/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ "./src/divi/index.js"
/*!***************************!*\
  !*** ./src/divi/index.js ***!
  \***************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style.css */ "./src/divi/style.css");
/* harmony import */ var _shared_share_bar_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/share-bar.css */ "./src/shared/share-bar.css");
/* harmony import */ var _shared_review_notice_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/review-notice-dom */ "./src/shared/review-notice-dom.js");
/* harmony import */ var _shared_publish_guard_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/publish-guard-ui */ "./src/shared/publish-guard-ui.js");




(function bootDiviReview(attempt) {
  const drawer = document.getElementById('flow-ew-divi-drawer');
  if (!drawer) {
    if (attempt < 150) {
      requestAnimationFrame(function () {
        bootDiviReview(attempt + 1);
      });
    }
    return;
  }
  if (drawer.dataset.flowEwDiviReady === '1') {
    return;
  }
  drawer.dataset.flowEwDiviReady = '1';
  (function runDiviReview(drawer) {
    let reviewWrapper = null;
    let reviewMainButton = null;
    let reviewDropdownButton = null;
    let toolbarMounted = false;
    function debounce(fn, ms) {
      let t;
      return function () {
        clearTimeout(t);
        t = setTimeout(fn, ms);
      };
    }
    function ensureDrawerHost() {
      const host = document.querySelector('.et-vb-top-window-ui');
      if (!host) {
        return false;
      }
      if (drawer.parentElement !== host) {
        host.appendChild(drawer);
      }
      return true;
    }
    function reviewLabel() {
      const i18n = window.flowEW && window.flowEW.i18n;
      return i18n && i18n.reviewPanelTitle || 'Review';
    }
    function findPageBarActions() {
      return document.querySelector('.et-vb-page-bar-right-side-save-button') || document.querySelector('.et-vb-page-bar-tools .et-vb-page-bar-right-side-save-button') || document.querySelector('.et-vb-page-bar')?.querySelector('.et-vb-page-bar-dropdown-button--fill')?.closest('.et-vb-page-bar-tools') || null;
    }
    function findPreviewWrapper() {
      const bar = findPageBarActions();
      if (!bar) {
        return null;
      }
      const wrappers = Array.from(bar.querySelectorAll('.et-vb-page-bar-dropdown-button-wrapper'));
      const byLabel = wrappers.find(function (wrapper) {
        const btn = wrapper.querySelector('.et-vb-page-bar-action-button');
        if (!btn) {
          return false;
        }
        const label = (btn.textContent || '').trim();
        return /preview/i.test(label);
      });
      if (byLabel) {
        return byLabel;
      }
      const saveIdx = wrappers.findIndex(function (wrapper) {
        return !!wrapper.querySelector('.et-vb-page-bar-dropdown-button--fill');
      });
      if (saveIdx > 0) {
        return wrappers[saveIdx - 1];
      }
      return wrappers.length >= 2 ? wrappers[1] : null;
    }
    function findExitWrapper() {
      const bar = findPageBarActions();
      if (!bar) {
        return null;
      }
      const byClass = bar.querySelector('.et-vb-page-bar-exit-button');
      if (byClass) {
        return byClass;
      }
      return Array.from(bar.querySelectorAll('.et-vb-page-bar-dropdown-button-wrapper')).find(function (wrapper) {
        const btn = wrapper.querySelector('.et-vb-page-bar-action-button');
        return btn && /^\s*exit\s*$/i.test((btn.textContent || '').trim());
      }) || null;
    }
    function bindReviewButtons(wrapper) {
      if (!wrapper) {
        return;
      }
      reviewMainButton = wrapper.querySelector('.et-vb-page-bar-action-button');
      reviewDropdownButton = wrapper.querySelector('.et-vb-page-bar-dropdown-button--dropdown-menu');
      [reviewMainButton, reviewDropdownButton].forEach(function (btn) {
        if (!btn) {
          return;
        }
        if (btn.dataset.flowEwReviewBound === '1') {
          return;
        }
        btn.dataset.flowEwReviewBound = '1';
        btn.addEventListener('click', function (e) {
          e.preventDefault();
          e.stopPropagation();
          e.stopImmediatePropagation();
          toggleDrawer();
        }, true);
      });
      wrapper.dataset.flowEwReviewBound = '1';
    }
    function ensureReviewMainButtonContent(btn) {
      if (!btn) {
        return null;
      }
      let dot = btn.querySelector('.flow-ew-divi-review-dot');
      let label = btn.querySelector('.flow-ew-divi-review-label');
      if (!dot || !label) {
        btn.textContent = '';
        dot = document.createElement('span');
        dot.className = 'flow-ew-divi-review-dot';
        dot.hidden = true;
        dot.setAttribute('aria-hidden', 'true');
        label = document.createElement('span');
        label.className = 'flow-ew-divi-review-label';
        btn.appendChild(dot);
        btn.appendChild(label);
      }
      label.textContent = reviewLabel();
      btn.setAttribute('aria-label', reviewLabel());
      return {
        dot,
        label
      };
    }
    function syncReviewToolbarStatus(review) {
      if (!reviewWrapper) {
        return;
      }
      const status = review ? review.display_status || review.status || '' : '';
      if (status) {
        reviewWrapper.setAttribute('data-status', status);
      } else {
        reviewWrapper.removeAttribute('data-status');
      }
      const dot = reviewWrapper.querySelector('.flow-ew-divi-review-dot');
      if (dot) {
        dot.hidden = !status;
      }
    }
    function createReviewWrapper(previewWrapper) {
      const wrapper = document.createElement('div');
      wrapper.className = 'et-vb-page-bar-dropdown-button-wrapper flow-ew-divi-review-wrapper';
      const inner = document.createElement('div');
      inner.className = 'et-vb-page-bar-dropdown-button';
      const mainBtn = document.createElement('button');
      mainBtn.className = 'et-vb-page-bar-action-button';
      mainBtn.type = 'button';
      ensureReviewMainButtonContent(mainBtn);
      const dropdownBtn = document.createElement('div');
      dropdownBtn.className = 'et-vb-page-bar-dropdown-button--dropdown-menu';
      dropdownBtn.setAttribute('role', 'button');
      dropdownBtn.tabIndex = 0;
      dropdownBtn.setAttribute('aria-label', reviewLabel());
      const previewCaret = previewWrapper ? previewWrapper.querySelector('.et-vb-page-bar-dropdown-button--dropdown-menu .et-vb-icon') : null;
      if (previewCaret) {
        dropdownBtn.appendChild(previewCaret.cloneNode(true));
      }
      inner.appendChild(mainBtn);
      inner.appendChild(dropdownBtn);
      wrapper.appendChild(inner);
      return wrapper;
    }
    function ensureReviewToolbarButton() {
      const exitWrapper = findExitWrapper();
      const previewWrapper = findPreviewWrapper();
      if (!exitWrapper || !previewWrapper) {
        return false;
      }
      if (!reviewWrapper || !document.body.contains(reviewWrapper)) {
        reviewWrapper = createReviewWrapper(previewWrapper);
      }
      const mainBtn = reviewWrapper.querySelector('.et-vb-page-bar-action-button');
      ensureReviewMainButtonContent(mainBtn);
      syncReviewToolbarStatus(window.flowEW && window.flowEW.activeReview || null);
      const exitParent = exitWrapper.parentElement;
      if (exitParent && (reviewWrapper.parentElement !== exitParent || reviewWrapper.nextElementSibling !== exitWrapper)) {
        exitParent.insertBefore(reviewWrapper, exitWrapper);
      }
      bindReviewButtons(reviewWrapper);
      toolbarMounted = true;
      return true;
    }
    function syncDiviColorMode() {
      const classic = drawer.querySelector('.flow-ew-classic--divi');
      if (classic) {
        // Match Divi submenus: dark panel in both light and dark app modes.
        classic.classList.add('flow-ew-classic--builder-dark');
      }
    }
    syncDiviColorMode();
    if (!document.documentElement.dataset.flowEwDiviColorObserver) {
      document.documentElement.dataset.flowEwDiviColorObserver = '1';
      const colorObserver = new MutationObserver(syncDiviColorMode);
      colorObserver.observe(document.documentElement, {
        attributes: true,
        attributeFilter: ['data-app-color-mode']
      });
    }
    function syncToolbarAndDrawer() {
      ensureDrawerHost();
      return ensureReviewToolbarButton();
    }
    const debouncedEnsure = debounce(syncToolbarAndDrawer, 80);
    const bodyObserver = new MutationObserver(function () {
      if (!toolbarMounted) {
        syncToolbarAndDrawer();
      } else {
        debouncedEnsure();
      }
    });
    bodyObserver.observe(document.body, {
      childList: true,
      subtree: true
    });
    let mountAttempts = 0;
    function tryMountLoop() {
      syncToolbarAndDrawer();
      mountAttempts++;
      if (!toolbarMounted && mountAttempts < 240) {
        requestAnimationFrame(tryMountLoop);
      }
    }
    tryMountLoop();
    function positionDrawer() {
      const anchor = reviewWrapper;
      if (!anchor) {
        return;
      }
      const rect = anchor.getBoundingClientRect();
      const pageBar = document.querySelector('.et-vb-page-bar');
      const topPos = pageBar ? Math.round(pageBar.getBoundingClientRect().bottom) : Math.round(rect.bottom);
      drawer.style.top = topPos + 'px';
      drawer.style.right = Math.round(window.innerWidth - rect.right) + 'px';
      drawer.style.left = 'auto';
    }
    function refreshReviewNotices() {
      const ew = window.flowEW;
      if (!ew) {
        return;
      }
      (0,_shared_review_notice_dom__WEBPACK_IMPORTED_MODULE_2__.ensureReviewNotices)({
        reviewMandatory: ew.reviewMandatory,
        isPublished: ew.isPublished,
        review: ew.activeReview,
        reviewerMeta: ew.reviewerMeta,
        currentUserCan: ew.currentUserCan
      });
    }
    function setReviewActive(isActive) {
      [reviewMainButton, reviewDropdownButton].forEach(function (btn) {
        if (btn) {
          btn.classList.toggle('et-vb-page-bar-button--active', isActive);
        }
      });
    }
    function openDrawer() {
      ensureDrawerHost();
      drawer.hidden = false;
      positionDrawer();
      drawer.classList.add('is-open');
      setReviewActive(true);
      refreshReviewNotices();
    }
    function closeDrawer() {
      drawer.classList.remove('is-open');
      setReviewActive(false);
      drawer.hidden = true;
    }
    function toggleDrawer() {
      if (drawer.classList.contains('is-open')) {
        closeDrawer();
      } else {
        openDrawer();
      }
    }
    document.addEventListener('keydown', function (e) {
      if (e.key === 'Escape' && drawer.classList.contains('is-open')) {
        closeDrawer();
      }
    });
    document.addEventListener('mousedown', function (e) {
      if (!drawer.classList.contains('is-open')) {
        return;
      }
      if (drawer.contains(e.target) || reviewWrapper && reviewWrapper.contains(e.target)) {
        return;
      }
      closeDrawer();
    });
    window.addEventListener('resize', function () {
      if (drawer.classList.contains('is-open')) {
        positionDrawer();
      }
    });
    const ew = window.flowEW || {};
    const reviewMandatory = !!ew.reviewMandatory;
    const isPublished = !!ew.isPublished;
    const reviewerMeta = Number(ew.reviewerMeta || 0);
    let lastReview = ew.activeReview || null;
    let blockedState = false;
    let publishGuardTimer;
    function currentReviewerId(review) {
      const fromReview = Number(review && review.reviewer_id || review && review.reviewer && review.reviewer.id || 0);
      return fromReview > 0 ? fromReview : reviewerMeta;
    }
    function isPublishBlocked(review) {
      if (!reviewMandatory) {
        return false;
      }
      if (isPublished) {
        return false;
      }
      if (!review || review.status !== 'approved') {
        return true;
      }
      return currentReviewerId(review) <= 0;
    }
    function findSaveAndPublishMenuItem() {
      return Array.from(document.querySelectorAll('.et-vb-right-click-option')).find(function (item) {
        return /save\s*&\s*publish/i.test((item.textContent || '').trim());
      });
    }
    function applyPublishGuard(review) {
      blockedState = isPublishBlocked(review);
      document.body.classList.toggle('flow-ew-divi-publish-blocked', blockedState);
      const menuItem = findSaveAndPublishMenuItem();
      if (!menuItem) {
        return;
      }
      const wrap = menuItem.closest('.et-vb-right-click-option-wrap') || menuItem;
      wrap.classList.toggle('et-vb-right-click-option-wrap--disabled', blockedState);
      wrap.classList.toggle('flow-ew-divi-publish-blocked-item', blockedState);
      if (blockedState) {
        menuItem.style.opacity = '0.4';
        menuItem.style.pointerEvents = 'none';
        menuItem.style.cursor = 'not-allowed';
      } else {
        menuItem.style.opacity = '';
        menuItem.style.pointerEvents = '';
        menuItem.style.cursor = '';
      }
      (0,_shared_publish_guard_ui__WEBPACK_IMPORTED_MODULE_3__.syncPublishGuardTooltip)(menuItem, blockedState);
    }
    function schedulePublishGuard(review) {
      if (review !== undefined) {
        lastReview = review;
      }
      clearTimeout(publishGuardTimer);
      publishGuardTimer = setTimeout(function () {
        applyPublishGuard(lastReview);
      }, 80);
    }
    document.addEventListener('click', function (e) {
      if (!blockedState) {
        return;
      }
      const target = e.target;
      if (!target || !target.closest) {
        return;
      }
      if (target.closest('.flow-ew-divi-drawer') || target.closest('.flow-ew-divi-review-wrapper')) {
        return;
      }
      const menuItem = target.closest('.et-vb-right-click-option');
      if (menuItem && /save\s*&\s*publish/i.test((menuItem.textContent || '').trim())) {
        e.preventDefault();
        e.stopImmediatePropagation();
      }
    }, true);
    const guardObserver = new MutationObserver(function () {
      schedulePublishGuard();
    });
    guardObserver.observe(document.body, {
      childList: true,
      subtree: true
    });
    schedulePublishGuard(lastReview);
    function syncReviewerComboboxFromReview(review) {
      const select = drawer.querySelector('#flow-ew-reviewer-select');
      const input = drawer.querySelector('#flow-ew-reviewer-input');
      if (!select || !input) {
        return;
      }
      const list = drawer.querySelector('#flow-ew-reviewer-listbox');
      const rid = review ? Number(review.reviewer_id || review.reviewer && review.reviewer.id || 0) : 0;
      select.value = rid ? String(rid) : '';
      const opt = select.options[select.selectedIndex];
      input.value = opt && opt.value ? opt.textContent.replace(/^\s+|\s+$/g, '') : '';
      if (list) {
        list.querySelectorAll('[role="option"]').forEach(function (li) {
          const match = rid && Number(li.dataset.value) === rid;
          if (match) {
            li.setAttribute('aria-selected', 'true');
          } else {
            li.removeAttribute('aria-selected');
          }
        });
      }
    }
    document.addEventListener('flow-ew:classic-render', function (e) {
      const review = e.detail && e.detail.review;
      syncReviewToolbarStatus(review);
      syncReviewerComboboxFromReview(review);
      schedulePublishGuard(review);
      syncFreeUpsells(review);
    });
    function buildUpsellNode(data, className, linkMarginTop) {
      const wrap = document.createElement('div');
      wrap.className = className;
      wrap.setAttribute('data-flow-ew-divi-upsell', '1');
      const link = document.createElement('a');
      link.href = data.href || '#';
      link.style.marginTop = linkMarginTop;
      const badge = document.createElement('span');
      badge.className = 'flow-ew-upsell-badge';
      badge.textContent = 'PRO';
      link.appendChild(badge);
      link.appendChild(document.createTextNode(data.label));
      wrap.appendChild(link);
      if (data.helpText) {
        const help = document.createElement('p');
        help.className = 'flow-ew-upsell-help';
        help.textContent = data.helpText;
        wrap.appendChild(help);
      }
      return wrap;
    }
    function getFallbackUpsellData(type) {
      if (drawer.dataset.flowEwUpsellEnabled !== '1') {
        return null;
      }
      const href = drawer.dataset.flowEwUpsellHref || '';
      if (!href) {
        return null;
      }
      if (type === 'open') {
        const label = drawer.dataset.flowEwUpsellOpenLabel || '';
        if (!label) {
          return null;
        }
        return {
          href,
          label,
          helpText: drawer.dataset.flowEwUpsellOpenHelp || ''
        };
      }
      const label = drawer.dataset.flowEwUpsellReviewerLabel || '';
      if (!label) {
        return null;
      }
      return {
        href,
        label,
        helpText: drawer.dataset.flowEwUpsellReviewerHelp || ''
      };
    }
    function syncFreeUpsells(review) {
      const openData = window.flowEwUpsell || getFallbackUpsellData('open');
      if (openData && openData.label) {
        drawer.querySelectorAll('.flow-ew-open-review-extras').forEach(function (slot) {
          let node = slot.querySelector('.flow-ew-upsell-open-review');
          if (!node) {
            node = buildUpsellNode(openData, 'flow-ew-upsell-open-review', '6px');
            slot.appendChild(node);
          }
          const open = !!(review && review.is_open);
          node.style.display = open ? '' : 'none';
        });
      }
      const reviewerData = window.flowEwUpsellReviewer || getFallbackUpsellData('reviewer');
      const reviewerSelect = drawer.querySelector('#flow-ew-reviewer-select');
      if (reviewerData && reviewerData.label && reviewerSelect) {
        const anchor = drawer.querySelector('#flow-ew-reviewer-combobox') || reviewerSelect.parentElement;
        if (anchor && anchor.parentElement) {
          let node = anchor.parentElement.querySelector('.flow-ew-upsell-reviewer');
          const hasReviewer = Number(reviewerSelect.value || 0) > 0;
          if (hasReviewer && !node) {
            node = buildUpsellNode(reviewerData, 'flow-ew-upsell-reviewer', '14px');
            anchor.parentElement.insertBefore(node, anchor.nextSibling);
          }
          if (node) {
            node.style.display = hasReviewer ? '' : 'none';
          }
        }
        if (!reviewerSelect.dataset.flowDiviUpsellBound) {
          reviewerSelect.dataset.flowDiviUpsellBound = '1';
          reviewerSelect.addEventListener('change', function () {
            syncFreeUpsells(review);
          });
        }
      }
    }
    const comboboxRoot = drawer.querySelector('#flow-ew-reviewer-combobox');
    if (comboboxRoot) {
      initReviewerCombobox(comboboxRoot);
    }
    function initReviewerCombobox(root) {
      const input = root.querySelector('.flow-ew-reviewer-combobox__input');
      const list = root.querySelector('.flow-ew-reviewer-combobox__list');
      const select = root.querySelector('#flow-ew-reviewer-select');
      if (!input || !list || !select) {
        return;
      }
      const options = Array.from(list.querySelectorAll('[role="option"]'));
      let activeIndex = -1;
      function setOpen(openList) {
        list.hidden = !openList;
        input.setAttribute('aria-expanded', openList ? 'true' : 'false');
      }
      function filterOptions(q) {
        const needle = (q || '').toLowerCase().trim();
        options.forEach(function (li) {
          const label = (li.dataset.label || li.textContent || '').toLowerCase().trim();
          const show = !needle || label.includes(needle);
          li.hidden = !show;
          li.style.display = show ? '' : 'none';
        });
      }
      function visibleOptions() {
        return options.filter(function (li) {
          return !li.hidden && li.style.display !== 'none';
        });
      }
      function chooseOption(li) {
        if (!li || li.hidden) {
          return;
        }
        const id = li.dataset.value;
        const label = li.dataset.label || li.textContent.trim();
        select.value = id;
        input.value = label;
        setOpen(false);
        activeIndex = -1;
        select.dispatchEvent(new Event('change', {
          bubbles: true
        }));
      }
      input.addEventListener('focus', function () {
        if (input.disabled) {
          return;
        }
        filterOptions(input.value);
        setOpen(true);
      });
      input.addEventListener('input', function () {
        if (input.disabled) {
          return;
        }
        filterOptions(input.value);
        setOpen(true);
        activeIndex = -1;
      });
      list.addEventListener('mousedown', function (e) {
        const li = e.target.closest('[role="option"]');
        if (li && !li.hidden) {
          e.preventDefault();
          chooseOption(li);
        }
      });
      document.addEventListener('click', function (e) {
        if (!root.contains(e.target)) {
          setOpen(false);
          activeIndex = -1;
        }
      });
      input.addEventListener('keydown', function (e) {
        if (input.disabled) {
          return;
        }
        const vis = visibleOptions();
        if (e.key === 'ArrowDown') {
          e.preventDefault();
          if (!list.hidden && vis.length) {
            activeIndex = Math.min(activeIndex + 1, vis.length - 1);
            vis[activeIndex].focus();
          } else {
            filterOptions(input.value);
            setOpen(true);
            activeIndex = 0;
            if (vis[0]) {
              vis[0].focus();
            }
          }
        } else if (e.key === 'ArrowUp') {
          e.preventDefault();
          if (!list.hidden && vis.length) {
            activeIndex = Math.max(activeIndex - 1, 0);
            vis[activeIndex].focus();
          }
        } else if (e.key === 'Enter') {
          const focused = list.querySelector('[role="option"]:focus');
          if (focused && !focused.hidden) {
            e.preventDefault();
            chooseOption(focused);
          }
        } else if (e.key === 'Escape') {
          setOpen(false);
          activeIndex = -1;
          input.focus();
        }
      });
    }
    refreshReviewNotices();
  })(drawer);
})(0);

