@namiml/web-sdk 3.3.9-dev.202603132233 → 3.3.9-dev.202603141643
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nami-web.cjs +6 -4
- package/dist/nami-web.mjs +6 -4
- package/dist/nami-web.umd.js +6 -4
- package/package.json +1 -1
package/dist/nami-web.umd.js
CHANGED
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
padding-top: 0;
|
|
89
89
|
padding-bottom: 0;
|
|
90
90
|
}
|
|
91
|
-
`,$m=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)},jm={attribute:!0,type:String,converter:Gh,reflect:!1,hasChanged:Vh},zm=(e=jm,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 Hm(e){return(t,n)=>"object"==typeof n?zm(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 Bm(e){return Hm({...e,state:!0,attribute:!1})}function Um(e){return!e||"object"==typeof e&&0==Object.keys(e).length}const Gm="entry",Vm="screen",Xm="branch",Km="exit",Ym="unknown";var qm;!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"}(qm||(qm={}));const Jm="__handoff_sequence__",Qm="__buy_sku__",Zm="__default__",ef="__appear__",tf="__disappear__",nf="__login_success__",af="__login_failure__",rf="__logout_success__",of="__logout_failure__",sf="__purchase_success__",lf="__remoteback__",df="__tag_update__",uf="and",cf="or",hf="i_contains",mf="equals",ff="i_equals",pf="not_equals",gf="not_i_equals",vf="not_contains",yf="set",bf="notSet";class wf{constructor(){this.resolvers=new Map,this.namespaceResolvers=new Map}static get shared(){return wf.instance||(wf.instance=new wf),wf.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 uf:return n.every((e=>e));case cf: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 uf:for(const e of t)if(!this.evaluateFilter(e))return!1;return!0;case cf: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(e.operator===yf)return null!=t;if(e.operator===bf)return null==t;if(null==t){return!![pf,gf,vf].includes(e.operator)}switch(e.operator){case hf: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 mf: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 ff: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 pf:return e.values.every((e=>"string"!=typeof t||t!==e));case gf:return e.values.every((e=>"string"!=typeof t||0!==t.localeCompare(e,void 0,{sensitivity:"accent"})));case vf: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 t;const n=e.lastIndexOf(".");if(-1!==n){const t=e.slice(0,n),i=e.slice(n+1),a=this.resolveRaw(t);return void 0!==a?this.extractProperty(i,a):void 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)return t(e)}}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){Je.debug(`[NamiConditionEvaluator] ${e}`)}}class kf{constructor(){}register(){wf.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 Sf extends kf{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 _f extends kf{constructor(){super(),this.namespace="Device";const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[1]||"",t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=kl();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 Mf=[/(^|_)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 Ef{constructor(){this.params={},"undefined"!=typeof window&&this.setSearchParams()}static get instance(){return Ef._instance||(Ef._instance=new Ef),Ef._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=>Mf.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}}Ef._instance=null;const Pf=()=>Ef.instance.params,Tf=/\{\{\s*([^}]+?)\s*\}\}/g;class xf{constructor(e){this.flowManager=e,this.urlParams=Pf()}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 Sf(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(Tf,((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 Af extends kf{constructor(){super(),this.namespace="urlParams",this.context=Pf(),this.register()}resolveValue(e){return Je.debug("[URLParamsResolver]","Resolving keyPath",e),this.resolveKeyPath(e,this.context)}}class Cf extends kf{getContextProvider(){const e=oh.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 Lf extends kf{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=oh.providers;if(0===t.length)return;const n=t.find((e=>e.flow));return n?n.getCurrentPlacementLabel():t[t.length-1]?.getCurrentPlacementLabel()}}class If{constructor(){this.load()}setExternalId(e){return this.externalId=e,this}getExternalId(){return this.externalId}isLoggedIn(){return!!this.externalId}save(){return this.externalId?da.setNamiProfile({externalId:this.externalId}):da.removeNamiProfile(),this}load(){const e=da.getNamiProfile();e&&(this.externalId=e.externalId),oh.setIsLoggedIn(!!this.externalId)}async login(e){const t=await qs.instance.login(e);t.external_id&&oh.setIsLoggedIn(!0),this.setExternalId(t.external_id).save()}async logout(){await qs.instance.logout(),oh.setIsLoggedIn(!1),this.setExternalId(void 0).save()}}var Df;If.instance=new If,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"}(Df||(Df={}));class Rf{constructor(){this.emitter=Zl.getInstance(),wf.shared.registerNamespaceResolver("UserTags",(e=>{const t=e.replace("UserTags.",""),n=Rf.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 If.instance.isLoggedIn()}static loggedInId(){return this.instance.isSDKInitialized||Je.debug(N),If.instance.getExternalId()}static async login(e){if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(Df.LOGIN,!1,e),e}if(this.inAnonymousMode()){const e=new ka;throw this.invokeStateHandler(Df.LOGIN,!1,e),e}try{if(await If.instance.login(e),await ch.instance.fetchActiveEntitlements(),this.invokeStateHandler(Df.LOGIN,!0),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,nf)}}catch(e){if(this.invokeStateHandler(Df.LOGIN,!1,e),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,af)}throw e}}static async logout(){if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(Df.LOGOUT,!1,e),e}if(this.inAnonymousMode()){const e=new ka;throw this.invokeStateHandler(Df.LOGOUT,!1,e),e}try{if(await If.instance.logout(),await ch.instance.fetchActiveEntitlements(),this.invokeStateHandler(Df.LOGOUT,!0),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,rf)}}catch(e){if(this.invokeStateHandler(Df.LOGOUT,!1,e),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,of)}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?Df.ANONYMOUS_MODE_ON:Df.ANONYMOUS_MODE_OFF;if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(t,!1,e),e}if(this.anonymousModeCapability())if(this.inAnonymousMode()!==e)if(e)da.setAnonymousMode(e),da.resetDevice(),this.refetchConfig(),this.invokeStateHandler(Df.ANONYMOUS_MODE_ON,!0);else{da.clearAnonymousMode();const e=da.getNamiConfig()?.namiCommands;await nd.instance.createOrUpdateDevice(kl(e)),da.clearAnonymousUUID(),this.refetchConfig(),this.invokeStateHandler(Df.ANONYMOUS_MODE_OFF,!0)}else{const n=e?new ba:new wa;this.invokeStateHandler(t,!1,n)}else Je.warn("Anonymous mode feature is not enabled for your Nami account. Contact support@nami.ml for details.")}static inAnonymousMode(){return!!this.instance.isSDKInitialized&&sd()}static setCustomerAttribute(e,t){if(!this.instance.isSDKInitialized)throw new ma;if(da.setCustomerAttribute(e,t),Gs(A.PAYWALL_PERSONALIZATION)?(oh.setCustomerAttribute({[e]:t}),Je.debug(`This customer attribute you set is now available for paywall personalization using the smart text variable: ${e}`)):Je.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.`),Ff.instance.flowOpen){const e=Ff.instance.currentFlow;if(e){const t=e.currentFlowStep;t&&e.executeLifecycle(t,df)}}}static getCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new ma;const t=da.getCustomerAttribute(e);return null!=t?Gs(A.PAYWALL_PERSONALIZATION)?Je.debug(`Found customer attribute. ${e} is available for paywall personalization on this device.`):Je.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.`):Je.warn(`No ${e} customer attribute found.`),t}static getAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new ma;return da.getAllCustomerAttributes()}static clearCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new ma;da.clearCustomerAttribute(e)?(oh.removeCustomerAttribute(e),Je.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.`)):Je.warn(`No value to clear for attribute ${e}.`)}static clearAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new ma;da.getAllCustomerAttributesKeys().forEach((e=>{oh.removeCustomerAttribute(e)})),da.clearAllCustomerAttributes(),Je.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 ma;return da.getCustomerJourneyState()}static deviceId(){return this.instance.isSDKInitialized?da.getDevice()?.id??U:U}static registerJourneyStateHandler(e){if(Vs("NamiCustomerManager.registerJourneyStateHandler"))return this.instance.emitter.addListener(Be,e),()=>{this.instance.emitter.removeListener(Be,e)}}static invokeStateHandler(e,t,n){this.instance.emitter.emit("accountStateChange",e,t,n)}get isSDKInitialized(){return _h.instance.isInitialized}static async updateCustomerDataPlatformId(e){if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}if(this.inAnonymousMode()){Je.info("Unable to set CDP ID in anonymous mode",{deviceId:da.getDevice()?.id,anonymousMode:!0});const e=new Sa;this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}else try{await nd.instance.updateDeviceField("customer_data_platform_id",e),this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!0)}catch(e){this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}}static anonymousModeCapability(){if(!this.instance.isSDKInitialized)return!1;const e=Gs(A.ANONYMOUS_MODE_CAPABILITY),t=Gs(A.THIRD_PARTY_TRANSACTIONS);return e&&t}static async refetchConfig(){this.instance.isSDKInitialized&&await Promise.all([id.instance.fetchProducts(),ad.instance.fetchPaywalls().then((e=>ed.instance.fetchCampaignRules(e)))])}}Rf.instance=new Rf;class Wf{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&&il(this.screens)}}class Nf extends Wf{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(Gm);a&&this.forward(a.id)}registerResolvers(e){e&&new Sf(e),new _f,new Af,new Cf,new Lf(this.campaign),wf.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)))}finished(){this.manager.finishFlow()}back(){this.previousStepAvailable?this.backToPreviousScreenStep():Je.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=nl(t.screen);return e&&this.component.flowNavigateToScreen(e,{transition:this.transition,direction:"backward"}),void(this.currentScreenState=oh.currentProvider?.state??null)}}Je.warn("No previous screen step found to return to")}else Je.warn(`Not allowed to go back to ${this.previousFlowStep.id}`)}forward(e){const t=this.getStep(e);if(t){if(this.isStepActive(t))switch(t.type){case Gm:case Km:return this.stepcrumbs.push(t),void this.executeLifecycle(t,Zm);case Xm:return void this.handleBranchStep(t);case Vm:return void this.handleScreenStep(t);case Ym:return}}else Je.error(`No step found with id: ${e}`)}pause(){this.isPaused?Je.info("Flow is already paused"):(this.isPaused=!0,this.pausedStepID=this.currentFlowStep?.id,Je.info("Flow paused"))}resumeFromPause(){if(!this.isPaused)return void Je.info("Flow is not paused");if(this.isPaused=!1,!this.pausedStepID)return void Je.warn("No step to resume from");const e=this.pausedStepID;this.pausedStepID=void 0,Je.info(`Flow resumed from step ${e}`),this.forward(e)}executeLifecycle(e,t,n){const i=e.actions[t];i&&this.executeFullLifecycles(i,n)}lifecycles(e){if(!this.currentFlowStep)return;const t=this.currentFlowStep.actions[e];if(t)return t;Je.info(`No actions found for button ${e} on step ${this.currentFlowStep.id}`)}triggerActions(e,t,n){const i=this.lifecycles(e);i&&(this.currentButton=t,this.executeFullLifecycles(i,n))}executeFullLifecycles(e,t){for(const n of e)[n.before,n.action,n.after].forEach((e=>e?.forEach((e=>this.shouldRun(e)&&this.performAction(e,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){return!e.conditions||e.conditions.every((e=>wf.shared.evaluate(e)))}performAction(e,t){if(!this.currentFlowStep)return void Je.warn("No current flow step");const n=(e.parameters?.delay?+e.parameters.delay:0)||0,i=n=>{if(this.currentFlowStep?.id===n)switch(e.function){case qm.BACK:this.back();break;case qm.NEXT:e.parameters?.step?this.forward(e.parameters.step):this.next();break;case qm.NAVIGATE:e.parameters?.step?this.previousFlowStep?.id===e.parameters.step?this.back():this.forward(e.parameters.step):this.next();break;case qm.FINISHED:case qm.DISMISS:this.finished();break;case qm.EXIT:{const e=this.steps.find((e=>e.type===Km));e&&this.forward(e.id);break}case qm.PAUSE:this.pause();break;case qm.RESUME:this.resumeFromPause();break;case qm.HANDOFF:if(e.parameters?.handoffTag)if(this.manager.handoffStepHandler)if(e.parameters.handoffData)Je.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} ${JSON.stringify(e.parameters.handoffData)}`),this.manager.handoffStepHandler(e.parameters.handoffTag,e.parameters.handoffData);else if(t)Je.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===Jm?this.flowHandoffFormSequence():this.manager.handoffStepHandler(e.parameters.handoffTag,t)}else Je.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} and no data`),this.manager.handoffStepHandler(e.parameters.handoffTag);else Je.debug("No handoffStepHandler found",e);break;case qm.LOG:e.parameters?.eventName?Je.info(`logEvent → ${e.parameters.eventName}`):Je.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case qm.TRACK:e.parameters?.eventName?Je.info(`trackEvent → ${e.parameters.eventName}`):Je.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case qm.SET_VIDEO:e.parameters?.name&&e.parameters.url?oh.setAppSuppliedVideoDetails({name:e.parameters.name,url:e.parameters.url}):Je.warn("Missing name, url for setting video details");break;case qm.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:Je.warn("Missing step for blocking back");break}case qm.FLOW_EVENT:{const t=new xf(this.manager),n=Object.fromEntries(Object.entries(e.parameters??{}).map((([e,n])=>[e,t.interpolateDeep(n)])));this.manager.eventHandler?this.manager.eventHandler(n):Je.warn("Missing event handler",n);break}case qm.FLOW_ENABLED:oh.setUserInteractionEnabled(!0);break;case qm.FLOW_DISABLED:oh.setUserInteractionEnabled(!1);break;case qm.SET_TAGS:e.parameters&&(oh.setUserTags(e.parameters),Object.entries(e.parameters).forEach((([e,t])=>{Rf.setCustomerAttribute(e,t)})));break;default:Je.warn(`Missing action handler for ${e.function}`,e)}else Je.debug(`Skipped action for stale flow step ${n}`)};n?setTimeout(i.bind(this,this.currentFlowStep.id),n):i(this.currentFlowStep.id)}nextStep(e){if(!e)return void Je.error("Next step not found");const t=this.steps.findIndex((t=>t.id===e.id));if(-1===t)return void Je.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}Je.debug(`No active next step found after ${e.id}`)}handleScreenStep(e){const t=nl(e.screen??"");e.screen&&t&&this.campaign?(this.stepcrumbs.push(e),this.component.flowNavigateToScreen(t,{transition:this.transition,direction:"forward"})):Je.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 Je.warn(`No actions defined for branch tag ${t}`);Je.warn(`No matching branch condition matched for step ${e.id}`)}getFormData(){return{...oh.currentProvider?.state?.formStates??{}}}flowHandoffFormSequence(){const e=this.currentScreenState?.formStates;if(!e)return void Je.warn("No formStates available for handoff sequence");const t=Object.keys(e).sort();if(0===t.length)return void Je.warn("formStates is empty, no handoffs to perform");const n=t.filter((t=>!0===e[t]));if(0===n.length)return Je.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 Je.warn("No active handoff sequence to resume"),void this.manager.resume();if(0===e.remainingKeys.length)return Je.info("All handoffs in the sequence are complete"),this.activeHandoffSequence=null,void this.manager.resume();const t=e.remainingKeys.shift(),n=e.formStates[t];Je.debug(`Starting handoff for ${t} → ${String(n)}`),this.activeHandoffSequence=e;const i=`${t}`;this.manager.handoffStepHandler?.(i,void 0)}}let Ff=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(t&&n&&n.currentFlowStep){if(n.activeHandoffSequence)return Je.debug(`Resuming flow at handoff sequence ${n.currentFlowStep.id}`),void n.resumeNextHandoff();Je.debug(`Resuming flow at step ${n.currentFlowStep.id}`),n.executeLifecycle(n.currentFlowStep,"__resume__")}else Je.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?(Je.debug(`Finishing flow programmatically at step ${n.currentFlowStep.id}`),n.finished()):Je.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():Je.warn("This flow cannot be paused"):Je.warn("Cannot pause: no active flow or current step")}static isFlowOpen(){return e.instance.flowOpen}presentFlow(e,t,n){const i=new Nf(e,t,this,n);return this.flowOpen=!0,this.currentFlow=i,i}finishFlow(){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===Vm));if(0===t.length)return 0;const n=this.currentFlow.stepcrumbs.filter((e=>e.type===Vm));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 Je.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?.[ef];if(!t)return null;for(const e of t){const t=e.action??[];for(const e of t)if((e.function===qm.NAVIGATE||e.function===qm.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 Of=2;let $f=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:jf}=Dm,zf=()=>document.createComment(""),Hf=(e,t,n)=>{const i=e._$AA.parentNode,a=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=i.insertBefore(zf(),a),r=i.insertBefore(zf(),a);n=new jf(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},Bf=(e,t,n=e)=>(e._$AI(t,n),e),Uf={},Gf=e=>{e._$AR(),e._$AA.remove()},Vf=(e,t,n)=>{const i=new Map;for(let a=t;a<=n;a++)i.set(e[a],a);return i},Xf=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends $f{constructor(e){if(super(e),e.type!==Of)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]=Bf(a[c],r[m]),c++,m++;else if(s[h]===o[f])l[f]=Bf(a[h],r[f]),h--,f--;else if(s[c]===o[f])l[f]=Bf(a[c],r[f]),Hf(e,l[f+1],a[c]),c++,f--;else if(s[h]===o[m])l[m]=Bf(a[h],r[m]),Hf(e,a[c],a[h]),h--,m++;else if(void 0===d&&(d=Vf(o,m,f),u=Vf(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=Hf(e,a[c]);Bf(t,r[m]),l[m]=t}else l[m]=Bf(n,r[m]),Hf(e,a[c],n),a[t]=null;m++}else Gf(a[h]),h--;else Gf(a[c]),c++;for(;m<=f;){const t=Hf(e,l[f+1]);Bf(t,r[m]),l[m++]=t}for(;c<=h;){const e=a[c++];null!==e&&Gf(e)}return this.ut=o,((e,t=Uf)=>{e._$AH=t})(e,l),ym}});const Kf=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 Yf(e,t,n){if("undefined"==typeof window||!e||!t)return Je.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 qf=class extends Nm{constructor(e,t,n){return super(),this.pages=[],this.currentOffset=0,this.presentationStyle="fullscreen",this.formFactor=Sl(),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=Ol(this.value,this.type);this.paywall=e.paywall,this.campaign=e.campaign}getPresentationStyle(e){const t=e?.template?.initialState?.presentation_style;return(n=t)&&Mh.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=Yf(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(),da.clearLaunchId(),window.TVJS?.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=document.body),document.removeEventListener("keydown",this.handleKeyDownEvent.bind(this)),Zl.getInstance().removeAllListeners(ze),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._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(lf)}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(),Js(this.campaign)&&(this.flow=Ff.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,tf);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,ef)}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 oh.getSelectedSlideIndex()}renderFlow(){return"undefined"==typeof document?gm``:this.isHalfSheet?this.renderHalfSheet():gm`
|
|
91
|
+
`,$m=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)},jm={attribute:!0,type:String,converter:Gh,reflect:!1,hasChanged:Vh},zm=(e=jm,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 Hm(e){return(t,n)=>"object"==typeof n?zm(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 Bm(e){return Hm({...e,state:!0,attribute:!1})}function Um(e){return!e||"object"==typeof e&&0==Object.keys(e).length}const Gm="entry",Vm="screen",Xm="branch",Km="exit",Ym="unknown";var qm;!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"}(qm||(qm={}));const Jm="__handoff_sequence__",Qm="__buy_sku__",Zm="__default__",ef="__appear__",tf="__disappear__",nf="__login_success__",af="__login_failure__",rf="__logout_success__",of="__logout_failure__",sf="__purchase_success__",lf="__remoteback__",df="__tag_update__",uf="and",cf="or",hf="i_contains",mf="equals",ff="i_equals",pf="not_equals",gf="not_i_equals",vf="not_contains",yf="set",bf="notSet";class wf{constructor(){this.resolvers=new Map,this.namespaceResolvers=new Map}static get shared(){return wf.instance||(wf.instance=new wf),wf.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 uf:return n.every((e=>e));case cf: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 uf:for(const e of t)if(!this.evaluateFilter(e))return!1;return!0;case cf: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(e.operator===yf)return null!=t;if(e.operator===bf)return null==t;if(null==t){return!![pf,gf,vf].includes(e.operator)}switch(e.operator){case hf: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 mf: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 ff: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 pf:return e.values.every((e=>"string"!=typeof t||t!==e));case gf:return e.values.every((e=>"string"!=typeof t||0!==t.localeCompare(e,void 0,{sensitivity:"accent"})));case vf: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 t;const n=e.lastIndexOf(".");if(-1!==n){const t=e.slice(0,n),i=e.slice(n+1),a=this.resolveRaw(t);return void 0!==a?this.extractProperty(i,a):void 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)return t(e)}}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){Je.debug(`[NamiConditionEvaluator] ${e}`)}}class kf{constructor(){}register(){wf.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 Sf extends kf{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 _f extends kf{constructor(){super(),this.namespace="Device";const e=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[1]||"",t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=kl();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 Mf=[/(^|_)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 Ef{constructor(){this.params={},"undefined"!=typeof window&&this.setSearchParams()}static get instance(){return Ef._instance||(Ef._instance=new Ef),Ef._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=>Mf.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}}Ef._instance=null;const Pf=()=>Ef.instance.params,Tf=/\{\{\s*([^}]+?)\s*\}\}/g;class xf{constructor(e){this.flowManager=e,this.urlParams=Pf()}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 Sf(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(Tf,((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 Af extends kf{constructor(){super(),this.namespace="urlParams",this.context=Pf(),this.register()}resolveValue(e){return Je.debug("[URLParamsResolver]","Resolving keyPath",e),this.resolveKeyPath(e,this.context)}}class Cf extends kf{getContextProvider(){const e=oh.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 Lf extends kf{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=oh.providers;if(0===t.length)return;const n=t.find((e=>e.flow));return n?n.getCurrentPlacementLabel():t[t.length-1]?.getCurrentPlacementLabel()}}class If{constructor(){this.load()}setExternalId(e){return this.externalId=e,this}getExternalId(){return this.externalId}isLoggedIn(){return!!this.externalId}save(){return this.externalId?da.setNamiProfile({externalId:this.externalId}):da.removeNamiProfile(),this}load(){const e=da.getNamiProfile();e&&(this.externalId=e.externalId),oh.setIsLoggedIn(!!this.externalId)}async login(e){const t=await qs.instance.login(e);t.external_id&&oh.setIsLoggedIn(!0),this.setExternalId(t.external_id).save()}async logout(){await qs.instance.logout(),oh.setIsLoggedIn(!1),this.setExternalId(void 0).save()}}var Df;If.instance=new If,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"}(Df||(Df={}));class Rf{constructor(){this.emitter=Zl.getInstance(),wf.shared.registerNamespaceResolver("UserTags",(e=>{const t=e.replace("UserTags.",""),n=Rf.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 If.instance.isLoggedIn()}static loggedInId(){return this.instance.isSDKInitialized||Je.debug(N),If.instance.getExternalId()}static async login(e){if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(Df.LOGIN,!1,e),e}if(this.inAnonymousMode()){const e=new ka;throw this.invokeStateHandler(Df.LOGIN,!1,e),e}try{if(await If.instance.login(e),await ch.instance.fetchActiveEntitlements(),this.invokeStateHandler(Df.LOGIN,!0),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,nf)}}catch(e){if(this.invokeStateHandler(Df.LOGIN,!1,e),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,af)}throw e}}static async logout(){if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(Df.LOGOUT,!1,e),e}if(this.inAnonymousMode()){const e=new ka;throw this.invokeStateHandler(Df.LOGOUT,!1,e),e}try{if(await If.instance.logout(),await ch.instance.fetchActiveEntitlements(),this.invokeStateHandler(Df.LOGOUT,!0),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,rf)}}catch(e){if(this.invokeStateHandler(Df.LOGOUT,!1,e),Ff.instance.flowOpen){const e=Ff.instance.currentFlow,t=e?.currentFlowStep;t&&e.executeLifecycle(t,of)}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?Df.ANONYMOUS_MODE_ON:Df.ANONYMOUS_MODE_OFF;if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(t,!1,e),e}if(this.anonymousModeCapability())if(this.inAnonymousMode()!==e)if(e)da.setAnonymousMode(e),da.resetDevice(),this.refetchConfig(),this.invokeStateHandler(Df.ANONYMOUS_MODE_ON,!0);else{da.clearAnonymousMode();const e=da.getNamiConfig()?.namiCommands;await nd.instance.createOrUpdateDevice(kl(e)),da.clearAnonymousUUID(),this.refetchConfig(),this.invokeStateHandler(Df.ANONYMOUS_MODE_OFF,!0)}else{const n=e?new ba:new wa;this.invokeStateHandler(t,!1,n)}else Je.warn("Anonymous mode feature is not enabled for your Nami account. Contact support@nami.ml for details.")}static inAnonymousMode(){return!!this.instance.isSDKInitialized&&sd()}static setCustomerAttribute(e,t){if(!this.instance.isSDKInitialized)throw new ma;if(da.setCustomerAttribute(e,t),Gs(A.PAYWALL_PERSONALIZATION)?(oh.setCustomerAttribute({[e]:t}),Je.debug(`This customer attribute you set is now available for paywall personalization using the smart text variable: ${e}`)):Je.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.`),Ff.instance.flowOpen){const e=Ff.instance.currentFlow;if(e){const t=e.currentFlowStep;t&&e.executeLifecycle(t,df)}}}static getCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new ma;const t=da.getCustomerAttribute(e);return null!=t?Gs(A.PAYWALL_PERSONALIZATION)?Je.debug(`Found customer attribute. ${e} is available for paywall personalization on this device.`):Je.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.`):Je.warn(`No ${e} customer attribute found.`),t}static getAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new ma;return da.getAllCustomerAttributes()}static clearCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new ma;da.clearCustomerAttribute(e)?(oh.removeCustomerAttribute(e),Je.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.`)):Je.warn(`No value to clear for attribute ${e}.`)}static clearAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new ma;da.getAllCustomerAttributesKeys().forEach((e=>{oh.removeCustomerAttribute(e)})),da.clearAllCustomerAttributes(),Je.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 ma;return da.getCustomerJourneyState()}static deviceId(){return this.instance.isSDKInitialized?da.getDevice()?.id??U:U}static registerJourneyStateHandler(e){if(Vs("NamiCustomerManager.registerJourneyStateHandler"))return this.instance.emitter.addListener(Be,e),()=>{this.instance.emitter.removeListener(Be,e)}}static invokeStateHandler(e,t,n){this.instance.emitter.emit("accountStateChange",e,t,n)}get isSDKInitialized(){return _h.instance.isInitialized}static async updateCustomerDataPlatformId(e){if(!this.instance.isSDKInitialized){const e=new ma;throw this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}if(this.inAnonymousMode()){Je.info("Unable to set CDP ID in anonymous mode",{deviceId:da.getDevice()?.id,anonymousMode:!0});const e=new Sa;this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}else try{await nd.instance.updateDeviceField("customer_data_platform_id",e),this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!0)}catch(e){this.invokeStateHandler(Df.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}}static anonymousModeCapability(){if(!this.instance.isSDKInitialized)return!1;const e=Gs(A.ANONYMOUS_MODE_CAPABILITY),t=Gs(A.THIRD_PARTY_TRANSACTIONS);return e&&t}static async refetchConfig(){this.instance.isSDKInitialized&&await Promise.all([id.instance.fetchProducts(),ad.instance.fetchPaywalls().then((e=>ed.instance.fetchCampaignRules(e)))])}}Rf.instance=new Rf;class Wf{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&&il(this.screens)}}class Nf extends Wf{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(Gm);a&&this.forward(a.id)}registerResolvers(e){e&&new Sf(e),new _f,new Af,new Cf,new Lf(this.campaign),wf.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)))}finished(){this.manager.finishFlow()}back(){this.previousStepAvailable?this.backToPreviousScreenStep():Je.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=nl(t.screen);return e&&this.component.flowNavigateToScreen(e,{transition:this.transition,direction:"backward"}),void(this.currentScreenState=oh.currentProvider?.state??null)}}Je.warn("No previous screen step found to return to")}else Je.warn(`Not allowed to go back to ${this.previousFlowStep.id}`)}forward(e){const t=this.getStep(e);if(t){if(this.isStepActive(t))switch(t.type){case Gm:case Km:return this.stepcrumbs.push(t),void this.executeLifecycle(t,Zm);case Xm:return void this.handleBranchStep(t);case Vm:return void this.handleScreenStep(t);case Ym:return}}else Je.error(`No step found with id: ${e}`)}pause(){this.isPaused?Je.info("Flow is already paused"):(this.isPaused=!0,this.pausedStepID=this.currentFlowStep?.id,Je.info("Flow paused"))}resumeFromPause(){if(!this.isPaused)return void Je.info("Flow is not paused");if(this.isPaused=!1,!this.pausedStepID)return void Je.warn("No step to resume from");const e=this.pausedStepID;this.pausedStepID=void 0,Je.info(`Flow resumed from step ${e}`),this.forward(e)}executeLifecycle(e,t,n){const i=e.actions[t];i&&this.executeFullLifecycles(i,n)}lifecycles(e){if(!this.currentFlowStep)return;const t=this.currentFlowStep.actions[e];if(t)return t;Je.info(`No actions found for button ${e} on step ${this.currentFlowStep.id}`)}triggerActions(e,t,n){const i=this.lifecycles(e);i&&(this.currentButton=t,this.executeFullLifecycles(i,n))}executeFullLifecycles(e,t){for(const n of e)[n.before,n.action,n.after].forEach((e=>e?.forEach((e=>this.shouldRun(e)&&this.performAction(e,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){return!e.conditions||e.conditions.every((e=>wf.shared.evaluate(e)))}performAction(e,t){if(!this.currentFlowStep)return void Je.warn("No current flow step");const n=(e.parameters?.delay?+e.parameters.delay:0)||0,i=n=>{if(this.currentFlowStep?.id===n)switch(e.function){case qm.BACK:this.back();break;case qm.NEXT:e.parameters?.step?this.forward(e.parameters.step):this.next();break;case qm.NAVIGATE:e.parameters?.step?this.previousFlowStep?.id===e.parameters.step?this.back():this.forward(e.parameters.step):this.next();break;case qm.FINISHED:case qm.DISMISS:this.finished();break;case qm.EXIT:{const e=this.steps.find((e=>e.type===Km));e&&this.forward(e.id);break}case qm.PAUSE:this.pause();break;case qm.RESUME:this.resumeFromPause();break;case qm.HANDOFF:if(e.parameters?.handoffTag)if(this.manager.handoffStepHandler)if(e.parameters.handoffData)Je.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} ${JSON.stringify(e.parameters.handoffData)}`),this.manager.handoffStepHandler(e.parameters.handoffTag,e.parameters.handoffData);else if(t)Je.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===Jm?this.flowHandoffFormSequence():this.manager.handoffStepHandler(e.parameters.handoffTag,t)}else Je.debug(`Invoking handoffStepHandler with ${e.parameters.handoffTag} and no data`),this.manager.handoffStepHandler(e.parameters.handoffTag);else Je.debug("No handoffStepHandler found",e);break;case qm.LOG:e.parameters?.eventName?Je.info(`logEvent → ${e.parameters.eventName}`):Je.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case qm.TRACK:e.parameters?.eventName?Je.info(`trackEvent → ${e.parameters.eventName}`):Je.warn(`Missing 'eventName' in logEvent action ${e.id??"unknown"}`);break;case qm.SET_VIDEO:e.parameters?.name&&e.parameters.url?oh.setAppSuppliedVideoDetails({name:e.parameters.name,url:e.parameters.url}):Je.warn("Missing name, url for setting video details");break;case qm.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:Je.warn("Missing step for blocking back");break}case qm.FLOW_EVENT:{const t=new xf(this.manager),n=Object.fromEntries(Object.entries(e.parameters??{}).map((([e,n])=>[e,t.interpolateDeep(n)])));this.manager.eventHandler?this.manager.eventHandler(n):Je.warn("Missing event handler",n);break}case qm.FLOW_ENABLED:oh.setUserInteractionEnabled(!0);break;case qm.FLOW_DISABLED:oh.setUserInteractionEnabled(!1);break;case qm.SET_TAGS:e.parameters&&(oh.setUserTags(e.parameters),Object.entries(e.parameters).forEach((([e,t])=>{Rf.setCustomerAttribute(e,t)})));break;default:Je.warn(`Missing action handler for ${e.function}`,e)}else Je.debug(`Skipped action for stale flow step ${n}`)};n?setTimeout(i.bind(this,this.currentFlowStep.id),n):i(this.currentFlowStep.id)}nextStep(e){if(!e)return void Je.error("Next step not found");const t=this.steps.findIndex((t=>t.id===e.id));if(-1===t)return void Je.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}Je.debug(`No active next step found after ${e.id}`)}handleScreenStep(e){const t=nl(e.screen??"");e.screen&&t&&this.campaign?(this.stepcrumbs.push(e),this.component.flowNavigateToScreen(t,{transition:this.transition,direction:"forward"})):Je.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 Je.warn(`No actions defined for branch tag ${t}`);Je.warn(`No matching branch condition matched for step ${e.id}`)}getFormData(){return{...oh.currentProvider?.state?.formStates??{}}}flowHandoffFormSequence(){const e=this.currentScreenState?.formStates;if(!e)return void Je.warn("No formStates available for handoff sequence");const t=Object.keys(e).sort();if(0===t.length)return void Je.warn("formStates is empty, no handoffs to perform");const n=t.filter((t=>!0===e[t]));if(0===n.length)return Je.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 Je.warn("No active handoff sequence to resume"),void this.manager.resume();if(0===e.remainingKeys.length)return Je.info("All handoffs in the sequence are complete"),this.activeHandoffSequence=null,void this.manager.resume();const t=e.remainingKeys.shift(),n=e.formStates[t];Je.debug(`Starting handoff for ${t} → ${String(n)}`),this.activeHandoffSequence=e;const i=`${t}`;this.manager.handoffStepHandler?.(i,void 0)}}let Ff=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(t&&n&&n.currentFlowStep){if(n.activeHandoffSequence)return Je.debug(`Resuming flow at handoff sequence ${n.currentFlowStep.id}`),void n.resumeNextHandoff();Je.debug(`Resuming flow at step ${n.currentFlowStep.id}`),n.executeLifecycle(n.currentFlowStep,"__resume__")}else Je.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?(Je.debug(`Finishing flow programmatically at step ${n.currentFlowStep.id}`),n.finished()):Je.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():Je.warn("This flow cannot be paused"):Je.warn("Cannot pause: no active flow or current step")}static isFlowOpen(){return e.instance.flowOpen}presentFlow(e,t,n){const i=new Nf(e,t,this,n);return this.flowOpen=!0,this.currentFlow=i,i}finishFlow(){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===Vm));if(0===t.length)return 0;const n=this.currentFlow.stepcrumbs.filter((e=>e.type===Vm));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 Je.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?.[ef];if(!t)return null;for(const e of t){const t=e.action??[];for(const e of t)if((e.function===qm.NAVIGATE||e.function===qm.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 Of=2;let $f=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:jf}=Dm,zf=()=>document.createComment(""),Hf=(e,t,n)=>{const i=e._$AA.parentNode,a=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=i.insertBefore(zf(),a),r=i.insertBefore(zf(),a);n=new jf(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},Bf=(e,t,n=e)=>(e._$AI(t,n),e),Uf={},Gf=e=>{e._$AR(),e._$AA.remove()},Vf=(e,t,n)=>{const i=new Map;for(let a=t;a<=n;a++)i.set(e[a],a);return i},Xf=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends $f{constructor(e){if(super(e),e.type!==Of)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]=Bf(a[c],r[m]),c++,m++;else if(s[h]===o[f])l[f]=Bf(a[h],r[f]),h--,f--;else if(s[c]===o[f])l[f]=Bf(a[c],r[f]),Hf(e,l[f+1],a[c]),c++,f--;else if(s[h]===o[m])l[m]=Bf(a[h],r[m]),Hf(e,a[c],a[h]),h--,m++;else if(void 0===d&&(d=Vf(o,m,f),u=Vf(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=Hf(e,a[c]);Bf(t,r[m]),l[m]=t}else l[m]=Bf(n,r[m]),Hf(e,a[c],n),a[t]=null;m++}else Gf(a[h]),h--;else Gf(a[c]),c++;for(;m<=f;){const t=Hf(e,l[f+1]);Bf(t,r[m]),l[m++]=t}for(;c<=h;){const e=a[c++];null!==e&&Gf(e)}return this.ut=o,((e,t=Uf)=>{e._$AH=t})(e,l),ym}});const Kf=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 Yf(e,t,n){if("undefined"==typeof window||!e||!t)return Je.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 qf=class extends Nm{constructor(e,t,n){return super(),this.pages=[],this.currentOffset=0,this.presentationStyle="fullscreen",this.formFactor=Sl(),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=Ol(this.value,this.type);this.paywall=e.paywall,this.campaign=e.campaign}getPresentationStyle(e){const t=e?.template?.initialState?.presentation_style;return(n=t)&&Mh.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=Yf(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(),da.clearLaunchId(),window.TVJS?.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=document.body),document.removeEventListener("keydown",this.handleKeyDownEvent.bind(this)),Zl.getInstance().removeAllListeners(ze),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(lf)}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(),Js(this.campaign)&&(this.flow=Ff.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,tf);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,ef)}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 oh.getSelectedSlideIndex()}renderFlow(){return"undefined"==typeof document?gm``:this.isHalfSheet?this.renderHalfSheet():gm`
|
|
92
92
|
<div class="nami-flow-container">
|
|
93
93
|
${Xf(this.pages,(e=>e.id),((e,t)=>{const n=this.getAnimationStyles(t);return gm`
|
|
94
94
|
<div class="nami-screen" style="${n} z-index: ${2-t}">${this.renderPaywall(e)}</div>
|
|
@@ -123,6 +123,8 @@
|
|
|
123
123
|
:host {
|
|
124
124
|
box-sizing: border-box;
|
|
125
125
|
width: 100%;
|
|
126
|
+
height: 100vh;
|
|
127
|
+
height: 100dvh;
|
|
126
128
|
display: block;
|
|
127
129
|
}
|
|
128
130
|
:host(.nami-disabled) {
|
|
@@ -130,8 +132,8 @@
|
|
|
130
132
|
}
|
|
131
133
|
.nami-flow-container {
|
|
132
134
|
position: relative;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
height: 100vh;
|
|
136
|
+
height: 100dvh;
|
|
135
137
|
overflow: hidden;
|
|
136
138
|
|
|
137
139
|
/* Safe area support for iOS */
|
|
@@ -262,7 +264,7 @@
|
|
|
262
264
|
`}render(){return this.renderSvgIcon(this.shouldRenderCurrentIcon()?this.component.name:this.previousSymbolName)}};T([Hm({type:Object})],Xx.prototype,"component",void 0),T([Hm({type:Boolean})],Xx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Xx.prototype,"scaleFactor",void 0),Xx=T([$m("nami-symbol")],Xx);let Kx=class extends bp{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 Lh(`\n :host {\n line-height: ${Bx(a,t)}px;\n display: ${i?"none":"grid"};\n overflow-wrap: anywhere;\n width: fit-content;\n ${Np(e,n)}\n ${Ux(e,n)}\n font-size: ${(a??Hx)*t}px;\n text-align: ${r||"center"};\n ${Xp("string"!=typeof o&&o)}\n ${Kp(e.fontName)}\n ${Yp(e,t,n)}\n ${zx(e)}\n ${Fp(e)}\n ${function({alignment:e,horizontalAlignment:t}){let n;return n=t&&Sp[t]?Sp[t]:e&&Sp[e]?Sp[e]:"center",Mp("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: ${Bx(a,t)}px;\n display: inline;\n overflow-wrap: anywhere;\n width: fit-content;\n ${Np(e,n)}\n ${Ux(e,n)}\n font-size: ${(a??Hx)*t}px;\n text-align: ${r||"center"};\n ${Xp("string"!=typeof o&&o)}\n ${Kp(e.fontName)}\n }\n ${zx(e,":host .bullet-text-wrapper")}\n :host .bullet-text-wrapper p {\n margin: 0;\n line-height: ${Bx(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 gm``;const s=a.map((e=>e?gm`<nami-text-list-item-wrapper .component=${this.component} .scaleFactor=${this.scaleFactor}>
|
|
263
265
|
${o&&gm`<nami-symbol .component=${o} .scaleFactor=${this.scaleFactor}></nami-symbol>`}
|
|
264
266
|
<div class="bullet-text-wrapper" .innerHTML="${cy(e)}"></div>
|
|
265
|
-
</nami-text-list-item-wrapper>`:null));return gm`${s}`}};T([Hm({type:Object})],Kx.prototype,"component",void 0),T([Hm({type:Boolean})],Kx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Kx.prototype,"scaleFactor",void 0),Kx=T([$m("nami-text-list")],Kx);(()=>{let e=!0;try{new RegExp("","u"),new RegExp("😀","u"),new RegExp("\\p{P}","u")}catch{e=!1}if(e)return;const t=cy.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 Yx=class extends bp{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?Lh(`\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 `):Lh(Np(e,!1));return Lh(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n ${i?`backdrop-filter: blur(${i}px);`:""}\n ${s};\n ${Jp(e.position)}\n ${Fp(e)}\n ${Yp(e,t,!1)}\n }\n :host(:focus),\n :host(.nami-focus-within){\n ${Np(e,!0)}\n ${Yp(e,t,!0)}\n }\n :host(:focus-visible){\n ${tg(e)}\n }\n :host > * {\n ${$p(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=>fg(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([Hm({type:Object})],Yx.prototype,"component",void 0),T([Hm({type:Boolean})],Yx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Yx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],Yx.prototype,"minSDKVersion",void 0),Yx=T([$m("nami-container")],Yx);let qx=class extends bp{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?Lh(`\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 `):Lh(Np(this.component,!1));return Lh(`\n :host {\n opacity: 0;\n display: ${this.component.hidden?"none":"flex"};\n ${a};\n ${e?`backdrop-filter: blur(${e}px);`:""}\n ${Jp(this.component.position)}\n ${Fp(this.component)}\n ${Yp(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 ${Np(this.component,!0)}\n ${Yp(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${tg(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;td(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=Ku(this.contextProvider.productDetails,n?.sku_menus??[],this.component?.subsetGroup||t);return ag(this.contextProvider,a,this.component,e).map((([e,t])=>(this.inFocusedState="television"==i?e:this.inFocusedState,t.map((e=>fg(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion))))))}};T([Hm({type:Object})],qx.prototype,"component",void 0),T([Hm({type:Boolean})],qx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],qx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],qx.prototype,"minSDKVersion",void 0),qx=T([$m("nami-product-container")],qx);let Jx=class extends bp{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 Lh(`\n :host {\n display: ${"television"===d?"flex":"inline-block"};\n ${o?"display:none;":""}\n position: relative;\n height: ${Ip(n??"100%",this.scaleFactor)};\n width: ${Ip(("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: ${Ip(n??"100%",this.scaleFactor)};\n width: ${Ip(("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&&mg(r,a)||(this.tabIndex=0),this.ariaLabel=t??n??"",gm`<img src="${e}" alt="${this.ariaLabel}" />`):(this.tabIndex=-1,this.ariaLabel=null,gm``)}};T([Hm({type:Object})],Jx.prototype,"component",void 0),T([Hm({type:Boolean})],Jx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Jx.prototype,"scaleFactor",void 0),Jx=T([$m("nami-image")],Jx);let Qx=class extends bp{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 Lh("");const{component:e,scaleFactor:t}=this,{formFactor:n}=this.contextConsumer.state,{backgroundBlur:i}=e,a="vertical"===e.direction?"margin-top":"margin-left";return Lh(`\n :host {\n max-height: ${"television"===n?"100vh":""};\n display: ${e.hidden?"none":"flex"};\n flex-direction: column;\n overflow: hidden;\n ${Op(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 ${Np(e,!1)}\n transition: all 0.3s;\n ${zp(e,t)}\n }\n :host(:focus){\n ${Np(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=>fg(this.contextProvider,e,this.scaleFactor,void 0,this.minSDKVersion)))}};T([Hm({type:Object})],Qx.prototype,"component",void 0),T([Hm({type:Boolean})],Qx.prototype,"fullscreen",void 0),T([Hm({type:Boolean})],Qx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Qx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],Qx.prototype,"minSDKVersion",void 0),Qx=T([$m("nami-background-container")],Qx);let Zx=class extends bp{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 Ih``;const{formFactor:a}=e.state,{backgroundBlur:r}=t,o="phone"!==a?"width: 100%;":"",s="vertical"===t.direction?"margin-top":"margin-left";return Lh(`\n :host {\n box-sizing: border-box;\n display: ${t.hidden?"none":"flex"};\n position: relative;\n flex: 1;\n min-height: 0;\n ${Fp(t)}\n ${Up(t,i)}\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 ${zp(t,i)}\n ${Np(t,!1)}\n }\n :host::-webkit-scrollbar {\n display: none;\n }\n :host(:focus){\n ${Np(t,!0)}\n }\n :host > * {\n width: 100%;\n }\n :host > *:not(:first-child) {\n ${s}: ${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=>fg(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)))||[]}};T([Hm({type:Object})],Zx.prototype,"component",void 0),T([Hm({type:Number})],Zx.prototype,"zIndex",void 0),T([Hm({type:Boolean})],Zx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Zx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],Zx.prototype,"minSDKVersion",void 0),Zx=T([$m("nami-content-container")],Zx);let eA=class extends bp{constructor(){super(),this.inFocusedState=!1,this.scaleFactor=1,this._handleClick=e=>{e.preventDefault(),Hg({contextProvider:this.contextProvider,onTap:this.component.onTap})},this.addEventListener("click",this._handleClick)}styles(){const e=Qp("active",this.component.components[0]),t=Qp("inactive",this.component.components[0]);return Lh(`\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 ${Fp(this.component)}\n ${Np(this.component,!1)}\n ${Yp(this.component,this.scaleFactor,!1)}\n ${this.component.hidden?"display:none;":""}\n }\n :host(:focus){\n ${Np(this.component,!0)}\n ${Yp(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${tg(this.component)}\n }\n .toggle{\n ${n=this.component,i=this.scaleFactor,`\n position: absolute;\n top: ${Lp(i,n.topPadding)}px;\n bottom: ${Lp(i,n.bottomPadding)}px;\n width: calc(50% - ${Lp(i,n.leftPadding)/2}px) !important;\n `}\n transition: transform .5s cubic-bezier(.77, 0, .175, 1);\n ${Zp(t,this.scaleFactor,!1)}\n }\n\n :host(:focus) .toggle{\n ${Zp(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 ${Np(e,!0)}\n ${eg(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 ${Np(e,!0)}\n ${eg(e,this.scaleFactor)}\n `);var n,i}render(){this.role="tablist";const e=this.component.components.map((e=>fg(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)));return gm`${e}<div class="toggle"></div>`}};T([Hm({type:Object})],eA.prototype,"component",void 0),T([Hm({type:Boolean})],eA.prototype,"inFocusedState",void 0),T([Hm({type:Number})],eA.prototype,"scaleFactor",void 0),T([Hm({type:Object})],eA.prototype,"minSDKVersion",void 0),eA=T([$m("nami-segment-picker")],eA);let tA=class extends bp{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&&kh(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=td(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=Qp("active",this.component),t=Qp("inactive",this.component);return Lh(`\n :host {\n box-sizing: border-box;\n display: ${this.component.hidden?"none":"inline-flex"};\n position: relative;\n ${Zp({...t,...this.component},this.scaleFactor,this.inFocusedState)}\n ${Vp(this.component.inactiveDropShadow??this.component.dropShadow)}\n }\n\n :host > * {\n cursor: pointer;\n }\n\n :host(.active) {\n z-index: 1 !important;\n ${eg({...e,...this.component},this.scaleFactor)}\n ${Vp(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||"",gm`<input type="radio"
|
|
267
|
+
</nami-text-list-item-wrapper>`:null));return gm`${s}`}};T([Hm({type:Object})],Kx.prototype,"component",void 0),T([Hm({type:Boolean})],Kx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Kx.prototype,"scaleFactor",void 0),Kx=T([$m("nami-text-list")],Kx);(()=>{let e=!0;try{new RegExp("","u"),new RegExp("😀","u"),new RegExp("\\p{P}","u")}catch{e=!1}if(e)return;const t=cy.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 Yx=class extends bp{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?Lh(`\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 `):Lh(Np(e,!1));return Lh(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n ${i?`backdrop-filter: blur(${i}px);`:""}\n ${s};\n ${Jp(e.position)}\n ${Fp(e)}\n ${Yp(e,t,!1)}\n }\n :host(:focus),\n :host(.nami-focus-within){\n ${Np(e,!0)}\n ${Yp(e,t,!0)}\n }\n :host(:focus-visible){\n ${tg(e)}\n }\n :host > * {\n ${$p(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=>fg(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([Hm({type:Object})],Yx.prototype,"component",void 0),T([Hm({type:Boolean})],Yx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Yx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],Yx.prototype,"minSDKVersion",void 0),Yx=T([$m("nami-container")],Yx);let qx=class extends bp{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?Lh(`\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 `):Lh(Np(this.component,!1));return Lh(`\n :host {\n opacity: 0;\n display: ${this.component.hidden?"none":"flex"};\n ${a};\n ${e?`backdrop-filter: blur(${e}px);`:""}\n ${Jp(this.component.position)}\n ${Fp(this.component)}\n ${Yp(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 ${Np(this.component,!0)}\n ${Yp(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${tg(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;td(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=Ku(this.contextProvider.productDetails,n?.sku_menus??[],this.component?.subsetGroup||t);return ag(this.contextProvider,a,this.component,e).map((([e,t])=>(this.inFocusedState="television"==i?e:this.inFocusedState,t.map((e=>fg(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion))))))}};T([Hm({type:Object})],qx.prototype,"component",void 0),T([Hm({type:Boolean})],qx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],qx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],qx.prototype,"minSDKVersion",void 0),qx=T([$m("nami-product-container")],qx);let Jx=class extends bp{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 Lh(`\n :host {\n display: ${"television"===d?"flex":"inline-block"};\n ${o?"display:none;":""}\n position: relative;\n height: ${Ip(n??"100%",this.scaleFactor)};\n width: ${Ip(("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: ${Ip(n??"100%",this.scaleFactor)};\n width: ${Ip(("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&&mg(r,a)||(this.tabIndex=0),this.ariaLabel=t??n??"",gm`<img src="${e}" alt="${this.ariaLabel}" />`):(this.tabIndex=-1,this.ariaLabel=null,gm``)}};T([Hm({type:Object})],Jx.prototype,"component",void 0),T([Hm({type:Boolean})],Jx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Jx.prototype,"scaleFactor",void 0),Jx=T([$m("nami-image")],Jx);let Qx=class extends bp{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 Lh("");const{component:e,scaleFactor:t}=this,{formFactor:n}=this.contextConsumer.state,{backgroundBlur:i}=e,a="vertical"===e.direction?"margin-top":"margin-left";return Lh(`\n :host {\n max-height: ${"television"===n?"100vh":""};\n display: ${e.hidden?"none":"flex"};\n flex-direction: column;\n overflow: hidden;\n ${Op(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 ${Np(e,!1)}\n transition: all 0.3s;\n ${zp(e,t)}\n }\n :host(:focus){\n ${Np(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=>fg(this.contextProvider,e,this.scaleFactor,void 0,this.minSDKVersion)))}};T([Hm({type:Object})],Qx.prototype,"component",void 0),T([Hm({type:Boolean})],Qx.prototype,"fullscreen",void 0),T([Hm({type:Boolean})],Qx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Qx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],Qx.prototype,"minSDKVersion",void 0),Qx=T([$m("nami-background-container")],Qx);let Zx=class extends bp{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 Ih``;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: ${Ip(s,i)};`:""):Up(t,i),d="vertical"===t.direction?"margin-top":"margin-left";return Lh(`\n :host {\n box-sizing: border-box;\n display: ${t.hidden?"none":"flex"};\n position: relative;\n flex: 1;\n min-height: 0;\n ${Fp(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 ${zp(t,i)}\n ${Np(t,!1)}\n }\n :host::-webkit-scrollbar {\n display: none;\n }\n :host(:focus){\n ${Np(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=>fg(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)))||[]}};T([Hm({type:Object})],Zx.prototype,"component",void 0),T([Hm({type:Number})],Zx.prototype,"zIndex",void 0),T([Hm({type:Boolean})],Zx.prototype,"inFocusedState",void 0),T([Hm({type:Number})],Zx.prototype,"scaleFactor",void 0),T([Hm({type:Object})],Zx.prototype,"minSDKVersion",void 0),Zx=T([$m("nami-content-container")],Zx);let eA=class extends bp{constructor(){super(),this.inFocusedState=!1,this.scaleFactor=1,this._handleClick=e=>{e.preventDefault(),Hg({contextProvider:this.contextProvider,onTap:this.component.onTap})},this.addEventListener("click",this._handleClick)}styles(){const e=Qp("active",this.component.components[0]),t=Qp("inactive",this.component.components[0]);return Lh(`\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 ${Fp(this.component)}\n ${Np(this.component,!1)}\n ${Yp(this.component,this.scaleFactor,!1)}\n ${this.component.hidden?"display:none;":""}\n }\n :host(:focus){\n ${Np(this.component,!0)}\n ${Yp(this.component,this.scaleFactor,!0)}\n }\n :host(:focus-visible){\n ${tg(this.component)}\n }\n .toggle{\n ${n=this.component,i=this.scaleFactor,`\n position: absolute;\n top: ${Lp(i,n.topPadding)}px;\n bottom: ${Lp(i,n.bottomPadding)}px;\n width: calc(50% - ${Lp(i,n.leftPadding)/2}px) !important;\n `}\n transition: transform .5s cubic-bezier(.77, 0, .175, 1);\n ${Zp(t,this.scaleFactor,!1)}\n }\n\n :host(:focus) .toggle{\n ${Zp(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 ${Np(e,!0)}\n ${eg(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 ${Np(e,!0)}\n ${eg(e,this.scaleFactor)}\n `);var n,i}render(){this.role="tablist";const e=this.component.components.map((e=>fg(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion)));return gm`${e}<div class="toggle"></div>`}};T([Hm({type:Object})],eA.prototype,"component",void 0),T([Hm({type:Boolean})],eA.prototype,"inFocusedState",void 0),T([Hm({type:Number})],eA.prototype,"scaleFactor",void 0),T([Hm({type:Object})],eA.prototype,"minSDKVersion",void 0),eA=T([$m("nami-segment-picker")],eA);let tA=class extends bp{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&&kh(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=td(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=Qp("active",this.component),t=Qp("inactive",this.component);return Lh(`\n :host {\n box-sizing: border-box;\n display: ${this.component.hidden?"none":"inline-flex"};\n position: relative;\n ${Zp({...t,...this.component},this.scaleFactor,this.inFocusedState)}\n ${Vp(this.component.inactiveDropShadow??this.component.dropShadow)}\n }\n\n :host > * {\n cursor: pointer;\n }\n\n :host(.active) {\n z-index: 1 !important;\n ${eg({...e,...this.component},this.scaleFactor)}\n ${Vp(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||"",gm`<input type="radio"
|
|
266
268
|
autocomplete="off"
|
|
267
269
|
id="${this.component.text}"
|
|
268
270
|
name="${this.component.text}"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namiml/web-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.3.9-dev.
|
|
4
|
+
"version": "3.3.9-dev.202603141643",
|
|
5
5
|
"source": "src/nami-web.ts",
|
|
6
6
|
"description": "Subscription monetization infrastructure — drop-in SDK with no-code paywalls, onboarding flows, A/B testing for web",
|
|
7
7
|
"scripts": {
|