{
  "version": 3,
  "sources": ["/cdn/shop/t/27/assets/bg-storefront-confirm.js?bg_tc_rev=20261012-admin-reference-prices"],
  "sourcesContent": ["(function (window, document) {\n  'use strict';\n\n  // The ONE storefront in-page confirmation dialog (TC-DIALOG-01). Native\n  // window.confirm/alert are banned on storefront surfaces: they are dead\n  // inside iframes and unattended browsers auto-dismiss them (BUG-04). This\n  // file is the single implementation; its consumers are:\n  //   1. bg-designer-storefront-runtime.js (openStorefrontConfirmDialog\n  //      delegates here; the PDP loads this asset before the runtime), and\n  //   2. bg-template-collection.js (the AI-generated edit-service disclaimer).\n  // Behavior contract (mirrors the previously runtime-owned dialog exactly):\n  // focus moves into the dialog, Tab is trapped, Escape cancels, focus returns\n  // to the opener, and the promise resolves true only on the explicit confirm\n  // action. This file also owns the confirm dialog's styles (injected below,\n  // scoped to .bg-designer-storefront-confirm-modal) so the dialog renders\n  // identically on pages that do not load bg-designer-storefront.css.\n  if (window.BgStorefrontConfirm) return;\n\n  function text(value) {\n    return String(value == null ? '' : value).trim();\n  }\n\n  function escapeHtml(value) {\n    return String(value == null ? '' : value)\n      .replace(/&/g, '&amp;')\n      .replace(/</g, '&lt;')\n      .replace(/>/g, '&gt;')\n      .replace(/\"/g, '&quot;')\n      .replace(/'/g, '&#39;');\n  }\n\n  function getFocusableElements(overlay) {\n    if (!overlay) return [];\n    return Array.prototype.slice.call(overlay.querySelectorAll(\n      'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n    )).filter(function (node) {\n      return !node.hidden\n        && node.getAttribute('aria-hidden') !== 'true'\n        && !(node.closest && node.closest('[hidden], [inert], [aria-hidden=\"true\"]'));\n    });\n  }\n\n  // Confirm-dialog styles, scoped to the confirm modal class so pages without\n  // bg-designer-storefront.css (template collections) render the same dialog,\n  // and PDP auth/artwork-later modal restyles never drift this dialog. Values\n  // replicate the shipped auth-modal recipe byte-for-byte.\n  var CONFIRM_STYLES = '' +\n    '.bg-designer-storefront-confirm-modal[hidden]{display:none !important;}' +\n    '.bg-designer-confirm-modal--open{overflow:hidden;}' +\n    '.bg-designer-storefront-confirm-modal{position:fixed;inset:0;z-index:2147482860;display:grid;place-items:center;padding:clamp(.875rem,3vw,1.5rem);}' +\n    '.bg-designer-storefront-confirm-modal.is-open,.bg-designer-storefront-confirm-modal:not([hidden]){overflow:hidden;background:#07122275;-webkit-backdrop-filter:blur(.125rem);backdrop-filter:blur(.125rem);}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__backdrop{position:absolute;inset:0;background:rgba(7,18,34,0.22);-webkit-backdrop-filter:blur(.1875rem);backdrop-filter:blur(.1875rem);}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__dialog{position:relative;z-index:1;display:grid;gap:1rem;width:min(31.25rem,calc(100vw - 1.75rem));max-height:calc(100vh - 1.75rem);overflow:auto;padding:1.25rem;border:1px solid rgba(15,41,65,0.14);border-radius:.5rem;background:#fff;color:#0f2941;box-shadow:0 1.5rem 3.5rem rgba(7,18,34,0.28);}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__close{position:absolute;top:.75rem;right:.75rem;display:inline-grid;place-items:center;width:2rem;height:2rem;padding:0;border:1px solid rgba(15,41,65,0.14);border-radius:999px;background:#fff;color:#28455f;font-size:1.25rem;line-height:1;cursor:pointer;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__close:hover,.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__close:focus-visible{border-color:rgba(15,76,129,0.35);background:#eef5ff;outline:none;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__content{display:grid;gap:.625rem;padding-right:2.25rem;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__content h2{margin:0;color:#07120c;font-size:clamp(1.375rem,4vw,1.875rem);font-weight:800;letter-spacing:0;line-height:1.1;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__content p{margin:0;color:#48607a;font-size:.9375rem;line-height:1.5;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__note{padding:.6875rem .75rem;border-radius:.5rem;background:#f4f7fb;color:#28455f !important;font-size:.8125rem !important;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__actions{display:grid;grid-template-columns:1fr 1fr;gap:.625rem;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__button{display:inline-flex;align-items:center;justify-content:center;min-height:2.875rem;padding:.6875rem .875rem;border:1px solid transparent;border-radius:.5rem;font:inherit;font-size:.875rem;font-weight:800;line-height:1.25;text-align:center;cursor:pointer;transition:background-color 140ms ease,border-color 140ms ease,color 140ms ease,box-shadow 140ms ease;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__button--primary{background:#0f4c81;color:#fff;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__button--primary:hover,.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__button--primary:focus-visible{background:#0b3b64;color:#fff;box-shadow:0 0 0 3px rgba(15,76,129,0.16);outline:none;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__button--secondary{border-color:#b7c9df;background:#fff;color:#0f4c81;}' +\n    '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__button--secondary:hover,.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__button--secondary:focus-visible{border-color:#0f4c81;background:#eef5ff;outline:none;}' +\n    '@media screen and (max-width:980px){' +\n      '.bg-designer-storefront-confirm-modal{padding:.75rem;}' +\n      '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__dialog{width:min(100%,31.25rem);padding:1rem;}' +\n      '.bg-designer-storefront-confirm-modal .bg-designer-storefront-auth-modal__actions{grid-template-columns:1fr;}' +\n    '}';\n\n  function ensureStyles() {\n    if (document.querySelector('style[data-bg-storefront-confirm-style]')) return;\n    var style = document.createElement('style');\n    style.setAttribute('data-bg-storefront-confirm-style', '1');\n    style.textContent = CONFIRM_STYLES;\n    (document.head || document.documentElement).appendChild(style);\n  }\n\n  function ensureDialog() {\n    var existing = document.querySelector('[data-bg-designer-confirm-modal]');\n    if (existing) return existing;\n    var modal = document.createElement('div');\n    modal.className = 'bg-designer-storefront-auth-modal bg-designer-storefront-confirm-modal';\n    modal.hidden = true;\n    modal.setAttribute('data-bg-designer-confirm-modal', '1');\n    modal.setAttribute('aria-hidden', 'true');\n    modal.innerHTML = '' +\n      '<div class=\"bg-designer-storefront-auth-modal__backdrop\" data-bg-designer-confirm-cancel></div>' +\n      '<div class=\"bg-designer-storefront-auth-modal__dialog\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"bg-designer-confirm-modal-title\" tabindex=\"-1\">' +\n        '<button type=\"button\" class=\"bg-designer-storefront-auth-modal__close\" aria-label=\"Close confirmation\" data-bg-designer-confirm-cancel>&times;</button>' +\n        '<div class=\"bg-designer-storefront-auth-modal__content\">' +\n          '<h2 id=\"bg-designer-confirm-modal-title\"></h2>' +\n          '<div data-bg-designer-confirm-body></div>' +\n          '<p class=\"bg-designer-storefront-auth-modal__note\" data-bg-designer-confirm-note hidden></p>' +\n        '</div>' +\n        '<div class=\"bg-designer-storefront-auth-modal__actions\">' +\n          '<button type=\"button\" class=\"bg-designer-storefront-auth-modal__button bg-designer-storefront-auth-modal__button--secondary\" data-bg-designer-confirm-cancel data-bg-designer-confirm-cancel-action></button>' +\n          '<button type=\"button\" class=\"bg-designer-storefront-auth-modal__button bg-designer-storefront-auth-modal__button--primary\" data-bg-designer-confirm-accept></button>' +\n        '</div>' +\n      '</div>';\n    document.body.appendChild(modal);\n    return modal;\n  }\n\n  // Reentrancy: a second open must not strand the first caller's promise.\n  var activeFinish = null;\n\n  function isOpen() {\n    var modal = document.querySelector('[data-bg-designer-confirm-modal]');\n    return !!(modal && !modal.hidden);\n  }\n\n  function open(options) {\n    var settings = options && typeof options === 'object' ? options : {};\n    ensureStyles();\n    var modal = ensureDialog();\n    var title = modal.querySelector('#bg-designer-confirm-modal-title');\n    if (title) title.textContent = text(settings.title) || 'Please confirm';\n    var body = modal.querySelector('[data-bg-designer-confirm-body]');\n    if (body) {\n      var lines = Array.isArray(settings.body) ? settings.body : [settings.body];\n      body.innerHTML = lines.map(function (line) {\n        return text(line) ? '<p>' + escapeHtml(text(line)) + '</p>' : '';\n      }).join('');\n    }\n    var note = modal.querySelector('[data-bg-designer-confirm-note]');\n    if (note) {\n      note.textContent = text(settings.note);\n      note.hidden = !text(settings.note);\n    }\n    var acceptButton = modal.querySelector('[data-bg-designer-confirm-accept]');\n    if (acceptButton) acceptButton.textContent = text(settings.confirmLabel) || 'Continue';\n    var cancelButton = modal.querySelector('[data-bg-designer-confirm-cancel-action]');\n    if (cancelButton) {\n      cancelButton.textContent = text(settings.cancelLabel) || 'Go back';\n      // Acknowledge-only notices keep the single confirm action.\n      cancelButton.hidden = settings.hideCancelAction === true;\n    }\n    var previousFocus = document.activeElement;\n    // Settle the previous dialog as cancelled before rewiring the shared node.\n    if (typeof activeFinish === 'function') activeFinish(false);\n    // Accidental-dismissal guard: the old blocking window.confirm absorbed the\n    // second activation of a double-click/double-Enter; this dialog opens\n    // synchronously under the pointer, so early activations are ignored until\n    // the settle window passes. Tests zero the window via __bgConfirmSettleMs.\n    var settleMs = typeof window.__bgConfirmSettleMs === 'number' ? window.__bgConfirmSettleMs : 350;\n    var openedAt = Date.now();\n    var withinSettleWindow = function () { return (Date.now() - openedAt) < settleMs; };\n    return new Promise(function (resolve) {\n      var settled = false;\n      var finish = function (accepted) {\n        if (settled) return;\n        settled = true;\n        activeFinish = null;\n        modal.hidden = true;\n        modal.classList.remove('is-open');\n        modal.setAttribute('aria-hidden', 'true');\n        document.body.classList.remove('bg-designer-confirm-modal--open');\n        modal.onkeydown = null;\n        if (previousFocus && typeof previousFocus.focus === 'function' && document.contains(previousFocus)) {\n          try { previousFocus.focus({ preventScroll: true }); } catch (_) { previousFocus.focus(); }\n        }\n        resolve(accepted === true);\n      };\n      activeFinish = finish;\n      Array.prototype.slice.call(modal.querySelectorAll('[data-bg-designer-confirm-cancel]')).forEach(function (control) {\n        control.onclick = function (event) {\n          event.preventDefault();\n          if (withinSettleWindow()) return;\n          finish(false);\n        };\n      });\n      if (acceptButton) {\n        acceptButton.onclick = function (event) {\n          event.preventDefault();\n          if (withinSettleWindow()) return;\n          finish(true);\n        };\n      }\n      modal.onkeydown = function (event) {\n        if (modal.hidden) return;\n        if (event.key === 'Escape') {\n          event.preventDefault();\n          event.stopPropagation();\n          if (withinSettleWindow()) return;\n          finish(false);\n          return;\n        }\n        if (event.key !== 'Tab') return;\n        var focusable = getFocusableElements(modal);\n        if (!focusable.length) return;\n        var first = focusable[0];\n        var last = focusable[focusable.length - 1];\n        if (event.shiftKey && document.activeElement === first) {\n          event.preventDefault();\n          last.focus();\n        } else if (!event.shiftKey && document.activeElement === last) {\n          event.preventDefault();\n          first.focus();\n        } else if (!modal.contains(document.activeElement)) {\n          event.preventDefault();\n          first.focus();\n        }\n      };\n      modal.hidden = false;\n      modal.classList.add('is-open');\n      modal.setAttribute('aria-hidden', 'false');\n      document.body.classList.add('bg-designer-confirm-modal--open');\n      window.requestAnimationFrame(function () {\n        if (modal.hidden) return;\n        // Focus the dialog panel itself, not an action button: a queued\n        // double-Enter must not land on Cancel (or Continue) and answer the\n        // question the shopper never read. Tab reaches the actions next.\n        var focusTarget = modal.querySelector('[role=\"dialog\"]')\n          || (cancelButton && !cancelButton.hidden ? cancelButton : acceptButton)\n          || modal;\n        if (focusTarget && typeof focusTarget.focus === 'function') {\n          try { focusTarget.focus({ preventScroll: true }); } catch (_) { focusTarget.focus(); }\n        }\n      });\n    });\n  }\n\n  window.BgStorefrontConfirm = {\n    open: open,\n    isOpen: isOpen\n  };\n})(window, document);\n"],
  "mappings": "CAAC,SAAUA,QAAQC,UAAU,CAC3B,aA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