/***/ },

/***/ "./src/shared/is-publish-blocked.js"
/*!******************************************!*\
  !*** ./src/shared/is-publish-blocked.js ***!
  \******************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   isPublishBlocked: () => (/* binding */ isPublishBlocked)
/* harmony export */ });
/**
 * Mirrors PublishGuard / classic-editor publish blocking — show review
 * notices only while this returns true.
 *
 * @param {{
 *   reviewMandatory?: boolean,
 *   isPublished?: boolean,
 *   review?: object|null,
 *   reviewerMeta?: number,
 * }} args
 */
function isPublishBlocked({
  reviewMandatory,
  isPublished,
  review,
  reviewerMeta = 0
}) {
  if (!reviewMandatory || isPublished) {
    return false;
  }
  const fromReview = Number(review?.reviewer_id ?? review?.reviewer?.id ?? 0);
  const fromMeta = Number(reviewerMeta ?? 0);
  const reviewerId = fromReview > 0 ? fromReview : fromMeta;
  return !(review?.status === 'approved' && reviewerId > 0);
}

/***/ },

/***/ "./src/shared/publish-guard-ui.js"
/*!****************************************!*\
  !*** ./src/shared/publish-guard-ui.js ***!
  \****************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   applyPublishGuardControl: () => (/* binding */ applyPublishGuardControl),
