PluginProbe
Gutenberg / 23.5.1
Gutenberg v23.5.1
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / scripts / format-library / index.js

index.js in Gutenberg 23.5.1, at build/scripts/format-library/index.js

6,272 lines 240.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var wp;
2 (wp ||= {}).formatLibrary = (() => {
3 var __create = Object.create;
4 var __defProp = Object.defineProperty;
5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6 var __getOwnPropNames = Object.getOwnPropertyNames;
7 var __getProtoOf = Object.getPrototypeOf;
8 var __hasOwnProp = Object.prototype.hasOwnProperty;
9 var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10 get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11 }) : x)(function(x) {
12 if (typeof require !== "undefined") return require.apply(this, arguments);
13 throw Error('Dynamic require of "' + x + '" is not supported');
14 });
15 var __commonJS = (cb, mod) => function __require2() {
16 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17 };
18 var __export = (target, all) => {
19 for (var name16 in all)
20 __defProp(target, name16, { get: all[name16], enumerable: true });
21 };
22 var __copyProps = (to, from, except, desc) => {
23 if (from && typeof from === "object" || typeof from === "function") {
24 for (let key of __getOwnPropNames(from))
25 if (!__hasOwnProp.call(to, key) && key !== except)
26 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27 }
28 return to;
29 };
30 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31 // If the importer is in node compatibility mode or this is not an ESM
32 // file that has been converted to a CommonJS file using a Babel-
33 // compatible transform (i.e. "__esModule" has not been set), then set
34 // "default" to the CommonJS "module.exports" for node compatibility.
35 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36 mod
37 ));
38
39 // package-external:@wordpress/rich-text
40 var require_rich_text = __commonJS({
41 "package-external:@wordpress/rich-text"(exports, module) {
42 module.exports = window.wp.richText;
43 }
44 });
45
46 // package-external:@wordpress/i18n
47 var require_i18n = __commonJS({
48 "package-external:@wordpress/i18n"(exports, module) {
49 module.exports = window.wp.i18n;
50 }
51 });
52
53 // package-external:@wordpress/block-editor
54 var require_block_editor = __commonJS({
55 "package-external:@wordpress/block-editor"(exports, module) {
56 module.exports = window.wp.blockEditor;
57 }
58 });
59
60 // package-external:@wordpress/element
61 var require_element = __commonJS({
62 "package-external:@wordpress/element"(exports, module) {
63 module.exports = window.wp.element;
64 }
65 });
66
67 // package-external:@wordpress/primitives
68 var require_primitives = __commonJS({
69 "package-external:@wordpress/primitives"(exports, module) {
70 module.exports = window.wp.primitives;
71 }
72 });
73
74 // vendor-external:react/jsx-runtime
75 var require_jsx_runtime = __commonJS({
76 "vendor-external:react/jsx-runtime"(exports, module) {
77 module.exports = window.ReactJSXRuntime;
78 }
79 });
80
81 // package-external:@wordpress/components
82 var require_components = __commonJS({
83 "package-external:@wordpress/components"(exports, module) {
84 module.exports = window.wp.components;
85 }
86 });
87
88 // vendor-external:react
89 var require_react = __commonJS({
90 "vendor-external:react"(exports, module) {
91 module.exports = window.React;
92 }
93 });
94
95 // vendor-external:react-dom
96 var require_react_dom = __commonJS({
97 "vendor-external:react-dom"(exports, module) {
98 module.exports = window.ReactDOM;
99 }
100 });
101
102 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
103 var require_use_sync_external_store_shim_development = __commonJS({
104 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
105 "use strict";
106 (function() {
107 function is(x, y) {
108 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
109 }
110 function useSyncExternalStore$2(subscribe2, getSnapshot2) {
111 didWarnOld18Alpha || void 0 === React31.startTransition || (didWarnOld18Alpha = true, console.error(
112 "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
113 ));
114 var value = getSnapshot2();
115 if (!didWarnUncachedGetSnapshot) {
116 var cachedValue = getSnapshot2();
117 objectIs(value, cachedValue) || (console.error(
118 "The result of getSnapshot should be cached to avoid an infinite loop"
119 ), didWarnUncachedGetSnapshot = true);
120 }
121 cachedValue = useState17({
122 inst: { value, getSnapshot: getSnapshot2 }
123 });
124 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
125 useLayoutEffect3(
126 function() {
127 inst.value = value;
128 inst.getSnapshot = getSnapshot2;
129 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
130 },
131 [subscribe2, value, getSnapshot2]
132 );
133 useEffect14(
134 function() {
135 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
136 return subscribe2(function() {
137 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
138 });
139 },
140 [subscribe2]
141 );
142 useDebugValue(value);
143 return value;
144 }
145 function checkIfSnapshotChanged(inst) {
146 var latestGetSnapshot = inst.getSnapshot;
147 inst = inst.value;
148 try {
149 var nextValue = latestGetSnapshot();
150 return !objectIs(inst, nextValue);
151 } catch (error2) {
152 return true;
153 }
154 }
155 function useSyncExternalStore$1(subscribe2, getSnapshot2) {
156 return getSnapshot2();
157 }
158 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
159 var React31 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState17 = React31.useState, useEffect14 = React31.useEffect, useLayoutEffect3 = React31.useLayoutEffect, useDebugValue = React31.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
160 exports.useSyncExternalStore = void 0 !== React31.useSyncExternalStore ? React31.useSyncExternalStore : shim;
161 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
162 })();
163 }
164 });
165
166 // node_modules/use-sync-external-store/shim/index.js
167 var require_shim = __commonJS({
168 "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
169 "use strict";
170 if (false) {
171 module.exports = null;
172 } else {
173 module.exports = require_use_sync_external_store_shim_development();
174 }
175 }
176 });
177
178 // package-external:@wordpress/a11y
179 var require_a11y = __commonJS({
180 "package-external:@wordpress/a11y"(exports, module) {
181 module.exports = window.wp.a11y;
182 }
183 });
184
185 // package-external:@wordpress/compose
186 var require_compose = __commonJS({
187 "package-external:@wordpress/compose"(exports, module) {
188 module.exports = window.wp.compose;
189 }
190 });
191
192 // package-external:@wordpress/private-apis
193 var require_private_apis = __commonJS({
194 "package-external:@wordpress/private-apis"(exports, module) {
195 module.exports = window.wp.privateApis;
196 }
197 });
198
199 // package-external:@wordpress/url
200 var require_url = __commonJS({
201 "package-external:@wordpress/url"(exports, module) {
202 module.exports = window.wp.url;
203 }
204 });
205
206 // package-external:@wordpress/html-entities
207 var require_html_entities = __commonJS({
208 "package-external:@wordpress/html-entities"(exports, module) {
209 module.exports = window.wp.htmlEntities;
210 }
211 });
212
213 // package-external:@wordpress/data
214 var require_data = __commonJS({
215 "package-external:@wordpress/data"(exports, module) {
216 module.exports = window.wp.data;
217 }
218 });
219
220 // packages/format-library/build-module/index.mjs
221 var import_rich_text18 = __toESM(require_rich_text(), 1);
222
223 // packages/format-library/build-module/bold/index.mjs
224 var import_i18n = __toESM(require_i18n(), 1);
225 var import_rich_text = __toESM(require_rich_text(), 1);
226 var import_block_editor = __toESM(require_block_editor(), 1);
227
228 // packages/icons/build-module/icon/index.mjs
229 var import_element = __toESM(require_element(), 1);
230 var icon_default = (0, import_element.forwardRef)(
231 ({ icon, size = 24, ...props }, ref) => {
232 return (0, import_element.cloneElement)(icon, {
233 width: size,
234 height: size,
235 ...props,
236 ref
237 });
238 }
239 );
240
241 // packages/icons/build-module/library/button.mjs
242 var import_primitives = __toESM(require_primitives(), 1);
243 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
244 var button_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { 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" }) });
245
246 // packages/icons/build-module/library/chevron-right.mjs
247 var import_primitives2 = __toESM(require_primitives(), 1);
248 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
249 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" }) });
250
251 // packages/icons/build-module/library/code.mjs
252 var import_primitives3 = __toESM(require_primitives(), 1);
253 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
254 var code_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { 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" }) });
255
256 // packages/icons/build-module/library/color.mjs
257 var import_primitives4 = __toESM(require_primitives(), 1);
258 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
259 var color_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { 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" }) });
260
261 // packages/icons/build-module/library/format-bold.mjs
262 var import_primitives5 = __toESM(require_primitives(), 1);
263 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
264 var format_bold_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { 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" }) });
265
266 // packages/icons/build-module/library/format-italic.mjs
267 var import_primitives6 = __toESM(require_primitives(), 1);
268 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
269 var format_italic_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M12.5 5L10 19h1.9l2.5-14z" }) });
270
271 // packages/icons/build-module/library/format-strikethrough.mjs
272 var import_primitives7 = __toESM(require_primitives(), 1);
273 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
274 var format_strikethrough_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" }) });
275
276 // packages/icons/build-module/library/help.mjs
277 var import_primitives8 = __toESM(require_primitives(), 1);
278 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
279 var help_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) });
280
281 // packages/icons/build-module/library/language.mjs
282 var import_primitives9 = __toESM(require_primitives(), 1);
283 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
284 var language_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { 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" }) });
285
286 // packages/icons/build-module/library/link.mjs
287 var import_primitives10 = __toESM(require_primitives(), 1);
288 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
289 var link_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { 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" }) });
290
291 // packages/icons/build-module/library/math.mjs
292 var import_primitives11 = __toESM(require_primitives(), 1);
293 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
294 var math_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M11.2 6.8c-.7 0-1.4.5-1.6 1.1l-2.8 7.5-1.2-1.8c-.1-.2-.4-.3-.6-.3H3v1.5h1.6l1.2 1.8c.6.9 1.9.7 2.2-.3l2.9-7.9s.1-.2.2-.2h7.8V6.7h-7.8Zm5.3 3.4-1.9 1.9-1.9-1.9-1.1 1.1 1.9 1.9-1.9 1.9 1.1 1.1 1.9-1.9 1.9 1.9 1.1-1.1-1.9-1.9 1.9-1.9-1.1-1.1Z" }) });
295
296 // packages/icons/build-module/library/subscript.mjs
297 var import_primitives12 = __toESM(require_primitives(), 1);
298 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
299 var subscript_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z" }) });
300
301 // packages/icons/build-module/library/superscript.mjs
302 var import_primitives13 = __toESM(require_primitives(), 1);
303 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
304 var superscript_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { 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" }) });
305
306 // packages/icons/build-module/library/text-color.mjs
307 var import_primitives14 = __toESM(require_primitives(), 1);
308 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
309 var text_color_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { 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" }) });
310
311 // packages/format-library/build-module/bold/index.mjs
312 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
313 var name = "core/bold";
314 var title = (0, import_i18n.__)("Bold");
315 var bold = {
316 name,
317 title,
318 tagName: "strong",
319 className: null,
320 edit({ isActive, value, onChange, onFocus, isVisible = true }) {
321 function onToggle() {
322 onChange((0, import_rich_text.toggleFormat)(value, { type: name, title }));
323 }
324 function onClick() {
325 onChange((0, import_rich_text.toggleFormat)(value, { type: name }));
326 onFocus();
327 }
328 return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
329 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
330 import_block_editor.RichTextShortcut,
331 {
332 type: "primary",
333 character: "b",
334 onUse: onToggle
335 }
336 ),
337 isVisible && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
338 import_block_editor.RichTextToolbarButton,
339 {
340 name: "bold",
341 icon: format_bold_default,
342 title,
343 onClick,
344 isActive,
345 shortcutType: "primary",
346 shortcutCharacter: "b"
347 }
348 ),
349 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
350 import_block_editor.__unstableRichTextInputEvent,
351 {
352 inputType: "formatBold",
353 onInput: onToggle
354 }
355 )
356 ] });
357 }
358 };
359
360 // packages/format-library/build-module/code/index.mjs
361 var import_i18n2 = __toESM(require_i18n(), 1);
362 var import_rich_text2 = __toESM(require_rich_text(), 1);
363 var import_block_editor2 = __toESM(require_block_editor(), 1);
364 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
365 var name2 = "core/code";
366 var title2 = (0, import_i18n2.__)("Inline code");
367 var code = {
368 name: name2,
369 title: title2,
370 tagName: "code",
371 className: null,
372 __unstableInputRule(value) {
373 const BACKTICK = "`";
374 const { start, text } = value;
375 const characterBefore = text[start - 1];
376 if (characterBefore !== BACKTICK) {
377 return value;
378 }
379 if (start - 2 < 0) {
380 return value;
381 }
382 const indexBefore = text.lastIndexOf(BACKTICK, start - 2);
383 if (indexBefore === -1) {
384 return value;
385 }
386 const startIndex = indexBefore;
387 const endIndex = start - 2;
388 if (startIndex === endIndex) {
389 return value;
390 }
391 value = (0, import_rich_text2.remove)(value, startIndex, startIndex + 1);
392 value = (0, import_rich_text2.remove)(value, endIndex, endIndex + 1);
393 value = (0, import_rich_text2.applyFormat)(value, { type: name2 }, startIndex, endIndex);
394 return value;
395 },
396 edit({ value, onChange, onFocus, isActive }) {
397 function onClick() {
398 onChange((0, import_rich_text2.toggleFormat)(value, { type: name2, title: title2 }));
399 onFocus();
400 }
401 return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
402 /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
403 import_block_editor2.RichTextShortcut,
404 {
405 type: "access",
406 character: "x",
407 onUse: onClick
408 }
409 ),
410 /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
411 import_block_editor2.RichTextToolbarButton,
412 {
413 icon: code_default,
414 title: title2,
415 onClick,
416 isActive,
417 role: "menuitemcheckbox"
418 }
419 )
420 ] });
421 }
422 };
423
424 // packages/format-library/build-module/image/index.mjs
425 var import_components = __toESM(require_components(), 1);
426
427 // node_modules/clsx/dist/clsx.mjs
428 function r(e) {
429 var t, f, n = "";
430 if ("string" == typeof e || "number" == typeof e) n += e;
431 else if ("object" == typeof e) if (Array.isArray(e)) {
432 var o = e.length;
433 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
434 } else for (f in e) e[f] && (n && (n += " "), n += f);
435 return n;
436 }
437 function clsx() {
438 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
439 return n;
440 }
441 var clsx_default = clsx;
442
443 // node_modules/@base-ui/utils/esm/useControlled.js
444 var React = __toESM(require_react(), 1);
445
446 // node_modules/@base-ui/utils/esm/error.js
447 var set;
448 if (true) {
449 set = /* @__PURE__ */ new Set();
450 }
451 function error(...messages) {
452 if (true) {
453 const messageKey = messages.join(" ");
454 if (!set.has(messageKey)) {
455 set.add(messageKey);
456 console.error(`Base UI: ${messageKey}`);
457 }
458 }
459 }
460
461 // node_modules/@base-ui/utils/esm/useControlled.js
462 function useControlled({
463 controlled,
464 default: defaultProp,
465 name: name16,
466 state = "value"
467 }) {
468 const {
469 current: isControlled
470 } = React.useRef(controlled !== void 0);
471 const [valueState, setValue] = React.useState(defaultProp);
472 const value = isControlled ? controlled : valueState;
473 if (true) {
474 React.useEffect(() => {
475 if (isControlled !== (controlled !== void 0)) {
476 error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name16} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name16} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n"));
477 }
478 }, [state, name16, controlled]);
479 const {
480 current: defaultValue
481 } = React.useRef(defaultProp);
482 React.useEffect(() => {
483 if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {
484 error([`A component is changing the default ${state} state of an uncontrolled ${name16} after being initialized. To suppress this warning opt to use a controlled ${name16}.`].join("\n"));
485 }
486 }, [defaultProp]);
487 }
488 const setValueIfUncontrolled = React.useCallback((newValue) => {
489 if (!isControlled) {
490 setValue(newValue);
491 }
492 }, []);
493 return [value, setValueIfUncontrolled];
494 }
495 function serializeToDevModeString(input) {
496 let nextId = 0;
497 const seen = /* @__PURE__ */ new WeakMap();
498 try {
499 const result = JSON.stringify(input, function replacer(key, value) {
500 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
501 return void 0;
502 }
503 if (typeof value === "bigint") {
504 return `__bigint__:${value}`;
505 }
506 if (value !== null && typeof value === "object") {
507 const id = seen.get(value);
508 if (id !== void 0) {
509 return `__object__:${id}`;
510 }
511 seen.set(value, nextId);
512 nextId += 1;
513 }
514 return value;
515 });
516 return result ?? `__top__:${typeof input}`;
517 } catch {
518 return "__unserializable__";
519 }
520 }
521
522 // node_modules/@base-ui/utils/esm/safeReact.js
523 var React2 = __toESM(require_react(), 1);
524 var SafeReact = {
525 ...React2
526 };
527
528 // node_modules/@base-ui/utils/esm/useRefWithInit.js
529 var React3 = __toESM(require_react(), 1);
530 var UNINITIALIZED = {};
531 function useRefWithInit(init, initArg) {
532 const ref = React3.useRef(UNINITIALIZED);
533 if (ref.current === UNINITIALIZED) {
534 ref.current = init(initArg);
535 }
536 return ref;
537 }
538
539 // node_modules/@base-ui/utils/esm/useStableCallback.js
540 var useInsertionEffect = SafeReact.useInsertionEffect;
541 var useSafeInsertionEffect = (
542 // React 17 doesn't have useInsertionEffect.
543 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
544 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
545 );
546 function useStableCallback(callback) {
547 const stable = useRefWithInit(createStableCallback).current;
548 stable.next = callback;
549 useSafeInsertionEffect(stable.effect);
550 return stable.trampoline;
551 }
552 function createStableCallback() {
553 const stable = {
554 next: void 0,
555 callback: assertNotCalled,
556 trampoline: (...args) => stable.callback?.(...args),
557 effect: () => {
558 stable.callback = stable.next;
559 }
560 };
561 return stable;
562 }
563 function assertNotCalled() {
564 if (true) {
565 throw (
566 /* minify-error-disabled */
567 new Error("Base UI: Cannot call an event handler while rendering.")
568 );
569 }
570 }
571
572 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js
573 var React4 = __toESM(require_react(), 1);
574 var noop = () => {
575 };
576 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop;
577
578 // node_modules/@base-ui/utils/esm/warn.js
579 var set2;
580 if (true) {
581 set2 = /* @__PURE__ */ new Set();
582 }
583 function warn(...messages) {
584 if (true) {
585 const messageKey = messages.join(" ");
586 if (!set2.has(messageKey)) {
587 set2.add(messageKey);
588 console.warn(`Base UI: ${messageKey}`);
589 }
590 }
591 }
592
593 // node_modules/@base-ui/react/esm/internals/composite/list/CompositeList.js
594 var React6 = __toESM(require_react(), 1);
595
596 // node_modules/@base-ui/react/esm/internals/composite/list/CompositeListContext.js
597 var React5 = __toESM(require_react(), 1);
598 var CompositeListContext = /* @__PURE__ */ React5.createContext({
599 register: () => {
600 },
601 unregister: () => {
602 },
603 subscribeMapChange: () => {
604 return () => {
605 };
606 },
607 elementsRef: {
608 current: []
609 },
610 nextIndexRef: {
611 current: 0
612 }
613 });
614 if (true) CompositeListContext.displayName = "CompositeListContext";
615 function useCompositeListContext() {
616 return React5.useContext(CompositeListContext);
617 }
618
619 // node_modules/@base-ui/react/esm/internals/composite/list/CompositeList.js
620 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
621 function CompositeList(props) {
622 const {
623 children,
624 elementsRef,
625 labelsRef,
626 onMapChange: onMapChangeProp
627 } = props;
628 const onMapChange = useStableCallback(onMapChangeProp);
629 const nextIndexRef = React6.useRef(0);
630 const listeners = useRefWithInit(createListeners).current;
631 const map = useRefWithInit(createMap).current;
632 const [mapTick, setMapTick] = React6.useState(0);
633 const lastTickRef = React6.useRef(mapTick);
634 const register = useStableCallback((node, metadata) => {
635 map.set(node, metadata ?? null);
636 lastTickRef.current += 1;
637 setMapTick(lastTickRef.current);
638 });
639 const unregister = useStableCallback((node) => {
640 map.delete(node);
641 lastTickRef.current += 1;
642 setMapTick(lastTickRef.current);
643 });
644 const sortedMap = React6.useMemo(() => {
645 disableEslintWarning(mapTick);
646 const newMap = /* @__PURE__ */ new Map();
647 const sortedNodes = Array.from(map.keys()).filter((node) => node.isConnected).sort(sortByDocumentPosition);
648 sortedNodes.forEach((node, index) => {
649 const metadata = map.get(node) ?? {};
650 newMap.set(node, {
651 ...metadata,
652 index
653 });
654 });
655 return newMap;
656 }, [map, mapTick]);
657 useIsoLayoutEffect(() => {
658 if (typeof MutationObserver !== "function" || sortedMap.size === 0) {
659 return void 0;
660 }
661 const mutationObserver = new MutationObserver((entries) => {
662 const diff = /* @__PURE__ */ new Set();
663 const updateDiff = (node) => diff.has(node) ? diff.delete(node) : diff.add(node);
664 entries.forEach((entry) => {
665 entry.removedNodes.forEach(updateDiff);
666 entry.addedNodes.forEach(updateDiff);
667 });
668 if (diff.size === 0) {
669 lastTickRef.current += 1;
670 setMapTick(lastTickRef.current);
671 }
672 });
673 sortedMap.forEach((_, node) => {
674 if (node.parentElement) {
675 mutationObserver.observe(node.parentElement, {
676 childList: true
677 });
678 }
679 });
680 return () => {
681 mutationObserver.disconnect();
682 };
683 }, [sortedMap]);
684 useIsoLayoutEffect(() => {
685 const shouldUpdateLengths = lastTickRef.current === mapTick;
686 if (shouldUpdateLengths) {
687 if (elementsRef.current.length !== sortedMap.size) {
688 elementsRef.current.length = sortedMap.size;
689 }
690 if (labelsRef && labelsRef.current.length !== sortedMap.size) {
691 labelsRef.current.length = sortedMap.size;
692 }
693 nextIndexRef.current = sortedMap.size;
694 }
695 onMapChange(sortedMap);
696 }, [onMapChange, sortedMap, elementsRef, labelsRef, mapTick]);
697 useIsoLayoutEffect(() => {
698 return () => {
699 elementsRef.current = [];
700 };
701 }, [elementsRef]);
702 useIsoLayoutEffect(() => {
703 return () => {
704 if (labelsRef) {
705 labelsRef.current = [];
706 }
707 };
708 }, [labelsRef]);
709 const subscribeMapChange = useStableCallback((fn) => {
710 listeners.add(fn);
711 return () => {
712 listeners.delete(fn);
713 };
714 });
715 useIsoLayoutEffect(() => {
716 listeners.forEach((l) => l(sortedMap));
717 }, [listeners, sortedMap]);
718 const contextValue = React6.useMemo(() => ({
719 register,
720 unregister,
721 subscribeMapChange,
722 elementsRef,
723 labelsRef,
724 nextIndexRef
725 }), [register, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef]);
726 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CompositeListContext.Provider, {
727 value: contextValue,
728 children
729 });
730 }
731 function createMap() {
732 return /* @__PURE__ */ new Map();
733 }
734 function createListeners() {
735 return /* @__PURE__ */ new Set();
736 }
737 function sortByDocumentPosition(a, b) {
738 const position = a.compareDocumentPosition(b);
739 if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) {
740 return -1;
741 }
742 if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) {
743 return 1;
744 }
745 return 0;
746 }
747 function disableEslintWarning(_) {
748 }
749
750 // node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js
751 var React7 = __toESM(require_react(), 1);
752 var DirectionContext = /* @__PURE__ */ React7.createContext(void 0);
753 if (true) DirectionContext.displayName = "DirectionContext";
754 function useDirection() {
755 const context = React7.useContext(DirectionContext);
756 return context?.direction ?? "ltr";
757 }
758
759 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
760 var React10 = __toESM(require_react(), 1);
761
762 // node_modules/@base-ui/utils/esm/useMergedRefs.js
763 function useMergedRefs(a, b, c, d) {
764 const forkRef = useRefWithInit(createForkRef).current;
765 if (didChange(forkRef, a, b, c, d)) {
766 update(forkRef, [a, b, c, d]);
767 }
768 return forkRef.callback;
769 }
770 function useMergedRefsN(refs) {
771 const forkRef = useRefWithInit(createForkRef).current;
772 if (didChangeN(forkRef, refs)) {
773 update(forkRef, refs);
774 }
775 return forkRef.callback;
776 }
777 function createForkRef() {
778 return {
779 callback: null,
780 cleanup: null,
781 refs: []
782 };
783 }
784 function didChange(forkRef, a, b, c, d) {
785 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
786 }
787 function didChangeN(forkRef, newRefs) {
788 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
789 }
790 function update(forkRef, refs) {
791 forkRef.refs = refs;
792 if (refs.every((ref) => ref == null)) {
793 forkRef.callback = null;
794 return;
795 }
796 forkRef.callback = (instance) => {
797 if (forkRef.cleanup) {
798 forkRef.cleanup();
799 forkRef.cleanup = null;
800 }
801 if (instance != null) {
802 const cleanupCallbacks = Array(refs.length).fill(null);
803 for (let i = 0; i < refs.length; i += 1) {
804 const ref = refs[i];
805 if (ref == null) {
806 continue;
807 }
808 switch (typeof ref) {
809 case "function": {
810 const refCleanup = ref(instance);
811 if (typeof refCleanup === "function") {
812 cleanupCallbacks[i] = refCleanup;
813 }
814 break;
815 }
816 case "object": {
817 ref.current = instance;
818 break;
819 }
820 default:
821 }
822 }
823 forkRef.cleanup = () => {
824 for (let i = 0; i < refs.length; i += 1) {
825 const ref = refs[i];
826 if (ref == null) {
827 continue;
828 }
829 switch (typeof ref) {
830 case "function": {
831 const cleanupCallback = cleanupCallbacks[i];
832 if (typeof cleanupCallback === "function") {
833 cleanupCallback();
834 } else {
835 ref(null);
836 }
837 break;
838 }
839 case "object": {
840 ref.current = null;
841 break;
842 }
843 default:
844 }
845 }
846 };
847 }
848 };
849 }
850
851 // node_modules/@base-ui/utils/esm/getReactElementRef.js
852 var React9 = __toESM(require_react(), 1);
853
854 // node_modules/@base-ui/utils/esm/reactVersion.js
855 var React8 = __toESM(require_react(), 1);
856 var majorVersion = parseInt(React8.version, 10);
857 function isReactVersionAtLeast(reactVersionToCheck) {
858 return majorVersion >= reactVersionToCheck;
859 }
860
861 // node_modules/@base-ui/utils/esm/getReactElementRef.js
862 function getReactElementRef(element) {
863 if (!/* @__PURE__ */ React9.isValidElement(element)) {
864 return null;
865 }
866 const reactElement = element;
867 const propsWithRef = reactElement.props;
868 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
869 }
870
871 // node_modules/@base-ui/utils/esm/mergeObjects.js
872 function mergeObjects(a, b) {
873 if (a && !b) {
874 return a;
875 }
876 if (!a && b) {
877 return b;
878 }
879 if (a || b) {
880 return {
881 ...a,
882 ...b
883 };
884 }
885 return void 0;
886 }
887
888 // node_modules/@base-ui/utils/esm/empty.js
889 function NOOP() {
890 }
891 var EMPTY_ARRAY = Object.freeze([]);
892 var EMPTY_OBJECT = Object.freeze({});
893
894 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js
895 function getStateAttributesProps(state, customMapping) {
896 const props = {};
897 for (const key in state) {
898 const value = state[key];
899 if (customMapping?.hasOwnProperty(key)) {
900 const customProps = customMapping[key](value);
901 if (customProps != null) {
902 Object.assign(props, customProps);
903 }
904 continue;
905 }
906 if (value === true) {
907 props[`data-${key.toLowerCase()}`] = "";
908 } else if (value) {
909 props[`data-${key.toLowerCase()}`] = value.toString();
910 }
911 }
912 return props;
913 }
914
915 // node_modules/@base-ui/react/esm/utils/resolveClassName.js
916 function resolveClassName(className, state) {
917 return typeof className === "function" ? className(state) : className;
918 }
919
920 // node_modules/@base-ui/react/esm/utils/resolveStyle.js
921 function resolveStyle(style, state) {
922 return typeof style === "function" ? style(state) : style;
923 }
924
925 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js
926 var EMPTY_PROPS = {};
927 function mergeProps(a, b, c, d, e) {
928 if (!c && !d && !e && !a) {
929 return createInitialMergedProps(b);
930 }
931 let merged = createInitialMergedProps(a);
932 if (b) {
933 merged = mergeInto(merged, b);
934 }
935 if (c) {
936 merged = mergeInto(merged, c);
937 }
938 if (d) {
939 merged = mergeInto(merged, d);
940 }
941 if (e) {
942 merged = mergeInto(merged, e);
943 }
944 return merged;
945 }
946 function mergePropsN(props) {
947 if (props.length === 0) {
948 return EMPTY_PROPS;
949 }
950 if (props.length === 1) {
951 return createInitialMergedProps(props[0]);
952 }
953 let merged = createInitialMergedProps(props[0]);
954 for (let i = 1; i < props.length; i += 1) {
955 merged = mergeInto(merged, props[i]);
956 }
957 return merged;
958 }
959 function createInitialMergedProps(inputProps) {
960 if (isPropsGetter(inputProps)) {
961 return {
962 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
963 };
964 }
965 return copyInitialProps(inputProps);
966 }
967 function mergeInto(merged, inputProps) {
968 if (isPropsGetter(inputProps)) {
969 return resolvePropsGetter(inputProps, merged);
970 }
971 return mutablyMergeInto(merged, inputProps);
972 }
973 function copyInitialProps(inputProps) {
974 const copiedProps = {
975 ...inputProps
976 };
977 for (const propName in copiedProps) {
978 const propValue = copiedProps[propName];
979 if (isEventHandler(propName, propValue)) {
980 copiedProps[propName] = wrapEventHandler(propValue);
981 }
982 }
983 return copiedProps;
984 }
985 function mutablyMergeInto(mergedProps, externalProps) {
986 if (!externalProps) {
987 return mergedProps;
988 }
989 for (const propName in externalProps) {
990 const externalPropValue = externalProps[propName];
991 switch (propName) {
992 case "style": {
993 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
994 break;
995 }
996 case "className": {
997 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
998 break;
999 }
1000 default: {
1001 if (isEventHandler(propName, externalPropValue)) {
1002 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
1003 } else {
1004 mergedProps[propName] = externalPropValue;
1005 }
1006 }
1007 }
1008 }
1009 return mergedProps;
1010 }
1011 function isEventHandler(key, value) {
1012 const code0 = key.charCodeAt(0);
1013 const code1 = key.charCodeAt(1);
1014 const code2 = key.charCodeAt(2);
1015 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
1016 }
1017 function isPropsGetter(inputProps) {
1018 return typeof inputProps === "function";
1019 }
1020 function resolvePropsGetter(inputProps, previousProps) {
1021 if (isPropsGetter(inputProps)) {
1022 return inputProps(previousProps);
1023 }
1024 return inputProps ?? EMPTY_PROPS;
1025 }
1026 function mergeEventHandlers(ourHandler, theirHandler) {
1027 if (!theirHandler) {
1028 return ourHandler;
1029 }
1030 if (!ourHandler) {
1031 return wrapEventHandler(theirHandler);
1032 }
1033 return (...args) => {
1034 const event = args[0];
1035 if (isSyntheticEvent(event)) {
1036 const baseUIEvent = event;
1037 makeEventPreventable(baseUIEvent);
1038 const result2 = theirHandler(...args);
1039 if (!baseUIEvent.baseUIHandlerPrevented) {
1040 ourHandler?.(...args);
1041 }
1042 return result2;
1043 }
1044 const result = theirHandler(...args);
1045 ourHandler?.(...args);
1046 return result;
1047 };
1048 }
1049 function wrapEventHandler(handler) {
1050 if (!handler) {
1051 return handler;
1052 }
1053 return (...args) => {
1054 const event = args[0];
1055 if (isSyntheticEvent(event)) {
1056 makeEventPreventable(event);
1057 }
1058 return handler(...args);
1059 };
1060 }
1061 function makeEventPreventable(event) {
1062 event.preventBaseUIHandler = () => {
1063 event.baseUIHandlerPrevented = true;
1064 };
1065 return event;
1066 }
1067 function mergeClassNames(ourClassName, theirClassName) {
1068 if (theirClassName) {
1069 if (ourClassName) {
1070 return theirClassName + " " + ourClassName;
1071 }
1072 return theirClassName;
1073 }
1074 return ourClassName;
1075 }
1076 function isSyntheticEvent(event) {
1077 return event != null && typeof event === "object" && "nativeEvent" in event;
1078 }
1079
1080 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
1081 var import_react = __toESM(require_react(), 1);
1082 function useRenderElement(element, componentProps, params = {}) {
1083 const renderProp = componentProps.render;
1084 const outProps = useRenderElementProps(componentProps, params);
1085 if (params.enabled === false) {
1086 return null;
1087 }
1088 const state = params.state ?? EMPTY_OBJECT;
1089 return evaluateRenderProp(element, renderProp, outProps, state);
1090 }
1091 function useRenderElementProps(componentProps, params = {}) {
1092 const {
1093 className: classNameProp,
1094 style: styleProp,
1095 render: renderProp
1096 } = componentProps;
1097 const {
1098 state = EMPTY_OBJECT,
1099 ref,
1100 props,
1101 stateAttributesMapping: stateAttributesMapping3,
1102 enabled = true
1103 } = params;
1104 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
1105 const style = enabled ? resolveStyle(styleProp, state) : void 0;
1106 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT;
1107 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
1108 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
1109 if (typeof document !== "undefined") {
1110 if (!enabled) {
1111 useMergedRefs(null, null);
1112 } else if (Array.isArray(ref)) {
1113 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
1114 } else {
1115 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
1116 }
1117 }
1118 if (!enabled) {
1119 return EMPTY_OBJECT;
1120 }
1121 if (className !== void 0) {
1122 outProps.className = mergeClassNames(outProps.className, className);
1123 }
1124 if (style !== void 0) {
1125 outProps.style = mergeObjects(outProps.style, style);
1126 }
1127 return outProps;
1128 }
1129 function resolveRenderFunctionProps(props) {
1130 if (Array.isArray(props)) {
1131 return mergePropsN(props);
1132 }
1133 return mergeProps(void 0, props);
1134 }
1135 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
1136 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
1137 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
1138 function evaluateRenderProp(element, render, props, state) {
1139 if (render) {
1140 if (typeof render === "function") {
1141 if (true) {
1142 warnIfRenderPropLooksLikeComponent(render);
1143 }
1144 return render(props, state);
1145 }
1146 const mergedProps = mergeProps(props, render.props);
1147 mergedProps.ref = props.ref;
1148 let newElement = render;
1149 if (newElement?.$$typeof === REACT_LAZY_TYPE) {
1150 const children = React10.Children.toArray(render);
1151 newElement = children[0];
1152 }
1153 if (true) {
1154 if (!/* @__PURE__ */ React10.isValidElement(newElement)) {
1155 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
1156 }
1157 }
1158 return /* @__PURE__ */ React10.cloneElement(newElement, mergedProps);
1159 }
1160 if (element) {
1161 if (typeof element === "string") {
1162 return renderTag(element, props);
1163 }
1164 }
1165 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
1166 }
1167 function warnIfRenderPropLooksLikeComponent(renderFn) {
1168 const functionName = renderFn.name;
1169 if (functionName.length === 0) {
1170 return;
1171 }
1172 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
1173 return;
1174 }
1175 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
1176 return;
1177 }
1178 warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
1179 }
1180 function renderTag(Tag, props) {
1181 if (Tag === "button") {
1182 return /* @__PURE__ */ (0, import_react.createElement)("button", {
1183 type: "button",
1184 ...props,
1185 key: props.key
1186 });
1187 }
1188 if (Tag === "img") {
1189 return /* @__PURE__ */ (0, import_react.createElement)("img", {
1190 alt: "",
1191 ...props,
1192 key: props.key
1193 });
1194 }
1195 return /* @__PURE__ */ React10.createElement(Tag, props);
1196 }
1197
1198 // node_modules/@base-ui/react/esm/internals/reason-parts.js
1199 var reason_parts_exports = {};
1200 __export(reason_parts_exports, {
1201 cancelOpen: () => cancelOpen,
1202 chipRemovePress: () => chipRemovePress,
1203 clearPress: () => clearPress,
1204 closePress: () => closePress,
1205 closeWatcher: () => closeWatcher,
1206 decrementPress: () => decrementPress,
1207 disabled: () => disabled,
1208 drag: () => drag,
1209 escapeKey: () => escapeKey,
1210 focusOut: () => focusOut,
1211 imperativeAction: () => imperativeAction,
1212 incrementPress: () => incrementPress,
1213 initial: () => initial,
1214 inputBlur: () => inputBlur,
1215 inputChange: () => inputChange,
1216 inputClear: () => inputClear,
1217 inputPaste: () => inputPaste,
1218 inputPress: () => inputPress,
1219 itemPress: () => itemPress,
1220 keyboard: () => keyboard,
1221 linkPress: () => linkPress,
1222 listNavigation: () => listNavigation,
1223 missing: () => missing,
1224 none: () => none,
1225 outsidePress: () => outsidePress,
1226 pointer: () => pointer,
1227 scrub: () => scrub,
1228 siblingOpen: () => siblingOpen,
1229 swipe: () => swipe,
1230 trackPress: () => trackPress,
1231 triggerFocus: () => triggerFocus,
1232 triggerHover: () => triggerHover,
1233 triggerPress: () => triggerPress,
1234 wheel: () => wheel,
1235 windowResize: () => windowResize
1236 });
1237 var none = "none";
1238 var triggerPress = "trigger-press";
1239 var triggerHover = "trigger-hover";
1240 var triggerFocus = "trigger-focus";
1241 var outsidePress = "outside-press";
1242 var itemPress = "item-press";
1243 var closePress = "close-press";
1244 var linkPress = "link-press";
1245 var clearPress = "clear-press";
1246 var chipRemovePress = "chip-remove-press";
1247 var trackPress = "track-press";
1248 var incrementPress = "increment-press";
1249 var decrementPress = "decrement-press";
1250 var inputChange = "input-change";
1251 var inputClear = "input-clear";
1252 var inputBlur = "input-blur";
1253 var inputPaste = "input-paste";
1254 var inputPress = "input-press";
1255 var focusOut = "focus-out";
1256 var escapeKey = "escape-key";
1257 var closeWatcher = "close-watcher";
1258 var listNavigation = "list-navigation";
1259 var keyboard = "keyboard";
1260 var pointer = "pointer";
1261 var drag = "drag";
1262 var wheel = "wheel";
1263 var scrub = "scrub";
1264 var cancelOpen = "cancel-open";
1265 var siblingOpen = "sibling-open";
1266 var disabled = "disabled";
1267 var missing = "missing";
1268 var initial = "initial";
1269 var imperativeAction = "imperative-action";
1270 var swipe = "swipe";
1271 var windowResize = "window-resize";
1272
1273 // node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js
1274 function createChangeEventDetails(reason, event, trigger, customProperties) {
1275 let canceled = false;
1276 let allowPropagation = false;
1277 const custom = customProperties ?? EMPTY_OBJECT;
1278 const details = {
1279 reason,
1280 event: event ?? new Event("base-ui"),
1281 cancel() {
1282 canceled = true;
1283 },
1284 allowPropagation() {
1285 allowPropagation = true;
1286 },
1287 get isCanceled() {
1288 return canceled;
1289 },
1290 get isPropagationAllowed() {
1291 return allowPropagation;
1292 },
1293 trigger,
1294 ...custom
1295 };
1296 return details;
1297 }
1298
1299 // node_modules/@base-ui/utils/esm/useId.js
1300 var React11 = __toESM(require_react(), 1);
1301 var globalId = 0;
1302 function useGlobalId(idOverride, prefix = "mui") {
1303 const [defaultId, setDefaultId] = React11.useState(idOverride);
1304 const id = idOverride || defaultId;
1305 React11.useEffect(() => {
1306 if (defaultId == null) {
1307 globalId += 1;
1308 setDefaultId(`${prefix}-${globalId}`);
1309 }
1310 }, [defaultId, prefix]);
1311 return id;
1312 }
1313 var maybeReactUseId = SafeReact.useId;
1314 function useId(idOverride, prefix) {
1315 if (maybeReactUseId !== void 0) {
1316 const reactId = maybeReactUseId();
1317 return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
1318 }
1319 return useGlobalId(idOverride, prefix);
1320 }
1321
1322 // node_modules/@base-ui/react/esm/internals/useBaseUiId.js
1323 function useBaseUiId(idOverride) {
1324 return useId(idOverride, "base-ui");
1325 }
1326
1327 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js
1328 var React13 = __toESM(require_react(), 1);
1329
1330 // node_modules/@base-ui/utils/esm/useOnMount.js
1331 var React12 = __toESM(require_react(), 1);
1332 var EMPTY = [];
1333 function useOnMount(fn) {
1334 React12.useEffect(fn, EMPTY);
1335 }
1336
1337 // node_modules/@base-ui/utils/esm/useAnimationFrame.js
1338 var EMPTY2 = null;
1339 var LAST_RAF = globalThis.requestAnimationFrame;
1340 var Scheduler = class {
1341 /* This implementation uses an array as a backing data-structure for frame callbacks.
1342 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1343 * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1344 * be much more efficient if there is a call pattern that alterns as
1345 * "request-cancel-request-cancel-…".
1346 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1347 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1348 callbacks = [];
1349 callbacksCount = 0;
1350 nextId = 1;
1351 startId = 1;
1352 isScheduled = false;
1353 tick = (timestamp) => {
1354 this.isScheduled = false;
1355 const currentCallbacks = this.callbacks;
1356 const currentCallbacksCount = this.callbacksCount;
1357 this.callbacks = [];
1358 this.callbacksCount = 0;
1359 this.startId = this.nextId;
1360 if (currentCallbacksCount > 0) {
1361 for (let i = 0; i < currentCallbacks.length; i += 1) {
1362 currentCallbacks[i]?.(timestamp);
1363 }
1364 }
1365 };
1366 request(fn) {
1367 const id = this.nextId;
1368 this.nextId += 1;
1369 this.callbacks.push(fn);
1370 this.callbacksCount += 1;
1371 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1372 if (!this.isScheduled || didRAFChange) {
1373 requestAnimationFrame(this.tick);
1374 this.isScheduled = true;
1375 }
1376 return id;
1377 }
1378 cancel(id) {
1379 const index = id - this.startId;
1380 if (index < 0 || index >= this.callbacks.length) {
1381 return;
1382 }
1383 this.callbacks[index] = null;
1384 this.callbacksCount -= 1;
1385 }
1386 };
1387 var scheduler = new Scheduler();
1388 var AnimationFrame = class _AnimationFrame {
1389 static create() {
1390 return new _AnimationFrame();
1391 }
1392 static request(fn) {
1393 return scheduler.request(fn);
1394 }
1395 static cancel(id) {
1396 return scheduler.cancel(id);
1397 }
1398 currentId = EMPTY2;
1399 /**
1400 * Executes `fn` after `delay`, clearing any previously scheduled call.
1401 */
1402 request(fn) {
1403 this.cancel();
1404 this.currentId = scheduler.request(() => {
1405 this.currentId = EMPTY2;
1406 fn();
1407 });
1408 }
1409 cancel = () => {
1410 if (this.currentId !== EMPTY2) {
1411 scheduler.cancel(this.currentId);
1412 this.currentId = EMPTY2;
1413 }
1414 };
1415 disposeEffect = () => {
1416 return this.cancel;
1417 };
1418 };
1419 function useAnimationFrame() {
1420 const timeout = useRefWithInit(AnimationFrame.create).current;
1421 useOnMount(timeout.disposeEffect);
1422 return timeout;
1423 }
1424
1425 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js
1426 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
1427 const [transitionStatus, setTransitionStatus] = React13.useState(open && enableIdleState ? "idle" : void 0);
1428 const [mounted, setMounted] = React13.useState(open);
1429 if (open && !mounted) {
1430 setMounted(true);
1431 setTransitionStatus("starting");
1432 }
1433 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) {
1434 setTransitionStatus("ending");
1435 }
1436 if (!open && !mounted && transitionStatus === "ending") {
1437 setTransitionStatus(void 0);
1438 }
1439 useIsoLayoutEffect(() => {
1440 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) {
1441 const frame = AnimationFrame.request(() => {
1442 setTransitionStatus("ending");
1443 });
1444 return () => {
1445 AnimationFrame.cancel(frame);
1446 };
1447 }
1448 return void 0;
1449 }, [open, mounted, transitionStatus, deferEndingState]);
1450 useIsoLayoutEffect(() => {
1451 if (!open || enableIdleState) {
1452 return void 0;
1453 }
1454 const frame = AnimationFrame.request(() => {
1455 setTransitionStatus(void 0);
1456 });
1457 return () => {
1458 AnimationFrame.cancel(frame);
1459 };
1460 }, [enableIdleState, open]);
1461 useIsoLayoutEffect(() => {
1462 if (!open || !enableIdleState) {
1463 return void 0;
1464 }
1465 if (open && mounted && transitionStatus !== "idle") {
1466 setTransitionStatus("starting");
1467 }
1468 const frame = AnimationFrame.request(() => {
1469 setTransitionStatus("idle");
1470 });
1471 return () => {
1472 AnimationFrame.cancel(frame);
1473 };
1474 }, [enableIdleState, open, mounted, transitionStatus]);
1475 return {
1476 mounted,
1477 setMounted,
1478 transitionStatus
1479 };
1480 }
1481
1482 // node_modules/@base-ui/react/esm/internals/composite/list/useCompositeListItem.js
1483 var React14 = __toESM(require_react(), 1);
1484 var IndexGuessBehavior = /* @__PURE__ */ (function(IndexGuessBehavior2) {
1485 IndexGuessBehavior2[IndexGuessBehavior2["None"] = 0] = "None";
1486 IndexGuessBehavior2[IndexGuessBehavior2["GuessFromOrder"] = 1] = "GuessFromOrder";
1487 return IndexGuessBehavior2;
1488 })({});
1489 function useCompositeListItem(params = {}) {
1490 const {
1491 label,
1492 metadata,
1493 textRef,
1494 indexGuessBehavior,
1495 index: externalIndex
1496 } = params;
1497 const {
1498 register,
1499 unregister,
1500 subscribeMapChange,
1501 elementsRef,
1502 labelsRef,
1503 nextIndexRef
1504 } = useCompositeListContext();
1505 const indexRef = React14.useRef(-1);
1506 const [index, setIndex] = React14.useState(externalIndex ?? (indexGuessBehavior === IndexGuessBehavior.GuessFromOrder ? () => {
1507 if (indexRef.current === -1) {
1508 const newIndex = nextIndexRef.current;
1509 nextIndexRef.current += 1;
1510 indexRef.current = newIndex;
1511 }
1512 return indexRef.current;
1513 } : -1));
1514 const componentRef = React14.useRef(null);
1515 const ref = React14.useCallback((node) => {
1516 componentRef.current = node;
1517 if (index !== -1 && node !== null) {
1518 elementsRef.current[index] = node;
1519 if (labelsRef) {
1520 const isLabelDefined = label !== void 0;
1521 labelsRef.current[index] = isLabelDefined ? label : textRef?.current?.textContent ?? node.textContent;
1522 }
1523 }
1524 }, [index, elementsRef, labelsRef, label, textRef]);
1525 useIsoLayoutEffect(() => {
1526 if (externalIndex != null) {
1527 return void 0;
1528 }
1529 const node = componentRef.current;
1530 if (node) {
1531 register(node, metadata);
1532 return () => {
1533 unregister(node);
1534 };
1535 }
1536 return void 0;
1537 }, [externalIndex, register, unregister, metadata]);
1538 useIsoLayoutEffect(() => {
1539 if (externalIndex != null) {
1540 return void 0;
1541 }
1542 return subscribeMapChange((map) => {
1543 const i = componentRef.current ? map.get(componentRef.current)?.index : null;
1544 if (i != null) {
1545 setIndex(i);
1546 }
1547 });
1548 }, [externalIndex, subscribeMapChange, setIndex]);
1549 return React14.useMemo(() => ({
1550 ref,
1551 index
1552 }), [index, ref]);
1553 }
1554
1555 // node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js
1556 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
1557 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
1558 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style";
1559 return TransitionStatusDataAttributes2;
1560 })({});
1561 var STARTING_HOOK = {
1562 [TransitionStatusDataAttributes.startingStyle]: ""
1563 };
1564 var ENDING_HOOK = {
1565 [TransitionStatusDataAttributes.endingStyle]: ""
1566 };
1567 var transitionStatusMapping = {
1568 transitionStatus(value) {
1569 if (value === "starting") {
1570 return STARTING_HOOK;
1571 }
1572 if (value === "ending") {
1573 return ENDING_HOOK;
1574 }
1575 return null;
1576 }
1577 };
1578
1579 // node_modules/@base-ui/utils/esm/isElementDisabled.js
1580 function isElementDisabled(element) {
1581 return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
1582 }
1583
1584 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js
1585 var React17 = __toESM(require_react(), 1);
1586
1587 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1588 function hasWindow() {
1589 return typeof window !== "undefined";
1590 }
1591 function getWindow(node) {
1592 var _node$ownerDocument;
1593 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1594 }
1595 function isHTMLElement(value) {
1596 if (!hasWindow()) {
1597 return false;
1598 }
1599 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1600 }
1601 function isShadowRoot(value) {
1602 if (!hasWindow() || typeof ShadowRoot === "undefined") {
1603 return false;
1604 }
1605 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1606 }
1607 function getComputedStyle2(element) {
1608 return getWindow(element).getComputedStyle(element);
1609 }
1610
1611 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js
1612 var React15 = __toESM(require_react(), 1);
1613 var CompositeRootContext = /* @__PURE__ */ React15.createContext(void 0);
1614 if (true) CompositeRootContext.displayName = "CompositeRootContext";
1615 function useCompositeRootContext(optional = false) {
1616 const context = React15.useContext(CompositeRootContext);
1617 if (context === void 0 && !optional) {
1618 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16));
1619 }
1620 return context;
1621 }
1622
1623 // node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js
1624 var React16 = __toESM(require_react(), 1);
1625 function useFocusableWhenDisabled(parameters) {
1626 const {
1627 focusableWhenDisabled,
1628 disabled: disabled2,
1629 composite = false,
1630 tabIndex: tabIndexProp = 0,
1631 isNativeButton
1632 } = parameters;
1633 const isFocusableComposite = composite && focusableWhenDisabled !== false;
1634 const isNonFocusableComposite = composite && focusableWhenDisabled === false;
1635 const props = React16.useMemo(() => {
1636 const additionalProps = {
1637 // allow Tabbing away from focusableWhenDisabled elements
1638 onKeyDown(event) {
1639 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") {
1640 event.preventDefault();
1641 }
1642 }
1643 };
1644 if (!composite) {
1645 additionalProps.tabIndex = tabIndexProp;
1646 if (!isNativeButton && disabled2) {
1647 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
1648 }
1649 }
1650 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) {
1651 additionalProps["aria-disabled"] = disabled2;
1652 }
1653 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
1654 additionalProps.disabled = disabled2;
1655 }
1656 return additionalProps;
1657 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
1658 return {
1659 props
1660 };
1661 }
1662
1663 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js
1664 function useButton(parameters = {}) {
1665 const {
1666 disabled: disabled2 = false,
1667 focusableWhenDisabled,
1668 tabIndex = 0,
1669 native: isNativeButton = true,
1670 composite: compositeProp
1671 } = parameters;
1672 const elementRef = React17.useRef(null);
1673 const compositeRootContext = useCompositeRootContext(true);
1674 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
1675 const {
1676 props: focusableWhenDisabledProps
1677 } = useFocusableWhenDisabled({
1678 focusableWhenDisabled,
1679 disabled: disabled2,
1680 composite: isCompositeItem,
1681 tabIndex,
1682 isNativeButton
1683 });
1684 if (true) {
1685 React17.useEffect(() => {
1686 if (!elementRef.current) {
1687 return;
1688 }
1689 const isButtonTag = isButtonElement(elementRef.current);
1690 if (isNativeButton) {
1691 if (!isButtonTag) {
1692 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1693 const message = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`.";
1694 error(`${message}${ownerStackMessage}`);
1695 }
1696 } else if (isButtonTag) {
1697 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1698 const message = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`.";
1699 error(`${message}${ownerStackMessage}`);
1700 }
1701 }, [isNativeButton]);
1702 }
1703 const updateDisabled = React17.useCallback(() => {
1704 const element = elementRef.current;
1705 if (!isButtonElement(element)) {
1706 return;
1707 }
1708 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) {
1709 element.disabled = false;
1710 }
1711 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]);
1712 useIsoLayoutEffect(updateDisabled, [updateDisabled]);
1713 const getButtonProps = React17.useCallback((externalProps = {}) => {
1714 const {
1715 onClick: externalOnClick,
1716 onMouseDown: externalOnMouseDown,
1717 onKeyUp: externalOnKeyUp,
1718 onKeyDown: externalOnKeyDown,
1719 onPointerDown: externalOnPointerDown,
1720 ...otherExternalProps
1721 } = externalProps;
1722 return mergeProps({
1723 onClick(event) {
1724 if (disabled2) {
1725 event.preventDefault();
1726 return;
1727 }
1728 externalOnClick?.(event);
1729 },
1730 onMouseDown(event) {
1731 if (!disabled2) {
1732 externalOnMouseDown?.(event);
1733 }
1734 },
1735 onKeyDown(event) {
1736 if (disabled2) {
1737 return;
1738 }
1739 makeEventPreventable(event);
1740 externalOnKeyDown?.(event);
1741 if (event.baseUIHandlerPrevented) {
1742 return;
1743 }
1744 const isCurrentTarget = event.target === event.currentTarget;
1745 const currentTarget = event.currentTarget;
1746 const isButton = isButtonElement(currentTarget);
1747 const isLink = !isNativeButton && isValidLinkElement(currentTarget);
1748 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
1749 const isEnterKey = event.key === "Enter";
1750 const isSpaceKey = event.key === " ";
1751 const role = currentTarget.getAttribute("role");
1752 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
1753 if (isCurrentTarget && isCompositeItem && isSpaceKey) {
1754 if (event.defaultPrevented && isTextNavigationRole) {
1755 return;
1756 }
1757 event.preventDefault();
1758 if (isLink || isNativeButton && isButton) {
1759 currentTarget.click();
1760 event.preventBaseUIHandler();
1761 } else if (shouldClick) {
1762 externalOnClick?.(event);
1763 event.preventBaseUIHandler();
1764 }
1765 return;
1766 }
1767 if (shouldClick) {
1768 if (!isNativeButton && (isSpaceKey || isEnterKey)) {
1769 event.preventDefault();
1770 }
1771 if (!isNativeButton && isEnterKey) {
1772 externalOnClick?.(event);
1773 }
1774 }
1775 },
1776 onKeyUp(event) {
1777 if (disabled2) {
1778 return;
1779 }
1780 makeEventPreventable(event);
1781 externalOnKeyUp?.(event);
1782 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
1783 event.preventDefault();
1784 return;
1785 }
1786 if (event.baseUIHandlerPrevented) {
1787 return;
1788 }
1789 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") {
1790 externalOnClick?.(event);
1791 }
1792 },
1793 onPointerDown(event) {
1794 if (disabled2) {
1795 event.preventDefault();
1796 return;
1797 }
1798 externalOnPointerDown?.(event);
1799 }
1800 }, isNativeButton ? {
1801 type: "button"
1802 } : {
1803 role: "button"
1804 }, focusableWhenDisabledProps, otherExternalProps);
1805 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
1806 const buttonRef = useStableCallback((element) => {
1807 elementRef.current = element;
1808 updateDisabled();
1809 });
1810 return {
1811 getButtonProps,
1812 buttonRef
1813 };
1814 }
1815 function isButtonElement(elem) {
1816 return isHTMLElement(elem) && elem.tagName === "BUTTON";
1817 }
1818 function isValidLinkElement(elem) {
1819 return Boolean(elem?.tagName === "A" && elem?.href);
1820 }
1821
1822 // node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js
1823 var ARROW_LEFT = "ArrowLeft";
1824 var ARROW_RIGHT = "ArrowRight";
1825 var ARROW_UP = "ArrowUp";
1826 var ARROW_DOWN = "ArrowDown";
1827
1828 // node_modules/@base-ui/react/esm/internals/shadowDom.js
1829 function activeElement(doc) {
1830 let element = doc.activeElement;
1831 while (element?.shadowRoot?.activeElement != null) {
1832 element = element.shadowRoot.activeElement;
1833 }
1834 return element;
1835 }
1836 function contains(parent, child) {
1837 if (!parent || !child) {
1838 return false;
1839 }
1840 const rootNode = child.getRootNode?.();
1841 if (parent.contains(child)) {
1842 return true;
1843 }
1844 if (rootNode && isShadowRoot(rootNode)) {
1845 let next = child;
1846 while (next) {
1847 if (parent === next) {
1848 return true;
1849 }
1850 next = next.parentNode || next.host;
1851 }
1852 }
1853 return false;
1854 }
1855 function getTarget(event) {
1856 if ("composedPath" in event) {
1857 return event.composedPath()[0];
1858 }
1859 return event.target;
1860 }
1861
1862 // node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js
1863 function stopEvent(event) {
1864 event.preventDefault();
1865 event.stopPropagation();
1866 }
1867
1868 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
1869 var round = Math.round;
1870 var floor = Math.floor;
1871
1872 // node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js
1873 function isDifferentGridRow(index, cols, prevRow) {
1874 return Math.floor(index / cols) !== prevRow;
1875 }
1876 function isIndexOutOfListBounds(list, index) {
1877 return index < 0 || index >= list.length;
1878 }
1879 function getMinListIndex(listRef, disabledIndices) {
1880 return findNonDisabledListIndex(listRef.current, {
1881 disabledIndices
1882 });
1883 }
1884 function getMaxListIndex(listRef, disabledIndices) {
1885 return findNonDisabledListIndex(listRef.current, {
1886 decrement: true,
1887 startingIndex: listRef.current.length,
1888 disabledIndices
1889 });
1890 }
1891 function findNonDisabledListIndex(list, {
1892 startingIndex = -1,
1893 decrement = false,
1894 disabledIndices,
1895 amount = 1
1896 } = {}) {
1897 let index = startingIndex;
1898 do {
1899 index += decrement ? -amount : amount;
1900 } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));
1901 return index;
1902 }
1903 function getGridNavigatedIndex(list, {
1904 event,
1905 orientation,
1906 loopFocus,
1907 onLoop,
1908 rtl,
1909 cols,
1910 disabledIndices,
1911 minIndex,
1912 maxIndex,
1913 prevIndex,
1914 stopEvent: stop = false
1915 }) {
1916 let nextIndex = prevIndex;
1917 let verticalDirection;
1918 if (event.key === ARROW_UP) {
1919 verticalDirection = "up";
1920 } else if (event.key === ARROW_DOWN) {
1921 verticalDirection = "down";
1922 }
1923 if (verticalDirection) {
1924 const rows = [];
1925 const rowIndexMap = [];
1926 let hasRoleRow = false;
1927 let visibleItemCount = 0;
1928 {
1929 let currentRowEl = null;
1930 let currentRowIndex = -1;
1931 list.forEach((el, idx) => {
1932 if (el == null) {
1933 return;
1934 }
1935 visibleItemCount += 1;
1936 const rowEl = el.closest('[role="row"]');
1937 if (rowEl) {
1938 hasRoleRow = true;
1939 }
1940 if (rowEl !== currentRowEl || currentRowIndex === -1) {
1941 currentRowEl = rowEl;
1942 currentRowIndex += 1;
1943 rows[currentRowIndex] = [];
1944 }
1945 rows[currentRowIndex].push(idx);
1946 rowIndexMap[idx] = currentRowIndex;
1947 });
1948 }
1949 let hasDomRows = false;
1950 let inferredDomCols = 0;
1951 if (hasRoleRow) {
1952 for (const row of rows) {
1953 const rowLength = row.length;
1954 if (rowLength > inferredDomCols) {
1955 inferredDomCols = rowLength;
1956 }
1957 if (rowLength !== cols) {
1958 hasDomRows = true;
1959 }
1960 }
1961 }
1962 const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;
1963 const verticalCols = inferredDomCols || cols;
1964 const navigateVertically = (direction) => {
1965 if (!hasDomRows || prevIndex === -1) {
1966 return void 0;
1967 }
1968 const currentRow = rowIndexMap[prevIndex];
1969 if (currentRow == null) {
1970 return void 0;
1971 }
1972 const colInRow = rows[currentRow].indexOf(prevIndex);
1973 const step = direction === "up" ? -1 : 1;
1974 for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {
1975 if (nextRow < 0 || nextRow >= rows.length) {
1976 if (!loopFocus || hasVirtualizedGaps) {
1977 return void 0;
1978 }
1979 nextRow = nextRow < 0 ? rows.length - 1 : 0;
1980 if (onLoop) {
1981 const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);
1982 const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];
1983 const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);
1984 nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;
1985 }
1986 }
1987 const targetRow = rows[nextRow];
1988 for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {
1989 const candidate = targetRow[col];
1990 if (!isListIndexDisabled(list, candidate, disabledIndices)) {
1991 return candidate;
1992 }
1993 }
1994 }
1995 return void 0;
1996 };
1997 const navigateVerticallyWithInferredRows = (direction) => {
1998 if (!hasVirtualizedGaps || prevIndex === -1) {
1999 return void 0;
2000 }
2001 const colInRow = prevIndex % verticalCols;
2002 const rowStep = direction === "up" ? -verticalCols : verticalCols;
2003 const lastRowStart = maxIndex - maxIndex % verticalCols;
2004 const rowCount = floor(maxIndex / verticalCols) + 1;
2005 for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {
2006 if (rowStart < 0 || rowStart > maxIndex) {
2007 if (!loopFocus) {
2008 return void 0;
2009 }
2010 rowStart = rowStart < 0 ? lastRowStart : 0;
2011 }
2012 const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);
2013 for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {
2014 if (!isListIndexDisabled(list, candidate, disabledIndices)) {
2015 return candidate;
2016 }
2017 }
2018 }
2019 return void 0;
2020 };
2021 if (stop) {
2022 stopEvent(event);
2023 }
2024 const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);
2025 if (verticalCandidate !== void 0) {
2026 nextIndex = verticalCandidate;
2027 } else if (prevIndex === -1) {
2028 nextIndex = verticalDirection === "up" ? maxIndex : minIndex;
2029 } else {
2030 nextIndex = findNonDisabledListIndex(list, {
2031 startingIndex: prevIndex,
2032 amount: verticalCols,
2033 decrement: verticalDirection === "up",
2034 disabledIndices
2035 });
2036 if (loopFocus) {
2037 if (verticalDirection === "up" && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {
2038 const col = prevIndex % verticalCols;
2039 const maxCol = maxIndex % verticalCols;
2040 const offset = maxIndex - (maxCol - col);
2041 if (maxCol === col) {
2042 nextIndex = maxIndex;
2043 } else {
2044 nextIndex = maxCol > col ? offset : offset - verticalCols;
2045 }
2046 if (onLoop) {
2047 nextIndex = onLoop(event, prevIndex, nextIndex);
2048 }
2049 }
2050 if (verticalDirection === "down" && prevIndex + verticalCols > maxIndex) {
2051 nextIndex = findNonDisabledListIndex(list, {
2052 startingIndex: prevIndex % verticalCols - verticalCols,
2053 amount: verticalCols,
2054 disabledIndices
2055 });
2056 if (onLoop) {
2057 nextIndex = onLoop(event, prevIndex, nextIndex);
2058 }
2059 }
2060 }
2061 }
2062 if (isIndexOutOfListBounds(list, nextIndex)) {
2063 nextIndex = prevIndex;
2064 }
2065 }
2066 if (orientation === "both") {
2067 const prevRow = floor(prevIndex / cols);
2068 if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {
2069 if (stop) {
2070 stopEvent(event);
2071 }
2072 if (prevIndex % cols !== cols - 1) {
2073 nextIndex = findNonDisabledListIndex(list, {
2074 startingIndex: prevIndex,
2075 disabledIndices
2076 });
2077 if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
2078 nextIndex = findNonDisabledListIndex(list, {
2079 startingIndex: prevIndex - prevIndex % cols - 1,
2080 disabledIndices
2081 });
2082 if (onLoop) {
2083 nextIndex = onLoop(event, prevIndex, nextIndex);
2084 }
2085 }
2086 } else if (loopFocus) {
2087 nextIndex = findNonDisabledListIndex(list, {
2088 startingIndex: prevIndex - prevIndex % cols - 1,
2089 disabledIndices
2090 });
2091 if (onLoop) {
2092 nextIndex = onLoop(event, prevIndex, nextIndex);
2093 }
2094 }
2095 if (isDifferentGridRow(nextIndex, cols, prevRow)) {
2096 nextIndex = prevIndex;
2097 }
2098 }
2099 if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {
2100 if (stop) {
2101 stopEvent(event);
2102 }
2103 if (prevIndex % cols !== 0) {
2104 nextIndex = findNonDisabledListIndex(list, {
2105 startingIndex: prevIndex,
2106 decrement: true,
2107 disabledIndices
2108 });
2109 if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
2110 nextIndex = findNonDisabledListIndex(list, {
2111 startingIndex: prevIndex + (cols - prevIndex % cols),
2112 decrement: true,
2113 disabledIndices
2114 });
2115 if (onLoop) {
2116 nextIndex = onLoop(event, prevIndex, nextIndex);
2117 }
2118 }
2119 } else if (loopFocus) {
2120 nextIndex = findNonDisabledListIndex(list, {
2121 startingIndex: prevIndex + (cols - prevIndex % cols),
2122 decrement: true,
2123 disabledIndices
2124 });
2125 if (onLoop) {
2126 nextIndex = onLoop(event, prevIndex, nextIndex);
2127 }
2128 }
2129 if (isDifferentGridRow(nextIndex, cols, prevRow)) {
2130 nextIndex = prevIndex;
2131 }
2132 }
2133 const lastRow = floor(maxIndex / cols) === prevRow;
2134 if (isIndexOutOfListBounds(list, nextIndex)) {
2135 if (loopFocus && lastRow) {
2136 nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {
2137 startingIndex: prevIndex - prevIndex % cols - 1,
2138 disabledIndices
2139 });
2140 if (onLoop) {
2141 nextIndex = onLoop(event, prevIndex, nextIndex);
2142 }
2143 } else {
2144 nextIndex = prevIndex;
2145 }
2146 }
2147 }
2148 return nextIndex;
2149 }
2150 function createGridCellMap(sizes, cols, dense) {
2151 const cellMap = [];
2152 let startIndex = 0;
2153 sizes.forEach(({
2154 width,
2155 height
2156 }, index) => {
2157 if (width > cols) {
2158 if (true) {
2159 throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);
2160 }
2161 }
2162 let itemPlaced = false;
2163 if (dense) {
2164 startIndex = 0;
2165 }
2166 while (!itemPlaced) {
2167 const targetCells = [];
2168 for (let i = 0; i < width; i += 1) {
2169 for (let j = 0; j < height; j += 1) {
2170 targetCells.push(startIndex + i + j * cols);
2171 }
2172 }
2173 if (startIndex % cols + width <= cols && targetCells.every((cell) => cellMap[cell] == null)) {
2174 targetCells.forEach((cell) => {
2175 cellMap[cell] = index;
2176 });
2177 itemPlaced = true;
2178 } else {
2179 startIndex += 1;
2180 }
2181 }
2182 });
2183 return [...cellMap];
2184 }
2185 function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
2186 if (index === -1) {
2187 return -1;
2188 }
2189 const firstCellIndex = cellMap.indexOf(index);
2190 const sizeItem = sizes[index];
2191 switch (corner) {
2192 case "tl":
2193 return firstCellIndex;
2194 case "tr":
2195 if (!sizeItem) {
2196 return firstCellIndex;
2197 }
2198 return firstCellIndex + sizeItem.width - 1;
2199 case "bl":
2200 if (!sizeItem) {
2201 return firstCellIndex;
2202 }
2203 return firstCellIndex + (sizeItem.height - 1) * cols;
2204 case "br":
2205 return cellMap.lastIndexOf(index);
2206 default:
2207 return -1;
2208 }
2209 }
2210 function getGridCellIndices(indices, cellMap) {
2211 return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);
2212 }
2213 function isListIndexDisabled(list, index, disabledIndices) {
2214 const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;
2215 if (isExplicitlyDisabled) {
2216 return true;
2217 }
2218 const element = list[index];
2219 if (!element) {
2220 return false;
2221 }
2222 if (!isElementVisible(element)) {
2223 return true;
2224 }
2225 return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true");
2226 }
2227 function isHiddenByStyles(styles) {
2228 return styles.visibility === "hidden" || styles.visibility === "collapse";
2229 }
2230 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
2231 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
2232 return false;
2233 }
2234 if (typeof element.checkVisibility === "function") {
2235 return element.checkVisibility();
2236 }
2237 return styles.display !== "none" && styles.display !== "contents";
2238 }
2239
2240 // node_modules/@base-ui/utils/esm/owner.js
2241 function ownerDocument(node) {
2242 return node?.ownerDocument || document;
2243 }
2244
2245 // node_modules/@base-ui/react/esm/internals/composite/composite.js
2246 var ARROW_UP2 = "ArrowUp";
2247 var ARROW_DOWN2 = "ArrowDown";
2248 var ARROW_LEFT2 = "ArrowLeft";
2249 var ARROW_RIGHT2 = "ArrowRight";
2250 var HOME = "Home";
2251 var END = "End";
2252 var HORIZONTAL_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT2, ARROW_RIGHT2]);
2253 var HORIZONTAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT2, ARROW_RIGHT2, HOME, END]);
2254 var VERTICAL_KEYS = /* @__PURE__ */ new Set([ARROW_UP2, ARROW_DOWN2]);
2255 var VERTICAL_KEYS_WITH_EXTRA_KEYS = /* @__PURE__ */ new Set([ARROW_UP2, ARROW_DOWN2, HOME, END]);
2256 var ARROW_KEYS = /* @__PURE__ */ new Set([...HORIZONTAL_KEYS, ...VERTICAL_KEYS]);
2257 var COMPOSITE_KEYS = /* @__PURE__ */ new Set([...ARROW_KEYS, HOME, END]);
2258 var SHIFT = "Shift";
2259 var CONTROL = "Control";
2260 var ALT = "Alt";
2261 var META = "Meta";
2262 var MODIFIER_KEYS = /* @__PURE__ */ new Set([SHIFT, CONTROL, ALT, META]);
2263 function isInputElement(element) {
2264 return isHTMLElement(element) && element.tagName === "INPUT";
2265 }
2266 function isNativeInput(element) {
2267 if (isInputElement(element) && element.selectionStart != null) {
2268 return true;
2269 }
2270 if (isHTMLElement(element) && element.tagName === "TEXTAREA") {
2271 return true;
2272 }
2273 return false;
2274 }
2275 function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {
2276 if (!scrollContainer || !element || !element.scrollTo) {
2277 return;
2278 }
2279 let targetX = scrollContainer.scrollLeft;
2280 let targetY = scrollContainer.scrollTop;
2281 const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;
2282 const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;
2283 if (isOverflowingX && orientation !== "vertical") {
2284 const elementOffsetLeft = getOffset(scrollContainer, element, "left");
2285 const containerStyles = getStyles(scrollContainer);
2286 const elementStyles = getStyles(element);
2287 if (direction === "ltr") {
2288 if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {
2289 targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
2290 } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {
2291 targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
2292 }
2293 }
2294 if (direction === "rtl") {
2295 if (elementOffsetLeft - elementStyles.scrollMarginRight < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {
2296 targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
2297 } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {
2298 targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
2299 }
2300 }
2301 }
2302 if (isOverflowingY && orientation !== "horizontal") {
2303 const elementOffsetTop = getOffset(scrollContainer, element, "top");
2304 const containerStyles = getStyles(scrollContainer);
2305 const elementStyles = getStyles(element);
2306 if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {
2307 targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;
2308 } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {
2309 targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;
2310 }
2311 }
2312 scrollContainer.scrollTo({
2313 left: targetX,
2314 top: targetY,
2315 behavior: "auto"
2316 });
2317 }
2318 function getOffset(ancestor, element, side) {
2319 const propName = side === "left" ? "offsetLeft" : "offsetTop";
2320 let result = 0;
2321 while (element.offsetParent) {
2322 result += element[propName];
2323 if (element.offsetParent === ancestor) {
2324 break;
2325 }
2326 element = element.offsetParent;
2327 }
2328 return result;
2329 }
2330 function getStyles(element) {
2331 const styles = getComputedStyle(element);
2332 return {
2333 scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,
2334 scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,
2335 scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,
2336 scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,
2337 scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,
2338 scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,
2339 scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,
2340 scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0
2341 };
2342 }
2343
2344 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js
2345 var React18 = __toESM(require_react(), 1);
2346
2347 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js
2348 var ReactDOM = __toESM(require_react_dom(), 1);
2349
2350 // node_modules/@base-ui/react/esm/utils/resolveRef.js
2351 function resolveRef(maybeRef) {
2352 if (maybeRef == null) {
2353 return maybeRef;
2354 }
2355 return "current" in maybeRef ? maybeRef.current : maybeRef;
2356 }
2357
2358 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js
2359 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) {
2360 const frame = useAnimationFrame();
2361 return useStableCallback((fnToExecute, signal = null) => {
2362 frame.cancel();
2363 const element = resolveRef(elementOrRef);
2364 if (element == null) {
2365 return;
2366 }
2367 const resolvedElement = element;
2368 const done = () => {
2369 ReactDOM.flushSync(fnToExecute);
2370 };
2371 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
2372 fnToExecute();
2373 return;
2374 }
2375 function exec() {
2376 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
2377 if (!signal?.aborted) {
2378 done();
2379 }
2380 }).catch(() => {
2381 if (treatAbortedAsFinished) {
2382 if (!signal?.aborted) {
2383 done();
2384 }
2385 return;
2386 }
2387 const currentAnimations = resolvedElement.getAnimations();
2388 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
2389 exec();
2390 }
2391 });
2392 }
2393 if (waitForStartingStyleRemoved) {
2394 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;
2395 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
2396 frame.request(exec);
2397 return;
2398 }
2399 const attributeObserver = new MutationObserver(() => {
2400 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
2401 attributeObserver.disconnect();
2402 exec();
2403 }
2404 });
2405 attributeObserver.observe(resolvedElement, {
2406 attributes: true,
2407 attributeFilter: [startingStyleAttribute]
2408 });
2409 signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
2410 once: true
2411 });
2412 return;
2413 }
2414 frame.request(exec);
2415 });
2416 }
2417
2418 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js
2419 function useOpenChangeComplete(parameters) {
2420 const {
2421 enabled = true,
2422 open,
2423 ref,
2424 onComplete: onCompleteParam
2425 } = parameters;
2426 const onComplete = useStableCallback(onCompleteParam);
2427 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false);
2428 React18.useEffect(() => {
2429 if (!enabled) {
2430 return void 0;
2431 }
2432 const abortController = new AbortController();
2433 runOnceAnimationsFinish(onComplete, abortController.signal);
2434 return () => {
2435 abortController.abort();
2436 };
2437 }, [enabled, open, onComplete, runOnceAnimationsFinish]);
2438 }
2439
2440 // node_modules/@base-ui/utils/esm/useForcedRerendering.js
2441 var React19 = __toESM(require_react(), 1);
2442 function useForcedRerendering() {
2443 const [, setState] = React19.useState({});
2444 return React19.useCallback(() => {
2445 setState({});
2446 }, []);
2447 }
2448
2449 // node_modules/@base-ui/utils/esm/inertValue.js
2450 function inertValue(value) {
2451 if (isReactVersionAtLeast(19)) {
2452 return value;
2453 }
2454 return value ? "true" : void 0;
2455 }
2456
2457 // node_modules/@base-ui/react/esm/internals/composite/item/useCompositeItem.js
2458 var React20 = __toESM(require_react(), 1);
2459 function useCompositeItem(params = {}) {
2460 const {
2461 highlightItemOnHover,
2462 highlightedIndex,
2463 onHighlightedIndexChange
2464 } = useCompositeRootContext();
2465 const {
2466 ref,
2467 index
2468 } = useCompositeListItem(params);
2469 const isHighlighted = highlightedIndex === index;
2470 const itemRef = React20.useRef(null);
2471 const mergedRef = useMergedRefs(ref, itemRef);
2472 const compositeProps = React20.useMemo(() => ({
2473 tabIndex: isHighlighted ? 0 : -1,
2474 onFocus() {
2475 onHighlightedIndexChange(index);
2476 },
2477 onMouseMove() {
2478 const item = itemRef.current;
2479 if (!highlightItemOnHover || !item) {
2480 return;
2481 }
2482 const disabled2 = item.hasAttribute("disabled") || item.ariaDisabled === "true";
2483 if (!isHighlighted && !disabled2) {
2484 item.focus();
2485 }
2486 }
2487 }), [isHighlighted, onHighlightedIndexChange, index, highlightItemOnHover]);
2488 return {
2489 compositeProps,
2490 compositeRef: mergedRef,
2491 index
2492 };
2493 }
2494
2495 // node_modules/@base-ui/react/esm/utils/getCssDimensions.js
2496 function getCssDimensions(element) {
2497 const css = getComputedStyle2(element);
2498 let width = parseFloat(css.width) || 0;
2499 let height = parseFloat(css.height) || 0;
2500 const hasOffset = isHTMLElement(element);
2501 const offsetWidth = hasOffset ? element.offsetWidth : width;
2502 const offsetHeight = hasOffset ? element.offsetHeight : height;
2503 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
2504 if (shouldFallback) {
2505 width = offsetWidth;
2506 height = offsetHeight;
2507 }
2508 return {
2509 width,
2510 height
2511 };
2512 }
2513
2514 // node_modules/@base-ui/react/esm/internals/csp-context/CSPContext.js
2515 var React21 = __toESM(require_react(), 1);
2516 var CSPContext = /* @__PURE__ */ React21.createContext(void 0);
2517 if (true) CSPContext.displayName = "CSPContext";
2518 var DEFAULT_CSP_CONTEXT_VALUE = {
2519 disableStyleElements: false
2520 };
2521 function useCSPContext() {
2522 return React21.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;
2523 }
2524
2525 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRoot.js
2526 var React23 = __toESM(require_react(), 1);
2527
2528 // node_modules/@base-ui/react/esm/internals/composite/root/useCompositeRoot.js
2529 var React22 = __toESM(require_react(), 1);
2530
2531 // node_modules/@base-ui/react/esm/internals/composite/constants.js
2532 var ACTIVE_COMPOSITE_ITEM = "data-composite-item-active";
2533
2534 // node_modules/@base-ui/react/esm/internals/composite/root/useCompositeRoot.js
2535 var EMPTY_ARRAY2 = [];
2536 function useCompositeRoot(params) {
2537 const {
2538 itemSizes,
2539 cols = 1,
2540 loopFocus = true,
2541 onLoop,
2542 dense = false,
2543 orientation = "both",
2544 direction,
2545 highlightedIndex: externalHighlightedIndex,
2546 onHighlightedIndexChange: externalSetHighlightedIndex,
2547 rootRef: externalRef,
2548 enableHomeAndEndKeys = false,
2549 stopEventPropagation = false,
2550 disabledIndices,
2551 modifierKeys = EMPTY_ARRAY2
2552 } = params;
2553 const [internalHighlightedIndex, internalSetHighlightedIndex] = React22.useState(0);
2554 const isGrid = cols > 1;
2555 const rootRef = React22.useRef(null);
2556 const mergedRef = useMergedRefs(rootRef, externalRef);
2557 const elementsRef = React22.useRef([]);
2558 const hasSetDefaultIndexRef = React22.useRef(false);
2559 const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;
2560 const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false) => {
2561 (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);
2562 if (shouldScrollIntoView) {
2563 const newActiveItem = elementsRef.current[index];
2564 scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);
2565 }
2566 });
2567 const onMapChange = useStableCallback((map) => {
2568 if (map.size === 0 || hasSetDefaultIndexRef.current) {
2569 return;
2570 }
2571 hasSetDefaultIndexRef.current = true;
2572 const sortedElements = Array.from(map.keys());
2573 const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null;
2574 const activeIndex = activeItem ? sortedElements.indexOf(activeItem) : -1;
2575 if (activeIndex !== -1) {
2576 onHighlightedIndexChange(activeIndex);
2577 }
2578 scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);
2579 });
2580 const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => {
2581 if (!onLoop) {
2582 return nextIndex;
2583 }
2584 return onLoop?.(event, prevIndex, nextIndex, elementsRef);
2585 });
2586 const props = React22.useMemo(() => ({
2587 "aria-orientation": orientation === "both" ? void 0 : orientation,
2588 ref: mergedRef,
2589 onFocus(event) {
2590 const element = rootRef.current;
2591 const target = getTarget(event.nativeEvent);
2592 if (!element || target == null || !isNativeInput(target)) {
2593 return;
2594 }
2595 target.setSelectionRange(0, target.value.length ?? 0);
2596 },
2597 onKeyDown(event) {
2598 const RELEVANT_KEYS = enableHomeAndEndKeys ? COMPOSITE_KEYS : ARROW_KEYS;
2599 if (!RELEVANT_KEYS.has(event.key)) {
2600 return;
2601 }
2602 if (isModifierKeySet(event, modifierKeys)) {
2603 return;
2604 }
2605 const element = rootRef.current;
2606 if (!element) {
2607 return;
2608 }
2609 const isRtl = direction === "rtl";
2610 const horizontalForwardKey = isRtl ? ARROW_LEFT2 : ARROW_RIGHT2;
2611 const forwardKey = {
2612 horizontal: horizontalForwardKey,
2613 vertical: ARROW_DOWN2,
2614 both: horizontalForwardKey
2615 }[orientation];
2616 const horizontalBackwardKey = isRtl ? ARROW_RIGHT2 : ARROW_LEFT2;
2617 const backwardKey = {
2618 horizontal: horizontalBackwardKey,
2619 vertical: ARROW_UP2,
2620 both: horizontalBackwardKey
2621 }[orientation];
2622 const target = getTarget(event.nativeEvent);
2623 if (target != null && isNativeInput(target) && !isElementDisabled(target)) {
2624 const selectionStart = target.selectionStart;
2625 const selectionEnd = target.selectionEnd;
2626 const textContent = target.value ?? "";
2627 if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) {
2628 return;
2629 }
2630 if (event.key !== backwardKey && selectionStart < textContent.length) {
2631 return;
2632 }
2633 if (event.key !== forwardKey && selectionStart > 0) {
2634 return;
2635 }
2636 }
2637 let nextIndex = highlightedIndex;
2638 const minIndex = getMinListIndex(elementsRef, disabledIndices);
2639 const maxIndex = getMaxListIndex(elementsRef, disabledIndices);
2640 if (isGrid) {
2641 const sizes = itemSizes || Array.from({
2642 length: elementsRef.current.length
2643 }, () => ({
2644 width: 1,
2645 height: 1
2646 }));
2647 const cellMap = createGridCellMap(sizes, cols, dense);
2648 const minGridIndex = cellMap.findIndex((index) => index != null && !isListIndexDisabled(elementsRef.current, index, disabledIndices));
2649 const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isListIndexDisabled(elementsRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1);
2650 nextIndex = cellMap[getGridNavigatedIndex(cellMap.map((itemIndex) => itemIndex != null ? elementsRef.current[itemIndex] : null), {
2651 event,
2652 orientation,
2653 loopFocus,
2654 onLoop: wrappedOnLoop,
2655 cols,
2656 // treat undefined (empty grid spaces) as disabled indices so we
2657 // don't end up in them
2658 disabledIndices: getGridCellIndices([...disabledIndices || elementsRef.current.map((_, index) => isListIndexDisabled(elementsRef.current, index) ? index : void 0), void 0], cellMap),
2659 minIndex: minGridIndex,
2660 maxIndex: maxGridIndex,
2661 prevIndex: getGridCellIndexOfCorner(
2662 highlightedIndex > maxIndex ? minIndex : highlightedIndex,
2663 sizes,
2664 cellMap,
2665 cols,
2666 // use a corner matching the edge closest to the direction we're
2667 // moving in so we don't end up in the same item. Prefer
2668 // top/left over bottom/right.
2669 // eslint-disable-next-line no-nested-ternary
2670 event.key === ARROW_DOWN2 ? "bl" : event.key === ARROW_RIGHT2 ? "tr" : "tl"
2671 ),
2672 rtl: isRtl
2673 })];
2674 }
2675 const forwardKeys = {
2676 horizontal: [horizontalForwardKey],
2677 vertical: [ARROW_DOWN2],
2678 both: [horizontalForwardKey, ARROW_DOWN2]
2679 }[orientation];
2680 const backwardKeys = {
2681 horizontal: [horizontalBackwardKey],
2682 vertical: [ARROW_UP2],
2683 both: [horizontalBackwardKey, ARROW_UP2]
2684 }[orientation];
2685 const preventedKeys = isGrid ? RELEVANT_KEYS : {
2686 horizontal: enableHomeAndEndKeys ? HORIZONTAL_KEYS_WITH_EXTRA_KEYS : HORIZONTAL_KEYS,
2687 vertical: enableHomeAndEndKeys ? VERTICAL_KEYS_WITH_EXTRA_KEYS : VERTICAL_KEYS,
2688 both: RELEVANT_KEYS
2689 }[orientation];
2690 if (enableHomeAndEndKeys) {
2691 if (event.key === HOME) {
2692 nextIndex = minIndex;
2693 } else if (event.key === END) {
2694 nextIndex = maxIndex;
2695 }
2696 }
2697 if (nextIndex === highlightedIndex && (forwardKeys.includes(event.key) || backwardKeys.includes(event.key))) {
2698 if (loopFocus && nextIndex === maxIndex && forwardKeys.includes(event.key)) {
2699 nextIndex = minIndex;
2700 if (onLoop) {
2701 nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
2702 }
2703 } else if (loopFocus && nextIndex === minIndex && backwardKeys.includes(event.key)) {
2704 nextIndex = maxIndex;
2705 if (onLoop) {
2706 nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
2707 }
2708 } else {
2709 nextIndex = findNonDisabledListIndex(elementsRef.current, {
2710 startingIndex: nextIndex,
2711 decrement: backwardKeys.includes(event.key),
2712 disabledIndices
2713 });
2714 }
2715 }
2716 if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {
2717 if (stopEventPropagation) {
2718 event.stopPropagation();
2719 }
2720 if (preventedKeys.has(event.key)) {
2721 event.preventDefault();
2722 }
2723 onHighlightedIndexChange(nextIndex, true);
2724 queueMicrotask(() => {
2725 elementsRef.current[nextIndex]?.focus();
2726 });
2727 }
2728 }
2729 }), [cols, dense, direction, disabledIndices, elementsRef, enableHomeAndEndKeys, highlightedIndex, isGrid, itemSizes, loopFocus, onLoop, wrappedOnLoop, mergedRef, modifierKeys, onHighlightedIndexChange, orientation, stopEventPropagation]);
2730 return React22.useMemo(() => ({
2731 props,
2732 highlightedIndex,
2733 onHighlightedIndexChange,
2734 elementsRef,
2735 disabledIndices,
2736 onMapChange,
2737 relayKeyboardEvent: props.onKeyDown
2738 }), [props, highlightedIndex, onHighlightedIndexChange, elementsRef, disabledIndices, onMapChange]);
2739 }
2740 function isModifierKeySet(event, ignoredModifierKeys) {
2741 for (const key of MODIFIER_KEYS.values()) {
2742 if (ignoredModifierKeys.includes(key)) {
2743 continue;
2744 }
2745 if (event.getModifierState(key)) {
2746 return true;
2747 }
2748 }
2749 return false;
2750 }
2751
2752 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRoot.js
2753 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
2754 function CompositeRoot(componentProps) {
2755 const {
2756 render,
2757 className,
2758 style,
2759 refs = EMPTY_ARRAY,
2760 props = EMPTY_ARRAY,
2761 state = EMPTY_OBJECT,
2762 stateAttributesMapping: stateAttributesMapping3,
2763 highlightedIndex: highlightedIndexProp,
2764 onHighlightedIndexChange: onHighlightedIndexChangeProp,
2765 orientation,
2766 dense,
2767 itemSizes,
2768 loopFocus,
2769 onLoop,
2770 cols,
2771 enableHomeAndEndKeys,
2772 onMapChange: onMapChangeProp,
2773 stopEventPropagation = true,
2774 rootRef,
2775 disabledIndices,
2776 modifierKeys,
2777 highlightItemOnHover = false,
2778 tag = "div",
2779 ...elementProps
2780 } = componentProps;
2781 const direction = useDirection();
2782 const {
2783 props: defaultProps,
2784 highlightedIndex,
2785 onHighlightedIndexChange,
2786 elementsRef,
2787 onMapChange: onMapChangeUnwrapped,
2788 relayKeyboardEvent
2789 } = useCompositeRoot({
2790 itemSizes,
2791 cols,
2792 loopFocus,
2793 onLoop,
2794 dense,
2795 orientation,
2796 highlightedIndex: highlightedIndexProp,
2797 onHighlightedIndexChange: onHighlightedIndexChangeProp,
2798 rootRef,
2799 stopEventPropagation,
2800 enableHomeAndEndKeys,
2801 direction,
2802 disabledIndices,
2803 modifierKeys
2804 });
2805 const element = useRenderElement(tag, componentProps, {
2806 state,
2807 ref: refs,
2808 props: [defaultProps, ...props, elementProps],
2809 stateAttributesMapping: stateAttributesMapping3
2810 });
2811 const contextValue = React23.useMemo(() => ({
2812 highlightedIndex,
2813 onHighlightedIndexChange,
2814 highlightItemOnHover,
2815 relayKeyboardEvent
2816 }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]);
2817 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CompositeRootContext.Provider, {
2818 value: contextValue,
2819 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CompositeList, {
2820 elementsRef,
2821 onMapChange: (newMap) => {
2822 onMapChangeProp?.(newMap);
2823 onMapChangeUnwrapped(newMap);
2824 },
2825 children: element
2826 })
2827 });
2828 }
2829
2830 // node_modules/@base-ui/react/esm/utils/useIsHydrating.js
2831 var import_shim = __toESM(require_shim(), 1);
2832 function subscribe() {
2833 return NOOP;
2834 }
2835 function getSnapshot() {
2836 return false;
2837 }
2838 function getServerSnapshot() {
2839 return true;
2840 }
2841 function useIsHydrating() {
2842 return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
2843 }
2844
2845 // node_modules/@base-ui/react/esm/tabs/index.parts.js
2846 var index_parts_exports = {};
2847 __export(index_parts_exports, {
2848 Indicator: () => TabsIndicator,
2849 List: () => TabsList,
2850 Panel: () => TabsPanel,
2851 Root: () => TabsRoot,
2852 Tab: () => TabsTab
2853 });
2854
2855 // node_modules/@base-ui/react/esm/tabs/root/TabsRoot.js
2856 var React25 = __toESM(require_react(), 1);
2857
2858 // node_modules/@base-ui/react/esm/tabs/root/TabsRootContext.js
2859 var React24 = __toESM(require_react(), 1);
2860 var TabsRootContext = /* @__PURE__ */ React24.createContext(void 0);
2861 if (true) TabsRootContext.displayName = "TabsRootContext";
2862 function useTabsRootContext() {
2863 const context = React24.useContext(TabsRootContext);
2864 if (context === void 0) {
2865 throw new Error(true ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage_default(64));
2866 }
2867 return context;
2868 }
2869
2870 // node_modules/@base-ui/react/esm/tabs/root/TabsRootDataAttributes.js
2871 var TabsRootDataAttributes = /* @__PURE__ */ (function(TabsRootDataAttributes2) {
2872 TabsRootDataAttributes2["activationDirection"] = "data-activation-direction";
2873 TabsRootDataAttributes2["orientation"] = "data-orientation";
2874 return TabsRootDataAttributes2;
2875 })({});
2876
2877 // node_modules/@base-ui/react/esm/tabs/root/stateAttributesMapping.js
2878 var tabsStateAttributesMapping = {
2879 tabActivationDirection: (dir) => ({
2880 [TabsRootDataAttributes.activationDirection]: dir
2881 })
2882 };
2883
2884 // node_modules/@base-ui/react/esm/tabs/root/TabsRoot.js
2885 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
2886 var TabsRoot = /* @__PURE__ */ React25.forwardRef(function TabsRoot2(componentProps, forwardedRef) {
2887 const {
2888 className,
2889 defaultValue: defaultValueProp = 0,
2890 onValueChange: onValueChangeProp,
2891 orientation = "horizontal",
2892 render,
2893 value: valueProp,
2894 style,
2895 ...elementProps
2896 } = componentProps;
2897 const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0;
2898 const tabPanelRefs = React25.useRef([]);
2899 const [mountedTabPanels, setMountedTabPanels] = React25.useState(() => /* @__PURE__ */ new Map());
2900 const [value, setValue] = useControlled({
2901 controlled: valueProp,
2902 default: defaultValueProp,
2903 name: "Tabs",
2904 state: "value"
2905 });
2906 const isControlled = valueProp !== void 0;
2907 const [tabMap, setTabMap] = React25.useState(() => /* @__PURE__ */ new Map());
2908 const getTabElementBySelectedValue = React25.useCallback((selectedValue) => {
2909 if (selectedValue === void 0) {
2910 return null;
2911 }
2912 for (const [tabElement, tabMetadata] of tabMap.entries()) {
2913 if (tabMetadata != null && selectedValue === (tabMetadata.value ?? tabMetadata.index)) {
2914 return tabElement;
2915 }
2916 }
2917 return null;
2918 }, [tabMap]);
2919 const [activationDirectionState, setActivationDirectionState] = React25.useState(() => ({
2920 previousValue: value,
2921 tabActivationDirection: "none"
2922 }));
2923 const {
2924 previousValue,
2925 tabActivationDirection: committedTabActivationDirection
2926 } = activationDirectionState;
2927 let tabActivationDirection = committedTabActivationDirection;
2928 let directionComputationIncomplete = false;
2929 if (previousValue !== value) {
2930 tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);
2931 directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;
2932 }
2933 const nextPreviousValue = directionComputationIncomplete ? previousValue : value;
2934 const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;
2935 useIsoLayoutEffect(() => {
2936 if (!shouldSyncActivationDirectionState) {
2937 return;
2938 }
2939 setActivationDirectionState({
2940 previousValue: nextPreviousValue,
2941 tabActivationDirection
2942 });
2943 }, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]);
2944 const onValueChange = useStableCallback((newValue, eventDetails) => {
2945 const activationDirection = computeActivationDirection(value, newValue, orientation, tabMap);
2946 eventDetails.activationDirection = activationDirection;
2947 onValueChangeProp?.(newValue, eventDetails);
2948 if (eventDetails.isCanceled) {
2949 return;
2950 }
2951 setValue(newValue);
2952 });
2953 const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => {
2954 onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, {
2955 activationDirection: "none"
2956 }));
2957 });
2958 const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {
2959 setMountedTabPanels((prev) => {
2960 if (prev.get(panelValue) === panelId) {
2961 return prev;
2962 }
2963 const next = new Map(prev);
2964 next.set(panelValue, panelId);
2965 return next;
2966 });
2967 });
2968 const unregisterMountedTabPanel = useStableCallback((panelValue, panelId) => {
2969 setMountedTabPanels((prev) => {
2970 if (!prev.has(panelValue) || prev.get(panelValue) !== panelId) {
2971 return prev;
2972 }
2973 const next = new Map(prev);
2974 next.delete(panelValue);
2975 return next;
2976 });
2977 });
2978 const getTabPanelIdByValue = React25.useCallback((tabValue) => {
2979 return mountedTabPanels.get(tabValue);
2980 }, [mountedTabPanels]);
2981 const getTabIdByPanelValue = React25.useCallback((tabPanelValue) => {
2982 for (const tabMetadata of tabMap.values()) {
2983 if (tabPanelValue === tabMetadata?.value) {
2984 return tabMetadata?.id;
2985 }
2986 }
2987 return void 0;
2988 }, [tabMap]);
2989 const tabsContextValue = React25.useMemo(() => ({
2990 getTabElementBySelectedValue,
2991 getTabIdByPanelValue,
2992 getTabPanelIdByValue,
2993 onValueChange,
2994 orientation,
2995 registerMountedTabPanel,
2996 setTabMap,
2997 unregisterMountedTabPanel,
2998 tabActivationDirection,
2999 value
3000 }), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, unregisterMountedTabPanel, tabActivationDirection, value]);
3001 const selectedTabMetadata = React25.useMemo(() => {
3002 for (const tabMetadata of tabMap.values()) {
3003 if (tabMetadata != null && tabMetadata.value === value) {
3004 return tabMetadata;
3005 }
3006 }
3007 return void 0;
3008 }, [tabMap, value]);
3009 const firstEnabledTabValue = React25.useMemo(() => {
3010 for (const tabMetadata of tabMap.values()) {
3011 if (tabMetadata != null && !tabMetadata.disabled) {
3012 return tabMetadata.value;
3013 }
3014 }
3015 return void 0;
3016 }, [tabMap]);
3017 const shouldNotifyInitialValueChangeRef = React25.useRef(!hasExplicitDefaultValueProp);
3018 const shouldHonorDisabledDefaultValueRef = React25.useRef(hasExplicitDefaultValueProp);
3019 const didRegisterTabsRef = React25.useRef(false);
3020 useIsoLayoutEffect(() => {
3021 if (isControlled) {
3022 return;
3023 }
3024 function commitAutomaticValueChange(fallbackValue, fallbackReason) {
3025 setValue(fallbackValue);
3026 setActivationDirectionState((prev) => {
3027 if (prev.previousValue === fallbackValue && prev.tabActivationDirection === "none") {
3028 return prev;
3029 }
3030 return {
3031 previousValue: fallbackValue,
3032 tabActivationDirection: "none"
3033 };
3034 });
3035 notifyAutomaticValueChange(fallbackValue, fallbackReason);
3036 shouldNotifyInitialValueChangeRef.current = false;
3037 }
3038 if (tabMap.size === 0) {
3039 if (!didRegisterTabsRef.current || value === null) {
3040 return;
3041 }
3042 commitAutomaticValueChange(null, reason_parts_exports.missing);
3043 return;
3044 }
3045 didRegisterTabsRef.current = true;
3046 const selectionIsDisabled = selectedTabMetadata?.disabled;
3047 const selectionIsMissing = selectedTabMetadata == null && value !== null;
3048 if (!selectionIsDisabled && value === defaultValueProp) {
3049 shouldHonorDisabledDefaultValueRef.current = false;
3050 }
3051 if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === defaultValueProp) {
3052 return;
3053 }
3054 const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;
3055 if (selectionIsDisabled || selectionIsMissing) {
3056 const fallbackValue = firstEnabledTabValue ?? null;
3057 if (value === fallbackValue) {
3058 shouldNotifyInitialValueChangeRef.current = false;
3059 return;
3060 }
3061 let fallbackReason = reason_parts_exports.missing;
3062 if (shouldNotifyInitialValueChange) {
3063 fallbackReason = reason_parts_exports.initial;
3064 } else if (selectionIsDisabled) {
3065 fallbackReason = reason_parts_exports.disabled;
3066 }
3067 commitAutomaticValueChange(fallbackValue, fallbackReason);
3068 return;
3069 }
3070 if (shouldNotifyInitialValueChange && selectedTabMetadata != null) {
3071 notifyAutomaticValueChange(value, reason_parts_exports.initial);
3072 shouldNotifyInitialValueChangeRef.current = false;
3073 }
3074 }, [defaultValueProp, firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]);
3075 const state = {
3076 orientation,
3077 tabActivationDirection
3078 };
3079 const element = useRenderElement("div", componentProps, {
3080 state,
3081 ref: forwardedRef,
3082 props: elementProps,
3083 stateAttributesMapping: tabsStateAttributesMapping
3084 });
3085 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TabsRootContext.Provider, {
3086 value: tabsContextValue,
3087 children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CompositeList, {
3088 elementsRef: tabPanelRefs,
3089 children: element
3090 })
3091 });
3092 });
3093 if (true) TabsRoot.displayName = "TabsRoot";
3094 function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
3095 if (oldValue == null || newValue == null) {
3096 return "none";
3097 }
3098 let oldTab = null;
3099 let newTab = null;
3100 for (const [tabElement, tabMetadata] of tabMap.entries()) {
3101 if (tabMetadata == null) {
3102 continue;
3103 }
3104 const tabValue = tabMetadata.value ?? tabMetadata.index;
3105 if (oldValue === tabValue) {
3106 oldTab = tabElement;
3107 }
3108 if (newValue === tabValue) {
3109 newTab = tabElement;
3110 }
3111 if (oldTab != null && newTab != null) {
3112 break;
3113 }
3114 }
3115 if (oldTab == null || newTab == null) {
3116 if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) {
3117 if (orientation === "horizontal") {
3118 return newValue > oldValue ? "right" : "left";
3119 }
3120 return newValue > oldValue ? "down" : "up";
3121 }
3122 return "none";
3123 }
3124 const oldRect = oldTab.getBoundingClientRect();
3125 const newRect = newTab.getBoundingClientRect();
3126 if (orientation === "horizontal") {
3127 if (newRect.left < oldRect.left) {
3128 return "left";
3129 }
3130 if (newRect.left > oldRect.left) {
3131 return "right";
3132 }
3133 } else {
3134 if (newRect.top < oldRect.top) {
3135 return "up";
3136 }
3137 if (newRect.top > oldRect.top) {
3138 return "down";
3139 }
3140 }
3141 return "none";
3142 }
3143
3144 // node_modules/@base-ui/react/esm/tabs/tab/TabsTab.js
3145 var React27 = __toESM(require_react(), 1);
3146
3147 // node_modules/@base-ui/react/esm/tabs/list/TabsListContext.js
3148 var React26 = __toESM(require_react(), 1);
3149 var TabsListContext = /* @__PURE__ */ React26.createContext(void 0);
3150 if (true) TabsListContext.displayName = "TabsListContext";
3151 function useTabsListContext() {
3152 const context = React26.useContext(TabsListContext);
3153 if (context === void 0) {
3154 throw new Error(true ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage_default(65));
3155 }
3156 return context;
3157 }
3158
3159 // node_modules/@base-ui/react/esm/tabs/tab/TabsTab.js
3160 var TabsTab = /* @__PURE__ */ React27.forwardRef(function TabsTab2(componentProps, forwardedRef) {
3161 const {
3162 className,
3163 disabled: disabled2 = false,
3164 render,
3165 value,
3166 id: idProp,
3167 nativeButton = true,
3168 style,
3169 ...elementProps
3170 } = componentProps;
3171 const {
3172 value: activeTabValue,
3173 getTabPanelIdByValue,
3174 orientation
3175 } = useTabsRootContext();
3176 const {
3177 activateOnFocus,
3178 highlightedTabIndex,
3179 onTabActivation,
3180 registerTabResizeObserverElement,
3181 setHighlightedTabIndex,
3182 tabsListElement
3183 } = useTabsListContext();
3184 const id = useBaseUiId(idProp);
3185 const tabMetadata = React27.useMemo(() => ({
3186 disabled: disabled2,
3187 id,
3188 value
3189 }), [disabled2, id, value]);
3190 const {
3191 compositeProps,
3192 compositeRef,
3193 index
3194 // hook is used instead of the CompositeItem component
3195 // because the index is needed for Tab internals
3196 } = useCompositeItem({
3197 metadata: tabMetadata
3198 });
3199 const active = value === activeTabValue;
3200 const isNavigatingRef = React27.useRef(false);
3201 const tabElementRef = React27.useRef(null);
3202 React27.useEffect(() => {
3203 const tabElement = tabElementRef.current;
3204 if (!tabElement) {
3205 return void 0;
3206 }
3207 return registerTabResizeObserverElement(tabElement);
3208 }, [registerTabResizeObserverElement]);
3209 useIsoLayoutEffect(() => {
3210 if (isNavigatingRef.current) {
3211 isNavigatingRef.current = false;
3212 return;
3213 }
3214 if (!(active && index > -1 && highlightedTabIndex !== index)) {
3215 return;
3216 }
3217 const listElement = tabsListElement;
3218 if (listElement != null) {
3219 const activeEl = activeElement(ownerDocument(listElement));
3220 if (activeEl && contains(listElement, activeEl)) {
3221 return;
3222 }
3223 }
3224 if (!disabled2) {
3225 setHighlightedTabIndex(index);
3226 }
3227 }, [active, index, highlightedTabIndex, setHighlightedTabIndex, disabled2, tabsListElement]);
3228 const {
3229 getButtonProps,
3230 buttonRef
3231 } = useButton({
3232 disabled: disabled2,
3233 native: nativeButton,
3234 focusableWhenDisabled: true
3235 });
3236 const tabPanelId = getTabPanelIdByValue(value);
3237 const isPressingRef = React27.useRef(false);
3238 const isMainButtonRef = React27.useRef(false);
3239 function onClick(event) {
3240 if (active || disabled2) {
3241 return;
3242 }
3243 onTabActivation(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, {
3244 activationDirection: "none"
3245 }));
3246 }
3247 function onFocus(event) {
3248 if (active) {
3249 return;
3250 }
3251 if (index > -1 && !disabled2) {
3252 setHighlightedTabIndex(index);
3253 }
3254 if (disabled2) {
3255 return;
3256 }
3257 if (activateOnFocus && (!isPressingRef.current || // keyboard or touch focus
3258 isPressingRef.current && isMainButtonRef.current)) {
3259 onTabActivation(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, {
3260 activationDirection: "none"
3261 }));
3262 }
3263 }
3264 function onPointerDown(event) {
3265 if (active || disabled2) {
3266 return;
3267 }
3268 isPressingRef.current = true;
3269 function handlePointerUp() {
3270 isPressingRef.current = false;
3271 isMainButtonRef.current = false;
3272 }
3273 if (!event.button || event.button === 0) {
3274 isMainButtonRef.current = true;
3275 const doc = ownerDocument(event.currentTarget);
3276 doc.addEventListener("pointerup", handlePointerUp, {
3277 once: true
3278 });
3279 }
3280 }
3281 const state = {
3282 disabled: disabled2,
3283 active,
3284 orientation
3285 };
3286 const element = useRenderElement("button", componentProps, {
3287 state,
3288 ref: [forwardedRef, buttonRef, compositeRef, tabElementRef],
3289 props: [compositeProps, {
3290 role: "tab",
3291 "aria-controls": tabPanelId,
3292 "aria-selected": active,
3293 id,
3294 onClick,
3295 onFocus,
3296 onPointerDown,
3297 [ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0,
3298 onKeyDownCapture() {
3299 isNavigatingRef.current = true;
3300 }
3301 }, elementProps, getButtonProps]
3302 });
3303 return element;
3304 });
3305 if (true) TabsTab.displayName = "TabsTab";
3306
3307 // node_modules/@base-ui/react/esm/tabs/indicator/TabsIndicator.js
3308 var React28 = __toESM(require_react(), 1);
3309
3310 // node_modules/@base-ui/react/esm/tabs/indicator/prehydrationScript.min.js
3311 var script = '!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();';
3312
3313 // node_modules/@base-ui/react/esm/tabs/indicator/TabsIndicatorCssVars.js
3314 var TabsIndicatorCssVars = /* @__PURE__ */ (function(TabsIndicatorCssVars2) {
3315 TabsIndicatorCssVars2["activeTabLeft"] = "--active-tab-left";
3316 TabsIndicatorCssVars2["activeTabRight"] = "--active-tab-right";
3317 TabsIndicatorCssVars2["activeTabTop"] = "--active-tab-top";
3318 TabsIndicatorCssVars2["activeTabBottom"] = "--active-tab-bottom";
3319 TabsIndicatorCssVars2["activeTabWidth"] = "--active-tab-width";
3320 TabsIndicatorCssVars2["activeTabHeight"] = "--active-tab-height";
3321 return TabsIndicatorCssVars2;
3322 })({});
3323
3324 // node_modules/@base-ui/react/esm/tabs/indicator/TabsIndicator.js
3325 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
3326 var stateAttributesMapping = {
3327 ...tabsStateAttributesMapping,
3328 activeTabPosition: () => null,
3329 activeTabSize: () => null
3330 };
3331 var TabsIndicator = /* @__PURE__ */ React28.forwardRef(function TabsIndicator2(componentProps, forwardedRef) {
3332 const {
3333 className,
3334 render,
3335 renderBeforeHydration = false,
3336 style: styleProp,
3337 ...elementProps
3338 } = componentProps;
3339 const {
3340 nonce
3341 } = useCSPContext();
3342 const {
3343 getTabElementBySelectedValue,
3344 orientation,
3345 tabActivationDirection,
3346 value
3347 } = useTabsRootContext();
3348 const {
3349 tabsListElement,
3350 registerIndicatorUpdateListener
3351 } = useTabsListContext();
3352 const isHydrating = useIsHydrating();
3353 const rerender = useForcedRerendering();
3354 React28.useEffect(() => {
3355 return registerIndicatorUpdateListener(rerender);
3356 }, [registerIndicatorUpdateListener, rerender]);
3357 let left = 0;
3358 let right = 0;
3359 let top = 0;
3360 let bottom = 0;
3361 let width = 0;
3362 let height = 0;
3363 let isTabSelected = false;
3364 if (value != null && tabsListElement != null) {
3365 const activeTab = getTabElementBySelectedValue(value);
3366 isTabSelected = true;
3367 if (activeTab != null) {
3368 const {
3369 width: computedWidth,
3370 height: computedHeight
3371 } = getCssDimensions(activeTab);
3372 const {
3373 width: tabListWidth,
3374 height: tabListHeight
3375 } = getCssDimensions(tabsListElement);
3376 const tabRect = activeTab.getBoundingClientRect();
3377 const tabsListRect = tabsListElement.getBoundingClientRect();
3378 const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1;
3379 const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1;
3380 const hasNonZeroScale = Math.abs(scaleX) > Number.EPSILON && Math.abs(scaleY) > Number.EPSILON;
3381 if (hasNonZeroScale) {
3382 const tabLeftDelta = tabRect.left - tabsListRect.left;
3383 const tabTopDelta = tabRect.top - tabsListRect.top;
3384 left = tabLeftDelta / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft;
3385 top = tabTopDelta / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop;
3386 } else {
3387 left = activeTab.offsetLeft;
3388 top = activeTab.offsetTop;
3389 }
3390 width = computedWidth;
3391 height = computedHeight;
3392 right = tabsListElement.scrollWidth - left - width;
3393 bottom = tabsListElement.scrollHeight - top - height;
3394 }
3395 }
3396 const activeTabPosition = isTabSelected ? {
3397 left,
3398 right,
3399 top,
3400 bottom
3401 } : null;
3402 const activeTabSize = isTabSelected ? {
3403 width,
3404 height
3405 } : null;
3406 const style = isTabSelected ? {
3407 [TabsIndicatorCssVars.activeTabLeft]: `${left}px`,
3408 [TabsIndicatorCssVars.activeTabRight]: `${right}px`,
3409 [TabsIndicatorCssVars.activeTabTop]: `${top}px`,
3410 [TabsIndicatorCssVars.activeTabBottom]: `${bottom}px`,
3411 [TabsIndicatorCssVars.activeTabWidth]: `${width}px`,
3412 [TabsIndicatorCssVars.activeTabHeight]: `${height}px`
3413 } : void 0;
3414 const displayIndicator = isTabSelected && width > 0 && height > 0;
3415 const state = {
3416 orientation,
3417 activeTabPosition,
3418 activeTabSize,
3419 tabActivationDirection
3420 };
3421 const element = useRenderElement("span", componentProps, {
3422 state,
3423 ref: forwardedRef,
3424 props: [{
3425 role: "presentation",
3426 style,
3427 hidden: !displayIndicator
3428 // do not display the indicator before the layout is settled
3429 }, elementProps, {
3430 suppressHydrationWarning: true
3431 }],
3432 stateAttributesMapping
3433 });
3434 if (value == null) {
3435 return null;
3436 }
3437 return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(React28.Fragment, {
3438 children: [element, isHydrating && renderBeforeHydration && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("script", {
3439 nonce,
3440 dangerouslySetInnerHTML: {
3441 __html: script
3442 },
3443 suppressHydrationWarning: true
3444 })]
3445 });
3446 });
3447 if (true) TabsIndicator.displayName = "TabsIndicator";
3448
3449 // node_modules/@base-ui/react/esm/tabs/panel/TabsPanel.js
3450 var React29 = __toESM(require_react(), 1);
3451
3452 // node_modules/@base-ui/react/esm/tabs/panel/TabsPanelDataAttributes.js
3453 var TabsPanelDataAttributes = (function(TabsPanelDataAttributes2) {
3454 TabsPanelDataAttributes2["index"] = "data-index";
3455 TabsPanelDataAttributes2["activationDirection"] = "data-activation-direction";
3456 TabsPanelDataAttributes2["orientation"] = "data-orientation";
3457 TabsPanelDataAttributes2["hidden"] = "data-hidden";
3458 TabsPanelDataAttributes2[TabsPanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle";
3459 TabsPanelDataAttributes2[TabsPanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle";
3460 return TabsPanelDataAttributes2;
3461 })({});
3462
3463 // node_modules/@base-ui/react/esm/tabs/panel/TabsPanel.js
3464 var stateAttributesMapping2 = {
3465 ...tabsStateAttributesMapping,
3466 ...transitionStatusMapping
3467 };
3468 var TabsPanel = /* @__PURE__ */ React29.forwardRef(function TabsPanel2(componentProps, forwardedRef) {
3469 const {
3470 className,
3471 value,
3472 render,
3473 keepMounted = false,
3474 style,
3475 ...elementProps
3476 } = componentProps;
3477 const {
3478 value: selectedValue,
3479 getTabIdByPanelValue,
3480 orientation,
3481 tabActivationDirection,
3482 registerMountedTabPanel,
3483 unregisterMountedTabPanel
3484 } = useTabsRootContext();
3485 const id = useBaseUiId();
3486 const metadata = React29.useMemo(() => ({
3487 id,
3488 value
3489 }), [id, value]);
3490 const {
3491 ref: listItemRef,
3492 index
3493 } = useCompositeListItem({
3494 metadata
3495 });
3496 const open = value === selectedValue;
3497 const {
3498 mounted,
3499 transitionStatus,
3500 setMounted
3501 } = useTransitionStatus(open);
3502 const hidden = !mounted;
3503 const correspondingTabId = getTabIdByPanelValue(value);
3504 const state = {
3505 hidden,
3506 orientation,
3507 tabActivationDirection,
3508 transitionStatus
3509 };
3510 const panelRef = React29.useRef(null);
3511 const element = useRenderElement("div", componentProps, {
3512 state,
3513 ref: [forwardedRef, listItemRef, panelRef],
3514 props: [{
3515 "aria-labelledby": correspondingTabId,
3516 hidden,
3517 id,
3518 role: "tabpanel",
3519 tabIndex: open ? 0 : -1,
3520 inert: inertValue(!open),
3521 [TabsPanelDataAttributes.index]: index
3522 }, elementProps],
3523 stateAttributesMapping: stateAttributesMapping2
3524 });
3525 useOpenChangeComplete({
3526 open,
3527 ref: panelRef,
3528 onComplete() {
3529 if (!open) {
3530 setMounted(false);
3531 }
3532 }
3533 });
3534 useIsoLayoutEffect(() => {
3535 if (hidden && !keepMounted) {
3536 return void 0;
3537 }
3538 if (id == null) {
3539 return void 0;
3540 }
3541 registerMountedTabPanel(value, id);
3542 return () => {
3543 unregisterMountedTabPanel(value, id);
3544 };
3545 }, [hidden, keepMounted, value, id, registerMountedTabPanel, unregisterMountedTabPanel]);
3546 const shouldRender = keepMounted || mounted;
3547 if (!shouldRender) {
3548 return null;
3549 }
3550 return element;
3551 });
3552 if (true) TabsPanel.displayName = "TabsPanel";
3553
3554 // node_modules/@base-ui/react/esm/tabs/list/TabsList.js
3555 var React30 = __toESM(require_react(), 1);
3556 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
3557 var TabsList = /* @__PURE__ */ React30.forwardRef(function TabsList2(componentProps, forwardedRef) {
3558 const {
3559 activateOnFocus = false,
3560 className,
3561 loopFocus = true,
3562 render,
3563 style,
3564 ...elementProps
3565 } = componentProps;
3566 const {
3567 onValueChange,
3568 orientation,
3569 value,
3570 setTabMap,
3571 tabActivationDirection
3572 } = useTabsRootContext();
3573 const [highlightedTabIndex, setHighlightedTabIndex] = React30.useState(0);
3574 const [tabsListElement, setTabsListElement] = React30.useState(null);
3575 const indicatorUpdateListenersRef = React30.useRef(/* @__PURE__ */ new Set());
3576 const tabResizeObserverElementsRef = React30.useRef(/* @__PURE__ */ new Set());
3577 const resizeObserverRef = React30.useRef(null);
3578 React30.useEffect(() => {
3579 if (typeof ResizeObserver === "undefined") {
3580 return void 0;
3581 }
3582 const resizeObserver = new ResizeObserver(() => {
3583 indicatorUpdateListenersRef.current.forEach((listener) => {
3584 listener();
3585 });
3586 });
3587 resizeObserverRef.current = resizeObserver;
3588 if (tabsListElement) {
3589 resizeObserver.observe(tabsListElement);
3590 }
3591 tabResizeObserverElementsRef.current.forEach((element) => {
3592 resizeObserver.observe(element);
3593 });
3594 return () => {
3595 resizeObserver.disconnect();
3596 resizeObserverRef.current = null;
3597 };
3598 }, [tabsListElement]);
3599 const registerIndicatorUpdateListener = useStableCallback((listener) => {
3600 indicatorUpdateListenersRef.current.add(listener);
3601 return () => {
3602 indicatorUpdateListenersRef.current.delete(listener);
3603 };
3604 });
3605 const registerTabResizeObserverElement = useStableCallback((element) => {
3606 tabResizeObserverElementsRef.current.add(element);
3607 resizeObserverRef.current?.observe(element);
3608 return () => {
3609 tabResizeObserverElementsRef.current.delete(element);
3610 resizeObserverRef.current?.unobserve(element);
3611 };
3612 });
3613 const onTabActivation = useStableCallback((newValue, eventDetails) => {
3614 if (newValue !== value) {
3615 onValueChange(newValue, eventDetails);
3616 }
3617 });
3618 const state = {
3619 orientation,
3620 tabActivationDirection
3621 };
3622 const defaultProps = {
3623 "aria-orientation": orientation === "vertical" ? "vertical" : void 0,
3624 role: "tablist"
3625 };
3626 const tabsListContextValue = React30.useMemo(() => ({
3627 activateOnFocus,
3628 highlightedTabIndex,
3629 registerIndicatorUpdateListener,
3630 registerTabResizeObserverElement,
3631 onTabActivation,
3632 setHighlightedTabIndex,
3633 tabsListElement
3634 }), [activateOnFocus, highlightedTabIndex, registerIndicatorUpdateListener, registerTabResizeObserverElement, onTabActivation, setHighlightedTabIndex, tabsListElement]);
3635 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabsListContext.Provider, {
3636 value: tabsListContextValue,
3637 children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CompositeRoot, {
3638 render,
3639 className,
3640 style,
3641 state,
3642 refs: [forwardedRef, setTabsListElement],
3643 props: [defaultProps, elementProps],
3644 stateAttributesMapping: tabsStateAttributesMapping,
3645 highlightedIndex: highlightedTabIndex,
3646 enableHomeAndEndKeys: true,
3647 loopFocus,
3648 orientation,
3649 onHighlightedIndexChange: setHighlightedTabIndex,
3650 onMapChange: setTabMap,
3651 disabledIndices: EMPTY_ARRAY
3652 })
3653 });
3654 });
3655 if (true) TabsList.displayName = "TabsList";
3656
3657 // node_modules/@base-ui/react/esm/use-render/useRender.js
3658 function useRender(params) {
3659 return useRenderElement(params.defaultTagName ?? "div", params, params);
3660 }
3661
3662 // packages/ui/build-module/icon/icon.mjs
3663 var import_element2 = __toESM(require_element(), 1);
3664 var import_primitives15 = __toESM(require_primitives(), 1);
3665 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
3666 var Icon = (0, import_element2.forwardRef)(function Icon2({ icon, size = 24, ...restProps }, ref) {
3667 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3668 import_primitives15.SVG,
3669 {
3670 ref,
3671 ...icon.props,
3672 ...restProps,
3673 width: size,
3674 height: size
3675 }
3676 );
3677 });
3678
3679 // packages/ui/build-module/stack/stack.mjs
3680 var import_element3 = __toESM(require_element(), 1);
3681 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
3682 function getRuntime() {
3683 const globalScope = globalThis;
3684 if (globalScope.__wpStyleRuntime) {
3685 return globalScope.__wpStyleRuntime;
3686 }
3687 globalScope.__wpStyleRuntime = {
3688 documents: /* @__PURE__ */ new Map(),
3689 styles: /* @__PURE__ */ new Map(),
3690 injectedStyles: /* @__PURE__ */ new WeakMap()
3691 };
3692 if (typeof document !== "undefined") {
3693 registerDocument(document);
3694 }
3695 return globalScope.__wpStyleRuntime;
3696 }
3697 function documentContainsStyleHash(targetDocument, hash) {
3698 if (!targetDocument.head) {
3699 return false;
3700 }
3701 for (const style of targetDocument.head.querySelectorAll(
3702 `style[${STYLE_HASH_ATTRIBUTE}]`
3703 )) {
3704 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
3705 return true;
3706 }
3707 }
3708 return false;
3709 }
3710 function injectStyle(targetDocument, hash, css) {
3711 if (!targetDocument.head) {
3712 return;
3713 }
3714 const runtime = getRuntime();
3715 let injectedStyles = runtime.injectedStyles.get(targetDocument);
3716 if (!injectedStyles) {
3717 injectedStyles = /* @__PURE__ */ new Set();
3718 runtime.injectedStyles.set(targetDocument, injectedStyles);
3719 }
3720 if (injectedStyles.has(hash)) {
3721 return;
3722 }
3723 if (documentContainsStyleHash(targetDocument, hash)) {
3724 injectedStyles.add(hash);
3725 return;
3726 }
3727 const style = targetDocument.createElement("style");
3728 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
3729 style.appendChild(targetDocument.createTextNode(css));
3730 targetDocument.head.appendChild(style);
3731 injectedStyles.add(hash);
3732 }
3733 function registerDocument(targetDocument) {
3734 const runtime = getRuntime();
3735 runtime.documents.set(
3736 targetDocument,
3737 (runtime.documents.get(targetDocument) ?? 0) + 1
3738 );
3739 for (const [hash, css] of runtime.styles) {
3740 injectStyle(targetDocument, hash, css);
3741 }
3742 return () => {
3743 const count = runtime.documents.get(targetDocument);
3744 if (count === void 0) {
3745 return;
3746 }
3747 if (count <= 1) {
3748 runtime.documents.delete(targetDocument);
3749 return;
3750 }
3751 runtime.documents.set(targetDocument, count - 1);
3752 };
3753 }
3754 function registerStyle(hash, css) {
3755 const runtime = getRuntime();
3756 runtime.styles.set(hash, css);
3757 for (const targetDocument of runtime.documents.keys()) {
3758 injectStyle(targetDocument, hash, css);
3759 }
3760 }
3761 if (typeof process === "undefined" || true) {
3762 registerStyle("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
3763 }
3764 var style_default = { "stack": "_19ce0419607e1896__stack" };
3765 var gapTokens = {
3766 xs: "var(--wpds-dimension-gap-xs, 4px)",
3767 sm: "var(--wpds-dimension-gap-sm, 8px)",
3768 md: "var(--wpds-dimension-gap-md, 12px)",
3769 lg: "var(--wpds-dimension-gap-lg, 16px)",
3770 xl: "var(--wpds-dimension-gap-xl, 24px)",
3771 "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
3772 "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
3773 };
3774 var Stack = (0, import_element3.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
3775 const style = {
3776 gap: gap && gapTokens[gap],
3777 alignItems: align,
3778 justifyContent: justify,
3779 flexDirection: direction,
3780 flexWrap: wrap
3781 };
3782 const element = useRender({
3783 render,
3784 ref,
3785 props: mergeProps(props, { style, className: style_default.stack })
3786 });
3787 return element;
3788 });
3789
3790 // packages/ui/build-module/utils/use-schedule-validation.mjs
3791 var import_element4 = __toESM(require_element(), 1);
3792 function useScheduleValidation(validate) {
3793 const validateRef = (0, import_element4.useRef)(validate);
3794 validateRef.current = validate;
3795 const timerRef = (0, import_element4.useRef)(null);
3796 const unmountedRef = (0, import_element4.useRef)(false);
3797 const scheduleValidation = (0, import_element4.useCallback)(() => {
3798 if (unmountedRef.current) {
3799 return;
3800 }
3801 if (timerRef.current) {
3802 clearTimeout(timerRef.current);
3803 }
3804 timerRef.current = setTimeout(() => {
3805 validateRef.current();
3806 timerRef.current = null;
3807 }, 0);
3808 }, []);
3809 (0, import_element4.useEffect)(() => {
3810 unmountedRef.current = false;
3811 return () => {
3812 unmountedRef.current = true;
3813 if (timerRef.current) {
3814 clearTimeout(timerRef.current);
3815 }
3816 };
3817 }, []);
3818 return scheduleValidation;
3819 }
3820
3821 // packages/ui/build-module/visually-hidden/visually-hidden.mjs
3822 var import_element5 = __toESM(require_element(), 1);
3823 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
3824 function getRuntime2() {
3825 const globalScope = globalThis;
3826 if (globalScope.__wpStyleRuntime) {
3827 return globalScope.__wpStyleRuntime;
3828 }
3829 globalScope.__wpStyleRuntime = {
3830 documents: /* @__PURE__ */ new Map(),
3831 styles: /* @__PURE__ */ new Map(),
3832 injectedStyles: /* @__PURE__ */ new WeakMap()
3833 };
3834 if (typeof document !== "undefined") {
3835 registerDocument2(document);
3836 }
3837 return globalScope.__wpStyleRuntime;
3838 }
3839 function documentContainsStyleHash2(targetDocument, hash) {
3840 if (!targetDocument.head) {
3841 return false;
3842 }
3843 for (const style of targetDocument.head.querySelectorAll(
3844 `style[${STYLE_HASH_ATTRIBUTE2}]`
3845 )) {
3846 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
3847 return true;
3848 }
3849 }
3850 return false;
3851 }
3852 function injectStyle2(targetDocument, hash, css) {
3853 if (!targetDocument.head) {
3854 return;
3855 }
3856 const runtime = getRuntime2();
3857 let injectedStyles = runtime.injectedStyles.get(targetDocument);
3858 if (!injectedStyles) {
3859 injectedStyles = /* @__PURE__ */ new Set();
3860 runtime.injectedStyles.set(targetDocument, injectedStyles);
3861 }
3862 if (injectedStyles.has(hash)) {
3863 return;
3864 }
3865 if (documentContainsStyleHash2(targetDocument, hash)) {
3866 injectedStyles.add(hash);
3867 return;
3868 }
3869 const style = targetDocument.createElement("style");
3870 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
3871 style.appendChild(targetDocument.createTextNode(css));
3872 targetDocument.head.appendChild(style);
3873 injectedStyles.add(hash);
3874 }
3875 function registerDocument2(targetDocument) {
3876 const runtime = getRuntime2();
3877 runtime.documents.set(
3878 targetDocument,
3879 (runtime.documents.get(targetDocument) ?? 0) + 1
3880 );
3881 for (const [hash, css] of runtime.styles) {
3882 injectStyle2(targetDocument, hash, css);
3883 }
3884 return () => {
3885 const count = runtime.documents.get(targetDocument);
3886 if (count === void 0) {
3887 return;
3888 }
3889 if (count <= 1) {
3890 runtime.documents.delete(targetDocument);
3891 return;
3892 }
3893 runtime.documents.set(targetDocument, count - 1);
3894 };
3895 }
3896 function registerStyle2(hash, css) {
3897 const runtime = getRuntime2();
3898 runtime.styles.set(hash, css);
3899 for (const targetDocument of runtime.documents.keys()) {
3900 injectStyle2(targetDocument, hash, css);
3901 }
3902 }
3903 if (typeof process === "undefined" || true) {
3904 registerStyle2("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}");
3905 }
3906 var style_default2 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
3907 var VisuallyHidden = (0, import_element5.forwardRef)(
3908 function VisuallyHidden2({ render, ...restProps }, ref) {
3909 const element = useRender({
3910 render,
3911 ref,
3912 props: mergeProps(
3913 { className: style_default2["visually-hidden"] },
3914 restProps,
3915 {
3916 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
3917 "data-visually-hidden": ""
3918 }
3919 )
3920 });
3921 return element;
3922 }
3923 );
3924
3925 // packages/ui/build-module/link/link.mjs
3926 var import_element6 = __toESM(require_element(), 1);
3927 var import_i18n3 = __toESM(require_i18n(), 1);
3928 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
3929 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
3930 function getRuntime3() {
3931 const globalScope = globalThis;
3932 if (globalScope.__wpStyleRuntime) {
3933 return globalScope.__wpStyleRuntime;
3934 }
3935 globalScope.__wpStyleRuntime = {
3936 documents: /* @__PURE__ */ new Map(),
3937 styles: /* @__PURE__ */ new Map(),
3938 injectedStyles: /* @__PURE__ */ new WeakMap()
3939 };
3940 if (typeof document !== "undefined") {
3941 registerDocument3(document);
3942 }
3943 return globalScope.__wpStyleRuntime;
3944 }
3945 function documentContainsStyleHash3(targetDocument, hash) {
3946 if (!targetDocument.head) {
3947 return false;
3948 }
3949 for (const style of targetDocument.head.querySelectorAll(
3950 `style[${STYLE_HASH_ATTRIBUTE3}]`
3951 )) {
3952 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
3953 return true;
3954 }
3955 }
3956 return false;
3957 }
3958 function injectStyle3(targetDocument, hash, css) {
3959 if (!targetDocument.head) {
3960 return;
3961 }
3962 const runtime = getRuntime3();
3963 let injectedStyles = runtime.injectedStyles.get(targetDocument);
3964 if (!injectedStyles) {
3965 injectedStyles = /* @__PURE__ */ new Set();
3966 runtime.injectedStyles.set(targetDocument, injectedStyles);
3967 }
3968 if (injectedStyles.has(hash)) {
3969 return;
3970 }
3971 if (documentContainsStyleHash3(targetDocument, hash)) {
3972 injectedStyles.add(hash);
3973 return;
3974 }
3975 const style = targetDocument.createElement("style");
3976 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
3977 style.appendChild(targetDocument.createTextNode(css));
3978 targetDocument.head.appendChild(style);
3979 injectedStyles.add(hash);
3980 }
3981 function registerDocument3(targetDocument) {
3982 const runtime = getRuntime3();
3983 runtime.documents.set(
3984 targetDocument,
3985 (runtime.documents.get(targetDocument) ?? 0) + 1
3986 );
3987 for (const [hash, css] of runtime.styles) {
3988 injectStyle3(targetDocument, hash, css);
3989 }
3990 return () => {
3991 const count = runtime.documents.get(targetDocument);
3992 if (count === void 0) {
3993 return;
3994 }
3995 if (count <= 1) {
3996 runtime.documents.delete(targetDocument);
3997 return;
3998 }
3999 runtime.documents.set(targetDocument, count - 1);
4000 };
4001 }
4002 function registerStyle3(hash, css) {
4003 const runtime = getRuntime3();
4004 runtime.styles.set(hash, css);
4005 for (const targetDocument of runtime.documents.keys()) {
4006 injectStyle3(targetDocument, hash, css);
4007 }
4008 }
4009 if (typeof process === "undefined" || true) {
4010 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
4011 }
4012 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
4013 if (typeof process === "undefined" || true) {
4014 registerStyle3("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
4015 }
4016 var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" };
4017 if (typeof process === "undefined" || true) {
4018 registerStyle3("7e0119b657", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-regular,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}');
4019 }
4020 var style_default3 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" };
4021 if (typeof process === "undefined" || true) {
4022 registerStyle3("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}");
4023 }
4024 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
4025 var Link = (0, import_element6.forwardRef)(function Link2({
4026 children,
4027 variant = "default",
4028 tone = "brand",
4029 openInNewTab = false,
4030 render,
4031 className,
4032 ...props
4033 }, ref) {
4034 const element = useRender({
4035 render,
4036 defaultTagName: "a",
4037 ref,
4038 props: mergeProps(props, {
4039 className: clsx_default(
4040 global_css_defense_default.a,
4041 resets_default["box-sizing"],
4042 focus_default["outset-ring--focus"],
4043 variant !== "unstyled" && style_default3.link,
4044 variant !== "unstyled" && style_default3[`is-${tone}`],
4045 variant === "unstyled" && style_default3["is-unstyled"],
4046 className
4047 ),
4048 target: openInNewTab ? "_blank" : void 0,
4049 children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4050 children,
4051 openInNewTab && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4052 "span",
4053 {
4054 className: style_default3["link-icon"],
4055 role: "img",
4056 "aria-label": (
4057 /* translators: accessibility text appended to link text */
4058 (0, import_i18n3.__)("(opens in a new tab)")
4059 )
4060 }
4061 )
4062 ] })
4063 })
4064 });
4065 return element;
4066 });
4067
4068 // packages/ui/build-module/tabs/index.mjs
4069 var tabs_exports = {};
4070 __export(tabs_exports, {
4071 List: () => List,
4072 Panel: () => Panel,
4073 Root: () => Root,
4074 Tab: () => Tab
4075 });
4076
4077 // packages/ui/build-module/tabs/list.mjs
4078 var import_element7 = __toESM(require_element(), 1);
4079 var import_compose = __toESM(require_compose(), 1);
4080 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
4081 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
4082 function getRuntime4() {
4083 const globalScope = globalThis;
4084 if (globalScope.__wpStyleRuntime) {
4085 return globalScope.__wpStyleRuntime;
4086 }
4087 globalScope.__wpStyleRuntime = {
4088 documents: /* @__PURE__ */ new Map(),
4089 styles: /* @__PURE__ */ new Map(),
4090 injectedStyles: /* @__PURE__ */ new WeakMap()
4091 };
4092 if (typeof document !== "undefined") {
4093 registerDocument4(document);
4094 }
4095 return globalScope.__wpStyleRuntime;
4096 }
4097 function documentContainsStyleHash4(targetDocument, hash) {
4098 if (!targetDocument.head) {
4099 return false;
4100 }
4101 for (const style of targetDocument.head.querySelectorAll(
4102 `style[${STYLE_HASH_ATTRIBUTE4}]`
4103 )) {
4104 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
4105 return true;
4106 }
4107 }
4108 return false;
4109 }
4110 function injectStyle4(targetDocument, hash, css) {
4111 if (!targetDocument.head) {
4112 return;
4113 }
4114 const runtime = getRuntime4();
4115 let injectedStyles = runtime.injectedStyles.get(targetDocument);
4116 if (!injectedStyles) {
4117 injectedStyles = /* @__PURE__ */ new Set();
4118 runtime.injectedStyles.set(targetDocument, injectedStyles);
4119 }
4120 if (injectedStyles.has(hash)) {
4121 return;
4122 }
4123 if (documentContainsStyleHash4(targetDocument, hash)) {
4124 injectedStyles.add(hash);
4125 return;
4126 }
4127 const style = targetDocument.createElement("style");
4128 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
4129 style.appendChild(targetDocument.createTextNode(css));
4130 targetDocument.head.appendChild(style);
4131 injectedStyles.add(hash);
4132 }
4133 function registerDocument4(targetDocument) {
4134 const runtime = getRuntime4();
4135 runtime.documents.set(
4136 targetDocument,
4137 (runtime.documents.get(targetDocument) ?? 0) + 1
4138 );
4139 for (const [hash, css] of runtime.styles) {
4140 injectStyle4(targetDocument, hash, css);
4141 }
4142 return () => {
4143 const count = runtime.documents.get(targetDocument);
4144 if (count === void 0) {
4145 return;
4146 }
4147 if (count <= 1) {
4148 runtime.documents.delete(targetDocument);
4149 return;
4150 }
4151 runtime.documents.set(targetDocument, count - 1);
4152 };
4153 }
4154 function registerStyle4(hash, css) {
4155 const runtime = getRuntime4();
4156 runtime.styles.set(hash, css);
4157 for (const targetDocument of runtime.documents.keys()) {
4158 injectStyle4(targetDocument, hash, css);
4159 }
4160 }
4161 if (typeof process === "undefined" || true) {
4162 registerStyle4("bb8cbb8f31", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}');
4163 }
4164 var style_default4 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" };
4165 var SCROLL_EPSILON = 1;
4166 var List = (0, import_element7.forwardRef)(
4167 function TabList({
4168 children,
4169 variant = "default",
4170 className,
4171 activateOnFocus,
4172 ...otherProps
4173 }, forwardedRef) {
4174 const [listEl, setListEl] = (0, import_element7.useState)(null);
4175 const [overflow, setOverflow] = (0, import_element7.useState)({
4176 first: false,
4177 last: false,
4178 isScrolling: false
4179 });
4180 (0, import_element7.useEffect)(() => {
4181 if (!listEl) {
4182 return;
4183 }
4184 const measureOverflow = () => {
4185 const { scrollWidth, clientWidth, scrollLeft } = listEl;
4186 const maxScroll = Math.max(scrollWidth - clientWidth, 0);
4187 const direction = listEl.dir || (typeof window !== "undefined" ? window.getComputedStyle(listEl).direction : "ltr");
4188 const scrollFromStart = direction === "rtl" && scrollLeft < 0 ? (
4189 // In RTL layouts, scrollLeft is typically 0 at the visual "start"
4190 // (right edge) and becomes negative toward the "end" (left edge).
4191 // Normalize value for correct first/last detection logic.
4192 -scrollLeft
4193 ) : scrollLeft;
4194 setOverflow({
4195 first: scrollFromStart > SCROLL_EPSILON,
4196 last: scrollFromStart < maxScroll - SCROLL_EPSILON,
4197 isScrolling: scrollWidth > clientWidth
4198 });
4199 };
4200 const resizeObserver = new ResizeObserver(measureOverflow);
4201 resizeObserver.observe(listEl);
4202 let scrollTick = false;
4203 const throttleMeasureOverflowOnScroll = () => {
4204 if (!scrollTick) {
4205 requestAnimationFrame(() => {
4206 measureOverflow();
4207 scrollTick = false;
4208 });
4209 scrollTick = true;
4210 }
4211 };
4212 listEl.addEventListener(
4213 "scroll",
4214 throttleMeasureOverflowOnScroll,
4215 { passive: true }
4216 );
4217 measureOverflow();
4218 return () => {
4219 listEl.removeEventListener(
4220 "scroll",
4221 throttleMeasureOverflowOnScroll
4222 );
4223 resizeObserver.disconnect();
4224 };
4225 }, [listEl]);
4226 const mergedListRef = (0, import_compose.useMergeRefs)([
4227 forwardedRef,
4228 (el) => setListEl(el)
4229 ]);
4230 return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4231 index_parts_exports.List,
4232 {
4233 ref: mergedListRef,
4234 activateOnFocus,
4235 "data-select-on-move": activateOnFocus ? "true" : "false",
4236 className: clsx_default(
4237 style_default4.tablist,
4238 overflow.first && style_default4["is-overflowing-first"],
4239 overflow.last && style_default4["is-overflowing-last"],
4240 style_default4[`is-${variant}-variant`],
4241 className
4242 ),
4243 ...otherProps,
4244 tabIndex: otherProps.tabIndex ?? (overflow.isScrolling ? -1 : void 0),
4245 children: [
4246 children,
4247 /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(index_parts_exports.Indicator, { className: style_default4.indicator })
4248 ]
4249 }
4250 );
4251 }
4252 );
4253
4254 // packages/ui/build-module/tabs/panel.mjs
4255 var import_element9 = __toESM(require_element(), 1);
4256
4257 // packages/ui/build-module/tabs/context.mjs
4258 var import_element8 = __toESM(require_element(), 1);
4259 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
4260 var VALIDATION_ENABLED = true;
4261 var TabsValidationContext = VALIDATION_ENABLED ? (0, import_element8.createContext)(null) : null;
4262 function useRegisterTabDev() {
4263 const context = (0, import_element8.useContext)(TabsValidationContext);
4264 (0, import_element8.useEffect)(() => {
4265 if (context) {
4266 return context.registerTab();
4267 }
4268 return void 0;
4269 }, [context]);
4270 }
4271 function useRegisterTabProd() {
4272 }
4273 var useRegisterTab = VALIDATION_ENABLED ? useRegisterTabDev : useRegisterTabProd;
4274 function useRegisterPanelDev() {
4275 const context = (0, import_element8.useContext)(TabsValidationContext);
4276 (0, import_element8.useEffect)(() => {
4277 if (context) {
4278 return context.registerPanel();
4279 }
4280 return void 0;
4281 }, [context]);
4282 }
4283 function useRegisterPanelProd() {
4284 }
4285 var useRegisterPanel = VALIDATION_ENABLED ? useRegisterPanelDev : useRegisterPanelProd;
4286 function TabsValidationProviderDev({
4287 children
4288 }) {
4289 const tabCountRef = (0, import_element8.useRef)(0);
4290 const panelCountRef = (0, import_element8.useRef)(0);
4291 const scheduleValidation = useScheduleValidation(() => {
4292 const tabCount = tabCountRef.current;
4293 const panelCount = panelCountRef.current;
4294 if (tabCount !== panelCount) {
4295 throw new Error(
4296 `Tabs: Tab/Panel count mismatch (${tabCount} Tabs, ${panelCount} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`
4297 );
4298 }
4299 });
4300 const registerTab = (0, import_element8.useCallback)(() => {
4301 tabCountRef.current += 1;
4302 scheduleValidation();
4303 return () => {
4304 tabCountRef.current -= 1;
4305 scheduleValidation();
4306 };
4307 }, [scheduleValidation]);
4308 const registerPanel = (0, import_element8.useCallback)(() => {
4309 panelCountRef.current += 1;
4310 scheduleValidation();
4311 return () => {
4312 panelCountRef.current -= 1;
4313 scheduleValidation();
4314 };
4315 }, [scheduleValidation]);
4316 const contextValue = (0, import_element8.useMemo)(
4317 () => ({
4318 registerTab,
4319 registerPanel
4320 }),
4321 [registerTab, registerPanel]
4322 );
4323 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TabsValidationContext.Provider, { value: contextValue, children });
4324 }
4325 function TabsValidationProviderProd({
4326 children
4327 }) {
4328 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children });
4329 }
4330 var TabsValidationProvider = VALIDATION_ENABLED ? TabsValidationProviderDev : TabsValidationProviderProd;
4331
4332 // packages/ui/build-module/tabs/panel.mjs
4333 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
4334 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
4335 function getRuntime5() {
4336 const globalScope = globalThis;
4337 if (globalScope.__wpStyleRuntime) {
4338 return globalScope.__wpStyleRuntime;
4339 }
4340 globalScope.__wpStyleRuntime = {
4341 documents: /* @__PURE__ */ new Map(),
4342 styles: /* @__PURE__ */ new Map(),
4343 injectedStyles: /* @__PURE__ */ new WeakMap()
4344 };
4345 if (typeof document !== "undefined") {
4346 registerDocument5(document);
4347 }
4348 return globalScope.__wpStyleRuntime;
4349 }
4350 function documentContainsStyleHash5(targetDocument, hash) {
4351 if (!targetDocument.head) {
4352 return false;
4353 }
4354 for (const style of targetDocument.head.querySelectorAll(
4355 `style[${STYLE_HASH_ATTRIBUTE5}]`
4356 )) {
4357 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
4358 return true;
4359 }
4360 }
4361 return false;
4362 }
4363 function injectStyle5(targetDocument, hash, css) {
4364 if (!targetDocument.head) {
4365 return;
4366 }
4367 const runtime = getRuntime5();
4368 let injectedStyles = runtime.injectedStyles.get(targetDocument);
4369 if (!injectedStyles) {
4370 injectedStyles = /* @__PURE__ */ new Set();
4371 runtime.injectedStyles.set(targetDocument, injectedStyles);
4372 }
4373 if (injectedStyles.has(hash)) {
4374 return;
4375 }
4376 if (documentContainsStyleHash5(targetDocument, hash)) {
4377 injectedStyles.add(hash);
4378 return;
4379 }
4380 const style = targetDocument.createElement("style");
4381 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
4382 style.appendChild(targetDocument.createTextNode(css));
4383 targetDocument.head.appendChild(style);
4384 injectedStyles.add(hash);
4385 }
4386 function registerDocument5(targetDocument) {
4387 const runtime = getRuntime5();
4388 runtime.documents.set(
4389 targetDocument,
4390 (runtime.documents.get(targetDocument) ?? 0) + 1
4391 );
4392 for (const [hash, css] of runtime.styles) {
4393 injectStyle5(targetDocument, hash, css);
4394 }
4395 return () => {
4396 const count = runtime.documents.get(targetDocument);
4397 if (count === void 0) {
4398 return;
4399 }
4400 if (count <= 1) {
4401 runtime.documents.delete(targetDocument);
4402 return;
4403 }
4404 runtime.documents.set(targetDocument, count - 1);
4405 };
4406 }
4407 function registerStyle5(hash, css) {
4408 const runtime = getRuntime5();
4409 runtime.styles.set(hash, css);
4410 for (const targetDocument of runtime.documents.keys()) {
4411 injectStyle5(targetDocument, hash, css);
4412 }
4413 }
4414 if (typeof process === "undefined" || true) {
4415 registerStyle5("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}");
4416 }
4417 var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" };
4418 if (typeof process === "undefined" || true) {
4419 registerStyle5("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
4420 }
4421 var focus_default2 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" };
4422 var Panel = (0, import_element9.forwardRef)(
4423 function TabPanel({ className, ...otherProps }, forwardedRef) {
4424 useRegisterPanel();
4425 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4426 index_parts_exports.Panel,
4427 {
4428 ref: forwardedRef,
4429 className: clsx_default(
4430 global_css_defense_default2.div,
4431 focus_default2["outset-ring--focus-visible"],
4432 className
4433 ),
4434 ...otherProps
4435 }
4436 );
4437 }
4438 );
4439
4440 // packages/ui/build-module/tabs/root.mjs
4441 var import_element10 = __toESM(require_element(), 1);
4442 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
4443 var Root = (0, import_element10.forwardRef)(
4444 function TabsRoot3({ ...otherProps }, forwardedRef) {
4445 return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TabsValidationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...otherProps }) });
4446 }
4447 );
4448
4449 // packages/ui/build-module/tabs/tab.mjs
4450 var import_element11 = __toESM(require_element(), 1);
4451 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
4452 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash";
4453 function getRuntime6() {
4454 const globalScope = globalThis;
4455 if (globalScope.__wpStyleRuntime) {
4456 return globalScope.__wpStyleRuntime;
4457 }
4458 globalScope.__wpStyleRuntime = {
4459 documents: /* @__PURE__ */ new Map(),
4460 styles: /* @__PURE__ */ new Map(),
4461 injectedStyles: /* @__PURE__ */ new WeakMap()
4462 };
4463 if (typeof document !== "undefined") {
4464 registerDocument6(document);
4465 }
4466 return globalScope.__wpStyleRuntime;
4467 }
4468 function documentContainsStyleHash6(targetDocument, hash) {
4469 if (!targetDocument.head) {
4470 return false;
4471 }
4472 for (const style of targetDocument.head.querySelectorAll(
4473 `style[${STYLE_HASH_ATTRIBUTE6}]`
4474 )) {
4475 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) {
4476 return true;
4477 }
4478 }
4479 return false;
4480 }
4481 function injectStyle6(targetDocument, hash, css) {
4482 if (!targetDocument.head) {
4483 return;
4484 }
4485 const runtime = getRuntime6();
4486 let injectedStyles = runtime.injectedStyles.get(targetDocument);
4487 if (!injectedStyles) {
4488 injectedStyles = /* @__PURE__ */ new Set();
4489 runtime.injectedStyles.set(targetDocument, injectedStyles);
4490 }
4491 if (injectedStyles.has(hash)) {
4492 return;
4493 }
4494 if (documentContainsStyleHash6(targetDocument, hash)) {
4495 injectedStyles.add(hash);
4496 return;
4497 }
4498 const style = targetDocument.createElement("style");
4499 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash);
4500 style.appendChild(targetDocument.createTextNode(css));
4501 targetDocument.head.appendChild(style);
4502 injectedStyles.add(hash);
4503 }
4504 function registerDocument6(targetDocument) {
4505 const runtime = getRuntime6();
4506 runtime.documents.set(
4507 targetDocument,
4508 (runtime.documents.get(targetDocument) ?? 0) + 1
4509 );
4510 for (const [hash, css] of runtime.styles) {
4511 injectStyle6(targetDocument, hash, css);
4512 }
4513 return () => {
4514 const count = runtime.documents.get(targetDocument);
4515 if (count === void 0) {
4516 return;
4517 }
4518 if (count <= 1) {
4519 runtime.documents.delete(targetDocument);
4520 return;
4521 }
4522 runtime.documents.set(targetDocument, count - 1);
4523 };
4524 }
4525 function registerStyle6(hash, css) {
4526 const runtime = getRuntime6();
4527 runtime.styles.set(hash, css);
4528 for (const targetDocument of runtime.documents.keys()) {
4529 injectStyle6(targetDocument, hash, css);
4530 }
4531 }
4532 if (typeof process === "undefined" || true) {
4533 registerStyle6("bb8cbb8f31", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-factor:1;--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-factor:-1;--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}');
4534 }
4535 var style_default5 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" };
4536 var Tab = (0, import_element11.forwardRef)(function Tab2({ className, children, ...otherProps }, forwardedRef) {
4537 useRegisterTab();
4538 return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4539 index_parts_exports.Tab,
4540 {
4541 ref: forwardedRef,
4542 className: clsx_default(style_default5.tab, className),
4543 ...otherProps,
4544 children: [
4545 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: style_default5["tab-children"], children }),
4546 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { icon: chevron_right_default, className: style_default5["tab-chevron"] })
4547 ]
4548 }
4549 );
4550 });
4551
4552 // packages/format-library/build-module/image/index.mjs
4553 var import_i18n4 = __toESM(require_i18n(), 1);
4554 var import_element12 = __toESM(require_element(), 1);
4555 var import_rich_text3 = __toESM(require_rich_text(), 1);
4556 var import_block_editor3 = __toESM(require_block_editor(), 1);
4557 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
4558 var ALLOWED_MEDIA_TYPES = ["image"];
4559 var name3 = "core/image";
4560 var title3 = (0, import_i18n4.__)("Inline image");
4561 function getCurrentImageId(activeObjectAttributes) {
4562 if (!activeObjectAttributes?.className) {
4563 return void 0;
4564 }
4565 const [, id] = activeObjectAttributes.className.match(/wp-image-(\d+)/) ?? [];
4566 return id ? parseInt(id, 10) : void 0;
4567 }
4568 var image = {
4569 name: name3,
4570 title: title3,
4571 keywords: [(0, import_i18n4.__)("photo"), (0, import_i18n4.__)("media")],
4572 object: true,
4573 tagName: "img",
4574 className: null,
4575 attributes: {
4576 className: "class",
4577 style: "style",
4578 url: "src",
4579 alt: "alt"
4580 },
4581 edit: Edit
4582 };
4583 function InlineUI({ value, onChange, activeObjectAttributes, contentRef }) {
4584 const { style, alt } = activeObjectAttributes;
4585 const width = style?.replace(/\D/g, "");
4586 const [editedWidth, setEditedWidth] = (0, import_element12.useState)(width);
4587 const [editedAlt, setEditedAlt] = (0, import_element12.useState)(alt);
4588 const hasChanged = editedWidth !== width || editedAlt !== alt;
4589 const popoverAnchor = (0, import_rich_text3.useAnchor)({
4590 editableContentElement: contentRef.current,
4591 settings: image
4592 });
4593 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4594 import_components.Popover,
4595 {
4596 focusOnMount: false,
4597 anchor: popoverAnchor,
4598 className: "block-editor-format-toolbar__image-popover",
4599 children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4600 "form",
4601 {
4602 className: "block-editor-format-toolbar__image-container-content",
4603 onSubmit: (event) => {
4604 const newReplacements = value.replacements.slice();
4605 newReplacements[value.start] = {
4606 type: name3,
4607 attributes: {
4608 ...activeObjectAttributes,
4609 style: editedWidth ? `width: ${editedWidth}px;` : "",
4610 alt: editedAlt
4611 }
4612 };
4613 onChange({
4614 ...value,
4615 replacements: newReplacements
4616 });
4617 event.preventDefault();
4618 },
4619 children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Stack, { direction: "column", gap: "lg", children: [
4620 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4621 import_components.__experimentalNumberControl,
4622 {
4623 __next40pxDefaultSize: true,
4624 label: (0, import_i18n4.__)("Width"),
4625 value: editedWidth,
4626 min: 1,
4627 onChange: (newWidth) => {
4628 setEditedWidth(newWidth);
4629 }
4630 }
4631 ),
4632 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4633 import_components.TextareaControl,
4634 {
4635 label: (0, import_i18n4.__)("Alternative text"),
4636 value: editedAlt,
4637 onChange: (newAlt) => {
4638 setEditedAlt(newAlt);
4639 },
4640 help: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
4641 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4642 Link,
4643 {
4644 openInNewTab: true,
4645 href: (
4646 // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
4647 (0, import_i18n4.__)(
4648 "https://www.w3.org/WAI/tutorials/images/decision-tree/"
4649 )
4650 ),
4651 children: (0, import_i18n4.__)(
4652 "Describe the purpose of the image."
4653 )
4654 }
4655 ),
4656 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("br", {}),
4657 (0, import_i18n4.__)("Leave empty if decorative.")
4658 ] })
4659 }
4660 ),
4661 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Stack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4662 import_components.Button,
4663 {
4664 disabled: !hasChanged,
4665 accessibleWhenDisabled: true,
4666 variant: "primary",
4667 type: "submit",
4668 size: "compact",
4669 children: (0, import_i18n4.__)("Apply")
4670 }
4671 ) })
4672 ] })
4673 }
4674 )
4675 }
4676 );
4677 }
4678 function Edit({
4679 value,
4680 onChange,
4681 onFocus,
4682 isObjectActive,
4683 activeObjectAttributes,
4684 contentRef
4685 }) {
4686 return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_block_editor3.MediaUploadCheck, { children: [
4687 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4688 import_block_editor3.MediaUpload,
4689 {
4690 allowedTypes: ALLOWED_MEDIA_TYPES,
4691 value: getCurrentImageId(activeObjectAttributes),
4692 onSelect: ({ id, url, alt, width: imgWidth }) => {
4693 onChange(
4694 (0, import_rich_text3.insertObject)(value, {
4695 type: name3,
4696 attributes: {
4697 className: `wp-image-${id}`,
4698 style: `width: ${Math.min(
4699 imgWidth,
4700 150
4701 )}px;`,
4702 url,
4703 alt
4704 }
4705 })
4706 );
4707 onFocus();
4708 },
4709 render: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4710 import_block_editor3.RichTextToolbarButton,
4711 {
4712 icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4713 import_components.SVG,
4714 {
4715 xmlns: "http://www.w3.org/2000/svg",
4716 viewBox: "0 0 24 24",
4717 children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components.Path, { 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" })
4718 }
4719 ),
4720 title: isObjectActive ? (0, import_i18n4.__)("Replace image") : title3,
4721 onClick: open,
4722 isActive: isObjectActive
4723 }
4724 )
4725 }
4726 ),
4727 isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4728 InlineUI,
4729 {
4730 value,
4731 onChange,
4732 activeObjectAttributes,
4733 contentRef
4734 }
4735 )
4736 ] });
4737 }
4738
4739 // packages/format-library/build-module/italic/index.mjs
4740 var import_i18n5 = __toESM(require_i18n(), 1);
4741 var import_rich_text4 = __toESM(require_rich_text(), 1);
4742 var import_block_editor4 = __toESM(require_block_editor(), 1);
4743 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
4744 var name4 = "core/italic";
4745 var title4 = (0, import_i18n5.__)("Italic");
4746 var italic = {
4747 name: name4,
4748 title: title4,
4749 tagName: "em",
4750 className: null,
4751 edit({ isActive, value, onChange, onFocus, isVisible = true }) {
4752 function onToggle() {
4753 onChange((0, import_rich_text4.toggleFormat)(value, { type: name4, title: title4 }));
4754 }
4755 function onClick() {
4756 onChange((0, import_rich_text4.toggleFormat)(value, { type: name4 }));
4757 onFocus();
4758 }
4759 return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
4760 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4761 import_block_editor4.RichTextShortcut,
4762 {
4763 type: "primary",
4764 character: "i",
4765 onUse: onToggle
4766 }
4767 ),
4768 isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4769 import_block_editor4.RichTextToolbarButton,
4770 {
4771 name: "italic",
4772 icon: format_italic_default,
4773 title: title4,
4774 onClick,
4775 isActive,
4776 shortcutType: "primary",
4777 shortcutCharacter: "i"
4778 }
4779 ),
4780 /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4781 import_block_editor4.__unstableRichTextInputEvent,
4782 {
4783 inputType: "formatItalic",
4784 onInput: onToggle
4785 }
4786 )
4787 ] });
4788 }
4789 };
4790
4791 // packages/format-library/build-module/link/index.mjs
4792 var import_i18n8 = __toESM(require_i18n(), 1);
4793 var import_element15 = __toESM(require_element(), 1);
4794 var import_rich_text6 = __toESM(require_rich_text(), 1);
4795 var import_url3 = __toESM(require_url(), 1);
4796 var import_block_editor6 = __toESM(require_block_editor(), 1);
4797 var import_html_entities = __toESM(require_html_entities(), 1);
4798 var import_a11y2 = __toESM(require_a11y(), 1);
4799
4800 // packages/format-library/build-module/link/inline.mjs
4801 var import_element14 = __toESM(require_element(), 1);
4802 var import_i18n7 = __toESM(require_i18n(), 1);
4803 var import_a11y = __toESM(require_a11y(), 1);
4804 var import_components3 = __toESM(require_components(), 1);
4805 var import_url2 = __toESM(require_url(), 1);
4806 var import_rich_text5 = __toESM(require_rich_text(), 1);
4807 var import_block_editor5 = __toESM(require_block_editor(), 1);
4808 var import_data = __toESM(require_data(), 1);
4809
4810 // packages/format-library/build-module/link/utils.mjs
4811 var import_url = __toESM(require_url(), 1);
4812 function isValidHref(href) {
4813 if (!href) {
4814 return false;
4815 }
4816 const trimmedHref = href.trim();
4817 if (!trimmedHref) {
4818 return false;
4819 }
4820 if (/^\S+:/.test(trimmedHref)) {
4821 const protocol = (0, import_url.getProtocol)(trimmedHref);
4822 if (!(0, import_url.isValidProtocol)(protocol)) {
4823 return false;
4824 }
4825 if (protocol.startsWith("http") && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
4826 return false;
4827 }
4828 const authority = (0, import_url.getAuthority)(trimmedHref);
4829 if (!(0, import_url.isValidAuthority)(authority)) {
4830 return false;
4831 }
4832 const path = (0, import_url.getPath)(trimmedHref);
4833 if (path && !(0, import_url.isValidPath)(path)) {
4834 return false;
4835 }
4836 const queryString = (0, import_url.getQueryString)(trimmedHref);
4837 if (queryString && !(0, import_url.isValidQueryString)(queryString)) {
4838 return false;
4839 }
4840 const fragment = (0, import_url.getFragment)(trimmedHref);
4841 if (fragment && !(0, import_url.isValidFragment)(fragment)) {
4842 return false;
4843 }
4844 }
4845 if (trimmedHref.startsWith("#") && !(0, import_url.isValidFragment)(trimmedHref)) {
4846 return false;
4847 }
4848 return true;
4849 }
4850 function createLinkFormat({
4851 url,
4852 type,
4853 id,
4854 opensInNewWindow,
4855 nofollow,
4856 cssClasses
4857 }) {
4858 const format = {
4859 type: "core/link",
4860 attributes: {
4861 url
4862 }
4863 };
4864 if (type) {
4865 format.attributes.type = type;
4866 }
4867 if (id) {
4868 format.attributes.id = id;
4869 }
4870 if (opensInNewWindow) {
4871 format.attributes.target = "_blank";
4872 format.attributes.rel = format.attributes.rel ? format.attributes.rel + " noopener" : "noopener";
4873 }
4874 if (nofollow) {
4875 format.attributes.rel = format.attributes.rel ? format.attributes.rel + " nofollow" : "nofollow";
4876 }
4877 const trimmedCssClasses = cssClasses?.trim();
4878 if (trimmedCssClasses?.length) {
4879 format.attributes.class = trimmedCssClasses;
4880 }
4881 return format;
4882 }
4883 function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) {
4884 const EMPTY_BOUNDARIES = {
4885 start: void 0,
4886 end: void 0
4887 };
4888 const { formats } = value;
4889 let targetFormat;
4890 let initialIndex;
4891 if (!formats?.length) {
4892 return EMPTY_BOUNDARIES;
4893 }
4894 const newFormats = formats.slice();
4895 const formatAtStart = newFormats[startIndex]?.find(
4896 ({ type }) => type === format.type
4897 );
4898 const formatAtEnd = newFormats[endIndex]?.find(
4899 ({ type }) => type === format.type
4900 );
4901 const formatAtEndMinusOne = newFormats[endIndex - 1]?.find(
4902 ({ type }) => type === format.type
4903 );
4904 if (!!formatAtStart) {
4905 targetFormat = formatAtStart;
4906 initialIndex = startIndex;
4907 } else if (!!formatAtEnd) {
4908 targetFormat = formatAtEnd;
4909 initialIndex = endIndex;
4910 } else if (!!formatAtEndMinusOne) {
4911 targetFormat = formatAtEndMinusOne;
4912 initialIndex = endIndex - 1;
4913 } else {
4914 return EMPTY_BOUNDARIES;
4915 }
4916 const index = newFormats[initialIndex].indexOf(targetFormat);
4917 const walkingArgs = [newFormats, initialIndex, targetFormat, index];
4918 startIndex = walkToStart(...walkingArgs);
4919 endIndex = walkToEnd(...walkingArgs);
4920 startIndex = startIndex < 0 ? 0 : startIndex;
4921 return {
4922 start: startIndex,
4923 end: endIndex + 1
4924 };
4925 }
4926 function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) {
4927 let index = initialIndex;
4928 const directions = {
4929 forwards: 1,
4930 backwards: -1
4931 };
4932 const directionIncrement = directions[direction] || 1;
4933 const inverseDirectionIncrement = directionIncrement * -1;
4934 while (formats[index] && formats[index][formatIndex] === targetFormatRef) {
4935 index = index + directionIncrement;
4936 }
4937 index = index + inverseDirectionIncrement;
4938 return index;
4939 }
4940 var partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
4941 var walkToStart = partialRight(walkToBoundary, "backwards");
4942 var walkToEnd = partialRight(walkToBoundary, "forwards");
4943
4944 // packages/format-library/build-module/link/css-classes-setting.mjs
4945 var import_element13 = __toESM(require_element(), 1);
4946 var import_compose2 = __toESM(require_compose(), 1);
4947 var import_i18n6 = __toESM(require_i18n(), 1);
4948 var import_components2 = __toESM(require_components(), 1);
4949 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
4950 var CSSClassesSettingComponent = ({ setting, value, onChange }) => {
4951 const hasValue = value ? value?.cssClasses?.length > 0 : false;
4952 const [isSettingActive, setIsSettingActive] = (0, import_element13.useState)(hasValue);
4953 const instanceId = (0, import_compose2.useInstanceId)(CSSClassesSettingComponent);
4954 const controlledRegionId = `css-classes-setting-${instanceId}`;
4955 const handleSettingChange = (newValue) => {
4956 const sanitizedValue = typeof newValue === "string" ? newValue.replace(/,/g, " ").replace(/\s+/g, " ").trim() : newValue;
4957 onChange({
4958 ...value,
4959 [setting.id]: sanitizedValue
4960 });
4961 };
4962 const handleCheckboxChange = () => {
4963 if (isSettingActive) {
4964 if (hasValue) {
4965 handleSettingChange("");
4966 }
4967 setIsSettingActive(false);
4968 } else {
4969 setIsSettingActive(true);
4970 }
4971 };
4972 return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("fieldset", { children: [
4973 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("legend", {}), children: setting.title }),
4974 /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Stack, { direction: "column", gap: "md", children: [
4975 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4976 import_components2.CheckboxControl,
4977 {
4978 label: setting.title,
4979 onChange: handleCheckboxChange,
4980 checked: isSettingActive || hasValue,
4981 "aria-expanded": isSettingActive,
4982 "aria-controls": isSettingActive ? controlledRegionId : void 0
4983 }
4984 ),
4985 isSettingActive && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: controlledRegionId, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4986 import_components2.__experimentalInputControl,
4987 {
4988 label: (0, import_i18n6.__)("CSS classes"),
4989 value: value?.cssClasses,
4990 onChange: handleSettingChange,
4991 help: (0, import_i18n6.__)(
4992 "Separate multiple classes with spaces."
4993 ),
4994 __unstableInputWidth: "100%",
4995 __next40pxDefaultSize: true
4996 }
4997 ) })
4998 ] })
4999 ] });
5000 };
5001 var css_classes_setting_default = CSSClassesSettingComponent;
5002
5003 // packages/format-library/build-module/link/inline.mjs
5004 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
5005 var LINK_SETTINGS = [
5006 ...import_block_editor5.LinkControl.DEFAULT_LINK_SETTINGS,
5007 {
5008 id: "nofollow",
5009 title: (0, import_i18n7.__)("Mark as nofollow")
5010 },
5011 {
5012 id: "cssClasses",
5013 title: (0, import_i18n7.__)("Additional CSS class(es)"),
5014 render: (setting, value, onChange) => {
5015 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5016 css_classes_setting_default,
5017 {
5018 setting,
5019 value,
5020 onChange
5021 }
5022 );
5023 }
5024 }
5025 ];
5026 function InlineLinkUI({
5027 isActive,
5028 activeAttributes,
5029 value,
5030 onChange,
5031 onFocusOutside,
5032 stopAddingLink,
5033 contentRef,
5034 focusOnMount
5035 }) {
5036 const richLinkTextValue = getRichTextValueFromSelection(value, isActive);
5037 const richTextText = richLinkTextValue.text;
5038 const { selectionChange } = (0, import_data.useDispatch)(import_block_editor5.store);
5039 const { createPageEntity, userCanCreatePages, selectionStart } = (0, import_data.useSelect)(
5040 (select) => {
5041 const { getSettings, getSelectionStart } = select(import_block_editor5.store);
5042 const _settings = getSettings();
5043 return {
5044 createPageEntity: _settings.__experimentalCreatePageEntity,
5045 userCanCreatePages: _settings.__experimentalUserCanCreatePages,
5046 selectionStart: getSelectionStart()
5047 };
5048 },
5049 []
5050 );
5051 const linkValue = (0, import_element14.useMemo)(
5052 () => ({
5053 url: activeAttributes.url,
5054 type: activeAttributes.type,
5055 id: activeAttributes.id,
5056 opensInNewTab: activeAttributes.target === "_blank",
5057 nofollow: activeAttributes.rel?.includes("nofollow"),
5058 title: richTextText,
5059 cssClasses: activeAttributes.class
5060 }),
5061 [
5062 activeAttributes.class,
5063 activeAttributes.id,
5064 activeAttributes.rel,
5065 activeAttributes.target,
5066 activeAttributes.type,
5067 activeAttributes.url,
5068 richTextText
5069 ]
5070 );
5071 function removeLink() {
5072 const newValue = (0, import_rich_text5.removeFormat)(value, "core/link");
5073 onChange(newValue);
5074 stopAddingLink();
5075 (0, import_a11y.speak)((0, import_i18n7.__)("Link removed."), "assertive");
5076 }
5077 function onChangeLink(nextValue) {
5078 const hasLink = linkValue?.url;
5079 const isNewLink = !hasLink;
5080 nextValue = {
5081 ...linkValue,
5082 ...nextValue
5083 };
5084 const newUrl = (0, import_url2.prependHTTPS)(nextValue.url);
5085 const linkFormat = createLinkFormat({
5086 url: newUrl,
5087 type: nextValue.type,
5088 id: nextValue.id !== void 0 && nextValue.id !== null ? String(nextValue.id) : void 0,
5089 opensInNewWindow: nextValue.opensInNewTab,
5090 nofollow: nextValue.nofollow,
5091 cssClasses: nextValue.cssClasses
5092 });
5093 const newText = nextValue.title || newUrl;
5094 let newValue;
5095 if ((0, import_rich_text5.isCollapsed)(value) && !isActive) {
5096 const inserted = (0, import_rich_text5.insert)(value, newText);
5097 newValue = (0, import_rich_text5.applyFormat)(
5098 inserted,
5099 linkFormat,
5100 value.start,
5101 value.start + newText.length
5102 );
5103 onChange(newValue);
5104 stopAddingLink();
5105 selectionChange({
5106 clientId: selectionStart.clientId,
5107 identifier: selectionStart.attributeKey,
5108 start: value.start + newText.length + 1
5109 });
5110 return;
5111 } else if (newText === richTextText) {
5112 const boundary = getFormatBoundary(value, {
5113 type: "core/link"
5114 });
5115 newValue = (0, import_rich_text5.applyFormat)(
5116 value,
5117 linkFormat,
5118 boundary.start,
5119 boundary.end
5120 );
5121 } else {
5122 newValue = (0, import_rich_text5.create)({ text: newText });
5123 newValue = (0, import_rich_text5.applyFormat)(newValue, linkFormat, 0, newText.length);
5124 const boundary = getFormatBoundary(value, {
5125 type: "core/link"
5126 });
5127 const [valBefore, valAfter] = (0, import_rich_text5.split)(
5128 value,
5129 boundary.start,
5130 boundary.start
5131 );
5132 const newValAfter = (0, import_rich_text5.replace)(valAfter, richTextText, newValue);
5133 newValue = (0, import_rich_text5.concat)(valBefore, newValAfter);
5134 }
5135 onChange(newValue);
5136 if (!isNewLink) {
5137 stopAddingLink();
5138 }
5139 if (!isValidHref(newUrl)) {
5140 (0, import_a11y.speak)(
5141 (0, import_i18n7.__)(
5142 "Warning: the link has been inserted but may have errors. Please test it."
5143 ),
5144 "assertive"
5145 );
5146 } else if (isActive) {
5147 (0, import_a11y.speak)((0, import_i18n7.__)("Link edited."), "assertive");
5148 } else {
5149 (0, import_a11y.speak)((0, import_i18n7.__)("Link inserted."), "assertive");
5150 }
5151 }
5152 const popoverAnchor = (0, import_rich_text5.useAnchor)({
5153 editableContentElement: contentRef.current,
5154 settings: {
5155 ...link,
5156 isActive
5157 }
5158 });
5159 async function handleCreate(pageTitle) {
5160 const page = await createPageEntity({
5161 title: pageTitle,
5162 status: "draft"
5163 });
5164 return {
5165 id: page.id,
5166 type: page.type,
5167 title: page.title.rendered,
5168 url: page.link,
5169 kind: "post-type"
5170 };
5171 }
5172 function createButtonText(searchTerm) {
5173 return (0, import_element14.createInterpolateElement)(
5174 (0, import_i18n7.sprintf)(
5175 /* translators: %s: search term. */
5176 (0, import_i18n7.__)("Create page: <mark>%s</mark>"),
5177 searchTerm
5178 ),
5179 { mark: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("mark", {}) }
5180 );
5181 }
5182 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5183 import_components3.Popover,
5184 {
5185 anchor: popoverAnchor,
5186 animate: false,
5187 onClose: stopAddingLink,
5188 onFocusOutside,
5189 placement: "bottom",
5190 offset: 8,
5191 shift: true,
5192 focusOnMount,
5193 constrainTabbing: true,
5194 children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5195 import_block_editor5.LinkControl,
5196 {
5197 value: linkValue,
5198 onChange: onChangeLink,
5199 onRemove: removeLink,
5200 hasRichPreviews: true,
5201 createSuggestion: createPageEntity && handleCreate,
5202 withCreateSuggestion: userCanCreatePages,
5203 createSuggestionButtonText: createButtonText,
5204 hasTextControl: true,
5205 settings: LINK_SETTINGS,
5206 showInitialSuggestions: true,
5207 suggestionsQuery: {
5208 // always show Pages as initial suggestions
5209 initialSuggestionsSearchOptions: {
5210 type: "post",
5211 subtype: "page",
5212 perPage: 20
5213 }
5214 }
5215 }
5216 )
5217 }
5218 );
5219 }
5220 function getRichTextValueFromSelection(value, isActive) {
5221 let textStart = value.start;
5222 let textEnd = value.end;
5223 if (isActive) {
5224 const boundary = getFormatBoundary(value, {
5225 type: "core/link"
5226 });
5227 textStart = boundary.start;
5228 textEnd = boundary.end;
5229 }
5230 return (0, import_rich_text5.slice)(value, textStart, textEnd);
5231 }
5232 var inline_default = InlineLinkUI;
5233
5234 // packages/format-library/build-module/link/index.mjs
5235 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
5236 var name5 = "core/link";
5237 var title5 = (0, import_i18n8.__)("Link");
5238 function Edit2({
5239 isActive,
5240 activeAttributes,
5241 value,
5242 onChange,
5243 onFocus,
5244 contentRef,
5245 isVisible = true
5246 }) {
5247 const [addingLink, setAddingLink] = (0, import_element15.useState)(false);
5248 const [openedBy, setOpenedBy] = (0, import_element15.useState)(null);
5249 (0, import_element15.useEffect)(() => {
5250 if (!isActive) {
5251 setAddingLink(false);
5252 }
5253 }, [isActive]);
5254 (0, import_element15.useLayoutEffect)(() => {
5255 const editableContentElement = contentRef.current;
5256 if (!editableContentElement) {
5257 return;
5258 }
5259 function handleClick(event) {
5260 const link2 = event.target.closest("[contenteditable] a");
5261 if (!link2 || // other formats (e.g. bold) may be nested within the link.
5262 !isActive) {
5263 return;
5264 }
5265 setAddingLink(true);
5266 setOpenedBy({
5267 el: link2,
5268 action: "click"
5269 });
5270 }
5271 editableContentElement.addEventListener("click", handleClick);
5272 return () => {
5273 editableContentElement.removeEventListener("click", handleClick);
5274 };
5275 }, [contentRef, isActive]);
5276 function addLink(target) {
5277 const text = (0, import_rich_text6.getTextContent)((0, import_rich_text6.slice)(value));
5278 if (!isActive && text && (0, import_url3.isURL)(text) && isValidHref(text)) {
5279 onChange(
5280 (0, import_rich_text6.applyFormat)(value, {
5281 type: name5,
5282 attributes: { url: text }
5283 })
5284 );
5285 } else if (!isActive && text && (0, import_url3.isEmail)(text)) {
5286 onChange(
5287 (0, import_rich_text6.applyFormat)(value, {
5288 type: name5,
5289 attributes: { url: `mailto:${text}` }
5290 })
5291 );
5292 } else if (!isActive && text && (0, import_url3.isPhoneNumber)(text)) {
5293 onChange(
5294 (0, import_rich_text6.applyFormat)(value, {
5295 type: name5,
5296 attributes: { url: `tel:${text.replace(/\D/g, "")}` }
5297 })
5298 );
5299 } else {
5300 if (target) {
5301 setOpenedBy({
5302 el: target,
5303 action: null
5304 // We don't need to distinguish between click or keyboard here
5305 });
5306 }
5307 setAddingLink(true);
5308 }
5309 }
5310 function stopAddingLink() {
5311 setAddingLink(false);
5312 if (openedBy?.el?.tagName === "BUTTON") {
5313 openedBy.el.focus();
5314 } else {
5315 onFocus();
5316 }
5317 setOpenedBy(null);
5318 }
5319 function onFocusOutside() {
5320 setAddingLink(false);
5321 setOpenedBy(null);
5322 }
5323 function onRemoveFormat() {
5324 onChange((0, import_rich_text6.removeFormat)(value, name5));
5325 (0, import_a11y2.speak)((0, import_i18n8.__)("Link removed."), "assertive");
5326 }
5327 const shouldAutoFocus = !(openedBy?.el?.tagName === "A" && openedBy?.action === "click");
5328 const hasSelection = !(0, import_rich_text6.isCollapsed)(value);
5329 return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
5330 hasSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5331 import_block_editor6.RichTextShortcut,
5332 {
5333 type: "primary",
5334 character: "k",
5335 onUse: addLink
5336 }
5337 ),
5338 /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5339 import_block_editor6.RichTextShortcut,
5340 {
5341 type: "primaryShift",
5342 character: "k",
5343 onUse: onRemoveFormat
5344 }
5345 ),
5346 isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5347 import_block_editor6.RichTextToolbarButton,
5348 {
5349 name: "link",
5350 icon: link_default,
5351 title: isActive ? (0, import_i18n8.__)("Link") : title5,
5352 onClick: (event) => {
5353 addLink(event.currentTarget);
5354 },
5355 isActive: isActive || addingLink,
5356 shortcutType: "primary",
5357 shortcutCharacter: "k",
5358 "aria-haspopup": "true",
5359 "aria-expanded": addingLink
5360 }
5361 ),
5362 isVisible && addingLink && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5363 inline_default,
5364 {
5365 stopAddingLink,
5366 onFocusOutside,
5367 isActive,
5368 activeAttributes,
5369 value,
5370 onChange,
5371 contentRef,
5372 focusOnMount: shouldAutoFocus ? "firstElement" : false
5373 }
5374 )
5375 ] });
5376 }
5377 var link = {
5378 name: name5,
5379 title: title5,
5380 tagName: "a",
5381 className: null,
5382 attributes: {
5383 url: "href",
5384 type: "data-type",
5385 id: "data-id",
5386 _id: "id",
5387 target: "target",
5388 rel: "rel",
5389 class: "class"
5390 },
5391 __unstablePasteRule(value, { html, plainText }) {
5392 const pastedText = (html || plainText).replace(/<[^>]+>/g, "").trim();
5393 if (!(0, import_url3.isURL)(pastedText) || !/^https?:/.test(pastedText)) {
5394 return value;
5395 }
5396 window.console.log("Created link:\n\n", pastedText);
5397 const format = {
5398 type: name5,
5399 attributes: {
5400 url: (0, import_html_entities.decodeEntities)(pastedText)
5401 }
5402 };
5403 if ((0, import_rich_text6.isCollapsed)(value)) {
5404 return (0, import_rich_text6.insert)(
5405 value,
5406 (0, import_rich_text6.applyFormat)(
5407 (0, import_rich_text6.create)({ text: plainText }),
5408 format,
5409 0,
5410 plainText.length
5411 )
5412 );
5413 }
5414 return (0, import_rich_text6.applyFormat)(value, format);
5415 },
5416 edit: Edit2
5417 };
5418
5419 // packages/format-library/build-module/strikethrough/index.mjs
5420 var import_i18n9 = __toESM(require_i18n(), 1);
5421 var import_rich_text7 = __toESM(require_rich_text(), 1);
5422 var import_block_editor7 = __toESM(require_block_editor(), 1);
5423 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
5424 var name6 = "core/strikethrough";
5425 var title6 = (0, import_i18n9.__)("Strikethrough");
5426 var strikethrough = {
5427 name: name6,
5428 title: title6,
5429 tagName: "s",
5430 className: null,
5431 edit({ isActive, value, onChange, onFocus }) {
5432 function onClick() {
5433 onChange((0, import_rich_text7.toggleFormat)(value, { type: name6, title: title6 }));
5434 onFocus();
5435 }
5436 return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
5437 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5438 import_block_editor7.RichTextShortcut,
5439 {
5440 type: "access",
5441 character: "d",
5442 onUse: onClick
5443 }
5444 ),
5445 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5446 import_block_editor7.RichTextToolbarButton,
5447 {
5448 icon: format_strikethrough_default,
5449 title: title6,
5450 onClick,
5451 isActive,
5452 role: "menuitemcheckbox"
5453 }
5454 )
5455 ] });
5456 }
5457 };
5458
5459 // packages/format-library/build-module/underline/index.mjs
5460 var import_i18n10 = __toESM(require_i18n(), 1);
5461 var import_rich_text8 = __toESM(require_rich_text(), 1);
5462 var import_block_editor8 = __toESM(require_block_editor(), 1);
5463 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
5464 var name7 = "core/underline";
5465 var title7 = (0, import_i18n10.__)("Underline");
5466 var underline = {
5467 name: name7,
5468 title: title7,
5469 tagName: "span",
5470 className: null,
5471 attributes: {
5472 style: "style"
5473 },
5474 edit({ value, onChange }) {
5475 const onToggle = () => {
5476 onChange(
5477 (0, import_rich_text8.toggleFormat)(value, {
5478 type: name7,
5479 attributes: {
5480 style: "text-decoration: underline;"
5481 },
5482 title: title7
5483 })
5484 );
5485 };
5486 return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
5487 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5488 import_block_editor8.RichTextShortcut,
5489 {
5490 type: "primary",
5491 character: "u",
5492 onUse: onToggle
5493 }
5494 ),
5495 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5496 import_block_editor8.__unstableRichTextInputEvent,
5497 {
5498 inputType: "formatUnderline",
5499 onInput: onToggle
5500 }
5501 )
5502 ] });
5503 }
5504 };
5505
5506 // packages/format-library/build-module/text-color/index.mjs
5507 var import_i18n12 = __toESM(require_i18n(), 1);
5508 var import_element17 = __toESM(require_element(), 1);
5509 var import_block_editor10 = __toESM(require_block_editor(), 1);
5510 var import_rich_text10 = __toESM(require_rich_text(), 1);
5511
5512 // packages/format-library/build-module/text-color/inline.mjs
5513 var import_element16 = __toESM(require_element(), 1);
5514 var import_data2 = __toESM(require_data(), 1);
5515 var import_rich_text9 = __toESM(require_rich_text(), 1);
5516 var import_block_editor9 = __toESM(require_block_editor(), 1);
5517 var import_components4 = __toESM(require_components(), 1);
5518 var import_i18n11 = __toESM(require_i18n(), 1);
5519 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
5520 var TABS = [
5521 { name: "color", title: (0, import_i18n11.__)("Text") },
5522 { name: "backgroundColor", title: (0, import_i18n11.__)("Background") }
5523 ];
5524 function parseCSS(css = "") {
5525 return css.split(";").reduce((accumulator, rule) => {
5526 if (rule) {
5527 const [property, value] = rule.split(":");
5528 if (property === "color") {
5529 accumulator.color = value;
5530 }
5531 if (property === "background-color" && value !== transparentValue) {
5532 accumulator.backgroundColor = value;
5533 }
5534 }
5535 return accumulator;
5536 }, {});
5537 }
5538 function parseClassName(className = "", colorSettings) {
5539 return className.split(" ").reduce((accumulator, name16) => {
5540 if (name16.startsWith("has-") && name16.endsWith("-color")) {
5541 const colorSlug = name16.replace(/^has-/, "").replace(/-color$/, "");
5542 const colorObject = (0, import_block_editor9.getColorObjectByAttributeValues)(
5543 colorSettings,
5544 colorSlug
5545 );
5546 accumulator.color = colorObject.color;
5547 }
5548 return accumulator;
5549 }, {});
5550 }
5551 function getActiveColors(value, name16, colorSettings) {
5552 const activeColorFormat = (0, import_rich_text9.getActiveFormat)(value, name16);
5553 if (!activeColorFormat) {
5554 return {};
5555 }
5556 return {
5557 ...parseCSS(activeColorFormat.attributes.style),
5558 ...parseClassName(activeColorFormat.attributes.class, colorSettings)
5559 };
5560 }
5561 function setColors(value, name16, colorSettings, colors) {
5562 const { color, backgroundColor } = {
5563 ...getActiveColors(value, name16, colorSettings),
5564 ...colors
5565 };
5566 if (!color && !backgroundColor) {
5567 return (0, import_rich_text9.removeFormat)(value, name16);
5568 }
5569 const styles = [];
5570 const classNames = [];
5571 const attributes = {};
5572 if (backgroundColor) {
5573 styles.push(["background-color", backgroundColor].join(":"));
5574 } else {
5575 styles.push(["background-color", transparentValue].join(":"));
5576 }
5577 if (color) {
5578 const colorObject = (0, import_block_editor9.getColorObjectByColorValue)(colorSettings, color);
5579 if (colorObject) {
5580 classNames.push((0, import_block_editor9.getColorClassName)("color", colorObject.slug));
5581 } else {
5582 styles.push(["color", color].join(":"));
5583 }
5584 }
5585 if (styles.length) {
5586 attributes.style = styles.join(";");
5587 }
5588 if (classNames.length) {
5589 attributes.class = classNames.join(" ");
5590 }
5591 return (0, import_rich_text9.applyFormat)(value, { type: name16, attributes });
5592 }
5593 function ColorPicker({ name: name16, property, value, onChange }) {
5594 const colors = (0, import_data2.useSelect)((select) => {
5595 const { getSettings } = select(import_block_editor9.store);
5596 return getSettings().colors ?? [];
5597 }, []);
5598 const activeColors = (0, import_element16.useMemo)(
5599 () => getActiveColors(value, name16, colors),
5600 [name16, value, colors]
5601 );
5602 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5603 import_block_editor9.ColorPalette,
5604 {
5605 value: activeColors[property],
5606 onChange: (color) => {
5607 onChange(
5608 setColors(value, name16, colors, { [property]: color })
5609 );
5610 },
5611 enableAlpha: true,
5612 __experimentalIsRenderedInSidebar: true
5613 }
5614 );
5615 }
5616 function InlineColorUI({
5617 name: name16,
5618 value,
5619 onChange,
5620 onClose,
5621 contentRef,
5622 isActive
5623 }) {
5624 const popoverAnchor = (0, import_rich_text9.useAnchor)({
5625 editableContentElement: contentRef.current,
5626 settings: { ...textColor, isActive }
5627 });
5628 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5629 import_components4.Popover,
5630 {
5631 onClose,
5632 className: "format-library__inline-color-popover",
5633 anchor: popoverAnchor,
5634 children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(tabs_exports.Root, { defaultValue: TABS[0].name, children: [
5635 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(tabs_exports.List, { children: TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(tabs_exports.Tab, { value: tab.name, children: tab.title }, tab.name)) }),
5636 TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5637 tabs_exports.Panel,
5638 {
5639 value: tab.name,
5640 tabIndex: -1,
5641 children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5642 ColorPicker,
5643 {
5644 name: name16,
5645 property: tab.name,
5646 value,
5647 onChange
5648 }
5649 )
5650 },
5651 tab.name
5652 ))
5653 ] })
5654 }
5655 );
5656 }
5657
5658 // packages/format-library/build-module/text-color/index.mjs
5659 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
5660 var transparentValue = "rgba(0, 0, 0, 0)";
5661 var name8 = "core/text-color";
5662 var title8 = (0, import_i18n12.__)("Highlight");
5663 var EMPTY_ARRAY3 = [];
5664 function getComputedStyleProperty(element, property) {
5665 const { ownerDocument: ownerDocument2 } = element;
5666 const { defaultView } = ownerDocument2;
5667 const style = defaultView.getComputedStyle(element);
5668 const value = style.getPropertyValue(property);
5669 if (property === "background-color" && value === transparentValue && element.parentElement) {
5670 return getComputedStyleProperty(element.parentElement, property);
5671 }
5672 return value;
5673 }
5674 function fillComputedColors(element, { color, backgroundColor }) {
5675 if (!color && !backgroundColor) {
5676 return;
5677 }
5678 return {
5679 color: color || getComputedStyleProperty(element, "color"),
5680 backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, "background-color") : backgroundColor
5681 };
5682 }
5683 function TextColorEdit({
5684 value,
5685 onChange,
5686 isActive,
5687 activeAttributes,
5688 contentRef
5689 }) {
5690 const [allowCustomControl, colors = EMPTY_ARRAY3] = (0, import_block_editor10.useSettings)(
5691 "color.custom",
5692 "color.palette"
5693 );
5694 const [isAddingColor, setIsAddingColor] = (0, import_element17.useState)(false);
5695 const colorIndicatorStyle = (0, import_element17.useMemo)(
5696 () => fillComputedColors(
5697 contentRef.current,
5698 getActiveColors(value, name8, colors)
5699 ),
5700 [contentRef, value, colors]
5701 );
5702 const hasColorsToChoose = !!colors.length || allowCustomControl;
5703 if (!hasColorsToChoose && !isActive) {
5704 return null;
5705 }
5706 return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
5707 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5708 import_block_editor10.RichTextToolbarButton,
5709 {
5710 className: "format-library-text-color-button",
5711 isActive,
5712 icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5713 icon_default,
5714 {
5715 icon: Object.keys(activeAttributes).length ? text_color_default : color_default,
5716 style: colorIndicatorStyle
5717 }
5718 ),
5719 title: title8,
5720 onClick: hasColorsToChoose ? () => setIsAddingColor(true) : () => onChange((0, import_rich_text10.removeFormat)(value, name8)),
5721 role: "menuitemcheckbox"
5722 }
5723 ),
5724 isAddingColor && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5725 InlineColorUI,
5726 {
5727 name: name8,
5728 onClose: () => setIsAddingColor(false),
5729 activeAttributes,
5730 value,
5731 onChange,
5732 contentRef,
5733 isActive
5734 }
5735 )
5736 ] });
5737 }
5738 var textColor = {
5739 name: name8,
5740 title: title8,
5741 tagName: "mark",
5742 className: "has-inline-color",
5743 attributes: {
5744 style: "style",
5745 class: "class"
5746 },
5747 edit: TextColorEdit
5748 };
5749
5750 // packages/format-library/build-module/subscript/index.mjs
5751 var import_i18n13 = __toESM(require_i18n(), 1);
5752 var import_rich_text11 = __toESM(require_rich_text(), 1);
5753 var import_block_editor11 = __toESM(require_block_editor(), 1);
5754 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
5755 var name9 = "core/subscript";
5756 var title9 = (0, import_i18n13.__)("Subscript");
5757 var subscript = {
5758 name: name9,
5759 title: title9,
5760 tagName: "sub",
5761 className: null,
5762 edit({ isActive, value, onChange, onFocus }) {
5763 function onToggle() {
5764 onChange((0, import_rich_text11.toggleFormat)(value, { type: name9, title: title9 }));
5765 }
5766 function onClick() {
5767 onToggle();
5768 onFocus();
5769 }
5770 return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5771 import_block_editor11.RichTextToolbarButton,
5772 {
5773 icon: subscript_default,
5774 title: title9,
5775 onClick,
5776 isActive,
5777 role: "menuitemcheckbox"
5778 }
5779 );
5780 }
5781 };
5782
5783 // packages/format-library/build-module/superscript/index.mjs
5784 var import_i18n14 = __toESM(require_i18n(), 1);
5785 var import_rich_text12 = __toESM(require_rich_text(), 1);
5786 var import_block_editor12 = __toESM(require_block_editor(), 1);
5787 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
5788 var name10 = "core/superscript";
5789 var title10 = (0, import_i18n14.__)("Superscript");
5790 var superscript = {
5791 name: name10,
5792 title: title10,
5793 tagName: "sup",
5794 className: null,
5795 edit({ isActive, value, onChange, onFocus }) {
5796 function onToggle() {
5797 onChange((0, import_rich_text12.toggleFormat)(value, { type: name10, title: title10 }));
5798 }
5799 function onClick() {
5800 onToggle();
5801 onFocus();
5802 }
5803 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5804 import_block_editor12.RichTextToolbarButton,
5805 {
5806 icon: superscript_default,
5807 title: title10,
5808 onClick,
5809 isActive,
5810 role: "menuitemcheckbox"
5811 }
5812 );
5813 }
5814 };
5815
5816 // packages/format-library/build-module/keyboard/index.mjs
5817 var import_i18n15 = __toESM(require_i18n(), 1);
5818 var import_rich_text13 = __toESM(require_rich_text(), 1);
5819 var import_block_editor13 = __toESM(require_block_editor(), 1);
5820 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
5821 var name11 = "core/keyboard";
5822 var title11 = (0, import_i18n15.__)("Keyboard input");
5823 var keyboard2 = {
5824 name: name11,
5825 title: title11,
5826 tagName: "kbd",
5827 className: null,
5828 edit({ isActive, value, onChange, onFocus }) {
5829 function onToggle() {
5830 onChange((0, import_rich_text13.toggleFormat)(value, { type: name11, title: title11 }));
5831 }
5832 function onClick() {
5833 onToggle();
5834 onFocus();
5835 }
5836 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5837 import_block_editor13.RichTextToolbarButton,
5838 {
5839 icon: button_default,
5840 title: title11,
5841 onClick,
5842 isActive,
5843 role: "menuitemcheckbox"
5844 }
5845 );
5846 }
5847 };
5848
5849 // packages/format-library/build-module/unknown/index.mjs
5850 var import_i18n16 = __toESM(require_i18n(), 1);
5851 var import_rich_text14 = __toESM(require_rich_text(), 1);
5852 var import_block_editor14 = __toESM(require_block_editor(), 1);
5853 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
5854 var name12 = "core/unknown";
5855 var title12 = (0, import_i18n16.__)("Clear Unknown Formatting");
5856 function selectionContainsUnknownFormats(value) {
5857 if ((0, import_rich_text14.isCollapsed)(value)) {
5858 return false;
5859 }
5860 const selectedValue = (0, import_rich_text14.slice)(value);
5861 return selectedValue.formats.some((formats) => {
5862 return formats.some((format) => format.type === name12);
5863 });
5864 }
5865 var unknown = {
5866 name: name12,
5867 title: title12,
5868 tagName: "*",
5869 className: null,
5870 edit({ isActive, value, onChange, onFocus }) {
5871 if (!isActive && !selectionContainsUnknownFormats(value)) {
5872 return null;
5873 }
5874 function onClick() {
5875 onChange((0, import_rich_text14.removeFormat)(value, name12));
5876 onFocus();
5877 }
5878 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5879 import_block_editor14.RichTextToolbarButton,
5880 {
5881 name: "unknown",
5882 icon: help_default,
5883 title: title12,
5884 onClick,
5885 isActive: true
5886 }
5887 );
5888 }
5889 };
5890
5891 // packages/format-library/build-module/language/index.mjs
5892 var import_i18n17 = __toESM(require_i18n(), 1);
5893 var import_block_editor15 = __toESM(require_block_editor(), 1);
5894 var import_components5 = __toESM(require_components(), 1);
5895 var import_element18 = __toESM(require_element(), 1);
5896 var import_rich_text15 = __toESM(require_rich_text(), 1);
5897 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
5898 var name13 = "core/language";
5899 var title13 = (0, import_i18n17.__)("Language");
5900 var language = {
5901 name: name13,
5902 title: title13,
5903 tagName: "bdo",
5904 className: null,
5905 attributes: {
5906 lang: "lang",
5907 dir: "dir"
5908 },
5909 edit: Edit3
5910 };
5911 function Edit3({ isActive, value, onChange, contentRef }) {
5912 const [isPopoverVisible, setIsPopoverVisible] = (0, import_element18.useState)(false);
5913 const togglePopover = () => {
5914 setIsPopoverVisible((state) => !state);
5915 };
5916 return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
5917 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5918 import_block_editor15.RichTextToolbarButton,
5919 {
5920 icon: language_default,
5921 label: title13,
5922 title: title13,
5923 onClick: () => {
5924 if (isActive) {
5925 onChange((0, import_rich_text15.removeFormat)(value, name13));
5926 } else {
5927 togglePopover();
5928 }
5929 },
5930 isActive,
5931 role: "menuitemcheckbox"
5932 }
5933 ),
5934 isPopoverVisible && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5935 InlineLanguageUI,
5936 {
5937 value,
5938 onChange,
5939 onClose: togglePopover,
5940 contentRef
5941 }
5942 )
5943 ] });
5944 }
5945 function InlineLanguageUI({ value, contentRef, onChange, onClose }) {
5946 const popoverAnchor = (0, import_rich_text15.useAnchor)({
5947 editableContentElement: contentRef.current,
5948 settings: language
5949 });
5950 const [lang, setLang] = (0, import_element18.useState)("");
5951 const [dir, setDir] = (0, import_element18.useState)("ltr");
5952 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5953 import_components5.Popover,
5954 {
5955 className: "block-editor-format-toolbar__language-popover",
5956 anchor: popoverAnchor,
5957 onClose,
5958 children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
5959 Stack,
5960 {
5961 render: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("form", {}),
5962 direction: "column",
5963 gap: "lg",
5964 className: "block-editor-format-toolbar__language-container-content",
5965 onSubmit: (event) => {
5966 event.preventDefault();
5967 onChange(
5968 (0, import_rich_text15.applyFormat)(value, {
5969 type: name13,
5970 attributes: {
5971 lang,
5972 dir
5973 }
5974 })
5975 );
5976 onClose();
5977 },
5978 children: [
5979 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5980 import_components5.TextControl,
5981 {
5982 label: title13,
5983 value: lang,
5984 onChange: (val) => setLang(val),
5985 help: (0, import_i18n17.__)(
5986 'A valid language attribute, like "en" or "fr".'
5987 )
5988 }
5989 ),
5990 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5991 import_components5.SelectControl,
5992 {
5993 __next40pxDefaultSize: true,
5994 label: (0, import_i18n17.__)("Text direction"),
5995 value: dir,
5996 options: [
5997 {
5998 label: (0, import_i18n17.__)("Left to right"),
5999 value: "ltr"
6000 },
6001 {
6002 label: (0, import_i18n17.__)("Right to left"),
6003 value: "rtl"
6004 }
6005 ],
6006 onChange: (val) => setDir(val)
6007 }
6008 ),
6009 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Stack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
6010 import_components5.Button,
6011 {
6012 __next40pxDefaultSize: true,
6013 variant: "primary",
6014 type: "submit",
6015 text: (0, import_i18n17.__)("Apply")
6016 }
6017 ) })
6018 ]
6019 }
6020 )
6021 }
6022 );
6023 }
6024
6025 // packages/format-library/build-module/math/index.mjs
6026 var import_i18n18 = __toESM(require_i18n(), 1);
6027 var import_element19 = __toESM(require_element(), 1);
6028 var import_rich_text16 = __toESM(require_rich_text(), 1);
6029 var import_block_editor16 = __toESM(require_block_editor(), 1);
6030 var import_components6 = __toESM(require_components(), 1);
6031 var import_a11y3 = __toESM(require_a11y(), 1);
6032
6033 // packages/format-library/build-module/lock-unlock.mjs
6034 var import_private_apis = __toESM(require_private_apis(), 1);
6035 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
6036 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
6037 "@wordpress/format-library"
6038 );
6039
6040 // packages/format-library/build-module/math/index.mjs
6041 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
6042 var { Badge: WCBadge } = unlock(import_components6.privateApis);
6043 var name14 = "core/math";
6044 var title14 = (0, import_i18n18.__)("Math");
6045 function InlineUI2({
6046 value,
6047 onChange,
6048 activeAttributes,
6049 contentRef,
6050 latexToMathML
6051 }) {
6052 const [latex, setLatex] = (0, import_element19.useState)(
6053 activeAttributes?.["data-latex"] || ""
6054 );
6055 const [error2, setError] = (0, import_element19.useState)(null);
6056 const popoverAnchor = (0, import_rich_text16.useAnchor)({
6057 editableContentElement: contentRef.current,
6058 settings: math
6059 });
6060 const handleLatexChange = (newLatex) => {
6061 let mathML = "";
6062 setLatex(newLatex);
6063 if (newLatex) {
6064 try {
6065 mathML = latexToMathML(newLatex, { displayMode: false });
6066 setError(null);
6067 } catch (err) {
6068 setError(err.message);
6069 (0, import_a11y3.speak)(
6070 (0, import_i18n18.sprintf)(
6071 /* translators: %s: error message returned when parsing LaTeX. */
6072 (0, import_i18n18.__)("Error parsing mathematical expression: %s"),
6073 err.message
6074 )
6075 );
6076 return;
6077 }
6078 }
6079 const newReplacements = value.replacements.slice();
6080 newReplacements[value.start] = {
6081 type: name14,
6082 attributes: {
6083 "data-latex": newLatex
6084 },
6085 innerHTML: mathML
6086 };
6087 onChange({
6088 ...value,
6089 replacements: newReplacements
6090 });
6091 };
6092 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6093 import_components6.Popover,
6094 {
6095 placement: "bottom-start",
6096 offset: 8,
6097 focusOnMount: false,
6098 anchor: popoverAnchor,
6099 className: "block-editor-format-toolbar__math-popover",
6100 children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { style: { minWidth: "300px", padding: "4px" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Stack, { direction: "column", gap: "xs", children: [
6101 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6102 import_components6.TextControl,
6103 {
6104 hideLabelFromVision: true,
6105 label: (0, import_i18n18.__)("LaTeX math syntax"),
6106 value: latex,
6107 onChange: handleLatexChange,
6108 placeholder: (0, import_i18n18.__)("e.g., x^2, \\frac{a}{b}"),
6109 autoComplete: "off",
6110 className: "block-editor-format-toolbar__math-input"
6111 }
6112 ),
6113 error2 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
6114 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6115 WCBadge,
6116 {
6117 intent: "error",
6118 className: "wp-block-math__error",
6119 children: (0, import_i18n18.sprintf)(
6120 /* translators: %s: error message returned when parsing LaTeX. */
6121 (0, import_i18n18.__)("Error: %s"),
6122 error2
6123 )
6124 }
6125 ),
6126 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("style", { children: ".wp-block-math__error .components-badge__content{white-space:normal}" })
6127 ] })
6128 ] }) })
6129 }
6130 );
6131 }
6132 function Edit4({
6133 value,
6134 onChange,
6135 onFocus,
6136 isObjectActive,
6137 activeObjectAttributes,
6138 contentRef
6139 }) {
6140 const [latexToMathML, setLatexToMathML] = (0, import_element19.useState)();
6141 (0, import_element19.useEffect)(() => {
6142 import("@wordpress/latex-to-mathml").then((module) => {
6143 setLatexToMathML(() => module.default);
6144 });
6145 }, []);
6146 function onClick() {
6147 let newValue;
6148 if (isObjectActive) {
6149 const latex = activeObjectAttributes?.["data-latex"] || "";
6150 newValue = (0, import_rich_text16.insert)(value, latex);
6151 newValue.start = newValue.end - latex.length;
6152 } else {
6153 const selectedText = (0, import_rich_text16.getTextContent)((0, import_rich_text16.slice)(value));
6154 let innerHTML = "";
6155 if (selectedText && latexToMathML) {
6156 try {
6157 innerHTML = latexToMathML(selectedText, {
6158 displayMode: false
6159 });
6160 } catch {
6161 }
6162 }
6163 newValue = (0, import_rich_text16.insertObject)(value, {
6164 type: name14,
6165 attributes: { "data-latex": selectedText },
6166 innerHTML
6167 });
6168 newValue.start = newValue.end - 1;
6169 }
6170 onChange(newValue);
6171 onFocus();
6172 }
6173 return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
6174 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6175 import_block_editor16.RichTextToolbarButton,
6176 {
6177 icon: math_default,
6178 title: title14,
6179 onClick,
6180 isActive: isObjectActive
6181 }
6182 ),
6183 isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6184 InlineUI2,
6185 {
6186 value,
6187 onChange,
6188 activeAttributes: activeObjectAttributes,
6189 contentRef,
6190 latexToMathML
6191 }
6192 )
6193 ] });
6194 }
6195 var math = {
6196 name: name14,
6197 title: title14,
6198 tagName: "math",
6199 className: null,
6200 attributes: {
6201 "data-latex": "data-latex"
6202 },
6203 contentEditable: false,
6204 edit: Edit4
6205 };
6206
6207 // packages/format-library/build-module/non-breaking-space/index.mjs
6208 var import_i18n19 = __toESM(require_i18n(), 1);
6209 var import_rich_text17 = __toESM(require_rich_text(), 1);
6210 var import_block_editor17 = __toESM(require_block_editor(), 1);
6211 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
6212 var name15 = "core/non-breaking-space";
6213 var title15 = (0, import_i18n19.__)("Non breaking space");
6214 var nonBreakingSpace = {
6215 name: name15,
6216 title: title15,
6217 tagName: "nbsp",
6218 className: null,
6219 edit({ value, onChange }) {
6220 function addNonBreakingSpace() {
6221 onChange((0, import_rich_text17.insert)(value, "\xA0"));
6222 }
6223 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6224 import_block_editor17.RichTextShortcut,
6225 {
6226 type: "primaryShift",
6227 character: " ",
6228 onUse: addNonBreakingSpace
6229 }
6230 );
6231 }
6232 };
6233
6234 // packages/format-library/build-module/default-formats.mjs
6235 var default_formats_default = [
6236 bold,
6237 code,
6238 image,
6239 italic,
6240 link,
6241 strikethrough,
6242 underline,
6243 textColor,
6244 subscript,
6245 superscript,
6246 keyboard2,
6247 unknown,
6248 language,
6249 math,
6250 nonBreakingSpace
6251 ];
6252
6253 // packages/format-library/build-module/index.mjs
6254 default_formats_default.forEach(
6255 ({ name: name16, ...settings }) => (0, import_rich_text18.registerFormatType)(name16, settings)
6256 );
6257 })();
6258 /*! Bundled license information:
6259
6260 use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
6261 (**
6262 * @license React
6263 * use-sync-external-store-shim.development.js
6264 *
6265 * Copyright (c) Meta Platforms, Inc. and affiliates.
6266 *
6267 * This source code is licensed under the MIT license found in the
6268 * LICENSE file in the root directory of this source tree.
6269 *)
6270 */
6271 //# sourceMappingURL=index.js.map
6272