From 265838f639f71a88ba0154adb8e0faf6d4e45bde Mon Sep 17 00:00:00 2001 From: sharathkannan <138484653+sharath-kannan@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:45:37 +0530 Subject: [PATCH 1/7] Fix(MWPW-152290):Removed the horizontal scroll seen in windows machines. (#2471) * horizontal overflow are hidden * changed the rule for property * changed % to vh --- libs/styles/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/styles/styles.css b/libs/styles/styles.css index a1fddf063e..a54f7d8799 100644 --- a/libs/styles/styles.css +++ b/libs/styles/styles.css @@ -108,7 +108,7 @@ /* grid sizes */ --grid-container-width: 83.4%; --grid-column-width: calc(var(--grid-container-width) / 12); - --grid-margins-width: calc((100vw - var(--grid-container-width)) / 2); + --grid-margins-width: calc((100% - var(--grid-container-width)) / 2); --grid-margins-width-10: calc((100vw - (var(--grid-column-width) * 10)) / 2); --grid-margins-width-8: calc((100vw - (var(--grid-column-width) * 8)) / 2); --grid-margins-width-6: calc((100vw - (var(--grid-column-width) * 6)) / 2); From daef70b286c44baccb908e925e8fd6da2c93acf2 Mon Sep 17 00:00:00 2001 From: Siva S <163842332+sivasadobe@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:45:44 +0530 Subject: [PATCH 2/7] MWPW-147468 - Delayed Activation of Blade Animations on Ps Product Page (#2487) * feat(video): implemented video play within the viewport * chore(video): opacity removed * fix: window extension * fix(DOM-exception): fixed dom exception & fixes test cases * fix(unit-test): removed dublicates urls in mocks * fix: test case added for play/pause & end event * chore: removed dublicate checks --- libs/blocks/video/video.js | 3 +- libs/utils/decorate.js | 38 ++++++- test/blocks/video/mocks/body.html | 49 +++++++++ test/blocks/video/video.test.js | 166 ++++++++++++++++++++++++++++-- 4 files changed, 246 insertions(+), 10 deletions(-) diff --git a/libs/blocks/video/video.js b/libs/blocks/video/video.js index 0cc438723e..43deb1b19d 100644 --- a/libs/blocks/video/video.js +++ b/libs/blocks/video/video.js @@ -1,5 +1,5 @@ import { createIntersectionObserver, getConfig } from '../../utils/utils.js'; -import { applyHoverPlay, getVideoAttrs } from '../../utils/decorate.js'; +import { applyHoverPlay, getVideoAttrs, applyInViewPortPlay } from '../../utils/decorate.js'; const ROOT_MARGIN = 1000; @@ -23,6 +23,7 @@ const loadVideo = (a) => { a.insertAdjacentHTML('afterend', video); const videoElem = document.body.querySelector(`source[src="${videoPath}"]`)?.parentElement; applyHoverPlay(videoElem); + applyInViewPortPlay(videoElem); a.remove(); }; diff --git a/libs/utils/decorate.js b/libs/utils/decorate.js index 7621c3b7ba..6754dd4faa 100644 --- a/libs/utils/decorate.js +++ b/libs/utils/decorate.js @@ -174,12 +174,14 @@ export function getVideoAttrs(hash, dataset) { const isAutoplay = hash?.includes('autoplay'); const isAutoplayOnce = hash?.includes('autoplay1'); const playOnHover = hash?.includes('hoverplay'); + const playInViewport = hash?.includes('viewportplay'); const poster = dataset?.videoPoster ? `poster='${dataset.videoPoster}'` : ''; const globalAttrs = `playsinline ${poster}`; const autoPlayAttrs = 'autoplay muted'; + const playInViewportAttrs = playInViewport ? 'data-play-viewport' : ''; if (isAutoplay && !isAutoplayOnce) { - return `${globalAttrs} ${autoPlayAttrs} loop`; + return `${globalAttrs} ${autoPlayAttrs} loop ${playInViewportAttrs}`; } if (playOnHover && isAutoplayOnce) { return `${globalAttrs} ${autoPlayAttrs} data-hoverplay`; @@ -188,7 +190,7 @@ export function getVideoAttrs(hash, dataset) { return `${globalAttrs} muted data-hoverplay`; } if (isAutoplayOnce) { - return `${globalAttrs} ${autoPlayAttrs}`; + return `${globalAttrs} ${autoPlayAttrs} ${playInViewportAttrs}`; } return `${globalAttrs} controls`; } @@ -225,3 +227,35 @@ export function handleObjectFit(bgRow) { setObjectFitAndPos(text, pic, r, ['fill', 'contain', 'cover', 'none', 'scale-down']); }); } + +export function getVideoIntersectionObserver() { + if (!window?.videoIntersectionObs) { + window.videoIntersectionObs = new window.IntersectionObserver((entries) => { + entries.forEach((entry) => { + const { intersectionRatio, target: video } = entry; + const isHaveLoopAttr = video.getAttributeNames().includes('loop'); + const { playedOnce = false } = video.dataset; + const isPlaying = video.currentTime > 0 && !video.paused && !video.ended + && video.readyState > video.HAVE_CURRENT_DATA; + + if (intersectionRatio <= 0.8) { + video.pause(); + } else if ((isHaveLoopAttr || !playedOnce) && !isPlaying) { + video.play(); + } + }); + }, { threshold: [0.8] }); + } + return window.videoIntersectionObs; +} + +export function applyInViewPortPlay(video) { + if (!video) return; + if (video.hasAttribute('data-play-viewport')) { + const observer = getVideoIntersectionObserver(); + video.addEventListener('ended', () => { + video.dataset.playedOnce = true; + }); + observer.observe(video); + } +} diff --git a/test/blocks/video/mocks/body.html b/test/blocks/video/mocks/body.html index 675392e960..bafb0a0338 100644 --- a/test/blocks/video/mocks/body.html +++ b/test/blocks/video/mocks/body.html @@ -1,3 +1,8 @@ +
@@ -37,4 +42,48 @@ https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb.mp4#_hoverplay
+ +
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb1.mp4#autoplay#viewportplay + +
+ +
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb8.mp4#autoplay#viewportplay + +
+
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb2.mp4#autoplay1#viewportplay + +
+ +
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb8.mp4#autoplay1#viewportplay + +
+ +
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb3.mp4#viewportplay + +
+
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb4.mp4#viewportplay + +
+
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb5.mp4#viewportplay#_hoverplay + +
+
+ + https://main--milo--adobecom.hlx.page/media_1e798d01c6ddc7e7eadc8f134d69e4f8d7193fdbb6.mp4#autoplay1#_hoverplay#viewportplay + +
diff --git a/test/blocks/video/video.test.js b/test/blocks/video/video.test.js index 68b31cd269..e80298c650 100644 --- a/test/blocks/video/video.test.js +++ b/test/blocks/video/video.test.js @@ -1,5 +1,8 @@ import { readFile } from '@web/test-runner-commands'; -import { expect } from '@esm-bundle/chai'; +import { expect, assert } from '@esm-bundle/chai'; + +import sinon from 'sinon'; + import { waitForElement } from '../../helpers/waitfor.js'; import { setConfig } from '../../../libs/utils/utils.js'; @@ -71,12 +74,11 @@ describe('video uploaded using franklin bot', () => { it('no hoverplay attribute added when with autoplay on loop', async () => { const block = document.querySelector('.video.autoplay.playonhover'); const a = block.querySelector('a'); - const { href } = a; - a.textContent = href; + a.textContent = 'no-lazy'; block.append(a); init(a); - const video = await waitForElement('.video.autoplay.playonhover video'); + const video = block.querySelector('video'); expect(video.hasAttribute('loop')).to.be.true; expect(video.hasAttribute('data-hoverplay')).to.be.false; }); @@ -84,12 +86,162 @@ describe('video uploaded using franklin bot', () => { it('decorate video with hoverplay when only hoverplay is added to url', async () => { const block = document.querySelector('.video.hoveronly'); const a = block.querySelector('a'); - const { href } = a; - a.textContent = href; + a.textContent = 'no-lazy'; block.append(a); init(a); - const video = await waitForElement('.video.hoveronly video'); + const video = block.querySelector('video'); expect(video.hasAttribute('data-hoverplay')).to.be.true; }); + + it('decorate video with viewportplay only with autoplay', async () => { + const block = document.querySelector('.video.autoplay.viewportplay'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + + init(a); + const video = block.querySelector('video'); + expect(video.hasAttribute('data-play-viewport')).to.be.true; + }); + + it('play video when element reached 80% viewport', async () => { + const block = document.querySelector('.video.autoplay.viewportplay.scrolled-80'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + const nextFrame = () => new Promise((resolve) => { + requestAnimationFrame(resolve); + }); + + init(a); + const video = block.querySelector('video'); + const source = video.querySelector('source'); + source.setAttribute('src', 'https://www.adobe.com/creativecloud/media_1167374e3354ef57f126fa78a55cbc1708ac4babd.mp4'); + source.setAttribute('type', 'video/mp4'); + + const playSpy = sinon.spy(video, 'play'); + const pauseSpy = sinon.spy(video, 'pause'); + + video.scrollIntoView(); + await nextFrame(); + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + assert.isTrue(playSpy.calledOnce); + + document.body.scrollIntoView(); + await nextFrame(); + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + assert.isTrue(pauseSpy.calledOnce); + + expect(video.hasAttribute('data-play-viewport')).to.be.true; + }); + + it('Don\'t play the video once it end when autoplay1 enabled', async () => { + const block = document.querySelector('.video.autoplay1.viewportplay.ended'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + const nextFrame = () => new Promise((resolve) => { + requestAnimationFrame(resolve); + }); + + init(a); + const video = block.querySelector('video'); + const source = video.querySelector('source'); + source.setAttribute('src', 'https://www.adobe.com/creativecloud/media_1167374e3354ef57f126fa78a55cbc1708ac4babd.mp4'); + source.setAttribute('type', 'video/mp4'); + + const playSpy = sinon.spy(video, 'play'); + const pauseSpy = sinon.spy(video, 'pause'); + const endedSpy = sinon.spy(); + video.addEventListener('ended', endedSpy); + + video.scrollIntoView(); + await nextFrame(); + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + assert.isTrue(playSpy.calledOnce); + + document.body.scrollIntoView(); + await nextFrame(); + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + assert.isTrue(pauseSpy.calledOnce); + + video.dispatchEvent(new Event('ended')); + await nextFrame(); + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + + video.scrollIntoView(); + await nextFrame(); + await new Promise((resolve) => { + setTimeout(resolve, 100); + }); + + expect(playSpy.callCount).to.equal(1); + expect(video.hasAttribute('data-play-viewport')).to.be.true; + }); + + it('decorate video with viewportplay only with autoplay1', async () => { + const block = document.querySelector('.video.autoplay1.viewportplay'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + + init(a); + const video = block.querySelector('video'); + expect(video.hasAttribute('data-play-viewport')).to.be.true; + }); + + it('decorate video with no viewportplay with autoplay1 hoverplay', async () => { + const block = document.querySelector('.video.autoplay1.hoverplay.no-viewportplay'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + + init(a); + const video = block.querySelector('video'); + expect(video.hasAttribute('data-play-viewport')).to.be.false; + }); + + it('decorate video with no viewportplay with hoverplay', async () => { + const block = document.querySelector('.video.hoverplay.no-viewportplay'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + + init(a); + const video = block.querySelector('video'); + expect(video.hasAttribute('data-play-viewport')).to.be.false; + }); + + it('decorate video with no viewportplay no autoplay', async () => { + const block = document.querySelector('.video.no-autoplay.no-viewportplay'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + + init(a); + const video = block.querySelector('video'); + expect(video.hasAttribute('data-play-viewport')).to.be.false; + }); + + it('decorate video with no viewportplay no autoplay1', async () => { + const block = document.querySelector('.video.no-autoplay1.no-viewportplay'); + const a = block.querySelector('a'); + a.textContent = 'no-lazy'; + block.append(a); + + init(a); + const video = block.querySelector('video'); + expect(video.hasAttribute('data-play-viewport')).to.be.false; + }); }); From 14af63423ec859b7121d859642c843ce3cf0d7c5 Mon Sep 17 00:00:00 2001 From: Amol Anand Date: Mon, 8 Jul 2024 05:15:51 -0400 Subject: [PATCH 3/7] Exposing the UNav Config for consumers to modify and reload the UNav if needed (#2501) * exporting the unav config to be consumed and modified later by consumers * Adding a comment to explain why we need this * Updating comment * getting the Unav config from the object before reloading --- libs/blocks/global-navigation/global-navigation.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/blocks/global-navigation/global-navigation.js b/libs/blocks/global-navigation/global-navigation.js index fcb39da851..83d5737aac 100644 --- a/libs/blocks/global-navigation/global-navigation.js +++ b/libs/blocks/global-navigation/global-navigation.js @@ -621,10 +621,12 @@ class Gnav { children: getChildren(), }); - window.UniversalNav(getConfiguration()); + // Exposing UNAV config for consumers + CONFIG.universalNav.universalNavConfig = getConfiguration(); + window.UniversalNav(CONFIG.universalNav.universalNavConfig); isDesktop.addEventListener('change', () => { - window.UniversalNav.reload(getConfiguration()); + window.UniversalNav.reload(CONFIG.universalNav.universalNavConfig); }); }; From 5f2f3e2ce513a3f86697673b6c29a39938b6200d Mon Sep 17 00:00:00 2001 From: Mira Fedas <30750556+mirafedas@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:15:58 +0200 Subject: [PATCH 4/7] MWPW-153657: Set the strikethrough price font size to 14px only in merch cards (#2527) * set the strikethrough price to 14px in merch card * updated merch-card --- libs/deps/merch-card.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libs/deps/merch-card.js b/libs/deps/merch-card.js index 397c18271c..34545131dd 100644 --- a/libs/deps/merch-card.js +++ b/libs/deps/merch-card.js @@ -1,4 +1,4 @@ -// branch: main commit: fbbefe1b71216b73b1e41d50997927fbc7340473 Tue, 25 Jun 2024 15:33:55 GMT +// branch: main commit: 258ad3d851cc4945eae2aab2dcc80a8d0c14d861 Fri, 28 Jun 2024 14:19:21 GMT import{html as a,LitElement as j}from"/libs/deps/lit-all.min.js";import{LitElement as q,html as T,css as F}from"/libs/deps/lit-all.min.js";var s=class extends q{static properties={size:{type:String,attribute:!0},src:{type:String,attribute:!0},alt:{type:String,attribute:!0},href:{type:String,attribute:!0}};constructor(){super(),this.size="m",this.alt=""}render(){let{href:e}=this;return e?T` ${this.alt} `:T` ${this.alt}`}static styles=F` @@ -395,8 +395,10 @@ import{html as a,LitElement as j}from"/libs/deps/lit-all.min.js";import{LitEleme @media screen and ${u(i)} { :host([size='wide']), :host([size='super-wide']) { - grid-column: span 2; + grid-column: span 3; width: 100%; + max-width: var(--consonant-merch-card-tablet-wide-width); + margin: 0 auto; } } @@ -428,6 +430,7 @@ import{html as a,LitElement as j}from"/libs/deps/lit-all.min.js";import{LitEleme /* responsive width */ --consonant-merch-card-mobile-width: 300px; + --consonant-merch-card-tablet-wide-width: 700px; /* spacing */ --consonant-merch-spacing-xxxs: 4px; @@ -798,11 +801,6 @@ merch-card[variant="mini-compare-chart"] [is="inline-price"] { min-width: 1px; } -merch-card[variant="mini-compare-chart"] span.placeholder-resolved[data-template="strikethrough"] { - font-size: var(--consonant-merch-card-body-m-font-size); - font-weight: 500; -} - merch-card[variant="mini-compare-chart"] [slot="price-commitment"] { font-size: var(--consonant-merch-card-body-xs-font-size); padding: 0 var(--consonant-merch-spacing-s); @@ -908,8 +906,8 @@ merch-card[variant="mini-compare-chart"] .footer-row-cell-description a { padding-bottom: 0; } - merch-card[variant="mini-compare-chart"] span.placeholder-resolved[data-template="strikethrough"] { - font-size: var(--consonant-merch-card-body-xs-font-size); + html[lang="he"] merch-card[variant="mini-compare-chart"] [is="inline-price"] .price-recurrence::before { + content: "\\200B"; } merch-card[variant="mini-compare-chart"] [slot="price-commitment"] { @@ -1383,6 +1381,12 @@ span[is="inline-price"][data-template='strikethrough'] { text-decoration: line-through; } +merch-card span.placeholder-resolved[data-template='strikethrough'], +merch-card span.price.price-strikethrough { + font-size: var(--consonant-merch-card-body-xs-font-size); + font-weight: normal; +} + /* merch-offer-select */ merch-offer-select[variant="subscription-options"] merch-offer span[is="inline-price"][data-display-tax='true'] .price-tax-inclusivity { font-size: 12px; From 15f8c9fd52f954f33d1e0fa67cfb4d43c950d307 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <118168183+sharmrj@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:47:48 +0530 Subject: [PATCH 5/7] MWPW-141022 [Project PEP] Prompt Dismissal + Tie-in with App Launcher UX (#2392) * Added a way to mock entitlements in non prod environments for testing purposes * Added a pulsing animation after dismissing the PEP modal * Added the ability to debug pep in prod; added skipPepEntitlements option * fixed url for loading the pep dismissal animation * Another url fix for the pep dismissal animation css file * slowed down the default animation * Added the tooltip * re-enabled tracking dismissed prompts * added tooltip that uses data attributes; cleaned up ring animation slightly * styled the tooltip in accordance with the new figma spec sheet * Changed the color of the tooltip * Pick up pep dismissal action config from section metadata; fixed lowercase url issue * Updated unit tests * updated an incomplete pep test * Fixed dismissal actions firing when redirecting * Removed a comment * added tests for running dismissal actions * Tooltip and animation are now cleared if the app switcher is clicked * added a missing semicolon * small refactor of remove animation/tooltip on click logic * A bit of cleanup * removed some unnecessary code * Fixed a bug introduced by one of the previous fixes * fixed a classname * Formatting of an html string * replaced all usage of right in absolute positioning with left * Added CONFIG default values to dismissal action function parameter lists * renamed a variable * Removed an unused variable * Grouped together common css rules in tooltip.css * Combined dismissal css with the general webapp-prompt css * Removed an unused import * Added a unit test * Removed some unneeded newlines * Moved the tooltip down slightly * Added a missing curly brace * added a missing semicolon on line 92 of libs/features/webapp-prompt/webapp-prompt.js Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * made the dismissal config its own entity * added some variables to the focus animation css * removed a redundant style * cleaned up the padding css for the tooltip * minor refactoring * Changed the tooltip fontfamily to use the milo styles variable defined in root * Removed an unnecessary css rule * Replaced tabs with spaces in webapp-prompt.css * Fixed the PEP unit tests * clock cleanup in tests * fixed an issue with the redirect * small change * Fixed eslint error by making a method static * Fixed failing tests --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- libs/features/webapp-prompt/webapp-prompt.css | 115 ++++++++++++++++++ libs/features/webapp-prompt/webapp-prompt.js | 95 +++++++++++++-- .../webapp-prompt/mocks/pep-prompt-content.js | 27 +++- test/features/webapp-prompt/test-utilities.js | 13 +- .../webapp-prompt/webapp-prompt.test.js | 110 ++++++++++++----- 5 files changed, 318 insertions(+), 42 deletions(-) diff --git a/libs/features/webapp-prompt/webapp-prompt.css b/libs/features/webapp-prompt/webapp-prompt.css index 1fbc0baae8..cd421f6f8a 100644 --- a/libs/features/webapp-prompt/webapp-prompt.css +++ b/libs/features/webapp-prompt/webapp-prompt.css @@ -188,3 +188,118 @@ } } } + +/* DISMISSAL TOOLTIP */ + +[data-pep-dismissal-tooltip]::after { + content: attr(data-pep-dismissal-tooltip); + display: inline-flex; + z-index: 3; + height: fit-content; + width: 8.875rem; + top: 125%; + left: -300%; + word-break: break-word; + border-radius: 7px; + + padding-inline: 0.5625rem; + padding-block: 0.25rem 0.3125rem; + + font-family: var(--body-font-family); + font-size: 0.75rem; + line-height: 0.9375rem; + color: white; +} + +[data-pep-dismissal-tooltip]::before { + content: ''; + z-index: 2; + width: 0.44rem; + height: 0.44rem; + border-radius: 0.05rem; + left: calc(50% - 0.22rem); + top: 115%; + + transform: rotate(45deg); +} + +[data-pep-dismissal-tooltip]::before, +[data-pep-dismissal-tooltip]::after { + background-color: #3B63FB; + position: absolute; + pointer-events: none; + transition: opacity 0.5s; +} + +@media (min-width: 1520px) { + [data-pep-dismissal-tooltip]::after { + left: calc(50% - 5rem); + } +} + +/* DISMISSAL ANIMATION */ + +.coach-indicator { + --coach-indicator-ring-default-color: rgba(56,146,243); + --coach-indicator-ring-diameter: 1.25rem; + --coach-indicator-ring-border-size: 2px; + --coach-indicator-ring-inline-size: var(--coach-indicator-ring-diameter); + --coach-indicator-ring-block-size: var(--coach-indicator-ring-diameter); + --coach-indicator-first-ring-delay-fraction: 0; + --coach-indicator-second-ring-delay-fraction: 0.33; + --coach-indicator-third-ring-delay-fraction: 0.66; + --animation-duration: 3000ms; +} + +@keyframes pulse { + 0% { + transform: scale(0.8); + opacity: 0; + } + + 50% { + transform: scale(1.5); + opacity: 1; + } + + 100% { + transform: scale(2); + opacity: 0; + } +} + +.coach-indicator .coach-indicator-ring { + display: block; + position: absolute; + top: 14%; + left: 13%; + + border-style: solid; + border-width: var(--coach-indicator-ring-border-size); + border-color: var(--coach-indicator-ring-default-color); + + inline-size: var(--coach-indicator-ring-inline-size); + block-size: var(--coach-indicator-ring-block-size); + animation: pulse var(--animation-duration) linear; + animation-fill-mode: both; + + border-radius: 5px; +} + +.coach-indicator .coach-indicator-ring:nth-child(1) { + animation-delay: calc(var(--animation-duration)*var(--coach-indicator-first-ring-delay-fraction)); +} + +.coach-indicator .coach-indicator-ring:nth-child(2) { + animation-delay: calc(var(--animation-duration)*var(--coach-indicator-second-ring-delay-fraction)); +} + +.coach-indicator .coach-indicator-ring:nth-child(3) { + animation-delay: calc(var(--animation-duration)*var(--coach-indicator-third-ring-delay-fraction)); +} + +@media (prefers-reduced-motion: reduce) { + .coach-indicator .coach-indicator-ring { + animation: none; + } +} diff --git a/libs/features/webapp-prompt/webapp-prompt.js b/libs/features/webapp-prompt/webapp-prompt.js index 418d2ad68d..d41207135c 100644 --- a/libs/features/webapp-prompt/webapp-prompt.js +++ b/libs/features/webapp-prompt/webapp-prompt.js @@ -8,13 +8,21 @@ import { import { getConfig, decorateSVG } from '../../utils/utils.js'; import { replaceKey, replaceText } from '../placeholders.js'; +export const DISMISSAL_CONFIG = { + animationCount: 2, + animationDuration: 2500, + tooltipMessage: 'Use the App Switcher to quickly find apps.', + tooltipDuration: 5000, +}; + const CONFIG = { selectors: { prompt: '.appPrompt' }, delay: 7000, loaderColor: '#EB1000', + ...DISMISSAL_CONFIG, }; -const getElemText = (elem) => elem?.textContent?.trim().toLowerCase(); +const getElemText = (elem) => elem?.textContent?.trim(); const getMetadata = (el) => [...el.childNodes].reduce((acc, row) => { if (row.children?.length === 2) { @@ -35,6 +43,54 @@ const getIcon = (content) => { return icons.company; }; +const showTooltip = ( + element, + message = CONFIG.tooltipMessage, + time = CONFIG.tooltipDuration, +) => { + element.setAttribute('data-pep-dismissal-tooltip', message); + const cleanup = () => element.removeAttribute('data-pep-dismissal-tooltip'); + const timeoutID = setTimeout(cleanup, time); + element.addEventListener('click', () => { + cleanup(); + clearTimeout(timeoutID); + }, { once: true }); +}; + +const playFocusAnimation = ( + element, + iterationCount = CONFIG.animationCount, + animationDuration = CONFIG.animationDuration, +) => { + element.classList.add('coach-indicator'); + element.style.setProperty('--animation-duration', `${animationDuration}ms`); + const rings = []; + const createRing = () => toFragment` +
+
`; + for (let i = 0; i < 3; i += 1) { + const ring = createRing(); + element.insertAdjacentElement('afterbegin', ring); + rings.push(ring); + } + // The cleanup function is added to the event queue + // some time after the end of the animation because + // the cleanup isn't high priority but it should be done + // eventually. (Animation truly ends slightly after + // animationDuration * iterationCount due to animation-delay) + const cleanup = () => { + rings.forEach((ring) => ring.remove()); + element.classList.remove('coach-indicator'); + }; + const timeoutID = setTimeout(cleanup, (iterationCount + 1) * animationDuration); + element.addEventListener('click', () => { + cleanup(); + clearTimeout(timeoutID); + }, { once: true }); +}; + const modalsActive = () => !!document.querySelector('.dialog-modal'); const waitForClosedModalsThen = (loadPEP) => { @@ -59,7 +115,10 @@ class AppPrompt { () => waitForClosedModalsThen(this.init), { once: true }, ); - } else this.init(); + this.initializationQueued = true; + return; + } + this.initializationQueued = false; } init = async () => { @@ -162,6 +221,10 @@ class AppPrompt { const metadata = getMetadata(content.querySelector('.section-metadata')); metadata['loader-duration'] = parseInt(metadata['loader-duration'] || CONFIG.delay, 10); metadata['loader-color'] = metadata['loader-color'] || CONFIG.loaderColor; + metadata['dismissal-animation-count'] = parseInt(metadata['dismissal-animation-count'] ?? CONFIG.animationCount, 10); + metadata['dismissal-animation-duration'] = parseInt(metadata['dismissal-animation-duration'] ?? CONFIG.animationDuration, 10); + metadata['dismissal-tooltip-message'] ??= CONFIG.tooltipMessage; + metadata['dismissal-tooltip-duration'] = parseInt(metadata['dismissal-tooltip-duration'] ?? CONFIG.tooltipDuration, 10); this.options = metadata; }; @@ -181,7 +244,7 @@ class AppPrompt { : ''; return toFragment`
${this.elements.closeIcon}
@@ -200,7 +263,7 @@ class AppPrompt { }; addEventListeners = () => { - this.anchor?.addEventListener('click', this.close); + this.anchor?.addEventListener('click', () => this.close({ dismissalActions: false })); document.addEventListener('keydown', this.handleKeyDown); [this.elements.closeIcon, this.elements.cta] @@ -211,9 +274,11 @@ class AppPrompt { if (event.key === 'Escape') this.close(); }; + static redirectTo = (url) => window.location.assign(url); + initRedirect = () => setTimeout(() => { - this.close({ saveDismissal: false }); - window.location.assign(this.options['redirect-url']); + this.close({ saveDismissal: false, dismissalActions: false }); + this.redirectTo(this.options['redirect-url']); }, this.options['loader-duration']); isDismissedPrompt = () => AppPrompt.getDismissedPrompts().includes(this.id); @@ -224,7 +289,7 @@ class AppPrompt { document.cookie = `dismissedAppPrompts=${JSON.stringify([...dismissedPrompts])};path=/`; }; - close = ({ saveDismissal = true } = {}) => { + close = ({ saveDismissal = true, dismissalActions = true } = {}) => { const appPromptElem = document.querySelector(CONFIG.selectors.prompt); appPromptElem?.remove(); clearTimeout(this.redirectFn); @@ -232,6 +297,19 @@ class AppPrompt { document.removeEventListener('keydown', this.handleKeyDown); this.anchor?.focus(); this.anchor?.removeEventListener('click', this.close); + + if (dismissalActions) { + playFocusAnimation( + this.anchor, + this.options['dismissal-animation-count'], + this.options['dismissal-animation-duration'], + ); + showTooltip( + this.anchor, + this.options['dismissal-tooltip-message'], + this.options['dismissal-tooltip-duration'], + ); + } }; static getDismissedPrompts = () => { @@ -246,7 +324,8 @@ class AppPrompt { export default async function init(config) { try { - const appPrompt = await new AppPrompt(config); + const appPrompt = new AppPrompt(config); + if (!appPrompt.initializationQueued) await appPrompt.init(); return appPrompt; } catch (e) { lanaLog({ message: 'Could not initialize PEP', e, tags: 'errorType=error,module=pep' }); diff --git a/test/features/webapp-prompt/mocks/pep-prompt-content.js b/test/features/webapp-prompt/mocks/pep-prompt-content.js index 9f32193ae4..165185e344 100644 --- a/test/features/webapp-prompt/mocks/pep-prompt-content.js +++ b/test/features/webapp-prompt/mocks/pep-prompt-content.js @@ -1,4 +1,13 @@ -export default ({ color, loaderDuration, redirectUrl, productName }) => `
+export default ({ + color, + loaderDuration, + redirectUrl, + productName, + animationCount, + animationDuration, + tooltipMessage, + tooltipDuration, +}) => `

@@ -27,5 +36,21 @@ export default ({ color, loaderDuration, redirectUrl, productName }) => `

product-name
${productName}
`} + ${animationCount && `
+
dismissal-animation-count
+
${animationCount}
+
`} + ${animationDuration && `
+
dismissal-animation-duration
+
${animationDuration}
+
`} + ${tooltipMessage && `
+
dismissal-tooltip-message
+
${tooltipMessage}
+
`} + ${tooltipDuration && `
+
dismissal-tooltip-duration
+
${tooltipDuration}
+
`}
`; diff --git a/test/features/webapp-prompt/test-utilities.js b/test/features/webapp-prompt/test-utilities.js index d74376db6c..7905390380 100644 --- a/test/features/webapp-prompt/test-utilities.js +++ b/test/features/webapp-prompt/test-utilities.js @@ -1,7 +1,8 @@ import { setViewport } from '@web/test-runner-commands'; import sinon from 'sinon'; -import init from '../../../libs/features/webapp-prompt/webapp-prompt.js'; +import init, { DISMISSAL_CONFIG } from '../../../libs/features/webapp-prompt/webapp-prompt.js'; import { viewports, mockRes as importedMockRes } from '../../blocks/global-navigation/test-utilities.js'; +import { setUserProfile } from '../../../libs/blocks/global-navigation/utilities/utilities.js'; import { getConfig, loadStyle, setConfig, updateConfig } from '../../../libs/utils/utils.js'; export const allSelectors = { @@ -17,6 +18,8 @@ export const allSelectors = { progressWrapper: '.appPrompt-progressWrapper', progress: '.appPrompt-progress', appSwitcher: '#unav-app-switcher', + indicatorRing: '.coach-indicator-ring', + tooltip: '[data-pep-dismissal-tooltip]', }; export const defaultConfig = { @@ -24,6 +27,7 @@ export const defaultConfig = { loaderDuration: 7500, redirectUrl: 'https://www.adobe.com/?pep=true', productName: 'photoshop', + ...DISMISSAL_CONFIG, }; export const mockRes = importedMockRes; @@ -38,6 +42,7 @@ export const initPep = async ({ entName = 'firefly-web-usage', isAnchorOpen = fa await setViewport(viewports.desktop); await loadStyle('../../../libs/features/webapp-prompt/webapp-prompt.css'); + setUserProfile({}); const pep = await init({ promptPath: 'https://pep-mocks.test/pep-prompt-content.plain.html', getAnchorState: getAnchorStateMock || (async () => ({ id: 'unav-app-switcher', isOpen: isAnchorOpen })), @@ -45,6 +50,10 @@ export const initPep = async ({ entName = 'firefly-web-usage', isAnchorOpen = fa parent: document.querySelector('div.feds-utilities'), }); - sinon.stub(pep, 'initRedirect').callsFake(() => null); + Object.setPrototypeOf(pep, { + ...Object.getPrototypeOf(pep), + redirectTo: sinon.stub().returns({}), + }); + return pep; }; diff --git a/test/features/webapp-prompt/webapp-prompt.test.js b/test/features/webapp-prompt/webapp-prompt.test.js index c3e6bf6c6c..38a89acfbc 100644 --- a/test/features/webapp-prompt/webapp-prompt.test.js +++ b/test/features/webapp-prompt/webapp-prompt.test.js @@ -3,17 +3,12 @@ import sinon, { stub } from 'sinon'; import pepPromptContent from './mocks/pep-prompt-content.js'; describe('PEP', () => { - let clock; let allSelectors; let defaultConfig; let mockRes; let initPep; beforeEach(async () => { - clock = sinon.useFakeTimers({ - toFake: ['setTimeout'], - shouldAdvanceTime: true, - }); // We need to import the utilities after mocking setTimeout to ensure // their setTimeout calls use Sinon's mocked implementation. // Importing before mocking would lead to a 5s PEP timeout, exceeding the 2s test limit. @@ -33,7 +28,6 @@ describe('PEP', () => { afterEach(() => { sinon.restore(); - clock.restore(); document.body.innerHTML = ''; document.cookie = `${document.cookie};expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`; }); @@ -41,20 +35,17 @@ describe('PEP', () => { describe('PEP rendering tests', () => { it('should render PEP', async () => { await initPep({}); - await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.exist; }); it('should not render PEP when previously dismissed', async () => { document.cookie = 'dismissedAppPrompts=["pep-prompt-content.plain.html"]'; await initPep({}); - await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should not render PEP when the entitlement does not match', async () => { await initPep({ entName: 'not-matching-entitlement' }); - await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); @@ -71,7 +62,6 @@ describe('PEP', () => { return null; }); await initPep({}); - await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); @@ -82,27 +72,22 @@ describe('PEP', () => { return null; }); await initPep({}); - await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should not render PEP when the anchor element is open', async () => { await initPep({ isAnchorOpen: true }); - await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should not render PEP when the GRM is open', async () => { + const clock = sinon.useFakeTimers(); document.body.insertAdjacentHTML('afterbegin', '
'); document.body.insertAdjacentHTML('afterbegin', '
'); await initPep({}); - try { - clock.runAll(); - } catch (e) { - expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; - } + expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; const event = new CustomEvent('milo:modal:closed'); window.dispatchEvent(event); @@ -110,70 +95,135 @@ describe('PEP', () => { document.querySelector('.locale-modal-v2')?.remove(); document.querySelector('.dialog-modal')?.remove(); - await clock.runAllAsync(); + await clock.tickAsync(300); + expect(document.querySelector(allSelectors.pepWrapper)).to.exist; + clock.uninstall(); }); }); describe('PEP configuration tests', () => { - it('should use config values when metadata loader color or duration are not provided', async () => { + it('should use config values when metadata loader color, duration, or dismissal options are not provided', async () => { sinon.restore(); stub(window, 'fetch').callsFake(async (url) => { - if (url.includes('pep-prompt-content.plain.html')) return mockRes({ payload: pepPromptContent({ ...defaultConfig, color: false, loaderDuration: false }) }); + if (url.includes('pep-prompt-content.plain.html')) { + return mockRes({ + payload: pepPromptContent({ + ...defaultConfig, + color: false, + loaderDuration: false, + animationCount: false, + animationDuration: false, + tooltipMessage: false, + tooltipDuration: false, + }), + }); + } return null; }); const pep = await initPep({}); - await clock.runAllAsync(); - const { 'loader-color': pepColor, 'loader-duration': pepDuration } = pep.options; - expect(!!pepColor && !!pepDuration).to.equal(true); + const { + 'loader-color': pepColor, + 'loader-duration': pepDuration, + 'dismissal-animation-count': animCount, + 'dismissal-animation-duration': animDuration, + 'dismissal-tooltip-message': tooltipMessage, + 'dismissal-tooltip-duration': tooltipDuration, + } = pep.options; + const configPresent = [ + pepColor, + pepDuration, + animCount, + animDuration, + tooltipMessage, + tooltipDuration, + ].reduce((acc, x) => acc && !!x, true); + expect(configPresent).to.equal(true); }); }); describe('PEP interaction tests', () => { it('should close PEP on Escape key', async () => { await initPep({}); - await clock.runAllAsync(); document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should close PEP on clicking the close icon', async () => { await initPep({}); - await clock.runAllAsync(); document.querySelector(allSelectors.closeIcon).click(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should close PEP on clicking the CTA', async () => { await initPep({}); - await clock.runAllAsync(); document.querySelector(allSelectors.cta).click(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should close PEP on clicking the anchor element', async () => { await initPep({}); - await clock.runAllAsync(); document.querySelector(allSelectors.appSwitcher).click(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); + + it('redirects when the PEP timer runs out', async () => { + const clock = sinon.useFakeTimers(); + const pep = await initPep({}); + + clock.tick(10000); + // redirectTo is mocked in test-utilities inside the initPep procedure + expect(pep.redirectTo.calledOnce).to.equal(true); + clock.uninstall(); + }); }); describe('PEP focus tests', () => { it('should focus on the close icon on initial render', async () => { await initPep({}); - await clock.runAllAsync(); expect(document.activeElement).to.equal(document.querySelector(allSelectors.closeIcon)); }); it('should focus on the anchor element after closing', async () => { await initPep({}); - await clock.runAllAsync(); document.querySelector(allSelectors.closeIcon).click(); expect(document.activeElement).to.equal(document.querySelector(allSelectors.appSwitcher)); }); }); + describe('PEP dismissal tests', () => { + it('adds three rings to the app switcher and removes them after the required amount of time', async () => { + const clock = sinon.useFakeTimers(); + await initPep({}); + + document.querySelector(allSelectors.closeIcon).click(); + expect([...document.querySelectorAll(allSelectors.indicatorRing)].length).to.equal(3); + clock.tick(7500); + expect([...document.querySelectorAll(allSelectors.indicatorRing)].length).to.equal(0); + clock.uninstall(); + }); + + it('adds a data attribute to the app switcher with the correct data and removes it after the allotted time', async () => { + const clock = sinon.useFakeTimers(); + await initPep({}); + + document.querySelector(allSelectors.closeIcon).click(); + expect(document.querySelector(allSelectors.tooltip)).to.exist; + + clock.tick(5000); + expect(document.querySelector(allSelectors.tooltip)).to.not.exist; + clock.uninstall(); + }); + + it('removes the dismissal animation and the tooltip upon clicking the anchor element', async () => { + await initPep({}); + document.querySelector(allSelectors.closeIcon).click(); + expect(document.querySelector(allSelectors.tooltip)).to.exist; + document.querySelector(allSelectors.appSwitcher).click(); + expect(document.querySelector(allSelectors.tooltip)).to.not.exist; + }); + }); + describe('PEP logging tests', () => { beforeEach(() => { window.lana.log = sinon.spy(); @@ -185,7 +235,6 @@ describe('PEP', () => { reject(new Error('Cannot get anchor state')); }), }); - await clock.runAllAsync(); expect(window.lana.log.getCalls().find((c) => c.args[0].includes('Error on getting anchor state'))).to.exist; expect(window.lana.log.getCalls().find((c) => c.args[1].tags.includes('errorType=error,module=pep'))).to.exist; }); @@ -203,7 +252,6 @@ describe('PEP', () => { return null; }); await initPep({}); - await clock.runAllAsync(); expect(window.lana.log.getCalls().find((c) => c.args[0].includes('Error fetching content for prompt'))).to.exist; expect(window.lana.log.getCalls().find((c) => c.args[1].tags.includes('errorType=error,module=pep'))).to.exist; }); From 8e6ca69ff12a2f88f89fa67c480f1e108fdd5343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilyas=20T=C3=BCrkben?= Date: Mon, 8 Jul 2024 14:17:55 +0200 Subject: [PATCH 6/7] Revert "MWPW-152283: [TEST] switch WCS to acom domain" (#2534) Revert "MWPW-152283: [TEST] switch WCS to acom domain (#2504)" This reverts commit 5e2dd4c73c5763b612455994b28ae4013855992b. --- libs/deps/commerce.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libs/deps/commerce.js b/libs/deps/commerce.js index 419656a102..2367f70d5e 100644 --- a/libs/deps/commerce.js +++ b/libs/deps/commerce.js @@ -1,6 +1,5 @@ -// branch: MWPW-152283 commit: c22c3d6a2a2752c5b91dbcfe88a2111ff39cbc67 Mon, 24 Jun 2024 13:12:20 GMT -var Mr=Object.defineProperty;var ci=(e,t,r)=>t in e?Mr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ui=(e,t)=>{for(var r in t)Mr(e,r,{get:t[r],enumerable:!0})};var ne=(e,t,r)=>(ci(e,typeof t!="symbol"?t+"":t,r),r),kr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Lt=(e,t,r)=>(kr(e,t,"read from private field"),r?r.call(e):t.get(e)),Gr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Nt=(e,t,r,n)=>(kr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var Ie;(function(e){e.ServerError="ServerError",e.ClientError="ClientError",e.UnexpectedError="UnexpectedError"})(Ie||(Ie={}));var Fr=(e,t,r)=>({type:(i=>i>=500?Ie.ServerError:i<400?Ie.UnexpectedError:Ie.ClientError)(e),message:t,originatingRequest:r,status:e});var li=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},Be;(function(e){e.AUTHORIZATION="Authorization",e.X_API_KEY="X-Api-Key"})(Be||(Be={}));var Ct=class{constructor(t){this.fetchOptions=t}commonHeaders(){let t={};return this.fetchOptions.apiKey&&(t[Be.X_API_KEY]=this.fetchOptions.apiKey),this.fetchOptions.accessToken&&(t[Be.AUTHORIZATION]=`Bearer ${this.fetchOptions.accessToken}`),t}transformData(t,r){return r?t.map(n=>r(n)):t.map(n=>this.identifyTransform(n))}transformDatum(t,r){return r?r(t):this.identifyTransform(t)}identifyTransform(t){return t}failOnBadStatusOrParseBody(t,r){return li(this,void 0,void 0,function*(){if(t.ok)return t.json().then(i=>({headers:t.headers,status:t.status,statusText:t.statusText,data:i}));let n=yield t.text();return Promise.reject(Fr(t.status,n,r))})}buildUrl(t,r,n,i,o){var s;let a=(s=this.fetchOptions.baseUrl)!==null&&s!==void 0?s:i(this.fetchOptions.env),c=o(r,n);return this.generateUrl(a,t,c)}generateUrl(t,r,n){let i=new URL(r,t);return n&&(i.search=this.convertToSearchParams(n).toString()),i.toString()}convertToSearchParams(t){return new URLSearchParams(t)}setParams(t,r,n){n!=null&&typeof n=="boolean"?t[r]=String(n):n&&(t[r]=n)}},It=Ct;var Y;(function(e){e.STAGE="STAGE",e.PRODUCTION="PRODUCTION",e.LOCAL="LOCAL"})(Y||(Y={}));var Re;(function(e){e.STAGE="STAGE",e.PRODUCTION="PROD",e.LOCAL="LOCAL"})(Re||(Re={}));var G;(function(e){e.DRAFT="DRAFT",e.PUBLISHED="PUBLISHED"})(G||(G={}));var fe;(function(e){e.V2="UCv2",e.V3="UCv3"})(fe||(fe={}));var $;(function(e){e.CHECKOUT="checkout",e.CHECKOUT_EMAIL="checkout/email",e.SEGMENTATION="segmentation",e.BUNDLE="bundle",e.COMMITMENT="commitment",e.RECOMMENDATION="recommendation",e.EMAIL="email",e.PAYMENT="payment",e.CHANGE_PLAN_TEAM_PLANS="change-plan/team-upgrade/plans",e.CHANGE_PLAN_TEAM_PAYMENT="change-plan/team-upgrade/payment"})($||($={}));var Rt=function(e){var t;return(t=fi.get(e))!==null&&t!==void 0?t:e},fi=new Map([["countrySpecific","cs"],["quantity","q"],["authCode","code"],["checkoutPromoCode","apc"],["rurl","rUrl"],["curl","cUrl"],["ctxrturl","ctxRtUrl"],["country","co"],["language","lang"],["clientId","cli"],["context","ctx"],["productArrangementCode","pa"],["offerType","ot"],["marketSegment","ms"]]);var Vr=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},jr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function ve(e,t,r){var n,i;try{for(var o=Vr(Object.entries(e)),s=o.next();!s.done;s=o.next()){var a=jr(s.value,2),c=a[0],l=a[1],u=Rt(c);l!=null&&r.has(u)&&t.set(u,l)}}catch(p){n={error:p}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}function Ye(e){switch(e){case Y.PRODUCTION:return"https://commerce.adobe.com";default:return"https://commerce-stg.adobe.com"}}function $e(e,t){var r,n;for(var i in e){var o=e[i];try{for(var s=(r=void 0,Vr(Object.entries(o))),a=s.next();!a.done;a=s.next()){var c=jr(a.value,2),l=c[0],u=c[1];if(u!=null){var p=Rt(l);t.set("items["+i+"]["+p+"]",u)}}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}}var pi=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Wr(e){Ei(e);var t=e.env,r=e.items,n=e.workflowStep,i=pi(e,["env","items","workflowStep"]),o=new URL(Ye(t));return o.pathname=n+"/",$e(r,o.searchParams),ve(i,o.searchParams,hi),o.toString()}var hi=new Set(["cli","co","lang","ctx","cUrl","mv","nglwfdata","otac","promoid","rUrl","sdid","spint","trackingid","code","campaignid","appctxid"]),di=["env","workflowStep","clientId","country","items"];function Ei(e){var t,r;try{for(var n=mi(di),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!0}var gi=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},yi="p_draft_landscape",_i="/store/";function Dt(e){Ti(e);var t=e.env,r=e.items,n=e.workflowStep,i=e.ms,o=e.marketSegment,s=e.ot,a=e.offerType,c=e.pa,l=e.productArrangementCode,u=e.landscape,p=gi(e,["env","items","workflowStep","ms","marketSegment","ot","offerType","pa","productArrangementCode","landscape"]),f={marketSegment:o??i,offerType:a??s,productArrangementCode:l??c},d=new URL(Ye(t));return d.pathname=""+_i+n,n!==$.SEGMENTATION&&n!==$.CHANGE_PLAN_TEAM_PLANS&&$e(r,d.searchParams),n===$.SEGMENTATION&&ve(f,d.searchParams,Ut),ve(p,d.searchParams,Ut),u===G.DRAFT&&ve({af:yi},d.searchParams,Ut),d.toString()}var Ut=new Set(["af","ai","apc","appctxid","cli","co","csm","ctx","ctxRtUrl","DCWATC","dp","fr","gsp","ijt","lang","lo","mal","ms","mv","mv2","nglwfdata","ot","otac","pa","pcid","promoid","q","rf","sc","scl","sdid","sid","spint","svar","th","thm","trackingid","usid","workflowid","context.guid","so.ca","so.su","so.tr","so.va"]),vi=["env","workflowStep","clientId","country"];function Ti(e){var t,r;try{for(var n=xi(vi),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(e.workflowStep!==$.SEGMENTATION&&e.workflowStep!==$.CHANGE_PLAN_TEAM_PLANS&&!e.items)throw new Error('Argument "checkoutData" is not valid, missing: items');return!0}function Mt(e,t){switch(e){case fe.V2:return Wr(t);case fe.V3:return Dt(t);default:return console.warn("Unsupported CheckoutType, will use UCv3 as default. Given type: "+e),Dt(t)}}var kt;(function(e){e.BASE="BASE",e.TRIAL="TRIAL",e.PROMOTION="PROMOTION"})(kt||(kt={}));var I;(function(e){e.MONTH="MONTH",e.YEAR="YEAR",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS",e.PERPETUAL="PERPETUAL",e.TERM_LICENSE="TERM_LICENSE",e.ACCESS_PASS="ACCESS_PASS",e.THREE_MONTHS="THREE_MONTHS",e.SIX_MONTHS="SIX_MONTHS"})(I||(I={}));var L;(function(e){e.ANNUAL="ANNUAL",e.MONTHLY="MONTHLY",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS",e.P1D="P1D",e.P1Y="P1Y",e.P3Y="P3Y",e.P10Y="P10Y",e.P15Y="P15Y",e.P3D="P3D",e.P7D="P7D",e.P30D="P30D",e.HALF_YEARLY="HALF_YEARLY",e.QUARTERLY="QUARTERLY"})(L||(L={}));var Gt;(function(e){e.INDIVIDUAL="INDIVIDUAL",e.TEAM="TEAM",e.ENTERPRISE="ENTERPRISE"})(Gt||(Gt={}));var Ft;(function(e){e.COM="COM",e.EDU="EDU",e.GOV="GOV"})(Ft||(Ft={}));var Vt;(function(e){e.DIRECT="DIRECT",e.INDIRECT="INDIRECT"})(Vt||(Vt={}));var jt;(function(e){e.ENTERPRISE_PRODUCT="ENTERPRISE_PRODUCT",e.ETLA="ETLA",e.RETAIL="RETAIL",e.VIP="VIP",e.VIPMP="VIPMP",e.FREE="FREE"})(jt||(jt={}));var bi=G.PUBLISHED,Hr=e=>{switch(e){case Y.PRODUCTION:return"https://wcs.adobe.io";case Y.STAGE:return"https://wcs-stage.adobe.io";case Y.LOCAL:return"http://localhost:3002";default:return"https://wcs-stage.adobe.io"}},Xr=(e,t)=>{var r;return e.api_key=t.apiKey,e.landscape=(r=t.landscape)!==null&&r!==void 0?r:bi,e};var Si=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},Wt=class extends It{constructor(t){super(t),this.apiPaths={getWebCommerceArtifact:"web_commerce_artifact"},this.getWebCommerceArtifact=(r,n,i,o)=>Si(this,void 0,void 0,function*(){let s=this.buildUrl(this.apiPaths.getWebCommerceArtifact,n,r,a=>Hr(a),(a,c)=>this.evaluateGetWebCommerceArtifactParams(a,c));return this.fetchOptions.fetch(s,{signal:o,headers:Object.assign({},this.commonHeaders()),mode:"cors"}).then(a=>this.failOnBadStatusOrParseBody(a,`GET ${s}`)).then(a=>{let l=a.data;return{data:this.transformDatum(l,i)}})})}evaluateGetWebCommerceArtifactParams(t,r){let n={};return this.setParams(n,"offer_selector_ids",r.offerSelectorIds.join(",")),this.setParams(n,"country",r.country),this.setParams(n,"language",r.language),this.setParams(n,"currency",r.currency),this.setParams(n,"locale",r.locale),this.setParams(n,"promotion_code",r.promotionCode),Xr(n,t)}},Br=Wt;var qe=e=>new Br(e).getWebCommerceArtifact;var Yr="tacocat.js";var ze=(e,t)=>String(e??"").toLowerCase()==String(t??"").toLowerCase(),$r=e=>`${e??""}`.replace(/[&<>'"]/g,t=>({"&":"&","<":"<",">":">","'":"'",'"':"""})[t]??t)??"";function w(e,t={},{metadata:r=!0,search:n=!0,storage:i=!0}={}){let o;if(n&&o==null){let s=new URLSearchParams(window.location.search),a=Te(n)?n:e;o=s.get(a)}if(i&&o==null){let s=Te(i)?i:e;o=window.sessionStorage.getItem(s)??window.localStorage.getItem(s)}if(r&&o==null){let s=Zr(Te(r)?r:e);o=document.documentElement.querySelector(`meta[name="${s}"]`)?.content}return o??t[e]}var be=()=>{};var qr=e=>typeof e=="boolean",ce=e=>typeof e=="function",Ze=e=>typeof e=="number",zr=e=>e!=null&&typeof e=="object";var Te=e=>typeof e=="string",Ht=e=>Te(e)&&e,Se=e=>Ze(e)&&Number.isFinite(e)&&e>0;function Pe(e,t=r=>r==null||r===""){return e!=null&&Object.entries(e).forEach(([r,n])=>{t(n)&&delete e[r]}),e}function v(e,t){if(qr(e))return e;let r=String(e);return r==="1"||r==="true"?!0:r==="0"||r==="false"?!1:t}function ie(e,t,r){let n=Object.values(t);return n.find(i=>ze(i,e))??r??n[0]}function Zr(e=""){return String(e).replace(/(\p{Lowercase_Letter})(\p{Uppercase_Letter})/gu,(t,r,n)=>`${r}-${n}`).replace(/\W+/gu,"-").toLowerCase()}function Ae(e,t=1){return Ze(e)||(e=Number.parseInt(e,10)),!Number.isNaN(e)&&e>0&&Number.isFinite(e)?e:t}var Pi=Date.now(),Xt=()=>`(+${Date.now()-Pi}ms)`,Qe=new Set,Ai=v(w("tacocat.debug",{},{metadata:!1}),typeof process<"u"&&process.env?.DEBUG);function Qr(e){let t=`[${Yr}/${e}]`,r=(s,a,...c)=>s?!0:(i(a,...c),!1),n=Ai?(s,...a)=>{console.debug(`${t} ${s}`,...a,Xt())}:()=>{},i=(s,...a)=>{let c=`${t} ${s}`;Qe.forEach(([l])=>l(c,...a))};return{assert:r,debug:n,error:i,warn:(s,...a)=>{let c=`${t} ${s}`;Qe.forEach(([,l])=>l(c,...a))}}}function wi(e,t){let r=[e,t];return Qe.add(r),()=>{Qe.delete(r)}}wi((e,...t)=>{console.error(e,...t,Xt())},(e,...t)=>{console.warn(e,...t,Xt())});var Oi="no promo",Jr="promo-tag",Li="yellow",Ni="neutral",Ci=(e,t,r)=>{let n=o=>o||Oi,i=r?` (was "${n(t)}")`:"";return`${n(e)}${i}`},Ii="cancel-context",Ue=(e,t)=>{let r=e===Ii,n=!r&&e?.length>0,i=(n||r)&&(t&&t!=e||!t&&!r),o=i&&n||!i&&!!t,s=o?e||t:void 0;return{effectivePromoCode:s,overridenPromoCode:e,className:o?Jr:`${Jr} no-promo`,text:Ci(s,t,i),variant:o?Li:Ni,isOverriden:i}};var Bt=function(e,t){return Bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Bt(e,t)};function De(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Bt(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var T=function(){return T=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0}),r=[],n=0,i=t;n1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(Di,function(a,c,l,u,p,f){if(c)t.minimumIntegerDigits=l.length;else{if(u&&p)throw new Error("We currently do not support maximum integer digits");if(f)throw new Error("We currently do not support exact integer digits")}return""});continue}if(un.test(i.stem)){t.minimumIntegerDigits=i.stem.length;continue}if(nn.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(nn,function(a,c,l,u,p,f){return l==="*"?t.minimumFractionDigits=c.length:u&&u[0]==="#"?t.maximumFractionDigits=u.length:p&&f?(t.minimumFractionDigits=p.length,t.maximumFractionDigits=p.length+f.length):(t.minimumFractionDigits=c.length,t.maximumFractionDigits=c.length),""}),i.options.length&&(t=T(T({},t),on(i.options[0])));continue}if(cn.test(i.stem)){t=T(T({},t),on(i.stem));continue}var o=ln(i.stem);o&&(t=T(T({},t),o));var s=Mi(i.stem);s&&(t=T(T({},t),s))}return t}var qt,ki=new RegExp("^"+$t.source+"*"),Gi=new RegExp($t.source+"*$");function x(e,t){return{start:e,end:t}}var Fi=!!String.prototype.startsWith,Vi=!!String.fromCodePoint,ji=!!Object.fromEntries,Wi=!!String.prototype.codePointAt,Hi=!!String.prototype.trimStart,Xi=!!String.prototype.trimEnd,Bi=!!Number.isSafeInteger,Yi=Bi?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},Zt=!0;try{pn=En("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),Zt=((qt=pn.exec("a"))===null||qt===void 0?void 0:qt[0])==="a"}catch{Zt=!1}var pn,mn=Fi?function(t,r,n){return t.startsWith(r,n)}:function(t,r,n){return t.slice(n,n+r.length)===r},Qt=Vi?String.fromCodePoint:function(){for(var t=[],r=0;ro;){if(s=t[o++],s>1114111)throw RangeError(s+" is not a valid code point");n+=s<65536?String.fromCharCode(s):String.fromCharCode(((s-=65536)>>10)+55296,s%1024+56320)}return n},hn=ji?Object.fromEntries:function(t){for(var r={},n=0,i=t;n=n)){var i=t.charCodeAt(r),o;return i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?i:(i-55296<<10)+(o-56320)+65536}},$i=Hi?function(t){return t.trimStart()}:function(t){return t.replace(ki,"")},qi=Xi?function(t){return t.trimEnd()}:function(t){return t.replace(Gi,"")};function En(e,t){return new RegExp(e,t)}var Jt;Zt?(zt=En("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),Jt=function(t,r){var n;zt.lastIndex=r;var i=zt.exec(t);return(n=i[1])!==null&&n!==void 0?n:""}):Jt=function(t,r){for(var n=[];;){var i=dn(t,r);if(i===void 0||xn(i)||Qi(i))break;n.push(i),r+=i>=65536?2:1}return Qt.apply(void 0,n)};var zt,gn=function(){function e(t,r){r===void 0&&(r={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!r.ignoreTag,this.requiresOtherClause=!!r.requiresOtherClause,this.shouldParseSkeletons=!!r.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,r,n){for(var i=[];!this.isEOF();){var o=this.char();if(o===123){var s=this.parseArgument(t,n);if(s.err)return s;i.push(s.val)}else{if(o===125&&t>0)break;if(o===35&&(r==="plural"||r==="selectordinal")){var a=this.clonePosition();this.bump(),i.push({type:A.pound,location:x(a,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(g.UNMATCHED_CLOSING_TAG,x(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&Kt(this.peek()||0)){var s=this.parseTag(t,r);if(s.err)return s;i.push(s.val)}else{var s=this.parseLiteral(t,r);if(s.err)return s;i.push(s.val)}}}return{val:i,err:null}},e.prototype.parseTag=function(t,r){var n=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:A.literal,value:"<"+i+"/>",location:x(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(t+1,r,!0);if(o.err)return o;var s=o.val,a=this.clonePosition();if(this.bumpIf("")?{val:{type:A.tag,value:i,children:s,location:x(n,this.clonePosition())},err:null}:this.error(g.INVALID_TAG,x(a,this.clonePosition())))}else return this.error(g.UNCLOSED_TAG,x(n,this.clonePosition()))}else return this.error(g.INVALID_TAG,x(n,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&Zi(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,r){for(var n=this.clonePosition(),i="";;){var o=this.tryParseQuote(r);if(o){i+=o;continue}var s=this.tryParseUnquoted(t,r);if(s){i+=s;continue}var a=this.tryParseLeftAngleBracket();if(a){i+=a;continue}break}var c=x(n,this.clonePosition());return{val:{type:A.literal,value:i,location:c},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!zi(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var r=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(n===39)if(this.peek()===39)r.push(39),this.bump();else{this.bump();break}else r.push(n);this.bump()}return Qt.apply(void 0,r)},e.prototype.tryParseUnquoted=function(t,r){if(this.isEOF())return null;var n=this.char();return n===60||n===123||n===35&&(r==="plural"||r==="selectordinal")||n===125&&t>0?null:(this.bump(),Qt(n))},e.prototype.parseArgument=function(t,r){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE,x(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(g.EMPTY_ARGUMENT,x(n,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(g.MALFORMED_ARGUMENT,x(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE,x(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:A.argument,value:i,location:x(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE,x(n,this.clonePosition())):this.parseArgumentOptions(t,r,i,n);default:return this.error(g.MALFORMED_ARGUMENT,x(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),r=this.offset(),n=Jt(this.message,r),i=r+n.length;this.bumpTo(i);var o=this.clonePosition(),s=x(t,o);return{value:n,location:s}},e.prototype.parseArgumentOptions=function(t,r,n,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,c=this.clonePosition();switch(a){case"":return this.error(g.EXPECT_ARGUMENT_TYPE,x(s,c));case"number":case"date":case"time":{this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var u=this.clonePosition(),p=this.parseSimpleArgStyleIfPossible();if(p.err)return p;var f=qi(p.val);if(f.length===0)return this.error(g.EXPECT_ARGUMENT_STYLE,x(this.clonePosition(),this.clonePosition()));var d=x(u,this.clonePosition());l={style:f,styleLocation:d}}var h=this.tryParseArgumentClose(i);if(h.err)return h;var E=x(i,this.clonePosition());if(l&&mn(l?.style,"::",0)){var S=$i(l.style.slice(2));if(a==="number"){var p=this.parseNumberSkeletonFromString(S,l.styleLocation);return p.err?p:{val:{type:A.number,value:n,location:E,style:p.val},err:null}}else{if(S.length===0)return this.error(g.EXPECT_DATE_TIME_SKELETON,E);var f={type:pe.dateTime,pattern:S,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?tn(S):{}},N=a==="date"?A.date:A.time;return{val:{type:N,value:n,location:E,style:f},err:null}}}return{val:{type:a==="number"?A.number:a==="date"?A.date:A.time,value:n,location:E,style:(o=l?.style)!==null&&o!==void 0?o:null},err:null}}case"plural":case"selectordinal":case"select":{var P=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(g.EXPECT_SELECT_ARGUMENT_OPTIONS,x(P,T({},P)));this.bumpSpace();var b=this.parseIdentifierIfPossible(),O=0;if(a!=="select"&&b.value==="offset"){if(!this.bumpIf(":"))return this.error(g.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,x(this.clonePosition(),this.clonePosition()));this.bumpSpace();var p=this.tryParseDecimalInteger(g.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,g.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(p.err)return p;this.bumpSpace(),b=this.parseIdentifierIfPossible(),O=p.val}var y=this.tryParsePluralOrSelectOptions(t,a,r,b);if(y.err)return y;var h=this.tryParseArgumentClose(i);if(h.err)return h;var C=x(i,this.clonePosition());return a==="select"?{val:{type:A.select,value:n,options:hn(y.val),location:C},err:null}:{val:{type:A.plural,value:n,options:hn(y.val),offset:O,pluralType:a==="plural"?"cardinal":"ordinal",location:C},err:null}}default:return this.error(g.INVALID_ARGUMENT_TYPE,x(s,c))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(g.EXPECT_ARGUMENT_CLOSING_BRACE,x(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,r=this.clonePosition();!this.isEOF();){var n=this.char();switch(n){case 39:{this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(g.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,x(i,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(r.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(r.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,r){var n=[];try{n=an(t)}catch{return this.error(g.INVALID_NUMBER_SKELETON,r)}return{val:{type:pe.number,tokens:n,location:r,parsedOptions:this.shouldParseSkeletons?fn(n):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,r,n,i){for(var o,s=!1,a=[],c=new Set,l=i.value,u=i.location;;){if(l.length===0){var p=this.clonePosition();if(r!=="select"&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(g.EXPECT_PLURAL_ARGUMENT_SELECTOR,g.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;u=x(p,this.clonePosition()),l=this.message.slice(p.offset,this.offset())}else break}if(c.has(l))return this.error(r==="select"?g.DUPLICATE_SELECT_ARGUMENT_SELECTOR:g.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,u);l==="other"&&(s=!0),this.bumpSpace();var d=this.clonePosition();if(!this.bumpIf("{"))return this.error(r==="select"?g.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:g.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,x(this.clonePosition(),this.clonePosition()));var h=this.parseMessage(t+1,r,n);if(h.err)return h;var E=this.tryParseArgumentClose(d);if(E.err)return E;a.push([l,{value:h.val,location:x(d,this.clonePosition())}]),c.add(l),this.bumpSpace(),o=this.parseIdentifierIfPossible(),l=o.value,u=o.location}return a.length===0?this.error(r==="select"?g.EXPECT_SELECT_ARGUMENT_SELECTOR:g.EXPECT_PLURAL_ARGUMENT_SELECTOR,x(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!s?this.error(g.MISSING_OTHER_CLAUSE,x(this.clonePosition(),this.clonePosition())):{val:a,err:null}},e.prototype.tryParseDecimalInteger=function(t,r){var n=1,i=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var o=!1,s=0;!this.isEOF();){var a=this.char();if(a>=48&&a<=57)o=!0,s=s*10+(a-48),this.bump();else break}var c=x(i,this.clonePosition());return o?(s*=n,Yi(s)?{val:s,err:null}:this.error(r,c)):this.error(t,c)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var r=dn(this.message,t);if(r===void 0)throw Error("Offset "+t+" is at invalid UTF-16 code unit boundary");return r},e.prototype.error=function(t,r){return{val:null,err:{kind:t,message:this.message,location:r}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(mn(this.message,t,this.offset())){for(var r=0;r=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset "+t+" must be greater than or equal to the current offset "+this.offset());for(t=Math.min(t,this.message.length);;){var r=this.offset();if(r===t)break;if(r>t)throw Error("targetOffset "+t+" is at invalid UTF-16 code unit boundary");if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&xn(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),r=this.offset(),n=this.message.charCodeAt(r+(t>=65536?2:1));return n??null},e}();function Kt(e){return e>=97&&e<=122||e>=65&&e<=90}function zi(e){return Kt(e)||e===47}function Zi(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function xn(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function Qi(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function er(e){e.forEach(function(t){if(delete t.location,rt(t)||nt(t))for(var r in t.options)delete t.options[r].location,er(t.options[r].value);else Ke(t)&&ot(t.style)||(et(t)||tt(t))&&Me(t.style)?delete t.style.location:it(t)&&er(t.children)})}function yn(e,t){t===void 0&&(t={}),t=T({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new gn(e,t).parse();if(r.err){var n=SyntaxError(g[r.err.kind]);throw n.location=r.err.location,n.originalMessage=r.err.message,n}return t?.captureLocation||er(r.val),r.val}function ke(e,t){var r=t&&t.cache?t.cache:no,n=t&&t.serializer?t.serializer:ro,i=t&&t.strategy?t.strategy:Ki;return i(e,{cache:r,serializer:n})}function Ji(e){return e==null||typeof e=="number"||typeof e=="boolean"}function _n(e,t,r,n){var i=Ji(n)?n:r(n),o=t.get(i);return typeof o>"u"&&(o=e.call(this,n),t.set(i,o)),o}function vn(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return typeof o>"u"&&(o=e.apply(this,n),t.set(i,o)),o}function tr(e,t,r,n,i){return r.bind(t,e,n,i)}function Ki(e,t){var r=e.length===1?_n:vn;return tr(e,this,r,t.cache.create(),t.serializer)}function eo(e,t){return tr(e,this,vn,t.cache.create(),t.serializer)}function to(e,t){return tr(e,this,_n,t.cache.create(),t.serializer)}var ro=function(){return JSON.stringify(arguments)};function rr(){this.cache=Object.create(null)}rr.prototype.get=function(e){return this.cache[e]};rr.prototype.set=function(e,t){this.cache[e]=t};var no={create:function(){return new rr}},st={variadic:eo,monadic:to};var me;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(me||(me={}));var Ge=function(e){De(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.code=n,o.originalMessage=i,o}return t.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},t}(Error);var nr=function(e){De(t,e);function t(r,n,i,o){return e.call(this,'Invalid values for "'+r+'": "'+n+'". Options are "'+Object.keys(i).join('", "')+'"',me.INVALID_VALUE,o)||this}return t}(Ge);var Tn=function(e){De(t,e);function t(r,n,i){return e.call(this,'Value for "'+r+'" must be of type '+n,me.INVALID_VALUE,i)||this}return t}(Ge);var bn=function(e){De(t,e);function t(r,n){return e.call(this,'The intl string context variable "'+r+'" was not provided to the string "'+n+'"',me.MISSING_VALUE,n)||this}return t}(Ge);var U;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(U||(U={}));function io(e){return e.length<2?e:e.reduce(function(t,r){var n=t[t.length-1];return!n||n.type!==U.literal||r.type!==U.literal?t.push(r):n.value+=r.value,t},[])}function oo(e){return typeof e=="function"}function Fe(e,t,r,n,i,o,s){if(e.length===1&&Yt(e[0]))return[{type:U.literal,value:e[0].value}];for(var a=[],c=0,l=e;c0?e.substring(0,n):"";let i=An(e.split("").reverse().join("")),o=r-i,s=e.substring(o,o+1),a=o+(s==="."||s===","?1:0);t.suffix=i>0?e.substring(a,r):"",t.mask=e.substring(n,a),t.maskHasNegativeSign=t.mask.charAt(0)==="-",t.maskHasPositiveSign=t.mask.charAt(0)==="+";let c=t.mask.match(lo);return t.decimal=c&&c[c.length-1]||".",t.separator=c&&c[1]&&c[0]||",",c=t.mask.split(t.decimal),t.integer=c[0],t.fraction=c[1],t}function po(e,t,r){let n=!1,i={value:e};e<0&&(n=!0,i.value=-i.value),i.sign=n?"-":"",i.value=Number(i.value).toFixed(t.fraction&&t.fraction.length),i.value=Number(i.value).toString();let o=t.fraction&&t.fraction.lastIndexOf("0"),[s="0",a=""]=i.value.split(".");return(!a||a&&a.length<=o)&&(a=o<0?"":(+("0."+a)).toFixed(o+1).replace("0.","")),i.integer=s,i.fraction=a,mo(i,t),(i.result==="0"||i.result==="")&&(n=!1,i.sign=""),!n&&t.maskHasPositiveSign?i.sign="+":n&&t.maskHasPositiveSign?i.sign="-":n&&(i.sign=r&&r.enforceMaskSign&&!t.maskHasNegativeSign?"":"-"),i}function mo(e,t){e.result="";let r=t.integer.split(t.separator),n=r.join(""),i=n&&n.indexOf("0");if(i>-1)for(;e.integer.lengthMath.round(e*20)/20},or=(e,t)=>({accept:e,round:t}),yo=[or(({divisor:e,price:t})=>t%e==0,({divisor:e,price:t})=>t/e),or(({usePrecision:e})=>e,({divisor:e,price:t})=>Math.ceil(Math.floor(t*1e4/e)/100)/100),or(()=>!0,({divisor:e,price:t})=>Math.ceil(Math.floor(t*100/e)/100))],sr={[I.YEAR]:{[L.MONTHLY]:Ve.MONTH,[L.ANNUAL]:Ve.YEAR},[I.MONTH]:{[L.MONTHLY]:Ve.MONTH}},_o=(e,t)=>e.indexOf(`'${t}'`)===0,vo=(e,t=!0)=>{let r=e.replace(/'.*?'/,"").trim(),n=Rn(r);return!!n?t||(r=r.replace(/[,\.]0+/,n)):r=r.replace(/\s?(#.*0)(?!\s)?/,"$&"+bo(e)),r},To=e=>{let t=So(e),r=_o(e,t),n=e.replace(/'.*?'/,""),i=Nn.test(n)||Cn.test(n);return{currencySymbol:t,isCurrencyFirst:r,hasCurrencySpace:i}},In=e=>e.replace(Nn,Ln).replace(Cn,Ln),bo=e=>e.match(/#(.?)#/)?.[1]===On?Eo:On,So=e=>e.match(/'(.*?)'/)?.[1]??"",Rn=e=>e.match(/0(.?)0/)?.[1]??"";function at({formatString:e,price:t,usePrecision:r,isIndianPrice:n=!1},i,o=s=>s){let{currencySymbol:s,isCurrencyFirst:a,hasCurrencySpace:c}=To(e),l=r?Rn(e):"",u=vo(e,r),p=r?2:0,f=o(t,{currencySymbol:s}),d=n?f.toLocaleString("hi-IN",{minimumFractionDigits:p,maximumFractionDigits:p}):wn(u,f),h=r?d.lastIndexOf(l):d.length,E=d.substring(0,h),S=d.substring(h+1);return{accessiblePrice:e.replace(/'.*?'/,"SYMBOL").replace(/#.*0/,d).replace(/SYMBOL/,s),currencySymbol:s,decimals:S,decimalsDelimiter:l,hasCurrencySpace:c,integer:E,isCurrencyFirst:a,recurrenceTerm:i}}var Un=e=>{let{commitment:t,term:r,usePrecision:n}=e,i=go[r]??1;return at(e,i>1?Ve.MONTH:sr[t]?.[r],(o,{currencySymbol:s})=>{let a={divisor:i,price:o,usePrecision:n},{round:c}=yo.find(({accept:u})=>u(a));if(!c)throw new Error(`Missing rounding rule for: ${JSON.stringify(a)}`);return(xo[s]??(u=>u))(c(a))})},Dn=({commitment:e,term:t,...r})=>at(r,sr[e]?.[t]),Mn=e=>{let{commitment:t,term:r}=e;return t===I.YEAR&&r===L.MONTHLY?at(e,Ve.YEAR,n=>n*12):at(e,sr[t]?.[r])};var Po={recurrenceLabel:"{recurrenceTerm, select, MONTH {/mo} YEAR {/yr} other {}}",recurrenceAriaLabel:"{recurrenceTerm, select, MONTH {per month} YEAR {per year} other {}}",perUnitLabel:"{perUnit, select, LICENSE {per license} other {}}",perUnitAriaLabel:"{perUnit, select, LICENSE {per license} other {}}",freeLabel:"Free",freeAriaLabel:"Free",taxExclusiveLabel:"{taxTerm, select, GST {excl. GST} VAT {excl. VAT} TAX {excl. tax} IVA {excl. IVA} SST {excl. SST} KDV {excl. KDV} other {}}",taxInclusiveLabel:"{taxTerm, select, GST {incl. GST} VAT {incl. VAT} TAX {incl. tax} IVA {incl. IVA} SST {incl. SST} KDV {incl. KDV} other {}}",alternativePriceAriaLabel:"Alternatively at {alternativePrice}",strikethroughAriaLabel:"Regularly at {strikethroughPrice}"},Ao=Qr("ConsonantTemplates/price"),wo=/<.+?>/g,W={container:"price",containerOptical:"price-optical",containerStrikethrough:"price-strikethrough",containerAnnual:"price-annual",disabled:"disabled",currencySpace:"price-currency-space",currencySymbol:"price-currency-symbol",decimals:"price-decimals",decimalsDelimiter:"price-decimals-delimiter",integer:"price-integer",recurrence:"price-recurrence",taxInclusivity:"price-tax-inclusivity",unitType:"price-unit-type"},he={perUnitLabel:"perUnitLabel",perUnitAriaLabel:"perUnitAriaLabel",recurrenceLabel:"recurrenceLabel",recurrenceAriaLabel:"recurrenceAriaLabel",taxExclusiveLabel:"taxExclusiveLabel",taxInclusiveLabel:"taxInclusiveLabel",strikethroughAriaLabel:"strikethroughAriaLabel"},Oo="TAX_EXCLUSIVE",Lo=e=>zr(e)?Object.entries(e).filter(([,t])=>Te(t)||Ze(t)||t===!0).reduce((t,[r,n])=>t+` ${r}${n===!0?"":'="'+$r(n)+'"'}`,""):"",z=(e,t,r,n=!1)=>`${n?In(t):t??""}`;function No(e,{accessibleLabel:t,currencySymbol:r,decimals:n,decimalsDelimiter:i,hasCurrencySpace:o,integer:s,isCurrencyFirst:a,recurrenceLabel:c,perUnitLabel:l,taxInclusivityLabel:u},p={}){let f=z(W.currencySymbol,r),d=z(W.currencySpace,o?" ":""),h="";return a&&(h+=f+d),h+=z(W.integer,s),h+=z(W.decimalsDelimiter,i),h+=z(W.decimals,n),a||(h+=d+f),h+=z(W.recurrence,c,null,!0),h+=z(W.unitType,l,null,!0),h+=z(W.taxInclusivity,u,!0),z(e,h,{...p,"aria-label":t})}var de=({displayOptical:e=!1,displayStrikethrough:t=!1,displayAnnual:r=!1}={})=>({country:n,displayFormatted:i=!0,displayRecurrence:o=!0,displayPerUnit:s=!1,displayTax:a=!1,language:c,literals:l={}}={},{commitment:u,formatString:p,price:f,priceWithoutDiscount:d,taxDisplay:h,taxTerm:E,term:S,usePrecision:N}={},P={})=>{Object.entries({country:n,formatString:p,language:c,price:f}).forEach(([re,wt])=>{if(wt==null)throw new Error(`Argument "${re}" is missing`)});let b={...Po,...l},O=`${c.toLowerCase()}-${n.toUpperCase()}`;function y(re,wt){let Ot=b[re];if(Ot==null)return"";try{return new Pn(Ot.replace(wo,""),O).format(wt)}catch{return Ao.error("Failed to format literal:",Ot),""}}let C=t&&d?d:f,M=e?Un:Dn;r&&(M=Mn);let{accessiblePrice:X,recurrenceTerm:B,...R}=M({commitment:u,formatString:p,term:S,price:e?f:C,usePrecision:N,isIndianPrice:n==="IN"}),j=X,ae="";if(v(o)&&B){let re=y(he.recurrenceAriaLabel,{recurrenceTerm:B});re&&(j+=" "+re),ae=y(he.recurrenceLabel,{recurrenceTerm:B})}let le="";if(v(s)){le=y(he.perUnitLabel,{perUnit:"LICENSE"});let re=y(he.perUnitAriaLabel,{perUnit:"LICENSE"});re&&(j+=" "+re)}let te="";v(a)&&E&&(te=y(h===Oo?he.taxExclusiveLabel:he.taxInclusiveLabel,{taxTerm:E}),te&&(j+=" "+te)),t&&(j=y(he.strikethroughAriaLabel,{strikethroughPrice:j}));let q=W.container;if(e&&(q+=" "+W.containerOptical),t&&(q+=" "+W.containerStrikethrough),r&&(q+=" "+W.containerAnnual),v(i))return No(q,{...R,accessibleLabel:j,recurrenceLabel:ae,perUnitLabel:le,taxInclusivityLabel:te},P);let{currencySymbol:ye,decimals:He,decimalsDelimiter:Xe,hasCurrencySpace:Ce,integer:At,isCurrencyFirst:si}=R,_e=[At,Xe,He];si?(_e.unshift(Ce?"\xA0":""),_e.unshift(ye)):(_e.push(Ce?"\xA0":""),_e.push(ye)),_e.push(ae,le,te);let ai=_e.join("");return z(q,ai,P)},kn=()=>(e,t,r)=>{let i=(e.displayOldPrice===void 0||v(e.displayOldPrice))&&t.priceWithoutDiscount&&t.priceWithoutDiscount!=t.price;return`${de()(e,t,r)}${i?" "+de({displayStrikethrough:!0})(e,t,r):""}`};var ar=de(),cr=kn(),ur=de({displayOptical:!0}),lr=de({displayStrikethrough:!0}),fr=de({displayAnnual:!0});var Co=(e,t)=>{if(!(!Se(e)||!Se(t)))return Math.floor((t-e)/t*100)},Gn=()=>(e,t,r)=>{let{price:n,priceWithoutDiscount:i}=t,o=Co(n,i);return o===void 0?'':`${o}%`};var pr=Gn();var mr="ABM",hr="PUF",dr="M2M",Er="PERPETUAL",Fn="P3Y",Io="TAX_INCLUSIVE_DETAILS",Ro="TAX_EXCLUSIVE",Vn={ABM:mr,PUF:hr,M2M:dr,PERPETUAL:Er,P3Y:Fn},Ja={[mr]:{commitment:I.YEAR,term:L.MONTHLY},[hr]:{commitment:I.YEAR,term:L.ANNUAL},[dr]:{commitment:I.MONTH,term:L.MONTHLY},[Er]:{commitment:I.PERPETUAL,term:void 0},[Fn]:{commitment:I.THREE_MONTHS,term:L.P3Y}},jn="Value is not an offer",ct=e=>{if(typeof e!="object")return jn;let{commitment:t,term:r}=e,n=Uo(t,r);return{...e,planType:n}};var Uo=(e,t)=>{if(e===void 0)return jn;if(e===""&&t==="")return"";let r="";return e===I.YEAR?t===L.MONTHLY?r=mr:t===L.ANNUAL&&(r=hr):e===I.MONTH?t===L.MONTHLY&&(r=dr):e===I.PERPETUAL&&(r=Er),r};function gr(e){let{priceDetails:t}=e,{price:r,priceWithoutDiscount:n,priceWithoutTax:i,priceWithoutDiscountAndTax:o,taxDisplay:s}=t;if(s!==Io)return e;let a={...e,priceDetails:{...t,price:i??r,priceWithoutDiscount:o??n,taxDisplay:Ro}};return a.offerType==="TRIAL"&&a.priceDetails.price===0&&(a.priceDetails.price=a.priceDetails.priceWithoutDiscount),a}var{freeze:Ee}=Object,Z=Ee({...fe}),Q=Ee({...$}),H=Ee({...Y}),xr=Ee({...I}),we=Ee({...Re}),yr=Ee({...Vn}),_r=Ee({...L});var wr={};ui(wr,{CLASS_NAME_FAILED:()=>ut,CLASS_NAME_PENDING:()=>lt,CLASS_NAME_RESOLVED:()=>ft,ERROR_MESSAGE_BAD_REQUEST:()=>vr,ERROR_MESSAGE_MISSING_LITERALS_URL:()=>br,ERROR_MESSAGE_OFFER_NOT_FOUND:()=>Tr,EVENT_TYPE_ERROR:()=>Do,EVENT_TYPE_FAILED:()=>pt,EVENT_TYPE_PENDING:()=>mt,EVENT_TYPE_READY:()=>ge,EVENT_TYPE_RESOLVED:()=>ht,LOG_NAMESPACE:()=>Sr,PARAM_AOS_API_KEY:()=>Mo,PARAM_ENV:()=>Pr,PARAM_LANDSCAPE:()=>Ar,PARAM_WCS_API_KEY:()=>ko,STATE_FAILED:()=>J,STATE_PENDING:()=>K,STATE_RESOLVED:()=>ee,TAG_NAME_SERVICE:()=>oe});var ut="placeholder-failed",lt="placeholder-pending",ft="placeholder-resolved",vr="Bad WCS request",Tr="Commerce offer not found",br="Literals URL not provided",Do="wcms:commerce:error",pt="wcms:placeholder:failed",mt="wcms:placeholder:pending",ge="wcms:commerce:ready",ht="wcms:placeholder:resolved",Sr="wcms/commerce",Pr="commerce.env",Ar="commerce.landscape",Mo="commerce.aosKey",ko="commerce.wcsKey",J="failed",K="pending",ee="resolved",oe="wcms-commerce";var Or={clientId:"merch-at-scale",delimiter:"\xB6",ignoredProperties:["analytics","literals"],serializableTypes:["Array","Object"],sampleRate:30,tags:"consumer=milo/commerce"},Wn=new Set,Go=e=>e instanceof Error||typeof e.originatingRequest=="string";function Hn(e){if(e==null)return;let t=typeof e;if(t==="function"){let{name:r}=e;return r?`${t} ${r}`:t}if(t==="object"){if(e instanceof Error)return e.message;if(typeof e.originatingRequest=="string"){let{message:n,originatingRequest:i,status:o}=e;return[n,o,i].filter(s=>s).join(" ")}let r=e[Symbol.toStringTag]??Object.getPrototypeOf(e).constructor.name;if(!Or.serializableTypes.includes(r))return r}return e}function Fo(e,t){if(!Or.ignoredProperties.includes(e))return Hn(t)}var Lr={append(e){let{delimiter:t,sampleRate:r,tags:n,clientId:i}=Or,{message:o,params:s}=e,a=[],c=o,l=[];s.forEach(f=>{f!=null&&(Go(f)?a:l).push(f)}),a.length&&(c+=" ",c+=a.map(Hn).join(" "));let{pathname:u,search:p}=window.location;c+=`${t}page=`,c+=u+p,l.length&&(c+=`${t}facts=`,c+=JSON.stringify(l,Fo)),Wn.has(c)||(Wn.add(c),window.lana.log(c,{sampleRate:r,tags:n,clientId:i}))}};var _=Object.freeze({checkoutClientId:"adobe_com",checkoutWorkflow:Z.V3,checkoutWorkflowStep:Q.EMAIL,country:"US",displayOldPrice:!0,displayPerUnit:!1,displayRecurrence:!0,displayTax:!1,env:H.PRODUCTION,forceTaxExclusive:!1,language:"en",entitlement:!1,extraOptions:{},modal:!1,promotionCode:"",quantity:1,wcsApiKey:"wcms-commerce-ims-ro-user-milo",wcsBufferDelay:1,wcsEnv:we.PRODUCTION,landscape:G.PUBLISHED,wcsBufferLimit:1});function Xn(e,{once:t=!1}={}){let r=null;function n(){let i=document.querySelector(oe);i!==r&&(r=i,i&&e(i))}return document.addEventListener(ge,n,{once:t}),ue(n),()=>document.removeEventListener(ge,n)}function je(e,{country:t,forceTaxExclusive:r,perpetual:n}){let i;if(e.length<2)i=e;else{let o=t==="GB"||n?"EN":"MULT",[s,a]=e;i=[s.language===o?s:a]}return r&&(i=i.map(gr)),i}var ue=e=>window.setTimeout(e);function Oe(e,t=1){if(e==null)return[t];let r=(Array.isArray(e)?e:String(e).split(",")).map(Ae).filter(Se);return r.length||(r=[t]),r}function dt(e){return e==null?[]:(Array.isArray(e)?e:String(e).split(",")).filter(Ht)}function F(){return window.customElements.get(oe)?.instance}var Vo="en_US",m={ar:"AR_es",be_en:"BE_en",be_fr:"BE_fr",be_nl:"BE_nl",br:"BR_pt",ca:"CA_en",ch_de:"CH_de",ch_fr:"CH_fr",ch_it:"CH_it",cl:"CL_es",co:"CO_es",la:"DO_es",mx:"MX_es",pe:"PE_es",africa:"ZA_en",dk:"DK_da",de:"DE_de",ee:"EE_et",eg_ar:"EG_ar",eg_en:"EG_en",es:"ES_es",fr:"FR_fr",gr_el:"GR_el",gr_en:"GR_en",ie:"IE_en",il_he:"IL_iw",it:"IT_it",lv:"LV_lv",lt:"LT_lt",lu_de:"LU_de",lu_en:"LU_en",lu_fr:"LU_fr",my_en:"MY_en",my_ms:"MY_ms",hu:"HU_hu",mt:"MT_en",mena_en:"DZ_en",mena_ar:"DZ_ar",nl:"NL_nl",no:"NO_nb",pl:"PL_pl",pt:"PT_pt",ro:"RO_ro",si:"SI_sl",sk:"SK_sk",fi:"FI_fi",se:"SE_sv",tr:"TR_tr",uk:"GB_en",at:"AT_de",cz:"CZ_cs",bg:"BG_bg",ru:"RU_ru",ua:"UA_uk",au:"AU_en",in_en:"IN_en",in_hi:"IN_hi",id_en:"ID_en",id_id:"ID_in",nz:"NZ_en",sa_ar:"SA_ar",sa_en:"SA_en",sg:"SG_en",cn:"CN_zh-Hans",tw:"TW_zh-Hant",hk_zh:"HK_zh-hant",jp:"JP_ja",kr:"KR_ko",za:"ZA_en",ng:"NG_en",cr:"CR_es",ec:"EC_es",pr:"US_es",gt:"GT_es",cis_en:"AZ_en",cis_ru:"AZ_ru",sea:"SG_en",th_en:"TH_en",th_th:"TH_th"},se=Object.freeze({LOCAL:"local",PROD:"prod",STAGE:"stage"});function Bn({locale:e={}}={}){if(!e.prefix)return{country:_.country,language:_.language,locale:Vo};let t=e.prefix.replace("/","")??"",[r=_.country,n=_.language]=(m[t]??t).split("_",2);return r=r.toUpperCase(),n=n.toLowerCase(),{country:r,language:n,locale:`${n}_${r}`}}function Nr(e={}){let{commerce:t={},locale:r=void 0}=e,i=(e.env?.name===se.PROD?se.PROD:ie(w(Pr,t,{metadata:!1}),se,se.PROD))===se.STAGE?H.STAGE:H.PRODUCTION,o=w("checkoutClientId",t)??_.checkoutClientId,s=ie(w("checkoutWorkflow",t),Z,_.checkoutWorkflow),a=Q.CHECKOUT;s===Z.V3&&(a=ie(w("checkoutWorkflowStep",t),Q,_.checkoutWorkflowStep));let c=v(w("displayOldPrice",t),_.displayOldPrice),l=v(w("displayPerUnit",t),_.displayPerUnit),u=v(w("displayRecurrence",t),_.displayRecurrence),p=v(w("displayTax",t),_.displayTax),f=v(w("entitlement",t),_.entitlement),d=v(w("modal",t),_.modal),h=v(w("forceTaxExclusive",t),_.forceTaxExclusive),E=w("promotionCode",t)??_.promotionCode,S=Oe(w("quantity",t)),N=w("wcsApiKey",t)??_.wcsApiKey,P=e.env?.name===se.PROD?G.PUBLISHED:ie(w(Ar,t),G,_.landscape),b=Ae(w("wcsBufferDelay",t),_.wcsBufferDelay),O=Ae(w("wcsBufferLimit",t),_.wcsBufferLimit),y=v(w("domain.switch",t),!1);return{...Bn({locale:r}),displayOldPrice:c,checkoutClientId:o,checkoutWorkflow:s,checkoutWorkflowStep:a,displayPerUnit:l,displayRecurrence:u,displayTax:p,entitlement:f,extraOptions:_.extraOptions,modal:d,env:i,forceTaxExclusive:h,priceLiteralsURL:t.priceLiteralsURL,priceLiteralsPromise:t.priceLiteralsPromise,promotionCode:E,quantity:S,wcsApiKey:N,wcsBufferDelay:b,wcsBufferLimit:O,wcsEnv:i===H.STAGE?we.STAGE:we.PRODUCTION,landscape:P,domainSwitch:y}}var $n="debug",jo="error",Wo="info",Ho="warn",Xo=Date.now(),Cr=new Set,Ir=new Set,Yn=new Map,We=Object.freeze({DEBUG:$n,ERROR:jo,INFO:Wo,WARN:Ho}),qn={append({level:e,message:t,params:r,timestamp:n,source:i}){console[e](`${n}ms [${i}] %c${t}`,"font-weight: bold;",...r)}},zn={filter:({level:e})=>e!==$n},Bo={filter:()=>!1};function Yo(e,t,r,n,i){return{level:e,message:t,namespace:r,get params(){if(n.length===1){let[o]=n;ce(o)&&(n=o(),Array.isArray(n)||(n=[n]))}return n},source:i,timestamp:Date.now()-Xo}}function $o(e){[...Ir].every(t=>t(e))&&Cr.forEach(t=>t(e))}function Zn(e){let t=(Yn.get(e)??0)+1;Yn.set(e,t);let r=`${e} #${t}`,n=o=>(s,...a)=>$o(Yo(o,s,e,a,r)),i=Object.seal({id:r,namespace:e,module(o){return Zn(`${i.namespace}/${o}`)},debug:n(We.DEBUG),error:n(We.ERROR),info:n(We.INFO),warn:n(We.WARN)});return i}function Et(...e){e.forEach(t=>{let{append:r,filter:n}=t;ce(n)?Ir.add(n):ce(r)&&Cr.add(r)})}function qo(e={}){let{name:t}=e,r=v(w("commerce.debug",{search:!0,storage:!0}),t===se.LOCAL);return Et(r?qn:zn),t===se.PROD&&Et(Lr),D}function zo(){Cr.clear(),Ir.clear()}var D={...Zn(Sr),Level:We,Plugins:{consoleAppender:qn,debugFilter:zn,quietFilter:Bo,lanaAppender:Lr},init:qo,reset:zo,use:Et};var Zo={CLASS_NAME_FAILED:ut,CLASS_NAME_PENDING:lt,CLASS_NAME_RESOLVED:ft,EVENT_TYPE_FAILED:pt,EVENT_TYPE_PENDING:mt,EVENT_TYPE_RESOLVED:ht,STATE_FAILED:J,STATE_PENDING:K,STATE_RESOLVED:ee},Qo={[J]:ut,[K]:lt,[ee]:ft},Jo={[J]:pt,[K]:mt,[ee]:ht},yt=new WeakMap;function V(e){if(!yt.has(e)){let t=D.module(e.constructor.is);yt.set(e,{changes:new Map,connected:!1,dispose:be,error:void 0,log:t,options:void 0,promises:[],state:K,timer:null,value:void 0,version:0})}return yt.get(e)}function gt(e){let t=V(e),{error:r,promises:n,state:i}=t;(i===ee||i===J)&&(t.promises=[],i===ee?n.forEach(({resolve:o})=>o(e)):i===J&&n.forEach(({reject:o})=>o(r))),e.dispatchEvent(new CustomEvent(Jo[i],{bubbles:!0}))}function xt(e){let t=yt.get(e);[J,K,ee].forEach(r=>{e.classList.toggle(Qo[r],r===t.state)})}var Ko={get error(){return V(this).error},get log(){return V(this).log},get options(){return V(this).options},get state(){return V(this).state},get value(){return V(this).value},attributeChangedCallback(e,t,r){V(this).changes.set(e,r),this.requestUpdate()},connectedCallback(){V(this).dispose=Xn(()=>this.requestUpdate(!0))},disconnectedCallback(){let e=V(this);e.connected&&(e.connected=!1,e.log.debug("Disconnected:",{element:this})),e.dispose(),e.dispose=be},onceSettled(){let{error:e,promises:t,state:r}=V(this);return ee===r?Promise.resolve(this):J===r?Promise.reject(e):new Promise((n,i)=>{t.push({resolve:n,reject:i})})},toggleResolved(e,t,r){let n=V(this);return e!==n.version?!1:(r!==void 0&&(n.options=r),n.state=ee,n.value=t,xt(this),this.log.debug("Resolved:",{element:this,value:t}),ue(()=>gt(this)),!0)},toggleFailed(e,t,r){let n=V(this);return e!==n.version?!1:(r!==void 0&&(n.options=r),n.error=t,n.state=J,xt(this),n.log.error("Failed:",{element:this,error:t}),ue(()=>gt(this)),!0)},togglePending(e){let t=V(this);return t.version++,e&&(t.options=e),t.state=K,xt(this),ue(()=>gt(this)),t.version},requestUpdate(e=!1){if(!this.isConnected||!F())return;let t=V(this);if(t.timer)return;let{error:r,options:n,state:i,value:o,version:s}=t;t.state=K,t.timer=ue(async()=>{t.timer=null;let a=null;if(t.changes.size&&(a=Object.fromEntries(t.changes.entries()),t.changes.clear()),t.connected?t.log.debug("Updated:",{element:this,changes:a}):(t.connected=!0,t.log.debug("Connected:",{element:this,changes:a})),a||e)try{await this.render?.()===!1&&t.state===K&&t.version===s&&(t.state=i,t.error=r,t.value=o,xt(this),gt(this))}catch(c){this.toggleFailed(t.version,c,n)}})}};function Qn(e={}){return Object.entries(e).forEach(([t,r])=>{(r==null||r===""||r?.length===0)&&delete e[t]}),e}function _t(e,t={}){let{tag:r,is:n}=e,i=document.createElement(r,{is:n});return i.setAttribute("is",n),Object.assign(i.dataset,Qn(t)),i}function vt(e){let{tag:t,is:r,prototype:n}=e,i=window.customElements.get(r);return i||(Object.defineProperties(n,Object.getOwnPropertyDescriptors(Ko)),i=Object.defineProperties(e,Object.getOwnPropertyDescriptors(Zo)),window.customElements.define(r,i,{extends:t})),i}function Tt(e,t=document.body){return Array.from(t?.querySelectorAll(`${e.tag}[is="${e.is}"]`)??[])}function bt(e,t={}){return e instanceof HTMLElement?(Object.assign(e.dataset,Qn(t)),e):null}var es="download",ts="upgrade",xe,Le=class Le extends HTMLAnchorElement{constructor(){super();Gr(this,xe,void 0);this.addEventListener("click",this.clickHandler)}static get observedAttributes(){return["data-checkout-workflow","data-checkout-workflow-step","data-extra-options","data-ims-country","data-perpetual","data-promotion-code","data-quantity","data-template","data-wcs-osi","data-entitlement","data-upgrade","data-modal"]}static createCheckoutLink(r={},n=""){let i=F();if(!i)return null;let{checkoutMarketSegment:o,checkoutWorkflow:s,checkoutWorkflowStep:a,entitlement:c,upgrade:l,modal:u,perpetual:p,promotionCode:f,quantity:d,wcsOsi:h,extraOptions:E}=i.collectCheckoutOptions(r),S=_t(Le,{checkoutMarketSegment:o,checkoutWorkflow:s,checkoutWorkflowStep:a,entitlement:c,upgrade:l,modal:u,perpetual:p,promotionCode:f,quantity:d,wcsOsi:h,extraOptions:E});return n&&(S.innerHTML=`${n}`),S}static getCheckoutLinks(r){return Tt(Le,r)}get isCheckoutLink(){return!0}get placeholder(){return this}clickHandler(r){var n;(n=Lt(this,xe))==null||n.call(this,r)}async render(r={}){if(!this.isConnected)return!1;let n=F();if(!n)return!1;this.dataset.imsCountry||n.imsCountryPromise.then(u=>{u&&(this.dataset.imsCountry=u)},be);let i=n.collectCheckoutOptions(r,this.placeholder);if(!i.wcsOsi.length)return!1;let o;try{o=JSON.parse(i.extraOptions??"{}")}catch(u){this.placeholder.log.error("cannot parse exta checkout options",u)}let s=this.placeholder.togglePending(i);this.href="";let a=n.resolveOfferSelectors(i),c=await Promise.all(a);c=c.map(u=>je(u,i));let l=await n.buildCheckoutAction(c.flat(),{...o,...i});return this.renderOffers(c.flat(),i,{},l,s)}renderOffers(r,n,i={},o=void 0,s=void 0){if(!this.isConnected)return!1;let a=F();if(!a)return!1;if(n={...JSON.parse(this.placeholder.dataset.extraOptions??"null"),...n,...i},s??(s=this.placeholder.togglePending(n)),Lt(this,xe)&&Nt(this,xe,void 0),o){this.classList.remove(es,ts),this.placeholder.toggleResolved(s,r,n);let{url:l,text:u,className:p,handler:f}=o;return l&&(this.href=l),u&&(this.firstElementChild.innerHTML=u),p&&this.classList.add(...p.split(" ")),f&&(this.setAttribute("href","#"),Nt(this,xe,f.bind(this))),!0}else if(r.length){if(this.placeholder.toggleResolved(s,r,n)){let l=a.buildCheckoutURL(r,n);return this.setAttribute("href",l),!0}}else{let l=new Error(`Not provided: ${n?.wcsOsi??"-"}`);if(this.placeholder.toggleFailed(s,l,n))return this.setAttribute("href","#"),!0}return!1}updateOptions(r={}){let n=F();if(!n)return!1;let{checkoutMarketSegment:i,checkoutWorkflow:o,checkoutWorkflowStep:s,entitlement:a,upgrade:c,modal:l,perpetual:u,promotionCode:p,quantity:f,wcsOsi:d}=n.collectCheckoutOptions(r);return bt(this,{checkoutMarketSegment:i,checkoutWorkflow:o,checkoutWorkflowStep:s,entitlement:a,upgrade:c,modal:l,perpetual:u,promotionCode:p,quantity:f,wcsOsi:d}),!0}};xe=new WeakMap,ne(Le,"is","checkout-link"),ne(Le,"tag","a");var Rr=Le,St=vt(Rr);var Jn=[m.uk,m.au,m.fr,m.at,m.be_en,m.be_fr,m.be_nl,m.bg,m.ch_de,m.ch_fr,m.ch_it,m.cz,m.de,m.dk,m.ee,m.eg_ar,m.eg_en,m.es,m.fi,m.fr,m.gr_el,m.gr_en,m.hu,m.ie,m.it,m.lu_de,m.lu_en,m.lu_fr,m.nl,m.no,m.pl,m.pt,m.ro,m.se,m.si,m.sk,m.tr,m.ua,m.id_en,m.id_id,m.in_en,m.in_hi,m.jp,m.my_en,m.my_ms,m.nz,m.th_en,m.th_th],rs={INDIVIDUAL_COM:[m.za,m.lt,m.lv,m.ng,m.sa_ar,m.sa_en,m.za,m.sg,m.kr],TEAM_COM:[m.za,m.lt,m.lv,m.ng,m.za,m.co,m.kr],INDIVIDUAL_EDU:[m.lt,m.lv,m.sa_en,m.sea],TEAM_EDU:[m.sea,m.kr]},Ne=class Ne extends HTMLSpanElement{static get observedAttributes(){return["data-display-old-price","data-display-per-unit","data-display-recurrence","data-display-tax","data-perpetual","data-promotion-code","data-tax-exclusive","data-template","data-wcs-osi"]}static createInlinePrice(t){let r=F();if(!r)return null;let{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}=r.collectPriceOptions(t);return _t(Ne,{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f})}static getInlinePrices(t){return Tt(Ne,t)}get isInlinePrice(){return!0}get placeholder(){return this}resolveDisplayTaxForGeoAndSegment(t,r,n,i){let o=`${t}_${r}`;if(Jn.includes(t)||Jn.includes(o))return!0;let s=rs[`${n}_${i}`];return s?!!(s.includes(t)||s.includes(o)):!1}async resolveDisplayTax(t,r){let[n]=await t.resolveOfferSelectors(r),i=je(await n,r);if(i?.length){let{country:o,language:s}=r,a=i[0],[c=""]=a.marketSegments;return this.resolveDisplayTaxForGeoAndSegment(o,s,a.customerSegment,c)}}async render(t={}){if(!this.isConnected)return!1;let r=F();if(!r)return!1;let n=r.collectPriceOptions(t,this.placeholder);if(!n.wcsOsi.length)return!1;this.placeholder.dataset.displayTax||(n.displayTax=await this.resolveDisplayTax(r,n)||!1);let i=this.placeholder.togglePending(n);this.innerHTML="";let[o]=r.resolveOfferSelectors(n);return this.renderOffers(je(await o,n),n,i)}renderOffers(t,r={},n=void 0){if(!this.isConnected)return;let i=F();if(!i)return!1;let o=i.collectPriceOptions({...this.dataset,...r});if(n??(n=this.placeholder.togglePending(o)),t.length){if(this.placeholder.toggleResolved(n,t,o))return this.innerHTML=i.buildPriceHTML(t,o),!0}else{let s=new Error(`Not provided: ${o?.wcsOsi??"-"}`);if(this.placeholder.toggleFailed(n,s,o))return this.innerHTML="",!0}return!1}updateOptions(t){let r=F();if(!r)return!1;let{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}=r.collectPriceOptions(t);return bt(this,{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}),!0}};ne(Ne,"is","inline-price"),ne(Ne,"tag","span");var Ur=Ne,Pt=vt(Ur);function Kn({providers:e,settings:t},r){let n=D.module("checkout");function i(l,u){let{checkoutClientId:p,checkoutWorkflow:f,checkoutWorkflowStep:d,country:h,language:E,promotionCode:S,quantity:N}=t,{checkoutMarketSegment:P,checkoutWorkflow:b=f,checkoutWorkflowStep:O=d,imsCountry:y,country:C=y??h,language:M=E,quantity:X=N,entitlement:B,upgrade:R,modal:j,perpetual:ae,promotionCode:le=S,wcsOsi:te,extraOptions:q,...ye}=Object.assign({},u?.dataset??{},l??{}),He=ie(b,Z,_.checkoutWorkflow),Xe=Q.CHECKOUT;He===Z.V3&&(Xe=ie(O,Q,_.checkoutWorkflowStep));let Ce=Pe({...ye,extraOptions:q,checkoutClientId:p,checkoutMarketSegment:P,country:C,quantity:Oe(X,_.quantity),checkoutWorkflow:He,checkoutWorkflowStep:Xe,language:M,entitlement:v(B),upgrade:v(R),modal:v(j),perpetual:v(ae),promotionCode:Ue(le).effectivePromoCode,wcsOsi:dt(te)});if(u)for(let At of e.checkout)At(u,Ce);return Ce}async function o(l,u){let p=F(),f=await r.getCheckoutAction?.(l,u,p.imsSignedInPromise);return f||null}function s(l,u){if(!Array.isArray(l)||!l.length||!u)return"";let{env:p,landscape:f}=t,{checkoutClientId:d,checkoutMarketSegment:h,checkoutWorkflow:E,checkoutWorkflowStep:S,country:N,promotionCode:P,quantity:b,...O}=i(u),y=window.frameElement?"if":"fp",C={checkoutPromoCode:P,clientId:d,context:y,country:N,env:p,items:[],marketSegment:h,workflowStep:S,landscape:f,...O};if(l.length===1){let[{offerId:M,offerType:X,productArrangementCode:B}]=l,{marketSegments:[R]}=l[0];Object.assign(C,{marketSegment:R,offerType:X,productArrangementCode:B}),C.items.push(b[0]===1?{id:M}:{id:M,quantity:b[0]})}else C.items.push(...l.map(({offerId:M},X)=>({id:M,quantity:b[X]??_.quantity})));return Mt(E,C)}let{createCheckoutLink:a,getCheckoutLinks:c}=St;return{CheckoutLink:St,CheckoutWorkflow:Z,CheckoutWorkflowStep:Q,buildCheckoutAction:o,buildCheckoutURL:s,collectCheckoutOptions:i,createCheckoutLink:a,getCheckoutLinks:c}}function ns({interval:e=200,maxAttempts:t=25}={}){let r=D.module("ims");return new Promise(n=>{r.debug("Waing for IMS to be ready");let i=0;function o(){window.adobeIMS?.initialized?n():++i>t?(r.debug("Timeout"),n()):setTimeout(o,e)}o()})}function is(e){return e.then(()=>window.adobeIMS.isSignedInUser())}function os(e){let t=D.module("ims");return e.then(r=>r?window.adobeIMS.getProfile().then(({countryCode:n})=>(t.debug("Got user country:",n),n),n=>{t.error("Unable to get user country:",n)}):null)}function ei({}){let e=ns(),t=is(e),r=os(t);return{imsReadyPromise:e,imsSignedInPromise:t,imsCountryPromise:r}}function ss(e){if(!e.priceLiteralsURL)throw new Error(br);return new Promise(t=>{window.fetch(e.priceLiteralsURL).then(r=>{r.json().then(({data:n})=>{t(n)})})})}async function ti(e){let r=await(e.priceLiteralsPromise||ss(e));if(Array.isArray(r)){let n=o=>r.find(s=>ze(s.lang,o)),i=n(e.language)??n(_.language);if(i)return Object.freeze(i)}return{}}function ri({literals:e,providers:t,settings:r}){function n(a,c){let{country:l,displayOldPrice:u,displayPerUnit:p,displayRecurrence:f,displayTax:d,forceTaxExclusive:h,language:E,promotionCode:S,quantity:N}=r,{displayOldPrice:P=u,displayPerUnit:b=p,displayRecurrence:O=f,displayTax:y=d,forceTaxExclusive:C=h,country:M=l,language:X=E,perpetual:B,promotionCode:R=S,quantity:j=N,template:ae,wcsOsi:le,...te}=Object.assign({},c?.dataset??{},a??{}),q=Pe({...te,country:M,displayOldPrice:v(P),displayPerUnit:v(b),displayRecurrence:v(O),displayTax:v(y),forceTaxExclusive:v(C),language:X,perpetual:v(B),promotionCode:Ue(R).effectivePromoCode,quantity:Oe(j,_.quantity),template:ae,wcsOsi:dt(le)});if(c)for(let ye of t.price)ye(c,q);return q}function i(a,c){if(!Array.isArray(a)||!a.length||!c)return"";let{template:l}=c,u;switch(l){case"discount":u=pr;break;case"strikethrough":u=lr;break;case"optical":u=ur;break;case"annual":u=fr;break;default:u=c.promotionCode?cr:ar}let p=n(c);p.literals=Object.assign({},e.price,Pe(c.literals??{}));let[f]=a;return f={...f,...f.priceDetails},u(p,f)}let{createInlinePrice:o,getInlinePrices:s}=Pt;return{InlinePrice:Pt,buildPriceHTML:i,collectPriceOptions:n,createInlinePrice:o,getInlinePrices:s}}var Dr="_acom",ni={[H.PRODUCTION]:"https://wcs.adobe.com",[H.STAGE]:"https://wcs.stage.adobe.com",[H.PRODUCTION+Dr]:"https://www.adobe.com",[H.STAGE+Dr]:"https://www.stage.adobe.com"};function ii({settings:e}){let t=D.module("wcs"),{env:r,domainSwitch:n,wcsApiKey:i}=e,o=n?ni[r+Dr]:ni[r],s={apiKey:i,baseUrl:o,fetch:window.fetch.bind(window)},a=qe(s),c=new Map,l=new Map,u;async function p(h,E,S=!0){let N=Tr;try{t.debug("Fetching:",h),h.offerSelectorIds=h.offerSelectorIds.sort();let{data:P}=await a(h,{apiKey:i,environment:e.wcsEnv,landscape:r===H.STAGE?"ALL":e.landscape},({resolvedOffers:O})=>({offers:O.map(ct)}));t.debug("Fetched:",h,P);let{offers:b}=P??{};E.forEach(({resolve:O},y)=>{let C=b.filter(({offerSelectorIds:M})=>M.includes(y)).flat();C.length&&(E.delete(y),O(C))})}catch(P){P.status===404&&h.offerSelectorIds.length>1?(t.debug("Multi-osi 404, fallback to fetch-by-one strategy"),await Promise.allSettled(h.offerSelectorIds.map(b=>p({...h,offerSelectorIds:[b]},E,!1)))):(t.error("Failed:",h,P),N=vr)}S&&E.size&&(t.debug("Missing:",{offerSelectorIds:[...E.keys()]}),E.forEach(P=>{P.reject(new Error(N))}))}function f(){clearTimeout(u);let h=[...l.values()];l.clear(),h.forEach(({options:E,promises:S})=>p(E,S))}function d({country:h,language:E,perpetual:S=!1,promotionCode:N="",wcsOsi:P=[]}){let b=`${E}_${h}`;h!=="GB"&&(E=S?"EN":"MULT");let O=[h,E,N].filter(y=>y).join("-").toLowerCase();return P.map(y=>{let C=`${y}-${O}`;if(!c.has(C)){let M=new Promise((X,B)=>{let R=l.get(O);if(!R){let j={country:h,locale:b,offerSelectorIds:[]};h!=="GB"&&(j.language=E),R={options:j,promises:new Map},l.set(O,R)}N&&(R.options.promotionCode=N),R.options.offerSelectorIds.push(y),R.promises.set(y,{resolve:X,reject:B}),R.options.offerSelectorIds.length>=e.wcsBufferLimit?f():(t.debug("Queued:",R.options),u||(u=setTimeout(f,e.wcsBufferDelay)))});c.set(C,M)}return c.get(C)})}return{WcsCommitment:xr,WcsPlanType:yr,WcsTerm:_r,resolveOfferSelectors:d}}var k=class extends HTMLElement{get isWcmsCommerce(){return!0}};ne(k,"instance"),ne(k,"promise",null);window.customElements.define(oe,k);async function as(e,t){let r=D.init(e.env).module("service");r.debug("Activating:",e);let n={price:{}},i=Object.freeze(Nr(e));try{n.price=await ti(i)}catch(c){r.warn("Price literals were not fetched:",c)}let o={checkout:new Set,price:new Set},s=document.createElement(oe),a={literals:n,providers:o,settings:i};return k.instance=Object.defineProperties(s,Object.getOwnPropertyDescriptors({...Kn(a,t),...ei(a),...ri(a),...ii(a),...wr,Log:D,get defaults(){return _},get literals(){return n},get log(){return D},get providers(){return{checkout(c){return o.checkout.add(c),()=>o.checkout.delete(c)},price(c){return o.price.add(c),()=>o.price.delete(c)}}},get settings(){return i}})),r.debug("Activated:",{literals:n,settings:i,element:s}),document.head.append(s),ue(()=>{let c=new CustomEvent(ge,{bubbles:!0,cancelable:!1,detail:k.instance});k.instance.dispatchEvent(c)}),k.instance}function oi(){document.head.querySelector(oe)?.remove(),k.promise=null,D.reset()}function cs(e,t){if(ce(e)){let r=ce(t)?t():{};return r.force&&oi(),k.promise??(k.promise=as(e(),r))}return k.promise?k.promise:new Promise(r=>{let n=i=>{r(i.detail)};document.head.addEventListener(ge,n,{once:!0})})}export{St as CheckoutLink,Z as CheckoutWorkflow,Q as CheckoutWorkflowStep,_ as Defaults,Pt as InlinePrice,G as Landscape,D as Log,oe as TAG_NAME_SERVICE,xr as WcsCommitment,we as WcsEnv,yr as WcsPlanType,_r as WcsTerm,ct as applyPlanType,Bn as getLocaleSettings,Nr as getSettings,cs as init,oi as reset}; - //# sourceMappingURL=commerce.js.map - \ No newline at end of file +// branch: develop commit: b3f6608faa10db8d0187b310044d4690d063f1bf Thu, 06 Jun 2024 16:47:00 GMT +var Ur=Object.defineProperty;var ii=(e,t,r)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var oi=(e,t)=>{for(var r in t)Ur(e,r,{get:t[r],enumerable:!0})};var te=(e,t,r)=>(ii(e,typeof t!="symbol"?t+"":t,r),r),Dr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Ot=(e,t,r)=>(Dr(e,t,"read from private field"),r?r.call(e):t.get(e)),Mr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Lt=(e,t,r,n)=>(Dr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var Ce;(function(e){e.ServerError="ServerError",e.ClientError="ClientError",e.UnexpectedError="UnexpectedError"})(Ce||(Ce={}));var kr=(e,t,r)=>({type:(i=>i>=500?Ce.ServerError:i<400?Ce.UnexpectedError:Ce.ClientError)(e),message:t,originatingRequest:r,status:e});var si=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},He;(function(e){e.AUTHORIZATION="Authorization",e.X_API_KEY="X-Api-Key"})(He||(He={}));var Nt=class{constructor(t){this.fetchOptions=t}commonHeaders(){let t={};return this.fetchOptions.apiKey&&(t[He.X_API_KEY]=this.fetchOptions.apiKey),this.fetchOptions.accessToken&&(t[He.AUTHORIZATION]=`Bearer ${this.fetchOptions.accessToken}`),t}transformData(t,r){return r?t.map(n=>r(n)):t.map(n=>this.identifyTransform(n))}transformDatum(t,r){return r?r(t):this.identifyTransform(t)}identifyTransform(t){return t}failOnBadStatusOrParseBody(t,r){return si(this,void 0,void 0,function*(){if(t.ok)return t.json().then(i=>({headers:t.headers,status:t.status,statusText:t.statusText,data:i}));let n=yield t.text();return Promise.reject(kr(t.status,n,r))})}buildUrl(t,r,n,i,o){var s;let a=(s=this.fetchOptions.baseUrl)!==null&&s!==void 0?s:i(this.fetchOptions.env),c=o(r,n);return this.generateUrl(a,t,c)}generateUrl(t,r,n){let i=new URL(r,t);return n&&(i.search=this.convertToSearchParams(n).toString()),i.toString()}convertToSearchParams(t){return new URLSearchParams(t)}setParams(t,r,n){n!=null&&typeof n=="boolean"?t[r]=String(n):n&&(t[r]=n)}},Ct=Nt;var W;(function(e){e.STAGE="STAGE",e.PRODUCTION="PRODUCTION",e.LOCAL="LOCAL"})(W||(W={}));var Re;(function(e){e.STAGE="STAGE",e.PRODUCTION="PROD",e.LOCAL="LOCAL"})(Re||(Re={}));var M;(function(e){e.DRAFT="DRAFT",e.PUBLISHED="PUBLISHED"})(M||(M={}));var le;(function(e){e.V2="UCv2",e.V3="UCv3"})(le||(le={}));var oe;(function(e){e.CHECKOUT="checkout",e.CHECKOUT_EMAIL="checkout/email",e.SEGMENTATION="segmentation",e.BUNDLE="bundle",e.COMMITMENT="commitment",e.RECOMMENDATION="recommendation",e.EMAIL="email",e.PAYMENT="payment",e.CHANGE_PLAN_TEAM_PLANS="change-plan/team-upgrade/plans",e.CHANGE_PLAN_TEAM_PAYMENT="change-plan/team-upgrade/payment"})(oe||(oe={}));var Rt=function(e){var t;return(t=ai.get(e))!==null&&t!==void 0?t:e},ai=new Map([["countrySpecific","cs"],["quantity","q"],["authCode","code"],["checkoutPromoCode","apc"],["rurl","rUrl"],["curl","cUrl"],["ctxrturl","ctxRtUrl"],["country","co"],["language","lang"],["clientId","cli"],["context","ctx"],["productArrangementCode","pa"],["offerType","ot"],["marketSegment","ms"]]);var Gr=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Fr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function ve(e,t,r){var n,i;try{for(var o=Gr(Object.entries(e)),s=o.next();!s.done;s=o.next()){var a=Fr(s.value,2),c=a[0],l=a[1],u=Rt(c);l!=null&&r.has(u)&&t.set(u,l)}}catch(p){n={error:p}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}function Xe(e){switch(e){case W.PRODUCTION:return"https://commerce.adobe.com";default:return"https://commerce-stg.adobe.com"}}function Be(e,t){var r,n;for(var i in e){var o=e[i];try{for(var s=(r=void 0,Gr(Object.entries(o))),a=s.next();!a.done;a=s.next()){var c=Fr(a.value,2),l=c[0],u=c[1];if(u!=null){var p=Rt(l);t.set("items["+i+"]["+p+"]",u)}}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}}var ci=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Vr(e){pi(e);var t=e.env,r=e.items,n=e.workflowStep,i=ci(e,["env","items","workflowStep"]),o=new URL(Xe(t));return o.pathname=n+"/",Be(r,o.searchParams),ve(i,o.searchParams,li),o.toString()}var li=new Set(["cli","co","lang","ctx","cUrl","mv","nglwfdata","otac","promoid","rUrl","sdid","spint","trackingid","code","campaignid","appctxid"]),fi=["env","workflowStep","clientId","country","items"];function pi(e){var t,r;try{for(var n=ui(fi),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!0}var mi=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},di="p_draft_landscape",Ei="/store/";function Ut(e){xi(e);var t=e.env,r=e.items,n=e.workflowStep,i=e.ms,o=e.marketSegment,s=e.ot,a=e.offerType,c=e.pa,l=e.productArrangementCode,u=e.landscape,p=mi(e,["env","items","workflowStep","ms","marketSegment","ot","offerType","pa","productArrangementCode","landscape"]),f={marketSegment:o??i,offerType:a??s,productArrangementCode:l??c},m=new URL(Xe(t));return m.pathname=""+Ei+n,n!==oe.SEGMENTATION?Be(r,m.searchParams):ve(f,m.searchParams,It),ve(p,m.searchParams,It),u===M.DRAFT&&ve({af:di},m.searchParams,It),m.toString()}var It=new Set(["af","ai","apc","appctxid","cli","co","csm","ctx","ctxRtUrl","DCWATC","dp","fr","gsp","ijt","lang","lo","mal","ms","mv","mv2","nglwfdata","ot","otac","pa","pcid","promoid","q","rf","sc","scl","sdid","sid","spint","svar","th","thm","trackingid","usid","workflowid","context.guid","so.ca","so.su","so.tr","so.va"]),gi=["env","workflowStep","clientId","country"];function xi(e){var t,r;try{for(var n=hi(gi),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(e.workflowStep!==oe.SEGMENTATION&&!e.items)throw new Error('Argument "checkoutData" is not valid, missing: items');return!0}function Dt(e,t){switch(e){case le.V2:return Vr(t);case le.V3:return Ut(t);default:return console.warn("Unsupported CheckoutType, will use UCv3 as default. Given type: "+e),Ut(t)}}var Mt;(function(e){e.BASE="BASE",e.TRIAL="TRIAL",e.PROMOTION="PROMOTION"})(Mt||(Mt={}));var C;(function(e){e.MONTH="MONTH",e.YEAR="YEAR",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS",e.PERPETUAL="PERPETUAL",e.TERM_LICENSE="TERM_LICENSE",e.ACCESS_PASS="ACCESS_PASS",e.THREE_MONTHS="THREE_MONTHS",e.SIX_MONTHS="SIX_MONTHS"})(C||(C={}));var w;(function(e){e.ANNUAL="ANNUAL",e.MONTHLY="MONTHLY",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS",e.P1D="P1D",e.P1Y="P1Y",e.P3Y="P3Y",e.P10Y="P10Y",e.P15Y="P15Y",e.P3D="P3D",e.P7D="P7D",e.P30D="P30D",e.HALF_YEARLY="HALF_YEARLY",e.QUARTERLY="QUARTERLY"})(w||(w={}));var kt;(function(e){e.INDIVIDUAL="INDIVIDUAL",e.TEAM="TEAM",e.ENTERPRISE="ENTERPRISE"})(kt||(kt={}));var Gt;(function(e){e.COM="COM",e.EDU="EDU",e.GOV="GOV"})(Gt||(Gt={}));var Ft;(function(e){e.DIRECT="DIRECT",e.INDIRECT="INDIRECT"})(Ft||(Ft={}));var Vt;(function(e){e.ENTERPRISE_PRODUCT="ENTERPRISE_PRODUCT",e.ETLA="ETLA",e.RETAIL="RETAIL",e.VIP="VIP",e.VIPMP="VIPMP",e.FREE="FREE"})(Vt||(Vt={}));var yi=M.PUBLISHED,jr=e=>{switch(e){case W.PRODUCTION:return"https://wcs.adobe.io";case W.STAGE:return"https://wcs-stage.adobe.io";case W.LOCAL:return"http://localhost:3002";default:return"https://wcs-stage.adobe.io"}},Wr=(e,t)=>{var r;return e.api_key=t.apiKey,e.landscape=(r=t.landscape)!==null&&r!==void 0?r:yi,e};var vi=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},jt=class extends Ct{constructor(t){super(t),this.apiPaths={getWebCommerceArtifact:"web_commerce_artifact"},this.getWebCommerceArtifact=(r,n,i,o)=>vi(this,void 0,void 0,function*(){let s=this.buildUrl(this.apiPaths.getWebCommerceArtifact,n,r,a=>jr(a),(a,c)=>this.evaluateGetWebCommerceArtifactParams(a,c));return this.fetchOptions.fetch(s,{signal:o,headers:Object.assign({},this.commonHeaders()),mode:"cors"}).then(a=>this.failOnBadStatusOrParseBody(a,`GET ${s}`)).then(a=>{let l=a.data;return{data:this.transformDatum(l,i)}})})}evaluateGetWebCommerceArtifactParams(t,r){let n={};return this.setParams(n,"offer_selector_ids",r.offerSelectorIds.join(",")),this.setParams(n,"country",r.country),this.setParams(n,"language",r.language),this.setParams(n,"currency",r.currency),this.setParams(n,"locale",r.locale),this.setParams(n,"promotion_code",r.promotionCode),Wr(n,t)}},Hr=jt;var Ye=e=>new Hr(e).getWebCommerceArtifact;var Xr="tacocat.js";var $e=(e,t)=>String(e??"").toLowerCase()==String(t??"").toLowerCase(),Br=e=>`${e??""}`.replace(/[&<>'"]/g,t=>({"&":"&","<":"<",">":">","'":"'",'"':"""})[t]??t)??"";function A(e,t={},{metadata:r=!0,search:n=!0,storage:i=!0}={}){let o;if(n&&o==null){let s=new URLSearchParams(window.location.search),a=Te(n)?n:e;o=s.get(a)}if(i&&o==null){let s=Te(i)?i:e;o=window.sessionStorage.getItem(s)??window.localStorage.getItem(s)}if(r&&o==null){let s=qr(Te(r)?r:e);o=document.documentElement.querySelector(`meta[name="${s}"]`)?.content}return o??t[e]}var be=()=>{};var Yr=e=>typeof e=="boolean",se=e=>typeof e=="function",qe=e=>typeof e=="number",$r=e=>e!=null&&typeof e=="object";var Te=e=>typeof e=="string",Wt=e=>Te(e)&&e,Pe=e=>qe(e)&&Number.isFinite(e)&&e>0;function _e(e,t=r=>r==null||r===""){return e!=null&&Object.entries(e).forEach(([r,n])=>{t(n)&&delete e[r]}),e}function b(e,t){if(Yr(e))return e;let r=String(e);return r==="1"||r==="true"?!0:r==="0"||r==="false"?!1:t}function re(e,t,r){let n=Object.values(t);return n.find(i=>$e(i,e))??r??n[0]}function qr(e=""){return String(e).replace(/(\p{Lowercase_Letter})(\p{Uppercase_Letter})/gu,(t,r,n)=>`${r}-${n}`).replace(/\W+/gu,"-").toLowerCase()}function Se(e,t=1){return qe(e)||(e=Number.parseInt(e,10)),!Number.isNaN(e)&&e>0&&Number.isFinite(e)?e:t}var Ti=Date.now(),Ht=()=>`(+${Date.now()-Ti}ms)`,ze=new Set,bi=b(A("tacocat.debug",{},{metadata:!1}),typeof process<"u"&&process.env?.DEBUG);function zr(e){let t=`[${Xr}/${e}]`,r=(s,a,...c)=>s?!0:(i(a,...c),!1),n=bi?(s,...a)=>{console.debug(`${t} ${s}`,...a,Ht())}:()=>{},i=(s,...a)=>{let c=`${t} ${s}`;ze.forEach(([l])=>l(c,...a))};return{assert:r,debug:n,error:i,warn:(s,...a)=>{let c=`${t} ${s}`;ze.forEach(([,l])=>l(c,...a))}}}function Pi(e,t){let r=[e,t];return ze.add(r),()=>{ze.delete(r)}}Pi((e,...t)=>{console.error(e,...t,Ht())},(e,...t)=>{console.warn(e,...t,Ht())});var _i="no promo",Zr="promo-tag",Si="yellow",Ai="neutral",wi=(e,t,r)=>{let n=o=>o||_i,i=r?` (was "${n(t)}")`:"";return`${n(e)}${i}`},Oi="cancel-context",Ie=(e,t)=>{let r=e===Oi,n=!r&&e?.length>0,i=(n||r)&&(t&&t!=e||!t&&!r),o=i&&n||!i&&!!t,s=o?e||t:void 0;return{effectivePromoCode:s,overridenPromoCode:e,className:o?Zr:`${Zr} no-promo`,text:wi(s,t,i),variant:o?Si:Ai,isOverriden:i}};var Xt=function(e,t){return Xt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Xt(e,t)};function Ue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Xt(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var T=function(){return T=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0}),r=[],n=0,i=t;n1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(Ci,function(a,c,l,u,p,f){if(c)t.minimumIntegerDigits=l.length;else{if(u&&p)throw new Error("We currently do not support maximum integer digits");if(f)throw new Error("We currently do not support exact integer digits")}return""});continue}if(an.test(i.stem)){t.minimumIntegerDigits=i.stem.length;continue}if(tn.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(tn,function(a,c,l,u,p,f){return l==="*"?t.minimumFractionDigits=c.length:u&&u[0]==="#"?t.maximumFractionDigits=u.length:p&&f?(t.minimumFractionDigits=p.length,t.maximumFractionDigits=p.length+f.length):(t.minimumFractionDigits=c.length,t.maximumFractionDigits=c.length),""}),i.options.length&&(t=T(T({},t),rn(i.options[0])));continue}if(sn.test(i.stem)){t=T(T({},t),rn(i.stem));continue}var o=cn(i.stem);o&&(t=T(T({},t),o));var s=Ri(i.stem);s&&(t=T(T({},t),s))}return t}var $t,Ii=new RegExp("^"+Yt.source+"*"),Ui=new RegExp(Yt.source+"*$");function E(e,t){return{start:e,end:t}}var Di=!!String.prototype.startsWith,Mi=!!String.fromCodePoint,ki=!!Object.fromEntries,Gi=!!String.prototype.codePointAt,Fi=!!String.prototype.trimStart,Vi=!!String.prototype.trimEnd,ji=!!Number.isSafeInteger,Wi=ji?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},zt=!0;try{ln=hn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),zt=(($t=ln.exec("a"))===null||$t===void 0?void 0:$t[0])==="a"}catch{zt=!1}var ln,fn=Di?function(t,r,n){return t.startsWith(r,n)}:function(t,r,n){return t.slice(n,n+r.length)===r},Zt=Mi?String.fromCodePoint:function(){for(var t=[],r=0;ro;){if(s=t[o++],s>1114111)throw RangeError(s+" is not a valid code point");n+=s<65536?String.fromCharCode(s):String.fromCharCode(((s-=65536)>>10)+55296,s%1024+56320)}return n},pn=ki?Object.fromEntries:function(t){for(var r={},n=0,i=t;n=n)){var i=t.charCodeAt(r),o;return i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?i:(i-55296<<10)+(o-56320)+65536}},Hi=Fi?function(t){return t.trimStart()}:function(t){return t.replace(Ii,"")},Xi=Vi?function(t){return t.trimEnd()}:function(t){return t.replace(Ui,"")};function hn(e,t){return new RegExp(e,t)}var Qt;zt?(qt=hn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),Qt=function(t,r){var n;qt.lastIndex=r;var i=qt.exec(t);return(n=i[1])!==null&&n!==void 0?n:""}):Qt=function(t,r){for(var n=[];;){var i=mn(t,r);if(i===void 0||En(i)||$i(i))break;n.push(i),r+=i>=65536?2:1}return Zt.apply(void 0,n)};var qt,dn=function(){function e(t,r){r===void 0&&(r={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!r.ignoreTag,this.requiresOtherClause=!!r.requiresOtherClause,this.shouldParseSkeletons=!!r.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,r,n){for(var i=[];!this.isEOF();){var o=this.char();if(o===123){var s=this.parseArgument(t,n);if(s.err)return s;i.push(s.val)}else{if(o===125&&t>0)break;if(o===35&&(r==="plural"||r==="selectordinal")){var a=this.clonePosition();this.bump(),i.push({type:S.pound,location:E(a,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(d.UNMATCHED_CLOSING_TAG,E(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&Jt(this.peek()||0)){var s=this.parseTag(t,r);if(s.err)return s;i.push(s.val)}else{var s=this.parseLiteral(t,r);if(s.err)return s;i.push(s.val)}}}return{val:i,err:null}},e.prototype.parseTag=function(t,r){var n=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:S.literal,value:"<"+i+"/>",location:E(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(t+1,r,!0);if(o.err)return o;var s=o.val,a=this.clonePosition();if(this.bumpIf("")?{val:{type:S.tag,value:i,children:s,location:E(n,this.clonePosition())},err:null}:this.error(d.INVALID_TAG,E(a,this.clonePosition())))}else return this.error(d.UNCLOSED_TAG,E(n,this.clonePosition()))}else return this.error(d.INVALID_TAG,E(n,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&Yi(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,r){for(var n=this.clonePosition(),i="";;){var o=this.tryParseQuote(r);if(o){i+=o;continue}var s=this.tryParseUnquoted(t,r);if(s){i+=s;continue}var a=this.tryParseLeftAngleBracket();if(a){i+=a;continue}break}var c=E(n,this.clonePosition());return{val:{type:S.literal,value:i,location:c},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!Bi(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var r=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(n===39)if(this.peek()===39)r.push(39),this.bump();else{this.bump();break}else r.push(n);this.bump()}return Zt.apply(void 0,r)},e.prototype.tryParseUnquoted=function(t,r){if(this.isEOF())return null;var n=this.char();return n===60||n===123||n===35&&(r==="plural"||r==="selectordinal")||n===125&&t>0?null:(this.bump(),Zt(n))},e.prototype.parseArgument=function(t,r){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(d.EMPTY_ARGUMENT,E(n,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(d.MALFORMED_ARGUMENT,E(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:S.argument,value:i,location:E(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(n,this.clonePosition())):this.parseArgumentOptions(t,r,i,n);default:return this.error(d.MALFORMED_ARGUMENT,E(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),r=this.offset(),n=Qt(this.message,r),i=r+n.length;this.bumpTo(i);var o=this.clonePosition(),s=E(t,o);return{value:n,location:s}},e.prototype.parseArgumentOptions=function(t,r,n,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,c=this.clonePosition();switch(a){case"":return this.error(d.EXPECT_ARGUMENT_TYPE,E(s,c));case"number":case"date":case"time":{this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var u=this.clonePosition(),p=this.parseSimpleArgStyleIfPossible();if(p.err)return p;var f=Xi(p.val);if(f.length===0)return this.error(d.EXPECT_ARGUMENT_STYLE,E(this.clonePosition(),this.clonePosition()));var m=E(u,this.clonePosition());l={style:f,styleLocation:m}}var h=this.tryParseArgumentClose(i);if(h.err)return h;var x=E(i,this.clonePosition());if(l&&fn(l?.style,"::",0)){var y=Hi(l.style.slice(2));if(a==="number"){var p=this.parseNumberSkeletonFromString(y,l.styleLocation);return p.err?p:{val:{type:S.number,value:n,location:x,style:p.val},err:null}}else{if(y.length===0)return this.error(d.EXPECT_DATE_TIME_SKELETON,x);var f={type:fe.dateTime,pattern:y,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?Kr(y):{}},L=a==="date"?S.date:S.time;return{val:{type:L,value:n,location:x,style:f},err:null}}}return{val:{type:a==="number"?S.number:a==="date"?S.date:S.time,value:n,location:x,style:(o=l?.style)!==null&&o!==void 0?o:null},err:null}}case"plural":case"selectordinal":case"select":{var P=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(d.EXPECT_SELECT_ARGUMENT_OPTIONS,E(P,T({},P)));this.bumpSpace();var v=this.parseIdentifierIfPossible(),O=0;if(a!=="select"&&v.value==="offset"){if(!this.bumpIf(":"))return this.error(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,E(this.clonePosition(),this.clonePosition()));this.bumpSpace();var p=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,d.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(p.err)return p;this.bumpSpace(),v=this.parseIdentifierIfPossible(),O=p.val}var _=this.tryParsePluralOrSelectOptions(t,a,r,v);if(_.err)return _;var h=this.tryParseArgumentClose(i);if(h.err)return h;var U=E(i,this.clonePosition());return a==="select"?{val:{type:S.select,value:n,options:pn(_.val),location:U},err:null}:{val:{type:S.plural,value:n,options:pn(_.val),offset:O,pluralType:a==="plural"?"cardinal":"ordinal",location:U},err:null}}default:return this.error(d.INVALID_ARGUMENT_TYPE,E(s,c))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,r=this.clonePosition();!this.isEOF();){var n=this.char();switch(n){case 39:{this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(d.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,E(i,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(r.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(r.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,r){var n=[];try{n=on(t)}catch{return this.error(d.INVALID_NUMBER_SKELETON,r)}return{val:{type:fe.number,tokens:n,location:r,parsedOptions:this.shouldParseSkeletons?un(n):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,r,n,i){for(var o,s=!1,a=[],c=new Set,l=i.value,u=i.location;;){if(l.length===0){var p=this.clonePosition();if(r!=="select"&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_SELECTOR,d.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;u=E(p,this.clonePosition()),l=this.message.slice(p.offset,this.offset())}else break}if(c.has(l))return this.error(r==="select"?d.DUPLICATE_SELECT_ARGUMENT_SELECTOR:d.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,u);l==="other"&&(s=!0),this.bumpSpace();var m=this.clonePosition();if(!this.bumpIf("{"))return this.error(r==="select"?d.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:d.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,E(this.clonePosition(),this.clonePosition()));var h=this.parseMessage(t+1,r,n);if(h.err)return h;var x=this.tryParseArgumentClose(m);if(x.err)return x;a.push([l,{value:h.val,location:E(m,this.clonePosition())}]),c.add(l),this.bumpSpace(),o=this.parseIdentifierIfPossible(),l=o.value,u=o.location}return a.length===0?this.error(r==="select"?d.EXPECT_SELECT_ARGUMENT_SELECTOR:d.EXPECT_PLURAL_ARGUMENT_SELECTOR,E(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!s?this.error(d.MISSING_OTHER_CLAUSE,E(this.clonePosition(),this.clonePosition())):{val:a,err:null}},e.prototype.tryParseDecimalInteger=function(t,r){var n=1,i=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var o=!1,s=0;!this.isEOF();){var a=this.char();if(a>=48&&a<=57)o=!0,s=s*10+(a-48),this.bump();else break}var c=E(i,this.clonePosition());return o?(s*=n,Wi(s)?{val:s,err:null}:this.error(r,c)):this.error(t,c)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var r=mn(this.message,t);if(r===void 0)throw Error("Offset "+t+" is at invalid UTF-16 code unit boundary");return r},e.prototype.error=function(t,r){return{val:null,err:{kind:t,message:this.message,location:r}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(fn(this.message,t,this.offset())){for(var r=0;r=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset "+t+" must be greater than or equal to the current offset "+this.offset());for(t=Math.min(t,this.message.length);;){var r=this.offset();if(r===t)break;if(r>t)throw Error("targetOffset "+t+" is at invalid UTF-16 code unit boundary");if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&En(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),r=this.offset(),n=this.message.charCodeAt(r+(t>=65536?2:1));return n??null},e}();function Jt(e){return e>=97&&e<=122||e>=65&&e<=90}function Bi(e){return Jt(e)||e===47}function Yi(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function En(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function $i(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function Kt(e){e.forEach(function(t){if(delete t.location,et(t)||tt(t))for(var r in t.options)delete t.options[r].location,Kt(t.options[r].value);else Qe(t)&&nt(t.style)||(Je(t)||Ke(t))&&De(t.style)?delete t.style.location:rt(t)&&Kt(t.children)})}function gn(e,t){t===void 0&&(t={}),t=T({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new dn(e,t).parse();if(r.err){var n=SyntaxError(d[r.err.kind]);throw n.location=r.err.location,n.originalMessage=r.err.message,n}return t?.captureLocation||Kt(r.val),r.val}function Me(e,t){var r=t&&t.cache?t.cache:Ki,n=t&&t.serializer?t.serializer:Ji,i=t&&t.strategy?t.strategy:zi;return i(e,{cache:r,serializer:n})}function qi(e){return e==null||typeof e=="number"||typeof e=="boolean"}function xn(e,t,r,n){var i=qi(n)?n:r(n),o=t.get(i);return typeof o>"u"&&(o=e.call(this,n),t.set(i,o)),o}function yn(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return typeof o>"u"&&(o=e.apply(this,n),t.set(i,o)),o}function er(e,t,r,n,i){return r.bind(t,e,n,i)}function zi(e,t){var r=e.length===1?xn:yn;return er(e,this,r,t.cache.create(),t.serializer)}function Zi(e,t){return er(e,this,yn,t.cache.create(),t.serializer)}function Qi(e,t){return er(e,this,xn,t.cache.create(),t.serializer)}var Ji=function(){return JSON.stringify(arguments)};function tr(){this.cache=Object.create(null)}tr.prototype.get=function(e){return this.cache[e]};tr.prototype.set=function(e,t){this.cache[e]=t};var Ki={create:function(){return new tr}},it={variadic:Zi,monadic:Qi};var pe;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(pe||(pe={}));var ke=function(e){Ue(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.code=n,o.originalMessage=i,o}return t.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},t}(Error);var rr=function(e){Ue(t,e);function t(r,n,i,o){return e.call(this,'Invalid values for "'+r+'": "'+n+'". Options are "'+Object.keys(i).join('", "')+'"',pe.INVALID_VALUE,o)||this}return t}(ke);var vn=function(e){Ue(t,e);function t(r,n,i){return e.call(this,'Value for "'+r+'" must be of type '+n,pe.INVALID_VALUE,i)||this}return t}(ke);var Tn=function(e){Ue(t,e);function t(r,n){return e.call(this,'The intl string context variable "'+r+'" was not provided to the string "'+n+'"',pe.MISSING_VALUE,n)||this}return t}(ke);var R;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(R||(R={}));function eo(e){return e.length<2?e:e.reduce(function(t,r){var n=t[t.length-1];return!n||n.type!==R.literal||r.type!==R.literal?t.push(r):n.value+=r.value,t},[])}function to(e){return typeof e=="function"}function Ge(e,t,r,n,i,o,s){if(e.length===1&&Bt(e[0]))return[{type:R.literal,value:e[0].value}];for(var a=[],c=0,l=e;c0?e.substring(0,n):"";let i=_n(e.split("").reverse().join("")),o=r-i,s=e.substring(o,o+1),a=o+(s==="."||s===","?1:0);t.suffix=i>0?e.substring(a,r):"",t.mask=e.substring(n,a),t.maskHasNegativeSign=t.mask.charAt(0)==="-",t.maskHasPositiveSign=t.mask.charAt(0)==="+";let c=t.mask.match(so);return t.decimal=c&&c[c.length-1]||".",t.separator=c&&c[1]&&c[0]||",",c=t.mask.split(t.decimal),t.integer=c[0],t.fraction=c[1],t}function co(e,t,r){let n=!1,i={value:e};e<0&&(n=!0,i.value=-i.value),i.sign=n?"-":"",i.value=Number(i.value).toFixed(t.fraction&&t.fraction.length),i.value=Number(i.value).toString();let o=t.fraction&&t.fraction.lastIndexOf("0"),[s="0",a=""]=i.value.split(".");return(!a||a&&a.length<=o)&&(a=o<0?"":(+("0."+a)).toFixed(o+1).replace("0.","")),i.integer=s,i.fraction=a,uo(i,t),(i.result==="0"||i.result==="")&&(n=!1,i.sign=""),!n&&t.maskHasPositiveSign?i.sign="+":n&&t.maskHasPositiveSign?i.sign="-":n&&(i.sign=r&&r.enforceMaskSign&&!t.maskHasNegativeSign?"":"-"),i}function uo(e,t){e.result="";let r=t.integer.split(t.separator),n=r.join(""),i=n&&n.indexOf("0");if(i>-1)for(;e.integer.lengthMath.round(e*20)/20},ir=(e,t)=>({accept:e,round:t}),ho=[ir(({divisor:e,price:t})=>t%e==0,({divisor:e,price:t})=>t/e),ir(({usePrecision:e})=>e,({divisor:e,price:t})=>Math.ceil(Math.floor(t*1e4/e)/100)/100),ir(()=>!0,({divisor:e,price:t})=>Math.ceil(Math.floor(t*100/e)/100))],or={[C.YEAR]:{[w.MONTHLY]:Fe.MONTH,[w.ANNUAL]:Fe.YEAR},[C.MONTH]:{[w.MONTHLY]:Fe.MONTH}},Eo=(e,t)=>e.indexOf(`'${t}'`)===0,go=(e,t=!0)=>{let r=e.replace(/'.*?'/,"").trim(),n=Cn(r);return!!n?t||(r=r.replace(/[,\.]0+/,n)):r=r.replace(/\s?(#.*0)(?!\s)?/,"$&"+yo(e)),r},xo=e=>{let t=vo(e),r=Eo(e,t),n=e.replace(/'.*?'/,""),i=On.test(n)||Ln.test(n);return{currencySymbol:t,isCurrencyFirst:r,hasCurrencySpace:i}},Nn=e=>e.replace(On,wn).replace(Ln,wn),yo=e=>e.match(/#(.?)#/)?.[1]===An?fo:An,vo=e=>e.match(/'(.*?)'/)?.[1]??"",Cn=e=>e.match(/0(.?)0/)?.[1]??"";function ot({formatString:e,price:t,usePrecision:r,isIndianPrice:n=!1},i,o=s=>s){let{currencySymbol:s,isCurrencyFirst:a,hasCurrencySpace:c}=xo(e),l=r?Cn(e):"",u=go(e,r),p=r?2:0,f=o(t,{currencySymbol:s}),m=n?f.toLocaleString("hi-IN",{minimumFractionDigits:p,maximumFractionDigits:p}):Sn(u,f),h=r?m.lastIndexOf(l):m.length,x=m.substring(0,h),y=m.substring(h+1);return{accessiblePrice:e.replace(/'.*?'/,"SYMBOL").replace(/#.*0/,m).replace(/SYMBOL/,s),currencySymbol:s,decimals:y,decimalsDelimiter:l,hasCurrencySpace:c,integer:x,isCurrencyFirst:a,recurrenceTerm:i}}var Rn=e=>{let{commitment:t,term:r,usePrecision:n}=e,i=po[r]??1;return ot(e,i>1?Fe.MONTH:or[t]?.[r],(o,{currencySymbol:s})=>{let a={divisor:i,price:o,usePrecision:n},{round:c}=ho.find(({accept:u})=>u(a));if(!c)throw new Error(`Missing rounding rule for: ${JSON.stringify(a)}`);return(mo[s]??(u=>u))(c(a))})},In=({commitment:e,term:t,...r})=>ot(r,or[e]?.[t]),Un=e=>{let{commitment:t,term:r}=e;return t===C.YEAR&&r===w.MONTHLY?ot(e,Fe.YEAR,n=>n*12):ot(e,or[t]?.[r])};var To={recurrenceLabel:"{recurrenceTerm, select, MONTH {/mo} YEAR {/yr} other {}}",recurrenceAriaLabel:"{recurrenceTerm, select, MONTH {per month} YEAR {per year} other {}}",perUnitLabel:"{perUnit, select, LICENSE {per license} other {}}",perUnitAriaLabel:"{perUnit, select, LICENSE {per license} other {}}",freeLabel:"Free",freeAriaLabel:"Free",taxExclusiveLabel:"{taxTerm, select, GST {excl. GST} VAT {excl. VAT} TAX {excl. tax} IVA {excl. IVA} SST {excl. SST} KDV {excl. KDV} other {}}",taxInclusiveLabel:"{taxTerm, select, GST {incl. GST} VAT {incl. VAT} TAX {incl. tax} IVA {incl. IVA} SST {incl. SST} KDV {incl. KDV} other {}}",alternativePriceAriaLabel:"Alternatively at {alternativePrice}",strikethroughAriaLabel:"Regularly at {strikethroughPrice}"},bo=zr("ConsonantTemplates/price"),Po=/<.+?>/g,V={container:"price",containerOptical:"price-optical",containerStrikethrough:"price-strikethrough",containerAnnual:"price-annual",disabled:"disabled",currencySpace:"price-currency-space",currencySymbol:"price-currency-symbol",decimals:"price-decimals",decimalsDelimiter:"price-decimals-delimiter",integer:"price-integer",recurrence:"price-recurrence",taxInclusivity:"price-tax-inclusivity",unitType:"price-unit-type"},me={perUnitLabel:"perUnitLabel",perUnitAriaLabel:"perUnitAriaLabel",recurrenceLabel:"recurrenceLabel",recurrenceAriaLabel:"recurrenceAriaLabel",taxExclusiveLabel:"taxExclusiveLabel",taxInclusiveLabel:"taxInclusiveLabel",strikethroughAriaLabel:"strikethroughAriaLabel"},_o="TAX_EXCLUSIVE",So=e=>$r(e)?Object.entries(e).filter(([,t])=>Te(t)||qe(t)||t===!0).reduce((t,[r,n])=>t+` ${r}${n===!0?"":'="'+Br(n)+'"'}`,""):"",B=(e,t,r,n=!1)=>`${n?Nn(t):t??""}`;function Ao(e,{accessibleLabel:t,currencySymbol:r,decimals:n,decimalsDelimiter:i,hasCurrencySpace:o,integer:s,isCurrencyFirst:a,recurrenceLabel:c,perUnitLabel:l,taxInclusivityLabel:u},p={}){let f=B(V.currencySymbol,r),m=B(V.currencySpace,o?" ":""),h="";return a&&(h+=f+m),h+=B(V.integer,s),h+=B(V.decimalsDelimiter,i),h+=B(V.decimals,n),a||(h+=m+f),h+=B(V.recurrence,c,null,!0),h+=B(V.unitType,l,null,!0),h+=B(V.taxInclusivity,u,!0),B(e,h,{...p,"aria-label":t})}var he=({displayOptical:e=!1,displayStrikethrough:t=!1,displayAnnual:r=!1}={})=>({country:n,displayFormatted:i=!0,displayRecurrence:o=!0,displayPerUnit:s=!1,displayTax:a=!1,language:c,literals:l={}}={},{commitment:u,formatString:p,price:f,priceWithoutDiscount:m,taxDisplay:h,taxTerm:x,term:y,usePrecision:L}={},P={})=>{Object.entries({country:n,formatString:p,language:c,price:f}).forEach(([ee,At])=>{if(At==null)throw new Error(`Argument "${ee}" is missing`)});let v={...To,...l},O=`${c.toLowerCase()}-${n.toUpperCase()}`;function _(ee,At){let wt=v[ee];if(wt==null)return"";try{return new Pn(wt.replace(Po,""),O).format(At)}catch{return bo.error("Failed to format literal:",wt),""}}let U=t&&m?m:f,F=e?Rn:In;r&&(F=Un);let{accessiblePrice:N,recurrenceTerm:j,...J}=F({commitment:u,formatString:p,term:y,price:e?f:U,usePrecision:L,isIndianPrice:n==="IN"}),H=N,ce="";if(b(o)&&j){let ee=_(me.recurrenceAriaLabel,{recurrenceTerm:j});ee&&(H+=" "+ee),ce=_(me.recurrenceLabel,{recurrenceTerm:j})}let ue="";if(b(s)){ue=_(me.perUnitLabel,{perUnit:"LICENSE"});let ee=_(me.perUnitAriaLabel,{perUnit:"LICENSE"});ee&&(H+=" "+ee)}let K="";b(a)&&x&&(K=_(h===_o?me.taxExclusiveLabel:me.taxInclusiveLabel,{taxTerm:x}),K&&(H+=" "+K)),t&&(H=_(me.strikethroughAriaLabel,{strikethroughPrice:H}));let X=V.container;if(e&&(X+=" "+V.containerOptical),t&&(X+=" "+V.containerStrikethrough),r&&(X+=" "+V.containerAnnual),b(i))return Ao(X,{...J,accessibleLabel:H,recurrenceLabel:ce,perUnitLabel:ue,taxInclusivityLabel:K},P);let{currencySymbol:xe,decimals:je,decimalsDelimiter:We,hasCurrencySpace:Ne,integer:St,isCurrencyFirst:ri}=J,ye=[St,We,je];ri?(ye.unshift(Ne?"\xA0":""),ye.unshift(xe)):(ye.push(Ne?"\xA0":""),ye.push(xe)),ye.push(ce,ue,K);let ni=ye.join("");return B(X,ni,P)},Dn=()=>(e,t,r)=>{let i=(e.displayOldPrice===void 0||b(e.displayOldPrice))&&t.priceWithoutDiscount&&t.priceWithoutDiscount!=t.price;return`${he()(e,t,r)}${i?" "+he({displayStrikethrough:!0})(e,t,r):""}`};var sr=he(),ar=Dn(),cr=he({displayOptical:!0}),ur=he({displayStrikethrough:!0}),lr=he({displayAnnual:!0});var wo=(e,t)=>{if(!(!Pe(e)||!Pe(t)))return Math.floor((t-e)/t*100)},Mn=()=>(e,t,r)=>{let{price:n,priceWithoutDiscount:i}=t,o=wo(n,i);return o===void 0?'':`${o}%`};var fr=Mn();var pr="ABM",mr="PUF",hr="M2M",dr="PERPETUAL",kn="P3Y",Oo="TAX_INCLUSIVE_DETAILS",Lo="TAX_EXCLUSIVE",Gn={ABM:pr,PUF:mr,M2M:hr,PERPETUAL:dr,P3Y:kn},za={[pr]:{commitment:C.YEAR,term:w.MONTHLY},[mr]:{commitment:C.YEAR,term:w.ANNUAL},[hr]:{commitment:C.MONTH,term:w.MONTHLY},[dr]:{commitment:C.PERPETUAL,term:void 0},[kn]:{commitment:C.THREE_MONTHS,term:w.P3Y}},Fn="Value is not an offer",st=e=>{if(typeof e!="object")return Fn;let{commitment:t,term:r}=e,n=No(t,r);return{...e,planType:n}};var No=(e,t)=>{if(e===void 0)return Fn;if(e===""&&t==="")return"";let r="";return e===C.YEAR?t===w.MONTHLY?r=pr:t===w.ANNUAL&&(r=mr):e===C.MONTH?t===w.MONTHLY&&(r=hr):e===C.PERPETUAL&&(r=dr),r};function Er(e){let{priceDetails:t}=e,{price:r,priceWithoutDiscount:n,priceWithoutTax:i,priceWithoutDiscountAndTax:o,taxDisplay:s}=t;if(s!==Oo)return e;let a={...e,priceDetails:{...t,price:i??r,priceWithoutDiscount:o??n,taxDisplay:Lo}};return a.offerType==="TRIAL"&&a.priceDetails.price===0&&(a.priceDetails.price=a.priceDetails.priceWithoutDiscount),a}var{freeze:de}=Object,Y=de({...le}),$=de({...oe}),q=de({...W}),gr=de({...C}),Ae=de({...Re}),xr=de({...Gn}),yr=de({...w});var Ar={};oi(Ar,{CLASS_NAME_FAILED:()=>at,CLASS_NAME_PENDING:()=>ct,CLASS_NAME_RESOLVED:()=>ut,ERROR_MESSAGE_BAD_REQUEST:()=>vr,ERROR_MESSAGE_MISSING_LITERALS_URL:()=>br,ERROR_MESSAGE_OFFER_NOT_FOUND:()=>Tr,EVENT_TYPE_ERROR:()=>Co,EVENT_TYPE_FAILED:()=>lt,EVENT_TYPE_PENDING:()=>ft,EVENT_TYPE_READY:()=>Ee,EVENT_TYPE_RESOLVED:()=>pt,LOG_NAMESPACE:()=>Pr,PARAM_AOS_API_KEY:()=>Ro,PARAM_ENV:()=>_r,PARAM_LANDSCAPE:()=>Sr,PARAM_WCS_API_KEY:()=>Io,STATE_FAILED:()=>z,STATE_PENDING:()=>Z,STATE_RESOLVED:()=>Q,TAG_NAME_SERVICE:()=>ne});var at="placeholder-failed",ct="placeholder-pending",ut="placeholder-resolved",vr="Bad WCS request",Tr="Commerce offer not found",br="Literals URL not provided",Co="wcms:commerce:error",lt="wcms:placeholder:failed",ft="wcms:placeholder:pending",Ee="wcms:commerce:ready",pt="wcms:placeholder:resolved",Pr="wcms/commerce",_r="commerce.env",Sr="commerce.landscape",Ro="commerce.aosKey",Io="commerce.wcsKey",z="failed",Z="pending",Q="resolved",ne="wcms-commerce";var wr={clientId:"merch-at-scale",delimiter:"\xB6",ignoredProperties:["analytics","literals"],serializableTypes:["Array","Object"],sampleRate:30,tags:"consumer=milo/commerce"},Vn=new Set,Uo=e=>e instanceof Error||typeof e.originatingRequest=="string";function jn(e){if(e==null)return;let t=typeof e;if(t==="function"){let{name:r}=e;return r?`${t} ${r}`:t}if(t==="object"){if(e instanceof Error)return e.message;if(typeof e.originatingRequest=="string"){let{message:n,originatingRequest:i,status:o}=e;return[n,o,i].filter(s=>s).join(" ")}let r=e[Symbol.toStringTag]??Object.getPrototypeOf(e).constructor.name;if(!wr.serializableTypes.includes(r))return r}return e}function Do(e,t){if(!wr.ignoredProperties.includes(e))return jn(t)}var Or={append(e){let{delimiter:t,sampleRate:r,tags:n,clientId:i}=wr,{message:o,params:s}=e,a=[],c=o,l=[];s.forEach(f=>{f!=null&&(Uo(f)?a:l).push(f)}),a.length&&(c+=" ",c+=a.map(jn).join(" "));let{pathname:u,search:p}=window.location;c+=`${t}page=`,c+=u+p,l.length&&(c+=`${t}facts=`,c+=JSON.stringify(l,Do)),Vn.has(c)||(Vn.add(c),window.lana.log(c,{sampleRate:r,tags:n,clientId:i}))}};var g=Object.freeze({checkoutClientId:"adobe_com",checkoutWorkflow:Y.V3,checkoutWorkflowStep:$.EMAIL,country:"US",displayOldPrice:!0,displayPerUnit:!1,displayRecurrence:!0,displayTax:!1,env:q.PRODUCTION,forceTaxExclusive:!1,language:"en",entitlement:!1,extraOptions:{},modal:!1,promotionCode:"",quantity:1,wcsApiKey:"wcms-commerce-ims-ro-user-milo",wcsBufferDelay:1,wcsEnv:Ae.PRODUCTION,landscape:M.PUBLISHED,wcsBufferLimit:1});function Wn(e,{once:t=!1}={}){let r=null;function n(){let i=document.querySelector(ne);i!==r&&(r=i,i&&e(i))}return document.addEventListener(Ee,n,{once:t}),ae(n),()=>document.removeEventListener(Ee,n)}function mt(e,{country:t,forceTaxExclusive:r,perpetual:n}){let i;if(e.length<2)i=e;else{let o=t==="GB"||n?"EN":"MULT",[s,a]=e;i=[s.language===o?s:a]}return r&&(i=i.map(Er)),i}var ae=e=>window.setTimeout(e);function we(e,t=1){if(e==null)return[t];let r=(Array.isArray(e)?e:String(e).split(",")).map(Se).filter(Pe);return r.length||(r=[t]),r}function ht(e){return e==null?[]:(Array.isArray(e)?e:String(e).split(",")).filter(Wt)}function k(){return window.customElements.get(ne)?.instance}var Mo="en_US",ko={ar:"AR_es",br:"BR_pt",ca:"CA_en",cl:"CL_es",co:"CO_es",la:"DO_es",mx:"MX_es",pe:"PE_es",africa:"ZA_en",dk:"DK_da",de:"DE_de",ee:"EE_et",es:"ES_es",fr:"FR_fr",ie:"IE_en",il_he:"IL_iw",it:"IT_it",lv:"LV_lv",lt:"LT_lt",hu:"HU_hu",mt:"MT_en",mena_en:"DZ_en",mena_ar:"DZ_ar",nl:"NL_nl",no:"NO_nb",pl:"PL_pl",pt:"PT_pt",ro:"RO_ro",si:"SI_sl",sk:"SK_sk",fi:"FI_fi",se:"SE_sv",tr:"TR_tr",uk:"GB_en",at:"AT_de",cz:"CZ_cs",bg:"BG_bg",ru:"RU_ru",ua:"UA_uk",au:"AU_en",in:"IN_en",id_id:"ID_in",nz:"NZ_en",sg:"SG_en",cn:"CN_zh-Hans",tw:"TW_zh-Hant",hk_zh:"HK_zh-hant",jp:"JP_ja",kr:"KR_ko",za:"ZA_en",ng:"NG_en",cr:"CR_es",ec:"EC_es",pr:"US_es",gt:"GT_es",cis_en:"AZ_en",cis_ru:"AZ_ru",sea:"SG_en",th:"TH_en"},ie=Object.freeze({LOCAL:"local",PROD:"prod",STAGE:"stage"});function Hn({locale:e={}}={}){if(!e.prefix)return{country:g.country,language:g.language,locale:Mo};let t=e.prefix.replace("/","")??"",[r=g.country,n=g.language]=(ko[t]??t).split("_",2);return r=r.toUpperCase(),n=n.toLowerCase(),{country:r,language:n,locale:`${n}_${r}`}}function Lr(e={}){let{commerce:t={},locale:r=void 0}=e,i=(e.env?.name===ie.PROD?ie.PROD:re(A(_r,t,{metadata:!1}),ie,ie.PROD))===ie.STAGE?q.STAGE:q.PRODUCTION,o=A("checkoutClientId",t)??g.checkoutClientId,s=re(A("checkoutWorkflow",t),Y,g.checkoutWorkflow),a=$.CHECKOUT;s===Y.V3&&(a=re(A("checkoutWorkflowStep",t),$,g.checkoutWorkflowStep));let c=b(A("displayOldPrice",t),g.displayOldPrice),l=b(A("displayPerUnit",t),g.displayPerUnit),u=b(A("displayRecurrence",t),g.displayRecurrence),p=b(A("displayTax",t),g.displayTax),f=b(A("entitlement",t),g.entitlement),m=b(A("modal",t),g.modal),h=b(A("forceTaxExclusive",t),g.forceTaxExclusive),x=A("promotionCode",t)??g.promotionCode,y=we(A("quantity",t)),L=A("wcsApiKey",t)??g.wcsApiKey,P=e.env?.name===ie.PROD?M.PUBLISHED:re(A(Sr,t),M,g.landscape),v=Se(A("wcsBufferDelay",t),g.wcsBufferDelay),O=Se(A("wcsBufferLimit",t),g.wcsBufferLimit);return{...Hn({locale:r}),displayOldPrice:c,checkoutClientId:o,checkoutWorkflow:s,checkoutWorkflowStep:a,displayPerUnit:l,displayRecurrence:u,displayTax:p,entitlement:f,extraOptions:g.extraOptions,modal:m,env:i,forceTaxExclusive:h,priceLiteralsURL:t.priceLiteralsURL,priceLiteralsPromise:t.priceLiteralsPromise,promotionCode:x,quantity:y,wcsApiKey:L,wcsBufferDelay:v,wcsBufferLimit:O,wcsEnv:i===q.STAGE?Ae.STAGE:Ae.PRODUCTION,landscape:P}}var Bn="debug",Go="error",Fo="info",Vo="warn",jo=Date.now(),Nr=new Set,Cr=new Set,Xn=new Map,Ve=Object.freeze({DEBUG:Bn,ERROR:Go,INFO:Fo,WARN:Vo}),Yn={append({level:e,message:t,params:r,timestamp:n,source:i}){console[e](`${n}ms [${i}] %c${t}`,"font-weight: bold;",...r)}},$n={filter:({level:e})=>e!==Bn},Wo={filter:()=>!1};function Ho(e,t,r,n,i){return{level:e,message:t,namespace:r,get params(){if(n.length===1){let[o]=n;se(o)&&(n=o(),Array.isArray(n)||(n=[n]))}return n},source:i,timestamp:Date.now()-jo}}function Xo(e){[...Cr].every(t=>t(e))&&Nr.forEach(t=>t(e))}function qn(e){let t=(Xn.get(e)??0)+1;Xn.set(e,t);let r=`${e} #${t}`,n=o=>(s,...a)=>Xo(Ho(o,s,e,a,r)),i=Object.seal({id:r,namespace:e,module(o){return qn(`${i.namespace}/${o}`)},debug:n(Ve.DEBUG),error:n(Ve.ERROR),info:n(Ve.INFO),warn:n(Ve.WARN)});return i}function dt(...e){e.forEach(t=>{let{append:r,filter:n}=t;se(n)?Cr.add(n):se(r)&&Nr.add(r)})}function Bo(e={}){let{name:t}=e,r=b(A("commerce.debug",{search:!0,storage:!0}),t===ie.LOCAL);return dt(r?Yn:$n),t===ie.PROD&&dt(Or),I}function Yo(){Nr.clear(),Cr.clear()}var I={...qn(Pr),Level:Ve,Plugins:{consoleAppender:Yn,debugFilter:$n,quietFilter:Wo,lanaAppender:Or},init:Bo,reset:Yo,use:dt};var $o={CLASS_NAME_FAILED:at,CLASS_NAME_PENDING:ct,CLASS_NAME_RESOLVED:ut,EVENT_TYPE_FAILED:lt,EVENT_TYPE_PENDING:ft,EVENT_TYPE_RESOLVED:pt,STATE_FAILED:z,STATE_PENDING:Z,STATE_RESOLVED:Q},qo={[z]:at,[Z]:ct,[Q]:ut},zo={[z]:lt,[Z]:ft,[Q]:pt},xt=new WeakMap;function G(e){if(!xt.has(e)){let t=I.module(e.constructor.is);xt.set(e,{changes:new Map,connected:!1,dispose:be,error:void 0,log:t,options:void 0,promises:[],state:Z,timer:null,value:void 0,version:0})}return xt.get(e)}function Et(e){let t=G(e),{error:r,promises:n,state:i}=t;(i===Q||i===z)&&(t.promises=[],i===Q?n.forEach(({resolve:o})=>o(e)):i===z&&n.forEach(({reject:o})=>o(r))),e.dispatchEvent(new CustomEvent(zo[i],{bubbles:!0}))}function gt(e){let t=xt.get(e);[z,Z,Q].forEach(r=>{e.classList.toggle(qo[r],r===t.state)})}var Zo={get error(){return G(this).error},get log(){return G(this).log},get options(){return G(this).options},get state(){return G(this).state},get value(){return G(this).value},attributeChangedCallback(e,t,r){G(this).changes.set(e,r),this.requestUpdate()},connectedCallback(){G(this).dispose=Wn(()=>this.requestUpdate(!0))},disconnectedCallback(){let e=G(this);e.connected&&(e.connected=!1,e.log.debug("Disconnected:",{element:this})),e.dispose(),e.dispose=be},onceSettled(){let{error:e,promises:t,state:r}=G(this);return Q===r?Promise.resolve(this):z===r?Promise.reject(e):new Promise((n,i)=>{t.push({resolve:n,reject:i})})},toggleResolved(e,t,r){let n=G(this);return e!==n.version?!1:(r!==void 0&&(n.options=r),n.state=Q,n.value=t,gt(this),this.log.debug("Resolved:",{element:this,value:t}),ae(()=>Et(this)),!0)},toggleFailed(e,t,r){let n=G(this);return e!==n.version?!1:(r!==void 0&&(n.options=r),n.error=t,n.state=z,gt(this),n.log.error("Failed:",{element:this,error:t}),ae(()=>Et(this)),!0)},togglePending(e){let t=G(this);return t.version++,e&&(t.options=e),t.state=Z,gt(this),ae(()=>Et(this)),t.version},requestUpdate(e=!1){if(!this.isConnected||!k())return;let t=G(this);if(t.timer)return;let{error:r,options:n,state:i,value:o,version:s}=t;t.state=Z,t.timer=ae(async()=>{t.timer=null;let a=null;if(t.changes.size&&(a=Object.fromEntries(t.changes.entries()),t.changes.clear()),t.connected?t.log.debug("Updated:",{element:this,changes:a}):(t.connected=!0,t.log.debug("Connected:",{element:this,changes:a})),a||e)try{await this.render?.()===!1&&t.state===Z&&t.version===s&&(t.state=i,t.error=r,t.value=o,gt(this),Et(this))}catch(c){this.toggleFailed(t.version,c,n)}})}};function zn(e={}){return Object.entries(e).forEach(([t,r])=>{(r==null||r===""||r?.length===0)&&delete e[t]}),e}function yt(e,t={}){let{tag:r,is:n}=e,i=document.createElement(r,{is:n});return i.setAttribute("is",n),Object.assign(i.dataset,zn(t)),i}function vt(e){let{tag:t,is:r,prototype:n}=e,i=window.customElements.get(r);return i||(Object.defineProperties(n,Object.getOwnPropertyDescriptors(Zo)),i=Object.defineProperties(e,Object.getOwnPropertyDescriptors($o)),window.customElements.define(r,i,{extends:t})),i}function Tt(e,t=document.body){return Array.from(t?.querySelectorAll(`${e.tag}[is="${e.is}"]`)??[])}function bt(e,t={}){return e instanceof HTMLElement?(Object.assign(e.dataset,zn(t)),e):null}var Qo="download",Jo="upgrade",ge,Oe=class Oe extends HTMLAnchorElement{constructor(){super();Mr(this,ge,void 0);this.addEventListener("click",this.clickHandler)}static get observedAttributes(){return["data-checkout-workflow","data-checkout-workflow-step","data-extra-options","data-ims-country","data-perpetual","data-promotion-code","data-quantity","data-template","data-wcs-osi","data-entitlement","data-upgrade","data-modal"]}static createCheckoutLink(r={},n=""){let i=k();if(!i)return null;let{checkoutMarketSegment:o,checkoutWorkflow:s,checkoutWorkflowStep:a,entitlement:c,upgrade:l,modal:u,perpetual:p,promotionCode:f,quantity:m,wcsOsi:h,extraOptions:x}=i.collectCheckoutOptions(r),y=yt(Oe,{checkoutMarketSegment:o,checkoutWorkflow:s,checkoutWorkflowStep:a,entitlement:c,upgrade:l,modal:u,perpetual:p,promotionCode:f,quantity:m,wcsOsi:h,extraOptions:x});return n&&(y.innerHTML=`${n}`),y}static getCheckoutLinks(r){return Tt(Oe,r)}get isCheckoutLink(){return!0}get placeholder(){return this}clickHandler(r){var n;(n=Ot(this,ge))==null||n.call(this,r)}async render(r={}){if(!this.isConnected)return!1;let n=k();if(!n)return!1;this.dataset.imsCountry||n.imsCountryPromise.then(u=>{u&&(this.dataset.imsCountry=u)},be);let i=n.collectCheckoutOptions(r,this.placeholder);if(!i.wcsOsi.length)return!1;let o;try{o=JSON.parse(i.extraOptions??"{}")}catch(u){this.placeholder.log.error("cannot parse exta checkout options",u)}let s=this.placeholder.togglePending(i);this.href="";let a=n.resolveOfferSelectors(i),c=await Promise.all(a);c=c.map(u=>mt(u,i));let l=await n.buildCheckoutAction(c.flat(),{...o,...i});return this.renderOffers(c.flat(),i,{},l,s)}renderOffers(r,n,i={},o=void 0,s=void 0){if(!this.isConnected)return!1;let a=k();if(!a)return!1;if(n={...JSON.parse(this.placeholder.dataset.extraOptions??"null"),...n,...i},s??(s=this.placeholder.togglePending(n)),Ot(this,ge)&&Lt(this,ge,void 0),o){this.classList.remove(Qo,Jo),this.placeholder.toggleResolved(s,r,n);let{url:l,text:u,className:p,handler:f}=o;return l&&(this.href=l),u&&(this.firstElementChild.innerHTML=u),p&&this.classList.add(...p.split(" ")),f&&(this.setAttribute("href","#"),Lt(this,ge,f.bind(this))),!0}else if(r.length){if(this.placeholder.toggleResolved(s,r,n)){let l=a.buildCheckoutURL(r,n);return this.setAttribute("href",l),!0}}else{let l=new Error(`Not provided: ${n?.wcsOsi??"-"}`);if(this.placeholder.toggleFailed(s,l,n))return this.setAttribute("href","#"),!0}return!1}updateOptions(r={}){let n=k();if(!n)return!1;let{checkoutMarketSegment:i,checkoutWorkflow:o,checkoutWorkflowStep:s,entitlement:a,upgrade:c,modal:l,perpetual:u,promotionCode:p,quantity:f,wcsOsi:m}=n.collectCheckoutOptions(r);return bt(this,{checkoutMarketSegment:i,checkoutWorkflow:o,checkoutWorkflowStep:s,entitlement:a,upgrade:c,modal:l,perpetual:u,promotionCode:p,quantity:f,wcsOsi:m}),!0}};ge=new WeakMap,te(Oe,"is","checkout-link"),te(Oe,"tag","a");var Rr=Oe,Pt=vt(Rr);var Le=class Le extends HTMLSpanElement{static get observedAttributes(){return["data-display-old-price","data-display-per-unit","data-display-recurrence","data-display-tax","data-perpetual","data-promotion-code","data-tax-exclusive","data-template","data-wcs-osi"]}static createInlinePrice(t){let r=k();if(!r)return null;let{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}=r.collectPriceOptions(t);return yt(Le,{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f})}static getInlinePrices(t){return Tt(Le,t)}get isInlinePrice(){return!0}get placeholder(){return this}async render(t={}){if(!this.isConnected)return!1;let r=k();if(!r)return!1;let n=r.collectPriceOptions(t,this.placeholder);if(!n.wcsOsi.length)return!1;let i=this.placeholder.togglePending(n);this.innerHTML="";let[o]=r.resolveOfferSelectors(n);return this.renderOffers(mt(await o,n),n,i)}renderOffers(t,r={},n=void 0){if(!this.isConnected)return;let i=k();if(!i)return!1;let o=i.collectPriceOptions({...this.dataset,...r});if(n??(n=this.placeholder.togglePending(o)),t.length){if(this.placeholder.toggleResolved(n,t,o))return this.innerHTML=i.buildPriceHTML(t,o),!0}else{let s=new Error(`Not provided: ${o?.wcsOsi??"-"}`);if(this.placeholder.toggleFailed(n,s,o))return this.innerHTML="",!0}return!1}updateOptions(t){let r=k();if(!r)return!1;let{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}=r.collectPriceOptions(t);return bt(this,{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}),!0}};te(Le,"is","inline-price"),te(Le,"tag","span");var Ir=Le,_t=vt(Ir);function Zn({providers:e,settings:t},r){let n=I.module("checkout");function i(l,u){let{checkoutClientId:p,checkoutWorkflow:f,checkoutWorkflowStep:m,country:h,language:x,promotionCode:y,quantity:L}=t,{checkoutMarketSegment:P,checkoutWorkflow:v=f,checkoutWorkflowStep:O=m,imsCountry:_,country:U=_??h,language:F=x,quantity:N=L,entitlement:j,upgrade:J,modal:H,perpetual:ce,promotionCode:ue=y,wcsOsi:K,extraOptions:X,...xe}=Object.assign({},u?.dataset??{},l??{}),je=re(v,Y,g.checkoutWorkflow),We=$.CHECKOUT;je===Y.V3&&(We=re(O,$,g.checkoutWorkflowStep));let Ne=_e({...xe,extraOptions:X,checkoutClientId:p,checkoutMarketSegment:P,country:U,quantity:we(N,g.quantity),checkoutWorkflow:je,checkoutWorkflowStep:We,language:F,entitlement:b(j),upgrade:b(J),modal:b(H),perpetual:b(ce),promotionCode:Ie(ue).effectivePromoCode,wcsOsi:ht(K)});if(u)for(let St of e.checkout)St(u,Ne);return Ne}async function o(l,u){let p=k(),f=await r.getCheckoutAction?.(l,u,p.imsSignedInPromise);return f||null}function s(l,u){if(!Array.isArray(l)||!l.length||!u)return"";let{env:p,landscape:f}=t,{checkoutClientId:m,checkoutMarketSegment:h,checkoutWorkflow:x,checkoutWorkflowStep:y,country:L,promotionCode:P,quantity:v,...O}=i(u),_=window.frameElement?"if":"fp",U={checkoutPromoCode:P,clientId:m,context:_,country:L,env:p,items:[],marketSegment:h,workflowStep:y,landscape:f,...O};if(l.length===1){let[{offerId:F,offerType:N,productArrangementCode:j}]=l,{marketSegments:[J]}=l[0];Object.assign(U,{marketSegment:J,offerType:N,productArrangementCode:j}),U.items.push(v[0]===1?{id:F}:{id:F,quantity:v[0]})}else U.items.push(...l.map(({offerId:F},N)=>({id:F,quantity:v[N]??g.quantity})));return Dt(x,U)}let{createCheckoutLink:a,getCheckoutLinks:c}=Pt;return{CheckoutLink:Pt,CheckoutWorkflow:Y,CheckoutWorkflowStep:$,buildCheckoutAction:o,buildCheckoutURL:s,collectCheckoutOptions:i,createCheckoutLink:a,getCheckoutLinks:c}}function Ko({interval:e=200,maxAttempts:t=25}={}){let r=I.module("ims");return new Promise(n=>{r.debug("Waing for IMS to be ready");let i=0;function o(){window.adobeIMS?.initialized?n():++i>t?(r.debug("Timeout"),n()):setTimeout(o,e)}o()})}function es(e){return e.then(()=>window.adobeIMS.isSignedInUser())}function ts(e){let t=I.module("ims");return e.then(r=>r?window.adobeIMS.getProfile().then(({countryCode:n})=>(t.debug("Got user country:",n),n),n=>{t.error("Unable to get user country:",n)}):null)}function Qn({}){let e=Ko(),t=es(e),r=ts(t);return{imsReadyPromise:e,imsSignedInPromise:t,imsCountryPromise:r}}function rs(e){if(!e.priceLiteralsURL)throw new Error(br);return new Promise(t=>{window.fetch(e.priceLiteralsURL).then(r=>{r.json().then(({data:n})=>{t(n)})})})}async function Jn(e){let r=await(e.priceLiteralsPromise||rs(e));if(Array.isArray(r)){let n=o=>r.find(s=>$e(s.lang,o)),i=n(e.language)??n(g.language);if(i)return Object.freeze(i)}return{}}function Kn({literals:e,providers:t,settings:r}){function n(a,c){let{country:l,displayOldPrice:u,displayPerUnit:p,displayRecurrence:f,displayTax:m,forceTaxExclusive:h,language:x,promotionCode:y,quantity:L}=r,{displayOldPrice:P=u,displayPerUnit:v=p,displayRecurrence:O=f,displayTax:_=m,forceTaxExclusive:U=h,country:F=l,language:N=x,perpetual:j,promotionCode:J=y,quantity:H=L,template:ce,wcsOsi:ue,...K}=Object.assign({},c?.dataset??{},a??{}),X=_e({...K,country:F,displayOldPrice:b(P),displayPerUnit:b(v),displayRecurrence:b(O),displayTax:b(_),forceTaxExclusive:b(U),language:N,perpetual:b(j),promotionCode:Ie(J).effectivePromoCode,quantity:we(H,g.quantity),template:ce,wcsOsi:ht(ue)});if(c)for(let xe of t.price)xe(c,X);return X}function i(a,c){if(!Array.isArray(a)||!a.length||!c)return"";let{template:l}=c,u;switch(l){case"discount":u=fr;break;case"strikethrough":u=ur;break;case"optical":u=cr;break;case"annual":u=lr;break;default:u=c.promotionCode?ar:sr}let p=n(c);p.literals=Object.assign({},e.price,_e(c.literals??{}));let[f]=a;return f={...f,...f.priceDetails},u(p,f)}let{createInlinePrice:o,getInlinePrices:s}=_t;return{InlinePrice:_t,buildPriceHTML:i,collectPriceOptions:n,createInlinePrice:o,getInlinePrices:s}}var ns={[q.PRODUCTION]:"https://wcs.adobe.com",[q.STAGE]:"https://wcs.stage.adobe.com"};function ei({settings:e}){let t=I.module("wcs"),{env:r,wcsApiKey:n}=e,i={apiKey:n,baseUrl:ns[r],fetch:window.fetch.bind(window)},o=Ye(i),s=new Map,a=new Map,c;async function l(f,m,h=!0){let x=Tr;try{t.debug("Fetching:",f),f.offerSelectorIds=f.offerSelectorIds.sort();let{data:y}=await o(f,{apiKey:n,environment:e.wcsEnv,landscape:r===q.STAGE?"ALL":e.landscape},({resolvedOffers:P})=>({offers:P.map(st)}));t.debug("Fetched:",f,y);let{offers:L}=y??{};m.forEach(({resolve:P},v)=>{let O=L.filter(({offerSelectorIds:_})=>_.includes(v)).flat();O.length&&(m.delete(v),P(O))})}catch(y){y.status===404&&f.offerSelectorIds.length>1?(t.debug("Multi-osi 404, fallback to fetch-by-one strategy"),await Promise.allSettled(f.offerSelectorIds.map(L=>l({...f,offerSelectorIds:[L]},m,!1)))):(t.error("Failed:",f,y),x=vr)}h&&m.size&&(t.debug("Missing:",{offerSelectorIds:[...m.keys()]}),m.forEach(y=>{y.reject(new Error(x))}))}function u(){clearTimeout(c);let f=[...a.values()];a.clear(),f.forEach(({options:m,promises:h})=>l(m,h))}function p({country:f,language:m,perpetual:h=!1,promotionCode:x="",wcsOsi:y=[]}){let L=`${m}_${f}`;f!=="GB"&&(m=h?"EN":"MULT");let P=[f,m,x].filter(v=>v).join("-").toLowerCase();return y.map(v=>{let O=`${v}-${P}`;if(!s.has(O)){let _=new Promise((U,F)=>{let N=a.get(P);if(!N){let j={country:f,locale:L,offerSelectorIds:[]};f!=="GB"&&(j.language=m),N={options:j,promises:new Map},a.set(P,N)}x&&(N.options.promotionCode=x),N.options.offerSelectorIds.push(v),N.promises.set(v,{resolve:U,reject:F}),N.options.offerSelectorIds.length>=e.wcsBufferLimit?u():(t.debug("Queued:",N.options),c||(c=setTimeout(u,e.wcsBufferDelay)))});s.set(O,_)}return s.get(O)})}return{WcsCommitment:gr,WcsPlanType:xr,WcsTerm:yr,resolveOfferSelectors:p}}var D=class extends HTMLElement{get isWcmsCommerce(){return!0}};te(D,"instance"),te(D,"promise",null);window.customElements.define(ne,D);async function is(e,t){let r=I.init(e.env).module("service");r.debug("Activating:",e);let n={price:{}},i=Object.freeze(Lr(e));try{n.price=await Jn(i)}catch(c){r.warn("Price literals were not fetched:",c)}let o={checkout:new Set,price:new Set},s=document.createElement(ne),a={literals:n,providers:o,settings:i};return D.instance=Object.defineProperties(s,Object.getOwnPropertyDescriptors({...Zn(a,t),...Qn(a),...Kn(a),...ei(a),...Ar,Log:I,get defaults(){return g},get literals(){return n},get log(){return I},get providers(){return{checkout(c){return o.checkout.add(c),()=>o.checkout.delete(c)},price(c){return o.price.add(c),()=>o.price.delete(c)}}},get settings(){return i}})),r.debug("Activated:",{literals:n,settings:i,element:s}),document.head.append(s),ae(()=>{let c=new CustomEvent(Ee,{bubbles:!0,cancelable:!1,detail:D.instance});D.instance.dispatchEvent(c)}),D.instance}function ti(){document.head.querySelector(ne)?.remove(),D.promise=null,I.reset()}function os(e,t){if(se(e)){let r=se(t)?t():{};return r.force&&ti(),D.promise??(D.promise=is(e(),r))}return D.promise?D.promise:new Promise(r=>{let n=i=>{r(i.detail)};document.head.addEventListener(Ee,n,{once:!0})})}export{Pt as CheckoutLink,Y as CheckoutWorkflow,$ as CheckoutWorkflowStep,g as Defaults,_t as InlinePrice,M as Landscape,I as Log,ne as TAG_NAME_SERVICE,gr as WcsCommitment,Ae as WcsEnv,xr as WcsPlanType,yr as WcsTerm,st as applyPlanType,Hn as getLocaleSettings,Lr as getSettings,os as init,ti as reset}; +//# sourceMappingURL=commerce.js.map From a77e493e078030fbe46d831a76b144eb1e5869b6 Mon Sep 17 00:00:00 2001 From: Saloni Jain <6162294+salonijain3@users.noreply.github.com> Date: Tue, 9 Jul 2024 12:10:04 +0530 Subject: [PATCH 7/7] Revert "MWPW-141022 [Project PEP] Prompt Dismissal + Tie-in with App Launcher UX" (#2546) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert "MWPW-141022 [Project PEP] Prompt Dismissal + Tie-in with App Launcher…" This reverts commit 15f8c9fd52f954f33d1e0fa67cfb4d43c950d307. --- libs/features/webapp-prompt/webapp-prompt.css | 115 ------------------ libs/features/webapp-prompt/webapp-prompt.js | 95 ++------------- .../webapp-prompt/mocks/pep-prompt-content.js | 27 +--- test/features/webapp-prompt/test-utilities.js | 13 +- .../webapp-prompt/webapp-prompt.test.js | 110 +++++------------ 5 files changed, 42 insertions(+), 318 deletions(-) diff --git a/libs/features/webapp-prompt/webapp-prompt.css b/libs/features/webapp-prompt/webapp-prompt.css index cd421f6f8a..1fbc0baae8 100644 --- a/libs/features/webapp-prompt/webapp-prompt.css +++ b/libs/features/webapp-prompt/webapp-prompt.css @@ -188,118 +188,3 @@ } } } - -/* DISMISSAL TOOLTIP */ - -[data-pep-dismissal-tooltip]::after { - content: attr(data-pep-dismissal-tooltip); - display: inline-flex; - z-index: 3; - height: fit-content; - width: 8.875rem; - top: 125%; - left: -300%; - word-break: break-word; - border-radius: 7px; - - padding-inline: 0.5625rem; - padding-block: 0.25rem 0.3125rem; - - font-family: var(--body-font-family); - font-size: 0.75rem; - line-height: 0.9375rem; - color: white; -} - -[data-pep-dismissal-tooltip]::before { - content: ''; - z-index: 2; - width: 0.44rem; - height: 0.44rem; - border-radius: 0.05rem; - left: calc(50% - 0.22rem); - top: 115%; - - transform: rotate(45deg); -} - -[data-pep-dismissal-tooltip]::before, -[data-pep-dismissal-tooltip]::after { - background-color: #3B63FB; - position: absolute; - pointer-events: none; - transition: opacity 0.5s; -} - -@media (min-width: 1520px) { - [data-pep-dismissal-tooltip]::after { - left: calc(50% - 5rem); - } -} - -/* DISMISSAL ANIMATION */ - -.coach-indicator { - --coach-indicator-ring-default-color: rgba(56,146,243); - --coach-indicator-ring-diameter: 1.25rem; - --coach-indicator-ring-border-size: 2px; - --coach-indicator-ring-inline-size: var(--coach-indicator-ring-diameter); - --coach-indicator-ring-block-size: var(--coach-indicator-ring-diameter); - --coach-indicator-first-ring-delay-fraction: 0; - --coach-indicator-second-ring-delay-fraction: 0.33; - --coach-indicator-third-ring-delay-fraction: 0.66; - --animation-duration: 3000ms; -} - -@keyframes pulse { - 0% { - transform: scale(0.8); - opacity: 0; - } - - 50% { - transform: scale(1.5); - opacity: 1; - } - - 100% { - transform: scale(2); - opacity: 0; - } -} - -.coach-indicator .coach-indicator-ring { - display: block; - position: absolute; - top: 14%; - left: 13%; - - border-style: solid; - border-width: var(--coach-indicator-ring-border-size); - border-color: var(--coach-indicator-ring-default-color); - - inline-size: var(--coach-indicator-ring-inline-size); - block-size: var(--coach-indicator-ring-block-size); - animation: pulse var(--animation-duration) linear; - animation-fill-mode: both; - - border-radius: 5px; -} - -.coach-indicator .coach-indicator-ring:nth-child(1) { - animation-delay: calc(var(--animation-duration)*var(--coach-indicator-first-ring-delay-fraction)); -} - -.coach-indicator .coach-indicator-ring:nth-child(2) { - animation-delay: calc(var(--animation-duration)*var(--coach-indicator-second-ring-delay-fraction)); -} - -.coach-indicator .coach-indicator-ring:nth-child(3) { - animation-delay: calc(var(--animation-duration)*var(--coach-indicator-third-ring-delay-fraction)); -} - -@media (prefers-reduced-motion: reduce) { - .coach-indicator .coach-indicator-ring { - animation: none; - } -} diff --git a/libs/features/webapp-prompt/webapp-prompt.js b/libs/features/webapp-prompt/webapp-prompt.js index d41207135c..418d2ad68d 100644 --- a/libs/features/webapp-prompt/webapp-prompt.js +++ b/libs/features/webapp-prompt/webapp-prompt.js @@ -8,21 +8,13 @@ import { import { getConfig, decorateSVG } from '../../utils/utils.js'; import { replaceKey, replaceText } from '../placeholders.js'; -export const DISMISSAL_CONFIG = { - animationCount: 2, - animationDuration: 2500, - tooltipMessage: 'Use the App Switcher to quickly find apps.', - tooltipDuration: 5000, -}; - const CONFIG = { selectors: { prompt: '.appPrompt' }, delay: 7000, loaderColor: '#EB1000', - ...DISMISSAL_CONFIG, }; -const getElemText = (elem) => elem?.textContent?.trim(); +const getElemText = (elem) => elem?.textContent?.trim().toLowerCase(); const getMetadata = (el) => [...el.childNodes].reduce((acc, row) => { if (row.children?.length === 2) { @@ -43,54 +35,6 @@ const getIcon = (content) => { return icons.company; }; -const showTooltip = ( - element, - message = CONFIG.tooltipMessage, - time = CONFIG.tooltipDuration, -) => { - element.setAttribute('data-pep-dismissal-tooltip', message); - const cleanup = () => element.removeAttribute('data-pep-dismissal-tooltip'); - const timeoutID = setTimeout(cleanup, time); - element.addEventListener('click', () => { - cleanup(); - clearTimeout(timeoutID); - }, { once: true }); -}; - -const playFocusAnimation = ( - element, - iterationCount = CONFIG.animationCount, - animationDuration = CONFIG.animationDuration, -) => { - element.classList.add('coach-indicator'); - element.style.setProperty('--animation-duration', `${animationDuration}ms`); - const rings = []; - const createRing = () => toFragment` -
-
`; - for (let i = 0; i < 3; i += 1) { - const ring = createRing(); - element.insertAdjacentElement('afterbegin', ring); - rings.push(ring); - } - // The cleanup function is added to the event queue - // some time after the end of the animation because - // the cleanup isn't high priority but it should be done - // eventually. (Animation truly ends slightly after - // animationDuration * iterationCount due to animation-delay) - const cleanup = () => { - rings.forEach((ring) => ring.remove()); - element.classList.remove('coach-indicator'); - }; - const timeoutID = setTimeout(cleanup, (iterationCount + 1) * animationDuration); - element.addEventListener('click', () => { - cleanup(); - clearTimeout(timeoutID); - }, { once: true }); -}; - const modalsActive = () => !!document.querySelector('.dialog-modal'); const waitForClosedModalsThen = (loadPEP) => { @@ -115,10 +59,7 @@ class AppPrompt { () => waitForClosedModalsThen(this.init), { once: true }, ); - this.initializationQueued = true; - return; - } - this.initializationQueued = false; + } else this.init(); } init = async () => { @@ -221,10 +162,6 @@ class AppPrompt { const metadata = getMetadata(content.querySelector('.section-metadata')); metadata['loader-duration'] = parseInt(metadata['loader-duration'] || CONFIG.delay, 10); metadata['loader-color'] = metadata['loader-color'] || CONFIG.loaderColor; - metadata['dismissal-animation-count'] = parseInt(metadata['dismissal-animation-count'] ?? CONFIG.animationCount, 10); - metadata['dismissal-animation-duration'] = parseInt(metadata['dismissal-animation-duration'] ?? CONFIG.animationDuration, 10); - metadata['dismissal-tooltip-message'] ??= CONFIG.tooltipMessage; - metadata['dismissal-tooltip-duration'] = parseInt(metadata['dismissal-tooltip-duration'] ?? CONFIG.tooltipDuration, 10); this.options = metadata; }; @@ -244,7 +181,7 @@ class AppPrompt { : ''; return toFragment`
${this.elements.closeIcon}
@@ -263,7 +200,7 @@ class AppPrompt { }; addEventListeners = () => { - this.anchor?.addEventListener('click', () => this.close({ dismissalActions: false })); + this.anchor?.addEventListener('click', this.close); document.addEventListener('keydown', this.handleKeyDown); [this.elements.closeIcon, this.elements.cta] @@ -274,11 +211,9 @@ class AppPrompt { if (event.key === 'Escape') this.close(); }; - static redirectTo = (url) => window.location.assign(url); - initRedirect = () => setTimeout(() => { - this.close({ saveDismissal: false, dismissalActions: false }); - this.redirectTo(this.options['redirect-url']); + this.close({ saveDismissal: false }); + window.location.assign(this.options['redirect-url']); }, this.options['loader-duration']); isDismissedPrompt = () => AppPrompt.getDismissedPrompts().includes(this.id); @@ -289,7 +224,7 @@ class AppPrompt { document.cookie = `dismissedAppPrompts=${JSON.stringify([...dismissedPrompts])};path=/`; }; - close = ({ saveDismissal = true, dismissalActions = true } = {}) => { + close = ({ saveDismissal = true } = {}) => { const appPromptElem = document.querySelector(CONFIG.selectors.prompt); appPromptElem?.remove(); clearTimeout(this.redirectFn); @@ -297,19 +232,6 @@ class AppPrompt { document.removeEventListener('keydown', this.handleKeyDown); this.anchor?.focus(); this.anchor?.removeEventListener('click', this.close); - - if (dismissalActions) { - playFocusAnimation( - this.anchor, - this.options['dismissal-animation-count'], - this.options['dismissal-animation-duration'], - ); - showTooltip( - this.anchor, - this.options['dismissal-tooltip-message'], - this.options['dismissal-tooltip-duration'], - ); - } }; static getDismissedPrompts = () => { @@ -324,8 +246,7 @@ class AppPrompt { export default async function init(config) { try { - const appPrompt = new AppPrompt(config); - if (!appPrompt.initializationQueued) await appPrompt.init(); + const appPrompt = await new AppPrompt(config); return appPrompt; } catch (e) { lanaLog({ message: 'Could not initialize PEP', e, tags: 'errorType=error,module=pep' }); diff --git a/test/features/webapp-prompt/mocks/pep-prompt-content.js b/test/features/webapp-prompt/mocks/pep-prompt-content.js index 165185e344..9f32193ae4 100644 --- a/test/features/webapp-prompt/mocks/pep-prompt-content.js +++ b/test/features/webapp-prompt/mocks/pep-prompt-content.js @@ -1,13 +1,4 @@ -export default ({ - color, - loaderDuration, - redirectUrl, - productName, - animationCount, - animationDuration, - tooltipMessage, - tooltipDuration, -}) => `
+export default ({ color, loaderDuration, redirectUrl, productName }) => `

@@ -36,21 +27,5 @@ export default ({

product-name
${productName}
`} - ${animationCount && `
-
dismissal-animation-count
-
${animationCount}
-
`} - ${animationDuration && `
-
dismissal-animation-duration
-
${animationDuration}
-
`} - ${tooltipMessage && `
-
dismissal-tooltip-message
-
${tooltipMessage}
-
`} - ${tooltipDuration && `
-
dismissal-tooltip-duration
-
${tooltipDuration}
-
`}
`; diff --git a/test/features/webapp-prompt/test-utilities.js b/test/features/webapp-prompt/test-utilities.js index 7905390380..d74376db6c 100644 --- a/test/features/webapp-prompt/test-utilities.js +++ b/test/features/webapp-prompt/test-utilities.js @@ -1,8 +1,7 @@ import { setViewport } from '@web/test-runner-commands'; import sinon from 'sinon'; -import init, { DISMISSAL_CONFIG } from '../../../libs/features/webapp-prompt/webapp-prompt.js'; +import init from '../../../libs/features/webapp-prompt/webapp-prompt.js'; import { viewports, mockRes as importedMockRes } from '../../blocks/global-navigation/test-utilities.js'; -import { setUserProfile } from '../../../libs/blocks/global-navigation/utilities/utilities.js'; import { getConfig, loadStyle, setConfig, updateConfig } from '../../../libs/utils/utils.js'; export const allSelectors = { @@ -18,8 +17,6 @@ export const allSelectors = { progressWrapper: '.appPrompt-progressWrapper', progress: '.appPrompt-progress', appSwitcher: '#unav-app-switcher', - indicatorRing: '.coach-indicator-ring', - tooltip: '[data-pep-dismissal-tooltip]', }; export const defaultConfig = { @@ -27,7 +24,6 @@ export const defaultConfig = { loaderDuration: 7500, redirectUrl: 'https://www.adobe.com/?pep=true', productName: 'photoshop', - ...DISMISSAL_CONFIG, }; export const mockRes = importedMockRes; @@ -42,7 +38,6 @@ export const initPep = async ({ entName = 'firefly-web-usage', isAnchorOpen = fa await setViewport(viewports.desktop); await loadStyle('../../../libs/features/webapp-prompt/webapp-prompt.css'); - setUserProfile({}); const pep = await init({ promptPath: 'https://pep-mocks.test/pep-prompt-content.plain.html', getAnchorState: getAnchorStateMock || (async () => ({ id: 'unav-app-switcher', isOpen: isAnchorOpen })), @@ -50,10 +45,6 @@ export const initPep = async ({ entName = 'firefly-web-usage', isAnchorOpen = fa parent: document.querySelector('div.feds-utilities'), }); - Object.setPrototypeOf(pep, { - ...Object.getPrototypeOf(pep), - redirectTo: sinon.stub().returns({}), - }); - + sinon.stub(pep, 'initRedirect').callsFake(() => null); return pep; }; diff --git a/test/features/webapp-prompt/webapp-prompt.test.js b/test/features/webapp-prompt/webapp-prompt.test.js index 38a89acfbc..c3e6bf6c6c 100644 --- a/test/features/webapp-prompt/webapp-prompt.test.js +++ b/test/features/webapp-prompt/webapp-prompt.test.js @@ -3,12 +3,17 @@ import sinon, { stub } from 'sinon'; import pepPromptContent from './mocks/pep-prompt-content.js'; describe('PEP', () => { + let clock; let allSelectors; let defaultConfig; let mockRes; let initPep; beforeEach(async () => { + clock = sinon.useFakeTimers({ + toFake: ['setTimeout'], + shouldAdvanceTime: true, + }); // We need to import the utilities after mocking setTimeout to ensure // their setTimeout calls use Sinon's mocked implementation. // Importing before mocking would lead to a 5s PEP timeout, exceeding the 2s test limit. @@ -28,6 +33,7 @@ describe('PEP', () => { afterEach(() => { sinon.restore(); + clock.restore(); document.body.innerHTML = ''; document.cookie = `${document.cookie};expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`; }); @@ -35,17 +41,20 @@ describe('PEP', () => { describe('PEP rendering tests', () => { it('should render PEP', async () => { await initPep({}); + await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.exist; }); it('should not render PEP when previously dismissed', async () => { document.cookie = 'dismissedAppPrompts=["pep-prompt-content.plain.html"]'; await initPep({}); + await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should not render PEP when the entitlement does not match', async () => { await initPep({ entName: 'not-matching-entitlement' }); + await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); @@ -62,6 +71,7 @@ describe('PEP', () => { return null; }); await initPep({}); + await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); @@ -72,22 +82,27 @@ describe('PEP', () => { return null; }); await initPep({}); + await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should not render PEP when the anchor element is open', async () => { await initPep({ isAnchorOpen: true }); + await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should not render PEP when the GRM is open', async () => { - const clock = sinon.useFakeTimers(); document.body.insertAdjacentHTML('afterbegin', '
'); document.body.insertAdjacentHTML('afterbegin', '
'); await initPep({}); - expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; + try { + clock.runAll(); + } catch (e) { + expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; + } const event = new CustomEvent('milo:modal:closed'); window.dispatchEvent(event); @@ -95,135 +110,70 @@ describe('PEP', () => { document.querySelector('.locale-modal-v2')?.remove(); document.querySelector('.dialog-modal')?.remove(); - await clock.tickAsync(300); - + await clock.runAllAsync(); expect(document.querySelector(allSelectors.pepWrapper)).to.exist; - clock.uninstall(); }); }); describe('PEP configuration tests', () => { - it('should use config values when metadata loader color, duration, or dismissal options are not provided', async () => { + it('should use config values when metadata loader color or duration are not provided', async () => { sinon.restore(); stub(window, 'fetch').callsFake(async (url) => { - if (url.includes('pep-prompt-content.plain.html')) { - return mockRes({ - payload: pepPromptContent({ - ...defaultConfig, - color: false, - loaderDuration: false, - animationCount: false, - animationDuration: false, - tooltipMessage: false, - tooltipDuration: false, - }), - }); - } + if (url.includes('pep-prompt-content.plain.html')) return mockRes({ payload: pepPromptContent({ ...defaultConfig, color: false, loaderDuration: false }) }); return null; }); const pep = await initPep({}); - const { - 'loader-color': pepColor, - 'loader-duration': pepDuration, - 'dismissal-animation-count': animCount, - 'dismissal-animation-duration': animDuration, - 'dismissal-tooltip-message': tooltipMessage, - 'dismissal-tooltip-duration': tooltipDuration, - } = pep.options; - const configPresent = [ - pepColor, - pepDuration, - animCount, - animDuration, - tooltipMessage, - tooltipDuration, - ].reduce((acc, x) => acc && !!x, true); - expect(configPresent).to.equal(true); + await clock.runAllAsync(); + const { 'loader-color': pepColor, 'loader-duration': pepDuration } = pep.options; + expect(!!pepColor && !!pepDuration).to.equal(true); }); }); describe('PEP interaction tests', () => { it('should close PEP on Escape key', async () => { await initPep({}); + await clock.runAllAsync(); document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should close PEP on clicking the close icon', async () => { await initPep({}); + await clock.runAllAsync(); document.querySelector(allSelectors.closeIcon).click(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should close PEP on clicking the CTA', async () => { await initPep({}); + await clock.runAllAsync(); document.querySelector(allSelectors.cta).click(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); it('should close PEP on clicking the anchor element', async () => { await initPep({}); + await clock.runAllAsync(); document.querySelector(allSelectors.appSwitcher).click(); expect(document.querySelector(allSelectors.pepWrapper)).to.not.exist; }); - - it('redirects when the PEP timer runs out', async () => { - const clock = sinon.useFakeTimers(); - const pep = await initPep({}); - - clock.tick(10000); - // redirectTo is mocked in test-utilities inside the initPep procedure - expect(pep.redirectTo.calledOnce).to.equal(true); - clock.uninstall(); - }); }); describe('PEP focus tests', () => { it('should focus on the close icon on initial render', async () => { await initPep({}); + await clock.runAllAsync(); expect(document.activeElement).to.equal(document.querySelector(allSelectors.closeIcon)); }); it('should focus on the anchor element after closing', async () => { await initPep({}); + await clock.runAllAsync(); document.querySelector(allSelectors.closeIcon).click(); expect(document.activeElement).to.equal(document.querySelector(allSelectors.appSwitcher)); }); }); - describe('PEP dismissal tests', () => { - it('adds three rings to the app switcher and removes them after the required amount of time', async () => { - const clock = sinon.useFakeTimers(); - await initPep({}); - - document.querySelector(allSelectors.closeIcon).click(); - expect([...document.querySelectorAll(allSelectors.indicatorRing)].length).to.equal(3); - clock.tick(7500); - expect([...document.querySelectorAll(allSelectors.indicatorRing)].length).to.equal(0); - clock.uninstall(); - }); - - it('adds a data attribute to the app switcher with the correct data and removes it after the allotted time', async () => { - const clock = sinon.useFakeTimers(); - await initPep({}); - - document.querySelector(allSelectors.closeIcon).click(); - expect(document.querySelector(allSelectors.tooltip)).to.exist; - - clock.tick(5000); - expect(document.querySelector(allSelectors.tooltip)).to.not.exist; - clock.uninstall(); - }); - - it('removes the dismissal animation and the tooltip upon clicking the anchor element', async () => { - await initPep({}); - document.querySelector(allSelectors.closeIcon).click(); - expect(document.querySelector(allSelectors.tooltip)).to.exist; - document.querySelector(allSelectors.appSwitcher).click(); - expect(document.querySelector(allSelectors.tooltip)).to.not.exist; - }); - }); - describe('PEP logging tests', () => { beforeEach(() => { window.lana.log = sinon.spy(); @@ -235,6 +185,7 @@ describe('PEP', () => { reject(new Error('Cannot get anchor state')); }), }); + await clock.runAllAsync(); expect(window.lana.log.getCalls().find((c) => c.args[0].includes('Error on getting anchor state'))).to.exist; expect(window.lana.log.getCalls().find((c) => c.args[1].tags.includes('errorType=error,module=pep'))).to.exist; }); @@ -252,6 +203,7 @@ describe('PEP', () => { return null; }); await initPep({}); + await clock.runAllAsync(); expect(window.lana.log.getCalls().find((c) => c.args[0].includes('Error fetching content for prompt'))).to.exist; expect(window.lana.log.getCalls().find((c) => c.args[1].tags.includes('errorType=error,module=pep'))).to.exist; });