/* harmony export */   findBricksPublishControl: () => (/* binding */ findBricksPublishControl),
/* harmony export */   getPublishGuardTooltip: () => (/* binding */ getPublishGuardTooltip),
/* harmony export */   publishGuardTooltipTarget: () => (/* binding */ publishGuardTooltipTarget),
/* harmony export */   syncGutenbergPublishGuardTooltips: () => (/* binding */ syncGutenbergPublishGuardTooltips),
/* harmony export */   syncPublishGuardTooltip: () => (/* binding */ syncPublishGuardTooltip)
/* harmony export */ });
/**
 * Shared publish-guard UI helpers (opacity lock + hover tooltip).
 */

function getPublishGuardTooltip() {
  const i18n = window.flowEW?.i18n || {};
  return i18n.publishGuardTooltip || 'Post can go live only after approval by a reviewer.';
}

/**
 * @param {Element|null|undefined} el
 * @returns {Element|null}
 */
function publishGuardTooltipTarget(el) {
  if (!el || !el.closest) {
    return null;
  }
  if (el.id === 'publish') {
    return el.closest('#publishing-action') || el.parentElement || el;
  }
  const panelToggle = el.closest('.editor-post-publish-panel__toggle, .editor-post-schedule__panel-dropdown');
  if (panelToggle) {
    return panelToggle;
  }
  return el.parentElement || el;
}

