web-push-notifications 3.122.0 → 3.123.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"widget-web-popups.js","mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,UAAAA,QAAA,iBAAAA,QAAA,4BACA,sBAAAC,QAAAA,OAAAC,IACAD,OAAA,gDAAAJ,OACA,CACA,IAAAM,EAAA,iBAAAL,QAAAD,EAAAG,QAAA,UAAAA,QAAA,iBAAAA,QAAA,uBAAAH,EAAAD,EAAA,OAAAA,EAAA,aAAAA,EAAA,YACA,QAAAQ,KAAAD,GAAA,iBAAAL,QAAAA,QAAAF,GAAAQ,GAAAD,EAAAC,EACA,CACC,CATD,CASCC,KAAA,CAAAC,EAAAC,EAAAC,qCCTDT,EAAAD,QAAAQ,UCAAP,EAAAD,QAAAS,UCAAR,EAAAD,QAAAU,ICCA,MAAAC,EAAA,GAGA,SAAAC,EAAAC,GAEA,MAAAC,EAAAH,EAAAE,GACA,QAAAE,IAAAD,EACA,OAAAA,EAAAd,QAGA,MAAAC,EAAAU,EAAAE,GAAA,CAGAb,QAAA,IAOA,OAHAgB,EAAAH,GAAAZ,EAAAA,EAAAD,QAAAY,GAGAX,EAAAD,OACA,CCrBAY,EAAAK,EAAA,CAAAjB,EAAAkB,KACA,QAAAC,KAAAD,EACAN,EAAAQ,EAAAF,EAAAC,KAAAP,EAAAQ,EAAApB,EAAAmB,IACAE,OAAAC,eAAAtB,EAAAmB,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJzCP,EAAAQ,EAAA,CAAAK,EAAAC,IAAAL,OAAAM,UAAAC,eAAAC,KAAAJ,EAAAC,GCCAd,EAAAkB,EAAA9B,IACAqB,OAAAU,iBAAA/B,EAAA,CAAoC,CAAAgC,OAAAC,aAAA,CAAwBC,MAAA,UAAiB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F,KAAM,+BAe9C,CAEQ,iBAAMk1B,CAAY/H,GACxBzqC,KAAKu0C,sBAAsB9J,EAASntB,MACpC,MAAMuwB,UAAEA,EAASvwB,KAAEA,GAASmtB,EAExB3nB,GAAgB2nB,KAIF,SAAdoD,EAKc,qBAAdA,GACF8F,eAAea,QAAQx0C,KAAK6zC,qBAAqBv2B,GAAO,WALlDtd,KAAK6oB,GAAGyX,KAAKmU,iBAAiBn3B,GAOxC,CAEQ,oBAAAu2B,CAAqBv2B,GAC3B,MAAO,GAAGsG,YAAqCtG,GACjD,EAGF,MAAMo3B,GAA0C,CAC9CC,2BAA4B,EAC5BC,8BAA+B,EAC/BC,4BAA6B,GAG/B,SAAS9F,GAAcltB,GACrB,OAAO6yB,GAAgB7yB,GAAWizB,UAAY,KAAOJ,GAAgBE,6BACvE,CAEA,SAAS5F,GAAkBntB,GACzB,MAAMuW,EAAWvW,GAAWkzB,WAAathC,KAAKsG,MAAM8H,EAAUkzB,YAAcC,IAE5E,OAAOtrC,OAAO2K,MAAM+jB,GAAY,KAAOA,CACzC,CAEA,SAASkV,GAAiBzrB,EAAqCmP,GAC7D,MAAMoH,EAAW4W,GAAkBntB,GAEnC,OAAoB,OAAbuW,GAAqBA,GAAYpH,CAC1C,CAGA,SAAS8gB,GAAW/uB,GAClB,OAAOgkB,GAAiBhkB,IAAU4gB,GAAqB5gB,GAAS,EAAIA,EAAMkQ,KAC5E","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/external umd {\"commonjs\":\"preact\",\"commonjs2\":\"preact\",\"amd\":\"preact\",\"root\":\"preact\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/compat\",\"commonjs2\":\"preact/compat\",\"amd\":\"preact/compat\",\"root\":\"preactCompat\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/jsx-runtime\",\"commonjs2\":\"preact/jsx-runtime\",\"amd\":\"preact/jsx-runtime\",\"root\":\"jsxRuntime\"}","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/constants.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/glyphs.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/layout.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/palette.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/timer.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/shared/textDirection.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/helpers.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form.js","webpack://web-push-notifications/./src/widgets/WebPopups/clickTrigger.ts","webpack://web-push-notifications/./src/widgets/WebPopups/constants.ts","webpack://web-push-notifications/./src/modules/storage/migrations/constants.ts","webpack://web-push-notifications/./src/modules/storage/migrations/helpers.ts","webpack://web-push-notifications/./src/modules/storage/migrations/initial.ts","webpack://web-push-notifications/./src/modules/storage/migrations/Migrations.ts","webpack://web-push-notifications/./src/modules/storage/migrations/MigrationExecutor.ts","webpack://web-push-notifications/./src/core/storage.ts","webpack://web-push-notifications/./src/core/logger.ts","webpack://web-push-notifications/./src/widgets/WebPopups/deviceSubmitApi.ts","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/colorScheme.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/formSession.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/TextFieldView/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/TextFieldView/TextFieldView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/EmailInputSlotView/EmailInputSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/TagInputSlotView/TagInputSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/ConsentSlotView/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/ConsentSlotView/ConsentSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/SubmitSlotView/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/SubmitSlotView/SubmitSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/productsSlot.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/revealControls.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/subscribeSession.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/WebPopupReader.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/WebPopupInline.js","webpack://web-push-notifications/./src/widgets/WebPopups/subscriptionFormApi.ts","webpack://web-push-notifications/./src/widgets/WebPopups/webPopupLogger.ts","webpack://web-push-notifications/./src/widgets/WebPopups/EmbeddedWebPopups.ts","webpack://web-push-notifications/./src/widgets/WebPopups/exitIntent.ts","webpack://web-push-notifications/./src/widgets/WebPopups/interactions.ts","webpack://web-push-notifications/./src/widgets/WebPopups/productsHost.ts","webpack://web-push-notifications/./src/widgets/WebPopups/pushPermissionCondition.ts","webpack://web-push-notifications/./src/widgets/WebPopups/renderer.tsx","webpack://web-push-notifications/./src/widgets/WebPopups/scrollDepth.ts","webpack://web-push-notifications/./src/helpers/pagePath.ts","webpack://web-push-notifications/./src/widgets/WebPopups/WebPopupsWidget.ts","webpack://web-push-notifications/./src/widgets/WebPopups/embeddedRenderer.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"preact\", \"preact/compat\", \"preact/jsx-runtime\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\")) : factory(root[\"preact\"], root[\"preactCompat\"], root[\"jsxRuntime\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__524__, __WEBPACK_EXTERNAL_MODULE__873__, __WEBPACK_EXTERNAL_MODULE__247__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__524__;","module.exports = __WEBPACK_EXTERNAL_MODULE__873__;","module.exports = __WEBPACK_EXTERNAL_MODULE__247__;","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter/value functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tObject.defineProperties(exports, { [Symbol.toStringTag]: { value: 'Module' }, __esModule: { value: true } });\n};","/**\n * Current stored-format version (WebPopupJson.version). Version 2 = the\n * layout-tree format (nested containers + Content/Image leaves, named content\n * zones). Version 1 (flat layout + single slot list) is retired without a\n * migration path — v1 popups are treated as broken, same as the pre-engine\n * ai-builder format.\n */\nexport const WEB_POPUP_VERSION = 2;\n// Bomb protection for the embedded layout tree — the json travels through a\n// public API, so the parser refuses to walk pathological trees.\nexport const WEB_POPUP_LAYOUT_MAX_DEPTH = 10;\nexport const WEB_POPUP_LAYOUT_MAX_NODES = 100;\n/** Protocols allowed in button hrefs (plus relative `#`/`/`/`?` prefixes). */\nexport const SAFE_URL_PROTOCOL = /^(https?:|mailto:|tel:)/i;\nexport const WEB_POPUP_FONT_STACK = 'Inter, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif';\n// Palette defaults (mirror the editor's popup theme) — what a popup gets for\n// any WebPopupColors entry its json doesn't set.\nexport const WEB_POPUP_TEXT_COLOR = '#101828';\nexport const WEB_POPUP_TEXT_SECONDARY_COLOR = '#667085';\nexport const WEB_POPUP_ACCENT_COLOR = '#2970FF';\nexport const WEB_POPUP_BACKGROUND_COLOR = '#FFFFFF';\n/** Label over an accent fill in the light scheme; dark picks it by accent luminance. */\nexport const WEB_POPUP_ON_ACCENT_COLOR = '#FFFFFF';\nexport const WEB_POPUP_DEFAULT_COLORS = {\n background: WEB_POPUP_BACKGROUND_COLOR,\n accent: WEB_POPUP_ACCENT_COLOR,\n text: WEB_POPUP_TEXT_COLOR,\n textSecondary: WEB_POPUP_TEXT_SECONDARY_COLOR,\n textInverse: '#FFFFFF'\n};\n/** Fallback width used when a fixed-width context needs a number anyway. */\nexport const WEB_POPUP_DEFAULT_WIDTH = 360;\n/** Max height of an `<img>` in an Inline block: at full container width a side image would be too tall. */\nexport const WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT = 360;\n// Per-variant text styles — the same numbers the editor's canvas derives from\n// its theme presets. No colors here: those come from the popup palette via\n// webPopupTextColor below.\nexport const WEB_POPUP_TEXT_VARIANT_STYLES = {\n h1: {\n fontSize: 24,\n fontWeight: 600,\n lineHeight: 1.25\n },\n h2: {\n fontSize: 18,\n fontWeight: 600,\n lineHeight: 1.3\n },\n h3: {\n fontSize: 16,\n fontWeight: 600,\n lineHeight: 1.35\n },\n body: {\n fontSize: 14,\n fontWeight: 'normal',\n lineHeight: 1.5\n },\n caption: {\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.4\n },\n eyebrow: {\n fontSize: 11,\n fontWeight: 600,\n letterSpacing: '0.08em',\n lineHeight: 1.4\n },\n icon: {\n fontSize: 24,\n lineHeight: 1.2\n }\n};\n// Inverse-tone translucency per text style: headings full-strength, the\n// secondary variants toned down — same rhythm the palette's default white\n// set always had.\nconst INVERSE_TEXT_ALPHAS = {\n h1: 1,\n h2: 1,\n h3: 1,\n icon: 1,\n eyebrow: 0.8,\n body: 0.9,\n caption: 0.75\n};\n// colors.textInverse at the given opacity. Only #rgb/#rrggbb can be blended;\n// any other author-supplied css color renders full-strength rather than\n// being guessed at.\nfunction inverseColorAt(color, alpha) {\n if (alpha >= 1) return color;\n const hex = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(color)?.[1];\n if (!hex) return color;\n const full = hex.length === 3 ? hex.split('').map(c => c + c).join('') : hex;\n const [r, g, b] = [0, 2, 4].map(i => parseInt(full.slice(i, i + 2), 16));\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n/**\n * A text slot's color: the palette's main/secondary role by variant; in an\n * 'inverse' zone (over a background image) — colors.textInverse, with the\n * secondary variants toned translucent. Undefined for a non-inverse 'icon'\n * (an emoji line inherits — its glyphs aren't recolorable anyway).\n */\nexport function webPopupTextColor(variant, colors, inverse) {\n if (inverse) return inverseColorAt(colors.textInverse, INVERSE_TEXT_ALPHAS[variant] ?? 1);\n if (variant === 'icon') return undefined;\n return variant === 'caption' || variant === 'eyebrow' ? colors.textSecondary : colors.text;\n}\n/** The dark fill under a container's background image while it loads. */\nexport const WEB_POPUP_BG_SECTION_FALLBACK = '#1D2939';\nconst HEADING_VARIANTS = ['h1', 'h2', 'h3', 'icon'];\nexport function webPopupSlotRole(slot) {\n // An icon reads as the line above a title, so it hugs what follows; a\n // countdown wants a block's air, which the 'action' fallback gives it.\n if (slot.type === 'glyph') return 'heading';\n if (slot.type !== 'text') return 'action';\n return HEADING_VARIANTS.includes(slot.variant) ? 'heading' : 'text';\n}\nexport function webPopupSlotGap(prev, next) {\n if (next === 'action') return prev === 'action' ? 6 : 16;\n if (next === 'text' && prev === 'heading') return 4;\n return 8;\n}\n// Paddings INSIDE a form slot (field rows, submit pill); the rhythm above\n// owns the space BETWEEN slots.\nexport const WEB_POPUP_TEXT_SLOT_PADDING = '4px 0';\nexport const WEB_POPUP_BUTTON_SLOT_PADDING = '8px 0 4px';\n/**\n * The button pill both button slots and a form slot's submit button render\n * with — buttons pair the accent with white (primary = accent fill + white\n * label, secondary = white fill + accent outline). Shared with the editor's\n * canvas (parity contract).\n */\nexport function webPopupButtonPillStyle(variant, colors) {\n return {\n display: 'block',\n boxSizing: 'border-box',\n width: '100%',\n padding: '10px 25px',\n borderRadius: 6,\n fontSize: 14,\n fontWeight: 600,\n fontFamily: 'inherit',\n lineHeight: 1.5,\n textAlign: 'center',\n textDecoration: 'none',\n cursor: 'pointer',\n ...(variant === 'secondary' ? {\n backgroundColor: colors.surface,\n color: colors.accent,\n border: `1px solid ${colors.accent}`\n } : {\n backgroundColor: colors.accent,\n color: colors.onAccent,\n border: 'none'\n })\n };\n}\n// Form-slot input chrome, shared with the editor's canvas (parity contract):\n// a `surface` card whatever the zone tone, only the border varies.\nexport const WEB_POPUP_FORM_INPUT_BORDER = '#D0D5DD';\nexport const WEB_POPUP_FORM_ERROR_COLOR = '#D92D20';\n/** The error red lifted for a dark background — the same Untitled UI ramp, three steps up. */\nexport const WEB_POPUP_FORM_ERROR_COLOR_DARK = '#FDA29B';\nexport function webPopupFormInputStyle(colors, borderColor = colors.border) {\n return {\n display: 'block',\n boxSizing: 'border-box',\n width: '100%',\n padding: '10px 12px',\n borderRadius: 6,\n fontSize: 14,\n fontFamily: 'inherit',\n lineHeight: 1.5,\n backgroundColor: colors.surface,\n color: colors.surfaceText,\n border: `1px solid ${borderColor}`,\n outline: 'none'\n };\n}\n// What a normalized form slot falls back to when the json omits the copy —\n// also the editor's defaults for a freshly added slot.\nexport const WEB_POPUP_FORM_DEFAULTS = {\n submitLabel: 'Subscribe',\n successMessage: 'Thanks for subscribing!',\n confirmEmailMessage: 'Please check your inbox and confirm your email.'\n};\n// What a normalized choice slot falls back to when the json omits the copy.\nexport const WEB_POPUP_CHOICE_DEFAULTS = {\n submitLabel: 'Save',\n successMessage: 'Thanks! Your choice is saved.'\n};\nexport const WEB_POPUP_PRODUCTS_DEFAULTS = {\n ctaText: 'Shop now',\n limit: 4\n};\nexport const WEB_POPUP_PRODUCTS_MAX_LIMIT = 12;\n/** Cards a products slot draws without a host: enough to read as a row, never the full limit. */\nexport const WEB_POPUP_PRODUCTS_PLACEHOLDERS = 3;\n/** How long one products answer serves both the host's pre-show check and the render. */\nexport const WEB_POPUP_PRODUCTS_CACHE_MS = 60 * 1000;\n// Same, for a rating slot.\nexport const WEB_POPUP_RATING_DEFAULTS = {\n submitLabel: 'Send',\n successMessage: 'Thanks for the feedback!'\n};\n// The scores a scale offers, in display order; thumbs are 0/1 so `score` stays\n// \"higher is better\" everywhere. Shared with the editor canvas (parity).\nexport function webPopupRatingScores(scale) {\n if (scale === 'nps') return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n if (scale === 'stars') return [1, 2, 3, 4, 5];\n return [0, 1];\n}\n/** Options a `choice` slot may carry; exported so the editor can't offer one normalization drops. */\nexport const WEB_POPUP_MAX_CHOICE_OPTIONS = 12;\n/** What a slot says when the host callback rejected: nothing actionable, so it's retryable. */\nexport const WEB_POPUP_RETRY_ERROR = 'Something went wrong. Please try again.';\n/** Email shape both form paths accept; the server runs the real check. */\nexport const WEB_POPUP_EMAIL_PATTERN = /^\\S+@\\S+\\.\\S+$/;\n/** Copy a Form's Email input falls back to — also the editor's defaults for a fresh block. */\nexport const WEB_POPUP_EMAIL_INPUT_DEFAULTS = {\n invalidMessage: 'Enter a valid email',\n requiredMessage: 'Required'\n};\n/** Copy a Form's Tag input falls back to. */\nexport const WEB_POPUP_TAG_INPUT_DEFAULTS = {\n requiredMessage: 'Required'\n};\n/** Copy a Form's Consent falls back to. */\nexport const WEB_POPUP_CONSENT_DEFAULTS = {\n requiredMessage: 'Please accept the privacy policy'\n};\n/** Copy a Form's Submit falls back to; the error is the retry line every submitting slot shows. */\nexport const WEB_POPUP_SUBMIT_DEFAULTS = {\n label: 'Submit',\n errorMessage: WEB_POPUP_RETRY_ERROR\n};\nexport const WEB_POPUP_KEYFRAMES = `\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n`;\n// Page-switch transition: the incoming page's content fades in while explicit\n// px sizes glide instead of jumping (auto sizes still snap — 'auto' can't be\n// transitioned). One duration for both so they read as a single move.\nexport const WEB_POPUP_PAGE_TRANSITION_MS = 300;\n/** Side room px for the page arrows: default and clamp bounds. */\nexport const WEB_POPUP_ARROW_GUTTER_DEFAULT = 48;\nexport const WEB_POPUP_ARROW_GUTTER_MIN = 28;\nexport const WEB_POPUP_ARROW_GUTTER_MAX = 120;\n/** The drawn triangle, px; its height is twice its width. */\nexport const WEB_POPUP_ARROW_WIDTH = 14;\nexport const WEB_POPUP_ARROW_HEIGHT = 28;\n/** The arrow's drop shadow, a css `filter`. */\nexport const WEB_POPUP_ARROW_SHADOW = 'drop-shadow(0 2px 4px rgba(16, 24, 40, 0.28))';\n/** The arrow triangle's svg polygon points, pointing to `side`. */\nexport function webPopupArrowPoints(side) {\n const w = WEB_POPUP_ARROW_WIDTH;\n const h = WEB_POPUP_ARROW_HEIGHT;\n return side === 'left' ? `${w},1 1,${h / 2} ${w},${h - 1}` : `0,1 ${w - 1},${h / 2} 0,${h - 1}`;\n}\n/** How much an arrow or the slide-out ✕ grows under the pointer. */\nexport const WEB_POPUP_CONTROL_HOVER_SCALE = 1.14;\n/** One control's slide in or out. */\nexport const WEB_POPUP_REVEAL_MS = 280;\nexport const WEB_POPUP_REVEAL_STAGGER_DEFAULT = 0.5;\n/** How long the pointer may be off the popup before the controls hide — crossing a gap is not leaving. */\nexport const WEB_POPUP_REVEAL_LEAVE_GRACE_MS = 750;\n/** The slide-out ✕ and its distance from the box corner, px. */\nexport const WEB_POPUP_SLIDE_CLOSE_SIZE = 28;\nexport const WEB_POPUP_SLIDE_CLOSE_GAP = 6;\n/** The slide-out ✕ grows by this factor while it slides out. */\nexport const WEB_POPUP_SLIDE_CLOSE_GROWTH = 1.5;\n/** The slide-out ✕ once out, px. */\nexport const WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE = Math.round(WEB_POPUP_SLIDE_CLOSE_SIZE * WEB_POPUP_SLIDE_CLOSE_GROWTH);","// Hand-authored 24×24 stroke geometry, inline (no icon package in a script that\n// loads on the customer's site). EXHAUSTIVE: a name without geometry won't compile.\nexport const WEB_POPUP_GLYPH_PATHS = {\n bell: 'M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0',\n gift: 'M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14' + 'M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z',\n cart: 'M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8' + 'M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0',\n chart: 'M3 21h18M7 21V11M12 21V6M17 21v-8',\n lock: 'M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3',\n calendar: 'M4 6h16v15H4zM4 10h16M9 3v4M15 3v4',\n check: 'M4 13l5 5L20 6',\n star: 'M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z',\n clock: 'M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2',\n tag: 'M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6' + 'l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0',\n mail: 'M3 6h18v12H3zM3 7l9 6 9-6',\n phone: 'M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4',\n download: 'M12 3v12M7 11l5 5 5-5M4 20h16',\n play: 'M8 5l12 7-12 7z',\n shield: 'M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z',\n sparkle: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z' + 'M18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z',\n percent: 'M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0',\n truck: 'M2 7h12v10H2zM14 10h4l3 3v4h-7' + 'M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0',\n ticket: 'M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12',\n user: 'M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0'\n};\n/** The icon names a `glyph` slot may carry — derived, never a second list. */\nexport const WEB_POPUP_GLYPH_NAMES = Object.keys(WEB_POPUP_GLYPH_PATHS);\n/** The sizes a glyph slot may take, px; the first is the normalization default. */\nexport const WEB_POPUP_GLYPH_SIZES = [24, 32, 48];\n/** The thumb a 'thumbs' rating draws; not author-selectable, so not in the whitelist. */\nexport const WEB_POPUP_THUMB_UP_PATH = 'M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4' + 'l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8';","import { WEB_POPUP_LAYOUT_MAX_DEPTH, WEB_POPUP_LAYOUT_MAX_NODES } from './constants';\n// Validation + css conversion for the embedded layout tree. The json is\n// API-writable and its styles land inline on customers' pages, so every prop\n// is normalized against a whitelist on parse: numbers are clamped, strings\n// must match a strict css-length/track pattern, enums fall back to defaults,\n// unknown props are dropped. Unknown node TYPES degrade instead of breaking:\n// a node with children renders as a Vertical stack (a container from a NEWER\n// editor keeps its content visible on an older engine build), a childless\n// unknown node is dropped.\nconst CONTAINER_TYPES = ['Vertical', 'Horizontal', 'Columns', 'Rows'];\nconst ORDERS = ['normal', 'reverse'];\nconst ALIGN_ITEMS = ['start', 'center', 'end', 'stretch'];\nconst JUSTIFY_CONTENT = ['start', 'center', 'end', 'space-between'];\nconst TEXT_ALIGNS = ['left', 'center', 'right'];\nconst TONES = ['default', 'inverse'];\nconst MAX_LENGTH_PX = 2000;\n// String lengths carry a unit — clamp each to its own sane ceiling, like the\n// numeric branch: a wire value (\"9999rem\" scales off the HOST page's root\n// font size) must not be able to blow the popup past the viewport.\nconst LENGTH_UNIT_MAX = {\n px: MAX_LENGTH_PX,\n '%': 100,\n em: 125,\n rem: 125\n};\nconst LENGTH_PATTERN = /^(\\d{1,4}(?:\\.\\d+)?)(px|%|em|rem)$/;\nconst TRACK_UNIT_MAX = {\n px: MAX_LENGTH_PX,\n '%': 100,\n fr: 100\n};\nconst TRACK_PATTERN = /^(\\d{1,4}(?:\\.\\d+)?)(px|%|fr)$/;\nconst TRACK_KEYWORDS = ['auto', 'min-content', 'max-content'];\nconst MAX_TRACKS = 12;\nfunction oneOf(value, allowed) {\n return allowed.includes(value) ? value : undefined;\n}\nfunction cssLength(value) {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.min(Math.max(value, 0), MAX_LENGTH_PX);\n }\n if (typeof value !== 'string') return undefined;\n const match = LENGTH_PATTERN.exec(value.trim());\n if (!match) return undefined;\n const [, amount, unit] = match;\n return `${Math.min(parseFloat(amount), LENGTH_UNIT_MAX[unit])}${unit}`;\n}\nconst BOX_SIDES = ['top', 'right', 'bottom', 'left'];\nfunction boxPadding(value) {\n const whole = cssLength(value);\n if (whole !== undefined) return whole;\n if (typeof value !== 'object' || value === null) return undefined;\n const sides = {};\n for (const side of BOX_SIDES) {\n const sideValue = cssLength(value[side]);\n if (sideValue !== undefined) sides[side] = sideValue;\n }\n return Object.keys(sides).length > 0 ? sides : undefined;\n}\nfunction trackSize(token) {\n if (TRACK_KEYWORDS.includes(token)) return token;\n const match = TRACK_PATTERN.exec(token);\n if (!match) return undefined;\n const [, amount, unit] = match;\n return `${Math.min(parseFloat(amount), TRACK_UNIT_MAX[unit])}${unit}`;\n}\nfunction trackSizes(value) {\n if (typeof value === 'number') {\n return Number.isInteger(value) && value >= 1 && value <= MAX_TRACKS ? value : undefined;\n }\n if (typeof value !== 'string') return undefined;\n const tokens = value.trim().split(/\\s+/);\n if (tokens.length < 1 || tokens.length > MAX_TRACKS) return undefined;\n const clamped = tokens.map(trackSize);\n return clamped.every(token => token !== undefined) ? clamped.join(' ') : undefined;\n}\nfunction nonEmptyString(value) {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\nfunction containerProps(raw) {\n const props = {};\n const gap = cssLength(raw.gap);\n if (gap !== undefined) props.gap = gap;\n const padding = boxPadding(raw.padding);\n if (padding !== undefined) props.padding = padding;\n const alignItems = oneOf(raw.alignItems, ALIGN_ITEMS);\n if (alignItems) props.alignItems = alignItems;\n const justifyContent = oneOf(raw.justifyContent, JUSTIFY_CONTENT);\n if (justifyContent) props.justifyContent = justifyContent;\n const alignContent = oneOf(raw.alignContent, JUSTIFY_CONTENT);\n if (alignContent) props.alignContent = alignContent;\n const backgroundImage = nonEmptyString(raw.backgroundImage);\n if (backgroundImage) props.backgroundImage = backgroundImage;\n const sizes = trackSizes(raw.sizes);\n if (sizes !== undefined) props.sizes = sizes;\n return props;\n}\nfunction normalizeNode(raw, depth, budget) {\n if (depth > WEB_POPUP_LAYOUT_MAX_DEPTH || budget.nodes <= 0) return null;\n if (typeof raw !== 'object' || raw === null) return null;\n budget.nodes -= 1;\n const node = raw;\n const props = typeof node.props === 'object' && node.props !== null ? node.props : {};\n if (node.type === 'Content') {\n const content = nonEmptyString(props.content);\n if (!content) return null;\n const out = {\n type: 'Content',\n props: {\n content\n }\n };\n const align = oneOf(props.align, TEXT_ALIGNS);\n if (align) out.props.align = align;\n const tone = oneOf(props.tone, TONES);\n if (tone && tone !== 'default') out.props.tone = tone;\n return out;\n }\n if (node.type === 'Image') {\n const image = nonEmptyString(props.image);\n if (!image) return null;\n const out = {\n type: 'Image',\n props: {\n image\n }\n };\n return out;\n }\n if (!Array.isArray(node.children)) return null;\n const type = oneOf(node.type, CONTAINER_TYPES) ?? 'Vertical';\n const children = [];\n for (const child of node.children) {\n const normalized = normalizeNode(child, depth + 1, budget);\n if (normalized) children.push(normalized);\n }\n const out = containerProps(props);\n // `order: 'reverse'` is applied right here and consumed: the normalized\n // tree carries the children already reordered (and the sizes template\n // reversed with them, so each child keeps its track) — the renderers and\n // the editor canvas never see the prop. Caveat for hand-authored json: the\n // \"keeps its track\" guarantee assumes one sizes token per child; with a\n // mismatched count the reversed template pairs children with different\n // tracks (grid itself would misalign such a template the same way).\n if (oneOf(props.order, ORDERS) === 'reverse') {\n children.reverse();\n if (typeof out.sizes === 'string') out.sizes = out.sizes.split(' ').reverse().join(' ');\n }\n return {\n type,\n props: out,\n children\n };\n}\n/**\n * Validate an embedded layout tree from the stored json. Returns the\n * normalized tree, or null when the value isn't a renderable tree at all —\n * the page is then dropped by resolveWebPopupPages.\n */\nexport function normalizeWebPopupLayout(raw) {\n return normalizeNode(raw, 0, {\n nodes: WEB_POPUP_LAYOUT_MAX_NODES\n });\n}\n// --- value substitution ($refs) ---------------------------------------------\n/** A page value key, as referenced from the tree by a `$key` token. */\nexport const WEB_POPUP_VALUE_KEY_PATTERN = /^[a-zA-Z][a-zA-Z0-9-]*$/;\nconst VALUE_REF_PATTERN = /^\\$([a-zA-Z][a-zA-Z0-9-]*)$/;\n// Every whitespace-separated token of the form $key is replaced; separators\n// survive, so both a whole-string prop ('$stackGap') and a token inside a\n// sizes template ('1fr $imageWidth') substitute with the same rule. An\n// unknown key stays as-is and fails the prop whitelist downstream — the prop\n// is dropped, same as any invalid literal.\nfunction substituteString(value, values) {\n if (!value.includes('$')) return value;\n return value.split(/(\\s+)/).map(token => {\n const key = VALUE_REF_PATTERN.exec(token)?.[1];\n // Own properties only: '$constructor' must stay an unknown ref, not\n // resolve to an Object.prototype member.\n return key !== undefined && Object.prototype.hasOwnProperty.call(values, key) ? values[key] : token;\n }).join('');\n}\n/**\n * Substitute a page's named values into its RAW layout tree — `$key` tokens\n * in string props become the values, verbatim. Runs BEFORE\n * normalizeWebPopupLayout (see resolveWebPopupPages), so a substituted value\n * passes exactly the whitelists/clamps a literal one would; substitution is\n * single-pass and normalizeWebPopupValues rejects values containing '$', so\n * refs can't chain. Binding keys (`content`, `image`, `backgroundImage`) are\n * never substituted — they already name params by design.\n */\nexport function substituteWebPopupLayoutValues(layout, values) {\n if (typeof layout !== 'object' || layout === null || Object.keys(values).length === 0) return layout;\n return substituteNode(layout, values, 0);\n}\nconst BINDING_PROPS = new Set(['content', 'image', 'backgroundImage']);\nfunction substituteNode(raw, values, depth) {\n if (depth > WEB_POPUP_LAYOUT_MAX_DEPTH || typeof raw !== 'object' || raw === null) return raw;\n const node = raw;\n const out = {\n ...node\n };\n if (typeof node.props === 'object' && node.props !== null) {\n const props = {\n ...node.props\n };\n for (const [key, value] of Object.entries(props)) {\n if (BINDING_PROPS.has(key)) continue;\n if (typeof value === 'string') {\n props[key] = substituteString(value, values);\n } else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Per-side paddings: one level of string sides.\n const sides = {\n ...value\n };\n for (const [side, sideValue] of Object.entries(sides)) {\n if (typeof sideValue === 'string') sides[side] = substituteString(sideValue, values);\n }\n props[key] = sides;\n }\n }\n out.props = props;\n }\n if (Array.isArray(node.children)) {\n out.children = node.children.map(child => substituteNode(child, values, depth + 1));\n }\n return out;\n}\n// --- css conversion (shared by the reader and the editor's canvas) ---------\nexport function webPopupCssLength(value) {\n return typeof value === 'number' ? `${value}px` : value;\n}\nexport function webPopupPaddingValue(padding) {\n if (typeof padding === 'number' || typeof padding === 'string') return webPopupCssLength(padding);\n const side = value => value === undefined ? '0' : webPopupCssLength(value);\n return `${side(padding.top)} ${side(padding.right)} ${side(padding.bottom)} ${side(padding.left)}`;\n}\n/** grid-template value for Columns/Rows: absent sizes = one 1fr per child. */\nexport function webPopupTracksValue(sizes, childCount) {\n if (typeof sizes === 'string') return sizes;\n const count = typeof sizes === 'number' ? sizes : Math.max(childCount, 1);\n return `repeat(${count}, 1fr)`;\n}\n// The scrim as a standalone gradient, for the layers that can't stack it in\n// the same background property (a background VIDEO paints its own element).\nexport function webPopupScrimGradient(dim = 0) {\n if (!(dim > 0)) return null;\n const scrim = `rgba(16, 24, 40, ${Math.min(dim, 1)})`;\n return `linear-gradient(${scrim}, ${scrim})`;\n}\n/**\n * The cover-background css of a container that draws an image behind its\n * content. `dim` (0–1) is the image's scrim — a dark translucent layer\n * painted as a gradient stacked over the url() in the same property, so it\n * needs no extra element and rides along wherever the background is drawn.\n */\nexport function webPopupBackgroundImageStyle(src, dim = 0) {\n // JSON.stringify quotes + escapes the url, so an src can't break out of\n // the css function.\n const image = `url(${JSON.stringify(src)})`;\n const scrim = webPopupScrimGradient(dim);\n return {\n backgroundImage: scrim ? `${scrim}, ${image}` : image,\n backgroundSize: 'cover',\n backgroundPosition: 'center'\n };\n}\n/**\n * The inline style of a container node — grid, mirroring kit-helpers'\n * Vertical/Horizontal/Columns/Rows semantics. The background image is passed\n * resolved (looked up in the page's images by the caller) so this stays a\n * pure props → css mapping.\n */\nexport function webPopupContainerStyle(node, backgroundSrc, backgroundDim = 0) {\n const props = node.props ?? {};\n const style = {\n display: 'grid',\n minWidth: 0\n };\n if (node.type === 'Horizontal') style.gridAutoFlow = 'column';\n if (node.type === 'Columns') style.gridTemplateColumns = webPopupTracksValue(props.sizes, node.children.length);\n if (node.type === 'Rows') style.gridTemplateRows = webPopupTracksValue(props.sizes, node.children.length);\n if (props.gap !== undefined) style.gap = webPopupCssLength(props.gap);\n if (props.padding !== undefined) style.padding = webPopupPaddingValue(props.padding);\n if (props.alignItems) style.alignItems = props.alignItems;\n if (props.justifyContent) style.justifyContent = props.justifyContent;\n if (props.alignContent) style.alignContent = props.alignContent;\n if (backgroundSrc) Object.assign(style, webPopupBackgroundImageStyle(backgroundSrc, backgroundDim));\n return style;\n}","// Scheme resolution for the popup palette: the authored light/dark roles plus\n// the derived ones (input surface, borders, the label over an accent fill).\nimport { WEB_POPUP_DEFAULT_COLORS, WEB_POPUP_FORM_ERROR_COLOR, WEB_POPUP_FORM_ERROR_COLOR_DARK, WEB_POPUP_FORM_INPUT_BORDER, WEB_POPUP_ON_ACCENT_COLOR, WEB_POPUP_TEXT_COLOR, WEB_POPUP_TEXT_SECONDARY_COLOR } from './constants';\nconst HEX_RE = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;\nfunction parseHex(color) {\n const hex = HEX_RE.exec(color.trim())?.[1];\n if (!hex) return null;\n const full = hex.length === 3 ? hex.split('').map(c => c + c).join('') : hex;\n return [0, 2, 4].map(i => parseInt(full.slice(i, i + 2), 16));\n}\nfunction toHex([r, g, b]) {\n return `#${[r, g, b].map(v => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0')).join('')}`;\n}\nfunction rgbToHsl([r, g, b]) {\n const [rn, gn, bn] = [r / 255, g / 255, b / 255];\n const max = Math.max(rn, gn, bn);\n const min = Math.min(rn, gn, bn);\n const l = (max + min) / 2;\n if (max === min) return [0, 0, l];\n const d = max - min;\n const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n let h;\n if (max === rn) h = (gn - bn) / d + (gn < bn ? 6 : 0);else if (max === gn) h = (bn - rn) / d + 2;else h = (rn - gn) / d + 4;\n return [h / 6, s, l];\n}\nfunction hueToChannel(p, q, t) {\n let tn = t;\n if (tn < 0) tn += 1;\n if (tn > 1) tn -= 1;\n if (tn < 1 / 6) return p + (q - p) * 6 * tn;\n if (tn < 1 / 2) return q;\n if (tn < 2 / 3) return p + (q - p) * (2 / 3 - tn) * 6;\n return p;\n}\nfunction hslToRgb([h, s, l]) {\n if (s === 0) {\n const v = l * 255;\n return [v, v, v];\n }\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n return [hueToChannel(p, q, h + 1 / 3) * 255, hueToChannel(p, q, h) * 255, hueToChannel(p, q, h - 1 / 3) * 255];\n}\n// Mirror the light half onto [0.07, 0.5]: #FFFFFF lands on the dark canvas\n// tone and near-whites stay apart instead of collapsing into one floor.\nfunction foldLightness(l) {\n return l > 0.5 ? 0.07 + (1 - l) * ((0.5 - 0.07) / 0.5) : l;\n}\n// Mirror the dark half onto [0.5, 0.93]: #000000 lands short of glaring white.\nfunction liftLightness(l) {\n return l < 0.5 ? 0.93 - l * ((0.93 - 0.5) / 0.5) : l;\n}\n/** Hue and saturation survive; only lightness moves. Non-hex colors pass through. */\nexport function webPopupShiftColor(color, direction) {\n const rgb = parseHex(color);\n if (!rgb) return color;\n const [h, s, l] = rgbToHsl(rgb);\n return toHex(hslToRgb([h, s, direction === 'fold' ? foldLightness(l) : liftLightness(l)]));\n}\n/** `ratio` of `over` blended into `base`; either color non-hex = `base` unchanged. */\nexport function webPopupMixColor(base, over, ratio) {\n const a = parseHex(base);\n const b = parseHex(over);\n if (!a || !b) return base;\n return toHex(a.map((v, i) => v + (b[i] - v) * ratio));\n}\n/** `color` at `alpha` as rgba(); a non-hex color renders full-strength instead of being guessed at. */\nexport function webPopupColorAlpha(color, alpha) {\n const rgb = parseHex(color);\n if (!rgb || alpha >= 1) return color;\n const [r, g, b] = rgb;\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\nfunction isLightColor(color) {\n const rgb = parseHex(color);\n if (!rgb) return false;\n // Perceived luminance, not HSL lightness: #FFFF00 and #0000FF share l = 0.5.\n const [r, g, b] = rgb;\n return (0.299 * r + 0.587 * g + 0.114 * b) / 255 > 0.6;\n}\n// The dark counterpart of a light palette: text lifts, surfaces fold, the\n// accent and the over-image inverse color stay as authored.\nexport function autoDarkWebPopupColors(light) {\n return {\n background: webPopupShiftColor(light.background, 'fold'),\n accent: light.accent,\n text: webPopupShiftColor(light.text, 'lift'),\n textSecondary: webPopupShiftColor(light.textSecondary, 'lift'),\n textInverse: light.textInverse\n };\n}\n// Light keeps the values the popup shipped with before dark mode existed\n// (white cards, grey border, white label) — enabling dark must not restyle it.\nfunction derivedColors(colors, scheme) {\n if (scheme === 'light') {\n return {\n surface: WEB_POPUP_DEFAULT_COLORS.background,\n surfaceText: WEB_POPUP_TEXT_COLOR,\n border: WEB_POPUP_FORM_INPUT_BORDER,\n onAccent: WEB_POPUP_ON_ACCENT_COLOR,\n error: WEB_POPUP_FORM_ERROR_COLOR,\n chromeIcon: WEB_POPUP_TEXT_SECONDARY_COLOR\n };\n }\n return {\n surface: webPopupMixColor(colors.background, colors.text, 0.08),\n surfaceText: colors.text,\n border: webPopupMixColor(colors.background, colors.text, 0.24),\n onAccent: isLightColor(colors.accent) ? WEB_POPUP_TEXT_COLOR : WEB_POPUP_ON_ACCENT_COLOR,\n error: WEB_POPUP_FORM_ERROR_COLOR_DARK,\n chromeIcon: colors.textSecondary\n };\n}\n/** The dark palette a popup renders with: authored roles over the autogenerated ones. */\nexport function webPopupDarkColors(light, dark) {\n return {\n ...autoDarkWebPopupColors(light),\n ...(dark?.colors ?? {})\n };\n}\n/** True when the popup opts into dark mode at all — the host's cue to watch the media query. */\nexport function webPopupDarkEnabled(chrome) {\n return chrome.dark?.enabled === true;\n}\n/** The scheme a popup actually draws with: 'dark' only when it opts in. */\nexport function webPopupEffectiveScheme(chrome, scheme = 'light') {\n return scheme === 'dark' && webPopupDarkEnabled(chrome) ? 'dark' : 'light';\n}\n// Every color a renderer needs, for the scheme actually drawn. Asking for\n// 'dark' on a popup without dark mode returns the light palette.\nexport function resolveWebPopupColors(chrome, scheme = 'light') {\n const effective = webPopupEffectiveScheme(chrome, scheme);\n const colors = effective === 'dark' ? webPopupDarkColors(chrome.colors, chrome.dark) : chrome.colors;\n return {\n ...colors,\n scheme: effective,\n ...derivedColors(colors, effective)\n };\n}\n/** The url drawn for `scheme`; a dark source only exists when authored. */\nexport function webPopupImageSrc(image, scheme = 'light') {\n return scheme === 'dark' && image.srcDark ? image.srcDark : image.src;\n}\n/** The page dim and box shadow for the scheme actually drawn; the light ones\n * stand in wherever the dark palette authored no override. */\nexport function resolveWebPopupBoxChrome(chrome, scheme = 'light') {\n if (webPopupEffectiveScheme(chrome, scheme) === 'light') {\n return {\n overlay: chrome.overlay,\n boxShadow: chrome.boxShadow\n };\n }\n return {\n overlay: chrome.dark?.overlay ?? chrome.overlay,\n boxShadow: chrome.dark?.boxShadow ?? chrome.boxShadow\n };\n}","// Countdown math: `endTime` is a LOCAL WALL CLOCK in `timezone` (empty = UTC),\n// never an instant. Pure, `now` passed in — the renderer ticks, this computes.\nconst WALL_CLOCK = /^(\\d{4})-(\\d{2})-(\\d{2})[T ](\\d{2}):(\\d{2})(?::(\\d{2}))?$/;\n// One formatter per zone: the reader asks for the remainder once a second per\n// timer slot, and constructing an Intl.DateTimeFormat is the expensive part.\nconst zoneFormatters = new Map();\nfunction zoneFormatter(timeZone) {\n const cached = zoneFormatters.get(timeZone);\n if (cached) return cached;\n try {\n const formatter = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hour12: false,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n });\n zoneFormatters.set(timeZone, formatter);\n return formatter;\n } catch {\n // An unknown/unsupported IANA name — the engine can't place a wall clock in it.\n return null;\n }\n}\n/** Can this engine compute offsets in the zone? Empty = the contract's UTC, so supported. */\nexport function webPopupTimeZoneSupported(timezone) {\n return !timezone || zoneFormatter(timezone) !== null;\n}\n// The zone's offset from UTC at an instant, in ms: render local parts, read\n// them back as if they were UTC, take the difference.\nfunction zoneOffsetMs(instantMs, formatter) {\n const parts = formatter.formatToParts(new Date(instantMs));\n const read = type => Number(parts.find(part => part.type === type)?.value ?? '0');\n // hour12: false still renders midnight as '24' in some engines.\n const asUtc = Date.UTC(read('year'), read('month') - 1, read('day'), read('hour') % 24, read('minute'), read('second'));\n return asUtc - instantMs;\n}\nconst DAY_MS = 86400000;\n// Every offset that can apply to a wall clock this close to a DST switch: the\n// day before, the naive instant, the day after.\nfunction candidateOffsets(wallAsUtc, formatter) {\n const offsets = [];\n for (const probe of [wallAsUtc - DAY_MS, wallAsUtc, wallAsUtc + DAY_MS]) {\n const offset = zoneOffsetMs(probe, formatter);\n if (!offsets.includes(offset)) offsets.push(offset);\n }\n return offsets;\n}\n// The reader asks for the remainder once a second per slot, and the deadline\n// never moves; a handful of entries, cleared wholesale if a document is absurd.\nconst deadlines = new Map();\n/** The instant (epoch ms) a wall clock names in a zone, or null when this engine can't place it. */\nexport function webPopupWallClockMs(endTime, timezone) {\n const cacheKey = `${endTime}|${timezone}`;\n const cached = deadlines.get(cacheKey);\n if (cached !== undefined) return cached;\n const resolved = resolveWallClockMs(endTime, timezone);\n if (deadlines.size > 100) deadlines.clear();\n deadlines.set(cacheKey, resolved);\n return resolved;\n}\nfunction resolveWallClockMs(endTime, timezone) {\n const match = WALL_CLOCK.exec((endTime || '').trim());\n if (!match) return null;\n const [, year, month, day, hour, minute, rawSecond] = match.map(Number);\n // The seconds group is optional — an absent one reads as NaN, not 0.\n const second = Number.isNaN(rawSecond) ? 0 : rawSecond;\n if (month < 1 || month > 12 || day < 1 || day > 31) return null;\n if (hour > 23 || minute > 59 || second > 59) return null;\n const wallAsUtc = Date.UTC(year, month - 1, day, hour, minute, second);\n // Date.UTC rolls impossible days over (Feb 30 → Mar 2); reject instead.\n const rolled = new Date(wallAsUtc);\n if (rolled.getUTCMonth() !== month - 1 || rolled.getUTCDate() !== day) return null;\n if (!timezone) return wallAsUtc;\n const formatter = zoneFormatter(timezone);\n if (!formatter) return null;\n // One rule for every zone, whatever the sign of its offset: an offset counts\n // when the instant it produces reads back as the wall clock asked for.\n const offsets = candidateOffsets(wallAsUtc, formatter);\n const instants = offsets.filter(offset => zoneOffsetMs(wallAsUtc - offset, formatter) === offset).map(offset => wallAsUtc - offset);\n // An ambiguous wall clock (fall back) takes the FIRST of its two instants.\n if (instants.length > 0) return Math.min(...instants);\n // None reads back: the wall clock is inside a spring-forward gap. The pre-gap\n // offset is the smaller one, so this rolls forward to just past the gap.\n return wallAsUtc - Math.min(...offsets);\n}\n/** What's left at `nowMs`, by unit; a passed OR uncomputable deadline reads as all zeros. */\nexport function webPopupTimerRemaining(endTime, timezone, nowMs) {\n const deadline = webPopupWallClockMs(endTime, timezone);\n const total = deadline === null ? 0 : Math.max(0, deadline - nowMs);\n const seconds = Math.floor(total / 1000);\n return {\n total,\n days: Math.floor(seconds / 86400),\n hours: Math.floor(seconds / 3600) % 24,\n minutes: Math.floor(seconds / 60) % 60,\n seconds: seconds % 60\n };\n}\n// Unit labels by ISO 639-1 code, the editor's 14 languages; anything else = English.\n// NOTE: not written by native speakers — worth a review before customers see them.\nconst TIMER_LABELS = {\n en: {\n days: 'Days',\n hours: 'Hours',\n minutes: 'Minutes',\n seconds: 'Seconds'\n },\n ru: {\n days: 'Дни',\n hours: 'Часы',\n minutes: 'Минуты',\n seconds: 'Секунды'\n },\n de: {\n days: 'Tage',\n hours: 'Stunden',\n minutes: 'Minuten',\n seconds: 'Sekunden'\n },\n es: {\n days: 'Días',\n hours: 'Horas',\n minutes: 'Minutos',\n seconds: 'Segundos'\n },\n fr: {\n days: 'Jours',\n hours: 'Heures',\n minutes: 'Minutes',\n seconds: 'Secondes'\n },\n pt: {\n days: 'Dias',\n hours: 'Horas',\n minutes: 'Minutos',\n seconds: 'Segundos'\n },\n ja: {\n days: '日',\n hours: '時間',\n minutes: '分',\n seconds: '秒'\n },\n ko: {\n days: '일',\n hours: '시간',\n minutes: '분',\n seconds: '초'\n },\n zh: {\n days: '天',\n hours: '小时',\n minutes: '分',\n seconds: '秒'\n },\n hi: {\n days: 'दिन',\n hours: 'घंटे',\n minutes: 'मिनट',\n seconds: 'सेकंड'\n },\n bn: {\n days: 'দিন',\n hours: 'ঘণ্টা',\n minutes: 'মিনিট',\n seconds: 'সেকেন্ড'\n },\n ar: {\n days: 'أيام',\n hours: 'ساعات',\n minutes: 'دقائق',\n seconds: 'ثوان'\n },\n he: {\n days: 'ימים',\n hours: 'שעות',\n minutes: 'דקות',\n seconds: 'שניות'\n },\n th: {\n days: 'วัน',\n hours: 'ชั่วโมง',\n minutes: 'นาที',\n seconds: 'วินาที'\n }\n};\n/** The unit labels for a language code; empty/unknown = English. */\nexport function webPopupTimerLabels(language) {\n return TIMER_LABELS[language] ?? TIMER_LABELS.en;\n}","const RTL_LETTER = /[\\p{Script=Arabic}\\p{Script=Hebrew}\\p{Script=Syriac}\\p{Script=Thaana}\\p{Script=Nko}\\p{Script=Samaritan}\\p{Script=Mandaic}\\p{Script=Adlam}\\p{Script=Hanifi_Rohingya}\\p{Script=Mende_Kikakui}\\p{Script=Yezidi}]/u;\nconst LETTER = /\\p{L}/u;\nconst NOT_COPY = /<[^>]*>|\\{\\{[\\s\\S]*?\\}\\}|\\{%[\\s\\S]*?%\\}/g;\n/** 'rtl' when most letters of the copy read right to left; markup and Liquid do not vote. */\nexport function detectTextDirection(...texts) {\n let rtl = 0;\n let ltr = 0;\n for (const char of texts.join(' ').replace(NOT_COPY, '')) {\n if (RTL_LETTER.test(char)) {\n rtl += 1;\n } else if (LETTER.test(char)) {\n ltr += 1;\n }\n }\n return rtl > ltr ? 'rtl' : 'ltr';\n}","import { SAFE_URL_PROTOCOL, WEB_POPUP_CHOICE_DEFAULTS, WEB_POPUP_CONSENT_DEFAULTS, WEB_POPUP_DEFAULT_COLORS, WEB_POPUP_EMAIL_INPUT_DEFAULTS, WEB_POPUP_FORM_DEFAULTS, WEB_POPUP_MAX_CHOICE_OPTIONS, WEB_POPUP_PRODUCTS_DEFAULTS, WEB_POPUP_PRODUCTS_MAX_LIMIT, WEB_POPUP_RATING_DEFAULTS, WEB_POPUP_SUBMIT_DEFAULTS, WEB_POPUP_TAG_INPUT_DEFAULTS, WEB_POPUP_VERSION, WEB_POPUP_ARROW_GUTTER_DEFAULT, WEB_POPUP_ARROW_GUTTER_MAX, WEB_POPUP_ARROW_GUTTER_MIN, WEB_POPUP_REVEAL_STAGGER_DEFAULT } from './constants';\nimport { WEB_POPUP_GLYPH_NAMES, WEB_POPUP_GLYPH_SIZES } from './glyphs';\nimport { normalizeWebPopupLayout, substituteWebPopupLayoutValues, WEB_POPUP_VALUE_KEY_PATTERN } from './layout';\nimport { autoDarkWebPopupColors } from './palette';\nimport { webPopupTimerLabels, webPopupTimeZoneSupported, webPopupWallClockMs } from './timer';\nimport { detectTextDirection } from '../shared/textDirection';\n// Sanitize a user-entered button URL before it lands in an href: https/http/\n// mailto/tel and page-relative links only.\nexport function safeUrl(url) {\n const trimmed = (url || '').trim();\n if (!trimmed) return undefined;\n if (trimmed.startsWith('#') || trimmed.startsWith('/') || trimmed.startsWith('?')) return trimmed;\n if (SAFE_URL_PROTOCOL.test(trimmed)) return trimmed;\n return undefined;\n}\n/**\n * The target/rel pair a popup link renders with: only an exact '_self' opts\n * out of the default new tab (and of its noreferrer, which same-tab\n * navigation doesn't need). One rule for both link kinds — the reader's\n * button anchors and the sanitizer's inline text links.\n */\nexport function webPopupLinkTargetAttrs(target) {\n return target === '_self' ? {\n target: '_self'\n } : {\n target: '_blank',\n rel: 'noreferrer'\n };\n}\n/**\n * Carries out a subscribe button's setting for the visitor's answer.\n * A new tab opens with noopener, so `window.open` returns null and a blocked tab goes unnoticed.\n */\nexport function applyWebPopupSubscribeOutcome(action, result, logger) {\n const outcome = result === 'granted' ? action.onGranted : action.onDenied;\n if (outcome?.type === 'href') openWebPopupSubscribeLink(outcome, logger);\n if (outcome?.type === 'page') return {\n page: outcome.page\n };\n // Granted always closes, as before the setting; denied closes only when set to.\n if (result === 'granted' || outcome?.type === 'close') return 'close';\n return 'stay';\n}\nfunction openWebPopupSubscribeLink(outcome, logger) {\n const href = typeof outcome.url === 'string' ? safeUrl(outcome.url) : undefined;\n if (!href) {\n logger?.warn('Subscribe button: the link to open after the answer is empty or unsafe, it was not opened');\n return;\n }\n if (outcome.target === '_self') {\n window.location.assign(href);\n return;\n }\n window.open(href, '_blank', 'noopener,noreferrer');\n}\nconst SANITIZE_ALLOWED_TAGS = new Set(['STRONG', 'B', 'EM', 'I', 'U', 'BR', 'A']);\nfunction copySanitized(from, to, doc) {\n for (const child of Array.from(from.childNodes)) {\n if (child.nodeType === 3 /* text */) {\n to.appendChild(doc.createTextNode(child.textContent ?? ''));\n continue;\n }\n if (child.nodeType !== 1 /* element */) continue;\n const el = child;\n // Unknown tags are unwrapped — their children survive as plain content.\n if (!SANITIZE_ALLOWED_TAGS.has(el.tagName)) {\n copySanitized(el, to, doc);\n continue;\n }\n const clean = doc.createElement(el.tagName.toLowerCase());\n if (el.tagName === 'A') {\n const href = safeUrl(el.getAttribute('href') ?? undefined);\n if (href) clean.setAttribute('href', href);\n const {\n target,\n rel\n } = webPopupLinkTargetAttrs(el.getAttribute('target'));\n clean.setAttribute('target', target);\n if (rel) clean.setAttribute('rel', rel);\n }\n to.appendChild(clean);\n copySanitized(el, clean, doc);\n }\n}\n/**\n * Sanitize a text slot's html before it's injected into the page. The editor\n * only ever writes inline formatting, but the json travels through a public\n * API and renders on customers' sites — so on render only the inline tags\n * survive (anything else is unwrapped to its text), every attribute is\n * dropped, and links keep only a safeUrl-approved href plus their tab choice\n * (target=\"_self\" stays; everything else opens in a new tab).\n */\nexport function sanitizeWebPopupHtml(html) {\n // No '<' → no elements can form; entities in plain text are already-valid\n // html and pass through untouched.\n if (!html.includes('<')) return html;\n const parsed = new DOMParser().parseFromString(html, 'text/html');\n const out = parsed.createElement('div');\n copySanitized(parsed.body, out, parsed);\n return out.innerHTML;\n}\nfunction colorString(value) {\n return typeof value === 'string' && value ? value : undefined;\n}\n/**\n * The popup palette from API-writable params: `colors` entries when present,\n * the legacy top-level background/accent underneath, palette defaults for the\n * rest — always a complete WebPopupColors.\n */\nexport function normalizeWebPopupColors(params) {\n const colors = typeof params.colors === 'object' && params.colors !== null ? params.colors : {};\n return {\n background: colorString(colors.background) ?? colorString(params.background) ?? WEB_POPUP_DEFAULT_COLORS.background,\n accent: colorString(colors.accent) ?? colorString(params.accent) ?? WEB_POPUP_DEFAULT_COLORS.accent,\n text: colorString(colors.text) ?? WEB_POPUP_DEFAULT_COLORS.text,\n textSecondary: colorString(colors.textSecondary) ?? WEB_POPUP_DEFAULT_COLORS.textSecondary,\n textInverse: colorString(colors.textInverse) ?? WEB_POPUP_DEFAULT_COLORS.textInverse\n };\n}\n// A page dim from API-writable json: both fields or nothing, opacity clamped.\nfunction normalizeOverlay(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const overlay = raw;\n const color = colorString(overlay.color);\n if (!color) return undefined;\n const opacity = typeof overlay.opacity === 'number' && Number.isFinite(overlay.opacity) ? Math.max(0, Math.min(1, overlay.opacity)) : 1;\n return {\n color,\n opacity\n };\n}\n// Authored dark entries over the ones autogenerated from the light palette.\n// Absent `dark` = no dark mode; an authored palette switched off is not that.\nexport function normalizeWebPopupDark(params, light) {\n const raw = params.dark;\n if (typeof raw !== 'object' || raw === null) return undefined;\n const dark = raw;\n const authored = typeof dark.colors === 'object' && dark.colors !== null ? dark.colors : {};\n const auto = autoDarkWebPopupColors(light);\n const overlay = normalizeOverlay(dark.overlay);\n return {\n enabled: dark.enabled === true,\n colors: {\n background: colorString(authored.background) ?? auto.background,\n accent: colorString(authored.accent) ?? auto.accent,\n text: colorString(authored.text) ?? auto.text,\n textSecondary: colorString(authored.textSecondary) ?? auto.textSecondary,\n textInverse: colorString(authored.textInverse) ?? auto.textInverse\n },\n ...(overlay ? {\n overlay\n } : {}),\n ...(colorString(dark.boxShadow) ? {\n boxShadow: dark.boxShadow\n } : {})\n };\n}\n// Parse stored PopupFormContent.json into the popup model. Returns null for\n// anything that isn't a version-2 popup with at least one page — including\n// the retired version-1 flat-layout format and pre-engine content with no\n// `version` field at all, which callers should treat as broken. The palette\n// comes out complete: colors entries → legacy top-level background/accent →\n// defaults.\nexport function parseWebPopupJson(json) {\n let raw;\n try {\n raw = JSON.parse(json);\n } catch {\n return null;\n }\n if (typeof raw !== 'object' || raw === null) return null;\n const candidate = raw;\n if (candidate.version !== WEB_POPUP_VERSION) return null;\n const params = candidate.params;\n if (typeof params !== 'object' || params === null) return null;\n if (!Array.isArray(params.pages) || params.pages.length === 0) return null;\n const colors = normalizeWebPopupColors(params);\n const dark = normalizeWebPopupDark(params, colors);\n return {\n version: WEB_POPUP_VERSION,\n params: {\n ...params,\n colors,\n ...(dark ? {\n dark\n } : {})\n }\n };\n}\n/** The editor's save path: model → PopupFormContent.json string. */\nexport function stringifyWebPopup(params) {\n const compat = {\n ...params,\n background: params.colors.background,\n accent: params.colors.accent\n };\n const payload = {\n version: WEB_POPUP_VERSION,\n params: compat\n };\n return JSON.stringify(payload);\n}\nconst IMAGE_FITS = ['cover', 'contain'];\nconst MAX_IMAGE_BLUR = 100;\n// Bomb protection for the page content, mirroring the layout tree's\n// depth/node caps: the tree allows up to ~100 Content nodes and several may\n// reference the same zone, so unbounded zones/slots would amplify into\n// thousands of sanitize+render passes on the customer's page.\nconst MAX_IMAGES = 20;\nconst MAX_ZONES = 20;\nconst MAX_ZONE_SLOTS = 50;\n// A media param's video, or undefined when it has none / an unusable url —\n// then the param stays a plain image and the poster is all that renders.\nfunction normalizeVideo(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const video = raw;\n const src = safeUrl(typeof video.src === 'string' ? video.src : undefined);\n if (!src) return undefined;\n return {\n src,\n ...(video.controls === true ? {\n controls: true\n } : {}),\n ...(video.loop === false ? {\n loop: false\n } : {})\n };\n}\n// The images come from API-writable json — keep only well-formed entries,\n// with the presentation props (fit/blur) validated like the layout tree's.\nfunction normalizeImages(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const img of raw) {\n if (out.length >= MAX_IMAGES) break;\n if (typeof img !== 'object' || img === null) continue;\n if (typeof img.key !== 'string' || !img.key) continue;\n if (typeof img.src !== 'string') continue;\n const video = normalizeVideo(img.video);\n out.push({\n key: img.key,\n label: typeof img.label === 'string' ? img.label : '',\n src: img.src,\n ...(typeof img.srcDark === 'string' && img.srcDark ? {\n srcDark: img.srcDark\n } : {}),\n ...(video ? {\n video\n } : {}),\n ...(typeof img.mediaId === 'string' && img.mediaId ? {\n mediaId: img.mediaId\n } : {}),\n ...(typeof img.mediaIdDark === 'string' && img.mediaIdDark ? {\n mediaIdDark: img.mediaIdDark\n } : {}),\n ...(IMAGE_FITS.includes(img.fit) ? {\n fit: img.fit\n } : {}),\n ...(typeof img.blur === 'number' && Number.isFinite(img.blur) && img.blur > 0 ? {\n blur: Math.min(img.blur, MAX_IMAGE_BLUR)\n } : {}),\n ...(typeof img.dim === 'number' && Number.isFinite(img.dim) && img.dim > 0 ? {\n dim: Math.min(img.dim, 1)\n } : {})\n });\n }\n return out;\n}\nconst MAX_VALUES = 20;\nconst MAX_VALUE_LENGTH = 64;\nconst MAX_SELECT_OPTIONS = 20;\nconst LENGTH_CONTROL_UNITS = ['px', '%', 'em', 'rem', 'fr'];\nfunction finiteNumber(value) {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n// Per-unit { min?, max? } overrides for a length control, keyed by a\n// whitelisted unit. Non-object input, unknown unit keys and non-finite bounds\n// are dropped; an all-empty map returns undefined so the field is omitted.\nfunction normalizeControlRanges(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const out = {};\n for (const unit of LENGTH_CONTROL_UNITS) {\n const entry = raw[unit];\n if (typeof entry !== 'object' || entry === null) continue;\n const min = finiteNumber(entry.min);\n const max = finiteNumber(entry.max);\n if (min === undefined && max === undefined) continue;\n out[unit] = {\n ...(min !== undefined ? {\n min\n } : {}),\n ...(max !== undefined ? {\n max\n } : {})\n };\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n// The control is editor metadata from API-writable json: enum-whitelisted\n// kind, clamped numbers, capped options. Anything malformed drops to\n// undefined — the editor falls back to a plain text input.\nfunction normalizeValueControl(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const control = raw;\n if (control.kind === 'text') return {\n kind: 'text'\n };\n if (control.kind === 'length' || control.kind === 'percent') {\n const min = finiteNumber(control.min);\n const max = finiteNumber(control.max);\n const units = control.kind === 'length' && Array.isArray(control.units) ? control.units.filter(u => LENGTH_CONTROL_UNITS.includes(u)) : [];\n // Per-unit min/max overrides: whitelisted unit keys, finite bounds. Any\n // malformed entry is skipped; an empty result drops the whole field.\n const ranges = control.kind === 'length' ? normalizeControlRanges(control.ranges) : undefined;\n return {\n kind: control.kind,\n ...(min !== undefined ? {\n min\n } : {}),\n ...(max !== undefined ? {\n max\n } : {}),\n ...(units.length > 0 ? {\n units\n } : {}),\n ...(ranges ? {\n ranges\n } : {})\n };\n }\n if (control.kind === 'select' && Array.isArray(control.options)) {\n const options = [];\n for (const option of control.options) {\n if (options.length >= MAX_SELECT_OPTIONS) break;\n if (typeof option !== 'object' || option === null) continue;\n if (typeof option.value !== 'string' || option.value.length > MAX_VALUE_LENGTH) continue;\n options.push({\n value: option.value,\n label: typeof option.label === 'string' ? option.label : option.value\n });\n }\n if (options.length > 0) return {\n kind: 'select',\n options\n };\n }\n return undefined;\n}\n/**\n * The page's named layout values from API-writable json: capped count,\n * whitelisted keys, short '$'-free value strings (substitution is single-pass\n * and this keeps refs from even *looking* chainable), validated controls.\n */\nexport function normalizeWebPopupValues(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const value of raw) {\n if (out.length >= MAX_VALUES) break;\n if (typeof value !== 'object' || value === null) continue;\n if (typeof value.key !== 'string' || !WEB_POPUP_VALUE_KEY_PATTERN.test(value.key)) continue;\n if (typeof value.value !== 'string' || value.value.length > MAX_VALUE_LENGTH || value.value.includes('$')) continue;\n if (out.some(v => v.key === value.key)) continue;\n const control = normalizeValueControl(value.control);\n out.push({\n key: value.key,\n label: typeof value.label === 'string' ? value.label : '',\n value: value.value,\n ...(control ? {\n control\n } : {})\n });\n }\n return out;\n}\n/** The values as a substitution map (see substituteWebPopupLayoutValues). */\nexport function webPopupValuesMap(values) {\n return Object.fromEntries(values.map(v => [v.key, v.value]));\n}\nconst FORM_FIELD_KINDS = ['email', 'firstName', 'lastName', 'phone', 'custom'];\nconst BUTTON_VARIANTS = ['primary', 'secondary'];\nconst MAX_FORM_FIELDS = 10;\n// A form slot's fields from API-writable json: capped, whitelisted kinds,\n// deduped keys. The submit contract needs an email — when none survives, one\n// is injected up front (the slot stays renderable/editable rather than being\n// dropped: the editor canvas resolves through this same pipeline). Email\n// fields are always required — the payload can't form without a value.\nfunction normalizeFormFields(raw) {\n const out = [];\n if (Array.isArray(raw)) {\n for (const field of raw) {\n if (out.length >= MAX_FORM_FIELDS) break;\n if (typeof field !== 'object' || field === null) continue;\n if (typeof field.key !== 'string' || !field.key) continue;\n if (!FORM_FIELD_KINDS.includes(field.kind)) continue;\n if (out.some(f => f.key === field.key)) continue;\n out.push({\n key: field.key,\n kind: field.kind,\n label: typeof field.label === 'string' ? field.label : '',\n placeholder: typeof field.placeholder === 'string' ? field.placeholder : '',\n required: field.kind === 'email' || field.required === true,\n ...(field.kind === 'custom' && typeof field.tag === 'string' && field.tag ? {\n tag: field.tag\n } : {})\n });\n }\n }\n if (!out.some(f => f.kind === 'email')) {\n let key = 'field-email';\n while (out.some(f => f.key === key)) key = `${key}-1`;\n out.unshift({\n key,\n kind: 'email',\n label: 'Email',\n placeholder: '',\n required: true\n });\n }\n return out.slice(0, MAX_FORM_FIELDS);\n}\nconst CHOICE_CONTROLS = ['checkbox', 'chips'];\nconst PRODUCTS_STRATEGIES = ['viewed', 'bestsellers_30d', 'also_bought', 'cart'];\nfunction productsStrategy(value) {\n return PRODUCTS_STRATEGIES.includes(value) ? value : undefined;\n}\nconst PRODUCTS_LAYOUTS = ['row', 'grid'];\nconst RATING_SCALES = ['nps', 'stars', 'thumbs'];\nconst RATING_SUBMIT_MODES = ['instant', 'button'];\nconst TIMER_EXPIRE_ACTIONS = ['keep', 'hide-popup', 'page'];\nconst LANGUAGE_CODE = /^[a-z]{2}$/i;\nconst HEX_COLOR = /^#[0-9a-fA-F]{6}$/;\n// Authored strings from API-writable json land in the popup's own markup on a\n// customer's page — capped so a 100kB \"label\" can't be one.\nconst MAX_SLOT_STRING = 120;\nconst MAX_SLOT_MESSAGE = 500;\nfunction slotString(value, max = MAX_SLOT_STRING) {\n return typeof value === 'string' ? value.trim().slice(0, max) : '';\n}\n// A capped string with a fallback for when the json omits it (or sends blanks).\nfunction slotStringOr(value, fallback, max = MAX_SLOT_STRING) {\n return slotString(value, max) || fallback;\n}\n/** An ISO 639-1 code, lowercased; anything else = '' (the renderer's 'en'). */\nfunction normalizeLanguage(value) {\n const code = slotString(value, 8);\n return LANGUAGE_CODE.test(code) ? code.toLowerCase() : '';\n}\n// Capped, non-empty values, deduped, label falling back to the value. An\n// option-less slot survives, like an unbound form: the editor must still edit it.\nfunction normalizeChoiceOptions(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const option of raw) {\n if (out.length >= WEB_POPUP_MAX_CHOICE_OPTIONS) break;\n if (typeof option !== 'object' || option === null) continue;\n const value = slotString(option.value);\n if (!value) continue;\n if (out.some(existing => existing.value === value)) continue;\n const tagValue = slotString(option.tagValue);\n out.push({\n value,\n label: slotStringOr(option.label, value),\n ...(tagValue ? {\n tagValue\n } : {})\n });\n }\n return out;\n}\n// The selection bounds against the surviving option count: 0 = unbounded, and\n// a max under the min would leave the slot unsubmittable — the min wins.\nfunction normalizeChoiceBounds(slot, options) {\n const bound = value => {\n const n = finiteNumber(value);\n return n === undefined || n <= 0 ? 0 : Math.min(Math.floor(n), options);\n };\n const min = bound(slot.min);\n const max = bound(slot.max);\n return {\n min,\n max: max > 0 ? Math.max(min, max) : 0\n };\n}\n// Per-type slot validation. Text and button entries pass through UNTOUCHED\n// when well-formed (stored popups predate this check — don't rewrite them);\n// a form slot is rebuilt field by field; an unknown slot type is dropped so\n// slot types added after this engine build degrade to absence, not a crash.\nfunction normalizeSlots(raw) {\n const out = [];\n for (const slot of raw) {\n if (out.length >= MAX_ZONE_SLOTS) break;\n if (typeof slot !== 'object' || slot === null) continue;\n if (typeof slot.key !== 'string' || !slot.key) continue;\n if (slot.type === 'text') {\n if (typeof slot.html === 'string') out.push(slot);\n continue;\n }\n if (slot.type === 'button') {\n // An action-less button would crash the renderer on the action switch.\n if (typeof slot.action === 'object' && slot.action !== null && typeof slot.action.type === 'string') {\n out.push(slot);\n }\n continue;\n }\n if (slot.type === 'timer') {\n // An unsupported zone name degrades to the contract's UTC rather than\n // dropping the countdown.\n const zone = slotString(slot.timezone, 64);\n const timezone = webPopupTimeZoneSupported(zone) ? zone : '';\n const endTime = slotString(slot.endTime, 32);\n // No computable deadline = nothing to count down to.\n if (webPopupWallClockMs(endTime, timezone) === null) continue;\n const expirePage = slotString(slot.expirePage);\n const onExpire = TIMER_EXPIRE_ACTIONS.includes(slot.onExpire) ? slot.onExpire : 'keep';\n // 'page' without a target page is 'keep' — the renderer never has to\n // guess where a pageless jump should land.\n const expires = onExpire === 'page' && !expirePage ? 'keep' : onExpire;\n out.push({\n type: 'timer',\n key: slot.key,\n endTime,\n timezone,\n language: normalizeLanguage(slot.language),\n showLabels: slot.showLabels !== false,\n onExpire: expires,\n ...(expires === 'page' ? {\n expirePage\n } : {})\n });\n continue;\n }\n if (slot.type === 'choice') {\n const options = normalizeChoiceOptions(slot.options);\n const {\n min,\n max\n } = normalizeChoiceBounds(slot, options.length);\n out.push({\n type: 'choice',\n key: slot.key,\n control: CHOICE_CONTROLS.includes(slot.control) ? slot.control : 'checkbox',\n tagName: slotString(slot.tagName),\n options,\n min,\n max,\n submitLabel: slotStringOr(slot.submitLabel, WEB_POPUP_CHOICE_DEFAULTS.submitLabel),\n submitVariant: BUTTON_VARIANTS.includes(slot.submitVariant) ? slot.submitVariant : 'primary',\n successMessage: slotStringOr(slot.successMessage, WEB_POPUP_CHOICE_DEFAULTS.successMessage, MAX_SLOT_MESSAGE)\n });\n continue;\n }\n if (slot.type === 'rating') {\n const labels = typeof slot.labels === 'object' && slot.labels !== null ? slot.labels : {};\n out.push({\n type: 'rating',\n key: slot.key,\n // A malformed scale renders as stars: five buttons read the same in\n // every language, which an 0..10 row does not.\n scale: RATING_SCALES.includes(slot.scale) ? slot.scale : 'stars',\n labels: {\n low: slotString(labels.low),\n high: slotString(labels.high)\n },\n submitMode: RATING_SUBMIT_MODES.includes(slot.submitMode) ? slot.submitMode : 'instant',\n submitLabel: slotStringOr(slot.submitLabel, WEB_POPUP_RATING_DEFAULTS.submitLabel),\n eventName: slotString(slot.eventName),\n successMessage: slotStringOr(slot.successMessage, WEB_POPUP_RATING_DEFAULTS.successMessage, MAX_SLOT_MESSAGE)\n });\n continue;\n }\n if (slot.type === 'glyph') {\n // An unknown icon name has no geometry to draw — dropped, exactly like\n // an unknown slot type.\n if (!WEB_POPUP_GLYPH_NAMES.includes(slot.name)) continue;\n out.push({\n type: 'glyph',\n key: slot.key,\n name: slot.name,\n size: WEB_POPUP_GLYPH_SIZES.includes(slot.size) ? slot.size : WEB_POPUP_GLYPH_SIZES[0],\n color: typeof slot.color === 'string' && HEX_COLOR.test(slot.color) ? slot.color : ''\n });\n continue;\n }\n if (slot.type === 'products') {\n const fields = typeof slot.fields === 'object' && slot.fields !== null ? slot.fields : {};\n const limit = Number.isFinite(slot.limit) ? Math.round(slot.limit) : WEB_POPUP_PRODUCTS_DEFAULTS.limit;\n // A strategy this build doesn't know would ask the feed for nothing — bestsellers always answer.\n const strategy = productsStrategy(slot.strategy) ?? 'bestsellers_30d';\n // The same as the strategy = no fallback: a second identical request finds nothing new.\n const fallback = productsStrategy(slot.fallbackStrategy);\n out.push({\n type: 'products',\n key: slot.key,\n strategy,\n ...(fallback && fallback !== strategy ? {\n fallbackStrategy: fallback\n } : {}),\n limit: Math.min(Math.max(limit, 1), WEB_POPUP_PRODUCTS_MAX_LIMIT),\n layout: PRODUCTS_LAYOUTS.includes(slot.layout) ? slot.layout : 'row',\n fields: {\n title: fields.title !== false,\n price: fields.price !== false,\n image: fields.image !== false,\n cta: fields.cta !== false\n },\n ctaText: slotString(slot.ctaText),\n hideWhenEmpty: slot.hideWhenEmpty === true\n });\n continue;\n }\n if (slot.type === 'email-input') {\n out.push({\n type: 'email-input',\n key: slot.key,\n label: slotString(slot.label),\n placeholder: slotString(slot.placeholder),\n invalidMessage: slotStringOr(slot.invalidMessage, WEB_POPUP_EMAIL_INPUT_DEFAULTS.invalidMessage),\n requiredMessage: slotStringOr(slot.requiredMessage, WEB_POPUP_EMAIL_INPUT_DEFAULTS.requiredMessage)\n });\n continue;\n }\n if (slot.type === 'tag-input') {\n out.push({\n type: 'tag-input',\n key: slot.key,\n tagName: slotString(slot.tagName),\n label: slotString(slot.label),\n placeholder: slotString(slot.placeholder),\n required: slot.required === true,\n requiredMessage: slotStringOr(slot.requiredMessage, WEB_POPUP_TAG_INPUT_DEFAULTS.requiredMessage)\n });\n continue;\n }\n if (slot.type === 'consent') {\n out.push({\n type: 'consent',\n key: slot.key,\n checkboxLabel: slotString(slot.checkboxLabel, MAX_SLOT_MESSAGE),\n linkLabel: slotString(slot.linkLabel),\n url: slotString(slot.url, MAX_SLOT_MESSAGE),\n requiredMessage: slotStringOr(slot.requiredMessage, WEB_POPUP_CONSENT_DEFAULTS.requiredMessage)\n });\n continue;\n }\n if (slot.type === 'submit') {\n out.push({\n type: 'submit',\n key: slot.key,\n variant: BUTTON_VARIANTS.includes(slot.variant) ? slot.variant : 'primary',\n label: slotStringOr(slot.label, WEB_POPUP_SUBMIT_DEFAULTS.label),\n errorMessage: slotStringOr(slot.errorMessage, WEB_POPUP_SUBMIT_DEFAULTS.errorMessage, MAX_SLOT_MESSAGE)\n });\n continue;\n }\n if (slot.type === 'email-subscription-form') {\n out.push({\n type: 'email-subscription-form',\n key: slot.key,\n formCode: typeof slot.formCode === 'string' ? slot.formCode : '',\n fields: normalizeFormFields(slot.fields),\n submitLabel: typeof slot.submitLabel === 'string' && slot.submitLabel ? slot.submitLabel : WEB_POPUP_FORM_DEFAULTS.submitLabel,\n submitVariant: BUTTON_VARIANTS.includes(slot.submitVariant) ? slot.submitVariant : 'primary',\n ...(typeof slot.privacy === 'object' && slot.privacy !== null && typeof slot.privacy.checkboxLabel === 'string' ? {\n privacy: {\n checkboxLabel: slot.privacy.checkboxLabel,\n url: typeof slot.privacy.url === 'string' ? slot.privacy.url : '',\n linkLabel: typeof slot.privacy.linkLabel === 'string' ? slot.privacy.linkLabel : ''\n }\n } : {}),\n successMessage: typeof slot.successMessage === 'string' && slot.successMessage ? slot.successMessage : WEB_POPUP_FORM_DEFAULTS.successMessage,\n confirmEmailMessage: typeof slot.confirmEmailMessage === 'string' && slot.confirmEmailMessage ? slot.confirmEmailMessage : WEB_POPUP_FORM_DEFAULTS.confirmEmailMessage\n });\n }\n // Unknown slot type → dropped.\n }\n return out;\n}\n// The zones come from API-writable json — keep only well-formed entries\n// (capped, see above) so the renderer can trust the shape.\nfunction normalizeContents(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const zone of raw) {\n if (out.length >= MAX_ZONES) break;\n if (typeof zone !== 'object' || zone === null) continue;\n if (typeof zone.key !== 'string' || !zone.key) continue;\n if (!Array.isArray(zone.slots)) continue;\n out.push({\n key: zone.key,\n label: typeof zone.label === 'string' ? zone.label : '',\n slots: normalizeSlots(zone.slots)\n });\n }\n return out;\n}\n/**\n * Every subscription form code the popup's form slots reference (unique,\n * empty codes skipped) — what a host records view stats for. Reads the RAW\n * params (tolerant of malformed slots), so it works on parsed-but-unresolved\n * json.\n */\nexport function collectWebPopupFormCodes(params) {\n const out = new Set();\n for (const page of params.pages) {\n if (!Array.isArray(page?.contents)) continue;\n for (const zone of page.contents) {\n if (!Array.isArray(zone?.slots)) continue;\n for (const slot of zone.slots) {\n if (typeof slot !== 'object' || slot === null) continue;\n if (slot.type !== 'email-subscription-form') continue;\n if (typeof slot.formCode === 'string' && slot.formCode) out.add(slot.formCode);\n }\n }\n }\n return [...out];\n}\n/** Every products slot of the popup, normalized: the host's pre-show question for `hideWhenEmpty`. */\nexport function collectWebPopupProductSlots(params) {\n const out = [];\n for (const page of params.pages) {\n if (!Array.isArray(page?.contents)) continue;\n for (const zone of page.contents) {\n if (!Array.isArray(zone?.slots)) continue;\n for (const slot of normalizeSlots(zone.slots)) {\n if (slot.type === 'products') out.push(slot);\n }\n }\n }\n return out;\n}\n// Has a 'hide-popup' countdown run out? The HOST asks before showing, at SHOW\n// time; any page counts, and a malformed timer reads as 'not expired'.\nexport function webPopupExpired(params, nowMs) {\n for (const page of params.pages) {\n if (!Array.isArray(page?.contents)) continue;\n for (const zone of page.contents) {\n if (!Array.isArray(zone?.slots)) continue;\n for (const slot of zone.slots) {\n if (typeof slot !== 'object' || slot === null) continue;\n if (slot.type !== 'timer' || slot.onExpire !== 'hide-popup') continue;\n if (typeof slot.endTime !== 'string') continue;\n const timezone = typeof slot.timezone === 'string' ? slot.timezone : '';\n const deadline = webPopupWallClockMs(slot.endTime, timezone);\n if (deadline !== null && deadline <= nowMs) return true;\n }\n }\n }\n return false;\n}\n/**\n * The popup box-size ceiling px, mirroring the layout tree's px clamp: the\n * json is API-writable and the size lands as inline style on the customer's\n * page. The editor clamps its Width/Height inputs to it too.\n */\nexport const WEB_POPUP_MAX_SIZE_PX = 2000;\nfunction validSize(value) {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.min(value, WEB_POPUP_MAX_SIZE_PX) : undefined;\n}\nexport function resolveWebPopupPageSize(own, shared, axis) {\n if (own === null) return undefined;\n let resolved;\n if (own === 'stretch') resolved = 'stretch';else resolved = validSize(own) ?? (shared === 'stretch' ? 'stretch' : validSize(shared));\n return axis === 'width' && resolved === 'stretch' ? undefined : resolved;\n}\n/**\n * The renderable pages: each page carries its own embedded layout tree — no\n * kind catalog at runtime. The page's named values are substituted into the\n * tree first ($key tokens), then the result is validated/normalized\n * (whitelisted props, unknown container types degrade to a Vertical stack) —\n * so substituted values pass the same clamps as literals; pages whose layout\n * isn't a tree at all are dropped. An empty result means the popup can't be\n * rendered. width/height come out FINAL (page override ?? chrome, validated)\n * — the renderer never falls back itself.\n */\nexport function resolveWebPopupPages(params) {\n const out = [];\n for (const page of params.pages) {\n const values = normalizeWebPopupValues(page.values);\n const layout = normalizeWebPopupLayout(substituteWebPopupLayoutValues(page.layout, webPopupValuesMap(values)));\n if (!layout) continue;\n const width = resolveWebPopupPageSize(page.width, params.width, 'width');\n const height = resolveWebPopupPageSize(page.height, params.height, 'height');\n const leftAction = normalizeWebPopupArrowAction(page.leftAction);\n const rightAction = normalizeWebPopupArrowAction(page.rightAction);\n out.push({\n key: page.key,\n layout,\n images: normalizeImages(page.images),\n contents: normalizeContents(page.contents),\n ...(width !== undefined ? {\n width\n } : {}),\n ...(height !== undefined ? {\n height\n } : {}),\n ...(page.role === 'success' ? {\n role: 'success'\n } : {}),\n ...(leftAction ? {\n leftAction\n } : {}),\n ...(rightAction ? {\n rightAction\n } : {})\n });\n }\n return out;\n}\n/** A side arrow's action from API-writable json; anything malformed = no arrow. An unsafe url is kept — the click drops it. */\nexport function normalizeWebPopupArrowAction(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const action = raw;\n if (action.type === 'close') return {\n type: 'close'\n };\n if (action.type === 'page') {\n return typeof action.page === 'string' && action.page ? {\n type: 'page',\n page: action.page\n } : undefined;\n }\n if (action.type === 'href' && typeof action.url === 'string' && action.url.trim()) {\n return {\n type: 'href',\n url: action.url,\n ...(action.target === '_self' ? {\n target: '_self'\n } : {})\n };\n }\n return undefined;\n}\nfunction clampNumber(raw, min, max, fallback) {\n return typeof raw === 'number' && Number.isFinite(raw) ? Math.min(Math.max(raw, min), max) : fallback;\n}\n/** The hover-revealed controls a live popup draws around its box, validated. */\nexport function resolveWebPopupReveal(params, pages = resolveWebPopupPages(params)) {\n return {\n slideOutClose: params.slideOutClose === true,\n arrowGutter: Math.round(clampNumber(params.arrowGutter, WEB_POPUP_ARROW_GUTTER_MIN, WEB_POPUP_ARROW_GUTTER_MAX, WEB_POPUP_ARROW_GUTTER_DEFAULT)),\n revealStagger: clampNumber(params.revealStagger, 0, 1, WEB_POPUP_REVEAL_STAGGER_DEFAULT),\n hasArrows: pages.some(page => page.leftAction || page.rightAction)\n };\n}\n/** The popup's text direction: the authored `dir`, else what its copy reads as. */\nexport function webPopupDirection(params) {\n if (params.dir === 'ltr' || params.dir === 'rtl') return params.dir;\n const copy = resolveWebPopupPages(params).flatMap(page => page.contents.flatMap(zone => zone.slots.flatMap(webPopupSlotCopy)));\n return detectTextDirection(...copy);\n}\n/** The visitor-facing copy of a slot; placeholders, urls and tag names stay out of the direction vote. */\nexport function webPopupSlotCopy(slot) {\n switch (slot.type) {\n case 'text':\n return [slot.html];\n case 'button':\n return [slot.label];\n case 'email-subscription-form':\n return [...slot.fields.map(field => field.label), slot.submitLabel, slot.successMessage, slot.confirmEmailMessage, ...(slot.privacy ? [slot.privacy.checkboxLabel, slot.privacy.linkLabel] : [])];\n case 'choice':\n return [...slot.options.map(option => option.label), slot.submitLabel, slot.successMessage];\n case 'rating':\n return [slot.labels.low, slot.labels.high, slot.submitLabel, slot.successMessage];\n case 'products':\n return [slot.ctaText];\n case 'email-input':\n return [slot.label, slot.invalidMessage, slot.requiredMessage];\n case 'tag-input':\n return [slot.label, slot.requiredMessage];\n case 'consent':\n return [slot.checkboxLabel, slot.linkLabel, slot.requiredMessage];\n case 'submit':\n return [slot.label, slot.errorMessage];\n case 'timer':\n return slot.showLabels ? Object.values(webPopupTimerLabels(slot.language)) : [];\n case 'glyph':\n return [];\n }\n}\n/** CSS alignment of an authored one: 'left' is the editor's default, so it follows the direction. */\nexport function webPopupCssTextAlign(align) {\n return align === 'left' ? 'start' : align;\n}\n/** The page shown first: startPage when it exists, else the first page. */\nexport function startPageOf(params, pages) {\n return pages.find(p => p.key === params.startPage) ?? pages[0];\n}\nexport function placementMaxSize(placement) {\n return `calc(100% - ${placement.offset * 2}px)`;\n}\n/** Whether a slot is a button with the `close` action; anything malformed reads as false. */\nexport function isWebPopupCloseButton(slot) {\n const candidate = slot;\n return candidate?.type === 'button' && candidate.action?.type === 'close';\n}\nfunction zoneWithoutCloseButtons(zone) {\n if (!Array.isArray(zone?.slots)) return zone;\n return {\n ...zone,\n slots: zone.slots.filter(slot => !isWebPopupCloseButton(slot))\n };\n}\n/** A copy of one page without close-action buttons; tolerant of non-normalized json. */\nexport function webPopupPageWithoutCloseButtons(page) {\n if (!Array.isArray(page?.contents)) return page;\n return {\n ...page,\n contents: page.contents.map(zoneWithoutCloseButtons)\n };\n}\n/** A copy of the params without close-action buttons — an Inline (EMBEDDED) block has nothing to close. */\nexport function webPopupParamsWithoutCloseButtons(params) {\n if (!Array.isArray(params?.pages)) return params;\n return {\n ...params,\n pages: params.pages.map(webPopupPageWithoutCloseButtons)\n };\n}","import { WEB_POPUP_EMAIL_PATTERN } from './constants';\nimport { resolveWebPopupPages } from './helpers';\nconst FORM_FIELD_SLOT_TYPES = new Set(['email-input', 'tag-input', 'consent']);\nconst FORM_SLOT_TYPES = new Set([...FORM_FIELD_SLOT_TYPES, 'submit']);\nfunction isFormFieldSlot(slot) {\n return FORM_FIELD_SLOT_TYPES.has(slot.type);\n}\n/** A field id: slot keys are unique within a page, not across pages. */\nexport function webPopupFormFieldId(pageKey, slotKey) {\n return `${pageKey}/${slotKey}`;\n}\n/** Every Form field of the popup, in page and stack order. */\nexport function collectWebPopupFormFields(pages) {\n const out = [];\n for (const page of pages) {\n for (const zone of page.contents) {\n for (const slot of zone.slots) {\n if (!isFormFieldSlot(slot)) continue;\n out.push({\n id: webPopupFormFieldId(page.key, slot.key),\n pageKey: page.key,\n slot\n });\n }\n }\n }\n return out;\n}\n/** Does any page carry a FORM slot (`email-input`, `tag-input`, `consent`, `submit`)? */\nexport function webPopupHasForm(params) {\n return resolveWebPopupPages(params).some(page => page.contents.some(zone => zone.slots.some(slot => FORM_SLOT_TYPES.has(slot.type))));\n}\nfunction fieldError(field, input) {\n const {\n slot\n } = field;\n if (slot.type === 'consent') return input.checks[field.id] ? undefined : slot.requiredMessage;\n const value = (input.texts[field.id] ?? '').trim();\n if (slot.type === 'tag-input') return slot.required && !value ? slot.requiredMessage : undefined;\n if (!value) return slot.requiredMessage;\n return WEB_POPUP_EMAIL_PATTERN.test(value) ? undefined : slot.invalidMessage;\n}\n/** The block text of every field that blocks a submit, by field id; empty = the Form can be sent. */\nexport function validateWebPopupForm(fields, input) {\n const errors = {};\n for (const field of fields) {\n const error = fieldError(field, input);\n if (error) errors[field.id] = error;\n }\n return errors;\n}\n/** The values a valid Form submits (contracts §10). */\nexport function webPopupFormValues(fields, input) {\n const values = {\n tags: {},\n policyAccepted: true\n };\n for (const field of fields) {\n const {\n slot\n } = field;\n if (slot.type === 'consent') {\n values.policyAccepted = values.policyAccepted && input.checks[field.id] === true;\n continue;\n }\n const value = (input.texts[field.id] ?? '').trim();\n if (slot.type === 'email-input') {\n values.email = value;\n continue;\n }\n if (value && slot.tagName) values.tags[slot.tagName] = value;\n }\n return values;\n}","import { type WebPopup } from './types';\n\nexport const isClickWebPopup = (popup: WebPopup): boolean => popup.trigger_type === 'CLICK';\n\n// Innermost first. composedPath() crosses open shadow roots, which closest() does not.\nfunction clickedElements(event: Event): Array<Element> {\n const path = typeof event.composedPath === 'function' ? event.composedPath() : [];\n if (path.length > 0) {\n return path.filter((node): node is Element => node instanceof Element);\n }\n\n const elements: Array<Element> = [];\n for (let node = event.target instanceof Element ? event.target : null; node; node = node.parentElement) {\n elements.push(node);\n }\n return elements;\n}\n\n/** Whether the click landed on an element matching the selector or inside one. Throws on an invalid selector. */\nexport function clickMatchesSelector(event: Event, selector: string): boolean {\n return clickedElements(event).some((element) => element.matches(selector));\n}\n\n// One capture listener for every CLICK popup: elements rendered later match too, and it runs before the site's own.\nexport function watchClicks(onClick: (event: MouseEvent) => void): () => void {\n document.addEventListener('click', onClick, true);\n return () => document.removeEventListener('click', onClick, true);\n}\n","export const WEB_POPUPS_WIDGET_NAMESPACE = 'pushwoosh-web-popups';\n\n// Prefix for every log line emitted by the web popups widget so its output is\n// easy to spot and filter in the console.\nexport const WEB_POPUPS_LOG_PREFIX = '[WebPopups]';\n\nexport const POPUP_HOST_Z_INDEX = 2147483647;\n\n// Breathing room between one popup closing and the next one opening. Not\n// cosmetic: without it the click that dismissed the first popup lands on the\n// incoming popup's overlay (which closes on click) or on one of its buttons.\nexport const QUEUE_GAP_MS = 400;\n\n// Carries an EMBEDDED block's server order, so a block re-rendered after navigation\n// takes its place in the stack instead of the end.\nexport const EMBEDDED_ORDER_ATTRIBUTE = 'data-pushwoosh-embedded-order';\n\n// Marks the ✕ the SDK draws on a dismissible journey placement.\nexport const EMBEDDED_DISMISS_ATTRIBUTE = 'data-pushwoosh-placement-dismiss';\n\n// Journey placements render ahead of every EMBEDDED campaign on the same element.\nexport const PLACEMENT_ORDER = -1;\n\n// The subscription-form service's public HTTP gateway. Serves\n// email-subscription-form slot submits and view stats for popup-embedded forms.\nexport const SUBSCRIPTION_FORMS_API_URL = 'https://subscription-form.svc-nue.pushwoosh.com/api/v1';\n","import { type TInboxMessagesStoreName, type TKeyValueStoreName, type TMainLogStoreName, type TMessageLogStoreName } from '../Storage.types';\n\nexport const STORE_NAME_KEY_VALUE: TKeyValueStoreName = 'keyValue';\nexport const STORE_NAME_MESSAGE_LOG: TMessageLogStoreName = 'messages';\nexport const STORE_NAME_MAIN_LOG: TMainLogStoreName = 'log';\nexport const STORE_NAME_INBOX_MESSAGES: TInboxMessagesStoreName = 'inboxMessages';\n\nexport const KEY_PATH_BASE_INCREMENT = 'id';\n","import { type TMigrationType, type TSdkStoreName } from '../Storage.types';\n\n/**\n * Check existed store, before create\n * @param name\n * @param storeCreator\n */\nexport function storeCreatorDecorator(name: TSdkStoreName, storeCreator: TMigrationType): TMigrationType {\n return function (database: IDBDatabase) {\n if (database.objectStoreNames.contains(name)) {\n return;\n }\n\n storeCreator(database);\n };\n}\n","import {\n STORE_NAME_INBOX_MESSAGES,\n STORE_NAME_KEY_VALUE,\n STORE_NAME_MAIN_LOG,\n STORE_NAME_MESSAGE_LOG,\n KEY_PATH_BASE_INCREMENT,\n} from './constants';\nimport { storeCreatorDecorator } from './helpers';\nimport {\n type TInboxMessagesIDBKeyPath,\n type TInboxMessagesIDBRemovalTimeIndex,\n type TInboxMessagesIDBStatusIndex,\n} from '../../../models/InboxMessages.types';\n\n/**\n * Create keyValue store migration\n * @param database\n */\nfunction createKeyValueStore(database: IDBDatabase) {\n database.createObjectStore(STORE_NAME_KEY_VALUE, { keyPath: 'key' });\n}\n\n/**\n * Create log store migration\n * @param database\n */\nfunction createLogStore(database: IDBDatabase) {\n const logStore = database.createObjectStore(\n STORE_NAME_MAIN_LOG,\n { keyPath: KEY_PATH_BASE_INCREMENT, autoIncrement: true },\n );\n logStore.createIndex('environment', 'environment', { unique: false });\n logStore.createIndex('date', 'date', { unique: false });\n logStore.createIndex('type', 'type', { unique: false });\n}\n\n/**\n * Create message log store migration\n * @param database\n */\nfunction createMessageLogStore(database: IDBDatabase) {\n const messagesStore = database.createObjectStore(\n STORE_NAME_MESSAGE_LOG,\n { keyPath: KEY_PATH_BASE_INCREMENT, autoIncrement: true },\n );\n messagesStore.createIndex('date', 'date', { unique: false });\n}\n\n/**\n * Create inbox messages store migration\n * @param database\n */\nfunction createInboxMessagesStore(database: IDBDatabase) {\n const keyPath: TInboxMessagesIDBKeyPath = 'inbox_id';\n const statusIndex: TInboxMessagesIDBStatusIndex = 'status';\n const removalTimeIndex: TInboxMessagesIDBRemovalTimeIndex = 'rt';\n\n const store = database.createObjectStore(STORE_NAME_INBOX_MESSAGES,\n { keyPath, autoIncrement: false },\n );\n store.createIndex(statusIndex, statusIndex, { unique: false, multiEntry: true });\n store.createIndex(removalTimeIndex, removalTimeIndex, { unique: false, multiEntry: true });\n}\n\nexport default [\n storeCreatorDecorator(STORE_NAME_KEY_VALUE, createKeyValueStore),\n storeCreatorDecorator(STORE_NAME_MAIN_LOG, createLogStore),\n storeCreatorDecorator(STORE_NAME_MESSAGE_LOG, createMessageLogStore),\n storeCreatorDecorator(STORE_NAME_INBOX_MESSAGES, createInboxMessagesStore),\n];\n","import { default as migrationsInitial } from './initial';\nimport { type TMigrationType } from '../Storage.types';\n\nexport default class Migrations {\n get all(): Array<TMigrationType> {\n return migrationsInitial;\n }\n}\n","import Migrations from './Migrations';\nimport { type TMigrationType } from '../Storage.types';\n\nexport default class MigrationExecutor {\n db: IDBDatabase;\n migrationsBuilder: Migrations;\n\n constructor(\n db: IDBDatabase,\n migrationsBuilder: Migrations = new Migrations(),\n ) {\n this.db = db;\n this.migrationsBuilder = migrationsBuilder;\n }\n\n applyMigrations() {\n this.applyMigrationsPack(this.migrationsBuilder.all);\n }\n\n applyMigrationsPack(migrationsPack: Array<TMigrationType>) {\n migrationsPack.forEach((migration) => {\n migration(this.db);\n });\n }\n}\n","import {\n STORE_NAME_KEY_VALUE,\n STORE_NAME_MAIN_LOG,\n STORE_NAME_MESSAGE_LOG,\n} from '../modules/storage/migrations/constants';\nimport MigrationExecutor from '../modules/storage/migrations/MigrationExecutor';\nimport { type IIDBOpenEventTargetWithResult } from '../modules/storage/Storage.types';\nimport version from '../modules/storage/version';\n\ndeclare const self: ServiceWorkerGlobalScope;\n\nfunction onversionchange(database: IDBDatabase, event: Event) {\n console.info('onversionchange', event);\n database.close();\n}\n\nlet databasePromise: Promise<IDBDatabase>;\nexport function getInstance(): Promise<IDBDatabase> {\n if (!databasePromise) {\n databasePromise = new Promise<IDBDatabase>((resolve, reject) => {\n const request: IDBOpenDBRequest = indexedDB.open('PUSHWOOSH_SDK_STORE', version);\n request.onsuccess = (event) => {\n const database: IDBDatabase = (event.target as IIDBOpenEventTargetWithResult).result;\n database.onversionchange = onversionchange.bind(null, database, reject);\n resolve(database);\n };\n\n request.onerror = () => reject(request.error);\n\n request.onupgradeneeded = (event) => {\n const database: IDBDatabase = (event.target as IIDBOpenEventTargetWithResult).result;\n database.onversionchange = onversionchange.bind(null, database, reject);\n\n const migrationExecutor = new MigrationExecutor(database);\n migrationExecutor.applyMigrations();\n };\n });\n }\n return databasePromise;\n}\n\nfunction getInstanceWithPromise(executor: any): any {\n return getInstance().then((database) => (\n new Promise((resolve, reject) => executor(database, resolve, reject))\n ));\n}\n\nfunction createKeyValue(name: string) {\n return {\n get<K extends string, D>(key: K, defaultValue?: D) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction(name).objectStore(name).get(key);\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(request.result?.value || defaultValue);\n } else if (isError) {\n reject(request.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n request.onsuccess = () => isComplete = true;\n request.onerror = () => isError = true;\n check();\n });\n },\n\n getAll() {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const result: { [key: string]: any } = {};\n const cursor = database.transaction(name).objectStore(name).openCursor();\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(result);\n } else if (isError) {\n reject(cursor.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n cursor.onsuccess = (event) => {\n const cursorResult = (event.target as any).result;\n if (cursorResult) {\n result[cursorResult.key] = cursorResult.value.value;\n cursorResult.continue();\n } else {\n isComplete = true;\n }\n };\n cursor.onerror = () => isError = true;\n check();\n });\n },\n\n async extend(key: string, value: any) {\n const oldValues = await this.get(key);\n const { ...newValues } = value;\n await this.set(key, { ...oldValues, ...newValues });\n },\n\n set<K, D>(key: K, value: D) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([name], 'readwrite').objectStore(name).put({ key, value });\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(key);\n } else if (isError) {\n reject(request.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n request.onsuccess = () => isComplete = true;\n request.onerror = () => isError = true;\n check();\n });\n },\n };\n}\n\nexport abstract class LogBase {\n protected abstract name: string;\n protected abstract maxItems: number;\n _add(obj: any) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([this.name], 'readwrite').objectStore(this.name).add(obj);\n request.onsuccess = () => {\n resolve(obj);\n };\n request.onerror = () => {\n reject(request.error);\n };\n }).then((obj: any) => {\n return this.getAll().then((items: { id: number }[]) => {\n if (Array.isArray(items)) {\n const ids = items.map((i) => i.id).sort((a, b) => {\n if (a == b) return 0;\n return a < b ? 1 : -1;\n });\n if (ids.length > this.maxItems) {\n return Promise.all(ids.slice(this.maxItems).map((id) => this.delete(id))).then(() => obj);\n }\n }\n return obj;\n });\n });\n }\n\n delete(key: any) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([this.name], 'readwrite').objectStore(this.name).delete(key);\n request.onsuccess = () => {\n resolve(request.result);\n };\n request.onerror = () => {\n reject(request.error);\n };\n });\n }\n\n getAll() {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const result: any[] = [];\n const cursor = database.transaction(this.name).objectStore(this.name).openCursor();\n cursor.onsuccess = (ev) => {\n const cursorResult = (ev.target as any).result;\n if (cursorResult) {\n if (cursorResult.value) {\n result.push(cursorResult.value);\n }\n cursorResult.continue();\n } else {\n resolve(result);\n }\n };\n cursor.onerror = () => {\n reject(cursor.error);\n };\n });\n }\n}\n\nexport class LogLog extends LogBase {\n protected name = STORE_NAME_MAIN_LOG;\n protected maxItems = 100;\n protected environment = (typeof self !== 'undefined' && self.registration) ? 'worker' : 'browser';\n add(type: string, message: any, additional?: any) {\n const obj: any = {\n type,\n environment: this.environment,\n message: `${message}`,\n date: new Date(),\n };\n if (message instanceof Error) {\n obj.stack = message.stack;\n }\n if (additional) {\n obj.additional = additional;\n }\n return this._add(obj);\n }\n}\n\nexport class LogMessage extends LogBase {\n protected name = STORE_NAME_MESSAGE_LOG;\n protected maxItems = 25;\n add(log: any) {\n return this._add({\n ...log,\n date: new Date(),\n });\n }\n}\n\nexport const keyValue = createKeyValue(STORE_NAME_KEY_VALUE);\nexport const log = new LogLog();\nexport const message = new LogMessage();\n","import { log as logStorage } from './storage';\n\nconst levels: { [key: string]: number } = {\n error: 1,\n info: 2,\n debug: 3,\n};\n\nlet limitLevel = 3;\n\ntype TWriteType = 'error' | 'apirequest' | 'info';\n\ninterface ILogger {\n setLevel(level: string): void;\n error(...args: any[]): void;\n info(...args: any[]): void;\n debug(...args: any[]): void;\n write(type: TWriteType, message: any, additional?: any): Promise<void>;\n isManualLevel(): boolean;\n [key: string]: any;\n}\n\nconst Logger: ILogger = {\n setLevel(level) {\n if (!levels[level]) {\n level = 'error';\n }\n limitLevel = levels[level];\n },\n write(type: TWriteType, message: any, additional?: any) {\n if (type === 'error') {\n this.error(message);\n } else {\n this.info(message);\n }\n return logStorage.add(type, message, additional);\n },\n} as ILogger;\n\nObject.keys(levels).forEach((levelName: string) => {\n const levelNumber = levels[levelName];\n Logger[levelName] = (...args: any[]) => {\n if (levelNumber <= limitLevel) {\n console.groupCollapsed(levelName);\n console.info('', ...args);\n console.trace('trace');\n console.groupEnd();\n }\n };\n});\n\nexport function logAndThrowError(error: string) {\n const logText = new Error(error);\n Logger.write('error', logText, 'logAndThrowError');\n throw logText;\n}\n\nexport function logAndRejectError(error: string, reject: (e: any) => void) {\n const logText = new Error(error);\n Logger.write('error', logText, 'logAndRejectError');\n reject(logText);\n}\n\nexport { Logger };\n","import {\n type WebPopupChoiceSubmitHandler, type WebPopupFormValuesSubmitHandler, type WebPopupRatingSubmitHandler,\n type WebPopupSubscribeResult,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { Logger } from '../../core/logger';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\n\n// The host side of the slots that talk to the device API: a choice becomes\n// TAGS, a rating an EVENT, a subscribe button the permission prompt.\n\n// A choice slot's picks appended to a LIST tag — additive by design: the slot\n// resets its selection on every show, so it cannot express an un-pick.\nexport function createChoiceSubmitHandler(pw: Pushwoosh): WebPopupChoiceSubmitHandler {\n return async ({ slotKey, tagName, values }) => {\n try {\n // String operation + `value` is setTags' shape; the numeric TagValue in\n // Api.types.ts belongs to multiRegisterDevice and no-ops here.\n await pw.api.setTags({ [tagName]: { operation: 'append', value: values } }); // also writes EMAIL tags when the visitor has one\n } catch (error) {\n Logger.error(error, `Failed to write web popup choice \"${slotKey}\" to tag \"${tagName}\"`);\n throw error;\n }\n };\n}\n\n// The score as an event, scale alongside (4 of 5 stars is not 4 of 10 NPS). An\n// in-app configured for this event can open over the popup; that's normal.\nexport function createRatingSubmitHandler(pw: Pushwoosh): WebPopupRatingSubmitHandler {\n return async ({ slotKey, eventName, score, scale }) => {\n try {\n await pw.api.postEvent(eventName, { score, scale, slotKey });\n } catch (error) {\n Logger.error(error, `Failed to post web popup rating \"${slotKey}\" as event \"${eventName}\"`);\n throw error;\n }\n };\n}\n\n// A `subscribe`-action button. Kept synchronous up to pw.subscribe() while the permission is\n// 'default': Firefox only honours a permission request inside the click's own task.\nexport function createSubscribeHandler(pw: Pushwoosh, campaignCode?: string): () => Promise<WebPopupSubscribeResult> {\n return async () => {\n const permissionBefore = pw.driver?.getPermission() ?? 'default';\n // No prompt to keep in the click's task once granted, so the server is asked; a failed check\n // reads as \"had a token\": a subscription is never over-counted.\n const hadToken = permissionBefore === 'granted'\n && await pw.api.checkDeviceSubscribeForPushNotifications(false).catch(() => true);\n let isSubscribed = false;\n\n try {\n await pw.subscribe();\n isSubscribed = pw.isDeviceRegistered();\n } catch (error) {\n Logger.error(error, 'Failed to subscribe from a web popup');\n }\n\n // The permission is the answer either way: a failed registration after a\n // granted prompt must not read to the popup as a refusal.\n const permission = (pw.driver?.getPermission() ?? 'default') as WebPopupSubscribeResult;\n\n if (campaignCode && permissionBefore !== 'denied' && !hadToken && isSubscribed && permission === 'granted') {\n pw.api.recordPopupFormEvent(campaignCode, 4).catch((error) => {\n Logger.error(error, `Failed to record the push subscription of web campaign \"${campaignCode}\"`);\n });\n }\n\n return permission;\n };\n}\n\n// Values of a FORM content, sent under the code of the campaign that shows it. The server answers\n// only OK or INVALID_EMAIL: the exact subscription state stays there, so an address can't be probed.\nexport function createFormValuesSubmitHandler(pw: Pushwoosh, campaignCode: string): WebPopupFormValuesSubmitHandler {\n return async (values) => {\n try {\n const response = await pw.api.submitPopupForm(campaignCode, values);\n\n if (response.result === 'OK') {\n return 'ok';\n }\n\n if (response.result === 'INVALID_EMAIL') {\n return 'invalid-email';\n }\n\n throw new Error(`Unexpected submitPopupForm result \"${response.result}\"`);\n } catch (error) {\n Logger.error(error, `Failed to submit the form of web campaign \"${campaignCode}\"`);\n throw error;\n }\n };\n}\n","import { useEffect, useState } from 'react';\nconst DARK_MEDIA_QUERY = '(prefers-color-scheme: dark)';\nfunction prefersDark() {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(DARK_MEDIA_QUERY).matches;\n}\n// 'auto' follows the visitor's OS setting and keeps following it: a popup can\n// be on screen when the theme flips, and a stale palette is the visible half.\nexport function useColorScheme(pref, watch) {\n const [dark, setDark] = useState(() => pref === 'auto' && watch && prefersDark());\n const watchDeps = [pref, watch];\n const [prevWatchDeps, setPrevWatchDeps] = useState(null);\n if (prevWatchDeps === null || watchDeps.some((dep, index) => dep !== prevWatchDeps[index])) {\n setPrevWatchDeps(watchDeps);\n if (pref === 'auto' && watch) {\n setDark(prefersDark());\n }\n }\n useEffect(() => {\n if (pref !== 'auto' || !watch || typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return undefined;\n }\n const media = window.matchMedia(DARK_MEDIA_QUERY);\n const onChange = event => setDark(event.matches);\n media.addEventListener('change', onChange);\n return () => media.removeEventListener('change', onChange);\n }, [pref, watch]);\n if (pref !== 'auto') return pref;\n return dark ? 'dark' : 'light';\n}","import { WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT } from './constants';\n/** Marks an Inline block's wrapper; the image cap is scoped to it so it never reaches the host page. */\nexport const WEB_POPUP_INLINE_SCOPE_ATTRIBUTE = 'data-pw-web-popup-inline';\n/** Marks the reader's ✕, so a host can tell it from the content's own buttons. */\nexport const WEB_POPUP_CLOSE_ATTRIBUTE = 'data-pw-close';\n/**\n * Marks the FORM content Submit: its send already counts in the campaign's Submits, so the host skips it as a click.\n * Email-subscription-form, choice and rating sends don't reach Submits, so their clicks stay interactions.\n */\nexport const WEB_POPUP_SUBMIT_ATTRIBUTE = 'data-pw-submit';\n/** An Inline block fills its container: the page's own width only sizes a floating popup. */\nexport const WEB_POPUP_INLINE_WRAPPER_STYLE = {\n width: '100%'\n};\n/** Image-cap stylesheet of an Inline block, scoped by WEB_POPUP_INLINE_SCOPE_ATTRIBUTE. */\nexport const WEB_POPUP_INLINE_IMAGE_CAP_CSS = `[${WEB_POPUP_INLINE_SCOPE_ATTRIBUTE}] img { max-height: ${WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT}px; object-fit: cover; }`;","import { createContext, useMemo, useState } from 'react';\nimport { collectWebPopupFormFields, validateWebPopupForm, webPopupFormValues } from './form';\nimport { resolveWebPopupPages } from './helpers';\nconst INERT_SESSION = {\n pageKey: '',\n texts: {},\n checks: {},\n errors: {},\n phase: 'idle',\n setText: () => {},\n setCheck: () => {},\n submit: () => {},\n turnPage: (target, go) => go(target),\n advance: () => {}\n};\n/** What a Form slot reads; a slot outside any WebPopupBox gets this inert session. */\nexport const WebPopupFormSessionContext = createContext(INERT_SESSION);\nfunction withoutKey(record, key) {\n if (!(key in record)) return record;\n return Object.fromEntries(Object.entries(record).filter(([candidate]) => candidate !== key));\n}\n/** The Form session a WebPopupBox owns: it sees every page and can switch them. */\nexport function useWebPopupFormSession(params, pageKey, onPageChange, onSubmitFormValues) {\n const pages = useMemo(() => resolveWebPopupPages(params), [params]);\n const fields = useMemo(() => collectWebPopupFormFields(pages), [pages]);\n const [texts, setTexts] = useState({});\n const [checks, setChecks] = useState({});\n const [errors, setErrors] = useState({});\n const [phase, setPhase] = useState('idle');\n const pageIndex = key => pages.findIndex(candidate => candidate.key === key);\n const pageValid = () => {\n const found = validateWebPopupForm(fields.filter(field => field.pageKey === pageKey), {\n texts,\n checks\n });\n setErrors(found);\n return Object.keys(found).length === 0;\n };\n // A page button can skip a page, so Submit checks every page and shows the first broken one.\n const formValid = () => {\n const found = validateWebPopupForm(fields, {\n texts,\n checks\n });\n setErrors(found);\n const invalid = fields.find(field => field.id in found);\n if (invalid) onPageChange?.(invalid.pageKey);\n return !invalid;\n };\n const showInvalidEmail = () => {\n const email = fields.find(field => field.slot.type === 'email-input');\n if (email?.slot.type !== 'email-input') return;\n setErrors({\n [email.id]: email.slot.invalidMessage\n });\n onPageChange?.(email.pageKey);\n };\n const submit = () => {\n if (!onSubmitFormValues || phase === 'submitting') return;\n if (!formValid()) {\n setPhase('idle');\n return;\n }\n setPhase('submitting');\n Promise.resolve().then(() => onSubmitFormValues(webPopupFormValues(fields, {\n texts,\n checks\n }))).then(result => {\n setPhase('idle');\n if (result === 'invalid-email') {\n showInvalidEmail();\n return;\n }\n const success = pages.find(candidate => candidate.role === 'success');\n if (success) onPageChange?.(success.key);\n }, () => setPhase('error'));\n };\n const turnPage = (target, go) => {\n if (phase === 'submitting') return;\n const targetIndex = pageIndex(target);\n const forward = targetIndex > pageIndex(pageKey);\n if (!onSubmitFormValues || !forward) {\n go(target);\n return;\n }\n if (pages[targetIndex].role === 'success') submit();else if (pageValid()) go(target);\n };\n const advance = () => {\n if (!onSubmitFormValues || phase === 'submitting') return;\n const next = pages[pageIndex(pageKey) + 1];\n if (!next || next.role === 'success') submit();else if (pageValid()) onPageChange?.(next.key);\n };\n return {\n pageKey,\n texts,\n checks,\n errors,\n phase,\n setText: (id, value) => {\n setTexts(prev => ({\n ...prev,\n [id]: value\n }));\n setErrors(prev => withoutKey(prev, id));\n },\n setCheck: (id, checked) => {\n setChecks(prev => ({\n ...prev,\n [id]: checked\n }));\n setErrors(prev => withoutKey(prev, id));\n },\n submit,\n turnPage,\n advance\n };\n}","import { webPopupTextColor, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from '../constants';\nexport const fieldSlotStyle = {\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: 'start'\n};\nexport function captionStyle({\n inverse,\n colors\n}) {\n const color = webPopupTextColor('caption', colors, inverse);\n return {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(color ? {\n color\n } : {})\n };\n}\nexport function errorStyle(colors) {\n return {\n fontSize: 12,\n lineHeight: 1.4,\n color: colors.error,\n paddingTop: 2\n };\n}","import { captionStyle } from '../styles';\nexport function labelStyle(look) {\n return {\n ...captionStyle(look),\n paddingBottom: 4\n };\n}","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useContext, useState } from 'react';\nimport { webPopupFormInputStyle } from '../../constants';\nimport { webPopupFormFieldId } from '../../form';\nimport { WebPopupFormSessionContext } from '../../formSession';\nimport { errorStyle, fieldSlotStyle } from '../styles';\nimport { labelStyle } from './styles';\n/** The text field a Form's Email and Tag inputs share; Enter advances the Form. */\nexport function TextFieldView({\n slotKey,\n label,\n placeholder,\n inputType,\n autoComplete,\n look\n}) {\n const session = useContext(WebPopupFormSessionContext);\n const [focused, setFocused] = useState(false);\n const id = webPopupFormFieldId(session.pageKey, slotKey);\n const error = session.errors[id];\n let borderColor;\n if (error) borderColor = look.colors.error;else if (focused) borderColor = look.colors.accent;\n return _jsxs(\"div\", {\n style: fieldSlotStyle,\n children: [label && _jsx(\"div\", {\n style: labelStyle(look),\n children: label\n }), _jsx(\"input\", {\n type: inputType,\n autoComplete: autoComplete,\n placeholder: placeholder || undefined,\n value: session.texts[id] ?? '',\n disabled: session.phase === 'submitting',\n style: webPopupFormInputStyle(look.colors, borderColor),\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n onChange: event => session.setText(id, event.currentTarget.value),\n onKeyDown: event => {\n if (event.key === 'Enter') session.advance();\n }\n }), error && _jsx(\"div\", {\n style: errorStyle(look.colors),\n children: error\n })]\n });\n}","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { TextFieldView } from '../TextFieldView';\n/** A Form's Email input, drawn the runtime's way. */\nexport function EmailInputSlotView({\n slot,\n ...look\n}) {\n return _jsx(TextFieldView, {\n slotKey: slot.key,\n label: slot.label,\n placeholder: slot.placeholder,\n inputType: \"email\",\n autoComplete: \"email\",\n look: look\n });\n}","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { TextFieldView } from '../TextFieldView';\n/** A Form's Tag input, drawn the runtime's way. */\nexport function TagInputSlotView({\n slot,\n ...look\n}) {\n return _jsx(TextFieldView, {\n slotKey: slot.key,\n label: slot.label,\n placeholder: slot.placeholder,\n inputType: \"text\",\n look: look\n });\n}","import { captionStyle } from '../styles';\nexport const checkboxStyle = {\n margin: '2px 0 0',\n flexShrink: 0\n};\nexport function labelStyle(look) {\n return {\n ...captionStyle(look),\n display: 'flex',\n alignItems: 'flex-start',\n gap: 8,\n cursor: 'pointer'\n };\n}\nexport function linkStyle(colors) {\n return {\n color: colors.accent\n };\n}","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useContext } from 'react';\nimport { webPopupFormFieldId } from '../../form';\nimport { WebPopupFormSessionContext } from '../../formSession';\nimport { safeUrl, webPopupLinkTargetAttrs } from '../../helpers';\nimport { errorStyle, fieldSlotStyle } from '../styles';\nimport { checkboxStyle, labelStyle, linkStyle } from './styles';\n/** A Form's Consent checkbox with its policy link. */\nexport function ConsentSlotView({\n slot,\n ...look\n}) {\n const session = useContext(WebPopupFormSessionContext);\n const id = webPopupFormFieldId(session.pageKey, slot.key);\n const error = session.errors[id];\n const href = safeUrl(slot.url);\n return _jsxs(\"div\", {\n style: fieldSlotStyle,\n children: [_jsxs(\"label\", {\n style: labelStyle(look),\n children: [_jsx(\"input\", {\n type: \"checkbox\",\n checked: session.checks[id] === true,\n disabled: session.phase === 'submitting',\n style: checkboxStyle,\n onChange: event => session.setCheck(id, event.currentTarget.checked)\n }), _jsxs(\"span\", {\n children: [slot.checkboxLabel, href && _jsxs(_Fragment, {\n children: [' ', _jsx(\"a\", {\n href: href,\n ...webPopupLinkTargetAttrs(undefined),\n style: linkStyle(look.colors),\n children: slot.linkLabel || slot.url\n })]\n })]\n })]\n }), error && _jsx(\"div\", {\n style: errorStyle(look.colors),\n children: error\n })]\n });\n}","import { webPopupButtonPillStyle, WEB_POPUP_BUTTON_SLOT_PADDING } from '../../constants';\nexport const slotStyle = {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n};\nexport function pillStyle(variant, colors, submitting) {\n return {\n ...webPopupButtonPillStyle(variant, colors),\n ...(submitting ? {\n opacity: 0.6,\n cursor: 'default'\n } : {})\n };\n}","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useContext } from 'react';\nimport { WebPopupFormSessionContext } from '../../formSession';\nimport { webPopupCssTextAlign } from '../../helpers';\nimport { WEB_POPUP_SUBMIT_ATTRIBUTE } from '../../styles';\nimport { errorStyle } from '../styles';\nimport { pillStyle, slotStyle } from './styles';\n/** A Form's Submit: sends every field of the popup; shows errorMessage after a refusal. */\nexport function SubmitSlotView({\n slot,\n align,\n colors\n}) {\n const session = useContext(WebPopupFormSessionContext);\n const submitting = session.phase === 'submitting';\n return _jsxs(\"div\", {\n style: slotStyle,\n children: [_jsx(\"button\", {\n type: \"button\",\n [WEB_POPUP_SUBMIT_ATTRIBUTE]: '',\n disabled: submitting,\n style: pillStyle(slot.variant, colors, submitting),\n onClick: session.submit,\n children: slot.label\n }), session.phase === 'error' && _jsx(\"div\", {\n style: {\n ...errorStyle(colors),\n textAlign: webPopupCssTextAlign(align)\n },\n children: slot.errorMessage\n })]\n });\n}","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { createContext, useContext, useEffect, useState } from 'react';\nimport { webPopupButtonPillStyle, webPopupTextColor, WEB_POPUP_PRODUCTS_CACHE_MS, WEB_POPUP_PRODUCTS_DEFAULTS, WEB_POPUP_PRODUCTS_PLACEHOLDERS, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from './constants';\nimport { safeUrl, webPopupLinkTargetAttrs } from './helpers';\n/** The products host of the box being drawn; WebPopupBox provides it, so no prop threads through the tree. */\nexport const WebPopupProductsContext = createContext(undefined);\nconst productsCache = new WeakMap();\n/**\n * One slot's items through the host, shared by the host's pre-show check and the render for WEB_POPUP_PRODUCTS_CACHE_MS,\n * so both see the same answer from one request. Never rejects: a failure or a non-array is an empty slot.\n */\nexport function loadWebPopupProducts(host, slot, now = Date.now()) {\n let cache = productsCache.get(host);\n if (!cache) {\n cache = new Map();\n productsCache.set(host, cache);\n }\n const key = `${slot.key}|${slot.strategy}|${slot.fallbackStrategy ?? ''}|${slot.limit}`;\n const hit = cache.get(key);\n if (hit && now - hit.at < WEB_POPUP_PRODUCTS_CACHE_MS) return hit.items;\n const entry = {\n at: now,\n items: Promise.resolve([])\n };\n entry.items = Promise.resolve().then(() => host.load(slot)).then(loaded => Array.isArray(loaded) ? loaded.slice(0, slot.limit) : []).catch(() => {\n // a failed answer is not kept: the next showing asks again\n if (cache.get(key) === entry) cache.delete(key);\n return [];\n });\n cache.set(key, entry);\n return entry.items;\n}\nconst CARD_MIN_WIDTH = 120;\nfunction formatPrice(price, currency) {\n if (!currency) return String(price);\n try {\n return new Intl.NumberFormat(undefined, {\n style: 'currency',\n currency\n }).format(price);\n } catch {\n return `${price} ${currency}`;\n }\n}\nfunction placeholderProducts(count) {\n return Array.from({\n length: count\n }, (_, i) => ({\n id: `placeholder-${i}`,\n title: 'Product name',\n url: ''\n }));\n}\nfunction ProductCard({\n product,\n slot,\n colors,\n inverse,\n onClick\n}) {\n const href = safeUrl(product.url);\n const image = safeUrl(product.image);\n const titleColor = webPopupTextColor('body', colors, inverse);\n const priceColor = webPopupTextColor('caption', colors, inverse);\n const cardStyle = {\n display: 'flex',\n flexDirection: 'column',\n gap: 6,\n minWidth: CARD_MIN_WIDTH,\n color: 'inherit',\n textDecoration: 'none',\n ...(slot.layout === 'row' ? {\n flex: `0 0 ${CARD_MIN_WIDTH}px`\n } : {})\n };\n const body = _jsxs(_Fragment, {\n children: [slot.fields.image ? _jsx(\"div\", {\n style: {\n aspectRatio: '1 / 1',\n borderRadius: 6,\n backgroundColor: colors.surface,\n border: `1px solid ${colors.border}`,\n ...(image ? {\n backgroundImage: `url(\"${image.replace(/\"/g, '%22')}\")`,\n backgroundSize: 'cover',\n backgroundPosition: 'center'\n } : {})\n }\n }) : null, slot.fields.title ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.body,\n ...(titleColor ? {\n color: titleColor\n } : {})\n },\n children: product.title\n }) : null, slot.fields.price && product.price !== undefined ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(priceColor ? {\n color: priceColor\n } : {})\n },\n children: formatPrice(product.price, product.currency)\n }) : null, slot.fields.cta ? _jsx(\"span\", {\n style: {\n ...webPopupButtonPillStyle('secondary', colors),\n padding: '6px 10px',\n fontSize: 13\n },\n children: slot.ctaText || WEB_POPUP_PRODUCTS_DEFAULTS.ctaText\n }) : null]\n });\n if (!href) return _jsx(\"div\", {\n style: cardStyle,\n children: body\n });\n return _jsx(\"a\", {\n href: href,\n ...webPopupLinkTargetAttrs('_self'),\n style: cardStyle,\n onClick: onClick,\n children: body\n });\n}\n// With a host: its items; loading, failed or empty collapses the slot, never a spinner on a shop page.\n// Without one: placeholder cards on the editor canvas and in previews, nothing on a live page.\nexport function ProductsSlotView({\n slot,\n inverse,\n colors,\n mode\n}) {\n const host = useContext(WebPopupProductsContext);\n const [items, setItems] = useState(null);\n // Pages are re-resolved on every render, so the slot object is new each time: keyed by what the request depends on.\n const request = `${slot.key}|${slot.strategy}|${slot.fallbackStrategy ?? ''}|${slot.limit}`;\n useEffect(() => {\n if (!host) return undefined;\n let cancelled = false;\n void loadWebPopupProducts(host, slot).then(loaded => {\n if (!cancelled) setItems(loaded);\n });\n return () => {\n cancelled = true;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [host, request]);\n if (!host && mode === 'live') return null;\n const shown = host ? items : placeholderProducts(Math.min(slot.limit, WEB_POPUP_PRODUCTS_PLACEHOLDERS));\n if (!shown || shown.length === 0) return null;\n const listStyle = slot.layout === 'grid' ? {\n display: 'grid',\n gridTemplateColumns: `repeat(auto-fill, minmax(${CARD_MIN_WIDTH}px, 1fr))`,\n gap: 12\n } : {\n display: 'flex',\n gap: 12,\n overflowX: 'auto'\n };\n return _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n \"data-pw-products\": slot.key,\n children: _jsx(\"div\", {\n style: listStyle,\n children: shown.map(product => _jsx(ProductCard, {\n product: product,\n slot: slot,\n colors: colors,\n inverse: inverse,\n onClick: mode === 'live' && host?.onClick ? () => host.onClick?.(product, slot) : undefined\n }, product.id))\n })\n });\n}","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { WEB_POPUP_ARROW_HEIGHT, WEB_POPUP_ARROW_SHADOW, WEB_POPUP_ARROW_WIDTH, WEB_POPUP_CONTROL_HOVER_SCALE, WEB_POPUP_REVEAL_LEAVE_GRACE_MS, WEB_POPUP_REVEAL_MS, webPopupArrowPoints, WEB_POPUP_SLIDE_CLOSE_GAP, WEB_POPUP_SLIDE_CLOSE_GROWTH, WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE } from './constants';\nimport { safeUrl } from './helpers';\nimport { webPopupColorAlpha } from './palette';\nimport { WEB_POPUP_CLOSE_ATTRIBUTE } from './styles';\n/** The reveal cascade: left arrow, right arrow, ✕ — each starts `revealStagger` into the previous one. */\nexport function webPopupRevealDelays(reveal, page) {\n const order = [];\n if (page.leftAction) order.push('left');\n if (page.rightAction) order.push('right');\n if (reveal.slideOutClose) order.push('close');\n const step = WEB_POPUP_REVEAL_MS * reveal.revealStagger;\n return Object.fromEntries(order.map((control, i) => [control, Math.round(i * step)]));\n}\n/** The room the box gives up to its controls; none on a device without hover, where nothing is revealed. */\nexport function webPopupRevealRoom(reveal, hoverCapable) {\n if (!hoverCapable) return {\n side: 0,\n top: 0\n };\n const close = reveal.slideOutClose ? WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE + WEB_POPUP_SLIDE_CLOSE_GAP : 0;\n return {\n side: Math.max(reveal.hasArrows ? reveal.arrowGutter : 0, close),\n top: close\n };\n}\n/** Px from the box's right edge to the revealed ✕; with a right arrow its right edge stops at the triangle's tip. */\nexport function webPopupSlideCloseInset(arrowGutter, hasRightArrow) {\n const free = WEB_POPUP_SLIDE_CLOSE_GAP;\n const tip = (arrowGutter + WEB_POPUP_ARROW_WIDTH) / 2;\n return hasRightArrow ? Math.min(free, tip - WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE) : free;\n}\n/** Whether the visitor's pointer can hover: touch screens get no revealed controls. */\nexport function useWebPopupHoverCapable() {\n const [capable] = useState(() => typeof window === 'undefined' || typeof window.matchMedia !== 'function' ? true : window.matchMedia('(hover: hover)').matches);\n return capable;\n}\n/** Revealed while the pointer or focus is inside; hiding waits a grace so a gap to a control is not a leave. */\nexport function useWebPopupReveal() {\n const [revealed, setRevealed] = useState(false);\n const timerRef = useRef(undefined);\n const cancel = () => {\n if (timerRef.current !== undefined) clearTimeout(timerRef.current);\n timerRef.current = undefined;\n };\n useEffect(() => cancel, []);\n const show = () => {\n cancel();\n setRevealed(true);\n };\n const hide = () => {\n cancel();\n timerRef.current = setTimeout(() => setRevealed(false), WEB_POPUP_REVEAL_LEAVE_GRACE_MS);\n };\n return {\n revealed,\n handlers: {\n onMouseEnter: show,\n onMouseLeave: hide,\n onFocus: show,\n onBlur: e => {\n if (!e.currentTarget.contains(e.relatedTarget)) hide();\n }\n }\n };\n}\nfunction transition(delay, revealed) {\n const wait = revealed ? delay ?? 0 : 0;\n const ease = 'cubic-bezier(0.22, 1, 0.36, 1)';\n return `transform ${WEB_POPUP_REVEAL_MS}ms ${ease} ${wait}ms, opacity ${WEB_POPUP_REVEAL_MS}ms ease ${wait}ms`;\n}\nfunction ArrowControl({\n side,\n action,\n gutter,\n colors,\n delay,\n revealed,\n onPageChange,\n onRequestClose\n}) {\n const [hover, setHover] = useState(false);\n const href = action.type === 'href' ? safeUrl(action.url) : undefined;\n const sameTab = action.type === 'href' && action.target === '_self';\n const onClick = () => {\n if (action.type === 'page') onPageChange(action.page);else if (action.type === 'close') onRequestClose?.();else if (href) {\n if (sameTab) window.location.assign(href);else window.open(href, '_blank', 'noopener,noreferrer');\n }\n };\n const tucked = side === 'left' ? 'translateX(100%)' : 'translateX(-100%)';\n const style = {\n position: 'absolute',\n top: '50%',\n [side === 'left' ? 'right' : 'left']: '100%',\n width: gutter,\n height: WEB_POPUP_ARROW_HEIGHT * 2,\n marginTop: -WEB_POPUP_ARROW_HEIGHT,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: 0,\n border: 'none',\n background: 'transparent',\n cursor: 'pointer',\n opacity: revealed ? 1 : 0,\n transform: revealed ? 'translateX(0)' : tucked,\n transition: transition(delay, revealed),\n pointerEvents: revealed ? 'auto' : 'none'\n };\n const glyph = {\n display: 'block',\n overflow: 'visible',\n filter: WEB_POPUP_ARROW_SHADOW,\n transform: hover ? `scale(${WEB_POPUP_CONTROL_HOVER_SCALE}) translateX(${side === 'left' ? -2 : 2}px)` : 'none',\n transition: 'transform 160ms ease'\n };\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": side === 'left' ? 'Previous' : 'Next',\n \"aria-hidden\": !revealed,\n tabIndex: revealed ? 0 : -1,\n \"data-pw-arrow\": side,\n style: style,\n onClick: onClick,\n onMouseEnter: () => setHover(true),\n onMouseLeave: () => setHover(false),\n children: _jsx(\"svg\", {\n width: WEB_POPUP_ARROW_WIDTH,\n height: WEB_POPUP_ARROW_HEIGHT,\n viewBox: `0 0 ${WEB_POPUP_ARROW_WIDTH} ${WEB_POPUP_ARROW_HEIGHT}`,\n style: glyph,\n \"aria-hidden\": \"true\",\n children: _jsx(\"polygon\", {\n points: webPopupArrowPoints(side),\n fill: colors.accent,\n stroke: colors.accent,\n strokeWidth: 2,\n strokeLinejoin: \"round\"\n })\n })\n });\n}\nfunction SlideOutClose({\n colors,\n inset,\n delay,\n revealed,\n onRequestClose\n}) {\n const [hover, setHover] = useState(false);\n const size = WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE;\n const gap = WEB_POPUP_SLIDE_CLOSE_GAP;\n const tucked = `translate(${-(inset + size)}px, ${gap + size}px) scale(${1 / WEB_POPUP_SLIDE_CLOSE_GROWTH})`;\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": \"Close\",\n [WEB_POPUP_CLOSE_ATTRIBUTE]: '',\n tabIndex: revealed ? 0 : -1,\n onClick: onRequestClose,\n onMouseEnter: () => setHover(true),\n onMouseLeave: () => setHover(false),\n style: {\n position: 'absolute',\n left: `calc(100% + ${inset}px)`,\n bottom: `calc(100% + ${gap}px)`,\n width: size,\n height: size,\n padding: 0,\n border: 'none',\n background: 'transparent',\n cursor: 'pointer',\n opacity: revealed ? 1 : 0,\n transform: revealed ? 'translate(0px, 0px) scale(1)' : tucked,\n transition: transition(delay, revealed),\n pointerEvents: revealed ? 'auto' : 'none'\n },\n children: _jsx(\"span\", {\n \"aria-hidden\": \"true\",\n style: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n background: webPopupColorAlpha(colors.surface, 0.96),\n boxShadow: '0 2px 6px rgba(16, 24, 40, 0.28)',\n color: colors.chromeIcon,\n fontSize: 20,\n lineHeight: 1,\n transformOrigin: 'right center',\n transform: hover ? `scale(${WEB_POPUP_CONTROL_HOVER_SCALE})` : 'none',\n transition: 'transform 160ms ease'\n },\n children: \"\\u2715\"\n })\n });\n}\n/** The arrows and the slide-out ✕ of a live popup; drawn BEFORE the box, so they tuck in under it. */\nexport function WebPopupRevealControls({\n page,\n reveal,\n colors,\n revealed,\n onPageChange,\n onRequestClose\n}) {\n const delays = webPopupRevealDelays(reveal, page);\n return _jsxs(_Fragment, {\n children: [page.leftAction && _jsx(ArrowControl, {\n side: \"left\",\n action: page.leftAction,\n gutter: reveal.arrowGutter,\n colors: colors,\n delay: delays.left,\n revealed: revealed,\n onPageChange: onPageChange,\n onRequestClose: onRequestClose\n }), page.rightAction && _jsx(ArrowControl, {\n side: \"right\",\n action: page.rightAction,\n gutter: reveal.arrowGutter,\n colors: colors,\n delay: delays.right,\n revealed: revealed,\n onPageChange: onPageChange,\n onRequestClose: onRequestClose\n }), reveal.slideOutClose && _jsx(SlideOutClose, {\n colors: colors,\n inset: webPopupSlideCloseInset(reveal.arrowGutter, Boolean(page.rightAction)),\n delay: delays.close,\n revealed: revealed,\n onRequestClose: onRequestClose\n })]\n });\n}","import { createContext, useMemo, useState } from 'react';\n/** What a subscribe button reads; a slot outside any WebPopupBox gets this inert session. */\nexport const WebPopupSubscribeContext = createContext({\n answered: false,\n markAnswered: () => {}\n});\n/** The subscribe session a WebPopupBox owns, so a button met again after a page turn stays spent. */\nexport function useWebPopupSubscribeSession() {\n const [answered, setAnswered] = useState(false);\n return useMemo(() => ({\n answered,\n markAnswered: () => setAnswered(true)\n }), [answered]);\n}","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useContext, useEffect, useMemo, useState } from 'react';\nimport { useColorScheme } from './colorScheme';\nimport { webPopupButtonPillStyle, webPopupFormInputStyle, webPopupRatingScores, webPopupTextColor, webPopupSlotGap, webPopupSlotRole, WEB_POPUP_BG_SECTION_FALLBACK, WEB_POPUP_BUTTON_SLOT_PADDING, WEB_POPUP_FONT_STACK, WEB_POPUP_EMAIL_PATTERN, WEB_POPUP_KEYFRAMES, WEB_POPUP_PAGE_TRANSITION_MS, WEB_POPUP_RETRY_ERROR, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from './constants';\nimport { ConsentSlotView, EmailInputSlotView, SubmitSlotView, TagInputSlotView } from './form-slots';\nimport { useWebPopupFormSession, WebPopupFormSessionContext } from './formSession';\nimport { WEB_POPUP_GLYPH_PATHS, WEB_POPUP_THUMB_UP_PATH } from './glyphs';\nimport { applyWebPopupSubscribeOutcome, placementMaxSize, resolveWebPopupPages, resolveWebPopupReveal, safeUrl, sanitizeWebPopupHtml, startPageOf, webPopupCssTextAlign, webPopupDirection, webPopupLinkTargetAttrs } from './helpers';\nimport { webPopupBackgroundImageStyle, webPopupContainerStyle, webPopupScrimGradient } from './layout';\nimport { resolveWebPopupBoxChrome, resolveWebPopupColors, webPopupColorAlpha, webPopupDarkEnabled, webPopupImageSrc } from './palette';\nimport { ProductsSlotView, WebPopupProductsContext } from './productsSlot';\nimport { useWebPopupHoverCapable, useWebPopupReveal, webPopupRevealRoom, WebPopupRevealControls } from './revealControls';\nimport { WEB_POPUP_CLOSE_ATTRIBUTE } from './styles';\nimport { useWebPopupSubscribeSession, WebPopupSubscribeContext } from './subscribeSession';\nimport { webPopupTimerLabels, webPopupTimerRemaining } from './timer';\n// Renders a popup from its model by interpreting each page's embedded layout\n// tree — the same node vocabulary the editor's canvas builds from: container\n// nodes become inline-styled grid divs, `Content` leaves render a named\n// zone's slot stack, `Image` leaves an image param. 'live' mode adds the\n// viewport chrome (overlay, placement, animation, close), 'preview' renders\n// just the popup box inline. Only one page renders at a time; buttons with a\n// `page` action switch pages. All styling is inline (shadow-DOM friendly, no\n// CSS files).\nconst ANIMATION_STYLE = {\n none: undefined,\n fade: 'pw-vpopup-fade 0.35s ease-out backwards',\n slide: 'pw-vpopup-slide 0.35s ease-out backwards'\n};\nfunction TextSlotView({\n slot,\n align,\n inverse,\n colors\n}) {\n const style = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES[slot.variant],\n textAlign: webPopupCssTextAlign(slot.align ?? align)\n };\n const color = webPopupTextColor(slot.variant, colors, inverse);\n if (color) style.color = color;\n // The html comes from the editor's rich-text slots, but the json is\n // API-writable — sanitize on render (inline tags only, safe link hrefs).\n return _jsx(\"div\", {\n style: style,\n dangerouslySetInnerHTML: {\n __html: sanitizeWebPopupHtml(slot.html)\n }\n });\n}\nfunction ButtonSlotView({\n slot,\n colors,\n logger,\n onRequestClose,\n onPageChange,\n onRequestSubscribe,\n onSubscribeClose\n}) {\n const form = useContext(WebPopupFormSessionContext);\n const subscribe = useContext(WebPopupSubscribeContext);\n const [askPhase, setAskPhase] = useState('idle');\n const pill = webPopupButtonPillStyle(slot.variant, colors);\n const wrapper = {};\n if (slot.action.type === 'close') {\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n style: pill,\n onClick: onRequestClose,\n children: slot.label\n })\n });\n }\n if (slot.action.type === 'page') {\n const target = slot.action.page;\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n style: pill,\n onClick: () => form.turnPage(target, onPageChange),\n children: slot.label\n })\n });\n }\n if (slot.action.type === 'subscribe') {\n const {\n action\n } = slot;\n // 'asking' guards the double click (one prompt, one registerDevice);\n // an answered ask stays disabled because the browser grants no second prompt.\n const spent = askPhase !== 'idle' || subscribe.answered;\n const ask = () => {\n if (!onRequestSubscribe || spent) return;\n setAskPhase('asking');\n onRequestSubscribe().then(result => {\n if (result === 'default') {\n setAskPhase('idle');\n return;\n }\n subscribe.markAnswered();\n const next = applyWebPopupSubscribeOutcome(action, result, logger);\n if (next === 'close') {\n onSubscribeClose?.();\n return;\n }\n setAskPhase(result);\n if (next !== 'stay') onPageChange(next.page);\n }).catch(() => setAskPhase('idle'));\n };\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n disabled: spent,\n style: {\n ...pill,\n ...(spent ? {\n opacity: 0.7\n } : {})\n },\n onClick: ask,\n children: slot.label\n })\n });\n }\n const href = safeUrl(slot.action.url);\n // No (safe) URL yet: an inert pill — not an '#' anchor opening a blank tab.\n if (!href) {\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n style: pill,\n children: slot.label\n })\n });\n }\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"a\", {\n href: href,\n ...webPopupLinkTargetAttrs(slot.action.target),\n style: pill,\n children: slot.label\n })\n });\n}\n// The copy a submitted slot leaves behind, in the zone's own body style.\nfunction SlotMessageView({\n message,\n align,\n inverse,\n colors\n}) {\n const color = webPopupTextColor('body', colors, inverse);\n return _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.body,\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: webPopupCssTextAlign(align),\n ...(color ? {\n color\n } : {})\n },\n children: message\n });\n}\nconst FORM_INPUT_TYPES = {\n email: 'email',\n phone: 'tel'\n};\nconst FORM_AUTOCOMPLETE = {\n email: 'email',\n firstName: 'given-name',\n lastName: 'family-name',\n phone: 'tel'\n};\n// The privacy-check error renders under the checkbox row; a field key can\n// never collide with it (normalized keys are non-empty slot-local ids).\nconst PRIVACY_ERROR_KEY = '__privacy';\n/**\n * An email-subscription form slot: the fields, the consent row and the\n * submit pill, all popup-styled. Local state machine: idle → submitting →\n * success/confirm (the form swaps to the slot's message) or error (the form\n * stays, a generic retryable note appears). Without an onSubmitForm handler\n * or a bound formCode the form is inert — inputs type, submit does nothing —\n * which is exactly what previews and the editor canvas want.\n */\nfunction FormSlotView({\n slot,\n align,\n inverse,\n colors,\n onSubmitForm\n}) {\n const [values, setValues] = useState({});\n const [policyAccepted, setPolicyAccepted] = useState(false);\n const [focusedKey, setFocusedKey] = useState(null);\n const [errors, setErrors] = useState({});\n const [phase, setPhase] = useState('idle');\n const captionColor = webPopupTextColor('caption', colors, inverse);\n const captionStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(captionColor ? {\n color: captionColor\n } : {})\n };\n const errorStyle = {\n fontSize: 12,\n lineHeight: 1.4,\n color: colors.error,\n paddingTop: 2\n };\n if (phase === 'success' || phase === 'confirm') {\n return _jsx(SlotMessageView, {\n message: phase === 'confirm' ? slot.confirmEmailMessage : slot.successMessage,\n align: align,\n inverse: inverse,\n colors: colors\n });\n }\n const setFieldValue = (key, value) => {\n setValues(prev => ({\n ...prev,\n [key]: value\n }));\n setErrors(prev => prev[key] ? Object.fromEntries(Object.entries(prev).filter(([k]) => k !== key)) : prev);\n };\n const submit = () => {\n if (!onSubmitForm || !slot.formCode || phase === 'submitting') return;\n const found = {};\n for (const field of slot.fields) {\n const value = (values[field.key] ?? '').trim();\n if (field.required && !value) found[field.key] = 'Required';else if (field.kind === 'email' && value && !WEB_POPUP_EMAIL_PATTERN.test(value)) {\n found[field.key] = 'Enter a valid email';\n }\n }\n if (slot.privacy && !policyAccepted) found[PRIVACY_ERROR_KEY] = 'Please accept the privacy policy';\n setErrors(found);\n if (Object.keys(found).length > 0) return;\n const payload = {\n email: '',\n policyAccepted: slot.privacy ? policyAccepted : true\n };\n const customFields = {};\n for (const field of slot.fields) {\n const value = (values[field.key] ?? '').trim();\n if (!value) continue;\n if (field.kind === 'email') payload.email = payload.email || value;else if (field.kind === 'firstName') payload.firstName = value;else if (field.kind === 'lastName') payload.lastName = value;else if (field.kind === 'phone') payload.phone = value;else customFields[field.tag || field.key] = value;\n }\n if (Object.keys(customFields).length > 0) payload.customFields = customFields;\n setPhase('submitting');\n // Promise.resolve wrapper: a host callback that throws SYNCHRONOUSLY\n // (before returning its promise) must land in the error phase too — a\n // bare .then(ok, fail) would let the throw escape and strand the form\n // in 'submitting' with no way back.\n Promise.resolve().then(() => onSubmitForm(slot.formCode, payload)).then(result => setPhase(result === 'confirm-email' ? 'confirm' : 'success'), () => setPhase('error'));\n };\n const submitting = phase === 'submitting';\n const privacyHref = slot.privacy ? safeUrl(slot.privacy.url) : undefined;\n const pill = {\n ...webPopupButtonPillStyle(slot.submitVariant, colors),\n ...(submitting ? {\n opacity: 0.6,\n cursor: 'default'\n } : {})\n };\n return _jsxs(\"form\", {\n noValidate: true,\n style: {\n margin: 0,\n textAlign: 'start'\n },\n onSubmit: event => {\n event.preventDefault();\n submit();\n },\n children: [slot.fields.map(field => {\n const error = errors[field.key];\n let borderColor;\n if (error) borderColor = colors.error;else if (focusedKey === field.key) borderColor = colors.accent;\n return _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [field.label && _jsx(\"div\", {\n style: {\n ...captionStyle,\n paddingBottom: 4\n },\n children: field.label\n }), _jsx(\"input\", {\n type: FORM_INPUT_TYPES[field.kind] ?? 'text',\n autoComplete: FORM_AUTOCOMPLETE[field.kind],\n placeholder: field.placeholder || undefined,\n value: values[field.key] ?? '',\n disabled: submitting,\n style: webPopupFormInputStyle(colors, borderColor),\n onFocus: () => setFocusedKey(field.key),\n onBlur: () => setFocusedKey(key => key === field.key ? null : key),\n onChange: event => setFieldValue(field.key, event.currentTarget.value)\n }), error && _jsx(\"div\", {\n style: errorStyle,\n children: error\n })]\n }, field.key);\n }), slot.privacy && _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [_jsxs(\"label\", {\n style: {\n ...captionStyle,\n display: 'flex',\n alignItems: 'flex-start',\n gap: 8,\n cursor: 'pointer'\n },\n children: [_jsx(\"input\", {\n type: \"checkbox\",\n checked: policyAccepted,\n disabled: submitting,\n style: {\n margin: '2px 0 0',\n flexShrink: 0\n },\n onChange: event => {\n setPolicyAccepted(event.currentTarget.checked);\n setErrors(prev => prev[PRIVACY_ERROR_KEY] ? Object.fromEntries(Object.entries(prev).filter(([k]) => k !== PRIVACY_ERROR_KEY)) : prev);\n }\n }), _jsxs(\"span\", {\n children: [slot.privacy.checkboxLabel, privacyHref && _jsxs(_Fragment, {\n children: [' ', _jsx(\"a\", {\n href: privacyHref,\n ...webPopupLinkTargetAttrs(undefined),\n style: {\n color: colors.accent\n },\n children: slot.privacy.linkLabel || slot.privacy.url\n })]\n })]\n })]\n }), errors[PRIVACY_ERROR_KEY] && _jsx(\"div\", {\n style: errorStyle,\n children: errors[PRIVACY_ERROR_KEY]\n })]\n }), _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n },\n children: _jsx(\"button\", {\n type: \"submit\",\n disabled: submitting,\n style: pill,\n children: slot.submitLabel\n })\n }), phase === 'error' && _jsx(\"div\", {\n style: {\n ...errorStyle,\n textAlign: webPopupCssTextAlign(align)\n },\n children: WEB_POPUP_RETRY_ERROR\n })]\n });\n}\n// The phase-2 slots. The two that submit follow the form slot's rules exactly:\n// inert without a callback, idle → submitting → success/error, then its copy.\n// One cell of the countdown: the digits over their unit label.\nfunction TimerCell({\n value,\n label,\n digitStyle,\n labelStyle\n}) {\n return _jsxs(\"div\", {\n style: {\n minWidth: 44\n },\n children: [_jsx(\"div\", {\n style: digitStyle,\n children: String(value).padStart(2, '0')\n }), label ? _jsx(\"div\", {\n style: labelStyle,\n children: label\n }) : null]\n });\n}\nfunction TimerSlotView({\n slot,\n align,\n inverse,\n colors,\n mode,\n onRequestClose,\n onPageChange\n}) {\n const [nowMs, setNowMs] = useState(() => Date.now());\n const remaining = webPopupTimerRemaining(slot.endTime, slot.timezone, nowMs);\n const expired = remaining.total === 0;\n // 'preview' draws a still frame: a gallery is many popups at once, and every\n // one of them would tick. A finished countdown stops on its own.\n useEffect(() => {\n if (mode !== 'live' || expired) return undefined;\n const id = setInterval(() => setNowMs(Date.now()), 1000);\n return () => clearInterval(id);\n }, [mode, expired, slot.endTime, slot.timezone]);\n // Past the deadline, the slot does what it was told. 'hide-popup' gets here\n // only for a popup left open ACROSS its deadline (the host gates the rest).\n useEffect(() => {\n if (mode !== 'live' || !expired) return;\n if (slot.onExpire === 'hide-popup') onRequestClose?.();else if (slot.onExpire === 'page' && slot.expirePage) onPageChange(slot.expirePage);\n }, [mode, expired, slot.onExpire, slot.expirePage, onRequestClose, onPageChange]);\n const digitColor = webPopupTextColor('h2', colors, inverse);\n const labelColor = webPopupTextColor('caption', colors, inverse);\n const digitStyle = {\n fontSize: 28,\n fontWeight: 700,\n lineHeight: 1.2,\n // Tabular figures: without them every second reflows the row.\n fontVariantNumeric: 'tabular-nums',\n ...(digitColor ? {\n color: digitColor\n } : {})\n };\n const labelStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(labelColor ? {\n color: labelColor\n } : {})\n };\n const labels = webPopupTimerLabels(slot.language);\n const cells = [{\n value: remaining.days,\n label: labels.days\n }, {\n value: remaining.hours,\n label: labels.hours\n }, {\n value: remaining.minutes,\n label: labels.minutes\n }, {\n value: remaining.seconds,\n label: labels.seconds\n }];\n return _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: webPopupCssTextAlign(align)\n },\n children: _jsx(\"div\", {\n style: {\n display: 'inline-flex',\n gap: 12,\n textAlign: 'center'\n },\n children: cells.map(cell => _jsx(TimerCell, {\n value: cell.value,\n label: slot.showLabels ? cell.label : '',\n digitStyle: digitStyle,\n labelStyle: labelStyle\n }, cell.label || cell.value))\n })\n });\n}\nfunction ChoiceSlotView({\n slot,\n align,\n inverse,\n colors,\n onSubmitChoice\n}) {\n const [picked, setPicked] = useState([]);\n const [phase, setPhase] = useState('idle');\n const [notice, setNotice] = useState('');\n if (phase === 'success') {\n return _jsx(SlotMessageView, {\n message: slot.successMessage,\n align: align,\n inverse: inverse,\n colors: colors\n });\n }\n const toggle = value => {\n setNotice('');\n setPicked(prev => {\n if (prev.includes(value)) return prev.filter(entry => entry !== value);\n // At the ceiling the extra tap is refused with a reason rather than\n // silently dropping the oldest pick.\n if (slot.max > 0 && prev.length >= slot.max) {\n setNotice(`Pick up to ${slot.max}`);\n return prev;\n }\n return [...prev, value];\n });\n };\n const submit = () => {\n if (!onSubmitChoice || !slot.tagName || phase === 'submitting') return;\n // An empty submit would CLEAR the tag — never what a \"save\" button means.\n const floor = Math.max(slot.min, 1);\n if (picked.length < floor) {\n setNotice(floor === 1 ? 'Pick at least one' : `Pick at least ${floor}`);\n return;\n }\n const values = slot.options.filter(option => picked.includes(option.value)).map(option => option.tagValue || option.value);\n setNotice('');\n setPhase('submitting');\n // Promise.resolve wrapper: a host callback that throws SYNCHRONOUSLY must\n // land in the error phase too, not escape and strand the slot.\n Promise.resolve().then(() => onSubmitChoice({\n slotKey: slot.key,\n tagName: slot.tagName,\n values\n })).then(() => setPhase('success'), () => setPhase('error'));\n };\n const submitting = phase === 'submitting';\n const textColor = webPopupTextColor('body', colors, inverse);\n const optionStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.body,\n ...(textColor ? {\n color: textColor\n } : {})\n };\n const chip = selected => ({\n padding: '6px 14px',\n borderRadius: 999,\n border: `1px solid ${colors.accent}`,\n backgroundColor: selected ? colors.accent : 'transparent',\n color: selected ? colors.onAccent : colors.accent,\n fontFamily: 'inherit',\n fontSize: 14,\n lineHeight: 1.4,\n cursor: 'pointer'\n });\n return _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [slot.control === 'chips' ? _jsx(\"div\", {\n style: {\n display: 'flex',\n flexWrap: 'wrap',\n gap: 8,\n justifyContent: align === 'center' ? 'center' : 'flex-start'\n },\n children: slot.options.map(option => _jsx(\"button\", {\n type: \"button\",\n \"aria-pressed\": picked.includes(option.value),\n style: chip(picked.includes(option.value)),\n onClick: () => toggle(option.value),\n children: option.label\n }, option.value))\n }) : _jsx(\"div\", {\n style: {\n display: 'grid',\n gap: 6\n },\n children: slot.options.map(option => _jsxs(\"label\", {\n style: {\n ...optionStyle,\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n cursor: 'pointer'\n },\n children: [_jsx(\"input\", {\n type: \"checkbox\",\n checked: picked.includes(option.value),\n onChange: () => toggle(option.value),\n style: {\n accentColor: colors.accent,\n width: 16,\n height: 16,\n margin: 0\n }\n }), option.label]\n }, option.value))\n }), notice ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n color: colors.error,\n paddingTop: 4\n },\n children: notice\n }) : null, phase === 'error' ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n color: colors.error,\n paddingTop: 4\n },\n children: WEB_POPUP_RETRY_ERROR\n }) : null, _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n },\n children: _jsx(\"button\", {\n type: \"button\",\n style: {\n ...webPopupButtonPillStyle(slot.submitVariant, colors),\n ...(submitting ? {\n opacity: 0.7\n } : {})\n },\n onClick: submit,\n children: slot.submitLabel\n })\n })]\n });\n}\n// One rating button: a number for nps, a star for stars, a thumb for thumbs.\nfunction RatingButton({\n score,\n scale,\n selected,\n colors,\n onPick\n}) {\n const base = {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: 0,\n border: `1px solid ${colors.accent}`,\n backgroundColor: selected ? colors.accent : 'transparent',\n color: selected ? colors.onAccent : colors.accent,\n fontFamily: 'inherit',\n fontSize: 14,\n lineHeight: 1,\n cursor: 'pointer'\n };\n if (scale === 'nps') {\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": `Rate ${score}`,\n \"aria-pressed\": selected,\n style: {\n ...base,\n width: 30,\n height: 32,\n borderRadius: 6\n },\n onClick: onPick,\n children: score\n });\n }\n const thumbs = scale === 'thumbs';\n // Icon-only buttons need a name of their own; the nps row says it in text.\n let label = `Rate ${score}`;\n if (thumbs) label = score === 1 ? 'Thumbs up' : 'Thumbs down';\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": label,\n \"aria-pressed\": selected,\n style: {\n ...base,\n width: thumbs ? 44 : 34,\n height: thumbs ? 40 : 34,\n borderRadius: thumbs ? 8 : 6\n },\n onClick: onPick,\n children: _jsx(\"svg\", {\n width: thumbs ? 22 : 20,\n height: thumbs ? 22 : 20,\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": \"true\",\n children: _jsx(\"path\", {\n d: thumbs ? WEB_POPUP_THUMB_UP_PATH : WEB_POPUP_GLYPH_PATHS.star,\n ...(thumbs && score === 0 ? {\n transform: 'rotate(180 12 12)'\n } : {})\n })\n })\n });\n}\nfunction RatingSlotView({\n slot,\n align,\n inverse,\n colors,\n onSubmitRating\n}) {\n const [score, setScore] = useState(null);\n const [phase, setPhase] = useState('idle');\n if (phase === 'success') {\n return _jsx(SlotMessageView, {\n message: slot.successMessage,\n align: align,\n inverse: inverse,\n colors: colors\n });\n }\n const send = value => {\n if (!onSubmitRating || !slot.eventName || phase === 'submitting') return;\n setPhase('submitting');\n // See ChoiceSlotView: a synchronous throw must land in 'error' too.\n Promise.resolve().then(() => onSubmitRating({\n slotKey: slot.key,\n eventName: slot.eventName,\n score: value,\n scale: slot.scale\n })).then(() => setPhase('success'), () => setPhase('error'));\n };\n const pick = value => {\n // Same guard as `send`: otherwise a tap during an in-flight submit moves the\n // highlight while the host keeps the score that was actually sent.\n if (phase === 'submitting') return;\n setScore(value);\n if (slot.submitMode === 'instant') send(value);\n };\n const scores = webPopupRatingScores(slot.scale);\n const labelColor = webPopupTextColor('caption', colors, inverse);\n const edgeLabelStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(labelColor ? {\n color: labelColor\n } : {})\n };\n // A star scale fills every button up to the pick — the row IS the score.\n const isSelected = value => slot.scale === 'stars' ? score !== null && value <= score : score === value;\n return _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [_jsx(\"div\", {\n style: {\n display: 'flex',\n flexWrap: 'wrap',\n gap: 6,\n justifyContent: align === 'center' ? 'center' : 'flex-start'\n },\n children: scores.map(value => _jsx(RatingButton, {\n score: value,\n scale: slot.scale,\n selected: isSelected(value),\n colors: colors,\n onPick: () => pick(value)\n }, value))\n }), slot.labels.low || slot.labels.high ? _jsxs(\"div\", {\n style: {\n display: 'flex',\n justifyContent: 'space-between',\n gap: 8,\n paddingTop: 4\n },\n children: [_jsx(\"span\", {\n style: edgeLabelStyle,\n children: slot.labels.low\n }), _jsx(\"span\", {\n style: edgeLabelStyle,\n children: slot.labels.high\n })]\n }) : null, phase === 'error' ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n color: colors.error,\n paddingTop: 4\n },\n children: WEB_POPUP_RETRY_ERROR\n }) : null, slot.submitMode === 'button' ? _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n },\n children: _jsx(\"button\", {\n type: \"button\",\n style: {\n ...webPopupButtonPillStyle('primary', colors),\n ...(phase === 'submitting' ? {\n opacity: 0.7\n } : {})\n },\n onClick: () => score === null ? undefined : send(score),\n children: slot.submitLabel\n })\n }) : null]\n });\n}\nfunction GlyphSlotView({\n slot,\n align,\n inverse,\n colors\n}) {\n // No authored color: the accent, or the inverse copy color over a dark image\n // (where the accent can be the one thing that doesn't read).\n const color = slot.color || (inverse ? colors.textInverse : colors.accent);\n return _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: webPopupCssTextAlign(align),\n lineHeight: 0\n },\n children: _jsx(\"svg\", {\n width: slot.size,\n height: slot.size,\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: color,\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": \"true\",\n style: {\n display: 'inline-block'\n },\n children: _jsx(\"path\", {\n d: WEB_POPUP_GLYPH_PATHS[slot.name]\n })\n })\n });\n}\n// A switch, not a chain of `&&`: the compiler is what notices a slot type with\n// no view. Exported so the editor canvas draws these slots with it, not a copy.\nexport function WebPopupSlotView({\n slot,\n align,\n inverse,\n colors,\n mode = 'live',\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitChoice,\n onSubmitRating,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n // A page jump nobody handles is a no-op, not a crash — the editor canvas\n // and the previews mount this without any navigation of their own.\n const pageChange = onPageChange ?? (() => {});\n switch (slot.type) {\n case 'text':\n return _jsx(TextSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors\n });\n case 'button':\n return _jsx(ButtonSlotView, {\n slot: slot,\n colors: colors,\n onRequestClose: onRequestClose,\n onPageChange: pageChange,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n });\n case 'email-subscription-form':\n return _jsx(FormSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n onSubmitForm: onSubmitForm\n });\n case 'timer':\n return _jsx(TimerSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n mode: mode,\n onRequestClose: onRequestClose,\n onPageChange: pageChange\n });\n case 'choice':\n return _jsx(ChoiceSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n onSubmitChoice: onSubmitChoice\n });\n case 'rating':\n return _jsx(RatingSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n onSubmitRating: onSubmitRating\n });\n case 'glyph':\n return _jsx(GlyphSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors\n });\n case 'products':\n return _jsx(ProductsSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors,\n mode: mode\n });\n case 'email-input':\n return _jsx(EmailInputSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors\n });\n case 'tag-input':\n return _jsx(TagInputSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors\n });\n case 'consent':\n return _jsx(ConsentSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors\n });\n case 'submit':\n return _jsx(SubmitSlotView, {\n slot: slot,\n align: align,\n colors: colors\n });\n }\n}\n// A Content leaf: the named zone's slots (texts, buttons and forms in order)\n// as a grid stack. An unknown zone key renders as an empty spot, not a crash.\nfunction ContentNodeView({\n node,\n page,\n colors,\n mode,\n leaf,\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitChoice,\n onSubmitRating,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n const zone = page.contents.find(z => z.key === node.props.content);\n if (!zone) return null;\n if (leaf?.renderZone) {\n return _jsx(\"div\", {\n style: {\n minWidth: 0\n },\n children: leaf.renderZone(zone, node)\n });\n }\n const align = node.props.align ?? 'left';\n const inverse = node.props.tone === 'inverse';\n return _jsx(\"div\", {\n style: {\n minWidth: 0\n },\n children: zone.slots.map((slot, index) => {\n const previous = zone.slots[index - 1];\n const marginTop = previous ? webPopupSlotGap(webPopupSlotRole(previous), webPopupSlotRole(slot)) : 0;\n return _jsx(\"div\", {\n style: marginTop ? {\n marginTop\n } : undefined,\n children: _jsx(WebPopupSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n mode: mode,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange,\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n })\n }, slot.key);\n })\n });\n}\n// The playable url of a media param, or undefined when it has no video.\nfunction mediaVideoSrc(image) {\n return image?.video ? safeUrl(image.video.src) : undefined;\n}\n// A media param's video: autoplay only muted, playsInline to keep iOS out of\n// fullscreen, and in 'preview' it holds on the poster instead of streaming.\nfunction MediaVideo({\n image,\n poster,\n src,\n style,\n mode\n}) {\n return _jsx(\"video\", {\n src: src,\n poster: poster || undefined,\n style: style,\n autoPlay: mode === 'live',\n muted: true,\n playsInline: true,\n preload: \"metadata\",\n loop: image.video?.loop !== false,\n controls: image.video?.controls === true\n });\n}\nfunction ImageNodeView({\n node,\n page,\n leaf,\n mode,\n scheme\n}) {\n const image = page.images.find(i => i.key === node.props.image);\n if (!image) return null;\n // The override sees srcless params too — an editor wants a placeholder\n // where the runtime shows nothing.\n if (leaf?.renderImage) return _jsx(_Fragment, {\n children: leaf.renderImage(image, node)\n });\n const video = mediaVideoSrc(image);\n const src = webPopupImageSrc(image, scheme);\n if (!src && !video) return null;\n const style = {\n display: 'block',\n width: '100%',\n minWidth: 0\n };\n if (image.fit) {\n style.height = '100%';\n style.objectFit = image.fit;\n } else {\n style.height = 'auto';\n }\n if (image.blur) style.filter = `blur(${image.blur}px)`;\n if (video) {\n return _jsx(MediaVideo, {\n image: image,\n poster: src,\n src: video,\n style: style,\n mode: mode\n });\n }\n return _jsx(\"img\", {\n src: src,\n alt: \"\",\n style: style\n });\n}\n// Both layered backgrounds (blur, video) share this shell: the color/poster\n// paints on an outer grid box, the content rides an inner layer covering it.\nfunction LayeredBackgroundBox({\n style,\n outer,\n inner,\n layer,\n children\n}) {\n const {\n backgroundColor,\n ...rest\n } = style;\n return _jsxs(\"div\", {\n style: {\n display: 'grid',\n minWidth: 0,\n backgroundColor,\n ...outer\n },\n children: [layer, _jsx(\"div\", {\n style: {\n ...rest,\n ...inner\n },\n children: children\n })]\n });\n}\n// The tree interpreter: containers → grid divs, leaves → zone/image views.\nfunction LayoutNodeView({\n node,\n page,\n colors,\n mode,\n scheme,\n leaf,\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitChoice,\n onSubmitRating,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n if (node.type === 'Content') {\n return _jsx(ContentNodeView, {\n node: node,\n page: page,\n colors: colors,\n mode: mode,\n scheme: scheme,\n leaf: leaf,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange,\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n });\n }\n if (node.type === 'Image') {\n return _jsx(ImageNodeView, {\n node: node,\n page: page,\n leaf: leaf,\n mode: mode,\n scheme: scheme\n });\n }\n const bgKey = node.props?.backgroundImage;\n const background = bgKey ? page.images.find(i => i.key === bgKey) : undefined;\n const blur = background?.blur ?? 0;\n const dim = background?.dim ?? 0;\n const bgVideo = mediaVideoSrc(background);\n const bgSrc = background ? webPopupImageSrc(background, scheme) : undefined;\n const style = webPopupContainerStyle(node, blur > 0 || bgVideo ? undefined : bgSrc || undefined, dim);\n if (bgKey) style.backgroundColor = WEB_POPUP_BG_SECTION_FALLBACK;\n const children = node.children.map((child, index) => _jsx(LayoutNodeView\n // Layout nodes are static per page render — positional keys are fine.\n , {\n node: child,\n page: page,\n colors: colors,\n mode: mode,\n scheme: scheme,\n leaf: leaf,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange,\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n }, index));\n if (bgVideo && background) {\n // A background video can't ride the css background property, so it paints\n // as its own layer; the scrim moves onto the content layer above it.\n const scrim = webPopupScrimGradient(dim);\n return _jsx(LayeredBackgroundBox, {\n style: style,\n outer: {\n position: 'relative',\n overflow: 'hidden',\n ...(bgSrc ? webPopupBackgroundImageStyle(bgSrc) : {})\n },\n inner: {\n position: 'relative',\n ...(scrim ? {\n backgroundImage: scrim\n } : {})\n },\n layer: _jsx(MediaVideo, {\n image: background,\n poster: bgSrc ?? '',\n src: bgVideo,\n mode: mode,\n style: {\n position: 'absolute',\n inset: 0,\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n ...(blur > 0 ? {\n filter: `blur(${blur}px)`\n } : {})\n }\n }),\n children: children\n });\n }\n if (blur > 0) {\n // backdrop-filter blurs what's painted BEHIND its element, never the\n // element's own background — so the image paints on an outer box and the\n // laid-out content rides an inner blurring layer covering it edge to\n // edge (grid/padding move onto that layer). The outer box is a grid so\n // a stretched height (a 'stretch' page's root) passes through to the\n // layer actually carrying alignContent.\n return _jsx(LayeredBackgroundBox, {\n style: style,\n outer: bgSrc ? webPopupBackgroundImageStyle(bgSrc, dim) : undefined,\n inner: {\n backdropFilter: `blur(${blur}px)`,\n WebkitBackdropFilter: `blur(${blur}px)`\n },\n children: children\n });\n }\n return _jsx(\"div\", {\n style: style,\n children: children\n });\n}\n// The popup box: the shared chrome (background, radius, shadow) around one\n// resolved page's layout tree. Exported for the editor — its canvas is this\n// very interpreter with `leafRenderers` swapping the Content/Image leaves\n// for editable views (the container interpretation stays this component's,\n// which is what keeps the canvas true to the runtime); the viewport chrome\n// (placement, overlay, enter animation) is the caller's business there.\n// After a page switch (`animatePage`) the incoming content fades in — keyed\n// by page so the animation restarts per switch — and an explicit px height\n// glides via the transition (auto heights just snap).\nexport function WebPopupBox({\n page,\n params,\n mode = 'live',\n colorScheme = 'light',\n leafRenderers,\n animatePage = false,\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitFormValues,\n onSubmitChoice,\n onSubmitRating,\n products,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n const formSession = useWebPopupFormSession(params, page.key, onPageChange, onSubmitFormValues);\n const subscribeSession = useWebPopupSubscribeSession();\n const colors = resolveWebPopupColors(params, colorScheme);\n const box = resolveWebPopupBoxChrome(params, colorScheme);\n const dir = useMemo(() => webPopupDirection(params), [params]);\n const style = {\n position: 'relative',\n boxSizing: 'border-box',\n overflow: 'hidden',\n backgroundColor: colors.background,\n colorScheme: colors.scheme,\n fontFamily: WEB_POPUP_FONT_STACK,\n color: colors.text,\n borderRadius: params.borderRadius > 0 ? params.borderRadius : undefined,\n boxShadow: box.boxShadow && box.boxShadow !== 'none' ? box.boxShadow : undefined,\n transition: `height ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease`\n };\n if (page.height) {\n // 'stretch' fills whatever box the caller gives (the fixed container pins\n // both vertical edges in live mode); a px height is the box's own.\n style.height = page.height === 'stretch' ? '100%' : page.height;\n style.overflowY = 'auto';\n }\n // A stretch page's tree gets the full box height to lay out in: the\n // min-height'd single-track grid stretches the root container, so its\n // alignContent can place the content vertically (a px height keeps the\n // pre-stretch behavior — content flows from the top).\n const pageStyle = {\n ...(animatePage ? {\n animation: `pw-vpopup-page ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease-out backwards`\n } : {}),\n ...(page.height === 'stretch' ? {\n display: 'grid',\n minHeight: '100%'\n } : {})\n };\n return _jsx(\"div\", {\n dir: dir,\n style: style,\n children: _jsx(WebPopupFormSessionContext.Provider, {\n value: formSession,\n children: _jsx(WebPopupProductsContext.Provider, {\n value: products,\n children: _jsx(WebPopupSubscribeContext.Provider, {\n value: subscribeSession,\n children: _jsx(\"div\", {\n style: pageStyle,\n children: _jsx(LayoutNodeView, {\n node: page.layout,\n page: page,\n colors: colors,\n mode: mode,\n scheme: colors.scheme,\n leaf: leafRenderers,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange ?? (() => {}),\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n })\n }, page.key)\n })\n })\n })\n });\n}\nfunction CloseButton({\n colors,\n onRequestClose\n}) {\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": \"Close\",\n [WEB_POPUP_CLOSE_ATTRIBUTE]: '',\n onClick: onRequestClose,\n style: {\n position: 'absolute',\n top: 10,\n insetInlineEnd: 10,\n width: 24,\n height: 24,\n padding: 0,\n border: 'none',\n borderRadius: '50%',\n background: webPopupColorAlpha(colors.surface, 0.92),\n boxShadow: '0 1px 3px rgba(16, 24, 40, 0.25)',\n color: colors.chromeIcon,\n fontSize: 13,\n lineHeight: 1,\n cursor: 'pointer'\n },\n children: \"\\u2715\"\n });\n}\n// Fixed viewport placement from the placement param: anchored edges get the\n// offset, unanchored axes center via translate. No width = stretch between\n// the side gutters; height 'stretch' = pinned to both vertical edges the same\n// way. The size is the ACTIVE page's (resolved page ?? chrome), so the box\n// re-anchors itself when a page switch changes it.\nfunction fixedContainerStyle(params, width, height, room = {\n side: 0,\n top: 0\n}) {\n const sideOffset = params.placement.offset + room.side;\n const topOffset = params.placement.offset + room.top;\n const placement = params.placement;\n const style = {\n position: 'fixed',\n boxSizing: 'border-box',\n maxWidth: room.side ? `calc(100% - ${sideOffset * 2}px)` : placementMaxSize(placement),\n maxHeight: room.top ? `calc(100% - ${placement.offset * 2 + room.top}px)` : placementMaxSize(placement),\n // The widget host is pointer-transparent (a corner banner must not block\n // the page); the popup itself takes clicks back.\n pointerEvents: 'auto'\n };\n if (width) {\n style.width = width;\n const h = placement.h;\n if (h === 'left') style.left = sideOffset;else if (h === 'right') style.right = sideOffset;else style.left = '50%';\n } else {\n // Stretch: pin both side edges regardless of the horizontal anchor.\n style.left = sideOffset;\n style.right = sideOffset;\n }\n if (height === 'stretch') {\n // Stretch: pin both vertical edges; the v anchor has nothing to place.\n style.top = topOffset;\n style.bottom = placement.offset;\n } else if (placement.v === 'top') style.top = topOffset;else if (placement.v === 'bottom') style.bottom = placement.offset;else style.top = '50%';\n const tx = width && placement.h === 'center' ? '-50%' : '0';\n const ty = placement.v === 'middle' && height !== 'stretch' ? '-50%' : '0';\n if (tx !== '0' || ty !== '0') style.transform = `translate(${tx}, ${ty})`;\n const anim = ANIMATION_STYLE[params.animation];\n if (anim) style.animation = anim;\n // A page switch that changes the (explicit) width glides instead of\n // jumping; the anchored edges keep the box pinned while it resizes.\n style.transition = `width ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease`;\n return style;\n}\nexport function WebPopupReader({\n params,\n mode = 'live',\n colorScheme = 'auto',\n onRequestClose,\n onSubmitForm,\n onSubmitFormValues,\n onSubmitChoice,\n onSubmitRating,\n products,\n onRequestSubscribe,\n logger,\n leafRenderers\n}) {\n // null = never navigated: show the start page. Guarded against keys that\n // don't exist (anymore) — an edited/older document falls back gracefully.\n const [pageKey, setPageKey] = useState(null);\n // Only the active page's images are in the DOM — the rest would start\n // downloading on the page switch, leaving the previous picture on screen\n // until the new one arrives. Warm the browser cache for every page up front.\n useEffect(() => {\n resolveWebPopupPages(params).forEach(p => p.images.forEach(({\n src,\n srcDark\n }) => {\n [src, srcDark].forEach(url => {\n if (url) new Image().src = url;\n });\n }));\n }, [params]);\n const scheme = useColorScheme(colorScheme, webPopupDarkEnabled(params));\n const dir = useMemo(() => webPopupDirection(params), [params]);\n const hoverCapable = useWebPopupHoverCapable();\n const {\n revealed,\n handlers: revealHandlers\n } = useWebPopupReveal();\n const pages = resolveWebPopupPages(params);\n if (pages.length === 0) return null;\n const page = pages.find(p => p.key === pageKey) ?? startPageOf(params, pages);\n // null = the initial page: entry is the chrome's business (the enter\n // animation in live mode); the page fade only plays on actual switches.\n const animatePage = pageKey !== null;\n if (mode === 'preview') {\n return _jsxs(\"div\", {\n style: {\n position: 'relative',\n width: page.width ?? '100%',\n transition: `width ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease`\n },\n children: [_jsx(\"style\", {\n children: WEB_POPUP_KEYFRAMES\n }), _jsx(WebPopupBox, {\n page: page,\n params: params,\n mode: mode,\n colorScheme: scheme,\n leafRenderers: leafRenderers,\n animatePage: animatePage,\n onRequestClose: onRequestClose,\n onPageChange: setPageKey,\n onSubmitForm: onSubmitForm,\n onSubmitFormValues: onSubmitFormValues,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n products: products,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onRequestClose,\n logger: logger\n })]\n });\n }\n const {\n overlay\n } = resolveWebPopupBoxChrome(params, scheme);\n const colors = resolveWebPopupColors(params, scheme);\n const reveal = resolveWebPopupReveal(params, pages);\n const room = webPopupRevealRoom(reveal, hoverCapable);\n return _jsxs(_Fragment, {\n children: [_jsx(\"style\", {\n children: WEB_POPUP_KEYFRAMES\n }), overlay && _jsx(\"div\", {\n style: {\n position: 'fixed',\n inset: 0,\n backgroundColor: overlay.color,\n opacity: overlay.opacity,\n animation: 'pw-vpopup-overlay 0.2s ease-out backwards',\n pointerEvents: 'auto'\n },\n onClick: onRequestClose\n }), _jsxs(\"div\", {\n dir: dir,\n style: fixedContainerStyle(params, page.width, page.height, room),\n ...revealHandlers,\n children: [hoverCapable && _jsx(WebPopupRevealControls, {\n page: page,\n reveal: reveal,\n colors: colors,\n revealed: revealed,\n onPageChange: setPageKey,\n onRequestClose: onRequestClose\n }), _jsx(WebPopupBox, {\n page: page,\n params: params,\n mode: mode,\n colorScheme: scheme,\n leafRenderers: leafRenderers,\n animatePage: animatePage,\n onRequestClose: onRequestClose,\n onPageChange: setPageKey,\n onSubmitForm: onSubmitForm,\n onSubmitFormValues: onSubmitFormValues,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n products: products,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onRequestClose,\n logger: logger\n }), !(hoverCapable && reveal.slideOutClose) && _jsx(CloseButton, {\n colors: colors,\n onRequestClose: onRequestClose\n })]\n })]\n });\n}","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useMemo, useState } from 'react';\nimport { useColorScheme } from './colorScheme';\nimport { resolveWebPopupPages, startPageOf, webPopupParamsWithoutCloseButtons } from './helpers';\nimport { webPopupDarkEnabled } from './palette';\nimport { WEB_POPUP_INLINE_IMAGE_CAP_CSS, WEB_POPUP_INLINE_SCOPE_ATTRIBUTE, WEB_POPUP_INLINE_WRAPPER_STYLE } from './styles';\nimport { WebPopupBox } from './WebPopupReader';\n/**\n * An Inline (EMBEDDED) block: one page box at its container's full width (the page width is ignored),\n * without ✕ and, unless the host passes onRequestClose, without close-action buttons. A subscribe answer removes it through onRequestRemove.\n * `<img>` is capped by a `<style>` scoped to the wrapper's attribute, so the rule never reaches\n * the host page, in a shadow root or in the light DOM. Page navigation is internal.\n */\nexport function WebPopupInline({\n params,\n mode = 'live',\n colorScheme = 'auto',\n logger,\n onSubmitForm,\n onSubmitFormValues,\n onSubmitChoice,\n onSubmitRating,\n products,\n onRequestSubscribe,\n onRequestRemove,\n onRequestClose\n}) {\n const [pageKey, setPageKey] = useState(null);\n const shown = useMemo(() => onRequestClose ? params : webPopupParamsWithoutCloseButtons(params), [params, onRequestClose]);\n const scheme = useColorScheme(colorScheme, webPopupDarkEnabled(shown));\n const pages = resolveWebPopupPages(shown);\n if (pages.length === 0) return null;\n const page = pages.find(candidate => candidate.key === pageKey) ?? startPageOf(shown, pages);\n return _jsxs(\"div\", {\n [WEB_POPUP_INLINE_SCOPE_ATTRIBUTE]: '',\n style: WEB_POPUP_INLINE_WRAPPER_STYLE,\n children: [_jsx(\"style\", {\n children: WEB_POPUP_INLINE_IMAGE_CAP_CSS\n }), _jsx(WebPopupBox, {\n page: page,\n params: shown,\n mode: mode,\n colorScheme: scheme,\n onRequestClose: onRequestClose,\n onPageChange: setPageKey,\n onSubmitForm: onSubmitForm,\n onSubmitFormValues: onSubmitFormValues,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n products: products,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onRequestRemove,\n logger: logger\n })]\n });\n}","import { type WebPopupFormSubmitHandler, type WebPopupFormSubmitResult } from '@pushwoosh/websdk-common/web-popups';\n\nimport { SUBSCRIPTION_FORMS_API_URL } from './constants';\nimport { Logger } from '../../core/logger';\n\n// The subscription-form service client for popup-embedded forms\n// (email-subscription-form slots). Same endpoints and payloads the hosted\n// <pushwoosh-subscribe-widget> uses — the popup reader only renders the\n// fields; subscribing an email goes through the service so form stats,\n// double opt-in and tag mapping keep working.\n\nconst SUBMIT_RESULTS: Record<string, WebPopupFormSubmitResult> = {\n SUBMIT_FORM_RESULT_SUBSCRIBED: 'subscribed',\n SUBMIT_FORM_RESULT_CONFIRM_EMAIL: 'confirm-email',\n SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED: 'already-subscribed',\n};\n\nconst formUrl = (formCode: string, action: string): string => (\n `${SUBSCRIPTION_FORMS_API_URL}/forms/code/${encodeURIComponent(formCode)}${action}`\n);\n\n/**\n * The reader's `onSubmitForm` handler: POST the slot's payload to the bound\n * form's submit endpoint. Throws on transport errors and unrecognized\n * results — the form slot shows its generic retryable error then; the\n * reader doesn't log, so the failure is recorded here before rethrowing.\n */\nexport const submitSubscriptionForm: WebPopupFormSubmitHandler = async (formCode, payload) => {\n try {\n const response = await fetch(formUrl(formCode, '/submit'), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n // userId mirrors the hosted widget's convention: same as the email.\n body: JSON.stringify({ ...payload, userId: payload.email }),\n });\n if (!response.ok) {\n throw new Error(`Subscription form submit failed: HTTP ${response.status}`);\n }\n const data = await response.json() as { result?: string };\n const result = SUBMIT_RESULTS[data.result ?? ''];\n if (!result) {\n throw new Error(`Subscription form submit failed: unexpected result \"${data.result}\"`);\n }\n return result;\n } catch (error) {\n Logger.error(error, `Failed to submit subscription form \"${formCode}\"`);\n throw error;\n }\n};\n\n/**\n * Fire-and-forget view stat for a popup-embedded form — the denominator of\n * the form's conversion rate. Never blocks or breaks the popup itself.\n */\nexport const recordSubscriptionFormView = (formCode: string, hwid: string): void => {\n fetch(formUrl(formCode, '/view'), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ code: formCode, userId: hwid, hwid }),\n }).catch((error) => {\n Logger.error(error, `Failed to record subscription form view for \"${formCode}\"`);\n });\n};\n","import { type WebPopupLogger } from '@pushwoosh/websdk-common/web-popups';\n\nimport { WEB_POPUPS_LOG_PREFIX } from './constants';\nimport { Logger } from '../../core/logger';\n\n// Logger has no warn level; error keeps the renderer's reasons visible at the default log level.\nexport const webPopupLogger: WebPopupLogger = {\n warn: (message) => Logger.error(WEB_POPUPS_LOG_PREFIX, message),\n};\n","import { type WebPopupParams } from '@pushwoosh/websdk-common/web-popups';\n\nimport {\n EMBEDDED_DISMISS_ATTRIBUTE, EMBEDDED_ORDER_ATTRIBUTE, WEB_POPUPS_LOG_PREFIX, WEB_POPUPS_WIDGET_NAMESPACE,\n} from './constants';\nimport { type WebPopup, type WebPopupEntry, type WebPopupShowTrigger } from './types';\nimport { Logger } from '../../core/logger';\n\nexport const isEmbeddedWebPopup = (popup: WebPopup): boolean => popup.kind === 'EMBEDDED';\n\n/** What the blocks need from the widget: page rules, rendering and stats live there. */\nexport type EmbeddedWebPopupsDeps = {\n matchesPage: (popup: WebPopup) => boolean;\n render: (container: HTMLElement, params: WebPopupParams, entry: WebPopupEntry) => void;\n unmount: (container: HTMLElement) => void;\n recordVisit: (entry: WebPopupEntry) => void;\n recordImpression: (code: string) => void;\n recordFormViews: (code: string, params: WebPopupParams) => void;\n dispatchShown: (code: string, trigger: WebPopupShowTrigger) => void;\n /** The ✕ the SDK draws on a dismissible journey placement. */\n dismiss: (entry: WebPopupEntry) => void;\n};\n\ntype EmbeddedBlock = {\n entry: WebPopupEntry;\n element: Element;\n host: HTMLElement;\n container: HTMLElement;\n /** 'api' blocks stay across navigation until their element leaves the page. */\n trigger: WebPopupShowTrigger;\n /** Waits for the first time the block is seen; null once seen (or never needed). */\n observer: IntersectionObserver | null;\n};\n\n/** EMBEDDED campaigns render inside the site's own elements: no delay, queue,\n * frequency or display slot — every eligible one renders. */\nexport class EmbeddedWebPopups {\n private readonly deps: EmbeddedWebPopupsDeps;\n\n /** Blocks on the page, keyed by campaign code. */\n private readonly blocks = new Map<string, EmbeddedBlock>();\n\n /** Campaigns already seen (IMPRESSION + form views reported) during this page load. */\n private readonly viewed = new Set<string>();\n\n /** Campaigns whose auto placement was already skipped with a log during this page load. */\n private readonly autoSkipLogged = new Set<string>();\n\n constructor(deps: EmbeddedWebPopupsDeps) {\n this.deps = deps;\n }\n\n /** Bring the blocks in line with the current page; called on load and on every navigation. */\n public syncWithPage(entries: Iterable<WebPopupEntry>, canAutoShow: (entry: WebPopupEntry) => boolean): void {\n for (const entry of entries) {\n if (!isEmbeddedWebPopup(entry.popup)) {\n continue;\n }\n\n const { code } = entry.popup;\n\n // The router dropped the element: the block sits in a detached node with live listeners.\n if (this.blocks.get(code)?.host.isConnected === false) {\n this.remove(code);\n }\n\n if (this.blocks.get(code)?.trigger === 'api') {\n continue;\n }\n\n if (!this.deps.matchesPage(entry.popup)) {\n this.remove(code);\n continue;\n }\n\n if (entry.content && canAutoShow(entry)) {\n this.place(entry, entry.content, 'auto');\n }\n }\n }\n\n /** Render on demand; false when there is no element to render into. */\n public show(entry: WebPopupEntry, content: WebPopupParams): boolean {\n return this.place(entry, content, 'api');\n }\n\n /** Remove the blocks the predicate picks, show() ones included; places nothing. */\n public removeWhere(shouldRemove: (entry: WebPopupEntry) => boolean): void {\n for (const [code, block] of [...this.blocks]) {\n if (shouldRemove(block.entry)) {\n this.remove(code);\n }\n }\n }\n\n private place(entry: WebPopupEntry, content: WebPopupParams, trigger: WebPopupShowTrigger): boolean {\n const { popup } = entry;\n\n const element = this.findContainer(popup, trigger);\n if (!element) {\n // The old block, if any, sits in a detached node with live listeners.\n this.remove(popup.code);\n return false;\n }\n\n const current = this.blocks.get(popup.code);\n if (current?.element === element && current.host.isConnected) {\n // The site asked for this block explicitly: it now outlives the page rules.\n if (trigger === 'api') {\n current.trigger = 'api';\n }\n return true;\n }\n\n // The router replaced or emptied the element: the old block is off the page.\n this.remove(popup.code);\n\n const host = document.createElement('div');\n host.id = `${WEB_POPUPS_WIDGET_NAMESPACE}-embedded-${popup.code}`;\n host.setAttribute(EMBEDDED_ORDER_ATTRIBUTE, String(entry.order));\n // A flex or grid container would otherwise shrink the block to its content.\n host.style.width = entry.placement?.width || '100%';\n element.insertBefore(host, this.firstBlockAfter(element, entry.order));\n\n const shadow = host.attachShadow({ mode: 'open' });\n const container = document.createElement('div');\n shadow.appendChild(container);\n\n // The inline renderer draws no ✕ of its own, so a journey placement the visitor may close gets one here.\n if (entry.placement?.dismissible) {\n host.style.position = 'relative';\n shadow.appendChild(this.createDismissButton(() => this.deps.dismiss(entry)));\n }\n\n this.deps.render(container, content, entry);\n this.blocks.set(popup.code, {\n entry, element, host, container, trigger, observer: this.watchFirstView(entry, content, host),\n });\n\n this.reportShown(entry, trigger);\n return true;\n }\n\n private createDismissButton(onClick: () => void): HTMLButtonElement {\n const button = document.createElement('button');\n button.type = 'button';\n button.textContent = '×';\n button.setAttribute('aria-label', 'Close');\n button.setAttribute(EMBEDDED_DISMISS_ATTRIBUTE, '');\n Object.assign(button.style, {\n position: 'absolute', top: '8px', right: '8px', width: '24px', height: '24px', padding: '0', border: 'none',\n borderRadius: '50%', background: 'rgba(0, 0, 0, 0.45)', color: '#FFFFFF', font: '16px/24px sans-serif', cursor: 'pointer',\n });\n button.addEventListener('click', onClick);\n\n return button;\n }\n\n private firstBlockAfter(element: Element, order: number): Element | null {\n return Array.from(element.children).find((child) => (\n child.hasAttribute(EMBEDDED_ORDER_ATTRIBUTE) && Number(child.getAttribute(EMBEDDED_ORDER_ATTRIBUTE)) > order\n )) ?? null;\n }\n\n private remove(code: string): void {\n const block = this.blocks.get(code);\n if (!block) {\n return;\n }\n\n this.blocks.delete(code);\n block.observer?.disconnect();\n this.deps.unmount(block.container);\n block.host.remove();\n }\n\n private findContainer(popup: WebPopup, trigger: WebPopupShowTrigger): Element | null {\n const { code, css_selector: selector } = popup;\n if (!selector) {\n this.logSkip(code, trigger, `${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\" has no css_selector; skipping`);\n return null;\n }\n\n try {\n const element = document.querySelector(selector);\n if (!element) {\n this.logSkip(code, trigger, `${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\": nothing matches \"${selector}\" on this page; skipping`);\n }\n return element;\n } catch (error) {\n // The selector comes from the dashboard/API verbatim; a broken one must not break the site.\n this.logSkip(code, trigger, `${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\": invalid css_selector \"${selector}\"; skipping`, error);\n return null;\n }\n }\n\n // Auto placement reruns on every navigation, so it logs once per page load;\n // show() resolves false and must say why on every call.\n private logSkip(code: string, trigger: WebPopupShowTrigger, ...details: Array<unknown>): void {\n if (trigger === 'auto') {\n if (this.autoSkipLogged.has(code)) {\n return;\n }\n this.autoSkipLogged.add(code);\n }\n\n Logger.debug(...details);\n }\n\n private reportShown(entry: WebPopupEntry, trigger: WebPopupShowTrigger): void {\n const { code } = entry.popup;\n\n this.deps.recordVisit(entry);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\" rendered (trigger: ${trigger})`);\n this.deps.dispatchShown(code, trigger);\n }\n\n // The block renders at once (no layout jump), but only a block the visitor\n // actually scrolled to counts as an impression.\n private watchFirstView(entry: WebPopupEntry, content: WebPopupParams, host: HTMLElement): IntersectionObserver | null {\n if (this.viewed.has(entry.popup.code)) {\n return null;\n }\n\n if (typeof IntersectionObserver !== 'function') {\n this.reportViewed(entry.popup.code, content);\n return null;\n }\n\n const observer = new IntersectionObserver((records) => {\n if (!records.some((record) => record.isIntersecting)) {\n return;\n }\n\n observer.disconnect();\n this.reportViewed(entry.popup.code, content);\n });\n observer.observe(host);\n\n return observer;\n }\n\n private reportViewed(code: string, content: WebPopupParams): void {\n if (this.viewed.has(code)) {\n return;\n }\n\n this.viewed.add(code);\n this.deps.recordImpression(code);\n this.deps.recordFormViews(code, content);\n }\n}\n","import { type WebPopup } from './types';\n\n// Upward speed, px per ms, that counts as a flick back to the top rather than reading upwards.\nconst FAST_SCROLL_UP_SPEED = 1.5;\n// The flick must end within the first screen of the page.\nconst TOP_ZONE_SCREENS = 1;\n// Momentum keeps a flick scrolling after the finger lifts; a scroll this long after any touch is the page's own.\nconst TOUCH_SCROLL_WINDOW_MS = 1000;\nconst TOUCH_EVENTS = ['touchstart', 'touchmove', 'touchend'] as const;\n// A history entry pushed without a user gesture is skipped by Back in Chromium, so the guard waits for one.\nconst ACTIVATION_EVENTS = ['pointerdown', 'touchstart', 'keydown'] as const;\nconst GUARD_STATE_KEY = '__pwExitIntent';\n\nexport type ExitIntentFormFactor = 'DESKTOP' | 'MOBILE';\n\n/** Returns whether a popup is now on screen: Back that showed nothing must still leave. */\nexport type ExitIntentHandler = () => boolean;\n\nexport const isExitIntentWebPopup = (popup: WebPopup): boolean => popup.trigger_type === 'EXIT_INTENT';\n\nconst asObject = (state: unknown): object | null => (typeof state === 'object' && state !== null ? state : null);\n\nconst isGuardState = (state: unknown): boolean => GUARD_STATE_KEY in (asObject(state) ?? {});\n\n// Desktop: the cursor leaves the window through its top edge, towards the tabs and the address bar.\nfunction watchCursorLeave(onExit: () => void): () => void {\n const onMouseOut = (event: MouseEvent): void => {\n if (event.relatedTarget === null && event.clientY <= 0) {\n onExit();\n }\n };\n\n document.addEventListener('mouseout', onMouseOut);\n return () => document.removeEventListener('mouseout', onMouseOut);\n}\n\n// Mobile: the visitor comes back from another tab or app — the popup waits until the page is visible again.\nfunction watchTabSwitch(onExit: () => void): () => void {\n let left = false;\n\n const onVisibilityChange = (): void => {\n if (document.visibilityState === 'hidden') {\n left = true;\n return;\n }\n\n if (left) {\n onExit();\n }\n };\n\n document.addEventListener('visibilitychange', onVisibilityChange);\n return () => document.removeEventListener('visibilitychange', onVisibilityChange);\n}\n\n// Only a finger flick counts: a \"back to top\" button or the site's own scrollTo is not the visitor leaving.\nfunction watchFastScrollUp(onExit: () => void): () => void {\n let lastY = window.scrollY;\n let lastTime = Date.now();\n let lastTouch = Number.NEGATIVE_INFINITY;\n\n const onTouch = (): void => {\n lastTouch = Date.now();\n };\n\n const onScroll = (): void => {\n const y = window.scrollY;\n const now = Date.now();\n const speed = (lastY - y) / Math.max(now - lastTime, 1);\n\n lastY = y;\n lastTime = now;\n\n const touchDriven = now - lastTouch <= TOUCH_SCROLL_WINDOW_MS;\n if (touchDriven && speed >= FAST_SCROLL_UP_SPEED && y <= window.innerHeight * TOP_ZONE_SCREENS) {\n onExit();\n }\n };\n\n TOUCH_EVENTS.forEach((type) => window.addEventListener(type, onTouch, { capture: true, passive: true }));\n window.addEventListener('scroll', onScroll, { passive: true });\n\n return () => {\n TOUCH_EVENTS.forEach((type) => window.removeEventListener(type, onTouch, true));\n window.removeEventListener('scroll', onScroll);\n };\n}\n\n// Browser and device Back both pop a guard entry pushed over the current one: the popup shows, the next Back leaves.\nfunction watchBack(onExit: ExitIntentHandler): () => void {\n let guardHref: string | null = null;\n // Whether the entry the visitor is on is our guard; a popstate tells where they landed, not where they came from.\n let onGuard = false;\n\n const pushGuard = (): void => {\n removeActivationListeners();\n\n if (!isGuardState(window.history.state)) {\n const guardState = { ...asObject(window.history.state), [GUARD_STATE_KEY]: true };\n window.history.pushState(guardState, '', window.location.href);\n }\n\n guardHref = window.location.href;\n onGuard = true;\n };\n\n const onPopState = (event: PopStateEvent): void => {\n const leftGuard = onGuard && window.location.href === guardHref && !isGuardState(event.state);\n onGuard = isGuardState(event.state);\n\n if (!leftGuard) {\n return;\n }\n\n guardHref = null;\n if (!onExit()) {\n window.history.back();\n }\n };\n\n function removeActivationListeners(): void {\n ACTIVATION_EVENTS.forEach((type) => window.removeEventListener(type, pushGuard, true));\n }\n\n ACTIVATION_EVENTS.forEach((type) => window.addEventListener(type, pushGuard, { capture: true, passive: true }));\n window.addEventListener('popstate', onPopState);\n\n return () => {\n removeActivationListeners();\n window.removeEventListener('popstate', onPopState);\n\n // A guard left on top would make the visitor's next Back a no-op.\n if (guardHref !== null && isGuardState(window.history.state)) {\n window.history.back();\n }\n };\n}\n\n// Calls onExit once, on the first sign the visitor is leaving the page; returns the teardown of every listener.\nexport function watchExitIntent(formFactor: ExitIntentFormFactor, onExit: ExitIntentHandler): () => void {\n let stops: Array<() => void> = [];\n\n const stop = (): void => {\n stops.forEach((fn) => fn());\n stops = [];\n };\n\n const fire = (): boolean => {\n stop();\n return onExit();\n };\n\n stops = formFactor === 'MOBILE'\n ? [watchTabSwitch(fire), watchFastScrollUp(fire), watchBack(fire)]\n : [watchCursorLeave(fire)];\n\n return stop;\n}\n","import { WEB_POPUP_CLOSE_ATTRIBUTE, WEB_POPUP_SUBMIT_ATTRIBUTE } from '@pushwoosh/websdk-common/web-popups';\n\n/** One delegated listener per container: a click on any link or button of the content, except the ✕ and the FORM Submit. */\nexport function listenForContentClicks(container: HTMLElement, onClick: () => void): void {\n container.addEventListener('click', (event) => {\n // No contains() check: a close button unmounts the tree before the click bubbles up here.\n const control = event.target instanceof Element ? event.target.closest('a, button') : null;\n\n if (!control || control.hasAttribute(WEB_POPUP_CLOSE_ATTRIBUTE)) {\n return;\n }\n\n // The FORM send already counts in the campaign's Submits; the panel adds Submits to Interactions.\n if (control.hasAttribute(WEB_POPUP_SUBMIT_ATTRIBUTE)) {\n return;\n }\n\n onClick();\n });\n}\n","import {\n collectWebPopupProductSlots, loadWebPopupProducts,\n type WebPopupParams, type WebPopupProductsHost,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { WEB_POPUPS_LOG_PREFIX } from './constants';\nimport { Logger } from '../../core/logger';\nimport { type Recommendations } from '../../modules/Recommendations/Recommendations';\n\n/** Products slots load from the onsite recommendations feed; a click goes out as PW_RecommendationClick. */\nexport function createProductsHost(recommendations: Pick<Recommendations, 'fetch' | 'trackClick'>): WebPopupProductsHost {\n return {\n load: async (slot) => {\n const fallback = slot.fallbackStrategy ?? 'none';\n const request = { limit: slot.limit, block: slot.key };\n // The feed serves the fallback itself when the strategy is empty; the slot's own, never the server default.\n const response = await recommendations.fetch({ ...request, strategy: slot.strategy, fallback }).catch((error) => {\n // A strategy this feed does not know yet is a 400 that would take the fallback down with it.\n if (fallback === 'none' || fallback === slot.strategy) {\n throw error;\n }\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} products slot \"${slot.key}\": strategy \"${slot.strategy}\" failed, trying \"${fallback}\"`);\n return recommendations.fetch({ ...request, strategy: fallback, fallback: 'none' });\n });\n\n return response.items.map((item) => ({\n id: item.id,\n title: item.title,\n price: item.price,\n currency: item.currency || undefined,\n image: item.image_url || undefined,\n url: item.url,\n }));\n },\n onClick: (product, slot) => {\n recommendations.trackClick({ block: slot.key, strategy: slot.strategy, productId: product.id }).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to track a click on product \"${product.id}\" in slot \"${slot.key}\"`);\n });\n },\n };\n}\n\n/** False when a `hideWhenEmpty` products slot has nothing, its fallback included: the popup is then not shown at all. */\nexport async function webPopupProductsAvailable(params: WebPopupParams, host: WebPopupProductsHost): Promise<boolean> {\n const required = collectWebPopupProductSlots(params).filter((slot) => slot.hideWhenEmpty);\n // the same memoised answer the render gets: one request, one verdict\n const answers = await Promise.all(required.map((slot) => loadWebPopupProducts(host, slot)));\n\n return answers.every((items) => items.length > 0);\n}\n","import { type WebPopup } from './types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport { type TPushPermissionStatus } from '../../services/PushService/pushPermissionStatus';\n\n// The campaign value for each status the SDK reports in the Push Permission Status tag.\nconst CAMPAIGN_VALUE: Record<TPushPermissionStatus, string> = {\n not_determined: 'DEFAULT',\n granted_explicit: 'GRANTED',\n denied: 'DENIED',\n unsupported: 'UNSUPPORTED',\n};\n\nconst CONDITIONS = new Set(Object.values(CAMPAIGN_VALUE));\n\n// An npm core can be older than this CDN widget, and legacy Safari throws outside its push package.\nfunction readCampaignValue(pw: Pushwoosh): string | undefined {\n if (typeof pw.getPushPermissionStatus !== 'function') {\n return undefined;\n }\n\n try {\n return CAMPAIGN_VALUE[pw.getPushPermissionStatus()];\n } catch {\n return undefined;\n }\n}\n\n/** Absent, empty, unknown or ALL lets everyone through; a status that can't be read lets nothing else through. */\nexport function matchesPushPermission(pw: Pushwoosh, popup: WebPopup): boolean {\n const required = popup.push_permission_status?.toUpperCase();\n\n if (!required || !CONDITIONS.has(required)) {\n return true;\n }\n\n return readCampaignValue(pw) === required;\n}\n","import { render } from 'preact';\n\nimport {\n parseWebPopupJson, resolveWebPopupPages, WebPopupReader,\n type WebPopupChoiceSubmitHandler, type WebPopupColorSchemePref, type WebPopupFormValuesSubmitHandler, type WebPopupParams,\n type WebPopupProductsHost, type WebPopupRatingSubmitHandler, type WebPopupSubscribeResult,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { submitSubscriptionForm } from './subscriptionFormApi';\nimport { webPopupLogger } from './webPopupLogger';\n\n/** The device-API handlers, passed in rather than imported: this module renders, it doesn't know the core. */\nexport type WebPopupDeviceHandlers = {\n onSubmitChoice: WebPopupChoiceSubmitHandler;\n onSubmitRating: WebPopupRatingSubmitHandler;\n products: WebPopupProductsHost;\n};\n\nexport type WebPopupSubmitHandlers = WebPopupDeviceHandlers & {\n // Bound to the campaign per render: one content can be shown by several campaigns.\n onSubmitFormValues: WebPopupFormValuesSubmitHandler;\n onRequestSubscribe: () => Promise<WebPopupSubscribeResult>;\n};\n\n/**\n * Parse stored popup json into the renderable model. Returns null for\n * anything that is not a supported {version: 1, params} popup with at least\n * one resolvable page — including legacy pre-engine content (no `version`\n * field), which is deliberately unrenderable.\n */\nexport const parseWebPopupContent = (json: string): WebPopupParams | null => {\n const parsed = parseWebPopupJson(json);\n if (!parsed) {\n return null;\n }\n\n if (resolveWebPopupPages(parsed.params).length === 0) {\n return null;\n }\n\n return parsed.params;\n};\n\n// Mount the popup into the shadow root; the reader draws the whole chrome and\n// owns page switching. Forms submit to their service, choice/rating via `handlers`.\nexport const renderWebPopup = (\n container: HTMLElement,\n params: WebPopupParams,\n onRequestClose: () => void,\n handlers: WebPopupSubmitHandlers,\n colorScheme: WebPopupColorSchemePref = 'auto',\n): void => {\n render(\n <WebPopupReader\n params={params}\n mode=\"live\"\n colorScheme={colorScheme}\n onRequestClose={onRequestClose}\n onSubmitForm={submitSubscriptionForm}\n onSubmitFormValues={handlers.onSubmitFormValues}\n onSubmitChoice={handlers.onSubmitChoice}\n onSubmitRating={handlers.onSubmitRating}\n onRequestSubscribe={handlers.onRequestSubscribe}\n products={handlers.products}\n logger={webPopupLogger}\n />,\n container,\n );\n};\n\n/**\n * Unmount a popup rendered by `renderWebPopup`. Dropping the host element alone\n * leaves the tree mounted on a detached node, so component cleanup never runs —\n * harmless for a popup shown once, not harmless now that popups cycle.\n */\nexport const unmountWebPopup = (container: HTMLElement): void => {\n render(null, container);\n};\n","import { type WebPopup } from './types';\n\n// A zoomed browser scrolls by fractions of a pixel and may stop just short of the very end.\nconst PAGE_END_TOLERANCE_PX = 1;\n\nexport const isScrollWebPopup = (popup: WebPopup): boolean => popup.trigger_type === 'SCROLL';\n\n/** The depth a SCROLL popup waits for, 0–100: absent, negative or not a number shows it at once. */\nexport function scrollThreshold(popup: WebPopup): number {\n const depth = popup.scroll_depth;\n if (typeof depth !== 'number' || Number.isNaN(depth)) {\n return 0;\n }\n\n return Math.min(Math.max(depth, 0), 100);\n}\n\n/** How far down the page the middle of the screen is, in percent; 100 on a page that does not scroll or at its end. */\nfunction pageScrollDepth(): number {\n const { scrollY, innerHeight } = window;\n const { scrollHeight } = document.scrollingElement ?? document.documentElement;\n\n if (scrollHeight <= innerHeight || scrollY + innerHeight >= scrollHeight - PAGE_END_TOLERANCE_PX) {\n return 100;\n }\n\n return (scrollY + innerHeight / 2) / scrollHeight * 100;\n}\n\n// Calls onReached once the page is scrolled to threshold. Already there: calls it at once and returns null;\n// otherwise returns the teardown of its listeners and observer.\nexport function watchScrollDepth(threshold: number, onReached: () => void): (() => void) | null {\n if (pageScrollDepth() >= threshold) {\n onReached();\n return null;\n }\n\n let frame: number | null = null;\n\n // Catches an SPA drawing its route after arming and a page that grows; without it, scroll and resize still work.\n const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(schedule) : null;\n\n const stop = (): void => {\n window.removeEventListener('scroll', schedule);\n window.removeEventListener('resize', schedule);\n observer?.disconnect();\n\n if (frame !== null) {\n window.cancelAnimationFrame(frame);\n frame = null;\n }\n };\n\n const check = (): void => {\n frame = null;\n\n if (pageScrollDepth() >= threshold) {\n stop();\n onReached();\n }\n };\n\n // One measurement per frame however many scroll, resize or layout events the browser fires.\n function schedule(): void {\n if (frame === null) {\n frame = window.requestAnimationFrame(check);\n }\n }\n\n window.addEventListener('scroll', schedule, { passive: true });\n window.addEventListener('resize', schedule);\n observer?.observe(document.documentElement);\n\n return stop;\n}\n","/** The page path events and page rules use: decoded, in the site's case, read anew on every call. */\nexport function getPagePath(): string {\n const { pathname } = window.location;\n\n // One malformed escape (cut UTF-8, overlong, surrogate, non-hex) makes the whole decode throw.\n try {\n return decodeURIComponent(pathname);\n } catch {\n return pathname;\n }\n}\n","import {\n collectWebPopupFormCodes, webPopupExpired, webPopupHasForm, type WebPopupColorSchemePref, type WebPopupParams,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { clickMatchesSelector, isClickWebPopup, watchClicks } from './clickTrigger';\nimport {\n PLACEMENT_ORDER, POPUP_HOST_Z_INDEX, QUEUE_GAP_MS, WEB_POPUPS_LOG_PREFIX, WEB_POPUPS_WIDGET_NAMESPACE,\n} from './constants';\nimport {\n createChoiceSubmitHandler, createFormValuesSubmitHandler, createRatingSubmitHandler, createSubscribeHandler,\n} from './deviceSubmitApi';\nimport { renderEmbeddedWebPopup } from './embeddedRenderer';\nimport { EmbeddedWebPopups, isEmbeddedWebPopup } from './EmbeddedWebPopups';\nimport { isExitIntentWebPopup, watchExitIntent } from './exitIntent';\nimport { listenForContentClicks } from './interactions';\nimport { createProductsHost, webPopupProductsAvailable } from './productsHost';\nimport { matchesPushPermission } from './pushPermissionCondition';\nimport {\n parseWebPopupContent, renderWebPopup, unmountWebPopup, type WebPopupDeviceHandlers, type WebPopupSubmitHandlers,\n} from './renderer';\nimport { isScrollWebPopup, scrollThreshold, watchScrollDepth } from './scrollDepth';\nimport { recordSubscriptionFormView } from './subscriptionFormApi';\nimport {\n type IWebPopupsPublicApi, type PageRule, type VisibleWebPopup, type WebPlacement, type WebPlacementAction, type WebPopup,\n type WebPopupEntry, type WebPopupHideReason, type WebPopupShowTrigger, type WebPopupsPublicState,\n} from './types';\nimport { Logger } from '../../core/logger';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport { getPagePath } from '../../helpers/pagePath';\n\nexport class WebPopupsWidget implements IWebPopupsPublicApi {\n private readonly pw: Pushwoosh;\n\n private isRecurringVisitor = false;\n\n /** Every popup the server returned, keyed by code. Never pruned. */\n private readonly entries = new Map<string, WebPopupEntry>();\n\n /** Contents shown by their own code, outside of any campaign; never auto-displayed. */\n private readonly contentEntries = new Map<string, WebPopupEntry>();\n\n /** Journey placements of this page load, keyed by hash; never mixed into the campaigns above. */\n private readonly placementEntries = new Map<string, WebPopupEntry>();\n\n /** Arrival sequence of each placement: the newer one wins a priority tie. */\n private readonly placementSeq = new Map<string, number>();\n\n private placementCounter = 0;\n\n /** Closed by the visitor; a pull answered before the server saw the dismiss must not bring them back. */\n private readonly dismissedPlacements = new Set<string>();\n\n /** SHOW is reported once per placement per page load. */\n private readonly shownPlacements = new Set<string>();\n\n /** The application has placements, or a postEvent response brought some: pull them on every navigation. */\n private placementsActive = false;\n\n /** Codes whose delay has elapsed or scroll depth is reached, waiting for the display slot. */\n private readonly queue: Array<string> = [];\n\n /** The single popup on screen, if any. */\n private visible: VisibleWebPopup | null = null;\n\n private drainTimeoutId: number | null = null;\n\n private autoShowEnabled = true;\n\n private colorScheme: WebPopupColorSchemePref = 'auto';\n\n private isNavigationSubscribed = false;\n private stopClickWatch: (() => void) | null = null;\n private badClickSelectors = new Set<string>();\n\n private openPopupsCount = 0;\n\n private bodyOverflowBeforeLock: string | null = null;\n\n /** Built once from `pw`: the device-API side of the choice/rating slots. */\n private readonly submitHandlers: WebPopupDeviceHandlers;\n\n /** EMBEDDED campaigns: blocks inside page elements, outside the popup pipeline. */\n private readonly embedded: EmbeddedWebPopups;\n\n // Declared before readyPromise on purpose: the Promise executor runs\n // synchronously inside that field initialiser.\n private readyResolve!: () => void;\n\n private readonly readyPromise = new Promise<void>((resolve) => {\n this.readyResolve = resolve;\n });\n\n constructor(pw: Pushwoosh) {\n this.pw = pw;\n this.submitHandlers = {\n onSubmitChoice: createChoiceSubmitHandler(pw),\n onSubmitRating: createRatingSubmitHandler(pw),\n products: createProductsHost(pw.recommendations),\n };\n this.embedded = new EmbeddedWebPopups({\n matchesPage: (popup) => this.checkSoftCondition(popup),\n render: (container, params, entry) => {\n this.listenForInteractions(container, entry);\n renderEmbeddedWebPopup(\n container, params, this.handlersFor(entry), this.colorScheme,\n () => this.embedded.removeWhere((other) => other === entry),\n entry.placement?.dismissible ? () => this.dismissPlacement(entry) : undefined,\n );\n },\n unmount: unmountWebPopup,\n recordVisit: (entry) => this.recordVisit(entry),\n recordImpression: (code) => this.recordImpression(code),\n recordFormViews: (code, params) => this.recordSubscriptionFormViews(code, params),\n dispatchShown: (code, trigger) => this.pw.dispatchEvent('show-web-popup', { code, trigger }),\n dismiss: (entry) => this.dismissPlacement(entry),\n });\n\n // Registered before run() so a site can call show() from its very first\n // Pushwoosh.push() callback; every public method awaits readyPromise.\n pw.moduleRegistry.webPopups = this;\n }\n\n public async run(): Promise<void> {\n const { pw } = this;\n\n try {\n // The CDN loader already skips this bundle when off; an npm site constructs the widget itself.\n if (pw.initParams.webPopups?.enable === false) {\n Logger.info(`${WEB_POPUPS_LOG_PREFIX} switched off by webPopups.enable, skipping`);\n\n return;\n }\n\n this.autoShowEnabled = pw.initParams.webPopups?.autoShow !== false;\n this.colorScheme = pw.initParams.webPopups?.colorScheme ?? 'auto';\n\n // Nothing to show, so nothing to register a device for. Absent feature\n // (older backend) keeps the previous behaviour; `finally` still runs.\n const features = await pw.data.getFeatures();\n const hasCampaigns = features?.['popup_forms']?.['enabled'] !== false;\n const buffered = this.acceptPlacements();\n this.placementsActive = this.placementsAllowed() && (features?.['web_placements']?.['enabled'] === true || buffered.length > 0);\n\n if (!hasCampaigns && !this.placementsActive) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} application has no active popup forms, skipping automatic display`);\n\n return;\n }\n\n await pw.api.ensureDeviceRegistered();\n\n this.isRecurringVisitor = await pw.data.getIsRecurringVisitor();\n\n const webPopups = hasCampaigns ? await pw.api.getPopupForms() : [];\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Received ${webPopups.length} popup(s) from server:`, webPopups.map((webPopup) => webPopup.code));\n\n webPopups.forEach((popup, order) => {\n this.entries.set(popup.code, this.createEntry('campaign', popup, order));\n });\n\n // Strong conditions gate AUTOMATIC display only — they are recorded, not\n // used as a load gate. Content is prefetched for every popup targeted at\n // this visitor, including trigger_type=API ones, so show() is instant;\n // popups that failed a strong condition or frequency are fetched lazily by show().\n await Promise.allSettled(Array.from(this.entries.values()).map(async (entry) => {\n entry.passedStrongConditions = this.checkStrongCondition(entry.popup);\n // A storage failure caps the popup; it must not cost an EMBEDDED its content.\n entry.passedFrequency = await this.checkCanBeShownByFrequencyCondition(entry.popup).catch(() => false);\n if (this.shouldPrefetchContent(entry)) {\n await this.ensureContent(entry);\n }\n }));\n\n const loaded = this.loadedCodes();\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} ${loaded.length} popup(s) passed strong conditions and loaded:`, loaded);\n\n this.subscribeToNavigation();\n this.subscribeToPushPermission();\n this.renderForCurrentPage();\n this.watchClickTriggers();\n\n if (this.placementsActive) {\n await this.pullPlacements(buffered);\n }\n\n await pw.data.setIsRecurringVisitor(true);\n } finally {\n // show() must never hang, even if run() blew up half way.\n this.readyResolve();\n pw.dispatchEvent('web-popups-ready', {});\n }\n }\n\n /* ------------------------------------------------------------------ *\n * Public API — Pushwoosh.moduleRegistry.webPopups\n * ------------------------------------------------------------------ */\n\n /**\n * Show a popup now past every display condition but the push permission status (and a POPUP's expired countdown).\n * Never rejects: resolves false and logs why. The full contract is in public/index.d.ts.\n */\n public async show(code: string): Promise<boolean> {\n await this.readyPromise;\n\n // Campaigns first: journey points saved before the switch to contents still carry campaign codes.\n const entry = this.entries.get(code) ?? this.getContentEntry(code);\n const isEmbedded = entry.kind === 'campaign' && isEmbeddedWebPopup(entry.popup);\n\n if (!isEmbedded && this.visible?.code === code) {\n return true;\n }\n\n // After the visible check: a popup on screen stays whatever the status. A content has no condition.\n if (!matchesPushPermission(this.pw, entry.popup)) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): the visitor's push permission does not match the campaign`);\n return false;\n }\n\n // Awaited BEFORE preempting so close() and present() run in the same task:\n // otherwise the browser paints the moment between two modal popups with the\n // body scroll lock released.\n const content = await this.ensureContent(entry);\n if (!content) {\n Logger.error(new Error('Web popup content unavailable'), `${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): content unavailable`);\n return false;\n }\n\n // A form submits under a campaign code; opened by its content code it would fail on Submit.\n if (entry.kind === 'content' && webPopupHasForm(content)) {\n Logger.error(new Error('Web popup form needs a campaign'), `${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): a form content is shown by a campaign only`);\n return false;\n }\n\n if (entry.productsEmpty) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): its products block has nothing to show`);\n return false;\n }\n\n // A block goes into its page element: it neither takes nor frees the popup display slot.\n if (isEmbedded) {\n return this.embedded.show(entry, content);\n }\n\n // The automatic pipeline may have shown this very popup while we awaited;\n // re-presenting it would double-count the impression.\n if (this.visible?.code === code) {\n return true;\n }\n\n // show() deliberately ignores the page rules — but not an expired\n // countdown: the offer is over however the popup was triggered.\n if (!this.checkNotExpired(entry)) {\n return false;\n }\n\n if (this.visible) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} show(\"${code}\") preempting \"${this.visible.code}\"`);\n // The preempted popup is finished with, not requeued: it already recorded\n // its impression and did its frequency bookkeeping.\n this.visible.close('preempted');\n }\n\n // Drop this popup's own armed timer / queue slot so the automatic pipeline\n // does not show it a second time.\n this.detachFromAutoPipeline(entry);\n\n this.present(entry, 'api');\n return true;\n }\n\n /**\n * Hide the visible popup, optionally only if it is the given one.\n * Returns false when nothing was hidden.\n */\n public hide(code?: string): boolean {\n if (!this.visible) {\n return false;\n }\n\n if (code !== undefined && this.visible.code !== code) {\n return false;\n }\n\n this.visible.close('api');\n return true;\n }\n\n /**\n * Hide the visible popup and dismiss everything still pending for this page\n * load. show() keeps working afterwards.\n */\n public hideAll(): boolean {\n const hadVisible = this.hide();\n\n this.entries.forEach((entry) => {\n if (entry.state !== 'waiting' && entry.state !== 'queued') {\n return;\n }\n\n this.detachFromAutoPipeline(entry);\n entry.state = 'done';\n });\n\n // After hide(), whose close() arms a drain for the next queued popup.\n this.cancelScheduledDrain();\n\n return hadVisible;\n }\n\n public isVisible(code?: string): boolean {\n if (!this.visible) {\n return false;\n }\n\n return code === undefined || this.visible.code === code;\n }\n\n public getVisibleCode(): string | null {\n return this.visible?.code ?? null;\n }\n\n public getAvailableCodes(): Array<string> {\n return Array.from(this.entries.keys());\n }\n\n public getState(): WebPopupsPublicState {\n const waiting: Array<string> = [];\n this.entries.forEach((entry, code) => {\n if (entry.state === 'waiting') {\n waiting.push(code);\n }\n });\n\n return {\n visible: this.getVisibleCode(),\n queued: [...this.queue],\n waiting,\n available: this.getAvailableCodes(),\n };\n }\n\n /* ---------------------------- Journey placements ---------------------------- */\n\n private placementsAllowed(): boolean {\n return this.pw.initParams.webPlacements?.enable !== false;\n }\n\n /** Takes over delivery from the core and returns what it buffered; an older core has neither hook. */\n private acceptPlacements(): Array<WebPlacement> {\n const { pw } = this;\n if (!this.placementsAllowed() || typeof pw.takeWebPlacements !== 'function') {\n return [];\n }\n\n pw.webPlacementsSink = (placements) => {\n this.receivePlacements(placements).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to render journey placements`);\n });\n };\n\n return pw.takeWebPlacements();\n }\n\n /** Placements a postEvent response released: shown at once, and the page starts pulling them. */\n private async receivePlacements(placements: Array<WebPlacement>): Promise<void> {\n await this.readyPromise;\n\n this.placementsActive = true;\n this.subscribeToNavigation();\n await this.syncPlacements(placements, false);\n }\n\n /** The server's queue for this user is the truth: a placement it no longer returns is taken off the page or the queue. */\n private async pullPlacements(extra: Array<WebPlacement> = []): Promise<void> {\n let pulled: Array<WebPlacement>;\n try {\n pulled = await this.pw.api.getWebPlacements();\n } catch (error) {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to load journey placements`);\n await this.syncPlacements(extra, false);\n return;\n }\n\n await this.syncPlacements([...pulled, ...extra], true);\n }\n\n private async syncPlacements(placements: Array<WebPlacement>, authoritative: boolean): Promise<void> {\n const now = Date.now();\n const live = placements.filter((placement) => (\n placement.hash && placement.content_code && !this.dismissedPlacements.has(placement.hash) && !placementExpired(placement, now)\n ));\n\n if (authoritative) {\n const kept = new Set(live.map((placement) => placement.hash));\n this.placementEntries.forEach((entry, hash) => {\n // A popup already on screen is let to finish; one still waiting or queued goes with the block.\n if (!kept.has(hash) && (isEmbeddedWebPopup(entry.popup) || entry.state !== 'visible')) {\n this.dropPlacement(entry);\n }\n });\n }\n\n live.forEach((placement) => {\n if (this.placementEntries.has(placement.hash)) {\n return;\n }\n\n const entry = this.createEntry('placement', placementPopup(placement), PLACEMENT_ORDER);\n entry.placement = placement;\n this.placementEntries.set(placement.hash, entry);\n this.placementCounter += 1;\n this.placementSeq.set(placement.hash, this.placementCounter);\n this.scheduleExpiry(entry, now);\n });\n\n await this.renderPlacements();\n }\n\n private async renderPlacements(): Promise<void> {\n const pending = Array.from(this.placementEntries.values()).filter((entry) => entry.state !== 'done');\n\n await Promise.all(pending.map(async (entry) => {\n const content = await this.ensureContent(entry);\n // A form submits under a campaign code, and a placement has none.\n if (!content || webPopupHasForm(content)) {\n if (content) {\n Logger.error(new Error('Web popup form needs a campaign'), `${WEB_POPUPS_LOG_PREFIX} placement \"${entry.popup.code}\": a form content is shown by a campaign only`);\n }\n entry.state = 'done';\n }\n }));\n\n const ready = pending.filter((entry) => entry.state !== 'done' && entry.content && !entry.productsEmpty);\n this.renderPlacementBlocks(ready.filter((entry) => isEmbeddedWebPopup(entry.popup)));\n this.queuePlacementPopup(ready.filter((entry) => !isEmbeddedWebPopup(entry.popup)));\n }\n\n /** One placement per element: the highest priority, the newest on a tie. */\n private renderPlacementBlocks(entries: Array<WebPopupEntry>): void {\n const winners = new Map<string, WebPopupEntry>();\n entries.forEach((entry) => {\n const selector = entry.popup.css_selector ?? '';\n const current = winners.get(selector);\n if (!current || this.placementBeats(entry, current)) {\n winners.set(selector, entry);\n }\n });\n\n const shown = new Set(winners.values());\n this.embedded.removeWhere((entry) => entry.kind === 'placement' && !shown.has(entry));\n shown.forEach((entry) => {\n this.embedded.show(entry, entry.content!);\n });\n }\n\n /** At most one placement popup at a time takes the display slot, ahead of campaigns. */\n private queuePlacementPopup(entries: Array<WebPopupEntry>): void {\n const busy = entries.some((entry) => entry.state === 'queued' || entry.state === 'visible');\n const idle = entries.filter((entry) => entry.state === 'idle');\n if (busy || idle.length === 0) {\n return;\n }\n\n const best = idle.reduce((winner, entry) => (this.placementBeats(entry, winner) ? entry : winner));\n best.state = 'queued';\n this.insertIntoQueue(best);\n this.drain();\n }\n\n private placementBeats(entry: WebPopupEntry, other: WebPopupEntry): boolean {\n const rank = placementRank(entry.placement) - placementRank(other.placement);\n if (rank !== 0) {\n return rank > 0;\n }\n\n return (this.placementSeq.get(entry.popup.code) ?? 0) > (this.placementSeq.get(other.popup.code) ?? 0);\n }\n\n private scheduleExpiry(entry: WebPopupEntry, now: number): void {\n const deadline = placementDeadline(entry.placement);\n // setTimeout overflows past ~24.8 days; a placement lives a week at most.\n if (deadline === null || deadline - now > 2 ** 31 - 1) {\n return;\n }\n\n window.setTimeout(() => {\n if (entry.state !== 'visible') {\n this.dropPlacement(entry);\n }\n }, deadline - now);\n }\n\n private dropPlacement(entry: WebPopupEntry): void {\n this.embedded.removeWhere((other) => other === entry);\n this.detachFromAutoPipeline(entry);\n entry.state = 'done';\n this.placementEntries.delete(entry.popup.code);\n }\n\n private dismissPlacement(entry: WebPopupEntry): void {\n this.dismissedPlacements.add(entry.popup.code);\n this.dropPlacement(entry);\n this.trackPlacement(entry.popup.code, 'WEB_PLACEMENT_ACTION_DISMISS');\n }\n\n private onPlacementsNavigate(): void {\n if (!this.placementsActive) {\n return;\n }\n\n this.pullPlacements().catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to refresh journey placements`);\n });\n }\n\n private trackPlacement(hash: string, action: WebPlacementAction): void {\n if (action === 'WEB_PLACEMENT_ACTION_SHOW') {\n if (this.shownPlacements.has(hash)) {\n return;\n }\n this.shownPlacements.add(hash);\n }\n\n // An npm core older than this CDN widget has no such call.\n if (typeof this.pw.api.trackWebPlacement !== 'function') {\n return;\n }\n\n this.pw.api.trackWebPlacement(hash, action).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record ${action} for placement \"${hash}\"`);\n });\n }\n\n private entryByCode(code: string): WebPopupEntry | undefined {\n return this.entries.get(code) ?? this.placementEntries.get(code);\n }\n\n /* ------------------------------------------------------------------ *\n * Content loading\n * ------------------------------------------------------------------ */\n\n private createEntry(kind: WebPopupEntry['kind'], popup: WebPopup, order: number): WebPopupEntry {\n return {\n kind,\n popup,\n order,\n state: 'idle',\n content: null,\n loading: null,\n productsEmpty: false,\n passedStrongConditions: false,\n passedFrequency: false,\n timeoutId: null,\n stopTriggerWatch: null,\n visitRecorded: false,\n };\n }\n\n private getContentEntry(code: string): WebPopupEntry {\n let entry = this.contentEntries.get(code);\n if (!entry) {\n // Only `code` and the content code are read for a content: show() skips conditions, present() stats.\n entry = this.createEntry('content', {\n code,\n popup_form_content_code: code,\n device_type: 'ALL',\n visitors_type: 'ALL',\n matching_pages: [],\n delay: 0,\n frequency: 'EVERY_VISIT',\n trigger_type: 'API',\n }, -1);\n this.contentEntries.set(code, entry);\n }\n\n return entry;\n }\n\n /**\n * Resolve the entry's renderable content, fetching it at most once. A failed\n * fetch clears the memo so a later show() can retry.\n */\n private ensureContent(entry: WebPopupEntry): Promise<WebPopupParams | null> {\n if (entry.content) {\n return Promise.resolve(entry.content);\n }\n\n if (entry.loading) {\n return entry.loading;\n }\n\n entry.loading = this.loadContent(entry.popup)\n .then(async (content) => {\n // Settled before the content counts as loaded, so no display path sees it unchecked.\n entry.productsEmpty = !!content && !(await webPopupProductsAvailable(content, this.submitHandlers.products));\n entry.content = content;\n return content;\n })\n .catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to load web popup \"${entry.popup.code}\"`);\n return null;\n })\n .finally(() => {\n if (!entry.content) {\n entry.loading = null;\n }\n });\n\n return entry.loading;\n }\n\n private async loadContent(webPopup: WebPopup): Promise<WebPopupParams | null> {\n const content = await this.pw.api.getPopupFormContent(webPopup.popup_form_content_code);\n const parsed = parseWebPopupContent(content.json);\n if (!parsed) {\n // Legacy / unknown format — this popup is broken and never shows.\n Logger.error(\n new Error('Unsupported popup content format'),\n `${WEB_POPUPS_LOG_PREFIX} Web popup \"${webPopup.code}\" content is not a supported {version, params} popup; skipping`,\n );\n return null;\n }\n\n return parsed;\n }\n\n // The one kind-specific gate at load: EMBEDDED has no frequency, so a capped POPUP is the only\n // eligible entry left to show() to fetch lazily.\n private shouldPrefetchContent(entry: WebPopupEntry): boolean {\n return entry.passedStrongConditions && (isEmbeddedWebPopup(entry.popup) || entry.passedFrequency);\n }\n\n private loadedCodes(): Array<string> {\n const codes: Array<string> = [];\n this.entries.forEach((entry, code) => {\n if (entry.content) {\n codes.push(code);\n }\n });\n return codes;\n }\n\n /* ------------------------------------------------------------------ *\n * Automatic display pipeline\n * ------------------------------------------------------------------ */\n\n private renderForCurrentPage(): void {\n this.releaseUnmatchedPending();\n\n const armed: Array<string> = [];\n this.entries.forEach((entry, code) => {\n if (this.canAutoDisplay(entry)) {\n this.arm(entry);\n armed.push(code);\n }\n });\n\n Logger.debug(\n `${WEB_POPUPS_LOG_PREFIX} ${armed.length} popup(s) selected for display on \"${getPagePath()}\":`,\n armed,\n );\n\n // Insurance: a no-op when something is visible or nothing is queued.\n this.drain();\n\n // EMBEDDED has no delay, frequency or countdown expiry: a block is part of the page, not an interruption.\n this.embedded.syncWithPage(this.entries.values(), (entry) => this.isAutoEligible(entry));\n }\n\n private canAutoDisplay(entry: WebPopupEntry): boolean {\n return !isEmbeddedWebPopup(entry.popup)\n && entry.state === 'idle'\n && this.isAutoEligible(entry)\n && entry.passedFrequency\n && this.checkNotExpired(entry);\n }\n\n /** What any kind needs to show by itself; kind-specific checks stay with the caller. */\n private isAutoEligible(entry: WebPopupEntry): boolean {\n return this.isAutoTrigger(entry.popup) && this.passesDisplayConditions(entry);\n }\n\n /** The conditions a popup shown without show() passes, whatever its trigger. */\n private passesDisplayConditions(entry: WebPopupEntry): boolean {\n return this.autoShowEnabled\n && entry.passedStrongConditions\n && entry.content !== null\n && !entry.productsEmpty\n && this.checkSoftCondition(entry.popup)\n && matchesPushPermission(this.pw, entry.popup);\n }\n\n /** What a waiting or queued popup must still pass: the page, the push permission and the countdown. */\n private isStillEligible(entry: WebPopupEntry): boolean {\n return !placementExpired(entry.placement, Date.now())\n && this.checkSoftCondition(entry.popup)\n && matchesPushPermission(this.pw, entry.popup)\n && this.checkNotExpired(entry);\n }\n\n private isAutoTrigger(webPopup: WebPopup): boolean {\n const trigger = webPopup.trigger_type;\n\n // Absent (older backend), PAGE_LOAD, SCROLL or EXIT_INTENT means automatic display.\n // Any other value — including one this SDK version does not know — counts\n // as API-only, so a future trigger kind never shows itself by accident.\n return !trigger || trigger === 'PAGE_LOAD' || trigger === 'SCROLL' || trigger === 'EXIT_INTENT';\n }\n\n /* ------------- CLICK trigger: outside the queue, every matching click opens the popup ------------- */\n\n private watchClickTriggers(): void {\n const hasClickPopups = Array.from(this.entries.values()).some((entry) => entry.kind === 'campaign' && isClickWebPopup(entry.popup));\n if (!hasClickPopups || this.stopClickWatch) {\n return;\n }\n\n this.stopClickWatch = watchClicks((event) => this.onTriggerClick(event));\n }\n\n private onTriggerClick(event: MouseEvent): void {\n // Whatever is on screen, ours or another campaign's, a click never opens a second popup over it.\n if (this.visible) {\n return;\n }\n\n const entry = Array.from(this.entries.values()).find((candidate) => this.isClickTarget(candidate, event));\n if (!entry) {\n return;\n }\n\n // The popup replaces what the element would do: a link must not navigate away from under it.\n event.preventDefault();\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${entry.popup.code}\" element clicked`);\n this.present(entry, 'auto');\n }\n\n private isClickTarget(entry: WebPopupEntry, event: MouseEvent): boolean {\n const { popup } = entry;\n const selector = popup.css_selector ?? '';\n if (entry.kind !== 'campaign' || !isClickWebPopup(popup) || !selector || isEmbeddedWebPopup(popup)) {\n return false;\n }\n\n if (!this.passesDisplayConditions(entry) || !this.checkNotExpired(entry)) {\n return false;\n }\n\n try {\n return clickMatchesSelector(event, selector);\n } catch (error) {\n // The selector comes from the dashboard/API verbatim; a broken one must not break the site's clicks.\n if (!this.badClickSelectors.has(popup.code)) {\n this.badClickSelectors.add(popup.code);\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\": invalid css_selector \"${selector}\"; its clicks are ignored`, error);\n }\n return false;\n }\n }\n\n private arm(entry: WebPopupEntry): void {\n entry.state = 'waiting';\n this.recordVisit(entry);\n\n if (isScrollWebPopup(entry.popup)) {\n this.armScrollDepth(entry);\n return;\n }\n\n if (isExitIntentWebPopup(entry.popup)) {\n this.armExitIntent(entry);\n return;\n }\n\n this.armDelay(entry);\n }\n\n private armDelay(entry: WebPopupEntry): void {\n const { popup } = entry;\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" armed for display in ${popup.delay}s`);\n\n entry.timeoutId = window.setTimeout(() => {\n entry.timeoutId = null;\n this.enqueueArmed(entry, 'delay elapsed');\n }, popup.delay * 1000);\n }\n\n private armScrollDepth(entry: WebPopupEntry): void {\n const { popup } = entry;\n const threshold = scrollThreshold(popup);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" armed for display at ${threshold}% scroll depth`);\n\n entry.stopTriggerWatch = watchScrollDepth(threshold, () => {\n entry.stopTriggerWatch = null;\n\n // Never show inside the arming pass: like armDelay(0), popups armed together keep the server order.\n entry.timeoutId = window.setTimeout(() => {\n entry.timeoutId = null;\n this.enqueueArmed(entry, 'scroll depth reached');\n }, 0);\n });\n }\n\n private armExitIntent(entry: WebPopupEntry): void {\n const { popup } = entry;\n const formFactor = this.pw.environment.formFactor === 'MOBILE' ? 'MOBILE' : 'DESKTOP';\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" armed for display on exit intent (${formFactor})`);\n\n entry.stopTriggerWatch = watchExitIntent(formFactor, () => {\n entry.stopTriggerWatch = null;\n this.enqueueArmed(entry, 'exit intent');\n return entry.state === 'visible';\n });\n }\n\n private enqueueArmed(entry: WebPopupEntry, reason: string): void {\n const { code } = entry.popup;\n\n entry.state = 'queued';\n this.insertIntoQueue(entry);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${code}\" ${reason}; queued at position ${this.queue.indexOf(code) + 1} of ${this.queue.length}`);\n\n this.drain();\n }\n\n /**\n * VISIT is reported once per page load, when the popup is armed for the\n * current page — the same moment as before the queue existed.\n */\n private recordVisit(entry: WebPopupEntry): void {\n if (entry.visitRecorded || entry.kind !== 'campaign') {\n return;\n }\n\n entry.visitRecorded = true;\n this.pw.api.recordPopupFormEvent(entry.popup.code, 1).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record web popup visit event for \"${entry.popup.code}\"`);\n });\n }\n\n /** Ordering: shorter delay first (SCROLL and EXIT_INTENT count as 0), then the order the server returned them. */\n private insertIntoQueue(entry: WebPopupEntry): void {\n const delay = queueDelay(entry.popup);\n\n const isAfter = (code: string): boolean => {\n const other = this.entryByCode(code);\n if (!other) {\n return false;\n }\n\n if (queueDelay(other.popup) !== delay) {\n return queueDelay(other.popup) > delay;\n }\n\n return other.order > entry.order;\n };\n\n const index = this.queue.findIndex(isAfter);\n if (index === -1) {\n this.queue.push(entry.popup.code);\n return;\n }\n\n this.queue.splice(index, 0, entry.popup.code);\n }\n\n /**\n * Return waiting and queued popups that stopped matching the page or the push permission, or whose countdown\n * passed, to `idle`; a returning visitor re-arms them with a full delay.\n */\n private releaseUnmatchedPending(): void {\n this.entries.forEach((entry) => {\n if (entry.state !== 'waiting' && entry.state !== 'queued') {\n return;\n }\n\n if (this.isStillEligible(entry)) {\n return;\n }\n\n this.detachFromAutoPipeline(entry);\n entry.state = 'idle';\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Released popup \"${entry.popup.code}\": page or push permission no longer matches, or its countdown passed`);\n });\n }\n\n /** Clear an entry's armed timer, trigger listeners and queue slot, leaving its state to the caller. */\n private detachFromAutoPipeline(entry: WebPopupEntry): void {\n if (entry.timeoutId !== null) {\n window.clearTimeout(entry.timeoutId);\n entry.timeoutId = null;\n }\n\n if (entry.stopTriggerWatch !== null) {\n entry.stopTriggerWatch();\n entry.stopTriggerWatch = null;\n }\n\n const index = this.queue.indexOf(entry.popup.code);\n if (index !== -1) {\n this.queue.splice(index, 1);\n }\n }\n\n /** Show the head of the queue if the display slot is free. */\n private drain(): void {\n if (this.visible || this.drainTimeoutId !== null) {\n return;\n }\n\n const code = this.queue.shift();\n if (code === undefined) {\n return;\n }\n\n const entry = this.entryByCode(code);\n if (!entry || entry.state !== 'queued') {\n this.drain();\n return;\n }\n\n // The page, the push permission or the deadline may have changed between enqueue and the slot freeing up.\n if (!this.isStillEligible(entry)) {\n entry.state = 'idle';\n this.drain();\n return;\n }\n\n if (!entry.content) {\n entry.state = 'done';\n this.drain();\n return;\n }\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Display slot free; showing \"${code}\"`);\n this.present(entry, 'auto');\n }\n\n private scheduleDrain(): void {\n if (this.drainTimeoutId !== null) {\n return;\n }\n\n this.drainTimeoutId = window.setTimeout(() => {\n this.drainTimeoutId = null;\n this.drain();\n }, QUEUE_GAP_MS);\n }\n\n private cancelScheduledDrain(): void {\n if (this.drainTimeoutId === null) {\n return;\n }\n\n window.clearTimeout(this.drainTimeoutId);\n this.drainTimeoutId = null;\n }\n\n /* ------------------------------------------------------------------ *\n * Rendering\n * ------------------------------------------------------------------ */\n\n private present(entry: WebPopupEntry, trigger: WebPopupShowTrigger): void {\n // A drain armed by the popup we are replacing must not fire behind us.\n this.cancelScheduledDrain();\n\n const { popup, content } = entry;\n if (!content) {\n entry.state = 'done';\n return;\n }\n\n // The host is pointer-transparent: the reader's overlay / popup box\n // re-enable pointer events themselves, so a corner banner without a\n // dim never blocks the page underneath.\n const host = document.createElement('div');\n host.id = `${WEB_POPUPS_WIDGET_NAMESPACE}-${popup.code}`;\n host.style.position = 'fixed';\n host.style.inset = '0';\n host.style.zIndex = String(POPUP_HOST_Z_INDEX);\n host.style.pointerEvents = 'none';\n document.body.appendChild(host);\n\n const shadow = host.attachShadow({ mode: 'open' });\n const container = document.createElement('div');\n shadow.appendChild(container);\n this.listenForInteractions(container, entry);\n\n // Only a dimmed (modal) popup locks the page scroll; banners and bars\n // leave the page usable.\n const modal = !!content.overlay;\n if (modal) {\n this.lockBodyScroll();\n }\n\n let closed = false;\n const close = (reason: WebPopupHideReason): void => {\n // Idempotent: the reader's overlay click and hide() can race.\n if (closed) {\n return;\n }\n closed = true;\n\n if (modal) {\n this.unlockBodyScroll();\n }\n\n unmountWebPopup(container);\n host.remove();\n\n if (this.visible?.code === popup.code) {\n this.visible = null;\n }\n entry.state = 'done';\n\n this.pw.dispatchEvent('hide-web-popup', { code: popup.code, reason });\n if (entry.kind === 'placement' && reason === 'user') {\n this.trackPlacement(popup.code, 'WEB_PLACEMENT_ACTION_DISMISS');\n }\n this.scheduleDrain();\n };\n\n this.visible = {\n code: popup.code, host, modal, close,\n };\n entry.state = 'visible';\n\n // The reader draws the whole chrome (overlay that closes on click,\n // placement, animation, the close button and close-action buttons).\n renderWebPopup(container, content, () => close('user'), this.handlersFor(entry), this.colorScheme);\n\n this.recordSubscriptionFormViews(popup.code, content);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" shown (trigger: ${trigger})`);\n\n // Popup form events take campaign codes only; a content opened from the\n // inbox is counted there, as the inbox open.\n if (entry.kind === 'campaign') {\n // A no-op on the automatic path, where the visit was recorded at arm time.\n this.recordVisit(entry);\n this.markAsShown(popup).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to mark web popup \"${popup.code}\" as shown`);\n });\n }\n if (entry.kind === 'placement') {\n this.trackPlacement(popup.code, 'WEB_PLACEMENT_ACTION_SHOW');\n }\n this.pw.dispatchEvent('show-web-popup', { code: popup.code, trigger });\n }\n\n private handlersFor(entry: WebPopupEntry): WebPopupSubmitHandlers {\n // Only a campaign counts its subscriptions: a placement or a content opened by its own code has no stats.\n const campaignCode = entry.kind === 'campaign' ? entry.popup.code : undefined;\n\n return {\n ...this.submitHandlers,\n onRequestSubscribe: createSubscribeHandler(this.pw, campaignCode),\n onSubmitFormValues: createFormValuesSubmitHandler(this.pw, entry.popup.code),\n };\n }\n\n // Embedded email-subscription forms count a view per showing — the\n // denominator of the form's conversion stats.\n private recordSubscriptionFormViews(code: string, content: WebPopupParams): void {\n const formCodes = collectWebPopupFormCodes(content);\n if (formCodes.length === 0) {\n return;\n }\n\n this.pw.data.getHwid()\n .then((hwid) => formCodes.forEach((formCode) => recordSubscriptionFormView(formCode, hwid)))\n .catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record subscription form views for web popup \"${code}\"`);\n });\n }\n\n /* ------------------------------------------------------------------ *\n * Scroll lock\n * ------------------------------------------------------------------ */\n\n private lockBodyScroll(): void {\n if (this.openPopupsCount === 0) {\n this.bodyOverflowBeforeLock = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n this.openPopupsCount += 1;\n }\n\n private unlockBodyScroll(): void {\n this.openPopupsCount = Math.max(0, this.openPopupsCount - 1);\n if (this.openPopupsCount === 0 && this.bodyOverflowBeforeLock !== null) {\n document.body.style.overflow = this.bodyOverflowBeforeLock;\n this.bodyOverflowBeforeLock = null;\n }\n }\n\n /* ------------------------------------------------------------------ *\n * Conditions\n * ------------------------------------------------------------------ */\n\n private subscribeToNavigation(): void {\n if (this.isNavigationSubscribed) {\n return;\n }\n\n this.isNavigationSubscribed = true;\n\n const onNavigate = (): void => {\n this.renderForCurrentPage();\n this.onPlacementsNavigate();\n };\n\n const nav = (window as Window & { navigation?: EventTarget }).navigation;\n if (nav && typeof nav.addEventListener === 'function') {\n nav.addEventListener('currententrychange', onNavigate);\n return;\n }\n\n window.addEventListener('popstate', onNavigate);\n window.addEventListener('hashchange', onNavigate);\n\n // Programmatic pushState/replaceState fires no event; poll location instead\n // of monkey-patching history so SPA routers stay untouched.\n let lastHref = window.location.href;\n window.setInterval(() => {\n if (window.location.href !== lastHref) {\n lastHref = window.location.href;\n onNavigate();\n }\n }, 500);\n }\n\n private subscribeToPushPermission(): void {\n const onChange = (): void => this.releaseByPushPermission();\n\n // An npm core older than this CDN widget has no addSdkEventHandler.\n if (typeof this.pw.addSdkEventHandler === 'function') {\n this.pw.addSdkEventHandler('change-permission', onChange);\n return;\n }\n\n this.pw.addEventHandler('change-permission', onChange);\n }\n\n // Only takes away: a campaign that starts to match waits for the next page, so nothing pops up after the dialog.\n private releaseByPushPermission(): void {\n this.releaseUnmatchedPending();\n this.embedded.removeWhere((entry) => !matchesPushPermission(this.pw, entry.popup));\n }\n\n private checkStrongCondition(webPopup: WebPopup): boolean {\n return this.checkCanBeShownByDeviceTypeCondition(webPopup)\n && this.checkCanBeShownByVisitorsTypeCondition(webPopup);\n }\n\n private checkSoftCondition(webPopup: WebPopup): boolean {\n return this.checkCanBeShownByMatchingPagesCondition(webPopup);\n }\n\n // A popup with a run-out 'hide-popup' countdown must not be shown at all —\n // asked HERE, at SHOW time, because a render already costs the impression.\n private checkNotExpired(entry: WebPopupEntry): boolean {\n if (!entry.content) {\n return true;\n }\n\n if (!webPopupExpired(entry.content, Date.now())) {\n return true;\n }\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${entry.popup.code}\" not shown: its countdown has passed`);\n return false;\n }\n\n private checkCanBeShownByDeviceTypeCondition(webPopup: WebPopup): boolean {\n const { device_type: deviceType } = webPopup;\n\n const formFactor = this.pw.environment.formFactor;\n if (deviceType === 'ALL') {\n return true;\n }\n\n return deviceType === formFactor;\n }\n\n private async checkCanBeShownByFrequencyCondition(webPopup: WebPopup): Promise<boolean> {\n const { frequency, code } = webPopup;\n\n // The visitor asked for it: every click opens the popup, whatever the frequency.\n if (isClickWebPopup(webPopup)) {\n return true;\n }\n\n if (frequency === 'ONCE') {\n const shown = await this.pw.data.getShownWebPopups();\n return !shown.includes(code);\n }\n\n if (frequency === 'ONCE_PER_SESSION') {\n return sessionStorage.getItem(this.getSessionStorageKey(code)) === null;\n }\n\n return true;\n }\n\n private checkCanBeShownByMatchingPagesCondition(webPopup: WebPopup): boolean {\n const { matching_pages: matchingPages, matching_page_rules: matchingPageRules, excluded_pages: excludedPages } = webPopup;\n const path = getPagePath();\n\n // \"Specified pages\": operator-aware rules preferred, legacy exact list as fallback.\n if (matchingPageRules && matchingPageRules.length > 0) {\n return matchingPageRules.some((rule) => this.matchPageRule(path, rule));\n }\n\n if (matchingPages && matchingPages.length > 0) {\n return matchingPages.some((page) => Boolean(page) && page === path);\n }\n\n if (excludedPages && excludedPages.length > 0) {\n return !excludedPages.some((rule) => this.matchPageRule(path, rule));\n }\n\n return true;\n }\n\n private matchPageRule(path: string, rule: PageRule): boolean {\n // A null or empty rule path is skipped like an unknown operator: empty STARTS_WITH would match every page.\n if (!rule.path) {\n return false;\n }\n\n switch (rule.operator) {\n case 'EQUALS':\n return path === rule.path;\n case 'STARTS_WITH':\n return path.startsWith(rule.path);\n default:\n // Unknown operator: skip the rule (fail-open) rather than hide/crash.\n return false;\n }\n }\n\n private checkCanBeShownByVisitorsTypeCondition(webPopup: WebPopup): boolean {\n const { visitors_type: visitorsType } = webPopup;\n\n if (visitorsType === 'NEW') {\n return !this.isRecurringVisitor;\n }\n\n if (visitorsType === 'RECURRING') {\n return this.isRecurringVisitor;\n }\n\n return true;\n }\n\n private recordImpression(code: string): void {\n if (this.placementEntries.has(code)) {\n this.trackPlacement(code, 'WEB_PLACEMENT_ACTION_SHOW');\n return;\n }\n\n this.recordPopupShownEvent(code);\n }\n\n private recordPopupShownEvent(code: string): void {\n this.pw.api.recordPopupFormEvent(code, 2).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record web popup shown event for \"${code}\"`);\n });\n }\n\n // Campaign stats, like VISIT and IMPRESSION: a content opened by its own code sends none.\n private listenForInteractions(container: HTMLElement, entry: WebPopupEntry): void {\n if (entry.kind === 'placement') {\n listenForContentClicks(container, () => {\n // A close button has already dismissed the placement by the time its click bubbles here: that is a DISMISS, not a CLICK.\n if (entry.state !== 'done') {\n this.trackPlacement(entry.popup.code, 'WEB_PLACEMENT_ACTION_CLICK');\n }\n });\n return;\n }\n\n if (entry.kind !== 'campaign') {\n return;\n }\n\n listenForContentClicks(container, () => {\n this.pw.api.recordPopupFormEvent(entry.popup.code, 3).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record web popup interaction for \"${entry.popup.code}\"`);\n });\n });\n }\n\n private async markAsShown(webPopup: WebPopup): Promise<void> {\n this.recordPopupShownEvent(webPopup.code);\n const { frequency, code } = webPopup;\n\n if (isClickWebPopup(webPopup)) {\n return;\n }\n\n if (frequency === 'ONCE') {\n await this.pw.data.addShownWebPopup(code);\n return;\n }\n\n if (frequency === 'ONCE_PER_SESSION') {\n sessionStorage.setItem(this.getSessionStorageKey(code), '1');\n }\n }\n\n private getSessionStorageKey(code: string): string {\n return `${WEB_POPUPS_WIDGET_NAMESPACE}.shown.${code}`;\n }\n}\n\nconst PLACEMENT_RANKS: Record<string, number> = {\n WEB_PLACEMENT_PRIORITY_LOW: 1,\n WEB_PLACEMENT_PRIORITY_MEDIUM: 2,\n WEB_PLACEMENT_PRIORITY_HIGH: 3,\n};\n\nfunction placementRank(placement?: WebPlacement): number {\n return PLACEMENT_RANKS[placement?.priority ?? ''] ?? PLACEMENT_RANKS.WEB_PLACEMENT_PRIORITY_MEDIUM;\n}\n\nfunction placementDeadline(placement?: WebPlacement): number | null {\n const deadline = placement?.expires_at ? Date.parse(placement.expires_at) : NaN;\n\n return Number.isNaN(deadline) ? null : deadline;\n}\n\nfunction placementExpired(placement: WebPlacement | undefined, now: number): boolean {\n const deadline = placementDeadline(placement);\n\n return deadline !== null && deadline <= now;\n}\n\n// SCROLL and EXIT_INTENT popups are shown on a visitor action: whatever delay they carry is not read.\nfunction queueDelay(popup: WebPopup): number {\n return isScrollWebPopup(popup) || isExitIntentWebPopup(popup) ? 0 : popup.delay;\n}\n\n/** Placements reuse the popup pipeline: no page rules, delay or frequency of their own. */\nfunction placementPopup(placement: WebPlacement): WebPopup {\n return {\n code: placement.hash,\n popup_form_content_code: placement.content_code,\n device_type: 'ALL',\n visitors_type: 'ALL',\n matching_pages: [],\n delay: 0,\n frequency: 'EVERY_VISIT',\n trigger_type: 'API',\n kind: placement.kind === 'WEB_PLACEMENT_KIND_EMBEDDED' ? 'EMBEDDED' : 'POPUP',\n css_selector: placement.css_selector,\n };\n}\n","import { render } from 'preact';\n\nimport {\n WebPopupInline, type WebPopupColorSchemePref, type WebPopupParams,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { type WebPopupSubmitHandlers } from './renderer';\nimport { submitSubscriptionForm } from './subscriptionFormApi';\nimport { webPopupLogger } from './webPopupLogger';\n\n/** Mount an EMBEDDED block inline; unmount it with `unmountWebPopup`. `onRequestRemove` is the subscribe button's close, `onRequestClose` keeps close buttons. */\nexport const renderEmbeddedWebPopup = (\n container: HTMLElement,\n params: WebPopupParams,\n handlers: WebPopupSubmitHandlers,\n colorScheme: WebPopupColorSchemePref = 'auto',\n onRequestRemove?: () => void,\n onRequestClose?: () => void,\n): void => {\n render(\n <WebPopupInline\n params={params}\n colorScheme={colorScheme}\n onSubmitForm={submitSubscriptionForm}\n onSubmitFormValues={handlers.onSubmitFormValues}\n onSubmitChoice={handlers.onSubmitChoice}\n onSubmitRating={handlers.onSubmitRating}\n onRequestSubscribe={handlers.onRequestSubscribe}\n products={handlers.products}\n onRequestRemove={onRequestRemove}\n onRequestClose={onRequestClose}\n logger={webPopupLogger}\n />,\n container,\n );\n};\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__524__","__WEBPACK_EXTERNAL_MODULE__873__","__WEBPACK_EXTERNAL_MODULE__247__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","defineProperties","Symbol","toStringTag","value","__esModule","SAFE_URL_PROTOCOL","WEB_POPUP_TEXT_COLOR","WEB_POPUP_TEXT_SECONDARY_COLOR","WEB_POPUP_ON_ACCENT_COLOR","WEB_POPUP_DEFAULT_COLORS","WEB_POPUP_TEXT_VARIANT_STYLES","h1","fontSize","fontWeight","lineHeight","h2","h3","body","caption","eyebrow","letterSpacing","icon","INVERSE_TEXT_ALPHAS","webPopupTextColor","variant","colors","inverse","color","alpha","hex","exec","full","length","split","map","c","join","g","b","parseInt","slice","inverseColorAt","textInverse","textSecondary","text","HEADING_VARIANTS","webPopupSlotRole","slot","type","includes","WEB_POPUP_BUTTON_SLOT_PADDING","webPopupButtonPillStyle","display","boxSizing","width","padding","borderRadius","fontFamily","textAlign","textDecoration","cursor","backgroundColor","surface","accent","border","onAccent","webPopupFormInputStyle","borderColor","surfaceText","outline","WEB_POPUP_FORM_DEFAULTS","WEB_POPUP_CHOICE_DEFAULTS","WEB_POPUP_PRODUCTS_DEFAULTS","WEB_POPUP_RATING_DEFAULTS","WEB_POPUP_RETRY_ERROR","WEB_POPUP_EMAIL_PATTERN","WEB_POPUP_EMAIL_INPUT_DEFAULTS","WEB_POPUP_TAG_INPUT_DEFAULTS","WEB_POPUP_CONSENT_DEFAULTS","WEB_POPUP_SUBMIT_DEFAULTS","WEB_POPUP_KEYFRAMES","webPopupArrowPoints","side","WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE","Math","round","WEB_POPUP_SLIDE_CLOSE_SIZE","WEB_POPUP_GLYPH_PATHS","bell","gift","cart","chart","lock","calendar","check","star","clock","tag","mail","phone","download","play","shield","sparkle","percent","truck","ticket","user","WEB_POPUP_GLYPH_NAMES","keys","WEB_POPUP_GLYPH_SIZES","CONTAINER_TYPES","ORDERS","ALIGN_ITEMS","JUSTIFY_CONTENT","TEXT_ALIGNS","TONES","MAX_LENGTH_PX","LENGTH_UNIT_MAX","px","em","rem","LENGTH_PATTERN","TRACK_UNIT_MAX","fr","TRACK_PATTERN","TRACK_KEYWORDS","oneOf","allowed","cssLength","Number","isFinite","min","max","match","trim","amount","unit","parseFloat","BOX_SIDES","trackSize","token","nonEmptyString","containerProps","raw","props","gap","whole","sides","sideValue","boxPadding","alignItems","justifyContent","alignContent","backgroundImage","sizes","isInteger","tokens","clamped","every","trackSizes","normalizeNode","depth","budget","nodes","node","content","out","align","tone","image","Array","isArray","children","child","normalized","push","order","reverse","normalizeWebPopupLayout","WEB_POPUP_VALUE_KEY_PATTERN","VALUE_REF_PATTERN","substituteString","values","substituteWebPopupLayoutValues","layout","substituteNode","BINDING_PROPS","Set","entries","has","webPopupCssLength","webPopupTracksValue","childCount","webPopupScrimGradient","dim","scrim","webPopupBackgroundImageStyle","src","JSON","stringify","backgroundSize","backgroundPosition","webPopupContainerStyle","backgroundSrc","backgroundDim","style","minWidth","gridAutoFlow","gridTemplateColumns","gridTemplateRows","top","right","bottom","left","webPopupPaddingValue","assign","HEX_RE","parseHex","toHex","v","toString","padStart","hueToChannel","p","q","t","tn","foldLightness","l","liftLightness","webPopupShiftColor","direction","rgb","h","s","rn","gn","bn","rgbToHsl","hslToRgb","webPopupMixColor","base","over","ratio","webPopupColorAlpha","isLightColor","autoDarkWebPopupColors","light","background","derivedColors","scheme","error","chromeIcon","webPopupDarkEnabled","chrome","dark","enabled","webPopupEffectiveScheme","resolveWebPopupColors","effective","webPopupImageSrc","srcDark","resolveWebPopupBoxChrome","overlay","boxShadow","WALL_CLOCK","zoneFormatters","Map","zoneFormatter","timeZone","cached","formatter","Intl","DateTimeFormat","hour12","year","month","day","hour","minute","second","set","webPopupTimeZoneSupported","timezone","zoneOffsetMs","instantMs","parts","formatToParts","Date","read","find","part","UTC","DAY_MS","deadlines","webPopupWallClockMs","endTime","cacheKey","resolved","rawSecond","isNaN","wallAsUtc","rolled","getUTCMonth","getUTCDate","offsets","probe","offset","candidateOffsets","instants","filter","resolveWallClockMs","size","clear","TIMER_LABELS","en","days","hours","minutes","seconds","ru","de","es","pt","ja","ko","zh","hi","ar","he","th","webPopupTimerLabels","language","RTL_LETTER","LETTER","NOT_COPY","safeUrl","url","trimmed","startsWith","test","webPopupLinkTargetAttrs","target","rel","applyWebPopupSubscribeOutcome","action","result","logger","outcome","onGranted","onDenied","href","warn","window","location","open","openWebPopupSubscribeLink","page","SANITIZE_ALLOWED_TAGS","copySanitized","from","to","doc","childNodes","nodeType","appendChild","createTextNode","textContent","el","tagName","clean","createElement","toLowerCase","getAttribute","setAttribute","sanitizeWebPopupHtml","html","parsed","DOMParser","parseFromString","innerHTML","colorString","normalizeWebPopupDark","params","authored","auto","opacity","normalizeOverlay","parseWebPopupJson","json","parse","candidate","version","pages","normalizeWebPopupColors","IMAGE_FITS","normalizeVideo","video","controls","loop","normalizeImages","img","label","mediaId","mediaIdDark","fit","blur","LENGTH_CONTROL_UNITS","finiteNumber","normalizeValueControl","control","kind","units","u","ranges","entry","normalizeControlRanges","options","option","normalizeWebPopupValues","some","webPopupValuesMap","fromEntries","FORM_FIELD_KINDS","BUTTON_VARIANTS","normalizeFormFields","field","f","placeholder","required","unshift","CHOICE_CONTROLS","PRODUCTS_STRATEGIES","productsStrategy","PRODUCTS_LAYOUTS","RATING_SCALES","RATING_SUBMIT_MODES","TIMER_EXPIRE_ACTIONS","LANGUAGE_CODE","HEX_COLOR","MAX_SLOT_MESSAGE","slotString","slotStringOr","fallback","normalizeLanguage","code","normalizeChoiceOptions","existing","tagValue","normalizeChoiceBounds","bound","n","floor","normalizeSlots","zone","expirePage","onExpire","expires","showLabels","submitLabel","submitVariant","successMessage","labels","scale","low","high","submitMode","eventName","fields","limit","strategy","fallbackStrategy","title","price","cta","ctaText","hideWhenEmpty","formCode","privacy","checkboxLabel","linkLabel","confirmEmailMessage","errorMessage","requiredMessage","invalidMessage","name","normalizeContents","slots","validSize","resolveWebPopupPageSize","own","shared","axis","resolveWebPopupPages","height","leftAction","normalizeWebPopupArrowAction","rightAction","images","contents","role","clampNumber","webPopupDirection","dir","texts","rtl","ltr","char","replace","detectTextDirection","flatMap","webPopupSlotCopy","webPopupCssTextAlign","startPageOf","startPage","placementMaxSize","placement","zoneWithoutCloseButtons","isWebPopupCloseButton","webPopupPageWithoutCloseButtons","FORM_FIELD_SLOT_TYPES","FORM_SLOT_TYPES","isFormFieldSlot","webPopupFormFieldId","pageKey","slotKey","webPopupHasForm","fieldError","input","checks","id","validateWebPopupForm","errors","isClickWebPopup","popup","trigger_type","clickMatchesSelector","event","selector","path","composedPath","Element","elements","parentElement","clickedElements","element","matches","WEB_POPUPS_WIDGET_NAMESPACE","WEB_POPUPS_LOG_PREFIX","EMBEDDED_ORDER_ATTRIBUTE","STORE_NAME_KEY_VALUE","STORE_NAME_MESSAGE_LOG","STORE_NAME_INBOX_MESSAGES","storeCreatorDecorator","storeCreator","database","objectStoreNames","contains","initial","createObjectStore","keyPath","logStore","autoIncrement","createIndex","unique","statusIndex","store","multiEntry","Migrations","all","MigrationExecutor","constructor","db","migrationsBuilder","applyMigrations","applyMigrationsPack","migrationsPack","forEach","migration","onversionchange","console","info","close","databasePromise","getInstanceWithPromise","executor","Promise","resolve","reject","request","indexedDB","onsuccess","bind","onerror","onupgradeneeded","then","LogBase","_add","transaction","objectStore","add","getAll","items","ids","sort","maxItems","delete","openCursor","ev","cursorResult","continue","log","environment","self","registration","message","additional","date","Error","stack","levels","debug","limitLevel","Logger","setLevel","level","write","createChoiceSubmitHandler","pw","async","api","setTags","operation","createRatingSubmitHandler","score","postEvent","createSubscribeHandler","campaignCode","permissionBefore","driver","getPermission","hadToken","checkDeviceSubscribeForPushNotifications","catch","isSubscribed","subscribe","isDeviceRegistered","permission","recordPopupFormEvent","createFormValuesSubmitHandler","response","submitPopupForm","levelName","levelNumber","args","groupCollapsed","trace","groupEnd","DARK_MEDIA_QUERY","prefersDark","matchMedia","useColorScheme","pref","watch","setDark","compat_root_preactCompat_","useState","watchDeps","prevWatchDeps","setPrevWatchDeps","dep","index","useEffect","media","onChange","addEventListener","removeEventListener","WEB_POPUP_INLINE_SCOPE_ATTRIBUTE","WEB_POPUP_CLOSE_ATTRIBUTE","WEB_POPUP_SUBMIT_ATTRIBUTE","WEB_POPUP_INLINE_WRAPPER_STYLE","WEB_POPUP_INLINE_IMAGE_CAP_CSS","WebPopupFormSessionContext","createContext","phase","setText","setCheck","submit","turnPage","go","advance","withoutKey","record","useWebPopupFormSession","onPageChange","onSubmitFormValues","useMemo","collectWebPopupFormFields","setTexts","setChecks","setErrors","setPhase","pageIndex","findIndex","pageValid","found","invalid","formValid","tags","policyAccepted","email","webPopupFormValues","showInvalidEmail","success","prev","checked","targetIndex","forward","next","fieldSlotStyle","captionStyle","errorStyle","paddingTop","labelStyle","look","paddingBottom","TextFieldView","inputType","autoComplete","session","useContext","focused","setFocused","jsx_runtime_root_jsxRuntime_","jsxs","jsx","disabled","onFocus","onBlur","currentTarget","onKeyDown","EmailInputSlotView","TagInputSlotView","checkboxStyle","margin","flexShrink","styles_labelStyle","ConsentSlotView","Fragment","slotStyle","pillStyle","submitting","SubmitSlotView","onClick","WebPopupProductsContext","productsCache","WeakMap","loadWebPopupProducts","host","now","cache","hit","at","load","loaded","formatPrice","currency","String","NumberFormat","format","ProductCard","product","titleColor","priceColor","cardStyle","flexDirection","flex","aspectRatio","ProductsSlotView","mode","setItems","cancelled","shown","count","_","listStyle","overflowX","webPopupSlideCloseInset","arrowGutter","hasRightArrow","tip","transition","delay","revealed","wait","ArrowControl","gutter","onRequestClose","hover","setHover","sameTab","tucked","position","marginTop","transform","pointerEvents","glyph","overflow","tabIndex","onMouseEnter","onMouseLeave","viewBox","points","fill","stroke","strokeWidth","strokeLinejoin","SlideOutClose","inset","transformOrigin","WebPopupRevealControls","reveal","delays","slideOutClose","step","revealStagger","webPopupRevealDelays","Boolean","WebPopupSubscribeContext","answered","markAnswered","ANIMATION_STYLE","none","fade","slide","TextSlotView","dangerouslySetInnerHTML","__html","ButtonSlotView","onRequestSubscribe","onSubscribeClose","form","askPhase","setAskPhase","pill","wrapper","spent","ask","SlotMessageView","FORM_INPUT_TYPES","FORM_AUTOCOMPLETE","firstName","lastName","PRIVACY_ERROR_KEY","FormSlotView","onSubmitForm","setValues","setPolicyAccepted","focusedKey","setFocusedKey","captionColor","privacyHref","noValidate","onSubmit","preventDefault","payload","customFields","setFieldValue","k","TimerCell","digitStyle","TimerSlotView","nowMs","setNowMs","remaining","deadline","total","webPopupTimerRemaining","expired","setInterval","clearInterval","digitColor","labelColor","fontVariantNumeric","cells","cell","ChoiceSlotView","onSubmitChoice","picked","setPicked","notice","setNotice","toggle","textColor","optionStyle","flexWrap","selected","accentColor","RatingButton","onPick","thumbs","strokeLinecap","RatingSlotView","onSubmitRating","setScore","send","scores","edgeLabelStyle","isSelected","pick","GlyphSlotView","WebPopupSlotView","pageChange","ContentNodeView","leaf","z","renderZone","previous","mediaVideoSrc","MediaVideo","poster","autoPlay","muted","playsInline","preload","ImageNodeView","renderImage","objectFit","alt","LayeredBackgroundBox","outer","inner","layer","rest","LayoutNodeView","bgKey","bgVideo","bgSrc","backdropFilter","WebkitBackdropFilter","WebPopupBox","colorScheme","leafRenderers","animatePage","products","formSession","subscribeSession","setAnswered","useWebPopupSubscribeSession","box","overflowY","pageStyle","animation","minHeight","Provider","CloseButton","insetInlineEnd","fixedContainerStyle","room","sideOffset","topOffset","maxWidth","maxHeight","tx","ty","anim","WebPopupReader","setPageKey","Image","hoverCapable","capable","useWebPopupHoverCapable","handlers","revealHandlers","setRevealed","timerRef","useRef","cancel","current","clearTimeout","show","hide","setTimeout","e","relatedTarget","useWebPopupReveal","hasArrows","resolveWebPopupReveal","webPopupRevealRoom","WebPopupInline","onRequestRemove","webPopupParamsWithoutCloseButtons","SUBMIT_RESULTS","SUBMIT_FORM_RESULT_SUBSCRIBED","SUBMIT_FORM_RESULT_CONFIRM_EMAIL","SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED","formUrl","encodeURIComponent","submitSubscriptionForm","fetch","method","headers","userId","ok","status","data","webPopupLogger","isEmbeddedWebPopup","EmbeddedWebPopups","deps","blocks","viewed","autoSkipLogged","syncWithPage","canAutoShow","isConnected","remove","trigger","matchesPage","place","removeWhere","shouldRemove","block","findContainer","document","insertBefore","firstBlockAfter","shadow","attachShadow","container","dismissible","createDismissButton","dismiss","render","observer","watchFirstView","reportShown","button","font","hasAttribute","disconnect","unmount","css_selector","logSkip","querySelector","details","recordVisit","dispatchShown","IntersectionObserver","reportViewed","records","isIntersecting","observe","recordImpression","recordFormViews","TOUCH_EVENTS","ACTIVATION_EVENTS","GUARD_STATE_KEY","isExitIntentWebPopup","asObject","state","isGuardState","watchCursorLeave","onExit","onMouseOut","clientY","watchTabSwitch","onVisibilityChange","visibilityState","watchFastScrollUp","lastY","scrollY","lastTime","lastTouch","NEGATIVE_INFINITY","onTouch","onScroll","y","speed","innerHeight","capture","passive","watchBack","guardHref","onGuard","pushGuard","removeActivationListeners","history","guardState","pushState","onPopState","leftGuard","back","listenForContentClicks","closest","webPopupProductsAvailable","collectWebPopupProductSlots","CAMPAIGN_VALUE","not_determined","granted_explicit","denied","unsupported","CONDITIONS","matchesPushPermission","push_permission_status","toUpperCase","getPushPermissionStatus","readCampaignValue","unmountWebPopup","external_commonjs_preact_commonjs2_preact_amd_preact_root_preact_","isScrollWebPopup","pageScrollDepth","scrollHeight","scrollingElement","documentElement","getPagePath","pathname","decodeURIComponent","WebPopupsWidget","recommendations","isRecurringVisitor","contentEntries","placementEntries","placementSeq","placementCounter","dismissedPlacements","shownPlacements","placementsActive","queue","visible","drainTimeoutId","autoShowEnabled","isNavigationSubscribed","stopClickWatch","badClickSelectors","openPopupsCount","bodyOverflowBeforeLock","readyPromise","readyResolve","submitHandlers","item","image_url","trackClick","productId","embedded","checkSoftCondition","listenForInteractions","renderEmbeddedWebPopup","handlersFor","other","dismissPlacement","recordSubscriptionFormViews","dispatchEvent","moduleRegistry","webPopups","run","initParams","enable","autoShow","features","getFeatures","hasCampaigns","buffered","acceptPlacements","placementsAllowed","ensureDeviceRegistered","getIsRecurringVisitor","getPopupForms","webPopup","createEntry","allSettled","passedStrongConditions","checkStrongCondition","passedFrequency","checkCanBeShownByFrequencyCondition","shouldPrefetchContent","ensureContent","loadedCodes","subscribeToNavigation","subscribeToPushPermission","renderForCurrentPage","watchClickTriggers","pullPlacements","setIsRecurringVisitor","getContentEntry","isEmbedded","productsEmpty","checkNotExpired","detachFromAutoPipeline","present","hideAll","hadVisible","cancelScheduledDrain","isVisible","getVisibleCode","getAvailableCodes","getState","waiting","queued","available","webPlacements","takeWebPlacements","webPlacementsSink","placements","receivePlacements","syncPlacements","extra","pulled","getWebPlacements","authoritative","live","hash","content_code","placementExpired","kept","dropPlacement","popup_form_content_code","device_type","visitors_type","matching_pages","frequency","placementPopup","scheduleExpiry","renderPlacements","pending","ready","renderPlacementBlocks","queuePlacementPopup","winners","placementBeats","busy","idle","best","reduce","winner","insertIntoQueue","drain","rank","placementRank","placementDeadline","trackPlacement","onPlacementsNavigate","trackWebPlacement","entryByCode","loading","timeoutId","stopTriggerWatch","visitRecorded","loadContent","finally","parseWebPopupContent","getPopupFormContent","codes","releaseUnmatchedPending","armed","canAutoDisplay","arm","isAutoEligible","isAutoTrigger","passesDisplayConditions","isStillEligible","onTriggerClick","isClickTarget","armScrollDepth","armExitIntent","armDelay","enqueueArmed","threshold","scroll_depth","scrollThreshold","onReached","frame","ResizeObserver","schedule","stop","cancelAnimationFrame","requestAnimationFrame","watchScrollDepth","formFactor","stops","fn","fire","watchExitIntent","reason","indexOf","queueDelay","splice","shift","scheduleDrain","zIndex","modal","lockBodyScroll","closed","unlockBodyScroll","renderWebPopup","markAsShown","formCodes","collectWebPopupFormCodes","getHwid","hwid","recordSubscriptionFormView","onNavigate","nav","navigation","lastHref","releaseByPushPermission","addSdkEventHandler","addEventHandler","checkCanBeShownByDeviceTypeCondition","checkCanBeShownByVisitorsTypeCondition","checkCanBeShownByMatchingPagesCondition","webPopupExpired","deviceType","getShownWebPopups","sessionStorage","getItem","getSessionStorageKey","matchingPages","matching_page_rules","matchingPageRules","excluded_pages","excludedPages","rule","matchPageRule","operator","visitorsType","recordPopupShownEvent","setItem","addShownWebPopup","PLACEMENT_RANKS","WEB_PLACEMENT_PRIORITY_LOW","WEB_PLACEMENT_PRIORITY_MEDIUM","WEB_PLACEMENT_PRIORITY_HIGH","priority","expires_at","NaN"],"sourceRoot":""}
1
+ {"version":3,"file":"widget-web-popups.js","mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,UAAAA,QAAA,iBAAAA,QAAA,4BACA,sBAAAC,QAAAA,OAAAC,IACAD,OAAA,gDAAAJ,OACA,CACA,IAAAM,EAAA,iBAAAL,QAAAD,EAAAG,QAAA,UAAAA,QAAA,iBAAAA,QAAA,uBAAAH,EAAAD,EAAA,OAAAA,EAAA,aAAAA,EAAA,YACA,QAAAQ,KAAAD,GAAA,iBAAAL,QAAAA,QAAAF,GAAAQ,GAAAD,EAAAC,EACA,CACC,CATD,CASCC,KAAA,CAAAC,EAAAC,EAAAC,qCCTDT,EAAAD,QAAAQ,UCAAP,EAAAD,QAAAS,UCAAR,EAAAD,QAAAU,ICCA,MAAAC,EAAA,GAGA,SAAAC,EAAAC,GAEA,MAAAC,EAAAH,EAAAE,GACA,QAAAE,IAAAD,EACA,OAAAA,EAAAd,QAGA,MAAAC,EAAAU,EAAAE,GAAA,CAGAb,QAAA,IAOA,OAHAgB,EAAAH,GAAAZ,EAAAA,EAAAD,QAAAY,GAGAX,EAAAD,OACA,CCrBAY,EAAAK,EAAA,CAAAjB,EAAAkB,KACA,QAAAC,KAAAD,EACAN,EAAAQ,EAAAF,EAAAC,KAAAP,EAAAQ,EAAApB,EAAAmB,IACAE,OAAAC,eAAAtB,EAAAmB,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,E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GsM,MAAOxY,IAC3DoX,GAAOpX,MAAMA,EAAO,GAAGyS,kDAAqErI,EAAMuH,MAAMzF,aAf1GsoB,GAAuBhE,EAAW,KAEZ,SAAhBpmB,EAAMmoB,OACR3jC,KAAK+uC,eAAevzB,EAAMuH,MAAMzF,KAAM,+BAe9C,CAEQ,iBAAMg1B,CAAY/H,GACxBvqC,KAAKs0C,sBAAsB/J,EAASjtB,MACpC,MAAMqwB,UAAEA,EAASrwB,KAAEA,GAASitB,EAExBznB,GAAgBynB,KAIF,SAAdoD,EAKc,qBAAdA,GACF8F,eAAec,QAAQv0C,KAAK2zC,qBAAqBr2B,GAAO,WALlDtd,KAAK6oB,GAAGuX,KAAKoU,iBAAiBl3B,GAOxC,CAEQ,oBAAAq2B,CAAqBr2B,GAC3B,MAAO,GAAGsG,YAAqCtG,GACjD,EAGF,MAAMm3B,GAA0C,CAC9CC,2BAA4B,EAC5BC,8BAA+B,EAC/BC,4BAA6B,GAG/B,SAAS/F,GAAchtB,GACrB,OAAO4yB,GAAgB5yB,GAAWgzB,UAAY,KAAOJ,GAAgBE,6BACvE,CAEA,SAAS7F,GAAkBjtB,GACzB,MAAMqW,EAAWrW,GAAWizB,WAAarhC,KAAKsG,MAAM8H,EAAUizB,YAAcC,IAE5E,OAAOrrC,OAAO2K,MAAM6jB,GAAY,KAAOA,CACzC,CAEA,SAASkV,GAAiBvrB,EAAqCmP,GAC7D,MAAMkH,EAAW4W,GAAkBjtB,GAEnC,OAAoB,OAAbqW,GAAqBA,GAAYlH,CAC1C,CAGA,SAAS4gB,GAAW7uB,GAClB,OAAO8jB,GAAiB9jB,IAAU0gB,GAAqB1gB,GAAS,EAAIA,EAAMiQ,KAC5E","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/external umd {\"commonjs\":\"preact\",\"commonjs2\":\"preact\",\"amd\":\"preact\",\"root\":\"preact\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/compat\",\"commonjs2\":\"preact/compat\",\"amd\":\"preact/compat\",\"root\":\"preactCompat\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/jsx-runtime\",\"commonjs2\":\"preact/jsx-runtime\",\"amd\":\"preact/jsx-runtime\",\"root\":\"jsxRuntime\"}","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/constants.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/glyphs.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/layout.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/palette.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/timer.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/shared/textDirection.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/helpers.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form.js","webpack://web-push-notifications/./src/widgets/WebPopups/clickTrigger.ts","webpack://web-push-notifications/./src/widgets/WebPopups/constants.ts","webpack://web-push-notifications/./src/modules/storage/migrations/constants.ts","webpack://web-push-notifications/./src/modules/storage/migrations/helpers.ts","webpack://web-push-notifications/./src/modules/storage/migrations/initial.ts","webpack://web-push-notifications/./src/modules/storage/migrations/Migrations.ts","webpack://web-push-notifications/./src/modules/storage/migrations/MigrationExecutor.ts","webpack://web-push-notifications/./src/core/storage.ts","webpack://web-push-notifications/./src/core/logger.ts","webpack://web-push-notifications/./src/widgets/WebPopups/deviceSubmitApi.ts","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/colorScheme.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/formSession.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/TextFieldView/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/TextFieldView/TextFieldView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/EmailInputSlotView/EmailInputSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/TagInputSlotView/TagInputSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/ConsentSlotView/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/ConsentSlotView/ConsentSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/SubmitSlotView/styles.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/form-slots/SubmitSlotView/SubmitSlotView.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/productsSlot.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/revealControls.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/subscribeSession.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/WebPopupReader.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/web-popups/WebPopupInline.js","webpack://web-push-notifications/./src/widgets/WebPopups/subscriptionFormApi.ts","webpack://web-push-notifications/./src/widgets/WebPopups/webPopupLogger.ts","webpack://web-push-notifications/./src/widgets/WebPopups/EmbeddedWebPopups.ts","webpack://web-push-notifications/./src/widgets/WebPopups/exitIntent.ts","webpack://web-push-notifications/./src/widgets/WebPopups/interactions.ts","webpack://web-push-notifications/./src/widgets/WebPopups/productsHost.ts","webpack://web-push-notifications/./src/widgets/WebPopups/pushPermissionCondition.ts","webpack://web-push-notifications/./src/widgets/WebPopups/renderer.tsx","webpack://web-push-notifications/./src/widgets/WebPopups/scrollDepth.ts","webpack://web-push-notifications/./src/helpers/pagePath.ts","webpack://web-push-notifications/./src/widgets/WebPopups/WebPopupsWidget.ts","webpack://web-push-notifications/./src/widgets/WebPopups/embeddedRenderer.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"preact\", \"preact/compat\", \"preact/jsx-runtime\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\")) : factory(root[\"preact\"], root[\"preactCompat\"], root[\"jsxRuntime\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__524__, __WEBPACK_EXTERNAL_MODULE__873__, __WEBPACK_EXTERNAL_MODULE__247__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__524__;","module.exports = __WEBPACK_EXTERNAL_MODULE__873__;","module.exports = __WEBPACK_EXTERNAL_MODULE__247__;","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter/value functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tObject.defineProperties(exports, { [Symbol.toStringTag]: { value: 'Module' }, __esModule: { value: true } });\n};","/**\n * Current stored-format version (WebPopupJson.version). Version 2 = the\n * layout-tree format (nested containers + Content/Image leaves, named content\n * zones). Version 1 (flat layout + single slot list) is retired without a\n * migration path — v1 popups are treated as broken, same as the pre-engine\n * ai-builder format.\n */\nexport const WEB_POPUP_VERSION = 2;\n// Bomb protection for the embedded layout tree — the json travels through a\n// public API, so the parser refuses to walk pathological trees.\nexport const WEB_POPUP_LAYOUT_MAX_DEPTH = 10;\nexport const WEB_POPUP_LAYOUT_MAX_NODES = 100;\n/** Protocols allowed in button hrefs (plus relative `#`/`/`/`?` prefixes). */\nexport const SAFE_URL_PROTOCOL = /^(https?:|mailto:|tel:)/i;\nexport const WEB_POPUP_FONT_STACK = 'Inter, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif';\n// Palette defaults (mirror the editor's popup theme) — what a popup gets for\n// any WebPopupColors entry its json doesn't set.\nexport const WEB_POPUP_TEXT_COLOR = '#101828';\nexport const WEB_POPUP_TEXT_SECONDARY_COLOR = '#667085';\nexport const WEB_POPUP_ACCENT_COLOR = '#2970FF';\nexport const WEB_POPUP_BACKGROUND_COLOR = '#FFFFFF';\n/** Label over an accent fill in the light scheme; dark picks it by accent luminance. */\nexport const WEB_POPUP_ON_ACCENT_COLOR = '#FFFFFF';\nexport const WEB_POPUP_DEFAULT_COLORS = {\n background: WEB_POPUP_BACKGROUND_COLOR,\n accent: WEB_POPUP_ACCENT_COLOR,\n text: WEB_POPUP_TEXT_COLOR,\n textSecondary: WEB_POPUP_TEXT_SECONDARY_COLOR,\n textInverse: '#FFFFFF'\n};\n/** Fallback width used when a fixed-width context needs a number anyway. */\nexport const WEB_POPUP_DEFAULT_WIDTH = 360;\n/** Max height of an `<img>` in an Inline block: at full container width a side image would be too tall. */\nexport const WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT = 360;\n// Per-variant text styles — the same numbers the editor's canvas derives from\n// its theme presets. No colors here: those come from the popup palette via\n// webPopupTextColor below.\nexport const WEB_POPUP_TEXT_VARIANT_STYLES = {\n h1: {\n fontSize: 24,\n fontWeight: 600,\n lineHeight: 1.25\n },\n h2: {\n fontSize: 18,\n fontWeight: 600,\n lineHeight: 1.3\n },\n h3: {\n fontSize: 16,\n fontWeight: 600,\n lineHeight: 1.35\n },\n body: {\n fontSize: 14,\n fontWeight: 'normal',\n lineHeight: 1.5\n },\n caption: {\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.4\n },\n eyebrow: {\n fontSize: 11,\n fontWeight: 600,\n letterSpacing: '0.08em',\n lineHeight: 1.4\n },\n icon: {\n fontSize: 24,\n lineHeight: 1.2\n }\n};\n// Inverse-tone translucency per text style: headings full-strength, the\n// secondary variants toned down — same rhythm the palette's default white\n// set always had.\nconst INVERSE_TEXT_ALPHAS = {\n h1: 1,\n h2: 1,\n h3: 1,\n icon: 1,\n eyebrow: 0.8,\n body: 0.9,\n caption: 0.75\n};\n// colors.textInverse at the given opacity. Only #rgb/#rrggbb can be blended;\n// any other author-supplied css color renders full-strength rather than\n// being guessed at.\nfunction inverseColorAt(color, alpha) {\n if (alpha >= 1) return color;\n const hex = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(color)?.[1];\n if (!hex) return color;\n const full = hex.length === 3 ? hex.split('').map(c => c + c).join('') : hex;\n const [r, g, b] = [0, 2, 4].map(i => parseInt(full.slice(i, i + 2), 16));\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n/**\n * A text slot's color: the palette's main/secondary role by variant; in an\n * 'inverse' zone (over a background image) — colors.textInverse, with the\n * secondary variants toned translucent. Undefined for a non-inverse 'icon'\n * (an emoji line inherits — its glyphs aren't recolorable anyway).\n */\nexport function webPopupTextColor(variant, colors, inverse) {\n if (inverse) return inverseColorAt(colors.textInverse, INVERSE_TEXT_ALPHAS[variant] ?? 1);\n if (variant === 'icon') return undefined;\n return variant === 'caption' || variant === 'eyebrow' ? colors.textSecondary : colors.text;\n}\n/** The dark fill under a container's background image while it loads. */\nexport const WEB_POPUP_BG_SECTION_FALLBACK = '#1D2939';\nconst HEADING_VARIANTS = ['h1', 'h2', 'h3', 'icon'];\nexport function webPopupSlotRole(slot) {\n // An icon reads as the line above a title, so it hugs what follows; a\n // countdown wants a block's air, which the 'action' fallback gives it.\n if (slot.type === 'glyph') return 'heading';\n if (slot.type !== 'text') return 'action';\n return HEADING_VARIANTS.includes(slot.variant) ? 'heading' : 'text';\n}\nexport function webPopupSlotGap(prev, next) {\n if (next === 'action') return prev === 'action' ? 6 : 16;\n if (next === 'text' && prev === 'heading') return 4;\n return 8;\n}\n// Paddings INSIDE a form slot (field rows, submit pill); the rhythm above\n// owns the space BETWEEN slots.\nexport const WEB_POPUP_TEXT_SLOT_PADDING = '4px 0';\nexport const WEB_POPUP_BUTTON_SLOT_PADDING = '8px 0 4px';\n/**\n * The button pill both button slots and a form slot's submit button render\n * with — buttons pair the accent with white (primary = accent fill + white\n * label, secondary = white fill + accent outline). Shared with the editor's\n * canvas (parity contract).\n */\nexport function webPopupButtonPillStyle(variant, colors) {\n return {\n display: 'block',\n boxSizing: 'border-box',\n width: '100%',\n padding: '10px 25px',\n borderRadius: 6,\n fontSize: 14,\n fontWeight: 600,\n fontFamily: 'inherit',\n lineHeight: 1.5,\n textAlign: 'center',\n textDecoration: 'none',\n cursor: 'pointer',\n ...(variant === 'secondary' ? {\n backgroundColor: colors.surface,\n color: colors.accent,\n border: `1px solid ${colors.accent}`\n } : {\n backgroundColor: colors.accent,\n color: colors.onAccent,\n border: 'none'\n })\n };\n}\n// Form-slot input chrome, shared with the editor's canvas (parity contract):\n// a `surface` card whatever the zone tone, only the border varies.\nexport const WEB_POPUP_FORM_INPUT_BORDER = '#D0D5DD';\nexport const WEB_POPUP_FORM_ERROR_COLOR = '#D92D20';\n/** The error red lifted for a dark background — the same Untitled UI ramp, three steps up. */\nexport const WEB_POPUP_FORM_ERROR_COLOR_DARK = '#FDA29B';\nexport function webPopupFormInputStyle(colors, borderColor = colors.border) {\n return {\n display: 'block',\n boxSizing: 'border-box',\n width: '100%',\n padding: '10px 12px',\n borderRadius: 6,\n fontSize: 14,\n fontFamily: 'inherit',\n lineHeight: 1.5,\n backgroundColor: colors.surface,\n color: colors.surfaceText,\n border: `1px solid ${borderColor}`,\n outline: 'none'\n };\n}\n// What a normalized form slot falls back to when the json omits the copy —\n// also the editor's defaults for a freshly added slot.\nexport const WEB_POPUP_FORM_DEFAULTS = {\n submitLabel: 'Subscribe',\n successMessage: 'Thanks for subscribing!',\n confirmEmailMessage: 'Please check your inbox and confirm your email.'\n};\n// What a normalized choice slot falls back to when the json omits the copy.\nexport const WEB_POPUP_CHOICE_DEFAULTS = {\n submitLabel: 'Save',\n successMessage: 'Thanks! Your choice is saved.'\n};\nexport const WEB_POPUP_PRODUCTS_DEFAULTS = {\n ctaText: 'Shop now',\n limit: 4\n};\nexport const WEB_POPUP_PRODUCTS_MAX_LIMIT = 12;\n/** Cards a products slot draws without a host: enough to read as a row, never the full limit. */\nexport const WEB_POPUP_PRODUCTS_PLACEHOLDERS = 3;\n/** How long one products answer serves both the host's pre-show check and the render. */\nexport const WEB_POPUP_PRODUCTS_CACHE_MS = 60 * 1000;\n// Same, for a rating slot.\nexport const WEB_POPUP_RATING_DEFAULTS = {\n submitLabel: 'Send',\n successMessage: 'Thanks for the feedback!'\n};\n// The scores a scale offers, in display order; thumbs are 0/1 so `score` stays\n// \"higher is better\" everywhere. Shared with the editor canvas (parity).\nexport function webPopupRatingScores(scale) {\n if (scale === 'nps') return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n if (scale === 'stars') return [1, 2, 3, 4, 5];\n return [0, 1];\n}\n/** Options a `choice` slot may carry; exported so the editor can't offer one normalization drops. */\nexport const WEB_POPUP_MAX_CHOICE_OPTIONS = 12;\n/** What a slot says when the host callback rejected: nothing actionable, so it's retryable. */\nexport const WEB_POPUP_RETRY_ERROR = 'Something went wrong. Please try again.';\n/** Email shape both form paths accept; the server runs the real check. */\nexport const WEB_POPUP_EMAIL_PATTERN = /^\\S+@\\S+\\.\\S+$/;\n/** Copy a Form's Email input falls back to — also the editor's defaults for a fresh block. */\nexport const WEB_POPUP_EMAIL_INPUT_DEFAULTS = {\n invalidMessage: 'Enter a valid email',\n requiredMessage: 'Required'\n};\n/** Copy a Form's Tag input falls back to. */\nexport const WEB_POPUP_TAG_INPUT_DEFAULTS = {\n requiredMessage: 'Required'\n};\n/** Copy a Form's Consent falls back to. */\nexport const WEB_POPUP_CONSENT_DEFAULTS = {\n requiredMessage: 'Please accept the privacy policy'\n};\n/** Copy a Form's Submit falls back to; the error is the retry line every submitting slot shows. */\nexport const WEB_POPUP_SUBMIT_DEFAULTS = {\n label: 'Submit',\n errorMessage: WEB_POPUP_RETRY_ERROR\n};\nexport const WEB_POPUP_KEYFRAMES = `\n@keyframes pw-vpopup-fade { from { opacity: 0; } }\n@keyframes pw-vpopup-slide { from { opacity: 0; translate: 0 28px; } }\n@keyframes pw-vpopup-overlay { from { opacity: 0; } }\n@keyframes pw-vpopup-page { from { opacity: 0; } }\n`;\n// Page-switch transition: the incoming page's content fades in while explicit\n// px sizes glide instead of jumping (auto sizes still snap — 'auto' can't be\n// transitioned). One duration for both so they read as a single move.\nexport const WEB_POPUP_PAGE_TRANSITION_MS = 300;\n/** Side room px for the page arrows: default and clamp bounds. */\nexport const WEB_POPUP_ARROW_GUTTER_DEFAULT = 48;\nexport const WEB_POPUP_ARROW_GUTTER_MIN = 28;\nexport const WEB_POPUP_ARROW_GUTTER_MAX = 120;\n/** The drawn triangle, px; its height is twice its width. */\nexport const WEB_POPUP_ARROW_WIDTH = 14;\nexport const WEB_POPUP_ARROW_HEIGHT = 28;\n/** The arrow's drop shadow, a css `filter`. */\nexport const WEB_POPUP_ARROW_SHADOW = 'drop-shadow(0 2px 4px rgba(16, 24, 40, 0.28))';\n/** The arrow triangle's svg polygon points, pointing to `side`. */\nexport function webPopupArrowPoints(side) {\n const w = WEB_POPUP_ARROW_WIDTH;\n const h = WEB_POPUP_ARROW_HEIGHT;\n return side === 'left' ? `${w},1 1,${h / 2} ${w},${h - 1}` : `0,1 ${w - 1},${h / 2} 0,${h - 1}`;\n}\n/** How much an arrow or the slide-out ✕ grows under the pointer. */\nexport const WEB_POPUP_CONTROL_HOVER_SCALE = 1.14;\n/** One control's slide in or out. */\nexport const WEB_POPUP_REVEAL_MS = 280;\nexport const WEB_POPUP_REVEAL_STAGGER_DEFAULT = 0.5;\n/** How long the pointer may be off the popup before the controls hide — crossing a gap is not leaving. */\nexport const WEB_POPUP_REVEAL_LEAVE_GRACE_MS = 750;\n/** The slide-out ✕ and its distance from the box corner, px. */\nexport const WEB_POPUP_SLIDE_CLOSE_SIZE = 28;\nexport const WEB_POPUP_SLIDE_CLOSE_GAP = 6;\n/** The slide-out ✕ grows by this factor while it slides out. */\nexport const WEB_POPUP_SLIDE_CLOSE_GROWTH = 1.5;\n/** The slide-out ✕ once out, px. */\nexport const WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE = Math.round(WEB_POPUP_SLIDE_CLOSE_SIZE * WEB_POPUP_SLIDE_CLOSE_GROWTH);","// Hand-authored 24×24 stroke geometry, inline (no icon package in a script that\n// loads on the customer's site). EXHAUSTIVE: a name without geometry won't compile.\nexport const WEB_POPUP_GLYPH_PATHS = {\n bell: 'M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0',\n gift: 'M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14' + 'M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z',\n cart: 'M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8' + 'M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0',\n chart: 'M3 21h18M7 21V11M12 21V6M17 21v-8',\n lock: 'M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3',\n calendar: 'M4 6h16v15H4zM4 10h16M9 3v4M15 3v4',\n check: 'M4 13l5 5L20 6',\n star: 'M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z',\n clock: 'M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2',\n tag: 'M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6' + 'l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0',\n mail: 'M3 6h18v12H3zM3 7l9 6 9-6',\n phone: 'M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4',\n download: 'M12 3v12M7 11l5 5 5-5M4 20h16',\n play: 'M8 5l12 7-12 7z',\n shield: 'M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z',\n sparkle: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z' + 'M18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z',\n percent: 'M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0',\n truck: 'M2 7h12v10H2zM14 10h4l3 3v4h-7' + 'M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0',\n ticket: 'M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12',\n user: 'M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0'\n};\n/** The icon names a `glyph` slot may carry — derived, never a second list. */\nexport const WEB_POPUP_GLYPH_NAMES = Object.keys(WEB_POPUP_GLYPH_PATHS);\n/** The sizes a glyph slot may take, px; the first is the normalization default. */\nexport const WEB_POPUP_GLYPH_SIZES = [24, 32, 48];\n/** The thumb a 'thumbs' rating draws; not author-selectable, so not in the whitelist. */\nexport const WEB_POPUP_THUMB_UP_PATH = 'M8 21V10l3.5-7A2 2 0 0 1 14 5v5h4.5a2 2 0 0 1 2 2.4' + 'l-1.3 6A2 2 0 0 1 17.2 21zM8 10H3.5v11H8';","import { WEB_POPUP_LAYOUT_MAX_DEPTH, WEB_POPUP_LAYOUT_MAX_NODES } from './constants';\n// Validation + css conversion for the embedded layout tree. The json is\n// API-writable and its styles land inline on customers' pages, so every prop\n// is normalized against a whitelist on parse: numbers are clamped, strings\n// must match a strict css-length/track pattern, enums fall back to defaults,\n// unknown props are dropped. Unknown node TYPES degrade instead of breaking:\n// a node with children renders as a Vertical stack (a container from a NEWER\n// editor keeps its content visible on an older engine build), a childless\n// unknown node is dropped.\nconst CONTAINER_TYPES = ['Vertical', 'Horizontal', 'Columns', 'Rows'];\nconst ORDERS = ['normal', 'reverse'];\nconst ALIGN_ITEMS = ['start', 'center', 'end', 'stretch'];\nconst JUSTIFY_CONTENT = ['start', 'center', 'end', 'space-between'];\nconst TEXT_ALIGNS = ['left', 'center', 'right'];\nconst TONES = ['default', 'inverse'];\nconst MAX_LENGTH_PX = 2000;\n// String lengths carry a unit — clamp each to its own sane ceiling, like the\n// numeric branch: a wire value (\"9999rem\" scales off the HOST page's root\n// font size) must not be able to blow the popup past the viewport.\nconst LENGTH_UNIT_MAX = {\n px: MAX_LENGTH_PX,\n '%': 100,\n em: 125,\n rem: 125\n};\nconst LENGTH_PATTERN = /^(\\d{1,4}(?:\\.\\d+)?)(px|%|em|rem)$/;\nconst TRACK_UNIT_MAX = {\n px: MAX_LENGTH_PX,\n '%': 100,\n fr: 100\n};\nconst TRACK_PATTERN = /^(\\d{1,4}(?:\\.\\d+)?)(px|%|fr)$/;\nconst TRACK_KEYWORDS = ['auto', 'min-content', 'max-content'];\nconst MAX_TRACKS = 12;\nfunction oneOf(value, allowed) {\n return allowed.includes(value) ? value : undefined;\n}\nfunction cssLength(value) {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.min(Math.max(value, 0), MAX_LENGTH_PX);\n }\n if (typeof value !== 'string') return undefined;\n const match = LENGTH_PATTERN.exec(value.trim());\n if (!match) return undefined;\n const [, amount, unit] = match;\n return `${Math.min(parseFloat(amount), LENGTH_UNIT_MAX[unit])}${unit}`;\n}\nconst BOX_SIDES = ['top', 'right', 'bottom', 'left'];\nfunction boxPadding(value) {\n const whole = cssLength(value);\n if (whole !== undefined) return whole;\n if (typeof value !== 'object' || value === null) return undefined;\n const sides = {};\n for (const side of BOX_SIDES) {\n const sideValue = cssLength(value[side]);\n if (sideValue !== undefined) sides[side] = sideValue;\n }\n return Object.keys(sides).length > 0 ? sides : undefined;\n}\nfunction trackSize(token) {\n if (TRACK_KEYWORDS.includes(token)) return token;\n const match = TRACK_PATTERN.exec(token);\n if (!match) return undefined;\n const [, amount, unit] = match;\n return `${Math.min(parseFloat(amount), TRACK_UNIT_MAX[unit])}${unit}`;\n}\nfunction trackSizes(value) {\n if (typeof value === 'number') {\n return Number.isInteger(value) && value >= 1 && value <= MAX_TRACKS ? value : undefined;\n }\n if (typeof value !== 'string') return undefined;\n const tokens = value.trim().split(/\\s+/);\n if (tokens.length < 1 || tokens.length > MAX_TRACKS) return undefined;\n const clamped = tokens.map(trackSize);\n return clamped.every(token => token !== undefined) ? clamped.join(' ') : undefined;\n}\nfunction nonEmptyString(value) {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\nfunction containerProps(raw) {\n const props = {};\n const gap = cssLength(raw.gap);\n if (gap !== undefined) props.gap = gap;\n const padding = boxPadding(raw.padding);\n if (padding !== undefined) props.padding = padding;\n const alignItems = oneOf(raw.alignItems, ALIGN_ITEMS);\n if (alignItems) props.alignItems = alignItems;\n const justifyContent = oneOf(raw.justifyContent, JUSTIFY_CONTENT);\n if (justifyContent) props.justifyContent = justifyContent;\n const alignContent = oneOf(raw.alignContent, JUSTIFY_CONTENT);\n if (alignContent) props.alignContent = alignContent;\n const backgroundImage = nonEmptyString(raw.backgroundImage);\n if (backgroundImage) props.backgroundImage = backgroundImage;\n const sizes = trackSizes(raw.sizes);\n if (sizes !== undefined) props.sizes = sizes;\n return props;\n}\nfunction normalizeNode(raw, depth, budget) {\n if (depth > WEB_POPUP_LAYOUT_MAX_DEPTH || budget.nodes <= 0) return null;\n if (typeof raw !== 'object' || raw === null) return null;\n budget.nodes -= 1;\n const node = raw;\n const props = typeof node.props === 'object' && node.props !== null ? node.props : {};\n if (node.type === 'Content') {\n const content = nonEmptyString(props.content);\n if (!content) return null;\n const out = {\n type: 'Content',\n props: {\n content\n }\n };\n const align = oneOf(props.align, TEXT_ALIGNS);\n if (align) out.props.align = align;\n const tone = oneOf(props.tone, TONES);\n if (tone && tone !== 'default') out.props.tone = tone;\n return out;\n }\n if (node.type === 'Image') {\n const image = nonEmptyString(props.image);\n if (!image) return null;\n const out = {\n type: 'Image',\n props: {\n image\n }\n };\n return out;\n }\n if (!Array.isArray(node.children)) return null;\n const type = oneOf(node.type, CONTAINER_TYPES) ?? 'Vertical';\n const children = [];\n for (const child of node.children) {\n const normalized = normalizeNode(child, depth + 1, budget);\n if (normalized) children.push(normalized);\n }\n const out = containerProps(props);\n // `order: 'reverse'` is applied right here and consumed: the normalized\n // tree carries the children already reordered (and the sizes template\n // reversed with them, so each child keeps its track) — the renderers and\n // the editor canvas never see the prop. Caveat for hand-authored json: the\n // \"keeps its track\" guarantee assumes one sizes token per child; with a\n // mismatched count the reversed template pairs children with different\n // tracks (grid itself would misalign such a template the same way).\n if (oneOf(props.order, ORDERS) === 'reverse') {\n children.reverse();\n if (typeof out.sizes === 'string') out.sizes = out.sizes.split(' ').reverse().join(' ');\n }\n return {\n type,\n props: out,\n children\n };\n}\n/**\n * Validate an embedded layout tree from the stored json. Returns the\n * normalized tree, or null when the value isn't a renderable tree at all —\n * the page is then dropped by resolveWebPopupPages.\n */\nexport function normalizeWebPopupLayout(raw) {\n return normalizeNode(raw, 0, {\n nodes: WEB_POPUP_LAYOUT_MAX_NODES\n });\n}\n// --- value substitution ($refs) ---------------------------------------------\n/** A page value key, as referenced from the tree by a `$key` token. */\nexport const WEB_POPUP_VALUE_KEY_PATTERN = /^[a-zA-Z][a-zA-Z0-9-]*$/;\nconst VALUE_REF_PATTERN = /^\\$([a-zA-Z][a-zA-Z0-9-]*)$/;\n// Every whitespace-separated token of the form $key is replaced; separators\n// survive, so both a whole-string prop ('$stackGap') and a token inside a\n// sizes template ('1fr $imageWidth') substitute with the same rule. An\n// unknown key stays as-is and fails the prop whitelist downstream — the prop\n// is dropped, same as any invalid literal.\nfunction substituteString(value, values) {\n if (!value.includes('$')) return value;\n return value.split(/(\\s+)/).map(token => {\n const key = VALUE_REF_PATTERN.exec(token)?.[1];\n // Own properties only: '$constructor' must stay an unknown ref, not\n // resolve to an Object.prototype member.\n return key !== undefined && Object.prototype.hasOwnProperty.call(values, key) ? values[key] : token;\n }).join('');\n}\n/**\n * Substitute a page's named values into its RAW layout tree — `$key` tokens\n * in string props become the values, verbatim. Runs BEFORE\n * normalizeWebPopupLayout (see resolveWebPopupPages), so a substituted value\n * passes exactly the whitelists/clamps a literal one would; substitution is\n * single-pass and normalizeWebPopupValues rejects values containing '$', so\n * refs can't chain. Binding keys (`content`, `image`, `backgroundImage`) are\n * never substituted — they already name params by design.\n */\nexport function substituteWebPopupLayoutValues(layout, values) {\n if (typeof layout !== 'object' || layout === null || Object.keys(values).length === 0) return layout;\n return substituteNode(layout, values, 0);\n}\nconst BINDING_PROPS = new Set(['content', 'image', 'backgroundImage']);\nfunction substituteNode(raw, values, depth) {\n if (depth > WEB_POPUP_LAYOUT_MAX_DEPTH || typeof raw !== 'object' || raw === null) return raw;\n const node = raw;\n const out = {\n ...node\n };\n if (typeof node.props === 'object' && node.props !== null) {\n const props = {\n ...node.props\n };\n for (const [key, value] of Object.entries(props)) {\n if (BINDING_PROPS.has(key)) continue;\n if (typeof value === 'string') {\n props[key] = substituteString(value, values);\n } else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n // Per-side paddings: one level of string sides.\n const sides = {\n ...value\n };\n for (const [side, sideValue] of Object.entries(sides)) {\n if (typeof sideValue === 'string') sides[side] = substituteString(sideValue, values);\n }\n props[key] = sides;\n }\n }\n out.props = props;\n }\n if (Array.isArray(node.children)) {\n out.children = node.children.map(child => substituteNode(child, values, depth + 1));\n }\n return out;\n}\n// --- css conversion (shared by the reader and the editor's canvas) ---------\nexport function webPopupCssLength(value) {\n return typeof value === 'number' ? `${value}px` : value;\n}\nexport function webPopupPaddingValue(padding) {\n if (typeof padding === 'number' || typeof padding === 'string') return webPopupCssLength(padding);\n const side = value => value === undefined ? '0' : webPopupCssLength(value);\n return `${side(padding.top)} ${side(padding.right)} ${side(padding.bottom)} ${side(padding.left)}`;\n}\n/** grid-template value for Columns/Rows: absent sizes = one 1fr per child. */\nexport function webPopupTracksValue(sizes, childCount) {\n if (typeof sizes === 'string') return sizes;\n const count = typeof sizes === 'number' ? sizes : Math.max(childCount, 1);\n return `repeat(${count}, 1fr)`;\n}\n// The scrim as a standalone gradient, for the layers that can't stack it in\n// the same background property (a background VIDEO paints its own element).\nexport function webPopupScrimGradient(dim = 0) {\n if (!(dim > 0)) return null;\n const scrim = `rgba(16, 24, 40, ${Math.min(dim, 1)})`;\n return `linear-gradient(${scrim}, ${scrim})`;\n}\n/**\n * The cover-background css of a container that draws an image behind its\n * content. `dim` (0–1) is the image's scrim — a dark translucent layer\n * painted as a gradient stacked over the url() in the same property, so it\n * needs no extra element and rides along wherever the background is drawn.\n */\nexport function webPopupBackgroundImageStyle(src, dim = 0) {\n // JSON.stringify quotes + escapes the url, so an src can't break out of\n // the css function.\n const image = `url(${JSON.stringify(src)})`;\n const scrim = webPopupScrimGradient(dim);\n return {\n backgroundImage: scrim ? `${scrim}, ${image}` : image,\n backgroundSize: 'cover',\n backgroundPosition: 'center'\n };\n}\n/**\n * The inline style of a container node — grid, mirroring kit-helpers'\n * Vertical/Horizontal/Columns/Rows semantics. The background image is passed\n * resolved (looked up in the page's images by the caller) so this stays a\n * pure props → css mapping.\n */\nexport function webPopupContainerStyle(node, backgroundSrc, backgroundDim = 0) {\n const props = node.props ?? {};\n const style = {\n display: 'grid',\n minWidth: 0\n };\n if (node.type === 'Horizontal') style.gridAutoFlow = 'column';\n if (node.type === 'Columns') style.gridTemplateColumns = webPopupTracksValue(props.sizes, node.children.length);\n if (node.type === 'Rows') style.gridTemplateRows = webPopupTracksValue(props.sizes, node.children.length);\n if (props.gap !== undefined) style.gap = webPopupCssLength(props.gap);\n if (props.padding !== undefined) style.padding = webPopupPaddingValue(props.padding);\n if (props.alignItems) style.alignItems = props.alignItems;\n if (props.justifyContent) style.justifyContent = props.justifyContent;\n if (props.alignContent) style.alignContent = props.alignContent;\n if (backgroundSrc) Object.assign(style, webPopupBackgroundImageStyle(backgroundSrc, backgroundDim));\n return style;\n}","// Scheme resolution for the popup palette: the authored light/dark roles plus\n// the derived ones (input surface, borders, the label over an accent fill).\nimport { WEB_POPUP_DEFAULT_COLORS, WEB_POPUP_FORM_ERROR_COLOR, WEB_POPUP_FORM_ERROR_COLOR_DARK, WEB_POPUP_FORM_INPUT_BORDER, WEB_POPUP_ON_ACCENT_COLOR, WEB_POPUP_TEXT_COLOR, WEB_POPUP_TEXT_SECONDARY_COLOR } from './constants';\nconst HEX_RE = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;\nfunction parseHex(color) {\n const hex = HEX_RE.exec(color.trim())?.[1];\n if (!hex) return null;\n const full = hex.length === 3 ? hex.split('').map(c => c + c).join('') : hex;\n return [0, 2, 4].map(i => parseInt(full.slice(i, i + 2), 16));\n}\nfunction toHex([r, g, b]) {\n return `#${[r, g, b].map(v => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0')).join('')}`;\n}\nfunction rgbToHsl([r, g, b]) {\n const [rn, gn, bn] = [r / 255, g / 255, b / 255];\n const max = Math.max(rn, gn, bn);\n const min = Math.min(rn, gn, bn);\n const l = (max + min) / 2;\n if (max === min) return [0, 0, l];\n const d = max - min;\n const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n let h;\n if (max === rn) h = (gn - bn) / d + (gn < bn ? 6 : 0);else if (max === gn) h = (bn - rn) / d + 2;else h = (rn - gn) / d + 4;\n return [h / 6, s, l];\n}\nfunction hueToChannel(p, q, t) {\n let tn = t;\n if (tn < 0) tn += 1;\n if (tn > 1) tn -= 1;\n if (tn < 1 / 6) return p + (q - p) * 6 * tn;\n if (tn < 1 / 2) return q;\n if (tn < 2 / 3) return p + (q - p) * (2 / 3 - tn) * 6;\n return p;\n}\nfunction hslToRgb([h, s, l]) {\n if (s === 0) {\n const v = l * 255;\n return [v, v, v];\n }\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n return [hueToChannel(p, q, h + 1 / 3) * 255, hueToChannel(p, q, h) * 255, hueToChannel(p, q, h - 1 / 3) * 255];\n}\n// Mirror the light half onto [0.07, 0.5]: #FFFFFF lands on the dark canvas\n// tone and near-whites stay apart instead of collapsing into one floor.\nfunction foldLightness(l) {\n return l > 0.5 ? 0.07 + (1 - l) * ((0.5 - 0.07) / 0.5) : l;\n}\n// Mirror the dark half onto [0.5, 0.93]: #000000 lands short of glaring white.\nfunction liftLightness(l) {\n return l < 0.5 ? 0.93 - l * ((0.93 - 0.5) / 0.5) : l;\n}\n/** Hue and saturation survive; only lightness moves. Non-hex colors pass through. */\nexport function webPopupShiftColor(color, direction) {\n const rgb = parseHex(color);\n if (!rgb) return color;\n const [h, s, l] = rgbToHsl(rgb);\n return toHex(hslToRgb([h, s, direction === 'fold' ? foldLightness(l) : liftLightness(l)]));\n}\n/** `ratio` of `over` blended into `base`; either color non-hex = `base` unchanged. */\nexport function webPopupMixColor(base, over, ratio) {\n const a = parseHex(base);\n const b = parseHex(over);\n if (!a || !b) return base;\n return toHex(a.map((v, i) => v + (b[i] - v) * ratio));\n}\n/** `color` at `alpha` as rgba(); a non-hex color renders full-strength instead of being guessed at. */\nexport function webPopupColorAlpha(color, alpha) {\n const rgb = parseHex(color);\n if (!rgb || alpha >= 1) return color;\n const [r, g, b] = rgb;\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\nfunction isLightColor(color) {\n const rgb = parseHex(color);\n if (!rgb) return false;\n // Perceived luminance, not HSL lightness: #FFFF00 and #0000FF share l = 0.5.\n const [r, g, b] = rgb;\n return (0.299 * r + 0.587 * g + 0.114 * b) / 255 > 0.6;\n}\n// The dark counterpart of a light palette: text lifts, surfaces fold, the\n// accent and the over-image inverse color stay as authored.\nexport function autoDarkWebPopupColors(light) {\n return {\n background: webPopupShiftColor(light.background, 'fold'),\n accent: light.accent,\n text: webPopupShiftColor(light.text, 'lift'),\n textSecondary: webPopupShiftColor(light.textSecondary, 'lift'),\n textInverse: light.textInverse\n };\n}\n// Light keeps the values the popup shipped with before dark mode existed\n// (white cards, grey border, white label) — enabling dark must not restyle it.\nfunction derivedColors(colors, scheme) {\n if (scheme === 'light') {\n return {\n surface: WEB_POPUP_DEFAULT_COLORS.background,\n surfaceText: WEB_POPUP_TEXT_COLOR,\n border: WEB_POPUP_FORM_INPUT_BORDER,\n onAccent: WEB_POPUP_ON_ACCENT_COLOR,\n error: WEB_POPUP_FORM_ERROR_COLOR,\n chromeIcon: WEB_POPUP_TEXT_SECONDARY_COLOR\n };\n }\n return {\n surface: webPopupMixColor(colors.background, colors.text, 0.08),\n surfaceText: colors.text,\n border: webPopupMixColor(colors.background, colors.text, 0.24),\n onAccent: isLightColor(colors.accent) ? WEB_POPUP_TEXT_COLOR : WEB_POPUP_ON_ACCENT_COLOR,\n error: WEB_POPUP_FORM_ERROR_COLOR_DARK,\n chromeIcon: colors.textSecondary\n };\n}\n/** The dark palette a popup renders with: authored roles over the autogenerated ones. */\nexport function webPopupDarkColors(light, dark) {\n return {\n ...autoDarkWebPopupColors(light),\n ...(dark?.colors ?? {})\n };\n}\n/** True when the popup opts into dark mode at all — the host's cue to watch the media query. */\nexport function webPopupDarkEnabled(chrome) {\n return chrome.dark?.enabled === true;\n}\n/** The scheme a popup actually draws with: 'dark' only when it opts in. */\nexport function webPopupEffectiveScheme(chrome, scheme = 'light') {\n return scheme === 'dark' && webPopupDarkEnabled(chrome) ? 'dark' : 'light';\n}\n// Every color a renderer needs, for the scheme actually drawn. Asking for\n// 'dark' on a popup without dark mode returns the light palette.\nexport function resolveWebPopupColors(chrome, scheme = 'light') {\n const effective = webPopupEffectiveScheme(chrome, scheme);\n const colors = effective === 'dark' ? webPopupDarkColors(chrome.colors, chrome.dark) : chrome.colors;\n return {\n ...colors,\n scheme: effective,\n ...derivedColors(colors, effective)\n };\n}\n/** The url drawn for `scheme`; a dark source only exists when authored. */\nexport function webPopupImageSrc(image, scheme = 'light') {\n return scheme === 'dark' && image.srcDark ? image.srcDark : image.src;\n}\n/** The page dim and box shadow for the scheme actually drawn; the light ones\n * stand in wherever the dark palette authored no override. */\nexport function resolveWebPopupBoxChrome(chrome, scheme = 'light') {\n if (webPopupEffectiveScheme(chrome, scheme) === 'light') {\n return {\n overlay: chrome.overlay,\n boxShadow: chrome.boxShadow\n };\n }\n return {\n overlay: chrome.dark?.overlay ?? chrome.overlay,\n boxShadow: chrome.dark?.boxShadow ?? chrome.boxShadow\n };\n}","// Countdown math: `endTime` is a LOCAL WALL CLOCK in `timezone` (empty = UTC),\n// never an instant. Pure, `now` passed in — the renderer ticks, this computes.\nconst WALL_CLOCK = /^(\\d{4})-(\\d{2})-(\\d{2})[T ](\\d{2}):(\\d{2})(?::(\\d{2}))?$/;\n// One formatter per zone: the reader asks for the remainder once a second per\n// timer slot, and constructing an Intl.DateTimeFormat is the expensive part.\nconst zoneFormatters = new Map();\nfunction zoneFormatter(timeZone) {\n const cached = zoneFormatters.get(timeZone);\n if (cached) return cached;\n try {\n const formatter = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hour12: false,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n });\n zoneFormatters.set(timeZone, formatter);\n return formatter;\n } catch {\n // An unknown/unsupported IANA name — the engine can't place a wall clock in it.\n return null;\n }\n}\n/** Can this engine compute offsets in the zone? Empty = the contract's UTC, so supported. */\nexport function webPopupTimeZoneSupported(timezone) {\n return !timezone || zoneFormatter(timezone) !== null;\n}\n// The zone's offset from UTC at an instant, in ms: render local parts, read\n// them back as if they were UTC, take the difference.\nfunction zoneOffsetMs(instantMs, formatter) {\n const parts = formatter.formatToParts(new Date(instantMs));\n const read = type => Number(parts.find(part => part.type === type)?.value ?? '0');\n // hour12: false still renders midnight as '24' in some engines.\n const asUtc = Date.UTC(read('year'), read('month') - 1, read('day'), read('hour') % 24, read('minute'), read('second'));\n return asUtc - instantMs;\n}\nconst DAY_MS = 86400000;\n// Every offset that can apply to a wall clock this close to a DST switch: the\n// day before, the naive instant, the day after.\nfunction candidateOffsets(wallAsUtc, formatter) {\n const offsets = [];\n for (const probe of [wallAsUtc - DAY_MS, wallAsUtc, wallAsUtc + DAY_MS]) {\n const offset = zoneOffsetMs(probe, formatter);\n if (!offsets.includes(offset)) offsets.push(offset);\n }\n return offsets;\n}\n// The reader asks for the remainder once a second per slot, and the deadline\n// never moves; a handful of entries, cleared wholesale if a document is absurd.\nconst deadlines = new Map();\n/** The instant (epoch ms) a wall clock names in a zone, or null when this engine can't place it. */\nexport function webPopupWallClockMs(endTime, timezone) {\n const cacheKey = `${endTime}|${timezone}`;\n const cached = deadlines.get(cacheKey);\n if (cached !== undefined) return cached;\n const resolved = resolveWallClockMs(endTime, timezone);\n if (deadlines.size > 100) deadlines.clear();\n deadlines.set(cacheKey, resolved);\n return resolved;\n}\nfunction resolveWallClockMs(endTime, timezone) {\n const match = WALL_CLOCK.exec((endTime || '').trim());\n if (!match) return null;\n const [, year, month, day, hour, minute, rawSecond] = match.map(Number);\n // The seconds group is optional — an absent one reads as NaN, not 0.\n const second = Number.isNaN(rawSecond) ? 0 : rawSecond;\n if (month < 1 || month > 12 || day < 1 || day > 31) return null;\n if (hour > 23 || minute > 59 || second > 59) return null;\n const wallAsUtc = Date.UTC(year, month - 1, day, hour, minute, second);\n // Date.UTC rolls impossible days over (Feb 30 → Mar 2); reject instead.\n const rolled = new Date(wallAsUtc);\n if (rolled.getUTCMonth() !== month - 1 || rolled.getUTCDate() !== day) return null;\n if (!timezone) return wallAsUtc;\n const formatter = zoneFormatter(timezone);\n if (!formatter) return null;\n // One rule for every zone, whatever the sign of its offset: an offset counts\n // when the instant it produces reads back as the wall clock asked for.\n const offsets = candidateOffsets(wallAsUtc, formatter);\n const instants = offsets.filter(offset => zoneOffsetMs(wallAsUtc - offset, formatter) === offset).map(offset => wallAsUtc - offset);\n // An ambiguous wall clock (fall back) takes the FIRST of its two instants.\n if (instants.length > 0) return Math.min(...instants);\n // None reads back: the wall clock is inside a spring-forward gap. The pre-gap\n // offset is the smaller one, so this rolls forward to just past the gap.\n return wallAsUtc - Math.min(...offsets);\n}\n/** What's left at `nowMs`, by unit; a passed OR uncomputable deadline reads as all zeros. */\nexport function webPopupTimerRemaining(endTime, timezone, nowMs) {\n const deadline = webPopupWallClockMs(endTime, timezone);\n const total = deadline === null ? 0 : Math.max(0, deadline - nowMs);\n const seconds = Math.floor(total / 1000);\n return {\n total,\n days: Math.floor(seconds / 86400),\n hours: Math.floor(seconds / 3600) % 24,\n minutes: Math.floor(seconds / 60) % 60,\n seconds: seconds % 60\n };\n}\n// Unit labels by ISO 639-1 code, the editor's 14 languages; anything else = English.\n// NOTE: not written by native speakers — worth a review before customers see them.\nconst TIMER_LABELS = {\n en: {\n days: 'Days',\n hours: 'Hours',\n minutes: 'Minutes',\n seconds: 'Seconds'\n },\n ru: {\n days: 'Дни',\n hours: 'Часы',\n minutes: 'Минуты',\n seconds: 'Секунды'\n },\n de: {\n days: 'Tage',\n hours: 'Stunden',\n minutes: 'Minuten',\n seconds: 'Sekunden'\n },\n es: {\n days: 'Días',\n hours: 'Horas',\n minutes: 'Minutos',\n seconds: 'Segundos'\n },\n fr: {\n days: 'Jours',\n hours: 'Heures',\n minutes: 'Minutes',\n seconds: 'Secondes'\n },\n pt: {\n days: 'Dias',\n hours: 'Horas',\n minutes: 'Minutos',\n seconds: 'Segundos'\n },\n ja: {\n days: '日',\n hours: '時間',\n minutes: '分',\n seconds: '秒'\n },\n ko: {\n days: '일',\n hours: '시간',\n minutes: '분',\n seconds: '초'\n },\n zh: {\n days: '天',\n hours: '小时',\n minutes: '分',\n seconds: '秒'\n },\n hi: {\n days: 'दिन',\n hours: 'घंटे',\n minutes: 'मिनट',\n seconds: 'सेकंड'\n },\n bn: {\n days: 'দিন',\n hours: 'ঘণ্টা',\n minutes: 'মিনিট',\n seconds: 'সেকেন্ড'\n },\n ar: {\n days: 'أيام',\n hours: 'ساعات',\n minutes: 'دقائق',\n seconds: 'ثوان'\n },\n he: {\n days: 'ימים',\n hours: 'שעות',\n minutes: 'דקות',\n seconds: 'שניות'\n },\n th: {\n days: 'วัน',\n hours: 'ชั่วโมง',\n minutes: 'นาที',\n seconds: 'วินาที'\n }\n};\n/** The unit labels for a language code; empty/unknown = English. */\nexport function webPopupTimerLabels(language) {\n return TIMER_LABELS[language] ?? TIMER_LABELS.en;\n}","const RTL_LETTER = /[\\p{Script=Arabic}\\p{Script=Hebrew}\\p{Script=Syriac}\\p{Script=Thaana}\\p{Script=Nko}\\p{Script=Samaritan}\\p{Script=Mandaic}\\p{Script=Adlam}\\p{Script=Hanifi_Rohingya}\\p{Script=Mende_Kikakui}\\p{Script=Yezidi}]/u;\nconst LETTER = /\\p{L}/u;\nconst NOT_COPY = /<[^>]*>|\\{\\{[\\s\\S]*?\\}\\}|\\{%[\\s\\S]*?%\\}/g;\n/** 'rtl' when most letters of the copy read right to left; markup and Liquid do not vote. */\nexport function detectTextDirection(...texts) {\n let rtl = 0;\n let ltr = 0;\n for (const char of texts.join(' ').replace(NOT_COPY, '')) {\n if (RTL_LETTER.test(char)) {\n rtl += 1;\n } else if (LETTER.test(char)) {\n ltr += 1;\n }\n }\n return rtl > ltr ? 'rtl' : 'ltr';\n}","import { SAFE_URL_PROTOCOL, WEB_POPUP_CHOICE_DEFAULTS, WEB_POPUP_CONSENT_DEFAULTS, WEB_POPUP_DEFAULT_COLORS, WEB_POPUP_EMAIL_INPUT_DEFAULTS, WEB_POPUP_FORM_DEFAULTS, WEB_POPUP_MAX_CHOICE_OPTIONS, WEB_POPUP_PRODUCTS_DEFAULTS, WEB_POPUP_PRODUCTS_MAX_LIMIT, WEB_POPUP_RATING_DEFAULTS, WEB_POPUP_SUBMIT_DEFAULTS, WEB_POPUP_TAG_INPUT_DEFAULTS, WEB_POPUP_VERSION, WEB_POPUP_ARROW_GUTTER_DEFAULT, WEB_POPUP_ARROW_GUTTER_MAX, WEB_POPUP_ARROW_GUTTER_MIN, WEB_POPUP_REVEAL_STAGGER_DEFAULT } from './constants';\nimport { WEB_POPUP_GLYPH_NAMES, WEB_POPUP_GLYPH_SIZES } from './glyphs';\nimport { normalizeWebPopupLayout, substituteWebPopupLayoutValues, WEB_POPUP_VALUE_KEY_PATTERN } from './layout';\nimport { autoDarkWebPopupColors } from './palette';\nimport { webPopupTimerLabels, webPopupTimeZoneSupported, webPopupWallClockMs } from './timer';\nimport { detectTextDirection } from '../shared/textDirection';\n// Sanitize a user-entered button URL before it lands in an href: https/http/\n// mailto/tel and page-relative links only.\nexport function safeUrl(url) {\n const trimmed = (url || '').trim();\n if (!trimmed) return undefined;\n if (trimmed.startsWith('#') || trimmed.startsWith('/') || trimmed.startsWith('?')) return trimmed;\n if (SAFE_URL_PROTOCOL.test(trimmed)) return trimmed;\n return undefined;\n}\n/**\n * The target/rel pair a popup link renders with: only an exact '_self' opts\n * out of the default new tab (and of its noreferrer, which same-tab\n * navigation doesn't need). One rule for both link kinds — the reader's\n * button anchors and the sanitizer's inline text links.\n */\nexport function webPopupLinkTargetAttrs(target) {\n return target === '_self' ? {\n target: '_self'\n } : {\n target: '_blank',\n rel: 'noreferrer'\n };\n}\n/**\n * Carries out a subscribe button's setting for the visitor's answer.\n * A new tab opens with noopener, so `window.open` returns null and a blocked tab goes unnoticed.\n */\nexport function applyWebPopupSubscribeOutcome(action, result, logger) {\n const outcome = result === 'granted' ? action.onGranted : action.onDenied;\n if (outcome?.type === 'href') openWebPopupSubscribeLink(outcome, logger);\n if (outcome?.type === 'page') return {\n page: outcome.page\n };\n // Granted always closes, as before the setting; denied closes only when set to.\n if (result === 'granted' || outcome?.type === 'close') return 'close';\n return 'stay';\n}\nfunction openWebPopupSubscribeLink(outcome, logger) {\n const href = typeof outcome.url === 'string' ? safeUrl(outcome.url) : undefined;\n if (!href) {\n logger?.warn('Subscribe button: the link to open after the answer is empty or unsafe, it was not opened');\n return;\n }\n if (outcome.target === '_self') {\n window.location.assign(href);\n return;\n }\n window.open(href, '_blank', 'noopener,noreferrer');\n}\nconst SANITIZE_ALLOWED_TAGS = new Set(['STRONG', 'B', 'EM', 'I', 'U', 'BR', 'A']);\nfunction copySanitized(from, to, doc) {\n for (const child of Array.from(from.childNodes)) {\n if (child.nodeType === 3 /* text */) {\n to.appendChild(doc.createTextNode(child.textContent ?? ''));\n continue;\n }\n if (child.nodeType !== 1 /* element */) continue;\n const el = child;\n // Unknown tags are unwrapped — their children survive as plain content.\n if (!SANITIZE_ALLOWED_TAGS.has(el.tagName)) {\n copySanitized(el, to, doc);\n continue;\n }\n const clean = doc.createElement(el.tagName.toLowerCase());\n if (el.tagName === 'A') {\n const href = safeUrl(el.getAttribute('href') ?? undefined);\n if (href) clean.setAttribute('href', href);\n const {\n target,\n rel\n } = webPopupLinkTargetAttrs(el.getAttribute('target'));\n clean.setAttribute('target', target);\n if (rel) clean.setAttribute('rel', rel);\n }\n to.appendChild(clean);\n copySanitized(el, clean, doc);\n }\n}\n/**\n * Sanitize a text slot's html before it's injected into the page. The editor\n * only ever writes inline formatting, but the json travels through a public\n * API and renders on customers' sites — so on render only the inline tags\n * survive (anything else is unwrapped to its text), every attribute is\n * dropped, and links keep only a safeUrl-approved href plus their tab choice\n * (target=\"_self\" stays; everything else opens in a new tab).\n */\nexport function sanitizeWebPopupHtml(html) {\n // No '<' → no elements can form; entities in plain text are already-valid\n // html and pass through untouched.\n if (!html.includes('<')) return html;\n const parsed = new DOMParser().parseFromString(html, 'text/html');\n const out = parsed.createElement('div');\n copySanitized(parsed.body, out, parsed);\n return out.innerHTML;\n}\nfunction colorString(value) {\n return typeof value === 'string' && value ? value : undefined;\n}\n/**\n * The popup palette from API-writable params: `colors` entries when present,\n * the legacy top-level background/accent underneath, palette defaults for the\n * rest — always a complete WebPopupColors.\n */\nexport function normalizeWebPopupColors(params) {\n const colors = typeof params.colors === 'object' && params.colors !== null ? params.colors : {};\n return {\n background: colorString(colors.background) ?? colorString(params.background) ?? WEB_POPUP_DEFAULT_COLORS.background,\n accent: colorString(colors.accent) ?? colorString(params.accent) ?? WEB_POPUP_DEFAULT_COLORS.accent,\n text: colorString(colors.text) ?? WEB_POPUP_DEFAULT_COLORS.text,\n textSecondary: colorString(colors.textSecondary) ?? WEB_POPUP_DEFAULT_COLORS.textSecondary,\n textInverse: colorString(colors.textInverse) ?? WEB_POPUP_DEFAULT_COLORS.textInverse\n };\n}\n// A page dim from API-writable json: both fields or nothing, opacity clamped.\nfunction normalizeOverlay(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const overlay = raw;\n const color = colorString(overlay.color);\n if (!color) return undefined;\n const opacity = typeof overlay.opacity === 'number' && Number.isFinite(overlay.opacity) ? Math.max(0, Math.min(1, overlay.opacity)) : 1;\n return {\n color,\n opacity\n };\n}\n// Authored dark entries over the ones autogenerated from the light palette.\n// Absent `dark` = no dark mode; an authored palette switched off is not that.\nexport function normalizeWebPopupDark(params, light) {\n const raw = params.dark;\n if (typeof raw !== 'object' || raw === null) return undefined;\n const dark = raw;\n const authored = typeof dark.colors === 'object' && dark.colors !== null ? dark.colors : {};\n const auto = autoDarkWebPopupColors(light);\n const overlay = normalizeOverlay(dark.overlay);\n return {\n enabled: dark.enabled === true,\n colors: {\n background: colorString(authored.background) ?? auto.background,\n accent: colorString(authored.accent) ?? auto.accent,\n text: colorString(authored.text) ?? auto.text,\n textSecondary: colorString(authored.textSecondary) ?? auto.textSecondary,\n textInverse: colorString(authored.textInverse) ?? auto.textInverse\n },\n ...(overlay ? {\n overlay\n } : {}),\n ...(colorString(dark.boxShadow) ? {\n boxShadow: dark.boxShadow\n } : {})\n };\n}\n// Parse stored PopupFormContent.json into the popup model. Returns null for\n// anything that isn't a version-2 popup with at least one page — including\n// the retired version-1 flat-layout format and pre-engine content with no\n// `version` field at all, which callers should treat as broken. The palette\n// comes out complete: colors entries → legacy top-level background/accent →\n// defaults.\nexport function parseWebPopupJson(json) {\n let raw;\n try {\n raw = JSON.parse(json);\n } catch {\n return null;\n }\n if (typeof raw !== 'object' || raw === null) return null;\n const candidate = raw;\n if (candidate.version !== WEB_POPUP_VERSION) return null;\n const params = candidate.params;\n if (typeof params !== 'object' || params === null) return null;\n if (!Array.isArray(params.pages) || params.pages.length === 0) return null;\n const colors = normalizeWebPopupColors(params);\n const dark = normalizeWebPopupDark(params, colors);\n return {\n version: WEB_POPUP_VERSION,\n params: {\n ...params,\n colors,\n ...(dark ? {\n dark\n } : {})\n }\n };\n}\n/** The editor's save path: model → PopupFormContent.json string. */\nexport function stringifyWebPopup(params) {\n const compat = {\n ...params,\n background: params.colors.background,\n accent: params.colors.accent\n };\n const payload = {\n version: WEB_POPUP_VERSION,\n params: compat\n };\n return JSON.stringify(payload);\n}\nconst IMAGE_FITS = ['cover', 'contain'];\nconst MAX_IMAGE_BLUR = 100;\n// Bomb protection for the page content, mirroring the layout tree's\n// depth/node caps: the tree allows up to ~100 Content nodes and several may\n// reference the same zone, so unbounded zones/slots would amplify into\n// thousands of sanitize+render passes on the customer's page.\nconst MAX_IMAGES = 20;\nconst MAX_ZONES = 20;\nconst MAX_ZONE_SLOTS = 50;\n// A media param's video, or undefined when it has none / an unusable url —\n// then the param stays a plain image and the poster is all that renders.\nfunction normalizeVideo(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const video = raw;\n const src = safeUrl(typeof video.src === 'string' ? video.src : undefined);\n if (!src) return undefined;\n return {\n src,\n ...(video.controls === true ? {\n controls: true\n } : {}),\n ...(video.loop === false ? {\n loop: false\n } : {})\n };\n}\n// The images come from API-writable json — keep only well-formed entries,\n// with the presentation props (fit/blur) validated like the layout tree's.\nfunction normalizeImages(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const img of raw) {\n if (out.length >= MAX_IMAGES) break;\n if (typeof img !== 'object' || img === null) continue;\n if (typeof img.key !== 'string' || !img.key) continue;\n if (typeof img.src !== 'string') continue;\n const video = normalizeVideo(img.video);\n out.push({\n key: img.key,\n label: typeof img.label === 'string' ? img.label : '',\n src: img.src,\n ...(typeof img.srcDark === 'string' && img.srcDark ? {\n srcDark: img.srcDark\n } : {}),\n ...(video ? {\n video\n } : {}),\n ...(typeof img.mediaId === 'string' && img.mediaId ? {\n mediaId: img.mediaId\n } : {}),\n ...(typeof img.mediaIdDark === 'string' && img.mediaIdDark ? {\n mediaIdDark: img.mediaIdDark\n } : {}),\n ...(IMAGE_FITS.includes(img.fit) ? {\n fit: img.fit\n } : {}),\n ...(typeof img.blur === 'number' && Number.isFinite(img.blur) && img.blur > 0 ? {\n blur: Math.min(img.blur, MAX_IMAGE_BLUR)\n } : {}),\n ...(typeof img.dim === 'number' && Number.isFinite(img.dim) && img.dim > 0 ? {\n dim: Math.min(img.dim, 1)\n } : {})\n });\n }\n return out;\n}\nconst MAX_VALUES = 20;\nconst MAX_VALUE_LENGTH = 64;\nconst MAX_SELECT_OPTIONS = 20;\nconst LENGTH_CONTROL_UNITS = ['px', '%', 'em', 'rem', 'fr'];\nfunction finiteNumber(value) {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n// Per-unit { min?, max? } overrides for a length control, keyed by a\n// whitelisted unit. Non-object input, unknown unit keys and non-finite bounds\n// are dropped; an all-empty map returns undefined so the field is omitted.\nfunction normalizeControlRanges(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const out = {};\n for (const unit of LENGTH_CONTROL_UNITS) {\n const entry = raw[unit];\n if (typeof entry !== 'object' || entry === null) continue;\n const min = finiteNumber(entry.min);\n const max = finiteNumber(entry.max);\n if (min === undefined && max === undefined) continue;\n out[unit] = {\n ...(min !== undefined ? {\n min\n } : {}),\n ...(max !== undefined ? {\n max\n } : {})\n };\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n// The control is editor metadata from API-writable json: enum-whitelisted\n// kind, clamped numbers, capped options. Anything malformed drops to\n// undefined — the editor falls back to a plain text input.\nfunction normalizeValueControl(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const control = raw;\n if (control.kind === 'text') return {\n kind: 'text'\n };\n if (control.kind === 'length' || control.kind === 'percent') {\n const min = finiteNumber(control.min);\n const max = finiteNumber(control.max);\n const units = control.kind === 'length' && Array.isArray(control.units) ? control.units.filter(u => LENGTH_CONTROL_UNITS.includes(u)) : [];\n // Per-unit min/max overrides: whitelisted unit keys, finite bounds. Any\n // malformed entry is skipped; an empty result drops the whole field.\n const ranges = control.kind === 'length' ? normalizeControlRanges(control.ranges) : undefined;\n return {\n kind: control.kind,\n ...(min !== undefined ? {\n min\n } : {}),\n ...(max !== undefined ? {\n max\n } : {}),\n ...(units.length > 0 ? {\n units\n } : {}),\n ...(ranges ? {\n ranges\n } : {})\n };\n }\n if (control.kind === 'select' && Array.isArray(control.options)) {\n const options = [];\n for (const option of control.options) {\n if (options.length >= MAX_SELECT_OPTIONS) break;\n if (typeof option !== 'object' || option === null) continue;\n if (typeof option.value !== 'string' || option.value.length > MAX_VALUE_LENGTH) continue;\n options.push({\n value: option.value,\n label: typeof option.label === 'string' ? option.label : option.value\n });\n }\n if (options.length > 0) return {\n kind: 'select',\n options\n };\n }\n return undefined;\n}\n/**\n * The page's named layout values from API-writable json: capped count,\n * whitelisted keys, short '$'-free value strings (substitution is single-pass\n * and this keeps refs from even *looking* chainable), validated controls.\n */\nexport function normalizeWebPopupValues(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const value of raw) {\n if (out.length >= MAX_VALUES) break;\n if (typeof value !== 'object' || value === null) continue;\n if (typeof value.key !== 'string' || !WEB_POPUP_VALUE_KEY_PATTERN.test(value.key)) continue;\n if (typeof value.value !== 'string' || value.value.length > MAX_VALUE_LENGTH || value.value.includes('$')) continue;\n if (out.some(v => v.key === value.key)) continue;\n const control = normalizeValueControl(value.control);\n out.push({\n key: value.key,\n label: typeof value.label === 'string' ? value.label : '',\n value: value.value,\n ...(control ? {\n control\n } : {})\n });\n }\n return out;\n}\n/** The values as a substitution map (see substituteWebPopupLayoutValues). */\nexport function webPopupValuesMap(values) {\n return Object.fromEntries(values.map(v => [v.key, v.value]));\n}\nconst FORM_FIELD_KINDS = ['email', 'firstName', 'lastName', 'phone', 'custom'];\nconst BUTTON_VARIANTS = ['primary', 'secondary'];\nconst MAX_FORM_FIELDS = 10;\n// A form slot's fields from API-writable json: capped, whitelisted kinds,\n// deduped keys. The submit contract needs an email — when none survives, one\n// is injected up front (the slot stays renderable/editable rather than being\n// dropped: the editor canvas resolves through this same pipeline). Email\n// fields are always required — the payload can't form without a value.\nfunction normalizeFormFields(raw) {\n const out = [];\n if (Array.isArray(raw)) {\n for (const field of raw) {\n if (out.length >= MAX_FORM_FIELDS) break;\n if (typeof field !== 'object' || field === null) continue;\n if (typeof field.key !== 'string' || !field.key) continue;\n if (!FORM_FIELD_KINDS.includes(field.kind)) continue;\n if (out.some(f => f.key === field.key)) continue;\n out.push({\n key: field.key,\n kind: field.kind,\n label: typeof field.label === 'string' ? field.label : '',\n placeholder: typeof field.placeholder === 'string' ? field.placeholder : '',\n required: field.kind === 'email' || field.required === true,\n ...(field.kind === 'custom' && typeof field.tag === 'string' && field.tag ? {\n tag: field.tag\n } : {})\n });\n }\n }\n if (!out.some(f => f.kind === 'email')) {\n let key = 'field-email';\n while (out.some(f => f.key === key)) key = `${key}-1`;\n out.unshift({\n key,\n kind: 'email',\n label: 'Email',\n placeholder: '',\n required: true\n });\n }\n return out.slice(0, MAX_FORM_FIELDS);\n}\nconst CHOICE_CONTROLS = ['checkbox', 'chips'];\nconst PRODUCTS_STRATEGIES = ['viewed', 'bestsellers_30d', 'also_bought', 'cart'];\nfunction productsStrategy(value) {\n return PRODUCTS_STRATEGIES.includes(value) ? value : undefined;\n}\nconst PRODUCTS_LAYOUTS = ['row', 'grid'];\nconst RATING_SCALES = ['nps', 'stars', 'thumbs'];\nconst RATING_SUBMIT_MODES = ['instant', 'button'];\nconst TIMER_EXPIRE_ACTIONS = ['keep', 'hide-popup', 'page'];\nconst LANGUAGE_CODE = /^[a-z]{2}$/i;\nconst HEX_COLOR = /^#[0-9a-fA-F]{6}$/;\n// Authored strings from API-writable json land in the popup's own markup on a\n// customer's page — capped so a 100kB \"label\" can't be one.\nconst MAX_SLOT_STRING = 120;\nconst MAX_SLOT_MESSAGE = 500;\nfunction slotString(value, max = MAX_SLOT_STRING) {\n return typeof value === 'string' ? value.trim().slice(0, max) : '';\n}\n// A capped string with a fallback for when the json omits it (or sends blanks).\nfunction slotStringOr(value, fallback, max = MAX_SLOT_STRING) {\n return slotString(value, max) || fallback;\n}\n/** An ISO 639-1 code, lowercased; anything else = '' (the renderer's 'en'). */\nfunction normalizeLanguage(value) {\n const code = slotString(value, 8);\n return LANGUAGE_CODE.test(code) ? code.toLowerCase() : '';\n}\n// Capped, non-empty values, deduped, label falling back to the value. An\n// option-less slot survives, like an unbound form: the editor must still edit it.\nfunction normalizeChoiceOptions(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const option of raw) {\n if (out.length >= WEB_POPUP_MAX_CHOICE_OPTIONS) break;\n if (typeof option !== 'object' || option === null) continue;\n const value = slotString(option.value);\n if (!value) continue;\n if (out.some(existing => existing.value === value)) continue;\n const tagValue = slotString(option.tagValue);\n out.push({\n value,\n label: slotStringOr(option.label, value),\n ...(tagValue ? {\n tagValue\n } : {})\n });\n }\n return out;\n}\n// The selection bounds against the surviving option count: 0 = unbounded, and\n// a max under the min would leave the slot unsubmittable — the min wins.\nfunction normalizeChoiceBounds(slot, options) {\n const bound = value => {\n const n = finiteNumber(value);\n return n === undefined || n <= 0 ? 0 : Math.min(Math.floor(n), options);\n };\n const min = bound(slot.min);\n const max = bound(slot.max);\n return {\n min,\n max: max > 0 ? Math.max(min, max) : 0\n };\n}\n// Per-type slot validation. Text and button entries pass through UNTOUCHED\n// when well-formed (stored popups predate this check — don't rewrite them);\n// a form slot is rebuilt field by field; an unknown slot type is dropped so\n// slot types added after this engine build degrade to absence, not a crash.\nfunction normalizeSlots(raw) {\n const out = [];\n for (const slot of raw) {\n if (out.length >= MAX_ZONE_SLOTS) break;\n if (typeof slot !== 'object' || slot === null) continue;\n if (typeof slot.key !== 'string' || !slot.key) continue;\n if (slot.type === 'text') {\n if (typeof slot.html === 'string') out.push(slot);\n continue;\n }\n if (slot.type === 'button') {\n // An action-less button would crash the renderer on the action switch.\n if (typeof slot.action === 'object' && slot.action !== null && typeof slot.action.type === 'string') {\n out.push(slot);\n }\n continue;\n }\n if (slot.type === 'timer') {\n // An unsupported zone name degrades to the contract's UTC rather than\n // dropping the countdown.\n const zone = slotString(slot.timezone, 64);\n const timezone = webPopupTimeZoneSupported(zone) ? zone : '';\n const endTime = slotString(slot.endTime, 32);\n // No computable deadline = nothing to count down to.\n if (webPopupWallClockMs(endTime, timezone) === null) continue;\n const expirePage = slotString(slot.expirePage);\n const onExpire = TIMER_EXPIRE_ACTIONS.includes(slot.onExpire) ? slot.onExpire : 'keep';\n // 'page' without a target page is 'keep' — the renderer never has to\n // guess where a pageless jump should land.\n const expires = onExpire === 'page' && !expirePage ? 'keep' : onExpire;\n out.push({\n type: 'timer',\n key: slot.key,\n endTime,\n timezone,\n language: normalizeLanguage(slot.language),\n showLabels: slot.showLabels !== false,\n onExpire: expires,\n ...(expires === 'page' ? {\n expirePage\n } : {})\n });\n continue;\n }\n if (slot.type === 'choice') {\n const options = normalizeChoiceOptions(slot.options);\n const {\n min,\n max\n } = normalizeChoiceBounds(slot, options.length);\n out.push({\n type: 'choice',\n key: slot.key,\n control: CHOICE_CONTROLS.includes(slot.control) ? slot.control : 'checkbox',\n tagName: slotString(slot.tagName),\n options,\n min,\n max,\n submitLabel: slotStringOr(slot.submitLabel, WEB_POPUP_CHOICE_DEFAULTS.submitLabel),\n submitVariant: BUTTON_VARIANTS.includes(slot.submitVariant) ? slot.submitVariant : 'primary',\n successMessage: slotStringOr(slot.successMessage, WEB_POPUP_CHOICE_DEFAULTS.successMessage, MAX_SLOT_MESSAGE)\n });\n continue;\n }\n if (slot.type === 'rating') {\n const labels = typeof slot.labels === 'object' && slot.labels !== null ? slot.labels : {};\n out.push({\n type: 'rating',\n key: slot.key,\n // A malformed scale renders as stars: five buttons read the same in\n // every language, which an 0..10 row does not.\n scale: RATING_SCALES.includes(slot.scale) ? slot.scale : 'stars',\n labels: {\n low: slotString(labels.low),\n high: slotString(labels.high)\n },\n submitMode: RATING_SUBMIT_MODES.includes(slot.submitMode) ? slot.submitMode : 'instant',\n submitLabel: slotStringOr(slot.submitLabel, WEB_POPUP_RATING_DEFAULTS.submitLabel),\n eventName: slotString(slot.eventName),\n successMessage: slotStringOr(slot.successMessage, WEB_POPUP_RATING_DEFAULTS.successMessage, MAX_SLOT_MESSAGE)\n });\n continue;\n }\n if (slot.type === 'glyph') {\n // An unknown icon name has no geometry to draw — dropped, exactly like\n // an unknown slot type.\n if (!WEB_POPUP_GLYPH_NAMES.includes(slot.name)) continue;\n out.push({\n type: 'glyph',\n key: slot.key,\n name: slot.name,\n size: WEB_POPUP_GLYPH_SIZES.includes(slot.size) ? slot.size : WEB_POPUP_GLYPH_SIZES[0],\n color: typeof slot.color === 'string' && HEX_COLOR.test(slot.color) ? slot.color : ''\n });\n continue;\n }\n if (slot.type === 'products') {\n const fields = typeof slot.fields === 'object' && slot.fields !== null ? slot.fields : {};\n const limit = Number.isFinite(slot.limit) ? Math.round(slot.limit) : WEB_POPUP_PRODUCTS_DEFAULTS.limit;\n // A strategy this build doesn't know would ask the feed for nothing — bestsellers always answer.\n const strategy = productsStrategy(slot.strategy) ?? 'bestsellers_30d';\n // The same as the strategy = no fallback: a second identical request finds nothing new.\n const fallback = productsStrategy(slot.fallbackStrategy);\n out.push({\n type: 'products',\n key: slot.key,\n strategy,\n ...(fallback && fallback !== strategy ? {\n fallbackStrategy: fallback\n } : {}),\n limit: Math.min(Math.max(limit, 1), WEB_POPUP_PRODUCTS_MAX_LIMIT),\n layout: PRODUCTS_LAYOUTS.includes(slot.layout) ? slot.layout : 'row',\n fields: {\n title: fields.title !== false,\n price: fields.price !== false,\n image: fields.image !== false,\n cta: fields.cta !== false\n },\n ctaText: slotString(slot.ctaText),\n hideWhenEmpty: slot.hideWhenEmpty === true\n });\n continue;\n }\n if (slot.type === 'email-input') {\n out.push({\n type: 'email-input',\n key: slot.key,\n label: slotString(slot.label),\n placeholder: slotString(slot.placeholder),\n invalidMessage: slotStringOr(slot.invalidMessage, WEB_POPUP_EMAIL_INPUT_DEFAULTS.invalidMessage),\n requiredMessage: slotStringOr(slot.requiredMessage, WEB_POPUP_EMAIL_INPUT_DEFAULTS.requiredMessage)\n });\n continue;\n }\n if (slot.type === 'tag-input') {\n out.push({\n type: 'tag-input',\n key: slot.key,\n tagName: slotString(slot.tagName),\n label: slotString(slot.label),\n placeholder: slotString(slot.placeholder),\n required: slot.required === true,\n requiredMessage: slotStringOr(slot.requiredMessage, WEB_POPUP_TAG_INPUT_DEFAULTS.requiredMessage)\n });\n continue;\n }\n if (slot.type === 'consent') {\n out.push({\n type: 'consent',\n key: slot.key,\n checkboxLabel: slotString(slot.checkboxLabel, MAX_SLOT_MESSAGE),\n linkLabel: slotString(slot.linkLabel),\n url: slotString(slot.url, MAX_SLOT_MESSAGE),\n requiredMessage: slotStringOr(slot.requiredMessage, WEB_POPUP_CONSENT_DEFAULTS.requiredMessage)\n });\n continue;\n }\n if (slot.type === 'submit') {\n out.push({\n type: 'submit',\n key: slot.key,\n variant: BUTTON_VARIANTS.includes(slot.variant) ? slot.variant : 'primary',\n label: slotStringOr(slot.label, WEB_POPUP_SUBMIT_DEFAULTS.label),\n errorMessage: slotStringOr(slot.errorMessage, WEB_POPUP_SUBMIT_DEFAULTS.errorMessage, MAX_SLOT_MESSAGE)\n });\n continue;\n }\n if (slot.type === 'email-subscription-form') {\n out.push({\n type: 'email-subscription-form',\n key: slot.key,\n formCode: typeof slot.formCode === 'string' ? slot.formCode : '',\n fields: normalizeFormFields(slot.fields),\n submitLabel: typeof slot.submitLabel === 'string' && slot.submitLabel ? slot.submitLabel : WEB_POPUP_FORM_DEFAULTS.submitLabel,\n submitVariant: BUTTON_VARIANTS.includes(slot.submitVariant) ? slot.submitVariant : 'primary',\n ...(typeof slot.privacy === 'object' && slot.privacy !== null && typeof slot.privacy.checkboxLabel === 'string' ? {\n privacy: {\n checkboxLabel: slot.privacy.checkboxLabel,\n url: typeof slot.privacy.url === 'string' ? slot.privacy.url : '',\n linkLabel: typeof slot.privacy.linkLabel === 'string' ? slot.privacy.linkLabel : ''\n }\n } : {}),\n successMessage: typeof slot.successMessage === 'string' && slot.successMessage ? slot.successMessage : WEB_POPUP_FORM_DEFAULTS.successMessage,\n confirmEmailMessage: typeof slot.confirmEmailMessage === 'string' && slot.confirmEmailMessage ? slot.confirmEmailMessage : WEB_POPUP_FORM_DEFAULTS.confirmEmailMessage\n });\n }\n // Unknown slot type → dropped.\n }\n return out;\n}\n// The zones come from API-writable json — keep only well-formed entries\n// (capped, see above) so the renderer can trust the shape.\nfunction normalizeContents(raw) {\n if (!Array.isArray(raw)) return [];\n const out = [];\n for (const zone of raw) {\n if (out.length >= MAX_ZONES) break;\n if (typeof zone !== 'object' || zone === null) continue;\n if (typeof zone.key !== 'string' || !zone.key) continue;\n if (!Array.isArray(zone.slots)) continue;\n out.push({\n key: zone.key,\n label: typeof zone.label === 'string' ? zone.label : '',\n slots: normalizeSlots(zone.slots)\n });\n }\n return out;\n}\n/**\n * Every subscription form code the popup's form slots reference (unique,\n * empty codes skipped) — what a host records view stats for. Reads the RAW\n * params (tolerant of malformed slots), so it works on parsed-but-unresolved\n * json.\n */\nexport function collectWebPopupFormCodes(params) {\n const out = new Set();\n for (const page of params.pages) {\n if (!Array.isArray(page?.contents)) continue;\n for (const zone of page.contents) {\n if (!Array.isArray(zone?.slots)) continue;\n for (const slot of zone.slots) {\n if (typeof slot !== 'object' || slot === null) continue;\n if (slot.type !== 'email-subscription-form') continue;\n if (typeof slot.formCode === 'string' && slot.formCode) out.add(slot.formCode);\n }\n }\n }\n return [...out];\n}\n/** Every products slot of the popup, normalized: the host's pre-show question for `hideWhenEmpty`. */\nexport function collectWebPopupProductSlots(params) {\n const out = [];\n for (const page of params.pages) {\n if (!Array.isArray(page?.contents)) continue;\n for (const zone of page.contents) {\n if (!Array.isArray(zone?.slots)) continue;\n for (const slot of normalizeSlots(zone.slots)) {\n if (slot.type === 'products') out.push(slot);\n }\n }\n }\n return out;\n}\n// Has a 'hide-popup' countdown run out? The HOST asks before showing, at SHOW\n// time; any page counts, and a malformed timer reads as 'not expired'.\nexport function webPopupExpired(params, nowMs) {\n for (const page of params.pages) {\n if (!Array.isArray(page?.contents)) continue;\n for (const zone of page.contents) {\n if (!Array.isArray(zone?.slots)) continue;\n for (const slot of zone.slots) {\n if (typeof slot !== 'object' || slot === null) continue;\n if (slot.type !== 'timer' || slot.onExpire !== 'hide-popup') continue;\n if (typeof slot.endTime !== 'string') continue;\n const timezone = typeof slot.timezone === 'string' ? slot.timezone : '';\n const deadline = webPopupWallClockMs(slot.endTime, timezone);\n if (deadline !== null && deadline <= nowMs) return true;\n }\n }\n }\n return false;\n}\n/**\n * The popup box-size ceiling px, mirroring the layout tree's px clamp: the\n * json is API-writable and the size lands as inline style on the customer's\n * page. The editor clamps its Width/Height inputs to it too.\n */\nexport const WEB_POPUP_MAX_SIZE_PX = 2000;\nfunction validSize(value) {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.min(value, WEB_POPUP_MAX_SIZE_PX) : undefined;\n}\nexport function resolveWebPopupPageSize(own, shared, axis) {\n if (own === null) return undefined;\n let resolved;\n if (own === 'stretch') resolved = 'stretch';else resolved = validSize(own) ?? (shared === 'stretch' ? 'stretch' : validSize(shared));\n return axis === 'width' && resolved === 'stretch' ? undefined : resolved;\n}\n/**\n * The renderable pages: each page carries its own embedded layout tree — no\n * kind catalog at runtime. The page's named values are substituted into the\n * tree first ($key tokens), then the result is validated/normalized\n * (whitelisted props, unknown container types degrade to a Vertical stack) —\n * so substituted values pass the same clamps as literals; pages whose layout\n * isn't a tree at all are dropped. An empty result means the popup can't be\n * rendered. width/height come out FINAL (page override ?? chrome, validated)\n * — the renderer never falls back itself.\n */\nexport function resolveWebPopupPages(params) {\n const out = [];\n for (const page of params.pages) {\n const values = normalizeWebPopupValues(page.values);\n const layout = normalizeWebPopupLayout(substituteWebPopupLayoutValues(page.layout, webPopupValuesMap(values)));\n if (!layout) continue;\n const width = resolveWebPopupPageSize(page.width, params.width, 'width');\n const height = resolveWebPopupPageSize(page.height, params.height, 'height');\n const leftAction = normalizeWebPopupArrowAction(page.leftAction);\n const rightAction = normalizeWebPopupArrowAction(page.rightAction);\n out.push({\n key: page.key,\n layout,\n images: normalizeImages(page.images),\n contents: normalizeContents(page.contents),\n ...(width !== undefined ? {\n width\n } : {}),\n ...(height !== undefined ? {\n height\n } : {}),\n ...(page.role === 'success' ? {\n role: 'success'\n } : {}),\n ...(leftAction ? {\n leftAction\n } : {}),\n ...(rightAction ? {\n rightAction\n } : {})\n });\n }\n return out;\n}\n/** A side arrow's action from API-writable json; anything malformed = no arrow. An unsafe url is kept — the click drops it. */\nexport function normalizeWebPopupArrowAction(raw) {\n if (typeof raw !== 'object' || raw === null) return undefined;\n const action = raw;\n if (action.type === 'close') return {\n type: 'close'\n };\n if (action.type === 'page') {\n return typeof action.page === 'string' && action.page ? {\n type: 'page',\n page: action.page\n } : undefined;\n }\n if (action.type === 'href' && typeof action.url === 'string' && action.url.trim()) {\n return {\n type: 'href',\n url: action.url,\n ...(action.target === '_self' ? {\n target: '_self'\n } : {})\n };\n }\n return undefined;\n}\nfunction clampNumber(raw, min, max, fallback) {\n return typeof raw === 'number' && Number.isFinite(raw) ? Math.min(Math.max(raw, min), max) : fallback;\n}\n/** The hover-revealed controls a live popup draws around its box, validated. */\nexport function resolveWebPopupReveal(params, pages = resolveWebPopupPages(params)) {\n return {\n slideOutClose: params.slideOutClose === true,\n arrowGutter: Math.round(clampNumber(params.arrowGutter, WEB_POPUP_ARROW_GUTTER_MIN, WEB_POPUP_ARROW_GUTTER_MAX, WEB_POPUP_ARROW_GUTTER_DEFAULT)),\n revealStagger: clampNumber(params.revealStagger, 0, 1, WEB_POPUP_REVEAL_STAGGER_DEFAULT),\n hasArrows: pages.some(page => page.leftAction || page.rightAction)\n };\n}\n/** The popup's text direction: the authored `dir`, else what its copy reads as. */\nexport function webPopupDirection(params) {\n if (params.dir === 'ltr' || params.dir === 'rtl') return params.dir;\n const copy = resolveWebPopupPages(params).flatMap(page => page.contents.flatMap(zone => zone.slots.flatMap(webPopupSlotCopy)));\n return detectTextDirection(...copy);\n}\n/** The visitor-facing copy of a slot; placeholders, urls and tag names stay out of the direction vote. */\nexport function webPopupSlotCopy(slot) {\n switch (slot.type) {\n case 'text':\n return [slot.html];\n case 'button':\n return [slot.label];\n case 'email-subscription-form':\n return [...slot.fields.map(field => field.label), slot.submitLabel, slot.successMessage, slot.confirmEmailMessage, ...(slot.privacy ? [slot.privacy.checkboxLabel, slot.privacy.linkLabel] : [])];\n case 'choice':\n return [...slot.options.map(option => option.label), slot.submitLabel, slot.successMessage];\n case 'rating':\n return [slot.labels.low, slot.labels.high, slot.submitLabel, slot.successMessage];\n case 'products':\n return [slot.ctaText];\n case 'email-input':\n return [slot.label, slot.invalidMessage, slot.requiredMessage];\n case 'tag-input':\n return [slot.label, slot.requiredMessage];\n case 'consent':\n return [slot.checkboxLabel, slot.linkLabel, slot.requiredMessage];\n case 'submit':\n return [slot.label, slot.errorMessage];\n case 'timer':\n return slot.showLabels ? Object.values(webPopupTimerLabels(slot.language)) : [];\n case 'glyph':\n return [];\n }\n}\n/** CSS alignment of an authored one: 'left' is the editor's default, so it follows the direction. */\nexport function webPopupCssTextAlign(align) {\n return align === 'left' ? 'start' : align;\n}\n/** The page shown first: startPage when it exists, else the first page. */\nexport function startPageOf(params, pages) {\n return pages.find(p => p.key === params.startPage) ?? pages[0];\n}\nexport function placementMaxSize(placement) {\n return `calc(100% - ${placement.offset * 2}px)`;\n}\n/** Whether a slot is a button with the `close` action; anything malformed reads as false. */\nexport function isWebPopupCloseButton(slot) {\n const candidate = slot;\n return candidate?.type === 'button' && candidate.action?.type === 'close';\n}\nfunction zoneWithoutCloseButtons(zone) {\n if (!Array.isArray(zone?.slots)) return zone;\n return {\n ...zone,\n slots: zone.slots.filter(slot => !isWebPopupCloseButton(slot))\n };\n}\n/** A copy of one page without close-action buttons; tolerant of non-normalized json. */\nexport function webPopupPageWithoutCloseButtons(page) {\n if (!Array.isArray(page?.contents)) return page;\n return {\n ...page,\n contents: page.contents.map(zoneWithoutCloseButtons)\n };\n}\n/** A copy of the params without close-action buttons — an Inline (EMBEDDED) block has nothing to close. */\nexport function webPopupParamsWithoutCloseButtons(params) {\n if (!Array.isArray(params?.pages)) return params;\n return {\n ...params,\n pages: params.pages.map(webPopupPageWithoutCloseButtons)\n };\n}","import { WEB_POPUP_EMAIL_PATTERN } from './constants';\nimport { resolveWebPopupPages } from './helpers';\nconst FORM_FIELD_SLOT_TYPES = new Set(['email-input', 'tag-input', 'consent']);\nconst FORM_SLOT_TYPES = new Set([...FORM_FIELD_SLOT_TYPES, 'submit']);\nfunction isFormFieldSlot(slot) {\n return FORM_FIELD_SLOT_TYPES.has(slot.type);\n}\n/** A field id: slot keys are unique within a page, not across pages. */\nexport function webPopupFormFieldId(pageKey, slotKey) {\n return `${pageKey}/${slotKey}`;\n}\n/** Every Form field of the popup, in page and stack order. */\nexport function collectWebPopupFormFields(pages) {\n const out = [];\n for (const page of pages) {\n for (const zone of page.contents) {\n for (const slot of zone.slots) {\n if (!isFormFieldSlot(slot)) continue;\n out.push({\n id: webPopupFormFieldId(page.key, slot.key),\n pageKey: page.key,\n slot\n });\n }\n }\n }\n return out;\n}\n/** Does any page carry a FORM slot (`email-input`, `tag-input`, `consent`, `submit`)? */\nexport function webPopupHasForm(params) {\n return resolveWebPopupPages(params).some(page => page.contents.some(zone => zone.slots.some(slot => FORM_SLOT_TYPES.has(slot.type))));\n}\nfunction fieldError(field, input) {\n const {\n slot\n } = field;\n if (slot.type === 'consent') return input.checks[field.id] ? undefined : slot.requiredMessage;\n const value = (input.texts[field.id] ?? '').trim();\n if (slot.type === 'tag-input') return slot.required && !value ? slot.requiredMessage : undefined;\n if (!value) return slot.requiredMessage;\n return WEB_POPUP_EMAIL_PATTERN.test(value) ? undefined : slot.invalidMessage;\n}\n/** The block text of every field that blocks a submit, by field id; empty = the Form can be sent. */\nexport function validateWebPopupForm(fields, input) {\n const errors = {};\n for (const field of fields) {\n const error = fieldError(field, input);\n if (error) errors[field.id] = error;\n }\n return errors;\n}\n/** The values a valid Form submits (contracts §10). */\nexport function webPopupFormValues(fields, input) {\n const values = {\n tags: {},\n policyAccepted: true\n };\n for (const field of fields) {\n const {\n slot\n } = field;\n if (slot.type === 'consent') {\n values.policyAccepted = values.policyAccepted && input.checks[field.id] === true;\n continue;\n }\n const value = (input.texts[field.id] ?? '').trim();\n if (slot.type === 'email-input') {\n values.email = value;\n continue;\n }\n if (value && slot.tagName) values.tags[slot.tagName] = value;\n }\n return values;\n}","import { type WebPopup } from './types';\n\nexport const isClickWebPopup = (popup: WebPopup): boolean => popup.trigger_type === 'CLICK';\n\n// Innermost first. composedPath() crosses open shadow roots, which closest() does not.\nfunction clickedElements(event: Event): Array<Element> {\n const path = typeof event.composedPath === 'function' ? event.composedPath() : [];\n if (path.length > 0) {\n return path.filter((node): node is Element => node instanceof Element);\n }\n\n const elements: Array<Element> = [];\n for (let node = event.target instanceof Element ? event.target : null; node; node = node.parentElement) {\n elements.push(node);\n }\n return elements;\n}\n\n/** Whether the click landed on an element matching the selector or inside one. Throws on an invalid selector. */\nexport function clickMatchesSelector(event: Event, selector: string): boolean {\n return clickedElements(event).some((element) => element.matches(selector));\n}\n\n// One capture listener for every CLICK popup: elements rendered later match too, and it runs before the site's own.\nexport function watchClicks(onClick: (event: MouseEvent) => void): () => void {\n document.addEventListener('click', onClick, true);\n return () => document.removeEventListener('click', onClick, true);\n}\n","export const WEB_POPUPS_WIDGET_NAMESPACE = 'pushwoosh-web-popups';\n\n// Prefix for every log line emitted by the web popups widget so its output is\n// easy to spot and filter in the console.\nexport const WEB_POPUPS_LOG_PREFIX = '[WebPopups]';\n\nexport const POPUP_HOST_Z_INDEX = 2147483647;\n\n// Breathing room between one popup closing and the next one opening. Not\n// cosmetic: without it the click that dismissed the first popup lands on the\n// incoming popup's overlay (which closes on click) or on one of its buttons.\nexport const QUEUE_GAP_MS = 400;\n\n// Carries an EMBEDDED block's server order, so a block re-rendered after navigation\n// takes its place in the stack instead of the end.\nexport const EMBEDDED_ORDER_ATTRIBUTE = 'data-pushwoosh-embedded-order';\n\n// Marks the ✕ the SDK draws on a dismissible journey placement.\nexport const EMBEDDED_DISMISS_ATTRIBUTE = 'data-pushwoosh-placement-dismiss';\n\n// Journey placements render ahead of every EMBEDDED campaign on the same element.\nexport const PLACEMENT_ORDER = -1;\n\n// The subscription-form service's public HTTP gateway. Serves\n// email-subscription-form slot submits and view stats for popup-embedded forms.\nexport const SUBSCRIPTION_FORMS_API_URL = 'https://subscription-form.svc-nue.pushwoosh.com/api/v1';\n","import { type TInboxMessagesStoreName, type TKeyValueStoreName, type TMainLogStoreName, type TMessageLogStoreName } from '../Storage.types';\n\nexport const STORE_NAME_KEY_VALUE: TKeyValueStoreName = 'keyValue';\nexport const STORE_NAME_MESSAGE_LOG: TMessageLogStoreName = 'messages';\nexport const STORE_NAME_MAIN_LOG: TMainLogStoreName = 'log';\nexport const STORE_NAME_INBOX_MESSAGES: TInboxMessagesStoreName = 'inboxMessages';\n\nexport const KEY_PATH_BASE_INCREMENT = 'id';\n","import { type TMigrationType, type TSdkStoreName } from '../Storage.types';\n\n/**\n * Check existed store, before create\n * @param name\n * @param storeCreator\n */\nexport function storeCreatorDecorator(name: TSdkStoreName, storeCreator: TMigrationType): TMigrationType {\n return function (database: IDBDatabase) {\n if (database.objectStoreNames.contains(name)) {\n return;\n }\n\n storeCreator(database);\n };\n}\n","import {\n STORE_NAME_INBOX_MESSAGES,\n STORE_NAME_KEY_VALUE,\n STORE_NAME_MAIN_LOG,\n STORE_NAME_MESSAGE_LOG,\n KEY_PATH_BASE_INCREMENT,\n} from './constants';\nimport { storeCreatorDecorator } from './helpers';\nimport {\n type TInboxMessagesIDBKeyPath,\n type TInboxMessagesIDBRemovalTimeIndex,\n type TInboxMessagesIDBStatusIndex,\n} from '../../../models/InboxMessages.types';\n\n/**\n * Create keyValue store migration\n * @param database\n */\nfunction createKeyValueStore(database: IDBDatabase) {\n database.createObjectStore(STORE_NAME_KEY_VALUE, { keyPath: 'key' });\n}\n\n/**\n * Create log store migration\n * @param database\n */\nfunction createLogStore(database: IDBDatabase) {\n const logStore = database.createObjectStore(\n STORE_NAME_MAIN_LOG,\n { keyPath: KEY_PATH_BASE_INCREMENT, autoIncrement: true },\n );\n logStore.createIndex('environment', 'environment', { unique: false });\n logStore.createIndex('date', 'date', { unique: false });\n logStore.createIndex('type', 'type', { unique: false });\n}\n\n/**\n * Create message log store migration\n * @param database\n */\nfunction createMessageLogStore(database: IDBDatabase) {\n const messagesStore = database.createObjectStore(\n STORE_NAME_MESSAGE_LOG,\n { keyPath: KEY_PATH_BASE_INCREMENT, autoIncrement: true },\n );\n messagesStore.createIndex('date', 'date', { unique: false });\n}\n\n/**\n * Create inbox messages store migration\n * @param database\n */\nfunction createInboxMessagesStore(database: IDBDatabase) {\n const keyPath: TInboxMessagesIDBKeyPath = 'inbox_id';\n const statusIndex: TInboxMessagesIDBStatusIndex = 'status';\n const removalTimeIndex: TInboxMessagesIDBRemovalTimeIndex = 'rt';\n\n const store = database.createObjectStore(STORE_NAME_INBOX_MESSAGES,\n { keyPath, autoIncrement: false },\n );\n store.createIndex(statusIndex, statusIndex, { unique: false, multiEntry: true });\n store.createIndex(removalTimeIndex, removalTimeIndex, { unique: false, multiEntry: true });\n}\n\nexport default [\n storeCreatorDecorator(STORE_NAME_KEY_VALUE, createKeyValueStore),\n storeCreatorDecorator(STORE_NAME_MAIN_LOG, createLogStore),\n storeCreatorDecorator(STORE_NAME_MESSAGE_LOG, createMessageLogStore),\n storeCreatorDecorator(STORE_NAME_INBOX_MESSAGES, createInboxMessagesStore),\n];\n","import { default as migrationsInitial } from './initial';\nimport { type TMigrationType } from '../Storage.types';\n\nexport default class Migrations {\n get all(): Array<TMigrationType> {\n return migrationsInitial;\n }\n}\n","import Migrations from './Migrations';\nimport { type TMigrationType } from '../Storage.types';\n\nexport default class MigrationExecutor {\n db: IDBDatabase;\n migrationsBuilder: Migrations;\n\n constructor(\n db: IDBDatabase,\n migrationsBuilder: Migrations = new Migrations(),\n ) {\n this.db = db;\n this.migrationsBuilder = migrationsBuilder;\n }\n\n applyMigrations() {\n this.applyMigrationsPack(this.migrationsBuilder.all);\n }\n\n applyMigrationsPack(migrationsPack: Array<TMigrationType>) {\n migrationsPack.forEach((migration) => {\n migration(this.db);\n });\n }\n}\n","import {\n STORE_NAME_KEY_VALUE,\n STORE_NAME_MAIN_LOG,\n STORE_NAME_MESSAGE_LOG,\n} from '../modules/storage/migrations/constants';\nimport MigrationExecutor from '../modules/storage/migrations/MigrationExecutor';\nimport { type IIDBOpenEventTargetWithResult } from '../modules/storage/Storage.types';\nimport version from '../modules/storage/version';\n\ndeclare const self: ServiceWorkerGlobalScope;\n\nfunction onversionchange(database: IDBDatabase, event: Event) {\n console.info('onversionchange', event);\n database.close();\n}\n\nlet databasePromise: Promise<IDBDatabase>;\nexport function getInstance(): Promise<IDBDatabase> {\n if (!databasePromise) {\n databasePromise = new Promise<IDBDatabase>((resolve, reject) => {\n const request: IDBOpenDBRequest = indexedDB.open('PUSHWOOSH_SDK_STORE', version);\n request.onsuccess = (event) => {\n const database: IDBDatabase = (event.target as IIDBOpenEventTargetWithResult).result;\n database.onversionchange = onversionchange.bind(null, database, reject);\n resolve(database);\n };\n\n request.onerror = () => reject(request.error);\n\n request.onupgradeneeded = (event) => {\n const database: IDBDatabase = (event.target as IIDBOpenEventTargetWithResult).result;\n database.onversionchange = onversionchange.bind(null, database, reject);\n\n const migrationExecutor = new MigrationExecutor(database);\n migrationExecutor.applyMigrations();\n };\n });\n }\n return databasePromise;\n}\n\nfunction getInstanceWithPromise(executor: any): any {\n return getInstance().then((database) => (\n new Promise((resolve, reject) => executor(database, resolve, reject))\n ));\n}\n\nfunction createKeyValue(name: string) {\n return {\n get<K extends string, D>(key: K, defaultValue?: D) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction(name).objectStore(name).get(key);\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(request.result?.value || defaultValue);\n } else if (isError) {\n reject(request.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n request.onsuccess = () => isComplete = true;\n request.onerror = () => isError = true;\n check();\n });\n },\n\n getAll() {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const result: { [key: string]: any } = {};\n const cursor = database.transaction(name).objectStore(name).openCursor();\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(result);\n } else if (isError) {\n reject(cursor.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n cursor.onsuccess = (event) => {\n const cursorResult = (event.target as any).result;\n if (cursorResult) {\n result[cursorResult.key] = cursorResult.value.value;\n cursorResult.continue();\n } else {\n isComplete = true;\n }\n };\n cursor.onerror = () => isError = true;\n check();\n });\n },\n\n async extend(key: string, value: any) {\n const oldValues = await this.get(key);\n const { ...newValues } = value;\n await this.set(key, { ...oldValues, ...newValues });\n },\n\n set<K, D>(key: K, value: D) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([name], 'readwrite').objectStore(name).put({ key, value });\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(key);\n } else if (isError) {\n reject(request.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n request.onsuccess = () => isComplete = true;\n request.onerror = () => isError = true;\n check();\n });\n },\n };\n}\n\nexport abstract class LogBase {\n protected abstract name: string;\n protected abstract maxItems: number;\n _add(obj: any) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([this.name], 'readwrite').objectStore(this.name).add(obj);\n request.onsuccess = () => {\n resolve(obj);\n };\n request.onerror = () => {\n reject(request.error);\n };\n }).then((obj: any) => {\n return this.getAll().then((items: { id: number }[]) => {\n if (Array.isArray(items)) {\n const ids = items.map((i) => i.id).sort((a, b) => {\n if (a == b) return 0;\n return a < b ? 1 : -1;\n });\n if (ids.length > this.maxItems) {\n return Promise.all(ids.slice(this.maxItems).map((id) => this.delete(id))).then(() => obj);\n }\n }\n return obj;\n });\n });\n }\n\n delete(key: any) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([this.name], 'readwrite').objectStore(this.name).delete(key);\n request.onsuccess = () => {\n resolve(request.result);\n };\n request.onerror = () => {\n reject(request.error);\n };\n });\n }\n\n getAll() {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const result: any[] = [];\n const cursor = database.transaction(this.name).objectStore(this.name).openCursor();\n cursor.onsuccess = (ev) => {\n const cursorResult = (ev.target as any).result;\n if (cursorResult) {\n if (cursorResult.value) {\n result.push(cursorResult.value);\n }\n cursorResult.continue();\n } else {\n resolve(result);\n }\n };\n cursor.onerror = () => {\n reject(cursor.error);\n };\n });\n }\n}\n\nexport class LogLog extends LogBase {\n protected name = STORE_NAME_MAIN_LOG;\n protected maxItems = 100;\n protected environment = (typeof self !== 'undefined' && self.registration) ? 'worker' : 'browser';\n add(type: string, message: any, additional?: any) {\n const obj: any = {\n type,\n environment: this.environment,\n message: `${message}`,\n date: new Date(),\n };\n if (message instanceof Error) {\n obj.stack = message.stack;\n }\n if (additional) {\n obj.additional = additional;\n }\n return this._add(obj);\n }\n}\n\nexport class LogMessage extends LogBase {\n protected name = STORE_NAME_MESSAGE_LOG;\n protected maxItems = 25;\n add(log: any) {\n return this._add({\n ...log,\n date: new Date(),\n });\n }\n}\n\nexport const keyValue = createKeyValue(STORE_NAME_KEY_VALUE);\nexport const log = new LogLog();\nexport const message = new LogMessage();\n","import { log as logStorage } from './storage';\n\nconst levels: { [key: string]: number } = {\n error: 1,\n info: 2,\n debug: 3,\n};\n\nlet limitLevel = 3;\n\ntype TWriteType = 'error' | 'apirequest' | 'info';\n\ninterface ILogger {\n setLevel(level: string): void;\n error(...args: any[]): void;\n info(...args: any[]): void;\n debug(...args: any[]): void;\n write(type: TWriteType, message: any, additional?: any): Promise<void>;\n isManualLevel(): boolean;\n [key: string]: any;\n}\n\nconst Logger: ILogger = {\n setLevel(level) {\n if (!levels[level]) {\n level = 'error';\n }\n limitLevel = levels[level];\n },\n write(type: TWriteType, message: any, additional?: any) {\n if (type === 'error') {\n this.error(message);\n } else {\n this.info(message);\n }\n return logStorage.add(type, message, additional);\n },\n} as ILogger;\n\nObject.keys(levels).forEach((levelName: string) => {\n const levelNumber = levels[levelName];\n Logger[levelName] = (...args: any[]) => {\n if (levelNumber <= limitLevel) {\n console.groupCollapsed(levelName);\n console.info('', ...args);\n console.trace('trace');\n console.groupEnd();\n }\n };\n});\n\nexport function logAndThrowError(error: string) {\n const logText = new Error(error);\n Logger.write('error', logText, 'logAndThrowError');\n throw logText;\n}\n\nexport function logAndRejectError(error: string, reject: (e: any) => void) {\n const logText = new Error(error);\n Logger.write('error', logText, 'logAndRejectError');\n reject(logText);\n}\n\nexport { Logger };\n","import {\n type WebPopupChoiceSubmitHandler, type WebPopupFormValuesSubmitHandler, type WebPopupRatingSubmitHandler,\n type WebPopupSubscribeResult,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { Logger } from '../../core/logger';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\n\n// The host side of the slots that talk to the device API: a choice becomes\n// TAGS, a rating an EVENT, a subscribe button the permission prompt.\n\n// A choice slot's picks appended to a LIST tag — additive by design: the slot\n// resets its selection on every show, so it cannot express an un-pick.\nexport function createChoiceSubmitHandler(pw: Pushwoosh): WebPopupChoiceSubmitHandler {\n return async ({ slotKey, tagName, values }) => {\n try {\n // String operation + `value` is setTags' shape; the numeric TagValue in\n // Api.types.ts belongs to multiRegisterDevice and no-ops here.\n await pw.api.setTags({ [tagName]: { operation: 'append', value: values } }); // also writes EMAIL tags when the visitor has one\n } catch (error) {\n Logger.error(error, `Failed to write web popup choice \"${slotKey}\" to tag \"${tagName}\"`);\n throw error;\n }\n };\n}\n\n// The score as an event, scale alongside (4 of 5 stars is not 4 of 10 NPS). An\n// in-app configured for this event can open over the popup; that's normal.\nexport function createRatingSubmitHandler(pw: Pushwoosh): WebPopupRatingSubmitHandler {\n return async ({ slotKey, eventName, score, scale }) => {\n try {\n await pw.api.postEvent(eventName, { score, scale, slotKey });\n } catch (error) {\n Logger.error(error, `Failed to post web popup rating \"${slotKey}\" as event \"${eventName}\"`);\n throw error;\n }\n };\n}\n\n// A `subscribe`-action button. Kept synchronous up to pw.subscribe() while the permission is\n// 'default': Firefox only honours a permission request inside the click's own task.\nexport function createSubscribeHandler(pw: Pushwoosh, campaignCode?: string): () => Promise<WebPopupSubscribeResult> {\n return async () => {\n const permissionBefore = pw.driver?.getPermission() ?? 'default';\n // No prompt to keep in the click's task once granted, so the server is asked; a failed check\n // reads as \"had a token\": a subscription is never over-counted.\n const hadToken = permissionBefore === 'granted'\n && await pw.api.checkDeviceSubscribeForPushNotifications(false).catch(() => true);\n let isSubscribed = false;\n\n try {\n await pw.subscribe();\n isSubscribed = pw.isDeviceRegistered();\n } catch (error) {\n Logger.error(error, 'Failed to subscribe from a web popup');\n }\n\n // The permission is the answer either way: a failed registration after a\n // granted prompt must not read to the popup as a refusal.\n const permission = (pw.driver?.getPermission() ?? 'default') as WebPopupSubscribeResult;\n\n if (campaignCode && permissionBefore !== 'denied' && !hadToken && isSubscribed && permission === 'granted') {\n pw.api.recordPopupFormEvent(campaignCode, 4).catch((error) => {\n Logger.error(error, `Failed to record the push subscription of web campaign \"${campaignCode}\"`);\n });\n }\n\n return permission;\n };\n}\n\n// Values of a FORM content, sent under the code of the campaign that shows it. The server answers\n// only OK or INVALID_EMAIL: the exact subscription state stays there, so an address can't be probed.\nexport function createFormValuesSubmitHandler(pw: Pushwoosh, campaignCode: string): WebPopupFormValuesSubmitHandler {\n return async (values) => {\n try {\n const response = await pw.api.submitPopupForm(campaignCode, values);\n\n if (response.result === 'OK') {\n return 'ok';\n }\n\n if (response.result === 'INVALID_EMAIL') {\n return 'invalid-email';\n }\n\n throw new Error(`Unexpected submitPopupForm result \"${response.result}\"`);\n } catch (error) {\n Logger.error(error, `Failed to submit the form of web campaign \"${campaignCode}\"`);\n throw error;\n }\n };\n}\n","import { useEffect, useState } from 'react';\nconst DARK_MEDIA_QUERY = '(prefers-color-scheme: dark)';\nfunction prefersDark() {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(DARK_MEDIA_QUERY).matches;\n}\n// 'auto' follows the visitor's OS setting and keeps following it: a popup can\n// be on screen when the theme flips, and a stale palette is the visible half.\nexport function useColorScheme(pref, watch) {\n const [dark, setDark] = useState(() => pref === 'auto' && watch && prefersDark());\n const watchDeps = [pref, watch];\n const [prevWatchDeps, setPrevWatchDeps] = useState(null);\n if (prevWatchDeps === null || watchDeps.some((dep, index) => dep !== prevWatchDeps[index])) {\n setPrevWatchDeps(watchDeps);\n if (pref === 'auto' && watch) {\n setDark(prefersDark());\n }\n }\n useEffect(() => {\n if (pref !== 'auto' || !watch || typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return undefined;\n }\n const media = window.matchMedia(DARK_MEDIA_QUERY);\n const onChange = event => setDark(event.matches);\n media.addEventListener('change', onChange);\n return () => media.removeEventListener('change', onChange);\n }, [pref, watch]);\n if (pref !== 'auto') return pref;\n return dark ? 'dark' : 'light';\n}","import { WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT } from './constants';\n/** Marks an Inline block's wrapper; the image cap is scoped to it so it never reaches the host page. */\nexport const WEB_POPUP_INLINE_SCOPE_ATTRIBUTE = 'data-pw-web-popup-inline';\n/** Marks the reader's ✕, so a host can tell it from the content's own buttons. */\nexport const WEB_POPUP_CLOSE_ATTRIBUTE = 'data-pw-close';\n/**\n * Marks the FORM content Submit: its send already counts in the campaign's Submits, so the host skips it as a click.\n * Email-subscription-form, choice and rating sends don't reach Submits, so their clicks stay interactions.\n */\nexport const WEB_POPUP_SUBMIT_ATTRIBUTE = 'data-pw-submit';\n/** An Inline block fills its container: the page's own width only sizes a floating popup. */\nexport const WEB_POPUP_INLINE_WRAPPER_STYLE = {\n width: '100%'\n};\n/** Image-cap stylesheet of an Inline block, scoped by WEB_POPUP_INLINE_SCOPE_ATTRIBUTE. */\nexport const WEB_POPUP_INLINE_IMAGE_CAP_CSS = `[${WEB_POPUP_INLINE_SCOPE_ATTRIBUTE}] img { max-height: ${WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT}px; object-fit: cover; }`;","import { createContext, useMemo, useState } from 'react';\nimport { collectWebPopupFormFields, validateWebPopupForm, webPopupFormValues } from './form';\nimport { resolveWebPopupPages } from './helpers';\nconst INERT_SESSION = {\n pageKey: '',\n texts: {},\n checks: {},\n errors: {},\n phase: 'idle',\n setText: () => {},\n setCheck: () => {},\n submit: () => {},\n turnPage: (target, go) => go(target),\n advance: () => {}\n};\n/** What a Form slot reads; a slot outside any WebPopupBox gets this inert session. */\nexport const WebPopupFormSessionContext = createContext(INERT_SESSION);\nfunction withoutKey(record, key) {\n if (!(key in record)) return record;\n return Object.fromEntries(Object.entries(record).filter(([candidate]) => candidate !== key));\n}\n/** The Form session a WebPopupBox owns: it sees every page and can switch them. */\nexport function useWebPopupFormSession(params, pageKey, onPageChange, onSubmitFormValues) {\n const pages = useMemo(() => resolveWebPopupPages(params), [params]);\n const fields = useMemo(() => collectWebPopupFormFields(pages), [pages]);\n const [texts, setTexts] = useState({});\n const [checks, setChecks] = useState({});\n const [errors, setErrors] = useState({});\n const [phase, setPhase] = useState('idle');\n const pageIndex = key => pages.findIndex(candidate => candidate.key === key);\n const pageValid = () => {\n const found = validateWebPopupForm(fields.filter(field => field.pageKey === pageKey), {\n texts,\n checks\n });\n setErrors(found);\n return Object.keys(found).length === 0;\n };\n // A page button can skip a page, so Submit checks every page and shows the first broken one.\n const formValid = () => {\n const found = validateWebPopupForm(fields, {\n texts,\n checks\n });\n setErrors(found);\n const invalid = fields.find(field => field.id in found);\n if (invalid) onPageChange?.(invalid.pageKey);\n return !invalid;\n };\n const showInvalidEmail = () => {\n const email = fields.find(field => field.slot.type === 'email-input');\n if (email?.slot.type !== 'email-input') return;\n setErrors({\n [email.id]: email.slot.invalidMessage\n });\n onPageChange?.(email.pageKey);\n };\n const submit = () => {\n if (!onSubmitFormValues || phase === 'submitting') return;\n if (!formValid()) {\n setPhase('idle');\n return;\n }\n setPhase('submitting');\n Promise.resolve().then(() => onSubmitFormValues(webPopupFormValues(fields, {\n texts,\n checks\n }))).then(result => {\n setPhase('idle');\n if (result === 'invalid-email') {\n showInvalidEmail();\n return;\n }\n const success = pages.find(candidate => candidate.role === 'success');\n if (success) onPageChange?.(success.key);\n }, () => setPhase('error'));\n };\n const turnPage = (target, go) => {\n if (phase === 'submitting') return;\n const targetIndex = pageIndex(target);\n const forward = targetIndex > pageIndex(pageKey);\n if (!onSubmitFormValues || !forward) {\n go(target);\n return;\n }\n if (pages[targetIndex].role === 'success') submit();else if (pageValid()) go(target);\n };\n const advance = () => {\n if (!onSubmitFormValues || phase === 'submitting') return;\n const next = pages[pageIndex(pageKey) + 1];\n if (!next || next.role === 'success') submit();else if (pageValid()) onPageChange?.(next.key);\n };\n return {\n pageKey,\n texts,\n checks,\n errors,\n phase,\n setText: (id, value) => {\n setTexts(prev => ({\n ...prev,\n [id]: value\n }));\n setErrors(prev => withoutKey(prev, id));\n },\n setCheck: (id, checked) => {\n setChecks(prev => ({\n ...prev,\n [id]: checked\n }));\n setErrors(prev => withoutKey(prev, id));\n },\n submit,\n turnPage,\n advance\n };\n}","import { webPopupTextColor, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from '../constants';\nexport const fieldSlotStyle = {\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: 'start'\n};\nexport function captionStyle({\n inverse,\n colors\n}) {\n const color = webPopupTextColor('caption', colors, inverse);\n return {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(color ? {\n color\n } : {})\n };\n}\nexport function errorStyle(colors) {\n return {\n fontSize: 12,\n lineHeight: 1.4,\n color: colors.error,\n paddingTop: 2\n };\n}","import { captionStyle } from '../styles';\nexport function labelStyle(look) {\n return {\n ...captionStyle(look),\n paddingBottom: 4\n };\n}","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useContext, useState } from 'react';\nimport { webPopupFormInputStyle } from '../../constants';\nimport { webPopupFormFieldId } from '../../form';\nimport { WebPopupFormSessionContext } from '../../formSession';\nimport { errorStyle, fieldSlotStyle } from '../styles';\nimport { labelStyle } from './styles';\n/** The text field a Form's Email and Tag inputs share; Enter advances the Form. */\nexport function TextFieldView({\n slotKey,\n label,\n placeholder,\n inputType,\n autoComplete,\n look\n}) {\n const session = useContext(WebPopupFormSessionContext);\n const [focused, setFocused] = useState(false);\n const id = webPopupFormFieldId(session.pageKey, slotKey);\n const error = session.errors[id];\n let borderColor;\n if (error) borderColor = look.colors.error;else if (focused) borderColor = look.colors.accent;\n return _jsxs(\"div\", {\n style: fieldSlotStyle,\n children: [label && _jsx(\"div\", {\n style: labelStyle(look),\n children: label\n }), _jsx(\"input\", {\n type: inputType,\n autoComplete: autoComplete,\n placeholder: placeholder || undefined,\n value: session.texts[id] ?? '',\n disabled: session.phase === 'submitting',\n style: webPopupFormInputStyle(look.colors, borderColor),\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n onChange: event => session.setText(id, event.currentTarget.value),\n onKeyDown: event => {\n if (event.key === 'Enter') session.advance();\n }\n }), error && _jsx(\"div\", {\n style: errorStyle(look.colors),\n children: error\n })]\n });\n}","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { TextFieldView } from '../TextFieldView';\n/** A Form's Email input, drawn the runtime's way. */\nexport function EmailInputSlotView({\n slot,\n ...look\n}) {\n return _jsx(TextFieldView, {\n slotKey: slot.key,\n label: slot.label,\n placeholder: slot.placeholder,\n inputType: \"email\",\n autoComplete: \"email\",\n look: look\n });\n}","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { TextFieldView } from '../TextFieldView';\n/** A Form's Tag input, drawn the runtime's way. */\nexport function TagInputSlotView({\n slot,\n ...look\n}) {\n return _jsx(TextFieldView, {\n slotKey: slot.key,\n label: slot.label,\n placeholder: slot.placeholder,\n inputType: \"text\",\n look: look\n });\n}","import { captionStyle } from '../styles';\nexport const checkboxStyle = {\n margin: '2px 0 0',\n flexShrink: 0\n};\nexport function labelStyle(look) {\n return {\n ...captionStyle(look),\n display: 'flex',\n alignItems: 'flex-start',\n gap: 8,\n cursor: 'pointer'\n };\n}\nexport function linkStyle(colors) {\n return {\n color: colors.accent\n };\n}","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useContext } from 'react';\nimport { webPopupFormFieldId } from '../../form';\nimport { WebPopupFormSessionContext } from '../../formSession';\nimport { safeUrl, webPopupLinkTargetAttrs } from '../../helpers';\nimport { errorStyle, fieldSlotStyle } from '../styles';\nimport { checkboxStyle, labelStyle, linkStyle } from './styles';\n/** A Form's Consent checkbox with its policy link. */\nexport function ConsentSlotView({\n slot,\n ...look\n}) {\n const session = useContext(WebPopupFormSessionContext);\n const id = webPopupFormFieldId(session.pageKey, slot.key);\n const error = session.errors[id];\n const href = safeUrl(slot.url);\n return _jsxs(\"div\", {\n style: fieldSlotStyle,\n children: [_jsxs(\"label\", {\n style: labelStyle(look),\n children: [_jsx(\"input\", {\n type: \"checkbox\",\n checked: session.checks[id] === true,\n disabled: session.phase === 'submitting',\n style: checkboxStyle,\n onChange: event => session.setCheck(id, event.currentTarget.checked)\n }), _jsxs(\"span\", {\n children: [slot.checkboxLabel, href && _jsxs(_Fragment, {\n children: [' ', _jsx(\"a\", {\n href: href,\n ...webPopupLinkTargetAttrs(undefined),\n style: linkStyle(look.colors),\n children: slot.linkLabel || slot.url\n })]\n })]\n })]\n }), error && _jsx(\"div\", {\n style: errorStyle(look.colors),\n children: error\n })]\n });\n}","import { webPopupButtonPillStyle, WEB_POPUP_BUTTON_SLOT_PADDING } from '../../constants';\nexport const slotStyle = {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n};\nexport function pillStyle(variant, colors, submitting) {\n return {\n ...webPopupButtonPillStyle(variant, colors),\n ...(submitting ? {\n opacity: 0.6,\n cursor: 'default'\n } : {})\n };\n}","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useContext } from 'react';\nimport { WebPopupFormSessionContext } from '../../formSession';\nimport { webPopupCssTextAlign } from '../../helpers';\nimport { WEB_POPUP_SUBMIT_ATTRIBUTE } from '../../styles';\nimport { errorStyle } from '../styles';\nimport { pillStyle, slotStyle } from './styles';\n/** A Form's Submit: sends every field of the popup; shows errorMessage after a refusal. */\nexport function SubmitSlotView({\n slot,\n align,\n colors\n}) {\n const session = useContext(WebPopupFormSessionContext);\n const submitting = session.phase === 'submitting';\n return _jsxs(\"div\", {\n style: slotStyle,\n children: [_jsx(\"button\", {\n type: \"button\",\n [WEB_POPUP_SUBMIT_ATTRIBUTE]: '',\n disabled: submitting,\n style: pillStyle(slot.variant, colors, submitting),\n onClick: session.submit,\n children: slot.label\n }), session.phase === 'error' && _jsx(\"div\", {\n style: {\n ...errorStyle(colors),\n textAlign: webPopupCssTextAlign(align)\n },\n children: slot.errorMessage\n })]\n });\n}","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { createContext, useContext, useEffect, useState } from 'react';\nimport { webPopupButtonPillStyle, webPopupTextColor, WEB_POPUP_PRODUCTS_CACHE_MS, WEB_POPUP_PRODUCTS_DEFAULTS, WEB_POPUP_PRODUCTS_PLACEHOLDERS, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from './constants';\nimport { safeUrl, webPopupLinkTargetAttrs } from './helpers';\n/** The products host of the box being drawn; WebPopupBox provides it, so no prop threads through the tree. */\nexport const WebPopupProductsContext = createContext(undefined);\nconst productsCache = new WeakMap();\n/**\n * One slot's items through the host, shared by the host's pre-show check and the render for WEB_POPUP_PRODUCTS_CACHE_MS,\n * so both see the same answer from one request. Never rejects: a failure or a non-array is an empty slot.\n */\nexport function loadWebPopupProducts(host, slot, now = Date.now()) {\n let cache = productsCache.get(host);\n if (!cache) {\n cache = new Map();\n productsCache.set(host, cache);\n }\n const key = `${slot.key}|${slot.strategy}|${slot.fallbackStrategy ?? ''}|${slot.limit}`;\n const hit = cache.get(key);\n if (hit && now - hit.at < WEB_POPUP_PRODUCTS_CACHE_MS) return hit.items;\n const entry = {\n at: now,\n items: Promise.resolve([])\n };\n entry.items = Promise.resolve().then(() => host.load(slot)).then(loaded => Array.isArray(loaded) ? loaded.slice(0, slot.limit) : []).catch(() => {\n // a failed answer is not kept: the next showing asks again\n if (cache.get(key) === entry) cache.delete(key);\n return [];\n });\n cache.set(key, entry);\n return entry.items;\n}\nconst CARD_MIN_WIDTH = 120;\nfunction formatPrice(price, currency) {\n if (!currency) return String(price);\n try {\n return new Intl.NumberFormat(undefined, {\n style: 'currency',\n currency\n }).format(price);\n } catch {\n return `${price} ${currency}`;\n }\n}\nfunction placeholderProducts(count) {\n return Array.from({\n length: count\n }, (_, i) => ({\n id: `placeholder-${i}`,\n title: 'Product name',\n url: ''\n }));\n}\nfunction ProductCard({\n product,\n slot,\n colors,\n inverse,\n onClick\n}) {\n const href = safeUrl(product.url);\n const image = safeUrl(product.image);\n const titleColor = webPopupTextColor('body', colors, inverse);\n const priceColor = webPopupTextColor('caption', colors, inverse);\n const cardStyle = {\n display: 'flex',\n flexDirection: 'column',\n gap: 6,\n minWidth: CARD_MIN_WIDTH,\n color: 'inherit',\n textDecoration: 'none',\n ...(slot.layout === 'row' ? {\n flex: `0 0 ${CARD_MIN_WIDTH}px`\n } : {})\n };\n const body = _jsxs(_Fragment, {\n children: [slot.fields.image ? _jsx(\"div\", {\n style: {\n aspectRatio: '1 / 1',\n borderRadius: 6,\n backgroundColor: colors.surface,\n border: `1px solid ${colors.border}`,\n ...(image ? {\n backgroundImage: `url(\"${image.replace(/\"/g, '%22')}\")`,\n backgroundSize: 'cover',\n backgroundPosition: 'center'\n } : {})\n }\n }) : null, slot.fields.title ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.body,\n ...(titleColor ? {\n color: titleColor\n } : {})\n },\n children: product.title\n }) : null, slot.fields.price && product.price !== undefined ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(priceColor ? {\n color: priceColor\n } : {})\n },\n children: formatPrice(product.price, product.currency)\n }) : null, slot.fields.cta ? _jsx(\"span\", {\n style: {\n ...webPopupButtonPillStyle('secondary', colors),\n padding: '6px 10px',\n fontSize: 13\n },\n children: slot.ctaText || WEB_POPUP_PRODUCTS_DEFAULTS.ctaText\n }) : null]\n });\n if (!href) return _jsx(\"div\", {\n style: cardStyle,\n children: body\n });\n return _jsx(\"a\", {\n href: href,\n ...webPopupLinkTargetAttrs('_self'),\n style: cardStyle,\n onClick: onClick,\n children: body\n });\n}\n// With a host: its items; loading, failed or empty collapses the slot, never a spinner on a shop page.\n// Without one: placeholder cards on the editor canvas and in previews, nothing on a live page.\nexport function ProductsSlotView({\n slot,\n inverse,\n colors,\n mode\n}) {\n const host = useContext(WebPopupProductsContext);\n const [items, setItems] = useState(null);\n // Pages are re-resolved on every render, so the slot object is new each time: keyed by what the request depends on.\n const request = `${slot.key}|${slot.strategy}|${slot.fallbackStrategy ?? ''}|${slot.limit}`;\n useEffect(() => {\n if (!host) return undefined;\n let cancelled = false;\n void loadWebPopupProducts(host, slot).then(loaded => {\n if (!cancelled) setItems(loaded);\n });\n return () => {\n cancelled = true;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [host, request]);\n if (!host && mode === 'live') return null;\n const shown = host ? items : placeholderProducts(Math.min(slot.limit, WEB_POPUP_PRODUCTS_PLACEHOLDERS));\n if (!shown || shown.length === 0) return null;\n const listStyle = slot.layout === 'grid' ? {\n display: 'grid',\n gridTemplateColumns: `repeat(auto-fill, minmax(${CARD_MIN_WIDTH}px, 1fr))`,\n gap: 12\n } : {\n display: 'flex',\n gap: 12,\n overflowX: 'auto'\n };\n return _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n \"data-pw-products\": slot.key,\n children: _jsx(\"div\", {\n style: listStyle,\n children: shown.map(product => _jsx(ProductCard, {\n product: product,\n slot: slot,\n colors: colors,\n inverse: inverse,\n onClick: mode === 'live' && host?.onClick ? () => host.onClick?.(product, slot) : undefined\n }, product.id))\n })\n });\n}","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useEffect, useRef, useState } from 'react';\nimport { WEB_POPUP_ARROW_HEIGHT, WEB_POPUP_ARROW_SHADOW, WEB_POPUP_ARROW_WIDTH, WEB_POPUP_CONTROL_HOVER_SCALE, WEB_POPUP_REVEAL_LEAVE_GRACE_MS, WEB_POPUP_REVEAL_MS, webPopupArrowPoints, WEB_POPUP_SLIDE_CLOSE_GAP, WEB_POPUP_SLIDE_CLOSE_GROWTH, WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE } from './constants';\nimport { safeUrl } from './helpers';\nimport { webPopupColorAlpha } from './palette';\nimport { WEB_POPUP_CLOSE_ATTRIBUTE } from './styles';\n/** The reveal cascade: left arrow, right arrow, ✕ — each starts `revealStagger` into the previous one. */\nexport function webPopupRevealDelays(reveal, page) {\n const order = [];\n if (page.leftAction) order.push('left');\n if (page.rightAction) order.push('right');\n if (reveal.slideOutClose) order.push('close');\n const step = WEB_POPUP_REVEAL_MS * reveal.revealStagger;\n return Object.fromEntries(order.map((control, i) => [control, Math.round(i * step)]));\n}\n/** The room the box gives up to its controls; none on a device without hover, where nothing is revealed. */\nexport function webPopupRevealRoom(reveal, hoverCapable) {\n if (!hoverCapable) return {\n side: 0,\n top: 0\n };\n const close = reveal.slideOutClose ? WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE + WEB_POPUP_SLIDE_CLOSE_GAP : 0;\n return {\n side: Math.max(reveal.hasArrows ? reveal.arrowGutter : 0, close),\n top: close\n };\n}\n/** Px from the box's right edge to the revealed ✕: its right edge sits at the right arrow's tip, arrow or not. */\nexport function webPopupSlideCloseInset(arrowGutter) {\n const tip = (arrowGutter + WEB_POPUP_ARROW_WIDTH) / 2;\n return Math.min(WEB_POPUP_SLIDE_CLOSE_GAP, tip - WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE);\n}\n/** Whether the visitor's pointer can hover: touch screens get no revealed controls. */\nexport function useWebPopupHoverCapable() {\n const [capable] = useState(() => typeof window === 'undefined' || typeof window.matchMedia !== 'function' ? true : window.matchMedia('(hover: hover)').matches);\n return capable;\n}\n/** Revealed while the pointer or focus is inside; hiding waits a grace so a gap to a control is not a leave. */\nexport function useWebPopupReveal() {\n const [revealed, setRevealed] = useState(false);\n const timerRef = useRef(undefined);\n const cancel = () => {\n if (timerRef.current !== undefined) clearTimeout(timerRef.current);\n timerRef.current = undefined;\n };\n useEffect(() => cancel, []);\n const show = () => {\n cancel();\n setRevealed(true);\n };\n const hide = () => {\n cancel();\n timerRef.current = setTimeout(() => setRevealed(false), WEB_POPUP_REVEAL_LEAVE_GRACE_MS);\n };\n return {\n revealed,\n handlers: {\n onMouseEnter: show,\n onMouseLeave: hide,\n onFocus: show,\n onBlur: e => {\n if (!e.currentTarget.contains(e.relatedTarget)) hide();\n }\n }\n };\n}\nfunction transition(delay, revealed) {\n const wait = revealed ? delay ?? 0 : 0;\n const ease = 'cubic-bezier(0.22, 1, 0.36, 1)';\n return `transform ${WEB_POPUP_REVEAL_MS}ms ${ease} ${wait}ms, opacity ${WEB_POPUP_REVEAL_MS}ms ease ${wait}ms`;\n}\nfunction ArrowControl({\n side,\n action,\n gutter,\n colors,\n delay,\n revealed,\n onPageChange,\n onRequestClose\n}) {\n const [hover, setHover] = useState(false);\n const href = action.type === 'href' ? safeUrl(action.url) : undefined;\n const sameTab = action.type === 'href' && action.target === '_self';\n const onClick = () => {\n if (action.type === 'page') onPageChange(action.page);else if (action.type === 'close') onRequestClose?.();else if (href) {\n if (sameTab) window.location.assign(href);else window.open(href, '_blank', 'noopener,noreferrer');\n }\n };\n const tucked = side === 'left' ? 'translateX(100%)' : 'translateX(-100%)';\n const style = {\n position: 'absolute',\n top: '50%',\n [side === 'left' ? 'right' : 'left']: '100%',\n width: gutter,\n height: WEB_POPUP_ARROW_HEIGHT * 2,\n marginTop: -WEB_POPUP_ARROW_HEIGHT,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: 0,\n border: 'none',\n background: 'transparent',\n cursor: 'pointer',\n opacity: revealed ? 1 : 0,\n transform: revealed ? 'translateX(0)' : tucked,\n transition: transition(delay, revealed),\n pointerEvents: revealed ? 'auto' : 'none'\n };\n const glyph = {\n display: 'block',\n overflow: 'visible',\n filter: WEB_POPUP_ARROW_SHADOW,\n transform: hover ? `scale(${WEB_POPUP_CONTROL_HOVER_SCALE}) translateX(${side === 'left' ? -2 : 2}px)` : 'none',\n transition: 'transform 160ms ease'\n };\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": side === 'left' ? 'Previous' : 'Next',\n \"aria-hidden\": !revealed,\n tabIndex: revealed ? 0 : -1,\n \"data-pw-arrow\": side,\n style: style,\n onClick: onClick,\n onMouseEnter: () => setHover(true),\n onMouseLeave: () => setHover(false),\n children: _jsx(\"svg\", {\n width: WEB_POPUP_ARROW_WIDTH,\n height: WEB_POPUP_ARROW_HEIGHT,\n viewBox: `0 0 ${WEB_POPUP_ARROW_WIDTH} ${WEB_POPUP_ARROW_HEIGHT}`,\n style: glyph,\n \"aria-hidden\": \"true\",\n children: _jsx(\"polygon\", {\n points: webPopupArrowPoints(side),\n fill: colors.accent,\n stroke: colors.accent,\n strokeWidth: 2,\n strokeLinejoin: \"round\"\n })\n })\n });\n}\nfunction SlideOutClose({\n colors,\n inset,\n delay,\n revealed,\n onRequestClose\n}) {\n const [hover, setHover] = useState(false);\n const size = WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE;\n const gap = WEB_POPUP_SLIDE_CLOSE_GAP;\n const tucked = `translate(${-(inset + size)}px, ${gap + size}px) scale(${1 / WEB_POPUP_SLIDE_CLOSE_GROWTH})`;\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": \"Close\",\n [WEB_POPUP_CLOSE_ATTRIBUTE]: '',\n tabIndex: revealed ? 0 : -1,\n onClick: onRequestClose,\n onMouseEnter: () => setHover(true),\n onMouseLeave: () => setHover(false),\n style: {\n position: 'absolute',\n left: `calc(100% + ${inset}px)`,\n bottom: `calc(100% + ${gap}px)`,\n width: size,\n height: size,\n padding: 0,\n border: 'none',\n background: 'transparent',\n cursor: 'pointer',\n opacity: revealed ? 1 : 0,\n transform: revealed ? 'translate(0px, 0px) scale(1)' : tucked,\n transition: transition(delay, revealed),\n pointerEvents: revealed ? 'auto' : 'none'\n },\n children: _jsx(\"span\", {\n \"aria-hidden\": \"true\",\n style: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n background: webPopupColorAlpha(colors.surface, 0.96),\n boxShadow: '0 2px 6px rgba(16, 24, 40, 0.28)',\n color: colors.chromeIcon,\n fontSize: 20,\n lineHeight: 1,\n transformOrigin: 'right center',\n transform: hover ? `scale(${WEB_POPUP_CONTROL_HOVER_SCALE})` : 'none',\n transition: 'transform 160ms ease'\n },\n children: \"\\u2715\"\n })\n });\n}\n/** The arrows and the slide-out ✕ of a live popup; drawn BEFORE the box, so they tuck in under it. */\nexport function WebPopupRevealControls({\n page,\n reveal,\n colors,\n revealed,\n onPageChange,\n onRequestClose\n}) {\n const delays = webPopupRevealDelays(reveal, page);\n return _jsxs(_Fragment, {\n children: [page.leftAction && _jsx(ArrowControl, {\n side: \"left\",\n action: page.leftAction,\n gutter: reveal.arrowGutter,\n colors: colors,\n delay: delays.left,\n revealed: revealed,\n onPageChange: onPageChange,\n onRequestClose: onRequestClose\n }), page.rightAction && _jsx(ArrowControl, {\n side: \"right\",\n action: page.rightAction,\n gutter: reveal.arrowGutter,\n colors: colors,\n delay: delays.right,\n revealed: revealed,\n onPageChange: onPageChange,\n onRequestClose: onRequestClose\n }), reveal.slideOutClose && _jsx(SlideOutClose, {\n colors: colors,\n inset: webPopupSlideCloseInset(reveal.arrowGutter),\n delay: delays.close,\n revealed: revealed,\n onRequestClose: onRequestClose\n })]\n });\n}","import { createContext, useMemo, useState } from 'react';\n/** What a subscribe button reads; a slot outside any WebPopupBox gets this inert session. */\nexport const WebPopupSubscribeContext = createContext({\n answered: false,\n markAnswered: () => {}\n});\n/** The subscribe session a WebPopupBox owns, so a button met again after a page turn stays spent. */\nexport function useWebPopupSubscribeSession() {\n const [answered, setAnswered] = useState(false);\n return useMemo(() => ({\n answered,\n markAnswered: () => setAnswered(true)\n }), [answered]);\n}","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useContext, useEffect, useMemo, useState } from 'react';\nimport { useColorScheme } from './colorScheme';\nimport { webPopupButtonPillStyle, webPopupFormInputStyle, webPopupRatingScores, webPopupTextColor, webPopupSlotGap, webPopupSlotRole, WEB_POPUP_BG_SECTION_FALLBACK, WEB_POPUP_BUTTON_SLOT_PADDING, WEB_POPUP_FONT_STACK, WEB_POPUP_EMAIL_PATTERN, WEB_POPUP_KEYFRAMES, WEB_POPUP_PAGE_TRANSITION_MS, WEB_POPUP_RETRY_ERROR, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from './constants';\nimport { ConsentSlotView, EmailInputSlotView, SubmitSlotView, TagInputSlotView } from './form-slots';\nimport { useWebPopupFormSession, WebPopupFormSessionContext } from './formSession';\nimport { WEB_POPUP_GLYPH_PATHS, WEB_POPUP_THUMB_UP_PATH } from './glyphs';\nimport { applyWebPopupSubscribeOutcome, placementMaxSize, resolveWebPopupPages, resolveWebPopupReveal, safeUrl, sanitizeWebPopupHtml, startPageOf, webPopupCssTextAlign, webPopupDirection, webPopupLinkTargetAttrs } from './helpers';\nimport { webPopupBackgroundImageStyle, webPopupContainerStyle, webPopupScrimGradient } from './layout';\nimport { resolveWebPopupBoxChrome, resolveWebPopupColors, webPopupColorAlpha, webPopupDarkEnabled, webPopupImageSrc } from './palette';\nimport { ProductsSlotView, WebPopupProductsContext } from './productsSlot';\nimport { useWebPopupHoverCapable, useWebPopupReveal, webPopupRevealRoom, WebPopupRevealControls } from './revealControls';\nimport { WEB_POPUP_CLOSE_ATTRIBUTE } from './styles';\nimport { useWebPopupSubscribeSession, WebPopupSubscribeContext } from './subscribeSession';\nimport { webPopupTimerLabels, webPopupTimerRemaining } from './timer';\n// Renders a popup from its model by interpreting each page's embedded layout\n// tree — the same node vocabulary the editor's canvas builds from: container\n// nodes become inline-styled grid divs, `Content` leaves render a named\n// zone's slot stack, `Image` leaves an image param. 'live' mode adds the\n// viewport chrome (overlay, placement, animation, close), 'preview' renders\n// just the popup box inline. Only one page renders at a time; buttons with a\n// `page` action switch pages. All styling is inline (shadow-DOM friendly, no\n// CSS files).\nconst ANIMATION_STYLE = {\n none: undefined,\n fade: 'pw-vpopup-fade 0.35s ease-out backwards',\n slide: 'pw-vpopup-slide 0.35s ease-out backwards'\n};\nfunction TextSlotView({\n slot,\n align,\n inverse,\n colors\n}) {\n const style = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES[slot.variant],\n textAlign: webPopupCssTextAlign(slot.align ?? align)\n };\n const color = webPopupTextColor(slot.variant, colors, inverse);\n if (color) style.color = color;\n // The html comes from the editor's rich-text slots, but the json is\n // API-writable — sanitize on render (inline tags only, safe link hrefs).\n return _jsx(\"div\", {\n style: style,\n dangerouslySetInnerHTML: {\n __html: sanitizeWebPopupHtml(slot.html)\n }\n });\n}\nfunction ButtonSlotView({\n slot,\n colors,\n logger,\n onRequestClose,\n onPageChange,\n onRequestSubscribe,\n onSubscribeClose\n}) {\n const form = useContext(WebPopupFormSessionContext);\n const subscribe = useContext(WebPopupSubscribeContext);\n const [askPhase, setAskPhase] = useState('idle');\n const pill = webPopupButtonPillStyle(slot.variant, colors);\n const wrapper = {};\n if (slot.action.type === 'close') {\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n style: pill,\n onClick: onRequestClose,\n children: slot.label\n })\n });\n }\n if (slot.action.type === 'page') {\n const target = slot.action.page;\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n style: pill,\n onClick: () => form.turnPage(target, onPageChange),\n children: slot.label\n })\n });\n }\n if (slot.action.type === 'subscribe') {\n const {\n action\n } = slot;\n // 'asking' guards the double click (one prompt, one registerDevice);\n // an answered ask stays disabled because the browser grants no second prompt.\n const spent = askPhase !== 'idle' || subscribe.answered;\n const ask = () => {\n if (!onRequestSubscribe || spent) return;\n setAskPhase('asking');\n onRequestSubscribe().then(result => {\n if (result === 'default') {\n setAskPhase('idle');\n return;\n }\n subscribe.markAnswered();\n const next = applyWebPopupSubscribeOutcome(action, result, logger);\n if (next === 'close') {\n onSubscribeClose?.();\n return;\n }\n setAskPhase(result);\n if (next !== 'stay') onPageChange(next.page);\n }).catch(() => setAskPhase('idle'));\n };\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n disabled: spent,\n style: {\n ...pill,\n ...(spent ? {\n opacity: 0.7\n } : {})\n },\n onClick: ask,\n children: slot.label\n })\n });\n }\n const href = safeUrl(slot.action.url);\n // No (safe) URL yet: an inert pill — not an '#' anchor opening a blank tab.\n if (!href) {\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"button\", {\n type: \"button\",\n style: pill,\n children: slot.label\n })\n });\n }\n return _jsx(\"div\", {\n style: wrapper,\n children: _jsx(\"a\", {\n href: href,\n ...webPopupLinkTargetAttrs(slot.action.target),\n style: pill,\n children: slot.label\n })\n });\n}\n// The copy a submitted slot leaves behind, in the zone's own body style.\nfunction SlotMessageView({\n message,\n align,\n inverse,\n colors\n}) {\n const color = webPopupTextColor('body', colors, inverse);\n return _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.body,\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: webPopupCssTextAlign(align),\n ...(color ? {\n color\n } : {})\n },\n children: message\n });\n}\nconst FORM_INPUT_TYPES = {\n email: 'email',\n phone: 'tel'\n};\nconst FORM_AUTOCOMPLETE = {\n email: 'email',\n firstName: 'given-name',\n lastName: 'family-name',\n phone: 'tel'\n};\n// The privacy-check error renders under the checkbox row; a field key can\n// never collide with it (normalized keys are non-empty slot-local ids).\nconst PRIVACY_ERROR_KEY = '__privacy';\n/**\n * An email-subscription form slot: the fields, the consent row and the\n * submit pill, all popup-styled. Local state machine: idle → submitting →\n * success/confirm (the form swaps to the slot's message) or error (the form\n * stays, a generic retryable note appears). Without an onSubmitForm handler\n * or a bound formCode the form is inert — inputs type, submit does nothing —\n * which is exactly what previews and the editor canvas want.\n */\nfunction FormSlotView({\n slot,\n align,\n inverse,\n colors,\n onSubmitForm\n}) {\n const [values, setValues] = useState({});\n const [policyAccepted, setPolicyAccepted] = useState(false);\n const [focusedKey, setFocusedKey] = useState(null);\n const [errors, setErrors] = useState({});\n const [phase, setPhase] = useState('idle');\n const captionColor = webPopupTextColor('caption', colors, inverse);\n const captionStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(captionColor ? {\n color: captionColor\n } : {})\n };\n const errorStyle = {\n fontSize: 12,\n lineHeight: 1.4,\n color: colors.error,\n paddingTop: 2\n };\n if (phase === 'success' || phase === 'confirm') {\n return _jsx(SlotMessageView, {\n message: phase === 'confirm' ? slot.confirmEmailMessage : slot.successMessage,\n align: align,\n inverse: inverse,\n colors: colors\n });\n }\n const setFieldValue = (key, value) => {\n setValues(prev => ({\n ...prev,\n [key]: value\n }));\n setErrors(prev => prev[key] ? Object.fromEntries(Object.entries(prev).filter(([k]) => k !== key)) : prev);\n };\n const submit = () => {\n if (!onSubmitForm || !slot.formCode || phase === 'submitting') return;\n const found = {};\n for (const field of slot.fields) {\n const value = (values[field.key] ?? '').trim();\n if (field.required && !value) found[field.key] = 'Required';else if (field.kind === 'email' && value && !WEB_POPUP_EMAIL_PATTERN.test(value)) {\n found[field.key] = 'Enter a valid email';\n }\n }\n if (slot.privacy && !policyAccepted) found[PRIVACY_ERROR_KEY] = 'Please accept the privacy policy';\n setErrors(found);\n if (Object.keys(found).length > 0) return;\n const payload = {\n email: '',\n policyAccepted: slot.privacy ? policyAccepted : true\n };\n const customFields = {};\n for (const field of slot.fields) {\n const value = (values[field.key] ?? '').trim();\n if (!value) continue;\n if (field.kind === 'email') payload.email = payload.email || value;else if (field.kind === 'firstName') payload.firstName = value;else if (field.kind === 'lastName') payload.lastName = value;else if (field.kind === 'phone') payload.phone = value;else customFields[field.tag || field.key] = value;\n }\n if (Object.keys(customFields).length > 0) payload.customFields = customFields;\n setPhase('submitting');\n // Promise.resolve wrapper: a host callback that throws SYNCHRONOUSLY\n // (before returning its promise) must land in the error phase too — a\n // bare .then(ok, fail) would let the throw escape and strand the form\n // in 'submitting' with no way back.\n Promise.resolve().then(() => onSubmitForm(slot.formCode, payload)).then(result => setPhase(result === 'confirm-email' ? 'confirm' : 'success'), () => setPhase('error'));\n };\n const submitting = phase === 'submitting';\n const privacyHref = slot.privacy ? safeUrl(slot.privacy.url) : undefined;\n const pill = {\n ...webPopupButtonPillStyle(slot.submitVariant, colors),\n ...(submitting ? {\n opacity: 0.6,\n cursor: 'default'\n } : {})\n };\n return _jsxs(\"form\", {\n noValidate: true,\n style: {\n margin: 0,\n textAlign: 'start'\n },\n onSubmit: event => {\n event.preventDefault();\n submit();\n },\n children: [slot.fields.map(field => {\n const error = errors[field.key];\n let borderColor;\n if (error) borderColor = colors.error;else if (focusedKey === field.key) borderColor = colors.accent;\n return _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [field.label && _jsx(\"div\", {\n style: {\n ...captionStyle,\n paddingBottom: 4\n },\n children: field.label\n }), _jsx(\"input\", {\n type: FORM_INPUT_TYPES[field.kind] ?? 'text',\n autoComplete: FORM_AUTOCOMPLETE[field.kind],\n placeholder: field.placeholder || undefined,\n value: values[field.key] ?? '',\n disabled: submitting,\n style: webPopupFormInputStyle(colors, borderColor),\n onFocus: () => setFocusedKey(field.key),\n onBlur: () => setFocusedKey(key => key === field.key ? null : key),\n onChange: event => setFieldValue(field.key, event.currentTarget.value)\n }), error && _jsx(\"div\", {\n style: errorStyle,\n children: error\n })]\n }, field.key);\n }), slot.privacy && _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [_jsxs(\"label\", {\n style: {\n ...captionStyle,\n display: 'flex',\n alignItems: 'flex-start',\n gap: 8,\n cursor: 'pointer'\n },\n children: [_jsx(\"input\", {\n type: \"checkbox\",\n checked: policyAccepted,\n disabled: submitting,\n style: {\n margin: '2px 0 0',\n flexShrink: 0\n },\n onChange: event => {\n setPolicyAccepted(event.currentTarget.checked);\n setErrors(prev => prev[PRIVACY_ERROR_KEY] ? Object.fromEntries(Object.entries(prev).filter(([k]) => k !== PRIVACY_ERROR_KEY)) : prev);\n }\n }), _jsxs(\"span\", {\n children: [slot.privacy.checkboxLabel, privacyHref && _jsxs(_Fragment, {\n children: [' ', _jsx(\"a\", {\n href: privacyHref,\n ...webPopupLinkTargetAttrs(undefined),\n style: {\n color: colors.accent\n },\n children: slot.privacy.linkLabel || slot.privacy.url\n })]\n })]\n })]\n }), errors[PRIVACY_ERROR_KEY] && _jsx(\"div\", {\n style: errorStyle,\n children: errors[PRIVACY_ERROR_KEY]\n })]\n }), _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n },\n children: _jsx(\"button\", {\n type: \"submit\",\n disabled: submitting,\n style: pill,\n children: slot.submitLabel\n })\n }), phase === 'error' && _jsx(\"div\", {\n style: {\n ...errorStyle,\n textAlign: webPopupCssTextAlign(align)\n },\n children: WEB_POPUP_RETRY_ERROR\n })]\n });\n}\n// The phase-2 slots. The two that submit follow the form slot's rules exactly:\n// inert without a callback, idle → submitting → success/error, then its copy.\n// One cell of the countdown: the digits over their unit label.\nfunction TimerCell({\n value,\n label,\n digitStyle,\n labelStyle\n}) {\n return _jsxs(\"div\", {\n style: {\n minWidth: 44\n },\n children: [_jsx(\"div\", {\n style: digitStyle,\n children: String(value).padStart(2, '0')\n }), label ? _jsx(\"div\", {\n style: labelStyle,\n children: label\n }) : null]\n });\n}\nfunction TimerSlotView({\n slot,\n align,\n inverse,\n colors,\n mode,\n onRequestClose,\n onPageChange\n}) {\n const [nowMs, setNowMs] = useState(() => Date.now());\n const remaining = webPopupTimerRemaining(slot.endTime, slot.timezone, nowMs);\n const expired = remaining.total === 0;\n // 'preview' draws a still frame: a gallery is many popups at once, and every\n // one of them would tick. A finished countdown stops on its own.\n useEffect(() => {\n if (mode !== 'live' || expired) return undefined;\n const id = setInterval(() => setNowMs(Date.now()), 1000);\n return () => clearInterval(id);\n }, [mode, expired, slot.endTime, slot.timezone]);\n // Past the deadline, the slot does what it was told. 'hide-popup' gets here\n // only for a popup left open ACROSS its deadline (the host gates the rest).\n useEffect(() => {\n if (mode !== 'live' || !expired) return;\n if (slot.onExpire === 'hide-popup') onRequestClose?.();else if (slot.onExpire === 'page' && slot.expirePage) onPageChange(slot.expirePage);\n }, [mode, expired, slot.onExpire, slot.expirePage, onRequestClose, onPageChange]);\n const digitColor = webPopupTextColor('h2', colors, inverse);\n const labelColor = webPopupTextColor('caption', colors, inverse);\n const digitStyle = {\n fontSize: 28,\n fontWeight: 700,\n lineHeight: 1.2,\n // Tabular figures: without them every second reflows the row.\n fontVariantNumeric: 'tabular-nums',\n ...(digitColor ? {\n color: digitColor\n } : {})\n };\n const labelStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(labelColor ? {\n color: labelColor\n } : {})\n };\n const labels = webPopupTimerLabels(slot.language);\n const cells = [{\n value: remaining.days,\n label: labels.days\n }, {\n value: remaining.hours,\n label: labels.hours\n }, {\n value: remaining.minutes,\n label: labels.minutes\n }, {\n value: remaining.seconds,\n label: labels.seconds\n }];\n return _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: webPopupCssTextAlign(align)\n },\n children: _jsx(\"div\", {\n style: {\n display: 'inline-flex',\n gap: 12,\n textAlign: 'center'\n },\n children: cells.map(cell => _jsx(TimerCell, {\n value: cell.value,\n label: slot.showLabels ? cell.label : '',\n digitStyle: digitStyle,\n labelStyle: labelStyle\n }, cell.label || cell.value))\n })\n });\n}\nfunction ChoiceSlotView({\n slot,\n align,\n inverse,\n colors,\n onSubmitChoice\n}) {\n const [picked, setPicked] = useState([]);\n const [phase, setPhase] = useState('idle');\n const [notice, setNotice] = useState('');\n if (phase === 'success') {\n return _jsx(SlotMessageView, {\n message: slot.successMessage,\n align: align,\n inverse: inverse,\n colors: colors\n });\n }\n const toggle = value => {\n setNotice('');\n setPicked(prev => {\n if (prev.includes(value)) return prev.filter(entry => entry !== value);\n // At the ceiling the extra tap is refused with a reason rather than\n // silently dropping the oldest pick.\n if (slot.max > 0 && prev.length >= slot.max) {\n setNotice(`Pick up to ${slot.max}`);\n return prev;\n }\n return [...prev, value];\n });\n };\n const submit = () => {\n if (!onSubmitChoice || !slot.tagName || phase === 'submitting') return;\n // An empty submit would CLEAR the tag — never what a \"save\" button means.\n const floor = Math.max(slot.min, 1);\n if (picked.length < floor) {\n setNotice(floor === 1 ? 'Pick at least one' : `Pick at least ${floor}`);\n return;\n }\n const values = slot.options.filter(option => picked.includes(option.value)).map(option => option.tagValue || option.value);\n setNotice('');\n setPhase('submitting');\n // Promise.resolve wrapper: a host callback that throws SYNCHRONOUSLY must\n // land in the error phase too, not escape and strand the slot.\n Promise.resolve().then(() => onSubmitChoice({\n slotKey: slot.key,\n tagName: slot.tagName,\n values\n })).then(() => setPhase('success'), () => setPhase('error'));\n };\n const submitting = phase === 'submitting';\n const textColor = webPopupTextColor('body', colors, inverse);\n const optionStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.body,\n ...(textColor ? {\n color: textColor\n } : {})\n };\n const chip = selected => ({\n padding: '6px 14px',\n borderRadius: 999,\n border: `1px solid ${colors.accent}`,\n backgroundColor: selected ? colors.accent : 'transparent',\n color: selected ? colors.onAccent : colors.accent,\n fontFamily: 'inherit',\n fontSize: 14,\n lineHeight: 1.4,\n cursor: 'pointer'\n });\n return _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [slot.control === 'chips' ? _jsx(\"div\", {\n style: {\n display: 'flex',\n flexWrap: 'wrap',\n gap: 8,\n justifyContent: align === 'center' ? 'center' : 'flex-start'\n },\n children: slot.options.map(option => _jsx(\"button\", {\n type: \"button\",\n \"aria-pressed\": picked.includes(option.value),\n style: chip(picked.includes(option.value)),\n onClick: () => toggle(option.value),\n children: option.label\n }, option.value))\n }) : _jsx(\"div\", {\n style: {\n display: 'grid',\n gap: 6\n },\n children: slot.options.map(option => _jsxs(\"label\", {\n style: {\n ...optionStyle,\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n cursor: 'pointer'\n },\n children: [_jsx(\"input\", {\n type: \"checkbox\",\n checked: picked.includes(option.value),\n onChange: () => toggle(option.value),\n style: {\n accentColor: colors.accent,\n width: 16,\n height: 16,\n margin: 0\n }\n }), option.label]\n }, option.value))\n }), notice ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n color: colors.error,\n paddingTop: 4\n },\n children: notice\n }) : null, phase === 'error' ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n color: colors.error,\n paddingTop: 4\n },\n children: WEB_POPUP_RETRY_ERROR\n }) : null, _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n },\n children: _jsx(\"button\", {\n type: \"button\",\n style: {\n ...webPopupButtonPillStyle(slot.submitVariant, colors),\n ...(submitting ? {\n opacity: 0.7\n } : {})\n },\n onClick: submit,\n children: slot.submitLabel\n })\n })]\n });\n}\n// One rating button: a number for nps, a star for stars, a thumb for thumbs.\nfunction RatingButton({\n score,\n scale,\n selected,\n colors,\n onPick\n}) {\n const base = {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: 0,\n border: `1px solid ${colors.accent}`,\n backgroundColor: selected ? colors.accent : 'transparent',\n color: selected ? colors.onAccent : colors.accent,\n fontFamily: 'inherit',\n fontSize: 14,\n lineHeight: 1,\n cursor: 'pointer'\n };\n if (scale === 'nps') {\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": `Rate ${score}`,\n \"aria-pressed\": selected,\n style: {\n ...base,\n width: 30,\n height: 32,\n borderRadius: 6\n },\n onClick: onPick,\n children: score\n });\n }\n const thumbs = scale === 'thumbs';\n // Icon-only buttons need a name of their own; the nps row says it in text.\n let label = `Rate ${score}`;\n if (thumbs) label = score === 1 ? 'Thumbs up' : 'Thumbs down';\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": label,\n \"aria-pressed\": selected,\n style: {\n ...base,\n width: thumbs ? 44 : 34,\n height: thumbs ? 40 : 34,\n borderRadius: thumbs ? 8 : 6\n },\n onClick: onPick,\n children: _jsx(\"svg\", {\n width: thumbs ? 22 : 20,\n height: thumbs ? 22 : 20,\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": \"true\",\n children: _jsx(\"path\", {\n d: thumbs ? WEB_POPUP_THUMB_UP_PATH : WEB_POPUP_GLYPH_PATHS.star,\n ...(thumbs && score === 0 ? {\n transform: 'rotate(180 12 12)'\n } : {})\n })\n })\n });\n}\nfunction RatingSlotView({\n slot,\n align,\n inverse,\n colors,\n onSubmitRating\n}) {\n const [score, setScore] = useState(null);\n const [phase, setPhase] = useState('idle');\n if (phase === 'success') {\n return _jsx(SlotMessageView, {\n message: slot.successMessage,\n align: align,\n inverse: inverse,\n colors: colors\n });\n }\n const send = value => {\n if (!onSubmitRating || !slot.eventName || phase === 'submitting') return;\n setPhase('submitting');\n // See ChoiceSlotView: a synchronous throw must land in 'error' too.\n Promise.resolve().then(() => onSubmitRating({\n slotKey: slot.key,\n eventName: slot.eventName,\n score: value,\n scale: slot.scale\n })).then(() => setPhase('success'), () => setPhase('error'));\n };\n const pick = value => {\n // Same guard as `send`: otherwise a tap during an in-flight submit moves the\n // highlight while the host keeps the score that was actually sent.\n if (phase === 'submitting') return;\n setScore(value);\n if (slot.submitMode === 'instant') send(value);\n };\n const scores = webPopupRatingScores(slot.scale);\n const labelColor = webPopupTextColor('caption', colors, inverse);\n const edgeLabelStyle = {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n ...(labelColor ? {\n color: labelColor\n } : {})\n };\n // A star scale fills every button up to the pick — the row IS the score.\n const isSelected = value => slot.scale === 'stars' ? score !== null && value <= score : score === value;\n return _jsxs(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING\n },\n children: [_jsx(\"div\", {\n style: {\n display: 'flex',\n flexWrap: 'wrap',\n gap: 6,\n justifyContent: align === 'center' ? 'center' : 'flex-start'\n },\n children: scores.map(value => _jsx(RatingButton, {\n score: value,\n scale: slot.scale,\n selected: isSelected(value),\n colors: colors,\n onPick: () => pick(value)\n }, value))\n }), slot.labels.low || slot.labels.high ? _jsxs(\"div\", {\n style: {\n display: 'flex',\n justifyContent: 'space-between',\n gap: 8,\n paddingTop: 4\n },\n children: [_jsx(\"span\", {\n style: edgeLabelStyle,\n children: slot.labels.low\n }), _jsx(\"span\", {\n style: edgeLabelStyle,\n children: slot.labels.high\n })]\n }) : null, phase === 'error' ? _jsx(\"div\", {\n style: {\n ...WEB_POPUP_TEXT_VARIANT_STYLES.caption,\n color: colors.error,\n paddingTop: 4\n },\n children: WEB_POPUP_RETRY_ERROR\n }) : null, slot.submitMode === 'button' ? _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_BUTTON_SLOT_PADDING\n },\n children: _jsx(\"button\", {\n type: \"button\",\n style: {\n ...webPopupButtonPillStyle('primary', colors),\n ...(phase === 'submitting' ? {\n opacity: 0.7\n } : {})\n },\n onClick: () => score === null ? undefined : send(score),\n children: slot.submitLabel\n })\n }) : null]\n });\n}\nfunction GlyphSlotView({\n slot,\n align,\n inverse,\n colors\n}) {\n // No authored color: the accent, or the inverse copy color over a dark image\n // (where the accent can be the one thing that doesn't read).\n const color = slot.color || (inverse ? colors.textInverse : colors.accent);\n return _jsx(\"div\", {\n style: {\n padding: WEB_POPUP_TEXT_SLOT_PADDING,\n textAlign: webPopupCssTextAlign(align),\n lineHeight: 0\n },\n children: _jsx(\"svg\", {\n width: slot.size,\n height: slot.size,\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: color,\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": \"true\",\n style: {\n display: 'inline-block'\n },\n children: _jsx(\"path\", {\n d: WEB_POPUP_GLYPH_PATHS[slot.name]\n })\n })\n });\n}\n// A switch, not a chain of `&&`: the compiler is what notices a slot type with\n// no view. Exported so the editor canvas draws these slots with it, not a copy.\nexport function WebPopupSlotView({\n slot,\n align,\n inverse,\n colors,\n mode = 'live',\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitChoice,\n onSubmitRating,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n // A page jump nobody handles is a no-op, not a crash — the editor canvas\n // and the previews mount this without any navigation of their own.\n const pageChange = onPageChange ?? (() => {});\n switch (slot.type) {\n case 'text':\n return _jsx(TextSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors\n });\n case 'button':\n return _jsx(ButtonSlotView, {\n slot: slot,\n colors: colors,\n onRequestClose: onRequestClose,\n onPageChange: pageChange,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n });\n case 'email-subscription-form':\n return _jsx(FormSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n onSubmitForm: onSubmitForm\n });\n case 'timer':\n return _jsx(TimerSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n mode: mode,\n onRequestClose: onRequestClose,\n onPageChange: pageChange\n });\n case 'choice':\n return _jsx(ChoiceSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n onSubmitChoice: onSubmitChoice\n });\n case 'rating':\n return _jsx(RatingSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n onSubmitRating: onSubmitRating\n });\n case 'glyph':\n return _jsx(GlyphSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors\n });\n case 'products':\n return _jsx(ProductsSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors,\n mode: mode\n });\n case 'email-input':\n return _jsx(EmailInputSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors\n });\n case 'tag-input':\n return _jsx(TagInputSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors\n });\n case 'consent':\n return _jsx(ConsentSlotView, {\n slot: slot,\n inverse: inverse,\n colors: colors\n });\n case 'submit':\n return _jsx(SubmitSlotView, {\n slot: slot,\n align: align,\n colors: colors\n });\n }\n}\n// A Content leaf: the named zone's slots (texts, buttons and forms in order)\n// as a grid stack. An unknown zone key renders as an empty spot, not a crash.\nfunction ContentNodeView({\n node,\n page,\n colors,\n mode,\n leaf,\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitChoice,\n onSubmitRating,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n const zone = page.contents.find(z => z.key === node.props.content);\n if (!zone) return null;\n if (leaf?.renderZone) {\n return _jsx(\"div\", {\n style: {\n minWidth: 0\n },\n children: leaf.renderZone(zone, node)\n });\n }\n const align = node.props.align ?? 'left';\n const inverse = node.props.tone === 'inverse';\n return _jsx(\"div\", {\n style: {\n minWidth: 0\n },\n children: zone.slots.map((slot, index) => {\n const previous = zone.slots[index - 1];\n const marginTop = previous ? webPopupSlotGap(webPopupSlotRole(previous), webPopupSlotRole(slot)) : 0;\n return _jsx(\"div\", {\n style: marginTop ? {\n marginTop\n } : undefined,\n children: _jsx(WebPopupSlotView, {\n slot: slot,\n align: align,\n inverse: inverse,\n colors: colors,\n mode: mode,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange,\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n })\n }, slot.key);\n })\n });\n}\n// The playable url of a media param, or undefined when it has no video.\nfunction mediaVideoSrc(image) {\n return image?.video ? safeUrl(image.video.src) : undefined;\n}\n// A media param's video: autoplay only muted, playsInline to keep iOS out of\n// fullscreen, and in 'preview' it holds on the poster instead of streaming.\nfunction MediaVideo({\n image,\n poster,\n src,\n style,\n mode\n}) {\n return _jsx(\"video\", {\n src: src,\n poster: poster || undefined,\n style: style,\n autoPlay: mode === 'live',\n muted: true,\n playsInline: true,\n preload: \"metadata\",\n loop: image.video?.loop !== false,\n controls: image.video?.controls === true\n });\n}\nfunction ImageNodeView({\n node,\n page,\n leaf,\n mode,\n scheme\n}) {\n const image = page.images.find(i => i.key === node.props.image);\n if (!image) return null;\n // The override sees srcless params too — an editor wants a placeholder\n // where the runtime shows nothing.\n if (leaf?.renderImage) return _jsx(_Fragment, {\n children: leaf.renderImage(image, node)\n });\n const video = mediaVideoSrc(image);\n const src = webPopupImageSrc(image, scheme);\n if (!src && !video) return null;\n const style = {\n display: 'block',\n width: '100%',\n minWidth: 0\n };\n if (image.fit) {\n style.height = '100%';\n style.objectFit = image.fit;\n } else {\n style.height = 'auto';\n }\n if (image.blur) style.filter = `blur(${image.blur}px)`;\n if (video) {\n return _jsx(MediaVideo, {\n image: image,\n poster: src,\n src: video,\n style: style,\n mode: mode\n });\n }\n return _jsx(\"img\", {\n src: src,\n alt: \"\",\n style: style\n });\n}\n// Both layered backgrounds (blur, video) share this shell: the color/poster\n// paints on an outer grid box, the content rides an inner layer covering it.\nfunction LayeredBackgroundBox({\n style,\n outer,\n inner,\n layer,\n children\n}) {\n const {\n backgroundColor,\n ...rest\n } = style;\n return _jsxs(\"div\", {\n style: {\n display: 'grid',\n minWidth: 0,\n backgroundColor,\n ...outer\n },\n children: [layer, _jsx(\"div\", {\n style: {\n ...rest,\n ...inner\n },\n children: children\n })]\n });\n}\n// The tree interpreter: containers → grid divs, leaves → zone/image views.\nfunction LayoutNodeView({\n node,\n page,\n colors,\n mode,\n scheme,\n leaf,\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitChoice,\n onSubmitRating,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n if (node.type === 'Content') {\n return _jsx(ContentNodeView, {\n node: node,\n page: page,\n colors: colors,\n mode: mode,\n scheme: scheme,\n leaf: leaf,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange,\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n });\n }\n if (node.type === 'Image') {\n return _jsx(ImageNodeView, {\n node: node,\n page: page,\n leaf: leaf,\n mode: mode,\n scheme: scheme\n });\n }\n const bgKey = node.props?.backgroundImage;\n const background = bgKey ? page.images.find(i => i.key === bgKey) : undefined;\n const blur = background?.blur ?? 0;\n const dim = background?.dim ?? 0;\n const bgVideo = mediaVideoSrc(background);\n const bgSrc = background ? webPopupImageSrc(background, scheme) : undefined;\n const style = webPopupContainerStyle(node, blur > 0 || bgVideo ? undefined : bgSrc || undefined, dim);\n if (bgKey) style.backgroundColor = WEB_POPUP_BG_SECTION_FALLBACK;\n const children = node.children.map((child, index) => _jsx(LayoutNodeView\n // Layout nodes are static per page render — positional keys are fine.\n , {\n node: child,\n page: page,\n colors: colors,\n mode: mode,\n scheme: scheme,\n leaf: leaf,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange,\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n }, index));\n if (bgVideo && background) {\n // A background video can't ride the css background property, so it paints\n // as its own layer; the scrim moves onto the content layer above it.\n const scrim = webPopupScrimGradient(dim);\n return _jsx(LayeredBackgroundBox, {\n style: style,\n outer: {\n position: 'relative',\n overflow: 'hidden',\n ...(bgSrc ? webPopupBackgroundImageStyle(bgSrc) : {})\n },\n inner: {\n position: 'relative',\n ...(scrim ? {\n backgroundImage: scrim\n } : {})\n },\n layer: _jsx(MediaVideo, {\n image: background,\n poster: bgSrc ?? '',\n src: bgVideo,\n mode: mode,\n style: {\n position: 'absolute',\n inset: 0,\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n ...(blur > 0 ? {\n filter: `blur(${blur}px)`\n } : {})\n }\n }),\n children: children\n });\n }\n if (blur > 0) {\n // backdrop-filter blurs what's painted BEHIND its element, never the\n // element's own background — so the image paints on an outer box and the\n // laid-out content rides an inner blurring layer covering it edge to\n // edge (grid/padding move onto that layer). The outer box is a grid so\n // a stretched height (a 'stretch' page's root) passes through to the\n // layer actually carrying alignContent.\n return _jsx(LayeredBackgroundBox, {\n style: style,\n outer: bgSrc ? webPopupBackgroundImageStyle(bgSrc, dim) : undefined,\n inner: {\n backdropFilter: `blur(${blur}px)`,\n WebkitBackdropFilter: `blur(${blur}px)`\n },\n children: children\n });\n }\n return _jsx(\"div\", {\n style: style,\n children: children\n });\n}\n// The popup box: the shared chrome (background, radius, shadow) around one\n// resolved page's layout tree. Exported for the editor — its canvas is this\n// very interpreter with `leafRenderers` swapping the Content/Image leaves\n// for editable views (the container interpretation stays this component's,\n// which is what keeps the canvas true to the runtime); the viewport chrome\n// (placement, overlay, enter animation) is the caller's business there.\n// After a page switch (`animatePage`) the incoming content fades in — keyed\n// by page so the animation restarts per switch — and an explicit px height\n// glides via the transition (auto heights just snap).\nexport function WebPopupBox({\n page,\n params,\n mode = 'live',\n colorScheme = 'light',\n leafRenderers,\n animatePage = false,\n onRequestClose,\n onPageChange,\n onSubmitForm,\n onSubmitFormValues,\n onSubmitChoice,\n onSubmitRating,\n products,\n onRequestSubscribe,\n onSubscribeClose,\n logger\n}) {\n const formSession = useWebPopupFormSession(params, page.key, onPageChange, onSubmitFormValues);\n const subscribeSession = useWebPopupSubscribeSession();\n const colors = resolveWebPopupColors(params, colorScheme);\n const box = resolveWebPopupBoxChrome(params, colorScheme);\n const dir = useMemo(() => webPopupDirection(params), [params]);\n const style = {\n position: 'relative',\n boxSizing: 'border-box',\n overflow: 'hidden',\n backgroundColor: colors.background,\n colorScheme: colors.scheme,\n fontFamily: WEB_POPUP_FONT_STACK,\n color: colors.text,\n borderRadius: params.borderRadius > 0 ? params.borderRadius : undefined,\n boxShadow: box.boxShadow && box.boxShadow !== 'none' ? box.boxShadow : undefined,\n transition: `height ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease`\n };\n if (page.height) {\n // 'stretch' fills whatever box the caller gives (the fixed container pins\n // both vertical edges in live mode); a px height is the box's own.\n style.height = page.height === 'stretch' ? '100%' : page.height;\n style.overflowY = 'auto';\n }\n // A stretch page's tree gets the full box height to lay out in: the\n // min-height'd single-track grid stretches the root container, so its\n // alignContent can place the content vertically (a px height keeps the\n // pre-stretch behavior — content flows from the top).\n const pageStyle = {\n ...(animatePage ? {\n animation: `pw-vpopup-page ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease-out backwards`\n } : {}),\n ...(page.height === 'stretch' ? {\n display: 'grid',\n minHeight: '100%'\n } : {})\n };\n return _jsx(\"div\", {\n dir: dir,\n style: style,\n children: _jsx(WebPopupFormSessionContext.Provider, {\n value: formSession,\n children: _jsx(WebPopupProductsContext.Provider, {\n value: products,\n children: _jsx(WebPopupSubscribeContext.Provider, {\n value: subscribeSession,\n children: _jsx(\"div\", {\n style: pageStyle,\n children: _jsx(LayoutNodeView, {\n node: page.layout,\n page: page,\n colors: colors,\n mode: mode,\n scheme: colors.scheme,\n leaf: leafRenderers,\n onRequestClose: onRequestClose,\n onPageChange: onPageChange ?? (() => {}),\n onSubmitForm: onSubmitForm,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onSubscribeClose,\n logger: logger\n })\n }, page.key)\n })\n })\n })\n });\n}\nfunction CloseButton({\n colors,\n onRequestClose\n}) {\n return _jsx(\"button\", {\n type: \"button\",\n \"aria-label\": \"Close\",\n [WEB_POPUP_CLOSE_ATTRIBUTE]: '',\n onClick: onRequestClose,\n style: {\n position: 'absolute',\n top: 10,\n insetInlineEnd: 10,\n width: 24,\n height: 24,\n padding: 0,\n border: 'none',\n borderRadius: '50%',\n background: webPopupColorAlpha(colors.surface, 0.92),\n boxShadow: '0 1px 3px rgba(16, 24, 40, 0.25)',\n color: colors.chromeIcon,\n fontSize: 13,\n lineHeight: 1,\n cursor: 'pointer'\n },\n children: \"\\u2715\"\n });\n}\n// Fixed viewport placement from the placement param: anchored edges get the\n// offset, unanchored axes center via translate. No width = stretch between\n// the side gutters; height 'stretch' = pinned to both vertical edges the same\n// way. The size is the ACTIVE page's (resolved page ?? chrome), so the box\n// re-anchors itself when a page switch changes it.\nfunction fixedContainerStyle(params, width, height, room = {\n side: 0,\n top: 0\n}) {\n const sideOffset = params.placement.offset + room.side;\n const topOffset = params.placement.offset + room.top;\n const placement = params.placement;\n const style = {\n position: 'fixed',\n boxSizing: 'border-box',\n maxWidth: room.side ? `calc(100% - ${sideOffset * 2}px)` : placementMaxSize(placement),\n maxHeight: room.top ? `calc(100% - ${placement.offset * 2 + room.top}px)` : placementMaxSize(placement),\n // The widget host is pointer-transparent (a corner banner must not block\n // the page); the popup itself takes clicks back.\n pointerEvents: 'auto'\n };\n if (width) {\n style.width = width;\n const h = placement.h;\n if (h === 'left') style.left = sideOffset;else if (h === 'right') style.right = sideOffset;else style.left = '50%';\n } else {\n // Stretch: pin both side edges regardless of the horizontal anchor.\n style.left = sideOffset;\n style.right = sideOffset;\n }\n if (height === 'stretch') {\n // Stretch: pin both vertical edges; the v anchor has nothing to place.\n style.top = topOffset;\n style.bottom = placement.offset;\n } else if (placement.v === 'top') style.top = topOffset;else if (placement.v === 'bottom') style.bottom = placement.offset;else style.top = '50%';\n const tx = width && placement.h === 'center' ? '-50%' : '0';\n const ty = placement.v === 'middle' && height !== 'stretch' ? '-50%' : '0';\n if (tx !== '0' || ty !== '0') style.transform = `translate(${tx}, ${ty})`;\n const anim = ANIMATION_STYLE[params.animation];\n if (anim) style.animation = anim;\n // A page switch that changes the (explicit) width glides instead of\n // jumping; the anchored edges keep the box pinned while it resizes.\n style.transition = `width ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease`;\n return style;\n}\nexport function WebPopupReader({\n params,\n mode = 'live',\n colorScheme = 'auto',\n onRequestClose,\n onSubmitForm,\n onSubmitFormValues,\n onSubmitChoice,\n onSubmitRating,\n products,\n onRequestSubscribe,\n logger,\n leafRenderers\n}) {\n // null = never navigated: show the start page. Guarded against keys that\n // don't exist (anymore) — an edited/older document falls back gracefully.\n const [pageKey, setPageKey] = useState(null);\n // Only the active page's images are in the DOM — the rest would start\n // downloading on the page switch, leaving the previous picture on screen\n // until the new one arrives. Warm the browser cache for every page up front.\n useEffect(() => {\n resolveWebPopupPages(params).forEach(p => p.images.forEach(({\n src,\n srcDark\n }) => {\n [src, srcDark].forEach(url => {\n if (url) new Image().src = url;\n });\n }));\n }, [params]);\n const scheme = useColorScheme(colorScheme, webPopupDarkEnabled(params));\n const dir = useMemo(() => webPopupDirection(params), [params]);\n const hoverCapable = useWebPopupHoverCapable();\n const {\n revealed,\n handlers: revealHandlers\n } = useWebPopupReveal();\n const pages = resolveWebPopupPages(params);\n if (pages.length === 0) return null;\n const page = pages.find(p => p.key === pageKey) ?? startPageOf(params, pages);\n // null = the initial page: entry is the chrome's business (the enter\n // animation in live mode); the page fade only plays on actual switches.\n const animatePage = pageKey !== null;\n if (mode === 'preview') {\n return _jsxs(\"div\", {\n style: {\n position: 'relative',\n width: page.width ?? '100%',\n transition: `width ${WEB_POPUP_PAGE_TRANSITION_MS}ms ease`\n },\n children: [_jsx(\"style\", {\n children: WEB_POPUP_KEYFRAMES\n }), _jsx(WebPopupBox, {\n page: page,\n params: params,\n mode: mode,\n colorScheme: scheme,\n leafRenderers: leafRenderers,\n animatePage: animatePage,\n onRequestClose: onRequestClose,\n onPageChange: setPageKey,\n onSubmitForm: onSubmitForm,\n onSubmitFormValues: onSubmitFormValues,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n products: products,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onRequestClose,\n logger: logger\n })]\n });\n }\n const {\n overlay\n } = resolveWebPopupBoxChrome(params, scheme);\n const colors = resolveWebPopupColors(params, scheme);\n const reveal = resolveWebPopupReveal(params, pages);\n const room = webPopupRevealRoom(reveal, hoverCapable);\n return _jsxs(_Fragment, {\n children: [_jsx(\"style\", {\n children: WEB_POPUP_KEYFRAMES\n }), overlay && _jsx(\"div\", {\n style: {\n position: 'fixed',\n inset: 0,\n backgroundColor: overlay.color,\n opacity: overlay.opacity,\n animation: 'pw-vpopup-overlay 0.2s ease-out backwards',\n pointerEvents: 'auto'\n },\n onClick: onRequestClose\n }), _jsxs(\"div\", {\n dir: dir,\n style: fixedContainerStyle(params, page.width, page.height, room),\n ...revealHandlers,\n children: [hoverCapable && _jsx(WebPopupRevealControls, {\n page: page,\n reveal: reveal,\n colors: colors,\n revealed: revealed,\n onPageChange: setPageKey,\n onRequestClose: onRequestClose\n }), _jsx(WebPopupBox, {\n page: page,\n params: params,\n mode: mode,\n colorScheme: scheme,\n leafRenderers: leafRenderers,\n animatePage: animatePage,\n onRequestClose: onRequestClose,\n onPageChange: setPageKey,\n onSubmitForm: onSubmitForm,\n onSubmitFormValues: onSubmitFormValues,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n products: products,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onRequestClose,\n logger: logger\n }), !(hoverCapable && reveal.slideOutClose) && _jsx(CloseButton, {\n colors: colors,\n onRequestClose: onRequestClose\n })]\n })]\n });\n}","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { useMemo, useState } from 'react';\nimport { useColorScheme } from './colorScheme';\nimport { resolveWebPopupPages, startPageOf, webPopupParamsWithoutCloseButtons } from './helpers';\nimport { webPopupDarkEnabled } from './palette';\nimport { WEB_POPUP_INLINE_IMAGE_CAP_CSS, WEB_POPUP_INLINE_SCOPE_ATTRIBUTE, WEB_POPUP_INLINE_WRAPPER_STYLE } from './styles';\nimport { WebPopupBox } from './WebPopupReader';\n/**\n * An Inline (EMBEDDED) block: one page box at its container's full width (the page width is ignored),\n * without ✕ and, unless the host passes onRequestClose, without close-action buttons. A subscribe answer removes it through onRequestRemove.\n * `<img>` is capped by a `<style>` scoped to the wrapper's attribute, so the rule never reaches\n * the host page, in a shadow root or in the light DOM. Page navigation is internal.\n */\nexport function WebPopupInline({\n params,\n mode = 'live',\n colorScheme = 'auto',\n logger,\n onSubmitForm,\n onSubmitFormValues,\n onSubmitChoice,\n onSubmitRating,\n products,\n onRequestSubscribe,\n onRequestRemove,\n onRequestClose\n}) {\n const [pageKey, setPageKey] = useState(null);\n const shown = useMemo(() => onRequestClose ? params : webPopupParamsWithoutCloseButtons(params), [params, onRequestClose]);\n const scheme = useColorScheme(colorScheme, webPopupDarkEnabled(shown));\n const pages = resolveWebPopupPages(shown);\n if (pages.length === 0) return null;\n const page = pages.find(candidate => candidate.key === pageKey) ?? startPageOf(shown, pages);\n return _jsxs(\"div\", {\n [WEB_POPUP_INLINE_SCOPE_ATTRIBUTE]: '',\n style: WEB_POPUP_INLINE_WRAPPER_STYLE,\n children: [_jsx(\"style\", {\n children: WEB_POPUP_INLINE_IMAGE_CAP_CSS\n }), _jsx(WebPopupBox, {\n page: page,\n params: shown,\n mode: mode,\n colorScheme: scheme,\n onRequestClose: onRequestClose,\n onPageChange: setPageKey,\n onSubmitForm: onSubmitForm,\n onSubmitFormValues: onSubmitFormValues,\n onSubmitChoice: onSubmitChoice,\n onSubmitRating: onSubmitRating,\n products: products,\n onRequestSubscribe: onRequestSubscribe,\n onSubscribeClose: onRequestRemove,\n logger: logger\n })]\n });\n}","import { type WebPopupFormSubmitHandler, type WebPopupFormSubmitResult } from '@pushwoosh/websdk-common/web-popups';\n\nimport { SUBSCRIPTION_FORMS_API_URL } from './constants';\nimport { Logger } from '../../core/logger';\n\n// The subscription-form service client for popup-embedded forms\n// (email-subscription-form slots). Same endpoints and payloads the hosted\n// <pushwoosh-subscribe-widget> uses — the popup reader only renders the\n// fields; subscribing an email goes through the service so form stats,\n// double opt-in and tag mapping keep working.\n\nconst SUBMIT_RESULTS: Record<string, WebPopupFormSubmitResult> = {\n SUBMIT_FORM_RESULT_SUBSCRIBED: 'subscribed',\n SUBMIT_FORM_RESULT_CONFIRM_EMAIL: 'confirm-email',\n SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED: 'already-subscribed',\n};\n\nconst formUrl = (formCode: string, action: string): string => (\n `${SUBSCRIPTION_FORMS_API_URL}/forms/code/${encodeURIComponent(formCode)}${action}`\n);\n\n/**\n * The reader's `onSubmitForm` handler: POST the slot's payload to the bound\n * form's submit endpoint. Throws on transport errors and unrecognized\n * results — the form slot shows its generic retryable error then; the\n * reader doesn't log, so the failure is recorded here before rethrowing.\n */\nexport const submitSubscriptionForm: WebPopupFormSubmitHandler = async (formCode, payload) => {\n try {\n const response = await fetch(formUrl(formCode, '/submit'), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n // userId mirrors the hosted widget's convention: same as the email.\n body: JSON.stringify({ ...payload, userId: payload.email }),\n });\n if (!response.ok) {\n throw new Error(`Subscription form submit failed: HTTP ${response.status}`);\n }\n const data = await response.json() as { result?: string };\n const result = SUBMIT_RESULTS[data.result ?? ''];\n if (!result) {\n throw new Error(`Subscription form submit failed: unexpected result \"${data.result}\"`);\n }\n return result;\n } catch (error) {\n Logger.error(error, `Failed to submit subscription form \"${formCode}\"`);\n throw error;\n }\n};\n\n/**\n * Fire-and-forget view stat for a popup-embedded form — the denominator of\n * the form's conversion rate. Never blocks or breaks the popup itself.\n */\nexport const recordSubscriptionFormView = (formCode: string, hwid: string): void => {\n fetch(formUrl(formCode, '/view'), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ code: formCode, userId: hwid, hwid }),\n }).catch((error) => {\n Logger.error(error, `Failed to record subscription form view for \"${formCode}\"`);\n });\n};\n","import { type WebPopupLogger } from '@pushwoosh/websdk-common/web-popups';\n\nimport { WEB_POPUPS_LOG_PREFIX } from './constants';\nimport { Logger } from '../../core/logger';\n\n// Logger has no warn level; error keeps the renderer's reasons visible at the default log level.\nexport const webPopupLogger: WebPopupLogger = {\n warn: (message) => Logger.error(WEB_POPUPS_LOG_PREFIX, message),\n};\n","import { type WebPopupParams } from '@pushwoosh/websdk-common/web-popups';\n\nimport {\n EMBEDDED_DISMISS_ATTRIBUTE, EMBEDDED_ORDER_ATTRIBUTE, WEB_POPUPS_LOG_PREFIX, WEB_POPUPS_WIDGET_NAMESPACE,\n} from './constants';\nimport { type WebPopup, type WebPopupEntry, type WebPopupShowTrigger } from './types';\nimport { Logger } from '../../core/logger';\n\nexport const isEmbeddedWebPopup = (popup: WebPopup): boolean => popup.kind === 'EMBEDDED';\n\n/** What the blocks need from the widget: page rules, rendering and stats live there. */\nexport type EmbeddedWebPopupsDeps = {\n matchesPage: (popup: WebPopup) => boolean;\n render: (container: HTMLElement, params: WebPopupParams, entry: WebPopupEntry) => void;\n unmount: (container: HTMLElement) => void;\n recordVisit: (entry: WebPopupEntry) => void;\n recordImpression: (code: string) => void;\n recordFormViews: (code: string, params: WebPopupParams) => void;\n dispatchShown: (code: string, trigger: WebPopupShowTrigger) => void;\n /** The ✕ the SDK draws on a dismissible journey placement. */\n dismiss: (entry: WebPopupEntry) => void;\n};\n\ntype EmbeddedBlock = {\n entry: WebPopupEntry;\n element: Element;\n host: HTMLElement;\n container: HTMLElement;\n /** 'api' blocks stay across navigation until their element leaves the page. */\n trigger: WebPopupShowTrigger;\n /** Waits for the first time the block is seen; null once seen (or never needed). */\n observer: IntersectionObserver | null;\n};\n\n/** EMBEDDED campaigns render inside the site's own elements: no delay, queue,\n * frequency or display slot — every eligible one renders. */\nexport class EmbeddedWebPopups {\n private readonly deps: EmbeddedWebPopupsDeps;\n\n /** Blocks on the page, keyed by campaign code. */\n private readonly blocks = new Map<string, EmbeddedBlock>();\n\n /** Campaigns already seen (IMPRESSION + form views reported) during this page load. */\n private readonly viewed = new Set<string>();\n\n /** Campaigns whose auto placement was already skipped with a log during this page load. */\n private readonly autoSkipLogged = new Set<string>();\n\n constructor(deps: EmbeddedWebPopupsDeps) {\n this.deps = deps;\n }\n\n /** Bring the blocks in line with the current page; called on load and on every navigation. */\n public syncWithPage(entries: Iterable<WebPopupEntry>, canAutoShow: (entry: WebPopupEntry) => boolean): void {\n for (const entry of entries) {\n if (!isEmbeddedWebPopup(entry.popup)) {\n continue;\n }\n\n const { code } = entry.popup;\n\n // The router dropped the element: the block sits in a detached node with live listeners.\n if (this.blocks.get(code)?.host.isConnected === false) {\n this.remove(code);\n }\n\n if (this.blocks.get(code)?.trigger === 'api') {\n continue;\n }\n\n if (!this.deps.matchesPage(entry.popup)) {\n this.remove(code);\n continue;\n }\n\n if (entry.content && canAutoShow(entry)) {\n this.place(entry, entry.content, 'auto');\n }\n }\n }\n\n /** Render on demand; false when there is no element to render into. */\n public show(entry: WebPopupEntry, content: WebPopupParams): boolean {\n return this.place(entry, content, 'api');\n }\n\n /** Remove the blocks the predicate picks, show() ones included; places nothing. */\n public removeWhere(shouldRemove: (entry: WebPopupEntry) => boolean): void {\n for (const [code, block] of [...this.blocks]) {\n if (shouldRemove(block.entry)) {\n this.remove(code);\n }\n }\n }\n\n private place(entry: WebPopupEntry, content: WebPopupParams, trigger: WebPopupShowTrigger): boolean {\n const { popup } = entry;\n\n const element = this.findContainer(popup, trigger);\n if (!element) {\n // The old block, if any, sits in a detached node with live listeners.\n this.remove(popup.code);\n return false;\n }\n\n const current = this.blocks.get(popup.code);\n if (current?.element === element && current.host.isConnected) {\n // The site asked for this block explicitly: it now outlives the page rules.\n if (trigger === 'api') {\n current.trigger = 'api';\n }\n return true;\n }\n\n // The router replaced or emptied the element: the old block is off the page.\n this.remove(popup.code);\n\n const host = document.createElement('div');\n host.id = `${WEB_POPUPS_WIDGET_NAMESPACE}-embedded-${popup.code}`;\n host.setAttribute(EMBEDDED_ORDER_ATTRIBUTE, String(entry.order));\n // A flex or grid container would otherwise shrink the block to its content.\n host.style.width = entry.placement?.width || '100%';\n element.insertBefore(host, this.firstBlockAfter(element, entry.order));\n\n const shadow = host.attachShadow({ mode: 'open' });\n const container = document.createElement('div');\n shadow.appendChild(container);\n\n // The inline renderer draws no ✕ of its own, so a journey placement the visitor may close gets one here.\n if (entry.placement?.dismissible) {\n host.style.position = 'relative';\n shadow.appendChild(this.createDismissButton(() => this.deps.dismiss(entry)));\n }\n\n this.deps.render(container, content, entry);\n this.blocks.set(popup.code, {\n entry, element, host, container, trigger, observer: this.watchFirstView(entry, content, host),\n });\n\n this.reportShown(entry, trigger);\n return true;\n }\n\n private createDismissButton(onClick: () => void): HTMLButtonElement {\n const button = document.createElement('button');\n button.type = 'button';\n button.textContent = '×';\n button.setAttribute('aria-label', 'Close');\n button.setAttribute(EMBEDDED_DISMISS_ATTRIBUTE, '');\n Object.assign(button.style, {\n position: 'absolute', top: '8px', right: '8px', width: '24px', height: '24px', padding: '0', border: 'none',\n borderRadius: '50%', background: 'rgba(0, 0, 0, 0.45)', color: '#FFFFFF', font: '16px/24px sans-serif', cursor: 'pointer',\n });\n button.addEventListener('click', onClick);\n\n return button;\n }\n\n private firstBlockAfter(element: Element, order: number): Element | null {\n return Array.from(element.children).find((child) => (\n child.hasAttribute(EMBEDDED_ORDER_ATTRIBUTE) && Number(child.getAttribute(EMBEDDED_ORDER_ATTRIBUTE)) > order\n )) ?? null;\n }\n\n private remove(code: string): void {\n const block = this.blocks.get(code);\n if (!block) {\n return;\n }\n\n this.blocks.delete(code);\n block.observer?.disconnect();\n this.deps.unmount(block.container);\n block.host.remove();\n }\n\n private findContainer(popup: WebPopup, trigger: WebPopupShowTrigger): Element | null {\n const { code, css_selector: selector } = popup;\n if (!selector) {\n this.logSkip(code, trigger, `${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\" has no css_selector; skipping`);\n return null;\n }\n\n try {\n const element = document.querySelector(selector);\n if (!element) {\n this.logSkip(code, trigger, `${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\": nothing matches \"${selector}\" on this page; skipping`);\n }\n return element;\n } catch (error) {\n // The selector comes from the dashboard/API verbatim; a broken one must not break the site.\n this.logSkip(code, trigger, `${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\": invalid css_selector \"${selector}\"; skipping`, error);\n return null;\n }\n }\n\n // Auto placement reruns on every navigation, so it logs once per page load;\n // show() resolves false and must say why on every call.\n private logSkip(code: string, trigger: WebPopupShowTrigger, ...details: Array<unknown>): void {\n if (trigger === 'auto') {\n if (this.autoSkipLogged.has(code)) {\n return;\n }\n this.autoSkipLogged.add(code);\n }\n\n Logger.debug(...details);\n }\n\n private reportShown(entry: WebPopupEntry, trigger: WebPopupShowTrigger): void {\n const { code } = entry.popup;\n\n this.deps.recordVisit(entry);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Embedded \"${code}\" rendered (trigger: ${trigger})`);\n this.deps.dispatchShown(code, trigger);\n }\n\n // The block renders at once (no layout jump), but only a block the visitor\n // actually scrolled to counts as an impression.\n private watchFirstView(entry: WebPopupEntry, content: WebPopupParams, host: HTMLElement): IntersectionObserver | null {\n if (this.viewed.has(entry.popup.code)) {\n return null;\n }\n\n if (typeof IntersectionObserver !== 'function') {\n this.reportViewed(entry.popup.code, content);\n return null;\n }\n\n const observer = new IntersectionObserver((records) => {\n if (!records.some((record) => record.isIntersecting)) {\n return;\n }\n\n observer.disconnect();\n this.reportViewed(entry.popup.code, content);\n });\n observer.observe(host);\n\n return observer;\n }\n\n private reportViewed(code: string, content: WebPopupParams): void {\n if (this.viewed.has(code)) {\n return;\n }\n\n this.viewed.add(code);\n this.deps.recordImpression(code);\n this.deps.recordFormViews(code, content);\n }\n}\n","import { type WebPopup } from './types';\n\n// Upward speed, px per ms, that counts as a flick back to the top rather than reading upwards.\nconst FAST_SCROLL_UP_SPEED = 1.5;\n// The flick must end within the first screen of the page.\nconst TOP_ZONE_SCREENS = 1;\n// Momentum keeps a flick scrolling after the finger lifts; a scroll this long after any touch is the page's own.\nconst TOUCH_SCROLL_WINDOW_MS = 1000;\nconst TOUCH_EVENTS = ['touchstart', 'touchmove', 'touchend'] as const;\n// A history entry pushed without a user gesture is skipped by Back in Chromium, so the guard waits for one.\nconst ACTIVATION_EVENTS = ['pointerdown', 'touchstart', 'keydown'] as const;\nconst GUARD_STATE_KEY = '__pwExitIntent';\n\nexport type ExitIntentFormFactor = 'DESKTOP' | 'MOBILE';\n\n/** Returns whether a popup is now on screen: Back that showed nothing must still leave. */\nexport type ExitIntentHandler = () => boolean;\n\nexport const isExitIntentWebPopup = (popup: WebPopup): boolean => popup.trigger_type === 'EXIT_INTENT';\n\nconst asObject = (state: unknown): object | null => (typeof state === 'object' && state !== null ? state : null);\n\nconst isGuardState = (state: unknown): boolean => GUARD_STATE_KEY in (asObject(state) ?? {});\n\n// Desktop: the cursor leaves the window through its top edge, towards the tabs and the address bar.\nfunction watchCursorLeave(onExit: () => void): () => void {\n const onMouseOut = (event: MouseEvent): void => {\n if (event.relatedTarget === null && event.clientY <= 0) {\n onExit();\n }\n };\n\n document.addEventListener('mouseout', onMouseOut);\n return () => document.removeEventListener('mouseout', onMouseOut);\n}\n\n// Mobile: the visitor comes back from another tab or app — the popup waits until the page is visible again.\nfunction watchTabSwitch(onExit: () => void): () => void {\n let left = false;\n\n const onVisibilityChange = (): void => {\n if (document.visibilityState === 'hidden') {\n left = true;\n return;\n }\n\n if (left) {\n onExit();\n }\n };\n\n document.addEventListener('visibilitychange', onVisibilityChange);\n return () => document.removeEventListener('visibilitychange', onVisibilityChange);\n}\n\n// Only a finger flick counts: a \"back to top\" button or the site's own scrollTo is not the visitor leaving.\nfunction watchFastScrollUp(onExit: () => void): () => void {\n let lastY = window.scrollY;\n let lastTime = Date.now();\n let lastTouch = Number.NEGATIVE_INFINITY;\n\n const onTouch = (): void => {\n lastTouch = Date.now();\n };\n\n const onScroll = (): void => {\n const y = window.scrollY;\n const now = Date.now();\n const speed = (lastY - y) / Math.max(now - lastTime, 1);\n\n lastY = y;\n lastTime = now;\n\n const touchDriven = now - lastTouch <= TOUCH_SCROLL_WINDOW_MS;\n if (touchDriven && speed >= FAST_SCROLL_UP_SPEED && y <= window.innerHeight * TOP_ZONE_SCREENS) {\n onExit();\n }\n };\n\n TOUCH_EVENTS.forEach((type) => window.addEventListener(type, onTouch, { capture: true, passive: true }));\n window.addEventListener('scroll', onScroll, { passive: true });\n\n return () => {\n TOUCH_EVENTS.forEach((type) => window.removeEventListener(type, onTouch, true));\n window.removeEventListener('scroll', onScroll);\n };\n}\n\n// Browser and device Back both pop a guard entry pushed over the current one: the popup shows, the next Back leaves.\nfunction watchBack(onExit: ExitIntentHandler): () => void {\n let guardHref: string | null = null;\n // Whether the entry the visitor is on is our guard; a popstate tells where they landed, not where they came from.\n let onGuard = false;\n\n const pushGuard = (): void => {\n removeActivationListeners();\n\n if (!isGuardState(window.history.state)) {\n const guardState = { ...asObject(window.history.state), [GUARD_STATE_KEY]: true };\n window.history.pushState(guardState, '', window.location.href);\n }\n\n guardHref = window.location.href;\n onGuard = true;\n };\n\n const onPopState = (event: PopStateEvent): void => {\n const leftGuard = onGuard && window.location.href === guardHref && !isGuardState(event.state);\n onGuard = isGuardState(event.state);\n\n if (!leftGuard) {\n return;\n }\n\n guardHref = null;\n if (!onExit()) {\n window.history.back();\n }\n };\n\n function removeActivationListeners(): void {\n ACTIVATION_EVENTS.forEach((type) => window.removeEventListener(type, pushGuard, true));\n }\n\n ACTIVATION_EVENTS.forEach((type) => window.addEventListener(type, pushGuard, { capture: true, passive: true }));\n window.addEventListener('popstate', onPopState);\n\n return () => {\n removeActivationListeners();\n window.removeEventListener('popstate', onPopState);\n\n // A guard left on top would make the visitor's next Back a no-op.\n if (guardHref !== null && isGuardState(window.history.state)) {\n window.history.back();\n }\n };\n}\n\n// Calls onExit once, on the first sign the visitor is leaving the page; returns the teardown of every listener.\nexport function watchExitIntent(formFactor: ExitIntentFormFactor, onExit: ExitIntentHandler): () => void {\n let stops: Array<() => void> = [];\n\n const stop = (): void => {\n stops.forEach((fn) => fn());\n stops = [];\n };\n\n const fire = (): boolean => {\n stop();\n return onExit();\n };\n\n stops = formFactor === 'MOBILE'\n ? [watchTabSwitch(fire), watchFastScrollUp(fire), watchBack(fire)]\n : [watchCursorLeave(fire)];\n\n return stop;\n}\n","import { WEB_POPUP_CLOSE_ATTRIBUTE, WEB_POPUP_SUBMIT_ATTRIBUTE } from '@pushwoosh/websdk-common/web-popups';\n\n/** One delegated listener per container: a click on any link or button of the content, except the ✕ and the FORM Submit. */\nexport function listenForContentClicks(container: HTMLElement, onClick: () => void): void {\n container.addEventListener('click', (event) => {\n // No contains() check: a close button unmounts the tree before the click bubbles up here.\n const control = event.target instanceof Element ? event.target.closest('a, button') : null;\n\n if (!control || control.hasAttribute(WEB_POPUP_CLOSE_ATTRIBUTE)) {\n return;\n }\n\n // The FORM send already counts in the campaign's Submits; the panel adds Submits to Interactions.\n if (control.hasAttribute(WEB_POPUP_SUBMIT_ATTRIBUTE)) {\n return;\n }\n\n onClick();\n });\n}\n","import {\n collectWebPopupProductSlots, loadWebPopupProducts,\n type WebPopupParams, type WebPopupProductsHost,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { WEB_POPUPS_LOG_PREFIX } from './constants';\nimport { Logger } from '../../core/logger';\nimport { type Recommendations } from '../../modules/Recommendations/Recommendations';\n\n/** Products slots load from the onsite recommendations feed; a click goes out as PW_RecommendationClick. */\nexport function createProductsHost(recommendations: Pick<Recommendations, 'fetch' | 'trackClick'>): WebPopupProductsHost {\n return {\n load: async (slot) => {\n const fallback = slot.fallbackStrategy ?? 'none';\n const request = { limit: slot.limit, block: slot.key };\n // The feed serves the fallback itself when the strategy is empty; the slot's own, never the server default.\n const response = await recommendations.fetch({ ...request, strategy: slot.strategy, fallback }).catch((error) => {\n // A strategy this feed does not know yet is a 400 that would take the fallback down with it.\n if (fallback === 'none' || fallback === slot.strategy) {\n throw error;\n }\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} products slot \"${slot.key}\": strategy \"${slot.strategy}\" failed, trying \"${fallback}\"`);\n return recommendations.fetch({ ...request, strategy: fallback, fallback: 'none' });\n });\n\n return response.items.map((item) => ({\n id: item.id,\n title: item.title,\n price: item.price,\n currency: item.currency || undefined,\n image: item.image_url || undefined,\n url: item.url,\n }));\n },\n onClick: (product, slot) => {\n recommendations.trackClick({ block: slot.key, strategy: slot.strategy, productId: product.id }).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to track a click on product \"${product.id}\" in slot \"${slot.key}\"`);\n });\n },\n };\n}\n\n/** False when a `hideWhenEmpty` products slot has nothing, its fallback included: the popup is then not shown at all. */\nexport async function webPopupProductsAvailable(params: WebPopupParams, host: WebPopupProductsHost): Promise<boolean> {\n const required = collectWebPopupProductSlots(params).filter((slot) => slot.hideWhenEmpty);\n // the same memoised answer the render gets: one request, one verdict\n const answers = await Promise.all(required.map((slot) => loadWebPopupProducts(host, slot)));\n\n return answers.every((items) => items.length > 0);\n}\n","import { type WebPopup } from './types';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport { type TPushPermissionStatus } from '../../services/PushService/pushPermissionStatus';\n\n// The campaign value for each status the SDK reports in the Push Permission Status tag.\nconst CAMPAIGN_VALUE: Record<TPushPermissionStatus, string> = {\n not_determined: 'DEFAULT',\n granted_explicit: 'GRANTED',\n denied: 'DENIED',\n unsupported: 'UNSUPPORTED',\n};\n\nconst CONDITIONS = new Set(Object.values(CAMPAIGN_VALUE));\n\n// An npm core can be older than this CDN widget, and legacy Safari throws outside its push package.\nfunction readCampaignValue(pw: Pushwoosh): string | undefined {\n if (typeof pw.getPushPermissionStatus !== 'function') {\n return undefined;\n }\n\n try {\n return CAMPAIGN_VALUE[pw.getPushPermissionStatus()];\n } catch {\n return undefined;\n }\n}\n\n/** Absent, empty, unknown or ALL lets everyone through; a status that can't be read lets nothing else through. */\nexport function matchesPushPermission(pw: Pushwoosh, popup: WebPopup): boolean {\n const required = popup.push_permission_status?.toUpperCase();\n\n if (!required || !CONDITIONS.has(required)) {\n return true;\n }\n\n return readCampaignValue(pw) === required;\n}\n","import { render } from 'preact';\n\nimport {\n parseWebPopupJson, resolveWebPopupPages, WebPopupReader,\n type WebPopupChoiceSubmitHandler, type WebPopupColorSchemePref, type WebPopupFormValuesSubmitHandler, type WebPopupParams,\n type WebPopupProductsHost, type WebPopupRatingSubmitHandler, type WebPopupSubscribeResult,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { submitSubscriptionForm } from './subscriptionFormApi';\nimport { webPopupLogger } from './webPopupLogger';\n\n/** The device-API handlers, passed in rather than imported: this module renders, it doesn't know the core. */\nexport type WebPopupDeviceHandlers = {\n onSubmitChoice: WebPopupChoiceSubmitHandler;\n onSubmitRating: WebPopupRatingSubmitHandler;\n products: WebPopupProductsHost;\n};\n\nexport type WebPopupSubmitHandlers = WebPopupDeviceHandlers & {\n // Bound to the campaign per render: one content can be shown by several campaigns.\n onSubmitFormValues: WebPopupFormValuesSubmitHandler;\n onRequestSubscribe: () => Promise<WebPopupSubscribeResult>;\n};\n\n/**\n * Parse stored popup json into the renderable model. Returns null for\n * anything that is not a supported {version: 1, params} popup with at least\n * one resolvable page — including legacy pre-engine content (no `version`\n * field), which is deliberately unrenderable.\n */\nexport const parseWebPopupContent = (json: string): WebPopupParams | null => {\n const parsed = parseWebPopupJson(json);\n if (!parsed) {\n return null;\n }\n\n if (resolveWebPopupPages(parsed.params).length === 0) {\n return null;\n }\n\n return parsed.params;\n};\n\n// Mount the popup into the shadow root; the reader draws the whole chrome and\n// owns page switching. Forms submit to their service, choice/rating via `handlers`.\nexport const renderWebPopup = (\n container: HTMLElement,\n params: WebPopupParams,\n onRequestClose: () => void,\n handlers: WebPopupSubmitHandlers,\n colorScheme: WebPopupColorSchemePref = 'auto',\n): void => {\n render(\n <WebPopupReader\n params={params}\n mode=\"live\"\n colorScheme={colorScheme}\n onRequestClose={onRequestClose}\n onSubmitForm={submitSubscriptionForm}\n onSubmitFormValues={handlers.onSubmitFormValues}\n onSubmitChoice={handlers.onSubmitChoice}\n onSubmitRating={handlers.onSubmitRating}\n onRequestSubscribe={handlers.onRequestSubscribe}\n products={handlers.products}\n logger={webPopupLogger}\n />,\n container,\n );\n};\n\n/**\n * Unmount a popup rendered by `renderWebPopup`. Dropping the host element alone\n * leaves the tree mounted on a detached node, so component cleanup never runs —\n * harmless for a popup shown once, not harmless now that popups cycle.\n */\nexport const unmountWebPopup = (container: HTMLElement): void => {\n render(null, container);\n};\n","import { type WebPopup } from './types';\n\n// A zoomed browser scrolls by fractions of a pixel and may stop just short of the very end.\nconst PAGE_END_TOLERANCE_PX = 1;\n\nexport const isScrollWebPopup = (popup: WebPopup): boolean => popup.trigger_type === 'SCROLL';\n\n/** The depth a SCROLL popup waits for, 0–100: absent, negative or not a number shows it at once. */\nexport function scrollThreshold(popup: WebPopup): number {\n const depth = popup.scroll_depth;\n if (typeof depth !== 'number' || Number.isNaN(depth)) {\n return 0;\n }\n\n return Math.min(Math.max(depth, 0), 100);\n}\n\n/** How far down the page the middle of the screen is, in percent; 100 on a page that does not scroll or at its end. */\nfunction pageScrollDepth(): number {\n const { scrollY, innerHeight } = window;\n const { scrollHeight } = document.scrollingElement ?? document.documentElement;\n\n if (scrollHeight <= innerHeight || scrollY + innerHeight >= scrollHeight - PAGE_END_TOLERANCE_PX) {\n return 100;\n }\n\n return (scrollY + innerHeight / 2) / scrollHeight * 100;\n}\n\n// Calls onReached once the page is scrolled to threshold. Already there: calls it at once and returns null;\n// otherwise returns the teardown of its listeners and observer.\nexport function watchScrollDepth(threshold: number, onReached: () => void): (() => void) | null {\n if (pageScrollDepth() >= threshold) {\n onReached();\n return null;\n }\n\n let frame: number | null = null;\n\n // Catches an SPA drawing its route after arming and a page that grows; without it, scroll and resize still work.\n const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(schedule) : null;\n\n const stop = (): void => {\n window.removeEventListener('scroll', schedule);\n window.removeEventListener('resize', schedule);\n observer?.disconnect();\n\n if (frame !== null) {\n window.cancelAnimationFrame(frame);\n frame = null;\n }\n };\n\n const check = (): void => {\n frame = null;\n\n if (pageScrollDepth() >= threshold) {\n stop();\n onReached();\n }\n };\n\n // One measurement per frame however many scroll, resize or layout events the browser fires.\n function schedule(): void {\n if (frame === null) {\n frame = window.requestAnimationFrame(check);\n }\n }\n\n window.addEventListener('scroll', schedule, { passive: true });\n window.addEventListener('resize', schedule);\n observer?.observe(document.documentElement);\n\n return stop;\n}\n","/** The page path events and page rules use: decoded, in the site's case, read anew on every call. */\nexport function getPagePath(): string {\n const { pathname } = window.location;\n\n // One malformed escape (cut UTF-8, overlong, surrogate, non-hex) makes the whole decode throw.\n try {\n return decodeURIComponent(pathname);\n } catch {\n return pathname;\n }\n}\n","import {\n collectWebPopupFormCodes, webPopupExpired, webPopupHasForm, type WebPopupColorSchemePref, type WebPopupParams,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { clickMatchesSelector, isClickWebPopup, watchClicks } from './clickTrigger';\nimport {\n PLACEMENT_ORDER, POPUP_HOST_Z_INDEX, QUEUE_GAP_MS, WEB_POPUPS_LOG_PREFIX, WEB_POPUPS_WIDGET_NAMESPACE,\n} from './constants';\nimport {\n createChoiceSubmitHandler, createFormValuesSubmitHandler, createRatingSubmitHandler, createSubscribeHandler,\n} from './deviceSubmitApi';\nimport { renderEmbeddedWebPopup } from './embeddedRenderer';\nimport { EmbeddedWebPopups, isEmbeddedWebPopup } from './EmbeddedWebPopups';\nimport { isExitIntentWebPopup, watchExitIntent } from './exitIntent';\nimport { listenForContentClicks } from './interactions';\nimport { createProductsHost, webPopupProductsAvailable } from './productsHost';\nimport { matchesPushPermission } from './pushPermissionCondition';\nimport {\n parseWebPopupContent, renderWebPopup, unmountWebPopup, type WebPopupDeviceHandlers, type WebPopupSubmitHandlers,\n} from './renderer';\nimport { isScrollWebPopup, scrollThreshold, watchScrollDepth } from './scrollDepth';\nimport { recordSubscriptionFormView } from './subscriptionFormApi';\nimport {\n type IWebPopupsPublicApi, type PageRule, type VisibleWebPopup, type WebPlacement, type WebPlacementAction, type WebPopup,\n type WebPopupEntry, type WebPopupHideReason, type WebPopupShowTrigger, type WebPopupsPublicState,\n} from './types';\nimport { Logger } from '../../core/logger';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport { getPagePath } from '../../helpers/pagePath';\n\nexport class WebPopupsWidget implements IWebPopupsPublicApi {\n private readonly pw: Pushwoosh;\n\n private isRecurringVisitor = false;\n\n /** Every popup the server returned, keyed by code. Never pruned. */\n private readonly entries = new Map<string, WebPopupEntry>();\n\n /** Contents shown by their own code, outside of any campaign; never auto-displayed. */\n private readonly contentEntries = new Map<string, WebPopupEntry>();\n\n /** Journey placements of this page load, keyed by hash; never mixed into the campaigns above. */\n private readonly placementEntries = new Map<string, WebPopupEntry>();\n\n /** Arrival sequence of each placement: the newer one wins a priority tie. */\n private readonly placementSeq = new Map<string, number>();\n\n private placementCounter = 0;\n\n /** Closed by the visitor; a pull answered before the server saw the dismiss must not bring them back. */\n private readonly dismissedPlacements = new Set<string>();\n\n /** SHOW is reported once per placement per page load. */\n private readonly shownPlacements = new Set<string>();\n\n /** The application has placements, or a postEvent response brought some: pull them on every navigation. */\n private placementsActive = false;\n\n /** Codes whose delay has elapsed or scroll depth is reached, waiting for the display slot. */\n private readonly queue: Array<string> = [];\n\n /** The single popup on screen, if any. */\n private visible: VisibleWebPopup | null = null;\n\n private drainTimeoutId: number | null = null;\n\n private autoShowEnabled = true;\n\n private colorScheme: WebPopupColorSchemePref = 'auto';\n\n private isNavigationSubscribed = false;\n private stopClickWatch: (() => void) | null = null;\n private badClickSelectors = new Set<string>();\n\n private openPopupsCount = 0;\n\n private bodyOverflowBeforeLock: string | null = null;\n\n /** Built once from `pw`: the device-API side of the choice/rating slots. */\n private readonly submitHandlers: WebPopupDeviceHandlers;\n\n /** EMBEDDED campaigns: blocks inside page elements, outside the popup pipeline. */\n private readonly embedded: EmbeddedWebPopups;\n\n // Declared before readyPromise on purpose: the Promise executor runs\n // synchronously inside that field initialiser.\n private readyResolve!: () => void;\n\n private readonly readyPromise = new Promise<void>((resolve) => {\n this.readyResolve = resolve;\n });\n\n constructor(pw: Pushwoosh) {\n this.pw = pw;\n this.submitHandlers = {\n onSubmitChoice: createChoiceSubmitHandler(pw),\n onSubmitRating: createRatingSubmitHandler(pw),\n products: createProductsHost(pw.recommendations),\n };\n this.embedded = new EmbeddedWebPopups({\n matchesPage: (popup) => this.checkSoftCondition(popup),\n render: (container, params, entry) => {\n this.listenForInteractions(container, entry);\n renderEmbeddedWebPopup(\n container, params, this.handlersFor(entry), this.colorScheme,\n () => this.embedded.removeWhere((other) => other === entry),\n entry.placement?.dismissible ? () => this.dismissPlacement(entry) : undefined,\n );\n },\n unmount: unmountWebPopup,\n recordVisit: (entry) => this.recordVisit(entry),\n recordImpression: (code) => this.recordImpression(code),\n recordFormViews: (code, params) => this.recordSubscriptionFormViews(code, params),\n dispatchShown: (code, trigger) => this.pw.dispatchEvent('show-web-popup', { code, trigger }),\n dismiss: (entry) => this.dismissPlacement(entry),\n });\n\n // Registered before run() so a site can call show() from its very first\n // Pushwoosh.push() callback; every public method awaits readyPromise.\n pw.moduleRegistry.webPopups = this;\n }\n\n public async run(): Promise<void> {\n const { pw } = this;\n\n try {\n // The CDN loader already skips this bundle when off; an npm site constructs the widget itself.\n if (pw.initParams.webPopups?.enable === false) {\n Logger.info(`${WEB_POPUPS_LOG_PREFIX} switched off by webPopups.enable, skipping`);\n\n return;\n }\n\n this.autoShowEnabled = pw.initParams.webPopups?.autoShow !== false;\n this.colorScheme = pw.initParams.webPopups?.colorScheme ?? 'auto';\n\n // Nothing to show, so nothing to register a device for. Absent feature\n // (older backend) keeps the previous behaviour; `finally` still runs.\n const features = await pw.data.getFeatures();\n const hasCampaigns = features?.['popup_forms']?.['enabled'] !== false;\n const buffered = this.acceptPlacements();\n this.placementsActive = this.placementsAllowed() && (features?.['web_placements']?.['enabled'] === true || buffered.length > 0);\n\n if (!hasCampaigns && !this.placementsActive) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} application has no active popup forms, skipping automatic display`);\n\n return;\n }\n\n await pw.api.ensureDeviceRegistered();\n\n this.isRecurringVisitor = await pw.data.getIsRecurringVisitor();\n\n const webPopups = hasCampaigns ? await pw.api.getPopupForms() : [];\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Received ${webPopups.length} popup(s) from server:`, webPopups.map((webPopup) => webPopup.code));\n\n webPopups.forEach((popup, order) => {\n this.entries.set(popup.code, this.createEntry('campaign', popup, order));\n });\n\n // Strong conditions gate AUTOMATIC display only — they are recorded, not\n // used as a load gate. Content is prefetched for every popup targeted at\n // this visitor, including trigger_type=API ones, so show() is instant;\n // popups that failed a strong condition or frequency are fetched lazily by show().\n await Promise.allSettled(Array.from(this.entries.values()).map(async (entry) => {\n entry.passedStrongConditions = this.checkStrongCondition(entry.popup);\n // A storage failure caps the popup; it must not cost an EMBEDDED its content.\n entry.passedFrequency = await this.checkCanBeShownByFrequencyCondition(entry.popup).catch(() => false);\n if (this.shouldPrefetchContent(entry)) {\n await this.ensureContent(entry);\n }\n }));\n\n const loaded = this.loadedCodes();\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} ${loaded.length} popup(s) passed strong conditions and loaded:`, loaded);\n\n this.subscribeToNavigation();\n this.subscribeToPushPermission();\n this.renderForCurrentPage();\n this.watchClickTriggers();\n\n if (this.placementsActive) {\n await this.pullPlacements(buffered);\n }\n\n await pw.data.setIsRecurringVisitor(true);\n } finally {\n // show() must never hang, even if run() blew up half way.\n this.readyResolve();\n pw.dispatchEvent('web-popups-ready', {});\n }\n }\n\n /* ------------------------------------------------------------------ *\n * Public API — Pushwoosh.moduleRegistry.webPopups\n * ------------------------------------------------------------------ */\n\n /**\n * Show a popup now past every display condition but the push permission status (and a POPUP's expired countdown).\n * Never rejects: resolves false and logs why. The full contract is in public/index.d.ts.\n */\n public async show(code: string): Promise<boolean> {\n await this.readyPromise;\n\n // Campaigns first: journey points saved before the switch to contents still carry campaign codes.\n const entry = this.entries.get(code) ?? this.getContentEntry(code);\n const isEmbedded = entry.kind === 'campaign' && isEmbeddedWebPopup(entry.popup);\n\n if (!isEmbedded && this.visible?.code === code) {\n return true;\n }\n\n // After the visible check: a popup on screen stays whatever the status. A content has no condition.\n if (!matchesPushPermission(this.pw, entry.popup)) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): the visitor's push permission does not match the campaign`);\n return false;\n }\n\n // Awaited BEFORE preempting so close() and present() run in the same task:\n // otherwise the browser paints the moment between two modal popups with the\n // body scroll lock released.\n const content = await this.ensureContent(entry);\n if (!content) {\n Logger.error(new Error('Web popup content unavailable'), `${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): content unavailable`);\n return false;\n }\n\n // A form submits under a campaign code; opened by its content code it would fail on Submit.\n if (entry.kind === 'content' && webPopupHasForm(content)) {\n Logger.error(new Error('Web popup form needs a campaign'), `${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): a form content is shown by a campaign only`);\n return false;\n }\n\n if (entry.productsEmpty) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} show(\"${code}\"): its products block has nothing to show`);\n return false;\n }\n\n // A block goes into its page element: it neither takes nor frees the popup display slot.\n if (isEmbedded) {\n return this.embedded.show(entry, content);\n }\n\n // The automatic pipeline may have shown this very popup while we awaited;\n // re-presenting it would double-count the impression.\n if (this.visible?.code === code) {\n return true;\n }\n\n // show() deliberately ignores the page rules — but not an expired\n // countdown: the offer is over however the popup was triggered.\n if (!this.checkNotExpired(entry)) {\n return false;\n }\n\n if (this.visible) {\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} show(\"${code}\") preempting \"${this.visible.code}\"`);\n // The preempted popup is finished with, not requeued: it already recorded\n // its impression and did its frequency bookkeeping.\n this.visible.close('preempted');\n }\n\n // Drop this popup's own armed timer / queue slot so the automatic pipeline\n // does not show it a second time.\n this.detachFromAutoPipeline(entry);\n\n this.present(entry, 'api');\n return true;\n }\n\n /**\n * Hide the visible popup, optionally only if it is the given one.\n * Returns false when nothing was hidden.\n */\n public hide(code?: string): boolean {\n if (!this.visible) {\n return false;\n }\n\n if (code !== undefined && this.visible.code !== code) {\n return false;\n }\n\n this.visible.close('api');\n return true;\n }\n\n /**\n * Hide the visible popup and dismiss everything still pending for this page\n * load. show() keeps working afterwards.\n */\n public hideAll(): boolean {\n const hadVisible = this.hide();\n\n this.entries.forEach((entry) => {\n if (entry.state !== 'waiting' && entry.state !== 'queued') {\n return;\n }\n\n this.detachFromAutoPipeline(entry);\n entry.state = 'done';\n });\n\n // After hide(), whose close() arms a drain for the next queued popup.\n this.cancelScheduledDrain();\n\n return hadVisible;\n }\n\n public isVisible(code?: string): boolean {\n if (!this.visible) {\n return false;\n }\n\n return code === undefined || this.visible.code === code;\n }\n\n public getVisibleCode(): string | null {\n return this.visible?.code ?? null;\n }\n\n public getAvailableCodes(): Array<string> {\n return Array.from(this.entries.keys());\n }\n\n public getState(): WebPopupsPublicState {\n const waiting: Array<string> = [];\n this.entries.forEach((entry, code) => {\n if (entry.state === 'waiting') {\n waiting.push(code);\n }\n });\n\n return {\n visible: this.getVisibleCode(),\n queued: [...this.queue],\n waiting,\n available: this.getAvailableCodes(),\n };\n }\n\n /* ---------------------------- Journey placements ---------------------------- */\n\n private placementsAllowed(): boolean {\n return this.pw.initParams.webPlacements?.enable !== false;\n }\n\n /** Takes over delivery from the core and returns what it buffered; an older core has neither hook. */\n private acceptPlacements(): Array<WebPlacement> {\n const { pw } = this;\n if (!this.placementsAllowed() || typeof pw.takeWebPlacements !== 'function') {\n return [];\n }\n\n pw.webPlacementsSink = (placements) => {\n this.receivePlacements(placements).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to render journey placements`);\n });\n };\n\n return pw.takeWebPlacements();\n }\n\n /** Placements a postEvent response released: shown at once, and the page starts pulling them. */\n private async receivePlacements(placements: Array<WebPlacement>): Promise<void> {\n await this.readyPromise;\n\n this.placementsActive = true;\n this.subscribeToNavigation();\n await this.syncPlacements(placements, false);\n }\n\n /** The server's queue for this user is the truth: a placement it no longer returns is taken off the page or the queue. */\n private async pullPlacements(extra: Array<WebPlacement> = []): Promise<void> {\n let pulled: Array<WebPlacement>;\n try {\n pulled = await this.pw.api.getWebPlacements();\n } catch (error) {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to load journey placements`);\n await this.syncPlacements(extra, false);\n return;\n }\n\n await this.syncPlacements([...pulled, ...extra], true);\n }\n\n private async syncPlacements(placements: Array<WebPlacement>, authoritative: boolean): Promise<void> {\n const now = Date.now();\n const live = placements.filter((placement) => (\n placement.hash && placement.content_code && !this.dismissedPlacements.has(placement.hash) && !placementExpired(placement, now)\n ));\n\n if (authoritative) {\n const kept = new Set(live.map((placement) => placement.hash));\n this.placementEntries.forEach((entry, hash) => {\n // A popup already on screen is let to finish; one still waiting or queued goes with the block.\n if (!kept.has(hash) && (isEmbeddedWebPopup(entry.popup) || entry.state !== 'visible')) {\n this.dropPlacement(entry);\n }\n });\n }\n\n live.forEach((placement) => {\n if (this.placementEntries.has(placement.hash)) {\n return;\n }\n\n const entry = this.createEntry('placement', placementPopup(placement), PLACEMENT_ORDER);\n entry.placement = placement;\n this.placementEntries.set(placement.hash, entry);\n this.placementCounter += 1;\n this.placementSeq.set(placement.hash, this.placementCounter);\n this.scheduleExpiry(entry, now);\n });\n\n await this.renderPlacements();\n }\n\n private async renderPlacements(): Promise<void> {\n const pending = Array.from(this.placementEntries.values()).filter((entry) => entry.state !== 'done');\n\n await Promise.all(pending.map(async (entry) => {\n const content = await this.ensureContent(entry);\n // A form submits under a campaign code, and a placement has none.\n if (!content || webPopupHasForm(content)) {\n if (content) {\n Logger.error(new Error('Web popup form needs a campaign'), `${WEB_POPUPS_LOG_PREFIX} placement \"${entry.popup.code}\": a form content is shown by a campaign only`);\n }\n entry.state = 'done';\n }\n }));\n\n const ready = pending.filter((entry) => entry.state !== 'done' && entry.content && !entry.productsEmpty);\n this.renderPlacementBlocks(ready.filter((entry) => isEmbeddedWebPopup(entry.popup)));\n this.queuePlacementPopup(ready.filter((entry) => !isEmbeddedWebPopup(entry.popup)));\n }\n\n /** One placement per element: the highest priority, the newest on a tie. */\n private renderPlacementBlocks(entries: Array<WebPopupEntry>): void {\n const winners = new Map<string, WebPopupEntry>();\n entries.forEach((entry) => {\n const selector = entry.popup.css_selector ?? '';\n const current = winners.get(selector);\n if (!current || this.placementBeats(entry, current)) {\n winners.set(selector, entry);\n }\n });\n\n const shown = new Set(winners.values());\n this.embedded.removeWhere((entry) => entry.kind === 'placement' && !shown.has(entry));\n shown.forEach((entry) => {\n this.embedded.show(entry, entry.content!);\n });\n }\n\n /** At most one placement popup at a time takes the display slot, ahead of campaigns. */\n private queuePlacementPopup(entries: Array<WebPopupEntry>): void {\n const busy = entries.some((entry) => entry.state === 'queued' || entry.state === 'visible');\n const idle = entries.filter((entry) => entry.state === 'idle');\n if (busy || idle.length === 0) {\n return;\n }\n\n const best = idle.reduce((winner, entry) => (this.placementBeats(entry, winner) ? entry : winner));\n best.state = 'queued';\n this.insertIntoQueue(best);\n this.drain();\n }\n\n private placementBeats(entry: WebPopupEntry, other: WebPopupEntry): boolean {\n const rank = placementRank(entry.placement) - placementRank(other.placement);\n if (rank !== 0) {\n return rank > 0;\n }\n\n return (this.placementSeq.get(entry.popup.code) ?? 0) > (this.placementSeq.get(other.popup.code) ?? 0);\n }\n\n private scheduleExpiry(entry: WebPopupEntry, now: number): void {\n const deadline = placementDeadline(entry.placement);\n // setTimeout overflows past ~24.8 days; a placement lives a week at most.\n if (deadline === null || deadline - now > 2 ** 31 - 1) {\n return;\n }\n\n window.setTimeout(() => {\n if (entry.state !== 'visible') {\n this.dropPlacement(entry);\n }\n }, deadline - now);\n }\n\n private dropPlacement(entry: WebPopupEntry): void {\n this.embedded.removeWhere((other) => other === entry);\n this.detachFromAutoPipeline(entry);\n entry.state = 'done';\n this.placementEntries.delete(entry.popup.code);\n }\n\n private dismissPlacement(entry: WebPopupEntry): void {\n this.dismissedPlacements.add(entry.popup.code);\n this.dropPlacement(entry);\n this.trackPlacement(entry.popup.code, 'WEB_PLACEMENT_ACTION_DISMISS');\n }\n\n private onPlacementsNavigate(): void {\n if (!this.placementsActive) {\n return;\n }\n\n this.pullPlacements().catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to refresh journey placements`);\n });\n }\n\n private trackPlacement(hash: string, action: WebPlacementAction): void {\n if (action === 'WEB_PLACEMENT_ACTION_SHOW') {\n if (this.shownPlacements.has(hash)) {\n return;\n }\n this.shownPlacements.add(hash);\n }\n\n // An npm core older than this CDN widget has no such call.\n if (typeof this.pw.api.trackWebPlacement !== 'function') {\n return;\n }\n\n this.pw.api.trackWebPlacement(hash, action).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record ${action} for placement \"${hash}\"`);\n });\n }\n\n private entryByCode(code: string): WebPopupEntry | undefined {\n return this.entries.get(code) ?? this.placementEntries.get(code);\n }\n\n /* ------------------------------------------------------------------ *\n * Content loading\n * ------------------------------------------------------------------ */\n\n private createEntry(kind: WebPopupEntry['kind'], popup: WebPopup, order: number): WebPopupEntry {\n return {\n kind,\n popup,\n order,\n state: 'idle',\n content: null,\n loading: null,\n productsEmpty: false,\n passedStrongConditions: false,\n passedFrequency: false,\n timeoutId: null,\n stopTriggerWatch: null,\n visitRecorded: false,\n };\n }\n\n private getContentEntry(code: string): WebPopupEntry {\n let entry = this.contentEntries.get(code);\n if (!entry) {\n // Only `code` and the content code are read for a content: show() skips conditions, present() stats.\n entry = this.createEntry('content', {\n code,\n popup_form_content_code: code,\n device_type: 'ALL',\n visitors_type: 'ALL',\n matching_pages: [],\n delay: 0,\n frequency: 'EVERY_VISIT',\n trigger_type: 'API',\n }, -1);\n this.contentEntries.set(code, entry);\n }\n\n return entry;\n }\n\n /**\n * Resolve the entry's renderable content, fetching it at most once. A failed\n * fetch clears the memo so a later show() can retry.\n */\n private ensureContent(entry: WebPopupEntry): Promise<WebPopupParams | null> {\n if (entry.content) {\n return Promise.resolve(entry.content);\n }\n\n if (entry.loading) {\n return entry.loading;\n }\n\n entry.loading = this.loadContent(entry.popup)\n .then(async (content) => {\n // Settled before the content counts as loaded, so no display path sees it unchecked.\n entry.productsEmpty = !!content && !(await webPopupProductsAvailable(content, this.submitHandlers.products));\n entry.content = content;\n return content;\n })\n .catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to load web popup \"${entry.popup.code}\"`);\n return null;\n })\n .finally(() => {\n if (!entry.content) {\n entry.loading = null;\n }\n });\n\n return entry.loading;\n }\n\n private async loadContent(webPopup: WebPopup): Promise<WebPopupParams | null> {\n const content = await this.pw.api.getPopupFormContent(webPopup.popup_form_content_code);\n const parsed = parseWebPopupContent(content.json);\n if (!parsed) {\n // Legacy / unknown format — this popup is broken and never shows.\n Logger.error(\n new Error('Unsupported popup content format'),\n `${WEB_POPUPS_LOG_PREFIX} Web popup \"${webPopup.code}\" content is not a supported {version, params} popup; skipping`,\n );\n return null;\n }\n\n return parsed;\n }\n\n // The one kind-specific gate at load: EMBEDDED has no frequency, so a capped POPUP is the only\n // eligible entry left to show() to fetch lazily.\n private shouldPrefetchContent(entry: WebPopupEntry): boolean {\n return entry.passedStrongConditions && (isEmbeddedWebPopup(entry.popup) || entry.passedFrequency);\n }\n\n private loadedCodes(): Array<string> {\n const codes: Array<string> = [];\n this.entries.forEach((entry, code) => {\n if (entry.content) {\n codes.push(code);\n }\n });\n return codes;\n }\n\n /* ------------------------------------------------------------------ *\n * Automatic display pipeline\n * ------------------------------------------------------------------ */\n\n private renderForCurrentPage(): void {\n this.releaseUnmatchedPending();\n\n const armed: Array<string> = [];\n this.entries.forEach((entry, code) => {\n if (this.canAutoDisplay(entry)) {\n this.arm(entry);\n armed.push(code);\n }\n });\n\n Logger.debug(\n `${WEB_POPUPS_LOG_PREFIX} ${armed.length} popup(s) selected for display on \"${getPagePath()}\":`,\n armed,\n );\n\n // Insurance: a no-op when something is visible or nothing is queued.\n this.drain();\n\n // EMBEDDED has no delay, frequency or countdown expiry: a block is part of the page, not an interruption.\n this.embedded.syncWithPage(this.entries.values(), (entry) => this.isAutoEligible(entry));\n }\n\n private canAutoDisplay(entry: WebPopupEntry): boolean {\n return !isEmbeddedWebPopup(entry.popup)\n && entry.state === 'idle'\n && this.isAutoEligible(entry)\n && entry.passedFrequency\n && this.checkNotExpired(entry);\n }\n\n /** What any kind needs to show by itself; kind-specific checks stay with the caller. */\n private isAutoEligible(entry: WebPopupEntry): boolean {\n return this.isAutoTrigger(entry.popup) && this.passesDisplayConditions(entry);\n }\n\n /** The conditions a popup shown without show() passes, whatever its trigger. */\n private passesDisplayConditions(entry: WebPopupEntry): boolean {\n return this.autoShowEnabled\n && entry.passedStrongConditions\n && entry.content !== null\n && !entry.productsEmpty\n && this.checkSoftCondition(entry.popup)\n && matchesPushPermission(this.pw, entry.popup);\n }\n\n /** What a waiting or queued popup must still pass: the page, the push permission and the countdown. */\n private isStillEligible(entry: WebPopupEntry): boolean {\n return !placementExpired(entry.placement, Date.now())\n && this.checkSoftCondition(entry.popup)\n && matchesPushPermission(this.pw, entry.popup)\n && this.checkNotExpired(entry);\n }\n\n private isAutoTrigger(webPopup: WebPopup): boolean {\n const trigger = webPopup.trigger_type;\n\n // Absent (older backend), PAGE_LOAD, SCROLL or EXIT_INTENT means automatic display.\n // Any other value — including one this SDK version does not know — counts\n // as API-only, so a future trigger kind never shows itself by accident.\n return !trigger || trigger === 'PAGE_LOAD' || trigger === 'SCROLL' || trigger === 'EXIT_INTENT';\n }\n\n /* ------------- CLICK trigger: outside the queue, every matching click opens the popup ------------- */\n\n private watchClickTriggers(): void {\n const hasClickPopups = Array.from(this.entries.values()).some((entry) => entry.kind === 'campaign' && isClickWebPopup(entry.popup));\n if (!hasClickPopups || this.stopClickWatch) {\n return;\n }\n\n this.stopClickWatch = watchClicks((event) => this.onTriggerClick(event));\n }\n\n private onTriggerClick(event: MouseEvent): void {\n // Whatever is on screen, ours or another campaign's, a click never opens a second popup over it.\n if (this.visible) {\n return;\n }\n\n const entry = Array.from(this.entries.values()).find((candidate) => this.isClickTarget(candidate, event));\n if (!entry) {\n return;\n }\n\n // The popup replaces what the element would do: a link must not navigate away from under it.\n event.preventDefault();\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${entry.popup.code}\" element clicked`);\n this.present(entry, 'auto');\n }\n\n private isClickTarget(entry: WebPopupEntry, event: MouseEvent): boolean {\n const { popup } = entry;\n const selector = popup.css_selector ?? '';\n if (entry.kind !== 'campaign' || !isClickWebPopup(popup) || !selector || isEmbeddedWebPopup(popup)) {\n return false;\n }\n\n if (!this.passesDisplayConditions(entry) || !this.checkNotExpired(entry)) {\n return false;\n }\n\n try {\n return clickMatchesSelector(event, selector);\n } catch (error) {\n // The selector comes from the dashboard/API verbatim; a broken one must not break the site's clicks.\n if (!this.badClickSelectors.has(popup.code)) {\n this.badClickSelectors.add(popup.code);\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\": invalid css_selector \"${selector}\"; its clicks are ignored`, error);\n }\n return false;\n }\n }\n\n private arm(entry: WebPopupEntry): void {\n entry.state = 'waiting';\n this.recordVisit(entry);\n\n if (isScrollWebPopup(entry.popup)) {\n this.armScrollDepth(entry);\n return;\n }\n\n if (isExitIntentWebPopup(entry.popup)) {\n this.armExitIntent(entry);\n return;\n }\n\n this.armDelay(entry);\n }\n\n private armDelay(entry: WebPopupEntry): void {\n const { popup } = entry;\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" armed for display in ${popup.delay}s`);\n\n entry.timeoutId = window.setTimeout(() => {\n entry.timeoutId = null;\n this.enqueueArmed(entry, 'delay elapsed');\n }, popup.delay * 1000);\n }\n\n private armScrollDepth(entry: WebPopupEntry): void {\n const { popup } = entry;\n const threshold = scrollThreshold(popup);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" armed for display at ${threshold}% scroll depth`);\n\n entry.stopTriggerWatch = watchScrollDepth(threshold, () => {\n entry.stopTriggerWatch = null;\n\n // Never show inside the arming pass: like armDelay(0), popups armed together keep the server order.\n entry.timeoutId = window.setTimeout(() => {\n entry.timeoutId = null;\n this.enqueueArmed(entry, 'scroll depth reached');\n }, 0);\n });\n }\n\n private armExitIntent(entry: WebPopupEntry): void {\n const { popup } = entry;\n const formFactor = this.pw.environment.formFactor === 'MOBILE' ? 'MOBILE' : 'DESKTOP';\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" armed for display on exit intent (${formFactor})`);\n\n entry.stopTriggerWatch = watchExitIntent(formFactor, () => {\n entry.stopTriggerWatch = null;\n this.enqueueArmed(entry, 'exit intent');\n return entry.state === 'visible';\n });\n }\n\n private enqueueArmed(entry: WebPopupEntry, reason: string): void {\n const { code } = entry.popup;\n\n entry.state = 'queued';\n this.insertIntoQueue(entry);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${code}\" ${reason}; queued at position ${this.queue.indexOf(code) + 1} of ${this.queue.length}`);\n\n this.drain();\n }\n\n /**\n * VISIT is reported once per page load, when the popup is armed for the\n * current page — the same moment as before the queue existed.\n */\n private recordVisit(entry: WebPopupEntry): void {\n if (entry.visitRecorded || entry.kind !== 'campaign') {\n return;\n }\n\n entry.visitRecorded = true;\n this.pw.api.recordPopupFormEvent(entry.popup.code, 1).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record web popup visit event for \"${entry.popup.code}\"`);\n });\n }\n\n /** Ordering: shorter delay first (SCROLL and EXIT_INTENT count as 0), then the order the server returned them. */\n private insertIntoQueue(entry: WebPopupEntry): void {\n const delay = queueDelay(entry.popup);\n\n const isAfter = (code: string): boolean => {\n const other = this.entryByCode(code);\n if (!other) {\n return false;\n }\n\n if (queueDelay(other.popup) !== delay) {\n return queueDelay(other.popup) > delay;\n }\n\n return other.order > entry.order;\n };\n\n const index = this.queue.findIndex(isAfter);\n if (index === -1) {\n this.queue.push(entry.popup.code);\n return;\n }\n\n this.queue.splice(index, 0, entry.popup.code);\n }\n\n /**\n * Return waiting and queued popups that stopped matching the page or the push permission, or whose countdown\n * passed, to `idle`; a returning visitor re-arms them with a full delay.\n */\n private releaseUnmatchedPending(): void {\n this.entries.forEach((entry) => {\n if (entry.state !== 'waiting' && entry.state !== 'queued') {\n return;\n }\n\n if (this.isStillEligible(entry)) {\n return;\n }\n\n this.detachFromAutoPipeline(entry);\n entry.state = 'idle';\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Released popup \"${entry.popup.code}\": page or push permission no longer matches, or its countdown passed`);\n });\n }\n\n /** Clear an entry's armed timer, trigger listeners and queue slot, leaving its state to the caller. */\n private detachFromAutoPipeline(entry: WebPopupEntry): void {\n if (entry.timeoutId !== null) {\n window.clearTimeout(entry.timeoutId);\n entry.timeoutId = null;\n }\n\n if (entry.stopTriggerWatch !== null) {\n entry.stopTriggerWatch();\n entry.stopTriggerWatch = null;\n }\n\n const index = this.queue.indexOf(entry.popup.code);\n if (index !== -1) {\n this.queue.splice(index, 1);\n }\n }\n\n /** Show the head of the queue if the display slot is free. */\n private drain(): void {\n if (this.visible || this.drainTimeoutId !== null) {\n return;\n }\n\n const code = this.queue.shift();\n if (code === undefined) {\n return;\n }\n\n const entry = this.entryByCode(code);\n if (!entry || entry.state !== 'queued') {\n this.drain();\n return;\n }\n\n // The page, the push permission or the deadline may have changed between enqueue and the slot freeing up.\n if (!this.isStillEligible(entry)) {\n entry.state = 'idle';\n this.drain();\n return;\n }\n\n if (!entry.content) {\n entry.state = 'done';\n this.drain();\n return;\n }\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Display slot free; showing \"${code}\"`);\n this.present(entry, 'auto');\n }\n\n private scheduleDrain(): void {\n if (this.drainTimeoutId !== null) {\n return;\n }\n\n this.drainTimeoutId = window.setTimeout(() => {\n this.drainTimeoutId = null;\n this.drain();\n }, QUEUE_GAP_MS);\n }\n\n private cancelScheduledDrain(): void {\n if (this.drainTimeoutId === null) {\n return;\n }\n\n window.clearTimeout(this.drainTimeoutId);\n this.drainTimeoutId = null;\n }\n\n /* ------------------------------------------------------------------ *\n * Rendering\n * ------------------------------------------------------------------ */\n\n private present(entry: WebPopupEntry, trigger: WebPopupShowTrigger): void {\n // A drain armed by the popup we are replacing must not fire behind us.\n this.cancelScheduledDrain();\n\n const { popup, content } = entry;\n if (!content) {\n entry.state = 'done';\n return;\n }\n\n // The host is pointer-transparent: the reader's overlay / popup box\n // re-enable pointer events themselves, so a corner banner without a\n // dim never blocks the page underneath.\n const host = document.createElement('div');\n host.id = `${WEB_POPUPS_WIDGET_NAMESPACE}-${popup.code}`;\n host.style.position = 'fixed';\n host.style.inset = '0';\n host.style.zIndex = String(POPUP_HOST_Z_INDEX);\n host.style.pointerEvents = 'none';\n document.body.appendChild(host);\n\n const shadow = host.attachShadow({ mode: 'open' });\n const container = document.createElement('div');\n shadow.appendChild(container);\n this.listenForInteractions(container, entry);\n\n // Only a dimmed (modal) popup locks the page scroll; banners and bars\n // leave the page usable.\n const modal = !!content.overlay;\n if (modal) {\n this.lockBodyScroll();\n }\n\n let closed = false;\n const close = (reason: WebPopupHideReason): void => {\n // Idempotent: the reader's overlay click and hide() can race.\n if (closed) {\n return;\n }\n closed = true;\n\n if (modal) {\n this.unlockBodyScroll();\n }\n\n unmountWebPopup(container);\n host.remove();\n\n if (this.visible?.code === popup.code) {\n this.visible = null;\n }\n entry.state = 'done';\n\n this.pw.dispatchEvent('hide-web-popup', { code: popup.code, reason });\n if (entry.kind === 'placement' && reason === 'user') {\n this.trackPlacement(popup.code, 'WEB_PLACEMENT_ACTION_DISMISS');\n }\n this.scheduleDrain();\n };\n\n this.visible = {\n code: popup.code, host, modal, close,\n };\n entry.state = 'visible';\n\n // The reader draws the whole chrome (overlay that closes on click,\n // placement, animation, the close button and close-action buttons).\n renderWebPopup(container, content, () => close('user'), this.handlersFor(entry), this.colorScheme);\n\n this.recordSubscriptionFormViews(popup.code, content);\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${popup.code}\" shown (trigger: ${trigger})`);\n\n // Popup form events take campaign codes only; a content opened from the\n // inbox is counted there, as the inbox open.\n if (entry.kind === 'campaign') {\n // A no-op on the automatic path, where the visit was recorded at arm time.\n this.recordVisit(entry);\n this.markAsShown(popup).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to mark web popup \"${popup.code}\" as shown`);\n });\n }\n if (entry.kind === 'placement') {\n this.trackPlacement(popup.code, 'WEB_PLACEMENT_ACTION_SHOW');\n }\n this.pw.dispatchEvent('show-web-popup', { code: popup.code, trigger });\n }\n\n private handlersFor(entry: WebPopupEntry): WebPopupSubmitHandlers {\n // Only a campaign counts its subscriptions: a placement or a content opened by its own code has no stats.\n const campaignCode = entry.kind === 'campaign' ? entry.popup.code : undefined;\n\n return {\n ...this.submitHandlers,\n onRequestSubscribe: createSubscribeHandler(this.pw, campaignCode),\n onSubmitFormValues: createFormValuesSubmitHandler(this.pw, entry.popup.code),\n };\n }\n\n // Embedded email-subscription forms count a view per showing — the\n // denominator of the form's conversion stats.\n private recordSubscriptionFormViews(code: string, content: WebPopupParams): void {\n const formCodes = collectWebPopupFormCodes(content);\n if (formCodes.length === 0) {\n return;\n }\n\n this.pw.data.getHwid()\n .then((hwid) => formCodes.forEach((formCode) => recordSubscriptionFormView(formCode, hwid)))\n .catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record subscription form views for web popup \"${code}\"`);\n });\n }\n\n /* ------------------------------------------------------------------ *\n * Scroll lock\n * ------------------------------------------------------------------ */\n\n private lockBodyScroll(): void {\n if (this.openPopupsCount === 0) {\n this.bodyOverflowBeforeLock = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n this.openPopupsCount += 1;\n }\n\n private unlockBodyScroll(): void {\n this.openPopupsCount = Math.max(0, this.openPopupsCount - 1);\n if (this.openPopupsCount === 0 && this.bodyOverflowBeforeLock !== null) {\n document.body.style.overflow = this.bodyOverflowBeforeLock;\n this.bodyOverflowBeforeLock = null;\n }\n }\n\n /* ------------------------------------------------------------------ *\n * Conditions\n * ------------------------------------------------------------------ */\n\n private subscribeToNavigation(): void {\n if (this.isNavigationSubscribed) {\n return;\n }\n\n this.isNavigationSubscribed = true;\n\n const onNavigate = (): void => {\n this.renderForCurrentPage();\n this.onPlacementsNavigate();\n };\n\n const nav = (window as Window & { navigation?: EventTarget }).navigation;\n if (nav && typeof nav.addEventListener === 'function') {\n nav.addEventListener('currententrychange', onNavigate);\n return;\n }\n\n window.addEventListener('popstate', onNavigate);\n window.addEventListener('hashchange', onNavigate);\n\n // Programmatic pushState/replaceState fires no event; poll location instead\n // of monkey-patching history so SPA routers stay untouched.\n let lastHref = window.location.href;\n window.setInterval(() => {\n if (window.location.href !== lastHref) {\n lastHref = window.location.href;\n onNavigate();\n }\n }, 500);\n }\n\n private subscribeToPushPermission(): void {\n const onChange = (): void => this.releaseByPushPermission();\n\n // An npm core older than this CDN widget has no addSdkEventHandler.\n if (typeof this.pw.addSdkEventHandler === 'function') {\n this.pw.addSdkEventHandler('change-permission', onChange);\n return;\n }\n\n this.pw.addEventHandler('change-permission', onChange);\n }\n\n // Only takes away: a campaign that starts to match waits for the next page, so nothing pops up after the dialog.\n private releaseByPushPermission(): void {\n this.releaseUnmatchedPending();\n this.embedded.removeWhere((entry) => !matchesPushPermission(this.pw, entry.popup));\n }\n\n private checkStrongCondition(webPopup: WebPopup): boolean {\n return this.checkCanBeShownByDeviceTypeCondition(webPopup)\n && this.checkCanBeShownByVisitorsTypeCondition(webPopup);\n }\n\n private checkSoftCondition(webPopup: WebPopup): boolean {\n return this.checkCanBeShownByMatchingPagesCondition(webPopup);\n }\n\n // A popup with a run-out 'hide-popup' countdown must not be shown at all —\n // asked HERE, at SHOW time, because a render already costs the impression.\n private checkNotExpired(entry: WebPopupEntry): boolean {\n if (!entry.content) {\n return true;\n }\n\n if (!webPopupExpired(entry.content, Date.now())) {\n return true;\n }\n\n Logger.debug(`${WEB_POPUPS_LOG_PREFIX} Popup \"${entry.popup.code}\" not shown: its countdown has passed`);\n return false;\n }\n\n private checkCanBeShownByDeviceTypeCondition(webPopup: WebPopup): boolean {\n const { device_type: deviceType } = webPopup;\n\n const formFactor = this.pw.environment.formFactor;\n if (deviceType === 'ALL') {\n return true;\n }\n\n return deviceType === formFactor;\n }\n\n private async checkCanBeShownByFrequencyCondition(webPopup: WebPopup): Promise<boolean> {\n const { frequency, code } = webPopup;\n\n // The visitor asked for it: every click opens the popup, whatever the frequency.\n if (isClickWebPopup(webPopup)) {\n return true;\n }\n\n if (frequency === 'ONCE') {\n const shown = await this.pw.data.getShownWebPopups();\n return !shown.includes(code);\n }\n\n if (frequency === 'ONCE_PER_SESSION') {\n return sessionStorage.getItem(this.getSessionStorageKey(code)) === null;\n }\n\n return true;\n }\n\n private checkCanBeShownByMatchingPagesCondition(webPopup: WebPopup): boolean {\n const { matching_pages: matchingPages, matching_page_rules: matchingPageRules, excluded_pages: excludedPages } = webPopup;\n const path = getPagePath();\n\n // \"Specified pages\": operator-aware rules preferred, legacy exact list as fallback.\n if (matchingPageRules && matchingPageRules.length > 0) {\n return matchingPageRules.some((rule) => this.matchPageRule(path, rule));\n }\n\n if (matchingPages && matchingPages.length > 0) {\n return matchingPages.some((page) => Boolean(page) && page === path);\n }\n\n if (excludedPages && excludedPages.length > 0) {\n return !excludedPages.some((rule) => this.matchPageRule(path, rule));\n }\n\n return true;\n }\n\n private matchPageRule(path: string, rule: PageRule): boolean {\n // A null or empty rule path is skipped like an unknown operator: empty STARTS_WITH would match every page.\n if (!rule.path) {\n return false;\n }\n\n switch (rule.operator) {\n case 'EQUALS':\n return path === rule.path;\n case 'STARTS_WITH':\n return path.startsWith(rule.path);\n default:\n // Unknown operator: skip the rule (fail-open) rather than hide/crash.\n return false;\n }\n }\n\n private checkCanBeShownByVisitorsTypeCondition(webPopup: WebPopup): boolean {\n const { visitors_type: visitorsType } = webPopup;\n\n if (visitorsType === 'NEW') {\n return !this.isRecurringVisitor;\n }\n\n if (visitorsType === 'RECURRING') {\n return this.isRecurringVisitor;\n }\n\n return true;\n }\n\n private recordImpression(code: string): void {\n if (this.placementEntries.has(code)) {\n this.trackPlacement(code, 'WEB_PLACEMENT_ACTION_SHOW');\n return;\n }\n\n this.recordPopupShownEvent(code);\n }\n\n private recordPopupShownEvent(code: string): void {\n this.pw.api.recordPopupFormEvent(code, 2).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record web popup shown event for \"${code}\"`);\n });\n }\n\n // Campaign stats, like VISIT and IMPRESSION: a content opened by its own code sends none.\n private listenForInteractions(container: HTMLElement, entry: WebPopupEntry): void {\n if (entry.kind === 'placement') {\n listenForContentClicks(container, () => {\n // A close button has already dismissed the placement by the time its click bubbles here: that is a DISMISS, not a CLICK.\n if (entry.state !== 'done') {\n this.trackPlacement(entry.popup.code, 'WEB_PLACEMENT_ACTION_CLICK');\n }\n });\n return;\n }\n\n if (entry.kind !== 'campaign') {\n return;\n }\n\n listenForContentClicks(container, () => {\n this.pw.api.recordPopupFormEvent(entry.popup.code, 3).catch((error) => {\n Logger.error(error, `${WEB_POPUPS_LOG_PREFIX} Failed to record web popup interaction for \"${entry.popup.code}\"`);\n });\n });\n }\n\n private async markAsShown(webPopup: WebPopup): Promise<void> {\n this.recordPopupShownEvent(webPopup.code);\n const { frequency, code } = webPopup;\n\n if (isClickWebPopup(webPopup)) {\n return;\n }\n\n if (frequency === 'ONCE') {\n await this.pw.data.addShownWebPopup(code);\n return;\n }\n\n if (frequency === 'ONCE_PER_SESSION') {\n sessionStorage.setItem(this.getSessionStorageKey(code), '1');\n }\n }\n\n private getSessionStorageKey(code: string): string {\n return `${WEB_POPUPS_WIDGET_NAMESPACE}.shown.${code}`;\n }\n}\n\nconst PLACEMENT_RANKS: Record<string, number> = {\n WEB_PLACEMENT_PRIORITY_LOW: 1,\n WEB_PLACEMENT_PRIORITY_MEDIUM: 2,\n WEB_PLACEMENT_PRIORITY_HIGH: 3,\n};\n\nfunction placementRank(placement?: WebPlacement): number {\n return PLACEMENT_RANKS[placement?.priority ?? ''] ?? PLACEMENT_RANKS.WEB_PLACEMENT_PRIORITY_MEDIUM;\n}\n\nfunction placementDeadline(placement?: WebPlacement): number | null {\n const deadline = placement?.expires_at ? Date.parse(placement.expires_at) : NaN;\n\n return Number.isNaN(deadline) ? null : deadline;\n}\n\nfunction placementExpired(placement: WebPlacement | undefined, now: number): boolean {\n const deadline = placementDeadline(placement);\n\n return deadline !== null && deadline <= now;\n}\n\n// SCROLL and EXIT_INTENT popups are shown on a visitor action: whatever delay they carry is not read.\nfunction queueDelay(popup: WebPopup): number {\n return isScrollWebPopup(popup) || isExitIntentWebPopup(popup) ? 0 : popup.delay;\n}\n\n/** Placements reuse the popup pipeline: no page rules, delay or frequency of their own. */\nfunction placementPopup(placement: WebPlacement): WebPopup {\n return {\n code: placement.hash,\n popup_form_content_code: placement.content_code,\n device_type: 'ALL',\n visitors_type: 'ALL',\n matching_pages: [],\n delay: 0,\n frequency: 'EVERY_VISIT',\n trigger_type: 'API',\n kind: placement.kind === 'WEB_PLACEMENT_KIND_EMBEDDED' ? 'EMBEDDED' : 'POPUP',\n css_selector: placement.css_selector,\n };\n}\n","import { render } from 'preact';\n\nimport {\n WebPopupInline, type WebPopupColorSchemePref, type WebPopupParams,\n} from '@pushwoosh/websdk-common/web-popups';\n\nimport { type WebPopupSubmitHandlers } from './renderer';\nimport { submitSubscriptionForm } from './subscriptionFormApi';\nimport { webPopupLogger } from './webPopupLogger';\n\n/** Mount an EMBEDDED block inline; unmount it with `unmountWebPopup`. `onRequestRemove` is the subscribe button's close, `onRequestClose` keeps close buttons. */\nexport const renderEmbeddedWebPopup = (\n container: HTMLElement,\n params: WebPopupParams,\n handlers: WebPopupSubmitHandlers,\n colorScheme: WebPopupColorSchemePref = 'auto',\n onRequestRemove?: () => void,\n onRequestClose?: () => void,\n): void => {\n render(\n <WebPopupInline\n params={params}\n colorScheme={colorScheme}\n onSubmitForm={submitSubscriptionForm}\n onSubmitFormValues={handlers.onSubmitFormValues}\n onSubmitChoice={handlers.onSubmitChoice}\n onSubmitRating={handlers.onSubmitRating}\n onRequestSubscribe={handlers.onRequestSubscribe}\n products={handlers.products}\n onRequestRemove={onRequestRemove}\n onRequestClose={onRequestClose}\n logger={webPopupLogger}\n />,\n container,\n );\n};\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__524__","__WEBPACK_EXTERNAL_MODULE__873__","__WEBPACK_EXTERNAL_MODULE__247__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","defineProperties","Symbol","toStringTag","value","__esModule","SAFE_URL_PROTOCOL","WEB_POPUP_TEXT_COLOR","WEB_POPUP_TEXT_SECONDARY_COLOR","WEB_POPUP_ON_ACCENT_COLOR","WEB_POPUP_DEFAULT_COLORS","WEB_POPUP_TEXT_VARIANT_STYLES","h1","fontSize","fontWeight","lineHeight","h2","h3","body","caption","eyebrow","letterSpacing","icon","INVERSE_TEXT_ALPHAS","webPopupTextColor","variant","colors","inverse","color","alpha","hex","exec","full","length","split","map","c","join","g","b","parseInt","slice","inverseColorAt","textInverse","textSecondary","text","HEADING_VARIANTS","webPopupSlotRole","slot","type","includes","WEB_POPUP_BUTTON_SLOT_PADDING","webPopupButtonPillStyle","display","boxSizing","width","padding","borderRadius","fontFamily","textAlign","textDecoration","cursor","backgroundColor","surface","accent","border","onAccent","webPopupFormInputStyle","borderColor","surfaceText","outline","WEB_POPUP_FORM_DEFAULTS","WEB_POPUP_CHOICE_DEFAULTS","WEB_POPUP_PRODUCTS_DEFAULTS","WEB_POPUP_RATING_DEFAULTS","WEB_POPUP_RETRY_ERROR","WEB_POPUP_EMAIL_PATTERN","WEB_POPUP_EMAIL_INPUT_DEFAULTS","WEB_POPUP_TAG_INPUT_DEFAULTS","WEB_POPUP_CONSENT_DEFAULTS","WEB_POPUP_SUBMIT_DEFAULTS","WEB_POPUP_KEYFRAMES","webPopupArrowPoints","side","WEB_POPUP_SLIDE_CLOSE_REVEALED_SIZE","Math","round","WEB_POPUP_SLIDE_CLOSE_SIZE","WEB_POPUP_GLYPH_PATHS","bell","gift","cart","chart","lock","calendar","check","star","clock","tag","mail","phone","download","play","shield","sparkle","percent","truck","ticket","user","WEB_POPUP_GLYPH_NAMES","keys","WEB_POPUP_GLYPH_SIZES","CONTAINER_TYPES","ORDERS","ALIGN_ITEMS","JUSTIFY_CONTENT","TEXT_ALIGNS","TONES","MAX_LENGTH_PX","LENGTH_UNIT_MAX","px","em","rem","LENGTH_PATTERN","TRACK_UNIT_MAX","fr","TRACK_PATTERN","TRACK_KEYWORDS","oneOf","allowed","cssLength","Number","isFinite","min","max","match","trim","amount","unit","parseFloat","BOX_SIDES","trackSize","token","nonEmptyString","containerProps","raw","props","gap","whole","sides","sideValue","boxPadding","alignItems","justifyContent","alignContent","backgroundImage","sizes","isInteger","tokens","clamped","every","trackSizes","normalizeNode","depth","budget","nodes","node","content","out","align","tone","image","Array","isArray","children","child","normalized","push","order","reverse","normalizeWebPopupLayout","WEB_POPUP_VALUE_KEY_PATTERN","VALUE_REF_PATTERN","substituteString","values","substituteWebPopupLayoutValues","layout","substituteNode","BINDING_PROPS","Set","entries","has","webPopupCssLength","webPopupTracksValue","childCount","webPopupScrimGradient","dim","scrim","webPopupBackgroundImageStyle","src","JSON","stringify","backgroundSize","backgroundPosition","webPopupContainerStyle","backgroundSrc","backgroundDim","style","minWidth","gridAutoFlow","gridTemplateColumns","gridTemplateRows","top","right","bottom","left","webPopupPaddingValue","assign","HEX_RE","parseHex","toHex","v","toString","padStart","hueToChannel","p","q","t","tn","foldLightness","l","liftLightness","webPopupShiftColor","direction","rgb","h","s","rn","gn","bn","rgbToHsl","hslToRgb","webPopupMixColor","base","over","ratio","webPopupColorAlpha","isLightColor","autoDarkWebPopupColors","light","background","derivedColors","scheme","error","chromeIcon","webPopupDarkEnabled","chrome","dark","enabled","webPopupEffectiveScheme","resolveWebPopupColors","effective","webPopupImageSrc","srcDark","resolveWebPopupBoxChrome","overlay","boxShadow","WALL_CLOCK","zoneFormatters","Map","zoneFormatter","timeZone","cached","formatter","Intl","DateTimeFormat","hour12","year","month","day","hour","minute","second","set","webPopupTimeZoneSupported","timezone","zoneOffsetMs","instantMs","parts","formatToParts","Date","read","find","part","UTC","DAY_MS","deadlines","webPopupWallClockMs","endTime","cacheKey","resolved","rawSecond","isNaN","wallAsUtc","rolled","getUTCMonth","getUTCDate","offsets","probe","offset","candidateOffsets","instants","filter","resolveWallClockMs","size","clear","TIMER_LABELS","en","days","hours","minutes","seconds","ru","de","es","pt","ja","ko","zh","hi","ar","he","th","webPopupTimerLabels","language","RTL_LETTER","LETTER","NOT_COPY","safeUrl","url","trimmed","startsWith","test","webPopupLinkTargetAttrs","target","rel","applyWebPopupSubscribeOutcome","action","result","logger","outcome","onGranted","onDenied","href","warn","window","location","open","openWebPopupSubscribeLink","page","SANITIZE_ALLOWED_TAGS","copySanitized","from","to","doc","childNodes","nodeType","appendChild","createTextNode","textContent","el","tagName","clean","createElement","toLowerCase","getAttribute","setAttribute","sanitizeWebPopupHtml","html","parsed","DOMParser","parseFromString","innerHTML","colorString","normalizeWebPopupDark","params","authored","auto","opacity","normalizeOverlay","parseWebPopupJson","json","parse","candidate","version","pages","normalizeWebPopupColors","IMAGE_FITS","normalizeVideo","video","controls","loop","normalizeImages","img","label","mediaId","mediaIdDark","fit","blur","LENGTH_CONTROL_UNITS","finiteNumber","normalizeValueControl","control","kind","units","u","ranges","entry","normalizeControlRanges","options","option","normalizeWebPopupValues","some","webPopupValuesMap","fromEntries","FORM_FIELD_KINDS","BUTTON_VARIANTS","normalizeFormFields","field","f","placeholder","required","unshift","CHOICE_CONTROLS","PRODUCTS_STRATEGIES","productsStrategy","PRODUCTS_LAYOUTS","RATING_SCALES","RATING_SUBMIT_MODES","TIMER_EXPIRE_ACTIONS","LANGUAGE_CODE","HEX_COLOR","MAX_SLOT_MESSAGE","slotString","slotStringOr","fallback","normalizeLanguage","code","normalizeChoiceOptions","existing","tagValue","normalizeChoiceBounds","bound","n","floor","normalizeSlots","zone","expirePage","onExpire","expires","showLabels","submitLabel","submitVariant","successMessage","labels","scale","low","high","submitMode","eventName","fields","limit","strategy","fallbackStrategy","title","price","cta","ctaText","hideWhenEmpty","formCode","privacy","checkboxLabel","linkLabel","confirmEmailMessage","errorMessage","requiredMessage","invalidMessage","name","normalizeContents","slots","validSize","resolveWebPopupPageSize","own","shared","axis","resolveWebPopupPages","height","leftAction","normalizeWebPopupArrowAction","rightAction","images","contents","role","clampNumber","webPopupDirection","dir","texts","rtl","ltr","char","replace","detectTextDirection","flatMap","webPopupSlotCopy","webPopupCssTextAlign","startPageOf","startPage","placementMaxSize","placement","zoneWithoutCloseButtons","isWebPopupCloseButton","webPopupPageWithoutCloseButtons","FORM_FIELD_SLOT_TYPES","FORM_SLOT_TYPES","isFormFieldSlot","webPopupFormFieldId","pageKey","slotKey","webPopupHasForm","fieldError","input","checks","id","validateWebPopupForm","errors","isClickWebPopup","popup","trigger_type","clickMatchesSelector","event","selector","path","composedPath","Element","elements","parentElement","clickedElements","element","matches","WEB_POPUPS_WIDGET_NAMESPACE","WEB_POPUPS_LOG_PREFIX","EMBEDDED_ORDER_ATTRIBUTE","STORE_NAME_KEY_VALUE","STORE_NAME_MESSAGE_LOG","STORE_NAME_INBOX_MESSAGES","storeCreatorDecorator","storeCreator","database","objectStoreNames","contains","initial","createObjectStore","keyPath","logStore","autoIncrement","createIndex","unique","statusIndex","store","multiEntry","Migrations","all","MigrationExecutor","constructor","db","migrationsBuilder","applyMigrations","applyMigrationsPack","migrationsPack","forEach","migration","onversionchange","console","info","close","databasePromise","getInstanceWithPromise","executor","Promise","resolve","reject","request","indexedDB","onsuccess","bind","onerror","onupgradeneeded","then","LogBase","_add","transaction","objectStore","add","getAll","items","ids","sort","maxItems","delete","openCursor","ev","cursorResult","continue","log","environment","self","registration","message","additional","date","Error","stack","levels","debug","limitLevel","Logger","setLevel","level","write","createChoiceSubmitHandler","pw","async","api","setTags","operation","createRatingSubmitHandler","score","postEvent","createSubscribeHandler","campaignCode","permissionBefore","driver","getPermission","hadToken","checkDeviceSubscribeForPushNotifications","catch","isSubscribed","subscribe","isDeviceRegistered","permission","recordPopupFormEvent","createFormValuesSubmitHandler","response","submitPopupForm","levelName","levelNumber","args","groupCollapsed","trace","groupEnd","DARK_MEDIA_QUERY","prefersDark","matchMedia","useColorScheme","pref","watch","setDark","compat_root_preactCompat_","useState","watchDeps","prevWatchDeps","setPrevWatchDeps","dep","index","useEffect","media","onChange","addEventListener","removeEventListener","WEB_POPUP_INLINE_SCOPE_ATTRIBUTE","WEB_POPUP_CLOSE_ATTRIBUTE","WEB_POPUP_SUBMIT_ATTRIBUTE","WEB_POPUP_INLINE_WRAPPER_STYLE","WEB_POPUP_INLINE_IMAGE_CAP_CSS","WebPopupFormSessionContext","createContext","phase","setText","setCheck","submit","turnPage","go","advance","withoutKey","record","useWebPopupFormSession","onPageChange","onSubmitFormValues","useMemo","collectWebPopupFormFields","setTexts","setChecks","setErrors","setPhase","pageIndex","findIndex","pageValid","found","invalid","formValid","tags","policyAccepted","email","webPopupFormValues","showInvalidEmail","success","prev","checked","targetIndex","forward","next","fieldSlotStyle","captionStyle","errorStyle","paddingTop","labelStyle","look","paddingBottom","TextFieldView","inputType","autoComplete","session","useContext","focused","setFocused","jsx_runtime_root_jsxRuntime_","jsxs","jsx","disabled","onFocus","onBlur","currentTarget","onKeyDown","EmailInputSlotView","TagInputSlotView","checkboxStyle","margin","flexShrink","styles_labelStyle","ConsentSlotView","Fragment","slotStyle","pillStyle","submitting","SubmitSlotView","onClick","WebPopupProductsContext","productsCache","WeakMap","loadWebPopupProducts","host","now","cache","hit","at","load","loaded","formatPrice","currency","String","NumberFormat","format","ProductCard","product","titleColor","priceColor","cardStyle","flexDirection","flex","aspectRatio","ProductsSlotView","mode","setItems","cancelled","shown","count","_","listStyle","overflowX","webPopupSlideCloseInset","arrowGutter","tip","transition","delay","revealed","wait","ArrowControl","gutter","onRequestClose","hover","setHover","sameTab","tucked","position","marginTop","transform","pointerEvents","glyph","overflow","tabIndex","onMouseEnter","onMouseLeave","viewBox","points","fill","stroke","strokeWidth","strokeLinejoin","SlideOutClose","inset","transformOrigin","WebPopupRevealControls","reveal","delays","slideOutClose","step","revealStagger","webPopupRevealDelays","WebPopupSubscribeContext","answered","markAnswered","ANIMATION_STYLE","none","fade","slide","TextSlotView","dangerouslySetInnerHTML","__html","ButtonSlotView","onRequestSubscribe","onSubscribeClose","form","askPhase","setAskPhase","pill","wrapper","spent","ask","SlotMessageView","FORM_INPUT_TYPES","FORM_AUTOCOMPLETE","firstName","lastName","PRIVACY_ERROR_KEY","FormSlotView","onSubmitForm","setValues","setPolicyAccepted","focusedKey","setFocusedKey","captionColor","privacyHref","noValidate","onSubmit","preventDefault","payload","customFields","setFieldValue","k","TimerCell","digitStyle","TimerSlotView","nowMs","setNowMs","remaining","deadline","total","webPopupTimerRemaining","expired","setInterval","clearInterval","digitColor","labelColor","fontVariantNumeric","cells","cell","ChoiceSlotView","onSubmitChoice","picked","setPicked","notice","setNotice","toggle","textColor","optionStyle","flexWrap","selected","accentColor","RatingButton","onPick","thumbs","strokeLinecap","RatingSlotView","onSubmitRating","setScore","send","scores","edgeLabelStyle","isSelected","pick","GlyphSlotView","WebPopupSlotView","pageChange","ContentNodeView","leaf","z","renderZone","previous","mediaVideoSrc","MediaVideo","poster","autoPlay","muted","playsInline","preload","ImageNodeView","renderImage","objectFit","alt","LayeredBackgroundBox","outer","inner","layer","rest","LayoutNodeView","bgKey","bgVideo","bgSrc","backdropFilter","WebkitBackdropFilter","WebPopupBox","colorScheme","leafRenderers","animatePage","products","formSession","subscribeSession","setAnswered","useWebPopupSubscribeSession","box","overflowY","pageStyle","animation","minHeight","Provider","CloseButton","insetInlineEnd","fixedContainerStyle","room","sideOffset","topOffset","maxWidth","maxHeight","tx","ty","anim","WebPopupReader","setPageKey","Image","hoverCapable","capable","useWebPopupHoverCapable","handlers","revealHandlers","setRevealed","timerRef","useRef","cancel","current","clearTimeout","show","hide","setTimeout","e","relatedTarget","useWebPopupReveal","hasArrows","resolveWebPopupReveal","webPopupRevealRoom","WebPopupInline","onRequestRemove","webPopupParamsWithoutCloseButtons","SUBMIT_RESULTS","SUBMIT_FORM_RESULT_SUBSCRIBED","SUBMIT_FORM_RESULT_CONFIRM_EMAIL","SUBMIT_FORM_RESULT_ALREADY_SUBSCRIBED","formUrl","encodeURIComponent","submitSubscriptionForm","fetch","method","headers","userId","ok","status","data","webPopupLogger","isEmbeddedWebPopup","EmbeddedWebPopups","deps","blocks","viewed","autoSkipLogged","syncWithPage","canAutoShow","isConnected","remove","trigger","matchesPage","place","removeWhere","shouldRemove","block","findContainer","document","insertBefore","firstBlockAfter","shadow","attachShadow","container","dismissible","createDismissButton","dismiss","render","observer","watchFirstView","reportShown","button","font","hasAttribute","disconnect","unmount","css_selector","logSkip","querySelector","details","recordVisit","dispatchShown","IntersectionObserver","reportViewed","records","isIntersecting","observe","recordImpression","recordFormViews","TOUCH_EVENTS","ACTIVATION_EVENTS","GUARD_STATE_KEY","isExitIntentWebPopup","asObject","state","isGuardState","watchCursorLeave","onExit","onMouseOut","clientY","watchTabSwitch","onVisibilityChange","visibilityState","watchFastScrollUp","lastY","scrollY","lastTime","lastTouch","NEGATIVE_INFINITY","onTouch","onScroll","y","speed","innerHeight","capture","passive","watchBack","guardHref","onGuard","pushGuard","removeActivationListeners","history","guardState","pushState","onPopState","leftGuard","back","listenForContentClicks","closest","webPopupProductsAvailable","collectWebPopupProductSlots","CAMPAIGN_VALUE","not_determined","granted_explicit","denied","unsupported","CONDITIONS","matchesPushPermission","push_permission_status","toUpperCase","getPushPermissionStatus","readCampaignValue","unmountWebPopup","external_commonjs_preact_commonjs2_preact_amd_preact_root_preact_","isScrollWebPopup","pageScrollDepth","scrollHeight","scrollingElement","documentElement","getPagePath","pathname","decodeURIComponent","WebPopupsWidget","recommendations","isRecurringVisitor","contentEntries","placementEntries","placementSeq","placementCounter","dismissedPlacements","shownPlacements","placementsActive","queue","visible","drainTimeoutId","autoShowEnabled","isNavigationSubscribed","stopClickWatch","badClickSelectors","openPopupsCount","bodyOverflowBeforeLock","readyPromise","readyResolve","submitHandlers","item","image_url","trackClick","productId","embedded","checkSoftCondition","listenForInteractions","renderEmbeddedWebPopup","handlersFor","other","dismissPlacement","recordSubscriptionFormViews","dispatchEvent","moduleRegistry","webPopups","run","initParams","enable","autoShow","features","getFeatures","hasCampaigns","buffered","acceptPlacements","placementsAllowed","ensureDeviceRegistered","getIsRecurringVisitor","getPopupForms","webPopup","createEntry","allSettled","passedStrongConditions","checkStrongCondition","passedFrequency","checkCanBeShownByFrequencyCondition","shouldPrefetchContent","ensureContent","loadedCodes","subscribeToNavigation","subscribeToPushPermission","renderForCurrentPage","watchClickTriggers","pullPlacements","setIsRecurringVisitor","getContentEntry","isEmbedded","productsEmpty","checkNotExpired","detachFromAutoPipeline","present","hideAll","hadVisible","cancelScheduledDrain","isVisible","getVisibleCode","getAvailableCodes","getState","waiting","queued","available","webPlacements","takeWebPlacements","webPlacementsSink","placements","receivePlacements","syncPlacements","extra","pulled","getWebPlacements","authoritative","live","hash","content_code","placementExpired","kept","dropPlacement","popup_form_content_code","device_type","visitors_type","matching_pages","frequency","placementPopup","scheduleExpiry","renderPlacements","pending","ready","renderPlacementBlocks","queuePlacementPopup","winners","placementBeats","busy","idle","best","reduce","winner","insertIntoQueue","drain","rank","placementRank","placementDeadline","trackPlacement","onPlacementsNavigate","trackWebPlacement","entryByCode","loading","timeoutId","stopTriggerWatch","visitRecorded","loadContent","finally","parseWebPopupContent","getPopupFormContent","codes","releaseUnmatchedPending","armed","canAutoDisplay","arm","isAutoEligible","isAutoTrigger","passesDisplayConditions","isStillEligible","onTriggerClick","isClickTarget","armScrollDepth","armExitIntent","armDelay","enqueueArmed","threshold","scroll_depth","scrollThreshold","onReached","frame","ResizeObserver","schedule","stop","cancelAnimationFrame","requestAnimationFrame","watchScrollDepth","formFactor","stops","fn","fire","watchExitIntent","reason","indexOf","queueDelay","splice","shift","scheduleDrain","zIndex","modal","lockBodyScroll","closed","unlockBodyScroll","renderWebPopup","markAsShown","formCodes","collectWebPopupFormCodes","getHwid","hwid","recordSubscriptionFormView","onNavigate","nav","navigation","lastHref","releaseByPushPermission","addSdkEventHandler","addEventHandler","checkCanBeShownByDeviceTypeCondition","checkCanBeShownByVisitorsTypeCondition","checkCanBeShownByMatchingPagesCondition","webPopupExpired","deviceType","getShownWebPopups","sessionStorage","getItem","getSessionStorageKey","matchingPages","matching_page_rules","matchingPageRules","excluded_pages","excludedPages","rule","matchPageRule","Boolean","operator","visitorsType","recordPopupShownEvent","setItem","addShownWebPopup","PLACEMENT_RANKS","WEB_PLACEMENT_PRIORITY_LOW","WEB_PLACEMENT_PRIORITY_MEDIUM","WEB_PLACEMENT_PRIORITY_HIGH","priority","expires_at","NaN"],"sourceRoot":""}