[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> format-library.js (source)

   1  /******/ (() => { // webpackBootstrap
   2  /******/     "use strict";
   3  var __webpack_exports__ = {};
   4  
   5  ;// external ["wp","richText"]
   6  const external_wp_richText_namespaceObject = window["wp"]["richText"];
   7  ;// external ["wp","i18n"]
   8  const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
   9  ;// external ["wp","blockEditor"]
  10  const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  11  ;// external ["wp","primitives"]
  12  const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  13  ;// external "ReactJSXRuntime"
  14  const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
  15  ;// ./node_modules/@wordpress/icons/build-module/library/format-bold.js
  16  /**
  17   * WordPress dependencies
  18   */
  19  
  20  
  21  const formatBold = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
  22    xmlns: "http://www.w3.org/2000/svg",
  23    viewBox: "0 0 24 24",
  24    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
  25      d: "M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"
  26    })
  27  });
  28  /* harmony default export */ const format_bold = (formatBold);
  29  
  30  ;// ./node_modules/@wordpress/format-library/build-module/bold/index.js
  31  /**
  32   * WordPress dependencies
  33   */
  34  
  35  
  36  
  37  
  38  
  39  const bold_name = 'core/bold';
  40  const title = (0,external_wp_i18n_namespaceObject.__)('Bold');
  41  const bold = {
  42    name: bold_name,
  43    title,
  44    tagName: 'strong',
  45    className: null,
  46    edit({
  47      isActive,
  48      value,
  49      onChange,
  50      onFocus
  51    }) {
  52      function onToggle() {
  53        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  54          type: bold_name,
  55          title
  56        }));
  57      }
  58      function onClick() {
  59        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  60          type: bold_name
  61        }));
  62        onFocus();
  63      }
  64      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
  65        children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  66          type: "primary",
  67          character: "b",
  68          onUse: onToggle
  69        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  70          name: "bold",
  71          icon: format_bold,
  72          title: title,
  73          onClick: onClick,
  74          isActive: isActive,
  75          shortcutType: "primary",
  76          shortcutCharacter: "b"
  77        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
  78          inputType: "formatBold",
  79          onInput: onToggle
  80        })]
  81      });
  82    }
  83  };
  84  
  85  ;// ./node_modules/@wordpress/icons/build-module/library/code.js
  86  /**
  87   * WordPress dependencies
  88   */
  89  
  90  
  91  const code = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
  92    viewBox: "0 0 24 24",
  93    xmlns: "http://www.w3.org/2000/svg",
  94    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
  95      d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"
  96    })
  97  });
  98  /* harmony default export */ const library_code = (code);
  99  
 100  ;// ./node_modules/@wordpress/format-library/build-module/code/index.js
 101  /**
 102   * WordPress dependencies
 103   */
 104  
 105  
 106  
 107  
 108  
 109  const code_name = 'core/code';
 110  const code_title = (0,external_wp_i18n_namespaceObject.__)('Inline code');
 111  const code_code = {
 112    name: code_name,
 113    title: code_title,
 114    tagName: 'code',
 115    className: null,
 116    __unstableInputRule(value) {
 117      const BACKTICK = '`';
 118      const {
 119        start,
 120        text
 121      } = value;
 122      const characterBefore = text[start - 1];
 123  
 124      // Quick check the text for the necessary character.
 125      if (characterBefore !== BACKTICK) {
 126        return value;
 127      }
 128      if (start - 2 < 0) {
 129        return value;
 130      }
 131      const indexBefore = text.lastIndexOf(BACKTICK, start - 2);
 132      if (indexBefore === -1) {
 133        return value;
 134      }
 135      const startIndex = indexBefore;
 136      const endIndex = start - 2;
 137      if (startIndex === endIndex) {
 138        return value;
 139      }
 140      value = (0,external_wp_richText_namespaceObject.remove)(value, startIndex, startIndex + 1);
 141      value = (0,external_wp_richText_namespaceObject.remove)(value, endIndex, endIndex + 1);
 142      value = (0,external_wp_richText_namespaceObject.applyFormat)(value, {
 143        type: code_name
 144      }, startIndex, endIndex);
 145      return value;
 146    },
 147    edit({
 148      value,
 149      onChange,
 150      onFocus,
 151      isActive
 152    }) {
 153      function onClick() {
 154        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
 155          type: code_name,
 156          title: code_title
 157        }));
 158        onFocus();
 159      }
 160      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
 161        children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
 162          type: "access",
 163          character: "x",
 164          onUse: onClick
 165        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
 166          icon: library_code,
 167          title: code_title,
 168          onClick: onClick,
 169          isActive: isActive,
 170          role: "menuitemcheckbox"
 171        })]
 172      });
 173    }
 174  };
 175  
 176  ;// external ["wp","components"]
 177  const external_wp_components_namespaceObject = window["wp"]["components"];
 178  ;// external ["wp","element"]
 179  const external_wp_element_namespaceObject = window["wp"]["element"];
 180  ;// ./node_modules/@wordpress/format-library/build-module/image/index.js
 181  /**
 182   * WordPress dependencies
 183   */
 184  
 185  
 186  
 187  
 188  
 189  
 190  const ALLOWED_MEDIA_TYPES = ['image'];
 191  const image_name = 'core/image';
 192  const image_title = (0,external_wp_i18n_namespaceObject.__)('Inline image');
 193  const image_image = {
 194    name: image_name,
 195    title: image_title,
 196    keywords: [(0,external_wp_i18n_namespaceObject.__)('photo'), (0,external_wp_i18n_namespaceObject.__)('media')],
 197    object: true,
 198    tagName: 'img',
 199    className: null,
 200    attributes: {
 201      className: 'class',
 202      style: 'style',
 203      url: 'src',
 204      alt: 'alt'
 205    },
 206    edit: Edit
 207  };
 208  function InlineUI({
 209    value,
 210    onChange,
 211    activeObjectAttributes,
 212    contentRef
 213  }) {
 214    const {
 215      style,
 216      alt
 217    } = activeObjectAttributes;
 218    const width = style?.replace(/\D/g, '');
 219    const [editedWidth, setEditedWidth] = (0,external_wp_element_namespaceObject.useState)(width);
 220    const [editedAlt, setEditedAlt] = (0,external_wp_element_namespaceObject.useState)(alt);
 221    const hasChanged = editedWidth !== width || editedAlt !== alt;
 222    const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
 223      editableContentElement: contentRef.current,
 224      settings: image_image
 225    });
 226    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, {
 227      placement: "bottom",
 228      focusOnMount: false,
 229      anchor: popoverAnchor,
 230      className: "block-editor-format-toolbar__image-popover",
 231      children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", {
 232        className: "block-editor-format-toolbar__image-container-content",
 233        onSubmit: event => {
 234          const newReplacements = value.replacements.slice();
 235          newReplacements[value.start] = {
 236            type: image_name,
 237            attributes: {
 238              ...activeObjectAttributes,
 239              style: width ? `width: $editedWidth}px;` : '',
 240              alt: editedAlt
 241            }
 242          };
 243          onChange({
 244            ...value,
 245            replacements: newReplacements
 246          });
 247          event.preventDefault();
 248        },
 249        children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
 250          spacing: 4,
 251          children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, {
 252            __next40pxDefaultSize: true,
 253            label: (0,external_wp_i18n_namespaceObject.__)('Width'),
 254            value: editedWidth,
 255            min: 1,
 256            onChange: newWidth => {
 257              setEditedWidth(newWidth);
 258            }
 259          }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, {
 260            label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'),
 261            __nextHasNoMarginBottom: true,
 262            value: editedAlt,
 263            onChange: newAlt => {
 264              setEditedAlt(newAlt);
 265            },
 266            help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
 267              children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, {
 268                href:
 269                // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
 270                (0,external_wp_i18n_namespaceObject.__)('https://www.w3.org/WAI/tutorials/images/decision-tree/'),
 271                children: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.')
 272              }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.')]
 273            })
 274          }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
 275            justify: "right",
 276            children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
 277              disabled: !hasChanged,
 278              accessibleWhenDisabled: true,
 279              variant: "primary",
 280              type: "submit",
 281              size: "compact",
 282              children: (0,external_wp_i18n_namespaceObject.__)('Apply')
 283            })
 284          })]
 285        })
 286      })
 287    });
 288  }
 289  function Edit({
 290    value,
 291    onChange,
 292    onFocus,
 293    isObjectActive,
 294    activeObjectAttributes,
 295    contentRef
 296  }) {
 297    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, {
 298      children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUpload, {
 299        allowedTypes: ALLOWED_MEDIA_TYPES,
 300        onSelect: ({
 301          id,
 302          url,
 303          alt,
 304          width: imgWidth
 305        }) => {
 306          onChange((0,external_wp_richText_namespaceObject.insertObject)(value, {
 307            type: image_name,
 308            attributes: {
 309              className: `wp-image-$id}`,
 310              style: `width: $Math.min(imgWidth, 150)}px;`,
 311              url,
 312              alt
 313            }
 314          }));
 315          onFocus();
 316        },
 317        render: ({
 318          open
 319        }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
 320          icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, {
 321            xmlns: "http://www.w3.org/2000/svg",
 322            viewBox: "0 0 24 24",
 323            children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, {
 324              d: "M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z"
 325            })
 326          }),
 327          title: image_title,
 328          onClick: open,
 329          isActive: isObjectActive
 330        })
 331      }), isObjectActive && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineUI, {
 332        value: value,
 333        onChange: onChange,
 334        activeObjectAttributes: activeObjectAttributes,
 335        contentRef: contentRef
 336      })]
 337    });
 338  }
 339  
 340  ;// ./node_modules/@wordpress/icons/build-module/library/format-italic.js
 341  /**
 342   * WordPress dependencies
 343   */
 344  
 345  
 346  const formatItalic = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
 347    xmlns: "http://www.w3.org/2000/svg",
 348    viewBox: "0 0 24 24",
 349    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
 350      d: "M12.5 5L10 19h1.9l2.5-14z"
 351    })
 352  });
 353  /* harmony default export */ const format_italic = (formatItalic);
 354  
 355  ;// ./node_modules/@wordpress/format-library/build-module/italic/index.js
 356  /**
 357   * WordPress dependencies
 358   */
 359  
 360  
 361  
 362  
 363  
 364  const italic_name = 'core/italic';
 365  const italic_title = (0,external_wp_i18n_namespaceObject.__)('Italic');
 366  const italic = {
 367    name: italic_name,
 368    title: italic_title,
 369    tagName: 'em',
 370    className: null,
 371    edit({
 372      isActive,
 373      value,
 374      onChange,
 375      onFocus
 376    }) {
 377      function onToggle() {
 378        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
 379          type: italic_name,
 380          title: italic_title
 381        }));
 382      }
 383      function onClick() {
 384        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
 385          type: italic_name
 386        }));
 387        onFocus();
 388      }
 389      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
 390        children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
 391          type: "primary",
 392          character: "i",
 393          onUse: onToggle
 394        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
 395          name: "italic",
 396          icon: format_italic,
 397          title: italic_title,
 398          onClick: onClick,
 399          isActive: isActive,
 400          shortcutType: "primary",
 401          shortcutCharacter: "i"
 402        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
 403          inputType: "formatItalic",
 404          onInput: onToggle
 405        })]
 406      });
 407    }
 408  };
 409  
 410  ;// external ["wp","url"]
 411  const external_wp_url_namespaceObject = window["wp"]["url"];
 412  ;// external ["wp","htmlEntities"]
 413  const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
 414  ;// ./node_modules/@wordpress/icons/build-module/library/link.js
 415  /**
 416   * WordPress dependencies
 417   */
 418  
 419  
 420  const link_link = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
 421    xmlns: "http://www.w3.org/2000/svg",
 422    viewBox: "0 0 24 24",
 423    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
 424      d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"
 425    })
 426  });
 427  /* harmony default export */ const library_link = (link_link);
 428  
 429  ;// external ["wp","a11y"]
 430  const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
 431  ;// external ["wp","data"]
 432  const external_wp_data_namespaceObject = window["wp"]["data"];
 433  ;// ./node_modules/@wordpress/format-library/build-module/link/utils.js
 434  /**
 435   * WordPress dependencies
 436   */
 437  
 438  
 439  /**
 440   * Check for issues with the provided href.
 441   *
 442   * @param {string} href The href.
 443   *
 444   * @return {boolean} Is the href invalid?
 445   */
 446  function isValidHref(href) {
 447    if (!href) {
 448      return false;
 449    }
 450    const trimmedHref = href.trim();
 451    if (!trimmedHref) {
 452      return false;
 453    }
 454  
 455    // Does the href start with something that looks like a URL protocol?
 456    if (/^\S+:/.test(trimmedHref)) {
 457      const protocol = (0,external_wp_url_namespaceObject.getProtocol)(trimmedHref);
 458      if (!(0,external_wp_url_namespaceObject.isValidProtocol)(protocol)) {
 459        return false;
 460      }
 461  
 462      // Add some extra checks for http(s) URIs, since these are the most common use-case.
 463      // This ensures URIs with an http protocol have exactly two forward slashes following the protocol.
 464      if (protocol.startsWith('http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
 465        return false;
 466      }
 467      const authority = (0,external_wp_url_namespaceObject.getAuthority)(trimmedHref);
 468      if (!(0,external_wp_url_namespaceObject.isValidAuthority)(authority)) {
 469        return false;
 470      }
 471      const path = (0,external_wp_url_namespaceObject.getPath)(trimmedHref);
 472      if (path && !(0,external_wp_url_namespaceObject.isValidPath)(path)) {
 473        return false;
 474      }
 475      const queryString = (0,external_wp_url_namespaceObject.getQueryString)(trimmedHref);
 476      if (queryString && !(0,external_wp_url_namespaceObject.isValidQueryString)(queryString)) {
 477        return false;
 478      }
 479      const fragment = (0,external_wp_url_namespaceObject.getFragment)(trimmedHref);
 480      if (fragment && !(0,external_wp_url_namespaceObject.isValidFragment)(fragment)) {
 481        return false;
 482      }
 483    }
 484  
 485    // Validate anchor links.
 486    if (trimmedHref.startsWith('#') && !(0,external_wp_url_namespaceObject.isValidFragment)(trimmedHref)) {
 487      return false;
 488    }
 489    return true;
 490  }
 491  
 492  /**
 493   * Generates the format object that will be applied to the link text.
 494   *
 495   * @param {Object}  options
 496   * @param {string}  options.url              The href of the link.
 497   * @param {string}  options.type             The type of the link.
 498   * @param {string}  options.id               The ID of the link.
 499   * @param {boolean} options.opensInNewWindow Whether this link will open in a new window.
 500   * @param {boolean} options.nofollow         Whether this link is marked as no follow relationship.
 501   * @return {Object} The final format object.
 502   */
 503  function createLinkFormat({
 504    url,
 505    type,
 506    id,
 507    opensInNewWindow,
 508    nofollow
 509  }) {
 510    const format = {
 511      type: 'core/link',
 512      attributes: {
 513        url
 514      }
 515    };
 516    if (type) {
 517      format.attributes.type = type;
 518    }
 519    if (id) {
 520      format.attributes.id = id;
 521    }
 522    if (opensInNewWindow) {
 523      format.attributes.target = '_blank';
 524      format.attributes.rel = format.attributes.rel ? format.attributes.rel + ' noreferrer noopener' : 'noreferrer noopener';
 525    }
 526    if (nofollow) {
 527      format.attributes.rel = format.attributes.rel ? format.attributes.rel + ' nofollow' : 'nofollow';
 528    }
 529    return format;
 530  }
 531  
 532  /* eslint-disable jsdoc/no-undefined-types */
 533  /**
 534   * Get the start and end boundaries of a given format from a rich text value.
 535   *
 536   *
 537   * @param {RichTextValue} value      the rich text value to interrogate.
 538   * @param {string}        format     the identifier for the target format (e.g. `core/link`, `core/bold`).
 539   * @param {number?}       startIndex optional startIndex to seek from.
 540   * @param {number?}       endIndex   optional endIndex to seek from.
 541   * @return {Object}    object containing start and end values for the given format.
 542   */
 543  /* eslint-enable jsdoc/no-undefined-types */
 544  function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) {
 545    const EMPTY_BOUNDARIES = {
 546      start: null,
 547      end: null
 548    };
 549    const {
 550      formats
 551    } = value;
 552    let targetFormat;
 553    let initialIndex;
 554    if (!formats?.length) {
 555      return EMPTY_BOUNDARIES;
 556    }
 557  
 558    // Clone formats to avoid modifying source formats.
 559    const newFormats = formats.slice();
 560    const formatAtStart = newFormats[startIndex]?.find(({
 561      type
 562    }) => type === format.type);
 563    const formatAtEnd = newFormats[endIndex]?.find(({
 564      type
 565    }) => type === format.type);
 566    const formatAtEndMinusOne = newFormats[endIndex - 1]?.find(({
 567      type
 568    }) => type === format.type);
 569    if (!!formatAtStart) {
 570      // Set values to conform to "start"
 571      targetFormat = formatAtStart;
 572      initialIndex = startIndex;
 573    } else if (!!formatAtEnd) {
 574      // Set values to conform to "end"
 575      targetFormat = formatAtEnd;
 576      initialIndex = endIndex;
 577    } else if (!!formatAtEndMinusOne) {
 578      // This is an edge case which will occur if you create a format, then place
 579      // the caret just before the format and hit the back ARROW key. The resulting
 580      // value object will have start and end +1 beyond the edge of the format boundary.
 581      targetFormat = formatAtEndMinusOne;
 582      initialIndex = endIndex - 1;
 583    } else {
 584      return EMPTY_BOUNDARIES;
 585    }
 586    const index = newFormats[initialIndex].indexOf(targetFormat);
 587    const walkingArgs = [newFormats, initialIndex, targetFormat, index];
 588  
 589    // Walk the startIndex "backwards" to the leading "edge" of the matching format.
 590    startIndex = walkToStart(...walkingArgs);
 591  
 592    // Walk the endIndex "forwards" until the trailing "edge" of the matching format.
 593    endIndex = walkToEnd(...walkingArgs);
 594  
 595    // Safe guard: start index cannot be less than 0.
 596    startIndex = startIndex < 0 ? 0 : startIndex;
 597  
 598    // // Return the indices of the "edges" as the boundaries.
 599    return {
 600      start: startIndex,
 601      end: endIndex
 602    };
 603  }
 604  
 605  /**
 606   * Walks forwards/backwards towards the boundary of a given format within an
 607   * array of format objects. Returns the index of the boundary.
 608   *
 609   * @param {Array}  formats         the formats to search for the given format type.
 610   * @param {number} initialIndex    the starting index from which to walk.
 611   * @param {Object} targetFormatRef a reference to the format type object being sought.
 612   * @param {number} formatIndex     the index at which we expect the target format object to be.
 613   * @param {string} direction       either 'forwards' or 'backwards' to indicate the direction.
 614   * @return {number} the index of the boundary of the given format.
 615   */
 616  function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) {
 617    let index = initialIndex;
 618    const directions = {
 619      forwards: 1,
 620      backwards: -1
 621    };
 622    const directionIncrement = directions[direction] || 1; // invalid direction arg default to forwards
 623    const inverseDirectionIncrement = directionIncrement * -1;
 624    while (formats[index] && formats[index][formatIndex] === targetFormatRef) {
 625      // Increment/decrement in the direction of operation.
 626      index = index + directionIncrement;
 627    }
 628  
 629    // Restore by one in inverse direction of operation
 630    // to avoid out of bounds.
 631    index = index + inverseDirectionIncrement;
 632    return index;
 633  }
 634  const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
 635  const walkToStart = partialRight(walkToBoundary, 'backwards');
 636  const walkToEnd = partialRight(walkToBoundary, 'forwards');
 637  
 638  ;// ./node_modules/@wordpress/format-library/build-module/link/inline.js
 639  /**
 640   * WordPress dependencies
 641   */
 642  
 643  
 644  
 645  
 646  
 647  
 648  
 649  
 650  
 651  /**
 652   * Internal dependencies
 653   */
 654  
 655  
 656  
 657  const LINK_SETTINGS = [...external_wp_blockEditor_namespaceObject.LinkControl.DEFAULT_LINK_SETTINGS, {
 658    id: 'nofollow',
 659    title: (0,external_wp_i18n_namespaceObject.__)('Mark as nofollow')
 660  }];
 661  function InlineLinkUI({
 662    isActive,
 663    activeAttributes,
 664    value,
 665    onChange,
 666    onFocusOutside,
 667    stopAddingLink,
 668    contentRef,
 669    focusOnMount
 670  }) {
 671    const richLinkTextValue = getRichTextValueFromSelection(value, isActive);
 672  
 673    // Get the text content minus any HTML tags.
 674    const richTextText = richLinkTextValue.text;
 675    const {
 676      selectionChange
 677    } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
 678    const {
 679      createPageEntity,
 680      userCanCreatePages,
 681      selectionStart
 682    } = (0,external_wp_data_namespaceObject.useSelect)(select => {
 683      const {
 684        getSettings,
 685        getSelectionStart
 686      } = select(external_wp_blockEditor_namespaceObject.store);
 687      const _settings = getSettings();
 688      return {
 689        createPageEntity: _settings.__experimentalCreatePageEntity,
 690        userCanCreatePages: _settings.__experimentalUserCanCreatePages,
 691        selectionStart: getSelectionStart()
 692      };
 693    }, []);
 694    const linkValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
 695      url: activeAttributes.url,
 696      type: activeAttributes.type,
 697      id: activeAttributes.id,
 698      opensInNewTab: activeAttributes.target === '_blank',
 699      nofollow: activeAttributes.rel?.includes('nofollow'),
 700      title: richTextText
 701    }), [activeAttributes.id, activeAttributes.rel, activeAttributes.target, activeAttributes.type, activeAttributes.url, richTextText]);
 702    function removeLink() {
 703      const newValue = (0,external_wp_richText_namespaceObject.removeFormat)(value, 'core/link');
 704      onChange(newValue);
 705      stopAddingLink();
 706      (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
 707    }
 708    function onChangeLink(nextValue) {
 709      const hasLink = linkValue?.url;
 710      const isNewLink = !hasLink;
 711  
 712      // Merge the next value with the current link value.
 713      nextValue = {
 714        ...linkValue,
 715        ...nextValue
 716      };
 717      const newUrl = (0,external_wp_url_namespaceObject.prependHTTP)(nextValue.url);
 718      const linkFormat = createLinkFormat({
 719        url: newUrl,
 720        type: nextValue.type,
 721        id: nextValue.id !== undefined && nextValue.id !== null ? String(nextValue.id) : undefined,
 722        opensInNewWindow: nextValue.opensInNewTab,
 723        nofollow: nextValue.nofollow
 724      });
 725      const newText = nextValue.title || newUrl;
 726  
 727      // Scenario: we have any active text selection or an active format.
 728      let newValue;
 729      if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !isActive) {
 730        // Scenario: we don't have any actively selected text or formats.
 731        const inserted = (0,external_wp_richText_namespaceObject.insert)(value, newText);
 732        newValue = (0,external_wp_richText_namespaceObject.applyFormat)(inserted, linkFormat, value.start, value.start + newText.length);
 733        onChange(newValue);
 734  
 735        // Close the Link UI.
 736        stopAddingLink();
 737  
 738        // Move the selection to the end of the inserted link outside of the format boundary
 739        // so the user can continue typing after the link.
 740        selectionChange({
 741          clientId: selectionStart.clientId,
 742          identifier: selectionStart.attributeKey,
 743          start: value.start + newText.length + 1
 744        });
 745        return;
 746      } else if (newText === richTextText) {
 747        newValue = (0,external_wp_richText_namespaceObject.applyFormat)(value, linkFormat);
 748      } else {
 749        // Scenario: Editing an existing link.
 750  
 751        // Create new RichText value for the new text in order that we
 752        // can apply formats to it.
 753        newValue = (0,external_wp_richText_namespaceObject.create)({
 754          text: newText
 755        });
 756        // Apply the new Link format to this new text value.
 757        newValue = (0,external_wp_richText_namespaceObject.applyFormat)(newValue, linkFormat, 0, newText.length);
 758  
 759        // Get the boundaries of the active link format.
 760        const boundary = getFormatBoundary(value, {
 761          type: 'core/link'
 762        });
 763  
 764        // Split the value at the start of the active link format.
 765        // Passing "start" as the 3rd parameter is required to ensure
 766        // the second half of the split value is split at the format's
 767        // start boundary and avoids relying on the value's "end" property
 768        // which may not correspond correctly.
 769        const [valBefore, valAfter] = (0,external_wp_richText_namespaceObject.split)(value, boundary.start, boundary.start);
 770  
 771        // Update the original (full) RichTextValue replacing the
 772        // target text with the *new* RichTextValue containing:
 773        // 1. The new text content.
 774        // 2. The new link format.
 775        // As "replace" will operate on the first match only, it is
 776        // run only against the second half of the value which was
 777        // split at the active format's boundary. This avoids a bug
 778        // with incorrectly targeted replacements.
 779        // See: https://github.com/WordPress/gutenberg/issues/41771.
 780        // Note original formats will be lost when applying this change.
 781        // That is expected behaviour.
 782        // See: https://github.com/WordPress/gutenberg/pull/33849#issuecomment-936134179.
 783        const newValAfter = (0,external_wp_richText_namespaceObject.replace)(valAfter, richTextText, newValue);
 784        newValue = (0,external_wp_richText_namespaceObject.concat)(valBefore, newValAfter);
 785      }
 786      onChange(newValue);
 787  
 788      // Focus should only be returned to the rich text on submit if this link is not
 789      // being created for the first time. If it is then focus should remain within the
 790      // Link UI because it should remain open for the user to modify the link they have
 791      // just created.
 792      if (!isNewLink) {
 793        stopAddingLink();
 794      }
 795      if (!isValidHref(newUrl)) {
 796        (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');
 797      } else if (isActive) {
 798        (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link edited.'), 'assertive');
 799      } else {
 800        (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link inserted.'), 'assertive');
 801      }
 802    }
 803    const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
 804      editableContentElement: contentRef.current,
 805      settings: {
 806        ...build_module_link_link,
 807        isActive
 808      }
 809    });
 810    async function handleCreate(pageTitle) {
 811      const page = await createPageEntity({
 812        title: pageTitle,
 813        status: 'draft'
 814      });
 815      return {
 816        id: page.id,
 817        type: page.type,
 818        title: page.title.rendered,
 819        url: page.link,
 820        kind: 'post-type'
 821      };
 822    }
 823    function createButtonText(searchTerm) {
 824      return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(/* translators: %s: search term. */
 825      (0,external_wp_i18n_namespaceObject.__)('Create page: <mark>%s</mark>'), searchTerm), {
 826        mark: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {})
 827      });
 828    }
 829    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, {
 830      anchor: popoverAnchor,
 831      animate: false,
 832      onClose: stopAddingLink,
 833      onFocusOutside: onFocusOutside,
 834      placement: "bottom",
 835      offset: 8,
 836      shift: true,
 837      focusOnMount: focusOnMount,
 838      constrainTabbing: true,
 839      children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.LinkControl, {
 840        value: linkValue,
 841        onChange: onChangeLink,
 842        onRemove: removeLink,
 843        hasRichPreviews: true,
 844        createSuggestion: createPageEntity && handleCreate,
 845        withCreateSuggestion: userCanCreatePages,
 846        createSuggestionButtonText: createButtonText,
 847        hasTextControl: true,
 848        settings: LINK_SETTINGS,
 849        showInitialSuggestions: true,
 850        suggestionsQuery: {
 851          // always show Pages as initial suggestions
 852          initialSuggestionsSearchOptions: {
 853            type: 'post',
 854            subtype: 'page',
 855            perPage: 20
 856          }
 857        }
 858      })
 859    });
 860  }
 861  function getRichTextValueFromSelection(value, isActive) {
 862    // Default to the selection ranges on the RichTextValue object.
 863    let textStart = value.start;
 864    let textEnd = value.end;
 865  
 866    // If the format is currently active then the rich text value
 867    // should always be taken from the bounds of the active format
 868    // and not the selected text.
 869    if (isActive) {
 870      const boundary = getFormatBoundary(value, {
 871        type: 'core/link'
 872      });
 873      textStart = boundary.start;
 874  
 875      // Text *selection* always extends +1 beyond the edge of the format.
 876      // We account for that here.
 877      textEnd = boundary.end + 1;
 878    }
 879  
 880    // Get a RichTextValue containing the selected text content.
 881    return (0,external_wp_richText_namespaceObject.slice)(value, textStart, textEnd);
 882  }
 883  /* harmony default export */ const inline = (InlineLinkUI);
 884  
 885  ;// ./node_modules/@wordpress/format-library/build-module/link/index.js
 886  /**
 887   * WordPress dependencies
 888   */
 889  
 890  
 891  
 892  
 893  
 894  
 895  
 896  
 897  
 898  /**
 899   * Internal dependencies
 900   */
 901  
 902  
 903  
 904  const link_name = 'core/link';
 905  const link_title = (0,external_wp_i18n_namespaceObject.__)('Link');
 906  function link_Edit({
 907    isActive,
 908    activeAttributes,
 909    value,
 910    onChange,
 911    onFocus,
 912    contentRef
 913  }) {
 914    const [addingLink, setAddingLink] = (0,external_wp_element_namespaceObject.useState)(false);
 915  
 916    // We only need to store the button element that opened the popover. We can ignore the other states, as they will be handled by the onFocus prop to return to the rich text field.
 917    const [openedBy, setOpenedBy] = (0,external_wp_element_namespaceObject.useState)(null);
 918    (0,external_wp_element_namespaceObject.useEffect)(() => {
 919      // When the link becomes inactive (i.e. isActive is false), reset the editingLink state
 920      // and the creatingLink state. This means that if the Link UI is displayed and the link
 921      // becomes inactive (e.g. used arrow keys to move cursor outside of link bounds), the UI will close.
 922      if (!isActive) {
 923        setAddingLink(false);
 924      }
 925    }, [isActive]);
 926    (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
 927      const editableContentElement = contentRef.current;
 928      if (!editableContentElement) {
 929        return;
 930      }
 931      function handleClick(event) {
 932        // There is a situation whereby there is an existing link in the rich text
 933        // and the user clicks on the leftmost edge of that link and fails to activate
 934        // the link format, but the click event still fires on the `<a>` element.
 935        // This causes the `editingLink` state to be set to `true` and the link UI
 936        // to be rendered in "creating" mode. We need to check isActive to see if
 937        // we have an active link format.
 938        const link = event.target.closest('[contenteditable] a');
 939        if (!link ||
 940        // other formats (e.g. bold) may be nested within the link.
 941        !isActive) {
 942          return;
 943        }
 944        setAddingLink(true);
 945        setOpenedBy({
 946          el: link,
 947          action: 'click'
 948        });
 949      }
 950      editableContentElement.addEventListener('click', handleClick);
 951      return () => {
 952        editableContentElement.removeEventListener('click', handleClick);
 953      };
 954    }, [contentRef, isActive]);
 955    function addLink(target) {
 956      const text = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(value));
 957      if (!isActive && text && (0,external_wp_url_namespaceObject.isURL)(text) && isValidHref(text)) {
 958        onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
 959          type: link_name,
 960          attributes: {
 961            url: text
 962          }
 963        }));
 964      } else if (!isActive && text && (0,external_wp_url_namespaceObject.isEmail)(text)) {
 965        onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
 966          type: link_name,
 967          attributes: {
 968            url: `mailto:$text}`
 969          }
 970        }));
 971      } else if (!isActive && text && (0,external_wp_url_namespaceObject.isPhoneNumber)(text)) {
 972        onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
 973          type: link_name,
 974          attributes: {
 975            url: `tel:$text.replace(/\D/g, '')}`
 976          }
 977        }));
 978      } else {
 979        if (target) {
 980          setOpenedBy({
 981            el: target,
 982            action: null // We don't need to distinguish between click or keyboard here
 983          });
 984        }
 985        setAddingLink(true);
 986      }
 987    }
 988  
 989    /**
 990     * Runs when the popover is closed via escape keypress, unlinking the selected text,
 991     * but _not_ on a click outside the popover. onFocusOutside handles that.
 992     */
 993    function stopAddingLink() {
 994      // Don't let the click handler on the toolbar button trigger again.
 995  
 996      // There are two places for us to return focus to on Escape keypress:
 997      // 1. The rich text field.
 998      // 2. The toolbar button.
 999  
1000      // The toolbar button is the only one we need to handle returning focus to.
1001      // Otherwise, we rely on the passed in onFocus to return focus to the rich text field.
1002  
1003      // Close the popover
1004      setAddingLink(false);
1005  
1006      // Return focus to the toolbar button or the rich text field
1007      if (openedBy?.el?.tagName === 'BUTTON') {
1008        openedBy.el.focus();
1009      } else {
1010        onFocus();
1011      }
1012      // Remove the openedBy state
1013      setOpenedBy(null);
1014    }
1015  
1016    // Test for this:
1017    // 1. Click on the link button
1018    // 2. Click the Options button in the top right of header
1019    // 3. Focus should be in the dropdown of the Options button
1020    // 4. Press Escape
1021    // 5. Focus should be on the Options button
1022    function onFocusOutside() {
1023      setAddingLink(false);
1024      setOpenedBy(null);
1025    }
1026    function onRemoveFormat() {
1027      onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, link_name));
1028      (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
1029    }
1030  
1031    // Only autofocus if we have clicked a link within the editor
1032    const shouldAutoFocus = !(openedBy?.el?.tagName === 'A' && openedBy?.action === 'click');
1033    const hasSelection = !(0,external_wp_richText_namespaceObject.isCollapsed)(value);
1034    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
1035      children: [hasSelection && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1036        type: "primary",
1037        character: "k",
1038        onUse: addLink
1039      }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1040        type: "primaryShift",
1041        character: "k",
1042        onUse: onRemoveFormat
1043      }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1044        name: "link",
1045        icon: library_link,
1046        title: isActive ? (0,external_wp_i18n_namespaceObject.__)('Link') : link_title,
1047        onClick: event => {
1048          addLink(event.currentTarget);
1049        },
1050        isActive: isActive || addingLink,
1051        shortcutType: "primary",
1052        shortcutCharacter: "k",
1053        "aria-haspopup": "true",
1054        "aria-expanded": addingLink
1055      }), addingLink && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inline, {
1056        stopAddingLink: stopAddingLink,
1057        onFocusOutside: onFocusOutside,
1058        isActive: isActive,
1059        activeAttributes: activeAttributes,
1060        value: value,
1061        onChange: onChange,
1062        contentRef: contentRef,
1063        focusOnMount: shouldAutoFocus ? 'firstElement' : false
1064      })]
1065    });
1066  }
1067  const build_module_link_link = {
1068    name: link_name,
1069    title: link_title,
1070    tagName: 'a',
1071    className: null,
1072    attributes: {
1073      url: 'href',
1074      type: 'data-type',
1075      id: 'data-id',
1076      _id: 'id',
1077      target: 'target',
1078      rel: 'rel'
1079    },
1080    __unstablePasteRule(value, {
1081      html,
1082      plainText
1083    }) {
1084      const pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim();
1085  
1086      // A URL was pasted, turn the selection into a link.
1087      // For the link pasting feature, allow only http(s) protocols.
1088      if (!(0,external_wp_url_namespaceObject.isURL)(pastedText) || !/^https?:/.test(pastedText)) {
1089        return value;
1090      }
1091  
1092      // Allows us to ask for this information when we get a report.
1093      window.console.log('Created link:\n\n', pastedText);
1094      const format = {
1095        type: link_name,
1096        attributes: {
1097          url: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(pastedText)
1098        }
1099      };
1100      if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
1101        return (0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.applyFormat)((0,external_wp_richText_namespaceObject.create)({
1102          text: plainText
1103        }), format, 0, plainText.length));
1104      }
1105      return (0,external_wp_richText_namespaceObject.applyFormat)(value, format);
1106    },
1107    edit: link_Edit
1108  };
1109  
1110  ;// ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js
1111  /**
1112   * WordPress dependencies
1113   */
1114  
1115  
1116  const formatStrikethrough = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1117    xmlns: "http://www.w3.org/2000/svg",
1118    viewBox: "0 0 24 24",
1119    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1120      d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"
1121    })
1122  });
1123  /* harmony default export */ const format_strikethrough = (formatStrikethrough);
1124  
1125  ;// ./node_modules/@wordpress/format-library/build-module/strikethrough/index.js
1126  /**
1127   * WordPress dependencies
1128   */
1129  
1130  
1131  
1132  
1133  
1134  const strikethrough_name = 'core/strikethrough';
1135  const strikethrough_title = (0,external_wp_i18n_namespaceObject.__)('Strikethrough');
1136  const strikethrough = {
1137    name: strikethrough_name,
1138    title: strikethrough_title,
1139    tagName: 's',
1140    className: null,
1141    edit({
1142      isActive,
1143      value,
1144      onChange,
1145      onFocus
1146    }) {
1147      function onClick() {
1148        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1149          type: strikethrough_name,
1150          title: strikethrough_title
1151        }));
1152        onFocus();
1153      }
1154      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
1155        children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1156          type: "access",
1157          character: "d",
1158          onUse: onClick
1159        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1160          icon: format_strikethrough,
1161          title: strikethrough_title,
1162          onClick: onClick,
1163          isActive: isActive,
1164          role: "menuitemcheckbox"
1165        })]
1166      });
1167    }
1168  };
1169  
1170  ;// ./node_modules/@wordpress/format-library/build-module/underline/index.js
1171  /**
1172   * WordPress dependencies
1173   */
1174  
1175  
1176  
1177  
1178  const underline_name = 'core/underline';
1179  const underline_title = (0,external_wp_i18n_namespaceObject.__)('Underline');
1180  const underline = {
1181    name: underline_name,
1182    title: underline_title,
1183    tagName: 'span',
1184    className: null,
1185    attributes: {
1186      style: 'style'
1187    },
1188    edit({
1189      value,
1190      onChange
1191    }) {
1192      const onToggle = () => {
1193        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1194          type: underline_name,
1195          attributes: {
1196            style: 'text-decoration: underline;'
1197          },
1198          title: underline_title
1199        }));
1200      };
1201      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
1202        children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1203          type: "primary",
1204          character: "u",
1205          onUse: onToggle
1206        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
1207          inputType: "formatUnderline",
1208          onInput: onToggle
1209        })]
1210      });
1211    }
1212  };
1213  
1214  ;// ./node_modules/@wordpress/icons/build-module/icon/index.js
1215  /**
1216   * WordPress dependencies
1217   */
1218  
1219  
1220  /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
1221  
1222  /**
1223   * Return an SVG icon.
1224   *
1225   * @param {IconProps}                                 props icon is the SVG component to render
1226   *                                                          size is a number specifying the icon size in pixels
1227   *                                                          Other props will be passed to wrapped SVG component
1228   * @param {import('react').ForwardedRef<HTMLElement>} ref   The forwarded ref to the SVG element.
1229   *
1230   * @return {JSX.Element}  Icon component
1231   */
1232  function Icon({
1233    icon,
1234    size = 24,
1235    ...props
1236  }, ref) {
1237    return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
1238      width: size,
1239      height: size,
1240      ...props,
1241      ref
1242    });
1243  }
1244  /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
1245  
1246  ;// ./node_modules/@wordpress/icons/build-module/library/text-color.js
1247  /**
1248   * WordPress dependencies
1249   */
1250  
1251  
1252  const textColor = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1253    xmlns: "http://www.w3.org/2000/svg",
1254    viewBox: "0 0 24 24",
1255    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1256      d: "M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"
1257    })
1258  });
1259  /* harmony default export */ const text_color = (textColor);
1260  
1261  ;// ./node_modules/@wordpress/icons/build-module/library/color.js
1262  /**
1263   * WordPress dependencies
1264   */
1265  
1266  
1267  const color = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1268    viewBox: "0 0 24 24",
1269    xmlns: "http://www.w3.org/2000/svg",
1270    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1271      d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"
1272    })
1273  });
1274  /* harmony default export */ const library_color = (color);
1275  
1276  ;// external ["wp","privateApis"]
1277  const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
1278  ;// ./node_modules/@wordpress/format-library/build-module/lock-unlock.js
1279  /**
1280   * WordPress dependencies
1281   */
1282  
1283  const {
1284    lock,
1285    unlock
1286  } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/format-library');
1287  
1288  ;// ./node_modules/@wordpress/format-library/build-module/text-color/inline.js
1289  /* wp:polyfill */
1290  /**
1291   * WordPress dependencies
1292   */
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  /**
1301   * Internal dependencies
1302   */
1303  
1304  
1305  
1306  const {
1307    Tabs
1308  } = unlock(external_wp_components_namespaceObject.privateApis);
1309  const TABS = [{
1310    name: 'color',
1311    title: (0,external_wp_i18n_namespaceObject.__)('Text')
1312  }, {
1313    name: 'backgroundColor',
1314    title: (0,external_wp_i18n_namespaceObject.__)('Background')
1315  }];
1316  function parseCSS(css = '') {
1317    return css.split(';').reduce((accumulator, rule) => {
1318      if (rule) {
1319        const [property, value] = rule.split(':');
1320        if (property === 'color') {
1321          accumulator.color = value;
1322        }
1323        if (property === 'background-color' && value !== transparentValue) {
1324          accumulator.backgroundColor = value;
1325        }
1326      }
1327      return accumulator;
1328    }, {});
1329  }
1330  function parseClassName(className = '', colorSettings) {
1331    return className.split(' ').reduce((accumulator, name) => {
1332      // `colorSlug` could contain dashes, so simply match the start and end.
1333      if (name.startsWith('has-') && name.endsWith('-color')) {
1334        const colorSlug = name.replace(/^has-/, '').replace(/-color$/, '');
1335        const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues)(colorSettings, colorSlug);
1336        accumulator.color = colorObject.color;
1337      }
1338      return accumulator;
1339    }, {});
1340  }
1341  function getActiveColors(value, name, colorSettings) {
1342    const activeColorFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name);
1343    if (!activeColorFormat) {
1344      return {};
1345    }
1346    return {
1347      ...parseCSS(activeColorFormat.attributes.style),
1348      ...parseClassName(activeColorFormat.attributes.class, colorSettings)
1349    };
1350  }
1351  function setColors(value, name, colorSettings, colors) {
1352    const {
1353      color,
1354      backgroundColor
1355    } = {
1356      ...getActiveColors(value, name, colorSettings),
1357      ...colors
1358    };
1359    if (!color && !backgroundColor) {
1360      return (0,external_wp_richText_namespaceObject.removeFormat)(value, name);
1361    }
1362    const styles = [];
1363    const classNames = [];
1364    const attributes = {};
1365    if (backgroundColor) {
1366      styles.push(['background-color', backgroundColor].join(':'));
1367    } else {
1368      // Override default browser color for mark element.
1369      styles.push(['background-color', transparentValue].join(':'));
1370    }
1371    if (color) {
1372      const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByColorValue)(colorSettings, color);
1373      if (colorObject) {
1374        classNames.push((0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', colorObject.slug));
1375      } else {
1376        styles.push(['color', color].join(':'));
1377      }
1378    }
1379    if (styles.length) {
1380      attributes.style = styles.join(';');
1381    }
1382    if (classNames.length) {
1383      attributes.class = classNames.join(' ');
1384    }
1385    return (0,external_wp_richText_namespaceObject.applyFormat)(value, {
1386      type: name,
1387      attributes
1388    });
1389  }
1390  function ColorPicker({
1391    name,
1392    property,
1393    value,
1394    onChange
1395  }) {
1396    const colors = (0,external_wp_data_namespaceObject.useSelect)(select => {
1397      var _getSettings$colors;
1398      const {
1399        getSettings
1400      } = select(external_wp_blockEditor_namespaceObject.store);
1401      return (_getSettings$colors = getSettings().colors) !== null && _getSettings$colors !== void 0 ? _getSettings$colors : [];
1402    }, []);
1403    const activeColors = (0,external_wp_element_namespaceObject.useMemo)(() => getActiveColors(value, name, colors), [name, value, colors]);
1404    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ColorPalette, {
1405      value: activeColors[property],
1406      onChange: color => {
1407        onChange(setColors(value, name, colors, {
1408          [property]: color
1409        }));
1410      }
1411    });
1412  }
1413  function InlineColorUI({
1414    name,
1415    value,
1416    onChange,
1417    onClose,
1418    contentRef,
1419    isActive
1420  }) {
1421    const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
1422      editableContentElement: contentRef.current,
1423      settings: {
1424        ...text_color_textColor,
1425        isActive
1426      }
1427    });
1428    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, {
1429      onClose: onClose,
1430      className: "format-library__inline-color-popover",
1431      anchor: popoverAnchor,
1432      children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, {
1433        children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, {
1434          children: TABS.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, {
1435            tabId: tab.name,
1436            children: tab.title
1437          }, tab.name))
1438        }), TABS.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, {
1439          tabId: tab.name,
1440          focusable: false,
1441          children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPicker, {
1442            name: name,
1443            property: tab.name,
1444            value: value,
1445            onChange: onChange
1446          })
1447        }, tab.name))]
1448      })
1449    });
1450  }
1451  
1452  ;// ./node_modules/@wordpress/format-library/build-module/text-color/index.js
1453  /**
1454   * WordPress dependencies
1455   */
1456  
1457  
1458  
1459  
1460  
1461  
1462  /**
1463   * Internal dependencies
1464   */
1465  
1466  
1467  const transparentValue = 'rgba(0, 0, 0, 0)';
1468  const text_color_name = 'core/text-color';
1469  const text_color_title = (0,external_wp_i18n_namespaceObject.__)('Highlight');
1470  const EMPTY_ARRAY = [];
1471  function getComputedStyleProperty(element, property) {
1472    const {
1473      ownerDocument
1474    } = element;
1475    const {
1476      defaultView
1477    } = ownerDocument;
1478    const style = defaultView.getComputedStyle(element);
1479    const value = style.getPropertyValue(property);
1480    if (property === 'background-color' && value === transparentValue && element.parentElement) {
1481      return getComputedStyleProperty(element.parentElement, property);
1482    }
1483    return value;
1484  }
1485  function fillComputedColors(element, {
1486    color,
1487    backgroundColor
1488  }) {
1489    if (!color && !backgroundColor) {
1490      return;
1491    }
1492    return {
1493      color: color || getComputedStyleProperty(element, 'color'),
1494      backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, 'background-color') : backgroundColor
1495    };
1496  }
1497  function TextColorEdit({
1498    value,
1499    onChange,
1500    isActive,
1501    activeAttributes,
1502    contentRef
1503  }) {
1504    const [allowCustomControl, colors = EMPTY_ARRAY] = (0,external_wp_blockEditor_namespaceObject.useSettings)('color.custom', 'color.palette');
1505    const [isAddingColor, setIsAddingColor] = (0,external_wp_element_namespaceObject.useState)(false);
1506    const colorIndicatorStyle = (0,external_wp_element_namespaceObject.useMemo)(() => fillComputedColors(contentRef.current, getActiveColors(value, text_color_name, colors)), [contentRef, value, colors]);
1507    const hasColorsToChoose = !!colors.length || allowCustomControl;
1508    if (!hasColorsToChoose && !isActive) {
1509      return null;
1510    }
1511    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
1512      children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1513        className: "format-library-text-color-button",
1514        isActive: isActive,
1515        icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, {
1516          icon: Object.keys(activeAttributes).length ? text_color : library_color,
1517          style: colorIndicatorStyle
1518        }),
1519        title: text_color_title
1520        // If has no colors to choose but a color is active remove the color onClick.
1521        ,
1522        onClick: hasColorsToChoose ? () => setIsAddingColor(true) : () => onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, text_color_name)),
1523        role: "menuitemcheckbox"
1524      }), isAddingColor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineColorUI, {
1525        name: text_color_name,
1526        onClose: () => setIsAddingColor(false),
1527        activeAttributes: activeAttributes,
1528        value: value,
1529        onChange: onChange,
1530        contentRef: contentRef,
1531        isActive: isActive
1532      })]
1533    });
1534  }
1535  const text_color_textColor = {
1536    name: text_color_name,
1537    title: text_color_title,
1538    tagName: 'mark',
1539    className: 'has-inline-color',
1540    attributes: {
1541      style: 'style',
1542      class: 'class'
1543    },
1544    edit: TextColorEdit
1545  };
1546  
1547  ;// ./node_modules/@wordpress/icons/build-module/library/subscript.js
1548  /**
1549   * WordPress dependencies
1550   */
1551  
1552  
1553  const subscript = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1554    xmlns: "http://www.w3.org/2000/svg",
1555    viewBox: "0 0 24 24",
1556    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1557      d: "M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"
1558    })
1559  });
1560  /* harmony default export */ const library_subscript = (subscript);
1561  
1562  ;// ./node_modules/@wordpress/format-library/build-module/subscript/index.js
1563  /**
1564   * WordPress dependencies
1565   */
1566  
1567  
1568  
1569  
1570  
1571  const subscript_name = 'core/subscript';
1572  const subscript_title = (0,external_wp_i18n_namespaceObject.__)('Subscript');
1573  const subscript_subscript = {
1574    name: subscript_name,
1575    title: subscript_title,
1576    tagName: 'sub',
1577    className: null,
1578    edit({
1579      isActive,
1580      value,
1581      onChange,
1582      onFocus
1583    }) {
1584      function onToggle() {
1585        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1586          type: subscript_name,
1587          title: subscript_title
1588        }));
1589      }
1590      function onClick() {
1591        onToggle();
1592        onFocus();
1593      }
1594      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1595        icon: library_subscript,
1596        title: subscript_title,
1597        onClick: onClick,
1598        isActive: isActive,
1599        role: "menuitemcheckbox"
1600      });
1601    }
1602  };
1603  
1604  ;// ./node_modules/@wordpress/icons/build-module/library/superscript.js
1605  /**
1606   * WordPress dependencies
1607   */
1608  
1609  
1610  const superscript = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1611    xmlns: "http://www.w3.org/2000/svg",
1612    viewBox: "0 0 24 24",
1613    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1614      d: "M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"
1615    })
1616  });
1617  /* harmony default export */ const library_superscript = (superscript);
1618  
1619  ;// ./node_modules/@wordpress/format-library/build-module/superscript/index.js
1620  /**
1621   * WordPress dependencies
1622   */
1623  
1624  
1625  
1626  
1627  
1628  const superscript_name = 'core/superscript';
1629  const superscript_title = (0,external_wp_i18n_namespaceObject.__)('Superscript');
1630  const superscript_superscript = {
1631    name: superscript_name,
1632    title: superscript_title,
1633    tagName: 'sup',
1634    className: null,
1635    edit({
1636      isActive,
1637      value,
1638      onChange,
1639      onFocus
1640    }) {
1641      function onToggle() {
1642        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1643          type: superscript_name,
1644          title: superscript_title
1645        }));
1646      }
1647      function onClick() {
1648        onToggle();
1649        onFocus();
1650      }
1651      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1652        icon: library_superscript,
1653        title: superscript_title,
1654        onClick: onClick,
1655        isActive: isActive,
1656        role: "menuitemcheckbox"
1657      });
1658    }
1659  };
1660  
1661  ;// ./node_modules/@wordpress/icons/build-module/library/button.js
1662  /**
1663   * WordPress dependencies
1664   */
1665  
1666  
1667  const button_button = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1668    viewBox: "0 0 24 24",
1669    xmlns: "http://www.w3.org/2000/svg",
1670    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1671      d: "M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"
1672    })
1673  });
1674  /* harmony default export */ const library_button = (button_button);
1675  
1676  ;// ./node_modules/@wordpress/format-library/build-module/keyboard/index.js
1677  /**
1678   * WordPress dependencies
1679   */
1680  
1681  
1682  
1683  
1684  
1685  const keyboard_name = 'core/keyboard';
1686  const keyboard_title = (0,external_wp_i18n_namespaceObject.__)('Keyboard input');
1687  const keyboard = {
1688    name: keyboard_name,
1689    title: keyboard_title,
1690    tagName: 'kbd',
1691    className: null,
1692    edit({
1693      isActive,
1694      value,
1695      onChange,
1696      onFocus
1697    }) {
1698      function onToggle() {
1699        onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1700          type: keyboard_name,
1701          title: keyboard_title
1702        }));
1703      }
1704      function onClick() {
1705        onToggle();
1706        onFocus();
1707      }
1708      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1709        icon: library_button,
1710        title: keyboard_title,
1711        onClick: onClick,
1712        isActive: isActive,
1713        role: "menuitemcheckbox"
1714      });
1715    }
1716  };
1717  
1718  ;// ./node_modules/@wordpress/icons/build-module/library/help.js
1719  /**
1720   * WordPress dependencies
1721   */
1722  
1723  
1724  const help = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1725    xmlns: "http://www.w3.org/2000/svg",
1726    viewBox: "0 0 24 24",
1727    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1728      d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"
1729    })
1730  });
1731  /* harmony default export */ const library_help = (help);
1732  
1733  ;// ./node_modules/@wordpress/format-library/build-module/unknown/index.js
1734  /* wp:polyfill */
1735  /**
1736   * WordPress dependencies
1737   */
1738  
1739  
1740  
1741  
1742  
1743  const unknown_name = 'core/unknown';
1744  const unknown_title = (0,external_wp_i18n_namespaceObject.__)('Clear Unknown Formatting');
1745  function selectionContainsUnknownFormats(value) {
1746    if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
1747      return false;
1748    }
1749    const selectedValue = (0,external_wp_richText_namespaceObject.slice)(value);
1750    return selectedValue.formats.some(formats => {
1751      return formats.some(format => format.type === unknown_name);
1752    });
1753  }
1754  const unknown = {
1755    name: unknown_name,
1756    title: unknown_title,
1757    tagName: '*',
1758    className: null,
1759    edit({
1760      isActive,
1761      value,
1762      onChange,
1763      onFocus
1764    }) {
1765      if (!isActive && !selectionContainsUnknownFormats(value)) {
1766        return null;
1767      }
1768      function onClick() {
1769        onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, unknown_name));
1770        onFocus();
1771      }
1772      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1773        name: "unknown",
1774        icon: library_help,
1775        title: unknown_title,
1776        onClick: onClick,
1777        isActive: true
1778      });
1779    }
1780  };
1781  
1782  ;// ./node_modules/@wordpress/icons/build-module/library/language.js
1783  /**
1784   * WordPress dependencies
1785   */
1786  
1787  
1788  const language = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
1789    xmlns: "http://www.w3.org/2000/svg",
1790    viewBox: "0 0 24 24",
1791    children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
1792      d: "M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"
1793    })
1794  });
1795  /* harmony default export */ const library_language = (language);
1796  
1797  ;// ./node_modules/@wordpress/format-library/build-module/language/index.js
1798  /**
1799   * WordPress dependencies
1800   */
1801  
1802  
1803  /**
1804   * WordPress dependencies
1805   */
1806  
1807  
1808  
1809  
1810  
1811  
1812  const language_name = 'core/language';
1813  const language_title = (0,external_wp_i18n_namespaceObject.__)('Language');
1814  const language_language = {
1815    name: language_name,
1816    tagName: 'bdo',
1817    className: null,
1818    edit: language_Edit,
1819    title: language_title
1820  };
1821  function language_Edit({
1822    isActive,
1823    value,
1824    onChange,
1825    contentRef
1826  }) {
1827    const [isPopoverVisible, setIsPopoverVisible] = (0,external_wp_element_namespaceObject.useState)(false);
1828    const togglePopover = () => {
1829      setIsPopoverVisible(state => !state);
1830    };
1831    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
1832      children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1833        icon: library_language,
1834        label: language_title,
1835        title: language_title,
1836        onClick: () => {
1837          if (isActive) {
1838            onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, language_name));
1839          } else {
1840            togglePopover();
1841          }
1842        },
1843        isActive: isActive,
1844        role: "menuitemcheckbox"
1845      }), isPopoverVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineLanguageUI, {
1846        value: value,
1847        onChange: onChange,
1848        onClose: togglePopover,
1849        contentRef: contentRef
1850      })]
1851    });
1852  }
1853  function InlineLanguageUI({
1854    value,
1855    contentRef,
1856    onChange,
1857    onClose
1858  }) {
1859    const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
1860      editableContentElement: contentRef.current,
1861      settings: language_language
1862    });
1863    const [lang, setLang] = (0,external_wp_element_namespaceObject.useState)('');
1864    const [dir, setDir] = (0,external_wp_element_namespaceObject.useState)('ltr');
1865    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, {
1866      className: "block-editor-format-toolbar__language-popover",
1867      anchor: popoverAnchor,
1868      onClose: onClose,
1869      children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, {
1870        as: "form",
1871        spacing: 4,
1872        className: "block-editor-format-toolbar__language-container-content",
1873        onSubmit: event => {
1874          event.preventDefault();
1875          onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
1876            type: language_name,
1877            attributes: {
1878              lang,
1879              dir
1880            }
1881          }));
1882          onClose();
1883        },
1884        children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, {
1885          __next40pxDefaultSize: true,
1886          __nextHasNoMarginBottom: true,
1887          label: language_title,
1888          value: lang,
1889          onChange: val => setLang(val),
1890          help: (0,external_wp_i18n_namespaceObject.__)('A valid language attribute, like "en" or "fr".')
1891        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
1892          __next40pxDefaultSize: true,
1893          __nextHasNoMarginBottom: true,
1894          label: (0,external_wp_i18n_namespaceObject.__)('Text direction'),
1895          value: dir,
1896          options: [{
1897            label: (0,external_wp_i18n_namespaceObject.__)('Left to right'),
1898            value: 'ltr'
1899          }, {
1900            label: (0,external_wp_i18n_namespaceObject.__)('Right to left'),
1901            value: 'rtl'
1902          }],
1903          onChange: val => setDir(val)
1904        }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, {
1905          alignment: "right",
1906          children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
1907            __next40pxDefaultSize: true,
1908            variant: "primary",
1909            type: "submit",
1910            text: (0,external_wp_i18n_namespaceObject.__)('Apply')
1911          })
1912        })]
1913      })
1914    });
1915  }
1916  
1917  ;// ./node_modules/@wordpress/format-library/build-module/non-breaking-space/index.js
1918  /**
1919   * WordPress dependencies
1920   */
1921  
1922  
1923  
1924  
1925  const non_breaking_space_name = 'core/non-breaking-space';
1926  const non_breaking_space_title = (0,external_wp_i18n_namespaceObject.__)('Non breaking space');
1927  const nonBreakingSpace = {
1928    name: non_breaking_space_name,
1929    title: non_breaking_space_title,
1930    tagName: 'nbsp',
1931    className: null,
1932    edit({
1933      value,
1934      onChange
1935    }) {
1936      function addNonBreakingSpace() {
1937        onChange((0,external_wp_richText_namespaceObject.insert)(value, '\u00a0'));
1938      }
1939      return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1940        type: "primaryShift",
1941        character: " ",
1942        onUse: addNonBreakingSpace
1943      });
1944    }
1945  };
1946  
1947  ;// ./node_modules/@wordpress/format-library/build-module/default-formats.js
1948  /**
1949   * Internal dependencies
1950   */
1951  
1952  
1953  
1954  
1955  
1956  
1957  
1958  
1959  
1960  
1961  
1962  
1963  
1964  
1965  /* harmony default export */ const default_formats = ([bold, code_code, image_image, italic, build_module_link_link, strikethrough, underline, text_color_textColor, subscript_subscript, superscript_superscript, keyboard, unknown, language_language, nonBreakingSpace]);
1966  
1967  ;// ./node_modules/@wordpress/format-library/build-module/index.js
1968  /* wp:polyfill */
1969  /**
1970   * WordPress dependencies
1971   */
1972  
1973  
1974  /**
1975   * Internal dependencies
1976   */
1977  
1978  default_formats.forEach(({
1979    name,
1980    ...settings
1981  }) => (0,external_wp_richText_namespaceObject.registerFormatType)(name, settings));
1982  
1983  (window.wp = window.wp || {}).formatLibrary = __webpack_exports__;
1984  /******/ })()
1985  ;


Generated : Fri Feb 21 08:20:01 2025 Cross-referenced by PHPXref