/**
 * @param {Element|null|undefined} el
 * @param {boolean} blocked
 */
function applyPublishGuardControl(el, blocked) {
  if (!el) {
    return;
  }
  const hint = getPublishGuardTooltip();
  const tooltipEl = publishGuardTooltipTarget(el);
  if (blocked) {
    el.style.opacity = '0.4';
    el.style.pointerEvents = 'none';
    el.style.cursor = 'not-allowed';
    if (tooltipEl) {
      tooltipEl.setAttribute('title', hint);
      tooltipEl.style.cursor = 'not-allowed';
      tooltipEl.dataset.flowEwPublishGuardTooltip = '1';
    }
    return;
  }
  el.style.opacity = '';
  el.style.pointerEvents = '';
  el.style.cursor = '';
  if (tooltipEl?.dataset.flowEwPublishGuardTooltip === '1') {
    tooltipEl.removeAttribute('title');
    tooltipEl.style.cursor = '';
    delete tooltipEl.dataset.flowEwPublishGuardTooltip;
  }
}
const GUTENBERG_TOOLTIP_SELECTORS = ['.edit-post-header .editor-post-publish-panel__toggle', '.edit-post-header .editor-post-publish-button'];

/**
 * @param {boolean} blocked
 */
function syncGutenbergPublishGuardTooltips(blocked) {
  const hint = getPublishGuardTooltip();
  GUTENBERG_TOOLTIP_SELECTORS.forEach(selector => {
    document.querySelectorAll(selector).forEach(el => {
      if (blocked) {
        el.setAttribute('title', hint);
        el.style.cursor = 'not-allowed';
        el.dataset.flowEwPublishGuardTooltip = '1';
        return;
      }
      if (el.dataset.flowEwPublishGuardTooltip === '1') {
        el.removeAttribute('title');
        el.style.cursor = '';
        delete el.dataset.flowEwPublishGuardTooltip;
      }
    });
  });
}

