PluginProbe
Gutenberg / 23.3.1
Gutenberg v23.3.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 / widgets / site-preview / render.js

render.js in Gutenberg 23.3.1, at build/widgets/site-preview/render.js

1,544 lines 72.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var __create = Object.create;
2 var __defProp = Object.defineProperty;
3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4 var __getOwnPropNames = Object.getOwnPropertyNames;
5 var __getProtoOf = Object.getPrototypeOf;
6 var __hasOwnProp = Object.prototype.hasOwnProperty;
7 var __commonJS = (cb, mod) => function __require() {
8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9 };
10 var __copyProps = (to, from, except, desc) => {
11 if (from && typeof from === "object" || typeof from === "function") {
12 for (let key of __getOwnPropNames(from))
13 if (!__hasOwnProp.call(to, key) && key !== except)
14 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15 }
16 return to;
17 };
18 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19 // If the importer is in node compatibility mode or this is not an ESM
20 // file that has been converted to a CommonJS file using a Babel-
21 // compatible transform (i.e. "__esModule" has not been set), then set
22 // "default" to the CommonJS "module.exports" for node compatibility.
23 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24 mod
25 ));
26
27 // package-external:@wordpress/element
28 var require_element = __commonJS({
29 "package-external:@wordpress/element"(exports, module) {
30 module.exports = window.wp.element;
31 }
32 });
33
34 // package-external:@wordpress/data
35 var require_data = __commonJS({
36 "package-external:@wordpress/data"(exports, module) {
37 module.exports = window.wp.data;
38 }
39 });
40
41 // package-external:@wordpress/core-data
42 var require_core_data = __commonJS({
43 "package-external:@wordpress/core-data"(exports, module) {
44 module.exports = window.wp.coreData;
45 }
46 });
47
48 // package-external:@wordpress/i18n
49 var require_i18n = __commonJS({
50 "package-external:@wordpress/i18n"(exports, module) {
51 module.exports = window.wp.i18n;
52 }
53 });
54
55 // package-external:@wordpress/primitives
56 var require_primitives = __commonJS({
57 "package-external:@wordpress/primitives"(exports, module) {
58 module.exports = window.wp.primitives;
59 }
60 });
61
62 // vendor-external:react/jsx-runtime
63 var require_jsx_runtime = __commonJS({
64 "vendor-external:react/jsx-runtime"(exports, module) {
65 module.exports = window.ReactJSXRuntime;
66 }
67 });
68
69 // package-external:@wordpress/url
70 var require_url = __commonJS({
71 "package-external:@wordpress/url"(exports, module) {
72 module.exports = window.wp.url;
73 }
74 });
75
76 // package-external:@wordpress/components
77 var require_components = __commonJS({
78 "package-external:@wordpress/components"(exports, module) {
79 module.exports = window.wp.components;
80 }
81 });
82
83 // vendor-external:react
84 var require_react = __commonJS({
85 "vendor-external:react"(exports, module) {
86 module.exports = window.React;
87 }
88 });
89
90 // widgets/site-preview/render.tsx
91 var import_element6 = __toESM(require_element());
92 var import_data = __toESM(require_data());
93 var import_core_data = __toESM(require_core_data());
94 var import_i18n2 = __toESM(require_i18n());
95
96 // packages/icons/build-module/library/wordpress.mjs
97 var import_primitives = __toESM(require_primitives(), 1);
98 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
99 var wordpress_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" }) });
100
101 // widgets/site-preview/render.tsx
102 var import_url = __toESM(require_url());
103 var import_components = __toESM(require_components());
104
105 // node_modules/clsx/dist/clsx.mjs
106 function r(e) {
107 var t, f, n = "";
108 if ("string" == typeof e || "number" == typeof e) n += e;
109 else if ("object" == typeof e) if (Array.isArray(e)) {
110 var o = e.length;
111 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
112 } else for (f in e) e[f] && (n && (n += " "), n += f);
113 return n;
114 }
115 function clsx() {
116 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
117 return n;
118 }
119 var clsx_default = clsx;
120
121 // node_modules/@base-ui/utils/esm/error.js
122 var set;
123 if (true) {
124 set = /* @__PURE__ */ new Set();
125 }
126 function error(...messages) {
127 if (true) {
128 const messageKey = messages.join(" ");
129 if (!set.has(messageKey)) {
130 set.add(messageKey);
131 console.error(`Base UI: ${messageKey}`);
132 }
133 }
134 }
135
136 // node_modules/@base-ui/utils/esm/useStableCallback.js
137 var React2 = __toESM(require_react(), 1);
138
139 // node_modules/@base-ui/utils/esm/useRefWithInit.js
140 var React = __toESM(require_react(), 1);
141 var UNINITIALIZED = {};
142 function useRefWithInit(init, initArg) {
143 const ref = React.useRef(UNINITIALIZED);
144 if (ref.current === UNINITIALIZED) {
145 ref.current = init(initArg);
146 }
147 return ref;
148 }
149
150 // node_modules/@base-ui/utils/esm/useStableCallback.js
151 var useInsertionEffect = React2[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)];
152 var useSafeInsertionEffect = (
153 // React 17 doesn't have useInsertionEffect.
154 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
155 useInsertionEffect !== React2.useLayoutEffect ? useInsertionEffect : (fn) => fn()
156 );
157 function useStableCallback(callback) {
158 const stable = useRefWithInit(createStableCallback).current;
159 stable.next = callback;
160 useSafeInsertionEffect(stable.effect);
161 return stable.trampoline;
162 }
163 function createStableCallback() {
164 const stable = {
165 next: void 0,
166 callback: assertNotCalled,
167 trampoline: (...args) => stable.callback?.(...args),
168 effect: () => {
169 stable.callback = stable.next;
170 }
171 };
172 return stable;
173 }
174 function assertNotCalled() {
175 if (true) {
176 throw (
177 /* minify-error-disabled */
178 new Error("Base UI: Cannot call an event handler while rendering.")
179 );
180 }
181 }
182
183 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js
184 var React3 = __toESM(require_react(), 1);
185 var noop = () => {
186 };
187 var useIsoLayoutEffect = typeof document !== "undefined" ? React3.useLayoutEffect : noop;
188
189 // node_modules/@base-ui/utils/esm/warn.js
190 var set2;
191 if (true) {
192 set2 = /* @__PURE__ */ new Set();
193 }
194 function warn(...messages) {
195 if (true) {
196 const messageKey = messages.join(" ");
197 if (!set2.has(messageKey)) {
198 set2.add(messageKey);
199 console.warn(`Base UI: ${messageKey}`);
200 }
201 }
202 }
203
204 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
205 var React6 = __toESM(require_react(), 1);
206
207 // node_modules/@base-ui/utils/esm/useMergedRefs.js
208 function useMergedRefs(a, b, c, d) {
209 const forkRef = useRefWithInit(createForkRef).current;
210 if (didChange(forkRef, a, b, c, d)) {
211 update(forkRef, [a, b, c, d]);
212 }
213 return forkRef.callback;
214 }
215 function useMergedRefsN(refs) {
216 const forkRef = useRefWithInit(createForkRef).current;
217 if (didChangeN(forkRef, refs)) {
218 update(forkRef, refs);
219 }
220 return forkRef.callback;
221 }
222 function createForkRef() {
223 return {
224 callback: null,
225 cleanup: null,
226 refs: []
227 };
228 }
229 function didChange(forkRef, a, b, c, d) {
230 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
231 }
232 function didChangeN(forkRef, newRefs) {
233 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
234 }
235 function update(forkRef, refs) {
236 forkRef.refs = refs;
237 if (refs.every((ref) => ref == null)) {
238 forkRef.callback = null;
239 return;
240 }
241 forkRef.callback = (instance) => {
242 if (forkRef.cleanup) {
243 forkRef.cleanup();
244 forkRef.cleanup = null;
245 }
246 if (instance != null) {
247 const cleanupCallbacks = Array(refs.length).fill(null);
248 for (let i = 0; i < refs.length; i += 1) {
249 const ref = refs[i];
250 if (ref == null) {
251 continue;
252 }
253 switch (typeof ref) {
254 case "function": {
255 const refCleanup = ref(instance);
256 if (typeof refCleanup === "function") {
257 cleanupCallbacks[i] = refCleanup;
258 }
259 break;
260 }
261 case "object": {
262 ref.current = instance;
263 break;
264 }
265 default:
266 }
267 }
268 forkRef.cleanup = () => {
269 for (let i = 0; i < refs.length; i += 1) {
270 const ref = refs[i];
271 if (ref == null) {
272 continue;
273 }
274 switch (typeof ref) {
275 case "function": {
276 const cleanupCallback = cleanupCallbacks[i];
277 if (typeof cleanupCallback === "function") {
278 cleanupCallback();
279 } else {
280 ref(null);
281 }
282 break;
283 }
284 case "object": {
285 ref.current = null;
286 break;
287 }
288 default:
289 }
290 }
291 };
292 }
293 };
294 }
295
296 // node_modules/@base-ui/utils/esm/getReactElementRef.js
297 var React5 = __toESM(require_react(), 1);
298
299 // node_modules/@base-ui/utils/esm/reactVersion.js
300 var React4 = __toESM(require_react(), 1);
301 var majorVersion = parseInt(React4.version, 10);
302 function isReactVersionAtLeast(reactVersionToCheck) {
303 return majorVersion >= reactVersionToCheck;
304 }
305
306 // node_modules/@base-ui/utils/esm/getReactElementRef.js
307 function getReactElementRef(element) {
308 if (!/* @__PURE__ */ React5.isValidElement(element)) {
309 return null;
310 }
311 const reactElement = element;
312 const propsWithRef = reactElement.props;
313 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
314 }
315
316 // node_modules/@base-ui/utils/esm/mergeObjects.js
317 function mergeObjects(a, b) {
318 if (a && !b) {
319 return a;
320 }
321 if (!a && b) {
322 return b;
323 }
324 if (a || b) {
325 return {
326 ...a,
327 ...b
328 };
329 }
330 return void 0;
331 }
332
333 // node_modules/@base-ui/utils/esm/empty.js
334 var EMPTY_ARRAY = Object.freeze([]);
335 var EMPTY_OBJECT = Object.freeze({});
336
337 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js
338 function getStateAttributesProps(state, customMapping) {
339 const props = {};
340 for (const key in state) {
341 const value = state[key];
342 if (customMapping?.hasOwnProperty(key)) {
343 const customProps = customMapping[key](value);
344 if (customProps != null) {
345 Object.assign(props, customProps);
346 }
347 continue;
348 }
349 if (value === true) {
350 props[`data-${key.toLowerCase()}`] = "";
351 } else if (value) {
352 props[`data-${key.toLowerCase()}`] = value.toString();
353 }
354 }
355 return props;
356 }
357
358 // node_modules/@base-ui/react/esm/utils/resolveClassName.js
359 function resolveClassName(className, state) {
360 return typeof className === "function" ? className(state) : className;
361 }
362
363 // node_modules/@base-ui/react/esm/utils/resolveStyle.js
364 function resolveStyle(style, state) {
365 return typeof style === "function" ? style(state) : style;
366 }
367
368 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js
369 var EMPTY_PROPS = {};
370 function mergeProps(a, b, c, d, e) {
371 if (!c && !d && !e && !a) {
372 return createInitialMergedProps(b);
373 }
374 let merged = createInitialMergedProps(a);
375 if (b) {
376 merged = mergeInto(merged, b);
377 }
378 if (c) {
379 merged = mergeInto(merged, c);
380 }
381 if (d) {
382 merged = mergeInto(merged, d);
383 }
384 if (e) {
385 merged = mergeInto(merged, e);
386 }
387 return merged;
388 }
389 function mergePropsN(props) {
390 if (props.length === 0) {
391 return EMPTY_PROPS;
392 }
393 if (props.length === 1) {
394 return createInitialMergedProps(props[0]);
395 }
396 let merged = createInitialMergedProps(props[0]);
397 for (let i = 1; i < props.length; i += 1) {
398 merged = mergeInto(merged, props[i]);
399 }
400 return merged;
401 }
402 function createInitialMergedProps(inputProps) {
403 if (isPropsGetter(inputProps)) {
404 return {
405 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
406 };
407 }
408 return copyInitialProps(inputProps);
409 }
410 function mergeInto(merged, inputProps) {
411 if (isPropsGetter(inputProps)) {
412 return resolvePropsGetter(inputProps, merged);
413 }
414 return mutablyMergeInto(merged, inputProps);
415 }
416 function copyInitialProps(inputProps) {
417 const copiedProps = {
418 ...inputProps
419 };
420 for (const propName in copiedProps) {
421 const propValue = copiedProps[propName];
422 if (isEventHandler(propName, propValue)) {
423 copiedProps[propName] = wrapEventHandler(propValue);
424 }
425 }
426 return copiedProps;
427 }
428 function mutablyMergeInto(mergedProps, externalProps) {
429 if (!externalProps) {
430 return mergedProps;
431 }
432 for (const propName in externalProps) {
433 const externalPropValue = externalProps[propName];
434 switch (propName) {
435 case "style": {
436 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
437 break;
438 }
439 case "className": {
440 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
441 break;
442 }
443 default: {
444 if (isEventHandler(propName, externalPropValue)) {
445 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
446 } else {
447 mergedProps[propName] = externalPropValue;
448 }
449 }
450 }
451 }
452 return mergedProps;
453 }
454 function isEventHandler(key, value) {
455 const code0 = key.charCodeAt(0);
456 const code1 = key.charCodeAt(1);
457 const code2 = key.charCodeAt(2);
458 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
459 }
460 function isPropsGetter(inputProps) {
461 return typeof inputProps === "function";
462 }
463 function resolvePropsGetter(inputProps, previousProps) {
464 if (isPropsGetter(inputProps)) {
465 return inputProps(previousProps);
466 }
467 return inputProps ?? EMPTY_PROPS;
468 }
469 function mergeEventHandlers(ourHandler, theirHandler) {
470 if (!theirHandler) {
471 return ourHandler;
472 }
473 if (!ourHandler) {
474 return wrapEventHandler(theirHandler);
475 }
476 return (...args) => {
477 const event = args[0];
478 if (isSyntheticEvent(event)) {
479 const baseUIEvent = event;
480 makeEventPreventable(baseUIEvent);
481 const result2 = theirHandler(...args);
482 if (!baseUIEvent.baseUIHandlerPrevented) {
483 ourHandler?.(...args);
484 }
485 return result2;
486 }
487 const result = theirHandler(...args);
488 ourHandler?.(...args);
489 return result;
490 };
491 }
492 function wrapEventHandler(handler) {
493 if (!handler) {
494 return handler;
495 }
496 return (...args) => {
497 const event = args[0];
498 if (isSyntheticEvent(event)) {
499 makeEventPreventable(event);
500 }
501 return handler(...args);
502 };
503 }
504 function makeEventPreventable(event) {
505 event.preventBaseUIHandler = () => {
506 event.baseUIHandlerPrevented = true;
507 };
508 return event;
509 }
510 function mergeClassNames(ourClassName, theirClassName) {
511 if (theirClassName) {
512 if (ourClassName) {
513 return theirClassName + " " + ourClassName;
514 }
515 return theirClassName;
516 }
517 return ourClassName;
518 }
519 function isSyntheticEvent(event) {
520 return event != null && typeof event === "object" && "nativeEvent" in event;
521 }
522
523 // node_modules/@base-ui/react/esm/internals/useRenderElement.js
524 var import_react = __toESM(require_react(), 1);
525 function useRenderElement(element, componentProps, params = {}) {
526 const renderProp = componentProps.render;
527 const outProps = useRenderElementProps(componentProps, params);
528 if (params.enabled === false) {
529 return null;
530 }
531 const state = params.state ?? EMPTY_OBJECT;
532 return evaluateRenderProp(element, renderProp, outProps, state);
533 }
534 function useRenderElementProps(componentProps, params = {}) {
535 const {
536 className: classNameProp,
537 style: styleProp,
538 render: renderProp
539 } = componentProps;
540 const {
541 state = EMPTY_OBJECT,
542 ref,
543 props,
544 stateAttributesMapping,
545 enabled = true
546 } = params;
547 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
548 const style = enabled ? resolveStyle(styleProp, state) : void 0;
549 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
550 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
551 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
552 if (typeof document !== "undefined") {
553 if (!enabled) {
554 useMergedRefs(null, null);
555 } else if (Array.isArray(ref)) {
556 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
557 } else {
558 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
559 }
560 }
561 if (!enabled) {
562 return EMPTY_OBJECT;
563 }
564 if (className !== void 0) {
565 outProps.className = mergeClassNames(outProps.className, className);
566 }
567 if (style !== void 0) {
568 outProps.style = mergeObjects(outProps.style, style);
569 }
570 return outProps;
571 }
572 function resolveRenderFunctionProps(props) {
573 if (Array.isArray(props)) {
574 return mergePropsN(props);
575 }
576 return mergeProps(void 0, props);
577 }
578 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
579 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
580 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
581 function evaluateRenderProp(element, render, props, state) {
582 if (render) {
583 if (typeof render === "function") {
584 if (true) {
585 warnIfRenderPropLooksLikeComponent(render);
586 }
587 return render(props, state);
588 }
589 const mergedProps = mergeProps(props, render.props);
590 mergedProps.ref = props.ref;
591 let newElement = render;
592 if (newElement?.$$typeof === REACT_LAZY_TYPE) {
593 const children = React6.Children.toArray(render);
594 newElement = children[0];
595 }
596 if (true) {
597 if (!/* @__PURE__ */ React6.isValidElement(newElement)) {
598 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"));
599 }
600 }
601 return /* @__PURE__ */ React6.cloneElement(newElement, mergedProps);
602 }
603 if (element) {
604 if (typeof element === "string") {
605 return renderTag(element, props);
606 }
607 }
608 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
609 }
610 function warnIfRenderPropLooksLikeComponent(renderFn) {
611 const functionName = renderFn.name;
612 if (functionName.length === 0) {
613 return;
614 }
615 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
616 return;
617 }
618 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
619 return;
620 }
621 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");
622 }
623 function renderTag(Tag, props) {
624 if (Tag === "button") {
625 return /* @__PURE__ */ (0, import_react.createElement)("button", {
626 type: "button",
627 ...props,
628 key: props.key
629 });
630 }
631 if (Tag === "img") {
632 return /* @__PURE__ */ (0, import_react.createElement)("img", {
633 alt: "",
634 ...props,
635 key: props.key
636 });
637 }
638 return /* @__PURE__ */ React6.createElement(Tag, props);
639 }
640
641 // node_modules/@base-ui/utils/esm/safeReact.js
642 var React7 = __toESM(require_react(), 1);
643 var SafeReact = {
644 ...React7
645 };
646
647 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js
648 var React10 = __toESM(require_react(), 1);
649
650 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
651 function hasWindow() {
652 return typeof window !== "undefined";
653 }
654 function getWindow(node) {
655 var _node$ownerDocument;
656 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
657 }
658 function isHTMLElement(value) {
659 if (!hasWindow()) {
660 return false;
661 }
662 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
663 }
664
665 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js
666 var React8 = __toESM(require_react(), 1);
667 var CompositeRootContext = /* @__PURE__ */ React8.createContext(void 0);
668 if (true) CompositeRootContext.displayName = "CompositeRootContext";
669 function useCompositeRootContext(optional = false) {
670 const context = React8.useContext(CompositeRootContext);
671 if (context === void 0 && !optional) {
672 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16));
673 }
674 return context;
675 }
676
677 // node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js
678 var React9 = __toESM(require_react(), 1);
679 function useFocusableWhenDisabled(parameters) {
680 const {
681 focusableWhenDisabled,
682 disabled,
683 composite = false,
684 tabIndex: tabIndexProp = 0,
685 isNativeButton
686 } = parameters;
687 const isFocusableComposite = composite && focusableWhenDisabled !== false;
688 const isNonFocusableComposite = composite && focusableWhenDisabled === false;
689 const props = React9.useMemo(() => {
690 const additionalProps = {
691 // allow Tabbing away from focusableWhenDisabled elements
692 onKeyDown(event) {
693 if (disabled && focusableWhenDisabled && event.key !== "Tab") {
694 event.preventDefault();
695 }
696 }
697 };
698 if (!composite) {
699 additionalProps.tabIndex = tabIndexProp;
700 if (!isNativeButton && disabled) {
701 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
702 }
703 }
704 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) {
705 additionalProps["aria-disabled"] = disabled;
706 }
707 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
708 additionalProps.disabled = disabled;
709 }
710 return additionalProps;
711 }, [composite, disabled, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
712 return {
713 props
714 };
715 }
716
717 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js
718 function useButton(parameters = {}) {
719 const {
720 disabled = false,
721 focusableWhenDisabled,
722 tabIndex = 0,
723 native: isNativeButton = true,
724 composite: compositeProp
725 } = parameters;
726 const elementRef = React10.useRef(null);
727 const compositeRootContext = useCompositeRootContext(true);
728 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
729 const {
730 props: focusableWhenDisabledProps
731 } = useFocusableWhenDisabled({
732 focusableWhenDisabled,
733 disabled,
734 composite: isCompositeItem,
735 tabIndex,
736 isNativeButton
737 });
738 if (true) {
739 React10.useEffect(() => {
740 if (!elementRef.current) {
741 return;
742 }
743 const isButtonTag = isButtonElement(elementRef.current);
744 if (isNativeButton) {
745 if (!isButtonTag) {
746 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
747 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`.";
748 error(`${message}${ownerStackMessage}`);
749 }
750 } else if (isButtonTag) {
751 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
752 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`.";
753 error(`${message}${ownerStackMessage}`);
754 }
755 }, [isNativeButton]);
756 }
757 const updateDisabled = React10.useCallback(() => {
758 const element = elementRef.current;
759 if (!isButtonElement(element)) {
760 return;
761 }
762 if (isCompositeItem && disabled && focusableWhenDisabledProps.disabled === void 0 && element.disabled) {
763 element.disabled = false;
764 }
765 }, [disabled, focusableWhenDisabledProps.disabled, isCompositeItem]);
766 useIsoLayoutEffect(updateDisabled, [updateDisabled]);
767 const getButtonProps = React10.useCallback((externalProps = {}) => {
768 const {
769 onClick: externalOnClick,
770 onMouseDown: externalOnMouseDown,
771 onKeyUp: externalOnKeyUp,
772 onKeyDown: externalOnKeyDown,
773 onPointerDown: externalOnPointerDown,
774 ...otherExternalProps
775 } = externalProps;
776 const type = isNativeButton ? "button" : void 0;
777 return mergeProps({
778 type,
779 onClick(event) {
780 if (disabled) {
781 event.preventDefault();
782 return;
783 }
784 externalOnClick?.(event);
785 },
786 onMouseDown(event) {
787 if (!disabled) {
788 externalOnMouseDown?.(event);
789 }
790 },
791 onKeyDown(event) {
792 if (disabled) {
793 return;
794 }
795 makeEventPreventable(event);
796 externalOnKeyDown?.(event);
797 if (event.baseUIHandlerPrevented) {
798 return;
799 }
800 const isCurrentTarget = event.target === event.currentTarget;
801 const currentTarget = event.currentTarget;
802 const isButton = isButtonElement(currentTarget);
803 const isLink = !isNativeButton && isValidLinkElement(currentTarget);
804 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
805 const isEnterKey = event.key === "Enter";
806 const isSpaceKey = event.key === " ";
807 const role = currentTarget.getAttribute("role");
808 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
809 if (isCurrentTarget && isCompositeItem && isSpaceKey) {
810 if (event.defaultPrevented && isTextNavigationRole) {
811 return;
812 }
813 event.preventDefault();
814 if (isLink || isNativeButton && isButton) {
815 currentTarget.click();
816 event.preventBaseUIHandler();
817 } else if (shouldClick) {
818 externalOnClick?.(event);
819 event.preventBaseUIHandler();
820 }
821 return;
822 }
823 if (shouldClick) {
824 if (!isNativeButton && (isSpaceKey || isEnterKey)) {
825 event.preventDefault();
826 }
827 if (!isNativeButton && isEnterKey) {
828 externalOnClick?.(event);
829 }
830 }
831 },
832 onKeyUp(event) {
833 if (disabled) {
834 return;
835 }
836 makeEventPreventable(event);
837 externalOnKeyUp?.(event);
838 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
839 event.preventDefault();
840 return;
841 }
842 if (event.baseUIHandlerPrevented) {
843 return;
844 }
845 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") {
846 externalOnClick?.(event);
847 }
848 },
849 onPointerDown(event) {
850 if (disabled) {
851 event.preventDefault();
852 return;
853 }
854 externalOnPointerDown?.(event);
855 }
856 }, !isNativeButton ? {
857 role: "button"
858 } : void 0, focusableWhenDisabledProps, otherExternalProps);
859 }, [disabled, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
860 const buttonRef = useStableCallback((element) => {
861 elementRef.current = element;
862 updateDisabled();
863 });
864 return {
865 getButtonProps,
866 buttonRef
867 };
868 }
869 function isButtonElement(elem) {
870 return isHTMLElement(elem) && elem.tagName === "BUTTON";
871 }
872 function isValidLinkElement(elem) {
873 return Boolean(elem?.tagName === "A" && elem?.href);
874 }
875
876 // node_modules/@base-ui/react/esm/button/Button.js
877 var React11 = __toESM(require_react(), 1);
878 var Button = /* @__PURE__ */ React11.forwardRef(function Button2(componentProps, forwardedRef) {
879 const {
880 render,
881 className,
882 disabled = false,
883 focusableWhenDisabled = false,
884 nativeButton = true,
885 style,
886 ...elementProps
887 } = componentProps;
888 const {
889 getButtonProps,
890 buttonRef
891 } = useButton({
892 disabled,
893 focusableWhenDisabled,
894 native: nativeButton
895 });
896 const state = {
897 disabled
898 };
899 return useRenderElement("button", componentProps, {
900 state,
901 ref: [forwardedRef, buttonRef],
902 props: [elementProps, getButtonProps]
903 });
904 });
905 if (true) Button.displayName = "Button";
906
907 // node_modules/@base-ui/react/esm/use-render/useRender.js
908 function useRender(params) {
909 return useRenderElement(params.defaultTagName ?? "div", params, params);
910 }
911
912 // packages/ui/build-module/text/text.mjs
913 var import_element = __toESM(require_element(), 1);
914 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
915 function getRuntime() {
916 const globalScope = globalThis;
917 if (globalScope.__wpStyleRuntime) {
918 return globalScope.__wpStyleRuntime;
919 }
920 globalScope.__wpStyleRuntime = {
921 documents: /* @__PURE__ */ new Map(),
922 styles: /* @__PURE__ */ new Map(),
923 injectedStyles: /* @__PURE__ */ new WeakMap()
924 };
925 if (typeof document !== "undefined") {
926 registerDocument(document);
927 }
928 return globalScope.__wpStyleRuntime;
929 }
930 function documentContainsStyleHash(targetDocument, hash) {
931 if (!targetDocument.head) {
932 return false;
933 }
934 for (const style of targetDocument.head.querySelectorAll(
935 `style[${STYLE_HASH_ATTRIBUTE}]`
936 )) {
937 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
938 return true;
939 }
940 }
941 return false;
942 }
943 function injectStyle(targetDocument, hash, css) {
944 if (!targetDocument.head) {
945 return;
946 }
947 const runtime = getRuntime();
948 let injectedStyles = runtime.injectedStyles.get(targetDocument);
949 if (!injectedStyles) {
950 injectedStyles = /* @__PURE__ */ new Set();
951 runtime.injectedStyles.set(targetDocument, injectedStyles);
952 }
953 if (injectedStyles.has(hash)) {
954 return;
955 }
956 if (documentContainsStyleHash(targetDocument, hash)) {
957 injectedStyles.add(hash);
958 return;
959 }
960 const style = targetDocument.createElement("style");
961 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
962 style.appendChild(targetDocument.createTextNode(css));
963 targetDocument.head.appendChild(style);
964 injectedStyles.add(hash);
965 }
966 function registerDocument(targetDocument) {
967 const runtime = getRuntime();
968 runtime.documents.set(
969 targetDocument,
970 (runtime.documents.get(targetDocument) ?? 0) + 1
971 );
972 for (const [hash, css] of runtime.styles) {
973 injectStyle(targetDocument, hash, css);
974 }
975 return () => {
976 const count = runtime.documents.get(targetDocument);
977 if (count === void 0) {
978 return;
979 }
980 if (count <= 1) {
981 runtime.documents.delete(targetDocument);
982 return;
983 }
984 runtime.documents.set(targetDocument, count - 1);
985 };
986 }
987 function registerStyle(hash, css) {
988 const runtime = getRuntime();
989 runtime.styles.set(hash, css);
990 for (const targetDocument of runtime.documents.keys()) {
991 injectStyle(targetDocument, hash, css);
992 }
993 }
994 if (typeof process === "undefined" || true) {
995 registerStyle("0c8601dd83", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}');
996 }
997 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
998 if (typeof process === "undefined" || true) {
999 registerStyle("1fb29d3a3c", "._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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-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 #0000);transition:var(--_gcd-a-transition,none)}");
1000 }
1001 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" };
1002 var Text = (0, import_element.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) {
1003 const element = useRender({
1004 render,
1005 defaultTagName: "span",
1006 ref,
1007 props: mergeProps(props, {
1008 className: clsx_default(
1009 style_default.text,
1010 global_css_defense_default.heading,
1011 global_css_defense_default.p,
1012 style_default[variant],
1013 className
1014 )
1015 })
1016 });
1017 return element;
1018 });
1019
1020 // packages/ui/build-module/button/button.mjs
1021 var import_element2 = __toESM(require_element(), 1);
1022 var import_i18n = __toESM(require_i18n(), 1);
1023 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
1024 import { speak } from "@wordpress/a11y";
1025 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
1026 function getRuntime2() {
1027 const globalScope = globalThis;
1028 if (globalScope.__wpStyleRuntime) {
1029 return globalScope.__wpStyleRuntime;
1030 }
1031 globalScope.__wpStyleRuntime = {
1032 documents: /* @__PURE__ */ new Map(),
1033 styles: /* @__PURE__ */ new Map(),
1034 injectedStyles: /* @__PURE__ */ new WeakMap()
1035 };
1036 if (typeof document !== "undefined") {
1037 registerDocument2(document);
1038 }
1039 return globalScope.__wpStyleRuntime;
1040 }
1041 function documentContainsStyleHash2(targetDocument, hash) {
1042 if (!targetDocument.head) {
1043 return false;
1044 }
1045 for (const style of targetDocument.head.querySelectorAll(
1046 `style[${STYLE_HASH_ATTRIBUTE2}]`
1047 )) {
1048 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
1049 return true;
1050 }
1051 }
1052 return false;
1053 }
1054 function injectStyle2(targetDocument, hash, css) {
1055 if (!targetDocument.head) {
1056 return;
1057 }
1058 const runtime = getRuntime2();
1059 let injectedStyles = runtime.injectedStyles.get(targetDocument);
1060 if (!injectedStyles) {
1061 injectedStyles = /* @__PURE__ */ new Set();
1062 runtime.injectedStyles.set(targetDocument, injectedStyles);
1063 }
1064 if (injectedStyles.has(hash)) {
1065 return;
1066 }
1067 if (documentContainsStyleHash2(targetDocument, hash)) {
1068 injectedStyles.add(hash);
1069 return;
1070 }
1071 const style = targetDocument.createElement("style");
1072 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
1073 style.appendChild(targetDocument.createTextNode(css));
1074 targetDocument.head.appendChild(style);
1075 injectedStyles.add(hash);
1076 }
1077 function registerDocument2(targetDocument) {
1078 const runtime = getRuntime2();
1079 runtime.documents.set(
1080 targetDocument,
1081 (runtime.documents.get(targetDocument) ?? 0) + 1
1082 );
1083 for (const [hash, css] of runtime.styles) {
1084 injectStyle2(targetDocument, hash, css);
1085 }
1086 return () => {
1087 const count = runtime.documents.get(targetDocument);
1088 if (count === void 0) {
1089 return;
1090 }
1091 if (count <= 1) {
1092 runtime.documents.delete(targetDocument);
1093 return;
1094 }
1095 runtime.documents.set(targetDocument, count - 1);
1096 };
1097 }
1098 function registerStyle2(hash, css) {
1099 const runtime = getRuntime2();
1100 runtime.styles.set(hash, css);
1101 for (const targetDocument of runtime.documents.keys()) {
1102 injectStyle2(targetDocument, hash, css);
1103 }
1104 }
1105 if (typeof process === "undefined" || true) {
1106 registerStyle2("7d54255a4c", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:499;--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:40px;--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;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(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:#0000;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:#0000;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:24px}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:32px}._914b42f315c0e580__is-loading{color:#0000;&:not([data-disabled]):is(:hover,:active,:focus){color:#0000}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}');
1107 }
1108 var style_default2 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
1109 if (typeof process === "undefined" || true) {
1110 registerStyle2("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}");
1111 }
1112 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
1113 if (typeof process === "undefined" || true) {
1114 registerStyle2("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._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-brand,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-brand,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-brand,var(--wp-admin-theme-color,#3858e9))}}");
1115 }
1116 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" };
1117 if (typeof process === "undefined" || true) {
1118 registerStyle2("1fb29d3a3c", "._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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-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 #0000);transition:var(--_gcd-a-transition,none)}");
1119 }
1120 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" };
1121 var Button3 = (0, import_element2.forwardRef)(
1122 function Button22({
1123 tone = "brand",
1124 variant = "solid",
1125 size = "default",
1126 className,
1127 focusableWhenDisabled = true,
1128 disabled,
1129 loading,
1130 loadingAnnouncement = (0, import_i18n.__)("Loading"),
1131 children,
1132 ...props
1133 }, ref) {
1134 const mergedClassName = clsx_default(
1135 global_css_defense_default2.button,
1136 resets_default["box-sizing"],
1137 focus_default["outset-ring--focus-except-active"],
1138 variant !== "unstyled" && style_default2.button,
1139 style_default2[`is-${tone}`],
1140 style_default2[`is-${variant}`],
1141 style_default2[`is-${size}`],
1142 loading && style_default2["is-loading"],
1143 className
1144 );
1145 (0, import_element2.useEffect)(() => {
1146 if (loading && loadingAnnouncement) {
1147 speak(loadingAnnouncement);
1148 }
1149 }, [loading, loadingAnnouncement]);
1150 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1151 Button,
1152 {
1153 ref,
1154 className: mergedClassName,
1155 focusableWhenDisabled,
1156 disabled: disabled ?? loading,
1157 ...props,
1158 children
1159 }
1160 );
1161 }
1162 );
1163
1164 // packages/ui/build-module/button/icon.mjs
1165 var import_element4 = __toESM(require_element(), 1);
1166
1167 // packages/ui/build-module/icon/icon.mjs
1168 var import_element3 = __toESM(require_element(), 1);
1169 var import_primitives2 = __toESM(require_primitives(), 1);
1170 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
1171 var Icon = (0, import_element3.forwardRef)(function Icon2({ icon, size = 24, ...restProps }, ref) {
1172 return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1173 import_primitives2.SVG,
1174 {
1175 ref,
1176 fill: "currentColor",
1177 ...icon.props,
1178 ...restProps,
1179 width: size,
1180 height: size
1181 }
1182 );
1183 });
1184
1185 // packages/ui/build-module/button/icon.mjs
1186 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
1187 var ButtonIcon = (0, import_element4.forwardRef)(
1188 function ButtonIcon2({ icon, ...props }, ref) {
1189 return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1190 Icon,
1191 {
1192 ref,
1193 icon,
1194 viewBox: "4 4 16 16",
1195 size: 16,
1196 ...props
1197 }
1198 );
1199 }
1200 );
1201
1202 // packages/ui/build-module/button/index.mjs
1203 ButtonIcon.displayName = "Button.Icon";
1204 var Button4 = Object.assign(Button3, {
1205 /**
1206 * An icon component specifically designed to work well when rendered inside
1207 * a `Button` component.
1208 */
1209 Icon: ButtonIcon
1210 });
1211
1212 // packages/ui/build-module/stack/stack.mjs
1213 var import_element5 = __toESM(require_element(), 1);
1214 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
1215 function getRuntime3() {
1216 const globalScope = globalThis;
1217 if (globalScope.__wpStyleRuntime) {
1218 return globalScope.__wpStyleRuntime;
1219 }
1220 globalScope.__wpStyleRuntime = {
1221 documents: /* @__PURE__ */ new Map(),
1222 styles: /* @__PURE__ */ new Map(),
1223 injectedStyles: /* @__PURE__ */ new WeakMap()
1224 };
1225 if (typeof document !== "undefined") {
1226 registerDocument3(document);
1227 }
1228 return globalScope.__wpStyleRuntime;
1229 }
1230 function documentContainsStyleHash3(targetDocument, hash) {
1231 if (!targetDocument.head) {
1232 return false;
1233 }
1234 for (const style of targetDocument.head.querySelectorAll(
1235 `style[${STYLE_HASH_ATTRIBUTE3}]`
1236 )) {
1237 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
1238 return true;
1239 }
1240 }
1241 return false;
1242 }
1243 function injectStyle3(targetDocument, hash, css) {
1244 if (!targetDocument.head) {
1245 return;
1246 }
1247 const runtime = getRuntime3();
1248 let injectedStyles = runtime.injectedStyles.get(targetDocument);
1249 if (!injectedStyles) {
1250 injectedStyles = /* @__PURE__ */ new Set();
1251 runtime.injectedStyles.set(targetDocument, injectedStyles);
1252 }
1253 if (injectedStyles.has(hash)) {
1254 return;
1255 }
1256 if (documentContainsStyleHash3(targetDocument, hash)) {
1257 injectedStyles.add(hash);
1258 return;
1259 }
1260 const style = targetDocument.createElement("style");
1261 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
1262 style.appendChild(targetDocument.createTextNode(css));
1263 targetDocument.head.appendChild(style);
1264 injectedStyles.add(hash);
1265 }
1266 function registerDocument3(targetDocument) {
1267 const runtime = getRuntime3();
1268 runtime.documents.set(
1269 targetDocument,
1270 (runtime.documents.get(targetDocument) ?? 0) + 1
1271 );
1272 for (const [hash, css] of runtime.styles) {
1273 injectStyle3(targetDocument, hash, css);
1274 }
1275 return () => {
1276 const count = runtime.documents.get(targetDocument);
1277 if (count === void 0) {
1278 return;
1279 }
1280 if (count <= 1) {
1281 runtime.documents.delete(targetDocument);
1282 return;
1283 }
1284 runtime.documents.set(targetDocument, count - 1);
1285 };
1286 }
1287 function registerStyle3(hash, css) {
1288 const runtime = getRuntime3();
1289 runtime.styles.set(hash, css);
1290 for (const targetDocument of runtime.documents.keys()) {
1291 injectStyle3(targetDocument, hash, css);
1292 }
1293 }
1294 if (typeof process === "undefined" || true) {
1295 registerStyle3("b51ff41489", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}");
1296 }
1297 var style_default3 = { "stack": "_19ce0419607e1896__stack" };
1298 var gapTokens = {
1299 xs: "var(--wpds-dimension-gap-xs, 4px)",
1300 sm: "var(--wpds-dimension-gap-sm, 8px)",
1301 md: "var(--wpds-dimension-gap-md, 12px)",
1302 lg: "var(--wpds-dimension-gap-lg, 16px)",
1303 xl: "var(--wpds-dimension-gap-xl, 24px)",
1304 "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
1305 "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
1306 };
1307 var Stack = (0, import_element5.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
1308 const style = {
1309 gap: gap && gapTokens[gap],
1310 alignItems: align,
1311 justifyContent: justify,
1312 flexDirection: direction,
1313 flexWrap: wrap
1314 };
1315 const element = useRender({
1316 render,
1317 ref,
1318 props: mergeProps(props, { style, className: style_default3.stack })
1319 });
1320 return element;
1321 });
1322
1323 // packages/style-runtime/src/index.ts
1324 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
1325 function getRuntime4() {
1326 const globalScope = globalThis;
1327 if (globalScope.__wpStyleRuntime) {
1328 return globalScope.__wpStyleRuntime;
1329 }
1330 globalScope.__wpStyleRuntime = {
1331 documents: /* @__PURE__ */ new Map(),
1332 styles: /* @__PURE__ */ new Map(),
1333 injectedStyles: /* @__PURE__ */ new WeakMap()
1334 };
1335 if (typeof document !== "undefined") {
1336 registerDocument4(document);
1337 }
1338 return globalScope.__wpStyleRuntime;
1339 }
1340 function documentContainsStyleHash4(targetDocument, hash) {
1341 if (!targetDocument.head) {
1342 return false;
1343 }
1344 for (const style of targetDocument.head.querySelectorAll(
1345 `style[${STYLE_HASH_ATTRIBUTE4}]`
1346 )) {
1347 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
1348 return true;
1349 }
1350 }
1351 return false;
1352 }
1353 function injectStyle4(targetDocument, hash, css) {
1354 if (!targetDocument.head) {
1355 return;
1356 }
1357 const runtime = getRuntime4();
1358 let injectedStyles = runtime.injectedStyles.get(targetDocument);
1359 if (!injectedStyles) {
1360 injectedStyles = /* @__PURE__ */ new Set();
1361 runtime.injectedStyles.set(targetDocument, injectedStyles);
1362 }
1363 if (injectedStyles.has(hash)) {
1364 return;
1365 }
1366 if (documentContainsStyleHash4(targetDocument, hash)) {
1367 injectedStyles.add(hash);
1368 return;
1369 }
1370 const style = targetDocument.createElement("style");
1371 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
1372 style.appendChild(targetDocument.createTextNode(css));
1373 targetDocument.head.appendChild(style);
1374 injectedStyles.add(hash);
1375 }
1376 function registerDocument4(targetDocument) {
1377 const runtime = getRuntime4();
1378 runtime.documents.set(
1379 targetDocument,
1380 (runtime.documents.get(targetDocument) ?? 0) + 1
1381 );
1382 for (const [hash, css] of runtime.styles) {
1383 injectStyle4(targetDocument, hash, css);
1384 }
1385 return () => {
1386 const count = runtime.documents.get(targetDocument);
1387 if (count === void 0) {
1388 return;
1389 }
1390 if (count <= 1) {
1391 runtime.documents.delete(targetDocument);
1392 return;
1393 }
1394 runtime.documents.set(targetDocument, count - 1);
1395 };
1396 }
1397 function registerStyle4(hash, css) {
1398 const runtime = getRuntime4();
1399 runtime.styles.set(hash, css);
1400 for (const targetDocument of runtime.documents.keys()) {
1401 injectStyle4(targetDocument, hash, css);
1402 }
1403 }
1404
1405 // widgets/site-preview/style.module.css
1406 if (typeof process === "undefined" || true) {
1407 registerStyle4("468ace9490", "._528f94b7f3c8f19c__container{aspect-ratio:3/4;height:100%;overflow:hidden;width:100%}._8b42f316c31ff9a3__urlBar{background:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);flex-shrink:0}._8b42f316c31ff9a3__urlBar,.dfc67cc19791df23__urlField{padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px)}.dfc67cc19791df23__urlField{background:var(--wpds-color-bg-surface-neutral,#fcfcfc);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);min-width:0}.d5d9069549093b8f__urlFavicon{flex-shrink:0;height:var(--wpds-typography-font-size-xs,11px);object-fit:contain;width:var(--wpds-typography-font-size-xs,11px)}._058ef3456ba3e4a3__urlIcon{color:var(--wpds-color-fg-content-neutral-weak,#707070);flex-shrink:0}._89b1c819076c4701__urlText{color:var(--wpds-color-fg-content-neutral,#1e1e1e);flex:1;font-size:var(--wpds-typography-font-size-xs,11px);line-height:var(--wpds-typography-line-height-xs,16px);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9f1f45e96a0d2105__previewWrap{flex:1;min-height:0;position:relative}.c1322576565e9858__loading{inset:0;position:absolute;z-index:1}._80c298aa7d9d30b1__iframe{inset-block-start:0;inset-inline-start:50%;min-height:375%;position:absolute;transform:translate(-50%) scale(.4);transform-origin:center top;width:250%}._017ce5123c2e1282__overlay{backdrop-filter:blur(1px);background:color-mix(in srgb,var(--wpds-color-fg-content-neutral-weak,#707070) 20%,#0000);inset:0;opacity:0;position:absolute}._9f1f45e96a0d2105__previewWrap:focus-within ._017ce5123c2e1282__overlay,._9f1f45e96a0d2105__previewWrap:hover ._017ce5123c2e1282__overlay{opacity:1}@media not (prefers-reduced-motion){._017ce5123c2e1282__overlay{transition:opacity var(--wpds-motion-duration-lg,.3s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}}");
1408 }
1409 var style_default4 = { "container": "_528f94b7f3c8f19c__container", "urlBar": "_8b42f316c31ff9a3__urlBar", "urlField": "dfc67cc19791df23__urlField", "urlFavicon": "d5d9069549093b8f__urlFavicon", "urlIcon": "_058ef3456ba3e4a3__urlIcon", "urlText": "_89b1c819076c4701__urlText", "previewWrap": "_9f1f45e96a0d2105__previewWrap", "loading": "c1322576565e9858__loading", "iframe": "_80c298aa7d9d30b1__iframe", "overlay": "_017ce5123c2e1282__overlay" };
1410
1411 // widgets/site-preview/render.tsx
1412 var import_jsx_runtime5 = __toESM(require_jsx_runtime());
1413 function PreviewUrlBar({
1414 siteUrl,
1415 siteIconUrl
1416 }) {
1417 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: style_default4.urlBar, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1418 Stack,
1419 {
1420 direction: "row",
1421 align: "center",
1422 gap: "xs",
1423 className: style_default4.urlField,
1424 children: [
1425 siteIconUrl ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1426 "img",
1427 {
1428 className: style_default4.urlFavicon,
1429 src: siteIconUrl,
1430 alt: ""
1431 }
1432 ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1433 Icon,
1434 {
1435 className: style_default4.urlIcon,
1436 icon: wordpress_default,
1437 size: 12
1438 }
1439 ),
1440 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { className: style_default4.urlText, children: siteUrl })
1441 ]
1442 }
1443 ) });
1444 }
1445 function SitePreview() {
1446 const [isIframeLoading, setIsIframeLoading] = (0, import_element6.useState)(true);
1447 const [isVisitLoading, setIsVisitLoading] = (0, import_element6.useState)(false);
1448 const [isEditLoading, setIsEditLoading] = (0, import_element6.useState)(false);
1449 const { siteUrl, siteIconUrl } = (0, import_data.useSelect)((select) => {
1450 const site = select(import_core_data.store).getEntityRecord(
1451 "root",
1452 "site",
1453 void 0
1454 );
1455 const base = select(import_core_data.store).getEntityRecord("root", "__unstableBase", void 0);
1456 return {
1457 siteUrl: site?.url,
1458 siteIconUrl: base?.site_icon_url
1459 };
1460 }, []);
1461 const isBlockTheme = (0, import_data.useSelect)(
1462 (select) => !!select(import_core_data.store).getCurrentTheme()?.is_block_theme,
1463 []
1464 );
1465 (0, import_element6.useEffect)(() => {
1466 setIsIframeLoading(true);
1467 }, [siteUrl]);
1468 if (!siteUrl) {
1469 return null;
1470 }
1471 const src = (0, import_url.addQueryArgs)(siteUrl, {
1472 wp_site_preview: 1
1473 });
1474 const editUrl = isBlockTheme ? "site-editor.php" : "customize.php";
1475 return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { direction: "column", className: style_default4.container, children: [
1476 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PreviewUrlBar, { siteUrl, siteIconUrl }),
1477 /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: style_default4.previewWrap, children: [
1478 isIframeLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1479 Stack,
1480 {
1481 direction: "column",
1482 align: "center",
1483 justify: "center",
1484 className: style_default4.loading,
1485 children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_components.Spinner, {})
1486 }
1487 ),
1488 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1489 "iframe",
1490 {
1491 className: style_default4.iframe,
1492 loading: "lazy",
1493 scrolling: "no",
1494 title: (0, import_i18n2.__)("Site preview"),
1495 src,
1496 onLoad: () => setIsIframeLoading(false),
1497 inert: "true"
1498 }
1499 ),
1500 !isIframeLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1501 Stack,
1502 {
1503 direction: "row",
1504 align: "center",
1505 justify: "center",
1506 gap: "sm",
1507 className: style_default4.overlay,
1508 children: [
1509 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1510 Button4,
1511 {
1512 variant: "solid",
1513 tone: "neutral",
1514 loading: isVisitLoading,
1515 onClick: () => {
1516 setIsVisitLoading(true);
1517 window.location.href = siteUrl;
1518 },
1519 children: (0, import_i18n2.__)("Visit")
1520 }
1521 ),
1522 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1523 Button4,
1524 {
1525 variant: "solid",
1526 tone: "brand",
1527 loading: isEditLoading,
1528 onClick: () => {
1529 setIsEditLoading(true);
1530 window.location.href = editUrl;
1531 },
1532 children: (0, import_i18n2.__)("Edit site")
1533 }
1534 )
1535 ]
1536 }
1537 )
1538 ] })
1539 ] });
1540 }
1541 export {
1542 SitePreview as default
1543 };
1544