{"version":3,"file":"client.login-button_a59710e9.id.esm.js","sources":["../../src/common/shop-swirl.ts","../../src/common/shop-sheet-modal/shop-sheet-modal-builder.ts","../../src/components/loginButton/components/modal-content.ts","../../src/components/loginButton/components/follow-on-shop-button.ts","../../src/components/loginButton/components/store-logo.ts","../../src/components/loginButton/shop-follow-button.ts","../../src/components/loginButton/init.ts"],"sourcesContent":["import {pickLogoColor} from './colors';\nimport {defineCustomElement} from './init';\n\nexport class ShopSwirl extends HTMLElement {\n constructor() {\n super();\n\n const template = document.createElement('template');\n const size = this.getAttribute('size');\n // If not specified, will assume a white background and render the purple logo.\n const backgroundColor = this.getAttribute('background-color') || '#FFF';\n\n template.innerHTML = getTemplateContents(\n size ? Number.parseInt(size, 10) : undefined,\n backgroundColor,\n );\n\n this.attachShadow({mode: 'open'}).appendChild(\n template.content.cloneNode(true),\n );\n }\n}\n\n/**\n * @param {number} size size of the logo.\n * @param {string} backgroundColor hex or rgb string for background color.\n * @returns {string} HTML content for the logo.\n */\nfunction getTemplateContents(size = 36, backgroundColor: string) {\n const [red, green, blue] = pickLogoColor(backgroundColor);\n const color = `rgb(${red}, ${green}, ${blue})`;\n const sizeRatio = 23 / 20;\n const height = size;\n const width = Math.round(height / sizeRatio);\n\n return `\n \n \n \n \n `;\n}\n\n/**\n * Define the shop-swirl custom element.\n */\nexport function defineElement() {\n defineCustomElement('shop-swirl', ShopSwirl);\n}\n","import {ShopSheetModal, createShopSheetModal} from './shop-sheet-modal';\n\nexport interface SheetModalManager {\n sheetModal: ShopSheetModal;\n destroy(): void;\n}\n\n/**\n * This builder is used to create a sheet modal on the page in a consistent way.\n * - withInnerHTML: allows a hook to add additional content to a wrapper div's shadow root, useful for CSS.\n * - build: creates the sheet modal, appends it to the shadow root, and appends the wrapper div to the body.\n *\n * The build method will return a SheetModalManager which can be used to reference the underlying sheetModal element\n * and a cleanup method called `destroy` that will remove the modal from the DOM.\n * @returns {object} - The sheet modal builder\n */\nexport function sheetModalBuilder() {\n const wrapper = document.createElement('div');\n const shadow = wrapper.attachShadow({mode: 'open'});\n\n // reset generic styles on `div` element\n wrapper.style.setProperty('all', 'initial');\n\n return {\n withInnerHTML(innerHTML: string) {\n shadow.innerHTML = innerHTML;\n\n return this;\n },\n build(): SheetModalManager {\n const sheetModal = createShopSheetModal();\n shadow.appendChild(sheetModal);\n document.body.appendChild(wrapper);\n\n return {\n get sheetModal() {\n return sheetModal;\n },\n destroy() {\n wrapper.remove();\n },\n };\n },\n };\n}\n","import {colors} from '../../../common/colors';\nimport {\n createStatusIndicator,\n ShopStatusIndicator,\n StatusIndicatorLoader,\n} from '../../../common/shop-status-indicator';\nimport {\n AuthorizeState,\n LoginButtonProcessingStatus as ProcessingStatus,\n} from '../../../types';\n\nexport const ELEMENT_CLASS_NAME = 'shop-modal-content';\n\ninterface Content {\n title?: string;\n description?: string;\n disclaimer?: string;\n authorizeState?: AuthorizeState;\n email?: string;\n status?: ProcessingStatus;\n}\n\nexport class ModalContent extends HTMLElement {\n #rootElement: ShadowRoot;\n\n // Header Elements\n #headerWrapper!: HTMLDivElement;\n #headerTitle!: HTMLHeadingElement;\n #headerDescription!: HTMLDivElement;\n\n // Main Content Elements\n #contentWrapper!: HTMLDivElement;\n #contentProcessingWrapper!: HTMLDivElement;\n #contentProcessingUser!: HTMLDivElement;\n #contentStatusIndicator?: ShopStatusIndicator;\n #contentChildrenWrapper!: HTMLDivElement;\n\n // Disclaimer Elements\n #disclaimerText!: HTMLDivElement;\n\n // Storage for content\n #contentStore: Content = {};\n\n constructor() {\n super();\n\n const template = document.createElement('template');\n template.innerHTML = getContent();\n this.#rootElement = this.attachShadow({mode: 'open'});\n this.#rootElement.appendChild(template.content.cloneNode(true));\n\n this.#headerWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}`,\n )!;\n this.#headerTitle = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-title`,\n )!;\n this.#headerDescription = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-description`,\n )!;\n this.#contentWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-content`,\n )!;\n this.#contentProcessingWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-processing`,\n )!;\n this.#contentProcessingUser = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-processing-user`,\n )!;\n this.#contentChildrenWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-children`,\n )!;\n this.#disclaimerText = this.#rootElement.querySelector(\n `.${ELEMENT_CLASS_NAME}-disclaimer`,\n )!;\n }\n\n hideDivider() {\n this.#headerWrapper.classList.add('hide-divider');\n }\n\n showDivider() {\n this.#headerWrapper.classList.remove('hide-divider');\n }\n\n update(content: Content) {\n this.#contentStore = {\n ...this.#contentStore,\n ...content,\n };\n\n this.#updateHeader();\n this.#updateMainContent();\n this.#updateDisclaimer();\n }\n\n #updateHeader() {\n const {title, description, authorizeState} = this.#contentStore;\n const visible = title || description;\n\n this.#headerWrapper.classList.toggle('hidden', !visible);\n this.#headerTitle.classList.toggle('hidden', !title);\n this.#headerDescription.classList.toggle('hidden', !description);\n\n this.#headerTitle.textContent = title || '';\n this.#headerDescription.textContent = description || '';\n\n if (authorizeState) {\n this.#headerWrapper.classList.toggle(\n 'hide-divider',\n authorizeState === AuthorizeState.Start,\n );\n\n this.#headerWrapper.classList.toggle(\n `${ELEMENT_CLASS_NAME}--small`,\n authorizeState === AuthorizeState.Start,\n );\n }\n }\n\n #updateMainContent() {\n const {authorizeState, status, email} = this.#contentStore;\n const contentWrapperVisible = Boolean(authorizeState || status);\n const processingWrapperVisible = Boolean(status && email);\n const childrenWrapperVisible = Boolean(\n contentWrapperVisible && !processingWrapperVisible,\n );\n\n this.#contentWrapper.classList.toggle('hidden', !contentWrapperVisible);\n this.#contentProcessingWrapper.classList.toggle(\n 'hidden',\n !processingWrapperVisible,\n );\n this.#contentChildrenWrapper.classList.toggle(\n 'hidden',\n !childrenWrapperVisible,\n );\n\n if (!this.#contentStatusIndicator && processingWrapperVisible) {\n const loaderType =\n authorizeState === AuthorizeState.OneClick\n ? StatusIndicatorLoader.Branded\n : StatusIndicatorLoader.Regular;\n this.#contentStatusIndicator = createStatusIndicator(loaderType);\n this.#contentProcessingWrapper.appendChild(this.#contentStatusIndicator);\n this.#contentStatusIndicator?.setStatus({\n status: 'loading',\n message: '',\n });\n }\n\n this.#contentProcessingUser.textContent = email || '';\n }\n\n #updateDisclaimer() {\n const {disclaimer} = this.#contentStore;\n const visible = Boolean(disclaimer);\n\n this.#disclaimerText.classList.toggle('hidden', !visible);\n this.#disclaimerText.innerHTML = disclaimer || '';\n }\n}\n\n/**\n * @returns {string} element styles and content\n */\nfunction getContent() {\n return `\n \n
\n

\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n `;\n}\n\nif (!customElements.get('shop-modal-content')) {\n customElements.define('shop-modal-content', ModalContent);\n}\n\n/**\n * helper function which creates a new modal content element\n * @param {object} content modal content\n * @param {boolean} hideDivider whether the bottom divider should be hidden\n * @returns {ModalContent} a new ModalContent element\n */\nexport function createModalContent(\n content: Content,\n hideDivider = false,\n): ModalContent {\n const modalContent = document.createElement(\n 'shop-modal-content',\n ) as ModalContent;\n if (hideDivider) {\n modalContent.hideDivider();\n }\n modalContent.update(content);\n\n return modalContent;\n}\n","import {I18n} from '../../../common/translator/i18n';\nimport {\n ShopLogo,\n createShopHeartIcon,\n ShopHeartIcon,\n} from '../../../common/svg';\nimport Bugsnag from '../../../common/bugsnag';\nimport {calculateContrast, inferBackgroundColor} from '../../../common/colors';\n\nconst ATTRIBUTE_FOLLOWING = 'following';\n\nexport class FollowOnShopButton extends HTMLElement {\n private _rootElement: ShadowRoot | null = null;\n private _button: HTMLButtonElement | null = null;\n private _wrapper: HTMLSpanElement | null = null;\n private _heartIcon: ShopHeartIcon | null = null;\n private _followSpan: HTMLSpanElement | null = null;\n private _followingSpan: HTMLSpanElement | null = null;\n private _i18n: I18n | null = null;\n private _followTextWidth = 0;\n private _followingTextWidth = 0;\n\n constructor() {\n super();\n\n if (!customElements.get('shop-logo')) {\n customElements.define('shop-logo', ShopLogo);\n }\n }\n\n async connectedCallback(): Promise {\n await this._initTranslations();\n this._initElements();\n }\n\n setFollowing({\n following = true,\n skipAnimation = false,\n }: {\n following?: boolean;\n skipAnimation?: boolean;\n }) {\n this._button?.classList.toggle(`button--animating`, !skipAnimation);\n this._button?.classList.toggle(`button--following`, following);\n\n if (this._followSpan !== null && this._followingSpan !== null) {\n this._followSpan.ariaHidden = following ? 'true' : 'false';\n this._followingSpan.ariaHidden = following ? 'false' : 'true';\n }\n\n this.style.setProperty(\n '--button-width',\n `${following ? this._followingTextWidth : this._followTextWidth}px`,\n );\n\n if (\n window.matchMedia(`(prefers-reduced-motion: reduce)`).matches ||\n skipAnimation\n ) {\n this._heartIcon?.setFilled(following);\n } else {\n this._button\n ?.querySelector('.follow-text')\n ?.addEventListener('transitionend', () => {\n this._heartIcon?.setFilled(following);\n });\n }\n }\n\n setFocused() {\n this._button?.focus();\n }\n\n private async _initTranslations() {\n try {\n // BUILD_LOCALE is used for generating localized bundles.\n // See ./scripts/i18n-dynamic-import-replacer-rollup.mjs for more info.\n // eslint-disable-next-line no-process-env\n const locale = process.env.BUILD_LOCALE || I18n.getDefaultLanguage();\n const dictionary = await import(`../translations/${locale}.json`);\n this._i18n = new I18n({[locale]: dictionary});\n } catch (error) {\n if (error instanceof Error) {\n Bugsnag.notify(error);\n }\n }\n return null;\n }\n\n private _initElements() {\n const template = document.createElement('template');\n template.innerHTML = getTemplateContents();\n\n this._rootElement = this.attachShadow({mode: 'open'});\n this._rootElement.appendChild(template.content.cloneNode(true));\n\n if (this._i18n) {\n const followText = this._i18n.translate('follow_on_shop.follow', {\n shop: getShopLogoHtml('white'),\n });\n const followingText = this._i18n.translate('follow_on_shop.following', {\n shop: getShopLogoHtml('black'),\n });\n this._rootElement.querySelector('slot[name=\"follow-text\"]')!.innerHTML =\n followText;\n this._rootElement.querySelector(\n 'slot[name=\"following-text\"]',\n )!.innerHTML = followingText;\n }\n\n this._button = this._rootElement.querySelector(`.button`)!;\n this._wrapper = this._button.querySelector(`.follow-icon-wrapper`)!;\n this._followSpan = this._rootElement?.querySelector('span.follow-text');\n this._followingSpan = this._rootElement?.querySelector(\n 'span.following-text',\n );\n\n this._heartIcon = createShopHeartIcon();\n this._wrapper.prepend(this._heartIcon);\n\n this._followTextWidth =\n this._rootElement.querySelector('.follow-text')?.scrollWidth || 0;\n this._followingTextWidth =\n this._rootElement.querySelector('.following-text')?.scrollWidth || 0;\n this.style.setProperty(\n '--reserved-width',\n `${Math.max(this._followTextWidth, this._followingTextWidth)}px`,\n );\n\n this.setFollowing({\n following: this.hasAttribute(ATTRIBUTE_FOLLOWING),\n skipAnimation: true,\n });\n\n this._setButtonStyle();\n }\n\n /**\n * Adds extra classes to the parent button component depending on the following calculations\n * 1. If the currently detected background color has a higher contrast ratio with white than black, the \"button--dark\" class will be added\n * 2. If the currently detected background color has a contrast ratio <= 3.06 ,the \"button--bordered\" class will be added\n *\n * When the \"button--dark\" class is added, the \"following\" text and shop logo should be changed to white.\n * When the \"button--bordered\" class is added, the button should have a border.\n */\n private _setButtonStyle() {\n const background = inferBackgroundColor(this);\n const isDark =\n calculateContrast(background, '#ffffff') >\n calculateContrast(background, '#000000');\n const isBordered = calculateContrast(background, '#5433EB') <= 3.06;\n\n this._button?.classList.toggle('button--dark', isDark);\n this._button?.classList.toggle('button--bordered', isBordered);\n\n if (isDark && this._i18n) {\n const followingText = this._i18n.translate('follow_on_shop.following', {\n shop: getShopLogoHtml('white'),\n });\n this._rootElement!.querySelector(\n 'slot[name=\"following-text\"]',\n )!.innerHTML = followingText;\n }\n }\n}\n\nif (!customElements.get('follow-on-shop-button')) {\n customElements.define('follow-on-shop-button', FollowOnShopButton);\n}\n\n/**\n * Get the template contents for the follow on shop trigger button.\n * @returns {string} string The template for the follow on shop trigger button\n */\nfunction getTemplateContents() {\n return `\n \n \n `;\n}\n\n/**\n * helper function to create a follow on shop trigger button\n * @param {string} color The color of the Shop logo.\n * @returns {string} The HTML for the Shop logo in the Follow on Shop button.\n */\nexport function getShopLogoHtml(color: string): string {\n return ``;\n}\n\n/**\n * helper function for building a Follow on Shop Button\n * @param {boolean} following Whether the user is following the shop.\n * @returns {FollowOnShopButton} - a Follow on Shop Button\n */\nexport function createFollowButton(following: boolean): FollowOnShopButton {\n const element = document.createElement('follow-on-shop-button');\n\n if (following) {\n element.setAttribute(ATTRIBUTE_FOLLOWING, '');\n }\n\n return element as FollowOnShopButton;\n}\n","import {createShopHeartIcon, ShopHeartIcon} from '../../../common/svg';\nimport {colors} from '../../../common/colors';\n\nexport const ELEMENT_NAME = 'store-logo';\n\nexport class StoreLogo extends HTMLElement {\n #rootElement: ShadowRoot;\n #wrapper: HTMLDivElement;\n #logoWrapper: HTMLDivElement;\n #logoImg: HTMLImageElement;\n #logoText: HTMLSpanElement;\n #heartIcon: ShopHeartIcon;\n\n #storeName = '';\n #logoSrc = '';\n\n constructor() {\n super();\n\n const template = document.createElement('template');\n template.innerHTML = getContent();\n this.#rootElement = this.attachShadow({mode: 'open'});\n this.#rootElement.appendChild(template.content.cloneNode(true));\n\n this.#wrapper = this.#rootElement.querySelector(`.${ELEMENT_NAME}`)!;\n this.#logoWrapper = this.#rootElement.querySelector(\n `.${ELEMENT_NAME}-logo-wrapper`,\n )!;\n this.#logoImg = this.#logoWrapper.querySelector('img')!;\n this.#logoText = this.#logoWrapper.querySelector('span')!;\n\n this.#heartIcon = createShopHeartIcon();\n this.#rootElement\n .querySelector(`.${ELEMENT_NAME}-icon-wrapper`)!\n .append(this.#heartIcon);\n }\n\n update({name, logoSrc}: {name?: string; logoSrc?: string}) {\n this.#storeName = name || this.#storeName;\n this.#logoSrc = logoSrc || this.#logoSrc;\n\n this.#updateDom();\n }\n\n connectedCallback() {\n this.#logoImg.addEventListener('error', () => {\n this.#logoSrc = '';\n this.#updateDom();\n });\n }\n\n setFavorited() {\n this.#wrapper.classList.add(`${ELEMENT_NAME}--favorited`);\n\n if (window.matchMedia(`(prefers-reduced-motion: reduce)`).matches) {\n this.#heartIcon.setFilled();\n return Promise.resolve();\n } else {\n return new Promise((resolve) => {\n this.#heartIcon.addEventListener('animationstart', () => {\n this.#heartIcon.setFilled();\n });\n\n this.#heartIcon.addEventListener('animationend', () => {\n setTimeout(resolve, 1000);\n });\n });\n }\n }\n\n #updateDom() {\n const name = this.#storeName;\n const currentLogoSrc = this.#logoImg.src;\n\n this.#logoText.textContent = name.charAt(0);\n this.#logoText.ariaLabel = name;\n\n if (this.#logoSrc && this.#logoSrc !== currentLogoSrc) {\n this.#logoImg.src = this.#logoSrc;\n this.#logoImg.alt = name;\n this.#logoWrapper.classList.remove(`${ELEMENT_NAME}-logo-wrapper--text`);\n this.#logoWrapper.classList.add(`${ELEMENT_NAME}-logo-wrapper--image`);\n } else if (!this.#logoSrc) {\n this.#logoWrapper.classList.remove(`${ELEMENT_NAME}-logo-wrapper--image`);\n this.#logoWrapper.classList.add(`${ELEMENT_NAME}-logo-wrapper--text`);\n }\n }\n}\n\n/**\n * @returns {string} the HTML content for the StoreLogo\n */\nfunction getContent() {\n return `\n \n
\n
\n \"\"\n \n
\n
\n
\n `;\n}\n\nif (!customElements.get(ELEMENT_NAME)) {\n customElements.define(ELEMENT_NAME, StoreLogo);\n}\n\n/**\n * helper function to create a new store logo component\n * @returns {StoreLogo} a new StoreLogo element\n */\nexport function createStoreLogo() {\n const storeLogo = document.createElement(ELEMENT_NAME) as StoreLogo;\n\n return storeLogo;\n}\n","import {constraintWidthInViewport} from 'common/utils/constraintWidthInViewport';\n\nimport {PayMessageSender} from '../../common/MessageSender';\nimport {defineCustomElement} from '../../common/init';\nimport {StoreMetadata} from '../../common/utils/types';\nimport Bugsnag from '../../common/bugsnag';\nimport {IFrameEventSource} from '../../common/MessageEventSource';\nimport MessageListener from '../../common/MessageListener';\nimport {ShopSheetModal} from '../../common/shop-sheet-modal/shop-sheet-modal';\nimport {\n PAY_AUTH_DOMAIN,\n PAY_AUTH_DOMAIN_ALT,\n SHOP_WEBSITE_DOMAIN,\n validateStorefrontOrigin,\n} from '../../common/utils/urls';\nimport {I18n} from '../../common/translator/i18n';\nimport {\n exchangeLoginCookie,\n getAnalyticsTraceId,\n getCookie,\n getStoreMeta,\n isMobileBrowser,\n updateAttribute,\n ShopHubTopic,\n removeOnePasswordPrompt,\n} from '../../common/utils';\nimport ConnectedWebComponent from '../../common/ConnectedWebComponent';\nimport {\n sheetModalBuilder,\n SheetModalManager,\n} from '../../common/shop-sheet-modal/shop-sheet-modal-builder';\nimport {\n AuthorizeState,\n LoginButtonCompletedEvent as CompletedEvent,\n LoginButtonMessageEventData as MessageEventData,\n OAuthParams,\n OAuthParamsV1,\n ShopActionType,\n LoginButtonVersion as Version,\n} from '../../types';\nimport {\n ATTRIBUTE_CLIENT_ID,\n ATTRIBUTE_STOREFRONT_ORIGIN,\n ATTRIBUTE_VERSION,\n ERRORS,\n LOAD_TIMEOUT_MS,\n ATTRIBUTE_DEV_MODE,\n ATTRIBUTE_ANALYTICS_TRACE_ID,\n} from '../../constants/loginButton';\nimport {\n createGetAppButtonHtml,\n createScanCodeTooltipHtml,\n SHOP_FOLLOW_BUTTON_HTML,\n} from '../../constants/followButton';\n\nimport {FollowOnShopMonorailTracker} from './analytics';\nimport {createModalContent, ModalContent} from './components/modal-content';\nimport {buildAuthorizeUrl} from './authorize';\nimport {\n createFollowButton,\n FollowOnShopButton,\n} from './components/follow-on-shop-button';\nimport {createStoreLogo, StoreLogo} from './components/store-logo';\n\nenum ModalOpenStatus {\n Closed = 'closed',\n Mounting = 'mounting',\n Open = 'open',\n}\n\nexport const COOKIE_NAME = 'shop_followed';\n\nexport default class ShopFollowButton extends ConnectedWebComponent {\n #rootElement: ShadowRoot;\n #analyticsTraceId = getAnalyticsTraceId();\n #clientId = '';\n #version: Version = '2';\n #storefrontOrigin = window.location.origin;\n #devMode = false;\n #monorailTracker = new FollowOnShopMonorailTracker({\n elementName: 'shop-follow-button',\n analyticsTraceId: this.#analyticsTraceId,\n });\n\n #buttonInViewportObserver: IntersectionObserver | undefined;\n\n #followShopButton: FollowOnShopButton | undefined;\n #isFollowing = false;\n #storefrontMeta: StoreMetadata | null = null;\n\n #iframe: HTMLIFrameElement | undefined;\n #iframeListener: MessageListener | undefined;\n #iframeMessenger: PayMessageSender | undefined;\n #iframeLoadTimeout: ReturnType | undefined;\n\n #authorizeModalManager: SheetModalManager | undefined;\n #followModalManager: SheetModalManager | undefined;\n\n #authorizeModal: ShopSheetModal | undefined;\n #authorizeLogo: StoreLogo | undefined;\n #authorizeModalContent: ModalContent | undefined;\n #authorizeModalOpenedStatus: ModalOpenStatus = ModalOpenStatus.Closed;\n #followedModal: ShopSheetModal | undefined;\n #followedModalContent: ModalContent | undefined;\n #followedTooltip: HTMLDivElement | undefined;\n\n #i18n: I18n | null = null;\n\n static get observedAttributes(): string[] {\n return [\n ATTRIBUTE_CLIENT_ID,\n ATTRIBUTE_VERSION,\n ATTRIBUTE_STOREFRONT_ORIGIN,\n ATTRIBUTE_DEV_MODE,\n ];\n }\n\n constructor() {\n super();\n\n this.#rootElement = this.attachShadow({mode: 'open'});\n this.#isFollowing = getCookie(COOKIE_NAME) === 'true';\n }\n\n #handleUserIdentityChange = () => {\n this.#updateSrc(true);\n };\n\n attributeChangedCallback(\n name: string,\n _oldValue: string,\n newValue: string,\n ): void {\n switch (name) {\n case ATTRIBUTE_VERSION:\n this.#version = newValue as Version;\n this.#updateSrc();\n break;\n case ATTRIBUTE_CLIENT_ID:\n this.#clientId = newValue;\n this.#updateSrc();\n break;\n case ATTRIBUTE_STOREFRONT_ORIGIN:\n this.#storefrontOrigin = newValue;\n validateStorefrontOrigin(this.#storefrontOrigin);\n break;\n case ATTRIBUTE_DEV_MODE:\n this.#devMode = newValue === 'true';\n this.#updateSrc();\n break;\n }\n }\n\n async connectedCallback(): Promise {\n this.subscribeToHub(\n ShopHubTopic.UserStatusIdentity,\n this.#handleUserIdentityChange,\n );\n\n await this.#initTranslations();\n this.#initElements();\n this.#initEvents();\n }\n\n async #initTranslations() {\n try {\n // BUILD_LOCALE is used for generating localized bundles.\n // See ./scripts/i18n-dynamic-import-replacer-rollup.mjs for more info.\n // eslint-disable-next-line no-process-env\n const locale = process.env.BUILD_LOCALE || I18n.getDefaultLanguage();\n const dictionary = await import(`./translations/${locale}.json`);\n this.#i18n = new I18n({[locale]: dictionary});\n } catch (error) {\n if (error instanceof Error) {\n Bugsnag.notify(error);\n }\n }\n return null;\n }\n\n #initElements() {\n this.#followShopButton = createFollowButton(this.#isFollowing);\n this.#rootElement.innerHTML = SHOP_FOLLOW_BUTTON_HTML;\n this.#rootElement.appendChild(this.#followShopButton);\n }\n\n #initEvents() {\n this.#trackComponentLoadedEvent(this.#isFollowing);\n this.#trackComponentInViewportEvent();\n\n validateStorefrontOrigin(this.#storefrontOrigin);\n this.#followShopButton?.addEventListener('click', () => {\n // dev mode\n if (this.#devMode) {\n this.#isFollowing = !this.#isFollowing;\n this.#followShopButton?.setFollowing({\n following: this.#isFollowing,\n });\n return;\n }\n\n if (this.#isFollowing) {\n this.#monorailTracker.trackFollowingGetAppButtonPageImpression();\n\n if (isMobileBrowser()) {\n this.#createAndOpenAlreadyFollowingModal();\n } else {\n this.#createAlreadyFollowingTooltip();\n }\n } else {\n this.#monorailTracker.trackFollowButtonClicked();\n this.#createAndOpenFollowOnShopModal();\n }\n });\n }\n\n disconnectedCallback(): void {\n this.unsubscribeAllFromHub();\n this.#iframeListener?.destroy();\n this.#buttonInViewportObserver?.disconnect();\n this.#authorizeModalManager?.destroy();\n this.#followModalManager?.destroy();\n }\n\n #createAndOpenFollowOnShopModal() {\n if (this.#authorizeModal) {\n this.#openAuthorizeModal();\n return;\n }\n\n this.#authorizeLogo = this.#createStoreLogo();\n this.#authorizeModalContent = createModalContent({});\n this.#authorizeModalContent.append(this.#createIframe());\n\n this.#authorizeModalManager = sheetModalBuilder()\n .withInnerHTML(SHOP_FOLLOW_BUTTON_HTML)\n .build();\n this.#authorizeModal = this.#authorizeModalManager.sheetModal;\n this.#authorizeModal.setAttribute(\n ATTRIBUTE_ANALYTICS_TRACE_ID,\n this.#analyticsTraceId,\n );\n this.#authorizeModal.appendChild(this.#authorizeLogo);\n this.#authorizeModal.appendChild(this.#authorizeModalContent);\n this.#authorizeModal.addEventListener(\n 'modalcloserequest',\n this.#closeAuthorizeModal.bind(this),\n );\n\n this.#authorizeModal.setMonorailTracker(this.#monorailTracker);\n this.#authorizeModalOpenedStatus = ModalOpenStatus.Mounting;\n }\n\n async #createAndOpenAlreadyFollowingModal() {\n if (!this.#followedModal) {\n this.#followModalManager = sheetModalBuilder()\n .withInnerHTML(SHOP_FOLLOW_BUTTON_HTML)\n .build();\n this.#followedModal = this.#followModalManager.sheetModal;\n this.#followedModal.setMonorailTracker(this.#monorailTracker);\n this.#followedModal.setAttribute('disable-popup', 'true');\n const storeMeta = await this.#fetchStorefrontMetadata();\n const storeName = storeMeta?.name ?? 'the store';\n const title = this.#i18n?.translate(\n 'follow_on_shop.following_modal.title',\n {store: storeName},\n );\n const description = this.#i18n?.translate(\n 'follow_on_shop.following_modal.subtitle',\n );\n this.#followedModalContent = createModalContent(\n {\n title,\n description,\n },\n true,\n );\n this.#followedModal.appendChild(this.#followedModalContent);\n this.#followedModal.appendChild(\n await this.#createAlreadyFollowingModalButton(),\n );\n this.#followedModal.addEventListener('modalcloserequest', async () => {\n if (this.#followedModal) {\n await this.#followedModal.close();\n }\n this.#followShopButton?.setFocused();\n });\n\n if (title) {\n this.#followedModal.setAttribute('title', title);\n }\n }\n\n this.#followedModal.open();\n this.#monorailTracker.trackFollowingGetAppButtonPageImpression();\n }\n\n #createStoreLogo(): StoreLogo {\n const storeLogo = createStoreLogo();\n\n this.#fetchStorefrontMetadata()\n .then((storefrontMeta) => {\n storeLogo.update({\n name: storefrontMeta?.name || '',\n logoSrc: storefrontMeta?.id\n ? `${SHOP_WEBSITE_DOMAIN}/shops/${storefrontMeta.id}/logo?width=58`\n : '',\n });\n })\n .catch(() => {\n /** no-op */\n });\n\n return storeLogo;\n }\n\n #createIframe(): HTMLIFrameElement {\n this.#iframe = document.createElement('iframe');\n this.#iframe.tabIndex = 0;\n this.#updateSrc();\n\n const eventDestination: Window | undefined =\n this.ownerDocument?.defaultView || undefined;\n\n this.#iframeListener = new MessageListener(\n new IFrameEventSource(this.#iframe),\n [PAY_AUTH_DOMAIN, PAY_AUTH_DOMAIN_ALT, this.#storefrontOrigin],\n this.#handlePostMessage.bind(this),\n eventDestination,\n );\n this.#iframeMessenger = new PayMessageSender(this.#iframe);\n\n updateAttribute(this.#iframe, 'allow', 'publickey-credentials-get *');\n\n return this.#iframe;\n }\n\n async #createAlreadyFollowingModalButton(): Promise {\n const buttonWrapper = document.createElement('div');\n const storeMeta = await this.#fetchStorefrontMetadata();\n const storeId = storeMeta?.id;\n\n const buttonText =\n this.#i18n?.translate('follow_on_shop.following_modal.continue', {\n defaultValue: 'Continue',\n }) ?? '';\n const buttonLink = storeId ? `https://shop.app/sid/${storeId}` : '#';\n buttonWrapper.innerHTML = createGetAppButtonHtml(buttonLink, buttonText);\n buttonWrapper.addEventListener('click', async () => {\n this.#monorailTracker.trackFollowingGetAppButtonClicked();\n this.#followedModal?.close();\n });\n return buttonWrapper;\n }\n\n async #createAlreadyFollowingTooltip() {\n if (!this.#followedTooltip) {\n this.#followedTooltip = document.createElement('div');\n this.#followedTooltip.classList.add('fos-tooltip', 'fos-tooltip-hidden');\n\n const storeMeta = await this.#fetchStorefrontMetadata();\n const storeName = storeMeta?.name ?? 'the store';\n const description =\n this.#i18n?.translate('follow_on_shop.following_modal.qr_header', {\n store: storeName,\n }) ?? '';\n const qrCodeAltText =\n this.#i18n?.translate('follow_on_shop.following_modal.qr_alt_text') ??\n '';\n const storeId = storeMeta?.id;\n const qrCodeUrl = storeId\n ? `${SHOP_WEBSITE_DOMAIN}/qr/sid/${storeId}`\n : `#`;\n this.#followedTooltip.innerHTML = createScanCodeTooltipHtml(\n description,\n qrCodeUrl,\n qrCodeAltText,\n );\n\n this.#followedTooltip\n .querySelector('.fos-tooltip-overlay')\n ?.addEventListener('click', () => {\n this.#followedTooltip?.classList.toggle('fos-tooltip-hidden', true);\n });\n this.#followedTooltip?.addEventListener('click', () => {\n this.#followedTooltip?.classList.toggle('fos-tooltip-hidden', true);\n });\n\n this.#rootElement.appendChild(this.#followedTooltip);\n }\n\n this.#followedTooltip.classList.toggle('fos-tooltip-hidden', false);\n }\n\n #updateSrc(forced?: boolean) {\n if (this.#iframe) {\n const oauthParams: OAuthParams | OAuthParamsV1 = {\n clientId: this.#clientId,\n responseType: 'code',\n };\n const authorizeUrl = buildAuthorizeUrl({\n version: this.#version,\n analyticsTraceId: this.#analyticsTraceId,\n flow: ShopActionType.Follow,\n oauthParams,\n });\n\n this.#initLoadTimeout();\n updateAttribute(this.#iframe, 'src', authorizeUrl, forced);\n Bugsnag.leaveBreadcrumb('Iframe url updated', {authorizeUrl}, 'state');\n }\n }\n\n #initLoadTimeout() {\n this.#clearLoadTimeout();\n this.#iframeLoadTimeout = setTimeout(() => {\n const error = ERRORS.temporarilyUnavailable;\n this.dispatchCustomEvent('error', {\n message: error.message,\n code: error.code,\n });\n // eslint-disable-next-line no-warning-comments\n // TODO: replace this bugsnag notify with a Observe-able event\n // Bugsnag.notify(\n // new PayTimeoutError(`Pay failed to load within ${LOAD_TIMEOUT_MS}ms.`),\n // {component: this.#component, src: this.iframe?.getAttribute('src')},\n // );\n this.#clearLoadTimeout();\n }, LOAD_TIMEOUT_MS);\n }\n\n #clearLoadTimeout() {\n if (!this.#iframeLoadTimeout) return;\n clearTimeout(this.#iframeLoadTimeout);\n this.#iframeLoadTimeout = undefined;\n }\n\n #trackComponentLoadedEvent(isFollowing: boolean) {\n this.#monorailTracker.trackFollowButtonPageImpression(isFollowing);\n }\n\n #trackComponentInViewportEvent() {\n this.#buttonInViewportObserver = new IntersectionObserver((entries) => {\n for (const {isIntersecting} of entries) {\n if (isIntersecting) {\n this.#buttonInViewportObserver?.disconnect();\n this.#monorailTracker.trackFollowButtonInViewport();\n }\n }\n });\n\n this.#buttonInViewportObserver.observe(this.#followShopButton!);\n }\n\n async #fetchStorefrontMetadata() {\n if (!this.#storefrontMeta) {\n this.#storefrontMeta = await getStoreMeta(this.#storefrontOrigin);\n }\n\n return this.#storefrontMeta;\n }\n\n async #handleCompleted({\n loggedIn,\n shouldFinalizeLogin,\n email,\n givenNameFirstInitial,\n avatar,\n }: Partial) {\n const now = new Date();\n now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);\n document.cookie = `${COOKIE_NAME}=true;expires=${now.toUTCString()};path=/`;\n\n if (loggedIn) {\n if (shouldFinalizeLogin) {\n exchangeLoginCookie(this.#storefrontOrigin, (error) => {\n Bugsnag.notify(new Error(error));\n });\n\n this.publishToHub(ShopHubTopic.UserSessionCreate, {\n email: givenNameFirstInitial || email,\n initial: givenNameFirstInitial || email?.[0] || '',\n avatar,\n });\n }\n }\n\n this.dispatchCustomEvent('completed', {\n loggedIn,\n email,\n });\n\n await this.#authorizeLogo?.setFavorited();\n await this.#authorizeModal?.close();\n this.#iframeListener?.destroy();\n this.#followShopButton?.setFollowing({following: true});\n this.#isFollowing = true;\n this.#trackComponentLoadedEvent(true);\n }\n\n #handleError(code: string, message: string, email?: string): void {\n this.#clearLoadTimeout();\n\n this.dispatchCustomEvent('error', {\n code,\n message,\n email,\n });\n }\n\n async #handleLoaded({\n clientName,\n logoSrc,\n }: {\n clientName?: string;\n logoSrc?: string;\n }) {\n if (clientName || logoSrc) {\n this.#authorizeLogo!.update({\n name: clientName,\n logoSrc,\n });\n }\n\n if (this.#authorizeModalOpenedStatus === ModalOpenStatus.Mounting) {\n this.#openAuthorizeModal();\n this.#authorizeModalOpenedStatus = ModalOpenStatus.Open;\n this.#clearLoadTimeout();\n }\n }\n\n async #openAuthorizeModal() {\n const result = await this.#authorizeModal!.open();\n if (result) {\n this.#iframeMessenger?.postMessage({\n type: 'sheetmodalopened',\n });\n }\n }\n\n async #closeAuthorizeModal() {\n if (this.#authorizeModal) {\n const result = await this.#authorizeModal.close();\n if (result) {\n this.#iframeMessenger?.postMessage({type: 'sheetmodalclosed'});\n // Remove the 1password custom element from the DOM after the sheet modal is closed.\n removeOnePasswordPrompt();\n }\n }\n this.#followShopButton?.setFocused();\n }\n\n #handlePostMessage(data: MessageEventData) {\n switch (data.type) {\n case 'loaded':\n this.#handleLoaded(data);\n break;\n case 'resize_iframe':\n this.#iframe!.style.height = `${data.height}px`;\n this.#iframe!.style.width = `${constraintWidthInViewport(data.width, this.#iframe!)}px`;\n break;\n case 'completed':\n this.#handleCompleted(data as CompletedEvent);\n break;\n case 'error':\n this.#handleError(data.code, data.message, data.email);\n break;\n case 'content':\n this.#authorizeModal?.setAttribute('title', data.title);\n this.#authorizeModalContent?.update(data);\n this.#authorizeLogo?.classList.toggle(\n 'hidden',\n data.authorizeState === AuthorizeState.Captcha,\n );\n break;\n case 'processing_status_updated':\n this.#authorizeModalContent?.update(data);\n break;\n case 'close_requested':\n this.#closeAuthorizeModal();\n break;\n }\n }\n}\n\n/**\n * Define the shop-follow-button custom element.\n */\nexport function defineElement() {\n defineCustomElement('shop-follow-button', ShopFollowButton);\n}\n","import {startBugsnag, isBrowserSupported} from '../../common/init';\nimport {defineElement as defineShopSwirl} from '../../common/shop-swirl';\n\nimport {defineElement as defineShopFollowButton} from './shop-follow-button';\nimport {defineElement as defineShopLoginButton} from './shop-login-button';\nimport {defineElement as defineShopLoginDefault} from './shop-login-default';\n\n/**\n * Initialize the login button web components.\n * This is the entry point that will be used for code-splitting.\n */\nfunction init() {\n if (!isBrowserSupported()) return;\n // eslint-disable-next-line no-process-env\n startBugsnag({bundle: 'loginButton', bundleLocale: process.env.BUILD_LOCALE});\n\n // The order of these calls is not significant. However, it is worth noting that\n // ShopFollowButton and ShopLoginDefault all rely on the ShopLoginButton.\n // To ensure that the ShopLoginButton is available when the other components are\n // defined, we prioritize defining the ShopLoginButton first.\n defineShopLoginButton();\n defineShopFollowButton();\n defineShopLoginDefault();\n defineShopSwirl();\n}\n\ninit();\n"],"names":["ShopSwirl","HTMLElement","constructor","super","template","document","createElement","size","this","getAttribute","backgroundColor","innerHTML","red","green","blue","pickLogoColor","color","sizeRatio","height","width","Math","round","getTemplateContents","Number","parseInt","undefined","attachShadow","mode","appendChild","content","cloneNode","sheetModalBuilder","wrapper","shadow","style","setProperty","withInnerHTML","build","sheetModal","createShopSheetModal","body","destroy","remove","ELEMENT_CLASS_NAME","ModalContent","_ModalContent_rootElement","set","_ModalContent_headerWrapper","_ModalContent_headerTitle","_ModalContent_headerDescription","_ModalContent_contentWrapper","_ModalContent_contentProcessingWrapper","_ModalContent_contentProcessingUser","_ModalContent_contentStatusIndicator","_ModalContent_contentChildrenWrapper","_ModalContent_disclaimerText","_ModalContent_contentStore","colors","brand","__classPrivateFieldSet","__classPrivateFieldGet","querySelector","hideDivider","classList","add","showDivider","update","_ModalContent_instances","_ModalContent_updateHeader","call","_ModalContent_updateMainContent","_ModalContent_updateDisclaimer","createModalContent","modalContent","title","description","authorizeState","visible","toggle","textContent","AuthorizeState","Start","status","email","contentWrapperVisible","Boolean","processingWrapperVisible","childrenWrapperVisible","loaderType","OneClick","StatusIndicatorLoader","Branded","Regular","createStatusIndicator","_a","setStatus","message","disclaimer","customElements","get","define","ATTRIBUTE_FOLLOWING","FollowOnShopButton","_rootElement","_button","_wrapper","_heartIcon","_followSpan","_followingSpan","_i18n","_followTextWidth","_followingTextWidth","ShopLogo","connectedCallback","_initTranslations","_initElements","setFollowing","following","skipAnimation","_b","ariaHidden","window","matchMedia","matches","_c","setFilled","_e","_d","addEventListener","setFocused","focus","locale","dictionary","follow_on_shop","follow","auth_modal","following_modal","subtitle","qr_header","qr_alt_text","continue","completed","personalization_consent","login_with_shop","login","login_title","login_description","signup_title","signup_description","login_sms_title","login_sms_description","login_email_title","login_email_description","login_email_footer","login_title_with_store","login_webauthn_title","login_webauthn_description","login_webauthn_footer","customer_accounts","remember_me","sign_up_page","verified_email_auth","legal","terms_of_service","privacy_policy","terms","client","shop","authorized_scopes","email_name","payment_request","checkout_modal","I18n","error","Error","Bugsnag","notify","getShopLogoHtml","followText","translate","followingText","createShopHeartIcon","prepend","scrollWidth","max","hasAttribute","_setButtonStyle","background","inferBackgroundColor","isDark","calculateContrast","isBordered","ELEMENT_NAME","StoreLogo","_StoreLogo_rootElement","_StoreLogo_wrapper","_StoreLogo_logoWrapper","_StoreLogo_logoImg","_StoreLogo_logoText","_StoreLogo_heartIcon","_StoreLogo_storeName","_StoreLogo_logoSrc","foregroundSecondary","white","append","name","logoSrc","_StoreLogo_instances","_StoreLogo_updateDom","setFavorited","Promise","resolve","setTimeout","ModalOpenStatus","currentLogoSrc","src","charAt","ariaLabel","alt","COOKIE_NAME","ShopFollowButton","ConnectedWebComponent","_ShopFollowButton_rootElement","_ShopFollowButton_analyticsTraceId","getAnalyticsTraceId","_ShopFollowButton_clientId","_ShopFollowButton_version","_ShopFollowButton_storefrontOrigin","location","origin","_ShopFollowButton_devMode","_ShopFollowButton_monorailTracker","FollowOnShopMonorailTracker","elementName","analyticsTraceId","_ShopFollowButton_buttonInViewportObserver","_ShopFollowButton_followShopButton","_ShopFollowButton_isFollowing","_ShopFollowButton_storefrontMeta","_ShopFollowButton_iframe","_ShopFollowButton_iframeListener","_ShopFollowButton_iframeMessenger","_ShopFollowButton_iframeLoadTimeout","_ShopFollowButton_authorizeModalManager","_ShopFollowButton_followModalManager","_ShopFollowButton_authorizeModal","_ShopFollowButton_authorizeLogo","_ShopFollowButton_authorizeModalContent","_ShopFollowButton_authorizeModalOpenedStatus","Closed","_ShopFollowButton_followedModal","_ShopFollowButton_followedModalContent","_ShopFollowButton_followedTooltip","_ShopFollowButton_i18n","_ShopFollowButton_handleUserIdentityChange","_ShopFollowButton_instances","_ShopFollowButton_updateSrc","getCookie","observedAttributes","ATTRIBUTE_CLIENT_ID","ATTRIBUTE_VERSION","ATTRIBUTE_STOREFRONT_ORIGIN","ATTRIBUTE_DEV_MODE","attributeChangedCallback","_oldValue","newValue","validateStorefrontOrigin","subscribeToHub","ShopHubTopic","UserStatusIdentity","_ShopFollowButton_initTranslations","_ShopFollowButton_initElements","_ShopFollowButton_initEvents","disconnectedCallback","unsubscribeAllFromHub","disconnect","element","setAttribute","createFollowButton","SHOP_FOLLOW_BUTTON_HTML","_ShopFollowButton_trackComponentInViewportEvent","trackFollowingGetAppButtonPageImpression","isMobileBrowser","_ShopFollowButton_createAndOpenAlreadyFollowingModal","_ShopFollowButton_createAlreadyFollowingTooltip","trackFollowButtonClicked","_ShopFollowButton_createAndOpenFollowOnShopModal","_ShopFollowButton_openAuthorizeModal","_ShopFollowButton_createIframe","ATTRIBUTE_ANALYTICS_TRACE_ID","_ShopFollowButton_closeAuthorizeModal","bind","setMonorailTracker","Mounting","storeMeta","_ShopFollowButton_fetchStorefrontMetadata","storeName","store","_ShopFollowButton_createAlreadyFollowingModalButton","__awaiter","close","open","storeLogo","then","storefrontMeta","id","SHOP_WEBSITE_DOMAIN","catch","tabIndex","eventDestination","ownerDocument","defaultView","MessageListener","IFrameEventSource","PAY_AUTH_DOMAIN","PAY_AUTH_DOMAIN_ALT","_ShopFollowButton_handlePostMessage","PayMessageSender","updateAttribute","buttonWrapper","storeId","buttonText","defaultValue","buttonLink","createGetAppButtonHtml","trackFollowingGetAppButtonClicked","qrCodeAltText","qrCodeUrl","createScanCodeTooltipHtml","_f","_g","forced","oauthParams","clientId","responseType","authorizeUrl","buildAuthorizeUrl","version","flow","ShopActionType","Follow","_ShopFollowButton_initLoadTimeout","leaveBreadcrumb","_ShopFollowButton_clearLoadTimeout","ERRORS","temporarilyUnavailable","dispatchCustomEvent","code","LOAD_TIMEOUT_MS","clearTimeout","isFollowing","trackFollowButtonPageImpression","IntersectionObserver","entries","isIntersecting","trackFollowButtonInViewport","observe","getStoreMeta","loggedIn","shouldFinalizeLogin","givenNameFirstInitial","avatar","now","Date","setTime","getTime","cookie","toUTCString","exchangeLoginCookie","publishToHub","UserSessionCreate","initial","_ShopFollowButton_trackComponentLoadedEvent","_ShopFollowButton_handleLoaded","clientName","Open","postMessage","type","removeOnePasswordPrompt","data","constraintWidthInViewport","_ShopFollowButton_handleCompleted","_ShopFollowButton_handleError","Captcha","isBrowserSupported","startBugsnag","bundle","bundleLocale","defineShopLoginButton","defineCustomElement","defineShopLoginDefault"],"mappings":"4ZAGM,MAAOA,UAAkBC,YAC7B,WAAAC,GACEC,QAEA,MAAMC,EAAWC,SAASC,cAAc,YAClCC,EAAOC,KAAKC,aAAa,QAEzBC,EAAkBF,KAAKC,aAAa,qBAAuB,OAEjEL,EAASO,UAgBb,SAA6BJ,EAAO,GAAIG,GACtC,MAAOE,EAAKC,EAAOC,GAAQC,EAAcL,GACnCM,EAAQ,OAAOJ,MAAQC,MAAUC,KACjCG,EAAY,KACZC,EAASX,EACTY,EAAQC,KAAKC,MAAMH,EAASD,GAElC,MAAO,uDAGSC,wBACDC,0rBAKygBH,uBAG1hB,CAnCyBM,CACnBf,EAAOgB,OAAOC,SAASjB,EAAM,SAAMkB,EACnCf,GAGFF,KAAKkB,aAAa,CAACC,KAAM,SAASC,YAChCxB,EAASyB,QAAQC,WAAU,GAE9B,WCJaC,IACd,MAAMC,EAAU3B,SAASC,cAAc,OACjC2B,EAASD,EAAQN,aAAa,CAACC,KAAM,SAK3C,OAFAK,EAAQE,MAAMC,YAAY,MAAO,WAE1B,CACL,aAAAC,CAAczB,GAGZ,OAFAsB,EAAOtB,UAAYA,EAEZH,IACR,EACD,KAAA6B,GACE,MAAMC,EAAaC,IAInB,OAHAN,EAAOL,YAAYU,GACnBjC,SAASmC,KAAKZ,YAAYI,GAEnB,CACL,cAAIM,GACF,OAAOA,CACR,EACD,OAAAG,GACET,EAAQU,QACT,EAEJ,EAEL,gDCjCO,MAAMC,GAAqB,qBAW5B,MAAOC,WAAqB3C,YAqBhC,WAAAC,GACEC,oBArBF0C,EAAyBC,IAAAtC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