/**
 * @param {Element|null|undefined} el
 * @param {boolean} blocked
 */
function syncPublishGuardTooltip(el, blocked) {
  if (!el) {
    return;
  }
  const hint = getPublishGuardTooltip();
  if (blocked) {
    el.setAttribute('title', hint);
    el.dataset.flowEwPublishGuardTooltip = '1';
    return;
  }
  if (el.dataset.flowEwPublishGuardTooltip === '1') {
    el.removeAttribute('title');
    delete el.dataset.flowEwPublishGuardTooltip;
  }
}

/** @returns {Element|null} */
function findBricksPublishControl() {
  return document.querySelector('#bricks-toolbar li:has([data-name="publish"])');
}

/***/ },

/***/ "./src/shared/resolve-classic-root.js"
/*!********************************************!*\
  !*** ./src/shared/resolve-classic-root.js ***!
  \********************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   resolveClassicOpenSlot: () => (/* binding */ resolveClassicOpenSlot),
/* harmony export */   resolveClassicRoot: () => (/* binding */ resolveClassicRoot)
/* harmony export */ });
/**
 * Prefer the visible builder drawer panel over the Classic Editor metabox.
 * On `post.php?action=elementor` both can exist in the DOM with duplicate IDs.
 */
function resolveClassicRoot() {
  const builderSelectors = ['#flow-ew-elementor-drawer #flow-ew-classic', '#flow-ew-bricks-drawer #flow-ew-classic', '#flow-ew-breakdance-drawer #flow-ew-classic', '#flow-ew-avada-drawer #flow-ew-classic', '#flow-ew-beaver-drawer #flow-ew-classic', '#flow-ew-divi-drawer #flow-ew-classic'];
  for (let i = 0; i < builderSelectors.length; i++) {
    const el = document.querySelector(builderSelectors[i]);
    if (el) {
      return el;
    }
  }
  return document.getElementById('flow-ew-classic');
}
function resolveClassicOpenSlot() {
  const builderSelectors = ['#flow-ew-elementor-drawer #flow-ew-classic-open-slot', '#flow-ew-bricks-drawer #flow-ew-classic-open-slot', '#flow-ew-breakdance-drawer #flow-ew-classic-open-slot', '#flow-ew-avada-drawer #flow-ew-classic-open-slot', '#flow-ew-beaver-drawer #flow-ew-classic-open-slot', '#flow-ew-divi-drawer #flow-ew-classic-open-slot'];
  for (let i = 0; i < builderSelectors.length; i++) {
    const el = document.querySelector(builderSelectors[i]);
    if (el) {
      return el;
    }
  }
  return document.getElementById('flow-ew-classic-open-slot');
}

