PageSourceSearch

https://www.tenktromso.no/modules/contrib/gutenberg/js/vendor/gutenberg/format-library/index.js?tmko21

js tenktromso.no collected 2026-10-09 16:53:24 UTC 64,875 bytes, 1,851 lines download raw bytes

1/******/ (() => { // webpackBootstrap
2/******/ 	"use strict";
3/******/ 	// The require scope
4/******/ 	var __webpack_require__ = {};
5/******/ 	
6/************************************************************************/
7/******/ 	/* webpack/runtime/make namespace object */
8/******/ 	(() => {
9/******/ 		// define __esModule on exports
10/******/ 		__webpack_require__.r = (exports) => {
11/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
12/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13/******/ 			}
14/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
15/******/ 		};
16/******/ 	})();
17/******/ 	
18/************************************************************************/
19var __webpack_exports__ = {};
20// ESM COMPAT FLAG
21__webpack_require__.r(__webpack_exports__);
22
23;// CONCATENATED MODULE: external ["wp","richText"]
24const external_wp_richText_namespaceObject = window["wp"]["richText"];
25;// CONCATENATED MODULE: external ["wp","element"]
26const external_wp_element_namespaceObject = window["wp"]["element"];
27;// CONCATENATED MODULE: external ["wp","i18n"]
28const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
29;// CONCATENATED MODULE: external ["wp","blockEditor"]
30const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
31;// CONCATENATED MODULE: external ["wp","primitives"]
32const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
33;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-bold.js
34
35/**
36 * WordPress dependencies
37 */
38
39const formatBold = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
40  xmlns: "http://www.w3.org/2000/svg",
41  viewBox: "0 0 24 24"
42}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
43  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"
44}));
45/* harmony default export */ const format_bold = (formatBold);
46
47;// CONCATENATED MODULE: ./packages/format-library/build-module/bold/index.js
48
49/**
50 * WordPress dependencies
51 */
52
53
54
55
56const bold_name = 'core/bold';
57const title = (0,external_wp_i18n_namespaceObject.__)('Bold');
58const bold = {
59  name: bold_name,
60  title,
61  tagName: 'strong',
62  className: null,
63  edit({
64    isActive,
65    value,
66    onChange,
67    onFocus
68  }) {
69    function onToggle() {
70      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
71        type: bold_name,
72        title
73      }));
74    }
75    function onClick() {
76      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
77        type: bold_name
78      }));
79      onFocus();
80    }
81    return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
82      type: "primary",
83      character: "b",
84      onUse: onToggle
85    }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
86      name: "bold",
87      icon: format_bold,
88      title: title,
89      onClick: onClick,
90      isActive: isActive,
91      shortcutType: "primary",
92      shortcutCharacter: "b"
93    }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
94      inputType: "formatBold",
95      onInput: onToggle
96    }));
97  }
98};
99
100;// CONCATENATED MODULE: ./packages/icons/build-module/library/code.js
101
102/**
103 * WordPress dependencies
104 */
105
106const code = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
107  viewBox: "0 0 24 24",
108  xmlns: "http://www.w3.org/2000/svg"
109}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
110  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"
111}));
112/* harmony default export */ const library_code = (code);
113
114;// CONCATENATED MODULE: ./packages/format-library/build-module/code/index.js
115
116/**
117 * WordPress dependencies
118 */
119
120
121
122
123const code_name = 'core/code';
124const code_title = (0,external_wp_i18n_namespaceObject.__)('Inline code');
125const code_code = {
126  name: code_name,
127  title: code_title,
128  tagName: 'code',
129  className: null,
130  __unstableInputRule(value) {
131    const BACKTICK = '`';
132    const {
133      start,
134      text
135    } = value;
136    const characterBefore = text[start - 1];
137
138    // Quick check the text for the necessary character.
139    if (characterBefore !== BACKTICK) {
140      return value;
141    }
142    if (start - 2 < 0) {
143      return value;
144    }
145    const indexBefore = text.lastIndexOf(BACKTICK, start - 2);
146    if (indexBefore === -1) {
147      return value;
148    }
149    const startIndex = indexBefore;
150    const endIndex = start - 2;
151    if (startIndex === endIndex) {
152      return value;
153    }
154    value = (0,external_wp_richText_namespaceObject.remove)(value, startIndex, startIndex + 1);
155    value = (0,external_wp_richText_namespaceObject.remove)(value, endIndex, endIndex + 1);
156    value = (0,external_wp_richText_namespaceObject.applyFormat)(value, {
157      type: code_name
158    }, startIndex, endIndex);
159    return value;
160  },
161  edit({
162    value,
163    onChange,
164    onFocus,
165    isActive
166  }) {
167    function onClick() {
168      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
169        type: code_name,
170        title: code_title
171      }));
172      onFocus();
173    }
174    return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
175      type: "access",
176      character: "x",
177      onUse: onClick
178    }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
179      icon: library_code,
180      title: code_title,
181      onClick: onClick,
182      isActive: isActive,
183      role: "menuitemcheckbox"
184    }));
185  }
186};
187
188;
188// CONCATENATED MODULE: external ["wp","components"]
189const external_wp_components_namespaceObject = window["wp"]["components"];
190;// CONCATENATED MODULE: ./packages/icons/build-module/library/keyboard-return.js
191
192/**
193 * WordPress dependencies
194 */
195
196const keyboardReturn = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
197  xmlns: "http://www.w3.org/2000/svg",
198  viewBox: "-2 -2 24 24"
199}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
200  d: "M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z"
201}));
202/* harmony default export */ const keyboard_return = (keyboardReturn);
203
204;// CONCATENATED MODULE: ./packages/format-library/build-module/image/index.js
205
206/**
207 * WordPress dependencies
208 */
209
210
211
212
213
214
215const ALLOWED_MEDIA_TYPES = ['image'];
216const image_name = 'core/image';
217const image_title = (0,external_wp_i18n_namespaceObject.__)('Inline image');
218const image_image = {
219  name: image_name,
220  title: image_title,
221  keywords: [(0,external_wp_i18n_namespaceObject.__)('photo'), (0,external_wp_i18n_namespaceObject.__)('media')],
222  object: true,
223  tagName: 'img',
224  className: null,
225  attributes: {
226    className: 'class',
227    style: 'style',
228    url: 'src',
229    alt: 'alt'
230  },
231  edit: Edit
232};
233function InlineUI({
234  value,
235  onChange,
236  activeObjectAttributes,
237  contentRef
238}) {
239  const {
240    style
241  } = activeObjectAttributes;
242  const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(style?.replace(/\D/g, ''));
243  const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
244    editableContentElement: contentRef.current,
245    settings: image_image
246  });
247  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
248    placement: "bottom",
249    focusOnMount: false,
250    anchor: popoverAnchor,
251    className: "block-editor-format-toolbar__image-popover"
252  }, (0,external_wp_element_namespaceObject.createElement)("form", {
253    className: "block-editor-format-toolbar__image-container-content",
254    onSubmit: event => {
255      const newReplacements = value.replacements.slice();
256      newReplacements[value.start] = {
257        type: image_name,
258        attributes: {
259          ...activeObjectAttributes,
260          style: width ? `width: ${width}px;` : ''
261        }
262      };
263      onChange({
264        ...value,
265        replacements: newReplacements
266      });
267      event.preventDefault();
268    }
269  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
270    alignment: "bottom",
271    spacing: "0"
272  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
273    className: "block-editor-format-toolbar__image-container-value",
274    label: (0,external_wp_i18n_namespaceObject.__)('Width'),
275    value: width,
276    min: 1,
277    onChange: newWidth => setWidth(newWidth)
278  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
279    className: "block-editor-format-toolbar__image-container-button",
280    icon: keyboard_return,
281    label: (0,external_wp_i18n_namespaceObject.__)('Apply'),
282    type: "submit"
283  }))));
284}
285function Edit({
286  value,
287  onChange,
288  onFocus,
289  isObjectActive,
290  activeObjectAttributes,
291  contentRef
292}) {
293  const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
294  function openModal() {
295    setIsModalOpen(true);
296  }
297  function closeModal() {
298    setIsModalOpen(false);
299  }
300  return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
301    icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
302      xmlns: "http://www.w3.org/2000/svg",
303      viewBox: "0 0 24 24"
304    }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
305      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"
306    })),
307    title: image_title,
308    onClick: openModal,
309    isActive: isObjectActive
310  }), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
311    allowedTypes: ALLOWED_MEDIA_TYPES,
312    onSelect: ({
313      id,
314      url,
315      alt,
316      width: imgWidth
317    }) => {
318      closeModal();
319      onChange((0,external_wp_richText_namespaceObject.insertObject)(value, {
320        type: image_name,
321        attributes: {
322          className: `wp-image-${id}`,
323          style: `width: ${Math.min(imgWidth, 150)}px;`,
324          url,
325          alt
326        }
327      }));
328      onFocus();
329    },
330    onClose: closeModal,
331    render: ({
332      open
333    }) => {
334      open();
335      return null;
336    }
337  }), isObjectActive && (0,external_wp_element_namespaceObject.createElement)(InlineUI, {
338    value: value,
339    onChange: onChange,
340    activeObjectAttributes: activeObjectAttributes,
341    contentRef: contentRef
342  }));
343}
344
345;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-italic.js
346
347/**
348 * WordPress dependencies
349 */
350
351const formatItalic = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
352  xmlns: "http://www.w3.org/2000/svg",
353  viewBox: "0 0 24 24"
354}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
355  d: "M12.5 5L10 19h1.9l2.5-14z"
356}));
357/* harmony default export */ const format_italic = (formatItalic);
358
359;// CONCATENATED MODULE: ./packages/format-library/build-module/italic/index.js
360
361/**
362 * WordPress dependencies
363 */
364
365
366
367
368const italic_name = 'core/italic';
369const italic_title = (0,external_wp_i18n_namespaceObject.__)('Italic');
370const italic = {
371  name: italic_name,
372  title: italic_title,
373  tagName: 'em',
374  className: null,
375  edit({
376    isActive,
377    value,
378    onChange,
379    onFocus
380  }) {
381    function onToggle() {
382      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
383        type: italic_name,
384        title: italic_title
385      }));
386    }
387    function onClick() {
388      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
389        type: italic_name
390      }));
391      onFocus();
392    }
393    return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
394      type: "primary",
395      character: "i",
396      onUse: onToggle
397    }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
398      name: "italic",
399      icon: format_italic,
400      title: italic_title,
401      onClick: onClick,
402      isActive: isActive,
403      shortcutType: "primary",
404      shortcutCharacter: "i"
405    }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
406      inputType: "formatItalic",
407      onInput: onToggle
408    }));
409  }
410};
411
412;// CONCATENATED MODULE: external ["wp","url"]
413const external_wp_url_namespaceObject = window["wp"]["url"];
414;// CONCATENATED MODULE: external ["wp","htmlEntities"]
415const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
416;// CONCATENATED MODULE: ./packages/icons/build-module/library/link-off.js
417
418/**
419 * WordPress dependencies
420 */
421
422const linkOff = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
423  xmlns: "http://www.w3.org/2000/svg",
424  viewBox: "0 0 24 24"
425}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
426  d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"
427}));
428/* harmony default export */ const link_off = (linkOff);
429
430;// CONCATENATED MODULE: ./packages/icons/build-module/library/link.js
431
432/**
433 * WordPress dependencies
434 */
435
436const link_link = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
437  xmlns: "http://www.w3.org/2000/svg",
438  viewBox: "0 0 24 24"
439}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
440  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"
441}));
442/* harmony default export */ const library_link = (link_link);
443
444;
444// CONCATENATED MODULE: external ["wp","a11y"]
445const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
446;// CONCATENATED MODULE: external ["wp","data"]
447const external_wp_data_namespaceObject = window["wp"]["data"];
448;// CONCATENATED MODULE: ./packages/format-library/build-module/link/utils.js
449/**
450 * WordPress dependencies
451 */
452
453
454/**
455 * Check for issues with the provided href.
456 *
457 * @param {string} href The href.
458 *
459 * @return {boolean} Is the href invalid?
460 */
461function isValidHref(href) {
462  if (!href) {
463    return false;
464  }
465  const trimmedHref = href.trim();
466  if (!trimmedHref) {
467    return false;
468  }
469
470  // Does the href start with something that looks like a URL protocol?
471  if (/^\S+:/.test(trimmedHref)) {
472    const protocol = (0,external_wp_url_namespaceObject.getProtocol)(trimmedHref);
473    if (!(0,external_wp_url_namespaceObject.isValidProtocol)(protocol)) {
474      return false;
475    }
476
477    // Add some extra checks for http(s) URIs, since these are the most common use-case.
478    // This ensures URIs with an http protocol have exactly two forward slashes following the protocol.
479    if (protocol.startsWith('http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
480      return false;
481    }
482    const authority = (0,external_wp_url_namespaceObject.getAuthority)(trimmedHref);
483    if (!(0,external_wp_url_namespaceObject.isValidAuthority)(authority)) {
484      return false;
485    }
486    const path = (0,external_wp_url_namespaceObject.getPath)(trimmedHref);
487    if (path && !(0,external_wp_url_namespaceObject.isValidPath)(path)) {
488      return false;
489    }
490    const queryString = (0,external_wp_url_namespaceObject.getQueryString)(trimmedHref);
491    if (queryString && !(0,external_wp_url_namespaceObject.isValidQueryString)(queryString)) {
492      return false;
493    }
494    const fragment = (0,external_wp_url_namespaceObject.getFragment)(trimmedHref);
495    if (fragment && !(0,external_wp_url_namespaceObject.isValidFragment)(fragment)) {
496      return false;
497    }
498  }
499
500  // Validate anchor links.
501  if (trimmedHref.startsWith('#') && !(0,external_wp_url_namespaceObject.isValidFragment)(trimmedHref)) {
502    return false;
503  }
504  return true;
505}
506
507/**
508 * Generates the format object that will be applied to the link text.
509 *
510 * @param {Object}  options
511 * @param {string}  options.url              The href of the link.
512 * @param {string}  options.type             The type of the link.
513 * @param {string}  options.id               The ID of the link.
514 * @param {boolean} options.opensInNewWindow Whether this link will open in a new window.
515 * @param {boolean} options.nofollow         Whether this link is marked as no follow relationship.
516 * @return {Object} The final format object.
517 */
518function createLinkFormat({
519  url,
520  type,
521  id,
522  opensInNewWindow,
523  nofollow
524}) {
525  const format = {
526    type: 'core/link',
527    attributes: {
528      url
529    }
530  };
531  if (type) format.attributes.type = type;
532  if (id) format.attributes.id = id;
533  if (opensInNewWindow) {
534    format.attributes.target = '_blank';
535    format.attributes.rel = format.attributes.rel ? format.attributes.rel + ' noreferrer noopener' : 'noreferrer noopener';
536  }
537  if (nofollow) {
538    format.attributes.rel = format.attributes.rel ? format.attributes.rel + ' nofollow' : 'nofollow';
539  }
540  return format;
541}
542
543/* eslint-disable jsdoc/no-undefined-types */
544/**
545 * Get the start and end boundaries of a given format from a rich text value.
546 *
547 *
548 * @param {RichTextValue} value      the rich text value to interrogate.
549 * @param {string}        format     the identifier for the target format (e.g. `core/link`, `core/bold`).
550 * @param {number?}       startIndex optional startIndex to seek from.
551 * @param {number?}       endIndex   optional endIndex to seek from.
552 * @return {Object}	object containing start and end values for the given format.
553 */
554/* eslint-enable jsdoc/no-undefined-types */
555function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) {
556  const EMPTY_BOUNDARIES = {
557    start: null,
558    end: null
559  };
560  const {
561    formats
562  } = value;
563  let targetFormat;
564  let initialIndex;
565  if (!formats?.length) {
566    return EMPTY_BOUNDARIES;
567  }
568
569  // Clone formats to avoid modifying source formats.
570  const newFormats = formats.slice();
571  const formatAtStart = newFormats[startIndex]?.find(({
572    type
573  }) => type === format.type);
574  const formatAtEnd = newFormats[endIndex]?.find(({
575    type
576  }) => type === format.type);
577  const formatAtEndMinusOne = newFormats[endIndex - 1]?.find(({
578    type
579  }) => type === format.type);
580  if (!!formatAtStart) {
581    // Set values to conform to "start"
582    targetFormat = formatAtStart;
583    initialIndex = startIndex;
584  } else if (!!formatAtEnd) {
585    // Set values to conform to "end"
586    targetFormat = formatAtEnd;
587    initialIndex = endIndex;
588  } else if (!!formatAtEndMinusOne) {
589    // This is an edge case which will occur if you create a format, then place
590    // the caret just before the format and hit the back ARROW key. The resulting
591    // value object will have start and end +1 beyond the edge of the format boundary.
592    targetFormat = formatAtEndMinusOne;
593    initialIndex = endIndex - 1;
594  } else {
595    return EMPTY_BOUNDARIES;
596  }
597  const index = newFormats[initialIndex].indexOf(targetFormat);
598  const walkingArgs = [newFormats, initialIndex, targetFormat, index];
599
600  // Walk the startIndex "backwards" to the leading "edge" of the matching format.
601  startIndex = walkToStart(...walkingArgs);
602
603  // Walk the endIndex "forwards" until the trailing "edge" of the matching format.
604  endIndex = walkToEnd(...walkingArgs);
605
606  // Safe guard: start index cannot be less than 0.
607  startIndex = startIndex < 0 ? 0 : startIndex;
608
609  // // Return the indicies of the "edges" as the boundaries.
610  return {
611    start: startIndex,
612    end: endIndex
613  };
614}
615
616/**
617 * Walks forwards/backwards towards the boundary of a given format within an
618 * array of format objects. Returns the index of the boundary.
619 *
620 * @param {Array}  formats         the formats to search for the given format type.
621 * @param {number} initialIndex    the starting index from which to walk.
622 * @param {Object} targetFormatRef a reference to the format type object being sought.
623 * @param {number} formatIndex     the index at which we expect the target format object to be.
624 * @param {string} direction       either 'forwards' or 'backwards' to indicate the direction.
625 * @return {number} the index of the boundary of the given format.
626 */
627function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) {
628  let index = initialIndex;
629  const directions = {
630    forwards: 1,
631    backwards: -1
632  };
633  const directionIncrement = directions[direction] || 1; // invalid direction arg default to forwards
634  const inverseDirectionIncrement = directionIncrement * -1;
635  while (formats[index] && formats[index][formatIndex] === targetFormatRef) {
636    // Increment/decrement in the direction of operation.
637    index = index + directionIncrement;
638  }
639
640  // Restore by one in inverse direction of operation
641  // to avoid out of bounds.
642  index = index + inverseDirectionIncrement;
643  return index;
644}
645const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
646const walkToStart = partialRight(walkToBoundary, 'backwards');
647const walkToEnd = partialRight(walkToBoundary, 'forwards');
648
649;// CONCATENATED MODULE: ./packages/format-library/build-module/link/use-link-instance-key.js
650// Weakly referenced map allows unused ids to be garbage collected.
651const weakMap = new WeakMap();
652
653// Incrementing zero-based ID value.
654let id = -1;
655const prefix = 'link-control-instance';
656function getKey(_id) {
657  return `${prefix}-${_id}`;
658}
659
660/**
661 * Builds a unique link control key for the given object reference.
662 *
663 * @param {Object} instance an unique object reference specific to this link control instance.
664 * @return {string | undefined} the unique key to use for this link control.
665 */
666function useLinkInstanceKey(instance) {
667  if (!instance) {
668    return;
669  }
670  if (weakMap.has(instance)) {
671    return getKey(weakMap.get(instance));
672  }
673  id += 1;
674  weakMap.set(instance, id);
675  return getKey(id);
676}
677/* harmony default export */ const use_link_instance_key = (useLinkInstanceKey);
678
679;// CONCATENATED MODULE: ./packages/format-library/build-module/link/inline.js
680
681/**
682 * WordPress dependencies
683 */
684
685
686
687
688
689
690
691
692
693/**
694 * Internal dependencies
695 */
696
697
698
699const LINK_SETTINGS = [...external_wp_blockEditor_namespaceObject.__experimentalLinkControl.DEFAULT_LINK_SETTINGS, {
700  id: 'nofollow',
701  title: (0,external_wp_i18n_namespaceObject.__)('Mark as nofollow')
702}];
703function InlineLinkUI({
704  isActive,
705  activeAttributes,
706  addingLink,
707  value,
708  onChange,
709  stopAddingLink,
710  contentRef
711}) {
712  const richLinkTextValue = getRichTextValueFromSelection(value, isActive);
713
714  // Get the text content minus any HTML tags.
715  const richTextText = richLinkTextValue.text;
716  const {
717    createPageEntity,
718    userCanCreatePages
719  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
720    const {
721      getSettings
722    } = select(external_wp_blockEditor_namespaceObject.store);
723    const _settings = getSettings();
724    return {
725      createPageEntity: _settings.__experimentalCreatePageEntity,
726      userCanCreatePages: _settings.__experimentalUserCanCreatePages
727    };
728  }, []);
729  const linkValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
730    url: activeAttributes.url,
731    type: activeAttributes.type,
732    id: activeAttributes.id,
733    opensInNewTab: activeAttributes.target === '_blank',
734    nofollow: activeAttributes.rel?.includes('nofollow'),
735    title: richTextText
736  }), [activeAttributes.id, activeAttributes.rel, activeAttributes.target, activeAttributes.type, activeAttributes.url, richTextText]);
737  function removeLink() {
738    const newValue = (0,external_wp_richText_namespaceObject.removeFormat)(value, 'core/link');
739    onChange(newValue);
740    stopAddingLink();
741    (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
742  }
743  function onChangeLink(nextValue) {
744    // LinkControl calls `onChange` immediately upon the toggling a setting.
745    // Before merging the next value with the current link value, check if
746    // the setting was toggled.
747    const didToggleSetting = linkValue.opensInNewTab !== nextValue.opensInNewTab && nextValue.url === undefined;
748    // Merge the next value with the current link value.
749    nextValue = {
750      ...linkValue,
751      ...nextValue
752    };
753    const newUrl = (0,external_wp_url_namespaceObject.prependHTTP)(nextValue.url);
754    const linkFormat = createLinkFormat({
755      url: newUrl,
756      type: nextValue.type,
757      id: nextValue.id !== undefined && nextValue.id !== null ? String(nextValue.id) : undefined,
758      opensInNewWindow: nextValue.opensInNewTab,
759      nofollow: nextValue.nofollow
760    });
761    const newText = nextValue.title || newUrl;
762    if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !isActive) {
763      // Scenario: we don't have any actively selected text or formats.
764      const toInsert = (0,external_wp_richText_namespaceObject.applyFormat)((0,external_wp_richText_namespaceObject.create)({
765        text: newText
766      }), linkFormat, 0, newText.length);
767      onChange((0,external_wp_richText_namespaceObject.insert)(value, toInsert));
768    } else {
769      // Scenario: we have any active text selection or an active format.
770      let newValue;
771      if (newText === richTextText) {
772        // If we're not updating the text then ignore.
773        newValue = (0,external_wp_richText_namespaceObject.applyFormat)(value, linkFormat);
774      } else {
775        // Create new RichText value for the new text in order that we
776        // can apply formats to it.
777        newValue = (0,external_wp_richText_namespaceObject.create)({
778          text: newText
779        });
780
781        // Apply the new Link format to this new text value.
782        newValue = (0,external_wp_richText_namespaceObject.applyFormat)(newValue, linkFormat, 0, newText.length);
783
784        // Get the boundaries of the active link format.
785        const boundary = getFormatBoundary(value, {
786          type: 'core/link'
787        });
788
789        // Split the value at the start of the active link format.
790        // Passing "start" as the 3rd parameter is required to ensure
791        // the second half of the split value is split at the format's
792        // start boundary and avoids relying on the value's "end" property
793        // which may not correspond correctly.
794        const [valBefore, valAfter] = (0,external_wp_richText_namespaceObject.split)(value, boundary.start, boundary.start);
795
796        // Update the original (full) RichTextValue replacing the
797        // target text with the *new* RichTextValue containing:
798        // 1. The new text content.
799        // 2. The new link format.
800        // As "replace" will operate on the first match only, it is
801        // run only against the second half of the value which was
802        // split at the active format's boundary. This avoids a bug
803        // with incorrectly targetted replacements.
804        // See: https://github.com/WordPress/gutenberg/issues/41771.
805        // Note original formats will be lost when applying this change.
806        // That is expected behaviour.
807        // See: https://github.com/WordPress/gutenberg/pull/33849#issuecomment-936134179.
808        const newValAfter = (0,external_wp_richText_namespaceObject.replace)(valAfter, richTextText, newValue);
809        newValue = (0,external_wp_richText_namespaceObject.concat)(valBefore, newValAfter);
810      }
811      newValue.start = newValue.end;
812
813      // Hides the Link UI.
814      newValue.activeFormats = [];
815      onChange(newValue);
816    }
817
818    // Focus should only be shifted back to the formatted segment when the
819    // URL is submitted.
820    if (!didToggleSetting) {
821      stopAddingLink();
822    }
823    if (!isValidHref(newUrl)) {
824      (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');
825    } else if (isActive) {
826      (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link edited.'), 'assertive');
827    } else {
828      (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link inserted.'), 'assertive');
829    }
830  }
831  const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
832    editableContentElement: contentRef.current,
833    settings: build_module_link_link
834  });
835
836  // Generate a string based key that is unique to this anchor reference.
837  // This is used to force re-mount the LinkControl component to avoid
838  // potential stale state bugs caused by the component not being remounted
839  // See https://github.com/WordPress/gutenberg/pull/34742.
840  const forceRemountKey = use_link_instance_key(popoverAnchor);
841
842  // Focus should only be moved into the Popover when the Link is being created or edited.
843  // When the Link is in "preview" mode focus should remain on the rich text because at
844  // this point the Link dialog is informational only and thus the user should be able to
845  // continue editing the rich text.
846  // Ref used because the focusOnMount prop shouldn't evolve during render of a Popover
847  // otherwise it causes a render of the content.
848  const focusOnMount = (0,external_wp_element_namespaceObject.useRef)(addingLink ? 'firstElement' : false);
849  async function handleCreate(pageTitle) {
850    const page = await createPageEntity({
851      title: pageTitle,
852      status: 'draft'
853    });
854    return {
855      id: page.id,
856      type: page.type,
857      title: page.title.rendered,
858      url: page.link,
859      kind: 'post-type'
860    };
861  }
862  function createButtonText(searchTerm) {
863    return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */
864    (0,external_wp_i18n_namespaceObject.__)('Create page: <mark>%s</mark>'), searchTerm), {
865      mark: (0,external_wp_element_namespaceObject.createElement)("mark", null)
866    });
867  }
868  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
869    anchor: popoverAnchor,
870    focusOnMount: focusOnMount.current,
871    onClose: stopAddingLink,
872    onFocusOutside: () => stopAddingLink(false),
873    placement: "bottom",
874    shift: true
875  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, {
876    key: forceRemountKey,
877    value: linkValue,
878    onChange: onChangeLink,
879    onRemove: removeLink,
880    forceIsEditingLink: addingLink,
881    hasRichPreviews: true,
882    createSuggestion: createPageEntity && handleCreate,
883    withCreateSuggestion: userCanCreatePages,
884    createSuggestionButtonText: createButtonText,
885    hasTextControl: true,
886    settings: LINK_SETTINGS
887  }));
888}
889function getRichTextValueFromSelection(value, isActive) {
890  // Default to the selection ranges on the RichTextValue object.
891  let textStart = value.start;
892  let textEnd = value.end;
893
894  // If the format is currently active then the rich text value
895  // should always be taken from the bounds of the active format
896  // and not the selected text.
897  if (isActive) {
898    const boundary = getFormatBoundary(value, {
899      type: 'core/link'
900    });
901    textStart = boundary.start;
902
903    // Text *selection* always extends +1 beyond the edge of the format.
904    // We account for that here.
905    textEnd = boundary.end + 1;
906  }
907
908  // Get a RichTextValue containing the selected text content.
909  return (0,external_wp_richText_namespaceObject.slice)(value, textStart, textEnd);
910}
911/* harmony default export */ const inline = (InlineLinkUI);
912
913;// CONCATENATED MODULE: ./packages/format-library/build-module/link/index.js
914
915/**
916 * WordPress dependencies
917 */
918
919
920
921
922
923
924
925
926
927/**
928 * Internal dependencies
929 */
930
931
932const link_name = 'core/link';
933const link_title = (0,external_wp_i18n_namespaceObject.__)('Link');
934function link_Edit({
935  isActive,
936  activeAttributes,
937  value,
938  onChange,
939  onFocus,
940  contentRef
941}) {
942  const [addingLink, setAddingLink] = (0,external_wp_element_namespaceObject.useState)(false);
943  function addLink() {
944    const text = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(value));
945    if (text && (0,external_wp_url_namespaceObject.isURL)(text) && isValidHref(text)) {
946      onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
947        type: link_name,
948        attributes: {
949          url: text
950        }
951      }));
952    } else if (text && (0,external_wp_url_namespaceObject.isEmail)(text)) {
953      onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
954        type: link_name,
955        attributes: {
956          url: `mailto:${text}`
957        }
958      }));
959    } else {
960      setAddingLink(true);
961    }
962  }
963  function stopAddingLink(returnFocus = true) {
964    setAddingLink(false);
965    if (returnFocus) {
966      onFocus();
967    }
968  }
969  function onRemoveFormat() {
970    onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, link_name));
971    (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
972  }
973  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
974    type: "primary",
975    character: "k",
976    onUse: addLink
977  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
978    type: "primaryShift",
979    character: "k",
980    onUse: onRemoveFormat
981  }), isActive && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
982    name: "link",
983    icon: link_off,
984    title: (0,external_wp_i18n_namespaceObject.__)('Unlink'),
985    onClick: onRemoveFormat,
986    isActive: isActive,
987    shortcutType: "primaryShift",
988    shortcutCharacter: "k",
989    "aria-haspopup": "true",
990    "aria-expanded": addingLink || isActive
991  }), !isActive && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
992    name: "link",
993    icon: library_link,
994    title: link_title,
995    onClick: addLink,
996    isActive: isActive,
997    shortcutType: "primary",
998    shortcutCharacter: "k",
999    "aria-haspopup": "true",
1000    "aria-expanded": addingLink || isActive
1001  }), (addingLink || isActive) && (0,external_wp_element_namespaceObject.createElement)(inline, {
1002    addingLink: addingLink,
1003    stopAddingLink: stopAddingLink,
1004    isActive: isActive,
1005    activeAttributes: activeAttributes,
1006    value: value,
1007    onChange: onChange,
1008    contentRef: contentRef
1009  }));
1010}
1011const build_module_link_link = {
1012  name: link_name,
1013  title: link_title,
1014  tagName: 'a',
1015  className: null,
1016  attributes: {
1017    url: 'href',
1018    type: 'data-type',
1019    id: 'data-id',
1020    target: 'target',
1021    rel: 'rel'
1022  },
1023  __unstablePasteRule(value, {
1024    html,
1025    plainText
1026  }) {
1027    if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
1028      return value;
1029    }
1030    const pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim();
1031
1032    // A URL was pasted, turn the selection into a link.
1033    if (!(0,external_wp_url_namespaceObject.isURL)(pastedText)) {
1034      return value;
1035    }
1036
1037    // Allows us to ask for this information when we get a report.
1038    window.console.log('Created link:\n\n', pastedText);
1039    return (0,external_wp_richText_namespaceObject.applyFormat)(value, {
1040      type: link_name,
1041      attributes: {
1042        url: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(pastedText)
1043      }
1044    });
1045  },
1046  edit: link_Edit
1047};
1048
1049;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-strikethrough.js
1050
1051/**
1052 * WordPress dependencies
1053 */
1054
1055const formatStrikethrough = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1056  xmlns: "http://www.w3.org/2000/svg",
1057  viewBox: "0 0 24 24"
1058}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1059  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-.
10596-.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"
1060}));
1061/* harmony default export */ const format_strikethrough = (formatStrikethrough);
1062
1063;// CONCATENATED MODULE: ./packages/format-library/build-module/strikethrough/index.js
1064
1065/**
1066 * WordPress dependencies
1067 */
1068
1069
1070
1071
1072const strikethrough_name = 'core/strikethrough';
1073const strikethrough_title = (0,external_wp_i18n_namespaceObject.__)('Strikethrough');
1074const strikethrough = {
1075  name: strikethrough_name,
1076  title: strikethrough_title,
1077  tagName: 's',
1078  className: null,
1079  edit({
1080    isActive,
1081    value,
1082    onChange,
1083    onFocus
1084  }) {
1085    function onClick() {
1086      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1087        type: strikethrough_name,
1088        title: strikethrough_title
1089      }));
1090      onFocus();
1091    }
1092    return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1093      type: "access",
1094      character: "d",
1095      onUse: onClick
1096    }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1097      icon: format_strikethrough,
1098      title: strikethrough_title,
1099      onClick: onClick,
1100      isActive: isActive,
1101      role: "menuitemcheckbox"
1102    }));
1103  }
1104};
1105
1106;// CONCATENATED MODULE: ./packages/format-library/build-module/underline/index.js
1107
1108/**
1109 * WordPress dependencies
1110 */
1111
1112
1113
1114const underline_name = 'core/underline';
1115const underline_title = (0,external_wp_i18n_namespaceObject.__)('Underline');
1116const underline = {
1117  name: underline_name,
1118  title: underline_title,
1119  tagName: 'span',
1120  className: null,
1121  attributes: {
1122    style: 'style'
1123  },
1124  edit({
1125    value,
1126    onChange
1127  }) {
1128    const onToggle = () => {
1129      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1130        type: underline_name,
1131        attributes: {
1132          style: 'text-decoration: underline;'
1133        },
1134        title: underline_title
1135      }));
1136    };
1137    return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1138      type: "primary",
1139      character: "u",
1140      onUse: onToggle
1141    }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
1142      inputType: "formatUnderline",
1143      onInput: onToggle
1144    }));
1145  }
1146};
1147
1148;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
1149/**
1150 * WordPress dependencies
1151 */
1152
1153
1154/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
1155
1156/**
1157 * Return an SVG icon.
1158 *
1159 * @param {IconProps}                                 props icon is the SVG component to render
1160 *                                                          size is a number specifiying the icon size in pixels
1161 *                                                          Other props will be passed to wrapped SVG component
1162 * @param {import('react').ForwardedRef<HTMLElement>} ref   The forwarded ref to the SVG element.
1163 *
1164 * @return {JSX.Element}  Icon component
1165 */
1166function Icon({
1167  icon,
1168  size = 24,
1169  ...props
1170}, ref) {
1171  return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
1172    width: size,
1173    height: size,
1174    ...props,
1175    ref
1176  });
1177}
1178/* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
1179
1180;// CONCATENATED MODULE: ./packages/icons/build-module/library/text-color.js
1181
1182/**
1183 * WordPress dependencies
1184 */
1185
1186const textColor = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1187  xmlns: "http://www.w3.org/2000/svg",
1188  viewBox: "0 0 24 24"
1189}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1190  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"
1191}));
1192/* harmony default export */ const text_color = (textColor);
1193
1194;// CONCATENATED MODULE: ./packages/icons/build-module/library/color.js
1195
1196/**
1197 * WordPress dependencies
1198 */
1199
1200const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1201  viewBox: "0 0 24 24",
1202  xmlns: "http://www.w3.org/2000/svg"
1203}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1204  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"
1205}));
1206/* harmony default export */ const library_color = (color);
1207
1208;// CONCATENATED MODULE: ./packages/format-library/build-module/text-color/inline.js
1209
1210/**
1211 * WordPress dependencies
1212 */
1213
1214
1215
1216
1217
1218
1219
1220/**
1221 * Internal dependencies
1222 */
1223
1224function parseCSS(css = '') {
1225  return css.split(';').reduce((accumulator, rule) => {
1226    if (rule) {
1227      const [property, value] = rule.split(':');
1228      if (property === 'color') accumulator.color = value;
1229      if (property === 'background-color' && value !== transparentValue) accumulator.backgroundColor = value;
1230    }
1231    return accumulator;
1232  }, {});
1233}
1234function parseClassName(className = '', colorSettings) {
1235  return className.split(' ').reduce((accumulator, name) => {
1236    // `colorSlug` could contain dashes, so simply match the start and end.
1237    if (name.startsWith('has-') && name.endsWith('-color')) {
1238      const colorSlug = name.replace(/^has-/, '').replace(/-color$/, '');
1239      const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues)(colorSettings, colorSlug);
1240      accumulator.color = colorObject.color;
1241    }
1242    return accumulator;
1243  }, {});
1244}
1245function getActiveColors(value, name, colorSettings) {
1246  const activeColorFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name);
1247  if (!activeColorFormat) {
1248    return {};
1249  }
1250  return {
1251    ...parseCSS(activeColorFormat.attributes.style),
1252    ...parseClassName(activeColorFormat.attributes.class, colorSettings)
1253  };
1254}
1255function setColors(value, name, colorSettings, colors) {
1256  const {
1257    color,
1258    backgroundColor
1259  } = {
1260    ...getActiveColors(value, name, colorSettings),
1261    ...colors
1262  };
1263  if (!color && !backgroundColor) {
1264    return (0,external_wp_richText_namespaceObject.removeFormat)(value, name);
1265  }
1266  const styles = [];
1267  const classNames = [];
1268  const attributes = {};
1269  if (backgroundColor) {
1270    styles.push(['background-color', backgroundColor].join(':'));
1271  } else {
1272    // Override default browser color for mark element.
1273    styles.push(['background-color', transparentValue].join(':'));
1274  }
1275  if (color) {
1276    const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByColorValue)(colorSettings, color);
1277    if (colorObject) {
1278      classNames.push((0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', colorObject.slug));
1279    } else {
1280      styles.push(['color', color].join(':'));
1281    }
1282  }
1283  if (styles.length) attributes.style = styles.join(';');
1284  if (classNames.length) attributes.class = classNames.join(' ');
1285  return (0,external_wp_richText_namespaceObject.applyFormat)(value, {
1286    type: name,
1287    attributes
1288  });
1289}
1290function ColorPicker({
1291  name,
1292  property,
1293  value,
1294  onChange
1295}) {
1296  const colors = (0,external_wp_data_namespaceObject.useSelect)(select => {
1297    var _getSettings$colors;
1298    const {
1299      getSettings
1300    } = select(external_wp_blockEditor_namespaceObject.store);
1301    return (_getSettings$colors = getSettings().colors) !== null && _getSettings$colors !== void 0 ? _getSettings$colors : [];
1302  }, []);
1303  const onColorChange = (0,external_wp_element_namespaceObject.useCallback)(color => {
1304    onChange(setColors(value, name, colors, {
1305      [property]: color
1306    }));
1307  }, [colors, onChange, property]);
1308  const activeColors = (0,external_wp_element_namespaceObject.useMemo)(() => getActiveColors(value, name, colors), [name, value, colors]);
1309  return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ColorPalette, {
1310    value: activeColors[property],
1311    onChange: onColorChange
1312  });
1313}
1314function InlineColorUI({
1315  name,
1316  value,
1317  onChange,
1318  onClose,
1319  contentRef
1320}) {
1321  const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
1322    editableContentElement: contentRef.current,
1323    settings: text_color_textColor
1324  });
1325
1326  /*
1327   As you change the text color by typing a HEX value into a field,
1328   the return value of document.getSelection jumps to the field you're editing,
1329   not the highlighted text. Given that useAnchor uses document.getSelection,
1330   it will return null, since it can't find the <mark> element within the HEX input.
1331   This caches the last truthy value of the selection anchor reference.
1332   */
1333  const cachedRect = (0,external_wp_blockEditor_namespaceObject.useCachedTruthy)(popoverAnchor.getBoundingClientRect());
1334  popoverAnchor.getBoundingClientRect = () => cachedRect;
1335  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
1336    onClose: onClose,
1337    className: "components-inline-color-popover",
1338    anchor: popoverAnchor
1339  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
1340    tabs: [{
1341      name: 'color',
1342      title: (0,external_wp_i18n_namespaceObject.__)('Text')
1343    }, {
1344      name: 'backgroundColor',
1345      title: (0,external_wp_i18n_namespaceObject.__)('Background')
1346    }]
1347  }, tab => (0,external_wp_element_namespaceObject.createElement)(ColorPicker, {
1348    name: name,
1349    property: tab.name,
1350    value: value,
1351    onChange: onChange
1352  })));
1353}
1354
1355;// CONCATENATED MODULE: ./packages/format-library/build-module/text-color/index.js
1356
1357/**
1358 * WordPress dependencies
1359 */
1360
1361
1362
1363
1364
1365
1366/**
1367 * Internal dependencies
1368 */
1369
1370const transparentValue = 'rgba(0, 0, 0, 0)';
1371const text_color_name = 'core/text-color';
1372const text_color_title = (0,external_wp_i18n_namespaceObject.__)('Highlight');
1373const EMPTY_ARRAY = [];
1374function getComputedStyleProperty(element, property) {
1375  const {
1376    ownerDocument
1377  } = element;
1378  const {
1379    defaultView
1380  } = ownerDocument;
1381  const style = defaultView.getComputedStyle(element);
1382  const value = style.getPropertyValue(property);
1383  if (property === 'background-color' && value === transparentValue && element.parentElement) {
1384    return getComputedStyleProperty(element.parentElement, property);
1385  }
1386  return value;
1387}
1388function fillComputedColors(element, {
1389  color,
1390  backgroundColor
1391}) {
1392  if (!color && !backgroundColor) {
1393    return;
1394  }
1395  return {
1396    color: color || getComputedStyleProperty(element, 'color'),
1397    backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, 'background-color') : backgroundColor
1398  };
1399}
1400function TextColorEdit({
1401  value,
1402  onChange,
1403  isActive,
1404  activeAttributes,
1405  contentRef
1406}) {
1407  const allowCustomControl = (0,external_wp_blockEditor_namespaceObject.useSetting)('color.custom');
1408  const colors = (0,external_wp_blockEditor_namespaceObject.useSetting)('color.palette') || EMPTY_ARRAY;
1409  const [isAddingColor, setIsAddingColor] = (0,external_wp_element_namespaceObject.useState)(false);
1410  const enableIsAddingColor = (0,external_wp_element_namespaceObject.useCallback)(() => setIsAddingColor(true), [setIsAddingColor]);
1411  const disableIsAddingColor = (0,external_wp_element_namespaceObject.useCallback)(() => setIsAddingColor(false), [setIsAddingColor]);
1412  const colorIndicatorStyle = (0,external_wp_element_namespaceObject.useMemo)(() => fillComputedColors(contentRef.current, getActiveColors(value, text_color_name, colors)), [value, colors]);
1413  const hasColorsToChoose = colors.length || !allowCustomControl;
1414  if (!hasColorsToChoose && !isActive) {
1415    return null;
1416  }
1417  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1418    className: "format-library-text-color-button",
1419    isActive: isActive,
1420    icon: (0,external_wp_element_namespaceObject.createElement)(icon, {
1421      icon: Object.keys(activeAttributes).length ? text_color : library_color,
1422      style: colorIndicatorStyle
1423    }),
1424    title: text_color_title
1425    // If has no colors to choose but a color is active remove the color onClick.
1426    ,
1427    onClick: hasColorsToChoose ? enableIsAddingColor : () => onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, text_color_name)),
1428    role: "menuitemcheckbox"
1429  }), isAddingColor && (0,external_wp_element_namespaceObject.createElement)(InlineColorUI, {
1430    name: text_color_name,
1431    onClose: disableIsAddingColor,
1432    activeAttributes: activeAttributes,
1433    value: value,
1434    onChange: onChange,
1435    contentRef: contentRef
1436  }));
1437}
1438const text_color_textColor = {
1439  name: text_color_name,
1440  title: text_color_title,
1441  tagName: 'mark',
1442  className: 'has-inline-color',
1443  attributes: {
1444    style: 'style',
1445    class: 'class'
1446  },
1447  /*
1448   * Since this format relies on the <mark> tag, it's important to
1449   * prevent the default yellow background color applied by most
1450   * browsers. The solution is to detect when this format is used with a
1451   * text color but no background color, and in such cases to override
1452   * the default styling with a transparent background.
1453   *
1454   * @see https://github.com/WordPress/gutenberg/pull/35516
1455   */
1456  __unstableFilterAttributeValue(key, value) {
1457    if (key !== 'style') return value;
1458    // We should not add a background-color if it's already set.
1459    if (value && value.includes('background-color')) return value;
1460    const addedCSS = ['background-color', transparentValue].join(':');
1461    // Prepend `addedCSS` to avoid a double `;;` as any the existing CSS
1462    // rules will already include a `;`.
1463    return value ? [addedCSS, value].join(';') : addedCSS;
1464  },
1465  edit: TextColorEdit
1466};
1467
1468;// CONCATENATED MODULE: ./packages/icons/build-module/library/subscript.js
1469
1470/**
1471 * WordPress dependencies
1472 */
1473
1474const subscript = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1475  xmlns: "http://www.w3.org/2000/svg",
1476  viewBox: "0 0 24 24"
1477}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1478  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-.
14781-.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"
1479}));
1480/* harmony default export */ const library_subscript = (subscript);
1481
1482;// CONCATENATED MODULE: ./packages/format-library/build-module/subscript/index.js
1483
1484/**
1485 * WordPress dependencies
1486 */
1487
1488
1489
1490
1491const subscript_name = 'core/subscript';
1492const subscript_title = (0,external_wp_i18n_namespaceObject.__)('Subscript');
1493const subscript_subscript = {
1494  name: subscript_name,
1495  title: subscript_title,
1496  tagName: 'sub',
1497  className: null,
1498  edit({
1499    isActive,
1500    value,
1501    onChange,
1502    onFocus
1503  }) {
1504    function onToggle() {
1505      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1506        type: subscript_name,
1507        title: subscript_title
1508      }));
1509    }
1510    function onClick() {
1511      onToggle();
1512      onFocus();
1513    }
1514    return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1515      icon: library_subscript,
1516      title: subscript_title,
1517      onClick: onClick,
1518      isActive: isActive,
1519      role: "menuitemcheckbox"
1520    });
1521  }
1522};
1523
1524;// CONCATENATED MODULE: ./packages/icons/build-module/library/superscript.js
1525
1526/**
1527 * WordPress dependencies
1528 */
1529
1530const superscript = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1531  xmlns: "http://www.w3.org/2000/svg",
1532  viewBox: "0 0 24 24"
1533}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1534  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"
1535}));
1536/* harmony default export */ const library_superscript = (superscript);
1537
1538;// CONCATENATED MODULE: ./packages/format-library/build-module/superscript/index.js
1539
1540/**
1541 * WordPress dependencies
1542 */
1543
1544
1545
1546
1547const superscript_name = 'core/superscript';
1548const superscript_title = (0,external_wp_i18n_namespaceObject.__)('Superscript');
1549const superscript_superscript = {
1550  name: superscript_name,
1551  title: superscript_title,
1552  tagName: 'sup',
1553  className: null,
1554  edit({
1555    isActive,
1556    value,
1557    onChange,
1558    onFocus
1559  }) {
1560    function onToggle() {
1561      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1562        type: superscript_name,
1563        title: superscript_title
1564      }));
1565    }
1566    function onClick() {
1567      onToggle();
1568      onFocus();
1569    }
1570    return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1571      icon: library_superscript,
1572      title: superscript_title,
1573      onClick: onClick,
1574      isActive: isActive,
1575      role: "menuitemcheckbox"
1576    });
1577  }
1578};
1579
1580;// CONCATENATED MODULE: ./packages/icons/build-module/library/button.js
1581
1582/**
1583 * WordPress dependencies
1584 */
1585
1586const button_button = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1587  viewBox: "0 0 24 24",
1588  xmlns: "http://www.w3.org/2000/svg"
1589}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1590  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"
1591}));
1592/* harmony default export */ const library_button = (button_button);
1593
1594;// CONCATENATED MODULE: ./packages/format-library/build-module/keyboard/index.js
1595
1596/**
1597 * WordPress dependencies
1598 */
1599
1600
1601
1602
1603const keyboard_name = 'core/keyboard';
1604const keyboard_title = (0,external_wp_i18n_namespaceObject.__)('Keyboard input');
1605const keyboard = {
1606  name: keyboard_name,
1607  title: keyboard_title,
1608  tagName: 'kbd',
1609  className: null,
1610  edit({
1611    isActive,
1612    value,
1613    onChange,
1614    onFocus
1615  }) {
1616    function onToggle() {
1617      onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
1618        type: keyboard_name,
1619        title: keyboard_title
1620      }));
1621    }
1622    function onClick() {
1623      onToggle();
1624      onFocus();
1625    }
1626    return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1627      icon: library_button,
1628      title: keyboard_title,
1629      onClick: onClick,
1630      isActive: isActive,
1631      role: "menuitemcheckbox"
1632    });
1633  }
1634};
1635
1636;// CONCATENATED MODULE: ./packages/icons/build-module/library/help.js
1637
1638/**
1639 * WordPress dependencies
1640 */
1641
1642const help = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1643  xmlns: "http://www.w3.org/2000/svg",
1644  viewBox: "0 0 24 24"
1645}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1646  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"
1647}));
1648/* harmony default export */ const library_help = (help);
1649
1650;// CONCATENATED MODULE: ./packages/format-library/build-module/unknown/index.js
1651
1652/**
1653 * WordPress dependencies
1654 */
1655
1656
1657
1658
1659const unknown_name = 'core/unknown';
1660const unknown_title = (0,external_wp_i18n_namespaceObject.__)('Clear Unknown Formatting');
1661const unknown = {
1662  name: unknown_name,
1663  title: unknown_title,
1664  tagName: '*',
1665  className: null,
1666  edit({
1667    isActive,
1668    value,
1669    onChange,
1670    onFocus
1671  }) {
1672    function onClick() {
1673      onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, unknown_name));
1674      onFocus();
1675    }
1676    const selectedValue = (0,external_wp_richText_namespaceObject.slice)(value);
1677    const hasUnknownFormats = selectedValue.formats.some(formats => {
1678      return formats.some(format => format.type === unknown_name);
1679    });
1680    if (!isActive && !hasUnknownFormats) {
1681      return null;
1682    }
1683    return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1684      name: "unknown",
1685      icon: library_help,
1686      title: unknown_title,
1687      onClick: onClick,
1688      isActive: true
1689    });
1690  }
1691};
1692
1693;// CONCATENATED MODULE: ./packages/icons/build-module/library/language.js
1694
1695/**
1696 * WordPress dependencies
1697 */
1698
1699const language = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1700  xmlns: "http://www.w3.org/2000/svg",
1701  viewBox: "0 0 24 24"
1702}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1703  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"
1704}));
1705/* harmony default export */ const library_language = (language);
1706
1707;// CONCATENATED MODULE: ./packages/format-library/build-module/language/index.js
1708
1709/**
1710 * WordPress dependencies
1711 */
1712
1713
1714/**
1715 * WordPress dependencies
1716 */
1717
1718
1719
1720
1721
1722const language_name = 'core/language';
1723const language_title = (0,external_wp_i18n_namespaceObject.__)('Language');
1724const language_language = {
1725  name: language_name,
1726  tagName: 'bdo',
1727  className: null,
1728  edit: language_Edit,
1729  title: language_title
1730};
1731function language_Edit({
1732  isActive,
1733  value,
1734  onChange,
1735  contentRef
1736}) {
1737  const [isPopoverVisible, setIsPopoverVisible] = (0,external_wp_element_namespaceObject.useState)(false);
1738  const togglePopover = () => {
1739    setIsPopoverVisible(state => !state);
1740  };
1741  return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1742    icon: library_language,
1743    label: language_title,
1744    title: language_title,
1745    onClick: () => {
1746      if (isActive) {
1747        onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, language_name));
1748      } else {
1749        togglePopover();
1750      }
1751    },
1752    isActive: isActive,
1753    role: "menuitemcheckbox"
1754  }), isPopoverVisible && (0,external_wp_element_namespaceObject.createElement)(InlineLanguageUI, {
1755    value: value,
1756    onChange: onChange,
1757    onClose: togglePopover,
1758    contentRef: contentRef
1759  }));
1760}
1761function InlineLanguageUI({
1762  value,
1763  contentRef,
1764  onChange,
1765  onClose
1766}) {
1767  const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
1768    editableContentElement: contentRef.current,
1769    settings: language_language
1770  });
1771  const [lang, setLang] = (0,external_wp_element_namespaceObject.useState)('');
1772  const [dir, setDir] = (0,external_wp_element_namespaceObject.useState)('ltr');
1773  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
1774    className: "block-editor-format-toolbar__language-popover",
1775    anchor: popoverAnchor,
1776    onClose: onClose
1777  }, (0,external_wp_element_namespaceObject.createElement)("form", {
1778    className: "block-editor-format-toolbar__language-container-content",
1779    onSubmit: event => {
1780      event.preventDefault();
1781      onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
1782        type: language_name,
1783        attributes: {
1784          lang,
1785          dir
1786        }
1787      }));
1788      onClose();
1789    }
1790  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
1791    label: language_title,
1792    value: lang,
1793    onChange: val => setLang(val),
1794    help: (0,external_wp_i18n_namespaceObject.__)('A valid language attribute, like "en" or "fr".')
1795  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
1796    label: (0,external_wp_i18n_namespaceObject.__)('Text direction'),
1797    value: dir,
1798    options: [{
1799      label: (0,external_wp_i18n_namespaceObject.__)('Left to right'),
1800      value: 'ltr'
1801    }, {
1802      label: (0,external_wp_i18n_namespaceObject.__)('Right to left'),
1803      value: 'rtl'
1804    }],
1805    onChange: val => setDir(val)
1806  }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
1807    alignment: "right"
1808  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
1809    variant: "primary",
1810    type: "submit",
1811    text: (0,external_wp_i18n_namespaceObject.__)('Apply')
1812  }))));
1813}
1814
1815;// CONCATENATED MODULE: ./packages/format-library/build-module/default-formats.js
1816/**
1817 * Internal dependencies
1818 */
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832/* 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]);
1833
1834;// CONCATENATED MODULE: ./packages/format-library/build-module/index.js
1835/**
1836 * WordPress dependencies
1837 */
1838
1839
1840/**
1841 * Internal dependencies
1842 */
1843
1844default_formats.forEach(({
1845  name,
1846  ...settings
1847}) => (0,external_wp_richText_namespaceObject.registerFormatType)(name, settings));
1848
1849(window.wp = window.wp || {}).formatLibrary = __webpack_exports__;
1850/******/ })()
1851;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.