@wordpress/format-library 5.32.0 → 5.32.1-next.ff1cebbba.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/build/bold/index.js +69 -58
  2. package/build/bold/index.js.map +7 -1
  3. package/build/code/index.js +62 -54
  4. package/build/code/index.js.map +7 -1
  5. package/build/default-formats.js +52 -24
  6. package/build/default-formats.js.map +7 -1
  7. package/build/image/index.js +185 -153
  8. package/build/image/index.js.map +7 -1
  9. package/build/index.js +28 -18
  10. package/build/index.js.map +7 -1
  11. package/build/italic/index.js +69 -58
  12. package/build/italic/index.js.map +7 -1
  13. package/build/keyboard/index.js +47 -36
  14. package/build/keyboard/index.js.map +7 -1
  15. package/build/language/index.js +145 -113
  16. package/build/language/index.js.map +7 -1
  17. package/build/link/css-classes-setting.js +81 -0
  18. package/build/link/css-classes-setting.js.map +7 -0
  19. package/build/link/index.js +162 -167
  20. package/build/link/index.js.map +7 -1
  21. package/build/link/inline.js +186 -174
  22. package/build/link/inline.js.map +7 -1
  23. package/build/link/use-link-instance-key.js +25 -19
  24. package/build/link/use-link-instance-key.js.map +7 -1
  25. package/build/link/utils.js +66 -115
  26. package/build/link/utils.js.map +7 -1
  27. package/build/lock-unlock.js +31 -15
  28. package/build/lock-unlock.js.map +7 -1
  29. package/build/non-breaking-space/index.js +44 -28
  30. package/build/non-breaking-space/index.js.map +7 -1
  31. package/build/strikethrough/index.js +57 -42
  32. package/build/strikethrough/index.js.map +7 -1
  33. package/build/subscript/index.js +47 -36
  34. package/build/subscript/index.js.map +7 -1
  35. package/build/superscript/index.js +47 -36
  36. package/build/superscript/index.js.map +7 -1
  37. package/build/text-color/index.js +102 -70
  38. package/build/text-color/index.js.map +7 -1
  39. package/build/text-color/inline.js +118 -116
  40. package/build/text-color/inline.js.map +7 -1
  41. package/build/underline/index.js +62 -40
  42. package/build/underline/index.js.map +7 -1
  43. package/build/unknown/index.js +51 -37
  44. package/build/unknown/index.js.map +7 -1
  45. package/build-module/bold/index.js +52 -52
  46. package/build-module/bold/index.js.map +7 -1
  47. package/build-module/code/index.js +41 -46
  48. package/build-module/code/index.js.map +7 -1
  49. package/build-module/default-formats.js +34 -19
  50. package/build-module/default-formats.js.map +7 -1
  51. package/build-module/image/index.js +174 -144
  52. package/build-module/image/index.js.map +7 -1
  53. package/build-module/index.js +6 -14
  54. package/build-module/index.js.map +7 -1
  55. package/build-module/italic/index.js +52 -52
  56. package/build-module/italic/index.js.map +7 -1
  57. package/build-module/keyboard/index.js +25 -30
  58. package/build-module/keyboard/index.js.map +7 -1
  59. package/build-module/language/index.js +128 -105
  60. package/build-module/language/index.js.map +7 -1
  61. package/build-module/link/css-classes-setting.js +67 -0
  62. package/build-module/link/css-classes-setting.js.map +7 -0
  63. package/build-module/link/index.js +128 -146
  64. package/build-module/link/index.js.map +7 -1
  65. package/build-module/link/inline.js +158 -154
  66. package/build-module/link/inline.js.map +7 -1
  67. package/build-module/link/use-link-instance-key.js +7 -14
  68. package/build-module/link/use-link-instance-key.js.map +7 -1
  69. package/build-module/link/utils.js +46 -101
  70. package/build-module/link/utils.js.map +7 -1
  71. package/build-module/lock-unlock.js +8 -7
  72. package/build-module/lock-unlock.js.map +7 -1
  73. package/build-module/non-breaking-space/index.js +22 -22
  74. package/build-module/non-breaking-space/index.js.map +7 -1
  75. package/build-module/strikethrough/index.js +38 -36
  76. package/build-module/strikethrough/index.js.map +7 -1
  77. package/build-module/subscript/index.js +25 -30
  78. package/build-module/subscript/index.js.map +7 -1
  79. package/build-module/superscript/index.js +25 -30
  80. package/build-module/superscript/index.js.map +7 -1
  81. package/build-module/text-color/index.js +72 -61
  82. package/build-module/text-color/index.js.map +7 -1
  83. package/build-module/text-color/inline.js +107 -106
  84. package/build-module/text-color/inline.js.map +7 -1
  85. package/build-module/underline/index.js +43 -34
  86. package/build-module/underline/index.js.map +7 -1
  87. package/build-module/unknown/index.js +26 -28
  88. package/build-module/unknown/index.js.map +7 -1
  89. package/build-style/style-rtl.css +0 -194
  90. package/build-style/style.css +0 -194
  91. package/package.json +21 -15
  92. package/src/image/style.scss +3 -0
  93. package/src/link/css-classes-setting.js +89 -0
  94. package/src/link/index.js +1 -0
  95. package/src/link/inline.js +19 -0
  96. package/src/link/style.scss +3 -0
  97. package/src/link/test/css-classes-setting.js +144 -0
  98. package/src/link/utils.js +8 -0
  99. package/src/style.scss +4 -4
  100. package/src/text-color/style.scss +2 -0
  101. package/build/default-formats.native.js +0 -16
  102. package/build/default-formats.native.js.map +0 -1
  103. package/build/link/index.native.js +0 -174
  104. package/build/link/index.native.js.map +0 -1
  105. package/build/link/modal-screens/link-picker-screen.native.js +0 -67
  106. package/build/link/modal-screens/link-picker-screen.native.js.map +0 -1
  107. package/build/link/modal-screens/link-settings-screen.native.js +0 -226
  108. package/build/link/modal-screens/link-settings-screen.native.js.map +0 -1
  109. package/build/link/modal-screens/screens.native.js +0 -11
  110. package/build/link/modal-screens/screens.native.js.map +0 -1
  111. package/build/link/modal.native.js +0 -53
  112. package/build/link/modal.native.js.map +0 -1
  113. package/build/text-color/index.native.js +0 -134
  114. package/build/text-color/index.native.js.map +0 -1
  115. package/build/text-color/inline.native.js +0 -150
  116. package/build/text-color/inline.native.js.map +0 -1
  117. package/build-module/default-formats.native.js +0 -10
  118. package/build-module/default-formats.native.js.map +0 -1
  119. package/build-module/link/index.native.js +0 -166
  120. package/build-module/link/index.native.js.map +0 -1
  121. package/build-module/link/modal-screens/link-picker-screen.native.js +0 -59
  122. package/build-module/link/modal-screens/link-picker-screen.native.js.map +0 -1
  123. package/build-module/link/modal-screens/link-settings-screen.native.js +0 -218
  124. package/build-module/link/modal-screens/link-settings-screen.native.js.map +0 -1
  125. package/build-module/link/modal-screens/screens.native.js +0 -5
  126. package/build-module/link/modal-screens/screens.native.js.map +0 -1
  127. package/build-module/link/modal.native.js +0 -45
  128. package/build-module/link/modal.native.js.map +0 -1
  129. package/build-module/text-color/index.native.js +0 -126
  130. package/build-module/text-color/index.native.js.map +0 -1
  131. package/build-module/text-color/inline.native.js +0 -142
  132. package/build-module/text-color/inline.native.js.map +0 -1