/***/ },

/***/ "./src/shared/review-notice-dom.js"
/*!*****************************************!*\
  !*** ./src/shared/review-notice-dom.js ***!
  \*****************************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ensureReviewNotices: () => (/* binding */ ensureReviewNotices),
/* harmony export */   syncReviewNoticeVisibility: () => (/* binding */ syncReviewNoticeVisibility)
/* harmony export */ });
/* harmony import */ var _is_publish_blocked__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-publish-blocked */ "./src/shared/is-publish-blocked.js");
/* harmony import */ var _resolve_classic_root__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolve-classic-root */ "./src/shared/resolve-classic-root.js");


function escHtml(str) {
  const d = document.createElement('div');
  d.textContent = str;
  return d.innerHTML;
}
function collectClassicRoots() {
  const roots = [];
  const primary = (0,_resolve_classic_root__WEBPACK_IMPORTED_MODULE_1__.resolveClassicRoot)();
  if (primary) {
    roots.push(primary);
  }
  document.querySelectorAll('#flow-ew-classic').forEach(el => {
    if (!roots.includes(el)) {
      roots.push(el);
    }
  });
  return roots;
}

/**
 * Toggle publish-guard notices. Works on PHP-rendered and JS-fallback notices.
 */
function syncReviewNoticeVisibility(args) {
  const blocked = (0,_is_publish_blocked__WEBPACK_IMPORTED_MODULE_0__.isPublishBlocked)(args);
  document.querySelectorAll('.flow-ew-review-notice').forEach(el => {
    if (el.dataset.flowEwPublishGuardOnly === '1') {
      el.hidden = !blocked;
      return;
    }
    el.hidden = false;
  });
}
function buildNoticeSpec(flowEW, review, publishBlocked) {
  const i18n = flowEW.i18n || {};
  const noReviewers = !!flowEW.noReviewers;
  const reviewMandatory = !!flowEW.reviewMandatory;
  if (noReviewers && !reviewMandatory) {
    return {
      variant: 'in-review',
      role: 'alert',
      publishGuardOnly: false,
      title: i18n.noReviewRolesTitle || 'No Review Roles Assigned',
      descHtml: flowEW.reviewRolesHintHtml || ''
    };
  }
  if (!publishBlocked) {
    return null;
  }
  if (noReviewers) {
    const descParts = [i18n.reviewMandatoryDesc || i18n.publishGuardTooltip || 'Post can go live only after approval by a reviewer.'];
    if (flowEW.reviewRolesHintHtml) {
      descParts.push(flowEW.reviewRolesHintHtml);
    }
    return {
      variant: 'changes-requested',
      role: 'alert',
      publishGuardOnly: true,
      title: i18n.noReviewRolesTitle || 'No Review Roles Assigned',
      descHtml: descParts.join(' ')
    };
  }
  return {
    variant: 'in-review',
    role: 'note',
    publishGuardOnly: true,
    title: i18n.reviewMandatoryTitle || 'Review Mode set to Mandatory',
    descHtml: i18n.reviewMandatoryDesc || i18n.publishGuardTooltip || 'Post can go live only after approval by a reviewer.'
  };
}
function renderNoticeElement(spec) {
  const div = document.createElement('div');
  div.className = 'flow-ew-review-notice flow-ew-review-notice--' + spec.variant;
  div.setAttribute('role', spec.role);
  div.dataset.flowEwJsNotice = '1';
  if (spec.publishGuardOnly) {
    div.dataset.flowEwPublishGuardOnly = '1';
  }
  div.innerHTML = '<p class="flow-ew-review-notice__title">' + escHtml(spec.title) + '</p>' + '<p class="flow-ew-review-notice__desc">' + spec.descHtml + '</p>';
  return div;
}
function insertNotice(root, notice) {
  const anchor = root.querySelector('#flow-ew-classic-open-slot') || root.firstElementChild;
  if (anchor) {
    anchor.insertAdjacentElement('afterend', notice);
    return;
  }
  root.prepend(notice);
}

