PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 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 All 404 releases
gutenberg / build / widgets / site-health / render.js

render.js in Gutenberg trunk, at build/widgets/site-health/render.js

1,225 lines 54.1 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/i18n
35 var require_i18n = __commonJS({
36 "package-external:@wordpress/i18n"(exports, module) {
37 module.exports = window.wp.i18n;
38 }
39 });
40
41 // package-external:@wordpress/api-fetch
42 var require_api_fetch = __commonJS({
43 "package-external:@wordpress/api-fetch"(exports, module) {
44 module.exports = window.wp.apiFetch;
45 }
46 });
47
48 // package-external:@wordpress/components
49 var require_components = __commonJS({
50 "package-external:@wordpress/components"(exports, module) {
51 module.exports = window.wp.components;
52 }
53 });
54
55 // vendor-external:react
56 var require_react = __commonJS({
57 "vendor-external:react"(exports, module) {
58 module.exports = window.React;
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/primitives
70 var require_primitives = __commonJS({
71 "package-external:@wordpress/primitives"(exports, module) {
72 module.exports = window.wp.primitives;
73 }
74 });
75
76 // widgets/site-health/render.tsx
77 var import_element4 = __toESM(require_element());
78 var import_i18n2 = __toESM(require_i18n());
79 var import_api_fetch = __toESM(require_api_fetch());
80 var import_components = __toESM(require_components());
81
82 // node_modules/clsx/dist/clsx.mjs
83 function r(e) {
84 var t, f, n = "";
85 if ("string" == typeof e || "number" == typeof e) n += e;
86 else if ("object" == typeof e) if (Array.isArray(e)) {
87 var o = e.length;
88 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
89 } else for (f in e) e[f] && (n && (n += " "), n += f);
90 return n;
91 }
92 function clsx() {
93 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
94 return n;
95 }
96 var clsx_default = clsx;
97
98 // node_modules/@base-ui/utils/createLogOnce.mjs
99 var loggedMessages;
100 if (true) {
101 loggedMessages = /* @__PURE__ */ new Set();
102 }
103 function createLogOnce(severity, prefix) {
104 return function logOnce(...messages) {
105 if (true) {
106 const message = messages.join(" ");
107 const output = prefix ? `${prefix}: ${message}` : message;
108 const key = `${severity}:${output}`;
109 if (!loggedMessages.has(key)) {
110 loggedMessages.add(key);
111 if (severity === "warn") {
112 console.warn(output);
113 } else {
114 console.error(output);
115 }
116 }
117 }
118 };
119 }
120
121 // node_modules/@base-ui/utils/useRefWithInit.mjs
122 var React = __toESM(require_react(), 1);
123 var UNINITIALIZED = {};
124 function useRefWithInit(init, initArg) {
125 const ref = React.useRef(UNINITIALIZED);
126 if (ref.current === UNINITIALIZED) {
127 ref.current = init(initArg);
128 }
129 return ref;
130 }
131
132 // node_modules/@base-ui/utils/warn.mjs
133 var warn = createLogOnce("warn", "Base UI");
134
135 // node_modules/@base-ui/utils/empty.mjs
136 var EMPTY_ARRAY = Object.freeze([]);
137 var EMPTY_OBJECT = Object.freeze({});
138
139 // node_modules/@base-ui/react/internals/useRenderElement.mjs
140 var React4 = __toESM(require_react(), 1);
141
142 // node_modules/@base-ui/utils/useMergedRefs.mjs
143 function useMergedRefs(a, b, c, d) {
144 const forkRef = useRefWithInit(createForkRef).current;
145 if (didChange(forkRef, a, b, c, d)) {
146 update(forkRef, [a, b, c, d]);
147 }
148 return forkRef.callback;
149 }
150 function useMergedRefsN(refs) {
151 const forkRef = useRefWithInit(createForkRef).current;
152 if (didChangeN(forkRef, refs)) {
153 update(forkRef, refs);
154 }
155 return forkRef.callback;
156 }
157 function createForkRef() {
158 return {
159 callback: null,
160 cleanup: null,
161 refs: []
162 };
163 }
164 function didChange(forkRef, a, b, c, d) {
165 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
166 }
167 function didChangeN(forkRef, newRefs) {
168 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
169 }
170 function update(forkRef, refs) {
171 forkRef.refs = refs;
172 if (refs.every((ref) => ref == null)) {
173 forkRef.callback = null;
174 return;
175 }
176 forkRef.callback = (instance) => {
177 if (forkRef.cleanup) {
178 forkRef.cleanup();
179 forkRef.cleanup = null;
180 }
181 if (instance != null) {
182 const cleanupCallbacks = Array(refs.length).fill(null);
183 for (let i = 0; i < refs.length; i += 1) {
184 const ref = refs[i];
185 if (ref == null) {
186 continue;
187 }
188 switch (typeof ref) {
189 case "function": {
190 const refCleanup = ref(instance);
191 if (typeof refCleanup === "function") {
192 cleanupCallbacks[i] = refCleanup;
193 }
194 break;
195 }
196 case "object": {
197 ref.current = instance;
198 break;
199 }
200 default:
201 }
202 }
203 forkRef.cleanup = () => {
204 for (let i = 0; i < refs.length; i += 1) {
205 const ref = refs[i];
206 if (ref == null) {
207 continue;
208 }
209 switch (typeof ref) {
210 case "function": {
211 const cleanupCallback = cleanupCallbacks[i];
212 if (typeof cleanupCallback === "function") {
213 cleanupCallback();
214 } else {
215 void ref(null);
216 }
217 break;
218 }
219 case "object": {
220 ref.current = null;
221 break;
222 }
223 default:
224 }
225 }
226 };
227 }
228 };
229 }
230
231 // node_modules/@base-ui/utils/getReactElementRef.mjs
232 var React3 = __toESM(require_react(), 1);
233
234 // node_modules/@base-ui/utils/reactVersion.mjs
235 var React2 = __toESM(require_react(), 1);
236 var majorVersion = parseInt(React2.version, 10);
237 function isReactVersionAtLeast(reactVersionToCheck) {
238 return majorVersion >= reactVersionToCheck;
239 }
240
241 // node_modules/@base-ui/utils/getReactElementRef.mjs
242 function getReactElementRef(element) {
243 if (!/* @__PURE__ */ React3.isValidElement(element)) {
244 return null;
245 }
246 const reactElement = element;
247 const propsWithRef = reactElement.props;
248 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
249 }
250
251 // node_modules/@base-ui/utils/mergeObjects.mjs
252 function mergeObjects(a, b) {
253 if (a && !b) {
254 return a;
255 }
256 if (!a && b) {
257 return b;
258 }
259 if (a || b) {
260 return {
261 ...a,
262 ...b
263 };
264 }
265 return void 0;
266 }
267
268 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
269 function getStateAttributesProps(state, customMapping) {
270 const props = {};
271 for (const key in state) {
272 const value = state[key];
273 if (customMapping?.hasOwnProperty(key)) {
274 const customProps = customMapping[key](value);
275 if (customProps != null) {
276 Object.assign(props, customProps);
277 }
278 continue;
279 }
280 if (value === true) {
281 props[`data-${key.toLowerCase()}`] = "";
282 } else if (value) {
283 props[`data-${key.toLowerCase()}`] = value.toString();
284 }
285 }
286 return props;
287 }
288
289 // node_modules/@base-ui/react/utils/resolveClassName.mjs
290 function resolveClassName(className, state) {
291 return typeof className === "function" ? className(state) : className;
292 }
293
294 // node_modules/@base-ui/react/utils/resolveStyle.mjs
295 function resolveStyle(style, state) {
296 return typeof style === "function" ? style(state) : style;
297 }
298
299 // node_modules/@base-ui/react/merge-props/mergeProps.mjs
300 var EMPTY_PROPS = {};
301 function mergeProps(a, b, c, d, e) {
302 if (!c && !d && !e && !a) {
303 return createInitialMergedProps(b);
304 }
305 let merged = createInitialMergedProps(a);
306 if (b) {
307 merged = mergeInto(merged, b);
308 }
309 if (c) {
310 merged = mergeInto(merged, c);
311 }
312 if (d) {
313 merged = mergeInto(merged, d);
314 }
315 if (e) {
316 merged = mergeInto(merged, e);
317 }
318 return merged;
319 }
320 function mergePropsN(props) {
321 if (props.length === 0) {
322 return EMPTY_PROPS;
323 }
324 if (props.length === 1) {
325 return createInitialMergedProps(props[0]);
326 }
327 let merged = createInitialMergedProps(props[0]);
328 for (let i = 1; i < props.length; i += 1) {
329 merged = mergeInto(merged, props[i]);
330 }
331 return merged;
332 }
333 function createInitialMergedProps(inputProps) {
334 if (isPropsGetter(inputProps)) {
335 return {
336 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
337 };
338 }
339 return copyInitialProps(inputProps);
340 }
341 function mergeInto(merged, inputProps) {
342 if (isPropsGetter(inputProps)) {
343 return resolvePropsGetter(inputProps, merged);
344 }
345 return mutablyMergeInto(merged, inputProps);
346 }
347 function copyInitialProps(inputProps) {
348 const copiedProps = {
349 ...inputProps
350 };
351 for (const propName in copiedProps) {
352 const propValue = copiedProps[propName];
353 if (isEventHandler(propName, propValue)) {
354 copiedProps[propName] = wrapEventHandler(propValue);
355 }
356 }
357 return copiedProps;
358 }
359 function mutablyMergeInto(mergedProps, externalProps) {
360 if (!externalProps) {
361 return mergedProps;
362 }
363 for (const propName in externalProps) {
364 const externalPropValue = externalProps[propName];
365 switch (propName) {
366 case "style": {
367 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
368 break;
369 }
370 case "className": {
371 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
372 break;
373 }
374 default: {
375 if (isEventHandler(propName, externalPropValue)) {
376 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
377 } else {
378 mergedProps[propName] = externalPropValue;
379 }
380 }
381 }
382 }
383 return mergedProps;
384 }
385 function isEventHandler(key, value) {
386 const code0 = key.charCodeAt(0);
387 const code1 = key.charCodeAt(1);
388 const code2 = key.charCodeAt(2);
389 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
390 }
391 function isPropsGetter(inputProps) {
392 return typeof inputProps === "function";
393 }
394 function resolvePropsGetter(inputProps, previousProps) {
395 if (isPropsGetter(inputProps)) {
396 return inputProps(previousProps);
397 }
398 return inputProps ?? EMPTY_PROPS;
399 }
400 function mergeEventHandlers(ourHandler, theirHandler) {
401 if (!theirHandler) {
402 return ourHandler;
403 }
404 if (!ourHandler) {
405 return wrapEventHandler(theirHandler);
406 }
407 return (...args) => {
408 const event = args[0];
409 if (isSyntheticEvent(event)) {
410 const baseUIEvent = event;
411 makeEventPreventable(baseUIEvent);
412 const result2 = theirHandler(...args);
413 if (!baseUIEvent.baseUIHandlerPrevented) {
414 ourHandler?.(...args);
415 }
416 return result2;
417 }
418 const result = theirHandler(...args);
419 ourHandler?.(...args);
420 return result;
421 };
422 }
423 function wrapEventHandler(handler) {
424 if (!handler) {
425 return handler;
426 }
427 return (...args) => {
428 const event = args[0];
429 if (isSyntheticEvent(event)) {
430 makeEventPreventable(event);
431 }
432 return handler(...args);
433 };
434 }
435 function makeEventPreventable(event) {
436 event.preventBaseUIHandler = () => {
437 event.baseUIHandlerPrevented = true;
438 };
439 return event;
440 }
441 function mergeClassNames(ourClassName, theirClassName) {
442 if (theirClassName) {
443 if (ourClassName) {
444 return theirClassName + " " + ourClassName;
445 }
446 return theirClassName;
447 }
448 return ourClassName;
449 }
450 function isSyntheticEvent(event) {
451 return event != null && typeof event === "object" && "nativeEvent" in event;
452 }
453
454 // node_modules/@base-ui/react/internals/useRenderElement.mjs
455 var import_react = __toESM(require_react(), 1);
456 function useRenderElement(element, componentProps, params = {}) {
457 let renderProp = componentProps.render;
458 if (params.enabled !== false) {
459 renderProp = unwrapLazyRenderProp(renderProp);
460 }
461 const outProps = useRenderElementProps(componentProps, params, renderProp);
462 if (params.enabled === false) {
463 return null;
464 }
465 const state = params.state ?? EMPTY_OBJECT;
466 return evaluateRenderProp(element, renderProp, outProps, state);
467 }
468 function useRenderElementProps(componentProps, params, renderProp) {
469 const {
470 className: classNameProp,
471 style: styleProp
472 } = componentProps;
473 const {
474 state = EMPTY_OBJECT,
475 ref,
476 props,
477 stateAttributesMapping,
478 enabled = true
479 } = params;
480 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
481 const style = enabled ? resolveStyle(styleProp, state) : void 0;
482 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
483 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
484 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
485 if (typeof document !== "undefined") {
486 if (!enabled) {
487 void useMergedRefs(null, null);
488 } else if (Array.isArray(ref)) {
489 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
490 } else {
491 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
492 }
493 }
494 if (!enabled) {
495 return EMPTY_OBJECT;
496 }
497 if (className !== void 0) {
498 outProps.className = mergeClassNames(outProps.className, className);
499 }
500 if (style !== void 0) {
501 outProps.style = mergeObjects(outProps.style, style);
502 }
503 return outProps;
504 }
505 function resolveRenderFunctionProps(props) {
506 if (Array.isArray(props)) {
507 return mergePropsN(props);
508 }
509 return mergeProps(void 0, props);
510 }
511 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
512 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
513 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
514 function unwrapLazyRenderProp(render) {
515 if (render?.$$typeof !== REACT_LAZY_TYPE) {
516 return render;
517 }
518 const unwrapped = React4.Children.toArray(render)[0];
519 return /* @__PURE__ */ React4.isValidElement(unwrapped) ? unwrapped : render;
520 }
521 function evaluateRenderProp(element, render, props, state) {
522 if (render) {
523 if (typeof render === "function") {
524 if (true) {
525 warnIfRenderPropLooksLikeComponent(render);
526 }
527 return render(props, state);
528 }
529 const mergedProps = mergeProps(props, render.props);
530 mergedProps.ref = props.ref;
531 if (true) {
532 if (!/* @__PURE__ */ React4.isValidElement(render)) {
533 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"));
534 }
535 }
536 return /* @__PURE__ */ React4.cloneElement(render, mergedProps);
537 }
538 if (element) {
539 if (typeof element === "string") {
540 return renderTag(element, props);
541 }
542 }
543 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
544 }
545 function warnIfRenderPropLooksLikeComponent(renderFn) {
546 const functionName = renderFn.name;
547 if (functionName.length === 0) {
548 return;
549 }
550 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
551 return;
552 }
553 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
554 return;
555 }
556 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");
557 }
558 function renderTag(Tag, props) {
559 if (Tag === "button") {
560 return /* @__PURE__ */ (0, import_react.createElement)("button", {
561 type: "button",
562 ...props,
563 key: props.key
564 });
565 }
566 if (Tag === "img") {
567 return /* @__PURE__ */ (0, import_react.createElement)("img", {
568 alt: "",
569 ...props,
570 key: props.key
571 });
572 }
573 return /* @__PURE__ */ React4.createElement(Tag, props);
574 }
575
576 // node_modules/@base-ui/react/use-render/useRender.mjs
577 function useRender(params) {
578 return useRenderElement(params.defaultTagName ?? "div", params, params);
579 }
580
581 // packages/ui/build-module/text/text.mjs
582 var import_element = __toESM(require_element(), 1);
583 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
584 function getRuntime() {
585 const globalScope = globalThis;
586 if (globalScope.__wpStyleRuntime) {
587 return globalScope.__wpStyleRuntime;
588 }
589 globalScope.__wpStyleRuntime = {
590 documents: /* @__PURE__ */ new Map(),
591 styles: /* @__PURE__ */ new Map(),
592 injectedStyles: /* @__PURE__ */ new WeakMap()
593 };
594 if (typeof document !== "undefined") {
595 registerDocument(document);
596 }
597 return globalScope.__wpStyleRuntime;
598 }
599 function documentContainsStyleHash(targetDocument, hash) {
600 if (!targetDocument.head) {
601 return false;
602 }
603 for (const style of targetDocument.head.querySelectorAll(
604 `style[${STYLE_HASH_ATTRIBUTE}]`
605 )) {
606 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
607 return true;
608 }
609 }
610 return false;
611 }
612 function injectStyle(targetDocument, hash, css) {
613 if (!targetDocument.head) {
614 return;
615 }
616 const runtime = getRuntime();
617 let injectedStyles = runtime.injectedStyles.get(targetDocument);
618 if (!injectedStyles) {
619 injectedStyles = /* @__PURE__ */ new Set();
620 runtime.injectedStyles.set(targetDocument, injectedStyles);
621 }
622 if (injectedStyles.has(hash)) {
623 return;
624 }
625 if (documentContainsStyleHash(targetDocument, hash)) {
626 injectedStyles.add(hash);
627 return;
628 }
629 const style = targetDocument.createElement("style");
630 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
631 style.appendChild(targetDocument.createTextNode(css));
632 targetDocument.head.appendChild(style);
633 injectedStyles.add(hash);
634 }
635 function registerDocument(targetDocument) {
636 const runtime = getRuntime();
637 runtime.documents.set(
638 targetDocument,
639 (runtime.documents.get(targetDocument) ?? 0) + 1
640 );
641 for (const [hash, css] of runtime.styles) {
642 injectStyle(targetDocument, hash, css);
643 }
644 return () => {
645 const count = runtime.documents.get(targetDocument);
646 if (count === void 0) {
647 return;
648 }
649 if (count <= 1) {
650 runtime.documents.delete(targetDocument);
651 return;
652 }
653 runtime.documents.set(targetDocument, count - 1);
654 };
655 }
656 function registerStyle(hash, css) {
657 const runtime = getRuntime();
658 runtime.styles.set(hash, css);
659 for (const targetDocument of runtime.documents.keys()) {
660 injectStyle(targetDocument, hash, css);
661 }
662 }
663 if (typeof process === "undefined" || true) {
664 registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;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-emphasis,600);--_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-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_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-emphasis,600);--_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-emphasis,600);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-emphasis,600);--_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-emphasis,600);--_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-emphasis,600);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-default,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-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,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-default,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-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,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)}}}');
665 }
666 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" };
667 if (typeof process === "undefined" || true) {
668 registerStyle("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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))}}&: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-emphasis,600));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)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
669 }
670 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", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
671 var Text = (0, import_element.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) {
672 const element = useRender({
673 render,
674 defaultTagName: "span",
675 ref,
676 props: mergeProps(props, {
677 className: clsx_default(
678 style_default.text,
679 global_css_defense_default.heading,
680 global_css_defense_default.p,
681 style_default[variant],
682 className
683 )
684 })
685 });
686 return element;
687 });
688
689 // packages/ui/build-module/link/link.mjs
690 var import_element2 = __toESM(require_element(), 1);
691 var import_i18n = __toESM(require_i18n(), 1);
692 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
693 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
694 function getRuntime2() {
695 const globalScope = globalThis;
696 if (globalScope.__wpStyleRuntime) {
697 return globalScope.__wpStyleRuntime;
698 }
699 globalScope.__wpStyleRuntime = {
700 documents: /* @__PURE__ */ new Map(),
701 styles: /* @__PURE__ */ new Map(),
702 injectedStyles: /* @__PURE__ */ new WeakMap()
703 };
704 if (typeof document !== "undefined") {
705 registerDocument2(document);
706 }
707 return globalScope.__wpStyleRuntime;
708 }
709 function documentContainsStyleHash2(targetDocument, hash) {
710 if (!targetDocument.head) {
711 return false;
712 }
713 for (const style of targetDocument.head.querySelectorAll(
714 `style[${STYLE_HASH_ATTRIBUTE2}]`
715 )) {
716 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
717 return true;
718 }
719 }
720 return false;
721 }
722 function injectStyle2(targetDocument, hash, css) {
723 if (!targetDocument.head) {
724 return;
725 }
726 const runtime = getRuntime2();
727 let injectedStyles = runtime.injectedStyles.get(targetDocument);
728 if (!injectedStyles) {
729 injectedStyles = /* @__PURE__ */ new Set();
730 runtime.injectedStyles.set(targetDocument, injectedStyles);
731 }
732 if (injectedStyles.has(hash)) {
733 return;
734 }
735 if (documentContainsStyleHash2(targetDocument, hash)) {
736 injectedStyles.add(hash);
737 return;
738 }
739 const style = targetDocument.createElement("style");
740 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
741 style.appendChild(targetDocument.createTextNode(css));
742 targetDocument.head.appendChild(style);
743 injectedStyles.add(hash);
744 }
745 function registerDocument2(targetDocument) {
746 const runtime = getRuntime2();
747 runtime.documents.set(
748 targetDocument,
749 (runtime.documents.get(targetDocument) ?? 0) + 1
750 );
751 for (const [hash, css] of runtime.styles) {
752 injectStyle2(targetDocument, hash, css);
753 }
754 return () => {
755 const count = runtime.documents.get(targetDocument);
756 if (count === void 0) {
757 return;
758 }
759 if (count <= 1) {
760 runtime.documents.delete(targetDocument);
761 return;
762 }
763 runtime.documents.set(targetDocument, count - 1);
764 };
765 }
766 function registerStyle2(hash, css) {
767 const runtime = getRuntime2();
768 runtime.styles.set(hash, css);
769 for (const targetDocument of runtime.documents.keys()) {
770 injectStyle2(targetDocument, hash, css);
771 }
772 }
773 if (typeof process === "undefined" || true) {
774 registerStyle2("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
775 }
776 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
777 if (typeof process === "undefined" || true) {
778 registerStyle2("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,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(--focus-color,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(--focus-color,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))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,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(--focus-color,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(--focus-color,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))}}}");
779 }
780 var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
781 if (typeof process === "undefined" || true) {
782 registerStyle2("e8e6a9be37", '@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-default,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"}}}');
783 }
784 var style_default2 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" };
785 if (typeof process === "undefined" || true) {
786 registerStyle2("e8e31009f5", "._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);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&: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))}}&: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-emphasis,600));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)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
787 }
788 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", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
789 var Link = (0, import_element2.forwardRef)(function Link2({
790 children,
791 variant = "default",
792 tone = "brand",
793 openInNewTab = false,
794 target,
795 render,
796 className,
797 ...props
798 }, ref) {
799 const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? "");
800 const element = useRender({
801 render,
802 defaultTagName: "a",
803 ref,
804 props: mergeProps(props, {
805 className: clsx_default(
806 global_css_defense_default2.a,
807 resets_default["box-sizing"],
808 focus_module_default["outset-ring--focus-except-active"],
809 variant !== "unstyled" && style_default2.link,
810 variant !== "unstyled" && style_default2[`is-${tone}`],
811 variant === "unstyled" && style_default2["is-unstyled"],
812 className
813 ),
814 target: target ?? (openInNewTab ? "_blank" : void 0),
815 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
816 children,
817 shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
818 "span",
819 {
820 className: style_default2["link-icon"],
821 role: "img",
822 "aria-label": (
823 /* translators: accessibility text appended to link text */
824 (0, import_i18n.__)("(opens in a new tab)")
825 )
826 }
827 )
828 ] })
829 })
830 });
831 return element;
832 });
833
834 // packages/ui/build-module/stack/stack.mjs
835 var import_element3 = __toESM(require_element(), 1);
836 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
837 function getRuntime3() {
838 const globalScope = globalThis;
839 if (globalScope.__wpStyleRuntime) {
840 return globalScope.__wpStyleRuntime;
841 }
842 globalScope.__wpStyleRuntime = {
843 documents: /* @__PURE__ */ new Map(),
844 styles: /* @__PURE__ */ new Map(),
845 injectedStyles: /* @__PURE__ */ new WeakMap()
846 };
847 if (typeof document !== "undefined") {
848 registerDocument3(document);
849 }
850 return globalScope.__wpStyleRuntime;
851 }
852 function documentContainsStyleHash3(targetDocument, hash) {
853 if (!targetDocument.head) {
854 return false;
855 }
856 for (const style of targetDocument.head.querySelectorAll(
857 `style[${STYLE_HASH_ATTRIBUTE3}]`
858 )) {
859 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
860 return true;
861 }
862 }
863 return false;
864 }
865 function injectStyle3(targetDocument, hash, css) {
866 if (!targetDocument.head) {
867 return;
868 }
869 const runtime = getRuntime3();
870 let injectedStyles = runtime.injectedStyles.get(targetDocument);
871 if (!injectedStyles) {
872 injectedStyles = /* @__PURE__ */ new Set();
873 runtime.injectedStyles.set(targetDocument, injectedStyles);
874 }
875 if (injectedStyles.has(hash)) {
876 return;
877 }
878 if (documentContainsStyleHash3(targetDocument, hash)) {
879 injectedStyles.add(hash);
880 return;
881 }
882 const style = targetDocument.createElement("style");
883 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
884 style.appendChild(targetDocument.createTextNode(css));
885 targetDocument.head.appendChild(style);
886 injectedStyles.add(hash);
887 }
888 function registerDocument3(targetDocument) {
889 const runtime = getRuntime3();
890 runtime.documents.set(
891 targetDocument,
892 (runtime.documents.get(targetDocument) ?? 0) + 1
893 );
894 for (const [hash, css] of runtime.styles) {
895 injectStyle3(targetDocument, hash, css);
896 }
897 return () => {
898 const count = runtime.documents.get(targetDocument);
899 if (count === void 0) {
900 return;
901 }
902 if (count <= 1) {
903 runtime.documents.delete(targetDocument);
904 return;
905 }
906 runtime.documents.set(targetDocument, count - 1);
907 };
908 }
909 function registerStyle3(hash, css) {
910 const runtime = getRuntime3();
911 runtime.styles.set(hash, css);
912 for (const targetDocument of runtime.documents.keys()) {
913 injectStyle3(targetDocument, hash, css);
914 }
915 }
916 if (typeof process === "undefined" || true) {
917 registerStyle3("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
918 }
919 var style_default3 = { "stack": "_19ce0419607e1896__stack" };
920 var gapTokens = {
921 xs: "var(--wpds-dimension-gap-xs, 4px)",
922 sm: "var(--wpds-dimension-gap-sm, 8px)",
923 md: "var(--wpds-dimension-gap-md, 12px)",
924 lg: "var(--wpds-dimension-gap-lg, 16px)",
925 xl: "var(--wpds-dimension-gap-xl, 24px)",
926 "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
927 "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
928 };
929 var Stack = (0, import_element3.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) {
930 const style = {
931 gap: gap && gapTokens[gap],
932 alignItems: align,
933 justifyContent: justify,
934 flexDirection: direction,
935 flexWrap: wrap
936 };
937 const element = useRender({
938 render,
939 ref,
940 props: mergeProps(props, { style, className: style_default3.stack })
941 });
942 return element;
943 });
944
945 // widgets/site-health/render.tsx
946 import { HostLink } from "@wordpress/widget-primitives";
947
948 // widgets/site-health/components/circle-progress/circle-progress.tsx
949 var import_primitives = __toESM(require_primitives());
950
951 // packages/style-runtime/src/index.ts
952 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
953 function getRuntime4() {
954 const globalScope = globalThis;
955 if (globalScope.__wpStyleRuntime) {
956 return globalScope.__wpStyleRuntime;
957 }
958 globalScope.__wpStyleRuntime = {
959 documents: /* @__PURE__ */ new Map(),
960 styles: /* @__PURE__ */ new Map(),
961 injectedStyles: /* @__PURE__ */ new WeakMap()
962 };
963 if (typeof document !== "undefined") {
964 registerDocument4(document);
965 }
966 return globalScope.__wpStyleRuntime;
967 }
968 function documentContainsStyleHash4(targetDocument, hash) {
969 if (!targetDocument.head) {
970 return false;
971 }
972 for (const style of targetDocument.head.querySelectorAll(
973 `style[${STYLE_HASH_ATTRIBUTE4}]`
974 )) {
975 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
976 return true;
977 }
978 }
979 return false;
980 }
981 function injectStyle4(targetDocument, hash, css) {
982 if (!targetDocument.head) {
983 return;
984 }
985 const runtime = getRuntime4();
986 let injectedStyles = runtime.injectedStyles.get(targetDocument);
987 if (!injectedStyles) {
988 injectedStyles = /* @__PURE__ */ new Set();
989 runtime.injectedStyles.set(targetDocument, injectedStyles);
990 }
991 if (injectedStyles.has(hash)) {
992 return;
993 }
994 if (documentContainsStyleHash4(targetDocument, hash)) {
995 injectedStyles.add(hash);
996 return;
997 }
998 const style = targetDocument.createElement("style");
999 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
1000 style.appendChild(targetDocument.createTextNode(css));
1001 targetDocument.head.appendChild(style);
1002 injectedStyles.add(hash);
1003 }
1004 function registerDocument4(targetDocument) {
1005 const runtime = getRuntime4();
1006 runtime.documents.set(
1007 targetDocument,
1008 (runtime.documents.get(targetDocument) ?? 0) + 1
1009 );
1010 for (const [hash, css] of runtime.styles) {
1011 injectStyle4(targetDocument, hash, css);
1012 }
1013 return () => {
1014 const count = runtime.documents.get(targetDocument);
1015 if (count === void 0) {
1016 return;
1017 }
1018 if (count <= 1) {
1019 runtime.documents.delete(targetDocument);
1020 return;
1021 }
1022 runtime.documents.set(targetDocument, count - 1);
1023 };
1024 }
1025 function registerStyle4(hash, css) {
1026 const runtime = getRuntime4();
1027 runtime.styles.set(hash, css);
1028 for (const targetDocument of runtime.documents.keys()) {
1029 injectStyle4(targetDocument, hash, css);
1030 }
1031 }
1032
1033 // widgets/site-health/components/circle-progress/circle-progress.module.css
1034 if (typeof process === "undefined" || true) {
1035 registerStyle4("eebb3d0b89", "._102f70874f5f6f85__root{flex-shrink:0;height:64px;width:64px}._102f70874f5f6f85__root.c2b8e83bf37a1369__success{--site-health-stroke:var(--wpds-color-stroke-surface-success,#92d39d);--site-health-fg:var(--wpds-color-foreground-content-success,#002900)}._102f70874f5f6f85__root._54958716847ff487__warning{--site-health-stroke:var(--wpds-color-stroke-surface-warning,#e1bd7c);--site-health-fg:var(--wpds-color-foreground-content-warning,#2e1900)}._102f70874f5f6f85__root._3173cf56308a969a__error{--site-health-stroke:var(--wpds-color-stroke-surface-error,#e0afa7);--site-health-fg:var(--wpds-color-foreground-content-error,#470000)}._102f70874f5f6f85__root circle:first-child{stroke:var(--wpds-color-background-track-neutral,#dbdbdb);stroke-width:12}._102f70874f5f6f85__root circle:last-of-type{stroke:var(--site-health-stroke);stroke-width:12;stroke-linecap:round;transform:rotate(-90deg);transform-origin:50% 50%;transition:stroke-dashoffset .5s ease}.fcddc693d8da23b7__percentage{fill:var(--site-health-fg);font-size:36px;font-weight:var(--wpds-typography-font-weight-emphasis,600)}");
1036 }
1037 var circle_progress_default = { "root": "_102f70874f5f6f85__root", "success": "c2b8e83bf37a1369__success", "warning": "_54958716847ff487__warning", "error": "_3173cf56308a969a__error", "percentage": "fcddc693d8da23b7__percentage" };
1038
1039 // widgets/site-health/components/circle-progress/circle-progress.tsx
1040 var import_jsx_runtime2 = __toESM(require_jsx_runtime());
1041 var RADIUS = 90;
1042 var CIRCUMFERENCE = 2 * Math.PI * RADIUS;
1043 function CircleProgress({ percentage, tone }) {
1044 const offset = CIRCUMFERENCE * (1 - percentage / 100);
1045 return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1046 import_primitives.SVG,
1047 {
1048 className: `${circle_progress_default.root} ${circle_progress_default[tone]}`,
1049 viewBox: "0 0 200 200",
1050 children: [
1051 /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1052 import_primitives.Circle,
1053 {
1054 r: RADIUS,
1055 cx: "100",
1056 cy: "100",
1057 fill: "transparent",
1058 strokeDasharray: CIRCUMFERENCE,
1059 strokeDashoffset: 0
1060 }
1061 ),
1062 /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1063 import_primitives.Circle,
1064 {
1065 r: RADIUS,
1066 cx: "100",
1067 cy: "100",
1068 fill: "transparent",
1069 strokeDasharray: CIRCUMFERENCE,
1070 strokeDashoffset: offset
1071 }
1072 ),
1073 /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1074 "text",
1075 {
1076 x: "100",
1077 y: "100",
1078 textAnchor: "middle",
1079 dominantBaseline: "middle",
1080 className: circle_progress_default.percentage,
1081 children: [
1082 percentage,
1083 "%"
1084 ]
1085 }
1086 )
1087 ]
1088 }
1089 );
1090 }
1091
1092 // widgets/site-health/style.module.css
1093 if (typeof process === "undefined" || true) {
1094 registerStyle4("846dda0ace", "._8ff8ab5f1d3747b3__root{height:100%;margin:0 auto;max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}.f5b9167dff836480__loading{height:100%;min-height:220px}");
1095 }
1096 var style_default4 = { "root": "_8ff8ab5f1d3747b3__root", "loading": "f5b9167dff836480__loading" };
1097
1098 // widgets/site-health/render.tsx
1099 var import_jsx_runtime3 = __toESM(require_jsx_runtime());
1100 var ASYNC_TEST_PATHS = [
1101 "/wp-site-health/v1/tests/background-updates",
1102 "/wp-site-health/v1/tests/loopback-requests",
1103 "/wp-site-health/v1/tests/https-status",
1104 "/wp-site-health/v1/tests/dotorg-communication",
1105 "/wp-site-health/v1/tests/authorization-header",
1106 "/wp-site-health/v1/tests/page-cache"
1107 ];
1108 function toneForPercentage(pct) {
1109 if (pct === 100) {
1110 return "success";
1111 }
1112 if (pct >= 75) {
1113 return "warning";
1114 }
1115 return "error";
1116 }
1117 function statusMessage(counts) {
1118 const total = counts.recommended + counts.critical;
1119 if (total <= 0) {
1120 return (0, import_i18n2.__)(
1121 "Great job! Your site currently passes all site health checks."
1122 );
1123 }
1124 if (counts.critical === 1) {
1125 return (0, import_i18n2.__)(
1126 "Your site has a critical issue that should be addressed as soon as possible to improve its performance and security."
1127 );
1128 }
1129 if (counts.critical > 1) {
1130 return (0, import_i18n2.__)(
1131 "Your site has critical issues that should be addressed as soon as possible to improve its performance and security."
1132 );
1133 }
1134 if (counts.recommended === 1) {
1135 return (0, import_i18n2.__)(
1136 "Your site\u2019s health is looking good, but there is still one thing you can do to improve its performance and security."
1137 );
1138 }
1139 return (0, import_i18n2.__)(
1140 "Your site\u2019s health is looking good, but there are still some things you can do to improve its performance and security."
1141 );
1142 }
1143 function reviewHref(counts) {
1144 const statuses = ["critical", "recommended"].filter(
1145 (status) => counts[status] > 0
1146 );
1147 const route = `/site-health?status=${statuses.join(",")}`;
1148 return `admin.php?page=dashboard-wp-admin&p=${encodeURIComponent(
1149 route
1150 )}`;
1151 }
1152 function SiteHealth() {
1153 const [counts, setCounts] = (0, import_element4.useState)(null);
1154 const [isLoading, setIsLoading] = (0, import_element4.useState)(true);
1155 (0, import_element4.useEffect)(() => {
1156 let ignore = false;
1157 const requests = ASYNC_TEST_PATHS.map(
1158 (path) => (0, import_api_fetch.default)({ path }).catch(() => null)
1159 );
1160 Promise.all(requests).then((results) => {
1161 if (ignore) {
1162 return;
1163 }
1164 const totals = {
1165 good: 0,
1166 recommended: 0,
1167 critical: 0
1168 };
1169 for (const result of results) {
1170 if (result?.status && result.status in totals) {
1171 totals[result.status]++;
1172 }
1173 }
1174 setCounts(totals);
1175 setIsLoading(false);
1176 });
1177 return () => {
1178 ignore = true;
1179 };
1180 }, []);
1181 if (isLoading) {
1182 return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1183 Stack,
1184 {
1185 className: style_default4.loading,
1186 direction: "column",
1187 align: "center",
1188 justify: "center",
1189 children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_components.Spinner, {})
1190 }
1191 );
1192 }
1193 if (!counts) {
1194 return null;
1195 }
1196 const total = counts.good + counts.recommended + counts.critical;
1197 const percentage = total > 0 ? Math.round(counts.good / total * 100) : 0;
1198 const issuesTotal = counts.recommended + counts.critical;
1199 const tone = toneForPercentage(percentage);
1200 const href = reviewHref(counts);
1201 const reviewLabel = (0, import_i18n2.sprintf)(
1202 /* translators: %d: Number of issues to address. */
1203 (0, import_i18n2._n)("Review %d item", "Review %d items", issuesTotal),
1204 issuesTotal
1205 );
1206 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1207 Stack,
1208 {
1209 className: style_default4.root,
1210 align: "center",
1211 direction: "column",
1212 justify: "center",
1213 gap: "lg",
1214 children: [
1215 /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CircleProgress, { percentage, tone }),
1216 /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { variant: "body-lg", children: statusMessage(counts) }),
1217 issuesTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Link, { render: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HostLink, { href }), children: reviewLabel })
1218 ]
1219 }
1220 );
1221 }
1222 export {
1223 SiteHealth as default
1224 };
1225