@namiml/web-sdk 3.3.9 → 3.4.0-dev.202603232321

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.
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).NamiWebSdk={})}(this,(function(e){"use strict";(()=>{if("undefined"!=typeof globalThis)return;const e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")();Object.defineProperty(e,"globalThis",{value:e,writable:!0,enumerable:!1,configurable:!0})})(),"undefined"!=typeof Element&&"function"!=typeof Element.prototype.getAttributeNames&&(Element.prototype.getAttributeNames=function(){const e=this.attributes,t=new Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=e[n].name;return t});const t=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(){}};var n,i,a,r,o,s,l,d,u,c,h,m,f=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n},p=function(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)};const g=e=>"boolean"==typeof e?e:e?.capture??!1;const v=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,n){if(null==t)return;const i=g(n)?this.__captureEventListeners:this.__eventListeners;let a=i.get(e);if(void 0===a)a=new Map,i.set(e,a);else if(a.has(t))return;const r="object"==typeof n&&n?n:{};r.signal?.addEventListener("abort",(()=>this.removeEventListener(e,t,n))),a.set(t,r??{})}removeEventListener(e,t,n){if(null==t)return;const i=g(n)?this.__captureEventListeners:this.__eventListeners,a=i.get(e);void 0!==a&&(a.delete(t),a.size||i.delete(e))}dispatchEvent(e){const t=[this];let n=this.__eventTargetParent;if(e.composed)for(;n;)t.push(n),n=n.__eventTargetParent;else for(;n&&n!==this.__host;)t.push(n),n=n.__eventTargetParent;let i=!1,a=!1,r=0,o=null,s=null,l=null;const d=e.stopPropagation,u=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get:()=>o??s,...y},srcElement:{get:()=>e.target,...y},currentTarget:{get:()=>l,...y},eventPhase:{get:()=>r,...y},composedPath:{value:()=>t,...y},stopPropagation:{value:()=>{i=!0,d.call(e)},...y},stopImmediatePropagation:{value:()=>{a=!0,u.call(e)},...y}});const c=(t,n,i)=>{"function"==typeof t?t(e):"function"==typeof t?.handleEvent&&t.handleEvent(e),n.once&&i.delete(t)},h=()=>(l=null,r=0,!e.defaultPrevented),m=t.slice().reverse();o=this.__host&&e.composed?null:this;const f=e=>{for(s=this;s.__host&&e.includes(s.__host);)s=s.__host};for(const t of m){o||s&&s!==t.__host||f(m.slice(m.indexOf(t))),l=t,r=t===e.target?2:1;const n=t.__captureEventListeners.get(e.type);if(n)for(const[e,t]of n)if(c(e,t,n),a)return h();if(i)return h()}const p=e.bubbles?t:[this];s=null;for(const t of p){o||s&&t!==s.__host||f(p.slice(0,p.indexOf(t)+1)),l=t,r=t===e.target?2:3;const n=t.__eventListeners.get(e.type);if(n)for(const[e,t]of n)if(c(e,t,n),a)return h();if(i)return h()}return h()}},y={__proto__:null,enumerable:!0};Object.freeze(y);const b=(c=class{constructor(e,t={}){if(n.set(this,!1),i.set(this,!1),a.set(this,!1),r.set(this,!1),o.set(this,Date.now()),s.set(this,!1),l.set(this,void 0),d.set(this,void 0),u.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,0===arguments.length)throw new Error("The type argument must be specified");if("object"!=typeof t||!t)throw new Error('The "options" argument must be an object');const{bubbles:c,cancelable:h,composed:m}=t;f(this,n,!!h,"f"),f(this,i,!!c,"f"),f(this,a,!!m,"f"),f(this,l,`${e}`,"f"),f(this,d,null,"f"),f(this,u,!1,"f")}initEvent(e,t,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){f(this,r,!0,"f")}get target(){return p(this,d,"f")}get currentTarget(){return p(this,d,"f")}get srcElement(){return p(this,d,"f")}get type(){return p(this,l,"f")}get cancelable(){return p(this,n,"f")}get defaultPrevented(){return p(this,n,"f")&&p(this,r,"f")}get timeStamp(){return p(this,o,"f")}composedPath(){return p(this,u,"f")?[p(this,d,"f")]:[]}get returnValue(){return!p(this,n,"f")||!p(this,r,"f")}get bubbles(){return p(this,i,"f")}get composed(){return p(this,a,"f")}get eventPhase(){return p(this,u,"f")?c.AT_TARGET:c.NONE}get cancelBubble(){return p(this,s,"f")}set cancelBubble(e){e&&f(this,s,!0,"f")}stopPropagation(){f(this,s,!0,"f")}get isTrusted(){return!1}},n=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c.NONE=0,c.CAPTURING_PHASE=1,c.AT_TARGET=2,c.BUBBLING_PHASE=3,c);Object.defineProperties(b.prototype,{initEvent:y,stopImmediatePropagation:y,preventDefault:y,target:y,currentTarget:y,srcElement:y,type:y,cancelable:y,defaultPrevented:y,timeStamp:y,composedPath:y,returnValue:y,bubbles:y,composed:y,eventPhase:y,cancelBubble:y,stopPropagation:y,isTrusted:y});const w=(m=class extends b{constructor(e,t={}){super(e,t),h.set(this,void 0),f(this,h,t?.detail??null,"f")}initCustomEvent(e,t,n,i){throw new Error("Method not implemented.")}get detail(){return p(this,h,"f")}},h=new WeakMap,m);Object.defineProperties(w.prototype,{detail:y});const k=b,S=w;globalThis.Event??=k,globalThis.CustomEvent??=S;const _=new WeakMap,M=e=>{let t=_.get(e);return void 0===t&&_.set(e,t=new Map),t},E=class extends v{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(M(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){M(this).set(e,String(t))}removeAttribute(e){M(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 M(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 t(this);return this.__internals=e,e}getAttribute(e){return M(this).get(e)??null}},P=class extends E{};function T(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 x(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)}globalThis.litServerRoot??=Object.defineProperty(new P,"localName",{get:()=>"lit-server-root"}),"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=P),"function"==typeof SuppressedError&&SuppressedError;var A;!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"}(A||(A={}));const{NAMI_SDK_VERSION:C="3.3.9",NAMI_SDK_PACKAGE_VERSION:L="3.3.9",PRODUCTION:I="production",DEVELOPMENT:D="development",PLATFORM_ID_REQUIRED:R="Platform ID is required",DEVICE_ID_REQUIRED:N="Device ID is required",EXTERNAL_ID_REQUIRED:W="External ID is required",SDK_NOT_INITIALIZED:F="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:O="Campaign is not available",FLOW_SCREENS_NOT_AVAILABLE:$="Flow screens not available",UNABLE_TO_UPDATE_CDP_ID:j="Unable to update CDP id in anonymous mode",ANONYMOUS_MODE_ALREADY_ON:z="Anonymous mode is already turned on.",ANONYMOUS_MODE_ALREADY_OFF:H="Anonymous mode is already turned off.",ANONYMOUS_MODE_LOGIN_NOT_ALLOWED:B="Login/logout are not available in anonymous mode",SESSION_REQUIRED:U="Session is required",DEVICE_ID_NOT_SET:G="Nami Device ID is not set",AUTH_DEVICE:V="nami_auth_device",NAMI_CONFIGURATION:X="nami_configuration",NAMI_PROFILE:K="nami_profile",API_CONFIG:Y="api_config",API_CAMPAIGN_RULES:q="api_campaign_rules",API_PAYWALLS:J="api_paywalls",API_CAMPAIGN_SESSION_TIMESTAMP:Q="api_campaign_session_timestamp",API_PRODUCTS:Z="api_products",API_ACTIVE_ENTITLEMENTS:ee="api_active_entitlements",SERVER_NAMI_ENTITLEMENTS:te="server_active_entitlements",INITIAL_APP_CONFIG:ne="initial_app_config",INITIAL_CAMPAIGN_RULES:ie="initial_campaign_rules",INITIAL_PAYWALLS:ae="initial_paywalls",INITIAL_PRODUCTS:re="initial_products",LOCAL_NAMI_ENTITLEMENTS:oe="local_active_entitlements",CUSTOMER_ATTRIBUTES_KEY_PREFIX:se="nami_cmr_attributes_",NAMI_CUSTOMER_JOURNEY_STATE:le="nami_customer_journey_state",ANONYMOUS_MODE:de="nami_anonymous_mode_v2",ANONYMOUS_UUID:ue="nami_anonymous_uuid",KEY_SESSION_COUNTER:ce="nami_session_counter",INITIAL_SESSION_COUNTER_VALUE:he=1,NAMI_LAST_IMPRESSION_ID:me="nami_last_impression_id",NAMI_PURCHASE_IMPRESSION_ID:fe="nami_purchase_impression_id",NAMI_LAUNCH_ID:pe="nami_launch_id",NAMI_SESSION_ID:ge="nami_session_id",NAMI_LANGUAGE_CODE:ve="nami_language_code",NAMI_PURCHASE_CHANNEL:ye="nami_purchase_channel",API_VERSION:be="v3",BASE_URL_PATH:we=`sdk/${be}/platform`,BASE_URL:ke="https://app.namiml.com",BASE_STAGING_URL:Se="https://app-staging.namiml.com",CUSTOM_HOST_PREFIX:_e="namiAPIHost=",USE_STAGING_API:Me="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:Ee="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:Pe=":",VALIDATE_PRODUCT_GROUPS:Te="validateProductGroups",EXTENDED_PLATFORM:xe="extended-platform",EXTENDED_PLATFORM_VERSION:Ae="extended-platform-version",API_MAX_CALLS_LIMIT:Ce=2,API_RETRY_DELAY_SEC:Le=2,API_TIMEOUT_LIMIT:Ie=2e4,DEVICE_API_TIMEOUT_LIMIT:De=2e3,STATUS_SUCCESS:Re=200,STATUS_BAD_REQUEST:Ne=400,STATUS_NOT_FOUND:We=404,STATUS_CONFLICT:Fe=409,STATUS_INTERNAL_SERVER_ERROR:Oe=500,INITIAL_SUCCESS:$e="Initial success",RECONFIG_SUCCESS:je="Reconfig success",ALREADY_CONFIGURED:ze="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:He="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:Be="PaywallActionEvent",AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED:Ue="AvailableActiveEntitlementsChanged",CUSTOMER_JOURNEY_STATE_CHANGED:Ge="CustomerJourneyStateChanged",SKU_TEXT_REGEX:Ve=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:Xe=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,HTML_REGEX:Ke=/<\/?[a-z][\s\S]*>/i,SMART_TEXT_PATTERN:Ye="${",LIQUID_VARIABLE_REGEX:qe=/\${[A-Za-z0-9.]+}/g}={};var Je;e.LogLevel=void 0,(Je=e.LogLevel||(e.LogLevel={}))[Je.DEBUG=1]="DEBUG",Je[Je.INFO=2]="INFO",Je[Je.WARN=3]="WARN",Je[Je.ERROR=4]="ERROR";const Qe={debug:e.LogLevel.DEBUG,info:e.LogLevel.INFO,warn:e.LogLevel.WARN,error:e.LogLevel.ERROR};const Ze=new class{constructor(){this.currentLogLevel=e.LogLevel.DEBUG,this.setLogger=t=>{this.currentLogLevel=t?Qe[t]:e.LogLevel.WARN}}debug(t,...n){this.shouldLog(e.LogLevel.DEBUG)&&console.debug(this.formatMessage(e.LogLevel.DEBUG,t,...n))}info(t,...n){this.shouldLog(e.LogLevel.INFO)&&console.info(this.formatMessage(e.LogLevel.INFO,t,...n))}warn(t,...n){this.shouldLog(e.LogLevel.WARN)&&console.warn(this.formatMessage(e.LogLevel.WARN,t,...n))}error(t,...n){this.shouldLog(e.LogLevel.ERROR)&&console.error(this.formatMessage(e.LogLevel.ERROR,t,...n))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(t,n,...i){const a=e.LogLevel[t];return`[${(new Date).toISOString()}] [${a}] ${n} ${i=i.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}};function et(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 tt(e,t){return e===t||e!=e&&t!=t}function nt(e,t){for(var n=e.length;n--;)if(tt(e[n][0],t))return n;return-1}var it=Array.prototype.splice;function at(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])}}at.prototype.clear=function(){this.__data__=[],this.size=0},at.prototype.delete=function(e){var t=this.__data__,n=nt(t,e);return!(n<0)&&(n==t.length-1?t.pop():it.call(t,n,1),--this.size,!0)},at.prototype.get=function(e){var t=this.__data__,n=nt(t,e);return n<0?void 0:t[n][1]},at.prototype.has=function(e){return nt(this.__data__,e)>-1},at.prototype.set=function(e,t){var n=this.__data__,i=nt(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var rt="object"==typeof global&&global&&global.Object===Object&&global,ot="object"==typeof self&&self&&self.Object===Object&&self,st=rt||ot||Function("return this")(),lt=st.Symbol,dt=Object.prototype,ut=dt.hasOwnProperty,ct=dt.toString,ht=lt?lt.toStringTag:void 0;var mt=Object.prototype.toString;var ft="[object Null]",pt="[object Undefined]",gt=lt?lt.toStringTag:void 0;function vt(e){return null==e?void 0===e?pt:ft:gt&&gt in Object(e)?function(e){var t=ut.call(e,ht),n=e[ht];try{e[ht]=void 0;var i=!0}catch(e){}var a=ct.call(e);return i&&(t?e[ht]=n:delete e[ht]),a}(e):function(e){return mt.call(e)}(e)}function yt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var bt="[object AsyncFunction]",wt="[object Function]",kt="[object GeneratorFunction]",St="[object Proxy]";function _t(e){if(!yt(e))return!1;var t=vt(e);return t==wt||t==kt||t==bt||t==St}var Mt,Et=st["__core-js_shared__"],Pt=(Mt=/[^.]+$/.exec(Et&&Et.keys&&Et.keys.IE_PROTO||""))?"Symbol(src)_1."+Mt:"";var Tt=Function.prototype.toString;function xt(e){if(null!=e){try{return Tt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var At=/^\[object .+?Constructor\]$/,Ct=Function.prototype,Lt=Object.prototype,It=Ct.toString,Dt=Lt.hasOwnProperty,Rt=RegExp("^"+It.call(Dt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nt(e){return!(!yt(e)||(t=e,Pt&&Pt in t))&&(_t(e)?Rt:At).test(xt(e));var t}function Wt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Nt(n)?n:void 0}var Ft=Wt(st,"Map"),Ot=Wt(Object,"create");var $t=Object.prototype.hasOwnProperty;var jt=Object.prototype.hasOwnProperty;function zt(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 Ht(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 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])}}zt.prototype.clear=function(){this.__data__=Ot?Ot(null):{},this.size=0},zt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},zt.prototype.get=function(e){var t=this.__data__;if(Ot){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return $t.call(t,e)?t[e]:void 0},zt.prototype.has=function(e){var t=this.__data__;return Ot?void 0!==t[e]:jt.call(t,e)},zt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ot&&void 0===t?"__lodash_hash_undefined__":t,this},Bt.prototype.clear=function(){this.size=0,this.__data__={hash:new zt,map:new(Ft||at),string:new zt}},Bt.prototype.delete=function(e){var t=Ht(this,e).delete(e);return this.size-=t?1:0,t},Bt.prototype.get=function(e){return Ht(this,e).get(e)},Bt.prototype.has=function(e){return Ht(this,e).has(e)},Bt.prototype.set=function(e,t){var n=Ht(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Ut(e){var t=this.__data__=new at(e);this.size=t.size}Ut.prototype.clear=function(){this.__data__=new at,this.size=0},Ut.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ut.prototype.get=function(e){return this.__data__.get(e)},Ut.prototype.has=function(e){return this.__data__.has(e)},Ut.prototype.set=function(e,t){var n=this.__data__;if(n instanceof at){var i=n.__data__;if(!Ft||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Bt(i)}return n.set(e,t),this.size=n.size,this};function Gt(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Bt;++t<n;)this.add(e[t])}function Vt(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 Xt(e,t){return e.has(t)}Gt.prototype.add=Gt.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Gt.prototype.has=function(e){return this.__data__.has(e)};var Kt=1,Yt=2;function qt(e,t,n,i,a,r){var o=n&Kt,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var d=r.get(e),u=r.get(t);if(d&&u)return d==t&&u==e;var c=-1,h=!0,m=n&Yt?new Gt:void 0;for(r.set(e,t),r.set(t,e);++c<s;){var f=e[c],p=t[c];if(i)var g=o?i(p,f,c,t,e,r):i(f,p,c,e,t,r);if(void 0!==g){if(g)continue;h=!1;break}if(m){if(!Vt(t,(function(e,t){if(!Xt(m,t)&&(f===e||a(f,e,n,i,r)))return m.push(t)}))){h=!1;break}}else if(f!==p&&!a(f,p,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Jt=st.Uint8Array;function Qt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Zt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var en=1,tn=2,nn="[object Boolean]",an="[object Date]",rn="[object Error]",on="[object Map]",sn="[object Number]",ln="[object RegExp]",dn="[object Set]",un="[object String]",cn="[object Symbol]",hn="[object ArrayBuffer]",mn="[object DataView]",fn=lt?lt.prototype:void 0,pn=fn?fn.valueOf:void 0;function gn(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}var vn=Array.isArray;function yn(e,t,n){var i=t(e);return vn(e)?i:gn(i,n(e))}function bn(){return[]}var wn=Object.prototype.propertyIsEnumerable,kn=Object.getOwnPropertySymbols,Sn=kn?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}(kn(e),(function(t){return wn.call(e,t)})))}:bn;function _n(e){return null!=e&&"object"==typeof e}function Mn(e){return _n(e)&&"[object Arguments]"==vt(e)}var En=Object.prototype,Pn=En.hasOwnProperty,Tn=En.propertyIsEnumerable,xn=Mn(function(){return arguments}())?Mn:function(e){return _n(e)&&Pn.call(e,"callee")&&!Tn.call(e,"callee")};var An="object"==typeof e&&e&&!e.nodeType&&e,Cn=An&&"object"==typeof module&&module&&!module.nodeType&&module,Ln=Cn&&Cn.exports===An?st.Buffer:void 0,In=(Ln?Ln.isBuffer:void 0)||function(){return!1},Dn=9007199254740991,Rn=/^(?:0|[1-9]\d*)$/;function Nn(e,t){var n=typeof e;return!!(t=null==t?Dn:t)&&("number"==n||"symbol"!=n&&Rn.test(e))&&e>-1&&e%1==0&&e<t}var Wn=9007199254740991;function Fn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Wn}var On={};function $n(e){return function(t){return e(t)}}On["[object Float32Array]"]=On["[object Float64Array]"]=On["[object Int8Array]"]=On["[object Int16Array]"]=On["[object Int32Array]"]=On["[object Uint8Array]"]=On["[object Uint8ClampedArray]"]=On["[object Uint16Array]"]=On["[object Uint32Array]"]=!0,On["[object Arguments]"]=On["[object Array]"]=On["[object ArrayBuffer]"]=On["[object Boolean]"]=On["[object DataView]"]=On["[object Date]"]=On["[object Error]"]=On["[object Function]"]=On["[object Map]"]=On["[object Number]"]=On["[object Object]"]=On["[object RegExp]"]=On["[object Set]"]=On["[object String]"]=On["[object WeakMap]"]=!1;var jn="object"==typeof e&&e&&!e.nodeType&&e,zn=jn&&"object"==typeof module&&module&&!module.nodeType&&module,Hn=zn&&zn.exports===jn&&rt.process,Bn=function(){try{var e=zn&&zn.require&&zn.require("util").types;return e||Hn&&Hn.binding&&Hn.binding("util")}catch(e){}}(),Un=Bn&&Bn.isTypedArray,Gn=Un?$n(Un):function(e){return _n(e)&&Fn(e.length)&&!!On[vt(e)]},Vn=Object.prototype.hasOwnProperty;function Xn(e,t){var n=vn(e),i=!n&&xn(e),a=!n&&!i&&In(e),r=!n&&!i&&!a&&Gn(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):[],l=s.length;for(var d in e)!t&&!Vn.call(e,d)||o&&("length"==d||a&&("offset"==d||"parent"==d)||r&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||Nn(d,l))||s.push(d);return s}var Kn=Object.prototype;function Yn(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Kn)}function qn(e,t){return function(n){return e(t(n))}}var Jn=qn(Object.keys,Object),Qn=Object.prototype.hasOwnProperty;function Zn(e){return null!=e&&Fn(e.length)&&!_t(e)}function ei(e){return Zn(e)?Xn(e):function(e){if(!Yn(e))return Jn(e);var t=[];for(var n in Object(e))Qn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}function ti(e){return yn(e,ei,Sn)}var ni=1,ii=Object.prototype.hasOwnProperty;var ai=Wt(st,"DataView"),ri=Wt(st,"Promise"),oi=Wt(st,"Set"),si=Wt(st,"WeakMap"),li="[object Map]",di="[object Promise]",ui="[object Set]",ci="[object WeakMap]",hi="[object DataView]",mi=xt(ai),fi=xt(Ft),pi=xt(ri),gi=xt(oi),vi=xt(si),yi=vt;(ai&&yi(new ai(new ArrayBuffer(1)))!=hi||Ft&&yi(new Ft)!=li||ri&&yi(ri.resolve())!=di||oi&&yi(new oi)!=ui||si&&yi(new si)!=ci)&&(yi=function(e){var t=vt(e),n="[object Object]"==t?e.constructor:void 0,i=n?xt(n):"";if(i)switch(i){case mi:return hi;case fi:return li;case pi:return di;case gi:return ui;case vi:return ci}return t});var bi=1,wi="[object Arguments]",ki="[object Array]",Si="[object Object]",_i=Object.prototype.hasOwnProperty;function Mi(e,t,n,i,a,r){var o=vn(e),s=vn(t),l=o?ki:yi(e),d=s?ki:yi(t),u=(l=l==wi?Si:l)==Si,c=(d=d==wi?Si:d)==Si,h=l==d;if(h&&In(e)){if(!In(t))return!1;o=!0,u=!1}if(h&&!u)return r||(r=new Ut),o||Gn(e)?qt(e,t,n,i,a,r):function(e,t,n,i,a,r,o){switch(n){case mn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case hn:return!(e.byteLength!=t.byteLength||!r(new Jt(e),new Jt(t)));case nn:case an:case sn:return tt(+e,+t);case rn:return e.name==t.name&&e.message==t.message;case ln:case un:return e==t+"";case on:var s=Qt;case dn:var l=i&en;if(s||(s=Zt),e.size!=t.size&&!l)return!1;var d=o.get(e);if(d)return d==t;i|=tn,o.set(e,t);var u=qt(s(e),s(t),i,a,r,o);return o.delete(e),u;case cn:if(pn)return pn.call(e)==pn.call(t)}return!1}(e,t,l,n,i,a,r);if(!(n&bi)){var m=u&&_i.call(e,"__wrapped__"),f=c&&_i.call(t,"__wrapped__");if(m||f){var p=m?e.value():e,g=f?t.value():t;return r||(r=new Ut),a(p,g,n,i,r)}}return!!h&&(r||(r=new Ut),function(e,t,n,i,a,r){var o=n&ni,s=ti(e),l=s.length;if(l!=ti(t).length&&!o)return!1;for(var d=l;d--;){var u=s[d];if(!(o?u in t:ii.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;++d<l;){var p=e[u=s[d]],g=t[u];if(i)var v=o?i(g,p,u,t,e,r):i(p,g,u,e,t,r);if(!(void 0===v?p===g||a(p,g,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 Ei(e,t,n,i,a){return e===t||(null==e||null==t||!_n(e)&&!_n(t)?e!=e&&t!=t:Mi(e,t,n,i,Ei,a))}var Pi=1,Ti=2;function xi(e){return e==e&&!yt(e)}function Ai(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Ci(e){var t=function(e){for(var t=ei(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,xi(a)]}return t}(e);return 1==t.length&&t[0][2]?Ai(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],l=e[s],d=o[1];if(o[2]){if(void 0===l&&!(s in e))return!1}else{var u=new Ut;if(!Ei(d,l,Pi|Ti,i,u))return!1}}return!0}(n,0,t)}}var Li="[object Symbol]";function Ii(e){return"symbol"==typeof e||_n(e)&&vt(e)==Li}var Di=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/;function Ni(e,t){if(vn(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ii(e))||(Ri.test(e)||!Di.test(e)||null!=t&&e in Object(t))}var Wi="Expected a function";function Fi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Wi);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(Fi.Cache||Bt),n}Fi.Cache=Bt;var Oi,$i,ji,zi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hi=/\\(\\)?/g,Bi=(Oi=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(zi,(function(e,n,i,a){t.push(i?a.replace(Hi,"$1"):n||e)})),t},$i=Fi(Oi,(function(e){return 500===ji.size&&ji.clear(),e})),ji=$i.cache,$i);var Ui=1/0,Gi=lt?lt.prototype:void 0,Vi=Gi?Gi.toString:void 0;function Xi(e){if("string"==typeof e)return e;if(vn(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,Xi)+"";if(Ii(e))return Vi?Vi.call(e):"";var t=e+"";return"0"==t&&1/e==-Ui?"-0":t}function Ki(e){return null==e?"":Xi(e)}function Yi(e,t){return vn(e)?e:Ni(e,t)?[e]:Bi(Ki(e))}var qi=1/0;function Ji(e){if("string"==typeof e||Ii(e))return e;var t=e+"";return"0"==t&&1/e==-qi?"-0":t}function Qi(e,t){for(var n=0,i=(t=Yi(t,e)).length;null!=e&&n<i;)e=e[Ji(t[n++])];return n&&n==i?e:void 0}function Zi(e,t){return null!=e&&t in Object(e)}function ea(e,t){return null!=e&&function(e,t,n){for(var i=-1,a=(t=Yi(t,e)).length,r=!1;++i<a;){var o=Ji(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=a?r:!!(a=null==e?0:e.length)&&Fn(a)&&Nn(o,a)&&(vn(e)||xn(e))}(e,t,Zi)}var ta=1,na=2;function ia(e,t){return Ni(e)&&xi(t)?Ai(Ji(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:Qi(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?ea(n,e):Ei(t,i,ta|na)}}function aa(e){return e}function ra(e){return Ni(e)?(t=Ji(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Qi(t,e)}}(e);var t}function oa(e){return e!=e}function sa(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,oa,n)}(e,t,0)>-1}var la=oi&&1/Zt(new oi([,-0]))[1]==1/0?function(e){return new oi(e)}:function(){},da=200;function ua(e,t){return e&&e.length?function(e,t,n){var i=-1,a=sa,r=e.length,o=!0,s=[],l=s;if(r>=da){var d=t?null:la(e);if(d)return Zt(d);o=!1,a=Xt,l=new Gt}else l=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=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),s.push(u)}else a(l,c,n)||(l!==s&&l.push(c),s.push(u))}return s}(e,"function"==typeof(n=t)?n:null==n?aa:"object"==typeof n?vn(n)?ia(n[0],n[1]):Ci(n):ra(n)):[];var n}const ca=new class{constructor(){this.memoryStore={}}setDevice(e){this.setItem(V,e)}getDevice(){return this.getItem(V)}resetDevice(){this.resetItem(V)}getAnonymousMode(){return this.getItem(de)||!1}setAnonymousMode(e){this.setItem(de,e)}clearAnonymousMode(){this.resetItem(de)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setLanguageCode(e){this.setItem(ve,e||"en")}getLanguageCode(){return this.getItem(ve)||"en"}setCampaignRules(e,t){e!==ie?e!==q||0!==this.getCampaignCacheTtl()?this.setItem(e,t):this.memoryStore[q]=JSON.stringify(t):this.memoryStore[ie]=JSON.stringify(t)}getCampaignRules(e){if(e===ie)return this.memoryStore[ie]?JSON.parse(this.memoryStore[ie]):null;if(e===q){const e=this.memoryStore[q];if(null!=e)return JSON.parse(e);let t=this.getItem(q);if(null===t)return null;if("string"==typeof t)try{t=JSON.parse(t)}catch{return t}return this.isLegacyTimestampedCache(t)?t.data:t}return this.getItem(e)}setPaywalls(e,t){e!==ae?e!==J||0!==this.getCampaignCacheTtl()?this.setItem(e,t):this.memoryStore[J]=JSON.stringify(t):this.memoryStore[ae]=JSON.stringify(t)}getPaywalls(e){if(e===ae)return this.memoryStore[ae]?JSON.parse(this.memoryStore[ae]):null;if(e===J){const e=this.memoryStore[J];if(null!=e)return JSON.parse(e);let t=this.getItem(J);if(null===t)return null;if("string"==typeof t)try{t=JSON.parse(t)}catch{return t}return this.isLegacyTimestampedCache(t)?t.data:t}return this.getItem(e)}setActiveEntitlements(e,t){this.setItem(e,t)}getActiveEntitlements(e){return this.getItem(e)||[]}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(Z)??[];return ua(et([...this.getItem(re)??[],...e]),"sku_ref_id")}setNamiConfig(e){this.setItem(X,e)}getNamiConfig(){return this.getItem(X)}setCustomerAttribute(e,t){this.setItem(se+e,t)}getCustomerAttribute(e){return this.getItem(se+e)}getAllCustomerAttributes(){return Object.entries(localStorage).filter((([e])=>e.includes(se))).map((([e,t])=>e.replace(se,"")+":"+t))}getAllCustomerAttributesKeys(){return Object.keys(localStorage).filter((e=>e.includes(se))).map((e=>e.replace(se,"")))}clearCustomerAttribute(e){const t=se+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}clearAllCustomerAttributes(){Object.keys(localStorage).filter((e=>e.includes(se))).map((e=>this.resetItem(e)))}setNamiProfile(e){this.setItem(K,e)}getNamiProfile(){return this.getItem(K)}removeNamiProfile(){this.resetItem(K)}setCustomerJourneyState(e){this.setItem(le,e)}getCustomerJourneyState(){return this.getItem(le)}setSessionCounter(){const e=this.getItem(ce),t=e?parseInt(e):he||he;this.setItem(ce,t+1)}getSessionCounter(){const e=this.getItem(ce);return e?parseInt(e):he}setLastImpressionId(e){this.setItem(me,e)}getLastImpressionId(){return this.getItem(me)??""}setPurchaseImpression(){const e=this.getLastImpressionId()??"";this.setItem(fe,e)}getPurchaseImpression(){return this.getItem(fe)??""}setSessionId(e){e&&this.setItem(ge,e)}getSessionId(){return this.getItem(ge)??""}clearSessionId(){this.resetItem(ge)}setLaunchId(e){e&&this.setItem(pe,e)}getLaunchId(){return this.getItem(pe)??""}clearLaunchId(){this.resetItem(pe)}setPurchaseChannel(e){e&&this.setItem(ye,e)}getPurchaseChannel(){return this.getItem(ye)}getAnonymousUUID(){return this.getItem(ue)}setAnonymousUUID(e){this.setItem(ue,e)}clearAnonymousUUID(){this.resetItem(ue)}setApiCampaignSessionTimestamp(){this.setItem(Q,Date.now())}getApiCampaignSessionTimestamp(){return this.getItem(Q)}purgeApiCampaignCache(){this.resetItem(J),this.resetItem(q),this.resetItem(Q)}getCampaignCacheTtl(){const e=this.getAppConfig(Y)||this.getAppConfig(ne);return e?.campaign_cache_ttl??null}isLegacyTimestampedCache(e){return"object"==typeof e&&null!==e&&"cachedAt"in e&&"data"in e}setItem(e,t){let n;try{n=JSON.stringify(t)}catch(t){return void Ze.error(`Serialization failed for ${e}`,t)}try{localStorage.setItem(e,n)}catch(t){Ze.error("Error setting item in localStorage:",t),this.resetItem(e),this.memoryStore[e]=n}}getItem(e){try{const t=localStorage.getItem(e);if(null!==t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&Ze.error("Error getting item from localStorage:",e,": ",t)}const t=this.memoryStore[e];return null!=t?JSON.parse(t):null}resetItem(e){try{localStorage.removeItem(e)}catch(t){"undefined"!=typeof window&&Ze.error("Error removing item from localStorage:",e,": ",t)}delete this.memoryStore[e]}clear(){try{localStorage.clear()}catch(e){Ze.error("Error clearing localStorage:",e)}this.memoryStore={}}};class ha extends Error{constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class ma extends Error{}class fa extends ma{constructor(){super(),this.status=409,this.name="ConflictError",this.message="ConflictError: Server responded with conflict"}}class pa extends Error{constructor(){super(F)}}class ga extends Error{constructor(){super(R)}}class va extends Error{constructor(){super(N)}}class ya extends Error{constructor(){super(W)}}class ba extends Error{constructor(){super(O)}}class wa extends Error{constructor(){super($)}}class ka extends Error{constructor(){super(z)}}class Sa extends Error{constructor(){super(H)}}class _a extends Error{constructor(){super(H)}}class Ma extends Error{constructor(){super(j)}}class Ea extends ma{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class Pa extends ma{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class Ta extends ma{constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class xa extends ma{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const Aa=(e,t)=>{if(e==Ne)throw new Ea(t);if(e==We)throw new Pa(t);if(e==Fe)throw new fa;if(e>Ne&&e<Oe)throw new Ta(e,t);if(e>=Oe)throw new xa(t)};async function Ca(e,t,n=Ie,i=Ce){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(o.status==Fe)throw new fa;if(a++,a<=i){const e=1e3*(a+Le);return await new Promise((t=>setTimeout(t,e))),r()}throw new ha(o.status,`Request failed after ${i} retries`)}return o};return(await r()).json()}function La(e){let t=e.length;for(;--t>=0;)e[t]=0}const Ia=256,Da=286,Ra=30,Na=15,Wa=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Fa=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Oa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),$a=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ja=new Array(576);La(ja);const za=new Array(60);La(za);const Ha=new Array(512);La(Ha);const Ba=new Array(256);La(Ba);const Ua=new Array(29);La(Ua);const Ga=new Array(Ra);function Va(e,t,n,i,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=a,this.has_stree=e&&e.length}let Xa,Ka,Ya;function qa(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}La(Ga);const Ja=e=>e<256?Ha[e]:Ha[256+(e>>>7)],Qa=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Za=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Qa(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},er=(e,t,n)=>{Za(e,n[2*t],n[2*t+1])},tr=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},nr=(e,t,n)=>{const i=new Array(16);let a,r,o=0;for(a=1;a<=Na;a++)o=o+n[a-1]<<1,i[a]=o;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=tr(i[t]++,t))}},ir=e=>{let t;for(t=0;t<Da;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ra;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},ar=e=>{e.bi_valid>8?Qa(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},rr=(e,t,n,i)=>{const a=2*t,r=2*n;return e[a]<e[r]||e[a]===e[r]&&i[t]<=i[n]},or=(e,t,n)=>{const i=e.heap[n];let a=n<<1;for(;a<=e.heap_len&&(a<e.heap_len&&rr(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!rr(t,i,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=i},sr=(e,t,n)=>{let i,a,r,o,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,a=e.pending_buf[e.sym_buf+s++],0===i?er(e,a,t):(r=Ba[a],er(e,r+Ia+1,t),o=Wa[r],0!==o&&(a-=Ua[r],Za(e,a,o)),i--,r=Ja(i),er(e,r,n),o=Fa[r],0!==o&&(i-=Ga[r],Za(e,i,o)))}while(s<e.sym_next);er(e,256,t)},lr=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,r=t.stat_desc.elems;let o,s,l,d=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<r;o++)0!==n[2*o]?(e.heap[++e.heap_len]=d=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=d<2?++d:0,n[2*l]=1,e.depth[l]=0,e.opt_len--,a&&(e.static_len-=i[2*l+1]);for(t.max_code=d,o=e.heap_len>>1;o>=1;o--)or(e,n,o);l=r;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],or(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[2*l]=n[2*o]+n[2*s],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[2*o+1]=n[2*s+1]=l,e.heap[1]=l++,or(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,i=t.max_code,a=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let d,u,c,h,m,f,p=0;for(h=0;h<=Na;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,d=e.heap_max+1;d<573;d++)u=e.heap[d],h=n[2*n[2*u+1]+1]+1,h>l&&(h=l,p++),n[2*u+1]=h,u>i||(e.bl_count[h]++,m=0,u>=s&&(m=o[u-s]),f=n[2*u],e.opt_len+=f*(h+m),r&&(e.static_len+=f*(a[2*u+1]+m)));if(0!==p){do{for(h=l-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(h=l;0!==h;h--)for(u=e.bl_count[h];0!==u;)c=e.heap[--d],c>i||(n[2*c+1]!==h&&(e.opt_len+=(h-n[2*c+1])*n[2*c],n[2*c+1]=h),u--)}})(e,t),nr(n,d,e.bl_count)},dr=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,l=7,d=4;for(0===o&&(l=138,d=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)a=o,o=t[2*(i+1)+1],++s<l&&a===o||(s<d?e.bl_tree[2*a]+=s:0!==a?(a!==r&&e.bl_tree[2*a]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,r=a,0===o?(l=138,d=3):a===o?(l=6,d=3):(l=7,d=4))},ur=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,l=7,d=4;for(0===o&&(l=138,d=3),i=0;i<=n;i++)if(a=o,o=t[2*(i+1)+1],!(++s<l&&a===o)){if(s<d)do{er(e,a,e.bl_tree)}while(0!=--s);else 0!==a?(a!==r&&(er(e,a,e.bl_tree),s--),er(e,16,e.bl_tree),Za(e,s-3,2)):s<=10?(er(e,17,e.bl_tree),Za(e,s-3,3)):(er(e,18,e.bl_tree),Za(e,s-11,7));s=0,r=a,0===o?(l=138,d=3):a===o?(l=6,d=3):(l=7,d=4)}};let cr=!1;const hr=(e,t,n,i)=>{Za(e,0+(i?1:0),3),ar(e),Qa(e,n),Qa(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var mr=e=>{cr||((()=>{let e,t,n,i,a;const r=new Array(16);for(n=0,i=0;i<28;i++)for(Ua[i]=n,e=0;e<1<<Wa[i];e++)Ba[n++]=i;for(Ba[n-1]=i,a=0,i=0;i<16;i++)for(Ga[i]=a,e=0;e<1<<Fa[i];e++)Ha[a++]=i;for(a>>=7;i<Ra;i++)for(Ga[i]=a<<7,e=0;e<1<<Fa[i]-7;e++)Ha[256+a++]=i;for(t=0;t<=Na;t++)r[t]=0;for(e=0;e<=143;)ja[2*e+1]=8,e++,r[8]++;for(;e<=255;)ja[2*e+1]=9,e++,r[9]++;for(;e<=279;)ja[2*e+1]=7,e++,r[7]++;for(;e<=287;)ja[2*e+1]=8,e++,r[8]++;for(nr(ja,287,r),e=0;e<Ra;e++)za[2*e+1]=5,za[2*e]=tr(e,5);Xa=new Va(ja,Wa,257,Da,Na),Ka=new Va(za,Fa,0,Ra,Na),Ya=new Va(new Array(0),Oa,0,19,7)})(),cr=!0),e.l_desc=new qa(e.dyn_ltree,Xa),e.d_desc=new qa(e.dyn_dtree,Ka),e.bl_desc=new qa(e.bl_tree,Ya),e.bi_buf=0,e.bi_valid=0,ir(e)},fr=(e,t,n,i)=>{let a,r,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Ia;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),lr(e,e.l_desc),lr(e,e.d_desc),o=(e=>{let t;for(dr(e,e.dyn_ltree,e.l_desc.max_code),dr(e,e.dyn_dtree,e.d_desc.max_code),lr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*$a[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),a=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=a&&(a=r)):a=r=n+5,n+4<=a&&-1!==t?hr(e,t,n,i):4===e.strategy||r===a?(Za(e,2+(i?1:0),3),sr(e,ja,za)):(Za(e,4+(i?1:0),3),((e,t,n,i)=>{let a;for(Za(e,t-257,5),Za(e,n-1,5),Za(e,i-4,4),a=0;a<i;a++)Za(e,e.bl_tree[2*$a[a]+1],3);ur(e,e.dyn_ltree,t-1),ur(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),sr(e,e.dyn_ltree,e.dyn_dtree)),ir(e),i&&ar(e)},pr=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(Ba[n]+Ia+1)]++,e.dyn_dtree[2*Ja(t)]++),e.sym_next===e.sym_end),gr=e=>{Za(e,2,3),er(e,256,ja),(e=>{16===e.bi_valid?(Qa(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)},vr={_tr_init:mr,_tr_stored_block:hr,_tr_flush_block:fr,_tr_tally:pr,_tr_align:gr};var yr=(e,t,n,i)=>{let a=65535&e,r=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{a=a+t[i++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16};const br=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var wr=(e,t,n,i)=>{const a=br,r=i+n;e^=-1;for(let n=i;n<r;n++)e=e>>>8^a[255&(e^t[n])];return~e},kr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Sr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:_r,_tr_stored_block:Mr,_tr_flush_block:Er,_tr_tally:Pr,_tr_align:Tr}=vr,{Z_NO_FLUSH:xr,Z_PARTIAL_FLUSH:Ar,Z_FULL_FLUSH:Cr,Z_FINISH:Lr,Z_BLOCK:Ir,Z_OK:Dr,Z_STREAM_END:Rr,Z_STREAM_ERROR:Nr,Z_DATA_ERROR:Wr,Z_BUF_ERROR:Fr,Z_DEFAULT_COMPRESSION:Or,Z_FILTERED:$r,Z_HUFFMAN_ONLY:jr,Z_RLE:zr,Z_FIXED:Hr,Z_DEFAULT_STRATEGY:Br,Z_UNKNOWN:Ur,Z_DEFLATED:Gr}=Sr,Vr=258,Xr=262,Kr=42,Yr=113,qr=666,Jr=(e,t)=>(e.msg=kr[t],t),Qr=e=>2*e-(e>4?9:0),Zr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},eo=e=>{let t,n,i,a=e.w_size;t=e.hash_size,i=t;do{n=e.head[--i],e.head[i]=n>=a?n-a:0}while(--t);t=a,i=t;do{n=e.prev[--i],e.prev[i]=n>=a?n-a:0}while(--t)};let to=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const no=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},io=(e,t)=>{Er(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,no(e.strm)},ao=(e,t)=>{e.pending_buf[e.pending++]=t},ro=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},oo=(e,t,n,i)=>{let a=e.avail_in;return a>i&&(a=i),0===a?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),1===e.state.wrap?e.adler=yr(e.adler,t,a,n):2===e.state.wrap&&(e.adler=wr(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},so=(e,t)=>{let n,i,a=e.max_chain_length,r=e.strstart,o=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-Xr?e.strstart-(e.w_size-Xr):0,d=e.window,u=e.w_mask,c=e.prev,h=e.strstart+Vr;let m=d[r+o-1],f=d[r+o];e.prev_length>=e.good_match&&(a>>=2),s>e.lookahead&&(s=e.lookahead);do{if(n=t,d[n+o]===f&&d[n+o-1]===m&&d[n]===d[r]&&d[++n]===d[r+1]){r+=2,n++;do{}while(d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&r<h);if(i=Vr-(h-r),r=h-Vr,i>o){if(e.match_start=t,o=i,i>=s)break;m=d[r+o-1],f=d[r+o]}}}while((t=c[t&u])>l&&0!=--a);return o<=e.lookahead?o:e.lookahead},lo=e=>{const t=e.w_size;let n,i,a;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Xr)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),eo(e),i+=t),0===e.strm.avail_in)break;if(n=oo(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=to(e,e.ins_h,e.window[a+1]);e.insert&&(e.ins_h=to(e,e.ins_h,e.window[a+3-1]),e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Xr&&0!==e.strm.avail_in)},uo=(e,t)=>{let n,i,a,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,s=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a)break;if(a=e.strm.avail_out-a,i=e.strstart-e.block_start,n>i+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n<r&&(0===n&&t!==Lr||t===xr||n!==i+e.strm.avail_in))break;o=t===Lr&&n===i+e.strm.avail_in?1:0,Mr(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,no(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(oo(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==xr&&t!==Lr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(oo(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,r=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=r||(i||t===Lr)&&t!==xr&&0===e.strm.avail_in&&i<=a)&&(n=i>a?a:i,o=t===Lr&&0===e.strm.avail_in&&n===i?1:0,Mr(e,e.block_start,n,o),e.block_start+=n,no(e.strm)),o?3:1)},co=(e,t)=>{let n,i;for(;;){if(e.lookahead<Xr){if(lo(e),e.lookahead<Xr&&t===xr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-Xr&&(e.match_length=so(e,n)),e.match_length>=3)if(i=Pr(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=to(e,e.ins_h,e.window[e.strstart+1]);else i=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(io(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2},ho=(e,t)=>{let n,i,a;for(;;){if(e.lookahead<Xr){if(lo(e),e.lookahead<Xr&&t===xr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Xr&&(e.match_length=so(e,n),e.match_length<=5&&(e.strategy===$r||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,i=Pr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(io(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Pr(e,0,e.window[e.strstart-1]),i&&io(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Pr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2};function mo(e,t,n,i,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=a}const fo=[new mo(0,0,0,0,uo),new mo(4,4,8,4,co),new mo(4,5,16,8,co),new mo(4,6,32,32,co),new mo(4,4,16,16,ho),new mo(8,16,32,32,ho),new mo(8,16,128,128,ho),new mo(8,32,128,256,ho),new mo(32,128,258,1024,ho),new mo(32,258,258,4096,ho)];function po(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Gr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Zr(this.dyn_ltree),Zr(this.dyn_dtree),Zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Zr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const go=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Kr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Yr&&t.status!==qr?1:0},vo=e=>{if(go(e))return Jr(e,Nr);e.total_in=e.total_out=0,e.data_type=Ur;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Kr:Yr,e.adler=2===t.wrap?0:1,t.last_flush=-2,_r(t),Dr},yo=e=>{const t=vo(e);return t===Dr&&(e=>{e.window_size=2*e.w_size,Zr(e.head),e.max_lazy_match=fo[e.level].max_lazy,e.good_match=fo[e.level].good_length,e.nice_match=fo[e.level].nice_length,e.max_chain_length=fo[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0})(e.state),t},bo=(e,t,n,i,a,r)=>{if(!e)return Nr;let o=1;if(t===Or&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),a<1||a>9||n!==Gr||i<8||i>15||t<0||t>9||r<0||r>Hr||8===i&&1!==o)return Jr(e,Nr);8===i&&(i=9);const s=new po;return e.state=s,s.strm=e,s.status=Kr,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=a+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<a+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=r,s.method=n,yo(e)};var wo=(e,t)=>{if(go(e)||t>Ir||t<0)return e?Jr(e,Nr):Nr;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===qr&&t!==Lr)return Jr(e,0===e.avail_out?Fr:Nr);const i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(no(e),0===e.avail_out)return n.last_flush=-1,Dr}else if(0===e.avail_in&&Qr(t)<=Qr(i)&&t!==Lr)return Jr(e,Fr);if(n.status===qr&&0!==e.avail_in)return Jr(e,Fr);if(n.status===Kr&&0===n.wrap&&(n.status=Yr),n.status===Kr){let t=Gr+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=jr||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=i<<6,0!==n.strstart&&(t|=32),t+=31-t%31,ro(n,t),0!==n.strstart&&(ro(n,e.adler>>>16),ro(n,65535&e.adler)),e.adler=1,n.status=Yr,no(e),0!==n.pending)return n.last_flush=-1,Dr}if(57===n.status)if(e.adler=0,ao(n,31),ao(n,139),ao(n,8),n.gzhead)ao(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ao(n,255&n.gzhead.time),ao(n,n.gzhead.time>>8&255),ao(n,n.gzhead.time>>16&255),ao(n,n.gzhead.time>>24&255),ao(n,9===n.level?2:n.strategy>=jr||n.level<2?4:0),ao(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(ao(n,255&n.gzhead.extra.length),ao(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=wr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(ao(n,0),ao(n,0),ao(n,0),ao(n,0),ao(n,0),ao(n,9===n.level?2:n.strategy>=jr||n.level<2?4:0),ao(n,3),n.status=Yr,no(e),0!==n.pending)return n.last_flush=-1,Dr;if(69===n.status){if(n.gzhead.extra){let t=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let a=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=wr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=a,no(e),0!==n.pending)return n.last_flush=-1,Dr;t=0,i-=a}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>t&&(e.adler=wr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i)),no(e),0!==n.pending)return n.last_flush=-1,Dr;i=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,ao(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i)),no(e),0!==n.pending)return n.last_flush=-1,Dr;i=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,ao(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(no(e),0!==n.pending))return n.last_flush=-1,Dr;ao(n,255&e.adler),ao(n,e.adler>>8&255),e.adler=0}if(n.status=Yr,no(e),0!==n.pending)return n.last_flush=-1,Dr}if(0!==e.avail_in||0!==n.lookahead||t!==xr&&n.status!==qr){let i=0===n.level?uo(n,t):n.strategy===jr?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(lo(e),0===e.lookahead)){if(t===xr)return 1;break}if(e.match_length=0,n=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(io(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===zr?((e,t)=>{let n,i,a,r;const o=e.window;for(;;){if(e.lookahead<=Vr){if(lo(e),e.lookahead<=Vr&&t===xr)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(a=e.strstart-1,i=o[a],i===o[++a]&&i===o[++a]&&i===o[++a])){r=e.strstart+Vr;do{}while(i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&a<r);e.match_length=Vr-(r-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=Pr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(io(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2})(n,t):fo[n.level].func(n,t);if(3!==i&&4!==i||(n.status=qr),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),Dr;if(2===i&&(t===Ar?Tr(n):t!==Ir&&(Mr(n,0,0,!1),t===Cr&&(Zr(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),no(e),0===e.avail_out))return n.last_flush=-1,Dr}return t!==Lr?Dr:n.wrap<=0?Rr:(2===n.wrap?(ao(n,255&e.adler),ao(n,e.adler>>8&255),ao(n,e.adler>>16&255),ao(n,e.adler>>24&255),ao(n,255&e.total_in),ao(n,e.total_in>>8&255),ao(n,e.total_in>>16&255),ao(n,e.total_in>>24&255)):(ro(n,e.adler>>>16),ro(n,65535&e.adler)),no(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?Dr:Rr)},ko=(e,t)=>{let n=t.length;if(go(e))return Nr;const i=e.state,a=i.wrap;if(2===a||1===a&&i.status!==Kr||i.lookahead)return Nr;if(1===a&&(e.adler=yr(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){0===a&&(Zr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(n-i.w_size,n),0),t=e,n=i.w_size}const r=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,lo(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=to(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,lo(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=o,e.input=s,e.avail_in=r,i.wrap=a,Dr},So={deflateInit:(e,t)=>bo(e,t,Gr,15,8,Br),deflateInit2:bo,deflateReset:yo,deflateResetKeep:vo,deflateSetHeader:(e,t)=>go(e)||2!==e.state.wrap?Nr:(e.state.gzhead=t,Dr),deflate:wo,deflateEnd:e=>{if(go(e))return Nr;const t=e.state.status;return e.state=null,t===Yr?Jr(e,Wr):Dr},deflateSetDictionary:ko,deflateInfo:"pako deflate (from Nodeca project)"};const _o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Mo={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)_o(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,i=e.length;n<i;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,i=0,a=e.length;t<a;t++){let a=e[t];n.set(a,i),i+=a.length}return n}};let Eo=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Eo=!1}const Po=new Uint8Array(256);for(let e=0;e<256;e++)Po[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Po[254]=Po[254]=1;var To={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,i,a,r,o=e.length,s=0;for(a=0;a<o;a++)n=e.charCodeAt(a),55296==(64512&n)&&a+1<o&&(i=e.charCodeAt(a+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),a++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),r=0,a=0;r<s;a++)n=e.charCodeAt(a),55296==(64512&n)&&a+1<o&&(i=e.charCodeAt(a+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),a++)),n<128?t[r++]=n:n<2048?(t[r++]=192|n>>>6,t[r++]=128|63&n):n<65536?(t[r++]=224|n>>>12,t[r++]=128|n>>>6&63,t[r++]=128|63&n):(t[r++]=240|n>>>18,t[r++]=128|n>>>12&63,t[r++]=128|n>>>6&63,t[r++]=128|63&n);return t},buf2string:(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,a;const r=new Array(2*n);for(a=0,i=0;i<n;){let t=e[i++];if(t<128){r[a++]=t;continue}let o=Po[t];if(o>4)r[a++]=65533,i+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&i<n;)t=t<<6|63&e[i++],o--;o>1?r[a++]=65533:t<65536?r[a++]=t:(t-=65536,r[a++]=55296|t>>10&1023,r[a++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Eo)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n})(r,a)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+Po[e[n]]>t?n:t}};var xo=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Ao=Object.prototype.toString,{Z_NO_FLUSH:Co,Z_SYNC_FLUSH:Lo,Z_FULL_FLUSH:Io,Z_FINISH:Do,Z_OK:Ro,Z_STREAM_END:No,Z_DEFAULT_COMPRESSION:Wo,Z_DEFAULT_STRATEGY:Fo,Z_DEFLATED:Oo}=Sr;function $o(e){this.options=Mo.assign({level:Wo,method:Oo,chunkSize:16384,windowBits:15,memLevel:8,strategy:Fo},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xo,this.strm.avail_out=0;let n=So.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Ro)throw new Error(kr[n]);if(t.header&&So.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?To.string2buf(t.dictionary):"[object ArrayBuffer]"===Ao.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=So.deflateSetDictionary(this.strm,e),n!==Ro)throw new Error(kr[n]);this._dict_set=!0}}$o.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize;let a,r;if(this.ended)return!1;for(r=t===~~t?t:!0===t?Do:Co,"string"==typeof e?n.input=To.string2buf(e):"[object ArrayBuffer]"===Ao.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(r===Lo||r===Io)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(a=So.deflate(n,r),a===No)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),a=So.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ro;if(0!==n.avail_out){if(r>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},$o.prototype.onData=function(e){this.chunks.push(e)},$o.prototype.onEnd=function(e){e===Ro&&(this.result=Mo.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const jo=16209;var zo=function(e,t){let n,i,a,r,o,s,l,d,u,c,h,m,f,p,g,v,y,b,w,k,S,_,M,E;const P=e.state;n=e.next_in,M=e.input,i=n+(e.avail_in-5),a=e.next_out,E=e.output,r=a-(t-e.avail_out),o=a+(e.avail_out-257),s=P.dmax,l=P.wsize,d=P.whave,u=P.wnext,c=P.window,h=P.hold,m=P.bits,f=P.lencode,p=P.distcode,g=(1<<P.lenbits)-1,v=(1<<P.distbits)-1;e:do{m<15&&(h+=M[n++]<<m,m+=8,h+=M[n++]<<m,m+=8),y=f[h&g];t:for(;;){if(b=y>>>24,h>>>=b,m-=b,b=y>>>16&255,0===b)E[a++]=65535&y;else{if(!(16&b)){if(64&b){if(32&b){P.mode=16191;break e}e.msg="invalid literal/length code",P.mode=jo;break e}y=f[(65535&y)+(h&(1<<b)-1)];continue t}for(w=65535&y,b&=15,b&&(m<b&&(h+=M[n++]<<m,m+=8),w+=h&(1<<b)-1,h>>>=b,m-=b),m<15&&(h+=M[n++]<<m,m+=8,h+=M[n++]<<m,m+=8),y=p[h&v];;){if(b=y>>>24,h>>>=b,m-=b,b=y>>>16&255,16&b){if(k=65535&y,b&=15,m<b&&(h+=M[n++]<<m,m+=8,m<b&&(h+=M[n++]<<m,m+=8)),k+=h&(1<<b)-1,k>s){e.msg="invalid distance too far back",P.mode=jo;break e}if(h>>>=b,m-=b,b=a-r,k>b){if(b=k-b,b>d&&P.sane){e.msg="invalid distance too far back",P.mode=jo;break e}if(S=0,_=c,0===u){if(S+=l-b,b<w){w-=b;do{E[a++]=c[S++]}while(--b);S=a-k,_=E}}else if(u<b){if(S+=l+u-b,b-=u,b<w){w-=b;do{E[a++]=c[S++]}while(--b);if(S=0,u<w){b=u,w-=b;do{E[a++]=c[S++]}while(--b);S=a-k,_=E}}}else if(S+=u-b,b<w){w-=b;do{E[a++]=c[S++]}while(--b);S=a-k,_=E}for(;w>2;)E[a++]=_[S++],E[a++]=_[S++],E[a++]=_[S++],w-=3;w&&(E[a++]=_[S++],w>1&&(E[a++]=_[S++]))}else{S=a-k;do{E[a++]=E[S++],E[a++]=E[S++],E[a++]=E[S++],w-=3}while(w>2);w&&(E[a++]=E[S++],w>1&&(E[a++]=E[S++]))}break}if(64&b){e.msg="invalid distance code",P.mode=jo;break e}y=p[(65535&y)+(h&(1<<b)-1)]}}break}}while(n<i&&a<o);w=m>>3,n-=w,m-=w<<3,h&=(1<<m)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=a<o?o-a+257:257-(a-o),P.hold=h,P.bits=m};const Ho=15,Bo=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Uo=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Go=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vo=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Xo=(e,t,n,i,a,r,o,s)=>{const l=s.bits;let d,u,c,h,m,f,p=0,g=0,v=0,y=0,b=0,w=0,k=0,S=0,_=0,M=0,E=null;const P=new Uint16Array(16),T=new Uint16Array(16);let x,A,C,L=null;for(p=0;p<=Ho;p++)P[p]=0;for(g=0;g<i;g++)P[t[n+g]]++;for(b=l,y=Ho;y>=1&&0===P[y];y--);if(b>y&&(b=y),0===y)return a[r++]=20971520,a[r++]=20971520,s.bits=1,0;for(v=1;v<y&&0===P[v];v++);for(b<v&&(b=v),S=1,p=1;p<=Ho;p++)if(S<<=1,S-=P[p],S<0)return-1;if(S>0&&(0===e||1!==y))return-1;for(T[1]=0,p=1;p<Ho;p++)T[p+1]=T[p]+P[p];for(g=0;g<i;g++)0!==t[n+g]&&(o[T[t[n+g]]++]=g);if(0===e?(E=L=o,f=20):1===e?(E=Bo,L=Uo,f=257):(E=Go,L=Vo,f=0),M=0,g=0,p=v,m=r,w=b,k=0,c=-1,_=1<<b,h=_-1,1===e&&_>852||2===e&&_>592)return 1;for(;;){x=p-k,o[g]+1<f?(A=0,C=o[g]):o[g]>=f?(A=L[o[g]-f],C=E[o[g]-f]):(A=96,C=0),d=1<<p-k,u=1<<w,v=u;do{u-=d,a[m+(M>>k)+u]=x<<24|A<<16|C}while(0!==u);for(d=1<<p-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,g++,0==--P[p]){if(p===y)break;p=t[n+o[g]]}if(p>b&&(M&h)!==c){for(0===k&&(k=b),m+=v,w=p-k,S=1<<w;w+k<y&&(S-=P[w+k],!(S<=0));)w++,S<<=1;if(_+=1<<w,1===e&&_>852||2===e&&_>592)return 1;c=M&h,a[c]=b<<24|w<<16|m-r}}return 0!==M&&(a[m+M]=p-k<<24|64<<16),s.bits=b,0};const{Z_FINISH:Ko,Z_BLOCK:Yo,Z_TREES:qo,Z_OK:Jo,Z_STREAM_END:Qo,Z_NEED_DICT:Zo,Z_STREAM_ERROR:es,Z_DATA_ERROR:ts,Z_MEM_ERROR:ns,Z_BUF_ERROR:is,Z_DEFLATED:as}=Sr,rs=16180,os=16190,ss=16191,ls=16192,ds=16194,us=16199,cs=16200,hs=16206,ms=16209,fs=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function ps(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const gs=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<rs||t.mode>16211?1:0},vs=e=>{if(gs(e))return es;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=rs,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Jo},ys=e=>{if(gs(e))return es;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,vs(e)},bs=(e,t)=>{let n;if(gs(e))return es;const i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?es:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,ys(e))},ws=(e,t)=>{if(!e)return es;const n=new ps;e.state=n,n.strm=e,n.window=null,n.mode=rs;const i=bs(e,t);return i!==Jo&&(e.state=null),i};let ks,Ss,_s=!0;const Ms=e=>{if(_s){ks=new Int32Array(512),Ss=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Xo(1,e.lens,0,288,ks,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Xo(2,e.lens,0,32,Ss,0,e.work,{bits:5}),_s=!1}e.lencode=ks,e.lenbits=9,e.distcode=Ss,e.distbits=5},Es=(e,t,n,i)=>{let a;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),i>=r.wsize?(r.window.set(t.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(a=r.wsize-r.wnext,a>i&&(a=i),r.window.set(t.subarray(n-i,n-i+a),r.wnext),(i-=a)?(r.window.set(t.subarray(n-i,n),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=a))),0};var Ps=(e,t)=>{let n,i,a,r,o,s,l,d,u,c,h,m,f,p,g,v,y,b,w,k,S,_,M=0;const E=new Uint8Array(4);let P,T;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(gs(e)||!e.output||!e.input&&0!==e.avail_in)return es;n=e.state,n.mode===ss&&(n.mode=ls),o=e.next_out,a=e.output,l=e.avail_out,r=e.next_in,i=e.input,s=e.avail_in,d=n.hold,u=n.bits,c=s,h=l,_=Jo;e:for(;;)switch(n.mode){case rs:if(0===n.wrap){n.mode=ls;break}for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(2&n.wrap&&35615===d){0===n.wbits&&(n.wbits=15),n.check=0,E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0),d=0,u=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=ms;break}if((15&d)!==as){e.msg="unknown compression method",n.mode=ms;break}if(d>>>=4,u-=4,S=8+(15&d),0===n.wbits&&(n.wbits=S),S>15||S>n.wbits){e.msg="invalid window size",n.mode=ms;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&d?16189:ss,d=0,u=0;break;case 16181:for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(n.flags=d,(255&n.flags)!==as){e.msg="unknown compression method",n.mode=ms;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=ms;break}n.head&&(n.head.text=d>>8&1),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0)),d=0,u=0,n.mode=16182;case 16182:for(;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.head&&(n.head.time=d),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,E[2]=d>>>16&255,E[3]=d>>>24&255,n.check=wr(n.check,E,4,0)),d=0,u=0,n.mode=16183;case 16183:for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.head&&(n.head.xflags=255&d,n.head.os=d>>8),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0)),d=0,u=0,n.mode=16184;case 16184:if(1024&n.flags){for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.length=d,n.head&&(n.head.extra_len=d),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0)),d=0,u=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(m=n.length,m>s&&(m=s),m&&(n.head&&(S=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+m),S)),512&n.flags&&4&n.wrap&&(n.check=wr(n.check,i,m,r)),s-=m,r+=m,n.length-=m),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===s)break e;m=0;do{S=i[r+m++],n.head&&S&&n.length<65536&&(n.head.name+=String.fromCharCode(S))}while(S&&m<s);if(512&n.flags&&4&n.wrap&&(n.check=wr(n.check,i,m,r)),s-=m,r+=m,S)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===s)break e;m=0;do{S=i[r+m++],n.head&&S&&n.length<65536&&(n.head.comment+=String.fromCharCode(S))}while(S&&m<s);if(512&n.flags&&4&n.wrap&&(n.check=wr(n.check,i,m,r)),s-=m,r+=m,S)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(4&n.wrap&&d!==(65535&n.check)){e.msg="header crc mismatch",n.mode=ms;break}d=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=ss;break;case 16189:for(;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}e.adler=n.check=fs(d),d=0,u=0,n.mode=os;case os:if(0===n.havedict)return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=s,n.hold=d,n.bits=u,Zo;e.adler=n.check=1,n.mode=ss;case ss:if(t===Yo||t===qo)break e;case ls:if(n.last){d>>>=7&u,u-=7&u,n.mode=hs;break}for(;u<3;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}switch(n.last=1&d,d>>>=1,u-=1,3&d){case 0:n.mode=16193;break;case 1:if(Ms(n),n.mode=us,t===qo){d>>>=2,u-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=ms}d>>>=2,u-=2;break;case 16193:for(d>>>=7&u,u-=7&u;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if((65535&d)!=(d>>>16^65535)){e.msg="invalid stored block lengths",n.mode=ms;break}if(n.length=65535&d,d=0,u=0,n.mode=ds,t===qo)break e;case ds:n.mode=16195;case 16195:if(m=n.length,m){if(m>s&&(m=s),m>l&&(m=l),0===m)break e;a.set(i.subarray(r,r+m),o),s-=m,r+=m,l-=m,o+=m,n.length-=m;break}n.mode=ss;break;case 16196:for(;u<14;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(n.nlen=257+(31&d),d>>>=5,u-=5,n.ndist=1+(31&d),d>>>=5,u-=5,n.ncode=4+(15&d),d>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ms;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;u<3;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.lens[x[n.have++]]=7&d,d>>>=3,u-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,P={bits:n.lenbits},_=Xo(0,n.lens,0,19,n.lencode,0,n.work,P),n.lenbits=P.bits,_){e.msg="invalid code lengths set",n.mode=ms;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;M=n.lencode[d&(1<<n.lenbits)-1],g=M>>>24,v=M>>>16&255,y=65535&M,!(g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(y<16)d>>>=g,u-=g,n.lens[n.have++]=y;else{if(16===y){for(T=g+2;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(d>>>=g,u-=g,0===n.have){e.msg="invalid bit length repeat",n.mode=ms;break}S=n.lens[n.have-1],m=3+(3&d),d>>>=2,u-=2}else if(17===y){for(T=g+3;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=g,u-=g,S=0,m=3+(7&d),d>>>=3,u-=3}else{for(T=g+7;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=g,u-=g,S=0,m=11+(127&d),d>>>=7,u-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ms;break}for(;m--;)n.lens[n.have++]=S}}if(n.mode===ms)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=ms;break}if(n.lenbits=9,P={bits:n.lenbits},_=Xo(1,n.lens,0,n.nlen,n.lencode,0,n.work,P),n.lenbits=P.bits,_){e.msg="invalid literal/lengths set",n.mode=ms;break}if(n.distbits=6,n.distcode=n.distdyn,P={bits:n.distbits},_=Xo(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,P),n.distbits=P.bits,_){e.msg="invalid distances set",n.mode=ms;break}if(n.mode=us,t===qo)break e;case us:n.mode=cs;case cs:if(s>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=s,n.hold=d,n.bits=u,zo(e,h),o=e.next_out,a=e.output,l=e.avail_out,r=e.next_in,i=e.input,s=e.avail_in,d=n.hold,u=n.bits,n.mode===ss&&(n.back=-1);break}for(n.back=0;M=n.lencode[d&(1<<n.lenbits)-1],g=M>>>24,v=M>>>16&255,y=65535&M,!(g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(v&&!(240&v)){for(b=g,w=v,k=y;M=n.lencode[k+((d&(1<<b+w)-1)>>b)],g=M>>>24,v=M>>>16&255,y=65535&M,!(b+g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=b,u-=b,n.back+=b}if(d>>>=g,u-=g,n.back+=g,n.length=y,0===v){n.mode=16205;break}if(32&v){n.back=-1,n.mode=ss;break}if(64&v){e.msg="invalid literal/length code",n.mode=ms;break}n.extra=15&v,n.mode=16201;case 16201:if(n.extra){for(T=n.extra;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;M=n.distcode[d&(1<<n.distbits)-1],g=M>>>24,v=M>>>16&255,y=65535&M,!(g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(!(240&v)){for(b=g,w=v,k=y;M=n.distcode[k+((d&(1<<b+w)-1)>>b)],g=M>>>24,v=M>>>16&255,y=65535&M,!(b+g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=b,u-=b,n.back+=b}if(d>>>=g,u-=g,n.back+=g,64&v){e.msg="invalid distance code",n.mode=ms;break}n.offset=y,n.extra=15&v,n.mode=16203;case 16203:if(n.extra){for(T=n.extra;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ms;break}n.mode=16204;case 16204:if(0===l)break e;if(m=h-l,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ms;break}m>n.wnext?(m-=n.wnext,f=n.wsize-m):f=n.wnext-m,m>n.length&&(m=n.length),p=n.window}else p=a,f=o-n.offset,m=n.length;m>l&&(m=l),l-=m,n.length-=m;do{a[o++]=p[f++]}while(--m);0===n.length&&(n.mode=cs);break;case 16205:if(0===l)break e;a[o++]=n.length,l--,n.mode=cs;break;case hs:if(n.wrap){for(;u<32;){if(0===s)break e;s--,d|=i[r++]<<u,u+=8}if(h-=l,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?wr(n.check,a,h,o-h):yr(n.check,a,h,o-h)),h=l,4&n.wrap&&(n.flags?d:fs(d))!==n.check){e.msg="incorrect data check",n.mode=ms;break}d=0,u=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(4&n.wrap&&d!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=ms;break}d=0,u=0}n.mode=16208;case 16208:_=Qo;break e;case ms:_=ts;break e;case 16210:return ns;default:return es}return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=s,n.hold=d,n.bits=u,(n.wsize||h!==e.avail_out&&n.mode<ms&&(n.mode<hs||t!==Ko))&&Es(e,e.output,e.next_out,h-e.avail_out),c-=e.avail_in,h-=e.avail_out,e.total_in+=c,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?wr(n.check,a,h,e.next_out-h):yr(n.check,a,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===ss?128:0)+(n.mode===us||n.mode===ds?256:0),(0===c&&0===h||t===Ko)&&_===Jo&&(_=is),_},Ts={inflateReset:ys,inflateReset2:bs,inflateResetKeep:vs,inflateInit:e=>ws(e,15),inflateInit2:ws,inflate:Ps,inflateEnd:e=>{if(gs(e))return es;let t=e.state;return t.window&&(t.window=null),e.state=null,Jo},inflateGetHeader:(e,t)=>{if(gs(e))return es;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,Jo):es},inflateSetDictionary:(e,t)=>{const n=t.length;let i,a,r;return gs(e)?es:(i=e.state,0!==i.wrap&&i.mode!==os?es:i.mode===os&&(a=1,a=yr(a,t,n,0),a!==i.check)?ts:(r=Es(e,t,n,n),r?(i.mode=16210,ns):(i.havedict=1,Jo)))},inflateInfo:"pako inflate (from Nodeca project)"};var xs=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const As=Object.prototype.toString,{Z_NO_FLUSH:Cs,Z_FINISH:Ls,Z_OK:Is,Z_STREAM_END:Ds,Z_NEED_DICT:Rs,Z_STREAM_ERROR:Ns,Z_DATA_ERROR:Ws,Z_MEM_ERROR:Fs}=Sr;function Os(e){this.options=Mo.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xo,this.strm.avail_out=0;let n=Ts.inflateInit2(this.strm,t.windowBits);if(n!==Is)throw new Error(kr[n]);if(this.header=new xs,Ts.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=To.string2buf(t.dictionary):"[object ArrayBuffer]"===As.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Ts.inflateSetDictionary(this.strm,t.dictionary),n!==Is)))throw new Error(kr[n])}function $s(e,t){const n=new Os(t);if(n.push(e),n.err)throw n.msg||kr[n.err];return n.result}Os.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize,a=this.options.dictionary;let r,o,s;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Ls:Cs,"[object ArrayBuffer]"===As.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),r=Ts.inflate(n,o),r===Rs&&a&&(r=Ts.inflateSetDictionary(n,a),r===Is?r=Ts.inflate(n,o):r===Ws&&(r=Rs));n.avail_in>0&&r===Ds&&n.state.wrap>0&&0!==e[n.next_in];)Ts.inflateReset(n),r=Ts.inflate(n,o);switch(r){case Ns:case Ws:case Rs:case Fs:return this.onEnd(r),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||r===Ds))if("string"===this.options.to){let e=To.utf8border(n.output,n.next_out),t=n.next_out-e,a=To.buf2string(n.output,e);n.next_out=t,n.avail_out=i-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(a)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(r!==Is||0!==s){if(r===Ds)return r=Ts.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Os.prototype.onData=function(e){this.chunks.push(e)},Os.prototype.onEnd=function(e){e===Is&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Mo.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var js={Inflate:Os,inflate:$s,inflateRaw:function(e,t){return(t=t||{}).raw=!0,$s(e,t)},ungzip:$s,constants:Sr};const{Inflate:zs,inflate:Hs,inflateRaw:Bs,ungzip:Us}=js;var Gs=Us;const Vs=e=>{let t;if(e?.includes(Me))t=Se;else{const n=e?.find((e=>e.includes(_e)));t=n?n.split("=")[1]:ke}return t=t.replace(/\/$/,""),t+"/"+we},Xs=e=>{const t=ca.getAppConfig(Y)||ca.getAppConfig(ne);return t?.capabilities?.includes(e)??!1},Ks=()=>{const e=(()=>{const e=ca.getAppConfig(Y)||ca.getAppConfig(ne);return e?.campaign_cache_ttl??null})();if(null===e)return;if(0===e)return void ca.purgeApiCampaignCache();const t=ca.getApiCampaignSessionTimestamp();if(null===t)return;(Date.now()-t)/1e3>=e&&ca.purgeApiCampaignCache()},Ys=e=>{const t=!Xs(A.THIRD_PARTY_TRANSACTIONS);return e&&!t&&Ze.info(`[${e}] Your plan does not have purchase management features.`),t};function qs(e){try{const t=function(e){if("undefined"!=typeof Buffer)return new Uint8Array(Buffer.from(e,"base64"));const t=atob(e),n=t.length,i=new Uint8Array(n);for(let e=0;e<n;e++)i[e]=t.charCodeAt(e);return i}(e.trim()),n=Gs(t),i=(new TextDecoder).decode(n);return JSON.parse(i)}catch{return}}function Js(e,t,n){const i=n.value;return n.value=function(...e){if(!this.platformID)throw new ga;return i.apply(this,e)},n}function Qs(e,t,n){const i=n.value;return n.value=function(...e){const t=ca.getDevice();if(!t?.id)throw new va;return i.apply(this,e)},n}class Zs{get deviceID(){return ca.getDevice()?.id}constructor(){const e=ca.getNamiConfig();!this.platformID&&e&&this.configure(e)}static configure(e){this.instance.configure(e)}configure(e){this.baseURL=Vs(e.namiCommands),this.platformID=e.appPlatformID}async login(e){if(!e)throw new ya;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"});ca.setSessionCounter(),n.id&&ca.setSessionId(n.id)}async postImpression(e){const t=`device/${this.deviceID}/impression/`,n=await this.requestBodyAPI(t,e,"POST",!0);n.id&&ca.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,t,n){const i=`${this.baseURL}/${this.platformID}/`+e;return await Ca(i,void 0,t,n)}async requestBodyAPI(e,t,n="POST",i=!1,a,r){const o=`${this.baseURL}/${this.platformID}/`+e,s={method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:i};return await Ca(o,s,a,r)}}function el(e){return null!=e?.flow}var tl;Zs.instance=new Zs,T([Qs],Zs.prototype,"login",null),T([Qs],Zs.prototype,"logout",null),T([Qs],Zs.prototype,"startSession",null),T([Qs],Zs.prototype,"postImpression",null),T([Qs],Zs.prototype,"postConversion",null),T([Qs],Zs.prototype,"purchaseValidation",null),T([Js],Zs.prototype,"fetchAPI",null),T([Js],Zs.prototype,"requestBodyAPI",null),e.NamiCampaignRuleType=void 0,(tl=e.NamiCampaignRuleType||(e.NamiCampaignRuleType={})).DEFAULT="default",tl.LABEL="label",tl.UNKNOWN="unknown",tl.URL="url";const nl=()=>ca.getPaywalls(ae)??[],il=()=>ca.getPaywalls(J)??[],al=()=>ua(et([...il(),...nl()]),"id"),rl=e=>al().find((t=>t.id===e)),ol=e=>{const t=al(),n=new Set(t.map((e=>e.id)));return e.every((e=>n.has(e)))};function sl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ll,dl={exports:{}};var ul=(ll||(ll=1,function(e){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var i=n(18),a=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(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}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return 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}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return 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},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,i){void 0===i&&(i=!1);var a=e.getVersionPrecision(t),r=e.getVersionPrecision(n),o=Math.max(a,r),s=0,l=e.map([t,n],(function(t){var n=o-e.getVersionPrecision(t),i=t+new Array(n+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(s=o-Math.min(a,r)),o-=1;o>=s;){if(l[0][o]>l[1][o])return 1;if(l[0][o]===l[1][o]){if(o===s)return 0;o-=1}else if(l[0][o]<l[1][o])return-1}},e.map=function(e,t){var n,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)i.push(t(e[n]));return i},e.find=function(e,t){var n,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,i=e.length;n<i;n+=1){var a=e[n];if(t(a,n))return a}},e.assign=function(e){for(var t,n,i=e,a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(r));var s=function(){var e=r[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,n=r.length;t<n;t+=1)s();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=a,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"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"},t.BROWSER_MAP={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"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={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"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(91))&&i.__esModule?i:{default:i},r=n(18);function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var s=function(){function e(){}var t,n,i;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new a.default(e,t)},e.parse=function(e){return new a.default(e).getResult()},t=e,i=[{key:"BROWSER_MAP",get:function(){return r.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return r.ENGINE_MAP}},{key:"OS_MAP",get:function(){return r.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return r.PLATFORMS_MAP}}],(n=null)&&o(t.prototype,n),i&&o(t,i),e}();t.default=s,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var i=l(n(92)),a=l(n(93)),r=l(n(94)),o=l(n(95)),s=l(n(17));function l(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},i=0,a={},r=0;if(Object.keys(e).forEach((function(t){var o=e[t];"string"==typeof o?(a[t]=o,r+=1):"object"==typeof o&&(n[t]=o,i+=1)})),i>0){var o=Object.keys(n),l=s.default.find(o,(function(e){return t.isOS(e)}));if(l){var d=this.satisfies(n[l]);if(void 0!==d)return d}var u=s.default.find(o,(function(e){return t.isPlatform(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}}if(r>0){var h=Object.keys(a),m=s.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==m)return this.compareVersion(a[m])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),a=s.default.getBrowserTypeByAlias(i);return t&&a&&(i=a.toLowerCase()),i===n},t.compareVersion=function(e){var t=[0],n=e,i=!1,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(s.default.compareVersions(a,n,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=a.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=a.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=a.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=a.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=a.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=a.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=a.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=a.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=a.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=a.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=a.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=a.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=a.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=a.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=a.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=a.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=a.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=a.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=a.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=a.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=a.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=a.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=a.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=a.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=a.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=a.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=a.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:a.default.getFirstMatch(t,e),version:a.default.getSecondMatch(t,e)}}}];t.default=o,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=n(18),o=[{test:[/Roku\/DVP/],describe:function(e){var t=a.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:r.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=a.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=a.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=a.default.getWindowsVersionName(t);return{name:r.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:r.OS_MAP.iOS},n=a.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=a.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=a.default.getMacOSVersionName(t),i={name:r.OS_MAP.MacOS,version:t};return n&&(i.versionName=n),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=a.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:r.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=a.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=a.default.getAndroidVersionName(t),i={name:r.OS_MAP.Android,version:t};return n&&(i.versionName=n),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=a.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:r.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=a.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||a.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||a.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:r.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=a.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=a.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:r.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:r.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=a.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.PlayStation4,version:t}}}];t.default=o,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=n(18),o=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=a.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:r.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=a.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:r.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:r.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:r.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:r.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:r.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.tv}}}];t.default=o,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=n(18),o=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:r.ENGINE_MAP.Blink};var t=a.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:r.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:r.ENGINE_MAP.Trident},n=a.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:r.ENGINE_MAP.Presto},n=a.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:r.ENGINE_MAP.Gecko},n=a.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:r.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:r.ENGINE_MAP.WebKit},n=a.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=o,e.exports=t.default}})}(dl)),dl.exports),cl=sl(ul);const hl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},ml="function"==typeof hl.BigInt,fl=ml?hl.BigInt.bind(hl):void 0,pl=ml?fl("0xffffffffffffffffffffffffffffffff"):null,gl=ml?fl("0x100000000000000000000000000000000"):null,vl=ml?fl(0):null,yl=ml?fl(1):null,bl=ml?fl(8):null,wl=ml?fl(1e4):null,kl=16,Sl=1/kl,_l={tablet:"tablet",mobile:"phone",tv:"television",desktop:"desktop"},Ml=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:C,language:"en"};const t=cl.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:C,language:window.navigator.language};if(n.type&&(i.form_factor=_l[n.type]),n.model&&(i.device_model=n.model),e&&e.length>0){const t=(e=>{const t=e.find((e=>e.includes(Ee))),n={platform:"",version:""};if(t){const e=t.split(Pe);n.platform=e[1],n.version=e[2]}return n})(e);i.extended_platform=t.platform,i.extended_platform_version=t.version}return i},El=()=>{const e=ca.getNamiConfig();if(e&&e.formFactor)return e.formFactor;if("undefined"==typeof window)return _l.desktop;const t=cl.getParser(window.navigator.userAgent).getPlatform();return t.type?_l[t.type]:_l.desktop},Pl={"1280x720":.67,"1920x1080":1,"3840x2160":2,"7680x4320":4};const Tl=()=>{const{innerWidth:e,innerHeight:t}=window;return Math.min(e/1920,t/1080)||1};function xl(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Al(e){if(!ml||!pl)return Il(e);try{const t=pl,n=function(e){if(!fl)throw new Error("BigInt is not supported in this environment");const t=e.replace(/-/g,"");return fl("0x"+t)}(e);return Number(n)/Number(t)*100}catch(t){throw Ze.error(`Error calculating audience split position for UUID ${e}`,t),new Error(`Invalid UUID format: ${e}`)}}function Cl(e){if(!fl)throw new Error("BigInt is not supported in this environment");let t=e.toString(16).padStart(32,"0");t=t.substring(0,12)+"4"+t.substring(13);const n=3&parseInt(t[16],16)|8;return t=t.substring(0,16)+n.toString(16)+t.substring(17),t.slice(0,8)+"-"+t.slice(8,12)+"-"+t.slice(12,16)+"-"+t.slice(16,20)+"-"+t.slice(20)}function Ll(e,t=.5){if(!Number.isFinite(e))throw new Error("Invalid target");if(!Number.isFinite(t))throw new Error("Invalid tolerance");const n=Math.max(0,Math.min(100,e)),i=Math.max(0,Math.min(50,t)),a=e=>Math.round(100*e),r=Math.max(0,a(n-i)),o=Math.min(1e4,a(n+i));if(!(ml&&pl&&fl&&wl))return function(e,t){const n=Math.max(0,Math.min(100,e-t)),i=Math.min(100,Math.max(0,e+t));let a=xl(),r=Number.POSITIVE_INFINITY;const o=50;for(let e=0;e<o;e++){const e=xl(),t=Il(e);if(t>=n&&t<=i)return e;const o=Dl(t,n,i);o<r&&(r=o,a=e)}return a}(n,i);const s=pl,l=fl,d=wl,u=e=>s*l(e)/d,c=u(r),h=u(o);if(h<=c)return Cl(c);const m=c+function(e){if(!fl||null===gl||null===yl||null===vl||null===bl)throw new Error("BigInt is not supported in this environment");const t=fl,n=vl,i=yl,a=bl,r=gl;if(e<n)throw new Error("n must be non-negative");if(e===n)return n;const o=new Uint8Array(16),s=e+i,l=r/s*s-i;let d=0;for(;d<10;){crypto.getRandomValues(o);let e=n;for(const n of o)e=e<<a|t(n);if(e<=l)return e%s;d++}try{crypto.getRandomValues(o);let i=n;for(const e of o)i=i<<a|t(e);const r=i%s;return Ze.warn("randomBigInt: reached max rejection attempts, using modulo fallback",{n:e.toString(),attempts:d}),r}catch(e){throw Ze.error("randomBigInt: failed to generate random values",e),new Error("randomBigInt: unable to generate random value")}}(h-c);return Cl(m)}function Il(e){const t=function(e){const t=e.replace(/-/g,"").toLowerCase();if(!/^[0-9a-f]{32}$/.test(t))throw new Error(`Invalid UUID format: ${e}`);let n=0;for(let e=t.length-1;e>=0;e--){n=(n+parseInt(t[e],kl))*Sl}return n}(e);return 100*t}function Dl(e,t,n){return e<t?t-e:e>n?e-n:0}const Rl=e=>{try{return Boolean(new URL(e))}catch{return!1}},Nl=(e,t,n)=>e?e.flatMap((e=>{let i;if(i="string"==typeof n?e.segments.filter((e=>e.form_factors.some((e=>e.form_factor===n)))):e.segments,0===i.length)return[];const a=((e,t)=>{const n=[...e].sort(((e,t)=>e.split-t.split));for(const e of n)if(t<=e.split)return e;return n[n.length-1]})(i,t);return{form_factors:a.form_factors,paywall:a.paywall,flow:a.flow,segment:a.segment,split:a.split,conversion_event_type:a.conversion_event_type,conversion_event_url:a.conversion_event_url,rule:e.rule,name:e.name,type:e.type,value:e.value,external_segment:e.external_segment}})):[],Wl=()=>{const e=ca.getCampaignRules(q)??[],t=ca.getCampaignRules(ie)??[],n=El(),i=et([...e,...t]).filter((e=>e.form_factors?.some((e=>e.form_factor===n))));return ua(i,"rule")},Fl=e=>{const t=ca.getCampaignRules(e)??[],n=El();return et(t).filter((e=>e.form_factors?.some((e=>e.form_factor===n))))},Ol=()=>Fl(ie),$l=()=>Fl(q),jl=(t,n,i,a)=>{const r=t().find((t=>a?t.type==a&&t.value==i:t.type==e.NamiCampaignRuleType.DEFAULT));if(!r)return{};const o=n().find((e=>r?.paywall===e.id));return{campaign:r,paywall:o}},zl=(e,t)=>{const n=jl($l,il,e,t);if(n.campaign&&n.paywall)return{campaign:n.campaign,paywall:n.paywall};const i=jl(Ol,nl,e,t);return i.campaign&&i.paywall?{campaign:i.campaign,paywall:i.paywall}:n.campaign||n.paywall?{campaign:n.campaign,paywall:n.paywall}:{campaign:i.campaign,paywall:i.paywall}};var Hl,Bl="object"==typeof Reflect?Reflect:null,Ul=Bl&&"function"==typeof Bl.apply?Bl.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};Hl=Bl&&"function"==typeof Bl.ownKeys?Bl.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Gl=Number.isNaN||function(e){return e!=e};function Vl(){Vl.init.call(this)}Vl.EventEmitter=Vl,Vl.prototype._events=void 0,Vl.prototype._eventsCount=0,Vl.prototype._maxListeners=void 0;var Xl=10;function Kl(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Yl(e){return void 0===e._maxListeners?Vl.defaultMaxListeners:e._maxListeners}function ql(e,t,n,i){var a,r,o,s;if(Kl(n),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),o=r[t]),void 0===o)o=r[t]=n,++e._eventsCount;else if("function"==typeof o?o=r[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(a=Yl(e))>0&&o.length>a&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return e}function Jl(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ql(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},a=Jl.bind(i);return a.listener=n,i.wrapFn=a,a}function Zl(e,t,n){var i=e._events;if(void 0===i)return[];var a=i[t];return void 0===a?[]:"function"==typeof a?n?[a.listener||a]:[a]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(a):td(a,a.length)}function ed(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function td(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}Object.defineProperty(Vl,"defaultMaxListeners",{enumerable:!0,get:function(){return Xl},set:function(e){if("number"!=typeof e||e<0||Gl(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Xl=e}}),Vl.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Vl.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Gl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Vl.prototype.getMaxListeners=function(){return Yl(this)},Vl.prototype.emit=function(e){var t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var r=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw r.context=a,r}var o=i[e];if(void 0===o)return!1;if("function"==typeof o)Ul(o,this,t);else{var s=o.length,l=td(o,s);for(let e=0;e<s;++e)Ul(l[e],this,t)}return!0},Vl.prototype.addListener=function(e,t){return ql(this,e,t,!1)},Vl.prototype.on=Vl.prototype.addListener,Vl.prototype.prependListener=function(e,t){return ql(this,e,t,!0)},Vl.prototype.once=function(e,t){return Kl(t),this.on(e,Ql(this,e,t)),this},Vl.prototype.prependOnceListener=function(e,t){return Kl(t),this.prependListener(e,Ql(this,e,t)),this},Vl.prototype.removeListener=function(e,t){var n,i,a,r,o;if(Kl(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(a=-1,r=n.length-1;r>=0;r--)if(n[r]===t||n[r].listener===t){o=n[r].listener,a=r;break}if(a<0)return this;0===a?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,a),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},Vl.prototype.off=Vl.prototype.removeListener,Vl.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var a,r=Object.keys(n);for(i=0;i<r.length;++i)"removeListener"!==(a=r[i])&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},Vl.prototype.listeners=function(e){return Zl(this,e,!0)},Vl.prototype.rawListeners=function(e){return Zl(this,e,!1)},Vl.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):ed.call(e,t)},Vl.prototype.listenerCount=ed,Vl.prototype.eventNames=function(){return this._eventsCount>0?Hl(this._events):[]};class nd{constructor(){this.emitter=new Vl}static getInstance(){return this.instance||(this.instance=new nd),this.instance}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}emit(e,...t){this.emitter.emit(e,...t)}addListener(e,t){this.emitter.addListener(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}listeners(e){return this.emitter.listeners(e)}listenerCount(e){return this.emitter.listenerCount(e)}}class id{constructor(){this.disableCampaignUpdates=!1,this.currentFormFactor=El()}configure(e,t,n=[]){this.currentFormFactor=e,this.splitPosition=t,this.disableCampaignUpdates=n.includes("disableCampaignUpdates")}async fetchCampaignRules(e){const t=ca.getDevice();let n;return this.disableCampaignUpdates?(Ze.info("Campaign updates disabled by configuration. Skipping fetch."),[]):(n=t?.id?await this.getCampaigns(t.id):await this.getAnonymousCampaigns(),n=n?.filter((e=>e.paywall&&e.form_factors.some((e=>e.form_factor===this.currentFormFactor))||e.flow&&e.flow?.object?.form_factors?.some((e=>e.form_factor===this.currentFormFactor)))),n=n?.filter((t=>{if(t.paywall){const n=e.find((e=>e.id==t.paywall));if(n)return t}else if(t.flow)return t})),ca.setCampaignRules(q,n),ca.setApiCampaignSessionTimestamp(),this.invokeAvailableCampaignsResponseHandler(),n)}invokeAvailableCampaignsResponseHandler(){const e=nd.getInstance().listeners(He),t=Wl();e.forEach((e=>e(t)))}async getAnonymousCampaigns(e=C){const t=`campaign_rules/?sdk_version=${e}`;try{const e=await Zs.instance.fetchAPI(t);return Nl(e.results??[],this.splitPosition,this.currentFormFactor)}catch(e){const n=this.fallbackData();if(!n)throw Ze.error(Aa(e.status,t)),e;return n.results}}async getCampaigns(e){const t=`device/${e}/campaign_rules/`;let n;try{n=await Zs.instance.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw Ze.error(Aa(e.status,t)),e}return n?.results||[]}fallbackData(){const e=ca.getCampaignRules(q)||ca.getCampaignRules(ie);return e?{count:e.length,results:e}:null}}function ad(e,t){return Ei(e,t)}id.instance=new id;class rd{createOrUpdateDevice(e,t,n){const i=ca.getDevice();if(!i?.id){const i={...e,id:t??this.getAnonymousUUID()??xl()};return{id:i.id,device:this.createDevice(i,n)}}return this.isEqualDevices(i,e)?{id:i.id,device:Promise.resolve(i)}:(this.updateDevice(i.id,e),{id:i.id,device:null})}async createDevice(e,t){try{const n=0,i=await this.requestAPIData("device/",e,void 0,void 0,n);return i?(ca.setDevice(i),i):(Ze.info("Device creation returned null, switching to anon mode for this session"),t?.setInMemoryAnonymousMode(!0),null)}catch(e){if(console.error("Error creating device:",e),e instanceof ha)return Ze.info("Retry limit exceeded, switching to anon mode for this session"),t?.setInMemoryAnonymousMode(!0),null;throw e}}async updateDevice(e,t){const n=await this.requestAPIData(`device/${e}/`,t,"PUT");return n&&ca.setDevice(n),n}async updateDeviceField(e,t){const n={[e]:t},i=ca.getDevice();if(!i?.id)throw new va;const a=await this.requestAPIData(`device/${i.id}/`,n,"PATCH");return a&&ca.setDevice(a),a}async requestAPIData(e,t,n="POST",i=De,a){let r;try{r=await Zs.instance.requestBodyAPI(e,t,n,!1,i,a)}catch(t){if(t instanceof ga)throw t;if("device/"===e&&t instanceof ha)throw t;if(r=ca.getDevice(),!r)return Ze.error(Aa(t.status,e)),null}return r}isEqualDevices(e,t){const n={...e,...t},i=Object.keys(e).reduce(((e,t)=>(e[t]=n[t],e)),{});return ad(i,e)}getOrCreateAnonymousUUID(){let e=ca.getAnonymousUUID();return e||(e=xl(),ca.setAnonymousUUID(e)),e}getAnonymousUUID(){const e=ca.getAnonymousUUID();return e?(ca.clearAnonymousUUID(),e):null}}rd.instance=new rd;class od{async fetchProducts(){if(Xs(A.THIRD_PARTY_TRANSACTIONS))return[];let e;try{e=await Zs.instance.fetchAPI("products/")}catch(t){if(e=this.fallbackData(),!e)throw Ze.error(Aa(t.status,"products/")),t}return e?.results&&ca.setProducts(Z,e.results),e?.results||[]}fallbackData(){const e=ca.getProducts(Z)||ca.getProducts(re);return e?{count:e.length,results:e}:null}}od.instance=new od;class sd{async fetchPaywalls(){const e=ca.getDevice();let t;return t=e?.id?await this.getPaywalls(e.id):await this.getAnonymousPaywalls(),t&&ca.setPaywalls(J,t),t}async getAnonymousPaywalls(e=C){const t=`paywalls/?sdk_version=${e}`;let n=null;try{n=await Zs.instance.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw Ze.error(Aa(e.status,t)),e}return n?.results||[]}async getPaywalls(e){const t=`device/${e}/paywalls/`;let n;try{n=await Zs.instance.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw Ze.error(Aa(e.status,t)),e}return n?.results||[]}fallbackData(){const e=ca.getPaywalls(J)||ca.getPaywalls(ae);return e?{count:e.length,results:e}:null}}sd.instance=new sd;class ld{async fetchConfig(){let e;try{e=await Zs.instance.fetchAPI("config/")}catch(t){if(e=ca.getAppConfig(Y)||ca.getAppConfig(ne),!e)throw Ze.error(Aa(t.status,"config/")),t}return e&&ca.setAppConfig(Y,e),e}}ld.instance=new ld;let dd=null;function ud(){return!!ca.getAnonymousMode()||!!dd&&dd.isInMemoryAnonymousMode()}class cd{async startSession(){if(ud())Ze.debug("Skipping session start call - anonymous mode");else try{await Zs.instance.startSession(new Date)}catch(e){Ze.error("error on start session: ",e)}}}cd.instance=new cd;const hd={en:{nami_day:"day",nami_day_plural:"days",nami_week:"week",nami_week_plural:"weeks",nami_month:"month",nami_month_plural:"months",nami_year:"year",nami_year_plural:"years",nami_day_abbrev:"day",nami_day_abbrev_plural:"days",nami_week_abbrev:"wk",nami_week_abbrev_plural:"wks",nami_month_abbrev:"mo",nami_month_abbrev_plural:"mos",nami_year_abbrev:"yr",nami_year_abbrev_plural:"yrs",nami_daily:"daily",nami_weekly:"weekly",nami_biweekly:"bi-weekly",nami_monthly:"monthly",nami_bimonthly:"bi-monthly",nami_quarterly:"quarterly",nami_biannually:"bi-annually",nami_yearly:"yearly"},af:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dae",nami_week_abbrev:"week",nami_week_abbrev_plural:"weke",nami_month_abbrev:"ma",nami_month_abbrev_plural:"maande",nami_year_abbrev:"jr",nami_year_abbrev_plural:"jare",nami_daily:"daagliks",nami_weekly:"weekliks",nami_biweekly:"tweeweekliks",nami_monthly:"maandeliks",nami_bimonthly:"tweemaandeliks",nami_quarterly:"kwartaalliks",nami_biannually:"tweejaarliks",nami_yearly:"jaarliks"},am:{nami_day_abbrev:"ቀን",nami_day_abbrev_plural:"ቀናት",nami_week_abbrev:"ሳምንት",nami_week_abbrev_plural:"ሳምንታት",nami_month_abbrev:"ወር",nami_month_abbrev_plural:"ሞስ",nami_year_abbrev:"ዓመት",nami_year_abbrev_plural:"ዓመታት",nami_daily:"በየቀኑ",nami_weekly:"ሳምንታዊ",nami_biweekly:"በየሁለት ሳምንቱ",nami_monthly:"ወርሃዊ",nami_bimonthly:"በየሁለት ወሩ",nami_quarterly:"በየሩብ ዓመቱ",nami_biannually:"በየሁለት ዓመቱ",nami_yearly:"ዓመታዊ"},ar:{nami_day_abbrev:"يوم",nami_day_abbrev_plural:"أيام",nami_week_abbrev:"أسبوع",nami_week_abbrev_plural:"أسابيع",nami_month_abbrev:"شهر",nami_month_abbrev_plural:"موس",nami_year_abbrev:"سنة",nami_year_abbrev_plural:"سنوات",nami_daily:"يوميًا",nami_weekly:"أسبوعي",nami_biweekly:"كل أسبوعين",nami_monthly:"شهريا",nami_bimonthly:"كل شهرين",nami_quarterly:"ربع سنوي",nami_biannually:"مرتين في السنة",nami_yearly:"سنوي"},bg:{nami_day_abbrev:"ден",nami_day_abbrev_plural:"дни",nami_week_abbrev:"седмица",nami_week_abbrev_plural:"седмици",nami_month_abbrev:"мо",nami_month_abbrev_plural:"мос",nami_year_abbrev:"год.",nami_year_abbrev_plural:"години",nami_daily:"ежедневно",nami_weekly:"седмично",nami_biweekly:"двуседмичен",nami_monthly:"месечно",nami_bimonthly:"двумесечно",nami_quarterly:"тримесечно",nami_biannually:"два пъти годишно",nami_yearly:"годишно"},ca:{nami_day_abbrev:"dia",nami_day_abbrev_plural:"dies",nami_week_abbrev:"setmana",nami_week_abbrev_plural:"setmanes",nami_month_abbrev:"mes",nami_month_abbrev_plural:"mesos",nami_year_abbrev:"any",nami_year_abbrev_plural:"anys",nami_daily:"diàriament",nami_weekly:"setmanal",nami_biweekly:"quinzenal",nami_monthly:"mensual",nami_bimonthly:"bimensual",nami_quarterly:"trimestral",nami_biannually:"bianualment",nami_yearly:"anual"},cs:{nami_day_abbrev:"den",nami_day_abbrev_plural:"dny",nami_week_abbrev:"týden",nami_week_abbrev_plural:"týdny",nami_month_abbrev:"měsíc",nami_month_abbrev_plural:"měsíce",nami_year_abbrev:"rok",nami_year_abbrev_plural:"roky",nami_daily:"denní",nami_weekly:"týdně",nami_biweekly:"dvoutýdenní",nami_monthly:"měsíční",nami_bimonthly:"dvouměsíčník",nami_quarterly:"čtvrtletní",nami_biannually:"pololetně",nami_yearly:"roční"},de:{nami_day_abbrev:"Tag",nami_day_abbrev_plural:"Tage",nami_week_abbrev:"Woche",nami_week_abbrev_plural:"Wochen",nami_month_abbrev:"Monat",nami_month_abbrev_plural:"Monate",nami_year_abbrev:"Jahr",nami_year_abbrev_plural:"Jahre",nami_daily:"täglich",nami_weekly:"wöchentlich",nami_biweekly:"zweiwöchentlich",nami_monthly:"monatlich",nami_bimonthly:"zweimonatlich",nami_quarterly:"vierteljährlich",nami_biannually:"halbjährlich",nami_yearly:"jährlich"},el:{nami_day_abbrev:"ημέρα",nami_day_abbrev_plural:"ημέρες",nami_week_abbrev:"εβδομάδα",nami_week_abbrev_plural:"εβδομάδες",nami_month_abbrev:"μήνα",nami_month_abbrev_plural:"μην",nami_year_abbrev:"έτος",nami_year_abbrev_plural:"χρόνια",nami_daily:"καθημερινά",nami_weekly:"εβδομαδιαίος",nami_biweekly:"ανά δύο εβδομάδες",nami_monthly:"μηνιαίος",nami_bimonthly:"διμηνιαίος",nami_quarterly:"τριμηνιαίος",nami_biannually:"ανά εξάμηνο",nami_yearly:"ετήσια"},es:{nami_day_abbrev:"día",nami_day_abbrev_plural:"días",nami_week_abbrev:"semana",nami_week_abbrev_plural:"semanas",nami_month_abbrev:"mes",nami_month_abbrev_plural:"meses",nami_year_abbrev:"año",nami_year_abbrev_plural:"años",nami_daily:"diario",nami_weekly:"semanal",nami_biweekly:"quincenal",nami_monthly:"mensual",nami_bimonthly:"bimensual",nami_quarterly:"trimestral",nami_biannually:"semestral",nami_yearly:"anual"},et:{nami_day_abbrev:"päev",nami_day_abbrev_plural:"päevad",nami_week_abbrev:"nädal",nami_week_abbrev_plural:"nädalat",nami_month_abbrev:"kuu",nami_month_abbrev_plural:"kuud",nami_year_abbrev:"aasta",nami_year_abbrev_plural:"aastat",nami_daily:"iga päev",nami_weekly:"iganädalane",nami_biweekly:"iga kahe nädala tagant",nami_monthly:"igakuine",nami_bimonthly:"kaks korda kuus",nami_quarterly:"kvartali",nami_biannually:"kaks korda aastas",nami_yearly:"iga-aastane"},fa:{nami_day_abbrev:"روز",nami_day_abbrev_plural:"روزها",nami_week_abbrev:"هفته",nami_week_abbrev_plural:"هفته‌ها",nami_month_abbrev:"مو",nami_month_abbrev_plural:"موش",nami_year_abbrev:"سال",nami_year_abbrev_plural:"سال",nami_daily:"روزانه",nami_weekly:"هفتگی",nami_biweekly:"دو هفته‌ای",nami_monthly:"ماهانه",nami_bimonthly:"دوماهه",nami_quarterly:"سه ماهه",nami_biannually:"دوسالانه",nami_yearly:"سالانه"},fi:{nami_day_abbrev:"päivä",nami_day_abbrev_plural:"päivää",nami_week_abbrev:"viikko",nami_week_abbrev_plural:"viikkoa",nami_month_abbrev:"kuukausi",nami_month_abbrev_plural:"kuukaudet",nami_year_abbrev:"vuosi",nami_year_abbrev_plural:"vuotta",nami_daily:"päivittäin",nami_weekly:"viikoittain",nami_biweekly:"joka toinen viikko",nami_monthly:"kuukausittain",nami_bimonthly:"kahdesti kuussa",nami_quarterly:"neljännesvuosittain",nami_biannually:"puolivuosittain",nami_yearly:"vuosittain"},fr:{nami_day_abbrev:"jour",nami_day_abbrev_plural:"jours",nami_week_abbrev:"semaine",nami_week_abbrev_plural:"semaines",nami_month_abbrev:"mois",nami_month_abbrev_plural:"mois",nami_year_abbrev:"année",nami_year_abbrev_plural:"ans",nami_daily:"tous les jours",nami_weekly:"hebdomadaire",nami_biweekly:"bihebdomadaire",nami_monthly:"mensuel",nami_bimonthly:"bimensuel",nami_quarterly:"trimestriel",nami_biannually:"bisannuel",nami_yearly:"annuel"},hi:{nami_day_abbrev:"दिन",nami_day_abbrev_plural:"दिन",nami_week_abbrev:"सप्त",nami_week_abbrev_plural:"सप्त",nami_month_abbrev:"महीना",nami_month_abbrev_plural:"महीने",nami_year_abbrev:"साल",nami_year_abbrev_plural:"वर्षीय",nami_daily:"दैनिक",nami_weekly:"साप्ताहिक",nami_biweekly:"द्वि-साप्ताहिक",nami_monthly:"महीने के",nami_bimonthly:"द्विमासिक",nami_quarterly:"त्रैमासिक",nami_biannually:"द्वि-वार्षिक रूप",nami_yearly:"वार्षिक"},hr:{nami_day_abbrev:"dan",nami_day_abbrev_plural:"dana",nami_week_abbrev:"tjedan",nami_week_abbrev_plural:"tjedni",nami_month_abbrev:"mjesec",nami_month_abbrev_plural:"mjeseca",nami_year_abbrev:"god.",nami_year_abbrev_plural:"godina",nami_daily:"dnevno",nami_weekly:"tjedno",nami_biweekly:"dvotjedno",nami_monthly:"mjesečno",nami_bimonthly:"dvomjesečno",nami_quarterly:"tromjesečno",nami_biannually:"dvogodišnje",nami_yearly:"godišnje"},hu:{nami_day_abbrev:"nap",nami_day_abbrev_plural:"napok",nami_week_abbrev:"hét",nami_week_abbrev_plural:"hetek",nami_month_abbrev:"hónap",nami_month_abbrev_plural:"hónap",nami_year_abbrev:"év",nami_year_abbrev_plural:"év",nami_daily:"napi",nami_weekly:"heti",nami_biweekly:"kéthetente",nami_monthly:"havi",nami_bimonthly:"kéthavonta",nami_quarterly:"negyedévenként",nami_biannually:"félévente",nami_yearly:"évi"},id:{nami_day_abbrev:"hari",nami_day_abbrev_plural:"hari",nami_week_abbrev:"minggu",nami_week_abbrev_plural:"minggu",nami_month_abbrev:"bulan",nami_month_abbrev_plural:"bulan",nami_year_abbrev:"tahun",nami_year_abbrev_plural:"tahun",nami_daily:"sehari-hari",nami_weekly:"mingguan",nami_biweekly:"dua kali seminggu",nami_monthly:"bulanan",nami_bimonthly:"dua bulanan",nami_quarterly:"triwulanan",nami_biannually:"dua tahunan",nami_yearly:"tahunan"},it:{nami_day_abbrev:"giorno",nami_day_abbrev_plural:"giorni",nami_week_abbrev:"settimana",nami_week_abbrev_plural:"settimane",nami_month_abbrev:"mese",nami_month_abbrev_plural:"mesi",nami_year_abbrev:"anno",nami_year_abbrev_plural:"anni",nami_daily:"quotidiano",nami_weekly:"settimanale",nami_biweekly:"bisettimanale",nami_monthly:"mensile",nami_bimonthly:"bimestrale",nami_quarterly:"trimestrale",nami_biannually:"semestralmente",nami_yearly:"annuale"},he:{nami_day_abbrev:"יְוֹם",nami_day_abbrev_plural:"ימים",nami_week_abbrev:"שבוע",nami_week_abbrev_plural:"שבועות",nami_month_abbrev:"מו",nami_month_abbrev_plural:"מוֹס",nami_year_abbrev:"שנה",nami_year_abbrev_plural:"שנים",nami_daily:"יוֹמִי",nami_weekly:"שְׁבוּעִי",nami_biweekly:"דו-שבועי",nami_monthly:"יַרחוֹן",nami_bimonthly:"דו-חודשי",nami_quarterly:"רִבעוֹן",nami_biannually:"דו-שנתי",nami_yearly:"שְׁנָתִי"},ja:{nami_day_abbrev:"日",nami_day_abbrev_plural:"日",nami_week_abbrev:"週",nami_week_abbrev_plural:"週",nami_month_abbrev:"モ",nami_month_abbrev_plural:"モス",nami_year_abbrev:"年",nami_year_abbrev_plural:"年",nami_daily:"毎日",nami_weekly:"毎週",nami_biweekly:"隔週",nami_monthly:"毎月",nami_bimonthly:"隔月",nami_quarterly:"四半期ごと",nami_biannually:"半年ごと",nami_yearly:"毎年"},ko:{nami_day_abbrev:"낮",nami_day_abbrev_plural:"날",nami_week_abbrev:"주",nami_week_abbrev_plural:"주",nami_month_abbrev:"모",nami_month_abbrev_plural:"모스",nami_year_abbrev:"년",nami_year_abbrev_plural:"년",nami_daily:"일일",nami_weekly:"주간",nami_biweekly:"격주 간행물",nami_monthly:"월간 간행물",nami_bimonthly:"격월",nami_quarterly:"계간지",nami_biannually:"반년마다",nami_yearly:"매년"},lt:{nami_day_abbrev:"diena",nami_day_abbrev_plural:"dienos",nami_week_abbrev:"savaitė",nami_week_abbrev_plural:"savaitės",nami_month_abbrev:"mėn.",nami_month_abbrev_plural:"mėn.",nami_year_abbrev:"metai",nami_year_abbrev_plural:"metų",nami_daily:"kasdien",nami_weekly:"kas savaitę",nami_biweekly:"kas dvi savaites",nami_monthly:"mėnesinis",nami_bimonthly:"kas du mėnesius",nami_quarterly:"ketvirtinis",nami_biannually:"kas du kartus per metus",nami_yearly:"kasmet"},lv:{nami_day_abbrev:"diena",nami_day_abbrev_plural:"dienas",nami_week_abbrev:"nedēļa",nami_week_abbrev_plural:"nedēļas",nami_month_abbrev:"mēn.",nami_month_abbrev_plural:"mēn.",nami_year_abbrev:"gads",nami_year_abbrev_plural:"gadi",nami_daily:"ikdienas",nami_weekly:"iknedēļas",nami_biweekly:"divreiz nedēļā",nami_monthly:"ikmēneša",nami_bimonthly:"divreiz mēnesī",nami_quarterly:"ceturksnī",nami_biannually:"divreiz gadā",nami_yearly:"katru gadu"},ms:{nami_day_abbrev:"hari",nami_day_abbrev_plural:"hari",nami_week_abbrev:"minggu",nami_week_abbrev_plural:"minggu",nami_month_abbrev:"bulan",nami_month_abbrev_plural:"bulan",nami_year_abbrev:"tahun",nami_year_abbrev_plural:"tahun",nami_daily:"setiap hari",nami_weekly:"mingguan",nami_biweekly:"dua minggu sekali",nami_monthly:"bulanan",nami_bimonthly:"dua kali sebulan",nami_quarterly:"suku tahunan",nami_biannually:"dua kali setahun",nami_yearly:"tahunan"},nl:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dagen",nami_week_abbrev:"week",nami_week_abbrev_plural:"weken",nami_month_abbrev:"maand",nami_month_abbrev_plural:"maanden",nami_year_abbrev:"jaar",nami_year_abbrev_plural:"jaren",nami_daily:"dagelijks",nami_weekly:"wekelijks",nami_biweekly:"tweewekelijks",nami_monthly:"maandelijks",nami_bimonthly:"tweemaandelijks",nami_quarterly:"kwartaal",nami_biannually:"halfjaarlijks",nami_yearly:"jaarlijks"},no:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dager",nami_week_abbrev:"uke",nami_week_abbrev_plural:"uker",nami_month_abbrev:"måned",nami_month_abbrev_plural:"måned",nami_year_abbrev:"år",nami_year_abbrev_plural:"år",nami_daily:"daglig",nami_weekly:"ukentlig",nami_biweekly:"annenhver uke",nami_monthly:"månedlig",nami_bimonthly:"annenhver måned",nami_quarterly:"kvartalsvis",nami_biannually:"to ganger i året",nami_yearly:"årlig"},pl:{nami_day_abbrev:"dzień",nami_day_abbrev_plural:"dni",nami_week_abbrev:"tydzień",nami_week_abbrev_plural:"tygodni",nami_month_abbrev:"miesiąc",nami_month_abbrev_plural:"miesiące",nami_year_abbrev:"rok",nami_year_abbrev_plural:"lat",nami_daily:"codziennie",nami_weekly:"tygodnik",nami_biweekly:"dwutygodniowy",nami_monthly:"miesięczny",nami_bimonthly:"dwumiesięczny",nami_quarterly:"kwartalny",nami_biannually:"dwa razy w roku",nami_yearly:"rocznie"},pt:{nami_day_abbrev:"dia",nami_day_abbrev_plural:"dias",nami_week_abbrev:"semana",nami_week_abbrev_plural:"semanas",nami_month_abbrev:"mês",nami_month_abbrev_plural:"meses",nami_year_abbrev:"ano",nami_year_abbrev_plural:"anos",nami_daily:"diário",nami_weekly:"semanalmente",nami_biweekly:"quinzenal",nami_monthly:"mensal",nami_bimonthly:"bimestral",nami_quarterly:"trimestral",nami_biannually:"bianualmente",nami_yearly:"anual"},ro:{nami_day_abbrev:"zi",nami_day_abbrev_plural:"zile",nami_week_abbrev:"săptămână",nami_week_abbrev_plural:"săptămâni",nami_month_abbrev:"lună",nami_month_abbrev_plural:"luni",nami_year_abbrev:"an",nami_year_abbrev_plural:"ani",nami_daily:"zilnic",nami_weekly:"săptămânal",nami_biweekly:"la două săptămâni",nami_monthly:"lunar",nami_bimonthly:"bilunar",nami_quarterly:"trimestrial",nami_biannually:"bianual",nami_yearly:"anual"},ru:{nami_day_abbrev:"день",nami_day_abbrev_plural:"дни",nami_week_abbrev:"нед",nami_week_abbrev_plural:"недели",nami_month_abbrev:"мо",nami_month_abbrev_plural:"мос",nami_year_abbrev:"год",nami_year_abbrev_plural:"лет",nami_daily:"ежедневно",nami_weekly:"еженедельный",nami_biweekly:"раз в две недели",nami_monthly:"ежемесячно",nami_bimonthly:"раз в два месяца",nami_quarterly:"ежеквартальный",nami_biannually:"раз в два года",nami_yearly:"ежегодно"},sk:{nami_day_abbrev:"deň",nami_day_abbrev_plural:"dni",nami_week_abbrev:"týždeň",nami_week_abbrev_plural:"týždne",nami_month_abbrev:"mesiac",nami_month_abbrev_plural:"mesiacov",nami_year_abbrev:"rok",nami_year_abbrev_plural:"rokov",nami_daily:"denne",nami_weekly:"týždenne",nami_biweekly:"dvojtýždenne",nami_monthly:"mesačne",nami_bimonthly:"dvojmesačne",nami_quarterly:"štvrťročne",nami_biannually:"polročne",nami_yearly:"ročne"},sl:{nami_day_abbrev:"dan",nami_day_abbrev_plural:"dni",nami_week_abbrev:"teden",nami_week_abbrev_plural:"tedni",nami_month_abbrev:"mesec",nami_month_abbrev_plural:"mesecev",nami_year_abbrev:"leto",nami_year_abbrev_plural:"let",nami_daily:"dnevno",nami_weekly:"tedensko",nami_biweekly:"dvotedensko",nami_monthly:"mesečno",nami_bimonthly:"dvomesečno",nami_quarterly:"četrtletno",nami_biannually:"polletno",nami_yearly:"letno"},sr:{nami_day_abbrev:"дан",nami_day_abbrev_plural:"дана",nami_week_abbrev:"недеља",nami_week_abbrev_plural:"недеље",nami_month_abbrev:"мо",nami_month_abbrev_plural:"мос",nami_year_abbrev:"год.",nami_year_abbrev_plural:"године",nami_daily:"свакодневно",nami_weekly:"недељно",nami_biweekly:"двонедељно",nami_monthly:"месечно",nami_bimonthly:"двомесечно",nami_quarterly:"квартално",nami_biannually:"два пута годишње",nami_yearly:"годишње"},sv:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dagar",nami_week_abbrev:"vecka",nami_week_abbrev_plural:"veckor",nami_month_abbrev:"mån",nami_month_abbrev_plural:"månader",nami_year_abbrev:"år",nami_year_abbrev_plural:"år",nami_daily:"dagligen",nami_weekly:"varje vecka",nami_biweekly:"som utkommer varannan vecka",nami_monthly:"månatlig",nami_bimonthly:"varannan månad",nami_quarterly:"kvartalsvis",nami_biannually:"vartannat år",nami_yearly:"årlig"},sw:{nami_day_abbrev:"siku",nami_day_abbrev_plural:"siku",nami_week_abbrev:"wiki",nami_week_abbrev_plural:"wiki",nami_month_abbrev:"mwezi",nami_month_abbrev_plural:"miezi",nami_year_abbrev:"mwaka",nami_year_abbrev_plural:"miaka",nami_daily:"kila siku",nami_weekly:"kila wiki",nami_biweekly:"kila wiki mbili",nami_monthly:"kila mwezi",nami_bimonthly:"kila baada ya miezi miwili",nami_quarterly:"robo mwaka",nami_biannually:"kila baada ya miaka miwili",nami_yearly:"kila mwaka"},th:{nami_day_abbrev:"วัน",nami_day_abbrev_plural:"วัน",nami_week_abbrev:"สัปดาห์",nami_week_abbrev_plural:"สัปดาห์",nami_month_abbrev:"โม",nami_month_abbrev_plural:"มอส",nami_year_abbrev:"ปี",nami_year_abbrev_plural:"ปี",nami_daily:"รายวัน",nami_weekly:"รายสัปดาห์",nami_biweekly:"สองสัปดาห์ครั้ง",nami_monthly:"รายเดือน",nami_bimonthly:"สองเดือนครั้ง",nami_quarterly:"ไตรมาส",nami_biannually:"ทุกสองปี",nami_yearly:"ทุกปี"},tr:{nami_day_abbrev:"gün",nami_day_abbrev_plural:"günler",nami_week_abbrev:"hafta",nami_week_abbrev_plural:"haftalar",nami_month_abbrev:"ay",nami_month_abbrev_plural:"aylar",nami_year_abbrev:"yıl",nami_year_abbrev_plural:"yıllar",nami_daily:"günlük",nami_weekly:"haftalık",nami_biweekly:"iki haftada bir",nami_monthly:"aylık",nami_bimonthly:"iki ayda bir",nami_quarterly:"üç aylık",nami_biannually:"iki yılda bir",nami_yearly:"yıllık"},uk:{nami_day_abbrev:"день",nami_day_abbrev_plural:"дні",nami_week_abbrev:"тиждень",nami_week_abbrev_plural:"тижні",nami_month_abbrev:"місяць",nami_month_abbrev_plural:"мос",nami_year_abbrev:"рік",nami_year_abbrev_plural:"років",nami_daily:"щоденно",nami_weekly:"щотижня",nami_biweekly:"раз на два тижні",nami_monthly:"щомісяця",nami_bimonthly:"раз на два місяці",nami_quarterly:"щоквартально",nami_biannually:"раз на півроку",nami_yearly:"щорічно"},vi:{nami_day_abbrev:"ngày",nami_day_abbrev_plural:"ngày",nami_week_abbrev:"tuần",nami_week_abbrev_plural:"tuần",nami_month_abbrev:"tháng",nami_month_abbrev_plural:"tháng",nami_year_abbrev:"năm",nami_year_abbrev_plural:"năm",nami_daily:"hằng ngày",nami_weekly:"hàng tuần",nami_biweekly:"hai tuần một lần",nami_monthly:"hàng tháng",nami_bimonthly:"hai tháng một lần",nami_quarterly:"hàng quý",nami_biannually:"hai năm một lần",nami_yearly:"hàng năm"},"zh-CN":{nami_day_abbrev:"天",nami_day_abbrev_plural:"天",nami_week_abbrev:"周",nami_week_abbrev_plural:"周",nami_month_abbrev:"莫",nami_month_abbrev_plural:"莫斯",nami_year_abbrev:"年",nami_year_abbrev_plural:"年",nami_daily:"日常的",nami_weekly:"每周",nami_biweekly:"每两周一次",nami_monthly:"月度",nami_bimonthly:"双月刊",nami_quarterly:"季刊",nami_biannually:"每半年",nami_yearly:"每年"},"zh-TW":{nami_day_abbrev:"天",nami_day_abbrev_plural:"天",nami_week_abbrev:"週",nami_week_abbrev_plural:"週",nami_month_abbrev:"莫",nami_month_abbrev_plural:"莫斯",nami_year_abbrev:"年",nami_year_abbrev_plural:"年",nami_daily:"日常的",nami_weekly:"每週",nami_biweekly:"每兩週一次",nami_monthly:"每月",nami_bimonthly:"雙月刊",nami_quarterly:"季刊",nami_biannually:"每半年",nami_yearly:"每年"},zu:{nami_day_abbrev:"usuku",nami_day_abbrev_plural:"izinsuku",nami_week_abbrev:"isonto",nami_week_abbrev_plural:"amasonto",nami_month_abbrev:"inyanga",nami_month_abbrev_plural:"i-mos",nami_year_abbrev:"unyaka",nami_year_abbrev_plural:"iminyaka",nami_daily:"nsuku zonke",nami_weekly:"masonto onke",nami_biweekly:"kabili ngesonto",nami_monthly:"nyanga zonke",nami_bimonthly:"kabili ngenyanga",nami_quarterly:"njalo ngekota",nami_biannually:"kabili ngonyaka",nami_yearly:"minyaka yonke"}},md="en";function fd(e){const t=function(e){if(!e)return md;const t=e.trim();if(hd[t])return t;const n=t.toLowerCase(),i=n.split("-")[0];return hd[i]?i:"zh"===i?n.includes("tw")||n.includes("hk")?"zh-TW":"zh-CN":md}(ca.getLanguageCode()),n=hd[t]??hd[md];return n?.[e]??e}const pd=e=>"subscription"===e;function gd(e){if(pd(e?.product_type)){const t=yd(e);if(t.length>0)return t[0].billingPeriod}return null}function vd(e){const t=function(e){if(!e)return[];const t=e.offers.filter((e=>"promo"===e.offer_type));return bd(t,e.subscription_period)}(e).find((e=>0===e.priceAmountMicros));return t?.billingPeriod||null}function yd(e){if(!e)return[];return bd(e.offers.filter((e=>"default"===e.offer_type)),e.subscription_period)}function bd(e,t){return e.map((e=>wd(e,t)))}function wd(e,t){if(!e)return{};const n=e.promo_period?.count??t?.count,i=e.promo_period?.type??t?.type,a=e.promo_price?.price??e.price,r=e.promo_price?.currency??e.currency;return{priceAmountMicros:1e6*a,priceCurrencyCode:r,billingPeriod:i?`P${n}${i[0].toUpperCase()}`:"",formattedPrice:_d(r).format(a)}}function kd(e,t=!1,n=!1,i=!1,a=!1){if(!e)return null;const r=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!r)return null;const[o,s,l,d]=r.slice(1).map((e=>parseInt(e))),u=(e,t,n,i,r)=>{const o=(e=>a?`${e}_abbrev`:e)(r),s=(e=>a?`${e}_abbrev_plural`:`${e}_plural`)(r);let l=fd(o),d=fd(s);return a||l!==o||(l=fd(`${r}_abbrev`)),a||d!==s||(d=fd(`${r}_abbrev_plural`)),i?e.toString():n?1===e||t?l:d:1===e||t?`${e} ${l}`:`${e} ${d}`};switch(e.at(-1)){case"D":return u(d,t,n,i,"nami_day");case"W":return u(l,t,n,i,"nami_week");case"M":return u(s,t,n,i,"nami_month");case"Y":return u(o,t,n,i,"nami_year")}return null}function Sd(e){if(!e||e.length<2)return!1;const t=e.at(-1)?.toUpperCase();return"M"===t||"Y"===t}function _d(e){const t={maximumFractionDigits:2,minimumFractionDigits:0};try{return new Intl.NumberFormat(navigator.language,{...t,style:"currency",currency:e})}catch{return new Intl.NumberFormat(navigator.language,{...t,style:"currency",currency:"USD"})}}const Md=(e,t,n)=>e&&t&&n?n.format(e-t):null,Ed=(e,t,n,i)=>{if(e&&t&&n&&i){const a=100*(1-e/(n/i*t));return`${Math.round(a)}%`}return null},Pd=(e,t)=>{if(""==t)return;const n=parseInt(t)-1;return n>=0&&n<e?.length?e[n]:e?.find((e=>e.sku_ref_id===t))},Td=e=>Ad(e.priceAmountMicros)/xd(e.billingPeriod),xd=e=>{let t=parseInt(e[1]);return e.includes("Y")&&(t*=12),t},Ad=e=>e/1e6;function Cd(e){return parseFloat((Math.round(e)/100).toFixed(2))}const Ld=(e,t,n=[])=>({price:()=>Rd(e),name:()=>e?.name,title:()=>e?.name,description:()=>e?.description,duration:()=>Nd(e),durationSingular:()=>Nd(e,!0),period:()=>Nd(e,!1,!0),periodNumber:()=>Nd(e,!1,!1,!0),freeTrialDuration:()=>Wd(e),freeTrialDurationSingular:()=>Wd(e,!0),freeTrialPeriod:()=>Wd(e,!1,!0),freeTrialPeriodNumber:()=>Wd(e,!1,!1,!0),pricePerMonth:()=>Fd(e),pricePerMonthRounded:()=>Fd(e,!0),periodInMonths:()=>Od(e),durationInMonths:()=>$d(e),durationInMonthsSingular:()=>$d(e,!0),periodNumberInMonths:()=>jd(e),percentagePriceDifferenceFromSku:()=>zd(e,t,n),priceDifferenceFromSku:()=>Hd(e,t,n),promoEligible:()=>null===Bd(e)&&null!==Ud(e,t),freeTrialEligible:()=>null!==Bd(e),promo:()=>Ud(e,t)?.offer_ref_id,promoCode:()=>"XXXXX",promoPrice:()=>Gd(e,t)?.formattedPrice,promoPeriod:()=>Vd(e,t,!1,!0),promoPeriodNumber:()=>Vd(e,t,!1,!1,!0),promoDuration:()=>Vd(e,t),promoDurationSingular:()=>Vd(e,t,!0),introEligible:()=>!1,pricePerDay:()=>Xd(e),pricePerWeek:()=>Kd(e),pricePerWeekRounded:()=>Kd(e,!0),introductoryPrice:()=>Yd(e,t),introductoryPeriod:()=>qd(e,t,!1,!0),introductoryPeriodNumber:()=>qd(e,t,!1,!1,!0),introductoryDuration:()=>qd(e,t),introductoryDurationSingular:()=>qd(e,t,!0),introductoryPricePerMonth:()=>Jd(e,t),introductoryPricePerMonthRounded:()=>Jd(e,t,!0),durationAbbrev:()=>Nd(e,!1,!1,!1,!0),freeTrialDurationAbbrev:()=>Wd(e,!1,!1,!1,!0),introductoryDurationAbbrev:()=>qd(e,t,!1,!1,!1,!0),promoDurationAbbrev:()=>Vd(e,t,!1,!1,!1,!0),promoDurationPhase2Abbrev:()=>Vd(e,t,!0,!0,!1,!0),durationInMonthsAbbrev:()=>$d(e,!1,!1,!1,!0),durationSingularAbbrev:()=>Nd(e,!0,!1,!1,!0),freeTrialDurationSingularAbbrev:()=>Wd(e,!0,!1,!1,!0),introductoryDurationSingularAbbrev:()=>qd(e,t,!0,!1,!1,!0),promoDurationSingularAbbrev:()=>Vd(e,t,!0,!1,!1,!0),promoDurationSingularPhase2Abbrev:()=>Vd(e,t,!0,!0,!1,!0),durationInMonthsSingularAbbrev:()=>$d(e,!0,!1,!1,!0),periodAbbrev:()=>Nd(e,!1,!0,!1,!0),freeTrialPeriodAbbrev:()=>Wd(e,!1,!0,!1,!0),introductoryPeriodAbbrev:()=>qd(e,t,!1,!0,!1,!0),promoPeriodAbbrev:()=>Vd(e,t,!1,!0,!1,!0),promoPeriodPhase2Abbrev:()=>Vd(e,t,!1,!0,!0,!0),periodInMonthsAbbrev:()=>$d(e,!1,!0,!1,!0),periodly:()=>function(e){if(!e)return null;const t=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!t)return null;const[,n,i,a,r]=t,o=void 0!==n?parseInt(n,10):0,s=void 0!==i?parseInt(i,10):0,l=void 0!==a?parseInt(a,10):0;return(void 0!==r?parseInt(r,10):0)>0?null:l>0?1===l?fd("nami_weekly"):2===l?fd("nami_biweekly"):null:s>0?fd(1===s?"nami_monthly":2===s?"nami_bimonthly":3===s?"nami_quarterly":6===s?"nami_biannually":12===s?"nami_yearly":"nami_monthly"):o>0?fd("nami_yearly"):null}(gd(e)),iso_subscription_duration:()=>Zd(e),invalid:()=>!1,unavailable:()=>!1}),Id=()=>Object.keys(Ld({})),Dd=(e,t,n,i=[])=>{if(!t)return null;const a=Ld(t,n,i);return a[e]?a[e]():null},Rd=e=>{const t=yd(e);return t&&t.length?t[0].formattedPrice:null},Nd=(e,t,n,i,a)=>kd(gd(e),t,n,i,a),Wd=(e,t,n,i,a)=>kd(vd(e),t,n,i,a),Fd=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=Td(n[0]);return i?_d(n[0].priceCurrencyCode).format(t?Math.round(i):i):null},Od=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=n[0].billingPeriod;if(!Sd(i))return null;return kd("P1Y"===i?"P12M":i,!1,!1,!1,t)},$d=(e,t,n,i,a)=>{const r=yd(e);if(!r||0===r.length)return null;const o=r[0].billingPeriod;if(!Sd(o))return null;return kd("P1Y"===o?"P12M":o,t,n,i,a)},jd=e=>{if(!e)return 0;const t=yd(e);return t&&t.length?xd(t[0].billingPeriod):0},zd=(e,t,n=[])=>{const i=yd(e);if(!i||0===i.length)return null;const a=Pd(n,t??"")?.product_details;if(!t||!a)return Ed(Cd(i[0].priceAmountMicros),jd(e));const r=yd(a);return Ed(Cd(i[0].priceAmountMicros),jd(e),r?.length>0?Cd(r[0].priceAmountMicros):0,jd(a))},Hd=(e,t,n=[])=>{const i=yd(e);if(!i||0===i.length)return null;const a=Pd(n,t??"")?.product_details;if(!t||!a)return Md(Td(i[0]));const r=yd(a);return Md(Td(i[0]),Td(r[0]),_d(r[0].priceCurrencyCode))},Bd=e=>vd(e),Ud=(e,t)=>{if(!e)return null;const n=e.offers.filter((e=>"promo"===e.offer_type));if(!t)return n[0]||null;const i=n[parseInt(t)];return i?i||null:n.find((e=>e.offer_ref_id===t))||null},Gd=(e,t)=>{if(!e)return null;return wd(Ud(e,t),e.subscription_period)},Vd=(e,t,n,i,a,r)=>{const o=Gd(e,t);return kd(o?.billingPeriod||null,n,i,a,r)},Xd=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=Ad(n[0].priceAmountMicros)/(e=>{const t=xd(e);return t?30.437*t:1})(n[0].billingPeriod);return i?_d(n[0].priceCurrencyCode).format(i):null},Kd=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=Ad(n[0].priceAmountMicros)/(e=>{const t=xd(e);return t?52*t/12:1})(n[0].billingPeriod);return i?_d(n[0].priceCurrencyCode).format(t?Math.round(i):i):null},Yd=(e,t)=>{const n=Qd(e,t);return n?.formattedPrice||null},qd=(e,t,n,i,a,r)=>{const o=Qd(e,t);return kd(o?.billingPeriod||null,n,i,a,r)},Jd=(e,t,n)=>{const i=Qd(e,t);if(!i)return;const a=Ad(i.priceAmountMicros),r=xd(i.billingPeriod),o=n?Math.round(a/r):a/r;return _d(i.priceCurrencyCode).format(o)},Qd=(e,t)=>{if(!e)return null;let n;return t?(n=e.offers[parseInt(t)],n||(n=e.offers.find((e=>e.offer_ref_id===t))||null)):n=e.offers[0],wd(n,e.subscription_period)},Zd=e=>{const t=gd(e);return t?"P7D"===t?"P1W":t:null};function eu(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:function(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(a);++i<a;)r[i]=e[i+t];return r}(e,t,n)}var tu=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function nu(e){return tu.test(e)}var iu="\\ud800-\\udfff",au="["+iu+"]",ru="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",ou="\\ud83c[\\udffb-\\udfff]",su="[^"+iu+"]",lu="(?:\\ud83c[\\udde6-\\uddff]){2}",du="[\\ud800-\\udbff][\\udc00-\\udfff]",uu="(?:"+ru+"|"+ou+")"+"?",cu="[\\ufe0e\\ufe0f]?",hu=cu+uu+("(?:\\u200d(?:"+[su,lu,du].join("|")+")"+cu+uu+")*"),mu="(?:"+[su+ru+"?",ru,lu,du,au].join("|")+")",fu=RegExp(ou+"(?="+ou+")|"+mu+hu,"g");function pu(e){return nu(e)?function(e){return e.match(fu)||[]}(e):function(e){return e.split("")}(e)}var gu,vu=(gu="toUpperCase",function(e){var t=nu(e=Ki(e))?pu(e):void 0,n=t?t[0]:e.charAt(0),i=t?eu(t,1).join(""):e.slice(1);return n[gu]()+i});var yu,bu=(yu={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},function(e){return null==yu?void 0:yu[e]}),wu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ku=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var Su=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var _u=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Mu="\\ud800-\\udfff",Eu="\\u2700-\\u27bf",Pu="a-z\\xdf-\\xf6\\xf8-\\xff",Tu="A-Z\\xc0-\\xd6\\xd8-\\xde",xu="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",Au="["+xu+"]",Cu="\\d+",Lu="["+Eu+"]",Iu="["+Pu+"]",Du="[^"+Mu+xu+Cu+Eu+Pu+Tu+"]",Ru="(?:\\ud83c[\\udde6-\\uddff]){2}",Nu="[\\ud800-\\udbff][\\udc00-\\udfff]",Wu="["+Tu+"]",Fu="(?:"+Iu+"|"+Du+")",Ou="(?:"+Wu+"|"+Du+")",$u="(?:['’](?:d|ll|m|re|s|t|ve))?",ju="(?:['’](?:D|LL|M|RE|S|T|VE))?",zu="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Hu="[\\ufe0e\\ufe0f]?",Bu=Hu+zu+("(?:\\u200d(?:"+["[^"+Mu+"]",Ru,Nu].join("|")+")"+Hu+zu+")*"),Uu="(?:"+[Lu,Ru,Nu].join("|")+")"+Bu,Gu=RegExp([Wu+"?"+Iu+"+"+$u+"(?="+[Au,Wu,"$"].join("|")+")",Ou+"+"+ju+"(?="+[Au,Wu+Fu,"$"].join("|")+")",Wu+"?"+Fu+"+"+$u,Wu+"+"+ju,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cu,Uu].join("|"),"g");function Vu(e,t,n){return e=Ki(e),void 0===t?function(e){return _u.test(e)}(e)?function(e){return e.match(Gu)||[]}(e):function(e){return e.match(Su)||[]}(e):e.match(t)||[]}var Xu=RegExp("['’]","g");var Ku,Yu=(Ku=function(e,t,n){return t=t.toLowerCase(),e+(n?vu(Ki(t).toLowerCase()):t)},function(e){return function(e,t,n){for(var i=-1,a=null==e?0:e.length;++i<a;)n=t(n,e[i],i,e);return n}(Vu(function(e){return(e=Ki(e))&&e.replace(wu,bu).replace(ku,"")}(e).replace(Xu,"")),Ku,"")});function qu(e,t,n,i){const a=n.flatMap((e=>e.products)).find((e=>e.id===t.selectedProducts[t.currentGroupId]));return Qu(ic(e,a?.sku_ref_id),a,i)}function Ju(e,t,n){const i=t.find((e=>e.id===n))?.products??[];return i.forEach((t=>{t.product_details=ic(e,t.sku_ref_id||""),t.variables=Qu(t.product_details,t,i)})),i}function Qu(e,t,n){if(!t)return{};const i=t.variables;if(!i)return{...t};Object.keys(i).forEach((t=>{if(Zu(i[t])){const a=tc(i[t],e,n);i[t]=function(e){if(!e||e.includes("null")||e.includes("undefined"))return"";if(/\$\{\s*(launch\.customAttributes\.|sku\.)\w+\s*}/.test(e))return"";return e}(a)}}));const a={};return Id().forEach((t=>{if(void 0===i[t]){const i=Dd(t,e,void 0,n);null!==i&&(a[t]=i)}})),{...t,...a,...i}}function Zu(e){return"string"==typeof e&&e.includes(Ye)}function ec(e,t,n){return t?(Object.keys(t).forEach((i=>{Zu(t[i])&&(t[i]=t[Yu(i)]=tc(t[i],e,n))})),{...t}):{}}const tc=(e,t,n)=>e.replace(Ve,((i,a)=>{const r=Ve.exec(e)?.slice(1)||[];a=r[0]??a;const o=r[1]?.replace(":","")??"";return Dd(a,t,o,n)}));function nc(e,t){return t.flatMap((e=>e.products)).some((t=>1==Dd("freeTrialEligible",ic(e,t.sku_ref_id))))}function ic(e=[],t=""){return e.find((e=>e.product_ref_id===t))||null}var ac=function(){try{var e=Wt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function rc(e,t,n){"__proto__"==t&&ac?ac(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var oc=Object.prototype.hasOwnProperty;function sc(e,t,n){var i=e[t];oc.call(e,t)&&tt(i,n)&&(void 0!==n||t in e)||rc(e,t,n)}function lc(e,t,n,i){var a=!n;n||(n={});for(var r=-1,o=t.length;++r<o;){var s=t[r],l=void 0;void 0===l&&(l=e[s]),a?rc(n,s,l):sc(n,s,l)}return n}var dc=Object.prototype.hasOwnProperty;function uc(e){if(!yt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Yn(e),n=[];for(var i in e)("constructor"!=i||!t&&dc.call(e,i))&&n.push(i);return n}function cc(e){return Zn(e)?Xn(e,!0):uc(e)}var hc="object"==typeof e&&e&&!e.nodeType&&e,mc=hc&&"object"==typeof module&&module&&!module.nodeType&&module,fc=mc&&mc.exports===hc?st.Buffer:void 0,pc=fc?fc.allocUnsafe:void 0;var gc=qn(Object.getPrototypeOf,Object),vc=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)gn(t,Sn(e)),e=gc(e);return t}:bn;function yc(e){return yn(e,cc,vc)}var bc=Object.prototype.hasOwnProperty;function wc(e){var t=new e.constructor(e.byteLength);return new Jt(t).set(new Jt(e)),t}var kc=/\w*$/;var Sc=lt?lt.prototype:void 0,_c=Sc?Sc.valueOf:void 0;var Mc="[object Boolean]",Ec="[object Date]",Pc="[object Map]",Tc="[object Number]",xc="[object RegExp]",Ac="[object Set]",Cc="[object String]",Lc="[object Symbol]",Ic="[object ArrayBuffer]",Dc="[object DataView]",Rc="[object Float32Array]",Nc="[object Float64Array]",Wc="[object Int8Array]",Fc="[object Int16Array]",Oc="[object Int32Array]",$c="[object Uint8Array]",jc="[object Uint8ClampedArray]",zc="[object Uint16Array]",Hc="[object Uint32Array]";function Bc(e,t,n){var i,a=e.constructor;switch(t){case Ic:return wc(e);case Mc:case Ec:return new a(+e);case Dc:return function(e,t){var n=t?wc(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Rc:case Nc:case Wc:case Fc:case Oc:case $c:case jc:case zc:case Hc:return function(e,t){var n=t?wc(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case Pc:return new a;case Tc:case Cc:return new a(e);case xc:return function(e){var t=new e.constructor(e.source,kc.exec(e));return t.lastIndex=e.lastIndex,t}(e);case Ac:return new a;case Lc:return i=e,_c?Object(_c.call(i)):{}}}var Uc=Object.create,Gc=function(){function e(){}return function(t){if(!yt(t))return{};if(Uc)return Uc(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Vc=Bn&&Bn.isMap,Xc=Vc?$n(Vc):function(e){return _n(e)&&"[object Map]"==yi(e)};var Kc=Bn&&Bn.isSet,Yc=Kc?$n(Kc):function(e){return _n(e)&&"[object Set]"==yi(e)},qc=1,Jc=2,Qc=4,Zc="[object Arguments]",eh="[object Function]",th="[object GeneratorFunction]",nh="[object Object]",ih={};function ah(e,t,n,i,a,r){var o,s=t&qc,l=t&Jc,d=t&Qc;if(void 0!==o)return o;if(!yt(e))return e;var u=vn(e);if(u){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&bc.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}(e,o)}else{var c=yi(e),h=c==eh||c==th;if(In(e))return function(e,t){if(t)return e.slice();var n=e.length,i=pc?pc(n):new e.constructor(n);return e.copy(i),i}(e,s);if(c==nh||c==Zc||h&&!a){if(o=l||h?{}:function(e){return"function"!=typeof e.constructor||Yn(e)?{}:Gc(gc(e))}(e),!s)return l?function(e,t){return lc(e,vc(e),t)}(e,function(e,t){return e&&lc(t,cc(t),e)}(o,e)):function(e,t){return lc(e,Sn(e),t)}(e,function(e,t){return e&&lc(t,ei(t),e)}(o,e))}else{if(!ih[c])return a?e:{};o=Bc(e,c,s)}}r||(r=new Ut);var m=r.get(e);if(m)return m;r.set(e,o),Yc(e)?e.forEach((function(i){o.add(ah(i,t,n,i,e,r))})):Xc(e)&&e.forEach((function(i,a){o.set(a,ah(i,t,n,a,e,r))}));var f=u?void 0:(d?l?yc:ti:l?cc:ei)(e);return function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););}(f||e,(function(i,a){f&&(i=e[a=i]),sc(o,a,ah(i,t,n,a,e,r))})),o}ih[Zc]=ih["[object Array]"]=ih["[object ArrayBuffer]"]=ih["[object DataView]"]=ih["[object Boolean]"]=ih["[object Date]"]=ih["[object Float32Array]"]=ih["[object Float64Array]"]=ih["[object Int8Array]"]=ih["[object Int16Array]"]=ih["[object Int32Array]"]=ih["[object Map]"]=ih["[object Number]"]=ih[nh]=ih["[object RegExp]"]=ih["[object Set]"]=ih["[object String]"]=ih["[object Symbol]"]=ih["[object Uint8Array]"]=ih["[object Uint8ClampedArray]"]=ih["[object Uint16Array]"]=ih["[object Uint32Array]"]=!0,ih["[object Error]"]=ih[eh]=ih["[object WeakMap]"]=!1;const rh=(e,t,n)=>{const i=Object.getOwnPropertyDescriptor(e,t);if(!i||i.configurable)try{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n,writable:!1})}catch{try{e[t]=n}catch{}}};class oh{constructor(){this.listeners=new Map}addEventListener(e,t,n){if(!t)return;const i=(e=>"boolean"==typeof e?{capture:e}:e??{})(n),a=this.listeners.get(e)??[];if(a.some((e=>e.listener===t)))return;const r={listener:t,once:Boolean(i.once)};if(i.signal){if(i.signal.aborted)return;r.signal=i.signal,r.abortHandler=()=>this.removeEventListener(e,t),i.signal.addEventListener("abort",r.abortHandler,{once:!0})}a.push(r),this.listeners.set(e,a)}removeEventListener(e,t){if(!t)return;const n=this.listeners.get(e);if(n&&0!==n.length){for(let e=n.length-1;e>=0;e-=1){const i=n[e];i.listener===t&&(i.signal&&i.abortHandler&&i.signal.removeEventListener("abort",i.abortHandler),n.splice(e,1))}0===n.length&&this.listeners.delete(e)}}dispatchEvent(e){if(!e||"string"!=typeof e.type)throw new TypeError('Failed to execute "dispatchEvent": event type must be a string.');const t=this.listeners.get(e.type);if(!t||0===t.length)return!0;rh(e,"target",this);let n=!1;const i=e.stopImmediatePropagation?.bind(e),a=e.stopPropagation?.bind(e),r=()=>{n=!0,i?.()},o=()=>{e.cancelBubble=!0,a?.()};e.stopImmediatePropagation=r,e.stopPropagation=o;const s=t.slice();for(const t of s){if(n)break;rh(e,"currentTarget",this),"function"==typeof t.listener?t.listener.call(this,e):"object"==typeof(l=t.listener)&&null!==l&&"handleEvent"in l&&t.listener.handleEvent.call(t.listener,e),t.once&&this.removeEventListener(e.type,t.listener)}var l;if(i)e.stopImmediatePropagation=i;else try{delete e.stopImmediatePropagation}catch{e.stopImmediatePropagation=r}if(a)e.stopPropagation=a;else try{delete e.stopPropagation}catch{e.stopPropagation=o}return rh(e,"currentTarget",null),!e.defaultPrevented}}let sh=[];const lh={paywallId:"",livePaywalls:[],selectedPaywall:void 0,selectedCampaign:void 0,campaignRules:[],anySkuHasTrialOffer:!1,anySkuHasIntroOffer:!1,anySkuHasPromoOffer:!1,isLoggedIn:!1,darkMode:!1,safeAreaTop:0,groups:[],selectedProducts:{},formStates:{},timerStates:{},currentPage:"page1",currentGroupId:"",currentGroupName:"",fullScreenPresentation:!1,launch:{productGroups:[],customAttributes:{},customObject:{},currentGroup:""},sku:{},orientation:"portrait",focusedState:!1,platformId:"",mediaList:{},skuItems:[],customer:{},hasNotch:!1,purchaseInProgress:!1,formFactor:"desktop",slides:{},userInteractionEnabled:!0,currentSlideIndex:void 0};class dh extends oh{static create(e,t,n){const i=new dh(e,t,n);return this.providers.push(i),i}static remove(e){this.providers=this.providers.filter((t=>t!==e))}static get currentProvider(){return dh.providers[0]}static setCustomerAttribute(e){this.providers.forEach((t=>{t.setCustomerAttribute(e)}))}static removeCustomerAttribute(e){this.providers.forEach((t=>{t.removeCustomerAttribute(e)}))}static setAppSuppliedVideoDetails(e){this.providers.forEach((t=>{t.setAppSuppliedVideoDetails(e)}))}static getSelectedPaywall(){return this.providers[0]?.getSelectedPaywall()}static setUserInteractionEnabled(e){this.providers.forEach((t=>{t.setUserInteractionEnabled(e)}))}static setUserTags(e){this.providers.forEach((t=>{t.setUserTags(e)}))}static setProductDetails(e){this.providers.forEach((t=>{t.setProductDetails(e)})),sh=e}static setPurchaseInProgress(e){this.providers.forEach((t=>{t.setPurchaseInProgress(e)}))}static setIsLoggedIn(e){this.providers.forEach((t=>{t.setIsLoggedIn(e)}))}static setPurchase(e,t){this.providers.forEach((n=>{n.setPurchase(e,t)}))}static getSelectedSlideIndex(){return this.providers[0]?.state.currentSlideIndex}constructor(e,t,n){super(),this.host=null,this.subscribers=new Set,this.productDetails=sh,this.filteredSkuMenus=[],this.state=ah(lh,5);const i=ca.getNamiProfile();this.state.isLoggedIn=!!i?.externalId,this.setPaywall(e,t,n),this.defineDynamicStateProps(),this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}emitEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}onEvent(e,t){const n=e=>t(e.detail);return this.addEventListener(e,n),()=>this.removeEventListener(e,n)}hostConnected(){}hostDisconnected(){this.subscribers.clear()}defineDynamicStateProps(){Object.defineProperty(this.state,"tvQuality",{get:this.getTVQuality.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportWidth",{get:this.getViewportWidth.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportHeight",{get:this.getViewportHeight.bind(this),enumerable:!1,configurable:!0})}setState(e){this.state=e,this.defineDynamicStateProps(),this.subscribers.forEach((e=>e())),this.host&&this.host.requestUpdate()}setProductDetails(e){this.productDetails=e}getProductDetails(){return this.productDetails}setCurrentGroupData(e,t){const n=qu(this.productDetails,this.state,this.filteredSkuMenus,Ju(this.productDetails,this.filteredSkuMenus,this.state.currentGroupId));this.setState({...this.state,currentGroupId:e,currentGroupName:t,sku:n})}setFormState(e,t){this.setState({...this.state,formStates:{...this.state.formStates,[e]:t}})}setTimerState(e,t,n,i){this.setState({...this.state,timerStates:{...this.state.timerStates,[e]:{remainingSeconds:t,savedAt:n,hasEmittedCompletion:i}}})}getTimerState(e){return this.state.timerStates[e]}getCurrentGroupId(){return this.state.currentGroupId}getCurrentGroupName(){return this.state.currentGroupName}setCurrentFormId(e,t){const n=this.state.formStates||{},i={...n,[e]:t||!n[e]};this.setState({...this.state,formStates:i})}getCurrentFormId(e){return this.state.formStates[e]}setSelectedProducts(e){const t=qu(this.productDetails,this.state,this.filteredSkuMenus,Ju(this.productDetails,this.filteredSkuMenus,this.state.currentGroupId));this.setState({...this.state,selectedProducts:e,sku:t})}selectedProducts(){return this.state.selectedProducts}setPaywall(e,t,n){let i={...this.state,formFactor:El(),selectedPaywall:e,selectedCampaign:n};const a=e.template?.initialState;i={...i,...a};const r=function(e,t,n=[]){const i=t.productGroups?.length?t.productGroups:n.map((e=>e.ref));return{customAttributes:t.customAttributes,productGroups:i,customObject:{...e.customObject,...t.customObject},currentGroup:t.currentGroup??""}}(i.launch,t,e.sku_menus);if(this.filteredSkuMenus=e.sku_menus??[],r.productGroups.length&&(this.filteredSkuMenus=this.filteredSkuMenus.filter((e=>r.productGroups.includes(e.ref)))),""!==r.currentGroup&&i.groups.length&&e.template?.displaySingleGroup&&(i.currentGroupId=i.groups.find((e=>e.ref==r.currentGroup))?.id??""),""===i.currentGroupId&&1===this.filteredSkuMenus.length){const e=i.groups.find((e=>e.ref==this.filteredSkuMenus[0].ref));i.currentGroupId=e?.id??i.currentGroupId}const o=Ju(this.productDetails,this.filteredSkuMenus,i.currentGroupId);i.skuItems=o,i.launch=r,i.anySkuHasTrialOffer=nc(this.productDetails,this.filteredSkuMenus),i.anySkuHasPromoOffer=function(e,t){return!nc(e,t)&&t.flatMap((e=>e.products)).some((t=>1==Dd("promoEligible",ic(e,t.sku_ref_id))))}(this.productDetails,this.filteredSkuMenus),i.paywallId=e.id,i.sku=qu(this.productDetails,i,this.filteredSkuMenus,o),this.setState(i)}getSelectedPaywall(){return this.state.selectedPaywall}getSelectedCampaign(){return this.state.selectedCampaign}getCurrentPlacementLabel(){return this.state.selectedCampaign?.value?this.state.selectedCampaign.value:this.flow?.campaign?.value?this.flow.campaign.value:void 0}getPaywallActionEventData(){const t=this.state.selectedCampaign,n=this.state.selectedPaywall;return{paywallId:n?.id??"",paywallName:n?.name??"",campaignId:t?.rule??"",campaignName:t?.name??"",campaignType:t?.type??"",campaignLabel:t?.value??"",campaignUrl:t?.type===e.NamiCampaignRuleType.URL?t?.value??"":"",segmentId:t?.segment??"",externalSegmentId:t?.external_segment??""}}paywallId(){return this.state.paywallId}setCurrentPage(e){this.setState({...this.state,currentPage:e})}setCustomerAttribute(e){this.setState({...this.state,customer:{...this.state.customer,...e}})}removeCustomerAttribute(e){delete this.state.customer[e],this.setState(this.state)}setIsLoggedIn(e){this.setState({...this.state,isLoggedIn:e})}setMediaList(e){this.setState({...this.state,mediaList:e.reduce(((e,t)=>({...e,[t.name]:t})))})}setSafeAreaTop(e){this.setState({...this.state,safeAreaTop:e})}setFullScreenPresentation(e){this.setState({...this.state,fullScreenPresentation:e})}setFormFactor(e){this.setState({...this.state,formFactor:e})}getFormFactor(){return this.state.formFactor}getTVQuality(){if("television"!==this.getFormFactor())return"";const e=window.devicePixelRatio||1,t=window.innerWidth||window.screen?.availWidth,n=window.innerHeight||window.screen?.availHeight;if(!t||!n)return"720p";const i=Math.max(t,n)*e,a=Math.min(t,n)*e;return i>=3840||a>=2160?"4K":i>=1920||a>=1080?"1080p":"720p"}getViewportWidth(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}getViewportHeight(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}setPurchaseInProgress(e){this.setState({...this.state,purchaseInProgress:e})}setPurchase(e,t){this.setState({...this.state,purchaseInProgress:e,productBeingPurchased:t})}setTimeSpentOnPaywall(e){this.setState({...this.state,timeSpentOnPaywall:e})}setAppSuppliedVideoDetails({url:e,name:t}){this.setState({...this.state,appSuppliedVideoUrl:e,appSuppliedVideoName:t})}resetAppSuppliedVideoDetails(){delete this.state.appSuppliedVideoUrl,delete this.state.appSuppliedVideoName,this.setState(this.state)}setLaunchDetails(e,t){this.setState({...this.state,launchValue:e,launchType:t})}setOpenHeaderIds(e,t){e=t?.skuId?`${e}_${t.skuId}`:e;const n=[...this.state.openHeaderIds],i=n.indexOf(e);-1!==i?n.splice(i,1):n.push(e),this.setState({...this.state,openHeaderIds:n,currentCollapsibleSku:t??null})}getCurrentCollapsibleSku(){return this.state.currentCollapsibleSku}setFlow(e){this.flow=e}setUserInteractionEnabled(e){this.setState({...this.state,userInteractionEnabled:e}),this.emitEvent("user-interaction-changed",{enabled:e})}setUserTags(e){this.setState({...this.state,userTags:{...this.state.userTags,...e}})}setCurrentSlideIndex(e){this.state.currentSlideIndex=e}}dh.providers=[];class uh{constructor(){this.refIdToPurchasedSKUs={},this.refIdToRelatedSKUs={},this.refIdToActivePurchases={}}}uh.instance=new uh;const ch=()=>ua(et([...ca.getNamiEntitlements(te),...ca.getNamiEntitlements(oe)]),"referenceId"),hh=()=>{nd.getInstance().emit(Ue,ch())};function mh(e){return{id:e.id,skuId:e.sku_ref_id,name:e.name,type:e.sku_type||"unknown",entitlements:e.entitlements,productDetails:"product_details"in e?e.product_details:null}}class fh{constructor(){}async fetchActiveEntitlements(){let e=null;if(ud()||Xs(A.THIRD_PARTY_TRANSACTIONS)||!Xs(A.ENTITLEMENT_MANAGEMENT))ud()&&Ze.debug("Skipping active entitlements update - anonymous mode"),Xs(A.THIRD_PARTY_TRANSACTIONS)&&Ze.debug("Skipping active entitlements update - paywalls-only mode"),Xs(A.ENTITLEMENT_MANAGEMENT)||Ze.debug("Skipping active entitlements update - no entitlement_management capability");else{const t=ca.getDevice();if(t?.id){const n=await this.getAPIEntitlements(t.id);e=n?.results,e&&(ca.setActiveEntitlements(ee,e),this.invokeActiveEntitlementsHandler(e))}}return e}async getAPIEntitlements(e){const t=`device/${e}/active_entitlements/`;let n={};try{n=await Zs.instance.fetchAPI(t)}catch(e){throw Ze.error(Aa(e.status,t)),e}return n}invokeActiveEntitlementsHandler(e){if(Ys()){(e=>{ca.setNamiEntitlements(te,e);const t=ca.getNamiEntitlements(oe),n=new Set(e.map((e=>e.referenceId))),i=t.filter((e=>{const t=n.has(e.referenceId);return t&&Ze.debug(`Server granted verified entitlement for ${e.referenceId}, so replacing provisional entitlement grant.`),!t}));i.length!==t.length&&ca.setNamiEntitlements(oe,i),hh()})(e.map((e=>(e=>{const t=e.entitlement_ref_id;return{name:e.name||"",desc:e.description||"",namiId:"",referenceId:t,relatedSkus:uh.instance.refIdToRelatedSKUs[t]||[],activePurchases:uh.instance.refIdToActivePurchases[t]||[],purchasedSkus:uh.instance.refIdToPurchasedSKUs[t]||[],expires:e.expires?new Date(e.expires).valueOf():0}})(e))))}}}fh.instance=new fh;class ph{async fetchCustomerJourneyState(){if(ud())return Ze.debug("Skipping customer journey state update - anonymous mode"),null;const e=ca.getDevice();if(!e?.id)return null;const t=`device/${e.id}/profile/`;let n=null;try{n=await Zs.instance.fetchAPI(t,void 0,0)}catch(e){throw Ze.error(Aa(e.status,t)),e}return n?(ca.setCustomerJourneyState(n.customer_journey_state),n.customer_journey_state):null}}ph.instance=new ph;class gh{constructor(){this.inMemoryAnonymousMode=!1,dd=this}setInMemoryAnonymousMode(e){this.inMemoryAnonymousMode=e,Ze.info(`In-memory anonymous mode ${e?"enabled":"disabled"} due to failed device registration`)}isInMemoryAnonymousMode(){return this.inMemoryAnonymousMode}isAnonymousMode(){return ca.getAnonymousMode()||this.inMemoryAnonymousMode}async init(e){this.setInitialValues(e),ld.instance.fetchConfig(),await this.initAndFetchRequiredData(e),cd.instance.startSession()}setInitialValues(e){const t={...e};delete t.initialConfig,ca.clearSessionId(),ca.setNamiConfig(t),ca.setLanguageCode(e.namiLanguageCode),ca.setPurchaseChannel(e.purchaseChannel);const n=e.initialConfig;if(n.appConfig||n.platform_config){const e=n?.appConfig||n?.platform_config;e&&ca.setAppConfig(ne,e)}n?.paywalls&&ca.setPaywalls(ae,n.paywalls),n?.products&&ca.setProducts(re,n.products)}initAnonymousDevice(){return{deviceId:rd.instance.getOrCreateAnonymousUUID(),deviceTask:null}}initIdentifiedDevice(e){const t={...Ml(e.namiCommands),...e.formFactor?{form_factor:e.formFactor}:{}},n=function(e){if(!e)return;const t=e.find((e=>e.startsWith("splitPosition=")));if(!t)return;const n=t.split("=")[1],i=Number(n);return n&&!isNaN(i)?Ll(i):void 0}(e.namiCommands),{id:i,device:a}=rd.instance.createOrUpdateDevice(t,n,this);return{deviceId:i,deviceTask:a}}async initAndFetchRequiredData(e,t=0,n=1){const i=e.initialConfig,a=e.formFactor??El(),r=this.isAnonymousMode(),{deviceId:o,deviceTask:s}=r?this.initAnonymousDevice():this.initIdentifiedDevice(e),l=Al(o);i.campaign_rules&&ca.setCampaignRules(ie,Nl(i.campaign_rules,l,a)),s&&await s,id.instance.configure(a,l,e.namiCommands),Ks();const d=Promise.all([od.instance.fetchProducts(),ph.instance.fetchCustomerJourneyState(),fh.instance.fetchActiveEntitlements(),sd.instance.fetchPaywalls().then((e=>id.instance.fetchCampaignRules(e)))]).catch((async i=>{if(i instanceof fa){if(ca.resetDevice(),t<n){const i=100*Math.pow(2,t);return await new Promise((e=>setTimeout(e,i))),this.initAndFetchRequiredData(e,t+1,n)}if(!r)return Ze.warn(`Max retries reached for ConflictError. ${i.message}`),this.setInMemoryAnonymousMode(!0),this.initAndFetchRequiredData(e,0,n)}throw i}));i.campaign_rules?.length&&i.paywalls?.length||await d,d.then((()=>this.reRenderPaywall()))}reRenderPaywall(){if("undefined"==typeof document)return;const e=document.querySelector("nami-paywall");e?.setPaywallData()}}function vh(e){return Array.isArray(e)?e.map(vh):e&&"object"==typeof e?Object.entries(e).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=vh(n)),e)),{}):e}gh.instance=new gh;let yh=!0,bh=!1;function wh(){if("function"==typeof window.VIZIO?.Chromevox?.isEnabled)try{yh=window.VIZIO?.Chromevox?.isEnabled()}catch{}}function kh(){return"undefined"!=typeof window&&void 0!==window.VIZIO&&"function"==typeof window.VIZIO?.Chromevox?.play}function Sh(e){e.isTrusted&&wh()}function _h(e){e.isTrusted&&(yh=!1)}function Mh(e){if(e&&kh()&&yh)try{window.VIZIO?.Chromevox?.play(e)}catch{}}var Eh;class Ph{constructor(){Eh.set(this,!1),this.maxLogging=!1}get isInitialized(){return x(this,Eh,"f")||null!=ca.getNamiConfig()}static sdkVersion(){return C}static sdkPackageVersion(){return L}static async configure(e){if(!e.appPlatformID)throw new ga;return this.setInitialConfig(e),await Ph.instance.initializeSDK(e)}static setInitialConfig(e){if(null!=e.initialConfig){if("string"==typeof e.initialConfig){Ze.warn("[DEPRECATED] NamiConfiguration.initialConfig should be an object");const t=function(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(t)}catch{return}}(e.initialConfig);if(!t)return Ze.error("Failed to parse NamiConfiguration.initialConfig"),void(e.initialConfig={});e.initialConfig=t}if("object"!=typeof e.initialConfig)e.initialConfig={};else if((e=>"object"==typeof e&&"initial_config"in e)(e.initialConfig)){const t=qs(e.initialConfig.initial_config);t?e.initialConfig=t:(e.initialConfig={},Ze.error("Failed to parse NamiConfiguration.initialConfig as base64-gzipped JSON"))}}else e.initialConfig={}}async initializeSDK(e){let t=!1,n=!1;const i=x(this,Eh,"f")?ca.getNamiConfig():null;if(Ze.setLogger(e.logLevel),Ph.instance.maxLogging=e.maxLogging??!1,null!==i){const r={...e};if(delete r.initialConfig,a=i,ad(vh(r),vh(a)))return Ze.warn("Nami SDK is already configured, ignoring this configure call."),{sdkInitialized:!0,configureState:ze};n=!0;const o=Vs(e.namiCommands),s=Vs(i.namiCommands);e.appPlatformID==i.appPlatformID&&o==s||(t=!0),e.namiLanguageCode===i.namiLanguageCode&&e.logLevel==i.logLevel||(n=!0)}var a;t&&(Ze.info("SDK full reconfigure called"),ca.resetDevice()),function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?a.call(e,n):a?a.value=n:t.set(e,n)}(this,Eh,!0,"f"),Zs.configure(e),await gh.instance.init(e),Ze.info("SDK successfully initialized!");const r=n||t?je:$e;return!bh&&kh()&&(window.addEventListener("VIZIO_TTS_ENABLED",Sh),window.addEventListener("VIZIO_TTS_DISABLED",_h),bh=!0,wh()),{sdkInitialized:!0,configureState:r}}}Eh=new WeakMap,Ph.instance=new Ph;const Th=new Set(["fullscreen","sheet","compact_sheet","modal"]);var xh;e.NamiPaywallManagerEvents=void 0,(xh=e.NamiPaywallManagerEvents||(e.NamiPaywallManagerEvents={})).BuySku="RegisterBuySKU",xh.Close="PaywallCloseRequested",xh.SignIn="PaywallSignInRequested",xh.Restore="PaywallRestoreRequested",xh.DeeplinkAction="PaywallDeeplinkAction";const Ah=globalThis,Ch=Ah.ShadowRoot&&(void 0===Ah.ShadyCSS||Ah.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lh=Symbol(),Ih=new WeakMap;let Dh=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Lh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Ch&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=Ih.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ih.set(t,e))}return e}toString(){return this.cssText}};const Rh=e=>new Dh("string"==typeof e?e:e+"",void 0,Lh),Nh=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[i+1]),e[0]);return new Dh(n,e,Lh)},Wh=Ch?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Rh(t)})(e):e,{is:Fh,defineProperty:Oh,getOwnPropertyDescriptor:$h,getOwnPropertyNames:jh,getOwnPropertySymbols:zh,getPrototypeOf:Hh}=Object,Bh=globalThis,Uh=Bh.trustedTypes,Gh=Uh?Uh.emptyScript:"",Vh=Bh.reactiveElementPolyfillSupport,Xh=(e,t)=>e,Kh={toAttribute(e,t){switch(t){case Boolean:e=e?Gh:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},Yh=(e,t)=>!Fh(e,t),qh={attribute:!0,type:String,converter:Kh,reflect:!1,useDefault:!1,hasChanged:Yh};Symbol.metadata??=Symbol("metadata"),Bh.litPropertyMetadata??=new WeakMap;let Jh=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=qh){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Oh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:a}=$h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const r=i?.call(this);a?.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??qh}static _$Ei(){if(this.hasOwnProperty(Xh("elementProperties")))return;const e=Hh(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Xh("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Xh("properties"))){const e=this.properties,t=[...jh(e),...zh(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(Wh(e))}else void 0!==e&&t.push(Wh(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(Ch)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of t){const t=document.createElement("style"),i=Ah.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(void 0!==i&&!0===n.reflect){const a=(void 0!==n.converter?.toAttribute?n.converter:Kh).toAttribute(t,n.type);this._$Em=e,null==a?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=n.getPropertyOptions(i),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:Kh;this._$Em=i;const r=a.fromAttribute(t,e.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const i=this.constructor,a=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??Yh)(a,t)||n.useDefault&&n.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:a},r){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==a||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,n,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};Jh.elementStyles=[],Jh.shadowRootOptions={mode:"open"},Jh[Xh("elementProperties")]=new Map,Jh[Xh("finalized")]=new Map,Vh?.({ReactiveElement:Jh}),(Bh.reactiveElementVersions??=[]).push("2.1.1");const Qh=globalThis,Zh=Qh.trustedTypes,em=Zh?Zh.createPolicy("lit-html",{createHTML:e=>e}):void 0,tm="$lit$",nm=`lit$${Math.random().toFixed(9).slice(2)}$`,im="?"+nm,am=`<${im}>`,rm=document,om=()=>rm.createComment(""),sm=e=>null===e||"object"!=typeof e&&"function"!=typeof e,lm=Array.isArray,dm=e=>lm(e)||"function"==typeof e?.[Symbol.iterator],um="[ \t\n\f\r]",cm=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hm=/-->/g,mm=/>/g,fm=RegExp(`>|${um}(?:([^\\s"'>=/]+)(${um}*=${um}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),pm=/'/g,gm=/"/g,vm=/^(?:script|style|textarea|title)$/i,ym=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),bm=ym(1),wm=ym(2),km=Symbol.for("lit-noChange"),Sm=Symbol.for("lit-nothing"),_m=new WeakMap,Mm=rm.createTreeWalker(rm,129);function Em(e,t){if(!lm(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==em?em.createHTML(t):t}const Pm=(e,t)=>{const n=e.length-1,i=[];let a,r=2===t?"<svg>":3===t?"<math>":"",o=cm;for(let t=0;t<n;t++){const n=e[t];let s,l,d=-1,u=0;for(;u<n.length&&(o.lastIndex=u,l=o.exec(n),null!==l);)u=o.lastIndex,o===cm?"!--"===l[1]?o=hm:void 0!==l[1]?o=mm:void 0!==l[2]?(vm.test(l[2])&&(a=RegExp("</"+l[2],"g")),o=fm):void 0!==l[3]&&(o=fm):o===fm?">"===l[0]?(o=a??cm,d=-1):void 0===l[1]?d=-2:(d=o.lastIndex-l[2].length,s=l[1],o=void 0===l[3]?fm:'"'===l[3]?gm:pm):o===gm||o===pm?o=fm:o===hm||o===mm?o=cm:(o=fm,a=void 0);const c=o===fm&&e[t+1].startsWith("/>")?" ":"";r+=o===cm?n+am:d>=0?(i.push(s),n.slice(0,d)+tm+n.slice(d)+nm+c):n+nm+(-2===d?t:c)}return[Em(e,r+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class Tm{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,r=0;const o=e.length-1,s=this.parts,[l,d]=Pm(e,t);if(this.el=Tm.createElement(l,n),Mm.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Mm.nextNode())&&s.length<o;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(tm)){const t=d[r++],n=i.getAttribute(e).split(nm),o=/([.?@])?(.*)/.exec(t);s.push({type:1,index:a,name:o[2],strings:n,ctor:"."===o[1]?Im:"?"===o[1]?Dm:"@"===o[1]?Rm:Lm}),i.removeAttribute(e)}else e.startsWith(nm)&&(s.push({type:6,index:a}),i.removeAttribute(e));if(vm.test(i.tagName)){const e=i.textContent.split(nm),t=e.length-1;if(t>0){i.textContent=Zh?Zh.emptyScript:"";for(let n=0;n<t;n++)i.append(e[n],om()),Mm.nextNode(),s.push({type:2,index:++a});i.append(e[t],om())}}}else if(8===i.nodeType)if(i.data===im)s.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(nm,e+1));)s.push({type:7,index:a}),e+=nm.length-1}a++}}static createElement(e,t){const n=rm.createElement("template");return n.innerHTML=e,n}}function xm(e,t,n=e,i){if(t===km)return t;let a=void 0!==i?n._$Co?.[i]:n._$Cl;const r=sm(t)?void 0:t._$litDirective$;return a?.constructor!==r&&(a?._$AO?.(!1),void 0===r?a=void 0:(a=new r(e),a._$AT(e,n,i)),void 0!==i?(n._$Co??=[])[i]=a:n._$Cl=a),void 0!==a&&(t=xm(e,a._$AS(e,t.values),a,i)),t}let Am=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??rm).importNode(t,!0);Mm.currentNode=i;let a=Mm.nextNode(),r=0,o=0,s=n[0];for(;void 0!==s;){if(r===s.index){let t;2===s.type?t=new Cm(a,a.nextSibling,this,e):1===s.type?t=new s.ctor(a,s.name,s.strings,this,e):6===s.type&&(t=new Nm(a,this,e)),this._$AV.push(t),s=n[++o]}r!==s?.index&&(a=Mm.nextNode(),r++)}return Mm.currentNode=rm,i}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}};class Cm{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Sm,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=xm(this,e,t),sm(e)?e===Sm||null==e||""===e?(this._$AH!==Sm&&this._$AR(),this._$AH=Sm):e!==this._$AH&&e!==km&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):dm(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Sm&&sm(this._$AH)?this._$AA.nextSibling.data=e:this.T(rm.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=Tm.createElement(Em(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new Am(i,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=_m.get(e.strings);return void 0===t&&_m.set(e.strings,t=new Tm(e)),t}k(e){lm(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const a of e)i===t.length?t.push(n=new Cm(this.O(om()),this.O(om()),this,this.options)):n=t[i],n._$AI(a),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class Lm{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,a){this.type=1,this._$AH=Sm,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Sm}_$AI(e,t=this,n,i){const a=this.strings;let r=!1;if(void 0===a)e=xm(this,e,t,0),r=!sm(e)||e!==this._$AH&&e!==km,r&&(this._$AH=e);else{const i=e;let o,s;for(e=a[0],o=0;o<a.length-1;o++)s=xm(this,i[n+o],t,o),s===km&&(s=this._$AH[o]),r||=!sm(s)||s!==this._$AH[o],s===Sm?e=Sm:e!==Sm&&(e+=(s??"")+a[o+1]),this._$AH[o]=s}r&&!i&&this.j(e)}j(e){e===Sm?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Im extends Lm{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Sm?void 0:e}}class Dm extends Lm{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Sm)}}class Rm extends Lm{constructor(e,t,n,i,a){super(e,t,n,i,a),this.type=5}_$AI(e,t=this){if((e=xm(this,e,t,0)??Sm)===km)return;const n=this._$AH,i=e===Sm&&n!==Sm||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,a=e!==Sm&&(n===Sm||i);i&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Nm{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){xm(this,e)}}const Wm={M:tm,P:nm,A:im,C:1,L:Pm,R:Am,D:dm,V:xm,I:Cm,H:Lm,N:Dm,U:Rm,B:Im,F:Nm},Fm=Qh.litHtmlPolyfillSupport;Fm?.(Tm,Cm),(Qh.litHtmlVersions??=[]).push("3.3.1");const Om=globalThis;let $m=class extends Jh{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const i=n?.renderBefore??t;let a=i._$litPart$;if(void 0===a){const e=n?.renderBefore??null;i._$litPart$=a=new Cm(t.insertBefore(om(),e),e,void 0,n??{})}return a._$AI(e),a})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return km}};$m._$litElement$=!0,$m.finalized=!0,Om.litElementHydrateSupport?.({LitElement:$m});const jm=Om.litElementPolyfillSupport;jm?.({LitElement:$m}),(Om.litElementVersions??=[]).push("4.2.1");const zm=Nh`
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).NamiWebSdk={})}(this,(function(e){"use strict";(()=>{if("undefined"!=typeof globalThis)return;const e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")();Object.defineProperty(e,"globalThis",{value:e,writable:!0,enumerable:!1,configurable:!0})})(),"undefined"!=typeof Element&&"function"!=typeof Element.prototype.getAttributeNames&&(Element.prototype.getAttributeNames=function(){const e=this.attributes,t=new Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=e[n].name;return t});const t=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(){}};var n,i,a,r,o,s,l,d,u,c,h,m,f=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n},p=function(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)};const g=e=>"boolean"==typeof e?e:e?.capture??!1;const v=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,n){if(null==t)return;const i=g(n)?this.__captureEventListeners:this.__eventListeners;let a=i.get(e);if(void 0===a)a=new Map,i.set(e,a);else if(a.has(t))return;const r="object"==typeof n&&n?n:{};r.signal?.addEventListener("abort",(()=>this.removeEventListener(e,t,n))),a.set(t,r??{})}removeEventListener(e,t,n){if(null==t)return;const i=g(n)?this.__captureEventListeners:this.__eventListeners,a=i.get(e);void 0!==a&&(a.delete(t),a.size||i.delete(e))}dispatchEvent(e){const t=[this];let n=this.__eventTargetParent;if(e.composed)for(;n;)t.push(n),n=n.__eventTargetParent;else for(;n&&n!==this.__host;)t.push(n),n=n.__eventTargetParent;let i=!1,a=!1,r=0,o=null,s=null,l=null;const d=e.stopPropagation,u=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get:()=>o??s,...y},srcElement:{get:()=>e.target,...y},currentTarget:{get:()=>l,...y},eventPhase:{get:()=>r,...y},composedPath:{value:()=>t,...y},stopPropagation:{value:()=>{i=!0,d.call(e)},...y},stopImmediatePropagation:{value:()=>{a=!0,u.call(e)},...y}});const c=(t,n,i)=>{"function"==typeof t?t(e):"function"==typeof t?.handleEvent&&t.handleEvent(e),n.once&&i.delete(t)},h=()=>(l=null,r=0,!e.defaultPrevented),m=t.slice().reverse();o=this.__host&&e.composed?null:this;const f=e=>{for(s=this;s.__host&&e.includes(s.__host);)s=s.__host};for(const t of m){o||s&&s!==t.__host||f(m.slice(m.indexOf(t))),l=t,r=t===e.target?2:1;const n=t.__captureEventListeners.get(e.type);if(n)for(const[e,t]of n)if(c(e,t,n),a)return h();if(i)return h()}const p=e.bubbles?t:[this];s=null;for(const t of p){o||s&&t!==s.__host||f(p.slice(0,p.indexOf(t)+1)),l=t,r=t===e.target?2:3;const n=t.__eventListeners.get(e.type);if(n)for(const[e,t]of n)if(c(e,t,n),a)return h();if(i)return h()}return h()}},y={__proto__:null,enumerable:!0};Object.freeze(y);const b=(c=class{constructor(e,t={}){if(n.set(this,!1),i.set(this,!1),a.set(this,!1),r.set(this,!1),o.set(this,Date.now()),s.set(this,!1),l.set(this,void 0),d.set(this,void 0),u.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,0===arguments.length)throw new Error("The type argument must be specified");if("object"!=typeof t||!t)throw new Error('The "options" argument must be an object');const{bubbles:c,cancelable:h,composed:m}=t;f(this,n,!!h,"f"),f(this,i,!!c,"f"),f(this,a,!!m,"f"),f(this,l,`${e}`,"f"),f(this,d,null,"f"),f(this,u,!1,"f")}initEvent(e,t,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){f(this,r,!0,"f")}get target(){return p(this,d,"f")}get currentTarget(){return p(this,d,"f")}get srcElement(){return p(this,d,"f")}get type(){return p(this,l,"f")}get cancelable(){return p(this,n,"f")}get defaultPrevented(){return p(this,n,"f")&&p(this,r,"f")}get timeStamp(){return p(this,o,"f")}composedPath(){return p(this,u,"f")?[p(this,d,"f")]:[]}get returnValue(){return!p(this,n,"f")||!p(this,r,"f")}get bubbles(){return p(this,i,"f")}get composed(){return p(this,a,"f")}get eventPhase(){return p(this,u,"f")?c.AT_TARGET:c.NONE}get cancelBubble(){return p(this,s,"f")}set cancelBubble(e){e&&f(this,s,!0,"f")}stopPropagation(){f(this,s,!0,"f")}get isTrusted(){return!1}},n=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c.NONE=0,c.CAPTURING_PHASE=1,c.AT_TARGET=2,c.BUBBLING_PHASE=3,c);Object.defineProperties(b.prototype,{initEvent:y,stopImmediatePropagation:y,preventDefault:y,target:y,currentTarget:y,srcElement:y,type:y,cancelable:y,defaultPrevented:y,timeStamp:y,composedPath:y,returnValue:y,bubbles:y,composed:y,eventPhase:y,cancelBubble:y,stopPropagation:y,isTrusted:y});const w=(m=class extends b{constructor(e,t={}){super(e,t),h.set(this,void 0),f(this,h,t?.detail??null,"f")}initCustomEvent(e,t,n,i){throw new Error("Method not implemented.")}get detail(){return p(this,h,"f")}},h=new WeakMap,m);Object.defineProperties(w.prototype,{detail:y});const k=b,S=w;globalThis.Event??=k,globalThis.CustomEvent??=S;const _=new WeakMap,M=e=>{let t=_.get(e);return void 0===t&&_.set(e,t=new Map),t},E=class extends v{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(M(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){M(this).set(e,String(t))}removeAttribute(e){M(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 M(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 t(this);return this.__internals=e,e}getAttribute(e){return M(this).get(e)??null}},P=class extends E{};function T(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 x(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)}globalThis.litServerRoot??=Object.defineProperty(new P,"localName",{get:()=>"lit-server-root"}),"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=P),"function"==typeof SuppressedError&&SuppressedError;var A;!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"}(A||(A={}));const{NAMI_SDK_VERSION:C="3.4.0",NAMI_SDK_PACKAGE_VERSION:L="3.4.0-dev.202603232321",PRODUCTION:I="production",DEVELOPMENT:D="development",PLATFORM_ID_REQUIRED:R="Platform ID is required",DEVICE_ID_REQUIRED:N="Device ID is required",EXTERNAL_ID_REQUIRED:W="External ID is required",SDK_NOT_INITIALIZED:F="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:O="Campaign is not available",FLOW_SCREENS_NOT_AVAILABLE:$="Flow screens not available",UNABLE_TO_UPDATE_CDP_ID:j="Unable to update CDP id in anonymous mode",ANONYMOUS_MODE_ALREADY_ON:z="Anonymous mode is already turned on.",ANONYMOUS_MODE_ALREADY_OFF:H="Anonymous mode is already turned off.",ANONYMOUS_MODE_LOGIN_NOT_ALLOWED:B="Login/logout are not available in anonymous mode",SESSION_REQUIRED:U="Session is required",DEVICE_ID_NOT_SET:G="Nami Device ID is not set",AUTH_DEVICE:V="nami_auth_device",NAMI_CONFIGURATION:X="nami_configuration",NAMI_PROFILE:K="nami_profile",API_CONFIG:Y="api_config",API_CAMPAIGN_RULES:q="api_campaign_rules",API_PAYWALLS:J="api_paywalls",API_CAMPAIGN_SESSION_TIMESTAMP:Q="api_campaign_session_timestamp",API_PRODUCTS:Z="api_products",API_ACTIVE_ENTITLEMENTS:ee="api_active_entitlements",SERVER_NAMI_ENTITLEMENTS:te="server_active_entitlements",INITIAL_APP_CONFIG:ne="initial_app_config",INITIAL_CAMPAIGN_RULES:ie="initial_campaign_rules",INITIAL_PAYWALLS:ae="initial_paywalls",INITIAL_PRODUCTS:re="initial_products",LOCAL_NAMI_ENTITLEMENTS:oe="local_active_entitlements",CUSTOMER_ATTRIBUTES_KEY_PREFIX:se="nami_cmr_attributes_",NAMI_CUSTOMER_JOURNEY_STATE:le="nami_customer_journey_state",ANONYMOUS_MODE:de="nami_anonymous_mode_v2",ANONYMOUS_UUID:ue="nami_anonymous_uuid",KEY_SESSION_COUNTER:ce="nami_session_counter",INITIAL_SESSION_COUNTER_VALUE:he=1,NAMI_LAST_IMPRESSION_ID:me="nami_last_impression_id",NAMI_PURCHASE_IMPRESSION_ID:fe="nami_purchase_impression_id",NAMI_LAUNCH_ID:pe="nami_launch_id",NAMI_SESSION_ID:ge="nami_session_id",NAMI_LANGUAGE_CODE:ve="nami_language_code",NAMI_PURCHASE_CHANNEL:ye="nami_purchase_channel",API_VERSION:be="v3",BASE_URL_PATH:we=`sdk/${be}/platform`,BASE_URL:ke="https://app.namiml.com",BASE_STAGING_URL:Se="https://app-staging.namiml.com",CUSTOM_HOST_PREFIX:_e="namiAPIHost=",USE_STAGING_API:Me="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:Ee="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:Pe=":",VALIDATE_PRODUCT_GROUPS:Te="validateProductGroups",EXTENDED_PLATFORM:xe="extended-platform",EXTENDED_PLATFORM_VERSION:Ae="extended-platform-version",API_MAX_CALLS_LIMIT:Ce=2,API_RETRY_DELAY_SEC:Le=2,API_TIMEOUT_LIMIT:Ie=2e4,DEVICE_API_TIMEOUT_LIMIT:De=2e3,STATUS_SUCCESS:Re=200,STATUS_BAD_REQUEST:Ne=400,STATUS_NOT_FOUND:We=404,STATUS_CONFLICT:Fe=409,STATUS_INTERNAL_SERVER_ERROR:Oe=500,INITIAL_SUCCESS:$e="Initial success",RECONFIG_SUCCESS:je="Reconfig success",ALREADY_CONFIGURED:ze="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:He="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:Be="PaywallActionEvent",AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED:Ue="AvailableActiveEntitlementsChanged",CUSTOMER_JOURNEY_STATE_CHANGED:Ge="CustomerJourneyStateChanged",SKU_TEXT_REGEX:Ve=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:Xe=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,HTML_REGEX:Ke=/<\/?[a-z][\s\S]*>/i,SMART_TEXT_PATTERN:Ye="${",LIQUID_VARIABLE_REGEX:qe=/\${[A-Za-z0-9.]+}/g}={};var Je;e.LogLevel=void 0,(Je=e.LogLevel||(e.LogLevel={}))[Je.DEBUG=1]="DEBUG",Je[Je.INFO=2]="INFO",Je[Je.WARN=3]="WARN",Je[Je.ERROR=4]="ERROR";const Qe={debug:e.LogLevel.DEBUG,info:e.LogLevel.INFO,warn:e.LogLevel.WARN,error:e.LogLevel.ERROR};const Ze=new class{constructor(){this.currentLogLevel=e.LogLevel.DEBUG,this.setLogger=t=>{this.currentLogLevel=t?Qe[t]:e.LogLevel.WARN}}debug(t,...n){this.shouldLog(e.LogLevel.DEBUG)&&console.debug(this.formatMessage(e.LogLevel.DEBUG,t,...n))}info(t,...n){this.shouldLog(e.LogLevel.INFO)&&console.info(this.formatMessage(e.LogLevel.INFO,t,...n))}warn(t,...n){this.shouldLog(e.LogLevel.WARN)&&console.warn(this.formatMessage(e.LogLevel.WARN,t,...n))}error(t,...n){this.shouldLog(e.LogLevel.ERROR)&&console.error(this.formatMessage(e.LogLevel.ERROR,t,...n))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(t,n,...i){const a=e.LogLevel[t];return`[${(new Date).toISOString()}] [${a}] ${n} ${i=i.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}};function et(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 tt(e,t){return e===t||e!=e&&t!=t}function nt(e,t){for(var n=e.length;n--;)if(tt(e[n][0],t))return n;return-1}var it=Array.prototype.splice;function at(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])}}at.prototype.clear=function(){this.__data__=[],this.size=0},at.prototype.delete=function(e){var t=this.__data__,n=nt(t,e);return!(n<0)&&(n==t.length-1?t.pop():it.call(t,n,1),--this.size,!0)},at.prototype.get=function(e){var t=this.__data__,n=nt(t,e);return n<0?void 0:t[n][1]},at.prototype.has=function(e){return nt(this.__data__,e)>-1},at.prototype.set=function(e,t){var n=this.__data__,i=nt(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var rt="object"==typeof global&&global&&global.Object===Object&&global,ot="object"==typeof self&&self&&self.Object===Object&&self,st=rt||ot||Function("return this")(),lt=st.Symbol,dt=Object.prototype,ut=dt.hasOwnProperty,ct=dt.toString,ht=lt?lt.toStringTag:void 0;var mt=Object.prototype.toString;var ft="[object Null]",pt="[object Undefined]",gt=lt?lt.toStringTag:void 0;function vt(e){return null==e?void 0===e?pt:ft:gt&&gt in Object(e)?function(e){var t=ut.call(e,ht),n=e[ht];try{e[ht]=void 0;var i=!0}catch(e){}var a=ct.call(e);return i&&(t?e[ht]=n:delete e[ht]),a}(e):function(e){return mt.call(e)}(e)}function yt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var bt="[object AsyncFunction]",wt="[object Function]",kt="[object GeneratorFunction]",St="[object Proxy]";function _t(e){if(!yt(e))return!1;var t=vt(e);return t==wt||t==kt||t==bt||t==St}var Mt,Et=st["__core-js_shared__"],Pt=(Mt=/[^.]+$/.exec(Et&&Et.keys&&Et.keys.IE_PROTO||""))?"Symbol(src)_1."+Mt:"";var Tt=Function.prototype.toString;function xt(e){if(null!=e){try{return Tt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var At=/^\[object .+?Constructor\]$/,Ct=Function.prototype,Lt=Object.prototype,It=Ct.toString,Dt=Lt.hasOwnProperty,Rt=RegExp("^"+It.call(Dt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nt(e){return!(!yt(e)||(t=e,Pt&&Pt in t))&&(_t(e)?Rt:At).test(xt(e));var t}function Wt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Nt(n)?n:void 0}var Ft=Wt(st,"Map"),Ot=Wt(Object,"create");var $t=Object.prototype.hasOwnProperty;var jt=Object.prototype.hasOwnProperty;function zt(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 Ht(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 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])}}zt.prototype.clear=function(){this.__data__=Ot?Ot(null):{},this.size=0},zt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},zt.prototype.get=function(e){var t=this.__data__;if(Ot){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return $t.call(t,e)?t[e]:void 0},zt.prototype.has=function(e){var t=this.__data__;return Ot?void 0!==t[e]:jt.call(t,e)},zt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ot&&void 0===t?"__lodash_hash_undefined__":t,this},Bt.prototype.clear=function(){this.size=0,this.__data__={hash:new zt,map:new(Ft||at),string:new zt}},Bt.prototype.delete=function(e){var t=Ht(this,e).delete(e);return this.size-=t?1:0,t},Bt.prototype.get=function(e){return Ht(this,e).get(e)},Bt.prototype.has=function(e){return Ht(this,e).has(e)},Bt.prototype.set=function(e,t){var n=Ht(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Ut(e){var t=this.__data__=new at(e);this.size=t.size}Ut.prototype.clear=function(){this.__data__=new at,this.size=0},Ut.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ut.prototype.get=function(e){return this.__data__.get(e)},Ut.prototype.has=function(e){return this.__data__.has(e)},Ut.prototype.set=function(e,t){var n=this.__data__;if(n instanceof at){var i=n.__data__;if(!Ft||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Bt(i)}return n.set(e,t),this.size=n.size,this};function Gt(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Bt;++t<n;)this.add(e[t])}function Vt(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 Xt(e,t){return e.has(t)}Gt.prototype.add=Gt.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Gt.prototype.has=function(e){return this.__data__.has(e)};var Kt=1,Yt=2;function qt(e,t,n,i,a,r){var o=n&Kt,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var d=r.get(e),u=r.get(t);if(d&&u)return d==t&&u==e;var c=-1,h=!0,m=n&Yt?new Gt:void 0;for(r.set(e,t),r.set(t,e);++c<s;){var f=e[c],p=t[c];if(i)var g=o?i(p,f,c,t,e,r):i(f,p,c,e,t,r);if(void 0!==g){if(g)continue;h=!1;break}if(m){if(!Vt(t,(function(e,t){if(!Xt(m,t)&&(f===e||a(f,e,n,i,r)))return m.push(t)}))){h=!1;break}}else if(f!==p&&!a(f,p,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Jt=st.Uint8Array;function Qt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Zt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var en=1,tn=2,nn="[object Boolean]",an="[object Date]",rn="[object Error]",on="[object Map]",sn="[object Number]",ln="[object RegExp]",dn="[object Set]",un="[object String]",cn="[object Symbol]",hn="[object ArrayBuffer]",mn="[object DataView]",fn=lt?lt.prototype:void 0,pn=fn?fn.valueOf:void 0;function gn(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}var vn=Array.isArray;function yn(e,t,n){var i=t(e);return vn(e)?i:gn(i,n(e))}function bn(){return[]}var wn=Object.prototype.propertyIsEnumerable,kn=Object.getOwnPropertySymbols,Sn=kn?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}(kn(e),(function(t){return wn.call(e,t)})))}:bn;function _n(e){return null!=e&&"object"==typeof e}function Mn(e){return _n(e)&&"[object Arguments]"==vt(e)}var En=Object.prototype,Pn=En.hasOwnProperty,Tn=En.propertyIsEnumerable,xn=Mn(function(){return arguments}())?Mn:function(e){return _n(e)&&Pn.call(e,"callee")&&!Tn.call(e,"callee")};var An="object"==typeof e&&e&&!e.nodeType&&e,Cn=An&&"object"==typeof module&&module&&!module.nodeType&&module,Ln=Cn&&Cn.exports===An?st.Buffer:void 0,In=(Ln?Ln.isBuffer:void 0)||function(){return!1},Dn=9007199254740991,Rn=/^(?:0|[1-9]\d*)$/;function Nn(e,t){var n=typeof e;return!!(t=null==t?Dn:t)&&("number"==n||"symbol"!=n&&Rn.test(e))&&e>-1&&e%1==0&&e<t}var Wn=9007199254740991;function Fn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Wn}var On={};function $n(e){return function(t){return e(t)}}On["[object Float32Array]"]=On["[object Float64Array]"]=On["[object Int8Array]"]=On["[object Int16Array]"]=On["[object Int32Array]"]=On["[object Uint8Array]"]=On["[object Uint8ClampedArray]"]=On["[object Uint16Array]"]=On["[object Uint32Array]"]=!0,On["[object Arguments]"]=On["[object Array]"]=On["[object ArrayBuffer]"]=On["[object Boolean]"]=On["[object DataView]"]=On["[object Date]"]=On["[object Error]"]=On["[object Function]"]=On["[object Map]"]=On["[object Number]"]=On["[object Object]"]=On["[object RegExp]"]=On["[object Set]"]=On["[object String]"]=On["[object WeakMap]"]=!1;var jn="object"==typeof e&&e&&!e.nodeType&&e,zn=jn&&"object"==typeof module&&module&&!module.nodeType&&module,Hn=zn&&zn.exports===jn&&rt.process,Bn=function(){try{var e=zn&&zn.require&&zn.require("util").types;return e||Hn&&Hn.binding&&Hn.binding("util")}catch(e){}}(),Un=Bn&&Bn.isTypedArray,Gn=Un?$n(Un):function(e){return _n(e)&&Fn(e.length)&&!!On[vt(e)]},Vn=Object.prototype.hasOwnProperty;function Xn(e,t){var n=vn(e),i=!n&&xn(e),a=!n&&!i&&In(e),r=!n&&!i&&!a&&Gn(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):[],l=s.length;for(var d in e)!t&&!Vn.call(e,d)||o&&("length"==d||a&&("offset"==d||"parent"==d)||r&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||Nn(d,l))||s.push(d);return s}var Kn=Object.prototype;function Yn(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Kn)}function qn(e,t){return function(n){return e(t(n))}}var Jn=qn(Object.keys,Object),Qn=Object.prototype.hasOwnProperty;function Zn(e){return null!=e&&Fn(e.length)&&!_t(e)}function ei(e){return Zn(e)?Xn(e):function(e){if(!Yn(e))return Jn(e);var t=[];for(var n in Object(e))Qn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}function ti(e){return yn(e,ei,Sn)}var ni=1,ii=Object.prototype.hasOwnProperty;var ai=Wt(st,"DataView"),ri=Wt(st,"Promise"),oi=Wt(st,"Set"),si=Wt(st,"WeakMap"),li="[object Map]",di="[object Promise]",ui="[object Set]",ci="[object WeakMap]",hi="[object DataView]",mi=xt(ai),fi=xt(Ft),pi=xt(ri),gi=xt(oi),vi=xt(si),yi=vt;(ai&&yi(new ai(new ArrayBuffer(1)))!=hi||Ft&&yi(new Ft)!=li||ri&&yi(ri.resolve())!=di||oi&&yi(new oi)!=ui||si&&yi(new si)!=ci)&&(yi=function(e){var t=vt(e),n="[object Object]"==t?e.constructor:void 0,i=n?xt(n):"";if(i)switch(i){case mi:return hi;case fi:return li;case pi:return di;case gi:return ui;case vi:return ci}return t});var bi=1,wi="[object Arguments]",ki="[object Array]",Si="[object Object]",_i=Object.prototype.hasOwnProperty;function Mi(e,t,n,i,a,r){var o=vn(e),s=vn(t),l=o?ki:yi(e),d=s?ki:yi(t),u=(l=l==wi?Si:l)==Si,c=(d=d==wi?Si:d)==Si,h=l==d;if(h&&In(e)){if(!In(t))return!1;o=!0,u=!1}if(h&&!u)return r||(r=new Ut),o||Gn(e)?qt(e,t,n,i,a,r):function(e,t,n,i,a,r,o){switch(n){case mn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case hn:return!(e.byteLength!=t.byteLength||!r(new Jt(e),new Jt(t)));case nn:case an:case sn:return tt(+e,+t);case rn:return e.name==t.name&&e.message==t.message;case ln:case un:return e==t+"";case on:var s=Qt;case dn:var l=i&en;if(s||(s=Zt),e.size!=t.size&&!l)return!1;var d=o.get(e);if(d)return d==t;i|=tn,o.set(e,t);var u=qt(s(e),s(t),i,a,r,o);return o.delete(e),u;case cn:if(pn)return pn.call(e)==pn.call(t)}return!1}(e,t,l,n,i,a,r);if(!(n&bi)){var m=u&&_i.call(e,"__wrapped__"),f=c&&_i.call(t,"__wrapped__");if(m||f){var p=m?e.value():e,g=f?t.value():t;return r||(r=new Ut),a(p,g,n,i,r)}}return!!h&&(r||(r=new Ut),function(e,t,n,i,a,r){var o=n&ni,s=ti(e),l=s.length;if(l!=ti(t).length&&!o)return!1;for(var d=l;d--;){var u=s[d];if(!(o?u in t:ii.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;++d<l;){var p=e[u=s[d]],g=t[u];if(i)var v=o?i(g,p,u,t,e,r):i(p,g,u,e,t,r);if(!(void 0===v?p===g||a(p,g,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 Ei(e,t,n,i,a){return e===t||(null==e||null==t||!_n(e)&&!_n(t)?e!=e&&t!=t:Mi(e,t,n,i,Ei,a))}var Pi=1,Ti=2;function xi(e){return e==e&&!yt(e)}function Ai(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function Ci(e){var t=function(e){for(var t=ei(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,xi(a)]}return t}(e);return 1==t.length&&t[0][2]?Ai(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],l=e[s],d=o[1];if(o[2]){if(void 0===l&&!(s in e))return!1}else{var u=new Ut;if(!Ei(d,l,Pi|Ti,i,u))return!1}}return!0}(n,0,t)}}var Li="[object Symbol]";function Ii(e){return"symbol"==typeof e||_n(e)&&vt(e)==Li}var Di=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/;function Ni(e,t){if(vn(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ii(e))||(Ri.test(e)||!Di.test(e)||null!=t&&e in Object(t))}var Wi="Expected a function";function Fi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Wi);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(Fi.Cache||Bt),n}Fi.Cache=Bt;var Oi,$i,ji,zi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hi=/\\(\\)?/g,Bi=(Oi=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(zi,(function(e,n,i,a){t.push(i?a.replace(Hi,"$1"):n||e)})),t},$i=Fi(Oi,(function(e){return 500===ji.size&&ji.clear(),e})),ji=$i.cache,$i);var Ui=1/0,Gi=lt?lt.prototype:void 0,Vi=Gi?Gi.toString:void 0;function Xi(e){if("string"==typeof e)return e;if(vn(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,Xi)+"";if(Ii(e))return Vi?Vi.call(e):"";var t=e+"";return"0"==t&&1/e==-Ui?"-0":t}function Ki(e){return null==e?"":Xi(e)}function Yi(e,t){return vn(e)?e:Ni(e,t)?[e]:Bi(Ki(e))}var qi=1/0;function Ji(e){if("string"==typeof e||Ii(e))return e;var t=e+"";return"0"==t&&1/e==-qi?"-0":t}function Qi(e,t){for(var n=0,i=(t=Yi(t,e)).length;null!=e&&n<i;)e=e[Ji(t[n++])];return n&&n==i?e:void 0}function Zi(e,t){return null!=e&&t in Object(e)}function ea(e,t){return null!=e&&function(e,t,n){for(var i=-1,a=(t=Yi(t,e)).length,r=!1;++i<a;){var o=Ji(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=a?r:!!(a=null==e?0:e.length)&&Fn(a)&&Nn(o,a)&&(vn(e)||xn(e))}(e,t,Zi)}var ta=1,na=2;function ia(e,t){return Ni(e)&&xi(t)?Ai(Ji(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:Qi(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?ea(n,e):Ei(t,i,ta|na)}}function aa(e){return e}function ra(e){return Ni(e)?(t=Ji(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Qi(t,e)}}(e);var t}function oa(e){return e!=e}function sa(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,oa,n)}(e,t,0)>-1}var la=oi&&1/Zt(new oi([,-0]))[1]==1/0?function(e){return new oi(e)}:function(){},da=200;function ua(e,t){return e&&e.length?function(e,t,n){var i=-1,a=sa,r=e.length,o=!0,s=[],l=s;if(r>=da){var d=t?null:la(e);if(d)return Zt(d);o=!1,a=Xt,l=new Gt}else l=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=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),s.push(u)}else a(l,c,n)||(l!==s&&l.push(c),s.push(u))}return s}(e,"function"==typeof(n=t)?n:null==n?aa:"object"==typeof n?vn(n)?ia(n[0],n[1]):Ci(n):ra(n)):[];var n}const ca=new class{constructor(){this.memoryStore={}}setDevice(e){this.setItem(V,e)}getDevice(){return this.getItem(V)}resetDevice(){this.resetItem(V)}getAnonymousMode(){return this.getItem(de)||!1}setAnonymousMode(e){this.setItem(de,e)}clearAnonymousMode(){this.resetItem(de)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setLanguageCode(e){this.setItem(ve,e||"en")}getLanguageCode(){return this.getItem(ve)||"en"}setCampaignRules(e,t){e!==ie?e!==q||0!==this.getCampaignCacheTtl()?this.setItem(e,t):this.memoryStore[q]=JSON.stringify(t):this.memoryStore[ie]=JSON.stringify(t)}getCampaignRules(e){if(e===ie)return this.memoryStore[ie]?JSON.parse(this.memoryStore[ie]):null;if(e===q){const e=this.memoryStore[q];if(null!=e)return JSON.parse(e);let t=this.getItem(q);if(null===t)return null;if("string"==typeof t)try{t=JSON.parse(t)}catch{return t}return this.isLegacyTimestampedCache(t)?t.data:t}return this.getItem(e)}setPaywalls(e,t){e!==ae?e!==J||0!==this.getCampaignCacheTtl()?this.setItem(e,t):this.memoryStore[J]=JSON.stringify(t):this.memoryStore[ae]=JSON.stringify(t)}getPaywalls(e){if(e===ae)return this.memoryStore[ae]?JSON.parse(this.memoryStore[ae]):null;if(e===J){const e=this.memoryStore[J];if(null!=e)return JSON.parse(e);let t=this.getItem(J);if(null===t)return null;if("string"==typeof t)try{t=JSON.parse(t)}catch{return t}return this.isLegacyTimestampedCache(t)?t.data:t}return this.getItem(e)}setActiveEntitlements(e,t){this.setItem(e,t)}getActiveEntitlements(e){return this.getItem(e)||[]}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(Z)??[];return ua(et([...this.getItem(re)??[],...e]),"sku_ref_id")}setNamiConfig(e){this.setItem(X,e)}getNamiConfig(){return this.getItem(X)}setCustomerAttribute(e,t){this.setItem(se+e,t)}getCustomerAttribute(e){return this.getItem(se+e)}getAllCustomerAttributes(){return Object.entries(localStorage).filter((([e])=>e.includes(se))).map((([e,t])=>e.replace(se,"")+":"+t))}getAllCustomerAttributesKeys(){return Object.keys(localStorage).filter((e=>e.includes(se))).map((e=>e.replace(se,"")))}clearCustomerAttribute(e){const t=se+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}clearAllCustomerAttributes(){Object.keys(localStorage).filter((e=>e.includes(se))).map((e=>this.resetItem(e)))}setNamiProfile(e){this.setItem(K,e)}getNamiProfile(){return this.getItem(K)}removeNamiProfile(){this.resetItem(K)}setCustomerJourneyState(e){this.setItem(le,e)}getCustomerJourneyState(){return this.getItem(le)}setSessionCounter(){const e=this.getItem(ce),t=e?parseInt(e):he||he;this.setItem(ce,t+1)}getSessionCounter(){const e=this.getItem(ce);return e?parseInt(e):he}setLastImpressionId(e){this.setItem(me,e)}getLastImpressionId(){return this.getItem(me)??""}setPurchaseImpression(){const e=this.getLastImpressionId()??"";this.setItem(fe,e)}getPurchaseImpression(){return this.getItem(fe)??""}setSessionId(e){e&&this.setItem(ge,e)}getSessionId(){return this.getItem(ge)??""}clearSessionId(){this.resetItem(ge)}setLaunchId(e){e&&this.setItem(pe,e)}getLaunchId(){return this.getItem(pe)??""}clearLaunchId(){this.resetItem(pe)}setPurchaseChannel(e){e&&this.setItem(ye,e)}getPurchaseChannel(){return this.getItem(ye)}getAnonymousUUID(){return this.getItem(ue)}setAnonymousUUID(e){this.setItem(ue,e)}clearAnonymousUUID(){this.resetItem(ue)}setApiCampaignSessionTimestamp(){this.setItem(Q,Date.now())}getApiCampaignSessionTimestamp(){return this.getItem(Q)}purgeApiCampaignCache(){this.resetItem(J),this.resetItem(q),this.resetItem(Q)}getCampaignCacheTtl(){const e=this.getAppConfig(Y)||this.getAppConfig(ne);return e?.campaign_cache_ttl??null}isLegacyTimestampedCache(e){return"object"==typeof e&&null!==e&&"cachedAt"in e&&"data"in e}setItem(e,t){let n;try{n=JSON.stringify(t)}catch(t){return void Ze.error(`Serialization failed for ${e}`,t)}try{localStorage.setItem(e,n)}catch(t){Ze.error("Error setting item in localStorage:",t),this.resetItem(e),this.memoryStore[e]=n}}getItem(e){try{const t=localStorage.getItem(e);if(null!==t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&Ze.error("Error getting item from localStorage:",e,": ",t)}const t=this.memoryStore[e];return null!=t?JSON.parse(t):null}resetItem(e){try{localStorage.removeItem(e)}catch(t){"undefined"!=typeof window&&Ze.error("Error removing item from localStorage:",e,": ",t)}delete this.memoryStore[e]}clear(){try{localStorage.clear()}catch(e){Ze.error("Error clearing localStorage:",e)}this.memoryStore={}}};class ha extends Error{constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class ma extends Error{}class fa extends ma{constructor(){super(),this.status=409,this.name="ConflictError",this.message="ConflictError: Server responded with conflict"}}class pa extends Error{constructor(){super(F)}}class ga extends Error{constructor(){super(R)}}class va extends Error{constructor(){super(N)}}class ya extends Error{constructor(){super(W)}}class ba extends Error{constructor(){super(O)}}class wa extends Error{constructor(){super($)}}class ka extends Error{constructor(){super(z)}}class Sa extends Error{constructor(){super(H)}}class _a extends Error{constructor(){super(H)}}class Ma extends Error{constructor(){super(j)}}class Ea extends ma{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class Pa extends ma{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class Ta extends ma{constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class xa extends ma{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const Aa=(e,t)=>{if(e==Ne)throw new Ea(t);if(e==We)throw new Pa(t);if(e==Fe)throw new fa;if(e>Ne&&e<Oe)throw new Ta(e,t);if(e>=Oe)throw new xa(t)};async function Ca(e,t,n=Ie,i=Ce){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(o.status==Fe)throw new fa;if(a++,a<=i){const e=1e3*(a+Le);return await new Promise((t=>setTimeout(t,e))),r()}throw new ha(o.status,`Request failed after ${i} retries`)}return o};return(await r()).json()}function La(e){let t=e.length;for(;--t>=0;)e[t]=0}const Ia=256,Da=286,Ra=30,Na=15,Wa=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Fa=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Oa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),$a=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ja=new Array(576);La(ja);const za=new Array(60);La(za);const Ha=new Array(512);La(Ha);const Ba=new Array(256);La(Ba);const Ua=new Array(29);La(Ua);const Ga=new Array(Ra);function Va(e,t,n,i,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=a,this.has_stree=e&&e.length}let Xa,Ka,Ya;function qa(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}La(Ga);const Ja=e=>e<256?Ha[e]:Ha[256+(e>>>7)],Qa=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Za=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Qa(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},er=(e,t,n)=>{Za(e,n[2*t],n[2*t+1])},tr=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},nr=(e,t,n)=>{const i=new Array(16);let a,r,o=0;for(a=1;a<=Na;a++)o=o+n[a-1]<<1,i[a]=o;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=tr(i[t]++,t))}},ir=e=>{let t;for(t=0;t<Da;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ra;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},ar=e=>{e.bi_valid>8?Qa(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},rr=(e,t,n,i)=>{const a=2*t,r=2*n;return e[a]<e[r]||e[a]===e[r]&&i[t]<=i[n]},or=(e,t,n)=>{const i=e.heap[n];let a=n<<1;for(;a<=e.heap_len&&(a<e.heap_len&&rr(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!rr(t,i,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=i},sr=(e,t,n)=>{let i,a,r,o,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,a=e.pending_buf[e.sym_buf+s++],0===i?er(e,a,t):(r=Ba[a],er(e,r+Ia+1,t),o=Wa[r],0!==o&&(a-=Ua[r],Za(e,a,o)),i--,r=Ja(i),er(e,r,n),o=Fa[r],0!==o&&(i-=Ga[r],Za(e,i,o)))}while(s<e.sym_next);er(e,256,t)},lr=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,r=t.stat_desc.elems;let o,s,l,d=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<r;o++)0!==n[2*o]?(e.heap[++e.heap_len]=d=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=d<2?++d:0,n[2*l]=1,e.depth[l]=0,e.opt_len--,a&&(e.static_len-=i[2*l+1]);for(t.max_code=d,o=e.heap_len>>1;o>=1;o--)or(e,n,o);l=r;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],or(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[2*l]=n[2*o]+n[2*s],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[2*o+1]=n[2*s+1]=l,e.heap[1]=l++,or(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,i=t.max_code,a=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let d,u,c,h,m,f,p=0;for(h=0;h<=Na;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,d=e.heap_max+1;d<573;d++)u=e.heap[d],h=n[2*n[2*u+1]+1]+1,h>l&&(h=l,p++),n[2*u+1]=h,u>i||(e.bl_count[h]++,m=0,u>=s&&(m=o[u-s]),f=n[2*u],e.opt_len+=f*(h+m),r&&(e.static_len+=f*(a[2*u+1]+m)));if(0!==p){do{for(h=l-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(h=l;0!==h;h--)for(u=e.bl_count[h];0!==u;)c=e.heap[--d],c>i||(n[2*c+1]!==h&&(e.opt_len+=(h-n[2*c+1])*n[2*c],n[2*c+1]=h),u--)}})(e,t),nr(n,d,e.bl_count)},dr=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,l=7,d=4;for(0===o&&(l=138,d=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)a=o,o=t[2*(i+1)+1],++s<l&&a===o||(s<d?e.bl_tree[2*a]+=s:0!==a?(a!==r&&e.bl_tree[2*a]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,r=a,0===o?(l=138,d=3):a===o?(l=6,d=3):(l=7,d=4))},ur=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,l=7,d=4;for(0===o&&(l=138,d=3),i=0;i<=n;i++)if(a=o,o=t[2*(i+1)+1],!(++s<l&&a===o)){if(s<d)do{er(e,a,e.bl_tree)}while(0!=--s);else 0!==a?(a!==r&&(er(e,a,e.bl_tree),s--),er(e,16,e.bl_tree),Za(e,s-3,2)):s<=10?(er(e,17,e.bl_tree),Za(e,s-3,3)):(er(e,18,e.bl_tree),Za(e,s-11,7));s=0,r=a,0===o?(l=138,d=3):a===o?(l=6,d=3):(l=7,d=4)}};let cr=!1;const hr=(e,t,n,i)=>{Za(e,0+(i?1:0),3),ar(e),Qa(e,n),Qa(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var mr=e=>{cr||((()=>{let e,t,n,i,a;const r=new Array(16);for(n=0,i=0;i<28;i++)for(Ua[i]=n,e=0;e<1<<Wa[i];e++)Ba[n++]=i;for(Ba[n-1]=i,a=0,i=0;i<16;i++)for(Ga[i]=a,e=0;e<1<<Fa[i];e++)Ha[a++]=i;for(a>>=7;i<Ra;i++)for(Ga[i]=a<<7,e=0;e<1<<Fa[i]-7;e++)Ha[256+a++]=i;for(t=0;t<=Na;t++)r[t]=0;for(e=0;e<=143;)ja[2*e+1]=8,e++,r[8]++;for(;e<=255;)ja[2*e+1]=9,e++,r[9]++;for(;e<=279;)ja[2*e+1]=7,e++,r[7]++;for(;e<=287;)ja[2*e+1]=8,e++,r[8]++;for(nr(ja,287,r),e=0;e<Ra;e++)za[2*e+1]=5,za[2*e]=tr(e,5);Xa=new Va(ja,Wa,257,Da,Na),Ka=new Va(za,Fa,0,Ra,Na),Ya=new Va(new Array(0),Oa,0,19,7)})(),cr=!0),e.l_desc=new qa(e.dyn_ltree,Xa),e.d_desc=new qa(e.dyn_dtree,Ka),e.bl_desc=new qa(e.bl_tree,Ya),e.bi_buf=0,e.bi_valid=0,ir(e)},fr=(e,t,n,i)=>{let a,r,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Ia;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),lr(e,e.l_desc),lr(e,e.d_desc),o=(e=>{let t;for(dr(e,e.dyn_ltree,e.l_desc.max_code),dr(e,e.dyn_dtree,e.d_desc.max_code),lr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*$a[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),a=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=a&&(a=r)):a=r=n+5,n+4<=a&&-1!==t?hr(e,t,n,i):4===e.strategy||r===a?(Za(e,2+(i?1:0),3),sr(e,ja,za)):(Za(e,4+(i?1:0),3),((e,t,n,i)=>{let a;for(Za(e,t-257,5),Za(e,n-1,5),Za(e,i-4,4),a=0;a<i;a++)Za(e,e.bl_tree[2*$a[a]+1],3);ur(e,e.dyn_ltree,t-1),ur(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),sr(e,e.dyn_ltree,e.dyn_dtree)),ir(e),i&&ar(e)},pr=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(Ba[n]+Ia+1)]++,e.dyn_dtree[2*Ja(t)]++),e.sym_next===e.sym_end),gr=e=>{Za(e,2,3),er(e,256,ja),(e=>{16===e.bi_valid?(Qa(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)},vr={_tr_init:mr,_tr_stored_block:hr,_tr_flush_block:fr,_tr_tally:pr,_tr_align:gr};var yr=(e,t,n,i)=>{let a=65535&e,r=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{a=a+t[i++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16};const br=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var wr=(e,t,n,i)=>{const a=br,r=i+n;e^=-1;for(let n=i;n<r;n++)e=e>>>8^a[255&(e^t[n])];return~e},kr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Sr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:_r,_tr_stored_block:Mr,_tr_flush_block:Er,_tr_tally:Pr,_tr_align:Tr}=vr,{Z_NO_FLUSH:xr,Z_PARTIAL_FLUSH:Ar,Z_FULL_FLUSH:Cr,Z_FINISH:Lr,Z_BLOCK:Ir,Z_OK:Dr,Z_STREAM_END:Rr,Z_STREAM_ERROR:Nr,Z_DATA_ERROR:Wr,Z_BUF_ERROR:Fr,Z_DEFAULT_COMPRESSION:Or,Z_FILTERED:$r,Z_HUFFMAN_ONLY:jr,Z_RLE:zr,Z_FIXED:Hr,Z_DEFAULT_STRATEGY:Br,Z_UNKNOWN:Ur,Z_DEFLATED:Gr}=Sr,Vr=258,Xr=262,Kr=42,Yr=113,qr=666,Jr=(e,t)=>(e.msg=kr[t],t),Qr=e=>2*e-(e>4?9:0),Zr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},eo=e=>{let t,n,i,a=e.w_size;t=e.hash_size,i=t;do{n=e.head[--i],e.head[i]=n>=a?n-a:0}while(--t);t=a,i=t;do{n=e.prev[--i],e.prev[i]=n>=a?n-a:0}while(--t)};let to=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const no=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},io=(e,t)=>{Er(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,no(e.strm)},ao=(e,t)=>{e.pending_buf[e.pending++]=t},ro=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},oo=(e,t,n,i)=>{let a=e.avail_in;return a>i&&(a=i),0===a?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),1===e.state.wrap?e.adler=yr(e.adler,t,a,n):2===e.state.wrap&&(e.adler=wr(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},so=(e,t)=>{let n,i,a=e.max_chain_length,r=e.strstart,o=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-Xr?e.strstart-(e.w_size-Xr):0,d=e.window,u=e.w_mask,c=e.prev,h=e.strstart+Vr;let m=d[r+o-1],f=d[r+o];e.prev_length>=e.good_match&&(a>>=2),s>e.lookahead&&(s=e.lookahead);do{if(n=t,d[n+o]===f&&d[n+o-1]===m&&d[n]===d[r]&&d[++n]===d[r+1]){r+=2,n++;do{}while(d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&r<h);if(i=Vr-(h-r),r=h-Vr,i>o){if(e.match_start=t,o=i,i>=s)break;m=d[r+o-1],f=d[r+o]}}}while((t=c[t&u])>l&&0!=--a);return o<=e.lookahead?o:e.lookahead},lo=e=>{const t=e.w_size;let n,i,a;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Xr)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),eo(e),i+=t),0===e.strm.avail_in)break;if(n=oo(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=to(e,e.ins_h,e.window[a+1]);e.insert&&(e.ins_h=to(e,e.ins_h,e.window[a+3-1]),e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Xr&&0!==e.strm.avail_in)},uo=(e,t)=>{let n,i,a,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,s=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a)break;if(a=e.strm.avail_out-a,i=e.strstart-e.block_start,n>i+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n<r&&(0===n&&t!==Lr||t===xr||n!==i+e.strm.avail_in))break;o=t===Lr&&n===i+e.strm.avail_in?1:0,Mr(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,no(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(oo(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==xr&&t!==Lr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(oo(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,r=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=r||(i||t===Lr)&&t!==xr&&0===e.strm.avail_in&&i<=a)&&(n=i>a?a:i,o=t===Lr&&0===e.strm.avail_in&&n===i?1:0,Mr(e,e.block_start,n,o),e.block_start+=n,no(e.strm)),o?3:1)},co=(e,t)=>{let n,i;for(;;){if(e.lookahead<Xr){if(lo(e),e.lookahead<Xr&&t===xr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-Xr&&(e.match_length=so(e,n)),e.match_length>=3)if(i=Pr(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=to(e,e.ins_h,e.window[e.strstart+1]);else i=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(io(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2},ho=(e,t)=>{let n,i,a;for(;;){if(e.lookahead<Xr){if(lo(e),e.lookahead<Xr&&t===xr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Xr&&(e.match_length=so(e,n),e.match_length<=5&&(e.strategy===$r||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,i=Pr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=to(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(io(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Pr(e,0,e.window[e.strstart-1]),i&&io(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Pr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2};function mo(e,t,n,i,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=a}const fo=[new mo(0,0,0,0,uo),new mo(4,4,8,4,co),new mo(4,5,16,8,co),new mo(4,6,32,32,co),new mo(4,4,16,16,ho),new mo(8,16,32,32,ho),new mo(8,16,128,128,ho),new mo(8,32,128,256,ho),new mo(32,128,258,1024,ho),new mo(32,258,258,4096,ho)];function po(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Gr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Zr(this.dyn_ltree),Zr(this.dyn_dtree),Zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Zr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const go=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Kr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Yr&&t.status!==qr?1:0},vo=e=>{if(go(e))return Jr(e,Nr);e.total_in=e.total_out=0,e.data_type=Ur;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Kr:Yr,e.adler=2===t.wrap?0:1,t.last_flush=-2,_r(t),Dr},yo=e=>{const t=vo(e);return t===Dr&&(e=>{e.window_size=2*e.w_size,Zr(e.head),e.max_lazy_match=fo[e.level].max_lazy,e.good_match=fo[e.level].good_length,e.nice_match=fo[e.level].nice_length,e.max_chain_length=fo[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0})(e.state),t},bo=(e,t,n,i,a,r)=>{if(!e)return Nr;let o=1;if(t===Or&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),a<1||a>9||n!==Gr||i<8||i>15||t<0||t>9||r<0||r>Hr||8===i&&1!==o)return Jr(e,Nr);8===i&&(i=9);const s=new po;return e.state=s,s.strm=e,s.status=Kr,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=a+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<a+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=r,s.method=n,yo(e)};var wo=(e,t)=>{if(go(e)||t>Ir||t<0)return e?Jr(e,Nr):Nr;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===qr&&t!==Lr)return Jr(e,0===e.avail_out?Fr:Nr);const i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(no(e),0===e.avail_out)return n.last_flush=-1,Dr}else if(0===e.avail_in&&Qr(t)<=Qr(i)&&t!==Lr)return Jr(e,Fr);if(n.status===qr&&0!==e.avail_in)return Jr(e,Fr);if(n.status===Kr&&0===n.wrap&&(n.status=Yr),n.status===Kr){let t=Gr+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=jr||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=i<<6,0!==n.strstart&&(t|=32),t+=31-t%31,ro(n,t),0!==n.strstart&&(ro(n,e.adler>>>16),ro(n,65535&e.adler)),e.adler=1,n.status=Yr,no(e),0!==n.pending)return n.last_flush=-1,Dr}if(57===n.status)if(e.adler=0,ao(n,31),ao(n,139),ao(n,8),n.gzhead)ao(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ao(n,255&n.gzhead.time),ao(n,n.gzhead.time>>8&255),ao(n,n.gzhead.time>>16&255),ao(n,n.gzhead.time>>24&255),ao(n,9===n.level?2:n.strategy>=jr||n.level<2?4:0),ao(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(ao(n,255&n.gzhead.extra.length),ao(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=wr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(ao(n,0),ao(n,0),ao(n,0),ao(n,0),ao(n,0),ao(n,9===n.level?2:n.strategy>=jr||n.level<2?4:0),ao(n,3),n.status=Yr,no(e),0!==n.pending)return n.last_flush=-1,Dr;if(69===n.status){if(n.gzhead.extra){let t=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let a=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=wr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=a,no(e),0!==n.pending)return n.last_flush=-1,Dr;t=0,i-=a}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>t&&(e.adler=wr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i)),no(e),0!==n.pending)return n.last_flush=-1,Dr;i=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,ao(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i)),no(e),0!==n.pending)return n.last_flush=-1,Dr;i=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,ao(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=wr(e.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(no(e),0!==n.pending))return n.last_flush=-1,Dr;ao(n,255&e.adler),ao(n,e.adler>>8&255),e.adler=0}if(n.status=Yr,no(e),0!==n.pending)return n.last_flush=-1,Dr}if(0!==e.avail_in||0!==n.lookahead||t!==xr&&n.status!==qr){let i=0===n.level?uo(n,t):n.strategy===jr?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(lo(e),0===e.lookahead)){if(t===xr)return 1;break}if(e.match_length=0,n=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(io(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===zr?((e,t)=>{let n,i,a,r;const o=e.window;for(;;){if(e.lookahead<=Vr){if(lo(e),e.lookahead<=Vr&&t===xr)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(a=e.strstart-1,i=o[a],i===o[++a]&&i===o[++a]&&i===o[++a])){r=e.strstart+Vr;do{}while(i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&a<r);e.match_length=Vr-(r-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=Pr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(io(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Lr?(io(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(io(e,!1),0===e.strm.avail_out)?1:2})(n,t):fo[n.level].func(n,t);if(3!==i&&4!==i||(n.status=qr),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),Dr;if(2===i&&(t===Ar?Tr(n):t!==Ir&&(Mr(n,0,0,!1),t===Cr&&(Zr(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),no(e),0===e.avail_out))return n.last_flush=-1,Dr}return t!==Lr?Dr:n.wrap<=0?Rr:(2===n.wrap?(ao(n,255&e.adler),ao(n,e.adler>>8&255),ao(n,e.adler>>16&255),ao(n,e.adler>>24&255),ao(n,255&e.total_in),ao(n,e.total_in>>8&255),ao(n,e.total_in>>16&255),ao(n,e.total_in>>24&255)):(ro(n,e.adler>>>16),ro(n,65535&e.adler)),no(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?Dr:Rr)},ko=(e,t)=>{let n=t.length;if(go(e))return Nr;const i=e.state,a=i.wrap;if(2===a||1===a&&i.status!==Kr||i.lookahead)return Nr;if(1===a&&(e.adler=yr(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){0===a&&(Zr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(n-i.w_size,n),0),t=e,n=i.w_size}const r=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,lo(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=to(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,lo(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=o,e.input=s,e.avail_in=r,i.wrap=a,Dr},So={deflateInit:(e,t)=>bo(e,t,Gr,15,8,Br),deflateInit2:bo,deflateReset:yo,deflateResetKeep:vo,deflateSetHeader:(e,t)=>go(e)||2!==e.state.wrap?Nr:(e.state.gzhead=t,Dr),deflate:wo,deflateEnd:e=>{if(go(e))return Nr;const t=e.state.status;return e.state=null,t===Yr?Jr(e,Wr):Dr},deflateSetDictionary:ko,deflateInfo:"pako deflate (from Nodeca project)"};const _o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Mo={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)_o(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,i=e.length;n<i;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,i=0,a=e.length;t<a;t++){let a=e[t];n.set(a,i),i+=a.length}return n}};let Eo=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Eo=!1}const Po=new Uint8Array(256);for(let e=0;e<256;e++)Po[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Po[254]=Po[254]=1;var To={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,i,a,r,o=e.length,s=0;for(a=0;a<o;a++)n=e.charCodeAt(a),55296==(64512&n)&&a+1<o&&(i=e.charCodeAt(a+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),a++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),r=0,a=0;r<s;a++)n=e.charCodeAt(a),55296==(64512&n)&&a+1<o&&(i=e.charCodeAt(a+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),a++)),n<128?t[r++]=n:n<2048?(t[r++]=192|n>>>6,t[r++]=128|63&n):n<65536?(t[r++]=224|n>>>12,t[r++]=128|n>>>6&63,t[r++]=128|63&n):(t[r++]=240|n>>>18,t[r++]=128|n>>>12&63,t[r++]=128|n>>>6&63,t[r++]=128|63&n);return t},buf2string:(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,a;const r=new Array(2*n);for(a=0,i=0;i<n;){let t=e[i++];if(t<128){r[a++]=t;continue}let o=Po[t];if(o>4)r[a++]=65533,i+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&i<n;)t=t<<6|63&e[i++],o--;o>1?r[a++]=65533:t<65536?r[a++]=t:(t-=65536,r[a++]=55296|t>>10&1023,r[a++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Eo)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n})(r,a)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+Po[e[n]]>t?n:t}};var xo=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Ao=Object.prototype.toString,{Z_NO_FLUSH:Co,Z_SYNC_FLUSH:Lo,Z_FULL_FLUSH:Io,Z_FINISH:Do,Z_OK:Ro,Z_STREAM_END:No,Z_DEFAULT_COMPRESSION:Wo,Z_DEFAULT_STRATEGY:Fo,Z_DEFLATED:Oo}=Sr;function $o(e){this.options=Mo.assign({level:Wo,method:Oo,chunkSize:16384,windowBits:15,memLevel:8,strategy:Fo},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xo,this.strm.avail_out=0;let n=So.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Ro)throw new Error(kr[n]);if(t.header&&So.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?To.string2buf(t.dictionary):"[object ArrayBuffer]"===Ao.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=So.deflateSetDictionary(this.strm,e),n!==Ro)throw new Error(kr[n]);this._dict_set=!0}}$o.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize;let a,r;if(this.ended)return!1;for(r=t===~~t?t:!0===t?Do:Co,"string"==typeof e?n.input=To.string2buf(e):"[object ArrayBuffer]"===Ao.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(r===Lo||r===Io)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(a=So.deflate(n,r),a===No)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),a=So.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ro;if(0!==n.avail_out){if(r>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},$o.prototype.onData=function(e){this.chunks.push(e)},$o.prototype.onEnd=function(e){e===Ro&&(this.result=Mo.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const jo=16209;var zo=function(e,t){let n,i,a,r,o,s,l,d,u,c,h,m,f,p,g,v,y,b,w,k,S,_,M,E;const P=e.state;n=e.next_in,M=e.input,i=n+(e.avail_in-5),a=e.next_out,E=e.output,r=a-(t-e.avail_out),o=a+(e.avail_out-257),s=P.dmax,l=P.wsize,d=P.whave,u=P.wnext,c=P.window,h=P.hold,m=P.bits,f=P.lencode,p=P.distcode,g=(1<<P.lenbits)-1,v=(1<<P.distbits)-1;e:do{m<15&&(h+=M[n++]<<m,m+=8,h+=M[n++]<<m,m+=8),y=f[h&g];t:for(;;){if(b=y>>>24,h>>>=b,m-=b,b=y>>>16&255,0===b)E[a++]=65535&y;else{if(!(16&b)){if(64&b){if(32&b){P.mode=16191;break e}e.msg="invalid literal/length code",P.mode=jo;break e}y=f[(65535&y)+(h&(1<<b)-1)];continue t}for(w=65535&y,b&=15,b&&(m<b&&(h+=M[n++]<<m,m+=8),w+=h&(1<<b)-1,h>>>=b,m-=b),m<15&&(h+=M[n++]<<m,m+=8,h+=M[n++]<<m,m+=8),y=p[h&v];;){if(b=y>>>24,h>>>=b,m-=b,b=y>>>16&255,16&b){if(k=65535&y,b&=15,m<b&&(h+=M[n++]<<m,m+=8,m<b&&(h+=M[n++]<<m,m+=8)),k+=h&(1<<b)-1,k>s){e.msg="invalid distance too far back",P.mode=jo;break e}if(h>>>=b,m-=b,b=a-r,k>b){if(b=k-b,b>d&&P.sane){e.msg="invalid distance too far back",P.mode=jo;break e}if(S=0,_=c,0===u){if(S+=l-b,b<w){w-=b;do{E[a++]=c[S++]}while(--b);S=a-k,_=E}}else if(u<b){if(S+=l+u-b,b-=u,b<w){w-=b;do{E[a++]=c[S++]}while(--b);if(S=0,u<w){b=u,w-=b;do{E[a++]=c[S++]}while(--b);S=a-k,_=E}}}else if(S+=u-b,b<w){w-=b;do{E[a++]=c[S++]}while(--b);S=a-k,_=E}for(;w>2;)E[a++]=_[S++],E[a++]=_[S++],E[a++]=_[S++],w-=3;w&&(E[a++]=_[S++],w>1&&(E[a++]=_[S++]))}else{S=a-k;do{E[a++]=E[S++],E[a++]=E[S++],E[a++]=E[S++],w-=3}while(w>2);w&&(E[a++]=E[S++],w>1&&(E[a++]=E[S++]))}break}if(64&b){e.msg="invalid distance code",P.mode=jo;break e}y=p[(65535&y)+(h&(1<<b)-1)]}}break}}while(n<i&&a<o);w=m>>3,n-=w,m-=w<<3,h&=(1<<m)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=a<o?o-a+257:257-(a-o),P.hold=h,P.bits=m};const Ho=15,Bo=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Uo=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Go=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Vo=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Xo=(e,t,n,i,a,r,o,s)=>{const l=s.bits;let d,u,c,h,m,f,p=0,g=0,v=0,y=0,b=0,w=0,k=0,S=0,_=0,M=0,E=null;const P=new Uint16Array(16),T=new Uint16Array(16);let x,A,C,L=null;for(p=0;p<=Ho;p++)P[p]=0;for(g=0;g<i;g++)P[t[n+g]]++;for(b=l,y=Ho;y>=1&&0===P[y];y--);if(b>y&&(b=y),0===y)return a[r++]=20971520,a[r++]=20971520,s.bits=1,0;for(v=1;v<y&&0===P[v];v++);for(b<v&&(b=v),S=1,p=1;p<=Ho;p++)if(S<<=1,S-=P[p],S<0)return-1;if(S>0&&(0===e||1!==y))return-1;for(T[1]=0,p=1;p<Ho;p++)T[p+1]=T[p]+P[p];for(g=0;g<i;g++)0!==t[n+g]&&(o[T[t[n+g]]++]=g);if(0===e?(E=L=o,f=20):1===e?(E=Bo,L=Uo,f=257):(E=Go,L=Vo,f=0),M=0,g=0,p=v,m=r,w=b,k=0,c=-1,_=1<<b,h=_-1,1===e&&_>852||2===e&&_>592)return 1;for(;;){x=p-k,o[g]+1<f?(A=0,C=o[g]):o[g]>=f?(A=L[o[g]-f],C=E[o[g]-f]):(A=96,C=0),d=1<<p-k,u=1<<w,v=u;do{u-=d,a[m+(M>>k)+u]=x<<24|A<<16|C}while(0!==u);for(d=1<<p-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,g++,0==--P[p]){if(p===y)break;p=t[n+o[g]]}if(p>b&&(M&h)!==c){for(0===k&&(k=b),m+=v,w=p-k,S=1<<w;w+k<y&&(S-=P[w+k],!(S<=0));)w++,S<<=1;if(_+=1<<w,1===e&&_>852||2===e&&_>592)return 1;c=M&h,a[c]=b<<24|w<<16|m-r}}return 0!==M&&(a[m+M]=p-k<<24|64<<16),s.bits=b,0};const{Z_FINISH:Ko,Z_BLOCK:Yo,Z_TREES:qo,Z_OK:Jo,Z_STREAM_END:Qo,Z_NEED_DICT:Zo,Z_STREAM_ERROR:es,Z_DATA_ERROR:ts,Z_MEM_ERROR:ns,Z_BUF_ERROR:is,Z_DEFLATED:as}=Sr,rs=16180,os=16190,ss=16191,ls=16192,ds=16194,us=16199,cs=16200,hs=16206,ms=16209,fs=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function ps(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const gs=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<rs||t.mode>16211?1:0},vs=e=>{if(gs(e))return es;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=rs,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Jo},ys=e=>{if(gs(e))return es;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,vs(e)},bs=(e,t)=>{let n;if(gs(e))return es;const i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?es:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,ys(e))},ws=(e,t)=>{if(!e)return es;const n=new ps;e.state=n,n.strm=e,n.window=null,n.mode=rs;const i=bs(e,t);return i!==Jo&&(e.state=null),i};let ks,Ss,_s=!0;const Ms=e=>{if(_s){ks=new Int32Array(512),Ss=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Xo(1,e.lens,0,288,ks,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Xo(2,e.lens,0,32,Ss,0,e.work,{bits:5}),_s=!1}e.lencode=ks,e.lenbits=9,e.distcode=Ss,e.distbits=5},Es=(e,t,n,i)=>{let a;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),i>=r.wsize?(r.window.set(t.subarray(n-r.wsize,n),0),r.wnext=0,r.whave=r.wsize):(a=r.wsize-r.wnext,a>i&&(a=i),r.window.set(t.subarray(n-i,n-i+a),r.wnext),(i-=a)?(r.window.set(t.subarray(n-i,n),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=a))),0};var Ps=(e,t)=>{let n,i,a,r,o,s,l,d,u,c,h,m,f,p,g,v,y,b,w,k,S,_,M=0;const E=new Uint8Array(4);let P,T;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(gs(e)||!e.output||!e.input&&0!==e.avail_in)return es;n=e.state,n.mode===ss&&(n.mode=ls),o=e.next_out,a=e.output,l=e.avail_out,r=e.next_in,i=e.input,s=e.avail_in,d=n.hold,u=n.bits,c=s,h=l,_=Jo;e:for(;;)switch(n.mode){case rs:if(0===n.wrap){n.mode=ls;break}for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(2&n.wrap&&35615===d){0===n.wbits&&(n.wbits=15),n.check=0,E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0),d=0,u=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=ms;break}if((15&d)!==as){e.msg="unknown compression method",n.mode=ms;break}if(d>>>=4,u-=4,S=8+(15&d),0===n.wbits&&(n.wbits=S),S>15||S>n.wbits){e.msg="invalid window size",n.mode=ms;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&d?16189:ss,d=0,u=0;break;case 16181:for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(n.flags=d,(255&n.flags)!==as){e.msg="unknown compression method",n.mode=ms;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=ms;break}n.head&&(n.head.text=d>>8&1),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0)),d=0,u=0,n.mode=16182;case 16182:for(;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.head&&(n.head.time=d),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,E[2]=d>>>16&255,E[3]=d>>>24&255,n.check=wr(n.check,E,4,0)),d=0,u=0,n.mode=16183;case 16183:for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.head&&(n.head.xflags=255&d,n.head.os=d>>8),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0)),d=0,u=0,n.mode=16184;case 16184:if(1024&n.flags){for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.length=d,n.head&&(n.head.extra_len=d),512&n.flags&&4&n.wrap&&(E[0]=255&d,E[1]=d>>>8&255,n.check=wr(n.check,E,2,0)),d=0,u=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(m=n.length,m>s&&(m=s),m&&(n.head&&(S=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(r,r+m),S)),512&n.flags&&4&n.wrap&&(n.check=wr(n.check,i,m,r)),s-=m,r+=m,n.length-=m),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===s)break e;m=0;do{S=i[r+m++],n.head&&S&&n.length<65536&&(n.head.name+=String.fromCharCode(S))}while(S&&m<s);if(512&n.flags&&4&n.wrap&&(n.check=wr(n.check,i,m,r)),s-=m,r+=m,S)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===s)break e;m=0;do{S=i[r+m++],n.head&&S&&n.length<65536&&(n.head.comment+=String.fromCharCode(S))}while(S&&m<s);if(512&n.flags&&4&n.wrap&&(n.check=wr(n.check,i,m,r)),s-=m,r+=m,S)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;u<16;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(4&n.wrap&&d!==(65535&n.check)){e.msg="header crc mismatch",n.mode=ms;break}d=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=ss;break;case 16189:for(;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}e.adler=n.check=fs(d),d=0,u=0,n.mode=os;case os:if(0===n.havedict)return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=s,n.hold=d,n.bits=u,Zo;e.adler=n.check=1,n.mode=ss;case ss:if(t===Yo||t===qo)break e;case ls:if(n.last){d>>>=7&u,u-=7&u,n.mode=hs;break}for(;u<3;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}switch(n.last=1&d,d>>>=1,u-=1,3&d){case 0:n.mode=16193;break;case 1:if(Ms(n),n.mode=us,t===qo){d>>>=2,u-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=ms}d>>>=2,u-=2;break;case 16193:for(d>>>=7&u,u-=7&u;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if((65535&d)!=(d>>>16^65535)){e.msg="invalid stored block lengths",n.mode=ms;break}if(n.length=65535&d,d=0,u=0,n.mode=ds,t===qo)break e;case ds:n.mode=16195;case 16195:if(m=n.length,m){if(m>s&&(m=s),m>l&&(m=l),0===m)break e;a.set(i.subarray(r,r+m),o),s-=m,r+=m,l-=m,o+=m,n.length-=m;break}n.mode=ss;break;case 16196:for(;u<14;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(n.nlen=257+(31&d),d>>>=5,u-=5,n.ndist=1+(31&d),d>>>=5,u-=5,n.ncode=4+(15&d),d>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ms;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;u<3;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.lens[x[n.have++]]=7&d,d>>>=3,u-=3}for(;n.have<19;)n.lens[x[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,P={bits:n.lenbits},_=Xo(0,n.lens,0,19,n.lencode,0,n.work,P),n.lenbits=P.bits,_){e.msg="invalid code lengths set",n.mode=ms;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;M=n.lencode[d&(1<<n.lenbits)-1],g=M>>>24,v=M>>>16&255,y=65535&M,!(g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(y<16)d>>>=g,u-=g,n.lens[n.have++]=y;else{if(16===y){for(T=g+2;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(d>>>=g,u-=g,0===n.have){e.msg="invalid bit length repeat",n.mode=ms;break}S=n.lens[n.have-1],m=3+(3&d),d>>>=2,u-=2}else if(17===y){for(T=g+3;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=g,u-=g,S=0,m=3+(7&d),d>>>=3,u-=3}else{for(T=g+7;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=g,u-=g,S=0,m=11+(127&d),d>>>=7,u-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ms;break}for(;m--;)n.lens[n.have++]=S}}if(n.mode===ms)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=ms;break}if(n.lenbits=9,P={bits:n.lenbits},_=Xo(1,n.lens,0,n.nlen,n.lencode,0,n.work,P),n.lenbits=P.bits,_){e.msg="invalid literal/lengths set",n.mode=ms;break}if(n.distbits=6,n.distcode=n.distdyn,P={bits:n.distbits},_=Xo(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,P),n.distbits=P.bits,_){e.msg="invalid distances set",n.mode=ms;break}if(n.mode=us,t===qo)break e;case us:n.mode=cs;case cs:if(s>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=s,n.hold=d,n.bits=u,zo(e,h),o=e.next_out,a=e.output,l=e.avail_out,r=e.next_in,i=e.input,s=e.avail_in,d=n.hold,u=n.bits,n.mode===ss&&(n.back=-1);break}for(n.back=0;M=n.lencode[d&(1<<n.lenbits)-1],g=M>>>24,v=M>>>16&255,y=65535&M,!(g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(v&&!(240&v)){for(b=g,w=v,k=y;M=n.lencode[k+((d&(1<<b+w)-1)>>b)],g=M>>>24,v=M>>>16&255,y=65535&M,!(b+g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=b,u-=b,n.back+=b}if(d>>>=g,u-=g,n.back+=g,n.length=y,0===v){n.mode=16205;break}if(32&v){n.back=-1,n.mode=ss;break}if(64&v){e.msg="invalid literal/length code",n.mode=ms;break}n.extra=15&v,n.mode=16201;case 16201:if(n.extra){for(T=n.extra;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;M=n.distcode[d&(1<<n.distbits)-1],g=M>>>24,v=M>>>16&255,y=65535&M,!(g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(!(240&v)){for(b=g,w=v,k=y;M=n.distcode[k+((d&(1<<b+w)-1)>>b)],g=M>>>24,v=M>>>16&255,y=65535&M,!(b+g<=u);){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}d>>>=b,u-=b,n.back+=b}if(d>>>=g,u-=g,n.back+=g,64&v){e.msg="invalid distance code",n.mode=ms;break}n.offset=y,n.extra=15&v,n.mode=16203;case 16203:if(n.extra){for(T=n.extra;u<T;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ms;break}n.mode=16204;case 16204:if(0===l)break e;if(m=h-l,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ms;break}m>n.wnext?(m-=n.wnext,f=n.wsize-m):f=n.wnext-m,m>n.length&&(m=n.length),p=n.window}else p=a,f=o-n.offset,m=n.length;m>l&&(m=l),l-=m,n.length-=m;do{a[o++]=p[f++]}while(--m);0===n.length&&(n.mode=cs);break;case 16205:if(0===l)break e;a[o++]=n.length,l--,n.mode=cs;break;case hs:if(n.wrap){for(;u<32;){if(0===s)break e;s--,d|=i[r++]<<u,u+=8}if(h-=l,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?wr(n.check,a,h,o-h):yr(n.check,a,h,o-h)),h=l,4&n.wrap&&(n.flags?d:fs(d))!==n.check){e.msg="incorrect data check",n.mode=ms;break}d=0,u=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;u<32;){if(0===s)break e;s--,d+=i[r++]<<u,u+=8}if(4&n.wrap&&d!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=ms;break}d=0,u=0}n.mode=16208;case 16208:_=Qo;break e;case ms:_=ts;break e;case 16210:return ns;default:return es}return e.next_out=o,e.avail_out=l,e.next_in=r,e.avail_in=s,n.hold=d,n.bits=u,(n.wsize||h!==e.avail_out&&n.mode<ms&&(n.mode<hs||t!==Ko))&&Es(e,e.output,e.next_out,h-e.avail_out),c-=e.avail_in,h-=e.avail_out,e.total_in+=c,e.total_out+=h,n.total+=h,4&n.wrap&&h&&(e.adler=n.check=n.flags?wr(n.check,a,h,e.next_out-h):yr(n.check,a,h,e.next_out-h)),e.data_type=n.bits+(n.last?64:0)+(n.mode===ss?128:0)+(n.mode===us||n.mode===ds?256:0),(0===c&&0===h||t===Ko)&&_===Jo&&(_=is),_},Ts={inflateReset:ys,inflateReset2:bs,inflateResetKeep:vs,inflateInit:e=>ws(e,15),inflateInit2:ws,inflate:Ps,inflateEnd:e=>{if(gs(e))return es;let t=e.state;return t.window&&(t.window=null),e.state=null,Jo},inflateGetHeader:(e,t)=>{if(gs(e))return es;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,Jo):es},inflateSetDictionary:(e,t)=>{const n=t.length;let i,a,r;return gs(e)?es:(i=e.state,0!==i.wrap&&i.mode!==os?es:i.mode===os&&(a=1,a=yr(a,t,n,0),a!==i.check)?ts:(r=Es(e,t,n,n),r?(i.mode=16210,ns):(i.havedict=1,Jo)))},inflateInfo:"pako inflate (from Nodeca project)"};var xs=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const As=Object.prototype.toString,{Z_NO_FLUSH:Cs,Z_FINISH:Ls,Z_OK:Is,Z_STREAM_END:Ds,Z_NEED_DICT:Rs,Z_STREAM_ERROR:Ns,Z_DATA_ERROR:Ws,Z_MEM_ERROR:Fs}=Sr;function Os(e){this.options=Mo.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xo,this.strm.avail_out=0;let n=Ts.inflateInit2(this.strm,t.windowBits);if(n!==Is)throw new Error(kr[n]);if(this.header=new xs,Ts.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=To.string2buf(t.dictionary):"[object ArrayBuffer]"===As.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Ts.inflateSetDictionary(this.strm,t.dictionary),n!==Is)))throw new Error(kr[n])}function $s(e,t){const n=new Os(t);if(n.push(e),n.err)throw n.msg||kr[n.err];return n.result}Os.prototype.push=function(e,t){const n=this.strm,i=this.options.chunkSize,a=this.options.dictionary;let r,o,s;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Ls:Cs,"[object ArrayBuffer]"===As.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),r=Ts.inflate(n,o),r===Rs&&a&&(r=Ts.inflateSetDictionary(n,a),r===Is?r=Ts.inflate(n,o):r===Ws&&(r=Rs));n.avail_in>0&&r===Ds&&n.state.wrap>0&&0!==e[n.next_in];)Ts.inflateReset(n),r=Ts.inflate(n,o);switch(r){case Ns:case Ws:case Rs:case Fs:return this.onEnd(r),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||r===Ds))if("string"===this.options.to){let e=To.utf8border(n.output,n.next_out),t=n.next_out-e,a=To.buf2string(n.output,e);n.next_out=t,n.avail_out=i-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(a)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(r!==Is||0!==s){if(r===Ds)return r=Ts.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Os.prototype.onData=function(e){this.chunks.push(e)},Os.prototype.onEnd=function(e){e===Is&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Mo.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var js={Inflate:Os,inflate:$s,inflateRaw:function(e,t){return(t=t||{}).raw=!0,$s(e,t)},ungzip:$s,constants:Sr};const{Inflate:zs,inflate:Hs,inflateRaw:Bs,ungzip:Us}=js;var Gs=Us;const Vs=e=>{let t;if(e?.includes(Me))t=Se;else{const n=e?.find((e=>e.includes(_e)));t=n?n.split("=")[1]:ke}return t=t.replace(/\/$/,""),t+"/"+we},Xs=e=>{const t=ca.getAppConfig(Y)||ca.getAppConfig(ne);return t?.capabilities?.includes(e)??!1},Ks=()=>{const e=(()=>{const e=ca.getAppConfig(Y)||ca.getAppConfig(ne);return e?.campaign_cache_ttl??null})();if(null===e)return;if(0===e)return void ca.purgeApiCampaignCache();const t=ca.getApiCampaignSessionTimestamp();if(null===t)return;(Date.now()-t)/1e3>=e&&ca.purgeApiCampaignCache()},Ys=e=>{const t=!Xs(A.THIRD_PARTY_TRANSACTIONS);return e&&!t&&Ze.info(`[${e}] Your plan does not have purchase management features.`),t};function qs(e){try{const t=function(e){if("undefined"!=typeof Buffer)return new Uint8Array(Buffer.from(e,"base64"));const t=atob(e),n=t.length,i=new Uint8Array(n);for(let e=0;e<n;e++)i[e]=t.charCodeAt(e);return i}(e.trim()),n=Gs(t),i=(new TextDecoder).decode(n);return JSON.parse(i)}catch{return}}function Js(e,t,n){const i=n.value;return n.value=function(...e){if(!this.platformID)throw new ga;return i.apply(this,e)},n}function Qs(e,t,n){const i=n.value;return n.value=function(...e){const t=ca.getDevice();if(!t?.id)throw new va;return i.apply(this,e)},n}class Zs{get deviceID(){return ca.getDevice()?.id}constructor(){const e=ca.getNamiConfig();!this.platformID&&e&&this.configure(e)}static configure(e){this.instance.configure(e)}configure(e){this.baseURL=Vs(e.namiCommands),this.platformID=e.appPlatformID}async login(e){if(!e)throw new ya;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"});ca.setSessionCounter(),n.id&&ca.setSessionId(n.id)}async postImpression(e){const t=`device/${this.deviceID}/impression/`,n=await this.requestBodyAPI(t,e,"POST",!0);n.id&&ca.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,t,n){const i=`${this.baseURL}/${this.platformID}/`+e;return await Ca(i,void 0,t,n)}async requestBodyAPI(e,t,n="POST",i=!1,a,r){const o=`${this.baseURL}/${this.platformID}/`+e,s={method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:i};return await Ca(o,s,a,r)}}function el(e){return null!=e?.flow}var tl;Zs.instance=new Zs,T([Qs],Zs.prototype,"login",null),T([Qs],Zs.prototype,"logout",null),T([Qs],Zs.prototype,"startSession",null),T([Qs],Zs.prototype,"postImpression",null),T([Qs],Zs.prototype,"postConversion",null),T([Qs],Zs.prototype,"purchaseValidation",null),T([Js],Zs.prototype,"fetchAPI",null),T([Js],Zs.prototype,"requestBodyAPI",null),e.NamiCampaignRuleType=void 0,(tl=e.NamiCampaignRuleType||(e.NamiCampaignRuleType={})).DEFAULT="default",tl.LABEL="label",tl.UNKNOWN="unknown",tl.URL="url";const nl=()=>ca.getPaywalls(ae)??[],il=()=>ca.getPaywalls(J)??[],al=()=>ua(et([...il(),...nl()]),"id"),rl=e=>al().find((t=>t.id===e)),ol=e=>{const t=al(),n=new Set(t.map((e=>e.id)));return e.every((e=>n.has(e)))};function sl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ll,dl={exports:{}};var ul=(ll||(ll=1,function(e){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var i=n(18),a=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(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}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return 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}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return 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},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,i){void 0===i&&(i=!1);var a=e.getVersionPrecision(t),r=e.getVersionPrecision(n),o=Math.max(a,r),s=0,l=e.map([t,n],(function(t){var n=o-e.getVersionPrecision(t),i=t+new Array(n+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(s=o-Math.min(a,r)),o-=1;o>=s;){if(l[0][o]>l[1][o])return 1;if(l[0][o]===l[1][o]){if(o===s)return 0;o-=1}else if(l[0][o]<l[1][o])return-1}},e.map=function(e,t){var n,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)i.push(t(e[n]));return i},e.find=function(e,t){var n,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,i=e.length;n<i;n+=1){var a=e[n];if(t(a,n))return a}},e.assign=function(e){for(var t,n,i=e,a=arguments.length,r=new Array(a>1?a-1:0),o=1;o<a;o++)r[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(r));var s=function(){var e=r[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,n=r.length;t<n;t+=1)s();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=a,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"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"},t.BROWSER_MAP={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"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={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"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(91))&&i.__esModule?i:{default:i},r=n(18);function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var s=function(){function e(){}var t,n,i;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new a.default(e,t)},e.parse=function(e){return new a.default(e).getResult()},t=e,i=[{key:"BROWSER_MAP",get:function(){return r.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return r.ENGINE_MAP}},{key:"OS_MAP",get:function(){return r.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return r.PLATFORMS_MAP}}],(n=null)&&o(t.prototype,n),i&&o(t,i),e}();t.default=s,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var i=l(n(92)),a=l(n(93)),r=l(n(94)),o=l(n(95)),s=l(n(17));function l(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},i=0,a={},r=0;if(Object.keys(e).forEach((function(t){var o=e[t];"string"==typeof o?(a[t]=o,r+=1):"object"==typeof o&&(n[t]=o,i+=1)})),i>0){var o=Object.keys(n),l=s.default.find(o,(function(e){return t.isOS(e)}));if(l){var d=this.satisfies(n[l]);if(void 0!==d)return d}var u=s.default.find(o,(function(e){return t.isPlatform(e)}));if(u){var c=this.satisfies(n[u]);if(void 0!==c)return c}}if(r>0){var h=Object.keys(a),m=s.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==m)return this.compareVersion(a[m])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),a=s.default.getBrowserTypeByAlias(i);return t&&a&&(i=a.toLowerCase()),i===n},t.compareVersion=function(e){var t=[0],n=e,i=!1,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(s.default.compareVersions(a,n,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=a.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=a.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=a.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=a.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=a.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=a.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=a.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=a.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=a.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=a.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=a.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=a.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=a.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=a.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=a.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=a.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=a.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=a.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=a.default.getFirstMatch(r,e)||a.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=a.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=a.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=a.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=a.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=a.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=a.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=a.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=a.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=a.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=a.default.getFirstMatch(r,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:a.default.getFirstMatch(t,e),version:a.default.getSecondMatch(t,e)}}}];t.default=o,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=n(18),o=[{test:[/Roku\/DVP/],describe:function(e){var t=a.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:r.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=a.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=a.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=a.default.getWindowsVersionName(t);return{name:r.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:r.OS_MAP.iOS},n=a.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=a.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=a.default.getMacOSVersionName(t),i={name:r.OS_MAP.MacOS,version:t};return n&&(i.versionName=n),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=a.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:r.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=a.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=a.default.getAndroidVersionName(t),i={name:r.OS_MAP.Android,version:t};return n&&(i.versionName=n),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=a.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:r.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=a.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||a.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||a.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:r.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=a.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=a.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:r.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:r.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=a.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:r.OS_MAP.PlayStation4,version:t}}}];t.default=o,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=n(18),o=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=a.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:r.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:r.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=a.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:r.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:r.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:r.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:r.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:r.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:r.PLATFORMS_MAP.tv}}}];t.default=o,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var i,a=(i=n(17))&&i.__esModule?i:{default:i},r=n(18),o=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:r.ENGINE_MAP.Blink};var t=a.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:r.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:r.ENGINE_MAP.Trident},n=a.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:r.ENGINE_MAP.Presto},n=a.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:r.ENGINE_MAP.Gecko},n=a.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:r.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:r.ENGINE_MAP.WebKit},n=a.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=o,e.exports=t.default}})}(dl)),dl.exports),cl=sl(ul);const hl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},ml="function"==typeof hl.BigInt,fl=ml?hl.BigInt.bind(hl):void 0,pl=ml?fl("0xffffffffffffffffffffffffffffffff"):null,gl=ml?fl("0x100000000000000000000000000000000"):null,vl=ml?fl(0):null,yl=ml?fl(1):null,bl=ml?fl(8):null,wl=ml?fl(1e4):null,kl=16,Sl=1/kl,_l={tablet:"tablet",mobile:"phone",tv:"television",desktop:"desktop"},Ml=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:C,language:"en"};const t=cl.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:C,language:window.navigator.language};if(n.type&&(i.form_factor=_l[n.type]),n.model&&(i.device_model=n.model),e&&e.length>0){const t=(e=>{const t=e.find((e=>e.includes(Ee))),n={platform:"",version:""};if(t){const e=t.split(Pe);n.platform=e[1],n.version=e[2]}return n})(e);i.extended_platform=t.platform,i.extended_platform_version=t.version}return i},El=()=>{const e=ca.getNamiConfig();if(e&&e.formFactor)return e.formFactor;if("undefined"==typeof window)return _l.desktop;const t=cl.getParser(window.navigator.userAgent).getPlatform();return t.type?_l[t.type]:_l.desktop},Pl={"1280x720":.67,"1920x1080":1,"3840x2160":2,"7680x4320":4};const Tl=()=>{const{innerWidth:e,innerHeight:t}=window;return Math.min(e/1920,t/1080)||1};function xl(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Al(e){if(!ml||!pl)return Il(e);try{const t=pl,n=function(e){if(!fl)throw new Error("BigInt is not supported in this environment");const t=e.replace(/-/g,"");return fl("0x"+t)}(e);return Number(n)/Number(t)*100}catch(t){throw Ze.error(`Error calculating audience split position for UUID ${e}`,t),new Error(`Invalid UUID format: ${e}`)}}function Cl(e){if(!fl)throw new Error("BigInt is not supported in this environment");let t=e.toString(16).padStart(32,"0");t=t.substring(0,12)+"4"+t.substring(13);const n=3&parseInt(t[16],16)|8;return t=t.substring(0,16)+n.toString(16)+t.substring(17),t.slice(0,8)+"-"+t.slice(8,12)+"-"+t.slice(12,16)+"-"+t.slice(16,20)+"-"+t.slice(20)}function Ll(e,t=.5){if(!Number.isFinite(e))throw new Error("Invalid target");if(!Number.isFinite(t))throw new Error("Invalid tolerance");const n=Math.max(0,Math.min(100,e)),i=Math.max(0,Math.min(50,t)),a=e=>Math.round(100*e),r=Math.max(0,a(n-i)),o=Math.min(1e4,a(n+i));if(!(ml&&pl&&fl&&wl))return function(e,t){const n=Math.max(0,Math.min(100,e-t)),i=Math.min(100,Math.max(0,e+t));let a=xl(),r=Number.POSITIVE_INFINITY;const o=50;for(let e=0;e<o;e++){const e=xl(),t=Il(e);if(t>=n&&t<=i)return e;const o=Dl(t,n,i);o<r&&(r=o,a=e)}return a}(n,i);const s=pl,l=fl,d=wl,u=e=>s*l(e)/d,c=u(r),h=u(o);if(h<=c)return Cl(c);const m=c+function(e){if(!fl||null===gl||null===yl||null===vl||null===bl)throw new Error("BigInt is not supported in this environment");const t=fl,n=vl,i=yl,a=bl,r=gl;if(e<n)throw new Error("n must be non-negative");if(e===n)return n;const o=new Uint8Array(16),s=e+i,l=r/s*s-i;let d=0;for(;d<10;){crypto.getRandomValues(o);let e=n;for(const n of o)e=e<<a|t(n);if(e<=l)return e%s;d++}try{crypto.getRandomValues(o);let i=n;for(const e of o)i=i<<a|t(e);const r=i%s;return Ze.warn("randomBigInt: reached max rejection attempts, using modulo fallback",{n:e.toString(),attempts:d}),r}catch(e){throw Ze.error("randomBigInt: failed to generate random values",e),new Error("randomBigInt: unable to generate random value")}}(h-c);return Cl(m)}function Il(e){const t=function(e){const t=e.replace(/-/g,"").toLowerCase();if(!/^[0-9a-f]{32}$/.test(t))throw new Error(`Invalid UUID format: ${e}`);let n=0;for(let e=t.length-1;e>=0;e--){n=(n+parseInt(t[e],kl))*Sl}return n}(e);return 100*t}function Dl(e,t,n){return e<t?t-e:e>n?e-n:0}const Rl=e=>{try{return Boolean(new URL(e))}catch{return!1}},Nl=(e,t,n)=>e?e.flatMap((e=>{let i;if(i="string"==typeof n?e.segments.filter((e=>e.form_factors.some((e=>e.form_factor===n)))):e.segments,0===i.length)return[];const a=((e,t)=>{const n=[...e].sort(((e,t)=>e.split-t.split));for(const e of n)if(t<=e.split)return e;return n[n.length-1]})(i,t);return{form_factors:a.form_factors,paywall:a.paywall,flow:a.flow,segment:a.segment,split:a.split,conversion_event_type:a.conversion_event_type,conversion_event_url:a.conversion_event_url,rule:e.rule,name:e.name,type:e.type,value:e.value,external_segment:e.external_segment}})):[],Wl=()=>{const e=ca.getCampaignRules(q)??[],t=ca.getCampaignRules(ie)??[],n=El(),i=et([...e,...t]).filter((e=>e.form_factors?.some((e=>e.form_factor===n))));return ua(i,"rule")},Fl=e=>{const t=ca.getCampaignRules(e)??[],n=El();return et(t).filter((e=>e.form_factors?.some((e=>e.form_factor===n))))},Ol=()=>Fl(ie),$l=()=>Fl(q),jl=(t,n,i,a)=>{const r=t().find((t=>a?t.type==a&&t.value==i:t.type==e.NamiCampaignRuleType.DEFAULT));if(!r)return{};const o=n().find((e=>r?.paywall===e.id));return{campaign:r,paywall:o}},zl=(e,t)=>{const n=jl($l,il,e,t);if(n.campaign&&n.paywall)return{campaign:n.campaign,paywall:n.paywall};const i=jl(Ol,nl,e,t);return i.campaign&&i.paywall?{campaign:i.campaign,paywall:i.paywall}:n.campaign||n.paywall?{campaign:n.campaign,paywall:n.paywall}:{campaign:i.campaign,paywall:i.paywall}};var Hl,Bl="object"==typeof Reflect?Reflect:null,Ul=Bl&&"function"==typeof Bl.apply?Bl.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};Hl=Bl&&"function"==typeof Bl.ownKeys?Bl.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var Gl=Number.isNaN||function(e){return e!=e};function Vl(){Vl.init.call(this)}Vl.EventEmitter=Vl,Vl.prototype._events=void 0,Vl.prototype._eventsCount=0,Vl.prototype._maxListeners=void 0;var Xl=10;function Kl(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Yl(e){return void 0===e._maxListeners?Vl.defaultMaxListeners:e._maxListeners}function ql(e,t,n,i){var a,r,o,s;if(Kl(n),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),o=r[t]),void 0===o)o=r[t]=n,++e._eventsCount;else if("function"==typeof o?o=r[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(a=Yl(e))>0&&o.length>a&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return e}function Jl(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ql(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},a=Jl.bind(i);return a.listener=n,i.wrapFn=a,a}function Zl(e,t,n){var i=e._events;if(void 0===i)return[];var a=i[t];return void 0===a?[]:"function"==typeof a?n?[a.listener||a]:[a]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(a):td(a,a.length)}function ed(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function td(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}Object.defineProperty(Vl,"defaultMaxListeners",{enumerable:!0,get:function(){return Xl},set:function(e){if("number"!=typeof e||e<0||Gl(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Xl=e}}),Vl.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Vl.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||Gl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Vl.prototype.getMaxListeners=function(){return Yl(this)},Vl.prototype.emit=function(e){var t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var r=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw r.context=a,r}var o=i[e];if(void 0===o)return!1;if("function"==typeof o)Ul(o,this,t);else{var s=o.length,l=td(o,s);for(let e=0;e<s;++e)Ul(l[e],this,t)}return!0},Vl.prototype.addListener=function(e,t){return ql(this,e,t,!1)},Vl.prototype.on=Vl.prototype.addListener,Vl.prototype.prependListener=function(e,t){return ql(this,e,t,!0)},Vl.prototype.once=function(e,t){return Kl(t),this.on(e,Ql(this,e,t)),this},Vl.prototype.prependOnceListener=function(e,t){return Kl(t),this.prependListener(e,Ql(this,e,t)),this},Vl.prototype.removeListener=function(e,t){var n,i,a,r,o;if(Kl(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(a=-1,r=n.length-1;r>=0;r--)if(n[r]===t||n[r].listener===t){o=n[r].listener,a=r;break}if(a<0)return this;0===a?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,a),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},Vl.prototype.off=Vl.prototype.removeListener,Vl.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var a,r=Object.keys(n);for(i=0;i<r.length;++i)"removeListener"!==(a=r[i])&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},Vl.prototype.listeners=function(e){return Zl(this,e,!0)},Vl.prototype.rawListeners=function(e){return Zl(this,e,!1)},Vl.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):ed.call(e,t)},Vl.prototype.listenerCount=ed,Vl.prototype.eventNames=function(){return this._eventsCount>0?Hl(this._events):[]};class nd{constructor(){this.emitter=new Vl}static getInstance(){return this.instance||(this.instance=new nd),this.instance}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}emit(e,...t){this.emitter.emit(e,...t)}addListener(e,t){this.emitter.addListener(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}removeAllListeners(e){e?this.emitter.removeAllListeners(e):this.emitter.removeAllListeners()}listeners(e){return this.emitter.listeners(e)}listenerCount(e){return this.emitter.listenerCount(e)}}class id{constructor(){this.disableCampaignUpdates=!1,this.currentFormFactor=El()}configure(e,t,n=[]){this.currentFormFactor=e,this.splitPosition=t,this.disableCampaignUpdates=n.includes("disableCampaignUpdates")}async fetchCampaignRules(e){const t=ca.getDevice();let n;return this.disableCampaignUpdates?(Ze.info("Campaign updates disabled by configuration. Skipping fetch."),[]):(n=t?.id?await this.getCampaigns(t.id):await this.getAnonymousCampaigns(),n=n?.filter((e=>e.paywall&&e.form_factors.some((e=>e.form_factor===this.currentFormFactor))||e.flow&&e.flow?.object?.form_factors?.some((e=>e.form_factor===this.currentFormFactor)))),n=n?.filter((t=>{if(t.paywall){const n=e.find((e=>e.id==t.paywall));if(n)return t}else if(t.flow)return t})),ca.setCampaignRules(q,n),ca.setApiCampaignSessionTimestamp(),this.invokeAvailableCampaignsResponseHandler(),n)}invokeAvailableCampaignsResponseHandler(){const e=nd.getInstance().listeners(He),t=Wl();e.forEach((e=>e(t)))}async getAnonymousCampaigns(e=C){const t=`campaign_rules/?sdk_version=${e}`;try{const e=await Zs.instance.fetchAPI(t);return Nl(e.results??[],this.splitPosition,this.currentFormFactor)}catch(e){const n=this.fallbackData();if(!n)throw Ze.error(Aa(e.status,t)),e;return n.results}}async getCampaigns(e){const t=`device/${e}/campaign_rules/`;let n;try{n=await Zs.instance.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw Ze.error(Aa(e.status,t)),e}return n?.results||[]}fallbackData(){const e=ca.getCampaignRules(q)||ca.getCampaignRules(ie);return e?{count:e.length,results:e}:null}}function ad(e,t){return Ei(e,t)}id.instance=new id;class rd{createOrUpdateDevice(e,t,n){const i=ca.getDevice();if(!i?.id){const i={...e,id:t??this.getAnonymousUUID()??xl()};return{id:i.id,device:this.createDevice(i,n)}}return this.isEqualDevices(i,e)?{id:i.id,device:Promise.resolve(i)}:(this.updateDevice(i.id,e),{id:i.id,device:null})}async createDevice(e,t){try{const n=0,i=await this.requestAPIData("device/",e,void 0,void 0,n);return i?(ca.setDevice(i),i):(Ze.info("Device creation returned null, switching to anon mode for this session"),t?.setInMemoryAnonymousMode(!0),null)}catch(e){if(console.error("Error creating device:",e),e instanceof ha)return Ze.info("Retry limit exceeded, switching to anon mode for this session"),t?.setInMemoryAnonymousMode(!0),null;throw e}}async updateDevice(e,t){const n=await this.requestAPIData(`device/${e}/`,t,"PUT");return n&&ca.setDevice(n),n}async updateDeviceField(e,t){const n={[e]:t},i=ca.getDevice();if(!i?.id)throw new va;const a=await this.requestAPIData(`device/${i.id}/`,n,"PATCH");return a&&ca.setDevice(a),a}async requestAPIData(e,t,n="POST",i=De,a){let r;try{r=await Zs.instance.requestBodyAPI(e,t,n,!1,i,a)}catch(t){if(t instanceof ga)throw t;if("device/"===e&&t instanceof ha)throw t;if(r=ca.getDevice(),!r)return Ze.error(Aa(t.status,e)),null}return r}isEqualDevices(e,t){const n={...e,...t},i=Object.keys(e).reduce(((e,t)=>(e[t]=n[t],e)),{});return ad(i,e)}getOrCreateAnonymousUUID(){let e=ca.getAnonymousUUID();return e||(e=xl(),ca.setAnonymousUUID(e)),e}getAnonymousUUID(){const e=ca.getAnonymousUUID();return e?(ca.clearAnonymousUUID(),e):null}}rd.instance=new rd;class od{async fetchProducts(){if(Xs(A.THIRD_PARTY_TRANSACTIONS))return[];let e;try{e=await Zs.instance.fetchAPI("products/")}catch(t){if(e=this.fallbackData(),!e)throw Ze.error(Aa(t.status,"products/")),t}return e?.results&&ca.setProducts(Z,e.results),e?.results||[]}fallbackData(){const e=ca.getProducts(Z)||ca.getProducts(re);return e?{count:e.length,results:e}:null}}od.instance=new od;class sd{async fetchPaywalls(){const e=ca.getDevice();let t;return t=e?.id?await this.getPaywalls(e.id):await this.getAnonymousPaywalls(),t&&ca.setPaywalls(J,t),t}async getAnonymousPaywalls(e=C){const t=`paywalls/?sdk_version=${e}`;let n=null;try{n=await Zs.instance.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw Ze.error(Aa(e.status,t)),e}return n?.results||[]}async getPaywalls(e){const t=`device/${e}/paywalls/`;let n;try{n=await Zs.instance.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw Ze.error(Aa(e.status,t)),e}return n?.results||[]}fallbackData(){const e=ca.getPaywalls(J)||ca.getPaywalls(ae);return e?{count:e.length,results:e}:null}}sd.instance=new sd;class ld{async fetchConfig(){let e;try{e=await Zs.instance.fetchAPI("config/")}catch(t){if(e=ca.getAppConfig(Y)||ca.getAppConfig(ne),!e)throw Ze.error(Aa(t.status,"config/")),t}return e&&ca.setAppConfig(Y,e),e}}ld.instance=new ld;let dd=null;function ud(){return!!ca.getAnonymousMode()||!!dd&&dd.isInMemoryAnonymousMode()}class cd{async startSession(){if(ud())Ze.debug("Skipping session start call - anonymous mode");else try{await Zs.instance.startSession(new Date)}catch(e){Ze.error("error on start session: ",e)}}}cd.instance=new cd;const hd={en:{nami_day:"day",nami_day_plural:"days",nami_week:"week",nami_week_plural:"weeks",nami_month:"month",nami_month_plural:"months",nami_year:"year",nami_year_plural:"years",nami_day_abbrev:"day",nami_day_abbrev_plural:"days",nami_week_abbrev:"wk",nami_week_abbrev_plural:"wks",nami_month_abbrev:"mo",nami_month_abbrev_plural:"mos",nami_year_abbrev:"yr",nami_year_abbrev_plural:"yrs",nami_daily:"daily",nami_weekly:"weekly",nami_biweekly:"bi-weekly",nami_monthly:"monthly",nami_bimonthly:"bi-monthly",nami_quarterly:"quarterly",nami_biannually:"bi-annually",nami_yearly:"yearly"},af:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dae",nami_week_abbrev:"week",nami_week_abbrev_plural:"weke",nami_month_abbrev:"ma",nami_month_abbrev_plural:"maande",nami_year_abbrev:"jr",nami_year_abbrev_plural:"jare",nami_daily:"daagliks",nami_weekly:"weekliks",nami_biweekly:"tweeweekliks",nami_monthly:"maandeliks",nami_bimonthly:"tweemaandeliks",nami_quarterly:"kwartaalliks",nami_biannually:"tweejaarliks",nami_yearly:"jaarliks"},am:{nami_day_abbrev:"ቀን",nami_day_abbrev_plural:"ቀናት",nami_week_abbrev:"ሳምንት",nami_week_abbrev_plural:"ሳምንታት",nami_month_abbrev:"ወር",nami_month_abbrev_plural:"ሞስ",nami_year_abbrev:"ዓመት",nami_year_abbrev_plural:"ዓመታት",nami_daily:"በየቀኑ",nami_weekly:"ሳምንታዊ",nami_biweekly:"በየሁለት ሳምንቱ",nami_monthly:"ወርሃዊ",nami_bimonthly:"በየሁለት ወሩ",nami_quarterly:"በየሩብ ዓመቱ",nami_biannually:"በየሁለት ዓመቱ",nami_yearly:"ዓመታዊ"},ar:{nami_day_abbrev:"يوم",nami_day_abbrev_plural:"أيام",nami_week_abbrev:"أسبوع",nami_week_abbrev_plural:"أسابيع",nami_month_abbrev:"شهر",nami_month_abbrev_plural:"موس",nami_year_abbrev:"سنة",nami_year_abbrev_plural:"سنوات",nami_daily:"يوميًا",nami_weekly:"أسبوعي",nami_biweekly:"كل أسبوعين",nami_monthly:"شهريا",nami_bimonthly:"كل شهرين",nami_quarterly:"ربع سنوي",nami_biannually:"مرتين في السنة",nami_yearly:"سنوي"},bg:{nami_day_abbrev:"ден",nami_day_abbrev_plural:"дни",nami_week_abbrev:"седмица",nami_week_abbrev_plural:"седмици",nami_month_abbrev:"мо",nami_month_abbrev_plural:"мос",nami_year_abbrev:"год.",nami_year_abbrev_plural:"години",nami_daily:"ежедневно",nami_weekly:"седмично",nami_biweekly:"двуседмичен",nami_monthly:"месечно",nami_bimonthly:"двумесечно",nami_quarterly:"тримесечно",nami_biannually:"два пъти годишно",nami_yearly:"годишно"},ca:{nami_day_abbrev:"dia",nami_day_abbrev_plural:"dies",nami_week_abbrev:"setmana",nami_week_abbrev_plural:"setmanes",nami_month_abbrev:"mes",nami_month_abbrev_plural:"mesos",nami_year_abbrev:"any",nami_year_abbrev_plural:"anys",nami_daily:"diàriament",nami_weekly:"setmanal",nami_biweekly:"quinzenal",nami_monthly:"mensual",nami_bimonthly:"bimensual",nami_quarterly:"trimestral",nami_biannually:"bianualment",nami_yearly:"anual"},cs:{nami_day_abbrev:"den",nami_day_abbrev_plural:"dny",nami_week_abbrev:"týden",nami_week_abbrev_plural:"týdny",nami_month_abbrev:"měsíc",nami_month_abbrev_plural:"měsíce",nami_year_abbrev:"rok",nami_year_abbrev_plural:"roky",nami_daily:"denní",nami_weekly:"týdně",nami_biweekly:"dvoutýdenní",nami_monthly:"měsíční",nami_bimonthly:"dvouměsíčník",nami_quarterly:"čtvrtletní",nami_biannually:"pololetně",nami_yearly:"roční"},de:{nami_day_abbrev:"Tag",nami_day_abbrev_plural:"Tage",nami_week_abbrev:"Woche",nami_week_abbrev_plural:"Wochen",nami_month_abbrev:"Monat",nami_month_abbrev_plural:"Monate",nami_year_abbrev:"Jahr",nami_year_abbrev_plural:"Jahre",nami_daily:"täglich",nami_weekly:"wöchentlich",nami_biweekly:"zweiwöchentlich",nami_monthly:"monatlich",nami_bimonthly:"zweimonatlich",nami_quarterly:"vierteljährlich",nami_biannually:"halbjährlich",nami_yearly:"jährlich"},el:{nami_day_abbrev:"ημέρα",nami_day_abbrev_plural:"ημέρες",nami_week_abbrev:"εβδομάδα",nami_week_abbrev_plural:"εβδομάδες",nami_month_abbrev:"μήνα",nami_month_abbrev_plural:"μην",nami_year_abbrev:"έτος",nami_year_abbrev_plural:"χρόνια",nami_daily:"καθημερινά",nami_weekly:"εβδομαδιαίος",nami_biweekly:"ανά δύο εβδομάδες",nami_monthly:"μηνιαίος",nami_bimonthly:"διμηνιαίος",nami_quarterly:"τριμηνιαίος",nami_biannually:"ανά εξάμηνο",nami_yearly:"ετήσια"},es:{nami_day_abbrev:"día",nami_day_abbrev_plural:"días",nami_week_abbrev:"semana",nami_week_abbrev_plural:"semanas",nami_month_abbrev:"mes",nami_month_abbrev_plural:"meses",nami_year_abbrev:"año",nami_year_abbrev_plural:"años",nami_daily:"diario",nami_weekly:"semanal",nami_biweekly:"quincenal",nami_monthly:"mensual",nami_bimonthly:"bimensual",nami_quarterly:"trimestral",nami_biannually:"semestral",nami_yearly:"anual"},et:{nami_day_abbrev:"päev",nami_day_abbrev_plural:"päevad",nami_week_abbrev:"nädal",nami_week_abbrev_plural:"nädalat",nami_month_abbrev:"kuu",nami_month_abbrev_plural:"kuud",nami_year_abbrev:"aasta",nami_year_abbrev_plural:"aastat",nami_daily:"iga päev",nami_weekly:"iganädalane",nami_biweekly:"iga kahe nädala tagant",nami_monthly:"igakuine",nami_bimonthly:"kaks korda kuus",nami_quarterly:"kvartali",nami_biannually:"kaks korda aastas",nami_yearly:"iga-aastane"},fa:{nami_day_abbrev:"روز",nami_day_abbrev_plural:"روزها",nami_week_abbrev:"هفته",nami_week_abbrev_plural:"هفته‌ها",nami_month_abbrev:"مو",nami_month_abbrev_plural:"موش",nami_year_abbrev:"سال",nami_year_abbrev_plural:"سال",nami_daily:"روزانه",nami_weekly:"هفتگی",nami_biweekly:"دو هفته‌ای",nami_monthly:"ماهانه",nami_bimonthly:"دوماهه",nami_quarterly:"سه ماهه",nami_biannually:"دوسالانه",nami_yearly:"سالانه"},fi:{nami_day_abbrev:"päivä",nami_day_abbrev_plural:"päivää",nami_week_abbrev:"viikko",nami_week_abbrev_plural:"viikkoa",nami_month_abbrev:"kuukausi",nami_month_abbrev_plural:"kuukaudet",nami_year_abbrev:"vuosi",nami_year_abbrev_plural:"vuotta",nami_daily:"päivittäin",nami_weekly:"viikoittain",nami_biweekly:"joka toinen viikko",nami_monthly:"kuukausittain",nami_bimonthly:"kahdesti kuussa",nami_quarterly:"neljännesvuosittain",nami_biannually:"puolivuosittain",nami_yearly:"vuosittain"},fr:{nami_day_abbrev:"jour",nami_day_abbrev_plural:"jours",nami_week_abbrev:"semaine",nami_week_abbrev_plural:"semaines",nami_month_abbrev:"mois",nami_month_abbrev_plural:"mois",nami_year_abbrev:"année",nami_year_abbrev_plural:"ans",nami_daily:"tous les jours",nami_weekly:"hebdomadaire",nami_biweekly:"bihebdomadaire",nami_monthly:"mensuel",nami_bimonthly:"bimensuel",nami_quarterly:"trimestriel",nami_biannually:"bisannuel",nami_yearly:"annuel"},hi:{nami_day_abbrev:"दिन",nami_day_abbrev_plural:"दिन",nami_week_abbrev:"सप्त",nami_week_abbrev_plural:"सप्त",nami_month_abbrev:"महीना",nami_month_abbrev_plural:"महीने",nami_year_abbrev:"साल",nami_year_abbrev_plural:"वर्षीय",nami_daily:"दैनिक",nami_weekly:"साप्ताहिक",nami_biweekly:"द्वि-साप्ताहिक",nami_monthly:"महीने के",nami_bimonthly:"द्विमासिक",nami_quarterly:"त्रैमासिक",nami_biannually:"द्वि-वार्षिक रूप",nami_yearly:"वार्षिक"},hr:{nami_day_abbrev:"dan",nami_day_abbrev_plural:"dana",nami_week_abbrev:"tjedan",nami_week_abbrev_plural:"tjedni",nami_month_abbrev:"mjesec",nami_month_abbrev_plural:"mjeseca",nami_year_abbrev:"god.",nami_year_abbrev_plural:"godina",nami_daily:"dnevno",nami_weekly:"tjedno",nami_biweekly:"dvotjedno",nami_monthly:"mjesečno",nami_bimonthly:"dvomjesečno",nami_quarterly:"tromjesečno",nami_biannually:"dvogodišnje",nami_yearly:"godišnje"},hu:{nami_day_abbrev:"nap",nami_day_abbrev_plural:"napok",nami_week_abbrev:"hét",nami_week_abbrev_plural:"hetek",nami_month_abbrev:"hónap",nami_month_abbrev_plural:"hónap",nami_year_abbrev:"év",nami_year_abbrev_plural:"év",nami_daily:"napi",nami_weekly:"heti",nami_biweekly:"kéthetente",nami_monthly:"havi",nami_bimonthly:"kéthavonta",nami_quarterly:"negyedévenként",nami_biannually:"félévente",nami_yearly:"évi"},id:{nami_day_abbrev:"hari",nami_day_abbrev_plural:"hari",nami_week_abbrev:"minggu",nami_week_abbrev_plural:"minggu",nami_month_abbrev:"bulan",nami_month_abbrev_plural:"bulan",nami_year_abbrev:"tahun",nami_year_abbrev_plural:"tahun",nami_daily:"sehari-hari",nami_weekly:"mingguan",nami_biweekly:"dua kali seminggu",nami_monthly:"bulanan",nami_bimonthly:"dua bulanan",nami_quarterly:"triwulanan",nami_biannually:"dua tahunan",nami_yearly:"tahunan"},it:{nami_day_abbrev:"giorno",nami_day_abbrev_plural:"giorni",nami_week_abbrev:"settimana",nami_week_abbrev_plural:"settimane",nami_month_abbrev:"mese",nami_month_abbrev_plural:"mesi",nami_year_abbrev:"anno",nami_year_abbrev_plural:"anni",nami_daily:"quotidiano",nami_weekly:"settimanale",nami_biweekly:"bisettimanale",nami_monthly:"mensile",nami_bimonthly:"bimestrale",nami_quarterly:"trimestrale",nami_biannually:"semestralmente",nami_yearly:"annuale"},he:{nami_day_abbrev:"יְוֹם",nami_day_abbrev_plural:"ימים",nami_week_abbrev:"שבוע",nami_week_abbrev_plural:"שבועות",nami_month_abbrev:"מו",nami_month_abbrev_plural:"מוֹס",nami_year_abbrev:"שנה",nami_year_abbrev_plural:"שנים",nami_daily:"יוֹמִי",nami_weekly:"שְׁבוּעִי",nami_biweekly:"דו-שבועי",nami_monthly:"יַרחוֹן",nami_bimonthly:"דו-חודשי",nami_quarterly:"רִבעוֹן",nami_biannually:"דו-שנתי",nami_yearly:"שְׁנָתִי"},ja:{nami_day_abbrev:"日",nami_day_abbrev_plural:"日",nami_week_abbrev:"週",nami_week_abbrev_plural:"週",nami_month_abbrev:"モ",nami_month_abbrev_plural:"モス",nami_year_abbrev:"年",nami_year_abbrev_plural:"年",nami_daily:"毎日",nami_weekly:"毎週",nami_biweekly:"隔週",nami_monthly:"毎月",nami_bimonthly:"隔月",nami_quarterly:"四半期ごと",nami_biannually:"半年ごと",nami_yearly:"毎年"},ko:{nami_day_abbrev:"낮",nami_day_abbrev_plural:"날",nami_week_abbrev:"주",nami_week_abbrev_plural:"주",nami_month_abbrev:"모",nami_month_abbrev_plural:"모스",nami_year_abbrev:"년",nami_year_abbrev_plural:"년",nami_daily:"일일",nami_weekly:"주간",nami_biweekly:"격주 간행물",nami_monthly:"월간 간행물",nami_bimonthly:"격월",nami_quarterly:"계간지",nami_biannually:"반년마다",nami_yearly:"매년"},lt:{nami_day_abbrev:"diena",nami_day_abbrev_plural:"dienos",nami_week_abbrev:"savaitė",nami_week_abbrev_plural:"savaitės",nami_month_abbrev:"mėn.",nami_month_abbrev_plural:"mėn.",nami_year_abbrev:"metai",nami_year_abbrev_plural:"metų",nami_daily:"kasdien",nami_weekly:"kas savaitę",nami_biweekly:"kas dvi savaites",nami_monthly:"mėnesinis",nami_bimonthly:"kas du mėnesius",nami_quarterly:"ketvirtinis",nami_biannually:"kas du kartus per metus",nami_yearly:"kasmet"},lv:{nami_day_abbrev:"diena",nami_day_abbrev_plural:"dienas",nami_week_abbrev:"nedēļa",nami_week_abbrev_plural:"nedēļas",nami_month_abbrev:"mēn.",nami_month_abbrev_plural:"mēn.",nami_year_abbrev:"gads",nami_year_abbrev_plural:"gadi",nami_daily:"ikdienas",nami_weekly:"iknedēļas",nami_biweekly:"divreiz nedēļā",nami_monthly:"ikmēneša",nami_bimonthly:"divreiz mēnesī",nami_quarterly:"ceturksnī",nami_biannually:"divreiz gadā",nami_yearly:"katru gadu"},ms:{nami_day_abbrev:"hari",nami_day_abbrev_plural:"hari",nami_week_abbrev:"minggu",nami_week_abbrev_plural:"minggu",nami_month_abbrev:"bulan",nami_month_abbrev_plural:"bulan",nami_year_abbrev:"tahun",nami_year_abbrev_plural:"tahun",nami_daily:"setiap hari",nami_weekly:"mingguan",nami_biweekly:"dua minggu sekali",nami_monthly:"bulanan",nami_bimonthly:"dua kali sebulan",nami_quarterly:"suku tahunan",nami_biannually:"dua kali setahun",nami_yearly:"tahunan"},nl:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dagen",nami_week_abbrev:"week",nami_week_abbrev_plural:"weken",nami_month_abbrev:"maand",nami_month_abbrev_plural:"maanden",nami_year_abbrev:"jaar",nami_year_abbrev_plural:"jaren",nami_daily:"dagelijks",nami_weekly:"wekelijks",nami_biweekly:"tweewekelijks",nami_monthly:"maandelijks",nami_bimonthly:"tweemaandelijks",nami_quarterly:"kwartaal",nami_biannually:"halfjaarlijks",nami_yearly:"jaarlijks"},no:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dager",nami_week_abbrev:"uke",nami_week_abbrev_plural:"uker",nami_month_abbrev:"måned",nami_month_abbrev_plural:"måned",nami_year_abbrev:"år",nami_year_abbrev_plural:"år",nami_daily:"daglig",nami_weekly:"ukentlig",nami_biweekly:"annenhver uke",nami_monthly:"månedlig",nami_bimonthly:"annenhver måned",nami_quarterly:"kvartalsvis",nami_biannually:"to ganger i året",nami_yearly:"årlig"},pl:{nami_day_abbrev:"dzień",nami_day_abbrev_plural:"dni",nami_week_abbrev:"tydzień",nami_week_abbrev_plural:"tygodni",nami_month_abbrev:"miesiąc",nami_month_abbrev_plural:"miesiące",nami_year_abbrev:"rok",nami_year_abbrev_plural:"lat",nami_daily:"codziennie",nami_weekly:"tygodnik",nami_biweekly:"dwutygodniowy",nami_monthly:"miesięczny",nami_bimonthly:"dwumiesięczny",nami_quarterly:"kwartalny",nami_biannually:"dwa razy w roku",nami_yearly:"rocznie"},pt:{nami_day_abbrev:"dia",nami_day_abbrev_plural:"dias",nami_week_abbrev:"semana",nami_week_abbrev_plural:"semanas",nami_month_abbrev:"mês",nami_month_abbrev_plural:"meses",nami_year_abbrev:"ano",nami_year_abbrev_plural:"anos",nami_daily:"diário",nami_weekly:"semanalmente",nami_biweekly:"quinzenal",nami_monthly:"mensal",nami_bimonthly:"bimestral",nami_quarterly:"trimestral",nami_biannually:"bianualmente",nami_yearly:"anual"},ro:{nami_day_abbrev:"zi",nami_day_abbrev_plural:"zile",nami_week_abbrev:"săptămână",nami_week_abbrev_plural:"săptămâni",nami_month_abbrev:"lună",nami_month_abbrev_plural:"luni",nami_year_abbrev:"an",nami_year_abbrev_plural:"ani",nami_daily:"zilnic",nami_weekly:"săptămânal",nami_biweekly:"la două săptămâni",nami_monthly:"lunar",nami_bimonthly:"bilunar",nami_quarterly:"trimestrial",nami_biannually:"bianual",nami_yearly:"anual"},ru:{nami_day_abbrev:"день",nami_day_abbrev_plural:"дни",nami_week_abbrev:"нед",nami_week_abbrev_plural:"недели",nami_month_abbrev:"мо",nami_month_abbrev_plural:"мос",nami_year_abbrev:"год",nami_year_abbrev_plural:"лет",nami_daily:"ежедневно",nami_weekly:"еженедельный",nami_biweekly:"раз в две недели",nami_monthly:"ежемесячно",nami_bimonthly:"раз в два месяца",nami_quarterly:"ежеквартальный",nami_biannually:"раз в два года",nami_yearly:"ежегодно"},sk:{nami_day_abbrev:"deň",nami_day_abbrev_plural:"dni",nami_week_abbrev:"týždeň",nami_week_abbrev_plural:"týždne",nami_month_abbrev:"mesiac",nami_month_abbrev_plural:"mesiacov",nami_year_abbrev:"rok",nami_year_abbrev_plural:"rokov",nami_daily:"denne",nami_weekly:"týždenne",nami_biweekly:"dvojtýždenne",nami_monthly:"mesačne",nami_bimonthly:"dvojmesačne",nami_quarterly:"štvrťročne",nami_biannually:"polročne",nami_yearly:"ročne"},sl:{nami_day_abbrev:"dan",nami_day_abbrev_plural:"dni",nami_week_abbrev:"teden",nami_week_abbrev_plural:"tedni",nami_month_abbrev:"mesec",nami_month_abbrev_plural:"mesecev",nami_year_abbrev:"leto",nami_year_abbrev_plural:"let",nami_daily:"dnevno",nami_weekly:"tedensko",nami_biweekly:"dvotedensko",nami_monthly:"mesečno",nami_bimonthly:"dvomesečno",nami_quarterly:"četrtletno",nami_biannually:"polletno",nami_yearly:"letno"},sr:{nami_day_abbrev:"дан",nami_day_abbrev_plural:"дана",nami_week_abbrev:"недеља",nami_week_abbrev_plural:"недеље",nami_month_abbrev:"мо",nami_month_abbrev_plural:"мос",nami_year_abbrev:"год.",nami_year_abbrev_plural:"године",nami_daily:"свакодневно",nami_weekly:"недељно",nami_biweekly:"двонедељно",nami_monthly:"месечно",nami_bimonthly:"двомесечно",nami_quarterly:"квартално",nami_biannually:"два пута годишње",nami_yearly:"годишње"},sv:{nami_day_abbrev:"dag",nami_day_abbrev_plural:"dagar",nami_week_abbrev:"vecka",nami_week_abbrev_plural:"veckor",nami_month_abbrev:"mån",nami_month_abbrev_plural:"månader",nami_year_abbrev:"år",nami_year_abbrev_plural:"år",nami_daily:"dagligen",nami_weekly:"varje vecka",nami_biweekly:"som utkommer varannan vecka",nami_monthly:"månatlig",nami_bimonthly:"varannan månad",nami_quarterly:"kvartalsvis",nami_biannually:"vartannat år",nami_yearly:"årlig"},sw:{nami_day_abbrev:"siku",nami_day_abbrev_plural:"siku",nami_week_abbrev:"wiki",nami_week_abbrev_plural:"wiki",nami_month_abbrev:"mwezi",nami_month_abbrev_plural:"miezi",nami_year_abbrev:"mwaka",nami_year_abbrev_plural:"miaka",nami_daily:"kila siku",nami_weekly:"kila wiki",nami_biweekly:"kila wiki mbili",nami_monthly:"kila mwezi",nami_bimonthly:"kila baada ya miezi miwili",nami_quarterly:"robo mwaka",nami_biannually:"kila baada ya miaka miwili",nami_yearly:"kila mwaka"},th:{nami_day_abbrev:"วัน",nami_day_abbrev_plural:"วัน",nami_week_abbrev:"สัปดาห์",nami_week_abbrev_plural:"สัปดาห์",nami_month_abbrev:"โม",nami_month_abbrev_plural:"มอส",nami_year_abbrev:"ปี",nami_year_abbrev_plural:"ปี",nami_daily:"รายวัน",nami_weekly:"รายสัปดาห์",nami_biweekly:"สองสัปดาห์ครั้ง",nami_monthly:"รายเดือน",nami_bimonthly:"สองเดือนครั้ง",nami_quarterly:"ไตรมาส",nami_biannually:"ทุกสองปี",nami_yearly:"ทุกปี"},tr:{nami_day_abbrev:"gün",nami_day_abbrev_plural:"günler",nami_week_abbrev:"hafta",nami_week_abbrev_plural:"haftalar",nami_month_abbrev:"ay",nami_month_abbrev_plural:"aylar",nami_year_abbrev:"yıl",nami_year_abbrev_plural:"yıllar",nami_daily:"günlük",nami_weekly:"haftalık",nami_biweekly:"iki haftada bir",nami_monthly:"aylık",nami_bimonthly:"iki ayda bir",nami_quarterly:"üç aylık",nami_biannually:"iki yılda bir",nami_yearly:"yıllık"},uk:{nami_day_abbrev:"день",nami_day_abbrev_plural:"дні",nami_week_abbrev:"тиждень",nami_week_abbrev_plural:"тижні",nami_month_abbrev:"місяць",nami_month_abbrev_plural:"мос",nami_year_abbrev:"рік",nami_year_abbrev_plural:"років",nami_daily:"щоденно",nami_weekly:"щотижня",nami_biweekly:"раз на два тижні",nami_monthly:"щомісяця",nami_bimonthly:"раз на два місяці",nami_quarterly:"щоквартально",nami_biannually:"раз на півроку",nami_yearly:"щорічно"},vi:{nami_day_abbrev:"ngày",nami_day_abbrev_plural:"ngày",nami_week_abbrev:"tuần",nami_week_abbrev_plural:"tuần",nami_month_abbrev:"tháng",nami_month_abbrev_plural:"tháng",nami_year_abbrev:"năm",nami_year_abbrev_plural:"năm",nami_daily:"hằng ngày",nami_weekly:"hàng tuần",nami_biweekly:"hai tuần một lần",nami_monthly:"hàng tháng",nami_bimonthly:"hai tháng một lần",nami_quarterly:"hàng quý",nami_biannually:"hai năm một lần",nami_yearly:"hàng năm"},"zh-CN":{nami_day_abbrev:"天",nami_day_abbrev_plural:"天",nami_week_abbrev:"周",nami_week_abbrev_plural:"周",nami_month_abbrev:"莫",nami_month_abbrev_plural:"莫斯",nami_year_abbrev:"年",nami_year_abbrev_plural:"年",nami_daily:"日常的",nami_weekly:"每周",nami_biweekly:"每两周一次",nami_monthly:"月度",nami_bimonthly:"双月刊",nami_quarterly:"季刊",nami_biannually:"每半年",nami_yearly:"每年"},"zh-TW":{nami_day_abbrev:"天",nami_day_abbrev_plural:"天",nami_week_abbrev:"週",nami_week_abbrev_plural:"週",nami_month_abbrev:"莫",nami_month_abbrev_plural:"莫斯",nami_year_abbrev:"年",nami_year_abbrev_plural:"年",nami_daily:"日常的",nami_weekly:"每週",nami_biweekly:"每兩週一次",nami_monthly:"每月",nami_bimonthly:"雙月刊",nami_quarterly:"季刊",nami_biannually:"每半年",nami_yearly:"每年"},zu:{nami_day_abbrev:"usuku",nami_day_abbrev_plural:"izinsuku",nami_week_abbrev:"isonto",nami_week_abbrev_plural:"amasonto",nami_month_abbrev:"inyanga",nami_month_abbrev_plural:"i-mos",nami_year_abbrev:"unyaka",nami_year_abbrev_plural:"iminyaka",nami_daily:"nsuku zonke",nami_weekly:"masonto onke",nami_biweekly:"kabili ngesonto",nami_monthly:"nyanga zonke",nami_bimonthly:"kabili ngenyanga",nami_quarterly:"njalo ngekota",nami_biannually:"kabili ngonyaka",nami_yearly:"minyaka yonke"}},md="en";function fd(e){const t=function(e){if(!e)return md;const t=e.trim();if(hd[t])return t;const n=t.toLowerCase(),i=n.split("-")[0];return hd[i]?i:"zh"===i?n.includes("tw")||n.includes("hk")?"zh-TW":"zh-CN":md}(ca.getLanguageCode()),n=hd[t]??hd[md];return n?.[e]??e}const pd=e=>"subscription"===e;function gd(e){if(pd(e?.product_type)){const t=yd(e);if(t.length>0)return t[0].billingPeriod}return null}function vd(e){const t=function(e){if(!e)return[];const t=e.offers.filter((e=>"promo"===e.offer_type));return bd(t,e.subscription_period)}(e).find((e=>0===e.priceAmountMicros));return t?.billingPeriod||null}function yd(e){if(!e)return[];return bd(e.offers.filter((e=>"default"===e.offer_type)),e.subscription_period)}function bd(e,t){return e.map((e=>wd(e,t)))}function wd(e,t){if(!e)return{};const n=e.promo_period?.count??t?.count,i=e.promo_period?.type??t?.type,a=e.promo_price?.price??e.price,r=e.promo_price?.currency??e.currency;return{priceAmountMicros:1e6*a,priceCurrencyCode:r,billingPeriod:i?`P${n}${i[0].toUpperCase()}`:"",formattedPrice:_d(r).format(a)}}function kd(e,t=!1,n=!1,i=!1,a=!1){if(!e)return null;const r=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!r)return null;const[o,s,l,d]=r.slice(1).map((e=>parseInt(e))),u=(e,t,n,i,r)=>{const o=(e=>a?`${e}_abbrev`:e)(r),s=(e=>a?`${e}_abbrev_plural`:`${e}_plural`)(r);let l=fd(o),d=fd(s);return a||l!==o||(l=fd(`${r}_abbrev`)),a||d!==s||(d=fd(`${r}_abbrev_plural`)),i?e.toString():n?1===e||t?l:d:1===e||t?`${e} ${l}`:`${e} ${d}`};switch(e.at(-1)){case"D":return u(d,t,n,i,"nami_day");case"W":return u(l,t,n,i,"nami_week");case"M":return u(s,t,n,i,"nami_month");case"Y":return u(o,t,n,i,"nami_year")}return null}function Sd(e){if(!e||e.length<2)return!1;const t=e.at(-1)?.toUpperCase();return"M"===t||"Y"===t}function _d(e){const t={maximumFractionDigits:2,minimumFractionDigits:0};try{return new Intl.NumberFormat(navigator.language,{...t,style:"currency",currency:e})}catch{return new Intl.NumberFormat(navigator.language,{...t,style:"currency",currency:"USD"})}}const Md=(e,t,n)=>e&&t&&n?n.format(e-t):null,Ed=(e,t,n,i)=>{if(e&&t&&n&&i){const a=100*(1-e/(n/i*t));return`${Math.round(a)}%`}return null},Pd=(e,t)=>{if(""==t)return;const n=parseInt(t)-1;return n>=0&&n<e?.length?e[n]:e?.find((e=>e.sku_ref_id===t))},Td=e=>Ad(e.priceAmountMicros)/xd(e.billingPeriod),xd=e=>{let t=parseInt(e[1]);return e.includes("Y")&&(t*=12),t},Ad=e=>e/1e6;function Cd(e){return parseFloat((Math.round(e)/100).toFixed(2))}const Ld=(e,t,n=[])=>({price:()=>Rd(e),name:()=>e?.name,title:()=>e?.name,description:()=>e?.description,duration:()=>Nd(e),durationSingular:()=>Nd(e,!0),period:()=>Nd(e,!1,!0),periodNumber:()=>Nd(e,!1,!1,!0),freeTrialDuration:()=>Wd(e),freeTrialDurationSingular:()=>Wd(e,!0),freeTrialPeriod:()=>Wd(e,!1,!0),freeTrialPeriodNumber:()=>Wd(e,!1,!1,!0),pricePerMonth:()=>Fd(e),pricePerMonthRounded:()=>Fd(e,!0),periodInMonths:()=>Od(e),durationInMonths:()=>$d(e),durationInMonthsSingular:()=>$d(e,!0),periodNumberInMonths:()=>jd(e),percentagePriceDifferenceFromSku:()=>zd(e,t,n),priceDifferenceFromSku:()=>Hd(e,t,n),promoEligible:()=>null===Bd(e)&&null!==Ud(e,t),freeTrialEligible:()=>null!==Bd(e),promo:()=>Ud(e,t)?.offer_ref_id,promoCode:()=>"XXXXX",promoPrice:()=>Gd(e,t)?.formattedPrice,promoPeriod:()=>Vd(e,t,!1,!0),promoPeriodNumber:()=>Vd(e,t,!1,!1,!0),promoDuration:()=>Vd(e,t),promoDurationSingular:()=>Vd(e,t,!0),introEligible:()=>!1,pricePerDay:()=>Xd(e),pricePerWeek:()=>Kd(e),pricePerWeekRounded:()=>Kd(e,!0),introductoryPrice:()=>Yd(e,t),introductoryPeriod:()=>qd(e,t,!1,!0),introductoryPeriodNumber:()=>qd(e,t,!1,!1,!0),introductoryDuration:()=>qd(e,t),introductoryDurationSingular:()=>qd(e,t,!0),introductoryPricePerMonth:()=>Jd(e,t),introductoryPricePerMonthRounded:()=>Jd(e,t,!0),durationAbbrev:()=>Nd(e,!1,!1,!1,!0),freeTrialDurationAbbrev:()=>Wd(e,!1,!1,!1,!0),introductoryDurationAbbrev:()=>qd(e,t,!1,!1,!1,!0),promoDurationAbbrev:()=>Vd(e,t,!1,!1,!1,!0),promoDurationPhase2Abbrev:()=>Vd(e,t,!0,!0,!1,!0),durationInMonthsAbbrev:()=>$d(e,!1,!1,!1,!0),durationSingularAbbrev:()=>Nd(e,!0,!1,!1,!0),freeTrialDurationSingularAbbrev:()=>Wd(e,!0,!1,!1,!0),introductoryDurationSingularAbbrev:()=>qd(e,t,!0,!1,!1,!0),promoDurationSingularAbbrev:()=>Vd(e,t,!0,!1,!1,!0),promoDurationSingularPhase2Abbrev:()=>Vd(e,t,!0,!0,!1,!0),durationInMonthsSingularAbbrev:()=>$d(e,!0,!1,!1,!0),periodAbbrev:()=>Nd(e,!1,!0,!1,!0),freeTrialPeriodAbbrev:()=>Wd(e,!1,!0,!1,!0),introductoryPeriodAbbrev:()=>qd(e,t,!1,!0,!1,!0),promoPeriodAbbrev:()=>Vd(e,t,!1,!0,!1,!0),promoPeriodPhase2Abbrev:()=>Vd(e,t,!1,!0,!0,!0),periodInMonthsAbbrev:()=>$d(e,!1,!0,!1,!0),periodly:()=>function(e){if(!e)return null;const t=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!t)return null;const[,n,i,a,r]=t,o=void 0!==n?parseInt(n,10):0,s=void 0!==i?parseInt(i,10):0,l=void 0!==a?parseInt(a,10):0;return(void 0!==r?parseInt(r,10):0)>0?null:l>0?1===l?fd("nami_weekly"):2===l?fd("nami_biweekly"):null:s>0?fd(1===s?"nami_monthly":2===s?"nami_bimonthly":3===s?"nami_quarterly":6===s?"nami_biannually":12===s?"nami_yearly":"nami_monthly"):o>0?fd("nami_yearly"):null}(gd(e)),iso_subscription_duration:()=>Zd(e),invalid:()=>!1,unavailable:()=>!1}),Id=()=>Object.keys(Ld({})),Dd=(e,t,n,i=[])=>{if(!t)return null;const a=Ld(t,n,i);return a[e]?a[e]():null},Rd=e=>{const t=yd(e);return t&&t.length?t[0].formattedPrice:null},Nd=(e,t,n,i,a)=>kd(gd(e),t,n,i,a),Wd=(e,t,n,i,a)=>kd(vd(e),t,n,i,a),Fd=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=Td(n[0]);return i?_d(n[0].priceCurrencyCode).format(t?Math.round(i):i):null},Od=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=n[0].billingPeriod;if(!Sd(i))return null;return kd("P1Y"===i?"P12M":i,!1,!1,!1,t)},$d=(e,t,n,i,a)=>{const r=yd(e);if(!r||0===r.length)return null;const o=r[0].billingPeriod;if(!Sd(o))return null;return kd("P1Y"===o?"P12M":o,t,n,i,a)},jd=e=>{if(!e)return 0;const t=yd(e);return t&&t.length?xd(t[0].billingPeriod):0},zd=(e,t,n=[])=>{const i=yd(e);if(!i||0===i.length)return null;const a=Pd(n,t??"")?.product_details;if(!t||!a)return Ed(Cd(i[0].priceAmountMicros),jd(e));const r=yd(a);return Ed(Cd(i[0].priceAmountMicros),jd(e),r?.length>0?Cd(r[0].priceAmountMicros):0,jd(a))},Hd=(e,t,n=[])=>{const i=yd(e);if(!i||0===i.length)return null;const a=Pd(n,t??"")?.product_details;if(!t||!a)return Md(Td(i[0]));const r=yd(a);return Md(Td(i[0]),Td(r[0]),_d(r[0].priceCurrencyCode))},Bd=e=>vd(e),Ud=(e,t)=>{if(!e)return null;const n=e.offers.filter((e=>"promo"===e.offer_type));if(!t)return n[0]||null;const i=n[parseInt(t)];return i?i||null:n.find((e=>e.offer_ref_id===t))||null},Gd=(e,t)=>{if(!e)return null;return wd(Ud(e,t),e.subscription_period)},Vd=(e,t,n,i,a,r)=>{const o=Gd(e,t);return kd(o?.billingPeriod||null,n,i,a,r)},Xd=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=Ad(n[0].priceAmountMicros)/(e=>{const t=xd(e);return t?30.437*t:1})(n[0].billingPeriod);return i?_d(n[0].priceCurrencyCode).format(i):null},Kd=(e,t)=>{const n=yd(e);if(!n||0===n.length)return null;const i=Ad(n[0].priceAmountMicros)/(e=>{const t=xd(e);return t?52*t/12:1})(n[0].billingPeriod);return i?_d(n[0].priceCurrencyCode).format(t?Math.round(i):i):null},Yd=(e,t)=>{const n=Qd(e,t);return n?.formattedPrice||null},qd=(e,t,n,i,a,r)=>{const o=Qd(e,t);return kd(o?.billingPeriod||null,n,i,a,r)},Jd=(e,t,n)=>{const i=Qd(e,t);if(!i)return;const a=Ad(i.priceAmountMicros),r=xd(i.billingPeriod),o=n?Math.round(a/r):a/r;return _d(i.priceCurrencyCode).format(o)},Qd=(e,t)=>{if(!e)return null;let n;return t?(n=e.offers[parseInt(t)],n||(n=e.offers.find((e=>e.offer_ref_id===t))||null)):n=e.offers[0],wd(n,e.subscription_period)},Zd=e=>{const t=gd(e);return t?"P7D"===t?"P1W":t:null};function eu(e,t,n){var i=e.length;return n=void 0===n?i:n,!t&&n>=i?e:function(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(a);++i<a;)r[i]=e[i+t];return r}(e,t,n)}var tu=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function nu(e){return tu.test(e)}var iu="\\ud800-\\udfff",au="["+iu+"]",ru="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",ou="\\ud83c[\\udffb-\\udfff]",su="[^"+iu+"]",lu="(?:\\ud83c[\\udde6-\\uddff]){2}",du="[\\ud800-\\udbff][\\udc00-\\udfff]",uu="(?:"+ru+"|"+ou+")"+"?",cu="[\\ufe0e\\ufe0f]?",hu=cu+uu+("(?:\\u200d(?:"+[su,lu,du].join("|")+")"+cu+uu+")*"),mu="(?:"+[su+ru+"?",ru,lu,du,au].join("|")+")",fu=RegExp(ou+"(?="+ou+")|"+mu+hu,"g");function pu(e){return nu(e)?function(e){return e.match(fu)||[]}(e):function(e){return e.split("")}(e)}var gu,vu=(gu="toUpperCase",function(e){var t=nu(e=Ki(e))?pu(e):void 0,n=t?t[0]:e.charAt(0),i=t?eu(t,1).join(""):e.slice(1);return n[gu]()+i});var yu,bu=(yu={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},function(e){return null==yu?void 0:yu[e]}),wu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ku=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var Su=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var _u=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var Mu="\\ud800-\\udfff",Eu="\\u2700-\\u27bf",Pu="a-z\\xdf-\\xf6\\xf8-\\xff",Tu="A-Z\\xc0-\\xd6\\xd8-\\xde",xu="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",Au="["+xu+"]",Cu="\\d+",Lu="["+Eu+"]",Iu="["+Pu+"]",Du="[^"+Mu+xu+Cu+Eu+Pu+Tu+"]",Ru="(?:\\ud83c[\\udde6-\\uddff]){2}",Nu="[\\ud800-\\udbff][\\udc00-\\udfff]",Wu="["+Tu+"]",Fu="(?:"+Iu+"|"+Du+")",Ou="(?:"+Wu+"|"+Du+")",$u="(?:['’](?:d|ll|m|re|s|t|ve))?",ju="(?:['’](?:D|LL|M|RE|S|T|VE))?",zu="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Hu="[\\ufe0e\\ufe0f]?",Bu=Hu+zu+("(?:\\u200d(?:"+["[^"+Mu+"]",Ru,Nu].join("|")+")"+Hu+zu+")*"),Uu="(?:"+[Lu,Ru,Nu].join("|")+")"+Bu,Gu=RegExp([Wu+"?"+Iu+"+"+$u+"(?="+[Au,Wu,"$"].join("|")+")",Ou+"+"+ju+"(?="+[Au,Wu+Fu,"$"].join("|")+")",Wu+"?"+Fu+"+"+$u,Wu+"+"+ju,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cu,Uu].join("|"),"g");function Vu(e,t,n){return e=Ki(e),void 0===t?function(e){return _u.test(e)}(e)?function(e){return e.match(Gu)||[]}(e):function(e){return e.match(Su)||[]}(e):e.match(t)||[]}var Xu=RegExp("['’]","g");var Ku,Yu=(Ku=function(e,t,n){return t=t.toLowerCase(),e+(n?vu(Ki(t).toLowerCase()):t)},function(e){return function(e,t,n){for(var i=-1,a=null==e?0:e.length;++i<a;)n=t(n,e[i],i,e);return n}(Vu(function(e){return(e=Ki(e))&&e.replace(wu,bu).replace(ku,"")}(e).replace(Xu,"")),Ku,"")});function qu(e,t,n,i){const a=n.flatMap((e=>e.products)).find((e=>e.id===t.selectedProducts[t.currentGroupId]));return Qu(ic(e,a?.sku_ref_id),a,i)}function Ju(e,t,n){const i=t.find((e=>e.id===n))?.products??[];return i.forEach((t=>{t.product_details=ic(e,t.sku_ref_id||""),t.variables=Qu(t.product_details,t,i)})),i}function Qu(e,t,n){if(!t)return{};const i=t.variables;if(!i)return{...t};Object.keys(i).forEach((t=>{if(Zu(i[t])){const a=tc(i[t],e,n);i[t]=function(e){if(!e||e.includes("null")||e.includes("undefined"))return"";if(/\$\{\s*(launch\.customAttributes\.|sku\.)\w+\s*}/.test(e))return"";return e}(a)}}));const a={};return Id().forEach((t=>{if(void 0===i[t]){const i=Dd(t,e,void 0,n);null!==i&&(a[t]=i)}})),{...t,...a,...i}}function Zu(e){return"string"==typeof e&&e.includes(Ye)}function ec(e,t,n){return t?(Object.keys(t).forEach((i=>{Zu(t[i])&&(t[i]=t[Yu(i)]=tc(t[i],e,n))})),{...t}):{}}const tc=(e,t,n)=>e.replace(Ve,((i,a)=>{const r=Ve.exec(e)?.slice(1)||[];a=r[0]??a;const o=r[1]?.replace(":","")??"";return Dd(a,t,o,n)}));function nc(e,t){return t.flatMap((e=>e.products)).some((t=>1==Dd("freeTrialEligible",ic(e,t.sku_ref_id))))}function ic(e=[],t=""){return e.find((e=>e.product_ref_id===t))||null}var ac=function(){try{var e=Wt(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();function rc(e,t,n){"__proto__"==t&&ac?ac(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var oc=Object.prototype.hasOwnProperty;function sc(e,t,n){var i=e[t];oc.call(e,t)&&tt(i,n)&&(void 0!==n||t in e)||rc(e,t,n)}function lc(e,t,n,i){var a=!n;n||(n={});for(var r=-1,o=t.length;++r<o;){var s=t[r],l=void 0;void 0===l&&(l=e[s]),a?rc(n,s,l):sc(n,s,l)}return n}var dc=Object.prototype.hasOwnProperty;function uc(e){if(!yt(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Yn(e),n=[];for(var i in e)("constructor"!=i||!t&&dc.call(e,i))&&n.push(i);return n}function cc(e){return Zn(e)?Xn(e,!0):uc(e)}var hc="object"==typeof e&&e&&!e.nodeType&&e,mc=hc&&"object"==typeof module&&module&&!module.nodeType&&module,fc=mc&&mc.exports===hc?st.Buffer:void 0,pc=fc?fc.allocUnsafe:void 0;var gc=qn(Object.getPrototypeOf,Object),vc=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)gn(t,Sn(e)),e=gc(e);return t}:bn;function yc(e){return yn(e,cc,vc)}var bc=Object.prototype.hasOwnProperty;function wc(e){var t=new e.constructor(e.byteLength);return new Jt(t).set(new Jt(e)),t}var kc=/\w*$/;var Sc=lt?lt.prototype:void 0,_c=Sc?Sc.valueOf:void 0;var Mc="[object Boolean]",Ec="[object Date]",Pc="[object Map]",Tc="[object Number]",xc="[object RegExp]",Ac="[object Set]",Cc="[object String]",Lc="[object Symbol]",Ic="[object ArrayBuffer]",Dc="[object DataView]",Rc="[object Float32Array]",Nc="[object Float64Array]",Wc="[object Int8Array]",Fc="[object Int16Array]",Oc="[object Int32Array]",$c="[object Uint8Array]",jc="[object Uint8ClampedArray]",zc="[object Uint16Array]",Hc="[object Uint32Array]";function Bc(e,t,n){var i,a=e.constructor;switch(t){case Ic:return wc(e);case Mc:case Ec:return new a(+e);case Dc:return function(e,t){var n=t?wc(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Rc:case Nc:case Wc:case Fc:case Oc:case $c:case jc:case zc:case Hc:return function(e,t){var n=t?wc(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,n);case Pc:return new a;case Tc:case Cc:return new a(e);case xc:return function(e){var t=new e.constructor(e.source,kc.exec(e));return t.lastIndex=e.lastIndex,t}(e);case Ac:return new a;case Lc:return i=e,_c?Object(_c.call(i)):{}}}var Uc=Object.create,Gc=function(){function e(){}return function(t){if(!yt(t))return{};if(Uc)return Uc(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Vc=Bn&&Bn.isMap,Xc=Vc?$n(Vc):function(e){return _n(e)&&"[object Map]"==yi(e)};var Kc=Bn&&Bn.isSet,Yc=Kc?$n(Kc):function(e){return _n(e)&&"[object Set]"==yi(e)},qc=1,Jc=2,Qc=4,Zc="[object Arguments]",eh="[object Function]",th="[object GeneratorFunction]",nh="[object Object]",ih={};function ah(e,t,n,i,a,r){var o,s=t&qc,l=t&Jc,d=t&Qc;if(void 0!==o)return o;if(!yt(e))return e;var u=vn(e);if(u){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&bc.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t}(e,o)}else{var c=yi(e),h=c==eh||c==th;if(In(e))return function(e,t){if(t)return e.slice();var n=e.length,i=pc?pc(n):new e.constructor(n);return e.copy(i),i}(e,s);if(c==nh||c==Zc||h&&!a){if(o=l||h?{}:function(e){return"function"!=typeof e.constructor||Yn(e)?{}:Gc(gc(e))}(e),!s)return l?function(e,t){return lc(e,vc(e),t)}(e,function(e,t){return e&&lc(t,cc(t),e)}(o,e)):function(e,t){return lc(e,Sn(e),t)}(e,function(e,t){return e&&lc(t,ei(t),e)}(o,e))}else{if(!ih[c])return a?e:{};o=Bc(e,c,s)}}r||(r=new Ut);var m=r.get(e);if(m)return m;r.set(e,o),Yc(e)?e.forEach((function(i){o.add(ah(i,t,n,i,e,r))})):Xc(e)&&e.forEach((function(i,a){o.set(a,ah(i,t,n,a,e,r))}));var f=u?void 0:(d?l?yc:ti:l?cc:ei)(e);return function(e,t){for(var n=-1,i=null==e?0:e.length;++n<i&&!1!==t(e[n],n,e););}(f||e,(function(i,a){f&&(i=e[a=i]),sc(o,a,ah(i,t,n,a,e,r))})),o}ih[Zc]=ih["[object Array]"]=ih["[object ArrayBuffer]"]=ih["[object DataView]"]=ih["[object Boolean]"]=ih["[object Date]"]=ih["[object Float32Array]"]=ih["[object Float64Array]"]=ih["[object Int8Array]"]=ih["[object Int16Array]"]=ih["[object Int32Array]"]=ih["[object Map]"]=ih["[object Number]"]=ih[nh]=ih["[object RegExp]"]=ih["[object Set]"]=ih["[object String]"]=ih["[object Symbol]"]=ih["[object Uint8Array]"]=ih["[object Uint8ClampedArray]"]=ih["[object Uint16Array]"]=ih["[object Uint32Array]"]=!0,ih["[object Error]"]=ih[eh]=ih["[object WeakMap]"]=!1;const rh=(e,t,n)=>{const i=Object.getOwnPropertyDescriptor(e,t);if(!i||i.configurable)try{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n,writable:!1})}catch{try{e[t]=n}catch{}}};class oh{constructor(){this.listeners=new Map}addEventListener(e,t,n){if(!t)return;const i=(e=>"boolean"==typeof e?{capture:e}:e??{})(n),a=this.listeners.get(e)??[];if(a.some((e=>e.listener===t)))return;const r={listener:t,once:Boolean(i.once)};if(i.signal){if(i.signal.aborted)return;r.signal=i.signal,r.abortHandler=()=>this.removeEventListener(e,t),i.signal.addEventListener("abort",r.abortHandler,{once:!0})}a.push(r),this.listeners.set(e,a)}removeEventListener(e,t){if(!t)return;const n=this.listeners.get(e);if(n&&0!==n.length){for(let e=n.length-1;e>=0;e-=1){const i=n[e];i.listener===t&&(i.signal&&i.abortHandler&&i.signal.removeEventListener("abort",i.abortHandler),n.splice(e,1))}0===n.length&&this.listeners.delete(e)}}dispatchEvent(e){if(!e||"string"!=typeof e.type)throw new TypeError('Failed to execute "dispatchEvent": event type must be a string.');const t=this.listeners.get(e.type);if(!t||0===t.length)return!0;rh(e,"target",this);let n=!1;const i=e.stopImmediatePropagation?.bind(e),a=e.stopPropagation?.bind(e),r=()=>{n=!0,i?.()},o=()=>{e.cancelBubble=!0,a?.()};e.stopImmediatePropagation=r,e.stopPropagation=o;const s=t.slice();for(const t of s){if(n)break;rh(e,"currentTarget",this),"function"==typeof t.listener?t.listener.call(this,e):"object"==typeof(l=t.listener)&&null!==l&&"handleEvent"in l&&t.listener.handleEvent.call(t.listener,e),t.once&&this.removeEventListener(e.type,t.listener)}var l;if(i)e.stopImmediatePropagation=i;else try{delete e.stopImmediatePropagation}catch{e.stopImmediatePropagation=r}if(a)e.stopPropagation=a;else try{delete e.stopPropagation}catch{e.stopPropagation=o}return rh(e,"currentTarget",null),!e.defaultPrevented}}let sh=[];const lh={paywallId:"",livePaywalls:[],selectedPaywall:void 0,selectedCampaign:void 0,campaignRules:[],anySkuHasTrialOffer:!1,anySkuHasIntroOffer:!1,anySkuHasPromoOffer:!1,isLoggedIn:!1,darkMode:!1,safeAreaTop:0,groups:[],selectedProducts:{},formStates:{},timerStates:{},currentPage:"page1",currentGroupId:"",currentGroupName:"",fullScreenPresentation:!1,launch:{productGroups:[],customAttributes:{},customObject:{},currentGroup:""},sku:{},orientation:"portrait",focusedState:!1,platformId:"",mediaList:{},skuItems:[],customer:{},hasNotch:!1,purchaseInProgress:!1,formFactor:"desktop",slides:{},userInteractionEnabled:!0,currentSlideIndex:void 0};class dh extends oh{static create(e,t,n){const i=new dh(e,t,n);return this.providers.push(i),i}static remove(e){this.providers=this.providers.filter((t=>t!==e))}static get currentProvider(){return dh.providers[0]}static setCustomerAttribute(e){this.providers.forEach((t=>{t.setCustomerAttribute(e)}))}static removeCustomerAttribute(e){this.providers.forEach((t=>{t.removeCustomerAttribute(e)}))}static setAppSuppliedVideoDetails(e){this.providers.forEach((t=>{t.setAppSuppliedVideoDetails(e)}))}static getSelectedPaywall(){return this.providers[0]?.getSelectedPaywall()}static setUserInteractionEnabled(e){this.providers.forEach((t=>{t.setUserInteractionEnabled(e)}))}static setUserTags(e){this.providers.forEach((t=>{t.setUserTags(e)}))}static setProductDetails(e){this.providers.forEach((t=>{t.setProductDetails(e)})),sh=e}static setPurchaseInProgress(e){this.providers.forEach((t=>{t.setPurchaseInProgress(e)}))}static setIsLoggedIn(e){this.providers.forEach((t=>{t.setIsLoggedIn(e)}))}static setPurchase(e,t){this.providers.forEach((n=>{n.setPurchase(e,t)}))}static getSelectedSlideIndex(){return this.providers[0]?.state.currentSlideIndex}constructor(e,t,n){super(),this.host=null,this.subscribers=new Set,this.productDetails=sh,this.filteredSkuMenus=[],this.state=ah(lh,5);const i=ca.getNamiProfile();this.state.isLoggedIn=!!i?.externalId,this.setPaywall(e,t,n),this.defineDynamicStateProps(),this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}emitEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}onEvent(e,t){const n=e=>t(e.detail);return this.addEventListener(e,n),()=>this.removeEventListener(e,n)}hostConnected(){}hostDisconnected(){this.subscribers.clear()}defineDynamicStateProps(){Object.defineProperty(this.state,"tvQuality",{get:this.getTVQuality.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportWidth",{get:this.getViewportWidth.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportHeight",{get:this.getViewportHeight.bind(this),enumerable:!1,configurable:!0})}setState(e){this.state=e,this.defineDynamicStateProps(),this.subscribers.forEach((e=>e())),this.host&&this.host.requestUpdate()}setProductDetails(e){this.productDetails=e}getProductDetails(){return this.productDetails}setCurrentGroupData(e,t){const n=qu(this.productDetails,this.state,this.filteredSkuMenus,Ju(this.productDetails,this.filteredSkuMenus,this.state.currentGroupId));this.setState({...this.state,currentGroupId:e,currentGroupName:t,sku:n})}setFormState(e,t){this.setState({...this.state,formStates:{...this.state.formStates,[e]:t}})}setTimerState(e,t,n,i){this.setState({...this.state,timerStates:{...this.state.timerStates,[e]:{remainingSeconds:t,savedAt:n,hasEmittedCompletion:i}}})}getTimerState(e){return this.state.timerStates[e]}getCurrentGroupId(){return this.state.currentGroupId}getCurrentGroupName(){return this.state.currentGroupName}setCurrentFormId(e,t){const n=this.state.formStates||{},i={...n,[e]:t||!n[e]};this.setState({...this.state,formStates:i})}getCurrentFormId(e){return this.state.formStates[e]}setSelectedProducts(e){const t=qu(this.productDetails,this.state,this.filteredSkuMenus,Ju(this.productDetails,this.filteredSkuMenus,this.state.currentGroupId));this.setState({...this.state,selectedProducts:e,sku:t})}selectedProducts(){return this.state.selectedProducts}setPaywall(e,t,n){let i={...this.state,formFactor:El(),selectedPaywall:e,selectedCampaign:n};const a=e.template?.initialState;i={...i,...a};const r=function(e,t,n=[]){const i=t.productGroups?.length?t.productGroups:n.map((e=>e.ref));return{customAttributes:t.customAttributes,productGroups:i,customObject:{...e.customObject,...t.customObject},currentGroup:t.currentGroup??""}}(i.launch,t,e.sku_menus);if(this.filteredSkuMenus=e.sku_menus??[],r.productGroups.length&&(this.filteredSkuMenus=this.filteredSkuMenus.filter((e=>r.productGroups.includes(e.ref)))),""!==r.currentGroup&&i.groups.length&&e.template?.displaySingleGroup&&(i.currentGroupId=i.groups.find((e=>e.ref==r.currentGroup))?.id??""),""===i.currentGroupId&&1===this.filteredSkuMenus.length){const e=i.groups.find((e=>e.ref==this.filteredSkuMenus[0].ref));i.currentGroupId=e?.id??i.currentGroupId}const o=Ju(this.productDetails,this.filteredSkuMenus,i.currentGroupId);i.skuItems=o,i.launch=r,i.anySkuHasTrialOffer=nc(this.productDetails,this.filteredSkuMenus),i.anySkuHasPromoOffer=function(e,t){return!nc(e,t)&&t.flatMap((e=>e.products)).some((t=>1==Dd("promoEligible",ic(e,t.sku_ref_id))))}(this.productDetails,this.filteredSkuMenus),i.paywallId=e.id,i.sku=qu(this.productDetails,i,this.filteredSkuMenus,o),this.setState(i)}getSelectedPaywall(){return this.state.selectedPaywall}getSelectedCampaign(){return this.state.selectedCampaign}getCurrentPlacementLabel(){return this.state.selectedCampaign?.value?this.state.selectedCampaign.value:this.flow?.campaign?.value?this.flow.campaign.value:void 0}getPaywallActionEventData(){const t=this.state.selectedCampaign,n=this.state.selectedPaywall;return{paywallId:n?.id??"",paywallName:n?.name??"",campaignId:t?.rule??"",campaignName:t?.name??"",campaignType:t?.type??"",campaignLabel:t?.value??"",campaignUrl:t?.type===e.NamiCampaignRuleType.URL?t?.value??"":"",segmentId:t?.segment??"",externalSegmentId:t?.external_segment??""}}paywallId(){return this.state.paywallId}setCurrentPage(e){this.setState({...this.state,currentPage:e})}setCustomerAttribute(e){this.setState({...this.state,customer:{...this.state.customer,...e}})}removeCustomerAttribute(e){delete this.state.customer[e],this.setState(this.state)}setIsLoggedIn(e){this.setState({...this.state,isLoggedIn:e})}setMediaList(e){this.setState({...this.state,mediaList:e.reduce(((e,t)=>({...e,[t.name]:t})))})}setSafeAreaTop(e){this.setState({...this.state,safeAreaTop:e})}setFullScreenPresentation(e){this.setState({...this.state,fullScreenPresentation:e})}setFormFactor(e){this.setState({...this.state,formFactor:e})}getFormFactor(){return this.state.formFactor}getTVQuality(){if("television"!==this.getFormFactor())return"";const e=window.devicePixelRatio||1,t=window.innerWidth||window.screen?.availWidth,n=window.innerHeight||window.screen?.availHeight;if(!t||!n)return"720p";const i=Math.max(t,n)*e,a=Math.min(t,n)*e;return i>=3840||a>=2160?"4K":i>=1920||a>=1080?"1080p":"720p"}getViewportWidth(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}getViewportHeight(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}setPurchaseInProgress(e){this.setState({...this.state,purchaseInProgress:e})}setPurchase(e,t){this.setState({...this.state,purchaseInProgress:e,productBeingPurchased:t})}setTimeSpentOnPaywall(e){this.setState({...this.state,timeSpentOnPaywall:e})}setAppSuppliedVideoDetails({url:e,name:t}){this.setState({...this.state,appSuppliedVideoUrl:e,appSuppliedVideoName:t})}resetAppSuppliedVideoDetails(){delete this.state.appSuppliedVideoUrl,delete this.state.appSuppliedVideoName,this.setState(this.state)}setLaunchDetails(e,t){this.setState({...this.state,launchValue:e,launchType:t})}setOpenHeaderIds(e,t){e=t?.skuId?`${e}_${t.skuId}`:e;const n=[...this.state.openHeaderIds],i=n.indexOf(e);-1!==i?n.splice(i,1):n.push(e),this.setState({...this.state,openHeaderIds:n,currentCollapsibleSku:t??null})}getCurrentCollapsibleSku(){return this.state.currentCollapsibleSku}setFlow(e){this.flow=e}setUserInteractionEnabled(e){this.setState({...this.state,userInteractionEnabled:e}),this.emitEvent("user-interaction-changed",{enabled:e})}setUserTags(e){this.setState({...this.state,userTags:{...this.state.userTags,...e}})}setCurrentSlideIndex(e){this.state.currentSlideIndex=e}}dh.providers=[];class uh{constructor(){this.refIdToPurchasedSKUs={},this.refIdToRelatedSKUs={},this.refIdToActivePurchases={}}}uh.instance=new uh;const ch=()=>ua(et([...ca.getNamiEntitlements(te),...ca.getNamiEntitlements(oe)]),"referenceId"),hh=()=>{nd.getInstance().emit(Ue,ch())};function mh(e){return{id:e.id,skuId:e.sku_ref_id,name:e.name,type:e.sku_type||"unknown",entitlements:e.entitlements,productDetails:"product_details"in e?e.product_details:null}}class fh{constructor(){}async fetchActiveEntitlements(){let e=null;if(ud()||Xs(A.THIRD_PARTY_TRANSACTIONS)||!Xs(A.ENTITLEMENT_MANAGEMENT))ud()&&Ze.debug("Skipping active entitlements update - anonymous mode"),Xs(A.THIRD_PARTY_TRANSACTIONS)&&Ze.debug("Skipping active entitlements update - paywalls-only mode"),Xs(A.ENTITLEMENT_MANAGEMENT)||Ze.debug("Skipping active entitlements update - no entitlement_management capability");else{const t=ca.getDevice();if(t?.id){const n=await this.getAPIEntitlements(t.id);e=n?.results,e&&(ca.setActiveEntitlements(ee,e),this.invokeActiveEntitlementsHandler(e))}}return e}async getAPIEntitlements(e){const t=`device/${e}/active_entitlements/`;let n={};try{n=await Zs.instance.fetchAPI(t)}catch(e){throw Ze.error(Aa(e.status,t)),e}return n}invokeActiveEntitlementsHandler(e){if(Ys()){(e=>{ca.setNamiEntitlements(te,e);const t=ca.getNamiEntitlements(oe),n=new Set(e.map((e=>e.referenceId))),i=t.filter((e=>{const t=n.has(e.referenceId);return t&&Ze.debug(`Server granted verified entitlement for ${e.referenceId}, so replacing provisional entitlement grant.`),!t}));i.length!==t.length&&ca.setNamiEntitlements(oe,i),hh()})(e.map((e=>(e=>{const t=e.entitlement_ref_id;return{name:e.name||"",desc:e.description||"",namiId:"",referenceId:t,relatedSkus:uh.instance.refIdToRelatedSKUs[t]||[],activePurchases:uh.instance.refIdToActivePurchases[t]||[],purchasedSkus:uh.instance.refIdToPurchasedSKUs[t]||[],expires:e.expires?new Date(e.expires).valueOf():0}})(e))))}}}fh.instance=new fh;class ph{async fetchCustomerJourneyState(){if(ud())return Ze.debug("Skipping customer journey state update - anonymous mode"),null;const e=ca.getDevice();if(!e?.id)return null;const t=`device/${e.id}/profile/`;let n=null;try{n=await Zs.instance.fetchAPI(t,void 0,0)}catch(e){throw Ze.error(Aa(e.status,t)),e}return n?(ca.setCustomerJourneyState(n.customer_journey_state),n.customer_journey_state):null}}ph.instance=new ph;class gh{constructor(){this.inMemoryAnonymousMode=!1,dd=this}setInMemoryAnonymousMode(e){this.inMemoryAnonymousMode=e,Ze.info(`In-memory anonymous mode ${e?"enabled":"disabled"} due to failed device registration`)}isInMemoryAnonymousMode(){return this.inMemoryAnonymousMode}isAnonymousMode(){return ca.getAnonymousMode()||this.inMemoryAnonymousMode}async init(e){this.setInitialValues(e),ld.instance.fetchConfig(),await this.initAndFetchRequiredData(e),cd.instance.startSession()}setInitialValues(e){const t={...e};delete t.initialConfig,ca.clearSessionId(),ca.setNamiConfig(t),ca.setLanguageCode(e.namiLanguageCode),ca.setPurchaseChannel(e.purchaseChannel);const n=e.initialConfig;if(n.appConfig||n.platform_config){const e=n?.appConfig||n?.platform_config;e&&ca.setAppConfig(ne,e)}n?.paywalls&&ca.setPaywalls(ae,n.paywalls),n?.products&&ca.setProducts(re,n.products)}initAnonymousDevice(){return{deviceId:rd.instance.getOrCreateAnonymousUUID(),deviceTask:null}}initIdentifiedDevice(e){const t={...Ml(e.namiCommands),...e.formFactor?{form_factor:e.formFactor}:{}},n=function(e){if(!e)return;const t=e.find((e=>e.startsWith("splitPosition=")));if(!t)return;const n=t.split("=")[1],i=Number(n);return n&&!isNaN(i)?Ll(i):void 0}(e.namiCommands),{id:i,device:a}=rd.instance.createOrUpdateDevice(t,n,this);return{deviceId:i,deviceTask:a}}async initAndFetchRequiredData(e,t=0,n=1){const i=e.initialConfig,a=e.formFactor??El(),r=this.isAnonymousMode(),{deviceId:o,deviceTask:s}=r?this.initAnonymousDevice():this.initIdentifiedDevice(e),l=Al(o);i.campaign_rules&&ca.setCampaignRules(ie,Nl(i.campaign_rules,l,a)),s&&await s,id.instance.configure(a,l,e.namiCommands),Ks();const d=Promise.all([od.instance.fetchProducts(),ph.instance.fetchCustomerJourneyState(),fh.instance.fetchActiveEntitlements(),sd.instance.fetchPaywalls().then((e=>id.instance.fetchCampaignRules(e)))]).catch((async i=>{if(i instanceof fa){if(ca.resetDevice(),t<n){const i=100*Math.pow(2,t);return await new Promise((e=>setTimeout(e,i))),this.initAndFetchRequiredData(e,t+1,n)}if(!r)return Ze.warn(`Max retries reached for ConflictError. ${i.message}`),this.setInMemoryAnonymousMode(!0),this.initAndFetchRequiredData(e,0,n)}throw i}));i.campaign_rules?.length&&i.paywalls?.length||await d,d.then((()=>this.reRenderPaywall()))}reRenderPaywall(){if("undefined"==typeof document)return;const e=document.querySelector("nami-paywall");e?.setPaywallData()}}function vh(e){return Array.isArray(e)?e.map(vh):e&&"object"==typeof e?Object.entries(e).reduce(((e,[t,n])=>(void 0!==n&&(e[t]=vh(n)),e)),{}):e}gh.instance=new gh;let yh=!0,bh=!1;function wh(){if("function"==typeof window.VIZIO?.Chromevox?.isEnabled)try{yh=window.VIZIO?.Chromevox?.isEnabled()}catch{}}function kh(){return"undefined"!=typeof window&&void 0!==window.VIZIO&&"function"==typeof window.VIZIO?.Chromevox?.play}function Sh(e){e.isTrusted&&wh()}function _h(e){e.isTrusted&&(yh=!1)}function Mh(e){if(e&&kh()&&yh)try{window.VIZIO?.Chromevox?.play(e)}catch{}}var Eh;class Ph{constructor(){Eh.set(this,!1),this.maxLogging=!1}get isInitialized(){return x(this,Eh,"f")||null!=ca.getNamiConfig()}static sdkVersion(){return C}static sdkPackageVersion(){return L}static async configure(e){if(!e.appPlatformID)throw new ga;return this.setInitialConfig(e),await Ph.instance.initializeSDK(e)}static setInitialConfig(e){if(null!=e.initialConfig){if("string"==typeof e.initialConfig){Ze.warn("[DEPRECATED] NamiConfiguration.initialConfig should be an object");const t=function(e){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{return JSON.parse(t)}catch{return}}(e.initialConfig);if(!t)return Ze.error("Failed to parse NamiConfiguration.initialConfig"),void(e.initialConfig={});e.initialConfig=t}if("object"!=typeof e.initialConfig)e.initialConfig={};else if((e=>"object"==typeof e&&"initial_config"in e)(e.initialConfig)){const t=qs(e.initialConfig.initial_config);t?e.initialConfig=t:(e.initialConfig={},Ze.error("Failed to parse NamiConfiguration.initialConfig as base64-gzipped JSON"))}}else e.initialConfig={}}async initializeSDK(e){let t=!1,n=!1;const i=x(this,Eh,"f")?ca.getNamiConfig():null;if(Ze.setLogger(e.logLevel),Ph.instance.maxLogging=e.maxLogging??!1,null!==i){const r={...e};if(delete r.initialConfig,a=i,ad(vh(r),vh(a)))return Ze.warn("Nami SDK is already configured, ignoring this configure call."),{sdkInitialized:!0,configureState:ze};n=!0;const o=Vs(e.namiCommands),s=Vs(i.namiCommands);e.appPlatformID==i.appPlatformID&&o==s||(t=!0),e.namiLanguageCode===i.namiLanguageCode&&e.logLevel==i.logLevel||(n=!0)}var a;t&&(Ze.info("SDK full reconfigure called"),ca.resetDevice()),function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?a.call(e,n):a?a.value=n:t.set(e,n)}(this,Eh,!0,"f"),Zs.configure(e),await gh.instance.init(e),Ze.info("SDK successfully initialized!");const r=n||t?je:$e;return!bh&&kh()&&(window.addEventListener("VIZIO_TTS_ENABLED",Sh),window.addEventListener("VIZIO_TTS_DISABLED",_h),bh=!0,wh()),{sdkInitialized:!0,configureState:r}}}Eh=new WeakMap,Ph.instance=new Ph;const Th=new Set(["fullscreen","sheet","compact_sheet","modal"]);var xh;e.NamiPaywallManagerEvents=void 0,(xh=e.NamiPaywallManagerEvents||(e.NamiPaywallManagerEvents={})).BuySku="RegisterBuySKU",xh.Close="PaywallCloseRequested",xh.SignIn="PaywallSignInRequested",xh.Restore="PaywallRestoreRequested",xh.DeeplinkAction="PaywallDeeplinkAction";const Ah=globalThis,Ch=Ah.ShadowRoot&&(void 0===Ah.ShadyCSS||Ah.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lh=Symbol(),Ih=new WeakMap;let Dh=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Lh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Ch&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=Ih.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ih.set(t,e))}return e}toString(){return this.cssText}};const Rh=e=>new Dh("string"==typeof e?e:e+"",void 0,Lh),Nh=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[i+1]),e[0]);return new Dh(n,e,Lh)},Wh=Ch?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Rh(t)})(e):e,{is:Fh,defineProperty:Oh,getOwnPropertyDescriptor:$h,getOwnPropertyNames:jh,getOwnPropertySymbols:zh,getPrototypeOf:Hh}=Object,Bh=globalThis,Uh=Bh.trustedTypes,Gh=Uh?Uh.emptyScript:"",Vh=Bh.reactiveElementPolyfillSupport,Xh=(e,t)=>e,Kh={toAttribute(e,t){switch(t){case Boolean:e=e?Gh:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},Yh=(e,t)=>!Fh(e,t),qh={attribute:!0,type:String,converter:Kh,reflect:!1,useDefault:!1,hasChanged:Yh};Symbol.metadata??=Symbol("metadata"),Bh.litPropertyMetadata??=new WeakMap;let Jh=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=qh){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Oh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:a}=$h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const r=i?.call(this);a?.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??qh}static _$Ei(){if(this.hasOwnProperty(Xh("elementProperties")))return;const e=Hh(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Xh("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Xh("properties"))){const e=this.properties,t=[...jh(e),...zh(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(Wh(e))}else void 0!==e&&t.push(Wh(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(Ch)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of t){const t=document.createElement("style"),i=Ah.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(void 0!==i&&!0===n.reflect){const a=(void 0!==n.converter?.toAttribute?n.converter:Kh).toAttribute(t,n.type);this._$Em=e,null==a?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=n.getPropertyOptions(i),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:Kh;this._$Em=i;const r=a.fromAttribute(t,e.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const i=this.constructor,a=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??Yh)(a,t)||n.useDefault&&n.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:a},r){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==a||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,n,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};Jh.elementStyles=[],Jh.shadowRootOptions={mode:"open"},Jh[Xh("elementProperties")]=new Map,Jh[Xh("finalized")]=new Map,Vh?.({ReactiveElement:Jh}),(Bh.reactiveElementVersions??=[]).push("2.1.1");const Qh=globalThis,Zh=Qh.trustedTypes,em=Zh?Zh.createPolicy("lit-html",{createHTML:e=>e}):void 0,tm="$lit$",nm=`lit$${Math.random().toFixed(9).slice(2)}$`,im="?"+nm,am=`<${im}>`,rm=document,om=()=>rm.createComment(""),sm=e=>null===e||"object"!=typeof e&&"function"!=typeof e,lm=Array.isArray,dm=e=>lm(e)||"function"==typeof e?.[Symbol.iterator],um="[ \t\n\f\r]",cm=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hm=/-->/g,mm=/>/g,fm=RegExp(`>|${um}(?:([^\\s"'>=/]+)(${um}*=${um}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),pm=/'/g,gm=/"/g,vm=/^(?:script|style|textarea|title)$/i,ym=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),bm=ym(1),wm=ym(2),km=Symbol.for("lit-noChange"),Sm=Symbol.for("lit-nothing"),_m=new WeakMap,Mm=rm.createTreeWalker(rm,129);function Em(e,t){if(!lm(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==em?em.createHTML(t):t}const Pm=(e,t)=>{const n=e.length-1,i=[];let a,r=2===t?"<svg>":3===t?"<math>":"",o=cm;for(let t=0;t<n;t++){const n=e[t];let s,l,d=-1,u=0;for(;u<n.length&&(o.lastIndex=u,l=o.exec(n),null!==l);)u=o.lastIndex,o===cm?"!--"===l[1]?o=hm:void 0!==l[1]?o=mm:void 0!==l[2]?(vm.test(l[2])&&(a=RegExp("</"+l[2],"g")),o=fm):void 0!==l[3]&&(o=fm):o===fm?">"===l[0]?(o=a??cm,d=-1):void 0===l[1]?d=-2:(d=o.lastIndex-l[2].length,s=l[1],o=void 0===l[3]?fm:'"'===l[3]?gm:pm):o===gm||o===pm?o=fm:o===hm||o===mm?o=cm:(o=fm,a=void 0);const c=o===fm&&e[t+1].startsWith("/>")?" ":"";r+=o===cm?n+am:d>=0?(i.push(s),n.slice(0,d)+tm+n.slice(d)+nm+c):n+nm+(-2===d?t:c)}return[Em(e,r+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class Tm{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,r=0;const o=e.length-1,s=this.parts,[l,d]=Pm(e,t);if(this.el=Tm.createElement(l,n),Mm.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Mm.nextNode())&&s.length<o;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(tm)){const t=d[r++],n=i.getAttribute(e).split(nm),o=/([.?@])?(.*)/.exec(t);s.push({type:1,index:a,name:o[2],strings:n,ctor:"."===o[1]?Im:"?"===o[1]?Dm:"@"===o[1]?Rm:Lm}),i.removeAttribute(e)}else e.startsWith(nm)&&(s.push({type:6,index:a}),i.removeAttribute(e));if(vm.test(i.tagName)){const e=i.textContent.split(nm),t=e.length-1;if(t>0){i.textContent=Zh?Zh.emptyScript:"";for(let n=0;n<t;n++)i.append(e[n],om()),Mm.nextNode(),s.push({type:2,index:++a});i.append(e[t],om())}}}else if(8===i.nodeType)if(i.data===im)s.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(nm,e+1));)s.push({type:7,index:a}),e+=nm.length-1}a++}}static createElement(e,t){const n=rm.createElement("template");return n.innerHTML=e,n}}function xm(e,t,n=e,i){if(t===km)return t;let a=void 0!==i?n._$Co?.[i]:n._$Cl;const r=sm(t)?void 0:t._$litDirective$;return a?.constructor!==r&&(a?._$AO?.(!1),void 0===r?a=void 0:(a=new r(e),a._$AT(e,n,i)),void 0!==i?(n._$Co??=[])[i]=a:n._$Cl=a),void 0!==a&&(t=xm(e,a._$AS(e,t.values),a,i)),t}let Am=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??rm).importNode(t,!0);Mm.currentNode=i;let a=Mm.nextNode(),r=0,o=0,s=n[0];for(;void 0!==s;){if(r===s.index){let t;2===s.type?t=new Cm(a,a.nextSibling,this,e):1===s.type?t=new s.ctor(a,s.name,s.strings,this,e):6===s.type&&(t=new Nm(a,this,e)),this._$AV.push(t),s=n[++o]}r!==s?.index&&(a=Mm.nextNode(),r++)}return Mm.currentNode=rm,i}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}};class Cm{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Sm,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=xm(this,e,t),sm(e)?e===Sm||null==e||""===e?(this._$AH!==Sm&&this._$AR(),this._$AH=Sm):e!==this._$AH&&e!==km&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):dm(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Sm&&sm(this._$AH)?this._$AA.nextSibling.data=e:this.T(rm.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=Tm.createElement(Em(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new Am(i,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=_m.get(e.strings);return void 0===t&&_m.set(e.strings,t=new Tm(e)),t}k(e){lm(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const a of e)i===t.length?t.push(n=new Cm(this.O(om()),this.O(om()),this,this.options)):n=t[i],n._$AI(a),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class Lm{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,a){this.type=1,this._$AH=Sm,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Sm}_$AI(e,t=this,n,i){const a=this.strings;let r=!1;if(void 0===a)e=xm(this,e,t,0),r=!sm(e)||e!==this._$AH&&e!==km,r&&(this._$AH=e);else{const i=e;let o,s;for(e=a[0],o=0;o<a.length-1;o++)s=xm(this,i[n+o],t,o),s===km&&(s=this._$AH[o]),r||=!sm(s)||s!==this._$AH[o],s===Sm?e=Sm:e!==Sm&&(e+=(s??"")+a[o+1]),this._$AH[o]=s}r&&!i&&this.j(e)}j(e){e===Sm?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Im extends Lm{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Sm?void 0:e}}class Dm extends Lm{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Sm)}}class Rm extends Lm{constructor(e,t,n,i,a){super(e,t,n,i,a),this.type=5}_$AI(e,t=this){if((e=xm(this,e,t,0)??Sm)===km)return;const n=this._$AH,i=e===Sm&&n!==Sm||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,a=e!==Sm&&(n===Sm||i);i&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Nm{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){xm(this,e)}}const Wm={M:tm,P:nm,A:im,C:1,L:Pm,R:Am,D:dm,V:xm,I:Cm,H:Lm,N:Dm,U:Rm,B:Im,F:Nm},Fm=Qh.litHtmlPolyfillSupport;Fm?.(Tm,Cm),(Qh.litHtmlVersions??=[]).push("3.3.1");const Om=globalThis;let $m=class extends Jh{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const i=n?.renderBefore??t;let a=i._$litPart$;if(void 0===a){const e=n?.renderBefore??null;i._$litPart$=a=new Cm(t.insertBefore(om(),e),e,void 0,n??{})}return a._$AI(e),a})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return km}};$m._$litElement$=!0,$m.finalized=!0,Om.litElementHydrateSupport?.({LitElement:$m});const jm=Om.litElementPolyfillSupport;jm?.({LitElement:$m}),(Om.litElementVersions??=[]).push("4.2.1");const zm=Nh`
2
2
  /* ——— keyframes ——— */
3
3
  @keyframes nami-slide-up {
4
4
  from { transform: translateY(100%); }
@@ -20,6 +20,13 @@
20
20
  to { opacity: 0; }
21
21
  }
22
22
 
23
+ /* Suppress entrance animation (e.g., returning from fullscreen to sheet).
24
+ Uses :host class so it persists across Lit re-renders. */
25
+ :host(.nami-no-entrance) .nami-half-sheet-container,
26
+ :host(.nami-no-entrance) .nami-half-sheet-backdrop {
27
+ animation: none !important;
28
+ }
29
+
23
30
  /* Accessibility: honor reduced motion */
24
31
  @media (prefers-reduced-motion: reduce) {
25
32
  .nami-half-sheet-container,
@@ -35,11 +42,12 @@
35
42
  inset: 0;
36
43
  background-color: rgba(0, 0, 0, 0.4);
37
44
  z-index: 9998;
38
- animation: nami-fade-in 0.3s ease-out forwards;
45
+ animation: nami-fade-in 0.2s ease-out forwards;
46
+ cursor: pointer;
39
47
  }
40
48
 
41
49
  .nami-half-sheet-backdrop.nami-dismissing {
42
- animation: nami-fade-out 0.3s ease-in forwards;
50
+ animation: nami-fade-out 0.2s ease-in forwards;
43
51
  }
44
52
 
45
53
  /* ——— sheet container ——— */
@@ -53,17 +61,26 @@
53
61
  border-top-right-radius: 16px;
54
62
  overflow: hidden;
55
63
  z-index: 9999;
56
- animation: nami-slide-up 0.3s ease-out forwards;
64
+ animation: nami-slide-up 0.2s ease-out forwards;
57
65
  padding-bottom: env(safe-area-inset-bottom, 0px);
66
+ transition: max-height 0.25s ease-out, border-radius 0.25s ease-out;
58
67
  }
59
68
 
60
69
  .nami-half-sheet-container.nami-dismissing {
61
- animation: nami-slide-down 0.3s ease-in forwards;
70
+ animation: nami-slide-down 0.2s ease-in forwards;
71
+ }
72
+
73
+ /* ——— sheet (near-full-height) variant ——— */
74
+ .nami-half-sheet-container.nami-sheet-full {
75
+ max-height: 90vh;
76
+ }
77
+
78
+ .nami-half-sheet-container.nami-sheet-full > .nami-half-sheet-content {
79
+ max-height: 90vh;
62
80
  }
63
81
 
64
82
  /* Grow transition: half-sheet → fullscreen */
65
83
  .nami-half-sheet-container.nami-expanding {
66
- transition: max-height 0.3s ease-out, border-radius 0.3s ease-out;
67
84
  max-height: 100vh;
68
85
  border-top-left-radius: 0;
69
86
  border-top-right-radius: 0;
@@ -74,30 +91,42 @@
74
91
  max-height: 60vh;
75
92
  overflow-y: auto;
76
93
  -webkit-overflow-scrolling: touch;
94
+ transition: max-height 0.25s ease-out;
77
95
  }
78
96
 
79
97
  .nami-half-sheet-content .nami-flow-container {
98
+ display: grid;
99
+ grid-template-columns: 1fr;
100
+ grid-template-rows: 1fr;
101
+ height: auto;
80
102
  min-height: auto;
103
+ overflow: hidden;
81
104
  padding-top: 0;
82
105
  padding-bottom: 0;
106
+ padding-left: 0;
107
+ padding-right: 0;
83
108
  }
84
109
 
85
110
  .nami-half-sheet-content .nami-screen {
111
+ grid-row: 1 / -1;
112
+ grid-column: 1 / -1;
86
113
  position: relative;
87
114
  height: auto;
88
115
  padding-top: 0;
89
116
  padding-bottom: 0;
117
+ padding-left: 0;
118
+ padding-right: 0;
90
119
  }
91
- `,Hm=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)},Bm={attribute:!0,type:String,converter:Kh,reflect:!1,hasChanged:Yh},Um=(e=Bm,t,n)=>{const{kind:i,metadata:a}=n;let r=globalThis.litPropertyMetadata.get(a);if(void 0===r&&globalThis.litPropertyMetadata.set(a,r=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),r.set(n.name,e),"accessor"===i){const{name:i}=n;return{set(n){const a=t.get.call(this);t.set.call(this,n),this.requestUpdate(i,a,e)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=n;return function(n){const a=this[i];t.call(this,n),this.requestUpdate(i,a,e)}}throw Error("Unsupported decorator location: "+i)};function Gm(e){return(t,n)=>"object"==typeof n?Um(e,t,n):((e,t,n)=>{const i=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),i?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function Vm(e){return Gm({...e,state:!0,attribute:!1})}function Xm(e){return!e||"object"==typeof e&&0==Object.keys(e).length}const Km="entry",Ym="screen",qm="branch",Jm="exit",Qm="unknown";var Zm;!function(e){e.NAVIGATE="flowNav",e.BACK="flowPrev",e.NEXT="flowNext",e.FINISHED="flowDone",e.DISMISS="flowDismiss",e.EXIT="flowExit",e.HANDOFF="flowHandoff",e.TRACK="trackEvent",e.LOG="logEvent",e.SET_VIDEO="setVideo",e.FLOW_EVENT="flowEvent",e.BLOCK_BACK="blockBackToStep",e.FLOW_ENABLED="flowInteractionEnabled",e.FLOW_DISABLED="flowInteractionDisabled",e.SET_TAGS="setTags",e.PAUSE="flowPause",e.RESUME="flowResume"}(Zm||(Zm={}));const ef="__handoff_sequence__",tf="__buy_sku__",nf="__default__",af="__appear__",rf="__disappear__",of="__login_success__",sf="__login_failure__",lf="__logout_success__",df="__logout_failure__",uf="__purchase_success__",cf="__remoteback__",hf="__tag_update__",mf="and",ff="or",pf="i_contains",gf="equals",vf="i_equals",yf="not_equals",bf="not_i_equals",wf="not_contains",kf="set",Sf="notSet";class _f{constructor(){this.resolvers=new Map,this.namespaceResolvers=new Map}static get shared(){return _f.instance||(_f.instance=new _f),_f.instance}registerNamespaceResolver(e,t){this.namespaceResolvers.set(e,t)}resetResolvers(){this.resolvers.clear()}evaluate(e){const t=e.filter??[];if(0===t.length)return!0;const n=t.map((e=>this.evaluateFilter(e)));switch(e.operator){case mf:return n.every((e=>e));case ff:return n.some((e=>e));default:return n.every((e=>e))}}evaluateOrdered(e){if(!e)return!0;const t=e.filter??[];if(0===t.length)return!0;switch(e.operator){case mf:for(const e of t)if(!this.evaluateFilter(e))return!1;return!0;case ff:for(const e of t)if(this.evaluateFilter(e))return!0;return!1;default:for(const e of t)if(!this.evaluateFilter(e))return!1;return!0}}evaluateFilter(e){const t=this.resolve(e.identifier);if(Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolve(${e.identifier}) → ${JSON.stringify(t)} (type: ${typeof t})`),e.operator===kf)return null!=t;if(e.operator===Sf)return null==t;if(null==t){Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] ${e.identifier} resolved to null — registeredNamespaces: [${[...this.namespaceResolvers.keys()].join(", ")}]`);return!![yf,bf,wf].includes(e.operator)}switch(e.operator){case pf:if(Array.isArray(t)){return e.values.some((e=>t.some((t=>0===t.localeCompare(e,void 0,{sensitivity:"accent"})))))}return this.log("Resolved value is not an array of strings for i_contains."),!1;case gf:return e.values.some((e=>{if("string"==typeof t)return t===e;if("boolean"==typeof t){const n="true"===e.toLowerCase();return t===n}return this.log("Unsupported type for equals comparison: "+typeof t),!1}));case vf:return e.values.some((e=>{if("string"==typeof t){return 0===t.localeCompare(e,void 0,{sensitivity:"accent"})}if("boolean"==typeof t){const n="true"===e.toLowerCase();return t===n}return this.log("Unsupported type for i_equals comparison: "+typeof t),!1}));case yf:return e.values.every((e=>"string"!=typeof t||t!==e));case bf:return e.values.every((e=>"string"!=typeof t||0!==t.localeCompare(e,void 0,{sensitivity:"accent"})));case wf:return e.values.every((e=>"string"!=typeof t||!t.includes(e)));default:return this.log(`Unsupported operator: ${e.operator}`),!1}}resolve(e){const t=this.resolveRaw(e);if(void 0!==t)return Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolve(${e}) — exact hit: ${JSON.stringify(t)}`),t;const n=e.lastIndexOf(".");if(-1===n);else{const t=e.slice(0,n),i=e.slice(n+1),a=this.resolveRaw(t);if(void 0!==a){const n=this.extractProperty(i,a);return Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolve(${e}) — fallback: base=${t} → ${typeof a}, extract(.${i}) → ${JSON.stringify(n)}`),n}this.log(`Could not resolve base identifier: ${t}`)}}resolveRaw(e){const t=[...this.namespaceResolvers.keys()].sort(((e,t)=>t.length-e.length));for(const n of t)if(e.startsWith(n)){const t=this.namespaceResolvers.get(n);if(t){const i=t(e);return Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolveRaw(${e}) — ns=${n} → ${JSON.stringify(i)}`),i}}}extractProperty(e,t){switch(e){case"last":if(Array.isArray(t))return t[t.length-1];break;case"first":if(Array.isArray(t))return t[0];break;case"count":if(Array.isArray(t))return t.length;if(t&&"object"==typeof t)return Object.keys(t).length;break;default:return}this.log(`Could not extract .${e} from type ${typeof t}`)}log(e){Ze.debug(`[NamiConditionEvaluator] ${e}`)}}class Mf{constructor(){}register(){_f.shared.registerNamespaceResolver(this.namespace,(e=>{const t=e.replace(new RegExp(`^${this.namespace}\\.`),"");return this.resolveValue(t)}))}resolveKeyPath(e,t){const n=e.replace(/\[(\w+)\]/g,".$1").split(".").filter(Boolean);let i=t;for(const e of n){if(null==i||"object"!=typeof i)return;i=i[e]}return i}}class Ef extends Mf{constructor(e){super(),this.namespace="LaunchContext",this.context=e,this.register()}resolveValue(e){if(e.startsWith("customAttributes.")){const t=e.substring(17);return this.resolveKeyPath(t,this.context.customAttributes)}if(e.startsWith("customObject.")){const t=e.substring(13);return this.resolveKeyPath(t,this.context.customObject)}return this.resolveKeyPath(e,{customAttributes:this.context.customAttributes,customObject:this.context.customObject,productGroups:this.context.productGroups})}}class Pf extends Mf{constructor(){super(),this.namespace="Device";const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[1]||"",t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Ml();this.context={osName:n.os_name,osVersion:n.os_version,appVersion:n.extended_platform_version,sdkVersion:n.sdk_version,deviceModel:n.device_model,screenWidth:window.innerWidth,screenHeight:window.innerHeight,formFactor:n.form_factor,tvQuality:this.tvQuality(n.form_factor??"desktop"),tvResolution:this.tvResolution(n.form_factor??"desktop"),screenSize:this.screenSizeTier(n.form_factor??"desktop"),language:n.language,country:e,timezone:t},this.register()}screenSizeTier(e){const t=window.screen.width,n=window.screen.height,i=window.devicePixelRatio||1,a=Math.round(t*i),r=Math.round(n*i),o=Math.max(a,r);switch(e){case"phone":return o<1136?"tiny":o<1334?"small":o<1920?"medium":o<2560?"large":"huge";case"tablet":return o<2048?"medium":o<2732?"large":"huge";case"television":return o<1920?"medium":o<3840?"large":"huge";case"desktop":return o<1440?"small":o<2560?"medium":o<3840?"large":"huge";default:return"medium"}}tvQuality(e){if("television"!==e)return"";const t=window.screen.width,n=window.screen.height,i=window.devicePixelRatio||1,a=Math.round(t*i),r=Math.round(n*i),o=Math.max(a,r),s=Math.min(a,r);return o>=3840||s>=2160?"4K":o>=1920||s>=1080?"1080p":"720p"}tvResolution(e){if("television"!==e)return"";const t=window.screen.width,n=window.screen.height,i=window.devicePixelRatio||1,a=Math.round(t*i),r=Math.round(n*i),o=Math.max(a,r),s=Math.min(a,r);return s<720&&o<1280?"SD":s>=720&&s<1080&&o>=1280&&o<1920?"720p":s>=1080&&s<1440&&o>=1920&&o<2560?"1080p":s>=1440&&s<2160&&o>=2560&&o<3840?"1440p":s>=2160&&s<3e3&&o>=3840&&o<5e3?"4K":s>=3e3&&o>=5e3?"8K":"Unknown"}resolveValue(e){return this.resolveKeyPath(e,this.context)}}const Tf=[/(^|_)api(_|$)?key/i,/^key$/i,/^token$/i,/id[_-]?token/i,/access[_-]?token/i,/^auth/i,/password/i,/secret/i,/signature/i,/hmac/i,/^jwt$/i,/^code$/i,/redirect[_-]?uri/i,/return[_-]?url/i,/^state$/i,/^session$/i,/^sid$/i,/^sso$/i,/assertion/i];class xf{constructor(){this.params={},"undefined"!=typeof window&&this.setSearchParams()}static get instance(){return xf._instance||(xf._instance=new xf),xf._instance}static refresh(){"undefined"!=typeof window&&this.instance.setSearchParams()}setSearchParams(){this.params=this.extractSafeParams()}safeValue(e){if(!e)return null;try{const t=decodeURIComponent(e).trim();return!t||/^null|undefined$/i.test(t)||((e=>e.includes("://")||/^\/.*\?/.test(e))(t)||(e=>/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/.test(e))(t)||(e=>/^[A-Za-z0-9_-]{40,}$/.test(e)||/^[A-Fa-f0-9]{40,}$/.test(e)||/^ya29\./.test(e)||/^sk_/.test(e)||/^ghp_/.test(e))(t))?null:((e,t=128)=>e.length>t?e.slice(0,t):e)(t)}catch{return null}}extractSafeParams(){const e=window.location,t={},n=new Set;try{const i=new URLSearchParams(e.search),a=(e,i)=>{const a=(e=>e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]/g,"_").toLowerCase())(e);if(n.size>=10)return;if((e=>Tf.some((t=>t.test(e))))(a))return;const r=this.safeValue(i);r&&(t[a]=r,n.add(a))};for(const[e,t]of i.entries())a(e,t)}catch{}return t}}xf._instance=null;const Af=()=>xf.instance.params,Cf=/\{\{\s*([^}]+?)\s*\}\}/g;class Lf{constructor(e){this.flowManager=e,this.urlParams=Af()}resolve(e){const t=this.flowManager.currentFlow,n=t?.component;if(e.startsWith("launchContext.")){const t=this.flowManager.currentFlow?.context;if(t){const n=e.substring(14),i=new Ef(t).resolveValue(n);return i?.toString()}}else switch(e){case"campaignId":return n?.campaign?.rule;case"campaignName":return n?.campaign?.name;case"campaignLabel":case"campaignPlacement":return n?.campaign?.value??void 0;case"campaignSegment":case"campaignSegmentId":return n?.campaign?.segment;case"campaignExternalSegment":case"campaignExternalSegmentId":return n?.campaign?.external_segment??void 0;case"pageName":return n?.paywall?.name;case"pageId":return n?.paywall?.id;case"flowName":return t?.name;case"flowId":return t?.id;case"objectId":return n?.campaign?.flow?.object_id;case"stepName":return t?.currentFlowStep?.name;case"buttonText":return t?.currentButton?.firstTextValue();case"slideNumber":{const e=n?.getSelectedSlideIndexForCurrentCarousel();return null!=e?`${e+1}`:void 0}default:return}}interpolateLiquidVariables(e){return e.replace(Cf,((e,t)=>{const n=this.resolve(t)??this.urlParams[t];return null!=n?n:""}))}interpolateDeep(e){return"string"==typeof e?this.interpolateLiquidVariables(e):Array.isArray(e)?e.map((e=>this.interpolateDeep(e))):e&&"object"==typeof e?Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:this.interpolateDeep(n)})),{}):e}}class If extends Mf{constructor(){super(),this.namespace="urlParams",this.context=Af(),this.register()}resolveValue(e){return Ze.debug("[URLParamsResolver]","Resolving keyPath",e),this.resolveKeyPath(e,this.context)}}class Df extends Mf{getContextProvider(){const e=dh.providers;if(0===e.length)return;const t=e.find((e=>e.flow));return t||e[e.length-1]}constructor(){super(),this.namespace="state",this.register()}resolveValue(e){const t=this.getContextProvider();if(t){if(e.startsWith("formStates.")){const n=e.substring(11);return t.getCurrentFormId(n)}return this.resolveKeyPath(e,t.state)}}}class Rf extends Mf{constructor(e){super(),this.namespace="Placement",this.campaign=e,this.register()}resolveValue(e){if("label"!==e)return;if(this.campaign&&void 0!==this.campaign.value&&null!==this.campaign.value)return this.campaign.value;const t=dh.providers;if(0===t.length)return;const n=t.find((e=>e.flow));return n?n.getCurrentPlacementLabel():t[t.length-1]?.getCurrentPlacementLabel()}}class Nf{constructor(){this.load()}setExternalId(e){return this.externalId=e,this}getExternalId(){return this.externalId}isLoggedIn(){return!!this.externalId}save(){return this.externalId?ca.setNamiProfile({externalId:this.externalId}):ca.removeNamiProfile(),this}load(){const e=ca.getNamiProfile();e&&(this.externalId=e.externalId),dh.setIsLoggedIn(!!this.externalId)}async login(e){const t=await Zs.instance.login(e);t.external_id&&dh.setIsLoggedIn(!0),this.setExternalId(t.external_id).save()}async logout(){await Zs.instance.logout(),dh.setIsLoggedIn(!1),this.setExternalId(void 0).save()}}var Wf;Nf.instance=new Nf,function(e){e.LOGIN="login",e.LOGOUT="logout",e.ADVERTISING_ID_SET="advertising_id_set",e.ADVERTISING_ID_CLEARED="advertising_id_cleared",e.VENDOR_ID_SET="vendor_id_set",e.VENDOR_ID_CLEARED="vendor_id_cleared",e.CUSTOMER_DATA_PLATFORM_ID_SET="customer_data_platform_id_set",e.CUSTOMER_DATA_PLATFORM_ID_CLEARED="customer_data_platform_id_cleared",e.ANONYMOUS_MODE_ON="anonymous_mode_on",e.ANONYMOUS_MODE_OFF="anonymous_mode_off",e.NAMI_DEVICE_ID_SET="nami_device_id_set",e.NAMI_DEVICE_ID_CLEARED="nami_device_id_cleared"}(Wf||(Wf={}));class Ff{constructor(){this.emitter=nd.getInstance(),_f.shared.registerNamespaceResolver("UserTags",(e=>{const t=e.replace("UserTags.",""),n=Ff.getCustomerAttribute(t);if(null!=n){const e=n.toLowerCase();return"true"===e||"false"===e?"true"===e:isNaN(Number(n))?n:parseInt(n,10)}return null}))}static isLoggedIn(){return Nf.instance.isLoggedIn()}static loggedInId(){return this.instance.isSDKInitialized||Ze.debug(F),Nf.instance.getExternalId()}static async login(e){if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(Wf.LOGIN,!1,e),e}if(this.inAnonymousMode()){const e=new _a;throw this.invokeStateHandler(Wf.LOGIN,!1,e),e}try{if(await Nf.instance.login(e),await fh.instance.fetchActiveEntitlements(),this.invokeStateHandler(Wf.LOGIN,!0),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&(Ph.instance.maxLogging&&Ze.debug(`[NamiCustomerManager] login success — triggering __login_success__ on step ${t.id}`),e.executeLifecycle(t,of))}}catch(e){if(this.invokeStateHandler(Wf.LOGIN,!1,e),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&(Ph.instance.maxLogging&&Ze.debug(`[NamiCustomerManager] login failure — triggering __login_failure__ on step ${t.id}`),e.executeLifecycle(t,sf))}throw e}}static async logout(){if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(Wf.LOGOUT,!1,e),e}if(this.inAnonymousMode()){const e=new _a;throw this.invokeStateHandler(Wf.LOGOUT,!1,e),e}try{if(await Nf.instance.logout(),await fh.instance.fetchActiveEntitlements(),this.invokeStateHandler(Wf.LOGOUT,!0),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,lf)}}catch(e){if(this.invokeStateHandler(Wf.LOGOUT,!1,e),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,df)}throw e}}static async setCustomerDataPlatformId(e){await this.updateCustomerDataPlatformId(e)}static async clearCustomerDataPlatformId(){await this.updateCustomerDataPlatformId(null)}static registerAccountStateHandler(e){return this.instance.emitter.on("accountStateChange",e),()=>{this.instance.emitter.off("accountStateChange",e)}}static async setAnonymousMode(e){const t=e?Wf.ANONYMOUS_MODE_ON:Wf.ANONYMOUS_MODE_OFF;if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(t,!1,e),e}if(this.anonymousModeCapability())if(this.inAnonymousMode()!==e)if(e)ca.setAnonymousMode(e),ca.resetDevice(),this.refetchConfig(),this.invokeStateHandler(Wf.ANONYMOUS_MODE_ON,!0);else{ca.clearAnonymousMode(),dd&&dd.setInMemoryAnonymousMode(!1);const e=ca.getNamiConfig()?.namiCommands;await rd.instance.createOrUpdateDevice(Ml(e)),ca.clearAnonymousUUID(),this.refetchConfig(),this.invokeStateHandler(Wf.ANONYMOUS_MODE_OFF,!0)}else{const n=e?new ka:new Sa;this.invokeStateHandler(t,!1,n)}else Ze.warn("Anonymous mode feature is not enabled for your Nami account. Contact support@nami.ml for details.")}static inAnonymousMode(){return!!this.instance.isSDKInitialized&&ud()}static setCustomerAttribute(e,t){if(!this.instance.isSDKInitialized)throw new pa;if(ca.setCustomerAttribute(e,t),Xs(A.PAYWALL_PERSONALIZATION)?(dh.setCustomerAttribute({[e]:t}),Ze.debug(`This customer attribute you set is now available for paywall personalization using the smart text variable: ${e}`)):Ze.warn(`The customer attribute ${e} is not available for using on a paywall, because your account's plan does not include paywall personalization. Contact support@nami.ml for details.`),Wp.instance.flowOpen){const e=Wp.instance.currentFlow;if(e){const t=e.currentFlowStep;t&&e.executeLifecycle(t,hf)}}}static getCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new pa;const t=ca.getCustomerAttribute(e);return null!=t?Xs(A.PAYWALL_PERSONALIZATION)?Ze.debug(`Found customer attribute. ${e} is available for paywall personalization on this device.`):Ze.warn(`Found customer attribute. ${e} is not available for use on a paywall because paywall personalization is not included in your account's plan. Contact support@nami.ml for details.`):Ze.warn(`No ${e} customer attribute found.`),t}static getAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new pa;return ca.getAllCustomerAttributes()}static clearCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new pa;ca.clearCustomerAttribute(e)?(dh.removeCustomerAttribute(e),Ze.warn(`This customer attribute has been cleared. ${e} is no longer available for paywall personalization on this device. A default value will be used if set in the Nami Control Center.`)):Ze.warn(`No value to clear for attribute ${e}.`)}static clearAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new pa;ca.getAllCustomerAttributesKeys().forEach((e=>{dh.removeCustomerAttribute(e)})),ca.clearAllCustomerAttributes(),Ze.warn("All customer attribute have been cleared. customer's smart text will no longer be personalized for this device. A default value will be used if set in the Nami Control Center.")}static journeyState(){if(!this.instance.isSDKInitialized)throw new pa;return ca.getCustomerJourneyState()}static deviceId(){return this.instance.isSDKInitialized?ca.getDevice()?.id??G:G}static registerJourneyStateHandler(e){if(Ys("NamiCustomerManager.registerJourneyStateHandler"))return this.instance.emitter.addListener(Ge,e),()=>{this.instance.emitter.removeListener(Ge,e)}}static invokeStateHandler(e,t,n){this.instance.emitter.emit("accountStateChange",e,t,n)}get isSDKInitialized(){return Ph.instance.isInitialized}static async updateCustomerDataPlatformId(e){if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}if(this.inAnonymousMode()){Ze.info("Unable to set CDP ID in anonymous mode",{deviceId:ca.getDevice()?.id,anonymousMode:!0});const e=new Ma;this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}else try{await rd.instance.updateDeviceField("customer_data_platform_id",e),this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!0)}catch(e){this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}}static anonymousModeCapability(){if(!this.instance.isSDKInitialized)return!1;const e=Xs(A.ANONYMOUS_MODE_CAPABILITY),t=Xs(A.THIRD_PARTY_TRANSACTIONS);return e&&t}static async refetchConfig(){this.instance.isSDKInitialized&&await Promise.all([od.instance.fetchProducts(),sd.instance.fetchPaywalls().then((e=>id.instance.fetchCampaignRules(e)))])}}Ff.instance=new Ff;const{NAMI_CLOSE_PAYWALL:Of="namiClosePaywall",NAMI_RESTORE_PURCHASES:$f="namiRestorePurchases",NAMI_SIGN_IN:jf="namiSignIn",NAMI_BUY_SKU:zf="namiBuySKU",SET_STATE:Hf="setState",NAMI_SELECT_SKU:Bf="namiSelectSKU",NAMI_PURCHASE_SELECTED_SKU:Uf="namiPurchaseSelectedSKU",NAMI_DEEP_LINK:Gf="namiDeeplink",NAMI_NAVIGATE_TO_SCREEN:Vf="namiNavigateToScreen",NAMI_RELOAD_PRODUCTS:Xf="namiReloadProducts",UNSUPPORTED:Kf="",NAMI_PURCHASE_SUCCESS:Yf="namiPurchaseSuccess",NAMI_PURCHASE_CANCELLED:qf="namiPurchaseCancelled",NAMI_PURCHASE_FAILED:Jf="namiPurchaseFailed",NAMI_PURCHASE_PENDING:Qf="namiPurchasePending",NAMI_PURCHASE_UNKNOWN:Zf="namiPurchaseUnknown",NAMI_SHOW_PAYWALL:ep="namiShowPaywall",NAMI_PAGE_CHANGE:tp="namiPageChange",NAMI_TOGGLE_CHANGE:np="namiToggleChange",NAMI_SLIDE_CHANGE:ip="namiSlideChange",NAMI_PLAY_VIDEO:ap="namiPlayVideo",NAMI_PAUSE_VIDEO:rp="namiPauseVideo",NAMI_MUTE_VIDEO:op="namiMuteVideo",NAMI_UNMUTE_VIDEO:sp="namiUnmuteVideo"}={};var lp,dp,up;function cp(e,t){return Array.isArray(e)?e.reduce(((e,n)=>{const i=cp(n,t);return Array.isArray(i)?[...e,...i]:[...e,i]}),[]):null==e?e:"object"==typeof e?Object.entries(e).reduce(((e,[n,i])=>{const a="newRow"===n?i:cp(i,t);return{...e,[n]:a}}),{}):"string"==typeof e?vp(e,t):e}function hp(e,t,n,i={}){const a=n.productBaseComponents||n.components||[],r=n.productFeaturedComponents||a;return t.map((t=>{const n=t.featured?r:a,o=t.entitlements.map((e=>e.entitlement_ref_id)),s=ic(e.productDetails,t.sku_ref_id),l={freeTrialEligible:1==Dd("freeTrialEligible",s),introEligible:1==Dd("introEligible",s),promoEligible:1==Dd("promoEligible",s),invalid:Dd("invalid",s),unavailable:Dd("unavailable",s)},d={...t,...t.variables,...l,id:t.id,entitlements:o};!function(e,t){const n=e=>{for(const i of e)i.sku=mh(t),i.components&&n(i.components),i.collapseHeader&&i.collapseHeader.components&&n(i.collapseHeader.components)};n(e)}(n,t);const u={sku:d,media:gp(i,{convertToUrl:!0})};return[t.featured??!1,cp(n,cp(u,u))]}),[])}function mp(e,t){return t.assertions?t.assertions.every(pp.bind(null,e)):!!t.orAssertions&&(!t.orAssertions.length||t.orAssertions.some(pp.bind(null,e)))}function fp(e,t,n,i=null){const{manager:a,previousStepAvailable:r,nextStepAvailable:o}=e?.flow??{},s=e.state,l=Af(),d={isLaunched:!!a?.flowOpen,previousStepAvailable:!!r,nextStepAvailable:!!o};let u={};return i&&(u={block:i}),u={...u,state:s,urlParams:l,flow:d,launch:s.launch,sku:s.sku,customer:s.customer},"string"==typeof t&&t.includes(Ye)&&(t=vp(t,u)),t}function pp(e,{value:t,expected:n,operator:i},a){return t=fp(e,t,0,a),n=fp(e,n,0,a),"equals"===i?t===n:"notEquals"===i?t!==n:"contains"===i?(Array.isArray(t)||"string"==typeof t||t instanceof String||(t=t.toString()),"collapse"==n&&(n+="_"+e.getCurrentCollapsibleSku()?.skuId),t.includes(n)):"notContains"===i?(Array.isArray(t)||"string"==typeof t||t instanceof String||(t=t.toString()),!t.includes(n)):"set"===i?"boolean"==typeof n?!!t&&!t.toString().match(qe)===n:!!t&&!t.toString().match(qe):"notSet"===i?!t||t.toString().match(qe):"gt"===i?t>n:"gte"===i?t>=n:"lt"===i?t<n:"lte"===i&&t<=n}function gp(e,{convertToUrl:t}={convertToUrl:!1}){return Object.entries(e).reduce(((e,[n,{content:i}])=>(t&&"string"!=typeof i&&i&&(i=URL.createObjectURL(i)),{...e,[n]:i})),{})}function vp(e,t){let n=e;if("string"!=typeof e)return n;const i=new RegExp(Xe.source,Xe.flags),a=[];let r;for(;null!==(r=i.exec(e))&&(a.push(r),i.global);)r.index===i.lastIndex&&i.lastIndex++;for(const[i,r]of a){const a=vp(r,t);if(i===e)return o(i,a);a!==r&&(n=n.replace(r,a)),n=n.replace(Xe,o)}return n;function o(e,n){const i=String(n).split("."),a=i[0];if(!a)return e;const r=yp(t,a);if(void 0===r)return e;if("object"==typeof r&&null!==r&&0===Object.keys(r).length)return"";const o=yp(t,...i);return void 0===o?"":"string"!=typeof o?o:vp(o,t)}}function yp(e,...t){let n=e;for(const e of t){if(null==n)return;n=Array.isArray(n)?n[+e]:n[e]}return n}e.NamiPaywallAction=void 0,(lp=e.NamiPaywallAction||(e.NamiPaywallAction={})).BUY_SKU="BUY_SKU",lp.SELECT_SKU="SELECT_SKU",lp.RESTORE_PURCHASES="RESTORE_PURCHASES",lp.SIGN_IN="SIGN_IN",lp.CLOSE_PAYWALL="CLOSE_PAYWALL",lp.SHOW_PAYWALL="SHOW_PAYWALL",lp.PURCHASE_SELECTED_SKU="PURCHASE_SELECTED_SKU",lp.PURCHASE_SUCCESS="PURCHASE_SUCCESS",lp.PURCHASE_FAILED="PURCHASE_FAILED",lp.PURCHASE_CANCELLED="PURCHASE_CANCELLED",lp.PURCHASE_PENDING="PURCHASE_PENDING",lp.PURCHASE_UNKNOWN="PURCHASE_UNKNOWN",lp.PURCHASE_DEFERRED="PURCHASE_DEFERRED",lp.DEEPLINK="DEEPLINK",lp.TOGGLE_CHANGE="TOGGLE_CHANGE",lp.PAGE_CHANGE="PAGE_CHANGE",lp.SLIDE_CHANGE="SLIDE_CHANGE",lp.COLLAPSIBLE_DRAWER_OPEN="COLLAPSIBLE_DRAWER_OPEN",lp.COLLAPSIBLE_DRAWER_CLOSE="COLLAPSIBLE_DRAWER_CLOSE",lp.VIDEO_STARTED="VIDEO_STARTED",lp.VIDEO_PAUSED="VIDEO_PAUSED",lp.VIDEO_RESUMED="VIDEO_RESUMED",lp.VIDEO_ENDED="VIDEO_ENDED",lp.VIDEO_CHANGED="VIDEO_CHANGED",lp.VIDEO_MUTED="VIDEO_MUTED",lp.VIDEO_UNMUTED="VIDEO_UNMUTED",lp.COUNTDOWN_TIMER_COMPLETED="COUNTDOWN_TIMER_COMPLETED",lp.UNKNOWN="UNKNOWN",function(e){e.DEFAULT="default",e.LABEL="label",e.URL="url"}(dp||(dp={})),function(e){e.DEEPLINK="deeplink",e.IN_APP="in_app"}(up||(up={}));const bp=e=>{const t=e.state.timeSpentOnPaywall;if(t)return Date.now()-t},wp=e=>{if(!e)return null;if(e.includes("#"))return e;const t=e.match(/[\d.]+/g);if(!t||t.length<3)return null;const[n,i,a,r]=t.map(Number),o=e=>Math.round(e).toString(16).padStart(2,"0"),s=void 0!==r&&r<1?o(255*r):"";return`#${o(n)}${o(i)}${o(a)}${s}`},kp=(e,t)=>{if(!e||!t)return!0;const n=e?.includes("rgb")?wp(e):e,i=t?.includes("rgb")?wp(t):t;return n?.toLowerCase()===i?.toLowerCase()};class Sp{constructor(t,n,i="",a=""){this.playing=!0,this.toggling=!1,this.handleVideoEvents=t=>{this.video.onended=()=>{this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED)},this.video.onpause=()=>{this.toggling||this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_PAUSED)},this.video.onplay=()=>{this.toggling||this.handlePlayerAnalytics(t,this.video.currentTime>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.VIDEO_STARTED)},this.video.onvolumechange=()=>{this.toggling||(this.muted=!this.muted,this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED))}},this.removeVideoEvents=()=>{this.video&&(this.video.onended=null,this.video.onpause=null,this.video.onplay=null,this.video.onvolumechange=null,this.toggling=!1)},this.video=n??this.video,Sp.instance?.videoSrc&&n.src!=Sp.instance.videoSrc&&this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_CHANGED),this.videoSrc=n.src,this.video&&(this.muteByDefault=n.muted,this.loopVideo=n.loop,this.autoplayVideo=n.autoplay,this.muted=this.video.muted,this.videoComponentName=i,this.videoComponentId=a,this.playing=this.video.readyState>2?!(!(this.video.currentTime>0)||this.video.paused||this.video.ended):this.playing,this.handleVideoEvents(t))}togglePlayVideo(e){this.toggling=!0,this.playing?this.video.pause():this.video.play(),this.playing=!this.playing,this.handlePlayerAnalytics(e)}toggleMuteVideo(t){this.toggling=!0,this.video.muted=!this.video.muted,this.muted=this.video.muted,this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED)}videoPlayingAction(){return this.video?.currentTime<=0?e.NamiPaywallAction.VIDEO_STARTED:this.video.paused?e.NamiPaywallAction.VIDEO_PAUSED:this.video.ended?e.NamiPaywallAction.VIDEO_ENDED:this.video?.currentTime>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.UNKNOWN}handlePlayerAnalytics(e,t){if(!this.video)return;const n={id:this.videoComponentId,name:this.videoComponentName,url:this.video.src,loopVideo:this.loopVideo,muteByDefault:this.muteByDefault,autoplayVideo:this.autoplayVideo,contentDuration:this.video.duration/1e3,contentTimecode:this.video.currentTime/1e3};nd.getInstance().emit(Be,{action:t??this.videoPlayingAction(),videoMetaData:n,timeSpentOnPaywall:bp(e)})}}Sp.instance=null;const _p=({onTap:t,sku:n,componentChange:i,contextProvider:a}={})=>{let r,o=e.NamiPaywallAction.UNKNOWN;switch(t?.function){case Of:o=e.NamiPaywallAction.CLOSE_PAYWALL,r=bp(a),Mp(),Sp.instance?.handlePlayerAnalytics(a,e.NamiPaywallAction.VIDEO_ENDED);break;case $f:o=e.NamiPaywallAction.RESTORE_PURCHASES,Ep();break;case jf:o=e.NamiPaywallAction.SIGN_IN,Pp();break;case Gf:Tp(t.parameters?.url);break;case zf:n&&(o=e.NamiPaywallAction.BUY_SKU,n=xp(a,t,n));break;case Vf:o=e.NamiPaywallAction.PAGE_CHANGE,i={name:t?.parameters?.screen},Ap(a,t?.parameters?.screen);break;case Hf:o=e.NamiPaywallAction.TOGGLE_CHANGE,i=Cp(a,t?.parameters?.formId,t?.parameters?.value);break;case Bf:n&&(o=e.NamiPaywallAction.SELECT_SKU,Lp(a,n));break;case Uf:n&&(o=e.NamiPaywallAction.PURCHASE_SELECTED_SKU,Ip(a,n));break;case Xf:break;case ap:case rp:Sp.instance?.togglePlayVideo(a);break;case op:case sp:Sp.instance?.toggleMuteVideo(a)}o!==e.NamiPaywallAction.UNKNOWN&&nd.getInstance().emit(Be,{...a.getPaywallActionEventData(),action:o,sku:n,timeSpentOnPaywall:r,componentChange:i,purchaseError:undefined,purchases:undefined})},Mp=()=>{ca.clearLaunchId(),Dp(e.NamiPaywallManagerEvents.Close)||"undefined"==typeof window||window.history.back()},Ep=()=>{const t=Xs(A.THIRD_PARTY_TRANSACTIONS);Dp(e.NamiPaywallManagerEvents.Restore)||t||Ze.warn("NamiPaywallManager.registerRestoreHandler is not registered, so restore option on the paywall will use default behavior.")},Pp=()=>{Dp(e.NamiPaywallManagerEvents.SignIn)},Tp=t=>{t?Dp(e.NamiPaywallManagerEvents.DeeplinkAction,t)||"undefined"!=typeof window&&window.open(t,"_blank"):Ze.debug("Paywall deep link action invoked, but no url present.")},xp=(t,n,i)=>{const a=n.parameters?.promo,r=i;if(a)Ze.debug(`promo id is not null ${i?.id}`),r.promoId=a.toString();else{Ze.debug(`promo id is null for ${i.id}, product details: ${JSON.stringify(i.productDetails)}`);const e=i.productDetails;if(pd(e?.product_type)){const t=function(e){return e.offers.find((e=>"promo"===e.offer_type&&0===e.price))}(e);if(t&&t.offer_ref_id)Ze.debug(`Found a free trial offer ${t.offer_ref_id}`),r.promoId=t.offer_ref_id.toString();else{const t=e.offers[0];t&&(Ze.debug(`Found an offer ${t.offer_ref_id}`),r.promoId=t.offer_ref_id?.toString())}}}return function(t,n){if(Xs(A.THIRD_PARTY_TRANSACTIONS)){if(ca.setPurchaseImpression(),nd.getInstance().listenerCount(e.NamiPaywallManagerEvents.BuySku)<=0)return void Ze.warn("In order for Nami to hand off the purchase so the transaction can be handled by, you must register a NamiBuySkuHandler callbackwith NamiPaywallManager.registerBuySkuHandler.");Ze.info(`Handing off purchase for processing by developer skuId=${n.skuId} promoId=${n.promoId}`),Dp(e.NamiPaywallManagerEvents.BuySku,n)}else{const i=function(e){if(!Ys("NamiPurchaseManager.buySKU"))return;const t=ca.getCachedProducts(),n=t?.find((t=>t.sku_ref_id==e));return{success:!!n,billingResponseCode:n?0:-999}}(n.skuId);if(i&&(Ze.info(`Purchase flow completed, success=${i.success}, code=${i.billingResponseCode}, message=${i.message}`),i.success)){nd.getInstance().emit(Be,{action:e.NamiPaywallAction.CLOSE_PAYWALL,sku:n,timeSpentOnPaywall:bp(t)}),Sp.instance?.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED);const i=t.getSelectedCampaign();i&&i.conversion_event_type==up.IN_APP&&i.conversion_event_url?(ca.clearLaunchId(),window.location.href=i.conversion_event_url):Mp()}}}(t,r),r},Ap=(e,t)=>{t&&(window.history.state?.prevUrl==t?window.history.back():e.setCurrentPage(t))},Cp=(e,t,n)=>{if(t)return e.setCurrentFormId(t,n),{formId:t,value:n};{const t=e.getCurrentGroupId(),n=e.getCurrentGroupName();return e.setCurrentGroupData(t,n),{id:t,name:n}}},Lp=(e,t)=>{const n=e.getCurrentGroupId(),i=e.selectedProducts();n&&t.id!=i[n]&&(i[n]=t.id,e.setSelectedProducts(i))},Ip=(e,t)=>{e.setPurchase(!0,t)};function Dp(e,...t){const n=nd.getInstance();return n.emit(e,...t),n.listenerCount(e)>0}class Rp{constructor(e={}){this.id=e.id??"",this.name=e.name??"",this.steps=e.steps??[],this.screens=e.screens??[],this.resumeFromBookmark=Boolean(e.resume_from_bookmark),this.transition=e.transition??"none"}get allScreensAvailable(){return this.screens.length>0&&ol(this.screens)}}class Np extends Rp{constructor(e,t,n,i){super(e.flow.object??{}),this.stepcrumbs=[],this.branchcrumbs=[],this.activeHandoffSequence=null,this.currentScreenState=null,this.isPaused=!1,this.timerStates={},this.campaign=e,this.component=t,this.context=i,this.manager=n,this.branchcrumbs=[],this.stepcrumbs=[],this.registerResolvers(i);const a=this.findStepByType(Km);a&&this.forward(a.id)}registerResolvers(e){e&&new Ef(e),new Pf,new If,new Df,new Rf(this.campaign),_f.shared.registerNamespaceResolver("Flow",(e=>{switch(e){case"Flow.stepcrumbs":return this.stepcrumbs.map((e=>e.id));case"Flow.branchcrumbs":return this.branchcrumbs;default:return}}))}get currentFlowStep(){return this.stepcrumbs.at(-1)}get nextStepAvailable(){return void 0!==this.nextFlowStep}get previousStepAvailable(){const e=!!this.previousFlowStep,t=!1!==this.previousFlowStep?.allow_back_to,n=this.stepcrumbs.slice(0,-1).some((e=>"screen"===e.type));return e&&t&&n}get previousFlowStep(){const e=this.stepcrumbs.length-2;return e>=0?this.stepcrumbs[e]:void 0}get nextFlowStep(){return this.nextStep(this.currentFlowStep)}getStep(e){return this.steps.find((t=>t.id===e))}findStepByType(e){return this.steps.find((t=>t.type===e))}isStepActive(e){return!e.branch_tags||!e.branch_tags.length||e.branch_tags.some((e=>this.branchcrumbs.includes(e)))}flowLog(e,...t){Ph.instance.maxLogging&&Ze.debug(`[NamiFlow] ${e}`,...t)}finished(){this.flowLog(`finished() — closing flow, isPaused=${this.isPaused}, step=${this.currentFlowStep?.id}`),this.manager.finishFlow(),Mp()}back(){this.previousStepAvailable?this.backToPreviousScreenStep():Ze.debug("No previous step available")}next(){const e=this.nextFlowStep;e&&this.forward(e.id)}backToPreviousScreenStep(){if(!1!==this.previousFlowStep?.allow_back_to){for(let e=this.stepcrumbs.length-2;e>=0;e--){const t=this.stepcrumbs[e];if(this.stepcrumbs.pop(),"branch"===t.type&&this.branchcrumbs.length>0&&this.branchcrumbs.pop(),"screen"===t.type&&t.screen){const e=rl(t.screen);return e&&this.component.flowNavigateToScreen(e,{transition:this.transition,direction:"backward"}),void(this.currentScreenState=dh.currentProvider?.state??null)}}Ze.warn("No previous screen step found to return to")}else Ze.warn(`Not allowed to go back to ${this.previousFlowStep.id}`)}forward(e){const t=this.getStep(e);if(t)if(this.isStepActive(t))switch(this.flowLog(`forward(${e}) — type=${t.type}, name=${t.name}, isPaused=${this.isPaused}`),t.type){case Km:case Jm:return this.stepcrumbs.push(t),void this.executeLifecycle(t,nf);case qm:return void this.handleBranchStep(t);case Ym:return void this.handleScreenStep(t);case Qm:return}else this.flowLog(`forward(${e}) — step not active (branch_tags=${JSON.stringify(t.branch_tags)}, branchcrumbs=${JSON.stringify(this.branchcrumbs)})`);else Ze.error(`No step found with id: ${e}`)}pause(){this.isPaused?Ze.info("Flow is already paused"):(this.isPaused=!0,this.pausedStepID=this.currentFlowStep?.id,this.flowLog(`pause() — pausedStepID=${this.pausedStepID}`),Ze.info("Flow paused"))}resumeFromPause(){if(!this.isPaused)return void Ze.info("Flow is not paused");if(this.isPaused=!1,!this.pausedStepID)return void Ze.warn("No step to resume from");const e=this.pausedStepID;this.pausedStepID=void 0,this.flowLog(`resumeFromPause() — resuming from step ${e}`),Ze.info(`Flow resumed from step ${e}`),this.forward(e)}executeLifecycle(e,t,n){const i=e.actions[t];i?(this.flowLog(`executeLifecycle(${t}) — step=${e.id}, isPaused=${this.isPaused}, ${i.length} lifecycle(s)`),this.executeFullLifecycles(i,n)):this.flowLog(`executeLifecycle(${t}) — no actions on step ${e.id}`)}lifecycles(e){if(!this.currentFlowStep)return;const t=this.currentFlowStep.actions[e];if(t)return t;Ze.info(`No actions found for button ${e} on step ${this.currentFlowStep.id}`)}triggerActions(e,t,n){const i=this.lifecycles(e);i&&(this.flowLog(`triggerActions(${e}) — step=${this.currentFlowStep?.id}, isPaused=${this.isPaused}`),this.currentButton=t,this.executeFullLifecycles(i,n))}executeFullLifecycles(e,t){for(const n of e){const e=["before","action","after"];[n.before,n.action,n.after].forEach(((n,i)=>n?.forEach((n=>{const a=this.shouldRun(n);this.flowLog(` ${e[i]}: ${n.function}${n.id?` (${n.id})`:""} — shouldRun=${a}`),a&&this.performAction(n,t)}))))}}triggerBeforeActions(e,t,n){const i=this.lifecycles(e);if(i){this.currentButton=t;for(const e of i)e.before?.forEach((e=>this.shouldRun(e)&&this.performAction(e,n)))}}triggerAfterActions(e,t,n){const i=this.lifecycles(e);if(i){this.currentButton=t;for(const e of i)e.after?.forEach((e=>this.shouldRun(e)&&this.performAction(e,n)))}}currentStepHasHoistedPrimaryActions(e){const t=this.lifecycles(e);return!!t&&t.some((e=>e.action?.length))}shouldRun(e){if(!e.conditions)return!0;const t=e.conditions.every((e=>{const t=_f.shared.evaluate(e);if(Ph.instance.maxLogging){const n=e.filter?.map((e=>`${e.identifier} ${e.operator} ${JSON.stringify(e.values)}`)).join(", ")??"none";Ze.debug(`[NamiFlow] condition: [${n}] op=${e.operator??"default"} → ${t}`)}return t}));return t}performAction(e,t){if(!this.currentFlowStep)return void Ze.warn("No current flow step");const n=(e.parameters?.delay?+e.parameters.delay:0)||0;this.flowLog(`performAction(${e.function}) — step=${this.currentFlowStep.id}, delay=${n}, params=${JSON.stringify(e.parameters??{})}`);const i=n=>{if(this.currentFlowStep?.id===n)switch(e.function){case Zm.BACK:this.back();break;case Zm.NEXT:e.parameters?.step?this.forward(e.parameters.step):this.next();break;case Zm.NAVIGATE:e.parameters?.step?this.previousFlowStep?.id===e.parameters.step?this.back():this.forward(e.parameters.step):this.next();break;case Zm.FINISHED:case Zm.DISMISS:this.finished();break;case Zm.EXIT:{const e=this.steps.find((e=>e.type===Jm));e&&this.forward(e.id);break}case Zm.PAUSE:this.pause();break;case Zm.RESUME:this.resumeFromPause();break;case Zm.HANDOFF:if(e.parameters?.handoffTag)if(this.manager.handoffStepHandler)if(e.parameters.handoffData)Ze.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} ${JSON.stringify(e.parameters.handoffData)}`),this.manager.handoffStepHandler(e.parameters.handoffTag,e.parameters.handoffData);else if(t)Ze.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} ${JSON.stringify(t)}`),this.manager.handoffStepHandler(e.parameters.handoffTag,t);else if(e.parameters.handoffFormId){const t=this.getFormData();e.parameters.handoffTag===ef?this.flowHandoffFormSequence():this.manager.handoffStepHandler(e.parameters.handoffTag,t)}else Ze.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} and no data`),this.manager.handoffStepHandler(e.parameters.handoffTag);else Ze.debug("No handoffStepHandler found",e);break;case Zm.LOG:e.parameters?.eventName?Ze.info(`logEvent → ${e.parameters.eventName}`):Ze.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case Zm.TRACK:e.parameters?.eventName?Ze.info(`trackEvent → ${e.parameters.eventName}`):Ze.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case Zm.SET_VIDEO:e.parameters?.name&&e.parameters.url?dh.setAppSuppliedVideoDetails({name:e.parameters.name,url:e.parameters.url}):Ze.warn("Missing name, url for setting video details");break;case Zm.BLOCK_BACK:{const t=e.parameters?.step,n=t?this.getStep(t):void 0;n?n.allow_back_to=!1:this.currentFlowStep?this.currentFlowStep.allow_back_to=!1:Ze.warn("Missing step for blocking back");break}case Zm.FLOW_EVENT:{const t=new Lf(this.manager),n=Object.fromEntries(Object.entries(e.parameters??{}).map((([e,n])=>[e,t.interpolateDeep(n)])));this.manager.eventHandler?this.manager.eventHandler(n):Ze.warn("Missing event handler",n);break}case Zm.FLOW_ENABLED:dh.setUserInteractionEnabled(!0);break;case Zm.FLOW_DISABLED:dh.setUserInteractionEnabled(!1);break;case Zm.SET_TAGS:e.parameters&&(dh.setUserTags(e.parameters),Object.entries(e.parameters).forEach((([e,t])=>{Ff.setCustomerAttribute(e,t)})));break;default:Ze.warn(`Missing action handler for ${e.function}`,e)}else this.flowLog(`performAction(${e.function}) — SKIPPED stale step ${n}, current=${this.currentFlowStep?.id}`)};n?setTimeout(i.bind(this,this.currentFlowStep.id),n):i(this.currentFlowStep.id)}nextStep(e){if(!e)return void Ze.error("Next step not found");const t=this.steps.findIndex((t=>t.id===e.id));if(-1===t)return void Ze.error(`Could not find next step for step ${e.id}`);const n=this.steps.slice(t+1);for(const e of n){if(this.isStepActive(e))return e}Ze.debug(`No active next step found after ${e.id}`)}handleScreenStep(e){const t=rl(e.screen??"");e.screen&&t&&this.campaign?(this.stepcrumbs.push(e),this.component.flowNavigateToScreen(t,{transition:this.transition,direction:"forward"})):Ze.error("No paywall or campaign found for next step")}handleBranchStep(e){this.stepcrumbs.push(e);for(const[t,n]of Object.entries(e.actions))if(n)for(const e of n)if(e.action){for(const n of e.action)if(this.shouldRun(n))return this.branchcrumbs.push(t),e.before?.forEach((e=>{this.performAction(e)})),e.action.forEach((e=>{this.shouldRun(e)&&this.performAction(e)})),void e.after?.forEach((e=>{this.performAction(e)}))}else Ze.warn(`No actions defined for branch tag ${t}`);Ze.warn(`No matching branch condition matched for step ${e.id}`)}getFormData(){return{...dh.currentProvider?.state?.formStates??{}}}flowHandoffFormSequence(){const e=this.currentScreenState?.formStates;if(!e)return void Ze.warn("No formStates available for handoff sequence");const t=Object.keys(e).sort();if(0===t.length)return void Ze.warn("formStates is empty, no handoffs to perform");const n=t.filter((t=>!0===e[t]));if(0===n.length)return Ze.info("No eligible handoff keys after filtering"),void this.manager.resume();this.activeHandoffSequence={formStates:{...e},remainingKeys:[...n]},this.resumeNextHandoff()}resumeNextHandoff(){const e=this.activeHandoffSequence;if(!e)return Ze.warn("No active handoff sequence to resume"),void this.manager.resume();if(0===e.remainingKeys.length)return Ze.info("All handoffs in the sequence are complete"),this.activeHandoffSequence=null,void this.manager.resume();const t=e.remainingKeys.shift(),n=e.formStates[t];Ze.debug(`Starting handoff for ${t} → ${String(n)}`),this.activeHandoffSequence=e;const i=`${t}`;this.manager.handoffStepHandler?.(i,void 0)}}let Wp=class e{static get instance(){return e._instance||(e._instance=new e),e._instance}constructor(){this.flowOpen=!1,this.lastAnimatedFlowProgress=new Map,this.navGraphCache=new WeakMap}static registerStepHandoff(e){this.instance.handoffStepHandler=e}static registerEventHandler(e){this.instance.eventHandler=e}static resume(){const{flowOpen:t,currentFlow:n}=e.instance;if(Ph.instance.maxLogging&&Ze.debug(`[NamiFlowManager] resume() — flowOpen=${t}, hasFlow=${!!n}, currentStep=${n?.currentFlowStep?.id??"none"}, isPaused=${n?.isPaused??"N/A"}`),t&&n&&n.currentFlowStep){if(n.activeHandoffSequence)return Ze.debug(`Resuming flow at handoff sequence ${n.currentFlowStep.id}`),void n.resumeNextHandoff();Ze.debug(`Resuming flow at step ${n.currentFlowStep.id}`),n.executeLifecycle(n.currentFlowStep,"__resume__")}else Ze.warn("Cannot resume: no active flow or current step")}resume(){e.resume()}static finish(){const{flowOpen:t,currentFlow:n}=e.instance;t&&n&&n.currentFlowStep?(Ze.debug(`Finishing flow programmatically at step ${n.currentFlowStep.id}`),n.finished()):Ze.debug("Cannot finish: no active flow or current step")}static pause(){const{flowOpen:t,currentFlow:n}=e.instance;t&&n&&n.currentFlowStep?!0===n.resumeFromBookmark?n.pause():Ze.warn("This flow cannot be paused"):Ze.warn("Cannot pause: no active flow or current step")}static isFlowOpen(){return e.instance.flowOpen}presentFlow(e,t,n){const i=new Np(e,t,this,n);return this.flowOpen=!0,this.currentFlow=i,i}finishFlow(){Ph.instance.maxLogging&&Ze.debug("[NamiFlowManager] finishFlow() — closing flow"),this.flowOpen=!1,this.currentFlow=void 0,this.lastAnimatedFlowProgress.clear()}getLastAnimatedFlowProgress(e){return this.lastAnimatedFlowProgress.get(e)??0}setLastAnimatedFlowProgress(e,t){this.currentFlow&&this.lastAnimatedFlowProgress.set(e,t)}getCurrentFlowProgress(e){if(!this.currentFlow)return 1;if(!this.currentFlow.currentFlowStep)return 0;const t=this.currentFlow.steps.filter((e=>e.type===Ym));if(0===t.length)return 0;const n=this.currentFlow.stepcrumbs.filter((e=>e.type===Ym));if(0===n.length)return 0;const i=this.buildNavGraph(this.currentFlow),a=this.currentFlow.currentFlowStep,r=this.findBranchPoint(t,i);let o=0;if(r)o=this.calculateBranchingProgress(n,t,a,r,i);else{const e=t.findIndex((e=>e.id===a.id));o=e>=0?(e+1)/t.length:0}return o=Math.max(0,Math.min(1,o)),e&&this.setLastAnimatedFlowProgress(e,o),o}findBranchPoint(e,t){for(const n of e)if(this.hasBranching(n,e,t))return n;return null}calculateBranchingProgress(e,t,n,i,a){const r=e.length,o=t.findIndex((e=>e.id===i.id)),s=e.findIndex((e=>e.id===i.id)),l=t.findIndex((e=>e.id===n.id));if(-1===s||n.id===i.id)return(l+1)/(o+2);const d=this.countForwardScreens(n,t,a),u=r+d;return Ze.debug(`Branching progress: visited=${r}, remaining=${d}, total=${u}, step=${n.id}`),r/u}countForwardScreens(e,t,n){const i=t.findIndex((t=>t.id===e.id));if(-1===i)return 0;const a=new Set;let r=0;const o=(e,s)=>{if(a.has(e))return;a.add(e);const l=(n.get(e)||[]).filter((e=>{const n=t.findIndex((t=>t.id===e));return n>i}));if(0!==l.length)for(const e of l)o(e,s+1);else r=Math.max(r,s)};return o(e.id,0),r}hasBranching(e,t,n){const i=t.findIndex((t=>t.id===e.id));if(-1===i)return!1;const a=(n.get(e.id)||[]).filter((e=>{const n=t.findIndex((t=>t.id===e));return n>i}));return a.length>1}buildNavGraph(e){const t=this.navGraphCache.get(e);if(t)return t;const n=new Map;e.steps.forEach((e=>{e.actions&&Object.values(e.actions).forEach((t=>{Array.isArray(t)&&t.forEach((t=>{t.action&&t.action.forEach((t=>{if("flowNav"===t.function){const i=t.parameters?.step;i&&(n.has(e.id)||n.set(e.id,new Set),n.get(e.id).add(i))}}))}))}))}));const i=new Map;return n.forEach(((e,t)=>{i.set(t,Array.from(e))})),this.navGraphCache.set(e,i),i}static getLastAnimatedFlowProgress(e){return this.instance.getLastAnimatedFlowProgress(e)}static setLastAnimatedFlowProgress(e,t){this.instance.setLastAnimatedFlowProgress(e,t)}static getCurrentFlowProgress(e){return this.instance.getCurrentFlowProgress(e)}getCurrentFlowStepAutoAdvanceDelay(){const e=this.currentFlow?.currentFlowStep;if(!e)return null;const t=e.actions?.[af];if(!t)return null;for(const e of t){const t=e.action??[];for(const e of t)if((e.function===Zm.NAVIGATE||e.function===Zm.NEXT)&&null!=e.parameters?.delay){const t=e.parameters.delay,n=Number(t);if(!isNaN(n)&&n>0)return n/1e3}}return null}static getCurrentFlowStepAutoAdvanceDelay(){return this.instance.getCurrentFlowStepAutoAdvanceDelay()}};const Fp=2;let Op=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const{I:$p}=Wm,jp=()=>document.createComment(""),zp=(e,t,n)=>{const i=e._$AA.parentNode,a=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=i.insertBefore(jp(),a),r=i.insertBefore(jp(),a);n=new $p(t,r,e,e.options)}else{const t=n._$AB.nextSibling,r=n._$AM,o=r!==e;if(o){let t;n._$AQ?.(e),n._$AM=e,void 0!==n._$AP&&(t=e._$AU)!==r._$AU&&n._$AP(t)}if(t!==a||o){let e=n._$AA;for(;e!==t;){const t=e.nextSibling;i.insertBefore(e,a),e=t}}}return n},Hp=(e,t,n=e)=>(e._$AI(t,n),e),Bp={},Up=e=>{e._$AR(),e._$AA.remove()},Gp=(e,t,n)=>{const i=new Map;for(let a=t;a<=n;a++)i.set(e[a],a);return i},Vp=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends Op{constructor(e){if(super(e),e.type!==Fp)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;void 0===n?n=t:void 0!==t&&(i=t);const a=[],r=[];let o=0;for(const t of e)a[o]=i?i(t,o):o,r[o]=n(t,o),o++;return{values:r,keys:a}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const a=(e=>e._$AH)(e),{values:r,keys:o}=this.dt(t,n,i);if(!Array.isArray(a))return this.ut=o,r;const s=this.ut??=[],l=[];let d,u,c=0,h=a.length-1,m=0,f=r.length-1;for(;c<=h&&m<=f;)if(null===a[c])c++;else if(null===a[h])h--;else if(s[c]===o[m])l[m]=Hp(a[c],r[m]),c++,m++;else if(s[h]===o[f])l[f]=Hp(a[h],r[f]),h--,f--;else if(s[c]===o[f])l[f]=Hp(a[c],r[f]),zp(e,l[f+1],a[c]),c++,f--;else if(s[h]===o[m])l[m]=Hp(a[h],r[m]),zp(e,a[c],a[h]),h--,m++;else if(void 0===d&&(d=Gp(o,m,f),u=Gp(s,c,h)),d.has(s[c]))if(d.has(s[h])){const t=u.get(o[m]),n=void 0!==t?a[t]:null;if(null===n){const t=zp(e,a[c]);Hp(t,r[m]),l[m]=t}else l[m]=Hp(n,r[m]),zp(e,a[c],n),a[t]=null;m++}else Up(a[h]),h--;else Up(a[c]),c++;for(;m<=f;){const t=zp(e,l[f+1]);Hp(t,r[m]),l[m++]=t}for(;c<=h;){const e=a[c++];null!==e&&Up(e)}return this.ut=o,((e,t=Bp)=>{e._$AH=t})(e,l),km}});const Xp=async e=>{const t=new Set(Array.from(document.fonts.values()).map((e=>e.family)));return e.forEach((e=>{const n=function(e){return t=`${e.family}-${e.style}`,t.replace(/ /g,"");var t}(e);if(t.has(n))return;const i=new FontFace(n,`url(${e.file})`);document.fonts.add(i)})),document.fonts.ready.then()};function Kp(e,t,n){if("undefined"==typeof window||!e||!t)return Ze.debug("Swipe detection is not supported in this environment."),{destroy(){},updateOptions(){}};const i={minDistance:n?.minDistance,maxDuration:n?.maxDuration??600,lockAxis:n?.lockAxis,preventScrollOnSwipe:n?.preventScrollOnSwipe,pointerTypes:n?.pointerTypes??["touch"],passiveListeners:n?.passiveListeners??!0,axisHint:n?.axisHint,edgeLeakThreshold:n?.edgeLeakThreshold},a=e.style.touchAction;i.preventScrollOnSwipe&&(e.style.touchAction="none");let r=null,o=0,s=0,l=0,d=0,u=0,c=null,h=null,m=!1,f=!1,p=!1;const g=e=>{try{const t=window.getComputedStyle(e);if(!t)return!1;const n=t.overflowY;if("auto"!==n&&"scroll"!==n)return!1;const i=e;return i.scrollHeight>i.clientHeight}catch{return!1}},v=e=>i.pointerTypes.includes(e.pointerType),y=t=>{const n=t.composedPath?t.composedPath()[0]:t.target;if(v(t)&&null===r){r=t.pointerId,o=l=t.clientX,s=d=t.clientY,u=performance.now(),c=null,p=!1,m=!1,f=!1,h="y"===i.axisHint?((e,t)=>{let n=e;for(;n&&n!==t&&n instanceof HTMLElement;){if(g(n))return n;n=n.parentElement||(n.parentNode?.host??null)}return null})(n,e):null,h||(f=!0);try{e?.setPointerCapture?.(t.pointerId)}catch{try{n?.setPointerCapture?.(t.pointerId)}catch{}}}},b=e=>{if(e.pointerId===r&&v(e)){if(l=e.clientX,d=e.clientY,i.lockAxis&&!c){const e=Math.abs(l-o),t=Math.abs(d-s);(e>2||t>2)&&(c=t>=e?"y":"x")}if("y"===i.axisHint&&("y"===c||!i.lockAxis)){const n=d-s,a=n<0?"up":"down",r=Math.abs(n),c=performance.now()-u,g=r/Math.max(c,1),v=r>=i.minDistance||g>.5;if(h)if(v)f=!0;else if(((e,t)=>!!e&&("down"===t?e.scrollTop>0:e.scrollTop+e.clientHeight<e.scrollHeight-1))(h,a)){if(!(("down"===a&&h.scrollTop<=50||"up"===a&&h.scrollTop+h.clientHeight>=h.scrollHeight-50)&&g>.3))return void(m=!0);f=!0}else f=!0;const y=!h||r>=i.edgeLeakThreshold;if(!p&&!m&&f&&y&&r>=i.minDistance){p=!0;const i=performance.now(),c={direction:"up"===a?"up":"down",distanceX:l-o,distanceY:n,absX:Math.abs(l-o),absY:r,duration:i-u,velocity:r/Math.max(i-u,1),startX:o,startY:s,endX:l,endY:d,startedAt:u,endedAt:i,originalEvent:e};t(c)}}}},w=e=>{if(e.pointerId!==r)return;if(!v(e))return void k();if(h)return void k();if(p||m)return void k();const n=performance.now(),a=n-u,g=l-o,y=d-s,b=Math.abs(g),w=Math.abs(y);let S;S=i.lockAxis&&c?c:"x"===i.axisHint?"x":"y"===i.axisHint?"y":b>=w?"x":"y";const _="x"===S?b:w,M=a<=i.maxDuration;let E=i.minDistance;h&&"y"===S&&f&&(E+=i.edgeLeakThreshold);if(M&&_>=E){let i;i="x"===S?g>0?"right":"left":y>0?"down":"up";const r=_/Math.max(a,1);t({direction:i,distanceX:g,distanceY:y,absX:b,absY:w,duration:a,velocity:r,startX:o,startY:s,endX:l,endY:d,startedAt:u,endedAt:n,originalEvent:e})}k()},k=()=>{r=null,c=null,u=0,h=null,f=!1,m=!1,p=!1},S=!!i.passiveListeners&&{passive:!0},_=i.passiveListeners?{passive:!0,capture:!0}:{capture:!0};e.addEventListener("pointerdown",y,_),e.addEventListener("pointermove",b,S),e.addEventListener("pointerup",w,S),e.addEventListener("pointercancel",w,S),e.addEventListener("lostpointercapture",w,S);return{destroy:()=>{e.removeEventListener("pointerdown",y,_),e.removeEventListener("pointermove",b,S),e.removeEventListener("pointerup",w,S),e.removeEventListener("pointercancel",w,S),e.removeEventListener("lostpointercapture",w,S),i.preventScrollOnSwipe&&(e.style.touchAction=a),k()},updateOptions:t=>{Object.assign(i,t),"boolean"==typeof t.preventScrollOnSwipe&&(t.preventScrollOnSwipe?e.style.touchAction="none":e.style.touchAction=a)}}}let Yp=class extends $m{constructor(e,t,n){return super(),this.pages=[],this.currentOffset=0,this.presentationStyle="fullscreen",this.formFactor=El(),this.timeSpentOnPaywall=0,this.animation={transition:"none",direction:"forward"},this._originalBodyStyles={},this._originalDocumentStyles={},this._savedScrollY=0,this._sheetDragStartY=0,this._sheetIsDragging=!1,this._dismissThreshold=100,this.type=e,this.value=t,this.context=n,this.setPaywallData(),this}setPaywallData(){const e=zl(this.value,this.type);this.paywall=e.paywall,this.campaign=e.campaign}getPresentationStyle(e){const t=e?.template?.initialState?.presentation_style;return(n=t)&&Th.has(n)?"sheet"===n?"fullscreen":n:"fullscreen";var n}get isHalfSheet(){return"compact_sheet"===this.presentationStyle}connectedCallback(){super.connectedCallback(),window.TVJS?.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=this),document.addEventListener("keydown",this.handleKeyDownEvent.bind(this)),this._swipeHandler=Kp(this,this.handleSwipeEvent.bind(this),{axisHint:"y",lockAxis:!0,minDistance:25,edgeLeakThreshold:15,preventScrollOnSwipe:!1,pointerTypes:["touch"]}),this.presentationStyle=this.getPresentationStyle(this.paywall),this.setOriginalStyles()}disconnectedCallback(){super.disconnectedCallback(),ca.clearLaunchId(),window.TVJS?.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=document.body),document.removeEventListener("keydown",this.handleKeyDownEvent.bind(this)),nd.getInstance().removeAllListeners(Be),this.restoreStyles(),this._halfSheetAbortController?.abort(),this._swipeHandler.destroy()}setOriginalStyles(){"television"===this.formFactor&&(this._originalBodyStyles.overflow=document.body.style.overflow,document.body.style.overflow="hidden"),this._originalBodyStyles.background=document.body.style.background,"phone"===this.formFactor&&(this._originalBodyStyles["overscroll-behavior"]=document.body.style.overscrollBehavior?document.body.style.overscrollBehavior:null,this._originalDocumentStyles["overscroll-behavior"]=document.documentElement.style.overscrollBehavior?document.documentElement.style.overscrollBehavior:null,document.body.style.overscrollBehavior="none",document.documentElement.style.overscrollBehavior="none",this.isHalfSheet||(this._originalBodyStyles.overflow=document.body.style.overflow,document.body.style.overflow="hidden")),this.isHalfSheet&&(this._savedScrollY=window.scrollY,this._originalBodyStyles.position=document.body.style.position||null,this._originalBodyStyles.top=document.body.style.top||null,this._originalBodyStyles.width=document.body.style.width||null,document.body.style.position="fixed",document.body.style.top=`-${this._savedScrollY}px`,document.body.style.width="100%")}restoreStyles(){Object.entries(this._originalBodyStyles).forEach((([e,t])=>{null!==t?document.body.style.setProperty(e,t):document.body.style.removeProperty(e)})),Object.entries(this._originalDocumentStyles).forEach((([e,t])=>{null!==t?document.documentElement.style.setProperty(e,t):document.documentElement.style.removeProperty(e)})),this._savedScrollY>0&&(window.scrollTo(0,this._savedScrollY),this._savedScrollY=0)}handleKeyDownEvent(e){!this.flow||10009!==e.keyCode&&"Backspace"!==e.key&&"GoBack"!==e.key||this.flow.triggerActions(cf)}handleSwipeEvent({direction:e}){"down"===e?this.flow?.triggerActions("__swipe_down__"):"up"===e&&this.flow?.triggerActions("__swipe_up__")}setupHalfSheetDragTracking(){this._halfSheetAbortController?.abort(),this._halfSheetAbortController=new AbortController;const{signal:e}=this._halfSheetAbortController,t=this.shadowRoot?.querySelector(".nami-half-sheet-container"),n=this.shadowRoot?.querySelector(".nami-half-sheet-content");if(!t||!n)return;t.addEventListener("touchstart",(e=>{n.scrollTop>0||(this._sheetDragStartY=e.touches[0].clientY,this._sheetIsDragging=!0)}),{passive:!0,signal:e}),t.addEventListener("touchmove",(e=>{if(!this._sheetIsDragging)return;const n=e.touches[0].clientY-this._sheetDragStartY;n>0&&(t.style.transform=`translateY(${n}px)`,t.style.transition="none",e.preventDefault())}),{passive:!1,signal:e}),t.addEventListener("touchend",(()=>{if(!this._sheetIsDragging)return;this._sheetIsDragging=!1;const e=t.style.transform.match(/translateY\((\d+(?:\.\d+)?)px\)/);if((e?parseFloat(e[1]):0)>this._dismissThreshold){if(this.flow?.currentStepHasHoistedPrimaryActions("__swipe_down__")??!1)t.style.transform="translateY(0)",t.style.transition="transform 0.2s ease-out",this.flow?.triggerActions("__swipe_down__");else{t.style.transform="translateY(100%)",t.style.transition="transform 0.2s ease-in";const e=this.shadowRoot?.querySelector(".nami-half-sheet-backdrop");e&&e.classList.add("nami-dismissing"),setTimeout((()=>{this.flow?.finished()}),200)}}else t.style.transform="translateY(0)",t.style.transition="transform 0.2s ease-out"}),{signal:e})}setupHalfSheetFocusTrap(){const e=this.shadowRoot?.querySelector(".nami-half-sheet-container");if(!e)return;e.focus();const t=this._halfSheetAbortController?.signal;e.addEventListener("keydown",(t=>{if("Tab"!==t.key)return;const n=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===n.length)return;const i=n[0],a=n[n.length-1];t.shiftKey?document.activeElement!==i&&this.shadowRoot?.activeElement!==i||(t.preventDefault(),a.focus()):document.activeElement!==a&&this.shadowRoot?.activeElement!==a||(t.preventDefault(),i.focus())}),t?{signal:t}:void 0)}firstUpdated(){this.timeSpentOnPaywall=Date.now(),el(this.campaign)&&(this.flow=Wp.instance.presentFlow(this.campaign,this,this.context)),this.isHalfSheet&&this.updateComplete.then((()=>{this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap()}))}updated(e){super.updated(e),this.isHalfSheet&&e.has("presentationStyle")&&(this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap())}getAnimationStyles(e){const t="backward"===this.animation.direction?-1:1;switch(this.animation.transition){case"verticalSlide":return`transform: translateY(${100*(e-this.currentOffset)*t}vh);`;case"slide":return`transform: translateX(${100*(e-this.currentOffset)*t}vw);`;case"fade":return`opacity: ${e===this.currentOffset?1:0};`;default:return""}}async updatePages(e){if(0===this.pages.length||"none"===this.animation.transition)return void(this.pages=[e]);const t=this.pages[this.pages.length-1];t?.id!==e.id&&(this.pages=[t,e],this.currentOffset=0,await this.updateComplete,requestAnimationFrame((()=>{this.currentOffset=1,setTimeout((()=>{this.pages=[e],this.currentOffset=0,this.paywall=e}),250)})))}async flowNavigateToScreen(e,t){this.flow?.previousFlowStep&&this.flow.executeLifecycle(this.flow.previousFlowStep,rf);const n=this.presentationStyle,i=this.getPresentationStyle(e);"fullscreen"===n&&"compact_sheet"===i?console.warn("Unsupported transition: fullscreen → compact_sheet. Presenting as fullscreen."):"compact_sheet"!==n||"fullscreen"!==i&&"sheet"!==i?this.presentationStyle=i:(await this.animateHalfSheetExpand(),this.presentationStyle="fullscreen"),this.animation=t,await this.updatePages(e),this.flow?.currentFlowStep&&this.flow.executeLifecycle(this.flow.currentFlowStep,af)}async animateHalfSheetExpand(){const e=this.shadowRoot?.querySelector(".nami-half-sheet-container");e&&(e.classList.add("nami-expanding"),await new Promise((e=>setTimeout(e,300))))}getSelectedSlideIndexForCurrentCarousel(){return dh.getSelectedSlideIndex()}renderFlow(){return"undefined"==typeof document?bm``:this.isHalfSheet?this.renderHalfSheet():bm`
120
+ `,Hm=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)},Bm={attribute:!0,type:String,converter:Kh,reflect:!1,hasChanged:Yh},Um=(e=Bm,t,n)=>{const{kind:i,metadata:a}=n;let r=globalThis.litPropertyMetadata.get(a);if(void 0===r&&globalThis.litPropertyMetadata.set(a,r=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),r.set(n.name,e),"accessor"===i){const{name:i}=n;return{set(n){const a=t.get.call(this);t.set.call(this,n),this.requestUpdate(i,a,e)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=n;return function(n){const a=this[i];t.call(this,n),this.requestUpdate(i,a,e)}}throw Error("Unsupported decorator location: "+i)};function Gm(e){return(t,n)=>"object"==typeof n?Um(e,t,n):((e,t,n)=>{const i=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),i?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function Vm(e){return Gm({...e,state:!0,attribute:!1})}function Xm(e){return!e||"object"==typeof e&&0==Object.keys(e).length}const Km="entry",Ym="screen",qm="branch",Jm="exit",Qm="unknown";var Zm;!function(e){e.NAVIGATE="flowNav",e.BACK="flowPrev",e.NEXT="flowNext",e.FINISHED="flowDone",e.DISMISS="flowDismiss",e.EXIT="flowExit",e.HANDOFF="flowHandoff",e.TRACK="trackEvent",e.LOG="logEvent",e.SET_VIDEO="setVideo",e.FLOW_EVENT="flowEvent",e.BLOCK_BACK="blockBackToStep",e.FLOW_ENABLED="flowInteractionEnabled",e.FLOW_DISABLED="flowInteractionDisabled",e.SET_TAGS="setTags",e.PAUSE="flowPause",e.RESUME="flowResume"}(Zm||(Zm={}));const ef="__handoff_sequence__",tf="__buy_sku__",nf="__default__",af="__appear__",rf="__disappear__",of="__login_success__",sf="__login_failure__",lf="__logout_success__",df="__logout_failure__",uf="__purchase_success__",cf="__remoteback__",hf="__tag_update__",mf="and",ff="or",pf="i_contains",gf="equals",vf="i_equals",yf="not_equals",bf="not_i_equals",wf="not_contains",kf="set",Sf="notSet";class _f{constructor(){this.resolvers=new Map,this.namespaceResolvers=new Map}static get shared(){return _f.instance||(_f.instance=new _f),_f.instance}registerNamespaceResolver(e,t){this.namespaceResolvers.set(e,t)}resetResolvers(){this.resolvers.clear()}evaluate(e){const t=e.filter??[];if(0===t.length)return!0;const n=t.map((e=>this.evaluateFilter(e)));switch(e.operator){case mf:return n.every((e=>e));case ff:return n.some((e=>e));default:return n.every((e=>e))}}evaluateOrdered(e){if(!e)return!0;const t=e.filter??[];if(0===t.length)return!0;switch(e.operator){case mf:for(const e of t)if(!this.evaluateFilter(e))return!1;return!0;case ff:for(const e of t)if(this.evaluateFilter(e))return!0;return!1;default:for(const e of t)if(!this.evaluateFilter(e))return!1;return!0}}evaluateFilter(e){const t=this.resolve(e.identifier);if(Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolve(${e.identifier}) → ${JSON.stringify(t)} (type: ${typeof t})`),e.operator===kf)return null!=t;if(e.operator===Sf)return null==t;if(null==t){Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] ${e.identifier} resolved to null — registeredNamespaces: [${[...this.namespaceResolvers.keys()].join(", ")}]`);return!![yf,bf,wf].includes(e.operator)}switch(e.operator){case pf:if(Array.isArray(t)){return e.values.some((e=>t.some((t=>0===t.localeCompare(e,void 0,{sensitivity:"accent"})))))}return this.log("Resolved value is not an array of strings for i_contains."),!1;case gf:return e.values.some((e=>{if("string"==typeof t)return t===e;if("boolean"==typeof t){const n="true"===e.toLowerCase();return t===n}return this.log("Unsupported type for equals comparison: "+typeof t),!1}));case vf:return e.values.some((e=>{if("string"==typeof t){return 0===t.localeCompare(e,void 0,{sensitivity:"accent"})}if("boolean"==typeof t){const n="true"===e.toLowerCase();return t===n}return this.log("Unsupported type for i_equals comparison: "+typeof t),!1}));case yf:return e.values.every((e=>"string"!=typeof t||t!==e));case bf:return e.values.every((e=>"string"!=typeof t||0!==t.localeCompare(e,void 0,{sensitivity:"accent"})));case wf:return e.values.every((e=>"string"!=typeof t||!t.includes(e)));default:return this.log(`Unsupported operator: ${e.operator}`),!1}}resolve(e){const t=this.resolveRaw(e);if(void 0!==t)return Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolve(${e}) — exact hit: ${JSON.stringify(t)}`),t;const n=e.lastIndexOf(".");if(-1===n);else{const t=e.slice(0,n),i=e.slice(n+1),a=this.resolveRaw(t);if(void 0!==a){const n=this.extractProperty(i,a);return Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolve(${e}) — fallback: base=${t} → ${typeof a}, extract(.${i}) → ${JSON.stringify(n)}`),n}this.log(`Could not resolve base identifier: ${t}`)}}resolveRaw(e){const t=[...this.namespaceResolvers.keys()].sort(((e,t)=>t.length-e.length));for(const n of t)if(e.startsWith(n)){const t=this.namespaceResolvers.get(n);if(t){const i=t(e);return Ph.instance.maxLogging&&Ze.debug(`[NamiConditionEvaluator] resolveRaw(${e}) — ns=${n} → ${JSON.stringify(i)}`),i}}}extractProperty(e,t){switch(e){case"last":if(Array.isArray(t))return t[t.length-1];break;case"first":if(Array.isArray(t))return t[0];break;case"count":if(Array.isArray(t))return t.length;if(t&&"object"==typeof t)return Object.keys(t).length;break;default:return}this.log(`Could not extract .${e} from type ${typeof t}`)}log(e){Ze.debug(`[NamiConditionEvaluator] ${e}`)}}class Mf{constructor(){}register(){_f.shared.registerNamespaceResolver(this.namespace,(e=>{const t=e.replace(new RegExp(`^${this.namespace}\\.`),"");return this.resolveValue(t)}))}resolveKeyPath(e,t){const n=e.replace(/\[(\w+)\]/g,".$1").split(".").filter(Boolean);let i=t;for(const e of n){if(null==i||"object"!=typeof i)return;i=i[e]}return i}}class Ef extends Mf{constructor(e){super(),this.namespace="LaunchContext",this.context=e,this.register()}resolveValue(e){if(e.startsWith("customAttributes.")){const t=e.substring(17);return this.resolveKeyPath(t,this.context.customAttributes)}if(e.startsWith("customObject.")){const t=e.substring(13);return this.resolveKeyPath(t,this.context.customObject)}return this.resolveKeyPath(e,{customAttributes:this.context.customAttributes,customObject:this.context.customObject,productGroups:this.context.productGroups})}}class Pf extends Mf{constructor(){super(),this.namespace="Device";const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[1]||"",t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Ml();this.context={osName:n.os_name,osVersion:n.os_version,appVersion:n.extended_platform_version,sdkVersion:n.sdk_version,deviceModel:n.device_model,screenWidth:window.innerWidth,screenHeight:window.innerHeight,formFactor:n.form_factor,tvQuality:this.tvQuality(n.form_factor??"desktop"),tvResolution:this.tvResolution(n.form_factor??"desktop"),screenSize:this.screenSizeTier(n.form_factor??"desktop"),language:n.language,country:e,timezone:t},this.register()}screenSizeTier(e){const t=window.screen.width,n=window.screen.height,i=window.devicePixelRatio||1,a=Math.round(t*i),r=Math.round(n*i),o=Math.max(a,r);switch(e){case"phone":return o<1136?"tiny":o<1334?"small":o<1920?"medium":o<2560?"large":"huge";case"tablet":return o<2048?"medium":o<2732?"large":"huge";case"television":return o<1920?"medium":o<3840?"large":"huge";case"desktop":return o<1440?"small":o<2560?"medium":o<3840?"large":"huge";default:return"medium"}}tvQuality(e){if("television"!==e)return"";const t=window.screen.width,n=window.screen.height,i=window.devicePixelRatio||1,a=Math.round(t*i),r=Math.round(n*i),o=Math.max(a,r),s=Math.min(a,r);return o>=3840||s>=2160?"4K":o>=1920||s>=1080?"1080p":"720p"}tvResolution(e){if("television"!==e)return"";const t=window.screen.width,n=window.screen.height,i=window.devicePixelRatio||1,a=Math.round(t*i),r=Math.round(n*i),o=Math.max(a,r),s=Math.min(a,r);return s<720&&o<1280?"SD":s>=720&&s<1080&&o>=1280&&o<1920?"720p":s>=1080&&s<1440&&o>=1920&&o<2560?"1080p":s>=1440&&s<2160&&o>=2560&&o<3840?"1440p":s>=2160&&s<3e3&&o>=3840&&o<5e3?"4K":s>=3e3&&o>=5e3?"8K":"Unknown"}resolveValue(e){return this.resolveKeyPath(e,this.context)}}const Tf=[/(^|_)api(_|$)?key/i,/^key$/i,/^token$/i,/id[_-]?token/i,/access[_-]?token/i,/^auth/i,/password/i,/secret/i,/signature/i,/hmac/i,/^jwt$/i,/^code$/i,/redirect[_-]?uri/i,/return[_-]?url/i,/^state$/i,/^session$/i,/^sid$/i,/^sso$/i,/assertion/i];class xf{constructor(){this.params={},"undefined"!=typeof window&&this.setSearchParams()}static get instance(){return xf._instance||(xf._instance=new xf),xf._instance}static refresh(){"undefined"!=typeof window&&this.instance.setSearchParams()}setSearchParams(){this.params=this.extractSafeParams()}safeValue(e){if(!e)return null;try{const t=decodeURIComponent(e).trim();return!t||/^null|undefined$/i.test(t)||((e=>e.includes("://")||/^\/.*\?/.test(e))(t)||(e=>/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/.test(e))(t)||(e=>/^[A-Za-z0-9_-]{40,}$/.test(e)||/^[A-Fa-f0-9]{40,}$/.test(e)||/^ya29\./.test(e)||/^sk_/.test(e)||/^ghp_/.test(e))(t))?null:((e,t=128)=>e.length>t?e.slice(0,t):e)(t)}catch{return null}}extractSafeParams(){const e=window.location,t={},n=new Set;try{const i=new URLSearchParams(e.search),a=(e,i)=>{const a=(e=>e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]/g,"_").toLowerCase())(e);if(n.size>=10)return;if((e=>Tf.some((t=>t.test(e))))(a))return;const r=this.safeValue(i);r&&(t[a]=r,n.add(a))};for(const[e,t]of i.entries())a(e,t)}catch{}return t}}xf._instance=null;const Af=()=>xf.instance.params,Cf=/\{\{\s*([^}]+?)\s*\}\}/g;class Lf{constructor(e){this.flowManager=e,this.urlParams=Af()}resolve(e){const t=this.flowManager.currentFlow,n=t?.component;if(e.startsWith("launchContext.")){const t=this.flowManager.currentFlow?.context;if(t){const n=e.substring(14),i=new Ef(t).resolveValue(n);return i?.toString()}}else switch(e){case"campaignId":return n?.campaign?.rule;case"campaignName":return n?.campaign?.name;case"campaignLabel":case"campaignPlacement":return n?.campaign?.value??void 0;case"campaignSegment":case"campaignSegmentId":return n?.campaign?.segment;case"campaignExternalSegment":case"campaignExternalSegmentId":return n?.campaign?.external_segment??void 0;case"pageName":return n?.paywall?.name;case"pageId":return n?.paywall?.id;case"flowName":return t?.name;case"flowId":return t?.id;case"objectId":return n?.campaign?.flow?.object_id;case"stepName":return t?.currentFlowStep?.name;case"buttonText":return t?.currentButton?.firstTextValue();case"slideNumber":{const e=n?.getSelectedSlideIndexForCurrentCarousel();return null!=e?`${e+1}`:void 0}default:return}}interpolateLiquidVariables(e){return e.replace(Cf,((e,t)=>{const n=this.resolve(t)??this.urlParams[t];return null!=n?n:""}))}interpolateDeep(e){return"string"==typeof e?this.interpolateLiquidVariables(e):Array.isArray(e)?e.map((e=>this.interpolateDeep(e))):e&&"object"==typeof e?Object.entries(e).reduce(((e,[t,n])=>({...e,[t]:this.interpolateDeep(n)})),{}):e}}class If extends Mf{constructor(){super(),this.namespace="urlParams",this.context=Af(),this.register()}resolveValue(e){return Ze.debug("[URLParamsResolver]","Resolving keyPath",e),this.resolveKeyPath(e,this.context)}}class Df extends Mf{getContextProvider(){const e=dh.providers;if(0===e.length)return;const t=e.find((e=>e.flow));return t||e[e.length-1]}constructor(){super(),this.namespace="state",this.register()}resolveValue(e){const t=this.getContextProvider();if(t){if(e.startsWith("formStates.")){const n=e.substring(11);return t.getCurrentFormId(n)}return this.resolveKeyPath(e,t.state)}}}class Rf extends Mf{constructor(e){super(),this.namespace="Placement",this.campaign=e,this.register()}resolveValue(e){if("label"!==e)return;if(this.campaign&&void 0!==this.campaign.value&&null!==this.campaign.value)return this.campaign.value;const t=dh.providers;if(0===t.length)return;const n=t.find((e=>e.flow));return n?n.getCurrentPlacementLabel():t[t.length-1]?.getCurrentPlacementLabel()}}class Nf{constructor(){this.load()}setExternalId(e){return this.externalId=e,this}getExternalId(){return this.externalId}isLoggedIn(){return!!this.externalId}save(){return this.externalId?ca.setNamiProfile({externalId:this.externalId}):ca.removeNamiProfile(),this}load(){const e=ca.getNamiProfile();e&&(this.externalId=e.externalId),dh.setIsLoggedIn(!!this.externalId)}async login(e){const t=await Zs.instance.login(e);t.external_id&&dh.setIsLoggedIn(!0),this.setExternalId(t.external_id).save()}async logout(){await Zs.instance.logout(),dh.setIsLoggedIn(!1),this.setExternalId(void 0).save()}}var Wf;Nf.instance=new Nf,function(e){e.LOGIN="login",e.LOGOUT="logout",e.ADVERTISING_ID_SET="advertising_id_set",e.ADVERTISING_ID_CLEARED="advertising_id_cleared",e.VENDOR_ID_SET="vendor_id_set",e.VENDOR_ID_CLEARED="vendor_id_cleared",e.CUSTOMER_DATA_PLATFORM_ID_SET="customer_data_platform_id_set",e.CUSTOMER_DATA_PLATFORM_ID_CLEARED="customer_data_platform_id_cleared",e.ANONYMOUS_MODE_ON="anonymous_mode_on",e.ANONYMOUS_MODE_OFF="anonymous_mode_off",e.NAMI_DEVICE_ID_SET="nami_device_id_set",e.NAMI_DEVICE_ID_CLEARED="nami_device_id_cleared"}(Wf||(Wf={}));class Ff{constructor(){this.emitter=nd.getInstance(),_f.shared.registerNamespaceResolver("UserTags",(e=>{const t=e.replace("UserTags.",""),n=Ff.getCustomerAttribute(t);if(null!=n){const e=n.toLowerCase();return"true"===e||"false"===e?"true"===e:isNaN(Number(n))?n:parseInt(n,10)}return null}))}static isLoggedIn(){return Nf.instance.isLoggedIn()}static loggedInId(){return this.instance.isSDKInitialized||Ze.debug(F),Nf.instance.getExternalId()}static async login(e){if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(Wf.LOGIN,!1,e),e}if(this.inAnonymousMode()){const e=new _a;throw this.invokeStateHandler(Wf.LOGIN,!1,e),e}try{if(await Nf.instance.login(e),await fh.instance.fetchActiveEntitlements(),this.invokeStateHandler(Wf.LOGIN,!0),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&(Ph.instance.maxLogging&&Ze.debug(`[NamiCustomerManager] login success — triggering __login_success__ on step ${t.id}`),e.executeLifecycle(t,of))}}catch(e){if(this.invokeStateHandler(Wf.LOGIN,!1,e),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&(Ph.instance.maxLogging&&Ze.debug(`[NamiCustomerManager] login failure — triggering __login_failure__ on step ${t.id}`),e.executeLifecycle(t,sf))}throw e}}static async logout(){if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(Wf.LOGOUT,!1,e),e}if(this.inAnonymousMode()){const e=new _a;throw this.invokeStateHandler(Wf.LOGOUT,!1,e),e}try{if(await Nf.instance.logout(),await fh.instance.fetchActiveEntitlements(),this.invokeStateHandler(Wf.LOGOUT,!0),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,lf)}}catch(e){if(this.invokeStateHandler(Wf.LOGOUT,!1,e),Wp.instance.flowOpen){const e=Wp.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,df)}throw e}}static async setCustomerDataPlatformId(e){await this.updateCustomerDataPlatformId(e)}static async clearCustomerDataPlatformId(){await this.updateCustomerDataPlatformId(null)}static registerAccountStateHandler(e){return this.instance.emitter.on("accountStateChange",e),()=>{this.instance.emitter.off("accountStateChange",e)}}static async setAnonymousMode(e){const t=e?Wf.ANONYMOUS_MODE_ON:Wf.ANONYMOUS_MODE_OFF;if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(t,!1,e),e}if(this.anonymousModeCapability())if(this.inAnonymousMode()!==e)if(e)ca.setAnonymousMode(e),ca.resetDevice(),this.refetchConfig(),this.invokeStateHandler(Wf.ANONYMOUS_MODE_ON,!0);else{ca.clearAnonymousMode(),dd&&dd.setInMemoryAnonymousMode(!1);const e=ca.getNamiConfig()?.namiCommands;await rd.instance.createOrUpdateDevice(Ml(e)),ca.clearAnonymousUUID(),this.refetchConfig(),this.invokeStateHandler(Wf.ANONYMOUS_MODE_OFF,!0)}else{const n=e?new ka:new Sa;this.invokeStateHandler(t,!1,n)}else Ze.warn("Anonymous mode feature is not enabled for your Nami account. Contact support@nami.ml for details.")}static inAnonymousMode(){return!!this.instance.isSDKInitialized&&ud()}static setCustomerAttribute(e,t){if(!this.instance.isSDKInitialized)throw new pa;if(ca.setCustomerAttribute(e,t),Xs(A.PAYWALL_PERSONALIZATION)?(dh.setCustomerAttribute({[e]:t}),Ze.debug(`This customer attribute you set is now available for paywall personalization using the smart text variable: ${e}`)):Ze.warn(`The customer attribute ${e} is not available for using on a paywall, because your account's plan does not include paywall personalization. Contact support@nami.ml for details.`),Wp.instance.flowOpen){const e=Wp.instance.currentFlow;if(e){const t=e.currentFlowStep;t&&e.executeLifecycle(t,hf)}}}static getCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new pa;const t=ca.getCustomerAttribute(e);return null!=t?Xs(A.PAYWALL_PERSONALIZATION)?Ze.debug(`Found customer attribute. ${e} is available for paywall personalization on this device.`):Ze.warn(`Found customer attribute. ${e} is not available for use on a paywall because paywall personalization is not included in your account's plan. Contact support@nami.ml for details.`):Ze.warn(`No ${e} customer attribute found.`),t}static getAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new pa;return ca.getAllCustomerAttributes()}static clearCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new pa;ca.clearCustomerAttribute(e)?(dh.removeCustomerAttribute(e),Ze.warn(`This customer attribute has been cleared. ${e} is no longer available for paywall personalization on this device. A default value will be used if set in the Nami Control Center.`)):Ze.warn(`No value to clear for attribute ${e}.`)}static clearAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new pa;ca.getAllCustomerAttributesKeys().forEach((e=>{dh.removeCustomerAttribute(e)})),ca.clearAllCustomerAttributes(),Ze.warn("All customer attribute have been cleared. customer's smart text will no longer be personalized for this device. A default value will be used if set in the Nami Control Center.")}static journeyState(){if(!this.instance.isSDKInitialized)throw new pa;return ca.getCustomerJourneyState()}static deviceId(){return this.instance.isSDKInitialized?ca.getDevice()?.id??G:G}static registerJourneyStateHandler(e){if(Ys("NamiCustomerManager.registerJourneyStateHandler"))return this.instance.emitter.addListener(Ge,e),()=>{this.instance.emitter.removeListener(Ge,e)}}static invokeStateHandler(e,t,n){this.instance.emitter.emit("accountStateChange",e,t,n)}get isSDKInitialized(){return Ph.instance.isInitialized}static async updateCustomerDataPlatformId(e){if(!this.instance.isSDKInitialized){const e=new pa;throw this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}if(this.inAnonymousMode()){Ze.info("Unable to set CDP ID in anonymous mode",{deviceId:ca.getDevice()?.id,anonymousMode:!0});const e=new Ma;this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}else try{await rd.instance.updateDeviceField("customer_data_platform_id",e),this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!0)}catch(e){this.invokeStateHandler(Wf.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}}static anonymousModeCapability(){if(!this.instance.isSDKInitialized)return!1;const e=Xs(A.ANONYMOUS_MODE_CAPABILITY),t=Xs(A.THIRD_PARTY_TRANSACTIONS);return e&&t}static async refetchConfig(){this.instance.isSDKInitialized&&await Promise.all([od.instance.fetchProducts(),sd.instance.fetchPaywalls().then((e=>id.instance.fetchCampaignRules(e)))])}}Ff.instance=new Ff;const{NAMI_CLOSE_PAYWALL:Of="namiClosePaywall",NAMI_RESTORE_PURCHASES:$f="namiRestorePurchases",NAMI_SIGN_IN:jf="namiSignIn",NAMI_BUY_SKU:zf="namiBuySKU",SET_STATE:Hf="setState",NAMI_SELECT_SKU:Bf="namiSelectSKU",NAMI_PURCHASE_SELECTED_SKU:Uf="namiPurchaseSelectedSKU",NAMI_DEEP_LINK:Gf="namiDeeplink",NAMI_NAVIGATE_TO_SCREEN:Vf="namiNavigateToScreen",NAMI_RELOAD_PRODUCTS:Xf="namiReloadProducts",UNSUPPORTED:Kf="",NAMI_PURCHASE_SUCCESS:Yf="namiPurchaseSuccess",NAMI_PURCHASE_CANCELLED:qf="namiPurchaseCancelled",NAMI_PURCHASE_FAILED:Jf="namiPurchaseFailed",NAMI_PURCHASE_PENDING:Qf="namiPurchasePending",NAMI_PURCHASE_UNKNOWN:Zf="namiPurchaseUnknown",NAMI_SHOW_PAYWALL:ep="namiShowPaywall",NAMI_PAGE_CHANGE:tp="namiPageChange",NAMI_TOGGLE_CHANGE:np="namiToggleChange",NAMI_SLIDE_CHANGE:ip="namiSlideChange",NAMI_PLAY_VIDEO:ap="namiPlayVideo",NAMI_PAUSE_VIDEO:rp="namiPauseVideo",NAMI_MUTE_VIDEO:op="namiMuteVideo",NAMI_UNMUTE_VIDEO:sp="namiUnmuteVideo"}={};var lp,dp,up;function cp(e,t){return Array.isArray(e)?e.reduce(((e,n)=>{const i=cp(n,t);return Array.isArray(i)?[...e,...i]:[...e,i]}),[]):null==e?e:"object"==typeof e?Object.entries(e).reduce(((e,[n,i])=>{const a="newRow"===n?i:cp(i,t);return{...e,[n]:a}}),{}):"string"==typeof e?vp(e,t):e}function hp(e,t,n,i={}){const a=n.productBaseComponents||n.components||[],r=n.productFeaturedComponents||a;return t.map((t=>{const n=t.featured?r:a,o=t.entitlements.map((e=>e.entitlement_ref_id)),s=ic(e.productDetails,t.sku_ref_id),l={freeTrialEligible:1==Dd("freeTrialEligible",s),introEligible:1==Dd("introEligible",s),promoEligible:1==Dd("promoEligible",s),invalid:Dd("invalid",s),unavailable:Dd("unavailable",s)},d={...t,...t.variables,...l,id:t.id,entitlements:o};!function(e,t){const n=e=>{for(const i of e)i.sku=mh(t),i.components&&n(i.components),i.collapseHeader&&i.collapseHeader.components&&n(i.collapseHeader.components)};n(e)}(n,t);const u={sku:d,media:gp(i,{convertToUrl:!0})};return[t.featured??!1,cp(n,cp(u,u))]}),[])}function mp(e,t){return t.assertions?t.assertions.every(pp.bind(null,e)):!!t.orAssertions&&(!t.orAssertions.length||t.orAssertions.some(pp.bind(null,e)))}function fp(e,t,n,i=null){const{manager:a,previousStepAvailable:r,nextStepAvailable:o}=e?.flow??{},s=e.state,l=Af(),d={isLaunched:!!a?.flowOpen,previousStepAvailable:!!r,nextStepAvailable:!!o};let u={};return i&&(u={block:i}),u={...u,state:s,urlParams:l,flow:d,launch:s.launch,sku:s.sku,customer:s.customer},"string"==typeof t&&t.includes(Ye)&&(t=vp(t,u)),t}function pp(e,{value:t,expected:n,operator:i},a){return t=fp(e,t,0,a),n=fp(e,n,0,a),"equals"===i?t===n:"notEquals"===i?t!==n:"contains"===i?(Array.isArray(t)||"string"==typeof t||t instanceof String||(t=t.toString()),"collapse"==n&&(n+="_"+e.getCurrentCollapsibleSku()?.skuId),t.includes(n)):"notContains"===i?(Array.isArray(t)||"string"==typeof t||t instanceof String||(t=t.toString()),!t.includes(n)):"set"===i?"boolean"==typeof n?!!t&&!t.toString().match(qe)===n:!!t&&!t.toString().match(qe):"notSet"===i?!t||t.toString().match(qe):"gt"===i?t>n:"gte"===i?t>=n:"lt"===i?t<n:"lte"===i&&t<=n}function gp(e,{convertToUrl:t}={convertToUrl:!1}){return Object.entries(e).reduce(((e,[n,{content:i}])=>(t&&"string"!=typeof i&&i&&(i=URL.createObjectURL(i)),{...e,[n]:i})),{})}function vp(e,t){let n=e;if("string"!=typeof e)return n;const i=new RegExp(Xe.source,Xe.flags),a=[];let r;for(;null!==(r=i.exec(e))&&(a.push(r),i.global);)r.index===i.lastIndex&&i.lastIndex++;for(const[i,r]of a){const a=vp(r,t);if(i===e)return o(i,a);a!==r&&(n=n.replace(r,a)),n=n.replace(Xe,o)}return n;function o(e,n){const i=String(n).split("."),a=i[0];if(!a)return e;const r=yp(t,a);if(void 0===r)return e;if("object"==typeof r&&null!==r&&0===Object.keys(r).length)return"";const o=yp(t,...i);return void 0===o?"":"string"!=typeof o?o:vp(o,t)}}function yp(e,...t){let n=e;for(const e of t){if(null==n)return;n=Array.isArray(n)?n[+e]:n[e]}return n}e.NamiPaywallAction=void 0,(lp=e.NamiPaywallAction||(e.NamiPaywallAction={})).BUY_SKU="BUY_SKU",lp.SELECT_SKU="SELECT_SKU",lp.RESTORE_PURCHASES="RESTORE_PURCHASES",lp.SIGN_IN="SIGN_IN",lp.CLOSE_PAYWALL="CLOSE_PAYWALL",lp.SHOW_PAYWALL="SHOW_PAYWALL",lp.PURCHASE_SELECTED_SKU="PURCHASE_SELECTED_SKU",lp.PURCHASE_SUCCESS="PURCHASE_SUCCESS",lp.PURCHASE_FAILED="PURCHASE_FAILED",lp.PURCHASE_CANCELLED="PURCHASE_CANCELLED",lp.PURCHASE_PENDING="PURCHASE_PENDING",lp.PURCHASE_UNKNOWN="PURCHASE_UNKNOWN",lp.PURCHASE_DEFERRED="PURCHASE_DEFERRED",lp.DEEPLINK="DEEPLINK",lp.TOGGLE_CHANGE="TOGGLE_CHANGE",lp.PAGE_CHANGE="PAGE_CHANGE",lp.SLIDE_CHANGE="SLIDE_CHANGE",lp.COLLAPSIBLE_DRAWER_OPEN="COLLAPSIBLE_DRAWER_OPEN",lp.COLLAPSIBLE_DRAWER_CLOSE="COLLAPSIBLE_DRAWER_CLOSE",lp.VIDEO_STARTED="VIDEO_STARTED",lp.VIDEO_PAUSED="VIDEO_PAUSED",lp.VIDEO_RESUMED="VIDEO_RESUMED",lp.VIDEO_ENDED="VIDEO_ENDED",lp.VIDEO_CHANGED="VIDEO_CHANGED",lp.VIDEO_MUTED="VIDEO_MUTED",lp.VIDEO_UNMUTED="VIDEO_UNMUTED",lp.COUNTDOWN_TIMER_COMPLETED="COUNTDOWN_TIMER_COMPLETED",lp.UNKNOWN="UNKNOWN",function(e){e.DEFAULT="default",e.LABEL="label",e.URL="url"}(dp||(dp={})),function(e){e.DEEPLINK="deeplink",e.IN_APP="in_app"}(up||(up={}));const bp=e=>{const t=e.state.timeSpentOnPaywall;if(t)return Date.now()-t},wp=e=>{if(!e)return null;if(e.includes("#"))return e;const t=e.match(/[\d.]+/g);if(!t||t.length<3)return null;const[n,i,a,r]=t.map(Number),o=e=>Math.round(e).toString(16).padStart(2,"0"),s=void 0!==r&&r<1?o(255*r):"";return`#${o(n)}${o(i)}${o(a)}${s}`},kp=(e,t)=>{if(!e||!t)return!0;const n=e?.includes("rgb")?wp(e):e,i=t?.includes("rgb")?wp(t):t;return n?.toLowerCase()===i?.toLowerCase()};class Sp{constructor(t,n,i="",a=""){this.playing=!0,this.toggling=!1,this.handleVideoEvents=t=>{this.video.onended=()=>{this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED)},this.video.onpause=()=>{this.toggling||this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_PAUSED)},this.video.onplay=()=>{this.toggling||this.handlePlayerAnalytics(t,this.video.currentTime>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.VIDEO_STARTED)},this.video.onvolumechange=()=>{this.toggling||(this.muted=!this.muted,this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED))}},this.removeVideoEvents=()=>{this.video&&(this.video.onended=null,this.video.onpause=null,this.video.onplay=null,this.video.onvolumechange=null,this.toggling=!1)},this.video=n??this.video,Sp.instance?.videoSrc&&n.src!=Sp.instance.videoSrc&&this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_CHANGED),this.videoSrc=n.src,this.video&&(this.muteByDefault=n.muted,this.loopVideo=n.loop,this.autoplayVideo=n.autoplay,this.muted=this.video.muted,this.videoComponentName=i,this.videoComponentId=a,this.playing=this.video.readyState>2?!(!(this.video.currentTime>0)||this.video.paused||this.video.ended):this.playing,this.handleVideoEvents(t))}togglePlayVideo(e){this.toggling=!0,this.playing?this.video.pause():this.video.play(),this.playing=!this.playing,this.handlePlayerAnalytics(e)}toggleMuteVideo(t){this.toggling=!0,this.video.muted=!this.video.muted,this.muted=this.video.muted,this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED)}videoPlayingAction(){return this.video?.currentTime<=0?e.NamiPaywallAction.VIDEO_STARTED:this.video.paused?e.NamiPaywallAction.VIDEO_PAUSED:this.video.ended?e.NamiPaywallAction.VIDEO_ENDED:this.video?.currentTime>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.UNKNOWN}handlePlayerAnalytics(e,t){if(!this.video)return;const n={id:this.videoComponentId,name:this.videoComponentName,url:this.video.src,loopVideo:this.loopVideo,muteByDefault:this.muteByDefault,autoplayVideo:this.autoplayVideo,contentDuration:this.video.duration/1e3,contentTimecode:this.video.currentTime/1e3};nd.getInstance().emit(Be,{action:t??this.videoPlayingAction(),videoMetaData:n,timeSpentOnPaywall:bp(e)})}}Sp.instance=null;const _p=({onTap:t,sku:n,componentChange:i,contextProvider:a}={})=>{let r,o=e.NamiPaywallAction.UNKNOWN;switch(t?.function){case Of:o=e.NamiPaywallAction.CLOSE_PAYWALL,r=bp(a),Mp(),Sp.instance?.handlePlayerAnalytics(a,e.NamiPaywallAction.VIDEO_ENDED);break;case $f:o=e.NamiPaywallAction.RESTORE_PURCHASES,Ep();break;case jf:o=e.NamiPaywallAction.SIGN_IN,Pp();break;case Gf:Tp(t.parameters?.url);break;case zf:n&&(o=e.NamiPaywallAction.BUY_SKU,n=xp(a,t,n));break;case Vf:o=e.NamiPaywallAction.PAGE_CHANGE,i={name:t?.parameters?.screen},Ap(a,t?.parameters?.screen);break;case Hf:o=e.NamiPaywallAction.TOGGLE_CHANGE,i=Cp(a,t?.parameters?.formId,t?.parameters?.value);break;case Bf:n&&(o=e.NamiPaywallAction.SELECT_SKU,Lp(a,n));break;case Uf:n&&(o=e.NamiPaywallAction.PURCHASE_SELECTED_SKU,Ip(a,n));break;case Xf:break;case ap:case rp:Sp.instance?.togglePlayVideo(a);break;case op:case sp:Sp.instance?.toggleMuteVideo(a)}o!==e.NamiPaywallAction.UNKNOWN&&nd.getInstance().emit(Be,{...a.getPaywallActionEventData(),action:o,sku:n,timeSpentOnPaywall:r,componentChange:i,purchaseError:undefined,purchases:undefined})},Mp=()=>{ca.clearLaunchId(),Dp(e.NamiPaywallManagerEvents.Close)||"undefined"==typeof window||window.history.back()},Ep=()=>{const t=Xs(A.THIRD_PARTY_TRANSACTIONS);Dp(e.NamiPaywallManagerEvents.Restore)||t||Ze.warn("NamiPaywallManager.registerRestoreHandler is not registered, so restore option on the paywall will use default behavior.")},Pp=()=>{Dp(e.NamiPaywallManagerEvents.SignIn)},Tp=t=>{t?Dp(e.NamiPaywallManagerEvents.DeeplinkAction,t)||"undefined"!=typeof window&&window.open(t,"_blank"):Ze.debug("Paywall deep link action invoked, but no url present.")},xp=(t,n,i)=>{const a=n.parameters?.promo,r=i;if(a)Ze.debug(`promo id is not null ${i?.id}`),r.promoId=a.toString();else{Ze.debug(`promo id is null for ${i.id}, product details: ${JSON.stringify(i.productDetails)}`);const e=i.productDetails;if(pd(e?.product_type)){const t=function(e){return e.offers.find((e=>"promo"===e.offer_type&&0===e.price))}(e);if(t&&t.offer_ref_id)Ze.debug(`Found a free trial offer ${t.offer_ref_id}`),r.promoId=t.offer_ref_id.toString();else{const t=e.offers[0];t&&(Ze.debug(`Found an offer ${t.offer_ref_id}`),r.promoId=t.offer_ref_id?.toString())}}}return function(t,n){if(Xs(A.THIRD_PARTY_TRANSACTIONS)){if(ca.setPurchaseImpression(),nd.getInstance().listenerCount(e.NamiPaywallManagerEvents.BuySku)<=0)return void Ze.warn("In order for Nami to hand off the purchase so the transaction can be handled by, you must register a NamiBuySkuHandler callbackwith NamiPaywallManager.registerBuySkuHandler.");Ze.info(`Handing off purchase for processing by developer skuId=${n.skuId} promoId=${n.promoId}`),Dp(e.NamiPaywallManagerEvents.BuySku,n)}else{const i=function(e){if(!Ys("NamiPurchaseManager.buySKU"))return;const t=ca.getCachedProducts(),n=t?.find((t=>t.sku_ref_id==e));return{success:!!n,billingResponseCode:n?0:-999}}(n.skuId);if(i&&(Ze.info(`Purchase flow completed, success=${i.success}, code=${i.billingResponseCode}, message=${i.message}`),i.success)){nd.getInstance().emit(Be,{action:e.NamiPaywallAction.CLOSE_PAYWALL,sku:n,timeSpentOnPaywall:bp(t)}),Sp.instance?.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED);const i=t.getSelectedCampaign();i&&i.conversion_event_type==up.IN_APP&&i.conversion_event_url?(ca.clearLaunchId(),window.location.href=i.conversion_event_url):Mp()}}}(t,r),r},Ap=(e,t)=>{t&&(window.history.state?.prevUrl==t?window.history.back():e.setCurrentPage(t))},Cp=(e,t,n)=>{if(t)return e.setCurrentFormId(t,n),{formId:t,value:n};{const t=e.getCurrentGroupId(),n=e.getCurrentGroupName();return e.setCurrentGroupData(t,n),{id:t,name:n}}},Lp=(e,t)=>{const n=e.getCurrentGroupId(),i=e.selectedProducts();n&&t.id!=i[n]&&(i[n]=t.id,e.setSelectedProducts(i))},Ip=(e,t)=>{e.setPurchase(!0,t)};function Dp(e,...t){const n=nd.getInstance();return n.emit(e,...t),n.listenerCount(e)>0}class Rp{constructor(e={}){this.id=e.id??"",this.name=e.name??"",this.steps=e.steps??[],this.screens=e.screens??[],this.resumeFromBookmark=Boolean(e.resume_from_bookmark),this.transition=e.transition??"none"}get allScreensAvailable(){return this.screens.length>0&&ol(this.screens)}}class Np extends Rp{constructor(e,t,n,i){super(e.flow.object??{}),this.stepcrumbs=[],this.branchcrumbs=[],this.activeHandoffSequence=null,this.currentScreenState=null,this.isPaused=!1,this.timerStates={},this.campaign=e,this.component=t,this.context=i,this.manager=n,this.branchcrumbs=[],this.stepcrumbs=[],this.registerResolvers(i);const a=this.findStepByType(Km);a&&this.forward(a.id)}registerResolvers(e){e&&new Ef(e),new Pf,new If,new Df,new Rf(this.campaign),_f.shared.registerNamespaceResolver("Flow",(e=>{switch(e){case"Flow.stepcrumbs":return this.stepcrumbs.map((e=>e.id));case"Flow.branchcrumbs":return this.branchcrumbs;default:return}}))}get currentFlowStep(){return this.stepcrumbs.at(-1)}get nextStepAvailable(){return void 0!==this.nextFlowStep}get previousStepAvailable(){const e=!!this.previousFlowStep,t=!1!==this.previousFlowStep?.allow_back_to,n=this.stepcrumbs.slice(0,-1).some((e=>"screen"===e.type));return e&&t&&n}get previousFlowStep(){const e=this.stepcrumbs.length-2;return e>=0?this.stepcrumbs[e]:void 0}get nextFlowStep(){return this.nextStep(this.currentFlowStep)}getStep(e){return this.steps.find((t=>t.id===e))}findStepByType(e){return this.steps.find((t=>t.type===e))}isStepActive(e){return!e.branch_tags||!e.branch_tags.length||e.branch_tags.some((e=>this.branchcrumbs.includes(e)))}flowLog(e,...t){Ph.instance.maxLogging&&Ze.debug(`[NamiFlow] ${e}`,...t)}finished(){this.flowLog(`finished() — closing flow, isPaused=${this.isPaused}, step=${this.currentFlowStep?.id}`),this.manager.finishFlow(),Mp()}back(){this.previousStepAvailable?this.backToPreviousScreenStep():Ze.debug("No previous step available")}next(){const e=this.nextFlowStep;e&&this.forward(e.id)}backToPreviousScreenStep(){if(!1!==this.previousFlowStep?.allow_back_to){for(let e=this.stepcrumbs.length-2;e>=0;e--){const t=this.stepcrumbs[e];if(this.stepcrumbs.pop(),"branch"===t.type&&this.branchcrumbs.length>0&&this.branchcrumbs.pop(),"screen"===t.type&&t.screen){const e=rl(t.screen);return e&&this.component.flowNavigateToScreen(e,{transition:this.transition,direction:"backward"}),void(this.currentScreenState=dh.currentProvider?.state??null)}}Ze.warn("No previous screen step found to return to")}else Ze.warn(`Not allowed to go back to ${this.previousFlowStep.id}`)}forward(e){const t=this.getStep(e);if(t)if(this.isStepActive(t))switch(this.flowLog(`forward(${e}) — type=${t.type}, name=${t.name}, isPaused=${this.isPaused}`),t.type){case Km:case Jm:return this.stepcrumbs.push(t),void this.executeLifecycle(t,nf);case qm:return void this.handleBranchStep(t);case Ym:return void this.handleScreenStep(t);case Qm:return}else this.flowLog(`forward(${e}) — step not active (branch_tags=${JSON.stringify(t.branch_tags)}, branchcrumbs=${JSON.stringify(this.branchcrumbs)})`);else Ze.error(`No step found with id: ${e}`)}pause(){this.isPaused?Ze.info("Flow is already paused"):(this.isPaused=!0,this.pausedStepID=this.currentFlowStep?.id,this.flowLog(`pause() — pausedStepID=${this.pausedStepID}`),Ze.info("Flow paused"))}resumeFromPause(){if(!this.isPaused)return void Ze.info("Flow is not paused");if(this.isPaused=!1,!this.pausedStepID)return void Ze.warn("No step to resume from");const e=this.pausedStepID;this.pausedStepID=void 0,this.flowLog(`resumeFromPause() — resuming from step ${e}`),Ze.info(`Flow resumed from step ${e}`),this.forward(e)}executeLifecycle(e,t,n){const i=e.actions[t];i?(this.flowLog(`executeLifecycle(${t}) — step=${e.id}, isPaused=${this.isPaused}, ${i.length} lifecycle(s)`),this.executeFullLifecycles(i,n)):this.flowLog(`executeLifecycle(${t}) — no actions on step ${e.id}`)}lifecycles(e){if(!this.currentFlowStep)return;const t=this.currentFlowStep.actions[e];if(t)return t;Ze.info(`No actions found for button ${e} on step ${this.currentFlowStep.id}`)}triggerActions(e,t,n){const i=this.lifecycles(e);i&&(this.flowLog(`triggerActions(${e}) — step=${this.currentFlowStep?.id}, isPaused=${this.isPaused}`),this.currentButton=t,this.executeFullLifecycles(i,n))}executeFullLifecycles(e,t){for(const n of e){const e=["before","action","after"];[n.before,n.action,n.after].forEach(((n,i)=>n?.forEach((n=>{const a=this.shouldRun(n);this.flowLog(` ${e[i]}: ${n.function}${n.id?` (${n.id})`:""} — shouldRun=${a}`),a&&this.performAction(n,t)}))))}}triggerBeforeActions(e,t,n){const i=this.lifecycles(e);if(i){this.currentButton=t;for(const e of i)e.before?.forEach((e=>this.shouldRun(e)&&this.performAction(e,n)))}}triggerAfterActions(e,t,n){const i=this.lifecycles(e);if(i){this.currentButton=t;for(const e of i)e.after?.forEach((e=>this.shouldRun(e)&&this.performAction(e,n)))}}currentStepHasHoistedPrimaryActions(e){const t=this.lifecycles(e);return!!t&&t.some((e=>e.action?.length))}shouldRun(e){if(!e.conditions)return!0;const t=e.conditions.every((e=>{const t=_f.shared.evaluate(e);if(Ph.instance.maxLogging){const n=e.filter?.map((e=>`${e.identifier} ${e.operator} ${JSON.stringify(e.values)}`)).join(", ")??"none";Ze.debug(`[NamiFlow] condition: [${n}] op=${e.operator??"default"} → ${t}`)}return t}));return t}performAction(e,t){if(!this.currentFlowStep)return void Ze.warn("No current flow step");const n=(e.parameters?.delay?+e.parameters.delay:0)||0;this.flowLog(`performAction(${e.function}) — step=${this.currentFlowStep.id}, delay=${n}, params=${JSON.stringify(e.parameters??{})}`);const i=n=>{if(this.currentFlowStep?.id===n)switch(e.function){case Zm.BACK:this.back();break;case Zm.NEXT:e.parameters?.step?this.forward(e.parameters.step):this.next();break;case Zm.NAVIGATE:e.parameters?.step?this.previousFlowStep?.id===e.parameters.step?this.back():this.forward(e.parameters.step):this.next();break;case Zm.FINISHED:case Zm.DISMISS:this.finished();break;case Zm.EXIT:{const e=this.steps.find((e=>e.type===Jm));e&&this.forward(e.id);break}case Zm.PAUSE:this.pause();break;case Zm.RESUME:this.resumeFromPause();break;case Zm.HANDOFF:if(e.parameters?.handoffTag)if(this.manager.handoffStepHandler)if(e.parameters.handoffData)Ze.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} ${JSON.stringify(e.parameters.handoffData)}`),this.manager.handoffStepHandler(e.parameters.handoffTag,e.parameters.handoffData);else if(t)Ze.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} ${JSON.stringify(t)}`),this.manager.handoffStepHandler(e.parameters.handoffTag,t);else if(e.parameters.handoffFormId){const t=this.getFormData();e.parameters.handoffTag===ef?this.flowHandoffFormSequence():this.manager.handoffStepHandler(e.parameters.handoffTag,t)}else Ze.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} and no data`),this.manager.handoffStepHandler(e.parameters.handoffTag);else Ze.debug("No handoffStepHandler found",e);break;case Zm.LOG:e.parameters?.eventName?Ze.info(`logEvent → ${e.parameters.eventName}`):Ze.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case Zm.TRACK:e.parameters?.eventName?Ze.info(`trackEvent → ${e.parameters.eventName}`):Ze.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case Zm.SET_VIDEO:e.parameters?.name&&e.parameters.url?dh.setAppSuppliedVideoDetails({name:e.parameters.name,url:e.parameters.url}):Ze.warn("Missing name, url for setting video details");break;case Zm.BLOCK_BACK:{const t=e.parameters?.step,n=t?this.getStep(t):void 0;n?n.allow_back_to=!1:this.currentFlowStep?this.currentFlowStep.allow_back_to=!1:Ze.warn("Missing step for blocking back");break}case Zm.FLOW_EVENT:{const t=new Lf(this.manager),n=Object.fromEntries(Object.entries(e.parameters??{}).map((([e,n])=>[e,t.interpolateDeep(n)])));this.manager.eventHandler?this.manager.eventHandler(n):Ze.warn("Missing event handler",n);break}case Zm.FLOW_ENABLED:dh.setUserInteractionEnabled(!0);break;case Zm.FLOW_DISABLED:dh.setUserInteractionEnabled(!1);break;case Zm.SET_TAGS:e.parameters&&(dh.setUserTags(e.parameters),Object.entries(e.parameters).forEach((([e,t])=>{Ff.setCustomerAttribute(e,t)})));break;default:Ze.warn(`Missing action handler for ${e.function}`,e)}else this.flowLog(`performAction(${e.function}) — SKIPPED stale step ${n}, current=${this.currentFlowStep?.id}`)};n?setTimeout(i.bind(this,this.currentFlowStep.id),n):i(this.currentFlowStep.id)}nextStep(e){if(!e)return void Ze.error("Next step not found");const t=this.steps.findIndex((t=>t.id===e.id));if(-1===t)return void Ze.error(`Could not find next step for step ${e.id}`);const n=this.steps.slice(t+1);for(const e of n){if(this.isStepActive(e))return e}Ze.debug(`No active next step found after ${e.id}`)}handleScreenStep(e){const t=rl(e.screen??"");e.screen&&t&&this.campaign?(this.stepcrumbs.push(e),this.component.flowNavigateToScreen(t,{transition:this.transition,direction:"forward"})):Ze.error("No paywall or campaign found for next step")}handleBranchStep(e){this.stepcrumbs.push(e);for(const[t,n]of Object.entries(e.actions))if(n)for(const e of n)if(e.action){for(const n of e.action)if(this.shouldRun(n))return this.branchcrumbs.push(t),e.before?.forEach((e=>{this.performAction(e)})),e.action.forEach((e=>{this.shouldRun(e)&&this.performAction(e)})),void e.after?.forEach((e=>{this.performAction(e)}))}else Ze.warn(`No actions defined for branch tag ${t}`);Ze.warn(`No matching branch condition matched for step ${e.id}`)}getFormData(){return{...dh.currentProvider?.state?.formStates??{}}}flowHandoffFormSequence(){const e=this.currentScreenState?.formStates;if(!e)return void Ze.warn("No formStates available for handoff sequence");const t=Object.keys(e).sort();if(0===t.length)return void Ze.warn("formStates is empty, no handoffs to perform");const n=t.filter((t=>!0===e[t]));if(0===n.length)return Ze.info("No eligible handoff keys after filtering"),void this.manager.resume();this.activeHandoffSequence={formStates:{...e},remainingKeys:[...n]},this.resumeNextHandoff()}resumeNextHandoff(){const e=this.activeHandoffSequence;if(!e)return Ze.warn("No active handoff sequence to resume"),void this.manager.resume();if(0===e.remainingKeys.length)return Ze.info("All handoffs in the sequence are complete"),this.activeHandoffSequence=null,void this.manager.resume();const t=e.remainingKeys.shift(),n=e.formStates[t];Ze.debug(`Starting handoff for ${t} → ${String(n)}`),this.activeHandoffSequence=e;const i=`${t}`;this.manager.handoffStepHandler?.(i,void 0)}}let Wp=class e{static get instance(){return e._instance||(e._instance=new e),e._instance}constructor(){this.flowOpen=!1,this.lastAnimatedFlowProgress=new Map,this.navGraphCache=new WeakMap}static registerStepHandoff(e){this.instance.handoffStepHandler=e}static registerEventHandler(e){this.instance.eventHandler=e}static resume(){const{flowOpen:t,currentFlow:n}=e.instance;if(Ph.instance.maxLogging&&Ze.debug(`[NamiFlowManager] resume() — flowOpen=${t}, hasFlow=${!!n}, currentStep=${n?.currentFlowStep?.id??"none"}, isPaused=${n?.isPaused??"N/A"}`),t&&n&&n.currentFlowStep){if(n.activeHandoffSequence)return Ze.debug(`Resuming flow at handoff sequence ${n.currentFlowStep.id}`),void n.resumeNextHandoff();Ze.debug(`Resuming flow at step ${n.currentFlowStep.id}`),n.executeLifecycle(n.currentFlowStep,"__resume__")}else Ze.warn("Cannot resume: no active flow or current step")}resume(){e.resume()}static finish(){const{flowOpen:t,currentFlow:n}=e.instance;t&&n&&n.currentFlowStep?(Ze.debug(`Finishing flow programmatically at step ${n.currentFlowStep.id}`),n.finished()):Ze.debug("Cannot finish: no active flow or current step")}static pause(){const{flowOpen:t,currentFlow:n}=e.instance;t&&n&&n.currentFlowStep?!0===n.resumeFromBookmark?n.pause():Ze.warn("This flow cannot be paused"):Ze.warn("Cannot pause: no active flow or current step")}static isFlowOpen(){return e.instance.flowOpen}presentFlow(e,t,n){const i=new Np(e,t,this,n);return this.flowOpen=!0,this.currentFlow=i,i}finishFlow(){Ph.instance.maxLogging&&Ze.debug("[NamiFlowManager] finishFlow() — closing flow"),this.flowOpen=!1,this.currentFlow=void 0,this.lastAnimatedFlowProgress.clear()}getLastAnimatedFlowProgress(e){return this.lastAnimatedFlowProgress.get(e)??0}setLastAnimatedFlowProgress(e,t){this.currentFlow&&this.lastAnimatedFlowProgress.set(e,t)}getCurrentFlowProgress(e){if(!this.currentFlow)return 1;if(!this.currentFlow.currentFlowStep)return 0;const t=this.currentFlow.steps.filter((e=>e.type===Ym));if(0===t.length)return 0;const n=this.currentFlow.stepcrumbs.filter((e=>e.type===Ym));if(0===n.length)return 0;const i=this.buildNavGraph(this.currentFlow),a=this.currentFlow.currentFlowStep,r=this.findBranchPoint(t,i);let o=0;if(r)o=this.calculateBranchingProgress(n,t,a,r,i);else{const e=t.findIndex((e=>e.id===a.id));o=e>=0?(e+1)/t.length:0}return o=Math.max(0,Math.min(1,o)),e&&this.setLastAnimatedFlowProgress(e,o),o}findBranchPoint(e,t){for(const n of e)if(this.hasBranching(n,e,t))return n;return null}calculateBranchingProgress(e,t,n,i,a){const r=e.length,o=t.findIndex((e=>e.id===i.id)),s=e.findIndex((e=>e.id===i.id)),l=t.findIndex((e=>e.id===n.id));if(-1===s||n.id===i.id)return(l+1)/(o+2);const d=this.countForwardScreens(n,t,a),u=r+d;return Ze.debug(`Branching progress: visited=${r}, remaining=${d}, total=${u}, step=${n.id}`),r/u}countForwardScreens(e,t,n){const i=t.findIndex((t=>t.id===e.id));if(-1===i)return 0;const a=new Set;let r=0;const o=(e,s)=>{if(a.has(e))return;a.add(e);const l=(n.get(e)||[]).filter((e=>{const n=t.findIndex((t=>t.id===e));return n>i}));if(0!==l.length)for(const e of l)o(e,s+1);else r=Math.max(r,s)};return o(e.id,0),r}hasBranching(e,t,n){const i=t.findIndex((t=>t.id===e.id));if(-1===i)return!1;const a=(n.get(e.id)||[]).filter((e=>{const n=t.findIndex((t=>t.id===e));return n>i}));return a.length>1}buildNavGraph(e){const t=this.navGraphCache.get(e);if(t)return t;const n=new Map;e.steps.forEach((e=>{e.actions&&Object.values(e.actions).forEach((t=>{Array.isArray(t)&&t.forEach((t=>{t.action&&t.action.forEach((t=>{if("flowNav"===t.function){const i=t.parameters?.step;i&&(n.has(e.id)||n.set(e.id,new Set),n.get(e.id).add(i))}}))}))}))}));const i=new Map;return n.forEach(((e,t)=>{i.set(t,Array.from(e))})),this.navGraphCache.set(e,i),i}static getLastAnimatedFlowProgress(e){return this.instance.getLastAnimatedFlowProgress(e)}static setLastAnimatedFlowProgress(e,t){this.instance.setLastAnimatedFlowProgress(e,t)}static getCurrentFlowProgress(e){return this.instance.getCurrentFlowProgress(e)}getCurrentFlowStepAutoAdvanceDelay(){const e=this.currentFlow?.currentFlowStep;if(!e)return null;const t=e.actions?.[af];if(!t)return null;for(const e of t){const t=e.action??[];for(const e of t)if((e.function===Zm.NAVIGATE||e.function===Zm.NEXT)&&null!=e.parameters?.delay){const t=e.parameters.delay,n=Number(t);if(!isNaN(n)&&n>0)return n/1e3}}return null}static getCurrentFlowStepAutoAdvanceDelay(){return this.instance.getCurrentFlowStepAutoAdvanceDelay()}};const Fp=2;let Op=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};const{I:$p}=Wm,jp=()=>document.createComment(""),zp=(e,t,n)=>{const i=e._$AA.parentNode,a=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=i.insertBefore(jp(),a),r=i.insertBefore(jp(),a);n=new $p(t,r,e,e.options)}else{const t=n._$AB.nextSibling,r=n._$AM,o=r!==e;if(o){let t;n._$AQ?.(e),n._$AM=e,void 0!==n._$AP&&(t=e._$AU)!==r._$AU&&n._$AP(t)}if(t!==a||o){let e=n._$AA;for(;e!==t;){const t=e.nextSibling;i.insertBefore(e,a),e=t}}}return n},Hp=(e,t,n=e)=>(e._$AI(t,n),e),Bp={},Up=e=>{e._$AR(),e._$AA.remove()},Gp=(e,t,n)=>{const i=new Map;for(let a=t;a<=n;a++)i.set(e[a],a);return i},Vp=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends Op{constructor(e){if(super(e),e.type!==Fp)throw Error("repeat() can only be used in text expressions")}dt(e,t,n){let i;void 0===n?n=t:void 0!==t&&(i=t);const a=[],r=[];let o=0;for(const t of e)a[o]=i?i(t,o):o,r[o]=n(t,o),o++;return{values:r,keys:a}}render(e,t,n){return this.dt(e,t,n).values}update(e,[t,n,i]){const a=(e=>e._$AH)(e),{values:r,keys:o}=this.dt(t,n,i);if(!Array.isArray(a))return this.ut=o,r;const s=this.ut??=[],l=[];let d,u,c=0,h=a.length-1,m=0,f=r.length-1;for(;c<=h&&m<=f;)if(null===a[c])c++;else if(null===a[h])h--;else if(s[c]===o[m])l[m]=Hp(a[c],r[m]),c++,m++;else if(s[h]===o[f])l[f]=Hp(a[h],r[f]),h--,f--;else if(s[c]===o[f])l[f]=Hp(a[c],r[f]),zp(e,l[f+1],a[c]),c++,f--;else if(s[h]===o[m])l[m]=Hp(a[h],r[m]),zp(e,a[c],a[h]),h--,m++;else if(void 0===d&&(d=Gp(o,m,f),u=Gp(s,c,h)),d.has(s[c]))if(d.has(s[h])){const t=u.get(o[m]),n=void 0!==t?a[t]:null;if(null===n){const t=zp(e,a[c]);Hp(t,r[m]),l[m]=t}else l[m]=Hp(n,r[m]),zp(e,a[c],n),a[t]=null;m++}else Up(a[h]),h--;else Up(a[c]),c++;for(;m<=f;){const t=zp(e,l[f+1]);Hp(t,r[m]),l[m++]=t}for(;c<=h;){const e=a[c++];null!==e&&Up(e)}return this.ut=o,((e,t=Bp)=>{e._$AH=t})(e,l),km}});const Xp=async e=>{const t=new Set(Array.from(document.fonts.values()).map((e=>e.family)));return e.forEach((e=>{const n=function(e){return t=`${e.family}-${e.style}`,t.replace(/ /g,"");var t}(e);if(t.has(n))return;const i=new FontFace(n,`url(${e.file})`);document.fonts.add(i)})),document.fonts.ready.then()};function Kp(e,t,n){if("undefined"==typeof window||!e||!t)return Ze.debug("Swipe detection is not supported in this environment."),{destroy(){},updateOptions(){}};const i={minDistance:n?.minDistance,maxDuration:n?.maxDuration??600,lockAxis:n?.lockAxis,preventScrollOnSwipe:n?.preventScrollOnSwipe,pointerTypes:n?.pointerTypes??["touch"],passiveListeners:n?.passiveListeners??!0,axisHint:n?.axisHint,edgeLeakThreshold:n?.edgeLeakThreshold},a=e.style.touchAction;i.preventScrollOnSwipe&&(e.style.touchAction="none");let r=null,o=0,s=0,l=0,d=0,u=0,c=null,h=null,m=!1,f=!1,p=!1;const g=e=>{try{const t=window.getComputedStyle(e);if(!t)return!1;const n=t.overflowY;if("auto"!==n&&"scroll"!==n)return!1;const i=e;return i.scrollHeight>i.clientHeight}catch{return!1}},v=e=>i.pointerTypes.includes(e.pointerType),y=t=>{const n=t.composedPath?t.composedPath()[0]:t.target;if(v(t)&&null===r){r=t.pointerId,o=l=t.clientX,s=d=t.clientY,u=performance.now(),c=null,p=!1,m=!1,f=!1,h="y"===i.axisHint?((e,t)=>{let n=e;for(;n&&n!==t&&n instanceof HTMLElement;){if(g(n))return n;n=n.parentElement||(n.parentNode?.host??null)}return null})(n,e):null,h||(f=!0);try{e?.setPointerCapture?.(t.pointerId)}catch{try{n?.setPointerCapture?.(t.pointerId)}catch{}}}},b=e=>{if(e.pointerId===r&&v(e)){if(l=e.clientX,d=e.clientY,i.lockAxis&&!c){const e=Math.abs(l-o),t=Math.abs(d-s);(e>2||t>2)&&(c=t>=e?"y":"x")}if("y"===i.axisHint&&("y"===c||!i.lockAxis)){const n=d-s,a=n<0?"up":"down",r=Math.abs(n),c=performance.now()-u,g=r/Math.max(c,1),v=r>=i.minDistance||g>.5;if(h)if(v)f=!0;else if(((e,t)=>!!e&&("down"===t?e.scrollTop>0:e.scrollTop+e.clientHeight<e.scrollHeight-1))(h,a)){if(!(("down"===a&&h.scrollTop<=50||"up"===a&&h.scrollTop+h.clientHeight>=h.scrollHeight-50)&&g>.3))return void(m=!0);f=!0}else f=!0;const y=!h||r>=i.edgeLeakThreshold;if(!p&&!m&&f&&y&&r>=i.minDistance){p=!0;const i=performance.now(),c={direction:"up"===a?"up":"down",distanceX:l-o,distanceY:n,absX:Math.abs(l-o),absY:r,duration:i-u,velocity:r/Math.max(i-u,1),startX:o,startY:s,endX:l,endY:d,startedAt:u,endedAt:i,originalEvent:e};t(c)}}}},w=e=>{if(e.pointerId!==r)return;if(!v(e))return void k();if(h)return void k();if(p||m)return void k();const n=performance.now(),a=n-u,g=l-o,y=d-s,b=Math.abs(g),w=Math.abs(y);let S;S=i.lockAxis&&c?c:"x"===i.axisHint?"x":"y"===i.axisHint?"y":b>=w?"x":"y";const _="x"===S?b:w,M=a<=i.maxDuration;let E=i.minDistance;h&&"y"===S&&f&&(E+=i.edgeLeakThreshold);if(M&&_>=E){let i;i="x"===S?g>0?"right":"left":y>0?"down":"up";const r=_/Math.max(a,1);t({direction:i,distanceX:g,distanceY:y,absX:b,absY:w,duration:a,velocity:r,startX:o,startY:s,endX:l,endY:d,startedAt:u,endedAt:n,originalEvent:e})}k()},k=()=>{r=null,c=null,u=0,h=null,f=!1,m=!1,p=!1},S=!!i.passiveListeners&&{passive:!0},_=i.passiveListeners?{passive:!0,capture:!0}:{capture:!0};e.addEventListener("pointerdown",y,_),e.addEventListener("pointermove",b,S),e.addEventListener("pointerup",w,S),e.addEventListener("pointercancel",w,S),e.addEventListener("lostpointercapture",w,S);return{destroy:()=>{e.removeEventListener("pointerdown",y,_),e.removeEventListener("pointermove",b,S),e.removeEventListener("pointerup",w,S),e.removeEventListener("pointercancel",w,S),e.removeEventListener("lostpointercapture",w,S),i.preventScrollOnSwipe&&(e.style.touchAction=a),k()},updateOptions:t=>{Object.assign(i,t),"boolean"==typeof t.preventScrollOnSwipe&&(t.preventScrollOnSwipe?e.style.touchAction="none":e.style.touchAction=a)}}}let Yp=class extends $m{constructor(e,t,n){return super(),this.pages=[],this.currentOffset=0,this.presentationStyle="fullscreen",this.formFactor=El(),this.timeSpentOnPaywall=0,this.animation={transition:"none",direction:"forward"},this._originalBodyStyles={},this._originalDocumentStyles={},this._savedScrollY=0,this._sheetDragStartY=0,this._sheetIsDragging=!1,this._dismissThreshold=100,this._stylesAlreadySaved=!1,this.type=e,this.value=t,this.context=n,this.setPaywallData(),this}setPaywallData(){const e=zl(this.value,this.type);this.paywall=e.paywall,this.campaign=e.campaign}getPresentationStyle(e){return(t=e?.template?.initialState?.presentationStyle??e?.template?.initialState?.presentation_style)&&Th.has(t)?t:"fullscreen";var t}get isHalfSheet(){return"compact_sheet"===this.presentationStyle}get isSheet(){return"sheet"===this.presentationStyle}get isOverlaySheet(){return this.isHalfSheet||this.isSheet}connectedCallback(){super.connectedCallback(),window.TVJS?.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=this),document.addEventListener("keydown",this.handleKeyDownEvent.bind(this)),this._swipeHandler=Kp(this,this.handleSwipeEvent.bind(this),{axisHint:"y",lockAxis:!0,minDistance:25,edgeLeakThreshold:15,preventScrollOnSwipe:!1,pointerTypes:["touch"]}),this.presentationStyle=this.getPresentationStyle(this.paywall),this.classList.toggle("nami-half-sheet-mode",this.isOverlaySheet),this.setOriginalStyles()}disconnectedCallback(){super.disconnectedCallback(),ca.clearLaunchId(),window.TVJS?.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=document.body),document.removeEventListener("keydown",this.handleKeyDownEvent.bind(this)),nd.getInstance().removeAllListeners(Be),this.restoreStyles(),this._halfSheetAbortController?.abort(),this._swipeHandler.destroy()}setOriginalStyles(){this._stylesAlreadySaved||(this._stylesAlreadySaved=!0,this._originalBodyStyles.background=document.body.style.background,this._originalBodyStyles.overflow=document.body.style.overflow||null,this._originalBodyStyles.position=document.body.style.position||null,this._originalBodyStyles.top=document.body.style.top||null,this._originalBodyStyles.width=document.body.style.width||null,"phone"===this.formFactor&&(this._originalBodyStyles["overscroll-behavior"]=document.body.style.overscrollBehavior||null,this._originalDocumentStyles["overscroll-behavior"]=document.documentElement.style.overscrollBehavior||null)),"television"===this.formFactor&&(document.body.style.overflow="hidden"),"phone"===this.formFactor&&(document.body.style.overscrollBehavior="none",document.documentElement.style.overscrollBehavior="none",this.isOverlaySheet||(document.body.style.overflow="hidden")),this.isOverlaySheet&&(this._savedScrollY=window.scrollY,document.body.style.position="fixed",document.body.style.top=`-${this._savedScrollY}px`,document.body.style.width="100%",document.body.style.overflow="hidden")}restoreStyles(){Object.entries(this._originalBodyStyles).forEach((([e,t])=>{null!==t?document.body.style.setProperty(e,t):document.body.style.removeProperty(e)})),Object.entries(this._originalDocumentStyles).forEach((([e,t])=>{null!==t?document.documentElement.style.setProperty(e,t):document.documentElement.style.removeProperty(e)})),this._savedScrollY>0&&(window.scrollTo(0,this._savedScrollY),this._savedScrollY=0)}handleKeyDownEvent(e){!this.flow||10009!==e.keyCode&&"Backspace"!==e.key&&"GoBack"!==e.key||this.flow.triggerActions(cf)}handleBackdropClick(e){if(e.stopPropagation(),this.flow){this.flow.currentStepHasHoistedPrimaryActions("__swipe_down__")??!1?this.flow.triggerActions("__swipe_down__"):this.animateSheetDismiss().then((()=>{this.flow?.finished(),Mp()}))}else this.animateSheetDismiss().then((()=>Mp()))}async animateSheetDismiss(){const e=this.shadowRoot?.querySelector(".nami-half-sheet-container"),t=this.shadowRoot?.querySelector(".nami-half-sheet-backdrop");e&&e.classList.add("nami-dismissing"),t&&t.classList.add("nami-dismissing"),await new Promise((e=>setTimeout(e,200)))}handleSwipeEvent({direction:e}){"down"===e?this.flow?.triggerActions("__swipe_down__"):"up"===e&&this.flow?.triggerActions("__swipe_up__")}setupHalfSheetDragTracking(){this._halfSheetAbortController?.abort(),this._halfSheetAbortController=new AbortController;const{signal:e}=this._halfSheetAbortController,t=this.shadowRoot?.querySelector(".nami-half-sheet-container"),n=this.shadowRoot?.querySelector(".nami-half-sheet-content");if(!t||!n)return;t.addEventListener("touchstart",(e=>{n.scrollTop>0||(this._sheetDragStartY=e.touches[0].clientY,this._sheetIsDragging=!0)}),{passive:!0,signal:e}),t.addEventListener("touchmove",(e=>{if(!this._sheetIsDragging)return;const n=e.touches[0].clientY-this._sheetDragStartY;n>0&&(t.style.transform=`translateY(${n}px)`,t.style.transition="none",e.preventDefault())}),{passive:!1,signal:e}),t.addEventListener("touchend",(()=>{if(!this._sheetIsDragging)return;this._sheetIsDragging=!1;const e=t.style.transform.match(/translateY\((\d+(?:\.\d+)?)px\)/);if((e?parseFloat(e[1]):0)>this._dismissThreshold){if(this.flow?.currentStepHasHoistedPrimaryActions("__swipe_down__")??!1)t.style.transform="translateY(0)",t.style.transition="transform 0.2s ease-out",this.flow?.triggerActions("__swipe_down__");else{t.style.transform="translateY(100%)",t.style.transition="transform 0.2s ease-in";const e=this.shadowRoot?.querySelector(".nami-half-sheet-backdrop");e&&e.classList.add("nami-dismissing"),setTimeout((()=>{this.flow?.finished()}),200)}}else t.style.transform="translateY(0)",t.style.transition="transform 0.2s ease-out"}),{signal:e})}setupHalfSheetFocusTrap(){const e=this.shadowRoot?.querySelector(".nami-half-sheet-container");if(!e)return;e.focus();const t=this._halfSheetAbortController?.signal;e.addEventListener("keydown",(t=>{if("Tab"!==t.key)return;const n=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0===n.length)return;const i=n[0],a=n[n.length-1];t.shiftKey?document.activeElement!==i&&this.shadowRoot?.activeElement!==i||(t.preventDefault(),a.focus()):document.activeElement!==a&&this.shadowRoot?.activeElement!==a||(t.preventDefault(),i.focus())}),t?{signal:t}:void 0)}firstUpdated(){this.timeSpentOnPaywall=Date.now(),el(this.campaign)&&(this.flow=Wp.instance.presentFlow(this.campaign,this,this.context)),this.isOverlaySheet&&this.updateComplete.then((()=>{this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap()}))}updated(e){if(super.updated(e),e.has("presentationStyle")){const t=e.get("presentationStyle"),n="compact_sheet"===t||"sheet"===t,i=this.isOverlaySheet;n!==i&&(this.restoreStyles(),this._stylesAlreadySaved=!1,this.setOriginalStyles()),i&&(this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap())}}getAnimationStyles(e){const t="backward"===this.animation.direction?-1:1;switch(this.animation.transition){case"verticalSlide":return`transform: translateY(${100*(e-this.currentOffset)*t}vh);`;case"slide":return`transform: translateX(${100*(e-this.currentOffset)*t}vw);`;case"fade":return`opacity: ${e===this.currentOffset?1:0};`;default:return""}}async updatePages(e){if(0===this.pages.length||"none"===this.animation.transition)return void(this.pages=[e]);const t=this.pages[this.pages.length-1];t?.id!==e.id&&(this.pages=[t,e],this.currentOffset=0,await this.updateComplete,requestAnimationFrame((()=>{this.currentOffset=1,setTimeout((()=>{this.pages=[e],this.currentOffset=0,this.paywall=e}),250)})))}async animateFullscreenEntry(){const e=this.shadowRoot?.querySelector(".nami-flow-container");e&&(e.style.transform="translateY(100%)",e.style.transition="none",e.offsetHeight,e.style.transition="transform 0.25s ease-out",e.style.transform="translateY(0)",await new Promise((e=>setTimeout(e,250))),e.style.transition="",e.style.transform="")}async animateFullscreenExitOverlay(e){const t=document.createElement("div");t.style.cssText=`\n position: fixed; inset: 0; z-index: 10000;\n background: ${e};\n transition: transform 0.25s ease-in;\n `,this.shadowRoot?.appendChild(t),t.offsetHeight,t.style.transform="translateY(100%)",await new Promise((e=>setTimeout(e,250))),t.remove()}async flowNavigateToScreen(e,t){this.flow?.previousFlowStep&&this.flow.executeLifecycle(this.flow.previousFlowStep,rf);const n=this.presentationStyle,i=this.getPresentationStyle(e),a=0===this.pages.length,r="backward"===t.direction;if("compact_sheet"!==n&&"sheet"!==n||"fullscreen"!==i)if("fullscreen"!==n||"compact_sheet"!==i&&"sheet"!==i)this.presentationStyle=i,this.classList.toggle("nami-half-sheet-mode",this.isOverlaySheet);else if(a||r)if(r){const e=document.body.style.background||getComputedStyle(this).backgroundColor||"#000";this.classList.add("nami-no-entrance"),this.presentationStyle=i,this.classList.toggle("nami-half-sheet-mode",this.isOverlaySheet),await this.updateComplete,await this.animateFullscreenExitOverlay(e),this.classList.remove("nami-no-entrance")}else this.presentationStyle=i,this.classList.toggle("nami-half-sheet-mode",this.isOverlaySheet);else console.warn(`Unsupported forward transition: fullscreen → ${i}. Presenting as fullscreen.`);else this.presentationStyle="fullscreen",this.classList.toggle("nami-half-sheet-mode",this.isOverlaySheet),await this.updateComplete,await this.animateFullscreenEntry();const o=!("compact_sheet"!==n&&"sheet"!==n||"compact_sheet"!==i&&"sheet"!==i||n===i)||("compact_sheet"===n||"sheet"===n)&&"fullscreen"===i||"fullscreen"===n&&("compact_sheet"===i||"sheet"===i);this.animation=o?{transition:"fade",direction:t.direction}:t,await this.updatePages(e),this.flow?.currentFlowStep&&this.flow.executeLifecycle(this.flow.currentFlowStep,af)}getSelectedSlideIndexForCurrentCarousel(){return dh.getSelectedSlideIndex()}renderFlow(){return"undefined"==typeof document?bm``:this.isOverlaySheet?this.renderHalfSheet():bm`
92
121
  <div class="nami-flow-container">
93
122
  ${Vp(this.pages,(e=>e.id),((e,t)=>{const n=this.getAnimationStyles(t);return bm`
94
123
  <div class="nami-screen" style="${n} z-index: ${2-t}">${this.renderPaywall(e)}</div>
95
124
  `}))}
96
125
  </div>
97
126
  `}renderHalfSheet(){return"undefined"==typeof document?bm``:bm`
98
- <div class="nami-half-sheet-backdrop"></div>
127
+ <div class="nami-half-sheet-backdrop" @click=${this.handleBackdropClick}></div>
99
128
  <div
100
- class="nami-half-sheet-container"
129
+ class="nami-half-sheet-container ${this.isSheet?"nami-sheet-full":""}"
101
130
  role="dialog"
102
131
  aria-modal="true"
103
132
  aria-label="${this.paywall?.name||"Nami page"}"
@@ -119,13 +148,34 @@
119
148
  .timeSpentOnPaywall=${this.timeSpentOnPaywall}
120
149
  .flow=${this.flow}
121
150
  ></nami-paywall-screen>
122
- `}render(){return Xm(this.paywall)&&0===this.pages.length?bm``:el(this.campaign)?this.renderFlow():this.renderPaywall(this.paywall)}};var qp;Yp.styles=[zm,Nh`
151
+ `}render(){return Xm(this.paywall)&&0===this.pages.length?bm``:el(this.campaign)?this.renderFlow():this.isOverlaySheet?bm`
152
+ <div class="nami-half-sheet-backdrop" @click=${this.handleBackdropClick}></div>
153
+ <div
154
+ class="nami-half-sheet-container ${this.isSheet?"nami-sheet-full":""}"
155
+ role="dialog"
156
+ aria-modal="true"
157
+ aria-label="${this.paywall?.name||"Nami page"}"
158
+ tabindex="-1"
159
+ >
160
+ <div class="nami-half-sheet-content">
161
+ ${this.renderPaywall(this.paywall)}
162
+ </div>
163
+ </div>
164
+ `:this.renderPaywall(this.paywall)}};var qp;Yp.styles=[zm,Nh`
123
165
  :host {
124
166
  box-sizing: border-box;
125
167
  width: 100%;
126
168
  height: 100vh;
127
169
  height: 100dvh;
128
170
  display: block;
171
+ position: fixed;
172
+ inset: 0;
173
+ z-index: 9998;
174
+ }
175
+ :host(.nami-half-sheet-mode) {
176
+ height: auto;
177
+ background: transparent;
178
+ --nami-bg-position: absolute;
129
179
  }
130
180
  :host(.nami-disabled) {
131
181
  pointer-events: none;
@@ -264,7 +314,7 @@
264
314
  `}render(){return this.renderSvgIcon(this.shouldRenderCurrentIcon()?this.component.name:this.previousSymbolName)}};T([Gm({type:Object})],qx.prototype,"component",void 0),T([Gm({type:Boolean})],qx.prototype,"inFocusedState",void 0),T([Gm({type:Number})],qx.prototype,"scaleFactor",void 0),qx=T([Hm("nami-symbol")],qx);let Jx=class extends vg{constructor(){super(...arguments),this.inFocusedState=!1,this.scaleFactor=1}styles(){const{component:e,scaleFactor:t,inFocusedState:n}=this,{hidden:i,fontSize:a,alignment:r,strikethrough:o,spacing:s}=e;return Rh(`\n :host {\n line-height: ${Vx(a,t)}px;\n display: ${i?"none":"grid"};\n overflow-wrap: anywhere;\n width: fit-content;\n ${Rg(e,n)}\n ${Xx(e,n)}\n font-size: ${(a??Gx)*t}px;\n text-align: ${r||"center"};\n ${Gg("string"!=typeof o&&o)}\n ${Vg(e.fontName)}\n ${Xg(e,t,n)}\n ${Ux(e)}\n ${Ng(e)}\n ${function({alignment:e,horizontalAlignment:t}){let n;return n=t&&wg[t]?wg[t]:e&&wg[e]?wg[e]:"center",Sg("justify-content",n)}(e)}\n }\n :host > :not(:first-child) {\n margin-top: ${s||0}px;\n }\n .anticon {\n text-rendering: optimizelegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n color: inherit;\n display: inline-block;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -.125em;\n }\n .anticon svg {\n display: inline-block;\n line-height: 1;\n }\n\n :host .bullet-text-wrapper {\n line-height: ${Vx(a,t)}px;\n display: inline;\n overflow-wrap: anywhere;\n width: fit-content;\n ${Rg(e,n)}\n ${Xx(e,n)}\n font-size: ${(a??Gx)*t}px;\n text-align: ${r||"center"};\n ${Gg("string"!=typeof o&&o)}\n ${Vg(e.fontName)}\n }\n ${Ux(e,":host .bullet-text-wrapper")}\n :host .bullet-text-wrapper p {\n margin: 0;\n line-height: ${Vx(a,t)}px;\n }\n `)}render(){const{fontColor:e,fontSize:t,activeFontColor:n,bulletComponent:i,texts:a,spacing:r}=this.component,o=i?{fontColor:e,fontSize:t,activeFontColor:n,spacing:r,...i}:null;if(!Array.isArray(a))return bm``;const s=a.map((e=>e?bm`<nami-text-list-item-wrapper .component=${this.component} .scaleFactor=${this.scaleFactor}>
265
315
  ${o&&bm`<nami-symbol .component=${o} .scaleFactor=${this.scaleFactor}></nami-symbol>`}
266
316
  <div class="bullet-text-wrapper" .innerHTML="${fy(e)}"></div>
267
- </nami-text-list-item-wrapper>`:null));return bm`${s}`}};T([Gm({type:Object})],Jx.prototype,"component",void 0),T([Gm({type:Boolean})],Jx.prototype,"inFocusedState",void 0),T([Gm({type:Number})],Jx.prototype,"scaleFactor",void 0),Jx=T([Hm("nami-text-list")],Jx);(()=>{let e=!0;try{new RegExp("􏿿","u"),new RegExp("😀","u"),new RegExp("\\p{P}","u")}catch{e=!1}if(e)return;const t=fy.Lexer?.rules,n=t?.inline;n&&Object.values(n).forEach((e=>{e&&Object.keys(e).forEach((t=>{e[t]=(e=>{if(!(e instanceof RegExp))return e;if(!/\\p\{/.test(e.source))return e;const t="!\"#$%&'()*+,\\-./:;<=>?@[\\\\]^_`{|}~",n=e.source.replace(/\\p\{P\}\\p\{S\}/g,t).replace(/\\p\{P\}/g,t).replace(/\\p\{S\}/g,t),i=e.flags.replace(/u/g,"");return new RegExp(n,i)})(e[t])}))}))})();let Qx=class extends vg{constructor(){super(),this.inFocusedState=!1,this.scaleFactor=1,this.handleFocusIn=()=>this.setFocusState(!0),this.handleFocusOut=e=>{const t=e.relatedTarget??null;if(!t)return this.setFocusState(!1);t===this||this.shadowRoot?.contains(t)||this.setFocusState(!1)},this.handleFocusChanged=e=>{const{detail:t}=e;this.setFocusState(!0===t?.inFocusedState)},this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),this.addEventListener("focus-changed",this.handleFocusChanged)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focusin",this.handleFocusIn),this.removeEventListener("focusout",this.handleFocusOut),this.removeEventListener("focus-changed",this.handleFocusChanged)}styles(){const{component:e,scaleFactor:t,minSDKVersion:n}=this,{backgroundBlur:i}=e,a="vertical"===e.direction,r=a?"width":"height",o=a?"margin-top":"margin-left",s=e.fillImage?Rh(`\n line-height: 1.5715;\n background-image: url(${e.fillImage});\n background-position: center;\n background-repeat: no-repeat;\n background-size: cover;\n height: 100%;\n width: 100%;\n `):Rh(Rg(e,!1));return Rh(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n ${i?`backdrop-filter: blur(${i}px);`:""}\n ${s};\n ${Yg(e.position)}\n ${Ng(e)}\n ${Xg(e,t,!1)}\n }\n :host(:focus),\n :host(.nami-focus-within){\n ${Rg(e,!0)}\n ${Xg(e,t,!0)}\n }\n :host(:focus-visible){\n ${Zg(e)}\n }\n :host > * {\n ${Fg(n,r)}\n }\n :host > *:not(:first-child) {\n ${o}: ${e.spacing?e.spacing*t:0}px;\n }\n `)}render(){return(this.component.components??[]).map((e=>tv(this.contextProvider,e,this.scaleFactor,void 0,this.minSDKVersion)))}setFocusState(e){this.inFocusedState!==e&&(this.inFocusedState=e,this.classList.toggle("nami-focus-within",e),this.toggleAttribute("data-nami-focused",e))}};T([Gm({type:Object})],Qx.prototype,"component",void 0),T([Gm({type:Boolean})],Qx.prototype,"inFocusedState",void 0),T([Gm({type:Number})],Qx.prototype,"scaleFactor",void 0),T([Gm({type:Object})],Qx.prototype,"minSDKVersion",void 0),Qx=T([Hm("nami-container")],Qx);let Zx=class extends vg{constructor(){super(...arguments),this.inFocusedState=!1,this.scaleFactor=1}styles(){const{backgroundBlur:e}=this.component,t="vertical"===this.component.direction,n=t?"width":"height",i=t?"margin-top":"margin-left",a=this.component.fillImage?Rh(`\n line-height: 1.5715;\n background-image: url(${this.component.fillImage});\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n `):Rh(Rg(this.component,!1));return Rh(`\n :host {\n opacity: 0;\n display: ${this.component.hidden?"none":"flex"};\n ${a};\n ${e?`backdrop-filter: blur(${e}px);`:""}\n ${Yg(this.component.position)}\n ${Ng(this.component)}\n ${Xg(this.component,this.scaleFactor,!1)}\n transition: transform .5s ease-in;\n }\n :host > *:not(:first-child) {\n ${i}: ${this.component.spacing?this.component.spacing*this.scaleFactor:0}px;\n }\n :host(:focus){\n ${Rg(this.component,!0)}\n ${Xg(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${Zg(this.component)}\n }\n :host > * {\n ${n}: 100%;\n }\n :host(.fade-in){\n opacity: 1;\n animation: fadeIn 0.5s ease-in\n }\n @keyframes fadeIn {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n }\n `)}updated(){const{currentGroupId:e}=this.contextProvider.state;ad(e,this.currentGroupId)||(this.classList.remove("fade-in"),setTimeout((()=>this.classList.add("fade-in")),100),this.currentGroupId=e)}render(){const{mediaList:e,currentGroupId:t,selectedPaywall:n,formFactor:i}=this.contextProvider.state,a=Ju(this.contextProvider.productDetails,n?.sku_menus??[],this.component?.subsetGroup||t);return hp(this.contextProvider,a,this.component,e).map((([e,t])=>(this.inFocusedState="television"==i?e:this.inFocusedState,t.map((e=>tv(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion))))))}};T([Gm({type:Object})],Zx.prototype,"component",void 0),T([Gm({type:Boolean})],Zx.prototype,"inFocusedState",void 0),T([Gm({type:Number})],Zx.prototype,"scaleFactor",void 0),T([Gm({type:Object})],Zx.prototype,"minSDKVersion",void 0),Zx=T([Hm("nami-product-container")],Zx);let eA=class extends vg{constructor(){super(...arguments),this.inFocusedState=!1,this.scaleFactor=1}styles(){const{imageCropping:e,alignment:t,height:n,width:i,rightMargin:a,spacing:r,hidden:o,blur:s}=this.component,l="fit"===e,{formFactor:d}=this.contextConsumer.state;return Rh(`\n :host {\n display: ${"television"===d?"flex":"inline-block"};\n ${o?"display:none;":""}\n position: relative;\n height: ${Cg(n??"100%",this.scaleFactor)};\n width: ${Cg(("fitContent"==i?n:i)??"100%",this.scaleFactor)};\n }\n :host img {\n transition: all 0.3s;\n object-fit: ${l?"contain":"cover"};\n object-position: ${t} center;\n height: ${Cg(n??"100%",this.scaleFactor)};\n width: ${Cg(("fitContent"==i?n:i)??"100%",this.scaleFactor)};\n margin-right: ${a||r||0}px;\n ${s?`filter: blur(${s}px);`:""}\n flex-shrink: ${"number"==typeof i?0:1};\n }\n `)}render(){const{url:e,alt:t,title:n,focusedBorderColor:i,focusedFillColor:a,fillColor:r}=this.component;return e?(!i&&kp(r,a)||(this.tabIndex=0),this.ariaLabel=t??n??"",bm`<img src="${e}" alt="${this.ariaLabel}" />`):(this.tabIndex=-1,this.ariaLabel=null,bm``)}};T([Gm({type:Object})],eA.prototype,"component",void 0),T([Gm({type:Boolean})],eA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],eA.prototype,"scaleFactor",void 0),eA=T([Hm("nami-image")],eA);let tA=class extends vg{constructor(){super(...arguments),this.fullscreen=!1,this.inFocusedState=!1,this.scaleFactor=1}connectedCallback(){super.connectedCallback(),document.body.style.background=this.component.fillColor||"transparent"}styles(){if(!this.contextConsumer||!this.component)return Rh("");const{component:e,scaleFactor:t}=this,{formFactor:n}=this.contextConsumer.state,{backgroundBlur:i}=e,a="vertical"===e.direction?"margin-top":"margin-left";return Rh(`\n :host {\n max-height: ${"television"===n?"100vh":""};\n display: ${e.hidden?"none":"flex"};\n flex-direction: column;\n overflow: hidden;\n ${Wg(e)}\n position: fixed;\n width: 100%;\n bottom: 0px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n z-index: ${e.zIndex??1};\n top: 0px;\n ${i?`backdrop-filter: blur(${i}px);`:""}\n ${Rg(e,!1)}\n transition: all 0.3s;\n ${$g(e,t)}\n }\n :host(:focus){\n ${Rg(e,!0)}\n }\n :host > *:not(:first-child) {\n ${a}: ${e.spacing?e.spacing*t:0}px;\n }\n `)}updated(){const e=Array.from(document.getElementsByTagName("nami-paywall")),t=this.component.fillColor?.includes("gradient"),n=this.shadowRoot?.innerHTML.includes("nami-image");e[0]&&(e[0].style.position=!n||t?"relative":"","undefined"!=typeof window&&"undefined"!=typeof CSS&&CSS.supports("height: 100dvh")?e[0].style.minHeight=!n||t?"100dvh":"100%":e[0].style.minHeight=!n||t?"100vh":"100%")}render(){return(this.component.components??[]).map((e=>tv(this.contextProvider,e,this.scaleFactor,void 0,this.minSDKVersion)))}};T([Gm({type:Object})],tA.prototype,"component",void 0),T([Gm({type:Boolean})],tA.prototype,"fullscreen",void 0),T([Gm({type:Boolean})],tA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],tA.prototype,"scaleFactor",void 0),T([Gm({type:Object})],tA.prototype,"minSDKVersion",void 0),tA=T([Hm("nami-background-container")],tA);let nA=class extends vg{constructor(){super(...arguments),this.zIndex=2,this.inFocusedState=!1,this.scaleFactor=1}styles(){const{contextConsumer:e,component:t,zIndex:n,scaleFactor:i}=this;if(!e)return Nh``;const{formFactor:a}=e.state,{backgroundBlur:r}=t,o="phone"!==a?"width: 100%;":"",s=t.width??t.fixedWidth,l="phone"===a?"max-width:100%; "+(void 0!==s?`width: ${Cg(s,i)};`:""):Hg(t,i),d="vertical"===t.direction?"margin-top":"margin-left";return Rh(`\n :host {\n box-sizing: border-box;\n display: ${t.hidden?"none":"flex"};\n position: relative;\n flex: 1;\n min-height: 0;\n ${Ng(t)}\n ${l}\n ${o}\n align-items: center;\n justify-content: flex-start;\n justify-content: start;\n ${r?`backdrop-filter: blur(${r}px);`:""}\n z-index: ${n};\n transition: all 0.3s;\n overflow-y: ${"television"===a?"hidden":"scroll"};\n overflow-x: hidden;\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n ${$g(t,i)}\n ${Rg(t,!1)}\n }\n :host::-webkit-scrollbar {\n display: none;\n }\n :host(:focus){\n ${Rg(t,!0)}\n }\n :host > * {\n width: 100%;\n }\n :host > *:not(:first-child) {\n ${d}: ${t.spacing?t.spacing*i:0}px;\n }\n `)}firstUpdated(){const e=new CustomEvent("child-spacing",{detail:{spacing:this.component.spacing},bubbles:!0,composed:!0});this.dispatchEvent(e)}render(){return this.component.components?.map((e=>tv(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)))||[]}};T([Gm({type:Object})],nA.prototype,"component",void 0),T([Gm({type:Number})],nA.prototype,"zIndex",void 0),T([Gm({type:Boolean})],nA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],nA.prototype,"scaleFactor",void 0),T([Gm({type:Object})],nA.prototype,"minSDKVersion",void 0),nA=T([Hm("nami-content-container")],nA);let iA=class extends vg{constructor(){super(),this.inFocusedState=!1,this.scaleFactor=1,this._handleClick=e=>{e.preventDefault(),_p({contextProvider:this.contextProvider,onTap:this.component.onTap})},this.addEventListener("click",this._handleClick)}styles(){const e=qg("active",this.component.components[0]),t=qg("inactive",this.component.components[0]);return Rh(`\n :host {\n box-sizing: border-box;\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n display: flex;\n flex: 0 0 auto;\n position: relative;\n ${Ng(this.component)}\n ${Rg(this.component,!1)}\n ${Xg(this.component,this.scaleFactor,!1)}\n ${this.component.hidden?"display:none;":""}\n }\n :host(:focus){\n ${Rg(this.component,!0)}\n ${Xg(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${Zg(this.component)}\n }\n .toggle{\n ${n=this.component,i=this.scaleFactor,`\n position: absolute;\n top: ${Ag(i,n.topPadding)}px;\n bottom: ${Ag(i,n.bottomPadding)}px;\n width: calc(50% - ${Ag(i,n.leftPadding)/2}px) !important;\n `}\n transition: transform .5s cubic-bezier(.77, 0, .175, 1);\n ${Jg(t,this.scaleFactor,!1)}\n }\n\n :host(:focus) .toggle{\n ${Jg(e,this.scaleFactor,!0)}\n }\n \n nami-segment-picker-item:nth-of-type(1).active~.toggle {\n transform: translateX(0%);\n left: ${this.component.leftPadding?Number(this.component.leftPadding)*this.scaleFactor:0}px;\n ${Rg(e,!0)}\n ${Qg(e,this.scaleFactor)}\n }\n\n nami-segment-picker-item:nth-of-type(2).active~.toggle {\n transform: translateX(100%);\n right: ${this.component.rightPadding?Number(this.component.rightPadding)*this.scaleFactor:0}px;\n ${Rg(e,!0)}\n ${Qg(e,this.scaleFactor)}\n `);var n,i}render(){this.role="tablist";const e=this.component.components.map((e=>tv(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)));return bm`${e}<div class="toggle"></div>`}};T([Gm({type:Object})],iA.prototype,"component",void 0),T([Gm({type:Boolean})],iA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],iA.prototype,"scaleFactor",void 0),T([Gm({type:Object})],iA.prototype,"minSDKVersion",void 0),iA=T([Hm("nami-segment-picker")],iA);let aA=class extends vg{constructor(){super(...arguments),this.inFocusedState=!1,this.scaleFactor=1,this._handleFocus=()=>{this.inFocusedState=!0,this._announceButtonLabel()},this._handleKeyDown=e=>{"Enter"!==e.key&&" "!==e.key||this._handleClick()},this._handleClick=()=>{this._updateFormState(),this.requestUpdate("component")},this._handleHover=()=>{this.inFocusedState=!0}}connectedCallback(){super.connectedCallback(),this._isActive=!!this.component.checked,this.classList.toggle("active",this._isActive),this.component.formId&&this._updateFormState(),this.addEventListener("click",this._handleClick),this.addEventListener("mouseover",this._handleHover),this.addEventListener("keydown",this._handleKeyDown),this.addEventListener("focus",this._handleFocus)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleClick),this.removeEventListener("mouseover",this._handleHover),this.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("focus",this._handleFocus)}_announceButtonLabel(){const e=this.component.text||"";e&&Mh(e)}_getParentPicker(){const e=this.getRootNode();return e instanceof ShadowRoot?e.host:null}_getParentFormId(){return this._getParentPicker()?.component.formId}_updateFormState(){if(this.contextProvider)if(this.component.formId){const e=this._getParentFormId();e&&this.contextProvider.setFormState(e,this.component.formId)}else this.component.id&&this.contextProvider.setCurrentGroupData(this.component.id,this.component.text||"")}updated(e){if(!e.has("component"))return;if(!this.contextProvider)return;const t=e.get("component")??this.component;if(t.formId){const e=this._getParentFormId();e&&this.contextProvider.state.formStates[e]&&(this._isActive=this.contextProvider.state.formStates[e]===t.formId)}else this._isActive=ad(t.id,this.contextProvider.state.currentGroupId);if(this.classList.toggle("active",this._isActive),!this._isActive)return;const n=this.getRootNode();if(!(n instanceof ShadowRoot))return;n.querySelectorAll("nami-segment-picker-item").forEach((e=>{e!==this&&e.requestUpdate("component",e)}))}styles(){const e=qg("active",this.component),t=qg("inactive",this.component);return Rh(`\n :host {\n box-sizing: border-box;\n display: ${this.component.hidden?"none":"inline-flex"};\n position: relative;\n ${Jg({...t,...this.component},this.scaleFactor,this.inFocusedState)}\n ${Ug(this.component.inactiveDropShadow??this.component.dropShadow)}\n }\n\n :host > * {\n cursor: pointer;\n }\n\n :host(.active) {\n z-index: 1 !important;\n ${Qg({...e,...this.component},this.scaleFactor)}\n ${Ug(this.component.activeDropShadow??this.component.dropShadow)}\n }\n\n input {\n visibility: hidden;\n position: absolute;\n top: 0;\n }\n `)}render(){return this.tabIndex=0,this.role="tab",this.ariaSelected=`${this._isActive}`,this.ariaLabel=this.component.text||"",bm`<input type="radio"
317
+ </nami-text-list-item-wrapper>`:null));return bm`${s}`}};T([Gm({type:Object})],Jx.prototype,"component",void 0),T([Gm({type:Boolean})],Jx.prototype,"inFocusedState",void 0),T([Gm({type:Number})],Jx.prototype,"scaleFactor",void 0),Jx=T([Hm("nami-text-list")],Jx);(()=>{let e=!0;try{new RegExp("􏿿","u"),new RegExp("😀","u"),new RegExp("\\p{P}","u")}catch{e=!1}if(e)return;const t=fy.Lexer?.rules,n=t?.inline;n&&Object.values(n).forEach((e=>{e&&Object.keys(e).forEach((t=>{e[t]=(e=>{if(!(e instanceof RegExp))return e;if(!/\\p\{/.test(e.source))return e;const t="!\"#$%&'()*+,\\-./:;<=>?@[\\\\]^_`{|}~",n=e.source.replace(/\\p\{P\}\\p\{S\}/g,t).replace(/\\p\{P\}/g,t).replace(/\\p\{S\}/g,t),i=e.flags.replace(/u/g,"");return new RegExp(n,i)})(e[t])}))}))})();let Qx=class extends vg{constructor(){super(),this.inFocusedState=!1,this.scaleFactor=1,this.handleFocusIn=()=>this.setFocusState(!0),this.handleFocusOut=e=>{const t=e.relatedTarget??null;if(!t)return this.setFocusState(!1);t===this||this.shadowRoot?.contains(t)||this.setFocusState(!1)},this.handleFocusChanged=e=>{const{detail:t}=e;this.setFocusState(!0===t?.inFocusedState)},this.addEventListener("focusin",this.handleFocusIn),this.addEventListener("focusout",this.handleFocusOut),this.addEventListener("focus-changed",this.handleFocusChanged)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focusin",this.handleFocusIn),this.removeEventListener("focusout",this.handleFocusOut),this.removeEventListener("focus-changed",this.handleFocusChanged)}styles(){const{component:e,scaleFactor:t,minSDKVersion:n}=this,{backgroundBlur:i}=e,a="vertical"===e.direction,r=a?"width":"height",o=a?"margin-top":"margin-left",s=e.fillImage?Rh(`\n line-height: 1.5715;\n background-image: url(${e.fillImage});\n background-position: center;\n background-repeat: no-repeat;\n background-size: cover;\n height: 100%;\n width: 100%;\n `):Rh(Rg(e,!1));return Rh(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n ${i?`backdrop-filter: blur(${i}px);`:""}\n ${s};\n ${Yg(e.position)}\n ${Ng(e)}\n ${Xg(e,t,!1)}\n }\n :host(:focus),\n :host(.nami-focus-within){\n ${Rg(e,!0)}\n ${Xg(e,t,!0)}\n }\n :host(:focus-visible){\n ${Zg(e)}\n }\n :host > * {\n ${Fg(n,r)}\n }\n :host > *:not(:first-child) {\n ${o}: ${e.spacing?e.spacing*t:0}px;\n }\n `)}render(){return(this.component.components??[]).map((e=>tv(this.contextProvider,e,this.scaleFactor,void 0,this.minSDKVersion)))}setFocusState(e){this.inFocusedState!==e&&(this.inFocusedState=e,this.classList.toggle("nami-focus-within",e),this.toggleAttribute("data-nami-focused",e))}};T([Gm({type:Object})],Qx.prototype,"component",void 0),T([Gm({type:Boolean})],Qx.prototype,"inFocusedState",void 0),T([Gm({type:Number})],Qx.prototype,"scaleFactor",void 0),T([Gm({type:Object})],Qx.prototype,"minSDKVersion",void 0),Qx=T([Hm("nami-container")],Qx);let Zx=class extends vg{constructor(){super(...arguments),this.inFocusedState=!1,this.scaleFactor=1}styles(){const{backgroundBlur:e}=this.component,t="vertical"===this.component.direction,n=t?"width":"height",i=t?"margin-top":"margin-left",a=this.component.fillImage?Rh(`\n line-height: 1.5715;\n background-image: url(${this.component.fillImage});\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n `):Rh(Rg(this.component,!1));return Rh(`\n :host {\n opacity: 0;\n display: ${this.component.hidden?"none":"flex"};\n ${a};\n ${e?`backdrop-filter: blur(${e}px);`:""}\n ${Yg(this.component.position)}\n ${Ng(this.component)}\n ${Xg(this.component,this.scaleFactor,!1)}\n transition: transform .5s ease-in;\n }\n :host > *:not(:first-child) {\n ${i}: ${this.component.spacing?this.component.spacing*this.scaleFactor:0}px;\n }\n :host(:focus){\n ${Rg(this.component,!0)}\n ${Xg(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${Zg(this.component)}\n }\n :host > * {\n ${n}: 100%;\n }\n :host(.fade-in){\n opacity: 1;\n animation: fadeIn 0.5s ease-in\n }\n @keyframes fadeIn {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n }\n `)}updated(){const{currentGroupId:e}=this.contextProvider.state;ad(e,this.currentGroupId)||(this.classList.remove("fade-in"),setTimeout((()=>this.classList.add("fade-in")),100),this.currentGroupId=e)}render(){const{mediaList:e,currentGroupId:t,selectedPaywall:n,formFactor:i}=this.contextProvider.state,a=Ju(this.contextProvider.productDetails,n?.sku_menus??[],this.component?.subsetGroup||t);return hp(this.contextProvider,a,this.component,e).map((([e,t])=>(this.inFocusedState="television"==i?e:this.inFocusedState,t.map((e=>tv(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion))))))}};T([Gm({type:Object})],Zx.prototype,"component",void 0),T([Gm({type:Boolean})],Zx.prototype,"inFocusedState",void 0),T([Gm({type:Number})],Zx.prototype,"scaleFactor",void 0),T([Gm({type:Object})],Zx.prototype,"minSDKVersion",void 0),Zx=T([Hm("nami-product-container")],Zx);let eA=class extends vg{constructor(){super(...arguments),this.inFocusedState=!1,this.scaleFactor=1}styles(){const{imageCropping:e,alignment:t,height:n,width:i,rightMargin:a,spacing:r,hidden:o,blur:s}=this.component,l="fit"===e,{formFactor:d}=this.contextConsumer.state;return Rh(`\n :host {\n display: ${"television"===d?"flex":"inline-block"};\n ${o?"display:none;":""}\n position: relative;\n height: ${Cg(n??"100%",this.scaleFactor)};\n width: ${Cg(("fitContent"==i?n:i)??"100%",this.scaleFactor)};\n }\n :host img {\n transition: all 0.3s;\n object-fit: ${l?"contain":"cover"};\n object-position: ${t} center;\n height: ${Cg(n??"100%",this.scaleFactor)};\n width: ${Cg(("fitContent"==i?n:i)??"100%",this.scaleFactor)};\n margin-right: ${a||r||0}px;\n ${s?`filter: blur(${s}px);`:""}\n flex-shrink: ${"number"==typeof i?0:1};\n }\n `)}render(){const{url:e,alt:t,title:n,focusedBorderColor:i,focusedFillColor:a,fillColor:r}=this.component;return e?(!i&&kp(r,a)||(this.tabIndex=0),this.ariaLabel=t??n??"",bm`<img src="${e}" alt="${this.ariaLabel}" />`):(this.tabIndex=-1,this.ariaLabel=null,bm``)}};T([Gm({type:Object})],eA.prototype,"component",void 0),T([Gm({type:Boolean})],eA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],eA.prototype,"scaleFactor",void 0),eA=T([Hm("nami-image")],eA);let tA=class extends vg{constructor(){super(...arguments),this.fullscreen=!1,this.inFocusedState=!1,this.scaleFactor=1}connectedCallback(){super.connectedCallback();!!document.querySelector("nami-paywall.nami-half-sheet-mode")||(document.body.style.background=this.component.fillColor||"transparent")}styles(){if(!this.contextConsumer||!this.component)return Rh("");const{component:e,scaleFactor:t}=this,{formFactor:n}=this.contextConsumer.state,{backgroundBlur:i}=e,a="vertical"===e.direction?"margin-top":"margin-left";return Rh(`\n :host {\n max-height: ${"television"===n?"100vh":""};\n display: ${e.hidden?"none":"flex"};\n flex-direction: column;\n overflow: hidden;\n ${Wg(e)}\n position: var(--nami-bg-position, fixed);\n width: 100%;\n bottom: 0px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n z-index: ${e.zIndex??1};\n top: 0px;\n ${i?`backdrop-filter: blur(${i}px);`:""}\n ${Rg(e,!1)}\n transition: all 0.3s;\n ${$g(e,t)}\n }\n :host(:focus){\n ${Rg(e,!0)}\n }\n :host > *:not(:first-child) {\n ${a}: ${e.spacing?e.spacing*t:0}px;\n }\n `)}updated(){}render(){return(this.component.components??[]).map((e=>tv(this.contextProvider,e,this.scaleFactor,void 0,this.minSDKVersion)))}};T([Gm({type:Object})],tA.prototype,"component",void 0),T([Gm({type:Boolean})],tA.prototype,"fullscreen",void 0),T([Gm({type:Boolean})],tA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],tA.prototype,"scaleFactor",void 0),T([Gm({type:Object})],tA.prototype,"minSDKVersion",void 0),tA=T([Hm("nami-background-container")],tA);let nA=class extends vg{constructor(){super(...arguments),this.zIndex=2,this.inFocusedState=!1,this.scaleFactor=1}styles(){const{contextConsumer:e,component:t,zIndex:n,scaleFactor:i}=this;if(!e)return Nh``;const{formFactor:a}=e.state,{backgroundBlur:r}=t,o="phone"!==a?"width: 100%;":"",s=t.width??t.fixedWidth,l="phone"===a?"max-width:100%; "+(void 0!==s?`width: ${Cg(s,i)};`:""):Hg(t,i),d="vertical"===t.direction?"margin-top":"margin-left";return Rh(`\n :host {\n box-sizing: border-box;\n display: ${t.hidden?"none":"flex"};\n position: relative;\n flex: 1;\n min-height: 0;\n ${Ng(t)}\n ${l}\n ${o}\n align-items: center;\n justify-content: flex-start;\n justify-content: start;\n ${r?`backdrop-filter: blur(${r}px);`:""}\n z-index: ${n};\n transition: all 0.3s;\n overflow-y: ${"television"===a?"hidden":"scroll"};\n overflow-x: hidden;\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n ${$g(t,i)}\n ${Rg(t,!1)}\n }\n :host::-webkit-scrollbar {\n display: none;\n }\n :host(:focus){\n ${Rg(t,!0)}\n }\n :host > * {\n width: 100%;\n }\n :host > *:not(:first-child) {\n ${d}: ${t.spacing?t.spacing*i:0}px;\n }\n `)}firstUpdated(){const e=new CustomEvent("child-spacing",{detail:{spacing:this.component.spacing},bubbles:!0,composed:!0});this.dispatchEvent(e)}render(){return this.component.components?.map((e=>tv(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)))||[]}};T([Gm({type:Object})],nA.prototype,"component",void 0),T([Gm({type:Number})],nA.prototype,"zIndex",void 0),T([Gm({type:Boolean})],nA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],nA.prototype,"scaleFactor",void 0),T([Gm({type:Object})],nA.prototype,"minSDKVersion",void 0),nA=T([Hm("nami-content-container")],nA);let iA=class extends vg{constructor(){super(),this.inFocusedState=!1,this.scaleFactor=1,this._handleClick=e=>{e.preventDefault(),_p({contextProvider:this.contextProvider,onTap:this.component.onTap})},this.addEventListener("click",this._handleClick)}styles(){const e=qg("active",this.component.components[0]),t=qg("inactive",this.component.components[0]);return Rh(`\n :host {\n box-sizing: border-box;\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n display: flex;\n flex: 0 0 auto;\n position: relative;\n ${Ng(this.component)}\n ${Rg(this.component,!1)}\n ${Xg(this.component,this.scaleFactor,!1)}\n ${this.component.hidden?"display:none;":""}\n }\n :host(:focus){\n ${Rg(this.component,!0)}\n ${Xg(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${Zg(this.component)}\n }\n .toggle{\n ${n=this.component,i=this.scaleFactor,`\n position: absolute;\n top: ${Ag(i,n.topPadding)}px;\n bottom: ${Ag(i,n.bottomPadding)}px;\n width: calc(50% - ${Ag(i,n.leftPadding)/2}px) !important;\n `}\n transition: transform .5s cubic-bezier(.77, 0, .175, 1);\n ${Jg(t,this.scaleFactor,!1)}\n }\n\n :host(:focus) .toggle{\n ${Jg(e,this.scaleFactor,!0)}\n }\n \n nami-segment-picker-item:nth-of-type(1).active~.toggle {\n transform: translateX(0%);\n left: ${this.component.leftPadding?Number(this.component.leftPadding)*this.scaleFactor:0}px;\n ${Rg(e,!0)}\n ${Qg(e,this.scaleFactor)}\n }\n\n nami-segment-picker-item:nth-of-type(2).active~.toggle {\n transform: translateX(100%);\n right: ${this.component.rightPadding?Number(this.component.rightPadding)*this.scaleFactor:0}px;\n ${Rg(e,!0)}\n ${Qg(e,this.scaleFactor)}\n `);var n,i}render(){this.role="tablist";const e=this.component.components.map((e=>tv(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)));return bm`${e}<div class="toggle"></div>`}};T([Gm({type:Object})],iA.prototype,"component",void 0),T([Gm({type:Boolean})],iA.prototype,"inFocusedState",void 0),T([Gm({type:Number})],iA.prototype,"scaleFactor",void 0),T([Gm({type:Object})],iA.prototype,"minSDKVersion",void 0),iA=T([Hm("nami-segment-picker")],iA);let aA=class extends vg{constructor(){super(...arguments),this.inFocusedState=!1,this.scaleFactor=1,this._handleFocus=()=>{this.inFocusedState=!0,this._announceButtonLabel()},this._handleKeyDown=e=>{"Enter"!==e.key&&" "!==e.key||this._handleClick()},this._handleClick=()=>{this._updateFormState(),this.requestUpdate("component")},this._handleHover=()=>{this.inFocusedState=!0}}connectedCallback(){super.connectedCallback(),this._isActive=!!this.component.checked,this.classList.toggle("active",this._isActive),this.component.formId&&this._updateFormState(),this.addEventListener("click",this._handleClick),this.addEventListener("mouseover",this._handleHover),this.addEventListener("keydown",this._handleKeyDown),this.addEventListener("focus",this._handleFocus)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleClick),this.removeEventListener("mouseover",this._handleHover),this.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("focus",this._handleFocus)}_announceButtonLabel(){const e=this.component.text||"";e&&Mh(e)}_getParentPicker(){const e=this.getRootNode();return e instanceof ShadowRoot?e.host:null}_getParentFormId(){return this._getParentPicker()?.component.formId}_updateFormState(){if(this.contextProvider)if(this.component.formId){const e=this._getParentFormId();e&&this.contextProvider.setFormState(e,this.component.formId)}else this.component.id&&this.contextProvider.setCurrentGroupData(this.component.id,this.component.text||"")}updated(e){if(!e.has("component"))return;if(!this.contextProvider)return;const t=e.get("component")??this.component;if(t.formId){const e=this._getParentFormId();e&&this.contextProvider.state.formStates[e]&&(this._isActive=this.contextProvider.state.formStates[e]===t.formId)}else this._isActive=ad(t.id,this.contextProvider.state.currentGroupId);if(this.classList.toggle("active",this._isActive),!this._isActive)return;const n=this.getRootNode();if(!(n instanceof ShadowRoot))return;n.querySelectorAll("nami-segment-picker-item").forEach((e=>{e!==this&&e.requestUpdate("component",e)}))}styles(){const e=qg("active",this.component),t=qg("inactive",this.component);return Rh(`\n :host {\n box-sizing: border-box;\n display: ${this.component.hidden?"none":"inline-flex"};\n position: relative;\n ${Jg({...t,...this.component},this.scaleFactor,this.inFocusedState)}\n ${Ug(this.component.inactiveDropShadow??this.component.dropShadow)}\n }\n\n :host > * {\n cursor: pointer;\n }\n\n :host(.active) {\n z-index: 1 !important;\n ${Qg({...e,...this.component},this.scaleFactor)}\n ${Ug(this.component.activeDropShadow??this.component.dropShadow)}\n }\n\n input {\n visibility: hidden;\n position: absolute;\n top: 0;\n }\n `)}render(){return this.tabIndex=0,this.role="tab",this.ariaSelected=`${this._isActive}`,this.ariaLabel=this.component.text||"",bm`<input type="radio"
268
318
  autocomplete="off"
269
319
  id="${this.component.text}"
270
320
  name="${this.component.text}"