/**
 * Ensure review mode notices exist in builder/classic panels (SSR fallback).
 */
function ensureReviewNotices({
  review,
  reviewMandatory,
  reviewerMeta,
  isPublished,
  currentUserCan
}) {
  const flowEW = window.flowEW;
  if (!flowEW || !currentUserCan?.assignReviewer) {
    document.querySelectorAll('.flow-ew-review-notice[data-flow-ew-js-notice="1"]').forEach(el => el.remove());
    syncReviewNoticeVisibility({
      reviewMandatory,
      isPublished,
      review,
      reviewerMeta
    });
    return;
  }
  const publishBlocked = (0,_is_publish_blocked__WEBPACK_IMPORTED_MODULE_0__.isPublishBlocked)({
    reviewMandatory,
    isPublished,
    review,
    reviewerMeta
  });
  const spec = buildNoticeSpec(flowEW, review, publishBlocked);
  collectClassicRoots().forEach(root => {
    const jsNotice = root.querySelector('.flow-ew-review-notice[data-flow-ew-js-notice="1"]');
    const hasPhpNotice = root.querySelector('.flow-ew-review-notice:not([data-flow-ew-js-notice])');
    if (!spec) {
      if (jsNotice) {
        jsNotice.remove();
      }
      return;
    }
    if (hasPhpNotice) {
      if (jsNotice) {
        jsNotice.remove();
      }
      return;
    }
    if (jsNotice) {
      const next = renderNoticeElement(spec);
      jsNotice.replaceWith(next);
      return;
    }
    insertNotice(root, renderNoticeElement(spec));
  });
  syncReviewNoticeVisibility({
    reviewMandatory,
    isPublished,
    review,
    reviewerMeta
  });
}

