[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/script-modules/lazy-editor/ -> index.js (source)

   1  var __create = Object.create;
   2  var __defProp = Object.defineProperty;
   3  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   4  var __getOwnPropNames = Object.getOwnPropertyNames;
   5  var __getProtoOf = Object.getPrototypeOf;
   6  var __hasOwnProp = Object.prototype.hasOwnProperty;
   7  var __commonJS = (cb, mod) => function __require() {
   8    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
   9  };
  10  var __copyProps = (to, from, except, desc) => {
  11    if (from && typeof from === "object" || typeof from === "function") {
  12      for (let key of __getOwnPropNames(from))
  13        if (!__hasOwnProp.call(to, key) && key !== except)
  14          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15    }
  16    return to;
  17  };
  18  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  19    // If the importer is in node compatibility mode or this is not an ESM
  20    // file that has been converted to a CommonJS file using a Babel-
  21    // compatible transform (i.e. "__esModule" has not been set), then set
  22    // "default" to the CommonJS "module.exports" for node compatibility.
  23    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  24    mod
  25  ));
  26  
  27  // package-external:@wordpress/editor
  28  var require_editor = __commonJS({
  29    "package-external:@wordpress/editor"(exports, module) {
  30      module.exports = window.wp.editor;
  31    }
  32  });
  33  
  34  // package-external:@wordpress/core-data
  35  var require_core_data = __commonJS({
  36    "package-external:@wordpress/core-data"(exports, module) {
  37      module.exports = window.wp.coreData;
  38    }
  39  });
  40  
  41  // package-external:@wordpress/data
  42  var require_data = __commonJS({
  43    "package-external:@wordpress/data"(exports, module) {
  44      module.exports = window.wp.data;
  45    }
  46  });
  47  
  48  // package-external:@wordpress/components
  49  var require_components = __commonJS({
  50    "package-external:@wordpress/components"(exports, module) {
  51      module.exports = window.wp.components;
  52    }
  53  });
  54  
  55  // package-external:@wordpress/element
  56  var require_element = __commonJS({
  57    "package-external:@wordpress/element"(exports, module) {
  58      module.exports = window.wp.element;
  59    }
  60  });
  61  
  62  // package-external:@wordpress/style-engine
  63  var require_style_engine = __commonJS({
  64    "package-external:@wordpress/style-engine"(exports, module) {
  65      module.exports = window.wp.styleEngine;
  66    }
  67  });
  68  
  69  // package-external:@wordpress/i18n
  70  var require_i18n = __commonJS({
  71    "package-external:@wordpress/i18n"(exports, module) {
  72      module.exports = window.wp.i18n;
  73    }
  74  });
  75  
  76  // package-external:@wordpress/blocks
  77  var require_blocks = __commonJS({
  78    "package-external:@wordpress/blocks"(exports, module) {
  79      module.exports = window.wp.blocks;
  80    }
  81  });
  82  
  83  // package-external:@wordpress/private-apis
  84  var require_private_apis = __commonJS({
  85    "package-external:@wordpress/private-apis"(exports, module) {
  86      module.exports = window.wp.privateApis;
  87    }
  88  });
  89  
  90  // vendor-external:react/jsx-runtime
  91  var require_jsx_runtime = __commonJS({
  92    "vendor-external:react/jsx-runtime"(exports, module) {
  93      module.exports = window.ReactJSXRuntime;
  94    }
  95  });
  96  
  97  // package-external:@wordpress/block-editor
  98  var require_block_editor = __commonJS({
  99    "package-external:@wordpress/block-editor"(exports, module) {
 100      module.exports = window.wp.blockEditor;
 101    }
 102  });
 103  
 104  // packages/lazy-editor/build-module/components/editor/index.mjs
 105  var import_editor = __toESM(require_editor(), 1);
 106  var import_core_data5 = __toESM(require_core_data(), 1);
 107  var import_data6 = __toESM(require_data(), 1);
 108  var import_components = __toESM(require_components(), 1);
 109  var import_element4 = __toESM(require_element(), 1);
 110  
 111  // packages/lazy-editor/build-module/hooks/use-styles-id.mjs
 112  var import_core_data = __toESM(require_core_data(), 1);
 113  var import_data = __toESM(require_data(), 1);
 114  function useStylesId({ templateId } = {}) {
 115    const { globalStylesId, stylesId } = (0, import_data.useSelect)(
 116      (select2) => {
 117        const coreDataSelect = select2(import_core_data.store);
 118        const template = templateId ? coreDataSelect.getEntityRecord(
 119          "postType",
 120          "wp_template",
 121          templateId
 122        ) : null;
 123        return {
 124          globalStylesId: coreDataSelect.__experimentalGetCurrentGlobalStylesId(),
 125          /*
 126           * `styles_id` is not part of the template REST schema, so it
 127           * cannot come from the record type. It is read defensively in
 128           * case a filtered response carries one; without it the hook
 129           * falls back to the global styles ID below.
 130           */
 131          stylesId: template?.styles_id
 132        };
 133      },
 134      [templateId]
 135    );
 136    return stylesId || globalStylesId;
 137  }
 138  
 139  // packages/global-styles-engine/build-module/utils/object.mjs
 140  function setImmutably(object, path, value) {
 141    path = Array.isArray(path) ? [...path] : [path];
 142    object = Array.isArray(object) ? [...object] : { ...object };
 143    const leaf = path.pop();
 144    let prev = object;
 145    for (const key of path) {
 146      const lvl = prev[key];
 147      prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl };
 148    }
 149    prev[leaf] = value;
 150    return object;
 151  }
 152  var getValueFromObjectPath = (object, path, defaultValue) => {
 153    const arrayPath = Array.isArray(path) ? path : path.split(".");
 154    let value = object;
 155    arrayPath.forEach((fieldName) => {
 156      value = value?.[fieldName];
 157    });
 158    return value ?? defaultValue;
 159  };
 160  
 161  // packages/global-styles-engine/build-module/settings/get-setting.mjs
 162  var VALID_SETTINGS = [
 163    "appearanceTools",
 164    "useRootPaddingAwareAlignments",
 165    "background.backgroundClip",
 166    "background.backgroundImage",
 167    "background.backgroundRepeat",
 168    "background.backgroundSize",
 169    "background.backgroundPosition",
 170    "background.gradient",
 171    "border.color",
 172    "border.radius",
 173    "border.radiusSizes",
 174    "border.style",
 175    "border.width",
 176    "shadow.presets",
 177    "shadow.defaultPresets",
 178    "color.background",
 179    "color.button",
 180    "color.caption",
 181    "color.custom",
 182    "color.customDuotone",
 183    "color.customGradient",
 184    "color.defaultDuotone",
 185    "color.defaultGradients",
 186    "color.defaultPalette",
 187    "color.duotone",
 188    "color.gradients",
 189    "color.heading",
 190    "color.link",
 191    "color.palette",
 192    "color.text",
 193    "custom",
 194    "dimensions.aspectRatio",
 195    "dimensions.height",
 196    "dimensions.minHeight",
 197    "dimensions.minWidth",
 198    "dimensions.width",
 199    "dimensions.dimensionSizes",
 200    "layout.contentSize",
 201    "layout.definitions",
 202    "layout.wideSize",
 203    "lightbox.enabled",
 204    "lightbox.allowEditing",
 205    "position.fixed",
 206    "position.sticky",
 207    "spacing.customSpacingSize",
 208    "spacing.defaultSpacingSizes",
 209    "spacing.spacingSizes",
 210    "spacing.spacingScale",
 211    "spacing.blockGap",
 212    "spacing.margin",
 213    "spacing.padding",
 214    "spacing.units",
 215    "typography.fluid",
 216    "typography.customFontSize",
 217    "typography.defaultFontSizes",
 218    "typography.dropCap",
 219    "typography.fontFamilies",
 220    "typography.fontSizes",
 221    "typography.fontStyle",
 222    "typography.fontWeight",
 223    "typography.letterSpacing",
 224    "typography.lineHeight",
 225    "typography.textAlign",
 226    "typography.textColumns",
 227    "typography.textDecoration",
 228    "typography.textIndent",
 229    "typography.textShadow",
 230    "typography.defaultTextShadowPresets",
 231    "typography.textShadowPresets",
 232    "typography.textTransform",
 233    "typography.writingMode",
 234    "viewport.mobile",
 235    "viewport.tablet"
 236  ];
 237  function getSetting(globalStyles, path, blockName) {
 238    const appendedBlockPath = blockName ? ".blocks." + blockName : "";
 239    const appendedPropertyPath = path ? "." + path : "";
 240    const contextualPath = `settings$appendedBlockPath}$appendedPropertyPath}`;
 241    const globalPath = `settings$appendedPropertyPath}`;
 242    if (path) {
 243      return getValueFromObjectPath(globalStyles, contextualPath) ?? getValueFromObjectPath(globalStyles, globalPath);
 244    }
 245    let result = {};
 246    VALID_SETTINGS.forEach((setting) => {
 247      const value = getValueFromObjectPath(
 248        globalStyles,
 249        `settings$appendedBlockPath}.$setting}`
 250      ) ?? getValueFromObjectPath(globalStyles, `settings.$setting}`);
 251      if (value !== void 0) {
 252        result = setImmutably(result, setting.split("."), value);
 253      }
 254    });
 255    return result;
 256  }
 257  
 258  // packages/global-styles-engine/build-module/utils/common.mjs
 259  var import_style_engine = __toESM(require_style_engine(), 1);
 260  
 261  // packages/global-styles-engine/build-module/utils/fluid.mjs
 262  var DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px";
 263  var DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px";
 264  var DEFAULT_SCALE_FACTOR = 1;
 265  var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25;
 266  var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75;
 267  var DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px";
 268  function getComputedFluidTypographyValue({
 269    minimumFontSize,
 270    maximumFontSize,
 271    fontSize,
 272    minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH,
 273    maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
 274    scaleFactor = DEFAULT_SCALE_FACTOR,
 275    minimumFontSizeLimit
 276  }) {
 277    minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT;
 278    if (fontSize) {
 279      const fontSizeParsed = getTypographyValueAndUnit(fontSize);
 280      if (!fontSizeParsed?.unit || !fontSizeParsed?.value) {
 281        return null;
 282      }
 283      const minimumFontSizeLimitParsed = getTypographyValueAndUnit(
 284        minimumFontSizeLimit,
 285        {
 286          coerceTo: fontSizeParsed.unit
 287        }
 288      );
 289      if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) {
 290        if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) {
 291          return null;
 292        }
 293      }
 294      if (!maximumFontSize) {
 295        maximumFontSize = `$fontSizeParsed.value}$fontSizeParsed.unit}`;
 296      }
 297      if (!minimumFontSize) {
 298        const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16;
 299        const minimumFontSizeFactor = Math.min(
 300          Math.max(
 301            1 - 0.075 * Math.log2(fontSizeValueInPx),
 302            DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN
 303          ),
 304          DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX
 305        );
 306        const calculatedMinimumFontSize = roundToPrecision(
 307          fontSizeParsed.value * minimumFontSizeFactor,
 308          3
 309        );
 310        if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) {
 311          minimumFontSize = `$minimumFontSizeLimitParsed.value}$minimumFontSizeLimitParsed.unit}`;
 312        } else {
 313          minimumFontSize = `$calculatedMinimumFontSize}$fontSizeParsed.unit}`;
 314        }
 315      }
 316    }
 317    const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize);
 318    const fontSizeUnit = minimumFontSizeParsed?.unit || "rem";
 319    const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, {
 320      coerceTo: fontSizeUnit
 321    });
 322    if (!minimumFontSizeParsed || !maximumFontSizeParsed) {
 323      return null;
 324    }
 325    const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, {
 326      coerceTo: "rem"
 327    });
 328    const maximumViewportWidthParsed = getTypographyValueAndUnit(
 329      maximumViewportWidth,
 330      { coerceTo: fontSizeUnit }
 331    );
 332    const minimumViewportWidthParsed = getTypographyValueAndUnit(
 333      minimumViewportWidth,
 334      { coerceTo: fontSizeUnit }
 335    );
 336    if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) {
 337      return null;
 338    }
 339    const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value;
 340    if (!linearDenominator) {
 341      return null;
 342    }
 343    const minViewportWidthOffsetValue = roundToPrecision(
 344      minimumViewportWidthParsed.value / 100,
 345      3
 346    );
 347    const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit;
 348    const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator);
 349    const linearFactorScaled = roundToPrecision(
 350      (linearFactor || 1) * scaleFactor,
 351      3
 352    );
 353    const fluidTargetFontSize = `$minimumFontSizeRem.value}$minimumFontSizeRem.unit} + ((1vw - $viewportWidthOffset}) * $linearFactorScaled})`;
 354    return `clamp($minimumFontSize}, $fluidTargetFontSize}, $maximumFontSize})`;
 355  }
 356  function getTypographyValueAndUnit(rawValue, options = {}) {
 357    if (typeof rawValue !== "string" && typeof rawValue !== "number") {
 358      return null;
 359    }
 360    if (isFinite(rawValue)) {
 361      rawValue = `$rawValue}px`;
 362    }
 363    const { coerceTo, rootSizeValue, acceptableUnits } = {
 364      coerceTo: "",
 365      // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`.
 366      rootSizeValue: 16,
 367      acceptableUnits: ["rem", "px", "em"],
 368      ...options
 369    };
 370    const acceptableUnitsGroup = acceptableUnits?.join("|");
 371    const regexUnits = new RegExp(
 372      `^(\\d*\\.?\\d+)($acceptableUnitsGroup}){1,1}$`
 373    );
 374    const matches = rawValue.toString().match(regexUnits);
 375    if (!matches || matches.length < 3) {
 376      return null;
 377    }
 378    let [, value, unit] = matches;
 379    let returnValue = parseFloat(value);
 380    if ("px" === coerceTo && ("em" === unit || "rem" === unit)) {
 381      returnValue = returnValue * rootSizeValue;
 382      unit = coerceTo;
 383    }
 384    if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) {
 385      returnValue = returnValue / rootSizeValue;
 386      unit = coerceTo;
 387    }
 388    if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) {
 389      unit = coerceTo;
 390    }
 391    if (!unit) {
 392      return null;
 393    }
 394    return {
 395      value: roundToPrecision(returnValue, 3),
 396      unit
 397    };
 398  }
 399  function roundToPrecision(value, digits = 3) {
 400    const base = Math.pow(10, digits);
 401    return Math.round(value * base) / base;
 402  }
 403  
 404  // packages/global-styles-engine/build-module/utils/typography.mjs
 405  function isFluidTypographyEnabled(typographySettings) {
 406    const fluidSettings = typographySettings?.fluid;
 407    return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0;
 408  }
 409  function getFluidTypographyOptionsFromSettings(settings) {
 410    const typographySettings = settings?.typography ?? {};
 411    const layoutSettings = settings?.layout;
 412    const defaultMaxViewportWidth = getTypographyValueAndUnit(
 413      layoutSettings?.wideSize
 414    ) ? layoutSettings?.wideSize : null;
 415    return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? {
 416      fluid: {
 417        maxViewportWidth: defaultMaxViewportWidth,
 418        ...typeof typographySettings.fluid === "object" ? typographySettings.fluid : {}
 419      }
 420    } : {
 421      fluid: typographySettings?.fluid
 422    };
 423  }
 424  function getTypographyFontSizeValue(preset, settings) {
 425    const { size: defaultSize } = preset;
 426    if (!defaultSize || "0" === defaultSize || false === preset?.fluid) {
 427      return defaultSize;
 428    }
 429    if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) {
 430      return defaultSize;
 431    }
 432    const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings)?.fluid ?? {};
 433    const fluidFontSizeValue = getComputedFluidTypographyValue({
 434      minimumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.min,
 435      maximumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.max,
 436      fontSize: defaultSize,
 437      minimumFontSizeLimit: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minFontSize : void 0,
 438      maximumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.maxViewportWidth : void 0,
 439      minimumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minViewportWidth : void 0
 440    });
 441    if (!!fluidFontSizeValue) {
 442      return fluidFontSizeValue;
 443    }
 444    return defaultSize;
 445  }
 446  
 447  // packages/global-styles-engine/build-module/utils/common.mjs
 448  var ROOT_BLOCK_SELECTOR = "body";
 449  var ROOT_CSS_PROPERTIES_SELECTOR = ":root";
 450  function splitSelectorList(selector) {
 451    if (!selector.includes(",")) {
 452      return [selector];
 453    }
 454    const selectors = [];
 455    let currentSelector = "";
 456    let parenthesesDepth = 0;
 457    for (const char of selector) {
 458      if (char === "(") {
 459        parenthesesDepth++;
 460      } else if (char === ")" && parenthesesDepth > 0) {
 461        parenthesesDepth--;
 462      } else if (char === "," && parenthesesDepth === 0) {
 463        selectors.push(currentSelector);
 464        currentSelector = "";
 465        continue;
 466      }
 467      currentSelector += char;
 468    }
 469    selectors.push(currentSelector);
 470    return selectors;
 471  }
 472  var PRESET_METADATA = [
 473    {
 474      path: ["color", "palette"],
 475      valueKey: "color",
 476      cssVarInfix: "color",
 477      classes: [
 478        { classSuffix: "color", propertyName: "color" },
 479        {
 480          classSuffix: "background-color",
 481          propertyName: "background-color"
 482        },
 483        {
 484          classSuffix: "border-color",
 485          propertyName: "border-color"
 486        }
 487      ]
 488    },
 489    {
 490      path: ["color", "gradients"],
 491      valueKey: "gradient",
 492      cssVarInfix: "gradient",
 493      classes: [
 494        {
 495          classSuffix: "gradient-background",
 496          propertyName: "background"
 497        }
 498      ]
 499    },
 500    {
 501      path: ["color", "duotone"],
 502      valueKey: "colors",
 503      cssVarInfix: "duotone",
 504      valueFunc: ({ slug }) => `url( '#wp-duotone-$slug}' )`,
 505      classes: []
 506    },
 507    {
 508      path: ["shadow", "presets"],
 509      valueKey: "shadow",
 510      cssVarInfix: "shadow",
 511      classes: []
 512    },
 513    {
 514      path: ["typography", "fontSizes"],
 515      valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings),
 516      valueKey: "size",
 517      cssVarInfix: "font-size",
 518      classes: [{ classSuffix: "font-size", propertyName: "font-size" }]
 519    },
 520    {
 521      path: ["typography", "fontFamilies"],
 522      valueKey: "fontFamily",
 523      cssVarInfix: "font-family",
 524      classes: [
 525        { classSuffix: "font-family", propertyName: "font-family" }
 526      ]
 527    },
 528    {
 529      path: ["typography", "textShadowPresets"],
 530      valueKey: "textShadow",
 531      cssVarInfix: "text-shadow",
 532      classes: [
 533        { classSuffix: "text-shadow", propertyName: "text-shadow" }
 534      ]
 535    },
 536    {
 537      path: ["spacing", "spacingSizes"],
 538      valueKey: "size",
 539      cssVarInfix: "spacing",
 540      valueFunc: ({ size }) => size,
 541      classes: []
 542    },
 543    {
 544      path: ["border", "radiusSizes"],
 545      valueKey: "size",
 546      cssVarInfix: "border-radius",
 547      classes: []
 548    },
 549    {
 550      path: ["dimensions", "dimensionSizes"],
 551      valueKey: "size",
 552      cssVarInfix: "dimension",
 553      classes: []
 554    }
 555  ];
 556  function scopeSelector(scope, selector) {
 557    if (!scope || !selector) {
 558      return selector;
 559    }
 560    const scopes = splitSelectorList(scope);
 561    const selectors = splitSelectorList(selector);
 562    const selectorsScoped = [];
 563    scopes.forEach((outer) => {
 564      selectors.forEach((inner) => {
 565        selectorsScoped.push(`$outer.trim()} $inner.trim()}`);
 566      });
 567    });
 568    return selectorsScoped.join(", ");
 569  }
 570  function scopeFeatureSelectors(scope, selectors) {
 571    if (!scope || !selectors) {
 572      return;
 573    }
 574    const featureSelectors = {};
 575    Object.entries(selectors).forEach(([feature, selector]) => {
 576      if (typeof selector === "string") {
 577        featureSelectors[feature] = scopeSelector(scope, selector);
 578      }
 579      if (typeof selector === "object") {
 580        featureSelectors[feature] = {};
 581        Object.entries(selector).forEach(
 582          ([subfeature, subfeatureSelector]) => {
 583            featureSelectors[feature][subfeature] = scopeSelector(
 584              scope,
 585              subfeatureSelector
 586            );
 587          }
 588        );
 589      }
 590    });
 591    return featureSelectors;
 592  }
 593  function appendToSelector(selector, toAppend) {
 594    if (!selector.includes(",")) {
 595      return selector + toAppend;
 596    }
 597    const selectors = splitSelectorList(selector);
 598    const newSelectors = selectors.map((sel) => sel + toAppend);
 599    return newSelectors.join(",");
 600  }
 601  function getBlockStyleVariationSelector(variation, blockSelector) {
 602    const variationClass = `.is-style-$variation}`;
 603    if (!blockSelector) {
 604      return variationClass;
 605    }
 606    const ancestorRegex = /[^\s:]+/;
 607    const addVariationClass = (match) => match + variationClass;
 608    const result = splitSelectorList(blockSelector).map(
 609      (part) => part.replace(ancestorRegex, addVariationClass)
 610    );
 611    return result.join(",");
 612  }
 613  function getBlockStyleVariationFeatureSelector(variation, featureSelector) {
 614    const variationClass = `.is-style-$variation}`;
 615    const selectorParts = splitSelectorList(featureSelector).map(
 616      (selector) => {
 617        const trimmedSelector = selector.trim();
 618        const prefix = `$variationClass} `;
 619        if (trimmedSelector.startsWith(prefix)) {
 620          return trimmedSelector.slice(prefix.length);
 621        }
 622        return trimmedSelector;
 623      }
 624    );
 625    return getBlockStyleVariationSelector(
 626      variation,
 627      selectorParts.join(",")
 628    );
 629  }
 630  function getResolvedRefValue(ruleValue, tree) {
 631    if (!ruleValue || !tree) {
 632      return ruleValue;
 633    }
 634    if (typeof ruleValue === "object" && "ref" in ruleValue && ruleValue?.ref) {
 635      const resolvedRuleValue = (0, import_style_engine.getCSSValueFromRawStyle)(
 636        getValueFromObjectPath(tree, ruleValue.ref)
 637      );
 638      if (typeof resolvedRuleValue === "object" && resolvedRuleValue !== null && "ref" in resolvedRuleValue && resolvedRuleValue?.ref) {
 639        return void 0;
 640      }
 641      if (resolvedRuleValue === void 0) {
 642        return ruleValue;
 643      }
 644      return resolvedRuleValue;
 645    }
 646    return ruleValue;
 647  }
 648  function getResolvedThemeFilePath(file, themeFileURIs) {
 649    if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) {
 650      return file;
 651    }
 652    const uri = themeFileURIs.find(
 653      (themeFileUri) => themeFileUri?.name === file
 654    );
 655    if (!uri?.href) {
 656      return file;
 657    }
 658    return uri?.href;
 659  }
 660  function getResolvedValue(ruleValue, tree) {
 661    if (!ruleValue || !tree) {
 662      return ruleValue;
 663    }
 664    const resolvedValue = getResolvedRefValue(ruleValue, tree);
 665    if (typeof resolvedValue === "object" && resolvedValue !== null && "url" in resolvedValue && resolvedValue?.url) {
 666      return {
 667        ...resolvedValue,
 668        url: getResolvedThemeFilePath(
 669          resolvedValue.url,
 670          tree?._links?.["wp:theme-file"]
 671        )
 672      };
 673    }
 674    return resolvedValue;
 675  }
 676  
 677  // packages/global-styles-engine/build-module/core/render.mjs
 678  var import_blocks = __toESM(require_blocks(), 1);
 679  var import_style_engine2 = __toESM(require_style_engine(), 1);
 680  var import_data2 = __toESM(require_data(), 1);
 681  
 682  // packages/global-styles-engine/build-module/core/selectors.mjs
 683  function getBlockSelector(blockType, target = "root", options = {}) {
 684    if (!target) {
 685      return null;
 686    }
 687    const { fallback = false } = options;
 688    const { name, selectors, supports } = blockType;
 689    const hasSelectors = selectors && Object.keys(selectors).length > 0;
 690    const path = Array.isArray(target) ? target.join(".") : target;
 691    let rootSelector = null;
 692    if (hasSelectors && selectors.root) {
 693      rootSelector = selectors?.root;
 694    } else if (supports?.__experimentalSelector) {
 695      rootSelector = supports.__experimentalSelector;
 696    } else {
 697      rootSelector = ".wp-block-" + name.replace("core/", "").replace("/", "-");
 698    }
 699    if (path === "root") {
 700      return rootSelector;
 701    }
 702    const pathArray = Array.isArray(target) ? target : target.split(".");
 703    if (pathArray.length === 1) {
 704      const fallbackSelector = fallback ? rootSelector : null;
 705      if (hasSelectors) {
 706        const featureSelector2 = getValueFromObjectPath(
 707          selectors,
 708          `$path}.root`,
 709          null
 710        ) || getValueFromObjectPath(selectors, path, null);
 711        return featureSelector2 || fallbackSelector;
 712      }
 713      const featureSelector = supports ? getValueFromObjectPath(
 714        supports,
 715        `$path}.__experimentalSelector`,
 716        null
 717      ) : void 0;
 718      if (!featureSelector) {
 719        return fallbackSelector;
 720      }
 721      return scopeSelector(rootSelector, featureSelector);
 722    }
 723    let subfeatureSelector;
 724    if (hasSelectors) {
 725      subfeatureSelector = getValueFromObjectPath(selectors, path, null);
 726    }
 727    if (subfeatureSelector) {
 728      return subfeatureSelector;
 729    }
 730    if (fallback) {
 731      return getBlockSelector(blockType, pathArray[0], options);
 732    }
 733    return null;
 734  }
 735  
 736  // node_modules/.store/colord@2.10.0-Qx66Amv6c9C3nDPQDizV6Q/node_modules/colord/index.mjs
 737  for (r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r2) {
 738    return "string" == typeof r2 ? r2.length > 0 : "number" == typeof r2;
 739  }, n = function(r2, t2, n2) {
 740    return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r2) / n2 + 0;
 741  }, u = function(r2, t2, n2) {
 742    return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r2 > n2 ? n2 : r2 > t2 ? r2 : t2;
 743  }, e = function(r2) {
 744    return (r2 = isFinite(r2) ? r2 % 360 : 0) < 0 ? r2 + 360 : r2;
 745  }, o = function(r2, t2) {
 746    return void 0 === t2 && (t2 = 0), n(r2, t2) % 360;
 747  }, a = function(r2) {
 748    return { r: u(r2.r, 0, 255), g: u(r2.g, 0, 255), b: u(r2.b, 0, 255), a: u(r2.a) };
 749  }, i = function(r2) {
 750    return { r: n(r2.r), g: n(r2.g), b: n(r2.b), a: n(r2.a, 3) };
 751  }, s = /^#([0-9a-f]{3,8})$/i, d = function(r2, t2) {
 752    var n2 = r2.charCodeAt(t2);
 753    return (15 & n2) + 9 * (n2 >> 6);
 754  }, h = function(r2, t2) {
 755    return d(r2, t2) << 4 | d(r2, t2 + 1);
 756  }, b = [], f = 0; f < 256; f++) b.push((f < 16 ? "0" : "") + f.toString(16));
 757  var r;
 758  var t;
 759  var n;
 760  var u;
 761  var e;
 762  var o;
 763  var a;
 764  var i;
 765  var s;
 766  var d;
 767  var h;
 768  var b;
 769  var f;
 770  var g = function(r) {
 771    return b[u(r, 0, 255)];
 772  };
 773  var c = function(r) {
 774    var t = r.r, n = r.g, u = r.b, e = r.a, o = Math.max(t, n, u), a = o - Math.min(t, n, u), i = a ? o === t ? (n - u) / a : o === n ? 2 + (u - t) / a : 4 + (t - n) / a : 0;
 775    return { h: 60 * (i < 0 ? i + 6 : i), s: o ? a / o * 100 : 0, v: o / 255 * 100, a: e };
 776  };
 777  var v = function(r) {
 778    var t = r.h, n = r.s, u = r.v, e = r.a;
 779    t = t / 360 * 6, n /= 100, u /= 100;
 780    var o = Math.floor(t), a = u * (1 - n), i = u * (1 - (t - o) * n), s = u * (1 - (1 - t + o) * n), d = o % 6;
 781    return { r: 255 * [u, i, a, a, s, u][d], g: 255 * [s, u, u, i, a, a][d], b: 255 * [a, a, s, u, u, i][d], a: e };
 782  };
 783  var l = function(r) {
 784    return { h: e(r.h), s: u(r.s, 0, 100), l: u(r.l, 0, 100), a: u(r.a) };
 785  };
 786  var p = function(r) {
 787    return { h: o(r.h), s: n(r.s), l: n(r.l), a: n(r.a, 3) };
 788  };
 789  var m = function(r) {
 790    return v((n = (t = r).s, { h: t.h, s: (n *= ((u = t.l) < 50 ? u : 100 - u) / 100) > 0 ? 2 * n / (u + n) * 100 : 0, v: u + n, a: t.a }));
 791    var t, n, u;
 792  };
 793  var y = function(r) {
 794    return { h: (t = c(r)).h, s: (e = (200 - (n = t.s)) * (u = t.v) / 100) > 0 && e < 200 ? n * u / 100 / (e <= 100 ? e : 200 - e) * 100 : 0, l: e / 2, a: t.a };
 795    var t, n, u, e;
 796  };
 797  var N = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
 798  var x = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
 799  var M = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
 800  var H = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
 801  var $ = { string: [[function(r) {
 802    if (!s.test(r)) return null;
 803    var t = r.length;
 804    return t <= 5 ? { r: 17 * d(r, 1), g: 17 * d(r, 2), b: 17 * d(r, 3), a: 5 === t ? n(17 * d(r, 4) / 255, 2) : 1 } : 7 === t || 9 === t ? { r: h(r, 1), g: h(r, 3), b: h(r, 5), a: 9 === t ? n(h(r, 7) / 255, 2) : 1 } : null;
 805  }, "hex"], [function(r) {
 806    var t = M.exec(r) || H.exec(r);
 807    return t ? t[2] !== t[4] || t[4] !== t[6] ? null : a({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: void 0 === t[7] ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
 808  }, "rgb"], [function(t) {
 809    var n = N.exec(t) || x.exec(t);
 810    if (!n) return null;
 811    var u, e, o = l({ h: (u = n[1], e = n[2], void 0 === e && (e = "deg"), Number(u) * (r[e] || 1)), s: Number(n[3]), l: Number(n[4]), a: void 0 === n[5] ? 1 : Number(n[5]) / (n[6] ? 100 : 1) });
 812    return m(o);
 813  }, "hsl"]], object: [[function(r) {
 814    var n = r.r, u = r.g, e = r.b, o = r.a, i = void 0 === o ? 1 : o;
 815    return t(n) && t(u) && t(e) ? a({ r: Number(n), g: Number(u), b: Number(e), a: Number(i) }) : null;
 816  }, "rgb"], [function(r) {
 817    var n = r.h, u = r.s, e = r.l, o = r.a, a = void 0 === o ? 1 : o;
 818    if (!t(n) || !t(u) || !t(e)) return null;
 819    var i = l({ h: Number(n), s: Number(u), l: Number(e), a: Number(a) });
 820    return m(i);
 821  }, "hsl"], [function(r) {
 822    var n = r.h, o = r.s, a = r.v, i = r.a, s = void 0 === i ? 1 : i;
 823    if (!t(n) || !t(o) || !t(a)) return null;
 824    var d = (function(r2) {
 825      return { h: e(r2.h), s: u(r2.s, 0, 100), v: u(r2.v, 0, 100), a: u(r2.a) };
 826    })({ h: Number(n), s: Number(o), v: Number(a), a: Number(s) });
 827    return v(d);
 828  }, "hsv"]] };
 829  var j = function(r, t) {
 830    for (var n = 0; n < t.length; n++) {
 831      var u = t[n][0](r);
 832      if (u) return [u, t[n][1]];
 833    }
 834    return [null, void 0];
 835  };
 836  var w = function(r) {
 837    return "string" == typeof r ? j(r.trim(), $.string) : "object" == typeof r && null !== r ? j(r, $.object) : [null, void 0];
 838  };
 839  var k = function(r, t) {
 840    var n = y(r);
 841    return { h: n.h, s: u(n.s + 100 * t, 0, 100), l: n.l, a: n.a };
 842  };
 843  var E = function(r) {
 844    return (299 * r.r + 587 * r.g + 114 * r.b) / 1e3 / 255;
 845  };
 846  var R = function(r, t) {
 847    var n = y(r);
 848    return { h: n.h, s: n.s, l: u(n.l + 100 * t, 0, 100), a: n.a };
 849  };
 850  var q = (function() {
 851    function r(r2) {
 852      this.parsed = w(r2)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
 853    }
 854    return r.prototype.isValid = function() {
 855      return null !== this.parsed;
 856    }, r.prototype.brightness = function() {
 857      return n(E(this.rgba), 2);
 858    }, r.prototype.isDark = function() {
 859      return E(this.rgba) < 0.5;
 860    }, r.prototype.isLight = function() {
 861      return E(this.rgba) >= 0.5;
 862    }, r.prototype.toHex = function() {
 863      return r2 = i(this.rgba), t = r2.r, u = r2.g, e = r2.b, a = (o = r2.a) < 1 ? g(n(255 * o)) : "", "#" + g(t) + g(u) + g(e) + a;
 864      var r2, t, u, e, o, a;
 865    }, r.prototype.toRgb = function() {
 866      return i(this.rgba);
 867    }, r.prototype.toRgbString = function() {
 868      return r2 = i(this.rgba), t = r2.r, n = r2.g, u = r2.b, (e = r2.a) < 1 ? "rgba(" + t + ", " + n + ", " + u + ", " + e + ")" : "rgb(" + t + ", " + n + ", " + u + ")";
 869      var r2, t, n, u, e;
 870    }, r.prototype.toHsl = function() {
 871      return p(y(this.rgba));
 872    }, r.prototype.toHslString = function() {
 873      return r2 = p(y(this.rgba)), t = r2.h, n = r2.s, u = r2.l, (e = r2.a) < 1 ? "hsla(" + t + ", " + n + "%, " + u + "%, " + e + ")" : "hsl(" + t + ", " + n + "%, " + u + "%)";
 874      var r2, t, n, u, e;
 875    }, r.prototype.toHsv = function() {
 876      return r2 = c(this.rgba), { h: o(r2.h), s: n(r2.s), v: n(r2.v), a: n(r2.a, 3) };
 877      var r2;
 878    }, r.prototype.invert = function() {
 879      return A({ r: 255 - (r2 = this.rgba).r, g: 255 - r2.g, b: 255 - r2.b, a: r2.a });
 880      var r2;
 881    }, r.prototype.saturate = function(r2) {
 882      return void 0 === r2 && (r2 = 0.1), A(k(this.rgba, r2));
 883    }, r.prototype.desaturate = function(r2) {
 884      return void 0 === r2 && (r2 = 0.1), A(k(this.rgba, -r2));
 885    }, r.prototype.grayscale = function() {
 886      return A(k(this.rgba, -1));
 887    }, r.prototype.lighten = function(r2) {
 888      return void 0 === r2 && (r2 = 0.1), A(R(this.rgba, r2));
 889    }, r.prototype.darken = function(r2) {
 890      return void 0 === r2 && (r2 = 0.1), A(R(this.rgba, -r2));
 891    }, r.prototype.rotate = function(r2) {
 892      return void 0 === r2 && (r2 = 15), this.hue(y(this.rgba).h + r2);
 893    }, r.prototype.alpha = function(r2) {
 894      return "number" == typeof r2 ? A({ r: (t = this.rgba).r, g: t.g, b: t.b, a: r2 }) : n(this.rgba.a, 3);
 895      var t;
 896    }, r.prototype.hue = function(r2) {
 897      var t = y(this.rgba);
 898      return "number" == typeof r2 ? A({ h: r2, s: t.s, l: t.l, a: t.a }) : o(t.h);
 899    }, r.prototype.isEqual = function(r2) {
 900      return this.toHex() === A(r2).toHex();
 901    }, r;
 902  })();
 903  var A = function(r) {
 904    return r instanceof q ? r : new q(r);
 905  };
 906  
 907  // packages/global-styles-engine/build-module/utils/duotone.mjs
 908  function getValuesFromColors(colors = []) {
 909    const values = {
 910      r: [],
 911      g: [],
 912      b: [],
 913      a: []
 914    };
 915    colors.forEach((color) => {
 916      const rgbColor = A(color).toRgb();
 917      values.r.push(rgbColor.r / 255);
 918      values.g.push(rgbColor.g / 255);
 919      values.b.push(rgbColor.b / 255);
 920      values.a.push(rgbColor.a);
 921    });
 922    return values;
 923  }
 924  function getDuotoneFilter(id, colors) {
 925    const values = getValuesFromColors(colors);
 926    return `
 927  <svg
 928      xmlns:xlink="http://www.w3.org/1999/xlink"
 929      viewBox="0 0 0 0"
 930      width="0"
 931      height="0"
 932      focusable="false"
 933      role="none"
 934      aria-hidden="true"
 935      style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"
 936  >
 937      <defs>
 938          <filter id="$id}">
 939              <!--
 940                  Use sRGB instead of linearRGB so transparency looks correct.
 941                  Use perceptual brightness to convert to grayscale.
 942              -->
 943              <feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix>
 944              <!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. -->
 945              <feComponentTransfer color-interpolation-filters="sRGB">
 946                  <feFuncR type="table" tableValues="$values.r.join(" ")}"></feFuncR>
 947                  <feFuncG type="table" tableValues="$values.g.join(" ")}"></feFuncG>
 948                  <feFuncB type="table" tableValues="$values.b.join(" ")}"></feFuncB>
 949                  <feFuncA type="table" tableValues="$values.a.join(" ")}"></feFuncA>
 950              </feComponentTransfer>
 951              <!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. -->
 952              <feComposite in2="SourceGraphic" operator="in"></feComposite>
 953          </filter>
 954      </defs>
 955  </svg>`;
 956  }
 957  
 958  // packages/global-styles-engine/build-module/utils/string.mjs
 959  function kebabCase(str) {
 960    return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([0-9])([a-zA-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
 961  }
 962  
 963  // packages/global-styles-engine/build-module/utils/spacing.mjs
 964  function getSpacingPresetCssVar(value) {
 965    if (!value) {
 966      return;
 967    }
 968    const slug = value.match(/var:preset\|spacing\|(.+)/);
 969    if (!slug) {
 970      return value;
 971    }
 972    return `var(--wp--preset--spacing--$slug[1]})`;
 973  }
 974  
 975  // packages/global-styles-engine/build-module/utils/gap.mjs
 976  function getGapBoxControlValueFromStyle(blockGapValue) {
 977    if (!blockGapValue) {
 978      return null;
 979    }
 980    const isValueString = typeof blockGapValue === "string";
 981    return {
 982      top: isValueString ? blockGapValue : blockGapValue?.top,
 983      left: isValueString ? blockGapValue : blockGapValue?.left
 984    };
 985  }
 986  function getGapCSSValue(blockGapValue, defaultValue = "0") {
 987    const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue);
 988    if (!blockGapBoxControlValue) {
 989      return null;
 990    }
 991    const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue;
 992    const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue;
 993    return row === column ? row : `$row} $column}`;
 994  }
 995  
 996  // packages/global-styles-engine/build-module/utils/background.mjs
 997  var BACKGROUND_BLOCK_DEFAULT_VALUES = {
 998    backgroundSize: "cover",
 999    backgroundPosition: "50% 50%"
1000    // used only when backgroundSize is 'contain'.
1001  };
1002  function hasImageUrl(backgroundImage) {
1003    return typeof backgroundImage === "object" && backgroundImage !== null && "url" in backgroundImage && !!backgroundImage.url;
1004  }
1005  function setBackgroundStyleDefaults(backgroundStyle) {
1006    if (!backgroundStyle || !hasImageUrl(backgroundStyle.backgroundImage)) {
1007      return;
1008    }
1009    let backgroundStylesWithDefaults;
1010    if (!backgroundStyle?.backgroundSize) {
1011      backgroundStylesWithDefaults = {
1012        backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize
1013      };
1014    }
1015    if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) {
1016      backgroundStylesWithDefaults = {
1017        backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition
1018      };
1019    }
1020    return backgroundStylesWithDefaults;
1021  }
1022  
1023  // packages/global-styles-engine/build-module/utils/layout.mjs
1024  var LAYOUT_DEFINITIONS = {
1025    default: {
1026      name: "default",
1027      slug: "flow",
1028      className: "is-layout-flow",
1029      baseStyles: [
1030        {
1031          selector: " > .alignleft",
1032          rules: {
1033            float: "left",
1034            "margin-left": "0",
1035            "margin-right": "2em"
1036          }
1037        },
1038        {
1039          selector: " > .alignright",
1040          rules: {
1041            float: "right",
1042            "margin-left": "2em",
1043            "margin-right": "0"
1044          }
1045        },
1046        {
1047          selector: " > .aligncenter",
1048          rules: {
1049            "margin-left": "auto !important",
1050            "margin-right": "auto !important"
1051          }
1052        }
1053      ],
1054      spacingStyles: [
1055        {
1056          selector: " > :first-child",
1057          rules: {
1058            "margin-block-start": "0"
1059          }
1060        },
1061        {
1062          selector: " > :last-child",
1063          rules: {
1064            "margin-block-end": "0"
1065          }
1066        },
1067        {
1068          selector: " > *",
1069          rules: {
1070            "margin-block-start": null,
1071            "margin-block-end": "0"
1072          }
1073        }
1074      ]
1075    },
1076    constrained: {
1077      name: "constrained",
1078      slug: "constrained",
1079      className: "is-layout-constrained",
1080      baseStyles: [
1081        {
1082          selector: " > .alignleft",
1083          rules: {
1084            float: "left",
1085            "margin-left": "0",
1086            "margin-right": "2em"
1087          }
1088        },
1089        {
1090          selector: " > .alignright",
1091          rules: {
1092            float: "right",
1093            "margin-left": "2em",
1094            "margin-right": "0"
1095          }
1096        },
1097        {
1098          selector: " > .aligncenter",
1099          rules: {
1100            "margin-left": "auto !important",
1101            "margin-right": "auto !important"
1102          }
1103        },
1104        {
1105          selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))",
1106          rules: {
1107            "max-width": "var(--wp--style--global--content-size)",
1108            "margin-left": "auto !important",
1109            "margin-right": "auto !important"
1110          }
1111        },
1112        {
1113          selector: " > .alignwide",
1114          rules: {
1115            "max-width": "var(--wp--style--global--wide-size)"
1116          }
1117        }
1118      ],
1119      spacingStyles: [
1120        {
1121          selector: " > :first-child",
1122          rules: {
1123            "margin-block-start": "0"
1124          }
1125        },
1126        {
1127          selector: " > :last-child",
1128          rules: {
1129            "margin-block-end": "0"
1130          }
1131        },
1132        {
1133          selector: " > *",
1134          rules: {
1135            "margin-block-start": null,
1136            "margin-block-end": "0"
1137          }
1138        }
1139      ]
1140    },
1141    flex: {
1142      name: "flex",
1143      slug: "flex",
1144      className: "is-layout-flex",
1145      displayMode: "flex",
1146      baseStyles: [
1147        {
1148          selector: "",
1149          rules: {
1150            "flex-wrap": "wrap",
1151            "align-items": "center"
1152          }
1153        },
1154        {
1155          selector: " > :is(*, div)",
1156          // :is(*, div) instead of just * increases the specificity by 001.
1157          rules: {
1158            margin: "0"
1159          }
1160        }
1161      ],
1162      spacingStyles: [
1163        {
1164          selector: "",
1165          rules: {
1166            gap: null
1167          }
1168        }
1169      ]
1170    },
1171    grid: {
1172      name: "grid",
1173      slug: "grid",
1174      className: "is-layout-grid",
1175      displayMode: "grid",
1176      baseStyles: [
1177        {
1178          selector: " > :is(*, div)",
1179          // :is(*, div) instead of just * increases the specificity by 001.
1180          rules: {
1181            margin: "0"
1182          }
1183        }
1184      ],
1185      spacingStyles: [
1186        {
1187          selector: "",
1188          rules: {
1189            gap: null
1190          }
1191        }
1192      ]
1193    }
1194  };
1195  
1196  // packages/global-styles-engine/build-module/utils/viewport.mjs
1197  var DEFAULT_VIEWPORT_BREAKPOINTS = {
1198    mobile: "480px",
1199    tablet: "782px"
1200  };
1201  var VIEWPORT_SIZE_REGEXP = /^(\d+|\d*\.\d+)(px|em|rem)$/;
1202  var DEFAULT_FONT_SIZE = 16;
1203  function isViewportSettings(configOrSettings) {
1204    return "mobile" in configOrSettings || "tablet" in configOrSettings;
1205  }
1206  function getViewportSettings(configOrSettings) {
1207    if (!configOrSettings || typeof configOrSettings !== "object") {
1208      return {};
1209    }
1210    if (isViewportSettings(configOrSettings)) {
1211      return configOrSettings;
1212    }
1213    return configOrSettings.settings?.viewport ?? {};
1214  }
1215  function isValidViewportSize(value) {
1216    return typeof value === "string" && VIEWPORT_SIZE_REGEXP.test(value.trim());
1217  }
1218  function getViewportBreakpointValueInPixels(value) {
1219    if (typeof value === "number") {
1220      return value;
1221    }
1222    if (typeof value !== "string") {
1223      return void 0;
1224    }
1225    const match = value.trim().match(VIEWPORT_SIZE_REGEXP);
1226    if (!match) {
1227      return void 0;
1228    }
1229    const numericValue = Number.parseFloat(match[1]);
1230    const unit = match[2];
1231    return unit === "px" ? numericValue : numericValue * DEFAULT_FONT_SIZE;
1232  }
1233  function getViewportBreakpoints(configOrSettings) {
1234    const viewportSettings = getViewportSettings(configOrSettings);
1235    const breakpoints = {};
1236    const breakpointValuesInPixels = {};
1237    Object.keys(DEFAULT_VIEWPORT_BREAKPOINTS).forEach((breakpoint) => {
1238      const key = breakpoint;
1239      const value = viewportSettings[key];
1240      const px = getViewportBreakpointValueInPixels(value);
1241      if (px !== void 0 && isValidViewportSize(value)) {
1242        breakpoints[key] = value.trim();
1243        breakpointValuesInPixels[key] = px;
1244      }
1245    });
1246    const breakpointNames = Object.keys(breakpoints);
1247    if (!breakpointNames.length) {
1248      return { ...DEFAULT_VIEWPORT_BREAKPOINTS };
1249    }
1250    if (1 === breakpointNames.length) {
1251      return breakpoints;
1252    }
1253    const mobile = breakpoints.mobile;
1254    const tablet = breakpoints.tablet;
1255    if (breakpointValuesInPixels.mobile >= breakpointValuesInPixels.tablet) {
1256      return { mobile };
1257    }
1258    return { mobile, tablet };
1259  }
1260  function getResponsiveMediaQueries(configOrSettings) {
1261    const breakpoints = getViewportBreakpoints(configOrSettings);
1262    const mediaQueries = {};
1263    if (breakpoints.mobile) {
1264      mediaQueries["@mobile"] = `@media (width <= $breakpoints.mobile})`;
1265    }
1266    if (breakpoints.tablet) {
1267      mediaQueries["@tablet"] = breakpoints.mobile ? `@media ($breakpoints.mobile} < width <= $breakpoints.tablet})` : `@media (width <= $breakpoints.tablet})`;
1268    }
1269    return mediaQueries;
1270  }
1271  
1272  // packages/global-styles-engine/build-module/core/render.mjs
1273  var ELEMENT_CLASS_NAMES = {
1274    button: "wp-element-button",
1275    caption: "wp-element-caption"
1276  };
1277  var BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
1278    __experimentalBorder: "border",
1279    color: "color",
1280    dimensions: "dimensions",
1281    spacing: "spacing",
1282    typography: "typography"
1283  };
1284  var VALID_BLOCK_PSEUDO_SELECTORS = {
1285    "core/button": [":hover", ":focus", ":focus-visible", ":active"],
1286    "core/navigation-link": [":hover", ":focus", ":focus-visible", ":active"]
1287  };
1288  var VALID_ELEMENT_PSEUDO_SELECTORS = {
1289    link: [
1290      ":link",
1291      ":any-link",
1292      ":visited",
1293      ":hover",
1294      ":focus",
1295      ":focus-visible",
1296      ":active"
1297    ],
1298    button: [
1299      ":link",
1300      ":any-link",
1301      ":visited",
1302      ":hover",
1303      ":focus",
1304      ":focus-visible",
1305      ":active"
1306    ],
1307    // Validation states come before focus states because an edited field can match
1308    // both at once, so user action styles must be output last to win.
1309    textInput: [
1310      ":required",
1311      ":user-valid",
1312      ":user-invalid",
1313      ":focus",
1314      ":focus-visible",
1315      "::placeholder"
1316    ],
1317    select: [":hover", ":focus", ":focus-visible", ":active"]
1318  };
1319  function getPresetsClasses(blockSelector = "*", blockPresets = {}) {
1320    return PRESET_METADATA.reduce(
1321      (declarations, { path, cssVarInfix, classes }) => {
1322        if (!classes) {
1323          return declarations;
1324        }
1325        const presetByOrigin = getValueFromObjectPath(
1326          blockPresets,
1327          path,
1328          []
1329        );
1330        ["default", "theme", "custom"].forEach((origin) => {
1331          if (presetByOrigin[origin]) {
1332            presetByOrigin[origin].forEach(
1333              ({ slug }) => {
1334                classes.forEach(
1335                  ({
1336                    classSuffix,
1337                    propertyName
1338                  }) => {
1339                    const classSelectorToUse = `.has-$kebabCase(
1340                      slug
1341                    )}-$classSuffix}`;
1342                    const selectorToUse = blockSelector ? `:where($blockSelector})$classSelectorToUse}` : classSelectorToUse;
1343                    const value = `var(--wp--preset--$cssVarInfix}--$kebabCase(
1344                      slug
1345                    )})`;
1346                    declarations += `$selectorToUse}{$propertyName}: $value} !important;}`;
1347                  }
1348                );
1349              }
1350            );
1351          }
1352        });
1353        return declarations;
1354      },
1355      ""
1356    );
1357  }
1358  function getPresetsSvgFilters(blockPresets = {}) {
1359    return PRESET_METADATA.filter(
1360      // Duotone are the only type of filters for now.
1361      (metadata) => metadata.path.at(-1) === "duotone"
1362    ).flatMap((metadata) => {
1363      const presetByOrigin = getValueFromObjectPath(
1364        blockPresets,
1365        metadata.path,
1366        {}
1367      );
1368      return ["default", "theme", "custom"].filter((origin) => presetByOrigin[origin]).flatMap(
1369        (origin) => presetByOrigin[origin].map(
1370          (preset) => getDuotoneFilter(
1371            `wp-duotone-$preset.slug}`,
1372            preset.colors
1373          )
1374        )
1375      ).join("");
1376    });
1377  }
1378  function flattenTree(input = {}, prefix, token) {
1379    let result = [];
1380    Object.keys(input).forEach((key) => {
1381      const newKey = prefix + kebabCase(key.replace("/", "-"));
1382      const newLeaf = input[key];
1383      if (newLeaf instanceof Object) {
1384        const newPrefix = newKey + token;
1385        result = [...result, ...flattenTree(newLeaf, newPrefix, token)];
1386      } else {
1387        result.push(`$newKey}: $newLeaf}`);
1388      }
1389    });
1390    return result;
1391  }
1392  var updateParagraphTextIndentSelector = (featureDeclarations, settings, blockName) => {
1393    if (blockName !== "core/paragraph") {
1394      return featureDeclarations;
1395    }
1396    const blockSettings = settings?.blocks?.["core/paragraph"];
1397    const textIndentSetting = blockSettings?.typography?.textIndent ?? settings?.typography?.textIndent ?? "subsequent";
1398    if (textIndentSetting !== "all") {
1399      return featureDeclarations;
1400    }
1401    const oldSelector = ".wp-block-paragraph + .wp-block-paragraph";
1402    const newSelector = ".wp-block-paragraph";
1403    if (oldSelector in featureDeclarations) {
1404      const declarations = featureDeclarations[oldSelector];
1405      const updated = { ...featureDeclarations };
1406      delete updated[oldSelector];
1407      updated[newSelector] = declarations;
1408      return updated;
1409    }
1410    return featureDeclarations;
1411  };
1412  var updateButtonWidthDeclarations = (featureDeclarations, settings) => {
1413    const buttonSelector = ".wp-block-button";
1414    if (!(buttonSelector in featureDeclarations)) {
1415      return featureDeclarations;
1416    }
1417    const updated = { ...featureDeclarations };
1418    updated[buttonSelector] = updated[buttonSelector].map(
1419      (declaration) => {
1420        const match = declaration.match(/^width:\s*(.+)$/);
1421        if (!match) {
1422          return declaration;
1423        }
1424        const value = match[1];
1425        let percentage = null;
1426        if (value.endsWith("%")) {
1427          percentage = parseFloat(value);
1428        }
1429        const presetPrefix = "var(--wp--preset--dimension--";
1430        if (percentage === null && value.startsWith(presetPrefix) && value.endsWith(")")) {
1431          const slug = value.slice(presetPrefix.length, -1);
1432          const dimensionSizes = {
1433            ...settings?.dimensions?.dimensionSizes ?? {},
1434            ...settings?.blocks?.["core/button"]?.dimensions?.dimensionSizes ?? {}
1435          };
1436          for (const origin of Object.values(dimensionSizes)) {
1437            if (!Array.isArray(origin)) {
1438              continue;
1439            }
1440            for (const preset of origin) {
1441              if (preset.slug === slug && typeof preset.size === "string" && preset.size.endsWith("%")) {
1442                percentage = parseFloat(preset.size);
1443                break;
1444              }
1445            }
1446            if (percentage !== null) {
1447              break;
1448            }
1449          }
1450        }
1451        if (percentage === null || isNaN(percentage)) {
1452          return declaration;
1453        }
1454        return `width: calc($percentage} * 1% - (var(--wp--style--block-gap, 0.5em) * (1 - $percentage} / 100)))`;
1455      }
1456    );
1457    return updated;
1458  };
1459  var getFeatureDeclarations = (selectors, styles) => {
1460    const declarations = {};
1461    Object.entries(selectors).forEach(([feature, selector]) => {
1462      if (feature === "root" || feature === "css" || !styles?.[feature]) {
1463        return;
1464      }
1465      const isShorthand = typeof selector === "string";
1466      if (!isShorthand && typeof selector === "object" && selector !== null) {
1467        Object.entries(selector).forEach(
1468          ([subfeature, subfeatureSelector]) => {
1469            if (subfeature === "root" || !styles?.[feature][subfeature]) {
1470              return;
1471            }
1472            const subfeatureStyles = {
1473              [feature]: {
1474                [subfeature]: styles[feature][subfeature]
1475              }
1476            };
1477            const newDeclarations = getStylesDeclarations(subfeatureStyles);
1478            declarations[subfeatureSelector] = [
1479              ...declarations[subfeatureSelector] || [],
1480              ...newDeclarations
1481            ];
1482            delete styles[feature][subfeature];
1483          }
1484        );
1485      }
1486      if (isShorthand || typeof selector === "object" && selector !== null && "root" in selector) {
1487        const featureSelector = isShorthand ? selector : selector.root;
1488        const featureStyles = { [feature]: styles[feature] };
1489        const newDeclarations = getStylesDeclarations(featureStyles);
1490        declarations[featureSelector] = [
1491          ...declarations[featureSelector] || [],
1492          ...newDeclarations
1493        ];
1494        delete styles[feature];
1495      }
1496    });
1497    return declarations;
1498  };
1499  function getStateDeclarationsWithTextClipEscapes(declarations, stateStyles, baseStyles) {
1500    const baseClip = baseStyles?.find(
1501      (baseStyle) => baseStyle?.background?.backgroundClip
1502    )?.background?.backgroundClip;
1503    if ("text" !== baseClip) {
1504      return declarations;
1505    }
1506    const stateClip = stateStyles?.background?.backgroundClip;
1507    const paintsItsOwnBackground = !!stateStyles?.background?.gradient || !!stateStyles?.background?.backgroundImage || !!stateStyles?.color?.gradient;
1508    if (stateClip && "text" !== stateClip) {
1509      return paintsItsOwnBackground ? declarations : [...declarations, "background-image: unset"];
1510    }
1511    if (!stateClip && !paintsItsOwnBackground && !!stateStyles?.color?.text) {
1512      return [...declarations, "-webkit-text-fill-color: currentColor"];
1513    }
1514    return declarations;
1515  }
1516  function getStylesDeclarations(blockStyles = {}, selector = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) {
1517    const isRoot = ROOT_BLOCK_SELECTOR === selector;
1518    const output = Object.entries(
1519      import_blocks.__EXPERIMENTAL_STYLE_PROPERTY
1520    ).reduce(
1521      (declarations, [key, { value, properties, useEngine, rootOnly }]) => {
1522        if (rootOnly && !isRoot) {
1523          return declarations;
1524        }
1525        const pathToValue = value;
1526        if (pathToValue[0] === "elements" || useEngine) {
1527          return declarations;
1528        }
1529        const styleValue = getValueFromObjectPath(
1530          blockStyles,
1531          pathToValue
1532        );
1533        if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) {
1534          return declarations;
1535        }
1536        if (properties && typeof styleValue !== "string") {
1537          Object.entries(properties).forEach((entry) => {
1538            const [name, prop] = entry;
1539            if (!getValueFromObjectPath(styleValue, [prop], false)) {
1540              return;
1541            }
1542            const cssProperty = name.startsWith("--") ? name : kebabCase(name);
1543            declarations.push(
1544              `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)(
1545                getValueFromObjectPath(styleValue, [prop])
1546              )}`
1547            );
1548          });
1549        } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) {
1550          const cssProperty = key.startsWith("--") ? key : kebabCase(key);
1551          declarations.push(
1552            `$cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)(
1553              getValueFromObjectPath(blockStyles, pathToValue)
1554            )}`
1555          );
1556        }
1557        return declarations;
1558      },
1559      []
1560    );
1561    if (!!blockStyles.background) {
1562      if (blockStyles.background?.backgroundImage) {
1563        blockStyles.background.backgroundImage = getResolvedValue(
1564          blockStyles.background.backgroundImage,
1565          tree
1566        );
1567      }
1568      if (!isRoot && !!blockStyles.background?.backgroundImage?.id) {
1569        blockStyles = {
1570          ...blockStyles,
1571          background: {
1572            ...blockStyles.background,
1573            ...setBackgroundStyleDefaults(blockStyles.background)
1574          }
1575        };
1576      }
1577    }
1578    const extraRules = (0, import_style_engine2.getCSSRules)(blockStyles);
1579    extraRules.forEach((rule) => {
1580      if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) {
1581        return;
1582      }
1583      const cssProperty = rule.key.startsWith("-") ? rule.key : kebabCase(rule.key);
1584      let ruleValue = getResolvedValue(rule.value, tree);
1585      if (cssProperty === "font-size") {
1586        ruleValue = getTypographyFontSizeValue(
1587          { name: "", slug: "", size: ruleValue },
1588          tree?.settings
1589        );
1590      }
1591      if (cssProperty === "aspect-ratio") {
1592        output.push("min-height: unset");
1593      }
1594      output.push(`$cssProperty}: $ruleValue}`);
1595    });
1596    return output;
1597  }
1598  function getLayoutStyles({
1599    layoutDefinitions = LAYOUT_DEFINITIONS,
1600    style,
1601    selector,
1602    hasBlockGapSupport,
1603    hasFallbackGapSupport,
1604    fallbackGapValue
1605  }) {
1606    let ruleset = "";
1607    const blockGapValue = style?.spacing?.blockGap;
1608    let gapValue = hasBlockGapSupport ? getGapCSSValue(blockGapValue) : "";
1609    if (hasFallbackGapSupport) {
1610      if (selector === ROOT_BLOCK_SELECTOR) {
1611        gapValue = !gapValue ? "0.5em" : gapValue;
1612      } else if (!hasBlockGapSupport && fallbackGapValue) {
1613        gapValue = fallbackGapValue;
1614      }
1615    }
1616    const rowGapValue = hasBlockGapSupport && blockGapValue && typeof blockGapValue !== "string" ? getGapCSSValue(blockGapValue.top) : gapValue;
1617    if (gapValue && layoutDefinitions) {
1618      Object.values(layoutDefinitions).forEach(
1619        ({ className, name, spacingStyles }) => {
1620          if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) {
1621            return;
1622          }
1623          const layoutGapValue = ["default", "constrained"].includes(
1624            name
1625          ) ? rowGapValue : gapValue;
1626          if (spacingStyles?.length) {
1627            spacingStyles.forEach((spacingStyle) => {
1628              const declarations = [];
1629              if (spacingStyle.rules) {
1630                Object.entries(spacingStyle.rules).forEach(
1631                  ([cssProperty, cssValue]) => {
1632                    declarations.push(
1633                      `$cssProperty}: $cssValue ? cssValue : layoutGapValue}`
1634                    );
1635                  }
1636                );
1637              }
1638              if (declarations.length) {
1639                let combinedSelector = "";
1640                if (!hasBlockGapSupport) {
1641                  combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.$className}$spacingStyle?.selector || ""})` : `:where($selector}.$className}$spacingStyle?.selector || ""})`;
1642                } else {
1643                  combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.$className})$spacingStyle?.selector || ""}` : `:root :where($selector}-$className})$spacingStyle?.selector || ""}`;
1644                }
1645                ruleset += `$combinedSelector} { $declarations.join(
1646                  "; "
1647                )}; }`;
1648              }
1649            });
1650          }
1651        }
1652      );
1653      if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
1654        ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: $gapValue}; }`;
1655      }
1656    }
1657    if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) {
1658      const validDisplayModes = ["block", "flex", "grid"];
1659      Object.values(layoutDefinitions).forEach(
1660        ({ className, displayMode, baseStyles }) => {
1661          if (displayMode && validDisplayModes.includes(displayMode)) {
1662            ruleset += `$selector} .$className} { display:$displayMode}; }`;
1663          }
1664          if (baseStyles?.length) {
1665            baseStyles.forEach((baseStyle) => {
1666              const declarations = [];
1667              if (baseStyle.rules) {
1668                Object.entries(baseStyle.rules).forEach(
1669                  ([cssProperty, cssValue]) => {
1670                    declarations.push(
1671                      `$cssProperty}: $cssValue}`
1672                    );
1673                  }
1674                );
1675              }
1676              if (declarations.length) {
1677                const combinedSelector = `.$className}$baseStyle?.selector || ""}`;
1678                ruleset += `$combinedSelector} { $declarations.join(
1679                  "; "
1680                )}; }`;
1681              }
1682            });
1683          }
1684        }
1685      );
1686    }
1687    return ruleset;
1688  }
1689  var STYLE_KEYS = [
1690    "border",
1691    "color",
1692    "dimensions",
1693    "spacing",
1694    "typography",
1695    "filter",
1696    "outline",
1697    "shadow",
1698    "background"
1699  ];
1700  function pickStyleKeys(treeToPickFrom, responsiveMediaQueries) {
1701    return pickStyleAndPseudoKeys(
1702      treeToPickFrom,
1703      void 0,
1704      responsiveMediaQueries
1705    );
1706  }
1707  function pickStyleAndPseudoKeys(treeToPickFrom, blockName, responsiveMediaQueries) {
1708    if (!treeToPickFrom) {
1709      return {};
1710    }
1711    const entries = Object.entries(treeToPickFrom);
1712    const allowedPseudoSelectors = blockName ? VALID_BLOCK_PSEUDO_SELECTORS[blockName] ?? [] : [];
1713    const pickedEntries = entries.filter(
1714      ([key]) => STYLE_KEYS.includes(key) || allowedPseudoSelectors.includes(key) || responsiveMediaQueries[key]
1715    );
1716    const clonedEntries = pickedEntries.map(([key, style]) => [
1717      key,
1718      JSON.parse(JSON.stringify(style))
1719    ]);
1720    return Object.fromEntries(clonedEntries);
1721  }
1722  function getPseudoStyleNodes(node) {
1723    const {
1724      styles,
1725      baseStyles,
1726      selector,
1727      featureSelectors,
1728      name,
1729      elementName,
1730      mediaQuery,
1731      variationName
1732    } = node;
1733    const pseudoSelectors = name ? VALID_BLOCK_PSEUDO_SELECTORS[name] ?? [] : VALID_ELEMENT_PSEUDO_SELECTORS[elementName ?? ""] ?? [];
1734    if (!pseudoSelectors.length) {
1735      return [];
1736    }
1737    return pseudoSelectors.flatMap((pseudoSelector) => {
1738      const pseudoStyles = styles?.[pseudoSelector];
1739      if (!pseudoStyles || typeof pseudoStyles !== "object") {
1740        return [];
1741      }
1742      return [
1743        {
1744          styles: JSON.parse(JSON.stringify(pseudoStyles)),
1745          baseStyles: [styles, ...baseStyles ?? []],
1746          selector,
1747          selectorSuffix: pseudoSelector,
1748          mediaQuery,
1749          featureSelectors: featureSelectors && typeof featureSelectors !== "string" ? featureSelectors : void 0,
1750          name,
1751          elementName,
1752          variationName
1753        }
1754      ];
1755    });
1756  }
1757  function isPseudoElementSelector(selectorSuffix) {
1758    return selectorSuffix?.startsWith("::") ?? false;
1759  }
1760  function getPseudoRuleSelector(baseSelector, pseudoSelector) {
1761    if (isPseudoElementSelector(pseudoSelector)) {
1762      return `:root :where($baseSelector})$pseudoSelector}`;
1763    }
1764    return `:root :where($appendToSelector(
1765      baseSelector,
1766      pseudoSelector
1767    )})`;
1768  }
1769  function getResponsiveStyleNodes(node, responsiveMediaQueries) {
1770    const {
1771      styles,
1772      baseStyles,
1773      selector,
1774      fallbackGapValue,
1775      featureSelectors,
1776      hasLayoutSupport,
1777      layoutHasBlockGapSupport,
1778      layoutSelector,
1779      name,
1780      elementName,
1781      isStyleVariation,
1782      variationName
1783    } = node;
1784    if (!name && !elementName) {
1785      return [];
1786    }
1787    return Object.entries(responsiveMediaQueries).flatMap(
1788      ([breakpointKey, mediaQuery]) => {
1789        const breakpointStyles = styles?.[breakpointKey];
1790        if (!breakpointStyles || typeof breakpointStyles !== "object") {
1791          return [];
1792        }
1793        return [
1794          {
1795            styles: JSON.parse(JSON.stringify(breakpointStyles)),
1796            baseStyles: [styles, ...baseStyles ?? []],
1797            selector,
1798            mediaQuery,
1799            featureSelectors: featureSelectors && typeof featureSelectors !== "string" ? featureSelectors : void 0,
1800            fallbackGapValue,
1801            hasLayoutSupport,
1802            name,
1803            elementName,
1804            isStyleVariation,
1805            variationName,
1806            layoutSelector,
1807            layoutHasBlockGapSupport
1808          }
1809        ];
1810      }
1811    );
1812  }
1813  function getElementStylesByName(styleNode, responsiveMediaQueries) {
1814    const elementStylesByName = { ...styleNode?.elements ?? {} };
1815    Object.keys(responsiveMediaQueries).forEach((breakpointKey) => {
1816      Object.entries(styleNode?.[breakpointKey]?.elements ?? {}).forEach(
1817        ([elementName, styles]) => {
1818          elementStylesByName[elementName] = {
1819            ...elementStylesByName[elementName] ?? {},
1820            [breakpointKey]: styles
1821          };
1822        }
1823      );
1824    });
1825    return elementStylesByName;
1826  }
1827  var getNodesWithStyles = (tree, blockSelectors) => {
1828    const nodes = [];
1829    if (!tree?.styles) {
1830      return nodes;
1831    }
1832    const responsiveMediaQueries = getResponsiveMediaQueries(tree);
1833    const styles = pickStyleKeys(tree.styles, responsiveMediaQueries);
1834    if (styles) {
1835      nodes.push({
1836        styles,
1837        selector: ROOT_BLOCK_SELECTOR,
1838        // Root selector (body) styles should not be wrapped in `:root where()` to keep
1839        // specificity at (0,0,1) and maintain backwards compatibility.
1840        skipSelectorWrapper: true
1841      });
1842    }
1843    Object.entries(import_blocks.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => {
1844      if (tree.styles?.elements?.[name]) {
1845        nodes.push({
1846          styles: tree.styles?.elements?.[name] ?? {},
1847          selector,
1848          elementName: name,
1849          // Top level elements that don't use a class name should not receive the
1850          // `:root :where()` wrapper to maintain backwards compatibility.
1851          skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name]
1852        });
1853      }
1854    });
1855    Object.entries(tree.styles?.blocks ?? {}).forEach(
1856      ([blockName, node]) => {
1857        const blockStyles = pickStyleAndPseudoKeys(
1858          node,
1859          blockName,
1860          responsiveMediaQueries
1861        );
1862        const typedNode = node;
1863        if (typedNode?.css) {
1864          blockStyles.css = typedNode.css;
1865        }
1866        const variationNodesToAdd = [];
1867        const variationStyleNodesToAdd = [];
1868        if (typedNode?.variations) {
1869          Object.entries(typedNode.variations).forEach(
1870            ([variationName, variation]) => {
1871              const typedVariation = variation;
1872              const variationStyles = pickStyleAndPseudoKeys(
1873                typedVariation,
1874                blockName,
1875                responsiveMediaQueries
1876              );
1877              if (typedVariation?.css) {
1878                variationStyles.css = typedVariation.css;
1879              }
1880              const variationSelector = typeof blockSelectors !== "string" ? blockSelectors[blockName]?.styleVariationSelectors?.[variationName] : void 0;
1881              if (variationSelector && typeof blockSelectors !== "string") {
1882                const blockSelector = blockSelectors[blockName];
1883                variationStyleNodesToAdd.push({
1884                  styles: variationStyles,
1885                  baseStyles: [typedNode],
1886                  selector: variationSelector,
1887                  featureSelectors: blockSelector?.featureSelectors,
1888                  fallbackGapValue: blockSelector?.fallbackGapValue,
1889                  hasLayoutSupport: blockSelector?.hasLayoutSupport,
1890                  isStyleVariation: true,
1891                  variationName,
1892                  layoutSelector: variationSelector + blockSelector.selector,
1893                  layoutHasBlockGapSupport: true,
1894                  name: blockName
1895                });
1896              }
1897              Object.entries(
1898                getElementStylesByName(
1899                  typedVariation,
1900                  responsiveMediaQueries
1901                )
1902              ).forEach(([element, elementStyles]) => {
1903                if (elementStyles && import_blocks.__EXPERIMENTAL_ELEMENTS[element]) {
1904                  variationNodesToAdd.push({
1905                    styles: elementStyles,
1906                    selector: scopeSelector(
1907                      variationSelector,
1908                      import_blocks.__EXPERIMENTAL_ELEMENTS[element]
1909                    ),
1910                    elementName: element,
1911                    isStyleVariation: true
1912                  });
1913                }
1914              });
1915              Object.entries(typedVariation?.blocks ?? {}).forEach(
1916                ([
1917                  variationBlockName,
1918                  variationBlockStyles
1919                ]) => {
1920                  const variationBlockSelector = typeof blockSelectors !== "string" ? scopeSelector(
1921                    variationSelector,
1922                    blockSelectors[variationBlockName]?.selector
1923                  ) : void 0;
1924                  const variationDuotoneSelector = typeof blockSelectors !== "string" ? scopeSelector(
1925                    variationSelector,
1926                    blockSelectors[variationBlockName]?.duotoneSelector
1927                  ) : void 0;
1928                  const variationFeatureSelectors = typeof blockSelectors !== "string" ? scopeFeatureSelectors(
1929                    variationSelector,
1930                    blockSelectors[variationBlockName]?.featureSelectors ?? {}
1931                  ) : void 0;
1932                  const variationBlockStyleNodes = pickStyleAndPseudoKeys(
1933                    variationBlockStyles,
1934                    variationBlockName,
1935                    responsiveMediaQueries
1936                  );
1937                  if (variationBlockStyles?.css) {
1938                    variationBlockStyleNodes.css = variationBlockStyles.css;
1939                  }
1940                  if (!variationBlockSelector || typeof blockSelectors === "string") {
1941                    return;
1942                  }
1943                  variationNodesToAdd.push({
1944                    selector: variationBlockSelector,
1945                    name: variationBlockName,
1946                    isStyleVariation: true,
1947                    duotoneSelector: variationDuotoneSelector,
1948                    featureSelectors: variationFeatureSelectors,
1949                    fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue,
1950                    hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport,
1951                    styles: variationBlockStyleNodes
1952                  });
1953                  Object.entries(
1954                    getElementStylesByName(
1955                      variationBlockStyles,
1956                      responsiveMediaQueries
1957                    )
1958                  ).forEach(
1959                    ([
1960                      variationBlockElement,
1961                      variationBlockElementStyles
1962                    ]) => {
1963                      if (variationBlockElementStyles && import_blocks.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) {
1964                        variationNodesToAdd.push({
1965                          styles: variationBlockElementStyles,
1966                          selector: scopeSelector(
1967                            variationBlockSelector,
1968                            import_blocks.__EXPERIMENTAL_ELEMENTS[variationBlockElement]
1969                          ),
1970                          elementName: variationBlockElement,
1971                          isStyleVariation: true
1972                        });
1973                      }
1974                    }
1975                  );
1976                }
1977              );
1978            }
1979          );
1980        }
1981        if (typeof blockSelectors !== "string" && blockSelectors?.[blockName]?.selector) {
1982          nodes.push({
1983            duotoneSelector: blockSelectors[blockName].duotoneSelector,
1984            fallbackGapValue: blockSelectors[blockName].fallbackGapValue,
1985            hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
1986            selector: blockSelectors[blockName].selector,
1987            styles: blockStyles,
1988            featureSelectors: blockSelectors[blockName].featureSelectors,
1989            name: blockName
1990          });
1991        }
1992        nodes.push(...variationStyleNodesToAdd);
1993        Object.entries(
1994          getElementStylesByName(typedNode, responsiveMediaQueries)
1995        ).forEach(([elementName, value]) => {
1996          if (typeof blockSelectors !== "string" && value && blockSelectors?.[blockName] && import_blocks.__EXPERIMENTAL_ELEMENTS[elementName]) {
1997            nodes.push({
1998              styles: value,
1999              selector: blockSelectors[blockName]?.selector.split(",").map((sel) => {
2000                const elementSelectors = import_blocks.__EXPERIMENTAL_ELEMENTS[elementName].split(",");
2001                return elementSelectors.map(
2002                  (elementSelector) => sel + " " + elementSelector
2003                );
2004              }).join(","),
2005              elementName
2006            });
2007          }
2008        });
2009        nodes.push(...variationNodesToAdd);
2010      }
2011    );
2012    return nodes;
2013  };
2014  var getNodesWithSettings = (tree, blockSelectors) => {
2015    const nodes = [];
2016    if (!tree?.settings) {
2017      return nodes;
2018    }
2019    const pickPresets = (treeToPickFrom) => {
2020      let presets2 = {};
2021      PRESET_METADATA.forEach(({ path }) => {
2022        const value = getValueFromObjectPath(treeToPickFrom, path, false);
2023        if (value !== false) {
2024          presets2 = setImmutably(presets2, path, value);
2025        }
2026      });
2027      return presets2;
2028    };
2029    const presets = pickPresets(tree.settings);
2030    const custom = tree.settings?.custom;
2031    if (Object.keys(presets).length > 0 || custom) {
2032      nodes.push({
2033        presets,
2034        custom,
2035        selector: ROOT_CSS_PROPERTIES_SELECTOR
2036      });
2037    }
2038    Object.entries(tree.settings?.blocks ?? {}).forEach(
2039      ([blockName, node]) => {
2040        const blockCustom = node.custom;
2041        if (typeof blockSelectors === "string" || !blockSelectors[blockName]) {
2042          return;
2043        }
2044        const blockPresets = pickPresets(node);
2045        if (Object.keys(blockPresets).length > 0 || blockCustom) {
2046          nodes.push({
2047            presets: blockPresets,
2048            custom: blockCustom,
2049            selector: blockSelectors[blockName]?.selector,
2050            featureSelectors: blockSelectors[blockName]?.featureSelectors
2051          });
2052        }
2053      }
2054    );
2055    return nodes;
2056  };
2057  function resolveFeatureSelector(featureSelectors, featureKey, fallback) {
2058    if (!featureSelectors || typeof featureSelectors === "string") {
2059      return fallback;
2060    }
2061    const feature = featureSelectors[featureKey];
2062    if (typeof feature === "string") {
2063      return feature;
2064    }
2065    if (feature && typeof feature === "object" && typeof feature.root === "string") {
2066      return feature.root;
2067    }
2068    return fallback;
2069  }
2070  function getPresetVarDeclarations(presets, mergedSettings, { path, valueKey, valueFunc, cssVarInfix }) {
2071    const presetByOrigin = getValueFromObjectPath(
2072      presets,
2073      path,
2074      []
2075    );
2076    const declarations = [];
2077    for (const origin of ["default", "theme", "custom"]) {
2078      if (!presetByOrigin[origin]) {
2079        continue;
2080      }
2081      for (const value of presetByOrigin[origin]) {
2082        const slug = kebabCase(value.slug);
2083        if (valueKey && !valueFunc) {
2084          declarations.push(
2085            `--wp--preset--$cssVarInfix}--$slug}: $value[valueKey]}`
2086          );
2087        } else if (valueFunc && typeof valueFunc === "function") {
2088          declarations.push(
2089            `--wp--preset--$cssVarInfix}--$slug}: $valueFunc(
2090              value,
2091              mergedSettings
2092            )}`
2093          );
2094        }
2095      }
2096    }
2097    return declarations;
2098  }
2099  var generateCustomProperties = (tree, blockSelectors) => {
2100    const nodes = getNodesWithSettings(tree, blockSelectors);
2101    let ruleset = "";
2102    for (const { presets, custom, selector, featureSelectors } of nodes) {
2103      const defaultSelector = selector;
2104      const varsBySelector = {
2105        [defaultSelector]: []
2106      };
2107      if (tree?.settings) {
2108        for (const metadata of PRESET_METADATA) {
2109          const declarations = getPresetVarDeclarations(
2110            presets,
2111            tree.settings,
2112            metadata
2113          );
2114          if (declarations.length === 0) {
2115            continue;
2116          }
2117          const target = resolveFeatureSelector(
2118            featureSelectors,
2119            metadata.path[0],
2120            defaultSelector
2121          );
2122          if (!varsBySelector[target]) {
2123            varsBySelector[target] = [];
2124          }
2125          varsBySelector[target].push(...declarations);
2126        }
2127      }
2128      const customProps = flattenTree(custom, "--wp--custom--", "--");
2129      if (customProps.length > 0) {
2130        varsBySelector[defaultSelector].push(...customProps);
2131      }
2132      for (const [ruleSelector, declarations] of Object.entries(
2133        varsBySelector
2134      )) {
2135        if (declarations.length > 0) {
2136          ruleset += `$ruleSelector}{$declarations.join(";")};}`;
2137        }
2138      }
2139    }
2140    return ruleset;
2141  };
2142  function renderStylesNode(node, {
2143    tree,
2144    useRootPaddingAlign,
2145    disableLayoutStyles,
2146    hasBlockGapSupport,
2147    hasFallbackGapSupport,
2148    disableRootPadding
2149  }) {
2150    const {
2151      selector,
2152      selectorSuffix,
2153      mediaQuery,
2154      duotoneSelector,
2155      styles,
2156      baseStyles,
2157      fallbackGapValue,
2158      hasLayoutSupport,
2159      featureSelectors,
2160      layoutSelector,
2161      layoutHasBlockGapSupport,
2162      skipSelectorWrapper,
2163      name,
2164      variationName
2165    } = node;
2166    let ruleset = "";
2167    const effectiveSelector = selectorSuffix ? appendToSelector(selector, selectorSuffix) : selector;
2168    if (featureSelectors && typeof featureSelectors !== "string") {
2169      let featureDeclarations = getFeatureDeclarations(
2170        featureSelectors,
2171        styles
2172      );
2173      featureDeclarations = updateParagraphTextIndentSelector(
2174        featureDeclarations,
2175        tree.settings,
2176        name
2177      );
2178      featureDeclarations = updateButtonWidthDeclarations(
2179        featureDeclarations,
2180        tree.settings
2181      );
2182      Object.entries(featureDeclarations).forEach(
2183        ([featureSelector, declarations2]) => {
2184          if (declarations2.length) {
2185            const selectorForRule = variationName ? getBlockStyleVariationFeatureSelector(
2186              variationName,
2187              featureSelector
2188            ) : featureSelector;
2189            const featureRuleSelector = selectorSuffix ? getPseudoRuleSelector(
2190              selectorForRule,
2191              selectorSuffix
2192            ) : `:root :where($selectorForRule})`;
2193            const rules = declarations2.join(";");
2194            ruleset += `$featureRuleSelector}{$rules};}`;
2195          }
2196        }
2197      );
2198    }
2199    if (duotoneSelector) {
2200      const duotoneStyles = {};
2201      if (styles?.filter) {
2202        duotoneStyles.filter = styles.filter;
2203        delete styles.filter;
2204      }
2205      const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
2206      if (duotoneDeclarations.length) {
2207        ruleset += `$duotoneSelector}{$duotoneDeclarations.join(
2208          ";"
2209        )};}`;
2210      }
2211    }
2212    const selectorForLayout = layoutSelector ?? effectiveSelector;
2213    const hasBlockGapSupportForLayout = layoutHasBlockGapSupport ?? hasBlockGapSupport;
2214    if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selectorForLayout || hasLayoutSupport)) {
2215      ruleset += getLayoutStyles({
2216        style: styles,
2217        selector: selectorForLayout,
2218        hasBlockGapSupport: hasBlockGapSupportForLayout,
2219        hasFallbackGapSupport,
2220        fallbackGapValue
2221      });
2222    }
2223    const declarations = getStylesDeclarations(
2224      styles,
2225      effectiveSelector,
2226      useRootPaddingAlign,
2227      tree,
2228      disableRootPadding
2229    );
2230    const styleDeclarations = getStateDeclarationsWithTextClipEscapes(
2231      declarations,
2232      styles,
2233      baseStyles
2234    );
2235    if (styleDeclarations?.length) {
2236      let generalSelector = `:root :where($effectiveSelector})`;
2237      if (skipSelectorWrapper) {
2238        generalSelector = effectiveSelector;
2239      } else if (selectorSuffix) {
2240        generalSelector = getPseudoRuleSelector(selector, selectorSuffix);
2241      }
2242      ruleset += `$generalSelector}{$styleDeclarations.join(";")};}`;
2243    }
2244    if (styles?.css) {
2245      const cssFeatureSelector = featureSelectors && typeof featureSelectors === "object" ? featureSelectors.css : void 0;
2246      let resolvedCssSelector;
2247      if (typeof cssFeatureSelector === "string") {
2248        resolvedCssSelector = cssFeatureSelector;
2249      } else if (cssFeatureSelector && typeof cssFeatureSelector === "object" && "root" in cssFeatureSelector && typeof cssFeatureSelector.root === "string") {
2250        resolvedCssSelector = cssFeatureSelector.root;
2251      }
2252      if (resolvedCssSelector && variationName) {
2253        resolvedCssSelector = getBlockStyleVariationFeatureSelector(
2254          variationName,
2255          resolvedCssSelector
2256        );
2257      }
2258      const cssBaseSelector = resolvedCssSelector ?? selector;
2259      const cssSelector = selectorSuffix ? appendToSelector(cssBaseSelector, selectorSuffix) : cssBaseSelector;
2260      ruleset += processCSSNesting(styles.css, cssSelector);
2261    }
2262    if (mediaQuery && ruleset) {
2263      return `$mediaQuery}{$ruleset}}`;
2264    }
2265    return ruleset;
2266  }
2267  var transformToStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {}) => {
2268    const options = {
2269      blockGap: true,
2270      blockStyles: true,
2271      layoutStyles: true,
2272      marginReset: true,
2273      presets: true,
2274      rootPadding: true,
2275      variationStyles: false,
2276      ...styleOptions
2277    };
2278    const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
2279    const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
2280    const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;
2281    const { contentSize, wideSize } = tree?.settings?.layout || {};
2282    const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles;
2283    let ruleset = "";
2284    if (options.presets && (contentSize || wideSize)) {
2285      ruleset += `$ROOT_CSS_PROPERTIES_SELECTOR} {`;
2286      ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: $contentSize};` : ruleset;
2287      ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: $wideSize};` : ruleset;
2288      ruleset += "}";
2289    }
2290    if (hasBodyStyles) {
2291      ruleset += ":where(body) {margin: 0;";
2292      if (options.rootPadding && useRootPaddingAlign) {
2293        ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
2294                  .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
2295                  .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
2296                  .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }
2297                  .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;
2298                  `;
2299      }
2300      ruleset += "}";
2301    }
2302    if (options.blockStyles) {
2303      const responsiveMediaQueries = getResponsiveMediaQueries(tree);
2304      nodesWithStyles.forEach((node) => {
2305        if (node.isStyleVariation && !options.variationStyles) {
2306          return;
2307        }
2308        const responsiveNodes = getResponsiveStyleNodes(
2309          node,
2310          responsiveMediaQueries
2311        );
2312        [
2313          node,
2314          ...responsiveNodes,
2315          ...getPseudoStyleNodes(node),
2316          ...responsiveNodes.flatMap(getPseudoStyleNodes)
2317        ].forEach((expandedNode) => {
2318          ruleset += renderStylesNode(expandedNode, {
2319            tree,
2320            useRootPaddingAlign,
2321            disableLayoutStyles,
2322            hasBlockGapSupport,
2323            hasFallbackGapSupport,
2324            disableRootPadding
2325          });
2326        });
2327      });
2328    }
2329    if (options.layoutStyles) {
2330      ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }";
2331      ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }";
2332      ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }";
2333    }
2334    if (options.blockGap && hasBlockGapSupport) {
2335      const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em";
2336      ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: $gapValue}; margin-block-end: 0; }`;
2337      ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }";
2338      ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }";
2339    }
2340    if (options.presets) {
2341      nodesWithSettings.forEach(({ selector, presets }) => {
2342        if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) {
2343          selector = "";
2344        }
2345        const classes = getPresetsClasses(selector, presets);
2346        if (classes.length > 0) {
2347          ruleset += classes;
2348        }
2349      });
2350    }
2351    return ruleset;
2352  };
2353  function generateSvgFilters(tree, blockSelectors) {
2354    const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
2355    return nodesWithSettings.flatMap(({ presets }) => {
2356      return getPresetsSvgFilters(presets);
2357    });
2358  }
2359  var getSelectorsConfig = (blockType, rootSelector) => {
2360    if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) {
2361      return blockType.selectors;
2362    }
2363    const config = {
2364      root: rootSelector
2365    };
2366    Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(
2367      ([featureKey, featureName]) => {
2368        const featureSelector = getBlockSelector(blockType, featureKey);
2369        if (featureSelector) {
2370          config[featureName] = featureSelector;
2371        }
2372      }
2373    );
2374    return config;
2375  };
2376  var getBlockSelectors = (blockTypes, variationInstanceId) => {
2377    const { getBlockStyles } = (0, import_data2.select)(import_blocks.store);
2378    const result = {};
2379    blockTypes.forEach((blockType) => {
2380      const name = blockType.name;
2381      const selector = getBlockSelector(blockType);
2382      if (!selector) {
2383        return;
2384      }
2385      let duotoneSelector = getBlockSelector(blockType, "filter.duotone");
2386      if (!duotoneSelector) {
2387        const rootSelector = getBlockSelector(blockType);
2388        const duotoneSupport = (0, import_blocks.getBlockSupport)(
2389          blockType,
2390          "color.__experimentalDuotone",
2391          false
2392        );
2393        if (typeof duotoneSupport === "string" && rootSelector) {
2394          duotoneSelector = scopeSelector(rootSelector, duotoneSupport);
2395        }
2396      }
2397      const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout;
2398      const blockGapSupport = blockType?.supports?.spacing?.blockGap;
2399      const fallbackGapValue = typeof blockGapSupport === "object" && !Array.isArray(blockGapSupport) ? blockGapSupport.__experimentalDefault : void 0;
2400      const blockStyleVariations = getBlockStyles(name);
2401      const styleVariationSelectors = {};
2402      blockStyleVariations?.forEach((variation) => {
2403        const variationSuffix = variationInstanceId ? `-$variationInstanceId}` : "";
2404        const variationName = `$variation.name}$variationSuffix}`;
2405        const styleVariationSelector = getBlockStyleVariationSelector(
2406          variationName,
2407          selector
2408        );
2409        styleVariationSelectors[variationName] = styleVariationSelector;
2410      });
2411      const featureSelectors = getSelectorsConfig(blockType, selector);
2412      result[name] = {
2413        duotoneSelector: duotoneSelector ?? void 0,
2414        fallbackGapValue,
2415        featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0,
2416        hasLayoutSupport,
2417        name,
2418        selector,
2419        styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0
2420      };
2421    });
2422    return result;
2423  };
2424  function updateConfigWithSeparator(config) {
2425    const blocks = config.styles?.blocks;
2426    const separatorBlock = blocks?.["core/separator"];
2427    const needsSeparatorStyleUpdate = separatorBlock && separatorBlock.color?.background && !separatorBlock.color?.text && !separatorBlock.border?.color;
2428    if (needsSeparatorStyleUpdate) {
2429      return {
2430        ...config,
2431        styles: {
2432          ...config.styles,
2433          blocks: {
2434            ...blocks,
2435            "core/separator": {
2436              ...separatorBlock,
2437              color: {
2438                ...separatorBlock.color,
2439                text: separatorBlock.color?.background
2440              }
2441            }
2442          }
2443        }
2444      };
2445    }
2446    return config;
2447  }
2448  function processCSSNesting(css, blockSelector) {
2449    let processedCSS = "";
2450    if (!css || css.trim() === "") {
2451      return processedCSS;
2452    }
2453    const parts = css.split("&");
2454    parts.forEach((part) => {
2455      if (!part || part.trim() === "") {
2456        return;
2457      }
2458      const isRootCss = !part.includes("{");
2459      if (isRootCss) {
2460        processedCSS += `:root :where($blockSelector}){$part.trim()}}`;
2461      } else {
2462        const splitPart = part.replace("}", "").split("{");
2463        if (splitPart.length !== 2) {
2464          return;
2465        }
2466        const [nestedSelector, cssValue] = splitPart;
2467        const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/);
2468        const pseudoPart = matches ? matches[1] : "";
2469        const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim();
2470        let combinedSelector;
2471        if (withoutPseudoElement === "") {
2472          combinedSelector = blockSelector;
2473        } else {
2474          combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement);
2475        }
2476        processedCSS += `:root :where($combinedSelector})$pseudoPart}{$cssValue.trim()}}`;
2477      }
2478    });
2479    return processedCSS;
2480  }
2481  function generateGlobalStyles(config = {}, blockTypes = [], options = {}) {
2482    const {
2483      hasBlockGapSupport: hasBlockGapSupportOption,
2484      hasFallbackGapSupport: hasFallbackGapSupportOption,
2485      disableLayoutStyles = false,
2486      disableRootPadding = false,
2487      styleOptions = {}
2488    } = options;
2489    const blocks = blockTypes.length > 0 ? blockTypes : (0, import_blocks.getBlockTypes)();
2490    const blockGap = getSetting(config, "spacing.blockGap");
2491    const hasBlockGapSupport = hasBlockGapSupportOption ?? (blockGap !== null && blockGap !== void 0);
2492    const hasFallbackGapSupport = hasFallbackGapSupportOption ?? !hasBlockGapSupport;
2493    if (!config?.styles || !config?.settings) {
2494      return [[], {}];
2495    }
2496    const updatedConfig = updateConfigWithSeparator(config);
2497    const blockSelectors = getBlockSelectors(blocks);
2498    const customProperties = generateCustomProperties(
2499      updatedConfig,
2500      blockSelectors
2501    );
2502    const globalStyles = transformToStyles(
2503      updatedConfig,
2504      blockSelectors,
2505      hasBlockGapSupport,
2506      hasFallbackGapSupport,
2507      disableLayoutStyles,
2508      disableRootPadding,
2509      styleOptions
2510    );
2511    const svgs = generateSvgFilters(updatedConfig, blockSelectors);
2512    const styles = [
2513      {
2514        css: customProperties,
2515        isGlobalStyles: true
2516      },
2517      {
2518        css: globalStyles,
2519        isGlobalStyles: true
2520      },
2521      // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
2522      {
2523        css: updatedConfig?.styles?.css ?? "",
2524        isGlobalStyles: true
2525      },
2526      {
2527        assets: svgs,
2528        __unstableType: "svgs",
2529        isGlobalStyles: true
2530      }
2531    ];
2532    return [styles, updatedConfig.settings];
2533  }
2534  
2535  // packages/lazy-editor/build-module/hooks/use-editor-settings.mjs
2536  var import_core_data3 = __toESM(require_core_data(), 1);
2537  var import_blocks2 = __toESM(require_blocks(), 1);
2538  var import_element2 = __toESM(require_element(), 1);
2539  var import_data4 = __toESM(require_data(), 1);
2540  
2541  // packages/lazy-editor/build-module/hooks/use-global-styles.mjs
2542  var import_core_data2 = __toESM(require_core_data(), 1);
2543  var import_data3 = __toESM(require_data(), 1);
2544  var import_element = __toESM(require_element(), 1);
2545  function useUserGlobalStyles(id) {
2546    const { userGlobalStyles } = (0, import_data3.useSelect)(
2547      (select2) => {
2548        if (id === void 0) {
2549          return { userGlobalStyles: void 0 };
2550        }
2551        const { getEntityRecord, getEditedEntityRecord, canUser } = select2(import_core_data2.store);
2552        const userCanEditGlobalStyles = canUser("update", {
2553          kind: "root",
2554          name: "globalStyles",
2555          id
2556        });
2557        let record;
2558        if (
2559          /*
2560           * Test that the OPTIONS request for user capabilities is complete
2561           * before fetching the global styles entity record.
2562           * This is to avoid fetching the global styles entity unnecessarily.
2563           */
2564          typeof userCanEditGlobalStyles === "boolean"
2565        ) {
2566          if (userCanEditGlobalStyles) {
2567            record = getEditedEntityRecord(
2568              "root",
2569              "globalStyles",
2570              id
2571            );
2572          } else {
2573            record = getEntityRecord("root", "globalStyles", id, {
2574              context: "view"
2575            });
2576          }
2577        }
2578        return {
2579          userGlobalStyles: record
2580        };
2581      },
2582      [id]
2583    );
2584    return (0, import_element.useMemo)(() => {
2585      if (!userGlobalStyles) {
2586        return {
2587          user: void 0
2588        };
2589      }
2590      const user = userGlobalStyles;
2591      return {
2592        user
2593      };
2594    }, [userGlobalStyles]);
2595  }
2596  
2597  // packages/lazy-editor/build-module/lock-unlock.mjs
2598  var import_private_apis = __toESM(require_private_apis(), 1);
2599  var { unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
2600    "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
2601    "@wordpress/lazy-editor"
2602  );
2603  
2604  // packages/lazy-editor/build-module/hooks/use-editor-settings.mjs
2605  function useEditorSettings({
2606    stylesId
2607  }) {
2608    const { editorSettings, blockTypes } = (0, import_data4.useSelect)(
2609      (select2) => ({
2610        editorSettings: unlock(
2611          select2(import_core_data3.store)
2612        ).getEditorSettings(),
2613        blockTypes: select2(import_blocks2.store).getBlockTypes()
2614      }),
2615      []
2616    );
2617    const { user: globalStyles } = useUserGlobalStyles(stylesId);
2618    const [globalStylesCSS] = (0, import_element2.useMemo)(
2619      () => generateGlobalStyles(globalStyles, blockTypes),
2620      [globalStyles, blockTypes]
2621    );
2622    const hasEditorSettings = !!editorSettings;
2623    const styles = (0, import_element2.useMemo)(() => {
2624      if (!hasEditorSettings) {
2625        return [];
2626      }
2627      return [
2628        ...editorSettings?.styles ?? [],
2629        ...globalStylesCSS
2630      ];
2631    }, [hasEditorSettings, editorSettings?.styles, globalStylesCSS]);
2632    return {
2633      isReady: hasEditorSettings,
2634      editorSettings: (0, import_element2.useMemo)(
2635        () => ({
2636          ...editorSettings ?? {},
2637          styles
2638        }),
2639        [editorSettings, styles]
2640      )
2641    };
2642  }
2643  
2644  // packages/asset-loader/build-module/index.mjs
2645  function injectImportMap(scriptModules) {
2646    if (!scriptModules || Object.keys(scriptModules).length === 0) {
2647      return;
2648    }
2649    const existingMapElement = document.querySelector(
2650      "script#wp-importmap[type=importmap]"
2651    );
2652    if (existingMapElement) {
2653      try {
2654        const existingMap = JSON.parse(existingMapElement.text);
2655        if (!existingMap.imports) {
2656          existingMap.imports = {};
2657        }
2658        existingMap.imports = {
2659          ...existingMap.imports,
2660          ...scriptModules
2661        };
2662        existingMapElement.text = JSON.stringify(existingMap, null, 2);
2663      } catch (error) {
2664        console.error("Failed to parse or update import map:", error);
2665      }
2666    } else {
2667      const script = document.createElement("script");
2668      script.type = "importmap";
2669      script.id = "wp-importmap";
2670      script.text = JSON.stringify(
2671        {
2672          imports: scriptModules
2673        },
2674        null,
2675        2
2676      );
2677      document.head.appendChild(script);
2678    }
2679  }
2680  function loadStylesheet(handle, styleData) {
2681    return new Promise((resolve) => {
2682      if (!styleData.src) {
2683        resolve();
2684        return;
2685      }
2686      const existingLink = document.getElementById(handle + "-css");
2687      if (existingLink) {
2688        resolve();
2689        return;
2690      }
2691      const link = document.createElement("link");
2692      link.rel = "stylesheet";
2693      link.href = styleData.src + (styleData.version ? "?ver=" + styleData.version : "");
2694      link.id = handle + "-css";
2695      link.media = styleData.media || "all";
2696      link.onload = () => resolve();
2697      link.onerror = () => {
2698        console.error(`Failed to load stylesheet: $handle}`);
2699        resolve();
2700      };
2701      document.head.appendChild(link);
2702    });
2703  }
2704  function loadScript(handle, scriptData) {
2705    if (!scriptData.src) {
2706      const marker = document.createElement("script");
2707      marker.id = handle + "-js";
2708      marker.textContent = "// Processed: " + handle;
2709      return marker;
2710    }
2711    const script = document.createElement("script");
2712    script.src = scriptData.src + (scriptData.version ? "?ver=" + scriptData.version : "");
2713    script.id = handle + "-js";
2714    script.async = false;
2715    return script;
2716  }
2717  function injectInlineStyle(handle, inlineStyle, position) {
2718    let styleContent = "";
2719    if (Array.isArray(inlineStyle)) {
2720      styleContent = inlineStyle.join("\n");
2721    } else if (typeof inlineStyle === "string") {
2722      styleContent = inlineStyle;
2723    }
2724    if (styleContent && styleContent.trim()) {
2725      const styleId = handle + "-" + position + "-inline-css";
2726      if (!document.getElementById(styleId)) {
2727        const style = document.createElement("style");
2728        style.id = styleId;
2729        style.textContent = styleContent.trim();
2730        document.head.appendChild(style);
2731      }
2732    }
2733  }
2734  function injectInlineScript(handle, inlineScript, position) {
2735    let scriptContent = inlineScript;
2736    if (Array.isArray(scriptContent)) {
2737      scriptContent = scriptContent.join("\n");
2738    }
2739    const script = document.createElement("script");
2740    script.id = handle + "-" + position + "-js";
2741    script.textContent = scriptContent.trim();
2742    return script;
2743  }
2744  function buildDependencyOrderedList(assetsData) {
2745    const visited = /* @__PURE__ */ new Set();
2746    const visiting = /* @__PURE__ */ new Set();
2747    const orderedList = [];
2748    function visit(handle) {
2749      if (visited.has(handle)) {
2750        return;
2751      }
2752      if (visiting.has(handle)) {
2753        console.warn(
2754          `Circular dependency detected for handle: $handle}`
2755        );
2756        return;
2757      }
2758      visiting.add(handle);
2759      if (assetsData[handle]) {
2760        const deps = assetsData[handle].deps || [];
2761        deps.forEach((dep) => {
2762          if (assetsData[dep]) {
2763            visit(dep);
2764          }
2765        });
2766      }
2767      visiting.delete(handle);
2768      visited.add(handle);
2769      if (assetsData[handle]) {
2770        orderedList.push(handle);
2771      }
2772    }
2773    Object.keys(assetsData).forEach((handle) => {
2774      visit(handle);
2775    });
2776    return orderedList;
2777  }
2778  async function performScriptLoad(scriptElements, destination) {
2779    let parallel = [];
2780    for (const scriptElement of scriptElements) {
2781      if (scriptElement.src) {
2782        const loader = Promise.withResolvers();
2783        scriptElement.onload = () => loader.resolve();
2784        scriptElement.onerror = () => {
2785          console.error(`Failed to load script: $scriptElement.id}`);
2786          loader.resolve();
2787        };
2788        parallel.push(loader.promise);
2789      } else {
2790        await Promise.all(parallel);
2791        parallel = [];
2792      }
2793      destination.appendChild(scriptElement);
2794    }
2795    await Promise.all(parallel);
2796    parallel = [];
2797  }
2798  async function loadAssets(scriptsData, inlineScripts, stylesData, inlineStyles, htmlTemplates, scriptModules) {
2799    if (scriptModules) {
2800      injectImportMap(scriptModules);
2801    }
2802    const orderedStyles = buildDependencyOrderedList(stylesData);
2803    const orderedScripts = buildDependencyOrderedList(scriptsData);
2804    const stylePromises = [];
2805    for (const handle of orderedStyles) {
2806      const beforeInline = inlineStyles.before?.[handle];
2807      if (beforeInline) {
2808        injectInlineStyle(handle, beforeInline, "before");
2809      }
2810      stylePromises.push(loadStylesheet(handle, stylesData[handle]));
2811      const afterInline = inlineStyles.after?.[handle];
2812      if (afterInline) {
2813        injectInlineStyle(handle, afterInline, "after");
2814      }
2815    }
2816    const scriptElements = [];
2817    for (const handle of orderedScripts) {
2818      const beforeInline = inlineScripts.before?.[handle];
2819      if (beforeInline) {
2820        scriptElements.push(
2821          injectInlineScript(handle, beforeInline, "before")
2822        );
2823      }
2824      scriptElements.push(loadScript(handle, scriptsData[handle]));
2825      const afterInline = inlineScripts.after?.[handle];
2826      if (afterInline) {
2827        scriptElements.push(
2828          injectInlineScript(handle, afterInline, "after")
2829        );
2830      }
2831    }
2832    const scriptsPromise = performScriptLoad(scriptElements, document.body);
2833    await Promise.all([Promise.all(stylePromises), scriptsPromise]);
2834    if (htmlTemplates && htmlTemplates.length > 0) {
2835      htmlTemplates.forEach((templateHtml) => {
2836        const scriptMatch = templateHtml.match(
2837          /<script([^>]*)>(.*?)<\/script>/is
2838        );
2839        if (scriptMatch) {
2840          const attributes = scriptMatch[1];
2841          const content = scriptMatch[2];
2842          const script = document.createElement("script");
2843          const idMatch = attributes.match(/id=["']([^"']+)["']/);
2844          if (idMatch) {
2845            script.id = idMatch[1];
2846          }
2847          const typeMatch = attributes.match(/type=["']([^"']+)["']/);
2848          if (typeMatch) {
2849            script.type = typeMatch[1];
2850          }
2851          script.textContent = content;
2852          document.body.appendChild(script);
2853        }
2854      });
2855    }
2856  }
2857  var index_default = loadAssets;
2858  
2859  // packages/lazy-editor/build-module/hooks/use-editor-assets.mjs
2860  var import_core_data4 = __toESM(require_core_data(), 1);
2861  var import_element3 = __toESM(require_element(), 1);
2862  var import_data5 = __toESM(require_data(), 1);
2863  var loadAssetsPromise;
2864  async function loadEditorAssets() {
2865    const load = async () => {
2866      const editorAssets = await unlock(
2867        (0, import_data5.resolveSelect)(import_core_data4.store)
2868      ).getEditorAssets();
2869      await index_default(
2870        editorAssets.scripts || {},
2871        editorAssets.inline_scripts || { before: {}, after: {} },
2872        editorAssets.styles || {},
2873        editorAssets.inline_styles || { before: {}, after: {} },
2874        editorAssets.html_templates || [],
2875        editorAssets.script_modules || {}
2876      );
2877    };
2878    if (!loadAssetsPromise) {
2879      loadAssetsPromise = load();
2880    }
2881    return loadAssetsPromise;
2882  }
2883  function useEditorAssets() {
2884    const editorAssets = (0, import_data5.useSelect)((select2) => {
2885      return unlock(select2(import_core_data4.store)).getEditorAssets();
2886    }, []);
2887    const [assetsLoaded, setAssetsLoaded] = (0, import_element3.useState)(false);
2888    (0, import_element3.useEffect)(() => {
2889      if (editorAssets && !assetsLoaded) {
2890        loadEditorAssets().then(() => {
2891          setAssetsLoaded(true);
2892        }).catch((error) => {
2893          console.error("Failed to load editor assets:", error);
2894        });
2895      }
2896    }, [editorAssets, assetsLoaded]);
2897    return {
2898      isReady: !!editorAssets && assetsLoaded,
2899      assetsLoaded
2900    };
2901  }
2902  
2903  // packages/lazy-editor/build-module/components/editor/index.mjs
2904  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
2905  var {
2906    Editor: PrivateEditor,
2907    BackButton,
2908    PreferencesModal,
2909    ToolsMoreMenuGroup,
2910    SiteExport
2911  } = unlock(import_editor.privateApis);
2912  function Editor({
2913    postType,
2914    postId,
2915    settings,
2916    backButton,
2917    onActionPerformed,
2918    initialViewport,
2919    renderingMode
2920  }) {
2921    const homePage = (0, import_data6.useSelect)(
2922      (select2) => {
2923        if (postType || postId) {
2924          return null;
2925        }
2926        const { getHomePage } = unlock(select2(import_core_data5.store));
2927        return getHomePage();
2928      },
2929      [postType, postId]
2930    );
2931    const resolvedPostType = postType || homePage?.postType;
2932    const resolvedPostId = postId || homePage?.postId;
2933    const templateId = (0, import_data6.useSelect)(
2934      (select2) => {
2935        if (!resolvedPostType || !resolvedPostId) {
2936          return void 0;
2937        }
2938        if (resolvedPostType === "wp_template") {
2939          return resolvedPostId;
2940        }
2941        return unlock(select2(import_core_data5.store)).getTemplateId(
2942          resolvedPostType,
2943          resolvedPostId
2944        );
2945      },
2946      [resolvedPostType, resolvedPostId]
2947    );
2948    const stylesId = useStylesId({ templateId });
2949    const { isReady: settingsReady, editorSettings } = useEditorSettings({
2950      stylesId
2951    });
2952    const { isReady: assetsReady } = useEditorAssets();
2953    const finalSettings = (0, import_element4.useMemo)(
2954      () => ({
2955        ...editorSettings,
2956        ...settings,
2957        /*
2958         * The theme's styles and the user's global styles, then whatever the
2959         * host adds for the surface it is rendering into. Spelled out after
2960         * the spread because `styles` is a list each source adds to: a host
2961         * contributing its own must not drop everyone else's.
2962         */
2963        styles: [
2964          ...editorSettings.styles ?? [],
2965          ...settings?.styles ?? []
2966        ]
2967      }),
2968      [editorSettings, settings]
2969    );
2970    if (!settingsReady || !assetsReady) {
2971      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2972        "div",
2973        {
2974          style: {
2975            display: "flex",
2976            justifyContent: "center",
2977            alignItems: "center",
2978            height: "100vh"
2979          },
2980          children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {})
2981        }
2982      );
2983    }
2984    return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2985      PrivateEditor,
2986      {
2987        postType: resolvedPostType,
2988        postId: resolvedPostId,
2989        templateId,
2990        settings: finalSettings,
2991        styles: finalSettings.styles,
2992        onActionPerformed,
2993        initialViewport,
2994        renderingMode,
2995        children: [
2996          backButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BackButton, { children: backButton }),
2997          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreferencesModal, {}),
2998          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolsMoreMenuGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SiteExport, {}) })
2999        ]
3000      }
3001    );
3002  }
3003  
3004  // packages/lazy-editor/build-module/components/preview/index.mjs
3005  var import_i18n = __toESM(require_i18n(), 1);
3006  var import_element5 = __toESM(require_element(), 1);
3007  var import_block_editor = __toESM(require_block_editor(), 1);
3008  var import_editor2 = __toESM(require_editor(), 1);
3009  var import_blocks3 = __toESM(require_blocks(), 1);
3010  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
3011  if (typeof document !== "undefined" && (typeof process === "undefined" || true) && !document.head.querySelector("style[data-wp-hash='95327475c1']")) {
3012    const style = document.createElement("style");
3013    style.setAttribute("data-wp-hash", "95327475c1");
3014    style.appendChild(document.createTextNode(".lazy-editor-block-preview__container{align-items:center;border-radius:4px;display:flex;flex-direction:column;height:100%;justify-content:center}.dataviews-view-grid .lazy-editor-block-preview__container .block-editor-block-preview__container{height:100%}.dataviews-view-table .lazy-editor-block-preview__container{text-wrap:balance;text-wrap:pretty;flex-grow:0;width:96px}"));
3015    document.head.appendChild(style);
3016  }
3017  var { useStyle } = unlock(import_editor2.privateApis);
3018  function PreviewContent({
3019    blocks,
3020    content,
3021    description
3022  }) {
3023    const descriptionId = (0, import_element5.useId)();
3024    const backgroundColor = useStyle("color.background");
3025    const actualBlocks = (0, import_element5.useMemo)(() => {
3026      return blocks ?? (0, import_blocks3.parse)(content, {
3027        __unstableSkipMigrationLogs: true
3028      });
3029    }, [content, blocks]);
3030    const isEmpty = !actualBlocks?.length;
3031    return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
3032      "div",
3033      {
3034        className: "lazy-editor-block-preview__container",
3035        style: { backgroundColor },
3036        "aria-describedby": !!description ? descriptionId : void 0,
3037        children: [
3038          isEmpty && (0, import_i18n.__)("Empty."),
3039          !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_block_editor.BlockPreview.Async, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_block_editor.BlockPreview, { blocks: actualBlocks }) }),
3040          !!description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { hidden: true, id: descriptionId, children: description })
3041        ]
3042      }
3043    );
3044  }
3045  function Preview({
3046    blocks,
3047    content,
3048    description
3049  }) {
3050    const stylesId = useStylesId();
3051    const { isReady: settingsReady, editorSettings } = useEditorSettings({
3052      stylesId
3053    });
3054    const { isReady: assetsReady } = useEditorAssets();
3055    const finalSettings = (0, import_element5.useMemo)(
3056      () => ({
3057        ...editorSettings,
3058        isPreviewMode: true
3059      }),
3060      [editorSettings]
3061    );
3062    if (!settingsReady || !assetsReady) {
3063      return null;
3064    }
3065    return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_block_editor.BlockEditorProvider, { settings: finalSettings, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3066      PreviewContent,
3067      {
3068        blocks,
3069        content,
3070        description
3071      }
3072    ) });
3073  }
3074  export {
3075    Editor,
3076    Preview,
3077    loadEditorAssets,
3078    useEditorAssets,
3079    useEditorSettings
3080  };


Generated : Tue Nov 3 08:20:36 2026 Cross-referenced by PHPXref