[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> patterns.js (source)

   1  (function() {
   2  var wp;
   3  (wp ||= {}).patterns = (() => {
   4    var __create = Object.create;
   5    var __defProp = Object.defineProperty;
   6    var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
   7    var __getOwnPropNames = Object.getOwnPropertyNames;
   8    var __getProtoOf = Object.getPrototypeOf;
   9    var __hasOwnProp = Object.prototype.hasOwnProperty;
  10    var __commonJS = (cb, mod) => function __require() {
  11      return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  12    };
  13    var __export = (target, all) => {
  14      for (var name in all)
  15        __defProp(target, name, { get: all[name], enumerable: true });
  16    };
  17    var __copyProps = (to, from, except, desc) => {
  18      if (from && typeof from === "object" || typeof from === "function") {
  19        for (let key of __getOwnPropNames(from))
  20          if (!__hasOwnProp.call(to, key) && key !== except)
  21            __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  22      }
  23      return to;
  24    };
  25    var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  26      // If the importer is in node compatibility mode or this is not an ESM
  27      // file that has been converted to a CommonJS file using a Babel-
  28      // compatible transform (i.e. "__esModule" has not been set), then set
  29      // "default" to the CommonJS "module.exports" for node compatibility.
  30      isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  31      mod
  32    ));
  33    var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  34  
  35    // package-external:@wordpress/data
  36    var require_data = __commonJS({
  37      "package-external:@wordpress/data"(exports, module) {
  38        module.exports = window.wp.data;
  39      }
  40    });
  41  
  42    // package-external:@wordpress/blocks
  43    var require_blocks = __commonJS({
  44      "package-external:@wordpress/blocks"(exports, module) {
  45        module.exports = window.wp.blocks;
  46      }
  47    });
  48  
  49    // package-external:@wordpress/core-data
  50    var require_core_data = __commonJS({
  51      "package-external:@wordpress/core-data"(exports, module) {
  52        module.exports = window.wp.coreData;
  53      }
  54    });
  55  
  56    // package-external:@wordpress/block-editor
  57    var require_block_editor = __commonJS({
  58      "package-external:@wordpress/block-editor"(exports, module) {
  59        module.exports = window.wp.blockEditor;
  60      }
  61    });
  62  
  63    // package-external:@wordpress/private-apis
  64    var require_private_apis = __commonJS({
  65      "package-external:@wordpress/private-apis"(exports, module) {
  66        module.exports = window.wp.privateApis;
  67      }
  68    });
  69  
  70    // package-external:@wordpress/components
  71    var require_components = __commonJS({
  72      "package-external:@wordpress/components"(exports, module) {
  73        module.exports = window.wp.components;
  74      }
  75    });
  76  
  77    // package-external:@wordpress/element
  78    var require_element = __commonJS({
  79      "package-external:@wordpress/element"(exports, module) {
  80        module.exports = window.wp.element;
  81      }
  82    });
  83  
  84    // package-external:@wordpress/i18n
  85    var require_i18n = __commonJS({
  86      "package-external:@wordpress/i18n"(exports, module) {
  87        module.exports = window.wp.i18n;
  88      }
  89    });
  90  
  91    // vendor-external:react/jsx-runtime
  92    var require_jsx_runtime = __commonJS({
  93      "vendor-external:react/jsx-runtime"(exports, module) {
  94        module.exports = window.ReactJSXRuntime;
  95      }
  96    });
  97  
  98    // vendor-external:react
  99    var require_react = __commonJS({
 100      "vendor-external:react"(exports, module) {
 101        module.exports = window.React;
 102      }
 103    });
 104  
 105    // package-external:@wordpress/a11y
 106    var require_a11y = __commonJS({
 107      "package-external:@wordpress/a11y"(exports, module) {
 108        module.exports = window.wp.a11y;
 109      }
 110    });
 111  
 112    // package-external:@wordpress/primitives
 113    var require_primitives = __commonJS({
 114      "package-external:@wordpress/primitives"(exports, module) {
 115        module.exports = window.wp.primitives;
 116      }
 117    });
 118  
 119    // package-external:@wordpress/compose
 120    var require_compose = __commonJS({
 121      "package-external:@wordpress/compose"(exports, module) {
 122        module.exports = window.wp.compose;
 123      }
 124    });
 125  
 126    // package-external:@wordpress/notices
 127    var require_notices = __commonJS({
 128      "package-external:@wordpress/notices"(exports, module) {
 129        module.exports = window.wp.notices;
 130      }
 131    });
 132  
 133    // package-external:@wordpress/html-entities
 134    var require_html_entities = __commonJS({
 135      "package-external:@wordpress/html-entities"(exports, module) {
 136        module.exports = window.wp.htmlEntities;
 137      }
 138    });
 139  
 140    // package-external:@wordpress/url
 141    var require_url = __commonJS({
 142      "package-external:@wordpress/url"(exports, module) {
 143        module.exports = window.wp.url;
 144      }
 145    });
 146  
 147    // packages/patterns/build-module/index.mjs
 148    var index_exports = {};
 149    __export(index_exports, {
 150      privateApis: () => privateApis,
 151      store: () => store
 152    });
 153  
 154    // packages/patterns/build-module/store/index.mjs
 155    var import_data2 = __toESM(require_data(), 1);
 156  
 157    // packages/patterns/build-module/store/reducer.mjs
 158    var import_data = __toESM(require_data(), 1);
 159    function isEditingPattern(state = {}, action) {
 160      if (action?.type === "SET_EDITING_PATTERN") {
 161        return {
 162          ...state,
 163          [action.clientId]: action.isEditing
 164        };
 165      }
 166      return state;
 167    }
 168    var reducer_default = (0, import_data.combineReducers)({
 169      isEditingPattern
 170    });
 171  
 172    // packages/patterns/build-module/store/actions.mjs
 173    var actions_exports = {};
 174    __export(actions_exports, {
 175      convertSyncedPatternToStatic: () => convertSyncedPatternToStatic,
 176      createPattern: () => createPattern,
 177      createPatternFromFile: () => createPatternFromFile,
 178      setEditingPattern: () => setEditingPattern
 179    });
 180    var import_blocks = __toESM(require_blocks(), 1);
 181    var import_core_data = __toESM(require_core_data(), 1);
 182    var import_block_editor = __toESM(require_block_editor(), 1);
 183  
 184    // packages/patterns/build-module/constants.mjs
 185    var PATTERN_TYPES = {
 186      theme: "pattern",
 187      user: "wp_block"
 188    };
 189    var PATTERN_DEFAULT_CATEGORY = "all-patterns";
 190    var PATTERN_USER_CATEGORY = "my-patterns";
 191    var EXCLUDED_PATTERN_SOURCES = [
 192      "core",
 193      "pattern-directory/core",
 194      "pattern-directory/featured"
 195    ];
 196    var PATTERN_SYNC_TYPES = {
 197      full: "fully",
 198      unsynced: "unsynced"
 199    };
 200    var PATTERN_OVERRIDES_BINDING_SOURCE = "core/pattern-overrides";
 201  
 202    // packages/patterns/build-module/store/actions.mjs
 203    var createPattern = (title, syncType, content, categories) => async ({ registry }) => {
 204      const meta = syncType === PATTERN_SYNC_TYPES.unsynced ? {
 205        wp_pattern_sync_status: syncType
 206      } : void 0;
 207      const reusableBlock = {
 208        title,
 209        content,
 210        status: "publish",
 211        meta,
 212        wp_pattern_category: categories
 213      };
 214      const updatedRecord = await registry.dispatch(import_core_data.store).saveEntityRecord("postType", "wp_block", reusableBlock);
 215      return updatedRecord;
 216    };
 217    var createPatternFromFile = (file, categories) => async ({ dispatch }) => {
 218      const fileContent = await file.text();
 219      let parsedContent;
 220      try {
 221        parsedContent = JSON.parse(fileContent);
 222      } catch {
 223        throw new Error("Invalid JSON file");
 224      }
 225      if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") {
 226        throw new Error("Invalid pattern JSON file");
 227      }
 228      const pattern = await dispatch.createPattern(
 229        parsedContent.title,
 230        parsedContent.syncStatus,
 231        parsedContent.content,
 232        categories
 233      );
 234      return pattern;
 235    };
 236    var convertSyncedPatternToStatic = (clientId) => ({ registry }) => {
 237      const patternBlock = registry.select(import_block_editor.store).getBlock(clientId);
 238      const existingOverrides = patternBlock.attributes?.content;
 239      function cloneBlocksAndRemoveBindings(blocks) {
 240        return blocks.map((block) => {
 241          let metadata = block.attributes.metadata;
 242          if (metadata) {
 243            metadata = { ...metadata };
 244            delete metadata.id;
 245            delete metadata.bindings;
 246            if (existingOverrides?.[metadata.name]) {
 247              for (const [attributeName, value] of Object.entries(
 248                existingOverrides[metadata.name]
 249              )) {
 250                if (!(0, import_blocks.getBlockType)(block.name)?.attributes[attributeName]) {
 251                  continue;
 252                }
 253                block.attributes[attributeName] = value;
 254              }
 255            }
 256          }
 257          return (0, import_blocks.cloneBlock)(
 258            block,
 259            {
 260              metadata: metadata && Object.keys(metadata).length > 0 ? metadata : void 0
 261            },
 262            cloneBlocksAndRemoveBindings(block.innerBlocks)
 263          );
 264        });
 265      }
 266      const patternInnerBlocks = registry.select(import_block_editor.store).getBlocks(patternBlock.clientId);
 267      registry.dispatch(import_block_editor.store).replaceBlocks(
 268        patternBlock.clientId,
 269        cloneBlocksAndRemoveBindings(patternInnerBlocks)
 270      );
 271    };
 272    function setEditingPattern(clientId, isEditing) {
 273      return {
 274        type: "SET_EDITING_PATTERN",
 275        clientId,
 276        isEditing
 277      };
 278    }
 279  
 280    // packages/patterns/build-module/store/constants.mjs
 281    var STORE_NAME = "core/patterns";
 282  
 283    // packages/patterns/build-module/store/selectors.mjs
 284    var selectors_exports = {};
 285    __export(selectors_exports, {
 286      isEditingPattern: () => isEditingPattern2
 287    });
 288    function isEditingPattern2(state, clientId) {
 289      return state.isEditingPattern[clientId];
 290    }
 291  
 292    // packages/patterns/build-module/lock-unlock.mjs
 293    var import_private_apis = __toESM(require_private_apis(), 1);
 294    var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
 295      "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
 296      "@wordpress/patterns"
 297    );
 298  
 299    // packages/patterns/build-module/store/index.mjs
 300    var storeConfig = {
 301      reducer: reducer_default
 302    };
 303    var store = (0, import_data2.createReduxStore)(STORE_NAME, {
 304      ...storeConfig
 305    });
 306    (0, import_data2.register)(store);
 307    unlock(store).registerPrivateActions(actions_exports);
 308    unlock(store).registerPrivateSelectors(selectors_exports);
 309  
 310    // packages/patterns/build-module/components/overrides-panel.mjs
 311    var import_block_editor2 = __toESM(require_block_editor(), 1);
 312    var import_components = __toESM(require_components(), 1);
 313    var import_data3 = __toESM(require_data(), 1);
 314    var import_element = __toESM(require_element(), 1);
 315    var import_i18n = __toESM(require_i18n(), 1);
 316  
 317    // packages/patterns/build-module/api/index.mjs
 318    function isOverridableBlock(block) {
 319      return !!block.attributes.metadata?.name && !!block.attributes.metadata?.bindings && Object.values(block.attributes.metadata.bindings).some(
 320        (binding) => binding.source === "core/pattern-overrides"
 321      );
 322    }
 323  
 324    // packages/patterns/build-module/components/overrides-panel.mjs
 325    var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
 326    var { BlockQuickNavigation } = unlock(import_block_editor2.privateApis);
 327    function OverridesPanel() {
 328      const { allClientIds, supportedBlockTypesRaw } = (0, import_data3.useSelect)(
 329        (select) => ({
 330          allClientIds: select(import_block_editor2.store).getClientIdsWithDescendants(),
 331          supportedBlockTypesRaw: select(import_block_editor2.store).getSettings()?.__experimentalBlockBindingsSupportedAttributes
 332        }),
 333        []
 334      );
 335      const { getBlock } = (0, import_data3.useSelect)(import_block_editor2.store);
 336      const clientIdsWithOverrides = (0, import_element.useMemo)(() => {
 337        const supportedBlockTypes = Object.keys(supportedBlockTypesRaw ?? {});
 338        return allClientIds.filter((clientId) => {
 339          const block = getBlock(clientId);
 340          return supportedBlockTypes.includes(block.name) && isOverridableBlock(block);
 341        });
 342      }, [allClientIds, getBlock, supportedBlockTypesRaw]);
 343      if (!clientIdsWithOverrides?.length) {
 344        return null;
 345      }
 346      return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.PanelBody, { title: (0, import_i18n.__)("Overrides"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockQuickNavigation, { clientIds: clientIdsWithOverrides }) });
 347    }
 348  
 349    // packages/patterns/build-module/components/create-pattern-modal.mjs
 350    var import_components3 = __toESM(require_components(), 1);
 351  
 352    // node_modules/clsx/dist/clsx.mjs
 353    function r(e) {
 354      var t, f, n = "";
 355      if ("string" == typeof e || "number" == typeof e) n += e;
 356      else if ("object" == typeof e) if (Array.isArray(e)) {
 357        var o = e.length;
 358        for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
 359      } else for (f in e) e[f] && (n && (n += " "), n += f);
 360      return n;
 361    }
 362    function clsx() {
 363      for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
 364      return n;
 365    }
 366    var clsx_default = clsx;
 367  
 368    // node_modules/@base-ui/utils/useRefWithInit.mjs
 369    var React = __toESM(require_react(), 1);
 370    var UNINITIALIZED = {};
 371    function useRefWithInit(init, initArg) {
 372      const ref = React.useRef(UNINITIALIZED);
 373      if (ref.current === UNINITIALIZED) {
 374        ref.current = init(initArg);
 375      }
 376      return ref;
 377    }
 378  
 379    // node_modules/@base-ui/utils/warn.mjs
 380    var set;
 381    if (true) {
 382      set = /* @__PURE__ */ new Set();
 383    }
 384    function warn(...messages) {
 385      if (true) {
 386        const messageKey = messages.join(" ");
 387        if (!set.has(messageKey)) {
 388          set.add(messageKey);
 389          console.warn(`Base UI: $messageKey}`);
 390        }
 391      }
 392    }
 393  
 394    // node_modules/@base-ui/react/internals/useRenderElement.mjs
 395    var React4 = __toESM(require_react(), 1);
 396  
 397    // node_modules/@base-ui/utils/useMergedRefs.mjs
 398    function useMergedRefs(a, b, c, d) {
 399      const forkRef = useRefWithInit(createForkRef).current;
 400      if (didChange(forkRef, a, b, c, d)) {
 401        update(forkRef, [a, b, c, d]);
 402      }
 403      return forkRef.callback;
 404    }
 405    function useMergedRefsN(refs) {
 406      const forkRef = useRefWithInit(createForkRef).current;
 407      if (didChangeN(forkRef, refs)) {
 408        update(forkRef, refs);
 409      }
 410      return forkRef.callback;
 411    }
 412    function createForkRef() {
 413      return {
 414        callback: null,
 415        cleanup: null,
 416        refs: []
 417      };
 418    }
 419    function didChange(forkRef, a, b, c, d) {
 420      return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
 421    }
 422    function didChangeN(forkRef, newRefs) {
 423      return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
 424    }
 425    function update(forkRef, refs) {
 426      forkRef.refs = refs;
 427      if (refs.every((ref) => ref == null)) {
 428        forkRef.callback = null;
 429        return;
 430      }
 431      forkRef.callback = (instance) => {
 432        if (forkRef.cleanup) {
 433          forkRef.cleanup();
 434          forkRef.cleanup = null;
 435        }
 436        if (instance != null) {
 437          const cleanupCallbacks = Array(refs.length).fill(null);
 438          for (let i = 0; i < refs.length; i += 1) {
 439            const ref = refs[i];
 440            if (ref == null) {
 441              continue;
 442            }
 443            switch (typeof ref) {
 444              case "function": {
 445                const refCleanup = ref(instance);
 446                if (typeof refCleanup === "function") {
 447                  cleanupCallbacks[i] = refCleanup;
 448                }
 449                break;
 450              }
 451              case "object": {
 452                ref.current = instance;
 453                break;
 454              }
 455              default:
 456            }
 457          }
 458          forkRef.cleanup = () => {
 459            for (let i = 0; i < refs.length; i += 1) {
 460              const ref = refs[i];
 461              if (ref == null) {
 462                continue;
 463              }
 464              switch (typeof ref) {
 465                case "function": {
 466                  const cleanupCallback = cleanupCallbacks[i];
 467                  if (typeof cleanupCallback === "function") {
 468                    cleanupCallback();
 469                  } else {
 470                    ref(null);
 471                  }
 472                  break;
 473                }
 474                case "object": {
 475                  ref.current = null;
 476                  break;
 477                }
 478                default:
 479              }
 480            }
 481          };
 482        }
 483      };
 484    }
 485  
 486    // node_modules/@base-ui/utils/getReactElementRef.mjs
 487    var React3 = __toESM(require_react(), 1);
 488  
 489    // node_modules/@base-ui/utils/reactVersion.mjs
 490    var React2 = __toESM(require_react(), 1);
 491    var majorVersion = parseInt(React2.version, 10);
 492    function isReactVersionAtLeast(reactVersionToCheck) {
 493      return majorVersion >= reactVersionToCheck;
 494    }
 495  
 496    // node_modules/@base-ui/utils/getReactElementRef.mjs
 497    function getReactElementRef(element) {
 498      if (!/* @__PURE__ */ React3.isValidElement(element)) {
 499        return null;
 500      }
 501      const reactElement = element;
 502      const propsWithRef = reactElement.props;
 503      return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
 504    }
 505  
 506    // node_modules/@base-ui/utils/mergeObjects.mjs
 507    function mergeObjects(a, b) {
 508      if (a && !b) {
 509        return a;
 510      }
 511      if (!a && b) {
 512        return b;
 513      }
 514      if (a || b) {
 515        return {
 516          ...a,
 517          ...b
 518        };
 519      }
 520      return void 0;
 521    }
 522  
 523    // node_modules/@base-ui/utils/empty.mjs
 524    var EMPTY_ARRAY = Object.freeze([]);
 525    var EMPTY_OBJECT = Object.freeze({});
 526  
 527    // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
 528    function getStateAttributesProps(state, customMapping) {
 529      const props = {};
 530      for (const key in state) {
 531        const value = state[key];
 532        if (customMapping?.hasOwnProperty(key)) {
 533          const customProps = customMapping[key](value);
 534          if (customProps != null) {
 535            Object.assign(props, customProps);
 536          }
 537          continue;
 538        }
 539        if (value === true) {
 540          props[`data-$key.toLowerCase()}`] = "";
 541        } else if (value) {
 542          props[`data-$key.toLowerCase()}`] = value.toString();
 543        }
 544      }
 545      return props;
 546    }
 547  
 548    // node_modules/@base-ui/react/utils/resolveClassName.mjs
 549    function resolveClassName(className, state) {
 550      return typeof className === "function" ? className(state) : className;
 551    }
 552  
 553    // node_modules/@base-ui/react/utils/resolveStyle.mjs
 554    function resolveStyle(style, state) {
 555      return typeof style === "function" ? style(state) : style;
 556    }
 557  
 558    // node_modules/@base-ui/react/merge-props/mergeProps.mjs
 559    var EMPTY_PROPS = {};
 560    function mergeProps(a, b, c, d, e) {
 561      if (!c && !d && !e && !a) {
 562        return createInitialMergedProps(b);
 563      }
 564      let merged = createInitialMergedProps(a);
 565      if (b) {
 566        merged = mergeInto(merged, b);
 567      }
 568      if (c) {
 569        merged = mergeInto(merged, c);
 570      }
 571      if (d) {
 572        merged = mergeInto(merged, d);
 573      }
 574      if (e) {
 575        merged = mergeInto(merged, e);
 576      }
 577      return merged;
 578    }
 579    function mergePropsN(props) {
 580      if (props.length === 0) {
 581        return EMPTY_PROPS;
 582      }
 583      if (props.length === 1) {
 584        return createInitialMergedProps(props[0]);
 585      }
 586      let merged = createInitialMergedProps(props[0]);
 587      for (let i = 1; i < props.length; i += 1) {
 588        merged = mergeInto(merged, props[i]);
 589      }
 590      return merged;
 591    }
 592    function createInitialMergedProps(inputProps) {
 593      if (isPropsGetter(inputProps)) {
 594        return {
 595          ...resolvePropsGetter(inputProps, EMPTY_PROPS)
 596        };
 597      }
 598      return copyInitialProps(inputProps);
 599    }
 600    function mergeInto(merged, inputProps) {
 601      if (isPropsGetter(inputProps)) {
 602        return resolvePropsGetter(inputProps, merged);
 603      }
 604      return mutablyMergeInto(merged, inputProps);
 605    }
 606    function copyInitialProps(inputProps) {
 607      const copiedProps = {
 608        ...inputProps
 609      };
 610      for (const propName in copiedProps) {
 611        const propValue = copiedProps[propName];
 612        if (isEventHandler(propName, propValue)) {
 613          copiedProps[propName] = wrapEventHandler(propValue);
 614        }
 615      }
 616      return copiedProps;
 617    }
 618    function mutablyMergeInto(mergedProps, externalProps) {
 619      if (!externalProps) {
 620        return mergedProps;
 621      }
 622      for (const propName in externalProps) {
 623        const externalPropValue = externalProps[propName];
 624        switch (propName) {
 625          case "style": {
 626            mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
 627            break;
 628          }
 629          case "className": {
 630            mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
 631            break;
 632          }
 633          default: {
 634            if (isEventHandler(propName, externalPropValue)) {
 635              mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
 636            } else {
 637              mergedProps[propName] = externalPropValue;
 638            }
 639          }
 640        }
 641      }
 642      return mergedProps;
 643    }
 644    function isEventHandler(key, value) {
 645      const code0 = key.charCodeAt(0);
 646      const code1 = key.charCodeAt(1);
 647      const code2 = key.charCodeAt(2);
 648      return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
 649    }
 650    function isPropsGetter(inputProps) {
 651      return typeof inputProps === "function";
 652    }
 653    function resolvePropsGetter(inputProps, previousProps) {
 654      if (isPropsGetter(inputProps)) {
 655        return inputProps(previousProps);
 656      }
 657      return inputProps ?? EMPTY_PROPS;
 658    }
 659    function mergeEventHandlers(ourHandler, theirHandler) {
 660      if (!theirHandler) {
 661        return ourHandler;
 662      }
 663      if (!ourHandler) {
 664        return wrapEventHandler(theirHandler);
 665      }
 666      return (...args) => {
 667        const event = args[0];
 668        if (isSyntheticEvent(event)) {
 669          const baseUIEvent = event;
 670          makeEventPreventable(baseUIEvent);
 671          const result2 = theirHandler(...args);
 672          if (!baseUIEvent.baseUIHandlerPrevented) {
 673            ourHandler?.(...args);
 674          }
 675          return result2;
 676        }
 677        const result = theirHandler(...args);
 678        ourHandler?.(...args);
 679        return result;
 680      };
 681    }
 682    function wrapEventHandler(handler) {
 683      if (!handler) {
 684        return handler;
 685      }
 686      return (...args) => {
 687        const event = args[0];
 688        if (isSyntheticEvent(event)) {
 689          makeEventPreventable(event);
 690        }
 691        return handler(...args);
 692      };
 693    }
 694    function makeEventPreventable(event) {
 695      event.preventBaseUIHandler = () => {
 696        event.baseUIHandlerPrevented = true;
 697      };
 698      return event;
 699    }
 700    function mergeClassNames(ourClassName, theirClassName) {
 701      if (theirClassName) {
 702        if (ourClassName) {
 703          return theirClassName + " " + ourClassName;
 704        }
 705        return theirClassName;
 706      }
 707      return ourClassName;
 708    }
 709    function isSyntheticEvent(event) {
 710      return event != null && typeof event === "object" && "nativeEvent" in event;
 711    }
 712  
 713    // node_modules/@base-ui/react/internals/useRenderElement.mjs
 714    var import_react = __toESM(require_react(), 1);
 715    function useRenderElement(element, componentProps, params = {}) {
 716      const renderProp = componentProps.render;
 717      const outProps = useRenderElementProps(componentProps, params);
 718      if (params.enabled === false) {
 719        return null;
 720      }
 721      const state = params.state ?? EMPTY_OBJECT;
 722      return evaluateRenderProp(element, renderProp, outProps, state);
 723    }
 724    function useRenderElementProps(componentProps, params = {}) {
 725      const {
 726        className: classNameProp,
 727        style: styleProp,
 728        render: renderProp
 729      } = componentProps;
 730      const {
 731        state = EMPTY_OBJECT,
 732        ref,
 733        props,
 734        stateAttributesMapping,
 735        enabled = true
 736      } = params;
 737      const className = enabled ? resolveClassName(classNameProp, state) : void 0;
 738      const style = enabled ? resolveStyle(styleProp, state) : void 0;
 739      const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
 740      const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
 741      const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
 742      if (typeof document !== "undefined") {
 743        if (!enabled) {
 744          useMergedRefs(null, null);
 745        } else if (Array.isArray(ref)) {
 746          outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
 747        } else {
 748          outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
 749        }
 750      }
 751      if (!enabled) {
 752        return EMPTY_OBJECT;
 753      }
 754      if (className !== void 0) {
 755        outProps.className = mergeClassNames(outProps.className, className);
 756      }
 757      if (style !== void 0) {
 758        outProps.style = mergeObjects(outProps.style, style);
 759      }
 760      return outProps;
 761    }
 762    function resolveRenderFunctionProps(props) {
 763      if (Array.isArray(props)) {
 764        return mergePropsN(props);
 765      }
 766      return mergeProps(void 0, props);
 767    }
 768    var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
 769    var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
 770    var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
 771    function evaluateRenderProp(element, render, props, state) {
 772      if (render) {
 773        if (typeof render === "function") {
 774          if (true) {
 775            warnIfRenderPropLooksLikeComponent(render);
 776          }
 777          return render(props, state);
 778        }
 779        const mergedProps = mergeProps(props, render.props);
 780        mergedProps.ref = props.ref;
 781        let newElement = render;
 782        if (newElement?.$$typeof === REACT_LAZY_TYPE) {
 783          const children = React4.Children.toArray(render);
 784          newElement = children[0];
 785        }
 786        if (true) {
 787          if (!/* @__PURE__ */ React4.isValidElement(newElement)) {
 788            throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
 789          }
 790        }
 791        return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps);
 792      }
 793      if (element) {
 794        if (typeof element === "string") {
 795          return renderTag(element, props);
 796        }
 797      }
 798      throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
 799    }
 800    function warnIfRenderPropLooksLikeComponent(renderFn) {
 801      const functionName = renderFn.name;
 802      if (functionName.length === 0) {
 803        return;
 804      }
 805      if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
 806        return;
 807      }
 808      if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
 809        return;
 810      }
 811      warn(`The \`render\` prop received a function named \`$functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
 812    }
 813    function renderTag(Tag, props) {
 814      if (Tag === "button") {
 815        return /* @__PURE__ */ (0, import_react.createElement)("button", {
 816          type: "button",
 817          ...props,
 818          key: props.key
 819        });
 820      }
 821      if (Tag === "img") {
 822        return /* @__PURE__ */ (0, import_react.createElement)("img", {
 823          alt: "",
 824          ...props,
 825          key: props.key
 826        });
 827      }
 828      return /* @__PURE__ */ React4.createElement(Tag, props);
 829    }
 830  
 831    // node_modules/@base-ui/react/use-render/useRender.mjs
 832    function useRender(params) {
 833      return useRenderElement(params.defaultTagName ?? "div", params, params);
 834    }
 835  
 836    // packages/ui/build-module/text/text.mjs
 837    var import_element2 = __toESM(require_element(), 1);
 838    var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
 839    function getRuntime() {
 840      const globalScope = globalThis;
 841      if (globalScope.__wpStyleRuntime) {
 842        return globalScope.__wpStyleRuntime;
 843      }
 844      globalScope.__wpStyleRuntime = {
 845        documents: /* @__PURE__ */ new Map(),
 846        styles: /* @__PURE__ */ new Map(),
 847        injectedStyles: /* @__PURE__ */ new WeakMap()
 848      };
 849      if (typeof document !== "undefined") {
 850        registerDocument(document);
 851      }
 852      return globalScope.__wpStyleRuntime;
 853    }
 854    function documentContainsStyleHash(targetDocument, hash) {
 855      if (!targetDocument.head) {
 856        return false;
 857      }
 858      for (const style of targetDocument.head.querySelectorAll(
 859        `style[$STYLE_HASH_ATTRIBUTE}]`
 860      )) {
 861        if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
 862          return true;
 863        }
 864      }
 865      return false;
 866    }
 867    function injectStyle(targetDocument, hash, css) {
 868      if (!targetDocument.head) {
 869        return;
 870      }
 871      const runtime = getRuntime();
 872      let injectedStyles = runtime.injectedStyles.get(targetDocument);
 873      if (!injectedStyles) {
 874        injectedStyles = /* @__PURE__ */ new Set();
 875        runtime.injectedStyles.set(targetDocument, injectedStyles);
 876      }
 877      if (injectedStyles.has(hash)) {
 878        return;
 879      }
 880      if (documentContainsStyleHash(targetDocument, hash)) {
 881        injectedStyles.add(hash);
 882        return;
 883      }
 884      const style = targetDocument.createElement("style");
 885      style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
 886      style.appendChild(targetDocument.createTextNode(css));
 887      targetDocument.head.appendChild(style);
 888      injectedStyles.add(hash);
 889    }
 890    function registerDocument(targetDocument) {
 891      const runtime = getRuntime();
 892      runtime.documents.set(
 893        targetDocument,
 894        (runtime.documents.get(targetDocument) ?? 0) + 1
 895      );
 896      for (const [hash, css] of runtime.styles) {
 897        injectStyle(targetDocument, hash, css);
 898      }
 899      return () => {
 900        const count = runtime.documents.get(targetDocument);
 901        if (count === void 0) {
 902          return;
 903        }
 904        if (count <= 1) {
 905          runtime.documents.delete(targetDocument);
 906          return;
 907        }
 908        runtime.documents.set(targetDocument, count - 1);
 909      };
 910    }
 911    function registerStyle(hash, css) {
 912      const runtime = getRuntime();
 913      runtime.styles.set(hash, css);
 914      for (const targetDocument of runtime.documents.keys()) {
 915        injectStyle(targetDocument, hash, css);
 916      }
 917    }
 918    if (typeof process === "undefined" || true) {
 919      registerStyle("a495f9d138", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
 920    }
 921    var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
 922    if (typeof process === "undefined" || true) {
 923      registerStyle("af6d9984a6", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}");
 924    }
 925    var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
 926    var Text = (0, import_element2.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) {
 927      const element = useRender({
 928        render,
 929        defaultTagName: "span",
 930        ref,
 931        props: mergeProps(props, {
 932          className: clsx_default(
 933            style_default.text,
 934            global_css_defense_default.heading,
 935            global_css_defense_default.p,
 936            style_default[variant],
 937            className
 938          )
 939        })
 940      });
 941      return element;
 942    });
 943  
 944    // packages/icons/build-module/library/symbol.mjs
 945    var import_primitives = __toESM(require_primitives(), 1);
 946    var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
 947    var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.Path, { d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" }) });
 948  
 949    // packages/ui/build-module/stack/stack.mjs
 950    var import_element3 = __toESM(require_element(), 1);
 951    var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
 952    function getRuntime2() {
 953      const globalScope = globalThis;
 954      if (globalScope.__wpStyleRuntime) {
 955        return globalScope.__wpStyleRuntime;
 956      }
 957      globalScope.__wpStyleRuntime = {
 958        documents: /* @__PURE__ */ new Map(),
 959        styles: /* @__PURE__ */ new Map(),
 960        injectedStyles: /* @__PURE__ */ new WeakMap()
 961      };
 962      if (typeof document !== "undefined") {
 963        registerDocument2(document);
 964      }
 965      return globalScope.__wpStyleRuntime;
 966    }
 967    function documentContainsStyleHash2(targetDocument, hash) {
 968      if (!targetDocument.head) {
 969        return false;
 970      }
 971      for (const style of targetDocument.head.querySelectorAll(
 972        `style[$STYLE_HASH_ATTRIBUTE2}]`
 973      )) {
 974        if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
 975          return true;
 976        }
 977      }
 978      return false;
 979    }
 980    function injectStyle2(targetDocument, hash, css) {
 981      if (!targetDocument.head) {
 982        return;
 983      }
 984      const runtime = getRuntime2();
 985      let injectedStyles = runtime.injectedStyles.get(targetDocument);
 986      if (!injectedStyles) {
 987        injectedStyles = /* @__PURE__ */ new Set();
 988        runtime.injectedStyles.set(targetDocument, injectedStyles);
 989      }
 990      if (injectedStyles.has(hash)) {
 991        return;
 992      }
 993      if (documentContainsStyleHash2(targetDocument, hash)) {
 994        injectedStyles.add(hash);
 995        return;
 996      }
 997      const style = targetDocument.createElement("style");
 998      style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
 999      style.appendChild(targetDocument.createTextNode(css));
1000      targetDocument.head.appendChild(style);
1001      injectedStyles.add(hash);
1002    }
1003    function registerDocument2(targetDocument) {
1004      const runtime = getRuntime2();
1005      runtime.documents.set(
1006        targetDocument,
1007        (runtime.documents.get(targetDocument) ?? 0) + 1
1008      );
1009      for (const [hash, css] of runtime.styles) {
1010        injectStyle2(targetDocument, hash, css);
1011      }
1012      return () => {
1013        const count = runtime.documents.get(targetDocument);
1014        if (count === void 0) {
1015          return;
1016        }
1017        if (count <= 1) {
1018          runtime.documents.delete(targetDocument);
1019          return;
1020        }
1021        runtime.documents.set(targetDocument, count - 1);
1022      };
1023    }
1024    function registerStyle2(hash, css) {
1025      const runtime = getRuntime2();
1026      runtime.styles.set(hash, css);
1027      for (const targetDocument of runtime.documents.keys()) {
1028        injectStyle2(targetDocument, hash, css);
1029      }
1030    }
1031    if (typeof process === "undefined" || true) {
1032      registerStyle2("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
1033    }
1034    var style_default2 = { "stack": "_19ce0419607e1896__stack" };
1035    var gapTokens = {
1036      xs: "var(--wpds-dimension-gap-xs, 4px)",
1037      sm: "var(--wpds-dimension-gap-sm, 8px)",
1038      md: "var(--wpds-dimension-gap-md, 12px)",
1039      lg: "var(--wpds-dimension-gap-lg, 16px)",
1040      xl: "var(--wpds-dimension-gap-xl, 24px)",
1041      "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
1042      "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
1043    };
1044    var Stack = (0, import_element3.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
1045      const style = {
1046        gap: gap && gapTokens[gap],
1047        alignItems: align,
1048        justifyContent: justify,
1049        flexDirection: direction,
1050        flexWrap: wrap
1051      };
1052      const element = useRender({
1053        render,
1054        ref,
1055        props: mergeProps(props, { style, className: style_default2.stack })
1056      });
1057      return element;
1058    });
1059  
1060    // packages/patterns/build-module/components/create-pattern-modal.mjs
1061    var import_i18n3 = __toESM(require_i18n(), 1);
1062    var import_element6 = __toESM(require_element(), 1);
1063    var import_data5 = __toESM(require_data(), 1);
1064    var import_notices = __toESM(require_notices(), 1);
1065    var import_core_data3 = __toESM(require_core_data(), 1);
1066  
1067    // packages/patterns/build-module/components/category-selector.mjs
1068    var import_i18n2 = __toESM(require_i18n(), 1);
1069    var import_element4 = __toESM(require_element(), 1);
1070    var import_components2 = __toESM(require_components(), 1);
1071    var import_compose = __toESM(require_compose(), 1);
1072    var import_html_entities = __toESM(require_html_entities(), 1);
1073    var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
1074    var unescapeString = (arg) => {
1075      return (0, import_html_entities.decodeEntities)(arg);
1076    };
1077    var CATEGORY_SLUG = "wp_pattern_category";
1078    function CategorySelector({
1079      categoryTerms,
1080      onChange,
1081      categoryMap
1082    }) {
1083      const [search, setSearch] = (0, import_element4.useState)("");
1084      const debouncedSearch = (0, import_compose.useDebounce)(setSearch, 500);
1085      const suggestions = (0, import_element4.useMemo)(() => {
1086        return Array.from(categoryMap.values()).map((category) => unescapeString(category.label)).filter((category) => {
1087          if (search !== "") {
1088            return category.toLowerCase().includes(search.toLowerCase());
1089          }
1090          return true;
1091        }).sort((a, b) => a.localeCompare(b));
1092      }, [search, categoryMap]);
1093      function handleChange(termNames) {
1094        const uniqueTerms = termNames.reduce((terms, newTerm) => {
1095          if (!terms.some(
1096            (term) => term.toLowerCase() === newTerm.toLowerCase()
1097          )) {
1098            terms.push(newTerm);
1099          }
1100          return terms;
1101        }, []);
1102        onChange(uniqueTerms);
1103      }
1104      return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1105        import_components2.FormTokenField,
1106        {
1107          className: "patterns-menu-items__convert-modal-categories",
1108          value: categoryTerms,
1109          suggestions,
1110          onChange: handleChange,
1111          onInputChange: debouncedSearch,
1112          label: (0, import_i18n2.__)("Categories"),
1113          tokenizeOnBlur: true,
1114          __experimentalExpandOnFocus: true
1115        }
1116      );
1117    }
1118  
1119    // packages/patterns/build-module/private-hooks.mjs
1120    var import_data4 = __toESM(require_data(), 1);
1121    var import_core_data2 = __toESM(require_core_data(), 1);
1122    var import_element5 = __toESM(require_element(), 1);
1123    function useAddPatternCategory() {
1124      const { saveEntityRecord, invalidateResolution } = (0, import_data4.useDispatch)(import_core_data2.store);
1125      const { corePatternCategories, userPatternCategories } = (0, import_data4.useSelect)(
1126        (select) => {
1127          const { getUserPatternCategories, getBlockPatternCategories } = select(import_core_data2.store);
1128          return {
1129            corePatternCategories: getBlockPatternCategories(),
1130            userPatternCategories: getUserPatternCategories()
1131          };
1132        },
1133        []
1134      );
1135      const categoryMap = (0, import_element5.useMemo)(() => {
1136        const uniqueCategories = /* @__PURE__ */ new Map();
1137        userPatternCategories.forEach((category) => {
1138          uniqueCategories.set(category.label.toLowerCase(), {
1139            label: category.label,
1140            name: category.name,
1141            id: category.id
1142          });
1143        });
1144        corePatternCategories.forEach((category) => {
1145          if (!uniqueCategories.has(category.label.toLowerCase()) && // There are two core categories with `Post` label so explicitly remove the one with
1146          // the `query` slug to avoid any confusion.
1147          category.name !== "query") {
1148            uniqueCategories.set(category.label.toLowerCase(), {
1149              label: category.label,
1150              name: category.name
1151            });
1152          }
1153        });
1154        return uniqueCategories;
1155      }, [userPatternCategories, corePatternCategories]);
1156      async function findOrCreateTerm(term) {
1157        try {
1158          const existingTerm = categoryMap.get(term.toLowerCase());
1159          if (existingTerm?.id) {
1160            return existingTerm.id;
1161          }
1162          const termData = existingTerm ? { name: existingTerm.label, slug: existingTerm.name } : { name: term };
1163          const newTerm = await saveEntityRecord(
1164            "taxonomy",
1165            CATEGORY_SLUG,
1166            termData,
1167            { throwOnError: true }
1168          );
1169          invalidateResolution("getUserPatternCategories");
1170          return newTerm.id;
1171        } catch (error) {
1172          if (error.code !== "term_exists") {
1173            throw error;
1174          }
1175          return error.data.term_id;
1176        }
1177      }
1178      return { categoryMap, findOrCreateTerm };
1179    }
1180  
1181    // packages/patterns/build-module/components/create-pattern-modal.mjs
1182    var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
1183    function CreatePatternModal({
1184      className = "patterns-menu-items__convert-modal",
1185      modalTitle,
1186      ...restProps
1187    }) {
1188      const defaultModalTitle = (0, import_data5.useSelect)(
1189        (select) => select(import_core_data3.store).getPostType(PATTERN_TYPES.user)?.labels?.add_new_item,
1190        []
1191      );
1192      return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1193        import_components3.Modal,
1194        {
1195          title: modalTitle || defaultModalTitle,
1196          onRequestClose: restProps.onClose,
1197          overlayClassName: className,
1198          focusOnMount: "firstContentElement",
1199          size: "small",
1200          children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CreatePatternModalContents, { ...restProps })
1201        }
1202      );
1203    }
1204    function CreatePatternModalContents({
1205      confirmLabel = (0, import_i18n3.__)("Add"),
1206      defaultCategories = [],
1207      content,
1208      onClose,
1209      onError,
1210      onSuccess,
1211      defaultSyncType = PATTERN_SYNC_TYPES.full,
1212      defaultTitle = ""
1213    }) {
1214      const [syncType, setSyncType] = (0, import_element6.useState)(defaultSyncType);
1215      const [categoryTerms, setCategoryTerms] = (0, import_element6.useState)(defaultCategories);
1216      const [title, setTitle] = (0, import_element6.useState)(defaultTitle);
1217      const [isSaving, setIsSaving] = (0, import_element6.useState)(false);
1218      const { createPattern: createPattern2 } = unlock((0, import_data5.useDispatch)(store));
1219      const { createErrorNotice } = (0, import_data5.useDispatch)(import_notices.store);
1220      const { categoryMap, findOrCreateTerm } = useAddPatternCategory();
1221      async function onCreate(patternTitle, sync) {
1222        if (!title || isSaving) {
1223          return;
1224        }
1225        try {
1226          setIsSaving(true);
1227          const categories = await Promise.all(
1228            categoryTerms.map(
1229              (termName) => findOrCreateTerm(termName)
1230            )
1231          );
1232          const newPattern = await createPattern2(
1233            patternTitle,
1234            sync,
1235            typeof content === "function" ? content() : content,
1236            categories
1237          );
1238          onSuccess({
1239            pattern: newPattern,
1240            categoryId: PATTERN_DEFAULT_CATEGORY
1241          });
1242        } catch (error) {
1243          createErrorNotice(error.message, {
1244            type: "snackbar",
1245            id: "pattern-create"
1246          });
1247          onError?.();
1248        } finally {
1249          setIsSaving(false);
1250          setCategoryTerms([]);
1251          setTitle("");
1252        }
1253      }
1254      return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1255        "form",
1256        {
1257          onSubmit: (event) => {
1258            event.preventDefault();
1259            onCreate(title, syncType);
1260          },
1261          children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Stack, { direction: "column", gap: "lg", children: [
1262            /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1263              import_components3.TextControl,
1264              {
1265                label: (0, import_i18n3.__)("Name"),
1266                value: title,
1267                onChange: setTitle,
1268                placeholder: (0, import_i18n3.__)("My pattern"),
1269                className: "patterns-create-modal__name-input"
1270              }
1271            ),
1272            /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1273              CategorySelector,
1274              {
1275                categoryTerms,
1276                onChange: setCategoryTerms,
1277                categoryMap
1278              }
1279            ),
1280            /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1281              import_components3.ToggleControl,
1282              {
1283                label: (0, import_i18n3._x)("Synced", "pattern (singular)"),
1284                help: (0, import_i18n3.__)(
1285                  "Sync this pattern across multiple locations."
1286                ),
1287                checked: syncType === PATTERN_SYNC_TYPES.full,
1288                onChange: () => {
1289                  setSyncType(
1290                    syncType === PATTERN_SYNC_TYPES.full ? PATTERN_SYNC_TYPES.unsynced : PATTERN_SYNC_TYPES.full
1291                  );
1292                }
1293              }
1294            ),
1295            /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Stack, { gap: "sm", justify: "end", children: [
1296              /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1297                import_components3.Button,
1298                {
1299                  __next40pxDefaultSize: true,
1300                  variant: "tertiary",
1301                  onClick: () => {
1302                    onClose();
1303                    setTitle("");
1304                  },
1305                  children: (0, import_i18n3.__)("Cancel")
1306                }
1307              ),
1308              /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1309                import_components3.Button,
1310                {
1311                  __next40pxDefaultSize: true,
1312                  variant: "primary",
1313                  type: "submit",
1314                  "aria-disabled": !title || isSaving,
1315                  isBusy: isSaving,
1316                  children: confirmLabel
1317                }
1318              )
1319            ] })
1320          ] })
1321        }
1322      );
1323    }
1324  
1325    // packages/patterns/build-module/components/duplicate-pattern-modal.mjs
1326    var import_core_data4 = __toESM(require_core_data(), 1);
1327    var import_data6 = __toESM(require_data(), 1);
1328    var import_i18n4 = __toESM(require_i18n(), 1);
1329    var import_notices2 = __toESM(require_notices(), 1);
1330    var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
1331    function getTermLabels(pattern, categories) {
1332      if (pattern.type !== PATTERN_TYPES.user) {
1333        return categories.core?.filter(
1334          (category) => pattern.categories?.includes(category.name)
1335        ).map((category) => category.label);
1336      }
1337      return categories.user?.filter(
1338        (category) => pattern.wp_pattern_category?.includes(category.id)
1339      ).map((category) => category.label);
1340    }
1341    function useDuplicatePatternProps({ pattern, onSuccess }) {
1342      const { createSuccessNotice } = (0, import_data6.useDispatch)(import_notices2.store);
1343      const categories = (0, import_data6.useSelect)((select) => {
1344        const { getUserPatternCategories, getBlockPatternCategories } = select(import_core_data4.store);
1345        return {
1346          core: getBlockPatternCategories(),
1347          user: getUserPatternCategories()
1348        };
1349      });
1350      if (!pattern) {
1351        return null;
1352      }
1353      return {
1354        content: pattern.content,
1355        defaultCategories: getTermLabels(pattern, categories),
1356        defaultSyncType: pattern.type !== PATTERN_TYPES.user ? PATTERN_SYNC_TYPES.unsynced : pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full,
1357        defaultTitle: (0, import_i18n4.sprintf)(
1358          /* translators: %s: Existing pattern title */
1359          (0, import_i18n4._x)("%s (Copy)", "pattern"),
1360          typeof pattern.title === "string" ? pattern.title : pattern.title.raw
1361        ),
1362        onSuccess: ({ pattern: newPattern }) => {
1363          createSuccessNotice(
1364            (0, import_i18n4.sprintf)(
1365              // translators: %s: The new pattern's title e.g. 'Call to action (copy)'.
1366              (0, import_i18n4._x)('"%s" duplicated.', "pattern"),
1367              newPattern.title.raw
1368            ),
1369            {
1370              type: "snackbar",
1371              id: "patterns-create"
1372            }
1373          );
1374          onSuccess?.({ pattern: newPattern });
1375        }
1376      };
1377    }
1378    function DuplicatePatternModal({
1379      pattern,
1380      onClose,
1381      onSuccess
1382    }) {
1383      const duplicatedProps = useDuplicatePatternProps({ pattern, onSuccess });
1384      if (!pattern) {
1385        return null;
1386      }
1387      return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1388        CreatePatternModal,
1389        {
1390          modalTitle: (0, import_i18n4.__)("Duplicate pattern"),
1391          confirmLabel: (0, import_i18n4.__)("Duplicate"),
1392          onClose,
1393          onError: onClose,
1394          ...duplicatedProps
1395        }
1396      );
1397    }
1398  
1399    // packages/patterns/build-module/components/rename-pattern-modal.mjs
1400    var import_components4 = __toESM(require_components(), 1);
1401    var import_core_data5 = __toESM(require_core_data(), 1);
1402    var import_data7 = __toESM(require_data(), 1);
1403    var import_element7 = __toESM(require_element(), 1);
1404    var import_html_entities2 = __toESM(require_html_entities(), 1);
1405    var import_i18n5 = __toESM(require_i18n(), 1);
1406    var import_notices3 = __toESM(require_notices(), 1);
1407    var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
1408    function RenamePatternModal({
1409      onClose,
1410      onError,
1411      onSuccess,
1412      pattern,
1413      ...props
1414    }) {
1415      const originalName = (0, import_html_entities2.decodeEntities)(pattern.title);
1416      const [name, setName] = (0, import_element7.useState)(originalName);
1417      const [isSaving, setIsSaving] = (0, import_element7.useState)(false);
1418      const {
1419        editEntityRecord,
1420        __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
1421      } = (0, import_data7.useDispatch)(import_core_data5.store);
1422      const { createSuccessNotice, createErrorNotice } = (0, import_data7.useDispatch)(import_notices3.store);
1423      const onRename = async (event) => {
1424        event.preventDefault();
1425        if (!name || name === pattern.title || isSaving) {
1426          return;
1427        }
1428        try {
1429          await editEntityRecord("postType", pattern.type, pattern.id, {
1430            title: name
1431          });
1432          setIsSaving(true);
1433          setName("");
1434          onClose?.();
1435          const savedRecord = await saveSpecifiedEntityEdits(
1436            "postType",
1437            pattern.type,
1438            pattern.id,
1439            ["title"],
1440            { throwOnError: true }
1441          );
1442          onSuccess?.(savedRecord);
1443          createSuccessNotice((0, import_i18n5.__)("Pattern renamed"), {
1444            type: "snackbar",
1445            id: "pattern-update"
1446          });
1447        } catch (error) {
1448          onError?.();
1449          const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n5.__)("An error occurred while renaming the pattern.");
1450          createErrorNotice(errorMessage, {
1451            type: "snackbar",
1452            id: "pattern-update"
1453          });
1454        } finally {
1455          setIsSaving(false);
1456          setName("");
1457        }
1458      };
1459      const onRequestClose = () => {
1460        onClose?.();
1461        setName("");
1462      };
1463      return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1464        import_components4.Modal,
1465        {
1466          title: (0, import_i18n5.__)("Rename"),
1467          ...props,
1468          onRequestClose: onClose,
1469          focusOnMount: "firstContentElement",
1470          size: "small",
1471          children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Stack, { direction: "column", gap: "lg", children: [
1472            /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1473              import_components4.TextControl,
1474              {
1475                label: (0, import_i18n5.__)("Name"),
1476                value: name,
1477                onChange: setName,
1478                required: true
1479              }
1480            ),
1481            /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Stack, { gap: "sm", justify: "end", children: [
1482              /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1483                import_components4.Button,
1484                {
1485                  __next40pxDefaultSize: true,
1486                  variant: "tertiary",
1487                  onClick: onRequestClose,
1488                  children: (0, import_i18n5.__)("Cancel")
1489                }
1490              ),
1491              /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1492                import_components4.Button,
1493                {
1494                  __next40pxDefaultSize: true,
1495                  variant: "primary",
1496                  type: "submit",
1497                  children: (0, import_i18n5.__)("Save")
1498                }
1499              )
1500            ] })
1501          ] }) })
1502        }
1503      );
1504    }
1505  
1506    // packages/patterns/build-module/components/index.mjs
1507    var import_block_editor5 = __toESM(require_block_editor(), 1);
1508  
1509    // packages/patterns/build-module/components/pattern-convert-button.mjs
1510    var import_blocks2 = __toESM(require_blocks(), 1);
1511    var import_block_editor3 = __toESM(require_block_editor(), 1);
1512    var import_element8 = __toESM(require_element(), 1);
1513    var import_components5 = __toESM(require_components(), 1);
1514    var import_data8 = __toESM(require_data(), 1);
1515    var import_core_data6 = __toESM(require_core_data(), 1);
1516    var import_i18n6 = __toESM(require_i18n(), 1);
1517    var import_notices4 = __toESM(require_notices(), 1);
1518    var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
1519    function PatternConvertButton({
1520      clientIds,
1521      rootClientId,
1522      closeBlockSettingsMenu
1523    }) {
1524      const { createSuccessNotice } = (0, import_data8.useDispatch)(import_notices4.store);
1525      const { replaceBlocks, updateBlockAttributes } = (0, import_data8.useDispatch)(import_block_editor3.store);
1526      const { setEditingPattern: setEditingPattern2 } = unlock((0, import_data8.useDispatch)(store));
1527      const [isModalOpen, setIsModalOpen] = (0, import_element8.useState)(false);
1528      const { getBlockAttributes } = (0, import_data8.useSelect)(import_block_editor3.store);
1529      const canConvert = (0, import_data8.useSelect)(
1530        (select) => {
1531          const { canUser } = select(import_core_data6.store);
1532          const {
1533            getBlocksByClientId: getBlocksByClientId2,
1534            canInsertBlockType,
1535            getBlockRootClientId
1536          } = select(import_block_editor3.store);
1537          const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : void 0);
1538          const blocks = getBlocksByClientId2(clientIds) ?? [];
1539          const hasReusableBlockSupport = (blockName) => {
1540            const blockType = (0, import_blocks2.getBlockType)(blockName);
1541            const hasParent = blockType && "parent" in blockType;
1542            return (0, import_blocks2.hasBlockSupport)(blockName, "reusable", !hasParent);
1543          };
1544          const isSyncedPattern = blocks.length === 1 && blocks[0] && (0, import_blocks2.isReusableBlock)(blocks[0]) && !!select(import_core_data6.store).getEntityRecord(
1545            "postType",
1546            "wp_block",
1547            blocks[0].attributes.ref
1548          );
1549          const isUnsyncedPattern = blocks.length === 1 && blocks?.[0]?.attributes?.metadata?.patternName;
1550          const _canConvert = (
1551            // Hide when this is already a pattern.
1552            !isUnsyncedPattern && !isSyncedPattern && // Hide when patterns are disabled.
1553            canInsertBlockType("core/block", rootId) && blocks.every(
1554              (block) => (
1555                // Guard against the case where a regular block has *just* been converted.
1556                !!block && // Hide on invalid blocks.
1557                block.isValid && // Hide when block doesn't support being made into a pattern.
1558                hasReusableBlockSupport(block.name)
1559              )
1560            ) && // Hide when current doesn't have permission to do that.
1561            // Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
1562            !!canUser("create", {
1563              kind: "postType",
1564              name: "wp_block"
1565            })
1566          );
1567          return _canConvert;
1568        },
1569        [clientIds, rootClientId]
1570      );
1571      const { getBlocksByClientId } = (0, import_data8.useSelect)(import_block_editor3.store);
1572      const getContent = (0, import_element8.useCallback)(
1573        () => (0, import_blocks2.serialize)(getBlocksByClientId(clientIds)),
1574        [getBlocksByClientId, clientIds]
1575      );
1576      if (!canConvert) {
1577        return null;
1578      }
1579      const handleSuccess = ({ pattern }) => {
1580        if (pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced) {
1581          if (clientIds?.length === 1) {
1582            const existingAttributes = getBlockAttributes(clientIds[0]);
1583            updateBlockAttributes(clientIds[0], {
1584              metadata: {
1585                ...existingAttributes?.metadata ? existingAttributes.metadata : {},
1586                patternName: `core/block/$pattern.id}`,
1587                name: pattern.title.raw
1588              }
1589            });
1590          }
1591        } else {
1592          const newBlock = (0, import_blocks2.createBlock)("core/block", {
1593            ref: pattern.id
1594          });
1595          replaceBlocks(clientIds, newBlock);
1596          setEditingPattern2(newBlock.clientId, true);
1597        }
1598        createSuccessNotice(
1599          pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? (0, import_i18n6.sprintf)(
1600            // translators: %s: the name the user has given to the pattern.
1601            (0, import_i18n6.__)("Unsynced pattern created: %s"),
1602            pattern.title.raw
1603          ) : (0, import_i18n6.sprintf)(
1604            // translators: %s: the name the user has given to the pattern.
1605            (0, import_i18n6.__)("Synced pattern created: %s"),
1606            pattern.title.raw
1607          ),
1608          {
1609            type: "snackbar",
1610            id: "convert-to-pattern-success"
1611          }
1612        );
1613        setIsModalOpen(false);
1614        closeBlockSettingsMenu();
1615      };
1616      return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1617        /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1618          import_components5.MenuItem,
1619          {
1620            icon: symbol_default,
1621            onClick: () => setIsModalOpen(true),
1622            "aria-expanded": isModalOpen,
1623            "aria-haspopup": "dialog",
1624            children: (0, import_i18n6.__)("Create pattern")
1625          }
1626        ),
1627        isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1628          CreatePatternModal,
1629          {
1630            content: getContent,
1631            onSuccess: (pattern) => {
1632              handleSuccess(pattern);
1633            },
1634            onError: () => {
1635              setIsModalOpen(false);
1636            },
1637            onClose: () => {
1638              setIsModalOpen(false);
1639            }
1640          }
1641        )
1642      ] });
1643    }
1644  
1645    // packages/patterns/build-module/components/patterns-manage-button.mjs
1646    var import_components6 = __toESM(require_components(), 1);
1647    var import_i18n7 = __toESM(require_i18n(), 1);
1648    var import_blocks3 = __toESM(require_blocks(), 1);
1649    var import_data9 = __toESM(require_data(), 1);
1650    var import_element9 = __toESM(require_element(), 1);
1651    var import_block_editor4 = __toESM(require_block_editor(), 1);
1652    var import_url = __toESM(require_url(), 1);
1653    var import_core_data7 = __toESM(require_core_data(), 1);
1654    var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
1655    function PatternsManageButton({ clientId, onClose }) {
1656      const [showConfirmDialog, setShowConfirmDialog] = (0, import_element9.useState)(false);
1657      const {
1658        attributes,
1659        canDetach,
1660        isVisible,
1661        managePatternsUrl,
1662        isSyncedPattern,
1663        isUnsyncedPattern,
1664        canEdit
1665      } = (0, import_data9.useSelect)(
1666        (select) => {
1667          const { canRemoveBlock, getBlock, canEditBlock } = select(import_block_editor4.store);
1668          const { canUser } = select(import_core_data7.store);
1669          const block = getBlock(clientId);
1670          const _isUnsyncedPattern = !!block?.attributes?.metadata?.patternName;
1671          const _isSyncedPattern = !!block && (0, import_blocks3.isReusableBlock)(block) && !!canUser("update", {
1672            kind: "postType",
1673            name: "wp_block",
1674            id: block.attributes.ref
1675          });
1676          return {
1677            attributes: block.attributes,
1678            canEdit: canEditBlock(clientId),
1679            // For unsynced patterns, detaching is simply removing the `patternName` attribute.
1680            // For synced patterns, the `core:block` block is replaced with its inner blocks,
1681            // so checking whether `canRemoveBlock` is possible is required.
1682            canDetach: _isUnsyncedPattern || _isSyncedPattern && canRemoveBlock(clientId),
1683            isUnsyncedPattern: _isUnsyncedPattern,
1684            isSyncedPattern: _isSyncedPattern,
1685            isVisible: _isUnsyncedPattern || _isSyncedPattern,
1686            // The site editor and templates both check whether the user
1687            // has edit_theme_options capabilities. We can leverage that here
1688            // and omit the manage patterns link if the user can't access it.
1689            managePatternsUrl: canUser("create", {
1690              kind: "postType",
1691              name: "wp_template"
1692            }) ? (0, import_url.addQueryArgs)("site-editor.php", {
1693              p: "/pattern"
1694            }) : (0, import_url.addQueryArgs)("edit.php", {
1695              post_type: "wp_block"
1696            })
1697          };
1698        },
1699        [clientId]
1700      );
1701      const { updateBlockAttributes } = (0, import_data9.useDispatch)(import_block_editor4.store);
1702      const { convertSyncedPatternToStatic: convertSyncedPatternToStatic2 } = unlock(
1703        (0, import_data9.useDispatch)(store)
1704      );
1705      if (!isVisible || !canEdit) {
1706        return null;
1707      }
1708      const handleDetach = () => {
1709        if (isSyncedPattern) {
1710          convertSyncedPatternToStatic2(clientId);
1711        }
1712        if (isUnsyncedPattern) {
1713          const { patternName, ...attributesWithoutPatternName } = attributes?.metadata ?? {};
1714          updateBlockAttributes(clientId, {
1715            metadata: attributesWithoutPatternName
1716          });
1717        }
1718        onClose?.();
1719        setShowConfirmDialog(false);
1720      };
1721      return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1722        canDetach && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1723          /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components6.MenuItem, { onClick: () => setShowConfirmDialog(true), children: (0, import_i18n7.__)("Detach") }),
1724          /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1725            import_components6.__experimentalConfirmDialog,
1726            {
1727              isOpen: showConfirmDialog,
1728              onConfirm: handleDetach,
1729              onCancel: () => setShowConfirmDialog(false),
1730              confirmButtonText: (0, import_i18n7.__)("Detach"),
1731              size: "medium",
1732              title: (0, import_i18n7.__)("Detach pattern?"),
1733              __experimentalHideHeader: false,
1734              children: isSyncedPattern ? (0, import_i18n7.__)(
1735                "The blocks will be separated from the original pattern and will be fully editable. Future changes to the pattern will not apply here."
1736              ) : (0, import_i18n7.__)(
1737                "Blocks will no longer be associated with this pattern and will be fully editable."
1738              )
1739            }
1740          )
1741        ] }),
1742        /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components6.MenuItem, { href: managePatternsUrl, children: (0, import_i18n7.__)("Manage patterns") })
1743      ] });
1744    }
1745    var patterns_manage_button_default = PatternsManageButton;
1746  
1747    // packages/patterns/build-module/components/index.mjs
1748    var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
1749    function PatternsMenuItems({ rootClientId }) {
1750      return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_block_editor5.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1751        /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1752          PatternConvertButton,
1753          {
1754            clientIds: selectedClientIds,
1755            rootClientId,
1756            closeBlockSettingsMenu: onClose
1757          }
1758        ),
1759        selectedClientIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1760          patterns_manage_button_default,
1761          {
1762            clientId: selectedClientIds[0],
1763            onClose
1764          }
1765        )
1766      ] }) });
1767    }
1768  
1769    // packages/patterns/build-module/components/rename-pattern-category-modal.mjs
1770    var import_components7 = __toESM(require_components(), 1);
1771    var import_core_data8 = __toESM(require_core_data(), 1);
1772    var import_data10 = __toESM(require_data(), 1);
1773    var import_element10 = __toESM(require_element(), 1);
1774    var import_html_entities3 = __toESM(require_html_entities(), 1);
1775    var import_i18n8 = __toESM(require_i18n(), 1);
1776    var import_notices5 = __toESM(require_notices(), 1);
1777    var import_a11y = __toESM(require_a11y(), 1);
1778    var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
1779    function RenamePatternCategoryModal({
1780      category,
1781      existingCategories,
1782      onClose,
1783      onError,
1784      onSuccess,
1785      ...props
1786    }) {
1787      const id = (0, import_element10.useId)();
1788      const textControlRef = (0, import_element10.useRef)();
1789      const [name, setName] = (0, import_element10.useState)((0, import_html_entities3.decodeEntities)(category.name));
1790      const [isSaving, setIsSaving] = (0, import_element10.useState)(false);
1791      const [validationMessage, setValidationMessage] = (0, import_element10.useState)(false);
1792      const validationMessageId = validationMessage ? `patterns-rename-pattern-category-modal__validation-message-$id}` : void 0;
1793      const { saveEntityRecord, invalidateResolution } = (0, import_data10.useDispatch)(import_core_data8.store);
1794      const { createErrorNotice, createSuccessNotice } = (0, import_data10.useDispatch)(import_notices5.store);
1795      const onChange = (newName) => {
1796        if (validationMessage) {
1797          setValidationMessage(void 0);
1798        }
1799        setName(newName);
1800      };
1801      const onSave = async (event) => {
1802        event.preventDefault();
1803        if (isSaving) {
1804          return;
1805        }
1806        if (!name || name === category.name) {
1807          const message = (0, import_i18n8.__)("Please enter a new name for this category.");
1808          (0, import_a11y.speak)(message, "assertive");
1809          setValidationMessage(message);
1810          textControlRef.current?.focus();
1811          return;
1812        }
1813        if (existingCategories.patternCategories.find((existingCategory) => {
1814          return existingCategory.id !== category.id && existingCategory.label.toLowerCase() === name.toLowerCase();
1815        })) {
1816          const message = (0, import_i18n8.__)(
1817            "This category already exists. Please use a different name."
1818          );
1819          (0, import_a11y.speak)(message, "assertive");
1820          setValidationMessage(message);
1821          textControlRef.current?.focus();
1822          return;
1823        }
1824        try {
1825          setIsSaving(true);
1826          const savedRecord = await saveEntityRecord(
1827            "taxonomy",
1828            CATEGORY_SLUG,
1829            {
1830              id: category.id,
1831              slug: category.slug,
1832              name
1833            }
1834          );
1835          invalidateResolution("getUserPatternCategories");
1836          onSuccess?.(savedRecord);
1837          onClose();
1838          createSuccessNotice((0, import_i18n8.__)("Pattern category renamed."), {
1839            type: "snackbar",
1840            id: "pattern-category-update"
1841          });
1842        } catch (error) {
1843          onError?.();
1844          createErrorNotice(error.message, {
1845            type: "snackbar",
1846            id: "pattern-category-update"
1847          });
1848        } finally {
1849          setIsSaving(false);
1850          setName("");
1851        }
1852      };
1853      const onRequestClose = () => {
1854        onClose();
1855        setName("");
1856      };
1857      return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1858        import_components7.Modal,
1859        {
1860          title: (0, import_i18n8.__)("Rename"),
1861          onRequestClose,
1862          ...props,
1863          children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("form", { onSubmit: onSave, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { direction: "column", gap: "lg", children: [
1864            /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { direction: "column", gap: "sm", children: [
1865              /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1866                import_components7.TextControl,
1867                {
1868                  ref: textControlRef,
1869                  label: (0, import_i18n8.__)("Name"),
1870                  value: name,
1871                  onChange,
1872                  "aria-describedby": validationMessageId,
1873                  required: true
1874                }
1875              ),
1876              validationMessage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1877                "span",
1878                {
1879                  className: "patterns-rename-pattern-category-modal__validation-message",
1880                  id: validationMessageId,
1881                  children: validationMessage
1882                }
1883              )
1884            ] }),
1885            /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { gap: "sm", justify: "end", children: [
1886              /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1887                import_components7.Button,
1888                {
1889                  __next40pxDefaultSize: true,
1890                  variant: "tertiary",
1891                  onClick: onRequestClose,
1892                  children: (0, import_i18n8.__)("Cancel")
1893                }
1894              ),
1895              /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1896                import_components7.Button,
1897                {
1898                  __next40pxDefaultSize: true,
1899                  variant: "primary",
1900                  type: "submit",
1901                  "aria-disabled": !name || name === category.name || isSaving,
1902                  isBusy: isSaving,
1903                  children: (0, import_i18n8.__)("Save")
1904                }
1905              )
1906            ] })
1907          ] }) })
1908        }
1909      );
1910    }
1911  
1912    // packages/patterns/build-module/components/pattern-overrides-controls.mjs
1913    var import_element12 = __toESM(require_element(), 1);
1914    var import_block_editor6 = __toESM(require_block_editor(), 1);
1915    var import_components9 = __toESM(require_components(), 1);
1916    var import_i18n10 = __toESM(require_i18n(), 1);
1917  
1918    // packages/patterns/build-module/components/allow-overrides-modal.mjs
1919    var import_components8 = __toESM(require_components(), 1);
1920    var import_i18n9 = __toESM(require_i18n(), 1);
1921    var import_element11 = __toESM(require_element(), 1);
1922    var import_a11y2 = __toESM(require_a11y(), 1);
1923    var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
1924    function AllowOverridesModal({
1925      placeholder,
1926      initialName = "",
1927      onClose,
1928      onSave
1929    }) {
1930      const [editedBlockName, setEditedBlockName] = (0, import_element11.useState)(initialName);
1931      const descriptionId = (0, import_element11.useId)();
1932      const isNameValid = !!editedBlockName.trim();
1933      const handleSubmit = () => {
1934        if (editedBlockName !== initialName) {
1935          const message = (0, import_i18n9.sprintf)(
1936            /* translators: %s: new name/label for the block */
1937            (0, import_i18n9.__)('Block name changed to: "%s".'),
1938            editedBlockName
1939          );
1940          (0, import_a11y2.speak)(message, "assertive");
1941        }
1942        onSave(editedBlockName);
1943        onClose();
1944      };
1945      return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1946        import_components8.Modal,
1947        {
1948          title: (0, import_i18n9.__)("Enable overrides"),
1949          onRequestClose: onClose,
1950          focusOnMount: "firstContentElement",
1951          aria: { describedby: descriptionId },
1952          size: "small",
1953          children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1954            "form",
1955            {
1956              onSubmit: (event) => {
1957                event.preventDefault();
1958                if (!isNameValid) {
1959                  return;
1960                }
1961                handleSubmit();
1962              },
1963              children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { direction: "column", gap: "xl", children: [
1964                /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { id: descriptionId, children: (0, import_i18n9.__)(
1965                  "Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override."
1966                ) }),
1967                /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1968                  import_components8.TextControl,
1969                  {
1970                    value: editedBlockName,
1971                    label: (0, import_i18n9.__)("Name"),
1972                    help: (0, import_i18n9.__)(
1973                      'For example, if you are creating a recipe pattern, you use "Recipe Title", "Recipe Description", etc.'
1974                    ),
1975                    placeholder,
1976                    onChange: setEditedBlockName
1977                  }
1978                ),
1979                /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { gap: "sm", justify: "end", children: [
1980                  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1981                    import_components8.Button,
1982                    {
1983                      __next40pxDefaultSize: true,
1984                      variant: "tertiary",
1985                      onClick: onClose,
1986                      children: (0, import_i18n9.__)("Cancel")
1987                    }
1988                  ),
1989                  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1990                    import_components8.Button,
1991                    {
1992                      __next40pxDefaultSize: true,
1993                      "aria-disabled": !isNameValid,
1994                      variant: "primary",
1995                      type: "submit",
1996                      children: (0, import_i18n9.__)("Enable")
1997                    }
1998                  )
1999                ] })
2000              ] })
2001            }
2002          )
2003        }
2004      );
2005    }
2006    function DisallowOverridesModal({ onClose, onSave }) {
2007      const descriptionId = (0, import_element11.useId)();
2008      return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2009        import_components8.Modal,
2010        {
2011          title: (0, import_i18n9.__)("Disable overrides"),
2012          onRequestClose: onClose,
2013          aria: { describedby: descriptionId },
2014          size: "small",
2015          children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2016            "form",
2017            {
2018              onSubmit: (event) => {
2019                event.preventDefault();
2020                onSave();
2021                onClose();
2022              },
2023              children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { direction: "column", gap: "xl", children: [
2024                /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { id: descriptionId, children: (0, import_i18n9.__)(
2025                  "Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern."
2026                ) }),
2027                /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Stack, { gap: "sm", justify: "end", children: [
2028                  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2029                    import_components8.Button,
2030                    {
2031                      __next40pxDefaultSize: true,
2032                      variant: "tertiary",
2033                      onClick: onClose,
2034                      children: (0, import_i18n9.__)("Cancel")
2035                    }
2036                  ),
2037                  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2038                    import_components8.Button,
2039                    {
2040                      __next40pxDefaultSize: true,
2041                      variant: "primary",
2042                      type: "submit",
2043                      children: (0, import_i18n9.__)("Disable")
2044                    }
2045                  )
2046                ] })
2047              ] })
2048            }
2049          )
2050        }
2051      );
2052    }
2053  
2054    // packages/patterns/build-module/components/pattern-overrides-controls.mjs
2055    var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
2056    function PatternOverridesControls({
2057      attributes,
2058      setAttributes,
2059      name: blockName
2060    }) {
2061      const controlId = (0, import_element12.useId)();
2062      const [showAllowOverridesModal, setShowAllowOverridesModal] = (0, import_element12.useState)(false);
2063      const [showDisallowOverridesModal, setShowDisallowOverridesModal] = (0, import_element12.useState)(false);
2064      const hasName = !!attributes.metadata?.name;
2065      const defaultBindings = attributes.metadata?.bindings?.__default;
2066      const hasOverrides = hasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE;
2067      const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE;
2068      const { updateBlockBindings } = (0, import_block_editor6.useBlockBindingsUtils)();
2069      function updateBindings(isChecked, customName) {
2070        if (customName) {
2071          setAttributes({
2072            metadata: {
2073              ...attributes.metadata,
2074              name: customName
2075            }
2076          });
2077        }
2078        updateBlockBindings({
2079          __default: isChecked ? { source: PATTERN_OVERRIDES_BINDING_SOURCE } : void 0
2080        });
2081      }
2082      if (isConnectedToOtherSources) {
2083        return null;
2084      }
2085      const hasUnsupportedImageAttributes = blockName === "core/image" && !!attributes.href?.length;
2086      const helpText = !hasOverrides && hasUnsupportedImageAttributes ? (0, import_i18n10.__)(
2087        `Overrides currently don't support image links. Remove the link first before enabling overrides.`
2088      ) : (0, import_i18n10.__)(
2089        "Allow changes to this block throughout instances of this pattern."
2090      );
2091      return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2092        /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_block_editor6.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2093          import_components9.BaseControl,
2094          {
2095            id: controlId,
2096            label: (0, import_i18n10.__)("Overrides"),
2097            help: helpText,
2098            children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2099              import_components9.Button,
2100              {
2101                __next40pxDefaultSize: true,
2102                className: "pattern-overrides-control__allow-overrides-button",
2103                variant: "secondary",
2104                "aria-haspopup": "dialog",
2105                onClick: () => {
2106                  if (hasOverrides) {
2107                    setShowDisallowOverridesModal(true);
2108                  } else {
2109                    setShowAllowOverridesModal(true);
2110                  }
2111                },
2112                disabled: !hasOverrides && hasUnsupportedImageAttributes,
2113                accessibleWhenDisabled: true,
2114                children: hasOverrides ? (0, import_i18n10.__)("Disable overrides") : (0, import_i18n10.__)("Enable overrides")
2115              }
2116            )
2117          }
2118        ) }),
2119        showAllowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2120          AllowOverridesModal,
2121          {
2122            initialName: attributes.metadata?.name,
2123            onClose: () => setShowAllowOverridesModal(false),
2124            onSave: (newName) => {
2125              updateBindings(true, newName);
2126            }
2127          }
2128        ),
2129        showDisallowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2130          DisallowOverridesModal,
2131          {
2132            onClose: () => setShowDisallowOverridesModal(false),
2133            onSave: () => updateBindings(false)
2134          }
2135        )
2136      ] });
2137    }
2138    var pattern_overrides_controls_default = PatternOverridesControls;
2139  
2140    // packages/patterns/build-module/components/reset-overrides-control.mjs
2141    var import_block_editor7 = __toESM(require_block_editor(), 1);
2142    var import_components10 = __toESM(require_components(), 1);
2143    var import_data11 = __toESM(require_data(), 1);
2144    var import_i18n11 = __toESM(require_i18n(), 1);
2145    var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
2146    var CONTENT = "content";
2147    function ResetOverridesControl(props) {
2148      const name = props.attributes.metadata?.name;
2149      const registry = (0, import_data11.useRegistry)();
2150      const isOverridden = (0, import_data11.useSelect)(
2151        (select) => {
2152          if (!name) {
2153            return;
2154          }
2155          const { getBlockAttributes, getBlockParentsByBlockName } = select(import_block_editor7.store);
2156          const [patternClientId] = getBlockParentsByBlockName(
2157            props.clientId,
2158            "core/block",
2159            true
2160          );
2161          if (!patternClientId) {
2162            return;
2163          }
2164          const overrides = getBlockAttributes(patternClientId)[CONTENT];
2165          if (!overrides) {
2166            return;
2167          }
2168          return overrides.hasOwnProperty(name);
2169        },
2170        [props.clientId, name]
2171      );
2172      function onClick() {
2173        const { getBlockAttributes, getBlockParentsByBlockName } = registry.select(import_block_editor7.store);
2174        const [patternClientId] = getBlockParentsByBlockName(
2175          props.clientId,
2176          "core/block",
2177          true
2178        );
2179        if (!patternClientId) {
2180          return;
2181        }
2182        const overrides = getBlockAttributes(patternClientId)[CONTENT];
2183        if (!overrides.hasOwnProperty(name)) {
2184          return;
2185        }
2186        const { updateBlockAttributes, __unstableMarkLastChangeAsPersistent } = registry.dispatch(import_block_editor7.store);
2187        __unstableMarkLastChangeAsPersistent();
2188        let newOverrides = { ...overrides };
2189        delete newOverrides[name];
2190        if (!Object.keys(newOverrides).length) {
2191          newOverrides = void 0;
2192        }
2193        updateBlockAttributes(patternClientId, {
2194          [CONTENT]: newOverrides
2195        });
2196      }
2197      return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_block_editor7.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components10.ToolbarButton, { onClick, disabled: !isOverridden, children: (0, import_i18n11.__)("Reset") }) }) });
2198    }
2199  
2200    // packages/patterns/build-module/private-apis.mjs
2201    var privateApis = {};
2202    lock(privateApis, {
2203      OverridesPanel,
2204      CreatePatternModal,
2205      CreatePatternModalContents,
2206      DuplicatePatternModal,
2207      isOverridableBlock,
2208      useDuplicatePatternProps,
2209      RenamePatternModal,
2210      PatternsMenuItems,
2211      RenamePatternCategoryModal,
2212      PatternOverridesControls: pattern_overrides_controls_default,
2213      ResetOverridesControl,
2214      useAddPatternCategory,
2215      PATTERN_TYPES,
2216      PATTERN_DEFAULT_CATEGORY,
2217      PATTERN_USER_CATEGORY,
2218      EXCLUDED_PATTERN_SOURCES,
2219      PATTERN_SYNC_TYPES
2220    });
2221    return __toCommonJS(index_exports);
2222  })();
2223  (window.wp ||= {}).patterns = wp.patterns;
2224  })();


Generated : Sun Aug 16 08:20:24 2026 Cross-referenced by PHPXref