/***/ },

/***/ "./src/divi/style.css"
/*!****************************!*\
  !*** ./src/divi/style.css ***!
  \****************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin


/***/ },

/***/ "./src/shared/share-bar.css"
/*!**********************************!*\
  !*** ./src/shared/share-bar.css ***!
  \**********************************/
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin


/***/ }

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		if (!(moduleId in __webpack_modules__)) {
/******/ 			delete __webpack_module_cache__[moduleId];
/******/ 			var e = new Error("Cannot find module '" + moduleId + "'");
/******/ 			e.code = 'MODULE_NOT_FOUND';
/******/ 			throw e;
/******/ 		}
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = __webpack_modules__;
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/chunk loaded */
/******/ 	(() => {
/******/ 		var deferred = [];
/******/ 		__webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ 			if(chunkIds) {
/******/ 				priority = priority || 0;
/******/ 				for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ 				deferred[i] = [chunkIds, fn, priority];
/******/ 				return;
/******/ 			}
/******/ 			var notFulfilled = Infinity;
/******/ 			for (var i = 0; i < deferred.length; i++) {
/******/ 				var [chunkIds, fn, priority] = deferred[i];
/******/ 				var fulfilled = true;
/******/ 				for (var j = 0; j < chunkIds.length; j++) {
/******/ 					if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ 						chunkIds.splice(j--, 1);
/******/ 					} else {
/******/ 						fulfilled = false;
/******/ 						if(priority < notFulfilled) notFulfilled = priority;
/******/ 					}
/******/ 				}
/******/ 				if(fulfilled) {
/******/ 					deferred.splice(i--, 1)
/******/ 					var r = fn();
/******/ 					if (r !== undefined) result = r;
/******/ 				}
/******/ 			}
/******/ 			return result;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/jsonp chunk loading */
/******/ 	(() => {
/******/ 		// no baseURI
/******/ 		
/******/ 		// object to store loaded and loading chunks
/******/ 		// undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ 		// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ 		var installedChunks = {
/******/ 			"divi/index": 0,
/******/ 			"divi/style-index": 0
/******/ 		};
/******/ 		
/******/ 		// no chunk on demand loading
/******/ 		
/******/ 		// no prefetching
/******/ 		
/******/ 		// no preloaded
/******/ 		
/******/ 		// no HMR
/******/ 		
/******/ 		// no HMR manifest
/******/ 		
/******/ 		__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/ 		
/******/ 		// install a JSONP callback for chunk loading
/******/ 		var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ 			var [chunkIds, moreModules, runtime] = data;
/******/ 			// add "moreModules" to the modules object,
/******/ 			// then flag all "chunkIds" as loaded and fire callback
/******/ 			var moduleId, chunkId, i = 0;
/******/ 			if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ 				for(moduleId in moreModules) {
/******/ 					if(__webpack_require__.o(moreModules, moduleId)) {
/******/ 						__webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ 					}
/******/ 				}
/******/ 				if(runtime) var result = runtime(__webpack_require__);
/******/ 			}
/******/ 			if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ 			for(;i < chunkIds.length; i++) {
/******/ 				chunkId = chunkIds[i];
/******/ 				if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ 					installedChunks[chunkId][0]();
/******/ 				}
/******/ 				installedChunks[chunkId] = 0;
/******/ 			}
/******/ 			return __webpack_require__.O(result);
/******/ 		}
/******/ 		
/******/ 		var chunkLoadingGlobal = globalThis["webpackChunkjumplinks_editorial_workflow"] = globalThis["webpackChunkjumplinks_editorial_workflow"] || [];
/******/ 		chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ 		chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ 	})();
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module depends on other loaded chunks and execution need to be delayed
/******/ 	var __webpack_exports__ = __webpack_require__.O(undefined, ["divi/style-index"], () => (__webpack_require__("./src/divi/index.js")))
/******/ 	__webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/ 	
/******/ })()
;
//# sourceMappingURL=index.js.map