@@ -1,48 +1,59 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name2 in all)
7
+ __defProp(target, name2, { get: all[name2], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var subscript_exports = {};
19
+ __export(subscript_exports, {
20
+ subscript: () => subscript
5
21
  });
6
- exports.subscript = void 0;
7
- var _i18n = require("@wordpress/i18n");
8
- var _richText = require("@wordpress/rich-text");
9
- var _blockEditor = require("@wordpress/block-editor");
10
- var _icons = require("@wordpress/icons");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- const name = 'core/subscript';
17
- const title = (0, _i18n.__)('Subscript');
18
- const subscript = exports.subscript = {
22
+ module.exports = __toCommonJS(subscript_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_i18n = require("@wordpress/i18n");
25
+ var import_rich_text = require("@wordpress/rich-text");
26
+ var import_block_editor = require("@wordpress/block-editor");
27
+ var import_icons = require("@wordpress/icons");
28
+ const name = "core/subscript";
29
+ const title = (0, import_i18n.__)("Subscript");
30
+ const subscript = {
19
31
  name,
20
32
  title,
21
- tagName: 'sub',
33
+ tagName: "sub",
22
34
  className: null,
23
- edit({
24
- isActive,
25
- value,
26
- onChange,
27
- onFocus
28
- }) {
35
+ edit({ isActive, value, onChange, onFocus }) {
29
36
  function onToggle() {
30
- onChange((0, _richText.toggleFormat)(value, {
31
- type: name,
32
- title
33
- }));
37
+ onChange((0, import_rich_text.toggleFormat)(value, { type: name, title }));
34
38
  }
35
39
  function onClick() {
36
40
  onToggle();
37
41
  onFocus();
38
42
  }
39
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextToolbarButton, {
40
- icon: _icons.subscript,
41
- title: title,
42
- onClick: onClick,
43
- isActive: isActive,
44
- role: "menuitemcheckbox"
45
- });
43
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
+ import_block_editor.RichTextToolbarButton,
45
+ {
46
+ icon: import_icons.subscript,
47
+ title,
48
+ onClick,
49
+ isActive,
50
+ role: "menuitemcheckbox"
51
+ }
52
+ );
46
53
  }
47
54
  };
48
- //# sourceMappingURL=index.js.map
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ subscript
58
+ });
59
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_i18n","require","_richText","_blockEditor","_icons","_jsxRuntime","name","title","__","subscript","exports","tagName","className","edit","isActive","value","onChange","onFocus","onToggle","toggleFormat","type","onClick","jsx","RichTextToolbarButton","icon","subscriptIcon","role"],"sources":["@wordpress/format-library/src/subscript/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { subscript as subscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/subscript';\nconst title = __( 'Subscript' );\n\nexport const subscript = {\n\tname,\n\ttitle,\n\ttagName: 'sub',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ subscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAA8D,IAAAI,WAAA,GAAAJ,OAAA;AAN9D;AACA;AACA;;AAMA,MAAMK,IAAI,GAAG,gBAAgB;AAC7B,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,WAAY,CAAC;AAExB,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACxBH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,SAASC,QAAQA,CAAA,EAAG;MACnBF,QAAQ,CAAE,IAAAG,sBAAY,EAAEJ,KAAK,EAAE;QAAEK,IAAI,EAAEd,IAAI;QAAEC;MAAM,CAAE,CAAE,CAAC;IACzD;IAEA,SAASc,OAAOA,CAAA,EAAG;MAClBH,QAAQ,CAAC,CAAC;MACVD,OAAO,CAAC,CAAC;IACV;IAEA,oBACC,IAAAZ,WAAA,CAAAiB,GAAA,EAACnB,YAAA,CAAAoB,qBAAqB;MACrBC,IAAI,EAAGC,gBAAe;MACtBlB,KAAK,EAAGA,KAAO;MACfc,OAAO,EAAGA,OAAS;MACnBP,QAAQ,EAAGA,QAAU;MACrBY,IAAI,EAAC;IAAkB,CACvB,CAAC;EAEJ;AACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/subscript/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { subscript as subscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/subscript';\nconst title = __( 'Subscript' );\n\nexport const subscript = {\n\tname,\n\ttitle,\n\ttagName: 'sub',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ subscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BG;AAxBH,kBAAmB;AACnB,uBAA6B;AAC7B,0BAAsC;AACtC,mBAA2C;AAE3C,MAAM,OAAO;AACb,MAAM,YAAQ,gBAAI,WAAY;AAEvB,MAAM,YAAY;AAAA,EACxB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAM,EAAE,UAAU,OAAO,UAAU,QAAQ,GAAI;AAC9C,aAAS,WAAW;AACnB,mBAAU,+BAAc,OAAO,EAAE,MAAM,MAAM,MAAM,CAAE,CAAE;AAAA,IACxD;AAEA,aAAS,UAAU;AAClB,eAAS;AACT,cAAQ;AAAA,IACT;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,aAAAA;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAK;AAAA;AAAA,IACN;AAAA,EAEF;AACD;",
6
+ "names": ["subscriptIcon"]
7
+ }
@@ -1,48 +1,59 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name2 in all)
7
+ __defProp(target, name2, { get: all[name2], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var superscript_exports = {};
19
+ __export(superscript_exports, {
20
+ superscript: () => superscript
5
21
  });
6
- exports.superscript = void 0;
7
- var _i18n = require("@wordpress/i18n");
8
- var _richText = require("@wordpress/rich-text");
9
- var _blockEditor = require("@wordpress/block-editor");
10
- var _icons = require("@wordpress/icons");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- const name = 'core/superscript';
17
- const title = (0, _i18n.__)('Superscript');
18
- const superscript = exports.superscript = {
22
+ module.exports = __toCommonJS(superscript_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_i18n = require("@wordpress/i18n");
25
+ var import_rich_text = require("@wordpress/rich-text");
26
+ var import_block_editor = require("@wordpress/block-editor");
27
+ var import_icons = require("@wordpress/icons");
28
+ const name = "core/superscript";
29
+ const title = (0, import_i18n.__)("Superscript");
30
+ const superscript = {
19
31
  name,
20
32
  title,
21
- tagName: 'sup',
33
+ tagName: "sup",
22
34
  className: null,
23
- edit({
24
- isActive,
25
- value,
26
- onChange,
27
- onFocus
28
- }) {
35
+ edit({ isActive, value, onChange, onFocus }) {
29
36
  function onToggle() {
30
- onChange((0, _richText.toggleFormat)(value, {
31
- type: name,
32
- title
33
- }));
37
+ onChange((0, import_rich_text.toggleFormat)(value, { type: name, title }));
34
38
  }
35
39
  function onClick() {
36
40
  onToggle();
37
41
  onFocus();
38
42
  }
39
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextToolbarButton, {
40
- icon: _icons.superscript,
41
- title: title,
42
- onClick: onClick,
43
- isActive: isActive,
44
- role: "menuitemcheckbox"
45
- });
43
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
+ import_block_editor.RichTextToolbarButton,
45
+ {
46
+ icon: import_icons.superscript,
47
+ title,
48
+ onClick,
49
+ isActive,
50
+ role: "menuitemcheckbox"
51
+ }
52
+ );
46
53
  }
47
54
  };
48
- //# sourceMappingURL=index.js.map
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ superscript
58
+ });
59
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_i18n","require","_richText","_blockEditor","_icons","_jsxRuntime","name","title","__","superscript","exports","tagName","className","edit","isActive","value","onChange","onFocus","onToggle","toggleFormat","type","onClick","jsx","RichTextToolbarButton","icon","superscriptIcon","role"],"sources":["@wordpress/format-library/src/superscript/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { superscript as superscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/superscript';\nconst title = __( 'Superscript' );\n\nexport const superscript = {\n\tname,\n\ttitle,\n\ttagName: 'sup',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ superscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAkE,IAAAI,WAAA,GAAAJ,OAAA;AANlE;AACA;AACA;;AAMA,MAAMK,IAAI,GAAG,kBAAkB;AAC/B,MAAMC,KAAK,GAAG,IAAAC,QAAE,EAAE,aAAc,CAAC;AAE1B,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EAC1BH,IAAI;EACJC,KAAK;EACLI,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,IAAI;EACfC,IAAIA,CAAE;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IAC9C,SAASC,QAAQA,CAAA,EAAG;MACnBF,QAAQ,CAAE,IAAAG,sBAAY,EAAEJ,KAAK,EAAE;QAAEK,IAAI,EAAEd,IAAI;QAAEC;MAAM,CAAE,CAAE,CAAC;IACzD;IAEA,SAASc,OAAOA,CAAA,EAAG;MAClBH,QAAQ,CAAC,CAAC;MACVD,OAAO,CAAC,CAAC;IACV;IAEA,oBACC,IAAAZ,WAAA,CAAAiB,GAAA,EAACnB,YAAA,CAAAoB,qBAAqB;MACrBC,IAAI,EAAGC,kBAAiB;MACxBlB,KAAK,EAAGA,KAAO;MACfc,OAAO,EAAGA,OAAS;MACnBP,QAAQ,EAAGA,QAAU;MACrBY,IAAI,EAAC;IAAkB,CACvB,CAAC;EAEJ;AACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/superscript/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { superscript as superscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/superscript';\nconst title = __( 'Superscript' );\n\nexport const superscript = {\n\tname,\n\ttitle,\n\ttagName: 'sup',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ superscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BG;AAxBH,kBAAmB;AACnB,uBAA6B;AAC7B,0BAAsC;AACtC,mBAA+C;AAE/C,MAAM,OAAO;AACb,MAAM,YAAQ,gBAAI,aAAc;AAEzB,MAAM,cAAc;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAM,EAAE,UAAU,OAAO,UAAU,QAAQ,GAAI;AAC9C,aAAS,WAAW;AACnB,mBAAU,+BAAc,OAAO,EAAE,MAAM,MAAM,MAAM,CAAE,CAAE;AAAA,IACxD;AAEA,aAAS,UAAU;AAClB,eAAS;AACT,cAAQ;AAAA,IACT;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,aAAAA;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAK;AAAA;AAAA,IACN;AAAA,EAEF;AACD;",
6
+ "names": ["superscriptIcon"]
7
+ }
@@ -1,54 +1,64 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name2 in all)
9
+ __defProp(target, name2, { get: all[name2], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var text_color_exports = {};
29
+ __export(text_color_exports, {
30
+ textColor: () => textColor,
31
+ transparentValue: () => transparentValue
5
32
  });
6
- exports.transparentValue = exports.textColor = void 0;
7
- var _i18n = require("@wordpress/i18n");
8
- var _element = require("@wordpress/element");
9
- var _blockEditor = require("@wordpress/block-editor");
10
- var _icons = require("@wordpress/icons");
11
- var _richText = require("@wordpress/rich-text");
12
- var _inline = _interopRequireWildcard(require("./inline"));
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- /**
17
- * WordPress dependencies
18
- */
19
-
20
- /**
21
- * Internal dependencies
22
- */
23
-
24
- const transparentValue = exports.transparentValue = 'rgba(0, 0, 0, 0)';
25
- const name = 'core/text-color';
26
- const title = (0, _i18n.__)('Highlight');
33
+ module.exports = __toCommonJS(text_color_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_i18n = require("@wordpress/i18n");
36
+ var import_element = require("@wordpress/element");
37
+ var import_block_editor = require("@wordpress/block-editor");
38
+ var import_icons = require("@wordpress/icons");
39
+ var import_rich_text = require("@wordpress/rich-text");
40
+ var import_inline = __toESM(require("./inline"));
41
+ const transparentValue = "rgba(0, 0, 0, 0)";
42
+ const name = "core/text-color";
43
+ const title = (0, import_i18n.__)("Highlight");
27
44
  const EMPTY_ARRAY = [];
28
45
  function getComputedStyleProperty(element, property) {
29
- const {
30
- ownerDocument
31
- } = element;
32
- const {
33
- defaultView
34
- } = ownerDocument;
46
+ const { ownerDocument } = element;
47
+ const { defaultView } = ownerDocument;
35
48
  const style = defaultView.getComputedStyle(element);
36
49
  const value = style.getPropertyValue(property);
37
- if (property === 'background-color' && value === transparentValue && element.parentElement) {
50
+ if (property === "background-color" && value === transparentValue && element.parentElement) {
38
51
  return getComputedStyleProperty(element.parentElement, property);
39
52
  }
40
53
  return value;
41
54
  }
42
- function fillComputedColors(element, {
43
- color,
44
- backgroundColor
45
- }) {
55
+ function fillComputedColors(element, { color, backgroundColor }) {
46
56
  if (!color && !backgroundColor) {
47
57
  return;
48
58
  }
49
59
  return {
50
- color: color || getComputedStyleProperty(element, 'color'),
51
- backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, 'background-color') : backgroundColor
60
+ color: color || getComputedStyleProperty(element, "color"),
61
+ backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, "background-color") : backgroundColor
52
62
  };
53
63
  }
54
64
  function TextColorEdit({
@@ -58,46 +68,68 @@ function TextColorEdit({
58
68
  activeAttributes,
59
69
  contentRef
60
70
  }) {
61
- const [allowCustomControl, colors = EMPTY_ARRAY] = (0, _blockEditor.useSettings)('color.custom', 'color.palette');
62
- const [isAddingColor, setIsAddingColor] = (0, _element.useState)(false);
63
- const colorIndicatorStyle = (0, _element.useMemo)(() => fillComputedColors(contentRef.current, (0, _inline.getActiveColors)(value, name, colors)), [contentRef, value, colors]);
71
+ const [allowCustomControl, colors = EMPTY_ARRAY] = (0, import_block_editor.useSettings)(
72
+ "color.custom",
73
+ "color.palette"
74
+ );
75
+ const [isAddingColor, setIsAddingColor] = (0, import_element.useState)(false);
76
+ const colorIndicatorStyle = (0, import_element.useMemo)(
77
+ () => fillComputedColors(
78
+ contentRef.current,
79
+ (0, import_inline.getActiveColors)(value, name, colors)
80
+ ),
81
+ [contentRef, value, colors]
82
+ );
64
83
  const hasColorsToChoose = !!colors.length || allowCustomControl;
65
84
  if (!hasColorsToChoose && !isActive) {
66
85
  return null;
67
86
  }
68
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
69
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.RichTextToolbarButton, {
70
- className: "format-library-text-color-button",
71
- isActive: isActive,
72
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
73
- icon: Object.keys(activeAttributes).length ? _icons.textColor : _icons.color,
74
- style: colorIndicatorStyle
75
- }),
76
- title: title
77
- // If has no colors to choose but a color is active remove the color onClick.
78
- ,
79
- onClick: hasColorsToChoose ? () => setIsAddingColor(true) : () => onChange((0, _richText.removeFormat)(value, name)),
80
- role: "menuitemcheckbox"
81
- }), isAddingColor && /*#__PURE__*/(0, _jsxRuntime.jsx)(_inline.default, {
82
- name: name,
83
- onClose: () => setIsAddingColor(false),
84
- activeAttributes: activeAttributes,
85
- value: value,
86
- onChange: onChange,
87
- contentRef: contentRef,
88
- isActive: isActive
89
- })]
90
- });
87
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ import_block_editor.RichTextToolbarButton,
90
+ {
91
+ className: "format-library-text-color-button",
92
+ isActive,
93
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
94
+ import_icons.Icon,
95
+ {
96
+ icon: Object.keys(activeAttributes).length ? import_icons.textColor : import_icons.color,
97
+ style: colorIndicatorStyle
98
+ }
99
+ ),
100
+ title,
101
+ onClick: hasColorsToChoose ? () => setIsAddingColor(true) : () => onChange((0, import_rich_text.removeFormat)(value, name)),
102
+ role: "menuitemcheckbox"
103
+ }
104
+ ),
105
+ isAddingColor && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
106
+ import_inline.default,
107
+ {
108
+ name,
109
+ onClose: () => setIsAddingColor(false),
110
+ activeAttributes,
111
+ value,
112
+ onChange,
113
+ contentRef,
114
+ isActive
115
+ }
116
+ )
117
+ ] });
91
118
  }
92
- const textColor = exports.textColor = {
119
+ const textColor = {
93
120
  name,
94
121
  title,
95
- tagName: 'mark',
96
- className: 'has-inline-color',
122
+ tagName: "mark",
123
+ className: "has-inline-color",
97
124
  attributes: {
98
- style: 'style',
99
- class: 'class'
125
+ style: "style",
126
+ class: "class"
100
127
  },
101
128
  edit: TextColorEdit
102
129
  };
103
- //# sourceMappingURL=index.js.map
130
+ // Annotate the CommonJS export names for ESM import in node:
131
+ 0 && (module.exports = {
132
+ textColor,
133
+ transparentValue
134
+ });
135
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_i18n","require","_element","_blockEditor","_icons","_richText","_inline","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","transparentValue","exports","name","title","__","EMPTY_ARRAY","getComputedStyleProperty","element","property","ownerDocument","defaultView","style","getComputedStyle","value","getPropertyValue","parentElement","fillComputedColors","color","backgroundColor","TextColorEdit","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","useSettings","isAddingColor","setIsAddingColor","useState","colorIndicatorStyle","useMemo","current","getActiveColors","hasColorsToChoose","length","jsxs","Fragment","children","jsx","RichTextToolbarButton","className","icon","Icon","keys","textColorIcon","colorIcon","onClick","removeFormat","role","onClose","textColor","tagName","attributes","class","edit"],"sources":["@wordpress/format-library/src/text-color/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { RichTextToolbarButton, useSettings } from '@wordpress/block-editor';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { default as InlineColorUI, getActiveColors } from './inline';\n\nexport const transparentValue = 'rgba(0, 0, 0, 0)';\n\nconst name = 'core/text-color';\nconst title = __( 'Highlight' );\n\nconst EMPTY_ARRAY = [];\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst style = defaultView.getComputedStyle( element );\n\tconst value = style.getPropertyValue( property );\n\n\tif (\n\t\tproperty === 'background-color' &&\n\t\tvalue === transparentValue &&\n\t\telement.parentElement\n\t) {\n\t\treturn getComputedStyleProperty( element.parentElement, property );\n\t}\n\n\treturn value;\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor:\n\t\t\tbackgroundColor === transparentValue\n\t\t\t\t? getComputedStyleProperty( element, 'background-color' )\n\t\t\t\t: backgroundColor,\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst [ allowCustomControl, colors = EMPTY_ARRAY ] = useSettings(\n\t\t'color.custom',\n\t\t'color.palette'\n\t);\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef.current,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ contentRef, value, colors ]\n\t);\n\n\tconst hasColorsToChoose = !! colors.length || allowCustomControl;\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\tclassName=\"format-library-text-color-button\"\n\t\t\t\tisActive={ isActive }\n\t\t\t\ticon={\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ colorIndicatorStyle }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ title }\n\t\t\t\t// If has no colors to choose but a color is active remove the color onClick.\n\t\t\t\tonClick={\n\t\t\t\t\thasColorsToChoose\n\t\t\t\t\t\t? () => setIsAddingColor( true )\n\t\t\t\t\t\t: () => onChange( removeFormat( value, name ) )\n\t\t\t\t}\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ () => setIsAddingColor( false ) }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\tedit: TextColorEdit,\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAC,uBAAA,CAAAN,OAAA;AAAqE,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,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color/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { RichTextToolbarButton, useSettings } from '@wordpress/block-editor';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { default as InlineColorUI, getActiveColors } from './inline';\n\nexport const transparentValue = 'rgba(0, 0, 0, 0)';\n\nconst name = 'core/text-color';\nconst title = __( 'Highlight' );\n\nconst EMPTY_ARRAY = [];\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst style = defaultView.getComputedStyle( element );\n\tconst value = style.getPropertyValue( property );\n\n\tif (\n\t\tproperty === 'background-color' &&\n\t\tvalue === transparentValue &&\n\t\telement.parentElement\n\t) {\n\t\treturn getComputedStyleProperty( element.parentElement, property );\n\t}\n\n\treturn value;\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor:\n\t\t\tbackgroundColor === transparentValue\n\t\t\t\t? getComputedStyleProperty( element, 'background-color' )\n\t\t\t\t: backgroundColor,\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst [ allowCustomControl, colors = EMPTY_ARRAY ] = useSettings(\n\t\t'color.custom',\n\t\t'color.palette'\n\t);\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef.current,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ contentRef, value, colors ]\n\t);\n\n\tconst hasColorsToChoose = !! colors.length || allowCustomControl;\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\tclassName=\"format-library-text-color-button\"\n\t\t\t\tisActive={ isActive }\n\t\t\t\ticon={\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ colorIndicatorStyle }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ title }\n\t\t\t\t// If has no colors to choose but a color is active remove the color onClick.\n\t\t\t\tonClick={\n\t\t\t\t\thasColorsToChoose\n\t\t\t\t\t\t? () => setIsAddingColor( true )\n\t\t\t\t\t\t: () => onChange( removeFormat( value, name ) )\n\t\t\t\t}\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ () => setIsAddingColor( false ) }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\tedit: TextColorEdit,\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmFE;AAhFF,kBAAmB;AACnB,qBAAkC;AAClC,0BAAmD;AACnD,mBAIO;AACP,u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