| @@ -1,4 +1,6 @@ | ||
| 1 | +(function() { | |
| 2 | +"use strict"; | |
| 1 | 3 | var wp; |
| 2 | 4 | (wp ||= {}).formatLibrary = (() => { |
| 3 | 5 | var __create = Object.create; |
| 4 | 6 | var __defProp = Object.defineProperty; |
| @@ -14,8 +16,12 @@ | ||
| 14 | 16 | }); |
| 15 | 17 | var __commonJS = (cb, mod) => function __require2() { |
| 16 | 18 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 17 | 19 | }; |
| 20 | + var __export = (target, all) => { | |
| 21 | + for (var name16 in all) | |
| 22 | + __defProp(target, name16, { get: all[name16], enumerable: true }); | |
| 23 | + }; | |
| 18 | 24 | var __copyProps = (to, from, except, desc) => { |
| 19 | 25 | if (from && typeof from === "object" || typeof from === "function") { |
| 20 | 26 | for (let key of __getOwnPropNames(from)) |
| 21 | 27 | if (!__hasOwnProp.call(to, key) && key !== except) |
| @@ -80,33 +86,95 @@ | ||
| 80 | 86 | module.exports = window.wp.components; |
| 81 | 87 | } |
| 82 | 88 | }); |
| 83 | 89 | |
| 84 | - // package-external:@wordpress/url | |
| 85 | - var require_url = __commonJS({ | |
| 86 | - "package-external:@wordpress/url"(exports, module) { | |
| 87 | - module.exports = window.wp.url; | |
| 90 | + // vendor-external:react | |
| 91 | + var require_react = __commonJS({ | |
| 92 | + "vendor-external:react"(exports, module) { | |
| 93 | + module.exports = window.React; | |
| 88 | 94 | } |
| 89 | 95 | }); |
| 90 | 96 | |
| 91 | - // package-external:@wordpress/html-entities | |
| 92 | - var require_html_entities = __commonJS({ | |
| 93 | - "package-external:@wordpress/html-entities"(exports, module) { | |
| 94 | - module.exports = window.wp.htmlEntities; | |
| 97 | + // vendor-external:react-dom | |
| 98 | + var require_react_dom = __commonJS({ | |
| 99 | + "vendor-external:react-dom"(exports, module) { | |
| 100 | + module.exports = window.ReactDOM; | |
| 95 | 101 | } |
| 96 | 102 | }); |
| 97 | 103 | |
| 98 | - // package-external:@wordpress/a11y | |
| 99 | - var require_a11y = __commonJS({ | |
| 100 | - "package-external:@wordpress/a11y"(exports, module) { | |
| 101 | - module.exports = window.wp.a11y; | |
| 104 | + // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js | |
| 105 | + var require_use_sync_external_store_shim_development = __commonJS({ | |
| 106 | + "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { | |
| 107 | + "use strict"; | |
| 108 | + (function() { | |
| 109 | + function is(x, y) { | |
| 110 | + return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; | |
| 111 | + } | |
| 112 | + function useSyncExternalStore$2(subscribe2, getSnapshot2) { | |
| 113 | + didWarnOld18Alpha || void 0 === React51.startTransition || (didWarnOld18Alpha = true, console.error( | |
| 114 | + "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." | |
| 115 | + )); | |
| 116 | + var value = getSnapshot2(); | |
| 117 | + if (!didWarnUncachedGetSnapshot) { | |
| 118 | + var cachedValue = getSnapshot2(); | |
| 119 | + objectIs(value, cachedValue) || (console.error( | |
| 120 | + "The result of getSnapshot should be cached to avoid an infinite loop" | |
| 121 | + ), didWarnUncachedGetSnapshot = true); | |
| 122 | + } | |
| 123 | + cachedValue = useState21({ | |
| 124 | + inst: { value, getSnapshot: getSnapshot2 } | |
| 125 | + }); | |
| 126 | + var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; | |
| 127 | + useLayoutEffect3( | |
| 128 | + function() { | |
| 129 | + inst.value = value; | |
| 130 | + inst.getSnapshot = getSnapshot2; | |
| 131 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 132 | + }, | |
| 133 | + [subscribe2, value, getSnapshot2] | |
| 134 | + ); | |
| 135 | + useEffect14( | |
| 136 | + function() { | |
| 137 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 138 | + return subscribe2(function() { | |
| 139 | + checkIfSnapshotChanged(inst) && forceUpdate({ inst }); | |
| 140 | + }); | |
| 141 | + }, | |
| 142 | + [subscribe2] | |
| 143 | + ); | |
| 144 | + useDebugValue(value); | |
| 145 | + return value; | |
| 146 | + } | |
| 147 | + function checkIfSnapshotChanged(inst) { | |
| 148 | + var latestGetSnapshot = inst.getSnapshot; | |
| 149 | + inst = inst.value; | |
| 150 | + try { | |
| 151 | + var nextValue = latestGetSnapshot(); | |
| 152 | + return !objectIs(inst, nextValue); | |
| 153 | + } catch (error2) { | |
| 154 | + return true; | |
| 155 | + } | |
| 156 | + } | |
| 157 | + function useSyncExternalStore$1(subscribe2, getSnapshot2) { | |
| 158 | + return getSnapshot2(); | |
| 159 | + } | |
| 160 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | |
| 161 | + var React51 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState21 = React51.useState, useEffect14 = React51.useEffect, useLayoutEffect3 = React51.useLayoutEffect, useDebugValue = React51.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; | |
| 162 | + exports.useSyncExternalStore = void 0 !== React51.useSyncExternalStore ? React51.useSyncExternalStore : shim; | |
| 163 | + "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | |
| 164 | + })(); | |
| 102 | 165 | } |
| 103 | 166 | }); |
| 104 | 167 | |
| 105 | - // package-external:@wordpress/data | |
| 106 | - var require_data = __commonJS({ | |
| 107 | - "package-external:@wordpress/data"(exports, module) { | |
| 108 | - module.exports = window.wp.data; | |
| 168 | + // node_modules/use-sync-external-store/shim/index.js | |
| 169 | + var require_shim = __commonJS({ | |
| 170 | + "node_modules/use-sync-external-store/shim/index.js"(exports, module) { | |
| 171 | + "use strict"; | |
| 172 | + if (false) { | |
| 173 | + module.exports = null; | |
| 174 | + } else { | |
| 175 | + module.exports = require_use_sync_external_store_shim_development(); | |
| 176 | + } | |
| 109 | 177 | } |
| 110 | 178 | }); |
| 111 | 179 | |
| 112 | 180 | // package-external:@wordpress/compose |
| @@ -115,22 +183,36 @@ | ||
| 115 | 183 | module.exports = window.wp.compose; |
| 116 | 184 | } |
| 117 | 185 | }); |
| 118 | 186 | |
| 119 | - // vendor-external:react | |
| 120 | - var require_react = __commonJS({ | |
| 121 | - "vendor-external:react"(exports, module) { | |
| 122 | - module.exports = window.React; | |
| 187 | + // package-external:@wordpress/a11y | |
| 188 | + var require_a11y = __commonJS({ | |
| 189 | + "package-external:@wordpress/a11y"(exports, module) { | |
| 190 | + module.exports = window.wp.a11y; | |
| 123 | 191 | } |
| 124 | 192 | }); |
| 125 | 193 | |
| 126 | - // package-external:@wordpress/private-apis | |
| 127 | - var require_private_apis = __commonJS({ | |
| 128 | - "package-external:@wordpress/private-apis"(exports, module) { | |
| 129 | - module.exports = window.wp.privateApis; | |
| 194 | + // package-external:@wordpress/url | |
| 195 | + var require_url = __commonJS({ | |
| 196 | + "package-external:@wordpress/url"(exports, module) { | |
| 197 | + module.exports = window.wp.url; | |
| 130 | 198 | } |
| 131 | 199 | }); |
| 132 | 200 | |
| 201 | + // package-external:@wordpress/html-entities | |
| 202 | + var require_html_entities = __commonJS({ | |
| 203 | + "package-external:@wordpress/html-entities"(exports, module) { | |
| 204 | + module.exports = window.wp.htmlEntities; | |
| 205 | + } | |
| 206 | + }); | |
| 207 | + | |
| 208 | + // package-external:@wordpress/data | |
| 209 | + var require_data = __commonJS({ | |
| 210 | + "package-external:@wordpress/data"(exports, module) { | |
| 211 | + module.exports = window.wp.data; | |
| 212 | + } | |
| 213 | + }); | |
| 214 | + | |
| 133 | 215 | // packages/format-library/build-module/index.mjs |
| 134 | 216 | var import_rich_text18 = __toESM(require_rich_text(), 1); |
| 135 | 217 | |
| 136 | 218 | // packages/format-library/build-module/bold/index.mjs |
| @@ -140,18 +222,21 @@ | ||
| 140 | 222 | |
| 141 | 223 | // packages/icons/build-module/icon/index.mjs |
| 142 | 224 | var import_element = __toESM(require_element(), 1); |
| 143 | 225 | var icon_default = (0, import_element.forwardRef)( |
| 144 | - ({ icon, size = 24, ...props }, ref) => { | |
| 145 | - return (0, import_element.cloneElement)( | |
| 146 | - icon, | |
| 147 | - { | |
| 148 | - width: size, | |
| 149 | - height: size, | |
| 150 | - ...props, | |
| 151 | - ref | |
| 152 | - } | |
| 153 | - ); | |
| 226 | + ({ icon, size = 24, style, ...props }, ref) => { | |
| 227 | + const intrinsicStyle = icon.props.style; | |
| 228 | + const mergedStyle = intrinsicStyle || style ? { ...intrinsicStyle, ...style } : void 0; | |
| 229 | + return (0, import_element.cloneElement)(icon, { | |
| 230 | + width: size, | |
| 231 | + height: size, | |
| 232 | + ...props, | |
| 233 | + // Merge styles so the icon's intrinsic style (e.g. `fill: none` on | |
| 234 | + // stroke-based icons) is preserved unless the consumer overrides | |
| 235 | + // the same property explicitly. | |
| 236 | + ...mergedStyle ? { style: mergedStyle } : {}, | |
| 237 | + ref | |
| 238 | + }); | |
| 154 | 239 | } |
| 155 | 240 | ); |
| 156 | 241 | |
| 157 | 242 | // packages/icons/build-module/library/button.mjs |
| @@ -156,72 +241,107 @@ | ||
| 156 | 241 | |
| 157 | 242 | // packages/icons/build-module/library/button.mjs |
| 158 | 243 | var import_primitives = __toESM(require_primitives(), 1); |
| 159 | 244 | var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 160 | - var button_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z" }) }); | |
| 245 | + var button_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M8 11.75H16M5 16.25H19C19.6904 16.25 20.25 15.6904 20.25 15V8.5C20.25 7.80964 19.6904 7.25 19 7.25H5C4.30964 7.25 3.75 7.80964 3.75 8.5V15C3.75 15.6904 4.30964 16.25 5 16.25Z", vectorEffect: "non-scaling-stroke" }) }); | |
| 161 | 246 | |
| 162 | - // packages/icons/build-module/library/code.mjs | |
| 247 | + // packages/icons/build-module/library/chevron-right.mjs | |
| 163 | 248 | var import_primitives2 = __toESM(require_primitives(), 1); |
| 164 | 249 | var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); |
| 165 | - var code_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" }) }); | |
| 250 | + var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M10 6.5L15 12L10 17.5", vectorEffect: "non-scaling-stroke" }) }); | |
| 166 | 251 | |
| 167 | - // packages/icons/build-module/library/color.mjs | |
| 252 | + // packages/icons/build-module/library/code.mjs | |
| 168 | 253 | var import_primitives3 = __toESM(require_primitives(), 1); |
| 169 | 254 | var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); |
| 170 | - var color_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" }) }); | |
| 255 | + var code_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M7.99997 7L3.70708 11.2929C3.31655 11.6834 3.31655 12.3166 3.70708 12.7071L7.99997 17M16 17L20.2929 12.7071C20.6834 12.3166 20.6834 11.6834 20.2929 11.2929L16 7", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) }); | |
| 171 | 256 | |
| 172 | - // packages/icons/build-module/library/format-bold.mjs | |
| 257 | + // packages/icons/build-module/library/color.mjs | |
| 173 | 258 | var import_primitives4 = __toESM(require_primitives(), 1); |
| 174 | 259 | var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); |
| 175 | - var format_bold_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z" }) }); | |
| 260 | + var color_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M17.25 14C17.25 16.8995 14.8995 19.25 12 19.25C9.10051 19.25 6.75 16.8995 6.75 14C6.75 11.1005 10 7.37 12 5.12C14 7.37 17.25 11.1005 17.25 14Z", vectorEffect: "non-scaling-stroke" }) }); | |
| 176 | 261 | |
| 177 | - // packages/icons/build-module/library/format-italic.mjs | |
| 262 | + // packages/icons/build-module/library/error.mjs | |
| 178 | 263 | var import_primitives5 = __toESM(require_primitives(), 1); |
| 179 | 264 | var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); |
| 180 | - var format_italic_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M12.5 5L10 19h1.9l2.5-14z" }) }); | |
| 265 | + var error_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) }); | |
| 181 | 266 | |
| 182 | - // packages/icons/build-module/library/format-strikethrough.mjs | |
| 267 | + // packages/icons/build-module/library/format-bold.mjs | |
| 183 | 268 | var import_primitives6 = __toESM(require_primitives(), 1); |
| 184 | 269 | var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); |
| 185 | - var format_strikethrough_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z" }) }); | |
| 270 | + var format_bold_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M13 11.5H7.75M13 11.5L13.7412 11.6059C15.3242 11.832 16.5 13.1877 16.5 14.7868C16.5 16.5614 15.0614 18 13.2868 18H7.75C7.75 18 7.75 14.9338 7.75 11.5M13 11.5L13.2913 11.4417C14.5756 11.1849 15.5 10.0573 15.5 8.74755C15.5 7.23012 14.2699 6 12.7525 6H7.75C7.75 7.65199 7.75 9.63049 7.75 11.5", vectorEffect: "non-scaling-stroke" }) }); | |
| 186 | 271 | |
| 187 | - // packages/icons/build-module/library/help.mjs | |
| 272 | + // packages/icons/build-module/library/format-italic.mjs | |
| 188 | 273 | var import_primitives7 = __toESM(require_primitives(), 1); |
| 189 | 274 | var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); |
| 190 | - var help_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M12 4a8 8 0 1 1 .001 16.001A8 8 0 0 1 12 4Zm0 1.5a6.5 6.5 0 1 0-.001 13.001A6.5 6.5 0 0 0 12 5.5Zm.75 11h-1.5V15h1.5v1.5Zm-.445-9.234a3 3 0 0 1 .445 5.89V14h-1.5v-1.25c0-.57.452-.958.917-1.01A1.5 1.5 0 0 0 12 8.75a1.5 1.5 0 0 0-1.5 1.5H9a3 3 0 0 1 3.305-2.984Z" }) }); | |
| 275 | + var format_italic_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M11 19L13.5 5", vectorEffect: "non-scaling-stroke" }) }); | |
| 191 | 276 | |
| 192 | - // packages/icons/build-module/library/language.mjs | |
| 277 | + // packages/icons/build-module/library/format-strikethrough.mjs | |
| 193 | 278 | var import_primitives8 = __toESM(require_primitives(), 1); |
| 194 | 279 | var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); |
| 195 | - var language_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z" }) }); | |
| 280 | + var format_strikethrough_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M9 16.1554C12 18.02 15 16.5283 15 14.2908C15 13.6314 14.6839 12.999 14.1213 12.5328C14.108 12.5217 14.0945 12.5108 14.081 12.5M9 9.31845C9 7.49773 11.4313 6.3247 13.9199 7.4278M5.5 12.5H14.081M18.5 12.5H14.081", strokeLinecap: "square", vectorEffect: "non-scaling-stroke" }) }); | |
| 196 | 281 | |
| 197 | - // packages/icons/build-module/library/link.mjs | |
| 282 | + // packages/icons/build-module/library/help.mjs | |
| 198 | 283 | var import_primitives9 = __toESM(require_primitives(), 1); |
| 199 | 284 | var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); |
| 200 | - var link_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); | |
| 285 | + var help_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 286 | + /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M9.75 10.25C9.75 9.00736 10.7574 8 12 8C13.2426 8 14.25 9.00736 14.25 10.25C14.25 11.4083 13.3748 12.3621 12.2496 12.4863C12.1124 12.5015 12 12.6119 12 12.75V14M12 15V16.5", vectorEffect: "non-scaling-stroke" }), | |
| 287 | + /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M19.25 12C19.25 16.0041 16.0041 19.25 12 19.25C7.99594 19.25 4.75 16.0041 4.75 12C4.75 7.99594 7.99594 4.75 12 4.75C16.0041 4.75 19.25 7.99594 19.25 12Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) | |
| 288 | + ] }); | |
| 201 | 289 | |
| 202 | - // packages/icons/build-module/library/math.mjs | |
| 290 | + // packages/icons/build-module/library/inline-image.mjs | |
| 203 | 291 | var import_primitives10 = __toESM(require_primitives(), 1); |
| 204 | 292 | var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); |
| 205 | - var math_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M11.2 6.8c-.7 0-1.4.5-1.6 1.1l-2.8 7.5-1.2-1.8c-.1-.2-.4-.3-.6-.3H3v1.5h1.6l1.2 1.8c.6.9 1.9.7 2.2-.3l2.9-7.9s.1-.2.2-.2h7.8V6.7h-7.8Zm5.3 3.4-1.9 1.9-1.9-1.9-1.1 1.1 1.9 1.9-1.9 1.9 1.1 1.1 1.9-1.9 1.9 1.9 1.1-1.1-1.9-1.9 1.9-1.9-1.1-1.1Z" }) }); | |
| 293 | + var inline_image_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M13.25 11.3197L11.4155 9.48453C11.3765 9.44547 11.3132 9.44546 11.2741 9.48452L9.05837 11.7003C9.02448 11.7341 8.97132 11.7392 8.93163 11.7124L7.0648 10.4495C7.03003 10.426 6.98426 10.4267 6.95022 10.4513L4.75 12.0405M13.25 11.3197V7C13.25 6.30964 12.6904 5.75 12 5.75H6C5.30964 5.75 4.75 6.30965 4.75 7V12.0405M13.25 11.3197V13C13.25 13.6904 12.6904 14.25 12 14.25H6C5.30964 14.25 4.75 13.6904 4.75 13V12.0405M16 14H20M4 18H20", vectorEffect: "non-scaling-stroke" }) }); | |
| 206 | 294 | |
| 207 | - // packages/icons/build-module/library/subscript.mjs | |
| 295 | + // packages/icons/build-module/library/language.mjs | |
| 208 | 296 | var import_primitives11 = __toESM(require_primitives(), 1); |
| 209 | 297 | var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); |
| 210 | - var subscript_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z" }) }); | |
| 298 | + var language_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 299 | + /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M3 6H9.5M16 6H13.5M9.5 6V3M9.5 6H13.5M13.5 6C13.0477 7.24386 11.7361 9.79194 9.44037 12.5512M5.5 16.5C7.04336 15.2139 8.35238 13.8588 9.44037 12.5512M6.5 8C6.9232 8.9522 7.93743 10.7507 9.44037 12.5512M12.5 15.5C11.3314 14.6235 10.305 13.587 9.44037 12.5512", vectorEffect: "non-scaling-stroke" }), | |
| 300 | + /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M13.75 20V19.75L14.6667 17M14.6667 17L16.75 10.75H17.25L19.3333 17L20.25 19.75V20M19.3333 17H14.6667", vectorEffect: "non-scaling-stroke" }) | |
| 301 | + ] }); | |
| 211 | 302 | |
| 212 | - // packages/icons/build-module/library/superscript.mjs | |
| 303 | + // packages/icons/build-module/library/link.mjs | |
| 213 | 304 | var import_primitives12 = __toESM(require_primitives(), 1); |
| 214 | 305 | var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); |
| 215 | - var superscript_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z" }) }); | |
| 306 | + var link_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M9.5 12L14.5 12M10 7.75H8.25C5.90279 7.75 4 9.65279 4 12C4 14.3472 5.90279 16.25 8.25 16.25H10M14 16.25H15.75C18.0972 16.25 20 14.3472 20 12C20 9.65279 18.0972 7.75 15.75 7.75L14 7.75", vectorEffect: "non-scaling-stroke" }) }); | |
| 216 | 307 | |
| 217 | - // packages/icons/build-module/library/text-color.mjs | |
| 308 | + // packages/icons/build-module/library/math.mjs | |
| 218 | 309 | var import_primitives13 = __toESM(require_primitives(), 1); |
| 219 | 310 | var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); |
| 220 | - var text_color_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { d: "M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z" }) }); | |
| 311 | + var math_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { d: "M3 14H5L6.8916 16.3645C6.93974 16.4247 7.03496 16.4101 7.06289 16.3383L10.2521 8.13755C10.4015 7.75318 10.7717 7.5 11.1841 7.5H19M17 11L14.5 13.5M12 16L14.5 13.5M14.5 13.5L17 16M14.5 13.5L12 11", vectorEffect: "non-scaling-stroke" }) }); | |
| 221 | 312 | |
| 313 | + // packages/icons/build-module/library/published.mjs | |
| 314 | + var import_primitives14 = __toESM(require_primitives(), 1); | |
| 315 | + var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 316 | + var published_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 317 | + /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), | |
| 318 | + /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" }) | |
| 319 | + ] }); | |
| 320 | + | |
| 321 | + // packages/icons/build-module/library/subscript.mjs | |
| 322 | + var import_primitives15 = __toESM(require_primitives(), 1); | |
| 323 | + var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 324 | + var subscript_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 325 | + /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M17.75 18.5988H15.75C15.75 16.5322 17.75 17.0489 17.75 15.4989C17.75 14.7239 16.75 14.0738 15.75 14.8488", strokeLinecap: "square", vectorEffect: "non-scaling-stroke" }), | |
| 326 | + /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M10 12L13 7.4V7M10 12L7 7.4L7.00004 7M10 12L7 16.6V17M10 12L13 16.6V17", vectorEffect: "non-scaling-stroke" }) | |
| 327 | + ] }); | |
| 328 | + | |
| 329 | + // packages/icons/build-module/library/superscript.mjs | |
| 330 | + var import_primitives16 = __toESM(require_primitives(), 1); | |
| 331 | + var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 332 | + var superscript_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ | |
| 333 | + /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.Path, { d: "M17.75 8.59884H15.75C15.75 6.53219 17.75 7.04885 17.75 5.49887C17.75 4.72388 16.75 4.07384 15.75 4.84884", strokeLinecap: "square", vectorEffect: "non-scaling-stroke" }), | |
| 334 | + /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.Path, { d: "M10 12L13 7.4V7M10 12L7 7.4L7.00004 7M10 12L7 16.6V17M10 12L13 16.6V17", vectorEffect: "non-scaling-stroke" }) | |
| 335 | + ] }); | |
| 336 | + | |
| 337 | + // packages/icons/build-module/library/text-color.mjs | |
| 338 | + var import_primitives17 = __toESM(require_primitives(), 1); | |
| 339 | + var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 340 | + var text_color_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.Path, { d: "M8 17.5V17.223L9.01577 14.1757M9.01577 14.1757L11.3243 7.25H11.8784L14.1869 14.1757L15.2027 17.223V17.5M14.1869 14.1757H9.01577", vectorEffect: "non-scaling-stroke" }) }); | |
| 341 | + | |
| 222 | 342 | // packages/format-library/build-module/bold/index.mjs |
| 223 | - var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); | |
| 343 | + var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 224 | 344 | var name = "core/bold"; |
| 225 | 345 | var title = (0, import_i18n.__)("Bold"); |
| 226 | 346 | var bold = { |
| 227 | 347 | name, |
| @@ -227,18 +347,24 @@ | ||
| 227 | 347 | name, |
| 228 | 348 | title, |
| 229 | 349 | tagName: "strong", |
| 230 | 350 | className: null, |
| 231 | - edit({ isActive, value, onChange, onFocus, isVisible = true }) { | |
| 351 | + edit({ | |
| 352 | + isActive, | |
| 353 | + value, | |
| 354 | + onChange, | |
| 355 | + onFocus, | |
| 356 | + isVisible = true | |
| 357 | + }) { | |
| 232 | 358 | function onToggle() { |
| 233 | 359 | onChange((0, import_rich_text.toggleFormat)(value, { type: name, title })); |
| 234 | 360 | } |
| 235 | 361 | function onClick() { |
| 236 | - onChange((0, import_rich_text.toggleFormat)(value, { type: name })); | |
| 362 | + onChange((0, import_rich_text.toggleFormat)(value, { type: name, title })); | |
| 237 | 363 | onFocus(); |
| 238 | 364 | } |
| 239 | - return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [ | |
| 240 | - /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( | |
| 365 | + return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [ | |
| 366 | + /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 241 | 367 | import_block_editor.RichTextShortcut, |
| 242 | 368 | { |
| 243 | 369 | type: "primary", |
| 244 | 370 | character: "b", |
| @@ -244,9 +370,9 @@ | ||
| 244 | 370 | character: "b", |
| 245 | 371 | onUse: onToggle |
| 246 | 372 | } |
| 247 | 373 | ), |
| 248 | - isVisible && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( | |
| 374 | + isVisible && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 249 | 375 | import_block_editor.RichTextToolbarButton, |
| 250 | 376 | { |
| 251 | 377 | name: "bold", |
| 252 | 378 | icon: format_bold_default, |
| @@ -256,9 +382,9 @@ | ||
| 256 | 382 | shortcutType: "primary", |
| 257 | 383 | shortcutCharacter: "b" |
| 258 | 384 | } |
| 259 | 385 | ), |
| 260 | - /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( | |
| 386 | + /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 261 | 387 | import_block_editor.__unstableRichTextInputEvent, |
| 262 | 388 | { |
| 263 | 389 | inputType: "formatBold", |
| 264 | 390 | onInput: onToggle |
| @@ -271,9 +397,9 @@ | ||
| 271 | 397 | // packages/format-library/build-module/code/index.mjs |
| 272 | 398 | var import_i18n2 = __toESM(require_i18n(), 1); |
| 273 | 399 | var import_rich_text2 = __toESM(require_rich_text(), 1); |
| 274 | 400 | var import_block_editor2 = __toESM(require_block_editor(), 1); |
| 275 | - var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); | |
| 401 | + var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); | |
| 276 | 402 | var name2 = "core/code"; |
| 277 | 403 | var title2 = (0, import_i18n2.__)("Inline code"); |
| 278 | 404 | var code = { |
| 279 | 405 | name: name2, |
| @@ -303,15 +429,20 @@ | ||
| 303 | 429 | value = (0, import_rich_text2.remove)(value, endIndex, endIndex + 1); |
| 304 | 430 | value = (0, import_rich_text2.applyFormat)(value, { type: name2 }, startIndex, endIndex); |
| 305 | 431 | return value; |
| 306 | 432 | }, |
| 307 | - edit({ value, onChange, onFocus, isActive }) { | |
| 433 | + edit({ | |
| 434 | + value, | |
| 435 | + onChange, | |
| 436 | + onFocus, | |
| 437 | + isActive | |
| 438 | + }) { | |
| 308 | 439 | function onClick() { |
| 309 | 440 | onChange((0, import_rich_text2.toggleFormat)(value, { type: name2, title: title2 })); |
| 310 | 441 | onFocus(); |
| 311 | 442 | } |
| 312 | - return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [ | |
| 313 | - /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( | |
| 443 | + return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [ | |
| 444 | + /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( | |
| 314 | 445 | import_block_editor2.RichTextShortcut, |
| 315 | 446 | { |
| 316 | 447 | type: "access", |
| 317 | 448 | character: "x", |
| @@ -317,9 +448,9 @@ | ||
| 317 | 448 | character: "x", |
| 318 | 449 | onUse: onClick |
| 319 | 450 | } |
| 320 | 451 | ), |
| 321 | - /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( | |
| 452 | + /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( | |
| 322 | 453 | import_block_editor2.RichTextToolbarButton, |
| 323 | 454 | { |
| 324 | 455 | icon: code_default, |
| 325 | 456 | title: title2, |
| @@ -333,434 +464,410 @@ | ||
| 333 | 464 | }; |
| 334 | 465 | |
| 335 | 466 | // packages/format-library/build-module/image/index.mjs |
| 336 | 467 | var import_components = __toESM(require_components(), 1); |
| 337 | - var import_i18n3 = __toESM(require_i18n(), 1); | |
| 338 | - var import_element2 = __toESM(require_element(), 1); | |
| 339 | - var import_rich_text3 = __toESM(require_rich_text(), 1); | |
| 340 | - var import_block_editor3 = __toESM(require_block_editor(), 1); | |
| 341 | - var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); | |
| 342 | - var ALLOWED_MEDIA_TYPES = ["image"]; | |
| 343 | - var name3 = "core/image"; | |
| 344 | - var title3 = (0, import_i18n3.__)("Inline image"); | |
| 345 | - function getCurrentImageId(activeObjectAttributes) { | |
| 346 | - if (!activeObjectAttributes?.className) { | |
| 347 | - return void 0; | |
| 348 | - } | |
| 349 | - const [, id] = activeObjectAttributes.className.match(/wp-image-(\d+)/) ?? []; | |
| 350 | - return id ? parseInt(id, 10) : void 0; | |
| 468 | + | |
| 469 | + // node_modules/clsx/dist/clsx.mjs | |
| 470 | + function r(e) { | |
| 471 | + var t, f, n = ""; | |
| 472 | + if ("string" == typeof e || "number" == typeof e) n += e; | |
| 473 | + else if ("object" == typeof e) if (Array.isArray(e)) { | |
| 474 | + var o = e.length; | |
| 475 | + for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); | |
| 476 | + } else for (f in e) e[f] && (n && (n += " "), n += f); | |
| 477 | + return n; | |
| 351 | 478 | } |
| 352 | - var image = { | |
| 353 | - name: name3, | |
| 354 | - title: title3, | |
| 355 | - keywords: [(0, import_i18n3.__)("photo"), (0, import_i18n3.__)("media")], | |
| 356 | - object: true, | |
| 357 | - tagName: "img", | |
| 358 | - className: null, | |
| 359 | - attributes: { | |
| 360 | - className: "class", | |
| 361 | - style: "style", | |
| 362 | - url: "src", | |
| 363 | - alt: "alt" | |
| 364 | - }, | |
| 365 | - edit: Edit | |
| 366 | - }; | |
| 367 | - function InlineUI({ value, onChange, activeObjectAttributes, contentRef }) { | |
| 368 | - const { style, alt } = activeObjectAttributes; | |
| 369 | - const width = style?.replace(/\D/g, ""); | |
| 370 | - const [editedWidth, setEditedWidth] = (0, import_element2.useState)(width); | |
| 371 | - const [editedAlt, setEditedAlt] = (0, import_element2.useState)(alt); | |
| 372 | - const hasChanged = editedWidth !== width || editedAlt !== alt; | |
| 373 | - const popoverAnchor = (0, import_rich_text3.useAnchor)({ | |
| 374 | - editableContentElement: contentRef.current, | |
| 375 | - settings: image | |
| 376 | - }); | |
| 377 | - return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 378 | - import_components.Popover, | |
| 379 | - { | |
| 380 | - focusOnMount: false, | |
| 381 | - anchor: popoverAnchor, | |
| 382 | - className: "block-editor-format-toolbar__image-popover", | |
| 383 | - children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 384 | - "form", | |
| 385 | - { | |
| 386 | - className: "block-editor-format-toolbar__image-container-content", | |
| 387 | - onSubmit: (event) => { | |
| 388 | - const newReplacements = value.replacements.slice(); | |
| 389 | - newReplacements[value.start] = { | |
| 390 | - type: name3, | |
| 391 | - attributes: { | |
| 392 | - ...activeObjectAttributes, | |
| 393 | - style: editedWidth ? `width: ${editedWidth}px;` : "", | |
| 394 | - alt: editedAlt | |
| 395 | - } | |
| 396 | - }; | |
| 397 | - onChange({ | |
| 398 | - ...value, | |
| 399 | - replacements: newReplacements | |
| 400 | - }); | |
| 401 | - event.preventDefault(); | |
| 402 | - }, | |
| 403 | - children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_components.__experimentalVStack, { spacing: 4, children: [ | |
| 404 | - /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 405 | - import_components.__experimentalNumberControl, | |
| 406 | - { | |
| 407 | - __next40pxDefaultSize: true, | |
| 408 | - label: (0, import_i18n3.__)("Width"), | |
| 409 | - value: editedWidth, | |
| 410 | - min: 1, | |
| 411 | - onChange: (newWidth) => { | |
| 412 | - setEditedWidth(newWidth); | |
| 413 | - } | |
| 414 | - } | |
| 415 | - ), | |
| 416 | - /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 417 | - import_components.TextareaControl, | |
| 418 | - { | |
| 419 | - label: (0, import_i18n3.__)("Alternative text"), | |
| 420 | - value: editedAlt, | |
| 421 | - onChange: (newAlt) => { | |
| 422 | - setEditedAlt(newAlt); | |
| 423 | - }, | |
| 424 | - help: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [ | |
| 425 | - /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 426 | - import_components.ExternalLink, | |
| 427 | - { | |
| 428 | - href: ( | |
| 429 | - // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. | |
| 430 | - (0, import_i18n3.__)( | |
| 431 | - "https://www.w3.org/WAI/tutorials/images/decision-tree/" | |
| 432 | - ) | |
| 433 | - ), | |
| 434 | - children: (0, import_i18n3.__)( | |
| 435 | - "Describe the purpose of the image." | |
| 436 | - ) | |
| 437 | - } | |
| 438 | - ), | |
| 439 | - /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("br", {}), | |
| 440 | - (0, import_i18n3.__)("Leave empty if decorative.") | |
| 441 | - ] }) | |
| 442 | - } | |
| 443 | - ), | |
| 444 | - /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components.__experimentalHStack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 445 | - import_components.Button, | |
| 446 | - { | |
| 447 | - disabled: !hasChanged, | |
| 448 | - accessibleWhenDisabled: true, | |
| 449 | - variant: "primary", | |
| 450 | - type: "submit", | |
| 451 | - size: "compact", | |
| 452 | - children: (0, import_i18n3.__)("Apply") | |
| 453 | - } | |
| 454 | - ) }) | |
| 455 | - ] }) | |
| 479 | + function clsx() { | |
| 480 | + for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); | |
| 481 | + return n; | |
| 482 | + } | |
| 483 | + var clsx_default = clsx; | |
| 484 | + | |
| 485 | + // node_modules/@base-ui/utils/useControlled.mjs | |
| 486 | + var React = __toESM(require_react(), 1); | |
| 487 | + | |
| 488 | + // node_modules/@base-ui/utils/createLogOnce.mjs | |
| 489 | + var loggedMessages; | |
| 490 | + if (true) { | |
| 491 | + loggedMessages = /* @__PURE__ */ new Set(); | |
| 492 | + } | |
| 493 | + function createLogOnce(severity, prefix) { | |
| 494 | + return function logOnce(...messages) { | |
| 495 | + if (true) { | |
| 496 | + const message = messages.join(" "); | |
| 497 | + const output = prefix ? `${prefix}: ${message}` : message; | |
| 498 | + const key = `${severity}:${output}`; | |
| 499 | + if (!loggedMessages.has(key)) { | |
| 500 | + loggedMessages.add(key); | |
| 501 | + if (severity === "warn") { | |
| 502 | + console.warn(output); | |
| 503 | + } else { | |
| 504 | + console.error(output); | |
| 456 | 505 | } |
| 457 | - ) | |
| 506 | + } | |
| 458 | 507 | } |
| 459 | - ); | |
| 508 | + }; | |
| 460 | 509 | } |
| 461 | - function Edit({ | |
| 462 | - value, | |
| 463 | - onChange, | |
| 464 | - onFocus, | |
| 465 | - isObjectActive, | |
| 466 | - activeObjectAttributes, | |
| 467 | - contentRef | |
| 510 | + | |
| 511 | + // node_modules/@base-ui/utils/error.mjs | |
| 512 | + var error = createLogOnce("error", "Base UI"); | |
| 513 | + | |
| 514 | + // node_modules/@base-ui/utils/useControlled.mjs | |
| 515 | + function useControlled({ | |
| 516 | + controlled, | |
| 517 | + default: defaultProp, | |
| 518 | + name: name16, | |
| 519 | + state = "value" | |
| 468 | 520 | }) { |
| 469 | - return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_block_editor3.MediaUploadCheck, { children: [ | |
| 470 | - /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 471 | - import_block_editor3.MediaUpload, | |
| 472 | - { | |
| 473 | - allowedTypes: ALLOWED_MEDIA_TYPES, | |
| 474 | - value: getCurrentImageId(activeObjectAttributes), | |
| 475 | - onSelect: ({ id, url, alt, width: imgWidth }) => { | |
| 476 | - onChange( | |
| 477 | - (0, import_rich_text3.insertObject)(value, { | |
| 478 | - type: name3, | |
| 479 | - attributes: { | |
| 480 | - className: `wp-image-${id}`, | |
| 481 | - style: `width: ${Math.min( | |
| 482 | - imgWidth, | |
| 483 | - 150 | |
| 484 | - )}px;`, | |
| 485 | - url, | |
| 486 | - alt | |
| 487 | - } | |
| 488 | - }) | |
| 489 | - ); | |
| 490 | - onFocus(); | |
| 491 | - }, | |
| 492 | - render: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 493 | - import_block_editor3.RichTextToolbarButton, | |
| 494 | - { | |
| 495 | - icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 496 | - import_components.SVG, | |
| 497 | - { | |
| 498 | - xmlns: "http://www.w3.org/2000/svg", | |
| 499 | - viewBox: "0 0 24 24", | |
| 500 | - children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components.Path, { d: "M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z" }) | |
| 501 | - } | |
| 502 | - ), | |
| 503 | - title: isObjectActive ? (0, import_i18n3.__)("Replace image") : title3, | |
| 504 | - onClick: open, | |
| 505 | - isActive: isObjectActive | |
| 506 | - } | |
| 507 | - ) | |
| 521 | + const { | |
| 522 | + current: isControlled | |
| 523 | + } = React.useRef(controlled !== void 0); | |
| 524 | + const [valueState, setValue] = React.useState(defaultProp); | |
| 525 | + const value = isControlled && controlled !== void 0 ? controlled : valueState; | |
| 526 | + if (true) { | |
| 527 | + React.useEffect(() => { | |
| 528 | + if (isControlled !== (controlled !== void 0)) { | |
| 529 | + error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name16} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name16} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n")); | |
| 508 | 530 | } |
| 509 | - ), | |
| 510 | - isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( | |
| 511 | - InlineUI, | |
| 512 | - { | |
| 513 | - value, | |
| 514 | - onChange, | |
| 515 | - activeObjectAttributes, | |
| 516 | - contentRef | |
| 531 | + }, [state, name16, controlled]); | |
| 532 | + const { | |
| 533 | + current: defaultValue | |
| 534 | + } = React.useRef(defaultProp); | |
| 535 | + React.useEffect(() => { | |
| 536 | + if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { | |
| 537 | + error([`A component is changing the default ${state} state of an uncontrolled ${name16} after being initialized. To suppress this warning opt to use a controlled ${name16}.`].join("\n")); | |
| 517 | 538 | } |
| 518 | - ) | |
| 519 | - ] }); | |
| 539 | + }, [defaultProp]); | |
| 540 | + } | |
| 541 | + const setValueIfUncontrolled = React.useCallback((newValue) => { | |
| 542 | + if (!isControlled) { | |
| 543 | + setValue(newValue); | |
| 544 | + } | |
| 545 | + }, []); | |
| 546 | + return [value, setValueIfUncontrolled]; | |
| 520 | 547 | } |
| 548 | + function serializeToDevModeString(input) { | |
| 549 | + let nextId = 0; | |
| 550 | + const seen = /* @__PURE__ */ new WeakMap(); | |
| 551 | + try { | |
| 552 | + const result = JSON.stringify(input, function replacer(key, value) { | |
| 553 | + if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { | |
| 554 | + return void 0; | |
| 555 | + } | |
| 556 | + if (typeof value === "bigint") { | |
| 557 | + return `__bigint__:${value}`; | |
| 558 | + } | |
| 559 | + if (value !== null && typeof value === "object") { | |
| 560 | + const id = seen.get(value); | |
| 561 | + if (id !== void 0) { | |
| 562 | + return `__object__:${id}`; | |
| 563 | + } | |
| 564 | + seen.set(value, nextId); | |
| 565 | + nextId += 1; | |
| 566 | + } | |
| 567 | + return value; | |
| 568 | + }); | |
| 569 | + return result ?? `__top__:${typeof input}`; | |
| 570 | + } catch { | |
| 571 | + return "__unserializable__"; | |
| 572 | + } | |
| 573 | + } | |
| 521 | 574 | |
| 522 | - // packages/format-library/build-module/italic/index.mjs | |
| 523 | - var import_i18n4 = __toESM(require_i18n(), 1); | |
| 524 | - var import_rich_text4 = __toESM(require_rich_text(), 1); | |
| 525 | - var import_block_editor4 = __toESM(require_block_editor(), 1); | |
| 526 | - var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); | |
| 527 | - var name4 = "core/italic"; | |
| 528 | - var title4 = (0, import_i18n4.__)("Italic"); | |
| 529 | - var italic = { | |
| 530 | - name: name4, | |
| 531 | - title: title4, | |
| 532 | - tagName: "em", | |
| 533 | - className: null, | |
| 534 | - edit({ isActive, value, onChange, onFocus, isVisible = true }) { | |
| 535 | - function onToggle() { | |
| 536 | - onChange((0, import_rich_text4.toggleFormat)(value, { type: name4, title: title4 })); | |
| 575 | + // node_modules/@base-ui/utils/safeReact.mjs | |
| 576 | + var React2 = __toESM(require_react(), 1); | |
| 577 | + var SafeReact = { | |
| 578 | + ...React2 | |
| 579 | + }; | |
| 580 | + | |
| 581 | + // node_modules/@base-ui/utils/useRefWithInit.mjs | |
| 582 | + var React3 = __toESM(require_react(), 1); | |
| 583 | + var UNINITIALIZED = {}; | |
| 584 | + function useRefWithInit(init, initArg) { | |
| 585 | + const ref = React3.useRef(UNINITIALIZED); | |
| 586 | + if (ref.current === UNINITIALIZED) { | |
| 587 | + ref.current = init(initArg); | |
| 588 | + } | |
| 589 | + return ref; | |
| 590 | + } | |
| 591 | + | |
| 592 | + // node_modules/@base-ui/utils/useStableCallback.mjs | |
| 593 | + var useInsertionEffect = SafeReact.useInsertionEffect; | |
| 594 | + var useSafeInsertionEffect = ( | |
| 595 | + // React 17 doesn't have useInsertionEffect. | |
| 596 | + useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. | |
| 597 | + useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() | |
| 598 | + ); | |
| 599 | + function useStableCallback(callback) { | |
| 600 | + const stable = useRefWithInit(createStableCallback).current; | |
| 601 | + stable.next = callback; | |
| 602 | + useSafeInsertionEffect(stable.effect); | |
| 603 | + return stable.trampoline; | |
| 604 | + } | |
| 605 | + function createStableCallback() { | |
| 606 | + const stable = { | |
| 607 | + next: void 0, | |
| 608 | + callback: assertNotCalled, | |
| 609 | + trampoline: (...args) => stable.callback?.(...args), | |
| 610 | + effect: () => { | |
| 611 | + stable.callback = stable.next; | |
| 537 | 612 | } |
| 538 | - function onClick() { | |
| 539 | - onChange((0, import_rich_text4.toggleFormat)(value, { type: name4 })); | |
| 540 | - onFocus(); | |
| 541 | - } | |
| 542 | - return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [ | |
| 543 | - /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( | |
| 544 | - import_block_editor4.RichTextShortcut, | |
| 545 | - { | |
| 546 | - type: "primary", | |
| 547 | - character: "i", | |
| 548 | - onUse: onToggle | |
| 549 | - } | |
| 550 | - ), | |
| 551 | - isVisible && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( | |
| 552 | - import_block_editor4.RichTextToolbarButton, | |
| 553 | - { | |
| 554 | - name: "italic", | |
| 555 | - icon: format_italic_default, | |
| 556 | - title: title4, | |
| 557 | - onClick, | |
| 558 | - isActive, | |
| 559 | - shortcutType: "primary", | |
| 560 | - shortcutCharacter: "i" | |
| 561 | - } | |
| 562 | - ), | |
| 563 | - /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( | |
| 564 | - import_block_editor4.__unstableRichTextInputEvent, | |
| 565 | - { | |
| 566 | - inputType: "formatItalic", | |
| 567 | - onInput: onToggle | |
| 568 | - } | |
| 569 | - ) | |
| 570 | - ] }); | |
| 613 | + }; | |
| 614 | + return stable; | |
| 615 | + } | |
| 616 | + function assertNotCalled() { | |
| 617 | + if (true) { | |
| 618 | + throw ( | |
| 619 | + /* minify-error-disabled */ | |
| 620 | + new Error("Base UI: Cannot call an event handler while rendering.") | |
| 621 | + ); | |
| 571 | 622 | } |
| 572 | - }; | |
| 623 | + } | |
| 573 | 624 | |
| 574 | - // packages/format-library/build-module/link/index.mjs | |
| 575 | - var import_i18n7 = __toESM(require_i18n(), 1); | |
| 576 | - var import_element6 = __toESM(require_element(), 1); | |
| 577 | - var import_rich_text6 = __toESM(require_rich_text(), 1); | |
| 578 | - var import_url3 = __toESM(require_url(), 1); | |
| 579 | - var import_block_editor6 = __toESM(require_block_editor(), 1); | |
| 580 | - var import_html_entities = __toESM(require_html_entities(), 1); | |
| 581 | - var import_a11y2 = __toESM(require_a11y(), 1); | |
| 625 | + // node_modules/@base-ui/utils/warn.mjs | |
| 626 | + var warn = createLogOnce("warn", "Base UI"); | |
| 582 | 627 | |
| 583 | - // packages/format-library/build-module/link/inline.mjs | |
| 584 | - var import_element5 = __toESM(require_element(), 1); | |
| 585 | - var import_i18n6 = __toESM(require_i18n(), 1); | |
| 586 | - var import_a11y = __toESM(require_a11y(), 1); | |
| 587 | - var import_components3 = __toESM(require_components(), 1); | |
| 588 | - var import_url2 = __toESM(require_url(), 1); | |
| 589 | - var import_rich_text5 = __toESM(require_rich_text(), 1); | |
| 590 | - var import_block_editor5 = __toESM(require_block_editor(), 1); | |
| 591 | - var import_data = __toESM(require_data(), 1); | |
| 628 | + // node_modules/@base-ui/utils/empty.mjs | |
| 629 | + function NOOP() { | |
| 630 | + } | |
| 631 | + var EMPTY_ARRAY = Object.freeze([]); | |
| 632 | + var EMPTY_OBJECT = Object.freeze({}); | |
| 592 | 633 | |
| 593 | - // packages/format-library/build-module/link/utils.mjs | |
| 594 | - var import_url = __toESM(require_url(), 1); | |
| 595 | - function isValidHref(href) { | |
| 596 | - if (!href) { | |
| 597 | - return false; | |
| 634 | + // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs | |
| 635 | + var React6 = __toESM(require_react(), 1); | |
| 636 | + | |
| 637 | + // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs | |
| 638 | + var React4 = __toESM(require_react(), 1); | |
| 639 | + var noop = () => { | |
| 640 | + }; | |
| 641 | + var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; | |
| 642 | + | |
| 643 | + // node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs | |
| 644 | + var React5 = __toESM(require_react(), 1); | |
| 645 | + var CompositeListContext = /* @__PURE__ */ React5.createContext({ | |
| 646 | + register: () => { | |
| 647 | + }, | |
| 648 | + unregister: () => { | |
| 649 | + }, | |
| 650 | + subscribeMapChange: () => () => { | |
| 651 | + }, | |
| 652 | + nextIndexRef: { | |
| 653 | + current: 0 | |
| 598 | 654 | } |
| 599 | - const trimmedHref = href.trim(); | |
| 600 | - if (!trimmedHref) { | |
| 601 | - return false; | |
| 602 | - } | |
| 603 | - if (/^\S+:/.test(trimmedHref)) { | |
| 604 | - const protocol = (0, import_url.getProtocol)(trimmedHref); | |
| 605 | - if (!(0, import_url.isValidProtocol)(protocol)) { | |
| 606 | - return false; | |
| 655 | + }); | |
| 656 | + if (true) CompositeListContext.displayName = "CompositeListContext"; | |
| 657 | + function useCompositeListContext() { | |
| 658 | + return React5.useContext(CompositeListContext); | |
| 659 | + } | |
| 660 | + | |
| 661 | + // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs | |
| 662 | + var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); | |
| 663 | + function CompositeList(props) { | |
| 664 | + const { | |
| 665 | + children, | |
| 666 | + elementsRef, | |
| 667 | + labelsRef, | |
| 668 | + onMapChange: onMapChangeProp | |
| 669 | + } = props; | |
| 670 | + const onMapChange = useStableCallback(onMapChangeProp); | |
| 671 | + const [, setMapTick] = React6.useState(false); | |
| 672 | + const listeners = useRefWithInit(createListeners).current; | |
| 673 | + const map = useRefWithInit(createMap).current; | |
| 674 | + const nextIndexRef = React6.useRef(0); | |
| 675 | + const isDirtyRef = React6.useRef(true); | |
| 676 | + const itemsRef = React6.useRef(null); | |
| 677 | + const mutationObserverRef = React6.useRef(null); | |
| 678 | + const scheduleMapUpdate = useStableCallback(() => { | |
| 679 | + if (isDirtyRef.current) { | |
| 680 | + return; | |
| 607 | 681 | } |
| 608 | - if (protocol.startsWith("http") && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) { | |
| 609 | - return false; | |
| 682 | + isDirtyRef.current = true; | |
| 683 | + setMapTick((tick) => !tick); | |
| 684 | + }); | |
| 685 | + const register = useStableCallback((node, registration) => { | |
| 686 | + map.set(node, registration); | |
| 687 | + scheduleMapUpdate(); | |
| 688 | + }); | |
| 689 | + const unregister = useStableCallback((node) => { | |
| 690 | + map.delete(node); | |
| 691 | + scheduleMapUpdate(); | |
| 692 | + }); | |
| 693 | + const syncRefs = useStableCallback((items) => { | |
| 694 | + const nextMap = /* @__PURE__ */ new Map(); | |
| 695 | + elementsRef.current.length = 0; | |
| 696 | + if (labelsRef) { | |
| 697 | + labelsRef.current.length = 0; | |
| 610 | 698 | } |
| 611 | - const authority = (0, import_url.getAuthority)(trimmedHref); | |
| 612 | - if (!(0, import_url.isValidAuthority)(authority)) { | |
| 613 | - return false; | |
| 699 | + items.forEach((item) => { | |
| 700 | + nextMap.set(item.element, { | |
| 701 | + ...item.registration.metadata ?? {}, | |
| 702 | + index: item.index | |
| 703 | + }); | |
| 704 | + elementsRef.current[item.index] = item.element; | |
| 705 | + if (labelsRef) { | |
| 706 | + labelsRef.current[item.index] = item.registration.label !== void 0 ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent; | |
| 707 | + } | |
| 708 | + }); | |
| 709 | + nextIndexRef.current = elementsRef.current.length; | |
| 710 | + return nextMap; | |
| 711 | + }); | |
| 712 | + function observe(sortedNodes) { | |
| 713 | + mutationObserverRef.current?.disconnect(); | |
| 714 | + mutationObserverRef.current = null; | |
| 715 | + if (typeof MutationObserver !== "function" || sortedNodes.length < 2) { | |
| 716 | + return; | |
| 614 | 717 | } |
| 615 | - const path = (0, import_url.getPath)(trimmedHref); | |
| 616 | - if (path && !(0, import_url.isValidPath)(path)) { | |
| 617 | - return false; | |
| 718 | + const mutationObserver = new MutationObserver((entries) => { | |
| 719 | + if (!hasMovedNode(entries)) { | |
| 720 | + return; | |
| 721 | + } | |
| 722 | + let previousConnectedNode = null; | |
| 723 | + for (const node of sortedNodes) { | |
| 724 | + if (!node.isConnected) { | |
| 725 | + continue; | |
| 726 | + } | |
| 727 | + if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) { | |
| 728 | + mutationObserver.disconnect(); | |
| 729 | + scheduleMapUpdate(); | |
| 730 | + return; | |
| 731 | + } | |
| 732 | + previousConnectedNode = node; | |
| 733 | + } | |
| 734 | + }); | |
| 735 | + mutationObserverRef.current = mutationObserver; | |
| 736 | + const roots = /* @__PURE__ */ new Set(); | |
| 737 | + for (let i = 1; i < sortedNodes.length; i += 1) { | |
| 738 | + const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]); | |
| 739 | + if (root) { | |
| 740 | + roots.add(root); | |
| 741 | + } | |
| 618 | 742 | } |
| 619 | - const queryString = (0, import_url.getQueryString)(trimmedHref); | |
| 620 | - if (queryString && !(0, import_url.isValidQueryString)(queryString)) { | |
| 621 | - return false; | |
| 743 | + roots.forEach((root) => mutationObserver.observe(root, { | |
| 744 | + childList: true | |
| 745 | + })); | |
| 746 | + } | |
| 747 | + const flush = useStableCallback(() => { | |
| 748 | + const [items, automaticNodes] = getCompositeListSnapshot(map); | |
| 749 | + const nextMap = syncRefs(items); | |
| 750 | + const previousItems = itemsRef.current; | |
| 751 | + const changed = !previousItems || previousItems.length !== items.length || items.some((item, index2) => { | |
| 752 | + const previousItem = previousItems[index2]; | |
| 753 | + return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata; | |
| 754 | + }); | |
| 755 | + observe(automaticNodes); | |
| 756 | + itemsRef.current = items; | |
| 757 | + isDirtyRef.current = false; | |
| 758 | + if (!changed) { | |
| 759 | + return; | |
| 622 | 760 | } |
| 623 | - const fragment = (0, import_url.getFragment)(trimmedHref); | |
| 624 | - if (fragment && !(0, import_url.isValidFragment)(fragment)) { | |
| 625 | - return false; | |
| 761 | + listeners.forEach((listener) => listener(nextMap)); | |
| 762 | + onMapChange(nextMap); | |
| 763 | + }); | |
| 764 | + useIsoLayoutEffect(() => { | |
| 765 | + if (!isDirtyRef.current && itemsRef.current) { | |
| 766 | + syncRefs(itemsRef.current); | |
| 626 | 767 | } |
| 627 | - } | |
| 628 | - if (trimmedHref.startsWith("#") && !(0, import_url.isValidFragment)(trimmedHref)) { | |
| 629 | - return false; | |
| 630 | - } | |
| 631 | - return true; | |
| 768 | + return () => { | |
| 769 | + elementsRef.current = []; | |
| 770 | + if (labelsRef) { | |
| 771 | + labelsRef.current = []; | |
| 772 | + } | |
| 773 | + }; | |
| 774 | + }, [elementsRef, labelsRef, syncRefs]); | |
| 775 | + useIsoLayoutEffect(() => { | |
| 776 | + if (isDirtyRef.current) { | |
| 777 | + flush(); | |
| 778 | + } | |
| 779 | + }); | |
| 780 | + useIsoLayoutEffect(() => { | |
| 781 | + return () => { | |
| 782 | + mutationObserverRef.current?.disconnect(); | |
| 783 | + isDirtyRef.current = true; | |
| 784 | + }; | |
| 785 | + }, []); | |
| 786 | + const subscribeMapChange = useStableCallback((fn) => { | |
| 787 | + listeners.add(fn); | |
| 788 | + return () => { | |
| 789 | + listeners.delete(fn); | |
| 790 | + }; | |
| 791 | + }); | |
| 792 | + const contextValue = React6.useMemo(() => ({ | |
| 793 | + register, | |
| 794 | + unregister, | |
| 795 | + subscribeMapChange, | |
| 796 | + nextIndexRef | |
| 797 | + }), [register, unregister, subscribeMapChange, nextIndexRef]); | |
| 798 | + return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CompositeListContext.Provider, { | |
| 799 | + value: contextValue, | |
| 800 | + children | |
| 801 | + }); | |
| 632 | 802 | } |
| 633 | - function createLinkFormat({ | |
| 634 | - url, | |
| 635 | - type, | |
| 636 | - id, | |
| 637 | - opensInNewWindow, | |
| 638 | - nofollow, | |
| 639 | - cssClasses | |
| 640 | - }) { | |
| 641 | - const format = { | |
| 642 | - type: "core/link", | |
| 643 | - attributes: { | |
| 644 | - url | |
| 645 | - } | |
| 646 | - }; | |
| 647 | - if (type) { | |
| 648 | - format.attributes.type = type; | |
| 649 | - } | |
| 650 | - if (id) { | |
| 651 | - format.attributes.id = id; | |
| 652 | - } | |
| 653 | - if (opensInNewWindow) { | |
| 654 | - format.attributes.target = "_blank"; | |
| 655 | - format.attributes.rel = format.attributes.rel ? format.attributes.rel + " noopener" : "noopener"; | |
| 656 | - } | |
| 657 | - if (nofollow) { | |
| 658 | - format.attributes.rel = format.attributes.rel ? format.attributes.rel + " nofollow" : "nofollow"; | |
| 659 | - } | |
| 660 | - const trimmedCssClasses = cssClasses?.trim(); | |
| 661 | - if (trimmedCssClasses?.length) { | |
| 662 | - format.attributes.class = trimmedCssClasses; | |
| 663 | - } | |
| 664 | - return format; | |
| 803 | + function createMap() { | |
| 804 | + return /* @__PURE__ */ new Map(); | |
| 665 | 805 | } |
| 666 | - function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) { | |
| 667 | - const EMPTY_BOUNDARIES = { | |
| 668 | - start: void 0, | |
| 669 | - end: void 0 | |
| 670 | - }; | |
| 671 | - const { formats } = value; | |
| 672 | - let targetFormat; | |
| 673 | - let initialIndex; | |
| 674 | - if (!formats?.length) { | |
| 675 | - return EMPTY_BOUNDARIES; | |
| 676 | - } | |
| 677 | - const newFormats = formats.slice(); | |
| 678 | - const formatAtStart = newFormats[startIndex]?.find( | |
| 679 | - ({ type }) => type === format.type | |
| 680 | - ); | |
| 681 | - const formatAtEnd = newFormats[endIndex]?.find( | |
| 682 | - ({ type }) => type === format.type | |
| 683 | - ); | |
| 684 | - const formatAtEndMinusOne = newFormats[endIndex - 1]?.find( | |
| 685 | - ({ type }) => type === format.type | |
| 686 | - ); | |
| 687 | - if (!!formatAtStart) { | |
| 688 | - targetFormat = formatAtStart; | |
| 689 | - initialIndex = startIndex; | |
| 690 | - } else if (!!formatAtEnd) { | |
| 691 | - targetFormat = formatAtEnd; | |
| 692 | - initialIndex = endIndex; | |
| 693 | - } else if (!!formatAtEndMinusOne) { | |
| 694 | - targetFormat = formatAtEndMinusOne; | |
| 695 | - initialIndex = endIndex - 1; | |
| 696 | - } else { | |
| 697 | - return EMPTY_BOUNDARIES; | |
| 698 | - } | |
| 699 | - const index = newFormats[initialIndex].indexOf(targetFormat); | |
| 700 | - const walkingArgs = [newFormats, initialIndex, targetFormat, index]; | |
| 701 | - startIndex = walkToStart(...walkingArgs); | |
| 702 | - endIndex = walkToEnd(...walkingArgs); | |
| 703 | - startIndex = startIndex < 0 ? 0 : startIndex; | |
| 704 | - return { | |
| 705 | - start: startIndex, | |
| 706 | - end: endIndex + 1 | |
| 707 | - }; | |
| 806 | + function createListeners() { | |
| 807 | + return /* @__PURE__ */ new Set(); | |
| 708 | 808 | } |
| 709 | - function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) { | |
| 710 | - let index = initialIndex; | |
| 711 | - const directions = { | |
| 712 | - forwards: 1, | |
| 713 | - backwards: -1 | |
| 714 | - }; | |
| 715 | - const directionIncrement = directions[direction] || 1; | |
| 716 | - const inverseDirectionIncrement = directionIncrement * -1; | |
| 717 | - while (formats[index] && formats[index][formatIndex] === targetFormatRef) { | |
| 718 | - index = index + directionIncrement; | |
| 809 | + function getCompositeListSnapshot(map) { | |
| 810 | + const reservedIndices = /* @__PURE__ */ new Set(); | |
| 811 | + const items = []; | |
| 812 | + const automaticItems = []; | |
| 813 | + map.forEach((registration, node) => { | |
| 814 | + if (!node.isConnected) { | |
| 815 | + return; | |
| 816 | + } | |
| 817 | + const index2 = registration.index; | |
| 818 | + const item = { | |
| 819 | + index: index2 ?? -1, | |
| 820 | + element: node, | |
| 821 | + registration | |
| 822 | + }; | |
| 823 | + if (index2 === null) { | |
| 824 | + automaticItems.push(item); | |
| 825 | + } else if (index2 >= 0) { | |
| 826 | + reservedIndices.add(index2); | |
| 827 | + items.push(item); | |
| 828 | + } | |
| 829 | + }); | |
| 830 | + let nextAutomaticIndex = 0; | |
| 831 | + automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element)); | |
| 832 | + automaticItems.forEach((item) => { | |
| 833 | + while (reservedIndices.has(nextAutomaticIndex)) { | |
| 834 | + nextAutomaticIndex += 1; | |
| 835 | + } | |
| 836 | + item.index = nextAutomaticIndex; | |
| 837 | + items.push(item); | |
| 838 | + nextAutomaticIndex += 1; | |
| 839 | + }); | |
| 840 | + if (reservedIndices.size > 0) { | |
| 841 | + items.sort((a, b) => a.index - b.index); | |
| 719 | 842 | } |
| 720 | - index = index + inverseDirectionIncrement; | |
| 721 | - return index; | |
| 843 | + return [items, automaticItems.map((item) => item.element)]; | |
| 722 | 844 | } |
| 723 | - var partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs); | |
| 724 | - var walkToStart = partialRight(walkToBoundary, "backwards"); | |
| 725 | - var walkToEnd = partialRight(walkToBoundary, "forwards"); | |
| 726 | - | |
| 727 | - // packages/format-library/build-module/link/css-classes-setting.mjs | |
| 728 | - var import_element4 = __toESM(require_element(), 1); | |
| 729 | - var import_compose = __toESM(require_compose(), 1); | |
| 730 | - var import_i18n5 = __toESM(require_i18n(), 1); | |
| 731 | - var import_components2 = __toESM(require_components(), 1); | |
| 732 | - | |
| 733 | - // node_modules/@base-ui/utils/esm/useRefWithInit.js | |
| 734 | - var React = __toESM(require_react(), 1); | |
| 735 | - var UNINITIALIZED = {}; | |
| 736 | - function useRefWithInit(init, initArg) { | |
| 737 | - const ref = React.useRef(UNINITIALIZED); | |
| 738 | - if (ref.current === UNINITIALIZED) { | |
| 739 | - ref.current = init(initArg); | |
| 845 | + function getCommonAncestor(firstNode, lastNode) { | |
| 846 | + let ancestor = firstNode.parentElement; | |
| 847 | + while (ancestor && !ancestor.contains(lastNode)) { | |
| 848 | + ancestor = ancestor.parentElement; | |
| 740 | 849 | } |
| 741 | - return ref; | |
| 850 | + return ancestor; | |
| 742 | 851 | } |
| 743 | - | |
| 744 | - // node_modules/@base-ui/utils/esm/warn.js | |
| 745 | - var set; | |
| 746 | - if (true) { | |
| 747 | - set = /* @__PURE__ */ new Set(); | |
| 748 | - } | |
| 749 | - function warn(...messages) { | |
| 750 | - if (true) { | |
| 751 | - const messageKey = messages.join(" "); | |
| 752 | - if (!set.has(messageKey)) { | |
| 753 | - set.add(messageKey); | |
| 754 | - console.warn(`Base UI: ${messageKey}`); | |
| 852 | + function hasMovedNode(entries) { | |
| 853 | + for (const entry of entries) { | |
| 854 | + for (let i = 0; i < entry.removedNodes.length; i += 1) { | |
| 855 | + if (entry.removedNodes[i].isConnected) { | |
| 856 | + return true; | |
| 857 | + } | |
| 755 | 858 | } |
| 756 | 859 | } |
| 860 | + return false; | |
| 757 | 861 | } |
| 862 | + function sortByDocumentPosition(a, b) { | |
| 863 | + return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1; | |
| 864 | + } | |
| 758 | 865 | |
| 759 | - // node_modules/@base-ui/react/esm/internals/useRenderElement.js | |
| 760 | - var React4 = __toESM(require_react(), 1); | |
| 866 | + // node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 867 | + var React9 = __toESM(require_react(), 1); | |
| 761 | 868 | |
| 762 | - // node_modules/@base-ui/utils/esm/useMergedRefs.js | |
| 869 | + // node_modules/@base-ui/utils/useMergedRefs.mjs | |
| 763 | 870 | function useMergedRefs(a, b, c, d) { |
| 764 | 871 | const forkRef = useRefWithInit(createForkRef).current; |
| 765 | 872 | if (didChange(forkRef, a, b, c, d)) { |
| 766 | 873 | update(forkRef, [a, b, c, d]); |
| @@ -784,9 +891,9 @@ | ||
| 784 | 891 | function didChange(forkRef, a, b, c, d) { |
| 785 | 892 | return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; |
| 786 | 893 | } |
| 787 | 894 | function didChangeN(forkRef, newRefs) { |
| 788 | - return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); | |
| 895 | + return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); | |
| 789 | 896 | } |
| 790 | 897 | function update(forkRef, refs) { |
| 791 | 898 | forkRef.refs = refs; |
| 792 | 899 | if (refs.every((ref) => ref == null)) { |
| @@ -831,9 +938,9 @@ | ||
| 831 | 938 | const cleanupCallback = cleanupCallbacks[i]; |
| 832 | 939 | if (typeof cleanupCallback === "function") { |
| 833 | 940 | cleanupCallback(); |
| 834 | 941 | } else { |
| 835 | - ref(null); | |
| 942 | + void ref(null); | |
| 836 | 943 | } |
| 837 | 944 | break; |
| 838 | 945 | } |
| 839 | 946 | case "object": { |
| @@ -847,21 +954,21 @@ | ||
| 847 | 954 | } |
| 848 | 955 | }; |
| 849 | 956 | } |
| 850 | 957 | |
| 851 | - // node_modules/@base-ui/utils/esm/getReactElementRef.js | |
| 852 | - var React3 = __toESM(require_react(), 1); | |
| 958 | + // node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 959 | + var React8 = __toESM(require_react(), 1); | |
| 853 | 960 | |
| 854 | - // node_modules/@base-ui/utils/esm/reactVersion.js | |
| 855 | - var React2 = __toESM(require_react(), 1); | |
| 856 | - var majorVersion = parseInt(React2.version, 10); | |
| 961 | + // node_modules/@base-ui/utils/reactVersion.mjs | |
| 962 | + var React7 = __toESM(require_react(), 1); | |
| 963 | + var majorVersion = parseInt(React7.version, 10); | |
| 857 | 964 | function isReactVersionAtLeast(reactVersionToCheck) { |
| 858 | 965 | return majorVersion >= reactVersionToCheck; |
| 859 | 966 | } |
| 860 | 967 | |
| 861 | - // node_modules/@base-ui/utils/esm/getReactElementRef.js | |
| 968 | + // node_modules/@base-ui/utils/getReactElementRef.mjs | |
| 862 | 969 | function getReactElementRef(element) { |
| 863 | - if (!/* @__PURE__ */ React3.isValidElement(element)) { | |
| 970 | + if (!/* @__PURE__ */ React8.isValidElement(element)) { | |
| 864 | 971 | return null; |
| 865 | 972 | } |
| 866 | 973 | const reactElement = element; |
| 867 | 974 | const propsWithRef = reactElement.props; |
| @@ -867,9 +974,9 @@ | ||
| 867 | 974 | const propsWithRef = reactElement.props; |
| 868 | 975 | return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; |
| 869 | 976 | } |
| 870 | 977 | |
| 871 | - // node_modules/@base-ui/utils/esm/mergeObjects.js | |
| 978 | + // node_modules/@base-ui/utils/mergeObjects.mjs | |
| 872 | 979 | function mergeObjects(a, b) { |
| 873 | 980 | if (a && !b) { |
| 874 | 981 | return a; |
| 875 | 982 | } |
| @@ -884,13 +991,9 @@ | ||
| 884 | 991 | } |
| 885 | 992 | return void 0; |
| 886 | 993 | } |
| 887 | 994 | |
| 888 | - // node_modules/@base-ui/utils/esm/empty.js | |
| 889 | - var EMPTY_ARRAY = Object.freeze([]); | |
| 890 | - var EMPTY_OBJECT = Object.freeze({}); | |
| 891 | - | |
| 892 | - // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js | |
| 995 | + // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs | |
| 893 | 996 | function getStateAttributesProps(state, customMapping) { |
| 894 | 997 | const props = {}; |
| 895 | 998 | for (const key in state) { |
| 896 | 999 | const value = state[key]; |
| @@ -909,19 +1012,19 @@ | ||
| 909 | 1012 | } |
| 910 | 1013 | return props; |
| 911 | 1014 | } |
| 912 | 1015 | |
| 913 | - // node_modules/@base-ui/react/esm/utils/resolveClassName.js | |
| 1016 | + // node_modules/@base-ui/react/utils/resolveClassName.mjs | |
| 914 | 1017 | function resolveClassName(className, state) { |
| 915 | 1018 | return typeof className === "function" ? className(state) : className; |
| 916 | 1019 | } |
| 917 | 1020 | |
| 918 | - // node_modules/@base-ui/react/esm/utils/resolveStyle.js | |
| 1021 | + // node_modules/@base-ui/react/utils/resolveStyle.mjs | |
| 919 | 1022 | function resolveStyle(style, state) { |
| 920 | 1023 | return typeof style === "function" ? style(state) : style; |
| 921 | 1024 | } |
| 922 | 1025 | |
| 923 | - // node_modules/@base-ui/react/esm/merge-props/mergeProps.js | |
| 1026 | + // node_modules/@base-ui/react/merge-props/mergeProps.mjs | |
| 924 | 1027 | var EMPTY_PROPS = {}; |
| 925 | 1028 | function mergeProps(a, b, c, d, e) { |
| 926 | 1029 | if (!c && !d && !e && !a) { |
| 927 | 1030 | return createInitialMergedProps(b); |
| @@ -1074,13 +1177,16 @@ | ||
| 1074 | 1177 | function isSyntheticEvent(event) { |
| 1075 | 1178 | return event != null && typeof event === "object" && "nativeEvent" in event; |
| 1076 | 1179 | } |
| 1077 | 1180 | |
| 1078 | - // node_modules/@base-ui/react/esm/internals/useRenderElement.js | |
| 1181 | + // node_modules/@base-ui/react/internals/useRenderElement.mjs | |
| 1079 | 1182 | var import_react = __toESM(require_react(), 1); |
| 1080 | 1183 | function useRenderElement(element, componentProps, params = {}) { |
| 1081 | - const renderProp = componentProps.render; | |
| 1082 | - const outProps = useRenderElementProps(componentProps, params); | |
| 1184 | + let renderProp = componentProps.render; | |
| 1185 | + if (params.enabled !== false) { | |
| 1186 | + renderProp = unwrapLazyRenderProp(renderProp); | |
| 1187 | + } | |
| 1188 | + const outProps = useRenderElementProps(componentProps, params, renderProp); | |
| 1083 | 1189 | if (params.enabled === false) { |
| 1084 | 1190 | return null; |
| 1085 | 1191 | } |
| 1086 | 1192 | const state = params.state ?? EMPTY_OBJECT; |
| @@ -1085,29 +1191,28 @@ | ||
| 1085 | 1191 | } |
| 1086 | 1192 | const state = params.state ?? EMPTY_OBJECT; |
| 1087 | 1193 | return evaluateRenderProp(element, renderProp, outProps, state); |
| 1088 | 1194 | } |
| 1089 | - function useRenderElementProps(componentProps, params = {}) { | |
| 1195 | + function useRenderElementProps(componentProps, params, renderProp) { | |
| 1090 | 1196 | const { |
| 1091 | 1197 | className: classNameProp, |
| 1092 | - style: styleProp, | |
| 1093 | - render: renderProp | |
| 1198 | + style: styleProp | |
| 1094 | 1199 | } = componentProps; |
| 1095 | 1200 | const { |
| 1096 | 1201 | state = EMPTY_OBJECT, |
| 1097 | 1202 | ref, |
| 1098 | 1203 | props, |
| 1099 | - stateAttributesMapping, | |
| 1204 | + stateAttributesMapping: stateAttributesMapping4, | |
| 1100 | 1205 | enabled = true |
| 1101 | 1206 | } = params; |
| 1102 | 1207 | const className = enabled ? resolveClassName(classNameProp, state) : void 0; |
| 1103 | 1208 | const style = enabled ? resolveStyle(styleProp, state) : void 0; |
| 1104 | - const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; | |
| 1209 | + const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping4) : EMPTY_OBJECT; | |
| 1105 | 1210 | const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; |
| 1106 | 1211 | const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; |
| 1107 | 1212 | if (typeof document !== "undefined") { |
| 1108 | 1213 | if (!enabled) { |
| 1109 | - useMergedRefs(null, null); | |
| 1214 | + void useMergedRefs(null, null); | |
| 1110 | 1215 | } else if (Array.isArray(ref)) { |
| 1111 | 1216 | outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); |
| 1112 | 1217 | } else { |
| 1113 | 1218 | outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); |
| @@ -1132,8 +1237,15 @@ | ||
| 1132 | 1237 | } |
| 1133 | 1238 | var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); |
| 1134 | 1239 | var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; |
| 1135 | 1240 | var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; |
| 1241 | + function unwrapLazyRenderProp(render) { | |
| 1242 | + if (render?.$$typeof !== REACT_LAZY_TYPE) { | |
| 1243 | + return render; | |
| 1244 | + } | |
| 1245 | + const unwrapped = React9.Children.toArray(render)[0]; | |
| 1246 | + return /* @__PURE__ */ React9.isValidElement(unwrapped) ? unwrapped : render; | |
| 1247 | + } | |
| 1136 | 1248 | function evaluateRenderProp(element, render, props, state) { |
| 1137 | 1249 | if (render) { |
| 1138 | 1250 | if (typeof render === "function") { |
| 1139 | 1251 | if (true) { |
| @@ -1142,19 +1254,14 @@ | ||
| 1142 | 1254 | return render(props, state); |
| 1143 | 1255 | } |
| 1144 | 1256 | const mergedProps = mergeProps(props, render.props); |
| 1145 | 1257 | mergedProps.ref = props.ref; |
| 1146 | - let newElement = render; | |
| 1147 | - if (newElement?.$$typeof === REACT_LAZY_TYPE) { | |
| 1148 | - const children = React4.Children.toArray(render); | |
| 1149 | - newElement = children[0]; | |
| 1150 | - } | |
| 1151 | 1258 | if (true) { |
| 1152 | - if (!/* @__PURE__ */ React4.isValidElement(newElement)) { | |
| 1259 | + if (!/* @__PURE__ */ React9.isValidElement(render)) { | |
| 1153 | 1260 | 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")); |
| 1154 | 1261 | } |
| 1155 | 1262 | } |
| 1156 | - return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps); | |
| 1263 | + return /* @__PURE__ */ React9.cloneElement(render, mergedProps); | |
| 1157 | 1264 | } |
| 1158 | 1265 | if (element) { |
| 1159 | 1266 | if (typeof element === "string") { |
| 1160 | 1267 | return renderTag(element, props); |
| @@ -1189,18 +1296,3679 @@ | ||
| 1189 | 1296 | ...props, |
| 1190 | 1297 | key: props.key |
| 1191 | 1298 | }); |
| 1192 | 1299 | } |
| 1193 | - return /* @__PURE__ */ React4.createElement(Tag, props); | |
| 1300 | + return /* @__PURE__ */ React9.createElement(Tag, props); | |
| 1194 | 1301 | } |
| 1195 | 1302 | |
| 1196 | - // node_modules/@base-ui/react/esm/use-render/useRender.js | |
| 1303 | + // node_modules/@base-ui/utils/useId.mjs | |
| 1304 | + var React10 = __toESM(require_react(), 1); | |
| 1305 | + var globalId = 0; | |
| 1306 | + function useGlobalId(idOverride, prefix = "mui") { | |
| 1307 | + const [defaultId, setDefaultId] = React10.useState(idOverride); | |
| 1308 | + const id = idOverride || defaultId; | |
| 1309 | + React10.useEffect(() => { | |
| 1310 | + if (defaultId == null) { | |
| 1311 | + globalId += 1; | |
| 1312 | + setDefaultId(`${prefix}-${globalId}`); | |
| 1313 | + } | |
| 1314 | + }, [defaultId, prefix]); | |
| 1315 | + return id; | |
| 1316 | + } | |
| 1317 | + var maybeReactUseId = SafeReact.useId; | |
| 1318 | + function useId(idOverride, prefix) { | |
| 1319 | + if (maybeReactUseId !== void 0) { | |
| 1320 | + const reactId = maybeReactUseId(); | |
| 1321 | + return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); | |
| 1322 | + } | |
| 1323 | + return useGlobalId(idOverride, prefix); | |
| 1324 | + } | |
| 1325 | + | |
| 1326 | + // node_modules/@base-ui/react/internals/useBaseUiId.mjs | |
| 1327 | + function useBaseUiId(idOverride) { | |
| 1328 | + return useId(idOverride, "base-ui"); | |
| 1329 | + } | |
| 1330 | + | |
| 1331 | + // node_modules/@base-ui/react/internals/reason-parts.mjs | |
| 1332 | + var reason_parts_exports = {}; | |
| 1333 | + __export(reason_parts_exports, { | |
| 1334 | + cancelOpen: () => cancelOpen, | |
| 1335 | + chipRemovePress: () => chipRemovePress, | |
| 1336 | + clearPress: () => clearPress, | |
| 1337 | + closePress: () => closePress, | |
| 1338 | + closeWatcher: () => closeWatcher, | |
| 1339 | + decrementPress: () => decrementPress, | |
| 1340 | + disabled: () => disabled, | |
| 1341 | + drag: () => drag, | |
| 1342 | + escapeKey: () => escapeKey, | |
| 1343 | + focusOut: () => focusOut, | |
| 1344 | + imperativeAction: () => imperativeAction, | |
| 1345 | + incrementPress: () => incrementPress, | |
| 1346 | + initial: () => initial, | |
| 1347 | + inputBlur: () => inputBlur, | |
| 1348 | + inputChange: () => inputChange, | |
| 1349 | + inputClear: () => inputClear, | |
| 1350 | + inputPaste: () => inputPaste, | |
| 1351 | + inputPress: () => inputPress, | |
| 1352 | + itemPress: () => itemPress, | |
| 1353 | + keyboard: () => keyboard, | |
| 1354 | + linkPress: () => linkPress, | |
| 1355 | + listNavigation: () => listNavigation, | |
| 1356 | + missing: () => missing, | |
| 1357 | + none: () => none, | |
| 1358 | + outsidePress: () => outsidePress, | |
| 1359 | + pointer: () => pointer, | |
| 1360 | + scrub: () => scrub, | |
| 1361 | + siblingOpen: () => siblingOpen, | |
| 1362 | + swipe: () => swipe, | |
| 1363 | + trackPress: () => trackPress, | |
| 1364 | + triggerFocus: () => triggerFocus, | |
| 1365 | + triggerHover: () => triggerHover, | |
| 1366 | + triggerPress: () => triggerPress, | |
| 1367 | + wheel: () => wheel, | |
| 1368 | + windowResize: () => windowResize | |
| 1369 | + }); | |
| 1370 | + var none = "none"; | |
| 1371 | + var triggerPress = "trigger-press"; | |
| 1372 | + var triggerHover = "trigger-hover"; | |
| 1373 | + var triggerFocus = "trigger-focus"; | |
| 1374 | + var outsidePress = "outside-press"; | |
| 1375 | + var itemPress = "item-press"; | |
| 1376 | + var closePress = "close-press"; | |
| 1377 | + var linkPress = "link-press"; | |
| 1378 | + var clearPress = "clear-press"; | |
| 1379 | + var chipRemovePress = "chip-remove-press"; | |
| 1380 | + var trackPress = "track-press"; | |
| 1381 | + var incrementPress = "increment-press"; | |
| 1382 | + var decrementPress = "decrement-press"; | |
| 1383 | + var inputChange = "input-change"; | |
| 1384 | + var inputClear = "input-clear"; | |
| 1385 | + var inputBlur = "input-blur"; | |
| 1386 | + var inputPaste = "input-paste"; | |
| 1387 | + var inputPress = "input-press"; | |
| 1388 | + var focusOut = "focus-out"; | |
| 1389 | + var escapeKey = "escape-key"; | |
| 1390 | + var closeWatcher = "close-watcher"; | |
| 1391 | + var listNavigation = "list-navigation"; | |
| 1392 | + var keyboard = "keyboard"; | |
| 1393 | + var pointer = "pointer"; | |
| 1394 | + var drag = "drag"; | |
| 1395 | + var wheel = "wheel"; | |
| 1396 | + var scrub = "scrub"; | |
| 1397 | + var cancelOpen = "cancel-open"; | |
| 1398 | + var siblingOpen = "sibling-open"; | |
| 1399 | + var disabled = "disabled"; | |
| 1400 | + var missing = "missing"; | |
| 1401 | + var initial = "initial"; | |
| 1402 | + var imperativeAction = "imperative-action"; | |
| 1403 | + var swipe = "swipe"; | |
| 1404 | + var windowResize = "window-resize"; | |
| 1405 | + | |
| 1406 | + // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs | |
| 1407 | + function createChangeEventDetails(reason, event, trigger, customProperties) { | |
| 1408 | + let canceled = false; | |
| 1409 | + let allowPropagation = false; | |
| 1410 | + const custom = customProperties ?? EMPTY_OBJECT; | |
| 1411 | + const details = { | |
| 1412 | + reason, | |
| 1413 | + event: event ?? new Event("base-ui"), | |
| 1414 | + cancel() { | |
| 1415 | + canceled = true; | |
| 1416 | + }, | |
| 1417 | + allowPropagation() { | |
| 1418 | + allowPropagation = true; | |
| 1419 | + }, | |
| 1420 | + get isCanceled() { | |
| 1421 | + return canceled; | |
| 1422 | + }, | |
| 1423 | + get isPropagationAllowed() { | |
| 1424 | + return allowPropagation; | |
| 1425 | + }, | |
| 1426 | + trigger, | |
| 1427 | + ...custom | |
| 1428 | + }; | |
| 1429 | + return details; | |
| 1430 | + } | |
| 1431 | + | |
| 1432 | + // node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1433 | + var React12 = __toESM(require_react(), 1); | |
| 1434 | + | |
| 1435 | + // node_modules/@base-ui/utils/useOnMount.mjs | |
| 1436 | + var React11 = __toESM(require_react(), 1); | |
| 1437 | + function useOnMount(fn) { | |
| 1438 | + React11.useEffect(fn, EMPTY_ARRAY); | |
| 1439 | + } | |
| 1440 | + | |
| 1441 | + // node_modules/@base-ui/utils/useAnimationFrame.mjs | |
| 1442 | + var EMPTY = null; | |
| 1443 | + var LAST_RAF = globalThis.requestAnimationFrame; | |
| 1444 | + var Scheduler = class { | |
| 1445 | + /* This implementation uses an array as a backing data-structure for frame callbacks. | |
| 1446 | + * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it | |
| 1447 | + * never calls the native `cancelAnimationFrame` if there are no frames left. This can | |
| 1448 | + * be much more efficient if there is a call pattern that alterns as | |
| 1449 | + * "request-cancel-request-cancel-…". | |
| 1450 | + * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation | |
| 1451 | + * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ | |
| 1452 | + callbacks = []; | |
| 1453 | + callbacksCount = 0; | |
| 1454 | + nextId = 1; | |
| 1455 | + startId = 1; | |
| 1456 | + isScheduled = false; | |
| 1457 | + tick = (timestamp) => { | |
| 1458 | + this.isScheduled = false; | |
| 1459 | + const currentCallbacks = this.callbacks; | |
| 1460 | + const currentCallbacksCount = this.callbacksCount; | |
| 1461 | + this.callbacks = []; | |
| 1462 | + this.callbacksCount = 0; | |
| 1463 | + this.startId = this.nextId; | |
| 1464 | + if (currentCallbacksCount > 0) { | |
| 1465 | + for (let i = 0; i < currentCallbacks.length; i += 1) { | |
| 1466 | + currentCallbacks[i]?.(timestamp); | |
| 1467 | + } | |
| 1468 | + } | |
| 1469 | + }; | |
| 1470 | + request(fn) { | |
| 1471 | + const id = this.nextId; | |
| 1472 | + this.nextId += 1; | |
| 1473 | + this.callbacks.push(fn); | |
| 1474 | + this.callbacksCount += 1; | |
| 1475 | + const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); | |
| 1476 | + if (!this.isScheduled || didRAFChange) { | |
| 1477 | + requestAnimationFrame(this.tick); | |
| 1478 | + this.isScheduled = true; | |
| 1479 | + } | |
| 1480 | + return id; | |
| 1481 | + } | |
| 1482 | + cancel(id) { | |
| 1483 | + const index2 = id - this.startId; | |
| 1484 | + if (index2 < 0 || index2 >= this.callbacks.length) { | |
| 1485 | + return; | |
| 1486 | + } | |
| 1487 | + if (this.callbacks[index2] === null) { | |
| 1488 | + return; | |
| 1489 | + } | |
| 1490 | + this.callbacks[index2] = null; | |
| 1491 | + this.callbacksCount -= 1; | |
| 1492 | + } | |
| 1493 | + }; | |
| 1494 | + var scheduler = new Scheduler(); | |
| 1495 | + var AnimationFrame = class _AnimationFrame { | |
| 1496 | + static create() { | |
| 1497 | + return new _AnimationFrame(); | |
| 1498 | + } | |
| 1499 | + static request(fn) { | |
| 1500 | + return scheduler.request(fn); | |
| 1501 | + } | |
| 1502 | + static cancel(id) { | |
| 1503 | + return scheduler.cancel(id); | |
| 1504 | + } | |
| 1505 | + currentId = EMPTY; | |
| 1506 | + /** | |
| 1507 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 1508 | + */ | |
| 1509 | + request(fn) { | |
| 1510 | + this.cancel(); | |
| 1511 | + this.currentId = scheduler.request(() => { | |
| 1512 | + this.currentId = EMPTY; | |
| 1513 | + fn(); | |
| 1514 | + }); | |
| 1515 | + } | |
| 1516 | + cancel = () => { | |
| 1517 | + if (this.currentId !== EMPTY) { | |
| 1518 | + scheduler.cancel(this.currentId); | |
| 1519 | + this.currentId = EMPTY; | |
| 1520 | + } | |
| 1521 | + }; | |
| 1522 | + disposeEffect = () => { | |
| 1523 | + return this.cancel; | |
| 1524 | + }; | |
| 1525 | + }; | |
| 1526 | + function useAnimationFrame() { | |
| 1527 | + const timeout = useRefWithInit(AnimationFrame.create).current; | |
| 1528 | + useOnMount(timeout.disposeEffect); | |
| 1529 | + return timeout; | |
| 1530 | + } | |
| 1531 | + | |
| 1532 | + // node_modules/@base-ui/react/internals/useTransitionStatus.mjs | |
| 1533 | + function useTransitionStatus(open, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { | |
| 1534 | + const [transitionStatus, setTransitionStatus] = React12.useState(open && enableIdleState ? "idle" : void 0); | |
| 1535 | + const [mounted, setMounted] = React12.useState(open && !animateInitialOpen); | |
| 1536 | + if (open && !mounted) { | |
| 1537 | + setMounted(true); | |
| 1538 | + setTransitionStatus("starting"); | |
| 1539 | + } | |
| 1540 | + if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { | |
| 1541 | + setTransitionStatus("ending"); | |
| 1542 | + } | |
| 1543 | + if (!open && !mounted && transitionStatus === "ending") { | |
| 1544 | + setTransitionStatus(void 0); | |
| 1545 | + } | |
| 1546 | + useIsoLayoutEffect(() => { | |
| 1547 | + if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { | |
| 1548 | + const frame = AnimationFrame.request(() => { | |
| 1549 | + setTransitionStatus("ending"); | |
| 1550 | + }); | |
| 1551 | + return () => { | |
| 1552 | + AnimationFrame.cancel(frame); | |
| 1553 | + }; | |
| 1554 | + } | |
| 1555 | + return void 0; | |
| 1556 | + }, [open, mounted, transitionStatus, deferEndingState]); | |
| 1557 | + useIsoLayoutEffect(() => { | |
| 1558 | + if (!open || enableIdleState) { | |
| 1559 | + return void 0; | |
| 1560 | + } | |
| 1561 | + const frame = AnimationFrame.request(() => { | |
| 1562 | + setTransitionStatus(void 0); | |
| 1563 | + }); | |
| 1564 | + return () => { | |
| 1565 | + AnimationFrame.cancel(frame); | |
| 1566 | + }; | |
| 1567 | + }, [enableIdleState, open]); | |
| 1568 | + useIsoLayoutEffect(() => { | |
| 1569 | + if (!open || !enableIdleState) { | |
| 1570 | + return void 0; | |
| 1571 | + } | |
| 1572 | + if (open && mounted && transitionStatus !== "idle") { | |
| 1573 | + setTransitionStatus("starting"); | |
| 1574 | + } | |
| 1575 | + const frame = AnimationFrame.request(() => { | |
| 1576 | + setTransitionStatus("idle"); | |
| 1577 | + }); | |
| 1578 | + return () => { | |
| 1579 | + AnimationFrame.cancel(frame); | |
| 1580 | + }; | |
| 1581 | + }, [enableIdleState, open, mounted, transitionStatus]); | |
| 1582 | + return { | |
| 1583 | + mounted, | |
| 1584 | + setMounted, | |
| 1585 | + transitionStatus | |
| 1586 | + }; | |
| 1587 | + } | |
| 1588 | + | |
| 1589 | + // node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs | |
| 1590 | + var React13 = __toESM(require_react(), 1); | |
| 1591 | + function useCompositeListItem(params = {}) { | |
| 1592 | + const { | |
| 1593 | + guess, | |
| 1594 | + label, | |
| 1595 | + metadata, | |
| 1596 | + textRef, | |
| 1597 | + index: externalIndex | |
| 1598 | + } = params; | |
| 1599 | + const { | |
| 1600 | + register, | |
| 1601 | + unregister, | |
| 1602 | + subscribeMapChange, | |
| 1603 | + nextIndexRef | |
| 1604 | + } = useCompositeListContext(); | |
| 1605 | + const indexRef = React13.useRef(-1); | |
| 1606 | + const [internalIndex, setInternalIndex] = React13.useState(externalIndex == null && guess ? () => { | |
| 1607 | + if (indexRef.current === -1) { | |
| 1608 | + const newIndex = nextIndexRef.current; | |
| 1609 | + nextIndexRef.current += 1; | |
| 1610 | + indexRef.current = newIndex; | |
| 1611 | + } | |
| 1612 | + return indexRef.current; | |
| 1613 | + } : -1); | |
| 1614 | + const index2 = externalIndex ?? internalIndex; | |
| 1615 | + const componentRef = React13.useRef(null); | |
| 1616 | + const ref = React13.useCallback((node) => { | |
| 1617 | + const previousNode = componentRef.current; | |
| 1618 | + if (previousNode) { | |
| 1619 | + unregister(previousNode); | |
| 1620 | + } | |
| 1621 | + componentRef.current = node; | |
| 1622 | + if (node) { | |
| 1623 | + register(node, { | |
| 1624 | + metadata: metadata ?? null, | |
| 1625 | + index: externalIndex ?? null, | |
| 1626 | + label, | |
| 1627 | + textRef | |
| 1628 | + }); | |
| 1629 | + } | |
| 1630 | + }, [externalIndex, register, unregister, metadata, label, textRef]); | |
| 1631 | + useIsoLayoutEffect(() => { | |
| 1632 | + if (externalIndex != null) { | |
| 1633 | + return void 0; | |
| 1634 | + } | |
| 1635 | + return subscribeMapChange((map) => { | |
| 1636 | + const i = componentRef.current ? map.get(componentRef.current)?.index : null; | |
| 1637 | + if (i != null) { | |
| 1638 | + setInternalIndex(i); | |
| 1639 | + } | |
| 1640 | + }); | |
| 1641 | + }, [externalIndex, subscribeMapChange]); | |
| 1642 | + return { | |
| 1643 | + ref, | |
| 1644 | + index: index2 | |
| 1645 | + }; | |
| 1646 | + } | |
| 1647 | + | |
| 1648 | + // node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs | |
| 1649 | + var TransitionStatusDataAttributes_exports = {}; | |
| 1650 | + __export(TransitionStatusDataAttributes_exports, { | |
| 1651 | + endingStyle: () => endingStyle, | |
| 1652 | + startingStyle: () => startingStyle | |
| 1653 | + }); | |
| 1654 | + var startingStyle = "data-starting-style"; | |
| 1655 | + var endingStyle = "data-ending-style"; | |
| 1656 | + | |
| 1657 | + // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs | |
| 1658 | + var STARTING_HOOK = { | |
| 1659 | + [startingStyle]: "" | |
| 1660 | + }; | |
| 1661 | + var ENDING_HOOK = { | |
| 1662 | + [endingStyle]: "" | |
| 1663 | + }; | |
| 1664 | + var transitionStatusMapping = { | |
| 1665 | + transitionStatus(value) { | |
| 1666 | + if (value === "starting") { | |
| 1667 | + return STARTING_HOOK; | |
| 1668 | + } | |
| 1669 | + if (value === "ending") { | |
| 1670 | + return ENDING_HOOK; | |
| 1671 | + } | |
| 1672 | + return null; | |
| 1673 | + } | |
| 1674 | + }; | |
| 1675 | + | |
| 1676 | + // node_modules/@base-ui/react/internals/use-button/useButton.mjs | |
| 1677 | + var React16 = __toESM(require_react(), 1); | |
| 1678 | + | |
| 1679 | + // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs | |
| 1680 | + function hasWindow() { | |
| 1681 | + return typeof window !== "undefined"; | |
| 1682 | + } | |
| 1683 | + function getNodeName(node) { | |
| 1684 | + if (isNode(node)) { | |
| 1685 | + return (node.nodeName || "").toLowerCase(); | |
| 1686 | + } | |
| 1687 | + return "#document"; | |
| 1688 | + } | |
| 1689 | + function getWindow(node) { | |
| 1690 | + var _node$ownerDocument; | |
| 1691 | + return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; | |
| 1692 | + } | |
| 1693 | + function getDocumentElement(node) { | |
| 1694 | + var _ref; | |
| 1695 | + return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; | |
| 1696 | + } | |
| 1697 | + function isNode(value) { | |
| 1698 | + if (!hasWindow()) { | |
| 1699 | + return false; | |
| 1700 | + } | |
| 1701 | + return value instanceof Node || value instanceof getWindow(value).Node; | |
| 1702 | + } | |
| 1703 | + function isHTMLElement(value) { | |
| 1704 | + if (!hasWindow()) { | |
| 1705 | + return false; | |
| 1706 | + } | |
| 1707 | + return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; | |
| 1708 | + } | |
| 1709 | + function isShadowRoot(value) { | |
| 1710 | + if (!hasWindow() || typeof ShadowRoot === "undefined") { | |
| 1711 | + return false; | |
| 1712 | + } | |
| 1713 | + return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; | |
| 1714 | + } | |
| 1715 | + function isLastTraversableNode(node) { | |
| 1716 | + return /^(html|body|#document)$/.test(getNodeName(node)); | |
| 1717 | + } | |
| 1718 | + function getComputedStyle2(element) { | |
| 1719 | + return getWindow(element).getComputedStyle(element); | |
| 1720 | + } | |
| 1721 | + function getParentNode(node) { | |
| 1722 | + if (getNodeName(node) === "html") { | |
| 1723 | + return node; | |
| 1724 | + } | |
| 1725 | + const result = ( | |
| 1726 | + // Step into the shadow DOM of the parent of a slotted node. | |
| 1727 | + node.assignedSlot || // DOM Element detected. | |
| 1728 | + node.parentNode || // ShadowRoot detected. | |
| 1729 | + isShadowRoot(node) && node.host || // Fallback. | |
| 1730 | + getDocumentElement(node) | |
| 1731 | + ); | |
| 1732 | + return isShadowRoot(result) ? result.host : result; | |
| 1733 | + } | |
| 1734 | + | |
| 1735 | + // node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs | |
| 1736 | + var React14 = __toESM(require_react(), 1); | |
| 1737 | + var CompositeRootContext = /* @__PURE__ */ React14.createContext(void 0); | |
| 1738 | + if (true) CompositeRootContext.displayName = "CompositeRootContext"; | |
| 1739 | + function useCompositeRootContext(optional = false) { | |
| 1740 | + const context = React14.useContext(CompositeRootContext); | |
| 1741 | + if (context === void 0 && !optional) { | |
| 1742 | + throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); | |
| 1743 | + } | |
| 1744 | + return context; | |
| 1745 | + } | |
| 1746 | + | |
| 1747 | + // node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs | |
| 1748 | + var React15 = __toESM(require_react(), 1); | |
| 1749 | + function useFocusableWhenDisabled(parameters) { | |
| 1750 | + const { | |
| 1751 | + focusableWhenDisabled, | |
| 1752 | + disabled: disabled2, | |
| 1753 | + composite = false, | |
| 1754 | + tabIndex: tabIndexProp = 0, | |
| 1755 | + isNativeButton | |
| 1756 | + } = parameters; | |
| 1757 | + const isFocusableComposite = composite && focusableWhenDisabled !== false; | |
| 1758 | + const isNonFocusableComposite = composite && focusableWhenDisabled === false; | |
| 1759 | + const props = React15.useMemo(() => { | |
| 1760 | + const additionalProps = { | |
| 1761 | + // allow Tabbing away from focusableWhenDisabled elements | |
| 1762 | + onKeyDown(event) { | |
| 1763 | + if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { | |
| 1764 | + event.preventDefault(); | |
| 1765 | + } | |
| 1766 | + } | |
| 1767 | + }; | |
| 1768 | + if (!composite) { | |
| 1769 | + additionalProps.tabIndex = tabIndexProp; | |
| 1770 | + if (!isNativeButton && disabled2) { | |
| 1771 | + additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; | |
| 1772 | + } | |
| 1773 | + } | |
| 1774 | + if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { | |
| 1775 | + additionalProps["aria-disabled"] = disabled2; | |
| 1776 | + } | |
| 1777 | + if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { | |
| 1778 | + additionalProps.disabled = disabled2; | |
| 1779 | + } | |
| 1780 | + return additionalProps; | |
| 1781 | + }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); | |
| 1782 | + return { | |
| 1783 | + props | |
| 1784 | + }; | |
| 1785 | + } | |
| 1786 | + | |
| 1787 | + // node_modules/@base-ui/utils/owner.mjs | |
| 1788 | + function ownerDocument(node) { | |
| 1789 | + return node?.ownerDocument || document; | |
| 1790 | + } | |
| 1791 | + | |
| 1792 | + // node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs | |
| 1793 | + function dispatchClickWithModifiers(target, sourceEvent, { | |
| 1794 | + detail = 0 | |
| 1795 | + } = {}) { | |
| 1796 | + target.dispatchEvent(new (getWindow(target)).PointerEvent("click", { | |
| 1797 | + bubbles: true, | |
| 1798 | + cancelable: true, | |
| 1799 | + composed: true, | |
| 1800 | + detail, | |
| 1801 | + shiftKey: sourceEvent.shiftKey, | |
| 1802 | + ctrlKey: sourceEvent.ctrlKey, | |
| 1803 | + altKey: sourceEvent.altKey, | |
| 1804 | + metaKey: sourceEvent.metaKey | |
| 1805 | + })); | |
| 1806 | + } | |
| 1807 | + | |
| 1808 | + // node_modules/@base-ui/react/internals/use-button/useButton.mjs | |
| 1809 | + function useButton(parameters = {}) { | |
| 1810 | + const { | |
| 1811 | + disabled: disabled2 = false, | |
| 1812 | + focusableWhenDisabled, | |
| 1813 | + tabIndex = 0, | |
| 1814 | + native: isNativeButton = true, | |
| 1815 | + composite: compositeProp | |
| 1816 | + } = parameters; | |
| 1817 | + const elementRef = React16.useRef(null); | |
| 1818 | + const compositeRootContext = useCompositeRootContext(true); | |
| 1819 | + const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; | |
| 1820 | + const { | |
| 1821 | + props: focusableWhenDisabledProps | |
| 1822 | + } = useFocusableWhenDisabled({ | |
| 1823 | + focusableWhenDisabled, | |
| 1824 | + disabled: disabled2, | |
| 1825 | + composite: isCompositeItem, | |
| 1826 | + tabIndex, | |
| 1827 | + isNativeButton | |
| 1828 | + }); | |
| 1829 | + if (true) { | |
| 1830 | + React16.useEffect(() => { | |
| 1831 | + if (!elementRef.current) { | |
| 1832 | + return; | |
| 1833 | + } | |
| 1834 | + const isButtonTag = isButtonElement(elementRef.current); | |
| 1835 | + if (isNativeButton) { | |
| 1836 | + if (!isButtonTag) { | |
| 1837 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 1838 | + 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`."; | |
| 1839 | + error(`${message}${ownerStackMessage}`); | |
| 1840 | + } | |
| 1841 | + } else if (isButtonTag) { | |
| 1842 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 1843 | + 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`."; | |
| 1844 | + error(`${message}${ownerStackMessage}`); | |
| 1845 | + } | |
| 1846 | + }, [isNativeButton]); | |
| 1847 | + } | |
| 1848 | + const updateDisabled = React16.useCallback(() => { | |
| 1849 | + const element = elementRef.current; | |
| 1850 | + if (!isButtonElement(element)) { | |
| 1851 | + return; | |
| 1852 | + } | |
| 1853 | + if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { | |
| 1854 | + element.disabled = false; | |
| 1855 | + } | |
| 1856 | + }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); | |
| 1857 | + useIsoLayoutEffect(updateDisabled, [updateDisabled]); | |
| 1858 | + const getButtonProps = React16.useCallback((externalProps = {}) => { | |
| 1859 | + const { | |
| 1860 | + onClick: externalOnClick, | |
| 1861 | + onMouseDown: externalOnMouseDown, | |
| 1862 | + onKeyUp: externalOnKeyUp, | |
| 1863 | + onKeyDown: externalOnKeyDown, | |
| 1864 | + onPointerDown: externalOnPointerDown, | |
| 1865 | + ...otherExternalProps | |
| 1866 | + } = externalProps; | |
| 1867 | + return mergeProps({ | |
| 1868 | + onClick(event) { | |
| 1869 | + if (disabled2) { | |
| 1870 | + event.preventDefault(); | |
| 1871 | + return; | |
| 1872 | + } | |
| 1873 | + externalOnClick?.(event); | |
| 1874 | + }, | |
| 1875 | + onMouseDown(event) { | |
| 1876 | + if (!disabled2) { | |
| 1877 | + externalOnMouseDown?.(event); | |
| 1878 | + } | |
| 1879 | + }, | |
| 1880 | + onKeyDown(event) { | |
| 1881 | + if (disabled2) { | |
| 1882 | + return; | |
| 1883 | + } | |
| 1884 | + makeEventPreventable(event); | |
| 1885 | + externalOnKeyDown?.(event); | |
| 1886 | + if (event.baseUIHandlerPrevented) { | |
| 1887 | + return; | |
| 1888 | + } | |
| 1889 | + const isCurrentTarget = event.target === event.currentTarget; | |
| 1890 | + const currentTarget = event.currentTarget; | |
| 1891 | + const isButton = isButtonElement(currentTarget); | |
| 1892 | + const isLink = !isNativeButton && isValidLinkElement(currentTarget); | |
| 1893 | + const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); | |
| 1894 | + const isEnterKey = event.key === "Enter"; | |
| 1895 | + const isSpaceKey = event.key === " "; | |
| 1896 | + const role = currentTarget.getAttribute("role"); | |
| 1897 | + const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; | |
| 1898 | + if (isCurrentTarget && isCompositeItem && isSpaceKey) { | |
| 1899 | + if (event.defaultPrevented && isTextNavigationRole) { | |
| 1900 | + return; | |
| 1901 | + } | |
| 1902 | + event.preventDefault(); | |
| 1903 | + if (!isNativeButton || isButton) { | |
| 1904 | + event.preventBaseUIHandler(); | |
| 1905 | + dispatchClickWithModifiers(currentTarget, event); | |
| 1906 | + } | |
| 1907 | + return; | |
| 1908 | + } | |
| 1909 | + if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) { | |
| 1910 | + if (isCurrentTarget && isLink && isSpaceKey) { | |
| 1911 | + event.preventDefault(); | |
| 1912 | + } | |
| 1913 | + return; | |
| 1914 | + } | |
| 1915 | + if (event.defaultPrevented) { | |
| 1916 | + return; | |
| 1917 | + } | |
| 1918 | + event.preventDefault(); | |
| 1919 | + if (isEnterKey) { | |
| 1920 | + event.preventBaseUIHandler(); | |
| 1921 | + dispatchClickWithModifiers(currentTarget, event); | |
| 1922 | + } | |
| 1923 | + }, | |
| 1924 | + onKeyUp(event) { | |
| 1925 | + if (disabled2) { | |
| 1926 | + return; | |
| 1927 | + } | |
| 1928 | + makeEventPreventable(event); | |
| 1929 | + externalOnKeyUp?.(event); | |
| 1930 | + if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { | |
| 1931 | + event.preventDefault(); | |
| 1932 | + return; | |
| 1933 | + } | |
| 1934 | + if (event.baseUIHandlerPrevented) { | |
| 1935 | + return; | |
| 1936 | + } | |
| 1937 | + if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") { | |
| 1938 | + event.preventBaseUIHandler(); | |
| 1939 | + dispatchClickWithModifiers(event.currentTarget, event); | |
| 1940 | + } | |
| 1941 | + }, | |
| 1942 | + onPointerDown(event) { | |
| 1943 | + if (disabled2) { | |
| 1944 | + event.preventDefault(); | |
| 1945 | + return; | |
| 1946 | + } | |
| 1947 | + externalOnPointerDown?.(event); | |
| 1948 | + } | |
| 1949 | + }, isNativeButton ? { | |
| 1950 | + type: "button" | |
| 1951 | + } : { | |
| 1952 | + role: "button" | |
| 1953 | + }, focusableWhenDisabledProps, otherExternalProps); | |
| 1954 | + }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); | |
| 1955 | + const buttonRef = useStableCallback((element) => { | |
| 1956 | + elementRef.current = element; | |
| 1957 | + updateDisabled(); | |
| 1958 | + }); | |
| 1959 | + return { | |
| 1960 | + getButtonProps, | |
| 1961 | + buttonRef | |
| 1962 | + }; | |
| 1963 | + } | |
| 1964 | + function isButtonElement(elem) { | |
| 1965 | + return isHTMLElement(elem) && elem.tagName === "BUTTON"; | |
| 1966 | + } | |
| 1967 | + function isValidLinkElement(elem) { | |
| 1968 | + return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href); | |
| 1969 | + } | |
| 1970 | + | |
| 1971 | + // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 1972 | + var React17 = __toESM(require_react(), 1); | |
| 1973 | + | |
| 1974 | + // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 1975 | + var ReactDOM = __toESM(require_react_dom(), 1); | |
| 1976 | + | |
| 1977 | + // node_modules/@base-ui/react/utils/resolveRef.mjs | |
| 1978 | + function resolveRef(maybeRef) { | |
| 1979 | + if (maybeRef == null) { | |
| 1980 | + return maybeRef; | |
| 1981 | + } | |
| 1982 | + return "current" in maybeRef ? maybeRef.current : maybeRef; | |
| 1983 | + } | |
| 1984 | + | |
| 1985 | + // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs | |
| 1986 | + var pendingCallbacks = null; | |
| 1987 | + function flushBeforePaint(fn) { | |
| 1988 | + if (!pendingCallbacks) { | |
| 1989 | + const callbacks = []; | |
| 1990 | + pendingCallbacks = callbacks; | |
| 1991 | + queueMicrotask(() => { | |
| 1992 | + pendingCallbacks = null; | |
| 1993 | + ReactDOM.flushSync(() => { | |
| 1994 | + for (const callback of callbacks) { | |
| 1995 | + callback(); | |
| 1996 | + } | |
| 1997 | + }); | |
| 1998 | + }); | |
| 1999 | + } | |
| 2000 | + pendingCallbacks.push(fn); | |
| 2001 | + } | |
| 2002 | + function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) { | |
| 2003 | + const frame = useAnimationFrame(); | |
| 2004 | + return useStableCallback((fnToExecute, signal = null) => { | |
| 2005 | + frame.cancel(); | |
| 2006 | + const element = resolveRef(elementOrRef); | |
| 2007 | + if (element == null) { | |
| 2008 | + return; | |
| 2009 | + } | |
| 2010 | + const resolvedElement = element; | |
| 2011 | + const done = () => { | |
| 2012 | + if (!batch) { | |
| 2013 | + ReactDOM.flushSync(fnToExecute); | |
| 2014 | + return; | |
| 2015 | + } | |
| 2016 | + flushBeforePaint(() => { | |
| 2017 | + if (!signal?.aborted) { | |
| 2018 | + fnToExecute(); | |
| 2019 | + } | |
| 2020 | + }); | |
| 2021 | + }; | |
| 2022 | + if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { | |
| 2023 | + fnToExecute(); | |
| 2024 | + return; | |
| 2025 | + } | |
| 2026 | + function exec() { | |
| 2027 | + Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { | |
| 2028 | + if (!signal?.aborted) { | |
| 2029 | + done(); | |
| 2030 | + } | |
| 2031 | + }, () => { | |
| 2032 | + if (signal?.aborted) { | |
| 2033 | + return; | |
| 2034 | + } | |
| 2035 | + const currentAnimations = resolvedElement.getAnimations(); | |
| 2036 | + if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { | |
| 2037 | + exec(); | |
| 2038 | + return; | |
| 2039 | + } | |
| 2040 | + done(); | |
| 2041 | + }); | |
| 2042 | + } | |
| 2043 | + if (waitForStartingStyleRemoved) { | |
| 2044 | + const startingStyleAttribute = startingStyle; | |
| 2045 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 2046 | + frame.request(exec); | |
| 2047 | + return; | |
| 2048 | + } | |
| 2049 | + const attributeObserver = new MutationObserver(() => { | |
| 2050 | + if (!resolvedElement.hasAttribute(startingStyleAttribute)) { | |
| 2051 | + attributeObserver.disconnect(); | |
| 2052 | + exec(); | |
| 2053 | + } | |
| 2054 | + }); | |
| 2055 | + attributeObserver.observe(resolvedElement, { | |
| 2056 | + attributes: true, | |
| 2057 | + attributeFilter: [startingStyleAttribute] | |
| 2058 | + }); | |
| 2059 | + signal?.addEventListener("abort", () => attributeObserver.disconnect(), { | |
| 2060 | + once: true | |
| 2061 | + }); | |
| 2062 | + return; | |
| 2063 | + } | |
| 2064 | + frame.request(exec); | |
| 2065 | + }); | |
| 2066 | + } | |
| 2067 | + | |
| 2068 | + // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs | |
| 2069 | + function useOpenChangeComplete(parameters) { | |
| 2070 | + const { | |
| 2071 | + enabled = true, | |
| 2072 | + open, | |
| 2073 | + ref, | |
| 2074 | + batch = false, | |
| 2075 | + onComplete: onCompleteParam | |
| 2076 | + } = parameters; | |
| 2077 | + const onComplete = useStableCallback(onCompleteParam); | |
| 2078 | + const runOnceAnimationsFinish = useAnimationsFinished(ref, open, batch); | |
| 2079 | + React17.useEffect(() => { | |
| 2080 | + if (!enabled) { | |
| 2081 | + return void 0; | |
| 2082 | + } | |
| 2083 | + const abortController = new AbortController(); | |
| 2084 | + runOnceAnimationsFinish(onComplete, abortController.signal); | |
| 2085 | + return () => { | |
| 2086 | + abortController.abort(); | |
| 2087 | + }; | |
| 2088 | + }, [enabled, open, onComplete, runOnceAnimationsFinish]); | |
| 2089 | + } | |
| 2090 | + | |
| 2091 | + // node_modules/@base-ui/utils/useTimeout.mjs | |
| 2092 | + var EMPTY2 = 0; | |
| 2093 | + var Timeout = class _Timeout { | |
| 2094 | + static create() { | |
| 2095 | + return new _Timeout(); | |
| 2096 | + } | |
| 2097 | + currentId = EMPTY2; | |
| 2098 | + /** | |
| 2099 | + * Executes `fn` after `delay`, clearing any previously scheduled call. | |
| 2100 | + */ | |
| 2101 | + start(delay, fn) { | |
| 2102 | + this.clear(); | |
| 2103 | + this.currentId = setTimeout(() => { | |
| 2104 | + this.currentId = EMPTY2; | |
| 2105 | + fn(); | |
| 2106 | + }, delay); | |
| 2107 | + } | |
| 2108 | + isStarted() { | |
| 2109 | + return this.currentId !== EMPTY2; | |
| 2110 | + } | |
| 2111 | + clear = () => { | |
| 2112 | + if (this.currentId !== EMPTY2) { | |
| 2113 | + clearTimeout(this.currentId); | |
| 2114 | + this.currentId = EMPTY2; | |
| 2115 | + } | |
| 2116 | + }; | |
| 2117 | + disposeEffect = () => { | |
| 2118 | + return this.clear; | |
| 2119 | + }; | |
| 2120 | + }; | |
| 2121 | + function useTimeout() { | |
| 2122 | + const timeout = useRefWithInit(Timeout.create).current; | |
| 2123 | + useOnMount(timeout.disposeEffect); | |
| 2124 | + return timeout; | |
| 2125 | + } | |
| 2126 | + | |
| 2127 | + // node_modules/@base-ui/utils/shadowDom.mjs | |
| 2128 | + function activeElement(doc) { | |
| 2129 | + let element = doc.activeElement; | |
| 2130 | + while (element?.shadowRoot?.activeElement != null) { | |
| 2131 | + element = element.shadowRoot.activeElement; | |
| 2132 | + } | |
| 2133 | + return element; | |
| 2134 | + } | |
| 2135 | + function contains(parent, child) { | |
| 2136 | + if (!parent || !child) { | |
| 2137 | + return false; | |
| 2138 | + } | |
| 2139 | + const rootNode = child.getRootNode?.(); | |
| 2140 | + if (parent.contains(child)) { | |
| 2141 | + return true; | |
| 2142 | + } | |
| 2143 | + if (rootNode && isShadowRoot(rootNode)) { | |
| 2144 | + let next = child; | |
| 2145 | + while (next) { | |
| 2146 | + if (parent === next) { | |
| 2147 | + return true; | |
| 2148 | + } | |
| 2149 | + next = next.parentNode || next.host; | |
| 2150 | + } | |
| 2151 | + } | |
| 2152 | + return false; | |
| 2153 | + } | |
| 2154 | + function getTarget(event) { | |
| 2155 | + if ("composedPath" in event) { | |
| 2156 | + return event.composedPath()[0] ?? event.target; | |
| 2157 | + } | |
| 2158 | + return event.target; | |
| 2159 | + } | |
| 2160 | + | |
| 2161 | + // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs | |
| 2162 | + var round = Math.round; | |
| 2163 | + | |
| 2164 | + // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs | |
| 2165 | + function isIndexOutOfListBounds(list, index2) { | |
| 2166 | + return index2 < 0 || index2 >= list.length; | |
| 2167 | + } | |
| 2168 | + function getMinListIndex(listRef, disabledIndices) { | |
| 2169 | + return findNonDisabledListIndex(listRef.current, { | |
| 2170 | + disabledIndices | |
| 2171 | + }); | |
| 2172 | + } | |
| 2173 | + function getMaxListIndex(listRef, disabledIndices) { | |
| 2174 | + return findNonDisabledListIndex(listRef.current, { | |
| 2175 | + decrement: true, | |
| 2176 | + startingIndex: listRef.current.length, | |
| 2177 | + disabledIndices | |
| 2178 | + }); | |
| 2179 | + } | |
| 2180 | + function findNonDisabledListIndex(list, { | |
| 2181 | + startingIndex = -1, | |
| 2182 | + decrement = false, | |
| 2183 | + disabledIndices, | |
| 2184 | + amount = 1 | |
| 2185 | + } = {}) { | |
| 2186 | + let index2 = startingIndex; | |
| 2187 | + do { | |
| 2188 | + index2 += decrement ? -amount : amount; | |
| 2189 | + } while (index2 >= 0 && index2 <= list.length - 1 && isListIndexDisabled(list, index2, disabledIndices)); | |
| 2190 | + return index2; | |
| 2191 | + } | |
| 2192 | + function isListIndexDisabled(list, index2, disabledIndices) { | |
| 2193 | + const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index2) : disabledIndices?.includes(index2) ?? false; | |
| 2194 | + if (isExplicitlyDisabled) { | |
| 2195 | + return true; | |
| 2196 | + } | |
| 2197 | + const element = list[index2]; | |
| 2198 | + if (!element) { | |
| 2199 | + return false; | |
| 2200 | + } | |
| 2201 | + if (!isElementVisible(element)) { | |
| 2202 | + return true; | |
| 2203 | + } | |
| 2204 | + if (element.matches(":disabled")) { | |
| 2205 | + return true; | |
| 2206 | + } | |
| 2207 | + return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"); | |
| 2208 | + } | |
| 2209 | + function isHiddenByStyles(styles) { | |
| 2210 | + return styles.visibility === "hidden" || styles.visibility === "collapse"; | |
| 2211 | + } | |
| 2212 | + function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { | |
| 2213 | + if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { | |
| 2214 | + return false; | |
| 2215 | + } | |
| 2216 | + if (typeof element.checkVisibility === "function") { | |
| 2217 | + return element.checkVisibility(); | |
| 2218 | + } | |
| 2219 | + return styles.display !== "none" && styles.display !== "contents"; | |
| 2220 | + } | |
| 2221 | + | |
| 2222 | + // node_modules/@base-ui/utils/useForcedRerendering.mjs | |
| 2223 | + var React18 = __toESM(require_react(), 1); | |
| 2224 | + function useForcedRerendering() { | |
| 2225 | + const [, setState] = React18.useState({}); | |
| 2226 | + return React18.useCallback(() => { | |
| 2227 | + setState({}); | |
| 2228 | + }, []); | |
| 2229 | + } | |
| 2230 | + | |
| 2231 | + // node_modules/@base-ui/react/internals/composite/composite.mjs | |
| 2232 | + var ARROW_UP = "ArrowUp"; | |
| 2233 | + var ARROW_DOWN = "ArrowDown"; | |
| 2234 | + var ARROW_LEFT = "ArrowLeft"; | |
| 2235 | + var ARROW_RIGHT = "ArrowRight"; | |
| 2236 | + var HOME = "Home"; | |
| 2237 | + var END = "End"; | |
| 2238 | + var COMPOSITE_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]); | |
| 2239 | + var SHIFT = "Shift"; | |
| 2240 | + var MODIFIER_KEYS = [SHIFT, "Control", "Alt", "Meta"]; | |
| 2241 | + function isInputElement(element) { | |
| 2242 | + return isHTMLElement(element) && element.tagName === "INPUT"; | |
| 2243 | + } | |
| 2244 | + function isNativeInput(element) { | |
| 2245 | + if (isInputElement(element) && element.selectionStart != null) { | |
| 2246 | + return true; | |
| 2247 | + } | |
| 2248 | + if (isHTMLElement(element) && element.tagName === "TEXTAREA") { | |
| 2249 | + return true; | |
| 2250 | + } | |
| 2251 | + return false; | |
| 2252 | + } | |
| 2253 | + function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) { | |
| 2254 | + if (!scrollContainer || !element || !element.scrollTo) { | |
| 2255 | + return; | |
| 2256 | + } | |
| 2257 | + let targetX = scrollContainer.scrollLeft; | |
| 2258 | + let targetY = scrollContainer.scrollTop; | |
| 2259 | + const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth; | |
| 2260 | + const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight; | |
| 2261 | + if (isOverflowingX && orientation !== "vertical") { | |
| 2262 | + const elementOffsetLeft = getOffset(scrollContainer, element, "left"); | |
| 2263 | + const containerStyles = getStyles(scrollContainer); | |
| 2264 | + const elementStyles = getStyles(element); | |
| 2265 | + if (direction === "ltr") { | |
| 2266 | + if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) { | |
| 2267 | + targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight; | |
| 2268 | + } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) { | |
| 2269 | + targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft; | |
| 2270 | + } | |
| 2271 | + } | |
| 2272 | + if (direction === "rtl") { | |
| 2273 | + if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) { | |
| 2274 | + targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft; | |
| 2275 | + } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) { | |
| 2276 | + targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight; | |
| 2277 | + } | |
| 2278 | + } | |
| 2279 | + } | |
| 2280 | + if (isOverflowingY && orientation !== "horizontal") { | |
| 2281 | + const elementOffsetTop = getOffset(scrollContainer, element, "top"); | |
| 2282 | + const containerStyles = getStyles(scrollContainer); | |
| 2283 | + const elementStyles = getStyles(element); | |
| 2284 | + if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) { | |
| 2285 | + targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop; | |
| 2286 | + } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) { | |
| 2287 | + targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom; | |
| 2288 | + } | |
| 2289 | + } | |
| 2290 | + scrollContainer.scrollTo({ | |
| 2291 | + left: targetX, | |
| 2292 | + top: targetY, | |
| 2293 | + behavior: "auto" | |
| 2294 | + }); | |
| 2295 | + } | |
| 2296 | + function getOffset(ancestor, element, side) { | |
| 2297 | + const propName = side === "left" ? "offsetLeft" : "offsetTop"; | |
| 2298 | + let result = 0; | |
| 2299 | + while (element.offsetParent) { | |
| 2300 | + result += element[propName]; | |
| 2301 | + if (element.offsetParent === ancestor) { | |
| 2302 | + break; | |
| 2303 | + } | |
| 2304 | + element = element.offsetParent; | |
| 2305 | + } | |
| 2306 | + return result; | |
| 2307 | + } | |
| 2308 | + function getStyles(element) { | |
| 2309 | + const styles = getComputedStyle(element); | |
| 2310 | + return { | |
| 2311 | + scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0, | |
| 2312 | + scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0, | |
| 2313 | + scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0, | |
| 2314 | + scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0, | |
| 2315 | + scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0, | |
| 2316 | + scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0, | |
| 2317 | + scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0, | |
| 2318 | + scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0 | |
| 2319 | + }; | |
| 2320 | + } | |
| 2321 | + | |
| 2322 | + // node_modules/@base-ui/utils/inertValue.mjs | |
| 2323 | + function inertValue(value) { | |
| 2324 | + if (isReactVersionAtLeast(19)) { | |
| 2325 | + return value; | |
| 2326 | + } | |
| 2327 | + return value ? "true" : void 0; | |
| 2328 | + } | |
| 2329 | + | |
| 2330 | + // node_modules/@base-ui/react/internals/useValueChanged.mjs | |
| 2331 | + var React19 = __toESM(require_react(), 1); | |
| 2332 | + function useValueChanged(value, onChange) { | |
| 2333 | + const valueRef = React19.useRef(value); | |
| 2334 | + const onChangeCallback = useStableCallback(onChange); | |
| 2335 | + useIsoLayoutEffect(() => { | |
| 2336 | + if (valueRef.current !== value) { | |
| 2337 | + onChangeCallback(valueRef.current); | |
| 2338 | + } | |
| 2339 | + valueRef.current = value; | |
| 2340 | + }, [value, onChangeCallback]); | |
| 2341 | + } | |
| 2342 | + | |
| 2343 | + // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs | |
| 2344 | + var React20 = __toESM(require_react(), 1); | |
| 2345 | + | |
| 2346 | + // node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs | |
| 2347 | + var valid = "data-valid"; | |
| 2348 | + var invalid = "data-invalid"; | |
| 2349 | + | |
| 2350 | + // node_modules/@base-ui/react/internals/field-constants/constants.mjs | |
| 2351 | + var DEFAULT_VALIDITY_STATE = { | |
| 2352 | + badInput: false, | |
| 2353 | + customError: false, | |
| 2354 | + patternMismatch: false, | |
| 2355 | + rangeOverflow: false, | |
| 2356 | + rangeUnderflow: false, | |
| 2357 | + stepMismatch: false, | |
| 2358 | + tooLong: false, | |
| 2359 | + tooShort: false, | |
| 2360 | + typeMismatch: false, | |
| 2361 | + valid: null, | |
| 2362 | + valueMissing: false | |
| 2363 | + }; | |
| 2364 | + var DEFAULT_FIELD_STATE_ATTRIBUTES = { | |
| 2365 | + valid: null, | |
| 2366 | + touched: false, | |
| 2367 | + dirty: false, | |
| 2368 | + filled: false, | |
| 2369 | + focused: false | |
| 2370 | + }; | |
| 2371 | + var DEFAULT_FIELD_ROOT_STATE = { | |
| 2372 | + disabled: false, | |
| 2373 | + ...DEFAULT_FIELD_STATE_ATTRIBUTES | |
| 2374 | + }; | |
| 2375 | + var fieldValidityMapping = { | |
| 2376 | + valid(value) { | |
| 2377 | + if (value === null) { | |
| 2378 | + return null; | |
| 2379 | + } | |
| 2380 | + if (value) { | |
| 2381 | + return { | |
| 2382 | + [valid]: "" | |
| 2383 | + }; | |
| 2384 | + } | |
| 2385 | + return { | |
| 2386 | + [invalid]: "" | |
| 2387 | + }; | |
| 2388 | + } | |
| 2389 | + }; | |
| 2390 | + | |
| 2391 | + // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs | |
| 2392 | + var DEFAULT_FIELD_ROOT_CONTEXT = { | |
| 2393 | + invalid: void 0, | |
| 2394 | + name: void 0, | |
| 2395 | + validityData: { | |
| 2396 | + state: DEFAULT_VALIDITY_STATE, | |
| 2397 | + errors: [], | |
| 2398 | + error: "", | |
| 2399 | + value: "", | |
| 2400 | + initialValue: null | |
| 2401 | + }, | |
| 2402 | + setValidityData: NOOP, | |
| 2403 | + disabled: void 0, | |
| 2404 | + setTouched: NOOP, | |
| 2405 | + setDirty: NOOP, | |
| 2406 | + setFilled: NOOP, | |
| 2407 | + setFocused: NOOP, | |
| 2408 | + validationMode: "onSubmit", | |
| 2409 | + shouldValidateOnChange: () => false, | |
| 2410 | + state: DEFAULT_FIELD_ROOT_STATE, | |
| 2411 | + registerFieldControl: NOOP, | |
| 2412 | + validation: { | |
| 2413 | + getValidationProps: (_disabled, props = EMPTY_OBJECT) => props, | |
| 2414 | + inputRef: { | |
| 2415 | + current: null | |
| 2416 | + }, | |
| 2417 | + registeredInputs: /* @__PURE__ */ new Map(), | |
| 2418 | + registerInput: NOOP, | |
| 2419 | + getInputControl: () => null, | |
| 2420 | + commit: async () => { | |
| 2421 | + }, | |
| 2422 | + change: NOOP | |
| 2423 | + } | |
| 2424 | + }; | |
| 2425 | + var FieldRootContext = /* @__PURE__ */ React20.createContext(DEFAULT_FIELD_ROOT_CONTEXT); | |
| 2426 | + if (true) FieldRootContext.displayName = "FieldRootContext"; | |
| 2427 | + function useFieldRootContext(optional = true) { | |
| 2428 | + const context = React20.useContext(FieldRootContext); | |
| 2429 | + if (context.setValidityData === NOOP && !optional) { | |
| 2430 | + throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28)); | |
| 2431 | + } | |
| 2432 | + return context; | |
| 2433 | + } | |
| 2434 | + | |
| 2435 | + // node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs | |
| 2436 | + function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name16) { | |
| 2437 | + const { | |
| 2438 | + registerFieldControl | |
| 2439 | + } = useFieldRootContext(); | |
| 2440 | + const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); | |
| 2441 | + useIsoLayoutEffect(() => { | |
| 2442 | + const source = sourceRef.current; | |
| 2443 | + if (!enabled) { | |
| 2444 | + registerFieldControl(source, void 0); | |
| 2445 | + return; | |
| 2446 | + } | |
| 2447 | + const registration = { | |
| 2448 | + controlRef, | |
| 2449 | + getValue: getFormValueOverride, | |
| 2450 | + id, | |
| 2451 | + name: name16, | |
| 2452 | + value | |
| 2453 | + }; | |
| 2454 | + registerFieldControl(source, registration); | |
| 2455 | + }, [controlRef, enabled, getFormValueOverride, id, name16, registerFieldControl, sourceRef, value]); | |
| 2456 | + useIsoLayoutEffect(() => { | |
| 2457 | + const source = sourceRef.current; | |
| 2458 | + return () => { | |
| 2459 | + registerFieldControl(source, void 0); | |
| 2460 | + }; | |
| 2461 | + }, [registerFieldControl, sourceRef]); | |
| 2462 | + } | |
| 2463 | + | |
| 2464 | + // node_modules/@base-ui/react/internals/form-context/FormContext.mjs | |
| 2465 | + var React21 = __toESM(require_react(), 1); | |
| 2466 | + var FormContext = /* @__PURE__ */ React21.createContext({ | |
| 2467 | + elementRef: { | |
| 2468 | + current: null | |
| 2469 | + }, | |
| 2470 | + formRef: { | |
| 2471 | + current: { | |
| 2472 | + fields: /* @__PURE__ */ new Map() | |
| 2473 | + } | |
| 2474 | + }, | |
| 2475 | + errors: {}, | |
| 2476 | + clearErrors: NOOP, | |
| 2477 | + validationMode: "onSubmit", | |
| 2478 | + submitCountRef: { | |
| 2479 | + current: 0 | |
| 2480 | + } | |
| 2481 | + }); | |
| 2482 | + if (true) FormContext.displayName = "FormContext"; | |
| 2483 | + function useFormContext() { | |
| 2484 | + return React21.useContext(FormContext); | |
| 2485 | + } | |
| 2486 | + | |
| 2487 | + // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs | |
| 2488 | + var React23 = __toESM(require_react(), 1); | |
| 2489 | + | |
| 2490 | + // node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs | |
| 2491 | + var React22 = __toESM(require_react(), 1); | |
| 2492 | + var LabelableContext = /* @__PURE__ */ React22.createContext({ | |
| 2493 | + controlId: void 0, | |
| 2494 | + registerControlId: NOOP, | |
| 2495 | + resetControlId: NOOP, | |
| 2496 | + labelId: void 0, | |
| 2497 | + setLabelId: NOOP, | |
| 2498 | + messageIds: [], | |
| 2499 | + setMessageIds: NOOP, | |
| 2500 | + getDescriptionProps: (externalProps) => externalProps | |
| 2501 | + }); | |
| 2502 | + if (true) LabelableContext.displayName = "LabelableContext"; | |
| 2503 | + function useLabelableContext() { | |
| 2504 | + return React22.useContext(LabelableContext); | |
| 2505 | + } | |
| 2506 | + | |
| 2507 | + // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs | |
| 2508 | + function useLabelableId(params = {}) { | |
| 2509 | + const { | |
| 2510 | + id, | |
| 2511 | + enabled = true | |
| 2512 | + } = params; | |
| 2513 | + const { | |
| 2514 | + controlId, | |
| 2515 | + registerControlId, | |
| 2516 | + resetControlId | |
| 2517 | + } = useLabelableContext(); | |
| 2518 | + const defaultId = useBaseUiId(); | |
| 2519 | + const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); | |
| 2520 | + const hasRegisteredRef = React23.useRef(false); | |
| 2521 | + const hadExplicitIdRef = React23.useRef(false); | |
| 2522 | + const unregisterControlId = useStableCallback(() => { | |
| 2523 | + if (!hasRegisteredRef.current || registerControlId === NOOP) { | |
| 2524 | + return; | |
| 2525 | + } | |
| 2526 | + hasRegisteredRef.current = false; | |
| 2527 | + registerControlId(controlSourceRef.current, void 0); | |
| 2528 | + }); | |
| 2529 | + useIsoLayoutEffect(() => { | |
| 2530 | + if (!enabled || registerControlId === NOOP) { | |
| 2531 | + unregisterControlId(); | |
| 2532 | + return void 0; | |
| 2533 | + } | |
| 2534 | + let nextId; | |
| 2535 | + if (id !== void 0) { | |
| 2536 | + hadExplicitIdRef.current = true; | |
| 2537 | + nextId = id; | |
| 2538 | + } else if (hadExplicitIdRef.current) { | |
| 2539 | + nextId = defaultId; | |
| 2540 | + } else { | |
| 2541 | + resetControlId(); | |
| 2542 | + return void 0; | |
| 2543 | + } | |
| 2544 | + if (nextId === void 0) { | |
| 2545 | + unregisterControlId(); | |
| 2546 | + return void 0; | |
| 2547 | + } | |
| 2548 | + hasRegisteredRef.current = true; | |
| 2549 | + registerControlId(controlSourceRef.current, nextId); | |
| 2550 | + return void 0; | |
| 2551 | + }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]); | |
| 2552 | + useIsoLayoutEffect(() => { | |
| 2553 | + return unregisterControlId; | |
| 2554 | + }, [unregisterControlId]); | |
| 2555 | + return (enabled ? controlId : void 0) ?? id ?? defaultId; | |
| 2556 | + } | |
| 2557 | + | |
| 2558 | + // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs | |
| 2559 | + var React24 = __toESM(require_react(), 1); | |
| 2560 | + var DirectionContext = /* @__PURE__ */ React24.createContext(void 0); | |
| 2561 | + if (true) DirectionContext.displayName = "DirectionContext"; | |
| 2562 | + function useDirection() { | |
| 2563 | + const context = React24.useContext(DirectionContext); | |
| 2564 | + return context?.direction ?? "ltr"; | |
| 2565 | + } | |
| 2566 | + | |
| 2567 | + // node_modules/@base-ui/react/field/item/FieldItemContext.mjs | |
| 2568 | + var React25 = __toESM(require_react(), 1); | |
| 2569 | + var FieldItemContext = /* @__PURE__ */ React25.createContext({ | |
| 2570 | + disabled: false | |
| 2571 | + }); | |
| 2572 | + if (true) FieldItemContext.displayName = "FieldItemContext"; | |
| 2573 | + function useFieldItemContext() { | |
| 2574 | + const context = React25.useContext(FieldItemContext); | |
| 2575 | + return context; | |
| 2576 | + } | |
| 2577 | + | |
| 2578 | + // node_modules/@base-ui/react/field/root/useFieldValidation.mjs | |
| 2579 | + var React26 = __toESM(require_react(), 1); | |
| 2580 | + | |
| 2581 | + // node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs | |
| 2582 | + function getCombinedFieldValidityData(validityData, invalid2) { | |
| 2583 | + return { | |
| 2584 | + ...validityData, | |
| 2585 | + state: { | |
| 2586 | + ...validityData.state, | |
| 2587 | + valid: !invalid2 && validityData.state.valid | |
| 2588 | + } | |
| 2589 | + }; | |
| 2590 | + } | |
| 2591 | + | |
| 2592 | + // node_modules/@base-ui/react/field/root/useFieldValidation.mjs | |
| 2593 | + var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE); | |
| 2594 | + function isEligibleInput(input, formElement) { | |
| 2595 | + if (input.matches(":disabled")) { | |
| 2596 | + return false; | |
| 2597 | + } | |
| 2598 | + if (!formElement || input.form === formElement) { | |
| 2599 | + return true; | |
| 2600 | + } | |
| 2601 | + return input.form === null && !input.hasAttribute("form"); | |
| 2602 | + } | |
| 2603 | + function findRepresentativeInput(inputs, formElement) { | |
| 2604 | + let fallback = null; | |
| 2605 | + for (const input of inputs.keys()) { | |
| 2606 | + if (!isEligibleInput(input, formElement)) { | |
| 2607 | + continue; | |
| 2608 | + } | |
| 2609 | + if (!input.validity.valid) { | |
| 2610 | + return input; | |
| 2611 | + } | |
| 2612 | + fallback ??= input; | |
| 2613 | + } | |
| 2614 | + return fallback; | |
| 2615 | + } | |
| 2616 | + function makeState(customError) { | |
| 2617 | + return { | |
| 2618 | + ...DEFAULT_VALIDITY_STATE, | |
| 2619 | + valid: !customError, | |
| 2620 | + customError | |
| 2621 | + }; | |
| 2622 | + } | |
| 2623 | + function getNativeErrors(element) { | |
| 2624 | + return element && element.validationMessage ? [element.validationMessage] : []; | |
| 2625 | + } | |
| 2626 | + function useFieldValidation(params) { | |
| 2627 | + const { | |
| 2628 | + elementRef, | |
| 2629 | + formRef | |
| 2630 | + } = useFormContext(); | |
| 2631 | + const { | |
| 2632 | + setValidityData, | |
| 2633 | + validate, | |
| 2634 | + validityData, | |
| 2635 | + validationDebounceTime, | |
| 2636 | + invalid: invalid2, | |
| 2637 | + markedDirtyRef, | |
| 2638 | + state, | |
| 2639 | + shouldValidateOnChange, | |
| 2640 | + validationMode, | |
| 2641 | + registeredFieldIdRef | |
| 2642 | + } = params; | |
| 2643 | + const { | |
| 2644 | + controlId, | |
| 2645 | + getDescriptionProps | |
| 2646 | + } = useLabelableContext(); | |
| 2647 | + const timeout = useTimeout(); | |
| 2648 | + const inputRef = React26.useRef(null); | |
| 2649 | + const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current; | |
| 2650 | + const validationCommitIdRef = React26.useRef(0); | |
| 2651 | + const customValidityRef = React26.useRef(null); | |
| 2652 | + const registerInput = React26.useCallback((element, registration) => { | |
| 2653 | + registeredInputs.set(element, registration); | |
| 2654 | + return () => { | |
| 2655 | + registeredInputs.delete(element); | |
| 2656 | + }; | |
| 2657 | + }, [registeredInputs]); | |
| 2658 | + const getInputControl = useStableCallback(() => { | |
| 2659 | + const element = findRepresentativeInput(registeredInputs, elementRef.current); | |
| 2660 | + return element && registeredInputs.get(element)?.controlRef.current || null; | |
| 2661 | + }); | |
| 2662 | + const commit = useStableCallback(async (value, revalidate = false) => { | |
| 2663 | + validationCommitIdRef.current += 1; | |
| 2664 | + const validationCommitId = validationCommitIdRef.current; | |
| 2665 | + function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid2) { | |
| 2666 | + const fieldId = registeredFieldIdRef.current ?? controlId; | |
| 2667 | + if (fieldId == null) { | |
| 2668 | + return; | |
| 2669 | + } | |
| 2670 | + const currentFieldData = formRef.current.fields.get(fieldId); | |
| 2671 | + if (!currentFieldData) { | |
| 2672 | + return; | |
| 2673 | + } | |
| 2674 | + const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid); | |
| 2675 | + formRef.current.fields.set(fieldId, { | |
| 2676 | + ...currentFieldData, | |
| 2677 | + validityData: validityDataWithFormErrors | |
| 2678 | + }); | |
| 2679 | + } | |
| 2680 | + function makeValidityData(validityState, errorMessages) { | |
| 2681 | + const errors = validityState.valid === false ? errorMessages : []; | |
| 2682 | + return { | |
| 2683 | + value, | |
| 2684 | + state: validityState, | |
| 2685 | + error: errors[0] ?? "", | |
| 2686 | + errors, | |
| 2687 | + initialValue: validityData.initialValue | |
| 2688 | + }; | |
| 2689 | + } | |
| 2690 | + function setCustomValidity(element2, message) { | |
| 2691 | + const displaced = element2.validity.customError ? element2.validationMessage : ""; | |
| 2692 | + const ownedMessage = message.replace(/\r\n?/g, "\n"); | |
| 2693 | + element2.setCustomValidity(ownedMessage); | |
| 2694 | + customValidityRef.current = [element2, ownedMessage, displaced]; | |
| 2695 | + } | |
| 2696 | + function clearCustomValidity() { | |
| 2697 | + const record = customValidityRef.current; | |
| 2698 | + customValidityRef.current = null; | |
| 2699 | + if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) { | |
| 2700 | + record[0].setCustomValidity(record[2]); | |
| 2701 | + } | |
| 2702 | + } | |
| 2703 | + function publish(validityState, errorMessages, externalInvalid) { | |
| 2704 | + const nextValidityData = makeValidityData(validityState, errorMessages); | |
| 2705 | + updateRegisteredFieldValidity(nextValidityData, externalInvalid); | |
| 2706 | + setValidityData(nextValidityData); | |
| 2707 | + } | |
| 2708 | + function getState(el) { | |
| 2709 | + const computedState = validityKeys.reduce((acc, key) => { | |
| 2710 | + acc[key] = el.validity[key]; | |
| 2711 | + return acc; | |
| 2712 | + }, {}); | |
| 2713 | + let hasOnlyValueMissingError = false; | |
| 2714 | + for (const key of validityKeys) { | |
| 2715 | + if (key === "valid") { | |
| 2716 | + continue; | |
| 2717 | + } | |
| 2718 | + if (key === "valueMissing" && computedState[key]) { | |
| 2719 | + hasOnlyValueMissingError = true; | |
| 2720 | + } else if (computedState[key]) { | |
| 2721 | + return computedState; | |
| 2722 | + } | |
| 2723 | + } | |
| 2724 | + if (hasOnlyValueMissingError && !markedDirtyRef.current) { | |
| 2725 | + computedState.valid = true; | |
| 2726 | + computedState.valueMissing = false; | |
| 2727 | + } | |
| 2728 | + return computedState; | |
| 2729 | + } | |
| 2730 | + function resolveRepresentativeInput() { | |
| 2731 | + return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current; | |
| 2732 | + } | |
| 2733 | + let element = resolveRepresentativeInput(); | |
| 2734 | + function refreshState() { | |
| 2735 | + element = resolveRepresentativeInput(); | |
| 2736 | + return element?.willValidate ? getState(element) : makeState(false); | |
| 2737 | + } | |
| 2738 | + if (revalidate) { | |
| 2739 | + if (state.valid !== false || !element) { | |
| 2740 | + return; | |
| 2741 | + } | |
| 2742 | + if (!element.validity.valueMissing) { | |
| 2743 | + clearCustomValidity(); | |
| 2744 | + const currentElement = resolveRepresentativeInput(); | |
| 2745 | + const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : []; | |
| 2746 | + publish(makeState(foreign.length > 0), foreign, false); | |
| 2747 | + return; | |
| 2748 | + } | |
| 2749 | + for (const key of validityKeys) { | |
| 2750 | + if (key !== "valid" && key !== "valueMissing" && key !== "customError" && element.validity[key]) { | |
| 2751 | + return; | |
| 2752 | + } | |
| 2753 | + } | |
| 2754 | + } | |
| 2755 | + timeout.clear(); | |
| 2756 | + clearCustomValidity(); | |
| 2757 | + let nextState = refreshState(); | |
| 2758 | + let validationErrors = getNativeErrors(element); | |
| 2759 | + const isValidatingOnChange = shouldValidateOnChange(); | |
| 2760 | + if (validationErrors.length === 0 || isValidatingOnChange) { | |
| 2761 | + const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => { | |
| 2762 | + if (field.name) { | |
| 2763 | + acc[field.name] = field.getValue(); | |
| 2764 | + } | |
| 2765 | + return acc; | |
| 2766 | + }, {}); | |
| 2767 | + const resultOrPromise = validate(value, formValues); | |
| 2768 | + let result; | |
| 2769 | + if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) { | |
| 2770 | + if (nextState.valid === false) { | |
| 2771 | + publish(nextState, validationErrors); | |
| 2772 | + } else if (validationMode === "onSubmit" || !validityData.state.customError) { | |
| 2773 | + nextState.valid = null; | |
| 2774 | + publish(nextState, validationErrors); | |
| 2775 | + } | |
| 2776 | + result = await resultOrPromise; | |
| 2777 | + if (validationCommitId !== validationCommitIdRef.current) { | |
| 2778 | + return; | |
| 2779 | + } | |
| 2780 | + nextState = refreshState(); | |
| 2781 | + } else { | |
| 2782 | + result = resultOrPromise; | |
| 2783 | + } | |
| 2784 | + validationErrors = result ? [].concat(result).filter(Boolean) : []; | |
| 2785 | + if (validationErrors.length > 0) { | |
| 2786 | + nextState.valid = false; | |
| 2787 | + nextState.customError = true; | |
| 2788 | + if (element?.willValidate) { | |
| 2789 | + setCustomValidity(element, validationErrors.join("\n")); | |
| 2790 | + } | |
| 2791 | + } else { | |
| 2792 | + validationErrors = getNativeErrors(element); | |
| 2793 | + } | |
| 2794 | + } | |
| 2795 | + publish(nextState, validationErrors); | |
| 2796 | + }); | |
| 2797 | + const change = useStableCallback((value, cancelPending = false) => { | |
| 2798 | + timeout.clear(); | |
| 2799 | + validationCommitIdRef.current += 1; | |
| 2800 | + if (cancelPending) { | |
| 2801 | + return; | |
| 2802 | + } | |
| 2803 | + const validateOnChange = shouldValidateOnChange(); | |
| 2804 | + if (validateOnChange && value !== "" && validationDebounceTime) { | |
| 2805 | + timeout.start(validationDebounceTime, () => { | |
| 2806 | + commit(value); | |
| 2807 | + }); | |
| 2808 | + } else { | |
| 2809 | + commit(value, !validateOnChange); | |
| 2810 | + } | |
| 2811 | + }); | |
| 2812 | + const getValidationProps = React26.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? { | |
| 2813 | + "aria-invalid": true | |
| 2814 | + } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]); | |
| 2815 | + return React26.useMemo(() => ({ | |
| 2816 | + getValidationProps, | |
| 2817 | + inputRef, | |
| 2818 | + registeredInputs, | |
| 2819 | + registerInput, | |
| 2820 | + getInputControl, | |
| 2821 | + commit, | |
| 2822 | + change | |
| 2823 | + }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]); | |
| 2824 | + } | |
| 2825 | + | |
| 2826 | + // node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs | |
| 2827 | + function useRegisteredLabelId(idProp, setLabelId) { | |
| 2828 | + const id = useBaseUiId(idProp); | |
| 2829 | + useIsoLayoutEffect(() => { | |
| 2830 | + setLabelId(id); | |
| 2831 | + return () => { | |
| 2832 | + setLabelId((currentId) => currentId === id ? void 0 : currentId); | |
| 2833 | + }; | |
| 2834 | + }, [id, setLabelId]); | |
| 2835 | + return id; | |
| 2836 | + } | |
| 2837 | + | |
| 2838 | + // node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs | |
| 2839 | + function useLabel(params = {}) { | |
| 2840 | + const { | |
| 2841 | + id: idProp, | |
| 2842 | + fallbackControlId, | |
| 2843 | + native = false, | |
| 2844 | + setLabelId: setLabelIdProp, | |
| 2845 | + focusControl: focusControlProp | |
| 2846 | + } = params; | |
| 2847 | + const { | |
| 2848 | + controlId: contextControlId, | |
| 2849 | + setLabelId: setContextLabelId | |
| 2850 | + } = useLabelableContext(); | |
| 2851 | + const syncLabelId = useStableCallback((nextLabelId) => { | |
| 2852 | + setContextLabelId(nextLabelId); | |
| 2853 | + setLabelIdProp?.(nextLabelId); | |
| 2854 | + }); | |
| 2855 | + const id = useRegisteredLabelId(idProp, syncLabelId); | |
| 2856 | + const resolvedControlId = contextControlId ?? fallbackControlId; | |
| 2857 | + function focusControl(event) { | |
| 2858 | + if (focusControlProp) { | |
| 2859 | + focusControlProp(event, resolvedControlId); | |
| 2860 | + return; | |
| 2861 | + } | |
| 2862 | + if (!resolvedControlId) { | |
| 2863 | + return; | |
| 2864 | + } | |
| 2865 | + const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId); | |
| 2866 | + if (isHTMLElement(controlElement)) { | |
| 2867 | + focusElementWithVisible(controlElement); | |
| 2868 | + } | |
| 2869 | + } | |
| 2870 | + function handleInteraction(event) { | |
| 2871 | + const target = getTarget(event.nativeEvent); | |
| 2872 | + if (target?.closest("button,input,select,textarea")) { | |
| 2873 | + return; | |
| 2874 | + } | |
| 2875 | + if (!event.defaultPrevented && event.detail > 1) { | |
| 2876 | + event.preventDefault(); | |
| 2877 | + } | |
| 2878 | + if (native) { | |
| 2879 | + return; | |
| 2880 | + } | |
| 2881 | + focusControl(event); | |
| 2882 | + } | |
| 2883 | + return native ? { | |
| 2884 | + id, | |
| 2885 | + htmlFor: resolvedControlId, | |
| 2886 | + onMouseDown: handleInteraction | |
| 2887 | + } : { | |
| 2888 | + id, | |
| 2889 | + onClick: handleInteraction, | |
| 2890 | + onPointerDown(event) { | |
| 2891 | + event.preventDefault(); | |
| 2892 | + } | |
| 2893 | + }; | |
| 2894 | + } | |
| 2895 | + function focusElementWithVisible(element) { | |
| 2896 | + element.focus({ | |
| 2897 | + // Available from Chrome 144+ (January 2026). | |
| 2898 | + // Safari and Firefox already support it. | |
| 2899 | + focusVisible: true | |
| 2900 | + }); | |
| 2901 | + } | |
| 2902 | + | |
| 2903 | + // node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs | |
| 2904 | + var React27 = __toESM(require_react(), 1); | |
| 2905 | + function useCompositeItem(params = {}) { | |
| 2906 | + const { | |
| 2907 | + highlightItemOnHover, | |
| 2908 | + highlightedIndex, | |
| 2909 | + onHighlightedIndexChange | |
| 2910 | + } = useCompositeRootContext(); | |
| 2911 | + const { | |
| 2912 | + ref, | |
| 2913 | + index: index2 | |
| 2914 | + } = useCompositeListItem(params); | |
| 2915 | + const isHighlighted = highlightedIndex === index2; | |
| 2916 | + const itemRef = React27.useRef(null); | |
| 2917 | + const mergedRef = useMergedRefs(ref, itemRef); | |
| 2918 | + const compositeProps = { | |
| 2919 | + tabIndex: isHighlighted ? 0 : -1, | |
| 2920 | + onFocus() { | |
| 2921 | + onHighlightedIndexChange(index2); | |
| 2922 | + }, | |
| 2923 | + onMouseMove() { | |
| 2924 | + const item = itemRef.current; | |
| 2925 | + if (!highlightItemOnHover || !item) { | |
| 2926 | + return; | |
| 2927 | + } | |
| 2928 | + const disabled2 = item.hasAttribute("disabled") || item.ariaDisabled === "true"; | |
| 2929 | + if (!isHighlighted && !disabled2) { | |
| 2930 | + item.focus(); | |
| 2931 | + } | |
| 2932 | + } | |
| 2933 | + }; | |
| 2934 | + return { | |
| 2935 | + compositeProps, | |
| 2936 | + compositeRef: mergedRef, | |
| 2937 | + index: index2 | |
| 2938 | + }; | |
| 2939 | + } | |
| 2940 | + | |
| 2941 | + // node_modules/@base-ui/react/utils/getCssDimensions.mjs | |
| 2942 | + function getCssDimensions(element) { | |
| 2943 | + const css = getComputedStyle2(element); | |
| 2944 | + let width = parseFloat(css.width) || 0; | |
| 2945 | + let height = parseFloat(css.height) || 0; | |
| 2946 | + const hasOffset = isHTMLElement(element); | |
| 2947 | + const offsetWidth = hasOffset ? element.offsetWidth : width; | |
| 2948 | + const offsetHeight = hasOffset ? element.offsetHeight : height; | |
| 2949 | + const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; | |
| 2950 | + if (shouldFallback) { | |
| 2951 | + width = offsetWidth; | |
| 2952 | + height = offsetHeight; | |
| 2953 | + } | |
| 2954 | + return { | |
| 2955 | + width, | |
| 2956 | + height | |
| 2957 | + }; | |
| 2958 | + } | |
| 2959 | + | |
| 2960 | + // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs | |
| 2961 | + var React28 = __toESM(require_react(), 1); | |
| 2962 | + var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); | |
| 2963 | + var DirectionProvider = function DirectionProvider2(props) { | |
| 2964 | + const { | |
| 2965 | + direction = "ltr" | |
| 2966 | + } = props; | |
| 2967 | + const contextValue = React28.useMemo(() => ({ | |
| 2968 | + direction | |
| 2969 | + }), [direction]); | |
| 2970 | + return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DirectionContext.Provider, { | |
| 2971 | + value: contextValue, | |
| 2972 | + children: props.children | |
| 2973 | + }); | |
| 2974 | + }; | |
| 2975 | + if (true) DirectionProvider.displayName = "DirectionProvider"; | |
| 2976 | + | |
| 2977 | + // node_modules/@base-ui/utils/isElementDisabled.mjs | |
| 2978 | + function isElementDisabled(element) { | |
| 2979 | + return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"; | |
| 2980 | + } | |
| 2981 | + | |
| 2982 | + // node_modules/@base-ui/react/internals/csp-context/CSPContext.mjs | |
| 2983 | + var React29 = __toESM(require_react(), 1); | |
| 2984 | + var CSPContext = /* @__PURE__ */ React29.createContext(void 0); | |
| 2985 | + if (true) CSPContext.displayName = "CSPContext"; | |
| 2986 | + var DEFAULT_CSP_CONTEXT_VALUE = { | |
| 2987 | + disableStyleElements: false | |
| 2988 | + }; | |
| 2989 | + function useCSPContext() { | |
| 2990 | + return React29.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE; | |
| 2991 | + } | |
| 2992 | + | |
| 2993 | + // node_modules/@base-ui/react/utils/getElementTransform.mjs | |
| 2994 | + function getElementTransform(element, computedStyle) { | |
| 2995 | + const transform = (computedStyle ?? getWindow(element).getComputedStyle(element)).transform; | |
| 2996 | + let translateX = 0; | |
| 2997 | + let translateY = 0; | |
| 2998 | + let scale = 1; | |
| 2999 | + if (transform && transform !== "none") { | |
| 3000 | + const matrix = transform.match(/matrix(?:3d)?\(([^)]+)\)/); | |
| 3001 | + if (matrix) { | |
| 3002 | + const values = matrix[1].split(", ").map(parseFloat); | |
| 3003 | + if (values.length === 6) { | |
| 3004 | + translateX = values[4]; | |
| 3005 | + translateY = values[5]; | |
| 3006 | + scale = Math.sqrt(values[0] * values[0] + values[1] * values[1]); | |
| 3007 | + } else if (values.length === 16) { | |
| 3008 | + translateX = values[12]; | |
| 3009 | + translateY = values[13]; | |
| 3010 | + scale = values[0]; | |
| 3011 | + } | |
| 3012 | + } | |
| 3013 | + } | |
| 3014 | + return { | |
| 3015 | + x: translateX, | |
| 3016 | + y: translateY, | |
| 3017 | + scale | |
| 3018 | + }; | |
| 3019 | + } | |
| 3020 | + | |
| 3021 | + // node_modules/@base-ui/react/field/index.parts.mjs | |
| 3022 | + var index_parts_exports = {}; | |
| 3023 | + __export(index_parts_exports, { | |
| 3024 | + Control: () => FieldControl, | |
| 3025 | + Description: () => FieldDescription, | |
| 3026 | + Error: () => FieldError, | |
| 3027 | + Item: () => FieldItem, | |
| 3028 | + Label: () => FieldLabel, | |
| 3029 | + Root: () => FieldRoot, | |
| 3030 | + Validity: () => FieldValidity | |
| 3031 | + }); | |
| 3032 | + | |
| 3033 | + // node_modules/@base-ui/react/field/root/FieldRoot.mjs | |
| 3034 | + var React33 = __toESM(require_react(), 1); | |
| 3035 | + | |
| 3036 | + // node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs | |
| 3037 | + var React30 = __toESM(require_react(), 1); | |
| 3038 | + var FieldsetRootContext = /* @__PURE__ */ React30.createContext(void 0); | |
| 3039 | + if (true) FieldsetRootContext.displayName = "FieldsetRootContext"; | |
| 3040 | + function useFieldsetRootContext(optional = false) { | |
| 3041 | + const context = React30.useContext(FieldsetRootContext); | |
| 3042 | + if (!context && !optional) { | |
| 3043 | + throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86)); | |
| 3044 | + } | |
| 3045 | + return context; | |
| 3046 | + } | |
| 3047 | + | |
| 3048 | + // node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs | |
| 3049 | + var React31 = __toESM(require_react(), 1); | |
| 3050 | + var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); | |
| 3051 | + var LabelableProvider = function LabelableProvider2(props) { | |
| 3052 | + const defaultId = useBaseUiId(); | |
| 3053 | + const [controlIdState, setControlIdState] = React31.useState(defaultId); | |
| 3054 | + const [labelId, setLabelId] = React31.useState(); | |
| 3055 | + const [messageIds, setMessageIds] = React31.useState([]); | |
| 3056 | + const controlId = controlIdState === void 0 ? defaultId : controlIdState; | |
| 3057 | + const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map()); | |
| 3058 | + const { | |
| 3059 | + messageIds: parentMessageIds | |
| 3060 | + } = useLabelableContext(); | |
| 3061 | + const registerControlId = useStableCallback((source, nextId) => { | |
| 3062 | + const registrations = registrationsRef.current; | |
| 3063 | + if (nextId === void 0) { | |
| 3064 | + registrations.delete(source); | |
| 3065 | + } else { | |
| 3066 | + registrations.set(source, nextId); | |
| 3067 | + } | |
| 3068 | + setControlIdState((prev) => { | |
| 3069 | + if (registrations.size === 0) { | |
| 3070 | + return prev; | |
| 3071 | + } | |
| 3072 | + let nextControlId; | |
| 3073 | + for (const id of registrations.values()) { | |
| 3074 | + if (id === prev) { | |
| 3075 | + return prev; | |
| 3076 | + } | |
| 3077 | + if (nextControlId === void 0) { | |
| 3078 | + nextControlId = id; | |
| 3079 | + } | |
| 3080 | + } | |
| 3081 | + return nextControlId; | |
| 3082 | + }); | |
| 3083 | + }); | |
| 3084 | + const resetControlId = useStableCallback(() => { | |
| 3085 | + if (registrationsRef.current.size === 0) { | |
| 3086 | + setControlIdState(defaultId); | |
| 3087 | + } | |
| 3088 | + }); | |
| 3089 | + const getDescriptionProps = React31.useCallback((externalProps) => { | |
| 3090 | + const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : []; | |
| 3091 | + ids.push(...parentMessageIds, ...messageIds); | |
| 3092 | + return { | |
| 3093 | + ...externalProps, | |
| 3094 | + "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0 | |
| 3095 | + }; | |
| 3096 | + }, [parentMessageIds, messageIds]); | |
| 3097 | + const contextValue = React31.useMemo(() => ({ | |
| 3098 | + controlId, | |
| 3099 | + registerControlId, | |
| 3100 | + resetControlId, | |
| 3101 | + labelId, | |
| 3102 | + setLabelId, | |
| 3103 | + messageIds, | |
| 3104 | + setMessageIds, | |
| 3105 | + getDescriptionProps | |
| 3106 | + }), [controlId, registerControlId, resetControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]); | |
| 3107 | + return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LabelableContext.Provider, { | |
| 3108 | + value: contextValue, | |
| 3109 | + children: props.children | |
| 3110 | + }); | |
| 3111 | + }; | |
| 3112 | + if (true) LabelableProvider.displayName = "LabelableProvider"; | |
| 3113 | + | |
| 3114 | + // node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs | |
| 3115 | + var React32 = __toESM(require_react(), 1); | |
| 3116 | + function useFieldControlRegistration(params) { | |
| 3117 | + const { | |
| 3118 | + change, | |
| 3119 | + commit, | |
| 3120 | + invalid: invalid2, | |
| 3121 | + markedDirtyRef, | |
| 3122 | + name: name16, | |
| 3123 | + setRegisteredFieldName, | |
| 3124 | + registeredFieldIdRef, | |
| 3125 | + setValidityData, | |
| 3126 | + validityData | |
| 3127 | + } = params; | |
| 3128 | + const { | |
| 3129 | + formRef | |
| 3130 | + } = useFormContext(); | |
| 3131 | + const activeFieldControlSourceRef = React32.useRef(null); | |
| 3132 | + const registrationRef = React32.useRef(null); | |
| 3133 | + const initialValueCapturedRef = React32.useRef(false); | |
| 3134 | + const getValueForForm = useStableCallback(() => { | |
| 3135 | + const registration = registrationRef.current; | |
| 3136 | + if (!registration) { | |
| 3137 | + return void 0; | |
| 3138 | + } | |
| 3139 | + if (registration.getValue) { | |
| 3140 | + return registration.getValue(); | |
| 3141 | + } | |
| 3142 | + return registration.value; | |
| 3143 | + }); | |
| 3144 | + function getRegistrationValue(registration) { | |
| 3145 | + return registration.value === void 0 ? getValueForForm() : registration.value; | |
| 3146 | + } | |
| 3147 | + const validate = useStableCallback(() => { | |
| 3148 | + const registration = registrationRef.current; | |
| 3149 | + markedDirtyRef.current = true; | |
| 3150 | + if (!registration) { | |
| 3151 | + commit(validityData.value); | |
| 3152 | + return; | |
| 3153 | + } | |
| 3154 | + commit(getRegistrationValue(registration)); | |
| 3155 | + }); | |
| 3156 | + function refreshRegistration() { | |
| 3157 | + const registration = registrationRef.current; | |
| 3158 | + if (!registration || !registration.id) { | |
| 3159 | + return; | |
| 3160 | + } | |
| 3161 | + formRef.current.fields.set(registration.id, { | |
| 3162 | + getValue: getValueForForm, | |
| 3163 | + name: name16 ?? registration.name, | |
| 3164 | + controlRef: registration.controlRef, | |
| 3165 | + validityData: getCombinedFieldValidityData(validityData, invalid2), | |
| 3166 | + validate | |
| 3167 | + }); | |
| 3168 | + } | |
| 3169 | + function deleteRegistration(id = registrationRef.current?.id) { | |
| 3170 | + if (id) { | |
| 3171 | + formRef.current.fields.delete(id); | |
| 3172 | + } | |
| 3173 | + } | |
| 3174 | + function captureInitialValue(registration) { | |
| 3175 | + if (initialValueCapturedRef.current) { | |
| 3176 | + return; | |
| 3177 | + } | |
| 3178 | + initialValueCapturedRef.current = true; | |
| 3179 | + const initialValue = getRegistrationValue(registration); | |
| 3180 | + setValidityData((prev) => prev.initialValue === initialValue ? prev : { | |
| 3181 | + ...prev, | |
| 3182 | + initialValue | |
| 3183 | + }); | |
| 3184 | + } | |
| 3185 | + useIsoLayoutEffect(() => { | |
| 3186 | + const registration = registrationRef.current; | |
| 3187 | + if (!registration || !registration.id) { | |
| 3188 | + return; | |
| 3189 | + } | |
| 3190 | + setRegisteredFieldName(name16 ? void 0 : registration.name); | |
| 3191 | + formRef.current.fields.set(registration.id, { | |
| 3192 | + getValue: getValueForForm, | |
| 3193 | + name: name16 ?? registration.name, | |
| 3194 | + controlRef: registration.controlRef, | |
| 3195 | + validityData: getCombinedFieldValidityData(validityData, invalid2), | |
| 3196 | + validate | |
| 3197 | + }); | |
| 3198 | + }, [formRef, getValueForForm, invalid2, name16, setRegisteredFieldName, validate, validityData]); | |
| 3199 | + useIsoLayoutEffect(() => { | |
| 3200 | + const fields = formRef.current.fields; | |
| 3201 | + return () => { | |
| 3202 | + const id = registrationRef.current?.id; | |
| 3203 | + if (id) { | |
| 3204 | + fields.delete(id); | |
| 3205 | + } | |
| 3206 | + }; | |
| 3207 | + }, [formRef]); | |
| 3208 | + const register = useStableCallback((source, registration) => { | |
| 3209 | + if (!registration) { | |
| 3210 | + if (activeFieldControlSourceRef.current === source) { | |
| 3211 | + activeFieldControlSourceRef.current = null; | |
| 3212 | + change(void 0, true); | |
| 3213 | + deleteRegistration(); | |
| 3214 | + registrationRef.current = null; | |
| 3215 | + setRegisteredFieldName(void 0); | |
| 3216 | + registeredFieldIdRef.current = void 0; | |
| 3217 | + } | |
| 3218 | + return; | |
| 3219 | + } | |
| 3220 | + const previousId = registrationRef.current?.id; | |
| 3221 | + const previousSource = activeFieldControlSourceRef.current; | |
| 3222 | + if (previousSource && previousSource !== source) { | |
| 3223 | + change(void 0, true); | |
| 3224 | + } | |
| 3225 | + activeFieldControlSourceRef.current = source; | |
| 3226 | + registrationRef.current = registration; | |
| 3227 | + if (!name16) { | |
| 3228 | + setRegisteredFieldName(registration.name); | |
| 3229 | + } | |
| 3230 | + registeredFieldIdRef.current = registration.id; | |
| 3231 | + if (previousId && previousId !== registration.id) { | |
| 3232 | + deleteRegistration(previousId); | |
| 3233 | + } | |
| 3234 | + captureInitialValue(registration); | |
| 3235 | + refreshRegistration(); | |
| 3236 | + }); | |
| 3237 | + return [validate, register]; | |
| 3238 | + } | |
| 3239 | + | |
| 3240 | + // node_modules/@base-ui/react/field/root/FieldRoot.mjs | |
| 3241 | + var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); | |
| 3242 | + var FieldRootInner = /* @__PURE__ */ React33.forwardRef(function FieldRootInner2(componentProps, forwardedRef) { | |
| 3243 | + const { | |
| 3244 | + errors, | |
| 3245 | + validationMode: formValidationMode, | |
| 3246 | + submitCountRef | |
| 3247 | + } = useFormContext(); | |
| 3248 | + const { | |
| 3249 | + render, | |
| 3250 | + className, | |
| 3251 | + validate: validateProp, | |
| 3252 | + validationDebounceTime = 0, | |
| 3253 | + validationMode = formValidationMode, | |
| 3254 | + name: name16, | |
| 3255 | + disabled: disabledProp = false, | |
| 3256 | + invalid: invalidProp, | |
| 3257 | + dirty: dirtyProp, | |
| 3258 | + touched: touchedProp, | |
| 3259 | + actionsRef, | |
| 3260 | + style, | |
| 3261 | + ...elementProps | |
| 3262 | + } = componentProps; | |
| 3263 | + const disabledFieldset = useFieldsetRootContext(true)?.disabled; | |
| 3264 | + const validate = useStableCallback(validateProp || (() => null)); | |
| 3265 | + const disabled2 = disabledFieldset || disabledProp; | |
| 3266 | + const [touchedState, setTouchedUnwrapped] = React33.useState(false); | |
| 3267 | + const [dirtyState, setDirtyUnwrapped] = React33.useState(false); | |
| 3268 | + const [filled, setFilled] = React33.useState(false); | |
| 3269 | + const [focused, setFocused] = React33.useState(false); | |
| 3270 | + const dirty = dirtyProp ?? dirtyState; | |
| 3271 | + const touched = touchedProp ?? touchedState; | |
| 3272 | + const markedDirtyRef = React33.useRef(dirty); | |
| 3273 | + const registeredFieldIdRef = React33.useRef(void 0); | |
| 3274 | + const [registeredFieldName, setRegisteredFieldName] = React33.useState(); | |
| 3275 | + const effectiveName = name16 ?? registeredFieldName; | |
| 3276 | + useIsoLayoutEffect(() => { | |
| 3277 | + if (dirtyProp !== void 0) { | |
| 3278 | + markedDirtyRef.current = dirtyProp; | |
| 3279 | + } | |
| 3280 | + }, [dirtyProp]); | |
| 3281 | + const setDirty = useStableCallback((value) => { | |
| 3282 | + if (dirtyProp !== void 0) { | |
| 3283 | + return; | |
| 3284 | + } | |
| 3285 | + if (value) { | |
| 3286 | + markedDirtyRef.current = true; | |
| 3287 | + } | |
| 3288 | + setDirtyUnwrapped(value); | |
| 3289 | + }); | |
| 3290 | + const setTouched = useStableCallback((value) => { | |
| 3291 | + if (touchedProp !== void 0) { | |
| 3292 | + return; | |
| 3293 | + } | |
| 3294 | + setTouchedUnwrapped(value); | |
| 3295 | + }); | |
| 3296 | + const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitCountRef.current > 0); | |
| 3297 | + const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null; | |
| 3298 | + const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); | |
| 3299 | + const invalid2 = invalidProp === true || hasFormError; | |
| 3300 | + const [validityData, setValidityData] = React33.useState({ | |
| 3301 | + state: DEFAULT_VALIDITY_STATE, | |
| 3302 | + error: "", | |
| 3303 | + errors: [], | |
| 3304 | + value: null, | |
| 3305 | + initialValue: null | |
| 3306 | + }); | |
| 3307 | + const valid2 = !invalid2 && (disabled2 ? null : validityData.state.valid); | |
| 3308 | + const state = React33.useMemo(() => ({ | |
| 3309 | + disabled: disabled2, | |
| 3310 | + touched, | |
| 3311 | + dirty, | |
| 3312 | + valid: valid2, | |
| 3313 | + filled, | |
| 3314 | + focused | |
| 3315 | + }), [disabled2, touched, dirty, valid2, filled, focused]); | |
| 3316 | + const validation = useFieldValidation({ | |
| 3317 | + setValidityData, | |
| 3318 | + validate, | |
| 3319 | + validityData, | |
| 3320 | + validationDebounceTime, | |
| 3321 | + invalid: invalid2, | |
| 3322 | + markedDirtyRef, | |
| 3323 | + state, | |
| 3324 | + shouldValidateOnChange, | |
| 3325 | + validationMode, | |
| 3326 | + registeredFieldIdRef | |
| 3327 | + }); | |
| 3328 | + const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({ | |
| 3329 | + change: validation.change, | |
| 3330 | + commit: validation.commit, | |
| 3331 | + invalid: invalid2, | |
| 3332 | + markedDirtyRef, | |
| 3333 | + name: name16, | |
| 3334 | + setRegisteredFieldName, | |
| 3335 | + registeredFieldIdRef, | |
| 3336 | + setValidityData, | |
| 3337 | + validityData | |
| 3338 | + }); | |
| 3339 | + React33.useImperativeHandle(actionsRef, () => ({ | |
| 3340 | + validate: validateFieldControl | |
| 3341 | + }), [validateFieldControl]); | |
| 3342 | + const contextValue = React33.useMemo(() => ({ | |
| 3343 | + invalid: invalid2, | |
| 3344 | + name: effectiveName, | |
| 3345 | + validityData, | |
| 3346 | + setValidityData, | |
| 3347 | + disabled: disabled2, | |
| 3348 | + setTouched, | |
| 3349 | + setDirty, | |
| 3350 | + setFilled, | |
| 3351 | + setFocused, | |
| 3352 | + validationMode, | |
| 3353 | + shouldValidateOnChange, | |
| 3354 | + state, | |
| 3355 | + registerFieldControl, | |
| 3356 | + validation | |
| 3357 | + }), [invalid2, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]); | |
| 3358 | + const element = useRenderElement("div", componentProps, { | |
| 3359 | + ref: forwardedRef, | |
| 3360 | + state, | |
| 3361 | + props: elementProps, | |
| 3362 | + stateAttributesMapping: fieldValidityMapping | |
| 3363 | + }); | |
| 3364 | + return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FieldRootContext.Provider, { | |
| 3365 | + value: contextValue, | |
| 3366 | + children: element | |
| 3367 | + }); | |
| 3368 | + }); | |
| 3369 | + if (true) FieldRootInner.displayName = "FieldRootInner"; | |
| 3370 | + var FieldRoot = /* @__PURE__ */ React33.forwardRef(function FieldRoot2(componentProps, forwardedRef) { | |
| 3371 | + return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LabelableProvider, { | |
| 3372 | + children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FieldRootInner, { | |
| 3373 | + ...componentProps, | |
| 3374 | + ref: forwardedRef | |
| 3375 | + }) | |
| 3376 | + }); | |
| 3377 | + }); | |
| 3378 | + if (true) FieldRoot.displayName = "FieldRoot"; | |
| 3379 | + | |
| 3380 | + // node_modules/@base-ui/react/field/label/FieldLabel.mjs | |
| 3381 | + var React34 = __toESM(require_react(), 1); | |
| 3382 | + var FieldLabel = /* @__PURE__ */ React34.forwardRef(function FieldLabel2(componentProps, forwardedRef) { | |
| 3383 | + const { | |
| 3384 | + render, | |
| 3385 | + className, | |
| 3386 | + style, | |
| 3387 | + id: idProp, | |
| 3388 | + nativeLabel = true, | |
| 3389 | + ...elementProps | |
| 3390 | + } = componentProps; | |
| 3391 | + const fieldRootContext = useFieldRootContext(false); | |
| 3392 | + const fieldItemContext = useFieldItemContext(); | |
| 3393 | + const { | |
| 3394 | + labelId | |
| 3395 | + } = useLabelableContext(); | |
| 3396 | + const state = { | |
| 3397 | + ...fieldRootContext.state, | |
| 3398 | + disabled: fieldRootContext.disabled || fieldItemContext.disabled | |
| 3399 | + }; | |
| 3400 | + const labelRef = React34.useRef(null); | |
| 3401 | + const labelProps = useLabel({ | |
| 3402 | + id: labelId ?? idProp, | |
| 3403 | + native: nativeLabel | |
| 3404 | + }); | |
| 3405 | + if (true) { | |
| 3406 | + React34.useEffect(() => { | |
| 3407 | + if (!labelRef.current) { | |
| 3408 | + return; | |
| 3409 | + } | |
| 3410 | + const isLabelTag = labelRef.current.tagName === "LABEL"; | |
| 3411 | + if (nativeLabel) { | |
| 3412 | + if (!isLabelTag) { | |
| 3413 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 3414 | + const message = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`."; | |
| 3415 | + error(`${message}${ownerStackMessage}`); | |
| 3416 | + } | |
| 3417 | + } else if (isLabelTag) { | |
| 3418 | + const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; | |
| 3419 | + const message = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`."; | |
| 3420 | + error(`${message}${ownerStackMessage}`); | |
| 3421 | + } | |
| 3422 | + }, [nativeLabel]); | |
| 3423 | + } | |
| 3424 | + const element = useRenderElement("label", componentProps, { | |
| 3425 | + ref: [forwardedRef, labelRef], | |
| 3426 | + state, | |
| 3427 | + props: [labelProps, elementProps], | |
| 3428 | + stateAttributesMapping: fieldValidityMapping | |
| 3429 | + }); | |
| 3430 | + return element; | |
| 3431 | + }); | |
| 3432 | + if (true) FieldLabel.displayName = "FieldLabel"; | |
| 3433 | + | |
| 3434 | + // node_modules/@base-ui/react/field/error/FieldError.mjs | |
| 3435 | + var React35 = __toESM(require_react(), 1); | |
| 3436 | + var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); | |
| 3437 | + var stateAttributesMapping = { | |
| 3438 | + ...fieldValidityMapping, | |
| 3439 | + ...transitionStatusMapping | |
| 3440 | + }; | |
| 3441 | + var FieldError = /* @__PURE__ */ React35.forwardRef(function FieldError2(componentProps, forwardedRef) { | |
| 3442 | + const { | |
| 3443 | + render, | |
| 3444 | + id: idProp, | |
| 3445 | + className, | |
| 3446 | + match, | |
| 3447 | + style, | |
| 3448 | + ...elementProps | |
| 3449 | + } = componentProps; | |
| 3450 | + const id = useBaseUiId(idProp); | |
| 3451 | + const { | |
| 3452 | + validityData, | |
| 3453 | + state: fieldState, | |
| 3454 | + name: name16 | |
| 3455 | + } = useFieldRootContext(false); | |
| 3456 | + const { | |
| 3457 | + setMessageIds | |
| 3458 | + } = useLabelableContext(); | |
| 3459 | + const { | |
| 3460 | + errors | |
| 3461 | + } = useFormContext(); | |
| 3462 | + const formError = name16 && Object.hasOwn(errors, name16) ? errors[name16] : null; | |
| 3463 | + const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); | |
| 3464 | + const hasSpecificMatch = typeof match === "string"; | |
| 3465 | + let rendered = false; | |
| 3466 | + if (match === true) { | |
| 3467 | + rendered = true; | |
| 3468 | + } else if (fieldState.disabled) { | |
| 3469 | + rendered = false; | |
| 3470 | + } else if (hasSpecificMatch) { | |
| 3471 | + rendered = Boolean(validityData.state[match]); | |
| 3472 | + } else { | |
| 3473 | + rendered = hasFormError || validityData.state.valid === false; | |
| 3474 | + } | |
| 3475 | + const { | |
| 3476 | + mounted, | |
| 3477 | + transitionStatus, | |
| 3478 | + setMounted | |
| 3479 | + } = useTransitionStatus(rendered); | |
| 3480 | + useIsoLayoutEffect(() => { | |
| 3481 | + if (!rendered || !id) { | |
| 3482 | + return void 0; | |
| 3483 | + } | |
| 3484 | + setMessageIds((v) => v.concat(id)); | |
| 3485 | + return () => { | |
| 3486 | + setMessageIds((v) => v.filter((item) => item !== id)); | |
| 3487 | + }; | |
| 3488 | + }, [rendered, id, setMessageIds]); | |
| 3489 | + const errorRef = React35.useRef(null); | |
| 3490 | + const [lastRenderedMessage, setLastRenderedMessage] = React35.useState(null); | |
| 3491 | + const [lastRenderedMessageKey, setLastRenderedMessageKey] = React35.useState(null); | |
| 3492 | + let error2 = validityData.error; | |
| 3493 | + if (!hasSpecificMatch && hasFormError) { | |
| 3494 | + error2 = formError; | |
| 3495 | + } else if (validityData.errors.length > 1) { | |
| 3496 | + error2 = validityData.errors; | |
| 3497 | + } | |
| 3498 | + let errorMessage = error2; | |
| 3499 | + if (Array.isArray(error2)) { | |
| 3500 | + errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { | |
| 3501 | + children: error2.map((message) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { | |
| 3502 | + children: message | |
| 3503 | + }, message)) | |
| 3504 | + }) : error2[0]; | |
| 3505 | + } | |
| 3506 | + const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2; | |
| 3507 | + if (rendered && errorKey !== lastRenderedMessageKey) { | |
| 3508 | + setLastRenderedMessageKey(errorKey); | |
| 3509 | + setLastRenderedMessage(errorMessage); | |
| 3510 | + } | |
| 3511 | + useOpenChangeComplete({ | |
| 3512 | + open: rendered, | |
| 3513 | + ref: errorRef, | |
| 3514 | + onComplete() { | |
| 3515 | + if (!rendered) { | |
| 3516 | + setMounted(false); | |
| 3517 | + } | |
| 3518 | + } | |
| 3519 | + }); | |
| 3520 | + const state = { | |
| 3521 | + ...fieldState, | |
| 3522 | + transitionStatus | |
| 3523 | + }; | |
| 3524 | + const element = useRenderElement("div", componentProps, { | |
| 3525 | + ref: [forwardedRef, errorRef], | |
| 3526 | + state, | |
| 3527 | + props: [{ | |
| 3528 | + id, | |
| 3529 | + children: rendered ? errorMessage : lastRenderedMessage | |
| 3530 | + }, elementProps], | |
| 3531 | + stateAttributesMapping, | |
| 3532 | + enabled: mounted | |
| 3533 | + }); | |
| 3534 | + if (!mounted) { | |
| 3535 | + return null; | |
| 3536 | + } | |
| 3537 | + return element; | |
| 3538 | + }); | |
| 3539 | + if (true) FieldError.displayName = "FieldError"; | |
| 3540 | + | |
| 3541 | + // node_modules/@base-ui/react/field/description/FieldDescription.mjs | |
| 3542 | + var React36 = __toESM(require_react(), 1); | |
| 3543 | + var FieldDescription = /* @__PURE__ */ React36.forwardRef(function FieldDescription2(componentProps, forwardedRef) { | |
| 3544 | + const { | |
| 3545 | + render, | |
| 3546 | + id: idProp, | |
| 3547 | + className, | |
| 3548 | + style, | |
| 3549 | + ...elementProps | |
| 3550 | + } = componentProps; | |
| 3551 | + const id = useBaseUiId(idProp); | |
| 3552 | + const fieldRootContext = useFieldRootContext(false); | |
| 3553 | + const fieldItemContext = useFieldItemContext(); | |
| 3554 | + const { | |
| 3555 | + setMessageIds | |
| 3556 | + } = useLabelableContext(); | |
| 3557 | + const state = { | |
| 3558 | + ...fieldRootContext.state, | |
| 3559 | + disabled: fieldRootContext.disabled || fieldItemContext.disabled | |
| 3560 | + }; | |
| 3561 | + useIsoLayoutEffect(() => { | |
| 3562 | + if (!id) { | |
| 3563 | + return void 0; | |
| 3564 | + } | |
| 3565 | + setMessageIds((v) => v.concat(id)); | |
| 3566 | + return () => { | |
| 3567 | + setMessageIds((v) => v.filter((item) => item !== id)); | |
| 3568 | + }; | |
| 3569 | + }, [id, setMessageIds]); | |
| 3570 | + const element = useRenderElement("p", componentProps, { | |
| 3571 | + ref: forwardedRef, | |
| 3572 | + state, | |
| 3573 | + props: [{ | |
| 3574 | + id | |
| 3575 | + }, elementProps], | |
| 3576 | + stateAttributesMapping: fieldValidityMapping | |
| 3577 | + }); | |
| 3578 | + return element; | |
| 3579 | + }); | |
| 3580 | + if (true) FieldDescription.displayName = "FieldDescription"; | |
| 3581 | + | |
| 3582 | + // node_modules/@base-ui/react/field/control/FieldControl.mjs | |
| 3583 | + var React37 = __toESM(require_react(), 1); | |
| 3584 | + var FieldControl = /* @__PURE__ */ React37.forwardRef(function FieldControl2(componentProps, forwardedRef) { | |
| 3585 | + const { | |
| 3586 | + render, | |
| 3587 | + className, | |
| 3588 | + id: idProp, | |
| 3589 | + name: nameProp, | |
| 3590 | + value: valueProp, | |
| 3591 | + disabled: disabledProp = false, | |
| 3592 | + onValueChange, | |
| 3593 | + defaultValue, | |
| 3594 | + autoFocus = false, | |
| 3595 | + style, | |
| 3596 | + ...elementProps | |
| 3597 | + } = componentProps; | |
| 3598 | + const { | |
| 3599 | + state: fieldState, | |
| 3600 | + name: fieldName, | |
| 3601 | + disabled: fieldDisabled, | |
| 3602 | + setTouched, | |
| 3603 | + setDirty, | |
| 3604 | + validityData, | |
| 3605 | + setFocused, | |
| 3606 | + setFilled, | |
| 3607 | + validationMode, | |
| 3608 | + validation | |
| 3609 | + } = useFieldRootContext(); | |
| 3610 | + const { | |
| 3611 | + clearErrors, | |
| 3612 | + elementRef: formElementRef, | |
| 3613 | + submitCountRef | |
| 3614 | + } = useFormContext(); | |
| 3615 | + const disabled2 = fieldDisabled || disabledProp; | |
| 3616 | + const name16 = fieldName ?? nameProp; | |
| 3617 | + const state = { | |
| 3618 | + ...fieldState, | |
| 3619 | + disabled: disabled2 | |
| 3620 | + }; | |
| 3621 | + const { | |
| 3622 | + labelId | |
| 3623 | + } = useLabelableContext(); | |
| 3624 | + const id = useLabelableId({ | |
| 3625 | + id: idProp | |
| 3626 | + }); | |
| 3627 | + const [valueUnwrapped] = useControlled({ | |
| 3628 | + controlled: valueProp, | |
| 3629 | + default: defaultValue, | |
| 3630 | + name: "FieldControl", | |
| 3631 | + state: "value" | |
| 3632 | + }); | |
| 3633 | + const isControlled = valueProp !== void 0; | |
| 3634 | + const value = isControlled ? valueUnwrapped : void 0; | |
| 3635 | + const serializedValue = value == null ? void 0 : String(value); | |
| 3636 | + const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value); | |
| 3637 | + useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled2, nameProp); | |
| 3638 | + useIsoLayoutEffect(() => { | |
| 3639 | + const currentValue = serializedValue ?? validation.inputRef.current?.value; | |
| 3640 | + if (currentValue !== void 0) { | |
| 3641 | + setFilled(currentValue !== ""); | |
| 3642 | + } | |
| 3643 | + }, [serializedValue, validation.inputRef, setFilled]); | |
| 3644 | + useValueChanged(serializedValue, () => { | |
| 3645 | + if (serializedValue === void 0) { | |
| 3646 | + return; | |
| 3647 | + } | |
| 3648 | + clearErrors(name16); | |
| 3649 | + setDirty(serializedValue !== (validityData.initialValue ?? "")); | |
| 3650 | + validation.change(serializedValue); | |
| 3651 | + }); | |
| 3652 | + const inputRef = React37.useRef(null); | |
| 3653 | + const enterValidationTimeout = useTimeout(); | |
| 3654 | + useIsoLayoutEffect(() => { | |
| 3655 | + if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) { | |
| 3656 | + setFocused(true); | |
| 3657 | + } | |
| 3658 | + }, [autoFocus, setFocused]); | |
| 3659 | + const element = useRenderElement("input", componentProps, { | |
| 3660 | + ref: [forwardedRef, inputRef], | |
| 3661 | + state, | |
| 3662 | + props: [{ | |
| 3663 | + id, | |
| 3664 | + disabled: disabled2, | |
| 3665 | + name: name16, | |
| 3666 | + ref: validation.inputRef, | |
| 3667 | + "aria-labelledby": labelId, | |
| 3668 | + autoFocus, | |
| 3669 | + ...isControlled ? { | |
| 3670 | + value | |
| 3671 | + } : { | |
| 3672 | + defaultValue | |
| 3673 | + }, | |
| 3674 | + onChange(event) { | |
| 3675 | + const inputValue = event.currentTarget.value; | |
| 3676 | + const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent); | |
| 3677 | + onValueChange?.(inputValue, details); | |
| 3678 | + if (isControlled) { | |
| 3679 | + return; | |
| 3680 | + } | |
| 3681 | + setDirty(inputValue !== (validityData.initialValue ?? "")); | |
| 3682 | + setFilled(inputValue !== ""); | |
| 3683 | + if (!event.nativeEvent.defaultPrevented && !details.isCanceled) { | |
| 3684 | + clearErrors(name16); | |
| 3685 | + validation.change(inputValue); | |
| 3686 | + } | |
| 3687 | + }, | |
| 3688 | + onFocus() { | |
| 3689 | + setFocused(true); | |
| 3690 | + }, | |
| 3691 | + onBlur(event) { | |
| 3692 | + setTouched(true); | |
| 3693 | + setFocused(false); | |
| 3694 | + if (validationMode === "onBlur") { | |
| 3695 | + const inputValue = event.currentTarget.value; | |
| 3696 | + validation.commit(inputValue); | |
| 3697 | + if (isControlled) { | |
| 3698 | + queueMicrotask(() => { | |
| 3699 | + const nextValue = validation.inputRef.current?.value; | |
| 3700 | + if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) { | |
| 3701 | + validation.commit(nextValue); | |
| 3702 | + } | |
| 3703 | + }); | |
| 3704 | + } | |
| 3705 | + } | |
| 3706 | + }, | |
| 3707 | + onKeyDown(event) { | |
| 3708 | + if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") { | |
| 3709 | + setTouched(true); | |
| 3710 | + const value2 = event.currentTarget.value; | |
| 3711 | + const form = event.currentTarget.form; | |
| 3712 | + if (form && form === formElementRef.current && !event.defaultPrevented) { | |
| 3713 | + const input = event.currentTarget; | |
| 3714 | + const submitCount = submitCountRef.current; | |
| 3715 | + enterValidationTimeout.start(0, () => { | |
| 3716 | + if (submitCountRef.current === submitCount) { | |
| 3717 | + validation.commit(input.value); | |
| 3718 | + } | |
| 3719 | + }); | |
| 3720 | + } else { | |
| 3721 | + validation.commit(value2); | |
| 3722 | + } | |
| 3723 | + } | |
| 3724 | + } | |
| 3725 | + }, elementProps, (props) => validation.getValidationProps(disabled2, props)], | |
| 3726 | + stateAttributesMapping: fieldValidityMapping | |
| 3727 | + }); | |
| 3728 | + return element; | |
| 3729 | + }); | |
| 3730 | + if (true) FieldControl.displayName = "FieldControl"; | |
| 3731 | + | |
| 3732 | + // node_modules/@base-ui/react/field/validity/FieldValidity.mjs | |
| 3733 | + var React38 = __toESM(require_react(), 1); | |
| 3734 | + var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); | |
| 3735 | + var FieldValidity = function FieldValidity2(props) { | |
| 3736 | + const { | |
| 3737 | + children | |
| 3738 | + } = props; | |
| 3739 | + const { | |
| 3740 | + validityData, | |
| 3741 | + invalid: invalid2 | |
| 3742 | + } = useFieldRootContext(false); | |
| 3743 | + const combinedFieldValidityData = React38.useMemo(() => getCombinedFieldValidityData(validityData, invalid2), [validityData, invalid2]); | |
| 3744 | + const isInvalid = combinedFieldValidityData.state.valid === false; | |
| 3745 | + const { | |
| 3746 | + transitionStatus | |
| 3747 | + } = useTransitionStatus(isInvalid); | |
| 3748 | + const fieldValidityState = React38.useMemo(() => { | |
| 3749 | + return { | |
| 3750 | + ...combinedFieldValidityData, | |
| 3751 | + validity: combinedFieldValidityData.state, | |
| 3752 | + transitionStatus | |
| 3753 | + }; | |
| 3754 | + }, [combinedFieldValidityData, transitionStatus]); | |
| 3755 | + return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(React38.Fragment, { | |
| 3756 | + children: children(fieldValidityState) | |
| 3757 | + }); | |
| 3758 | + }; | |
| 3759 | + if (true) FieldValidity.displayName = "FieldValidity"; | |
| 3760 | + | |
| 3761 | + // node_modules/@base-ui/react/field/item/FieldItem.mjs | |
| 3762 | + var React39 = __toESM(require_react(), 1); | |
| 3763 | + var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); | |
| 3764 | + var FieldItem = /* @__PURE__ */ React39.forwardRef(function FieldItem2(componentProps, forwardedRef) { | |
| 3765 | + const { | |
| 3766 | + render, | |
| 3767 | + className, | |
| 3768 | + style, | |
| 3769 | + disabled: disabledProp = false, | |
| 3770 | + ...elementProps | |
| 3771 | + } = componentProps; | |
| 3772 | + const { | |
| 3773 | + state: fieldState, | |
| 3774 | + disabled: rootDisabled | |
| 3775 | + } = useFieldRootContext(false); | |
| 3776 | + const disabled2 = rootDisabled || disabledProp; | |
| 3777 | + const state = { | |
| 3778 | + ...fieldState, | |
| 3779 | + disabled: disabled2 | |
| 3780 | + }; | |
| 3781 | + const fieldItemContext = React39.useMemo(() => ({ | |
| 3782 | + disabled: disabled2 | |
| 3783 | + }), [disabled2]); | |
| 3784 | + const element = useRenderElement("div", componentProps, { | |
| 3785 | + ref: forwardedRef, | |
| 3786 | + state, | |
| 3787 | + props: elementProps, | |
| 3788 | + stateAttributesMapping: fieldValidityMapping | |
| 3789 | + }); | |
| 3790 | + return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LabelableProvider, { | |
| 3791 | + children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FieldItemContext.Provider, { | |
| 3792 | + value: fieldItemContext, | |
| 3793 | + children: element | |
| 3794 | + }) | |
| 3795 | + }); | |
| 3796 | + }); | |
| 3797 | + if (true) FieldItem.displayName = "FieldItem"; | |
| 3798 | + | |
| 3799 | + // node_modules/@base-ui/react/input/Input.mjs | |
| 3800 | + var React40 = __toESM(require_react(), 1); | |
| 3801 | + var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); | |
| 3802 | + var Input = /* @__PURE__ */ React40.forwardRef(function Input2(props, forwardedRef) { | |
| 3803 | + return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(index_parts_exports.Control, { | |
| 3804 | + ref: forwardedRef, | |
| 3805 | + ...props | |
| 3806 | + }); | |
| 3807 | + }); | |
| 3808 | + if (true) Input.displayName = "Input"; | |
| 3809 | + | |
| 3810 | + // node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs | |
| 3811 | + var React42 = __toESM(require_react(), 1); | |
| 3812 | + | |
| 3813 | + // node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs | |
| 3814 | + var React41 = __toESM(require_react(), 1); | |
| 3815 | + | |
| 3816 | + // node_modules/@base-ui/react/internals/composite/constants.mjs | |
| 3817 | + var ACTIVE_COMPOSITE_ITEM = "data-composite-item-active"; | |
| 3818 | + | |
| 3819 | + // node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs | |
| 3820 | + function useCompositeRoot(params) { | |
| 3821 | + const { | |
| 3822 | + loopFocus = true, | |
| 3823 | + orientation = "both", | |
| 3824 | + grid, | |
| 3825 | + onLoop, | |
| 3826 | + direction, | |
| 3827 | + highlightedIndex: externalHighlightedIndex, | |
| 3828 | + onHighlightedIndexChange: externalSetHighlightedIndex, | |
| 3829 | + rootRef: externalRef, | |
| 3830 | + enableHomeAndEndKeys = false, | |
| 3831 | + stopEventPropagation, | |
| 3832 | + disabledIndices, | |
| 3833 | + modifierKeys = EMPTY_ARRAY | |
| 3834 | + } = params; | |
| 3835 | + const [internalHighlightedIndex, internalSetHighlightedIndex] = React41.useState(0); | |
| 3836 | + const isGrid = grid != null; | |
| 3837 | + const rootRef = React41.useRef(null); | |
| 3838 | + const mergedRef = useMergedRefs(rootRef, externalRef); | |
| 3839 | + const elementsRef = React41.useRef([]); | |
| 3840 | + const hasSetDefaultIndexRef = React41.useRef(false); | |
| 3841 | + const highlightedElementRef = React41.useRef(null); | |
| 3842 | + const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex; | |
| 3843 | + const onHighlightedIndexChange = useStableCallback((index2, shouldScrollIntoView = false) => { | |
| 3844 | + highlightedElementRef.current = elementsRef.current[index2] ?? null; | |
| 3845 | + (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index2); | |
| 3846 | + if (shouldScrollIntoView) { | |
| 3847 | + const newActiveItem = elementsRef.current[index2]; | |
| 3848 | + scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation); | |
| 3849 | + } | |
| 3850 | + }); | |
| 3851 | + const onMapChange = useStableCallback((map) => { | |
| 3852 | + if (map.size === 0) { | |
| 3853 | + return; | |
| 3854 | + } | |
| 3855 | + if (hasSetDefaultIndexRef.current) { | |
| 3856 | + const elements = elementsRef.current; | |
| 3857 | + const nextIndex = elements.indexOf(highlightedElementRef.current); | |
| 3858 | + if (nextIndex === -1) { | |
| 3859 | + const replacement = elements[highlightedIndex]; | |
| 3860 | + if (!replacement || isListIndexDisabled(elements, highlightedIndex, disabledIndices)) { | |
| 3861 | + onHighlightedIndexChange(getFallbackIndex(elements, disabledIndices)); | |
| 3862 | + } else { | |
| 3863 | + highlightedElementRef.current = replacement; | |
| 3864 | + } | |
| 3865 | + } else if (nextIndex !== highlightedIndex) { | |
| 3866 | + onHighlightedIndexChange(nextIndex); | |
| 3867 | + } | |
| 3868 | + return; | |
| 3869 | + } | |
| 3870 | + hasSetDefaultIndexRef.current = true; | |
| 3871 | + const sortedElements = Array.from(map.keys()); | |
| 3872 | + const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null; | |
| 3873 | + const activeIndex = activeItem ? map.get(activeItem)?.index ?? -1 : -1; | |
| 3874 | + if (activeIndex !== -1) { | |
| 3875 | + onHighlightedIndexChange(activeIndex); | |
| 3876 | + } else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) { | |
| 3877 | + const firstEnabledIndex = findNonDisabledListIndex(sortedElements, { | |
| 3878 | + disabledIndices | |
| 3879 | + }); | |
| 3880 | + if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) { | |
| 3881 | + onHighlightedIndexChange(firstEnabledIndex); | |
| 3882 | + } | |
| 3883 | + } | |
| 3884 | + scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation); | |
| 3885 | + }); | |
| 3886 | + useIsoLayoutEffect(() => { | |
| 3887 | + if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) { | |
| 3888 | + return; | |
| 3889 | + } | |
| 3890 | + const elements = elementsRef.current; | |
| 3891 | + if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) { | |
| 3892 | + const firstEnabledIndex = findNonDisabledListIndex(elements, { | |
| 3893 | + disabledIndices | |
| 3894 | + }); | |
| 3895 | + if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) { | |
| 3896 | + onHighlightedIndexChange(firstEnabledIndex); | |
| 3897 | + } | |
| 3898 | + } | |
| 3899 | + }, [disabledIndices, externalHighlightedIndex, highlightedIndex, elementsRef, onHighlightedIndexChange]); | |
| 3900 | + const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => { | |
| 3901 | + if (!onLoop) { | |
| 3902 | + return nextIndex; | |
| 3903 | + } | |
| 3904 | + return onLoop(event, prevIndex, nextIndex, elementsRef); | |
| 3905 | + }); | |
| 3906 | + const onKeyDown = useStableCallback((event) => { | |
| 3907 | + const isHomeOrEnd = event.key === HOME || event.key === END; | |
| 3908 | + if (!COMPOSITE_KEYS.has(event.key) || !enableHomeAndEndKeys && isHomeOrEnd) { | |
| 3909 | + return; | |
| 3910 | + } | |
| 3911 | + if (isModifierKeySet(event, modifierKeys)) { | |
| 3912 | + return; | |
| 3913 | + } | |
| 3914 | + const element = rootRef.current; | |
| 3915 | + if (!element) { | |
| 3916 | + return; | |
| 3917 | + } | |
| 3918 | + const isRtl = direction === "rtl"; | |
| 3919 | + const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT; | |
| 3920 | + const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT; | |
| 3921 | + const forwardKey = orientation === "vertical" ? ARROW_DOWN : horizontalForwardKey; | |
| 3922 | + const backwardKey = orientation === "vertical" ? ARROW_UP : horizontalBackwardKey; | |
| 3923 | + const target = getTarget(event.nativeEvent); | |
| 3924 | + if (target != null && isNativeInput(target) && !isElementDisabled(target)) { | |
| 3925 | + const selectionStart = target.selectionStart; | |
| 3926 | + const selectionEnd = target.selectionEnd; | |
| 3927 | + const textContent = target.value; | |
| 3928 | + if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) { | |
| 3929 | + return; | |
| 3930 | + } | |
| 3931 | + if (event.key !== backwardKey && selectionStart < textContent.length) { | |
| 3932 | + return; | |
| 3933 | + } | |
| 3934 | + if (event.key !== forwardKey && selectionStart > 0) { | |
| 3935 | + return; | |
| 3936 | + } | |
| 3937 | + } | |
| 3938 | + let nextIndex = highlightedIndex; | |
| 3939 | + const minIndex = getMinListIndex(elementsRef, disabledIndices); | |
| 3940 | + const maxIndex = getMaxListIndex(elementsRef, disabledIndices); | |
| 3941 | + if (grid != null) { | |
| 3942 | + nextIndex = grid({ | |
| 3943 | + disabledIndices, | |
| 3944 | + elementsRef, | |
| 3945 | + event, | |
| 3946 | + highlightedIndex, | |
| 3947 | + loopFocus, | |
| 3948 | + maxIndex, | |
| 3949 | + minIndex, | |
| 3950 | + onLoop: wrappedOnLoop, | |
| 3951 | + orientation, | |
| 3952 | + rtl: isRtl | |
| 3953 | + }); | |
| 3954 | + } | |
| 3955 | + const isForwardKey = orientation !== "vertical" && event.key === horizontalForwardKey || orientation !== "horizontal" && event.key === ARROW_DOWN; | |
| 3956 | + const isBackwardKey = orientation !== "vertical" && event.key === horizontalBackwardKey || orientation !== "horizontal" && event.key === ARROW_UP; | |
| 3957 | + if (enableHomeAndEndKeys) { | |
| 3958 | + if (event.key === HOME) { | |
| 3959 | + nextIndex = minIndex; | |
| 3960 | + } else if (event.key === END) { | |
| 3961 | + nextIndex = maxIndex; | |
| 3962 | + } | |
| 3963 | + } | |
| 3964 | + if (nextIndex === highlightedIndex && (isForwardKey || isBackwardKey)) { | |
| 3965 | + if (loopFocus && nextIndex === maxIndex && isForwardKey) { | |
| 3966 | + nextIndex = minIndex; | |
| 3967 | + if (onLoop) { | |
| 3968 | + nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef); | |
| 3969 | + } | |
| 3970 | + } else if (loopFocus && nextIndex === minIndex && isBackwardKey) { | |
| 3971 | + nextIndex = maxIndex; | |
| 3972 | + if (onLoop) { | |
| 3973 | + nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef); | |
| 3974 | + } | |
| 3975 | + } else { | |
| 3976 | + nextIndex = findNonDisabledListIndex(elementsRef.current, { | |
| 3977 | + startingIndex: nextIndex, | |
| 3978 | + decrement: isBackwardKey, | |
| 3979 | + disabledIndices | |
| 3980 | + }); | |
| 3981 | + } | |
| 3982 | + } | |
| 3983 | + if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) { | |
| 3984 | + if (stopEventPropagation) { | |
| 3985 | + event.stopPropagation(); | |
| 3986 | + } | |
| 3987 | + if (isGrid || isHomeOrEnd || isForwardKey || isBackwardKey) { | |
| 3988 | + event.preventDefault(); | |
| 3989 | + } | |
| 3990 | + onHighlightedIndexChange(nextIndex, true); | |
| 3991 | + queueMicrotask(() => { | |
| 3992 | + elementsRef.current[nextIndex]?.focus(); | |
| 3993 | + }); | |
| 3994 | + } | |
| 3995 | + }); | |
| 3996 | + const props = { | |
| 3997 | + ref: mergedRef, | |
| 3998 | + onFocus(event) { | |
| 3999 | + const element = rootRef.current; | |
| 4000 | + const target = getTarget(event.nativeEvent); | |
| 4001 | + if (!element || target == null || !isNativeInput(target)) { | |
| 4002 | + return; | |
| 4003 | + } | |
| 4004 | + target.setSelectionRange(0, target.value.length); | |
| 4005 | + }, | |
| 4006 | + onKeyDown | |
| 4007 | + }; | |
| 4008 | + return { | |
| 4009 | + props, | |
| 4010 | + highlightedIndex, | |
| 4011 | + onHighlightedIndexChange, | |
| 4012 | + elementsRef, | |
| 4013 | + onMapChange, | |
| 4014 | + relayKeyboardEvent: onKeyDown | |
| 4015 | + }; | |
| 4016 | + } | |
| 4017 | + function getFallbackIndex(elements, disabledIndices) { | |
| 4018 | + let fallbackIndex = -1; | |
| 4019 | + for (let index2 = 0; index2 < elements.length; index2 += 1) { | |
| 4020 | + const element = elements[index2]; | |
| 4021 | + if (!element || isListIndexDisabled(elements, index2, disabledIndices)) { | |
| 4022 | + continue; | |
| 4023 | + } | |
| 4024 | + if (element.hasAttribute(ACTIVE_COMPOSITE_ITEM)) { | |
| 4025 | + return index2; | |
| 4026 | + } | |
| 4027 | + if (fallbackIndex === -1) { | |
| 4028 | + fallbackIndex = index2; | |
| 4029 | + } | |
| 4030 | + } | |
| 4031 | + return Math.max(fallbackIndex, 0); | |
| 4032 | + } | |
| 4033 | + function isModifierKeySet(event, ignoredModifierKeys) { | |
| 4034 | + for (const key of MODIFIER_KEYS) { | |
| 4035 | + if (ignoredModifierKeys.includes(key)) { | |
| 4036 | + continue; | |
| 4037 | + } | |
| 4038 | + if (event.getModifierState(key)) { | |
| 4039 | + return true; | |
| 4040 | + } | |
| 4041 | + } | |
| 4042 | + return false; | |
| 4043 | + } | |
| 4044 | + | |
| 4045 | + // node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs | |
| 4046 | + var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); | |
| 4047 | + function CompositeRoot(componentProps) { | |
| 4048 | + const { | |
| 4049 | + render, | |
| 4050 | + className, | |
| 4051 | + style, | |
| 4052 | + refs = EMPTY_ARRAY, | |
| 4053 | + props = EMPTY_ARRAY, | |
| 4054 | + state = EMPTY_OBJECT, | |
| 4055 | + stateAttributesMapping: stateAttributesMapping4, | |
| 4056 | + highlightedIndex: highlightedIndexProp, | |
| 4057 | + onHighlightedIndexChange: onHighlightedIndexChangeProp, | |
| 4058 | + orientation, | |
| 4059 | + grid, | |
| 4060 | + loopFocus, | |
| 4061 | + onLoop, | |
| 4062 | + enableHomeAndEndKeys, | |
| 4063 | + onMapChange: onMapChangeProp, | |
| 4064 | + stopEventPropagation = true, | |
| 4065 | + rootRef, | |
| 4066 | + disabledIndices, | |
| 4067 | + modifierKeys, | |
| 4068 | + highlightItemOnHover = false, | |
| 4069 | + tag = "div", | |
| 4070 | + ...elementProps | |
| 4071 | + } = componentProps; | |
| 4072 | + const direction = useDirection(); | |
| 4073 | + const { | |
| 4074 | + props: defaultProps, | |
| 4075 | + highlightedIndex, | |
| 4076 | + onHighlightedIndexChange, | |
| 4077 | + elementsRef, | |
| 4078 | + onMapChange: onMapChangeUnwrapped, | |
| 4079 | + relayKeyboardEvent | |
| 4080 | + } = useCompositeRoot({ | |
| 4081 | + grid, | |
| 4082 | + loopFocus, | |
| 4083 | + onLoop, | |
| 4084 | + orientation, | |
| 4085 | + highlightedIndex: highlightedIndexProp, | |
| 4086 | + onHighlightedIndexChange: onHighlightedIndexChangeProp, | |
| 4087 | + rootRef, | |
| 4088 | + stopEventPropagation, | |
| 4089 | + enableHomeAndEndKeys, | |
| 4090 | + direction, | |
| 4091 | + disabledIndices, | |
| 4092 | + modifierKeys | |
| 4093 | + }); | |
| 4094 | + const element = useRenderElement(tag, componentProps, { | |
| 4095 | + state, | |
| 4096 | + ref: refs, | |
| 4097 | + props: [defaultProps, ...props, elementProps], | |
| 4098 | + stateAttributesMapping: stateAttributesMapping4 | |
| 4099 | + }); | |
| 4100 | + const contextValue = React42.useMemo(() => ({ | |
| 4101 | + highlightedIndex, | |
| 4102 | + onHighlightedIndexChange, | |
| 4103 | + highlightItemOnHover, | |
| 4104 | + relayKeyboardEvent | |
| 4105 | + }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]); | |
| 4106 | + return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CompositeRootContext.Provider, { | |
| 4107 | + value: contextValue, | |
| 4108 | + children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CompositeList, { | |
| 4109 | + elementsRef, | |
| 4110 | + onMapChange: (newMap) => { | |
| 4111 | + onMapChangeProp?.(newMap); | |
| 4112 | + onMapChangeUnwrapped(newMap); | |
| 4113 | + }, | |
| 4114 | + children: element | |
| 4115 | + }) | |
| 4116 | + }); | |
| 4117 | + } | |
| 4118 | + | |
| 4119 | + // node_modules/@base-ui/react/internals/prehydrationScript.stub.mjs | |
| 4120 | + var script = ""; | |
| 4121 | + | |
| 4122 | + // node_modules/@base-ui/react/utils/useIsHydrating.mjs | |
| 4123 | + var import_shim = __toESM(require_shim(), 1); | |
| 4124 | + function subscribe() { | |
| 4125 | + return NOOP; | |
| 4126 | + } | |
| 4127 | + function getSnapshot() { | |
| 4128 | + return false; | |
| 4129 | + } | |
| 4130 | + function getServerSnapshot() { | |
| 4131 | + return true; | |
| 4132 | + } | |
| 4133 | + function useIsHydrating() { | |
| 4134 | + return (0, import_shim.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot); | |
| 4135 | + } | |
| 4136 | + | |
| 4137 | + // node_modules/@base-ui/react/internals/PrehydrationScript.mjs | |
| 4138 | + var React43 = __toESM(require_react(), 1); | |
| 4139 | + var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); | |
| 4140 | + function PrehydrationScript(props) { | |
| 4141 | + const { | |
| 4142 | + script: script2 | |
| 4143 | + } = props; | |
| 4144 | + const { | |
| 4145 | + nonce | |
| 4146 | + } = useCSPContext(); | |
| 4147 | + const isHydrating = useIsHydrating(); | |
| 4148 | + if (!isHydrating) { | |
| 4149 | + return null; | |
| 4150 | + } | |
| 4151 | + return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("script", { | |
| 4152 | + nonce, | |
| 4153 | + dangerouslySetInnerHTML: { | |
| 4154 | + __html: script2 | |
| 4155 | + }, | |
| 4156 | + suppressHydrationWarning: true | |
| 4157 | + }); | |
| 4158 | + } | |
| 4159 | + | |
| 4160 | + // node_modules/@base-ui/react/tabs/index.parts.mjs | |
| 4161 | + var index_parts_exports2 = {}; | |
| 4162 | + __export(index_parts_exports2, { | |
| 4163 | + Indicator: () => TabsIndicator, | |
| 4164 | + List: () => TabsList, | |
| 4165 | + Panel: () => TabsPanel, | |
| 4166 | + Root: () => TabsRoot, | |
| 4167 | + Tab: () => TabsTab | |
| 4168 | + }); | |
| 4169 | + | |
| 4170 | + // node_modules/@base-ui/react/tabs/root/TabsRoot.mjs | |
| 4171 | + var React45 = __toESM(require_react(), 1); | |
| 4172 | + | |
| 4173 | + // node_modules/@base-ui/react/tabs/root/TabsRootContext.mjs | |
| 4174 | + var React44 = __toESM(require_react(), 1); | |
| 4175 | + var TabsRootContext = /* @__PURE__ */ React44.createContext(void 0); | |
| 4176 | + if (true) TabsRootContext.displayName = "TabsRootContext"; | |
| 4177 | + function useTabsRootContext() { | |
| 4178 | + const context = React44.useContext(TabsRootContext); | |
| 4179 | + if (context === void 0) { | |
| 4180 | + throw new Error(true ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage_default(64)); | |
| 4181 | + } | |
| 4182 | + return context; | |
| 4183 | + } | |
| 4184 | + | |
| 4185 | + // node_modules/@base-ui/react/tabs/root/TabsRootDataAttributes.mjs | |
| 4186 | + var activationDirection = "data-activation-direction"; | |
| 4187 | + | |
| 4188 | + // node_modules/@base-ui/react/tabs/root/stateAttributesMapping.mjs | |
| 4189 | + var tabsStateAttributesMapping = { | |
| 4190 | + tabActivationDirection: (dir) => ({ | |
| 4191 | + [activationDirection]: dir | |
| 4192 | + }) | |
| 4193 | + }; | |
| 4194 | + | |
| 4195 | + // node_modules/@base-ui/react/tabs/root/TabsRoot.mjs | |
| 4196 | + var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); | |
| 4197 | + var TabsRoot = /* @__PURE__ */ React45.forwardRef(function TabsRoot2(componentProps, forwardedRef) { | |
| 4198 | + const { | |
| 4199 | + className, | |
| 4200 | + defaultValue: defaultValueProp = 0, | |
| 4201 | + onValueChange: onValueChangeProp, | |
| 4202 | + orientation = "horizontal", | |
| 4203 | + render, | |
| 4204 | + value: valueProp, | |
| 4205 | + style, | |
| 4206 | + ...elementProps | |
| 4207 | + } = componentProps; | |
| 4208 | + const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0; | |
| 4209 | + const tabPanelRefs = React45.useRef([]); | |
| 4210 | + const [mountedTabPanels, setMountedTabPanels] = React45.useState(() => /* @__PURE__ */ new Map()); | |
| 4211 | + const [value, setValue] = useControlled({ | |
| 4212 | + controlled: valueProp, | |
| 4213 | + default: defaultValueProp, | |
| 4214 | + name: "Tabs", | |
| 4215 | + state: "value" | |
| 4216 | + }); | |
| 4217 | + const isControlled = valueProp !== void 0; | |
| 4218 | + const [tabMap, setTabMap] = React45.useState(() => /* @__PURE__ */ new Map()); | |
| 4219 | + const lastKnownTabElementRef = React45.useRef(void 0); | |
| 4220 | + const getTabElementBySelectedValue = React45.useCallback((selectedValue) => findTabElement(tabMap, selectedValue), [tabMap]); | |
| 4221 | + const [activationDirectionState, setActivationDirectionState] = React45.useState(() => ({ | |
| 4222 | + previousValue: value, | |
| 4223 | + tabActivationDirection: "none" | |
| 4224 | + })); | |
| 4225 | + const { | |
| 4226 | + previousValue, | |
| 4227 | + tabActivationDirection: committedTabActivationDirection | |
| 4228 | + } = activationDirectionState; | |
| 4229 | + let tabActivationDirection = committedTabActivationDirection; | |
| 4230 | + let directionComputationIncomplete = false; | |
| 4231 | + if (previousValue !== value) { | |
| 4232 | + tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap); | |
| 4233 | + directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null; | |
| 4234 | + } | |
| 4235 | + const nextPreviousValue = directionComputationIncomplete ? previousValue : value; | |
| 4236 | + const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection; | |
| 4237 | + useIsoLayoutEffect(() => { | |
| 4238 | + if (!shouldSyncActivationDirectionState) { | |
| 4239 | + return; | |
| 4240 | + } | |
| 4241 | + setActivationDirectionState({ | |
| 4242 | + previousValue: nextPreviousValue, | |
| 4243 | + tabActivationDirection | |
| 4244 | + }); | |
| 4245 | + }, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]); | |
| 4246 | + const onValueChange = useStableCallback((newValue, eventDetails) => { | |
| 4247 | + const activationDirection2 = computeActivationDirection(value, newValue, orientation, tabMap); | |
| 4248 | + eventDetails.activationDirection = activationDirection2; | |
| 4249 | + onValueChangeProp?.(newValue, eventDetails); | |
| 4250 | + if (eventDetails.isCanceled) { | |
| 4251 | + return; | |
| 4252 | + } | |
| 4253 | + setValue(newValue); | |
| 4254 | + }); | |
| 4255 | + const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => { | |
| 4256 | + onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, { | |
| 4257 | + activationDirection: "none" | |
| 4258 | + })); | |
| 4259 | + }); | |
| 4260 | + const registerMountedTabPanel = useStableCallback((panelValue, panelId) => { | |
| 4261 | + setMountedTabPanels((prev) => { | |
| 4262 | + const next = new Map(prev); | |
| 4263 | + next.set(panelValue, panelId); | |
| 4264 | + return next; | |
| 4265 | + }); | |
| 4266 | + return () => { | |
| 4267 | + setMountedTabPanels((prev) => { | |
| 4268 | + if (prev.get(panelValue) !== panelId) { | |
| 4269 | + return prev; | |
| 4270 | + } | |
| 4271 | + const next = new Map(prev); | |
| 4272 | + next.delete(panelValue); | |
| 4273 | + return next; | |
| 4274 | + }); | |
| 4275 | + }; | |
| 4276 | + }); | |
| 4277 | + const getTabPanelIdByValue = React45.useCallback((tabValue) => { | |
| 4278 | + return mountedTabPanels.get(tabValue); | |
| 4279 | + }, [mountedTabPanels]); | |
| 4280 | + const getTabIdByPanelValue = React45.useCallback((tabPanelValue) => { | |
| 4281 | + for (const tabMetadata of tabMap.values()) { | |
| 4282 | + if (tabPanelValue === tabMetadata.value) { | |
| 4283 | + return tabMetadata.id; | |
| 4284 | + } | |
| 4285 | + } | |
| 4286 | + return void 0; | |
| 4287 | + }, [tabMap]); | |
| 4288 | + const tabsContextValue = React45.useMemo(() => ({ | |
| 4289 | + getTabElementBySelectedValue, | |
| 4290 | + getTabIdByPanelValue, | |
| 4291 | + getTabPanelIdByValue, | |
| 4292 | + onValueChange, | |
| 4293 | + orientation, | |
| 4294 | + registerMountedTabPanel, | |
| 4295 | + setTabMap, | |
| 4296 | + tabActivationDirection, | |
| 4297 | + value | |
| 4298 | + }), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, tabActivationDirection, value]); | |
| 4299 | + const selectedTabMetadata = React45.useMemo(() => { | |
| 4300 | + for (const tabMetadata of tabMap.values()) { | |
| 4301 | + if (tabMetadata.value === value) { | |
| 4302 | + return tabMetadata; | |
| 4303 | + } | |
| 4304 | + } | |
| 4305 | + return void 0; | |
| 4306 | + }, [tabMap, value]); | |
| 4307 | + const firstEnabledTabValue = React45.useMemo(() => { | |
| 4308 | + for (const tabMetadata of tabMap.values()) { | |
| 4309 | + if (!tabMetadata.disabled) { | |
| 4310 | + return tabMetadata.value; | |
| 4311 | + } | |
| 4312 | + } | |
| 4313 | + return void 0; | |
| 4314 | + }, [tabMap]); | |
| 4315 | + const shouldNotifyInitialValueChangeRef = React45.useRef(!hasExplicitDefaultValueProp); | |
| 4316 | + const initialDefaultValueRef = React45.useRef(defaultValueProp); | |
| 4317 | + const shouldHonorDisabledDefaultValueRef = React45.useRef(hasExplicitDefaultValueProp); | |
| 4318 | + const didRegisterTabsRef = React45.useRef(false); | |
| 4319 | + useIsoLayoutEffect(() => { | |
| 4320 | + if (isControlled) { | |
| 4321 | + return; | |
| 4322 | + } | |
| 4323 | + function commitAutomaticValueChange(fallbackValue, fallbackReason) { | |
| 4324 | + setValue(fallbackValue); | |
| 4325 | + setActivationDirectionState({ | |
| 4326 | + previousValue: fallbackValue, | |
| 4327 | + tabActivationDirection: "none" | |
| 4328 | + }); | |
| 4329 | + notifyAutomaticValueChange(fallbackValue, fallbackReason); | |
| 4330 | + shouldNotifyInitialValueChangeRef.current = false; | |
| 4331 | + } | |
| 4332 | + if (tabMap.size === 0) { | |
| 4333 | + if (didRegisterTabsRef.current && value !== null && !lastKnownTabElementRef.current?.isConnected) { | |
| 4334 | + commitAutomaticValueChange(null, reason_parts_exports.missing); | |
| 4335 | + } | |
| 4336 | + return; | |
| 4337 | + } | |
| 4338 | + didRegisterTabsRef.current = true; | |
| 4339 | + lastKnownTabElementRef.current = tabMap.keys().next().value; | |
| 4340 | + const selectionIsDisabled = selectedTabMetadata?.disabled; | |
| 4341 | + const selectionIsMissing = selectedTabMetadata == null && value !== null; | |
| 4342 | + if (!selectionIsDisabled && value === initialDefaultValueRef.current) { | |
| 4343 | + shouldHonorDisabledDefaultValueRef.current = false; | |
| 4344 | + } | |
| 4345 | + if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) { | |
| 4346 | + return; | |
| 4347 | + } | |
| 4348 | + const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current; | |
| 4349 | + if (selectionIsDisabled || selectionIsMissing) { | |
| 4350 | + const fallbackValue = firstEnabledTabValue ?? null; | |
| 4351 | + if (value === fallbackValue) { | |
| 4352 | + shouldNotifyInitialValueChangeRef.current = false; | |
| 4353 | + return; | |
| 4354 | + } | |
| 4355 | + let fallbackReason = reason_parts_exports.missing; | |
| 4356 | + if (shouldNotifyInitialValueChange) { | |
| 4357 | + fallbackReason = reason_parts_exports.initial; | |
| 4358 | + } else if (selectionIsDisabled) { | |
| 4359 | + fallbackReason = reason_parts_exports.disabled; | |
| 4360 | + } | |
| 4361 | + commitAutomaticValueChange(fallbackValue, fallbackReason); | |
| 4362 | + return; | |
| 4363 | + } | |
| 4364 | + if (shouldNotifyInitialValueChange && selectedTabMetadata != null) { | |
| 4365 | + notifyAutomaticValueChange(value, reason_parts_exports.initial); | |
| 4366 | + shouldNotifyInitialValueChangeRef.current = false; | |
| 4367 | + } | |
| 4368 | + }, [firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]); | |
| 4369 | + const state = { | |
| 4370 | + orientation, | |
| 4371 | + tabActivationDirection | |
| 4372 | + }; | |
| 4373 | + const element = useRenderElement("div", componentProps, { | |
| 4374 | + state, | |
| 4375 | + ref: forwardedRef, | |
| 4376 | + props: elementProps, | |
| 4377 | + stateAttributesMapping: tabsStateAttributesMapping | |
| 4378 | + }); | |
| 4379 | + return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TabsRootContext.Provider, { | |
| 4380 | + value: tabsContextValue, | |
| 4381 | + children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CompositeList, { | |
| 4382 | + elementsRef: tabPanelRefs, | |
| 4383 | + children: element | |
| 4384 | + }) | |
| 4385 | + }); | |
| 4386 | + }); | |
| 4387 | + if (true) TabsRoot.displayName = "TabsRoot"; | |
| 4388 | + function findTabElement(tabMap, value) { | |
| 4389 | + for (const [tabElement, tabMetadata] of tabMap.entries()) { | |
| 4390 | + if (value === tabMetadata.value) { | |
| 4391 | + return tabElement; | |
| 4392 | + } | |
| 4393 | + } | |
| 4394 | + return null; | |
| 4395 | + } | |
| 4396 | + function computeActivationDirection(oldValue, newValue, orientation, tabMap) { | |
| 4397 | + if (oldValue == null || newValue == null) { | |
| 4398 | + return "none"; | |
| 4399 | + } | |
| 4400 | + const [positionProp, backward, forward] = orientation === "horizontal" ? ["left", "left", "right"] : ["top", "up", "down"]; | |
| 4401 | + const oldTab = findTabElement(tabMap, oldValue); | |
| 4402 | + const newTab = findTabElement(tabMap, newValue); | |
| 4403 | + if (oldTab == null || newTab == null) { | |
| 4404 | + if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) { | |
| 4405 | + return newValue > oldValue ? forward : backward; | |
| 4406 | + } | |
| 4407 | + return "none"; | |
| 4408 | + } | |
| 4409 | + const oldPosition = oldTab.getBoundingClientRect()[positionProp]; | |
| 4410 | + const newPosition = newTab.getBoundingClientRect()[positionProp]; | |
| 4411 | + if (newPosition < oldPosition) { | |
| 4412 | + return backward; | |
| 4413 | + } | |
| 4414 | + if (newPosition > oldPosition) { | |
| 4415 | + return forward; | |
| 4416 | + } | |
| 4417 | + return "none"; | |
| 4418 | + } | |
| 4419 | + | |
| 4420 | + // node_modules/@base-ui/react/tabs/tab/TabsTab.mjs | |
| 4421 | + var React47 = __toESM(require_react(), 1); | |
| 4422 | + | |
| 4423 | + // node_modules/@base-ui/react/tabs/list/TabsListContext.mjs | |
| 4424 | + var React46 = __toESM(require_react(), 1); | |
| 4425 | + var TabsListContext = /* @__PURE__ */ React46.createContext(void 0); | |
| 4426 | + if (true) TabsListContext.displayName = "TabsListContext"; | |
| 4427 | + function useTabsListContext() { | |
| 4428 | + const context = React46.useContext(TabsListContext); | |
| 4429 | + if (context === void 0) { | |
| 4430 | + throw new Error(true ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage_default(65)); | |
| 4431 | + } | |
| 4432 | + return context; | |
| 4433 | + } | |
| 4434 | + | |
| 4435 | + // node_modules/@base-ui/react/tabs/tab/TabsTab.mjs | |
| 4436 | + var TabsTab = /* @__PURE__ */ React47.forwardRef(function TabsTab2(componentProps, forwardedRef) { | |
| 4437 | + const { | |
| 4438 | + className, | |
| 4439 | + disabled: disabled2 = false, | |
| 4440 | + render, | |
| 4441 | + value, | |
| 4442 | + id: idProp, | |
| 4443 | + nativeButton = true, | |
| 4444 | + style, | |
| 4445 | + ...elementProps | |
| 4446 | + } = componentProps; | |
| 4447 | + const { | |
| 4448 | + value: activeTabValue, | |
| 4449 | + getTabPanelIdByValue, | |
| 4450 | + onValueChange, | |
| 4451 | + orientation, | |
| 4452 | + tabActivationDirection | |
| 4453 | + } = useTabsRootContext(); | |
| 4454 | + const { | |
| 4455 | + activateOnFocus, | |
| 4456 | + registerTabResizeObserverElement, | |
| 4457 | + tabsListElement | |
| 4458 | + } = useTabsListContext(); | |
| 4459 | + const { | |
| 4460 | + highlightedIndex, | |
| 4461 | + onHighlightedIndexChange | |
| 4462 | + } = useCompositeRootContext(); | |
| 4463 | + const id = useBaseUiId(idProp); | |
| 4464 | + const tabMetadata = React47.useMemo(() => ({ | |
| 4465 | + disabled: disabled2, | |
| 4466 | + id, | |
| 4467 | + value | |
| 4468 | + }), [disabled2, id, value]); | |
| 4469 | + const { | |
| 4470 | + compositeProps, | |
| 4471 | + compositeRef, | |
| 4472 | + index: index2 | |
| 4473 | + // hook is used instead of the CompositeItem component | |
| 4474 | + // because the index is needed for Tab internals | |
| 4475 | + } = useCompositeItem({ | |
| 4476 | + metadata: tabMetadata | |
| 4477 | + }); | |
| 4478 | + const active = value === activeTabValue; | |
| 4479 | + const isNavigatingRef = React47.useRef(false); | |
| 4480 | + const unobserveTabElementRef = React47.useRef(null); | |
| 4481 | + const observeTabElement = useStableCallback((element2) => { | |
| 4482 | + unobserveTabElementRef.current?.(); | |
| 4483 | + unobserveTabElementRef.current = element2 ? registerTabResizeObserverElement(element2) : null; | |
| 4484 | + }); | |
| 4485 | + useIsoLayoutEffect(() => { | |
| 4486 | + if (isNavigatingRef.current) { | |
| 4487 | + isNavigatingRef.current = false; | |
| 4488 | + return; | |
| 4489 | + } | |
| 4490 | + if (!(active && index2 > -1 && highlightedIndex !== index2)) { | |
| 4491 | + return; | |
| 4492 | + } | |
| 4493 | + const listElement = tabsListElement; | |
| 4494 | + if (listElement != null) { | |
| 4495 | + const activeEl = activeElement(ownerDocument(listElement)); | |
| 4496 | + if (activeEl && contains(listElement, activeEl)) { | |
| 4497 | + return; | |
| 4498 | + } | |
| 4499 | + } | |
| 4500 | + if (!disabled2) { | |
| 4501 | + onHighlightedIndexChange(index2); | |
| 4502 | + } | |
| 4503 | + }, [active, index2, highlightedIndex, onHighlightedIndexChange, disabled2, tabsListElement]); | |
| 4504 | + const { | |
| 4505 | + getButtonProps, | |
| 4506 | + buttonRef | |
| 4507 | + } = useButton({ | |
| 4508 | + disabled: disabled2, | |
| 4509 | + native: nativeButton, | |
| 4510 | + focusableWhenDisabled: true | |
| 4511 | + }); | |
| 4512 | + const tabPanelId = getTabPanelIdByValue(value); | |
| 4513 | + const isPressingRef = React47.useRef(false); | |
| 4514 | + const isMainButtonRef = React47.useRef(false); | |
| 4515 | + function activate(event) { | |
| 4516 | + onValueChange(value, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent, void 0, { | |
| 4517 | + activationDirection: "none" | |
| 4518 | + })); | |
| 4519 | + } | |
| 4520 | + function onClick(event) { | |
| 4521 | + if (active || disabled2) { | |
| 4522 | + return; | |
| 4523 | + } | |
| 4524 | + activate(event); | |
| 4525 | + } | |
| 4526 | + function onFocus(event) { | |
| 4527 | + if (active || disabled2) { | |
| 4528 | + return; | |
| 4529 | + } | |
| 4530 | + if (activateOnFocus && (!isPressingRef.current || // keyboard or touch focus | |
| 4531 | + isMainButtonRef.current)) { | |
| 4532 | + activate(event); | |
| 4533 | + } | |
| 4534 | + } | |
| 4535 | + function onPointerDown(event) { | |
| 4536 | + if (active || disabled2) { | |
| 4537 | + return; | |
| 4538 | + } | |
| 4539 | + isPressingRef.current = true; | |
| 4540 | + isMainButtonRef.current = event.button === 0; | |
| 4541 | + const doc = ownerDocument(event.currentTarget); | |
| 4542 | + function handlePointerEnd() { | |
| 4543 | + isPressingRef.current = false; | |
| 4544 | + isMainButtonRef.current = false; | |
| 4545 | + doc.removeEventListener("pointerup", handlePointerEnd); | |
| 4546 | + doc.removeEventListener("pointercancel", handlePointerEnd); | |
| 4547 | + } | |
| 4548 | + doc.addEventListener("pointerup", handlePointerEnd); | |
| 4549 | + doc.addEventListener("pointercancel", handlePointerEnd); | |
| 4550 | + } | |
| 4551 | + const state = { | |
| 4552 | + disabled: disabled2, | |
| 4553 | + active, | |
| 4554 | + orientation, | |
| 4555 | + tabActivationDirection | |
| 4556 | + }; | |
| 4557 | + const element = useRenderElement("button", componentProps, { | |
| 4558 | + state, | |
| 4559 | + ref: [forwardedRef, buttonRef, compositeRef, observeTabElement], | |
| 4560 | + props: [compositeProps, { | |
| 4561 | + role: "tab", | |
| 4562 | + "aria-controls": tabPanelId, | |
| 4563 | + "aria-selected": active, | |
| 4564 | + id, | |
| 4565 | + onClick, | |
| 4566 | + onFocus, | |
| 4567 | + onPointerDown, | |
| 4568 | + [ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0, | |
| 4569 | + onKeyDownCapture() { | |
| 4570 | + isNavigatingRef.current = true; | |
| 4571 | + } | |
| 4572 | + }, elementProps, getButtonProps], | |
| 4573 | + stateAttributesMapping: tabsStateAttributesMapping | |
| 4574 | + }); | |
| 4575 | + return element; | |
| 4576 | + }); | |
| 4577 | + if (true) TabsTab.displayName = "TabsTab"; | |
| 4578 | + | |
| 4579 | + // node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs | |
| 4580 | + var React48 = __toESM(require_react(), 1); | |
| 4581 | + | |
| 4582 | + // node_modules/@base-ui/react/tabs/indicator/TabsIndicatorCssVars.mjs | |
| 4583 | + var activeTabLeft = "--active-tab-left"; | |
| 4584 | + var activeTabRight = "--active-tab-right"; | |
| 4585 | + var activeTabTop = "--active-tab-top"; | |
| 4586 | + var activeTabBottom = "--active-tab-bottom"; | |
| 4587 | + var activeTabWidth = "--active-tab-width"; | |
| 4588 | + var activeTabHeight = "--active-tab-height"; | |
| 4589 | + | |
| 4590 | + // node_modules/@base-ui/react/tabs/indicator/TabsIndicator.mjs | |
| 4591 | + var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); | |
| 4592 | + var _PrehydrationScript; | |
| 4593 | + var stateAttributesMapping2 = { | |
| 4594 | + ...tabsStateAttributesMapping, | |
| 4595 | + activeTabPosition: () => null, | |
| 4596 | + activeTabSize: () => null | |
| 4597 | + }; | |
| 4598 | + var MAX_LAYOUT_ROUNDING_ERROR = 2; | |
| 4599 | + var TabsIndicator = /* @__PURE__ */ React48.forwardRef(function TabsIndicator2(componentProps, forwardedRef) { | |
| 4600 | + const { | |
| 4601 | + className, | |
| 4602 | + render, | |
| 4603 | + renderBeforeHydration = false, | |
| 4604 | + style: styleProp, | |
| 4605 | + ...elementProps | |
| 4606 | + } = componentProps; | |
| 4607 | + const { | |
| 4608 | + getTabElementBySelectedValue, | |
| 4609 | + orientation, | |
| 4610 | + tabActivationDirection, | |
| 4611 | + value | |
| 4612 | + } = useTabsRootContext(); | |
| 4613 | + const { | |
| 4614 | + tabsListElement, | |
| 4615 | + registerIndicatorUpdateListener | |
| 4616 | + } = useTabsListContext(); | |
| 4617 | + const rerender = useForcedRerendering(); | |
| 4618 | + React48.useEffect(() => { | |
| 4619 | + return registerIndicatorUpdateListener(rerender); | |
| 4620 | + }, [registerIndicatorUpdateListener, rerender]); | |
| 4621 | + let left = 0; | |
| 4622 | + let right = 0; | |
| 4623 | + let top = 0; | |
| 4624 | + let bottom = 0; | |
| 4625 | + let width = 0; | |
| 4626 | + let height = 0; | |
| 4627 | + let isTabSelected = false; | |
| 4628 | + if (value != null && tabsListElement != null) { | |
| 4629 | + const activeTab = getTabElementBySelectedValue(value); | |
| 4630 | + if (activeTab != null) { | |
| 4631 | + isTabSelected = true; | |
| 4632 | + const { | |
| 4633 | + width: computedWidth, | |
| 4634 | + height: computedHeight | |
| 4635 | + } = getCssDimensions(activeTab); | |
| 4636 | + const { | |
| 4637 | + width: tabListWidth, | |
| 4638 | + height: tabListHeight | |
| 4639 | + } = getCssDimensions(tabsListElement); | |
| 4640 | + const tabRect = activeTab.getBoundingClientRect(); | |
| 4641 | + const tabsListRect = tabsListElement.getBoundingClientRect(); | |
| 4642 | + const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1; | |
| 4643 | + const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1; | |
| 4644 | + const layoutOffset = getLayoutOffset(activeTab, tabsListElement); | |
| 4645 | + left = layoutOffset.left; | |
| 4646 | + top = layoutOffset.top; | |
| 4647 | + const rectLeft = (tabRect.left - tabsListRect.left) / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft; | |
| 4648 | + const rectTop = (tabRect.top - tabsListRect.top) / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop; | |
| 4649 | + const tabTranslation = getActiveTabTranslation(activeTab); | |
| 4650 | + if (Math.abs(rectLeft - tabTranslation.x - left) <= MAX_LAYOUT_ROUNDING_ERROR && Math.abs(rectTop - tabTranslation.y - top) <= MAX_LAYOUT_ROUNDING_ERROR) { | |
| 4651 | + left = rectLeft; | |
| 4652 | + top = rectTop; | |
| 4653 | + } | |
| 4654 | + width = computedWidth; | |
| 4655 | + height = computedHeight; | |
| 4656 | + right = tabsListElement.scrollWidth - left - width; | |
| 4657 | + bottom = tabsListElement.scrollHeight - top - height; | |
| 4658 | + } | |
| 4659 | + } | |
| 4660 | + const activeTabPosition = isTabSelected ? { | |
| 4661 | + left, | |
| 4662 | + right, | |
| 4663 | + top, | |
| 4664 | + bottom | |
| 4665 | + } : null; | |
| 4666 | + const activeTabSize = isTabSelected ? { | |
| 4667 | + width, | |
| 4668 | + height | |
| 4669 | + } : null; | |
| 4670 | + const style = isTabSelected ? { | |
| 4671 | + [activeTabLeft]: `${left}px`, | |
| 4672 | + [activeTabRight]: `${right}px`, | |
| 4673 | + [activeTabTop]: `${top}px`, | |
| 4674 | + [activeTabBottom]: `${bottom}px`, | |
| 4675 | + [activeTabWidth]: `${width}px`, | |
| 4676 | + [activeTabHeight]: `${height}px` | |
| 4677 | + } : void 0; | |
| 4678 | + const displayIndicator = isTabSelected && width > 0 && height > 0; | |
| 4679 | + const state = { | |
| 4680 | + orientation, | |
| 4681 | + activeTabPosition, | |
| 4682 | + activeTabSize, | |
| 4683 | + tabActivationDirection | |
| 4684 | + }; | |
| 4685 | + const element = useRenderElement("span", componentProps, { | |
| 4686 | + state, | |
| 4687 | + ref: forwardedRef, | |
| 4688 | + props: [{ | |
| 4689 | + role: "presentation", | |
| 4690 | + style, | |
| 4691 | + hidden: !displayIndicator | |
| 4692 | + // do not display the indicator before the layout is settled | |
| 4693 | + }, elementProps, { | |
| 4694 | + suppressHydrationWarning: true | |
| 4695 | + }], | |
| 4696 | + stateAttributesMapping: stateAttributesMapping2 | |
| 4697 | + }); | |
| 4698 | + if (value == null) { | |
| 4699 | + return null; | |
| 4700 | + } | |
| 4701 | + return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(React48.Fragment, { | |
| 4702 | + children: [element, renderBeforeHydration && (_PrehydrationScript || (_PrehydrationScript = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PrehydrationScript, { | |
| 4703 | + script | |
| 4704 | + })))] | |
| 4705 | + }); | |
| 4706 | + }); | |
| 4707 | + if (true) TabsIndicator.displayName = "TabsIndicator"; | |
| 4708 | + function getLayoutOffset(element, ancestor) { | |
| 4709 | + const elementOffset = getCumulativeOffset(element); | |
| 4710 | + const ancestorOffset = getCumulativeOffset(ancestor); | |
| 4711 | + let left = elementOffset.left - ancestorOffset.left - ancestor.clientLeft; | |
| 4712 | + let top = elementOffset.top - ancestorOffset.top - ancestor.clientTop; | |
| 4713 | + let node = getParentNode(element); | |
| 4714 | + while (isHTMLElement(node) && node !== ancestor && !isLastTraversableNode(node)) { | |
| 4715 | + left -= node.scrollLeft; | |
| 4716 | + top -= node.scrollTop; | |
| 4717 | + node = getParentNode(node); | |
| 4718 | + } | |
| 4719 | + return { | |
| 4720 | + left, | |
| 4721 | + top | |
| 4722 | + }; | |
| 4723 | + } | |
| 4724 | + function getCumulativeOffset(element) { | |
| 4725 | + let left = 0; | |
| 4726 | + let top = 0; | |
| 4727 | + let currentElement = element; | |
| 4728 | + while (currentElement != null) { | |
| 4729 | + left += currentElement.offsetLeft; | |
| 4730 | + top += currentElement.offsetTop; | |
| 4731 | + const offsetParent = currentElement.offsetParent; | |
| 4732 | + if (offsetParent != null) { | |
| 4733 | + left += offsetParent.clientLeft; | |
| 4734 | + top += offsetParent.clientTop; | |
| 4735 | + } | |
| 4736 | + currentElement = offsetParent; | |
| 4737 | + } | |
| 4738 | + return { | |
| 4739 | + left, | |
| 4740 | + top | |
| 4741 | + }; | |
| 4742 | + } | |
| 4743 | + function getActiveTabTranslation(element) { | |
| 4744 | + const computedStyle = getWindow(element).getComputedStyle(element); | |
| 4745 | + const { | |
| 4746 | + x, | |
| 4747 | + y | |
| 4748 | + } = getElementTransform(element, computedStyle); | |
| 4749 | + let translateX = x; | |
| 4750 | + let translateY = y; | |
| 4751 | + const { | |
| 4752 | + translate | |
| 4753 | + } = computedStyle; | |
| 4754 | + if (translate && translate !== "none") { | |
| 4755 | + const parts = translate.split(" "); | |
| 4756 | + translateX += resolveTranslateLength(parts[0], element.offsetWidth); | |
| 4757 | + translateY += resolveTranslateLength(parts[1], element.offsetHeight); | |
| 4758 | + } | |
| 4759 | + return { | |
| 4760 | + x: translateX, | |
| 4761 | + y: translateY | |
| 4762 | + }; | |
| 4763 | + } | |
| 4764 | + function resolveTranslateLength(value, referenceSize) { | |
| 4765 | + if (!value) { | |
| 4766 | + return 0; | |
| 4767 | + } | |
| 4768 | + const numeric = parseFloat(value); | |
| 4769 | + if (!Number.isFinite(numeric)) { | |
| 4770 | + return 0; | |
| 4771 | + } | |
| 4772 | + return value.endsWith("%") ? numeric / 100 * referenceSize : numeric; | |
| 4773 | + } | |
| 4774 | + | |
| 4775 | + // node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs | |
| 4776 | + var React49 = __toESM(require_react(), 1); | |
| 4777 | + | |
| 4778 | + // node_modules/@base-ui/react/tabs/panel/TabsPanelDataAttributes.mjs | |
| 4779 | + var index = "data-index"; | |
| 4780 | + var startingStyle2 = TransitionStatusDataAttributes_exports.startingStyle; | |
| 4781 | + var endingStyle2 = TransitionStatusDataAttributes_exports.endingStyle; | |
| 4782 | + | |
| 4783 | + // node_modules/@base-ui/react/tabs/panel/TabsPanel.mjs | |
| 4784 | + var stateAttributesMapping3 = { | |
| 4785 | + ...tabsStateAttributesMapping, | |
| 4786 | + ...transitionStatusMapping | |
| 4787 | + }; | |
| 4788 | + var TabsPanel = /* @__PURE__ */ React49.forwardRef(function TabsPanel2(componentProps, forwardedRef) { | |
| 4789 | + const { | |
| 4790 | + className, | |
| 4791 | + value, | |
| 4792 | + render, | |
| 4793 | + keepMounted = false, | |
| 4794 | + style, | |
| 4795 | + ...elementProps | |
| 4796 | + } = componentProps; | |
| 4797 | + const { | |
| 4798 | + value: selectedValue, | |
| 4799 | + getTabIdByPanelValue, | |
| 4800 | + orientation, | |
| 4801 | + tabActivationDirection, | |
| 4802 | + registerMountedTabPanel | |
| 4803 | + } = useTabsRootContext(); | |
| 4804 | + const id = useBaseUiId(); | |
| 4805 | + const { | |
| 4806 | + ref: listItemRef, | |
| 4807 | + index: index2 | |
| 4808 | + } = useCompositeListItem(); | |
| 4809 | + const open = value === selectedValue; | |
| 4810 | + const { | |
| 4811 | + mounted, | |
| 4812 | + transitionStatus, | |
| 4813 | + setMounted | |
| 4814 | + } = useTransitionStatus(open); | |
| 4815 | + const hidden = !mounted; | |
| 4816 | + const correspondingTabId = getTabIdByPanelValue(value); | |
| 4817 | + const state = { | |
| 4818 | + hidden, | |
| 4819 | + orientation, | |
| 4820 | + tabActivationDirection, | |
| 4821 | + transitionStatus | |
| 4822 | + }; | |
| 4823 | + const panelRef = React49.useRef(null); | |
| 4824 | + const element = useRenderElement("div", componentProps, { | |
| 4825 | + state, | |
| 4826 | + ref: [forwardedRef, listItemRef, panelRef], | |
| 4827 | + props: [{ | |
| 4828 | + "aria-labelledby": correspondingTabId, | |
| 4829 | + hidden, | |
| 4830 | + id, | |
| 4831 | + role: "tabpanel", | |
| 4832 | + tabIndex: open ? 0 : -1, | |
| 4833 | + inert: inertValue(!open), | |
| 4834 | + // Computed key: a plain literal key fails the DOM-props excess property check. | |
| 4835 | + [index]: index2 | |
| 4836 | + }, elementProps], | |
| 4837 | + stateAttributesMapping: stateAttributesMapping3 | |
| 4838 | + }); | |
| 4839 | + useOpenChangeComplete({ | |
| 4840 | + open, | |
| 4841 | + ref: panelRef, | |
| 4842 | + onComplete() { | |
| 4843 | + if (!open) { | |
| 4844 | + setMounted(false); | |
| 4845 | + } | |
| 4846 | + } | |
| 4847 | + }); | |
| 4848 | + useIsoLayoutEffect(() => { | |
| 4849 | + if (id == null || hidden && !keepMounted) { | |
| 4850 | + return void 0; | |
| 4851 | + } | |
| 4852 | + return registerMountedTabPanel(value, id); | |
| 4853 | + }, [hidden, keepMounted, value, id, registerMountedTabPanel]); | |
| 4854 | + const shouldRender = keepMounted || mounted; | |
| 4855 | + if (!shouldRender) { | |
| 4856 | + return null; | |
| 4857 | + } | |
| 4858 | + return element; | |
| 4859 | + }); | |
| 4860 | + if (true) TabsPanel.displayName = "TabsPanel"; | |
| 4861 | + | |
| 4862 | + // node_modules/@base-ui/react/tabs/list/TabsList.mjs | |
| 4863 | + var React50 = __toESM(require_react(), 1); | |
| 4864 | + var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); | |
| 4865 | + var TabsList = /* @__PURE__ */ React50.forwardRef(function TabsList2(componentProps, forwardedRef) { | |
| 4866 | + const { | |
| 4867 | + activateOnFocus = false, | |
| 4868 | + className, | |
| 4869 | + loopFocus = true, | |
| 4870 | + render, | |
| 4871 | + style, | |
| 4872 | + ...elementProps | |
| 4873 | + } = componentProps; | |
| 4874 | + const { | |
| 4875 | + orientation, | |
| 4876 | + setTabMap, | |
| 4877 | + tabActivationDirection | |
| 4878 | + } = useTabsRootContext(); | |
| 4879 | + const [highlightedTabIndex, setHighlightedTabIndex] = React50.useState(0); | |
| 4880 | + const [tabsListElement, setTabsListElement] = React50.useState(null); | |
| 4881 | + const indicatorUpdateListenersRef = React50.useRef(/* @__PURE__ */ new Set()); | |
| 4882 | + const tabResizeObserverElementsRef = React50.useRef(/* @__PURE__ */ new Set()); | |
| 4883 | + const resizeObserverRef = React50.useRef(null); | |
| 4884 | + useIsoLayoutEffect(() => { | |
| 4885 | + if (typeof ResizeObserver === "undefined") { | |
| 4886 | + return void 0; | |
| 4887 | + } | |
| 4888 | + const resizeObserver = new ResizeObserver(() => { | |
| 4889 | + indicatorUpdateListenersRef.current.forEach((listener) => { | |
| 4890 | + listener(); | |
| 4891 | + }); | |
| 4892 | + }); | |
| 4893 | + resizeObserverRef.current = resizeObserver; | |
| 4894 | + if (tabsListElement) { | |
| 4895 | + resizeObserver.observe(tabsListElement); | |
| 4896 | + } | |
| 4897 | + tabResizeObserverElementsRef.current.forEach((element) => { | |
| 4898 | + resizeObserver.observe(element); | |
| 4899 | + }); | |
| 4900 | + return () => { | |
| 4901 | + resizeObserver.disconnect(); | |
| 4902 | + resizeObserverRef.current = null; | |
| 4903 | + }; | |
| 4904 | + }, [tabsListElement]); | |
| 4905 | + const registerIndicatorUpdateListener = useStableCallback((listener) => { | |
| 4906 | + indicatorUpdateListenersRef.current.add(listener); | |
| 4907 | + return () => { | |
| 4908 | + indicatorUpdateListenersRef.current.delete(listener); | |
| 4909 | + }; | |
| 4910 | + }); | |
| 4911 | + const registerTabResizeObserverElement = useStableCallback((element) => { | |
| 4912 | + tabResizeObserverElementsRef.current.add(element); | |
| 4913 | + resizeObserverRef.current?.observe(element); | |
| 4914 | + return () => { | |
| 4915 | + tabResizeObserverElementsRef.current.delete(element); | |
| 4916 | + resizeObserverRef.current?.unobserve(element); | |
| 4917 | + }; | |
| 4918 | + }); | |
| 4919 | + const state = { | |
| 4920 | + orientation, | |
| 4921 | + tabActivationDirection | |
| 4922 | + }; | |
| 4923 | + const defaultProps = { | |
| 4924 | + "aria-orientation": orientation === "vertical" ? "vertical" : void 0, | |
| 4925 | + role: "tablist" | |
| 4926 | + }; | |
| 4927 | + const tabsListContextValue = React50.useMemo(() => ({ | |
| 4928 | + activateOnFocus, | |
| 4929 | + registerIndicatorUpdateListener, | |
| 4930 | + registerTabResizeObserverElement, | |
| 4931 | + tabsListElement | |
| 4932 | + }), [activateOnFocus, registerIndicatorUpdateListener, registerTabResizeObserverElement, tabsListElement]); | |
| 4933 | + return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TabsListContext.Provider, { | |
| 4934 | + value: tabsListContextValue, | |
| 4935 | + children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CompositeRoot, { | |
| 4936 | + render, | |
| 4937 | + className, | |
| 4938 | + style, | |
| 4939 | + state, | |
| 4940 | + refs: [forwardedRef, setTabsListElement], | |
| 4941 | + props: [defaultProps, elementProps], | |
| 4942 | + stateAttributesMapping: tabsStateAttributesMapping, | |
| 4943 | + highlightedIndex: highlightedTabIndex, | |
| 4944 | + enableHomeAndEndKeys: true, | |
| 4945 | + loopFocus, | |
| 4946 | + orientation, | |
| 4947 | + onHighlightedIndexChange: setHighlightedTabIndex, | |
| 4948 | + onMapChange: setTabMap, | |
| 4949 | + disabledIndices: EMPTY_ARRAY | |
| 4950 | + }) | |
| 4951 | + }); | |
| 4952 | + }); | |
| 4953 | + if (true) TabsList.displayName = "TabsList"; | |
| 4954 | + | |
| 4955 | + // node_modules/@base-ui/react/use-render/useRender.mjs | |
| 1197 | 4956 | function useRender(params) { |
| 1198 | 4957 | return useRenderElement(params.defaultTagName ?? "div", params, params); |
| 1199 | 4958 | } |
| 1200 | 4959 | |
| 1201 | - // packages/ui/build-module/visually-hidden/visually-hidden.mjs | |
| 1202 | - var import_element3 = __toESM(require_element(), 1); | |
| 4960 | + // packages/ui/build-module/utils/direction-provider.mjs | |
| 4961 | + var import_i18n3 = __toESM(require_i18n(), 1); | |
| 4962 | + var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); | |
| 4963 | + function DirectionProvider3({ children }) { | |
| 4964 | + return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DirectionProvider, { direction: (0, import_i18n3.isRTL)() ? "rtl" : "ltr", children }); | |
| 4965 | + } | |
| 4966 | + | |
| 4967 | + // packages/ui/build-module/link/link.mjs | |
| 4968 | + var import_element2 = __toESM(require_element(), 1); | |
| 4969 | + var import_i18n4 = __toESM(require_i18n(), 1); | |
| 4970 | + var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); | |
| 1203 | 4971 | var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; |
| 1204 | 4972 | function getRuntime() { |
| 1205 | 4973 | const globalScope = globalThis; |
| 1206 | 4974 | if (globalScope.__wpStyleRuntime) { |
| @@ -1280,18 +5048,180 @@ | ||
| 1280 | 5048 | injectStyle(targetDocument, hash, css); |
| 1281 | 5049 | } |
| 1282 | 5050 | } |
| 1283 | 5051 | if (typeof process === "undefined" || true) { |
| 1284 | - registerStyle("c46e8cb841", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}"); | |
| 5052 | + registerStyle("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 1285 | 5053 | } |
| 1286 | - var style_default = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; | |
| 1287 | - var VisuallyHidden = (0, import_element3.forwardRef)( | |
| 5054 | + var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 5055 | + if (typeof process === "undefined" || true) { | |
| 5056 | + registerStyle("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))}}}"); | |
| 5057 | + } | |
| 5058 | + 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" }; | |
| 5059 | + if (typeof process === "undefined" || true) { | |
| 5060 | + registerStyle("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"}}}'); | |
| 5061 | + } | |
| 5062 | + var style_default = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" }; | |
| 5063 | + if (typeof process === "undefined" || true) { | |
| 5064 | + 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)}"); | |
| 5065 | + } | |
| 5066 | + 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" }; | |
| 5067 | + var Link = (0, import_element2.forwardRef)(function Link2({ | |
| 5068 | + children, | |
| 5069 | + variant = "default", | |
| 5070 | + tone = "brand", | |
| 5071 | + openInNewTab = false, | |
| 5072 | + target, | |
| 5073 | + render, | |
| 5074 | + className, | |
| 5075 | + ...props | |
| 5076 | + }, ref) { | |
| 5077 | + const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? ""); | |
| 5078 | + const element = useRender({ | |
| 5079 | + render, | |
| 5080 | + defaultTagName: "a", | |
| 5081 | + ref, | |
| 5082 | + props: mergeProps(props, { | |
| 5083 | + className: clsx_default( | |
| 5084 | + global_css_defense_default.a, | |
| 5085 | + resets_default["box-sizing"], | |
| 5086 | + focus_module_default["outset-ring--focus-except-active"], | |
| 5087 | + variant !== "unstyled" && style_default.link, | |
| 5088 | + variant !== "unstyled" && style_default[`is-${tone}`], | |
| 5089 | + variant === "unstyled" && style_default["is-unstyled"], | |
| 5090 | + className | |
| 5091 | + ), | |
| 5092 | + target: target ?? (openInNewTab ? "_blank" : void 0), | |
| 5093 | + children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [ | |
| 5094 | + children, | |
| 5095 | + shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( | |
| 5096 | + "span", | |
| 5097 | + { | |
| 5098 | + className: style_default["link-icon"], | |
| 5099 | + role: "img", | |
| 5100 | + "aria-label": ( | |
| 5101 | + /* translators: accessibility text appended to link text */ | |
| 5102 | + (0, import_i18n4.__)("(opens in a new tab)") | |
| 5103 | + ) | |
| 5104 | + } | |
| 5105 | + ) | |
| 5106 | + ] }) | |
| 5107 | + }) | |
| 5108 | + }); | |
| 5109 | + return element; | |
| 5110 | + }); | |
| 5111 | + | |
| 5112 | + // packages/ui/build-module/icon/icon.mjs | |
| 5113 | + var import_element3 = __toESM(require_element(), 1); | |
| 5114 | + var import_primitives18 = __toESM(require_primitives(), 1); | |
| 5115 | + var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); | |
| 5116 | + var Icon = (0, import_element3.forwardRef)(function Icon2({ icon, size = 24, style, ...restProps }, ref) { | |
| 5117 | + const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0; | |
| 5118 | + return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( | |
| 5119 | + import_primitives18.SVG, | |
| 5120 | + { | |
| 5121 | + ref, | |
| 5122 | + ...icon.props, | |
| 5123 | + ...restProps, | |
| 5124 | + ...mergedStyle ? { style: mergedStyle } : {}, | |
| 5125 | + width: size, | |
| 5126 | + height: size | |
| 5127 | + } | |
| 5128 | + ); | |
| 5129 | + }); | |
| 5130 | + | |
| 5131 | + // packages/ui/build-module/visually-hidden/visually-hidden.mjs | |
| 5132 | + var import_element4 = __toESM(require_element(), 1); | |
| 5133 | + var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; | |
| 5134 | + function getRuntime2() { | |
| 5135 | + const globalScope = globalThis; | |
| 5136 | + if (globalScope.__wpStyleRuntime) { | |
| 5137 | + return globalScope.__wpStyleRuntime; | |
| 5138 | + } | |
| 5139 | + globalScope.__wpStyleRuntime = { | |
| 5140 | + documents: /* @__PURE__ */ new Map(), | |
| 5141 | + styles: /* @__PURE__ */ new Map(), | |
| 5142 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 5143 | + }; | |
| 5144 | + if (typeof document !== "undefined") { | |
| 5145 | + registerDocument2(document); | |
| 5146 | + } | |
| 5147 | + return globalScope.__wpStyleRuntime; | |
| 5148 | + } | |
| 5149 | + function documentContainsStyleHash2(targetDocument, hash) { | |
| 5150 | + if (!targetDocument.head) { | |
| 5151 | + return false; | |
| 5152 | + } | |
| 5153 | + for (const style of targetDocument.head.querySelectorAll( | |
| 5154 | + `style[${STYLE_HASH_ATTRIBUTE2}]` | |
| 5155 | + )) { | |
| 5156 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { | |
| 5157 | + return true; | |
| 5158 | + } | |
| 5159 | + } | |
| 5160 | + return false; | |
| 5161 | + } | |
| 5162 | + function injectStyle2(targetDocument, hash, css) { | |
| 5163 | + if (!targetDocument.head) { | |
| 5164 | + return; | |
| 5165 | + } | |
| 5166 | + const runtime = getRuntime2(); | |
| 5167 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 5168 | + if (!injectedStyles) { | |
| 5169 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 5170 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 5171 | + } | |
| 5172 | + if (injectedStyles.has(hash)) { | |
| 5173 | + return; | |
| 5174 | + } | |
| 5175 | + if (documentContainsStyleHash2(targetDocument, hash)) { | |
| 5176 | + injectedStyles.add(hash); | |
| 5177 | + return; | |
| 5178 | + } | |
| 5179 | + const style = targetDocument.createElement("style"); | |
| 5180 | + style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); | |
| 5181 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 5182 | + targetDocument.head.appendChild(style); | |
| 5183 | + injectedStyles.add(hash); | |
| 5184 | + } | |
| 5185 | + function registerDocument2(targetDocument) { | |
| 5186 | + const runtime = getRuntime2(); | |
| 5187 | + runtime.documents.set( | |
| 5188 | + targetDocument, | |
| 5189 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 5190 | + ); | |
| 5191 | + for (const [hash, css] of runtime.styles) { | |
| 5192 | + injectStyle2(targetDocument, hash, css); | |
| 5193 | + } | |
| 5194 | + return () => { | |
| 5195 | + const count = runtime.documents.get(targetDocument); | |
| 5196 | + if (count === void 0) { | |
| 5197 | + return; | |
| 5198 | + } | |
| 5199 | + if (count <= 1) { | |
| 5200 | + runtime.documents.delete(targetDocument); | |
| 5201 | + return; | |
| 5202 | + } | |
| 5203 | + runtime.documents.set(targetDocument, count - 1); | |
| 5204 | + }; | |
| 5205 | + } | |
| 5206 | + function registerStyle2(hash, css) { | |
| 5207 | + const runtime = getRuntime2(); | |
| 5208 | + runtime.styles.set(hash, css); | |
| 5209 | + for (const targetDocument of runtime.documents.keys()) { | |
| 5210 | + injectStyle2(targetDocument, hash, css); | |
| 5211 | + } | |
| 5212 | + } | |
| 5213 | + if (typeof process === "undefined" || true) { | |
| 5214 | + registerStyle2("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}"); | |
| 5215 | + } | |
| 5216 | + var style_default2 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; | |
| 5217 | + var VisuallyHidden = (0, import_element4.forwardRef)( | |
| 1288 | 5218 | function VisuallyHidden2({ render, ...restProps }, ref) { |
| 1289 | 5219 | const element = useRender({ |
| 1290 | 5220 | render, |
| 1291 | 5221 | ref, |
| 1292 | 5222 | props: mergeProps( |
| 1293 | - { className: style_default["visually-hidden"] }, | |
| 5223 | + { className: style_default2["visually-hidden"] }, | |
| 1294 | 5224 | restProps, |
| 1295 | 5225 | { |
| 1296 | 5226 | // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. |
| 1297 | 5227 | "data-visually-hidden": "" |
| @@ -1301,14 +5231,2574 @@ | ||
| 1301 | 5231 | return element; |
| 1302 | 5232 | } |
| 1303 | 5233 | ); |
| 1304 | 5234 | |
| 5235 | + // packages/ui/build-module/stack/stack.mjs | |
| 5236 | + var import_element5 = __toESM(require_element(), 1); | |
| 5237 | + var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; | |
| 5238 | + function getRuntime3() { | |
| 5239 | + const globalScope = globalThis; | |
| 5240 | + if (globalScope.__wpStyleRuntime) { | |
| 5241 | + return globalScope.__wpStyleRuntime; | |
| 5242 | + } | |
| 5243 | + globalScope.__wpStyleRuntime = { | |
| 5244 | + documents: /* @__PURE__ */ new Map(), | |
| 5245 | + styles: /* @__PURE__ */ new Map(), | |
| 5246 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 5247 | + }; | |
| 5248 | + if (typeof document !== "undefined") { | |
| 5249 | + registerDocument3(document); | |
| 5250 | + } | |
| 5251 | + return globalScope.__wpStyleRuntime; | |
| 5252 | + } | |
| 5253 | + function documentContainsStyleHash3(targetDocument, hash) { | |
| 5254 | + if (!targetDocument.head) { | |
| 5255 | + return false; | |
| 5256 | + } | |
| 5257 | + for (const style of targetDocument.head.querySelectorAll( | |
| 5258 | + `style[${STYLE_HASH_ATTRIBUTE3}]` | |
| 5259 | + )) { | |
| 5260 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { | |
| 5261 | + return true; | |
| 5262 | + } | |
| 5263 | + } | |
| 5264 | + return false; | |
| 5265 | + } | |
| 5266 | + function injectStyle3(targetDocument, hash, css) { | |
| 5267 | + if (!targetDocument.head) { | |
| 5268 | + return; | |
| 5269 | + } | |
| 5270 | + const runtime = getRuntime3(); | |
| 5271 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 5272 | + if (!injectedStyles) { | |
| 5273 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 5274 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 5275 | + } | |
| 5276 | + if (injectedStyles.has(hash)) { | |
| 5277 | + return; | |
| 5278 | + } | |
| 5279 | + if (documentContainsStyleHash3(targetDocument, hash)) { | |
| 5280 | + injectedStyles.add(hash); | |
| 5281 | + return; | |
| 5282 | + } | |
| 5283 | + const style = targetDocument.createElement("style"); | |
| 5284 | + style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); | |
| 5285 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 5286 | + targetDocument.head.appendChild(style); | |
| 5287 | + injectedStyles.add(hash); | |
| 5288 | + } | |
| 5289 | + function registerDocument3(targetDocument) { | |
| 5290 | + const runtime = getRuntime3(); | |
| 5291 | + runtime.documents.set( | |
| 5292 | + targetDocument, | |
| 5293 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 5294 | + ); | |
| 5295 | + for (const [hash, css] of runtime.styles) { | |
| 5296 | + injectStyle3(targetDocument, hash, css); | |
| 5297 | + } | |
| 5298 | + return () => { | |
| 5299 | + const count = runtime.documents.get(targetDocument); | |
| 5300 | + if (count === void 0) { | |
| 5301 | + return; | |
| 5302 | + } | |
| 5303 | + if (count <= 1) { | |
| 5304 | + runtime.documents.delete(targetDocument); | |
| 5305 | + return; | |
| 5306 | + } | |
| 5307 | + runtime.documents.set(targetDocument, count - 1); | |
| 5308 | + }; | |
| 5309 | + } | |
| 5310 | + function registerStyle3(hash, css) { | |
| 5311 | + const runtime = getRuntime3(); | |
| 5312 | + runtime.styles.set(hash, css); | |
| 5313 | + for (const targetDocument of runtime.documents.keys()) { | |
| 5314 | + injectStyle3(targetDocument, hash, css); | |
| 5315 | + } | |
| 5316 | + } | |
| 5317 | + if (typeof process === "undefined" || true) { | |
| 5318 | + registerStyle3("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); | |
| 5319 | + } | |
| 5320 | + var style_default3 = { "stack": "_19ce0419607e1896__stack" }; | |
| 5321 | + var gapTokens = { | |
| 5322 | + xs: "var(--wpds-dimension-gap-xs, 4px)", | |
| 5323 | + sm: "var(--wpds-dimension-gap-sm, 8px)", | |
| 5324 | + md: "var(--wpds-dimension-gap-md, 12px)", | |
| 5325 | + lg: "var(--wpds-dimension-gap-lg, 16px)", | |
| 5326 | + xl: "var(--wpds-dimension-gap-xl, 24px)", | |
| 5327 | + "2xl": "var(--wpds-dimension-gap-2xl, 32px)", | |
| 5328 | + "3xl": "var(--wpds-dimension-gap-3xl, 40px)" | |
| 5329 | + }; | |
| 5330 | + var Stack = (0, import_element5.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { | |
| 5331 | + const style = { | |
| 5332 | + gap: gap && gapTokens[gap], | |
| 5333 | + alignItems: align, | |
| 5334 | + justifyContent: justify, | |
| 5335 | + flexDirection: direction, | |
| 5336 | + flexWrap: wrap | |
| 5337 | + }; | |
| 5338 | + const element = useRender({ | |
| 5339 | + render, | |
| 5340 | + ref, | |
| 5341 | + props: mergeProps(props, { style, className: style_default3.stack }) | |
| 5342 | + }); | |
| 5343 | + return element; | |
| 5344 | + }); | |
| 5345 | + | |
| 5346 | + // packages/ui/build-module/utils/use-schedule-validation.mjs | |
| 5347 | + var import_compose = __toESM(require_compose(), 1); | |
| 5348 | + var import_element6 = __toESM(require_element(), 1); | |
| 5349 | + function useScheduleValidation(validate) { | |
| 5350 | + const validateEvent = (0, import_compose.useEvent)(validate); | |
| 5351 | + const timerRef = (0, import_element6.useRef)(null); | |
| 5352 | + const unmountedRef = (0, import_element6.useRef)(false); | |
| 5353 | + const scheduleValidation = (0, import_element6.useCallback)(() => { | |
| 5354 | + if (unmountedRef.current) { | |
| 5355 | + return; | |
| 5356 | + } | |
| 5357 | + if (timerRef.current) { | |
| 5358 | + clearTimeout(timerRef.current); | |
| 5359 | + } | |
| 5360 | + timerRef.current = setTimeout(() => { | |
| 5361 | + validateEvent(); | |
| 5362 | + timerRef.current = null; | |
| 5363 | + }, 0); | |
| 5364 | + }, [validateEvent]); | |
| 5365 | + (0, import_element6.useEffect)(() => { | |
| 5366 | + unmountedRef.current = false; | |
| 5367 | + return () => { | |
| 5368 | + unmountedRef.current = true; | |
| 5369 | + if (timerRef.current) { | |
| 5370 | + clearTimeout(timerRef.current); | |
| 5371 | + } | |
| 5372 | + }; | |
| 5373 | + }, []); | |
| 5374 | + return scheduleValidation; | |
| 5375 | + } | |
| 5376 | + | |
| 5377 | + // packages/ui/build-module/form/primitives/input/input.mjs | |
| 5378 | + var import_element9 = __toESM(require_element(), 1); | |
| 5379 | + | |
| 5380 | + // packages/ui/build-module/form/primitives/input-layout/input-layout.mjs | |
| 5381 | + var import_element7 = __toESM(require_element(), 1); | |
| 5382 | + var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); | |
| 5383 | + var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; | |
| 5384 | + function getRuntime4() { | |
| 5385 | + const globalScope = globalThis; | |
| 5386 | + if (globalScope.__wpStyleRuntime) { | |
| 5387 | + return globalScope.__wpStyleRuntime; | |
| 5388 | + } | |
| 5389 | + globalScope.__wpStyleRuntime = { | |
| 5390 | + documents: /* @__PURE__ */ new Map(), | |
| 5391 | + styles: /* @__PURE__ */ new Map(), | |
| 5392 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 5393 | + }; | |
| 5394 | + if (typeof document !== "undefined") { | |
| 5395 | + registerDocument4(document); | |
| 5396 | + } | |
| 5397 | + return globalScope.__wpStyleRuntime; | |
| 5398 | + } | |
| 5399 | + function documentContainsStyleHash4(targetDocument, hash) { | |
| 5400 | + if (!targetDocument.head) { | |
| 5401 | + return false; | |
| 5402 | + } | |
| 5403 | + for (const style of targetDocument.head.querySelectorAll( | |
| 5404 | + `style[${STYLE_HASH_ATTRIBUTE4}]` | |
| 5405 | + )) { | |
| 5406 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { | |
| 5407 | + return true; | |
| 5408 | + } | |
| 5409 | + } | |
| 5410 | + return false; | |
| 5411 | + } | |
| 5412 | + function injectStyle4(targetDocument, hash, css) { | |
| 5413 | + if (!targetDocument.head) { | |
| 5414 | + return; | |
| 5415 | + } | |
| 5416 | + const runtime = getRuntime4(); | |
| 5417 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 5418 | + if (!injectedStyles) { | |
| 5419 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 5420 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 5421 | + } | |
| 5422 | + if (injectedStyles.has(hash)) { | |
| 5423 | + return; | |
| 5424 | + } | |
| 5425 | + if (documentContainsStyleHash4(targetDocument, hash)) { | |
| 5426 | + injectedStyles.add(hash); | |
| 5427 | + return; | |
| 5428 | + } | |
| 5429 | + const style = targetDocument.createElement("style"); | |
| 5430 | + style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); | |
| 5431 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 5432 | + targetDocument.head.appendChild(style); | |
| 5433 | + injectedStyles.add(hash); | |
| 5434 | + } | |
| 5435 | + function registerDocument4(targetDocument) { | |
| 5436 | + const runtime = getRuntime4(); | |
| 5437 | + runtime.documents.set( | |
| 5438 | + targetDocument, | |
| 5439 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 5440 | + ); | |
| 5441 | + for (const [hash, css] of runtime.styles) { | |
| 5442 | + injectStyle4(targetDocument, hash, css); | |
| 5443 | + } | |
| 5444 | + return () => { | |
| 5445 | + const count = runtime.documents.get(targetDocument); | |
| 5446 | + if (count === void 0) { | |
| 5447 | + return; | |
| 5448 | + } | |
| 5449 | + if (count <= 1) { | |
| 5450 | + runtime.documents.delete(targetDocument); | |
| 5451 | + return; | |
| 5452 | + } | |
| 5453 | + runtime.documents.set(targetDocument, count - 1); | |
| 5454 | + }; | |
| 5455 | + } | |
| 5456 | + function registerStyle4(hash, css) { | |
| 5457 | + const runtime = getRuntime4(); | |
| 5458 | + runtime.styles.set(hash, css); | |
| 5459 | + for (const targetDocument of runtime.documents.keys()) { | |
| 5460 | + injectStyle4(targetDocument, hash, css); | |
| 5461 | + } | |
| 5462 | + } | |
| 5463 | + if (typeof process === "undefined" || true) { | |
| 5464 | + registerStyle4("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)}"); | |
| 5465 | + } | |
| 5466 | + 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" }; | |
| 5467 | + if (typeof process === "undefined" || true) { | |
| 5468 | + registerStyle4("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 5469 | + } | |
| 5470 | + var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 5471 | + if (typeof process === "undefined" || true) { | |
| 5472 | + registerStyle4("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display: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:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); | |
| 5473 | + } | |
| 5474 | + var style_default4 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; | |
| 5475 | + var InputLayout = (0, import_element7.forwardRef)( | |
| 5476 | + function InputLayout2({ | |
| 5477 | + className, | |
| 5478 | + children, | |
| 5479 | + visuallyDisabled, | |
| 5480 | + size = "default", | |
| 5481 | + isBorderless, | |
| 5482 | + prefix, | |
| 5483 | + suffix, | |
| 5484 | + ...restProps | |
| 5485 | + }, ref) { | |
| 5486 | + return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)( | |
| 5487 | + "div", | |
| 5488 | + { | |
| 5489 | + ref, | |
| 5490 | + className: clsx_default( | |
| 5491 | + global_css_defense_default2.div, | |
| 5492 | + resets_default2["box-sizing"], | |
| 5493 | + style_default4["input-layout"], | |
| 5494 | + style_default4[`is-size-${size}`], | |
| 5495 | + visuallyDisabled && style_default4["is-disabled"], | |
| 5496 | + isBorderless && style_default4["is-borderless"], | |
| 5497 | + className | |
| 5498 | + ), | |
| 5499 | + ...restProps, | |
| 5500 | + children: [ | |
| 5501 | + import_element7.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 5502 | + "div", | |
| 5503 | + { | |
| 5504 | + className: style_default4["slot-wrapper"], | |
| 5505 | + "data-slot-type": "prefix", | |
| 5506 | + children: prefix | |
| 5507 | + } | |
| 5508 | + ), | |
| 5509 | + children, | |
| 5510 | + import_element7.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( | |
| 5511 | + "div", | |
| 5512 | + { | |
| 5513 | + className: style_default4["slot-wrapper"], | |
| 5514 | + "data-slot-type": "suffix", | |
| 5515 | + children: suffix | |
| 5516 | + } | |
| 5517 | + ) | |
| 5518 | + ] | |
| 5519 | + } | |
| 5520 | + ); | |
| 5521 | + } | |
| 5522 | + ); | |
| 5523 | + | |
| 5524 | + // packages/ui/build-module/form/primitives/input-layout/slot.mjs | |
| 5525 | + var import_element8 = __toESM(require_element(), 1); | |
| 5526 | + var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); | |
| 5527 | + var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; | |
| 5528 | + function getRuntime5() { | |
| 5529 | + const globalScope = globalThis; | |
| 5530 | + if (globalScope.__wpStyleRuntime) { | |
| 5531 | + return globalScope.__wpStyleRuntime; | |
| 5532 | + } | |
| 5533 | + globalScope.__wpStyleRuntime = { | |
| 5534 | + documents: /* @__PURE__ */ new Map(), | |
| 5535 | + styles: /* @__PURE__ */ new Map(), | |
| 5536 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 5537 | + }; | |
| 5538 | + if (typeof document !== "undefined") { | |
| 5539 | + registerDocument5(document); | |
| 5540 | + } | |
| 5541 | + return globalScope.__wpStyleRuntime; | |
| 5542 | + } | |
| 5543 | + function documentContainsStyleHash5(targetDocument, hash) { | |
| 5544 | + if (!targetDocument.head) { | |
| 5545 | + return false; | |
| 5546 | + } | |
| 5547 | + for (const style of targetDocument.head.querySelectorAll( | |
| 5548 | + `style[${STYLE_HASH_ATTRIBUTE5}]` | |
| 5549 | + )) { | |
| 5550 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { | |
| 5551 | + return true; | |
| 5552 | + } | |
| 5553 | + } | |
| 5554 | + return false; | |
| 5555 | + } | |
| 5556 | + function injectStyle5(targetDocument, hash, css) { | |
| 5557 | + if (!targetDocument.head) { | |
| 5558 | + return; | |
| 5559 | + } | |
| 5560 | + const runtime = getRuntime5(); | |
| 5561 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 5562 | + if (!injectedStyles) { | |
| 5563 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 5564 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 5565 | + } | |
| 5566 | + if (injectedStyles.has(hash)) { | |
| 5567 | + return; | |
| 5568 | + } | |
| 5569 | + if (documentContainsStyleHash5(targetDocument, hash)) { | |
| 5570 | + injectedStyles.add(hash); | |
| 5571 | + return; | |
| 5572 | + } | |
| 5573 | + const style = targetDocument.createElement("style"); | |
| 5574 | + style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); | |
| 5575 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 5576 | + targetDocument.head.appendChild(style); | |
| 5577 | + injectedStyles.add(hash); | |
| 5578 | + } | |
| 5579 | + function registerDocument5(targetDocument) { | |
| 5580 | + const runtime = getRuntime5(); | |
| 5581 | + runtime.documents.set( | |
| 5582 | + targetDocument, | |
| 5583 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 5584 | + ); | |
| 5585 | + for (const [hash, css] of runtime.styles) { | |
| 5586 | + injectStyle5(targetDocument, hash, css); | |
| 5587 | + } | |
| 5588 | + return () => { | |
| 5589 | + const count = runtime.documents.get(targetDocument); | |
| 5590 | + if (count === void 0) { | |
| 5591 | + return; | |
| 5592 | + } | |
| 5593 | + if (count <= 1) { | |
| 5594 | + runtime.documents.delete(targetDocument); | |
| 5595 | + return; | |
| 5596 | + } | |
| 5597 | + runtime.documents.set(targetDocument, count - 1); | |
| 5598 | + }; | |
| 5599 | + } | |
| 5600 | + function registerStyle5(hash, css) { | |
| 5601 | + const runtime = getRuntime5(); | |
| 5602 | + runtime.styles.set(hash, css); | |
| 5603 | + for (const targetDocument of runtime.documents.keys()) { | |
| 5604 | + injectStyle5(targetDocument, hash, css); | |
| 5605 | + } | |
| 5606 | + } | |
| 5607 | + if (typeof process === "undefined" || true) { | |
| 5608 | + registerStyle5("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display: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:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); | |
| 5609 | + } | |
| 5610 | + var style_default5 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; | |
| 5611 | + var InputLayoutSlot = (0, import_element8.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) { | |
| 5612 | + return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( | |
| 5613 | + "div", | |
| 5614 | + { | |
| 5615 | + ref, | |
| 5616 | + className: clsx_default( | |
| 5617 | + style_default5["input-layout-slot"], | |
| 5618 | + style_default5[`is-padding-${padding}`], | |
| 5619 | + className | |
| 5620 | + ), | |
| 5621 | + ...restProps | |
| 5622 | + } | |
| 5623 | + ); | |
| 5624 | + }); | |
| 5625 | + InputLayoutSlot.displayName = "InputLayout.Slot"; | |
| 5626 | + | |
| 5627 | + // packages/ui/build-module/form/primitives/input-layout/index.mjs | |
| 5628 | + var InputLayout3 = Object.assign(InputLayout, { | |
| 5629 | + Slot: InputLayoutSlot | |
| 5630 | + }); | |
| 5631 | + | |
| 5632 | + // packages/ui/build-module/form/primitives/input/input.mjs | |
| 5633 | + var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); | |
| 5634 | + var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; | |
| 5635 | + function getRuntime6() { | |
| 5636 | + const globalScope = globalThis; | |
| 5637 | + if (globalScope.__wpStyleRuntime) { | |
| 5638 | + return globalScope.__wpStyleRuntime; | |
| 5639 | + } | |
| 5640 | + globalScope.__wpStyleRuntime = { | |
| 5641 | + documents: /* @__PURE__ */ new Map(), | |
| 5642 | + styles: /* @__PURE__ */ new Map(), | |
| 5643 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 5644 | + }; | |
| 5645 | + if (typeof document !== "undefined") { | |
| 5646 | + registerDocument6(document); | |
| 5647 | + } | |
| 5648 | + return globalScope.__wpStyleRuntime; | |
| 5649 | + } | |
| 5650 | + function documentContainsStyleHash6(targetDocument, hash) { | |
| 5651 | + if (!targetDocument.head) { | |
| 5652 | + return false; | |
| 5653 | + } | |
| 5654 | + for (const style of targetDocument.head.querySelectorAll( | |
| 5655 | + `style[${STYLE_HASH_ATTRIBUTE6}]` | |
| 5656 | + )) { | |
| 5657 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { | |
| 5658 | + return true; | |
| 5659 | + } | |
| 5660 | + } | |
| 5661 | + return false; | |
| 5662 | + } | |
| 5663 | + function injectStyle6(targetDocument, hash, css) { | |
| 5664 | + if (!targetDocument.head) { | |
| 5665 | + return; | |
| 5666 | + } | |
| 5667 | + const runtime = getRuntime6(); | |
| 5668 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 5669 | + if (!injectedStyles) { | |
| 5670 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 5671 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 5672 | + } | |
| 5673 | + if (injectedStyles.has(hash)) { | |
| 5674 | + return; | |
| 5675 | + } | |
| 5676 | + if (documentContainsStyleHash6(targetDocument, hash)) { | |
| 5677 | + injectedStyles.add(hash); | |
| 5678 | + return; | |
| 5679 | + } | |
| 5680 | + const style = targetDocument.createElement("style"); | |
| 5681 | + style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); | |
| 5682 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 5683 | + targetDocument.head.appendChild(style); | |
| 5684 | + injectedStyles.add(hash); | |
| 5685 | + } | |
| 5686 | + function registerDocument6(targetDocument) { | |
| 5687 | + const runtime = getRuntime6(); | |
| 5688 | + runtime.documents.set( | |
| 5689 | + targetDocument, | |
| 5690 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 5691 | + ); | |
| 5692 | + for (const [hash, css] of runtime.styles) { | |
| 5693 | + injectStyle6(targetDocument, hash, css); | |
| 5694 | + } | |
| 5695 | + return () => { | |
| 5696 | + const count = runtime.documents.get(targetDocument); | |
| 5697 | + if (count === void 0) { | |
| 5698 | + return; | |
| 5699 | + } | |
| 5700 | + if (count <= 1) { | |
| 5701 | + runtime.documents.delete(targetDocument); | |
| 5702 | + return; | |
| 5703 | + } | |
| 5704 | + runtime.documents.set(targetDocument, count - 1); | |
| 5705 | + }; | |
| 5706 | + } | |
| 5707 | + function registerStyle6(hash, css) { | |
| 5708 | + const runtime = getRuntime6(); | |
| 5709 | + runtime.styles.set(hash, css); | |
| 5710 | + for (const targetDocument of runtime.documents.keys()) { | |
| 5711 | + injectStyle6(targetDocument, hash, css); | |
| 5712 | + } | |
| 5713 | + } | |
| 5714 | + if (typeof process === "undefined" || true) { | |
| 5715 | + registerStyle6("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)}"); | |
| 5716 | + } | |
| 5717 | + var global_css_defense_default3 = { "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" }; | |
| 5718 | + if (typeof process === "undefined" || true) { | |
| 5719 | + registerStyle6("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))}}}"); | |
| 5720 | + } | |
| 5721 | + var focus_module_default2 = { "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" }; | |
| 5722 | + if (typeof process === "undefined" || true) { | |
| 5723 | + registerStyle6("1a25f6a232", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0px) var(--wp-ui-input-layout-padding-inline,0px);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}&:disabled,&[aria-disabled=true]{--_gcd-input-placeholder-color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}&[type=number]{appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0}}}}}"); | |
| 5724 | + } | |
| 5725 | + var style_default6 = { "input": "_2ae7be2fc1bb17a3__input" }; | |
| 5726 | + var Input3 = (0, import_element9.forwardRef)(function Input22({ className, size = "default", prefix, suffix, style, ...restProps }, ref) { | |
| 5727 | + return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( | |
| 5728 | + InputLayout3, | |
| 5729 | + { | |
| 5730 | + className: clsx_default( | |
| 5731 | + focus_module_default2["outset-ring--focus-within"], | |
| 5732 | + className | |
| 5733 | + ), | |
| 5734 | + style, | |
| 5735 | + size, | |
| 5736 | + visuallyDisabled: restProps.disabled, | |
| 5737 | + prefix, | |
| 5738 | + suffix, | |
| 5739 | + children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( | |
| 5740 | + Input, | |
| 5741 | + { | |
| 5742 | + ref, | |
| 5743 | + className: clsx_default(global_css_defense_default3.input, style_default6.input), | |
| 5744 | + ...restProps | |
| 5745 | + } | |
| 5746 | + ) | |
| 5747 | + } | |
| 5748 | + ); | |
| 5749 | + }); | |
| 5750 | + | |
| 5751 | + // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs | |
| 5752 | + var import_i18n5 = __toESM(require_i18n(), 1); | |
| 5753 | + var import_element11 = __toESM(require_element(), 1); | |
| 5754 | + | |
| 5755 | + // packages/ui/build-module/spinner/spinner.mjs | |
| 5756 | + var import_element10 = __toESM(require_element(), 1); | |
| 5757 | + var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); | |
| 5758 | + var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; | |
| 5759 | + function getRuntime7() { | |
| 5760 | + const globalScope = globalThis; | |
| 5761 | + if (globalScope.__wpStyleRuntime) { | |
| 5762 | + return globalScope.__wpStyleRuntime; | |
| 5763 | + } | |
| 5764 | + globalScope.__wpStyleRuntime = { | |
| 5765 | + documents: /* @__PURE__ */ new Map(), | |
| 5766 | + styles: /* @__PURE__ */ new Map(), | |
| 5767 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 5768 | + }; | |
| 5769 | + if (typeof document !== "undefined") { | |
| 5770 | + registerDocument7(document); | |
| 5771 | + } | |
| 5772 | + return globalScope.__wpStyleRuntime; | |
| 5773 | + } | |
| 5774 | + function documentContainsStyleHash7(targetDocument, hash) { | |
| 5775 | + if (!targetDocument.head) { | |
| 5776 | + return false; | |
| 5777 | + } | |
| 5778 | + for (const style of targetDocument.head.querySelectorAll( | |
| 5779 | + `style[${STYLE_HASH_ATTRIBUTE7}]` | |
| 5780 | + )) { | |
| 5781 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { | |
| 5782 | + return true; | |
| 5783 | + } | |
| 5784 | + } | |
| 5785 | + return false; | |
| 5786 | + } | |
| 5787 | + function injectStyle7(targetDocument, hash, css) { | |
| 5788 | + if (!targetDocument.head) { | |
| 5789 | + return; | |
| 5790 | + } | |
| 5791 | + const runtime = getRuntime7(); | |
| 5792 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 5793 | + if (!injectedStyles) { | |
| 5794 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 5795 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 5796 | + } | |
| 5797 | + if (injectedStyles.has(hash)) { | |
| 5798 | + return; | |
| 5799 | + } | |
| 5800 | + if (documentContainsStyleHash7(targetDocument, hash)) { | |
| 5801 | + injectedStyles.add(hash); | |
| 5802 | + return; | |
| 5803 | + } | |
| 5804 | + const style = targetDocument.createElement("style"); | |
| 5805 | + style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); | |
| 5806 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 5807 | + targetDocument.head.appendChild(style); | |
| 5808 | + injectedStyles.add(hash); | |
| 5809 | + } | |
| 5810 | + function registerDocument7(targetDocument) { | |
| 5811 | + const runtime = getRuntime7(); | |
| 5812 | + runtime.documents.set( | |
| 5813 | + targetDocument, | |
| 5814 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 5815 | + ); | |
| 5816 | + for (const [hash, css] of runtime.styles) { | |
| 5817 | + injectStyle7(targetDocument, hash, css); | |
| 5818 | + } | |
| 5819 | + return () => { | |
| 5820 | + const count = runtime.documents.get(targetDocument); | |
| 5821 | + if (count === void 0) { | |
| 5822 | + return; | |
| 5823 | + } | |
| 5824 | + if (count <= 1) { | |
| 5825 | + runtime.documents.delete(targetDocument); | |
| 5826 | + return; | |
| 5827 | + } | |
| 5828 | + runtime.documents.set(targetDocument, count - 1); | |
| 5829 | + }; | |
| 5830 | + } | |
| 5831 | + function registerStyle7(hash, css) { | |
| 5832 | + const runtime = getRuntime7(); | |
| 5833 | + runtime.styles.set(hash, css); | |
| 5834 | + for (const targetDocument of runtime.documents.keys()) { | |
| 5835 | + injectStyle7(targetDocument, hash, css); | |
| 5836 | + } | |
| 5837 | + } | |
| 5838 | + if (typeof process === "undefined" || true) { | |
| 5839 | + registerStyle7("bbbecfe373", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.ab4d64c07c0ba587__spinner{background-color:transparent;display:inline-block;height:var(--wpds-dimension-size-2xs,16px);opacity:1;overflow:visible;position:relative;width:var(--wpds-dimension-size-2xs,16px)}.a7654e10245bb7d2__indicator,.dc51f80c84b35fe2__track{fill:transparent;stroke-width:1.5px}.dc51f80c84b35fe2__track{stroke:var(--wpds-color-background-track-neutral,#dbdbdb)}.a7654e10245bb7d2__indicator{stroke:var(--wpds-color-background-thumb-brand,var(--wp-admin-theme-color,#3858e9));stroke-linecap:round;animation:_02322d973909703c__spinner-spin 1.4s linear infinite both;transform-origin:50% 50%}@keyframes _02322d973909703c__spinner-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}}}"); | |
| 5840 | + } | |
| 5841 | + var style_default7 = { "spinner": "ab4d64c07c0ba587__spinner", "track": "dc51f80c84b35fe2__track", "indicator": "a7654e10245bb7d2__indicator", "spinner-spin": "_02322d973909703c__spinner-spin" }; | |
| 5842 | + var Spinner = (0, import_element10.forwardRef)( | |
| 5843 | + function Spinner2({ className, ...props }, ref) { | |
| 5844 | + return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)( | |
| 5845 | + "svg", | |
| 5846 | + { | |
| 5847 | + className: clsx_default(style_default7.spinner, className), | |
| 5848 | + viewBox: "0 0 100 100", | |
| 5849 | + xmlns: "http://www.w3.org/2000/svg", | |
| 5850 | + role: "presentation", | |
| 5851 | + focusable: "false", | |
| 5852 | + ...props, | |
| 5853 | + ref, | |
| 5854 | + children: [ | |
| 5855 | + /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( | |
| 5856 | + "circle", | |
| 5857 | + { | |
| 5858 | + className: style_default7.track, | |
| 5859 | + cx: "50", | |
| 5860 | + cy: "50", | |
| 5861 | + r: "50", | |
| 5862 | + vectorEffect: "non-scaling-stroke" | |
| 5863 | + } | |
| 5864 | + ), | |
| 5865 | + /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( | |
| 5866 | + "path", | |
| 5867 | + { | |
| 5868 | + className: style_default7.indicator, | |
| 5869 | + d: "m 50 0 a 50 50 0 0 1 50 50", | |
| 5870 | + vectorEffect: "non-scaling-stroke" | |
| 5871 | + } | |
| 5872 | + ) | |
| 5873 | + ] | |
| 5874 | + } | |
| 5875 | + ); | |
| 5876 | + } | |
| 5877 | + ); | |
| 5878 | + | |
| 5879 | + // packages/ui/build-module/form/primitives/validity-indicator/validity-indicator.mjs | |
| 5880 | + var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); | |
| 5881 | + var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; | |
| 5882 | + function getRuntime8() { | |
| 5883 | + const globalScope = globalThis; | |
| 5884 | + if (globalScope.__wpStyleRuntime) { | |
| 5885 | + return globalScope.__wpStyleRuntime; | |
| 5886 | + } | |
| 5887 | + globalScope.__wpStyleRuntime = { | |
| 5888 | + documents: /* @__PURE__ */ new Map(), | |
| 5889 | + styles: /* @__PURE__ */ new Map(), | |
| 5890 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 5891 | + }; | |
| 5892 | + if (typeof document !== "undefined") { | |
| 5893 | + registerDocument8(document); | |
| 5894 | + } | |
| 5895 | + return globalScope.__wpStyleRuntime; | |
| 5896 | + } | |
| 5897 | + function documentContainsStyleHash8(targetDocument, hash) { | |
| 5898 | + if (!targetDocument.head) { | |
| 5899 | + return false; | |
| 5900 | + } | |
| 5901 | + for (const style of targetDocument.head.querySelectorAll( | |
| 5902 | + `style[${STYLE_HASH_ATTRIBUTE8}]` | |
| 5903 | + )) { | |
| 5904 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { | |
| 5905 | + return true; | |
| 5906 | + } | |
| 5907 | + } | |
| 5908 | + return false; | |
| 5909 | + } | |
| 5910 | + function injectStyle8(targetDocument, hash, css) { | |
| 5911 | + if (!targetDocument.head) { | |
| 5912 | + return; | |
| 5913 | + } | |
| 5914 | + const runtime = getRuntime8(); | |
| 5915 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 5916 | + if (!injectedStyles) { | |
| 5917 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 5918 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 5919 | + } | |
| 5920 | + if (injectedStyles.has(hash)) { | |
| 5921 | + return; | |
| 5922 | + } | |
| 5923 | + if (documentContainsStyleHash8(targetDocument, hash)) { | |
| 5924 | + injectedStyles.add(hash); | |
| 5925 | + return; | |
| 5926 | + } | |
| 5927 | + const style = targetDocument.createElement("style"); | |
| 5928 | + style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); | |
| 5929 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 5930 | + targetDocument.head.appendChild(style); | |
| 5931 | + injectedStyles.add(hash); | |
| 5932 | + } | |
| 5933 | + function registerDocument8(targetDocument) { | |
| 5934 | + const runtime = getRuntime8(); | |
| 5935 | + runtime.documents.set( | |
| 5936 | + targetDocument, | |
| 5937 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 5938 | + ); | |
| 5939 | + for (const [hash, css] of runtime.styles) { | |
| 5940 | + injectStyle8(targetDocument, hash, css); | |
| 5941 | + } | |
| 5942 | + return () => { | |
| 5943 | + const count = runtime.documents.get(targetDocument); | |
| 5944 | + if (count === void 0) { | |
| 5945 | + return; | |
| 5946 | + } | |
| 5947 | + if (count <= 1) { | |
| 5948 | + runtime.documents.delete(targetDocument); | |
| 5949 | + return; | |
| 5950 | + } | |
| 5951 | + runtime.documents.set(targetDocument, count - 1); | |
| 5952 | + }; | |
| 5953 | + } | |
| 5954 | + function registerStyle8(hash, css) { | |
| 5955 | + const runtime = getRuntime8(); | |
| 5956 | + runtime.styles.set(hash, css); | |
| 5957 | + for (const targetDocument of runtime.documents.keys()) { | |
| 5958 | + injectStyle8(targetDocument, hash, css); | |
| 5959 | + } | |
| 5960 | + } | |
| 5961 | + if (typeof process === "undefined" || true) { | |
| 5962 | + registerStyle8("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)}"); | |
| 5963 | + } | |
| 5964 | + var global_css_defense_default4 = { "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" }; | |
| 5965 | + if (typeof process === "undefined" || true) { | |
| 5966 | + registerStyle8("d11816833c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7a7ac88e306348e7__indicator{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);align-items:flex-start;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display: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(--wpds-typography-font-size-sm,12px);gap:var(--wpds-dimension-gap-xs,4px);line-height:var(--wpds-typography-line-height-xs,16px);@media not (prefers-reduced-motion){animation:_48722cc5dd090ce4__indicator-jump var(--wpds-motion-duration-md,.2s) cubic-bezier(.68,-.55,.27,1.55)}}._57a3bbbfbe38a5c6__is-invalid{color:var(--wpds-color-foreground-content-error-weak,#cc1818)}._9e944dc198aac10b__is-valid{color:var(--wpds-color-foreground-content-success-weak,#008030)}.e482806667437c6a__indicator-icon{flex-shrink:0}._6e46434cc23019d2__indicator-spinner{height:var(--wpds-dimension-size-3xs,12px);margin:2px;width:var(--wpds-dimension-size-3xs,12px)}@keyframes _48722cc5dd090ce4__indicator-jump{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}}}'); | |
| 5967 | + } | |
| 5968 | + var style_default8 = { "indicator": "_7a7ac88e306348e7__indicator", "indicator-jump": "_48722cc5dd090ce4__indicator-jump", "is-invalid": "_57a3bbbfbe38a5c6__is-invalid", "is-valid": "_9e944dc198aac10b__is-valid", "indicator-icon": "e482806667437c6a__indicator-icon", "indicator-spinner": "_6e46434cc23019d2__indicator-spinner" }; | |
| 5969 | + var ICON = { | |
| 5970 | + valid: published_default, | |
| 5971 | + invalid: error_default | |
| 5972 | + }; | |
| 5973 | + function ValidityIndicator({ | |
| 5974 | + id, | |
| 5975 | + type, | |
| 5976 | + message | |
| 5977 | + }) { | |
| 5978 | + return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)( | |
| 5979 | + "p", | |
| 5980 | + { | |
| 5981 | + id, | |
| 5982 | + className: clsx_default( | |
| 5983 | + global_css_defense_default4.p, | |
| 5984 | + style_default8.indicator, | |
| 5985 | + style_default8[`is-${type}`] | |
| 5986 | + ), | |
| 5987 | + children: [ | |
| 5988 | + type === "validating" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Spinner, { className: style_default8["indicator-spinner"] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( | |
| 5989 | + Icon, | |
| 5990 | + { | |
| 5991 | + className: style_default8["indicator-icon"], | |
| 5992 | + icon: ICON[type], | |
| 5993 | + size: 16, | |
| 5994 | + fill: "currentColor" | |
| 5995 | + } | |
| 5996 | + ), | |
| 5997 | + message | |
| 5998 | + ] | |
| 5999 | + } | |
| 6000 | + ); | |
| 6001 | + } | |
| 6002 | + | |
| 6003 | + // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs | |
| 6004 | + var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); | |
| 6005 | + var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Stack, { ...props, direction: "column", gap: "sm" }); | |
| 6006 | + function appendRequiredIndicator(label, required, markWhenOptional) { | |
| 6007 | + let suffix; | |
| 6008 | + if (required && !markWhenOptional) { | |
| 6009 | + suffix = `(${(0, import_i18n5.__)("Required")})`; | |
| 6010 | + } else if (!required && markWhenOptional) { | |
| 6011 | + suffix = `(${(0, import_i18n5.__)("Optional")})`; | |
| 6012 | + } | |
| 6013 | + if (!suffix) { | |
| 6014 | + return label; | |
| 6015 | + } | |
| 6016 | + if (typeof label === "string") { | |
| 6017 | + return `${label} ${suffix}`; | |
| 6018 | + } | |
| 6019 | + return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [ | |
| 6020 | + label, | |
| 6021 | + " ", | |
| 6022 | + suffix | |
| 6023 | + ] }); | |
| 6024 | + } | |
| 6025 | + var VALIDITY_VISIBLE_ATTRIBUTE = "data-validity-visible"; | |
| 6026 | + var ControlWithError = (0, import_element11.forwardRef)(function ControlWithError2({ | |
| 6027 | + required, | |
| 6028 | + markWhenOptional, | |
| 6029 | + customValidity, | |
| 6030 | + getValidityTarget, | |
| 6031 | + children, | |
| 6032 | + render = DEFAULT_RENDER, | |
| 6033 | + ...restProps | |
| 6034 | + }, forwardedRef) { | |
| 6035 | + const [errorMessage, setErrorMessage] = (0, import_element11.useState)(); | |
| 6036 | + const [statusMessage, setStatusMessage] = (0, import_element11.useState)(); | |
| 6037 | + const [showMessage, setShowMessage] = (0, import_element11.useState)(false); | |
| 6038 | + const [isTouched, setIsTouched] = (0, import_element11.useState)(false); | |
| 6039 | + const wrapperRef = (0, import_element11.useRef)(null); | |
| 6040 | + (0, import_element11.useEffect)(() => { | |
| 6041 | + const validityTarget = getValidityTarget(); | |
| 6042 | + const handler = () => { | |
| 6043 | + if (customValidity?.type !== "validating") { | |
| 6044 | + setErrorMessage(validityTarget?.validationMessage); | |
| 6045 | + } | |
| 6046 | + setShowMessage(true); | |
| 6047 | + validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, ""); | |
| 6048 | + }; | |
| 6049 | + validityTarget?.addEventListener("invalid", handler); | |
| 6050 | + return () => validityTarget?.removeEventListener("invalid", handler); | |
| 6051 | + }, [customValidity?.type, getValidityTarget]); | |
| 6052 | + (0, import_element11.useEffect)(() => { | |
| 6053 | + const validityTarget = getValidityTarget(); | |
| 6054 | + const suppressNativePopover = (event) => { | |
| 6055 | + event.preventDefault(); | |
| 6056 | + if (!event.isTrusted) { | |
| 6057 | + return; | |
| 6058 | + } | |
| 6059 | + const target = event.target; | |
| 6060 | + const firstErrorInForm = Array.from( | |
| 6061 | + target.form?.elements ?? [] | |
| 6062 | + ).find((el) => !el.validity.valid); | |
| 6063 | + if (!target.form || firstErrorInForm === target) { | |
| 6064 | + target.focus(); | |
| 6065 | + } | |
| 6066 | + }; | |
| 6067 | + const radioSiblings = validityTarget?.type === "radio" && validityTarget?.name ? Array.from( | |
| 6068 | + wrapperRef.current?.querySelectorAll( | |
| 6069 | + `input[type="radio"][name="${validityTarget?.name}"]` | |
| 6070 | + ) ?? [] | |
| 6071 | + ).filter((sibling) => sibling !== validityTarget) : []; | |
| 6072 | + validityTarget?.addEventListener("invalid", suppressNativePopover); | |
| 6073 | + radioSiblings.forEach( | |
| 6074 | + (sibling) => sibling.addEventListener("invalid", suppressNativePopover) | |
| 6075 | + ); | |
| 6076 | + return () => { | |
| 6077 | + validityTarget?.removeEventListener( | |
| 6078 | + "invalid", | |
| 6079 | + suppressNativePopover | |
| 6080 | + ); | |
| 6081 | + radioSiblings.forEach( | |
| 6082 | + (sibling) => sibling.removeEventListener("invalid", suppressNativePopover) | |
| 6083 | + ); | |
| 6084 | + }; | |
| 6085 | + }, [getValidityTarget]); | |
| 6086 | + (0, import_element11.useEffect)(() => { | |
| 6087 | + const validityTarget = getValidityTarget(); | |
| 6088 | + if (!customValidity?.type) { | |
| 6089 | + validityTarget?.setCustomValidity(""); | |
| 6090 | + setErrorMessage(validityTarget?.validationMessage); | |
| 6091 | + setStatusMessage(void 0); | |
| 6092 | + return; | |
| 6093 | + } | |
| 6094 | + switch (customValidity.type) { | |
| 6095 | + case "validating": { | |
| 6096 | + validityTarget?.setCustomValidity(""); | |
| 6097 | + setErrorMessage(void 0); | |
| 6098 | + setStatusMessage({ | |
| 6099 | + type: "validating", | |
| 6100 | + message: customValidity.message | |
| 6101 | + }); | |
| 6102 | + break; | |
| 6103 | + } | |
| 6104 | + case "valid": { | |
| 6105 | + validityTarget?.setCustomValidity(""); | |
| 6106 | + setErrorMessage(validityTarget?.validationMessage); | |
| 6107 | + setStatusMessage({ | |
| 6108 | + type: "valid", | |
| 6109 | + message: customValidity.message | |
| 6110 | + }); | |
| 6111 | + break; | |
| 6112 | + } | |
| 6113 | + case "invalid": { | |
| 6114 | + validityTarget?.setCustomValidity( | |
| 6115 | + customValidity.message ?? "" | |
| 6116 | + ); | |
| 6117 | + setErrorMessage(validityTarget?.validationMessage); | |
| 6118 | + setStatusMessage(void 0); | |
| 6119 | + break; | |
| 6120 | + } | |
| 6121 | + } | |
| 6122 | + }, [customValidity, getValidityTarget]); | |
| 6123 | + (0, import_element11.useEffect)(() => { | |
| 6124 | + if (!isTouched || showMessage) { | |
| 6125 | + return; | |
| 6126 | + } | |
| 6127 | + if (customValidity?.type === "validating") { | |
| 6128 | + const timer = setTimeout(() => { | |
| 6129 | + setShowMessage(true); | |
| 6130 | + }, 1e3); | |
| 6131 | + return () => clearTimeout(timer); | |
| 6132 | + } | |
| 6133 | + setShowMessage(true); | |
| 6134 | + }, [isTouched, customValidity?.type, showMessage]); | |
| 6135 | + const onBlur = (event) => { | |
| 6136 | + if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) { | |
| 6137 | + return; | |
| 6138 | + } | |
| 6139 | + if (!isTouched) { | |
| 6140 | + setIsTouched(true); | |
| 6141 | + getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, ""); | |
| 6142 | + } | |
| 6143 | + const validityTarget = getValidityTarget(); | |
| 6144 | + const isValidating = customValidity?.type === "validating"; | |
| 6145 | + window.queueMicrotask(() => { | |
| 6146 | + if (!isValidating) { | |
| 6147 | + setErrorMessage(validityTarget?.validationMessage); | |
| 6148 | + } | |
| 6149 | + }); | |
| 6150 | + }; | |
| 6151 | + const messageId = (0, import_element11.useId)(); | |
| 6152 | + const message = (() => { | |
| 6153 | + if (errorMessage) { | |
| 6154 | + return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( | |
| 6155 | + ValidityIndicator, | |
| 6156 | + { | |
| 6157 | + id: messageId, | |
| 6158 | + type: "invalid", | |
| 6159 | + message: errorMessage | |
| 6160 | + } | |
| 6161 | + ); | |
| 6162 | + } | |
| 6163 | + if (statusMessage?.type) { | |
| 6164 | + return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( | |
| 6165 | + ValidityIndicator, | |
| 6166 | + { | |
| 6167 | + id: messageId, | |
| 6168 | + type: statusMessage.type, | |
| 6169 | + message: statusMessage.message | |
| 6170 | + } | |
| 6171 | + ); | |
| 6172 | + } | |
| 6173 | + return null; | |
| 6174 | + })(); | |
| 6175 | + const visibleMessage = showMessage ? message : null; | |
| 6176 | + (0, import_element11.useEffect)(() => { | |
| 6177 | + const target = getValidityTarget(); | |
| 6178 | + if (!target) { | |
| 6179 | + return; | |
| 6180 | + } | |
| 6181 | + function setDescribedBy(el, shouldAdd) { | |
| 6182 | + const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((id) => id && id !== messageId); | |
| 6183 | + if (shouldAdd) { | |
| 6184 | + ids.push(messageId); | |
| 6185 | + } | |
| 6186 | + if (ids.length) { | |
| 6187 | + el.setAttribute("aria-describedby", ids.join(" ")); | |
| 6188 | + } else { | |
| 6189 | + el.removeAttribute("aria-describedby"); | |
| 6190 | + } | |
| 6191 | + } | |
| 6192 | + setDescribedBy(target, !!visibleMessage); | |
| 6193 | + return () => setDescribedBy(target, false); | |
| 6194 | + }, [visibleMessage, messageId, getValidityTarget]); | |
| 6195 | + return useRender({ | |
| 6196 | + render, | |
| 6197 | + ref: [forwardedRef, wrapperRef], | |
| 6198 | + props: mergeProps(restProps, { | |
| 6199 | + onBlur, | |
| 6200 | + children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [ | |
| 6201 | + (0, import_element11.cloneElement)(children, { | |
| 6202 | + label: appendRequiredIndicator( | |
| 6203 | + children.props.label, | |
| 6204 | + required, | |
| 6205 | + markWhenOptional | |
| 6206 | + ), | |
| 6207 | + required | |
| 6208 | + }), | |
| 6209 | + visibleMessage | |
| 6210 | + ] }) | |
| 6211 | + }) | |
| 6212 | + }); | |
| 6213 | + }); | |
| 6214 | + | |
| 6215 | + // packages/ui/build-module/form/primitives/field/index.mjs | |
| 6216 | + var field_exports = {}; | |
| 6217 | + __export(field_exports, { | |
| 6218 | + Control: () => Control, | |
| 6219 | + Description: () => Description, | |
| 6220 | + Details: () => Details, | |
| 6221 | + Item: () => Item, | |
| 6222 | + Label: () => Label, | |
| 6223 | + Root: () => Root, | |
| 6224 | + VisualLabel: () => VisualLabel | |
| 6225 | + }); | |
| 6226 | + | |
| 6227 | + // packages/ui/build-module/form/primitives/field/root.mjs | |
| 6228 | + var import_element12 = __toESM(require_element(), 1); | |
| 6229 | + var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); | |
| 6230 | + var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; | |
| 6231 | + function getRuntime9() { | |
| 6232 | + const globalScope = globalThis; | |
| 6233 | + if (globalScope.__wpStyleRuntime) { | |
| 6234 | + return globalScope.__wpStyleRuntime; | |
| 6235 | + } | |
| 6236 | + globalScope.__wpStyleRuntime = { | |
| 6237 | + documents: /* @__PURE__ */ new Map(), | |
| 6238 | + styles: /* @__PURE__ */ new Map(), | |
| 6239 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 6240 | + }; | |
| 6241 | + if (typeof document !== "undefined") { | |
| 6242 | + registerDocument9(document); | |
| 6243 | + } | |
| 6244 | + return globalScope.__wpStyleRuntime; | |
| 6245 | + } | |
| 6246 | + function documentContainsStyleHash9(targetDocument, hash) { | |
| 6247 | + if (!targetDocument.head) { | |
| 6248 | + return false; | |
| 6249 | + } | |
| 6250 | + for (const style of targetDocument.head.querySelectorAll( | |
| 6251 | + `style[${STYLE_HASH_ATTRIBUTE9}]` | |
| 6252 | + )) { | |
| 6253 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { | |
| 6254 | + return true; | |
| 6255 | + } | |
| 6256 | + } | |
| 6257 | + return false; | |
| 6258 | + } | |
| 6259 | + function injectStyle9(targetDocument, hash, css) { | |
| 6260 | + if (!targetDocument.head) { | |
| 6261 | + return; | |
| 6262 | + } | |
| 6263 | + const runtime = getRuntime9(); | |
| 6264 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 6265 | + if (!injectedStyles) { | |
| 6266 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 6267 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 6268 | + } | |
| 6269 | + if (injectedStyles.has(hash)) { | |
| 6270 | + return; | |
| 6271 | + } | |
| 6272 | + if (documentContainsStyleHash9(targetDocument, hash)) { | |
| 6273 | + injectedStyles.add(hash); | |
| 6274 | + return; | |
| 6275 | + } | |
| 6276 | + const style = targetDocument.createElement("style"); | |
| 6277 | + style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); | |
| 6278 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 6279 | + targetDocument.head.appendChild(style); | |
| 6280 | + injectedStyles.add(hash); | |
| 6281 | + } | |
| 6282 | + function registerDocument9(targetDocument) { | |
| 6283 | + const runtime = getRuntime9(); | |
| 6284 | + runtime.documents.set( | |
| 6285 | + targetDocument, | |
| 6286 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 6287 | + ); | |
| 6288 | + for (const [hash, css] of runtime.styles) { | |
| 6289 | + injectStyle9(targetDocument, hash, css); | |
| 6290 | + } | |
| 6291 | + return () => { | |
| 6292 | + const count = runtime.documents.get(targetDocument); | |
| 6293 | + if (count === void 0) { | |
| 6294 | + return; | |
| 6295 | + } | |
| 6296 | + if (count <= 1) { | |
| 6297 | + runtime.documents.delete(targetDocument); | |
| 6298 | + return; | |
| 6299 | + } | |
| 6300 | + runtime.documents.set(targetDocument, count - 1); | |
| 6301 | + }; | |
| 6302 | + } | |
| 6303 | + function registerStyle9(hash, css) { | |
| 6304 | + const runtime = getRuntime9(); | |
| 6305 | + runtime.styles.set(hash, css); | |
| 6306 | + for (const targetDocument of runtime.documents.keys()) { | |
| 6307 | + injectStyle9(targetDocument, hash, css); | |
| 6308 | + } | |
| 6309 | + } | |
| 6310 | + if (typeof process === "undefined" || true) { | |
| 6311 | + registerStyle9("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); | |
| 6312 | + } | |
| 6313 | + var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; | |
| 6314 | + var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Stack, { ...props, direction: "column", gap: "sm" }); | |
| 6315 | + var Root = (0, import_element12.forwardRef)(function Root2({ className, render = DEFAULT_RENDER2, ...restProps }, ref) { | |
| 6316 | + return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( | |
| 6317 | + index_parts_exports.Root, | |
| 6318 | + { | |
| 6319 | + ref, | |
| 6320 | + className: clsx_default(resets_default3["box-sizing"], className), | |
| 6321 | + render, | |
| 6322 | + ...restProps | |
| 6323 | + } | |
| 6324 | + ); | |
| 6325 | + }); | |
| 6326 | + | |
| 6327 | + // packages/ui/build-module/form/primitives/field/item.mjs | |
| 6328 | + var import_element13 = __toESM(require_element(), 1); | |
| 6329 | + var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); | |
| 6330 | + var Item = (0, import_element13.forwardRef)(function Item2(props, ref) { | |
| 6331 | + return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(index_parts_exports.Item, { ref, ...props }); | |
| 6332 | + }); | |
| 6333 | + | |
| 6334 | + // packages/ui/build-module/form/primitives/field/label.mjs | |
| 6335 | + var import_element14 = __toESM(require_element(), 1); | |
| 6336 | + var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); | |
| 6337 | + var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; | |
| 6338 | + function getRuntime10() { | |
| 6339 | + const globalScope = globalThis; | |
| 6340 | + if (globalScope.__wpStyleRuntime) { | |
| 6341 | + return globalScope.__wpStyleRuntime; | |
| 6342 | + } | |
| 6343 | + globalScope.__wpStyleRuntime = { | |
| 6344 | + documents: /* @__PURE__ */ new Map(), | |
| 6345 | + styles: /* @__PURE__ */ new Map(), | |
| 6346 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 6347 | + }; | |
| 6348 | + if (typeof document !== "undefined") { | |
| 6349 | + registerDocument10(document); | |
| 6350 | + } | |
| 6351 | + return globalScope.__wpStyleRuntime; | |
| 6352 | + } | |
| 6353 | + function documentContainsStyleHash10(targetDocument, hash) { | |
| 6354 | + if (!targetDocument.head) { | |
| 6355 | + return false; | |
| 6356 | + } | |
| 6357 | + for (const style of targetDocument.head.querySelectorAll( | |
| 6358 | + `style[${STYLE_HASH_ATTRIBUTE10}]` | |
| 6359 | + )) { | |
| 6360 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { | |
| 6361 | + return true; | |
| 6362 | + } | |
| 6363 | + } | |
| 6364 | + return false; | |
| 6365 | + } | |
| 6366 | + function injectStyle10(targetDocument, hash, css) { | |
| 6367 | + if (!targetDocument.head) { | |
| 6368 | + return; | |
| 6369 | + } | |
| 6370 | + const runtime = getRuntime10(); | |
| 6371 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 6372 | + if (!injectedStyles) { | |
| 6373 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 6374 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 6375 | + } | |
| 6376 | + if (injectedStyles.has(hash)) { | |
| 6377 | + return; | |
| 6378 | + } | |
| 6379 | + if (documentContainsStyleHash10(targetDocument, hash)) { | |
| 6380 | + injectedStyles.add(hash); | |
| 6381 | + return; | |
| 6382 | + } | |
| 6383 | + const style = targetDocument.createElement("style"); | |
| 6384 | + style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); | |
| 6385 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 6386 | + targetDocument.head.appendChild(style); | |
| 6387 | + injectedStyles.add(hash); | |
| 6388 | + } | |
| 6389 | + function registerDocument10(targetDocument) { | |
| 6390 | + const runtime = getRuntime10(); | |
| 6391 | + runtime.documents.set( | |
| 6392 | + targetDocument, | |
| 6393 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 6394 | + ); | |
| 6395 | + for (const [hash, css] of runtime.styles) { | |
| 6396 | + injectStyle10(targetDocument, hash, css); | |
| 6397 | + } | |
| 6398 | + return () => { | |
| 6399 | + const count = runtime.documents.get(targetDocument); | |
| 6400 | + if (count === void 0) { | |
| 6401 | + return; | |
| 6402 | + } | |
| 6403 | + if (count <= 1) { | |
| 6404 | + runtime.documents.delete(targetDocument); | |
| 6405 | + return; | |
| 6406 | + } | |
| 6407 | + runtime.documents.set(targetDocument, count - 1); | |
| 6408 | + }; | |
| 6409 | + } | |
| 6410 | + function registerStyle10(hash, css) { | |
| 6411 | + const runtime = getRuntime10(); | |
| 6412 | + runtime.styles.set(hash, css); | |
| 6413 | + for (const targetDocument of runtime.documents.keys()) { | |
| 6414 | + injectStyle10(targetDocument, hash, css); | |
| 6415 | + } | |
| 6416 | + } | |
| 6417 | + if (typeof process === "undefined" || true) { | |
| 6418 | + registerStyle10("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 6419 | + } | |
| 6420 | + var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 6421 | + var Label = (0, import_element14.forwardRef)( | |
| 6422 | + function Label2({ className, hideFromVision, variant, ...restProps }, ref) { | |
| 6423 | + const label = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( | |
| 6424 | + index_parts_exports.Label, | |
| 6425 | + { | |
| 6426 | + ref, | |
| 6427 | + className: clsx_default( | |
| 6428 | + field_default.label, | |
| 6429 | + variant && field_default[`is-${variant}`], | |
| 6430 | + className | |
| 6431 | + ), | |
| 6432 | + ...restProps | |
| 6433 | + } | |
| 6434 | + ); | |
| 6435 | + if (hideFromVision) { | |
| 6436 | + return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(VisuallyHidden, { render: label }); | |
| 6437 | + } | |
| 6438 | + return label; | |
| 6439 | + } | |
| 6440 | + ); | |
| 6441 | + | |
| 6442 | + // packages/ui/build-module/form/primitives/field/description.mjs | |
| 6443 | + var import_element15 = __toESM(require_element(), 1); | |
| 6444 | + var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); | |
| 6445 | + var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; | |
| 6446 | + function getRuntime11() { | |
| 6447 | + const globalScope = globalThis; | |
| 6448 | + if (globalScope.__wpStyleRuntime) { | |
| 6449 | + return globalScope.__wpStyleRuntime; | |
| 6450 | + } | |
| 6451 | + globalScope.__wpStyleRuntime = { | |
| 6452 | + documents: /* @__PURE__ */ new Map(), | |
| 6453 | + styles: /* @__PURE__ */ new Map(), | |
| 6454 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 6455 | + }; | |
| 6456 | + if (typeof document !== "undefined") { | |
| 6457 | + registerDocument11(document); | |
| 6458 | + } | |
| 6459 | + return globalScope.__wpStyleRuntime; | |
| 6460 | + } | |
| 6461 | + function documentContainsStyleHash11(targetDocument, hash) { | |
| 6462 | + if (!targetDocument.head) { | |
| 6463 | + return false; | |
| 6464 | + } | |
| 6465 | + for (const style of targetDocument.head.querySelectorAll( | |
| 6466 | + `style[${STYLE_HASH_ATTRIBUTE11}]` | |
| 6467 | + )) { | |
| 6468 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { | |
| 6469 | + return true; | |
| 6470 | + } | |
| 6471 | + } | |
| 6472 | + return false; | |
| 6473 | + } | |
| 6474 | + function injectStyle11(targetDocument, hash, css) { | |
| 6475 | + if (!targetDocument.head) { | |
| 6476 | + return; | |
| 6477 | + } | |
| 6478 | + const runtime = getRuntime11(); | |
| 6479 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 6480 | + if (!injectedStyles) { | |
| 6481 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 6482 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 6483 | + } | |
| 6484 | + if (injectedStyles.has(hash)) { | |
| 6485 | + return; | |
| 6486 | + } | |
| 6487 | + if (documentContainsStyleHash11(targetDocument, hash)) { | |
| 6488 | + injectedStyles.add(hash); | |
| 6489 | + return; | |
| 6490 | + } | |
| 6491 | + const style = targetDocument.createElement("style"); | |
| 6492 | + style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); | |
| 6493 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 6494 | + targetDocument.head.appendChild(style); | |
| 6495 | + injectedStyles.add(hash); | |
| 6496 | + } | |
| 6497 | + function registerDocument11(targetDocument) { | |
| 6498 | + const runtime = getRuntime11(); | |
| 6499 | + runtime.documents.set( | |
| 6500 | + targetDocument, | |
| 6501 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 6502 | + ); | |
| 6503 | + for (const [hash, css] of runtime.styles) { | |
| 6504 | + injectStyle11(targetDocument, hash, css); | |
| 6505 | + } | |
| 6506 | + return () => { | |
| 6507 | + const count = runtime.documents.get(targetDocument); | |
| 6508 | + if (count === void 0) { | |
| 6509 | + return; | |
| 6510 | + } | |
| 6511 | + if (count <= 1) { | |
| 6512 | + runtime.documents.delete(targetDocument); | |
| 6513 | + return; | |
| 6514 | + } | |
| 6515 | + runtime.documents.set(targetDocument, count - 1); | |
| 6516 | + }; | |
| 6517 | + } | |
| 6518 | + function registerStyle11(hash, css) { | |
| 6519 | + const runtime = getRuntime11(); | |
| 6520 | + runtime.styles.set(hash, css); | |
| 6521 | + for (const targetDocument of runtime.documents.keys()) { | |
| 6522 | + injectStyle11(targetDocument, hash, css); | |
| 6523 | + } | |
| 6524 | + } | |
| 6525 | + if (typeof process === "undefined" || true) { | |
| 6526 | + registerStyle11("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)}"); | |
| 6527 | + } | |
| 6528 | + var global_css_defense_default5 = { "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" }; | |
| 6529 | + if (typeof process === "undefined" || true) { | |
| 6530 | + registerStyle11("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 6531 | + } | |
| 6532 | + var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 6533 | + var Description = (0, import_element15.forwardRef)(function Description2({ className, ...restProps }, ref) { | |
| 6534 | + return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( | |
| 6535 | + index_parts_exports.Description, | |
| 6536 | + { | |
| 6537 | + ref, | |
| 6538 | + className: clsx_default( | |
| 6539 | + global_css_defense_default5.p, | |
| 6540 | + field_default2.description, | |
| 6541 | + className | |
| 6542 | + ), | |
| 6543 | + ...restProps | |
| 6544 | + } | |
| 6545 | + ); | |
| 6546 | + }); | |
| 6547 | + | |
| 6548 | + // packages/ui/build-module/form/primitives/field/details.mjs | |
| 6549 | + var import_element16 = __toESM(require_element(), 1); | |
| 6550 | + var import_i18n6 = __toESM(require_i18n(), 1); | |
| 6551 | + var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); | |
| 6552 | + var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; | |
| 6553 | + function getRuntime12() { | |
| 6554 | + const globalScope = globalThis; | |
| 6555 | + if (globalScope.__wpStyleRuntime) { | |
| 6556 | + return globalScope.__wpStyleRuntime; | |
| 6557 | + } | |
| 6558 | + globalScope.__wpStyleRuntime = { | |
| 6559 | + documents: /* @__PURE__ */ new Map(), | |
| 6560 | + styles: /* @__PURE__ */ new Map(), | |
| 6561 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 6562 | + }; | |
| 6563 | + if (typeof document !== "undefined") { | |
| 6564 | + registerDocument12(document); | |
| 6565 | + } | |
| 6566 | + return globalScope.__wpStyleRuntime; | |
| 6567 | + } | |
| 6568 | + function documentContainsStyleHash12(targetDocument, hash) { | |
| 6569 | + if (!targetDocument.head) { | |
| 6570 | + return false; | |
| 6571 | + } | |
| 6572 | + for (const style of targetDocument.head.querySelectorAll( | |
| 6573 | + `style[${STYLE_HASH_ATTRIBUTE12}]` | |
| 6574 | + )) { | |
| 6575 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { | |
| 6576 | + return true; | |
| 6577 | + } | |
| 6578 | + } | |
| 6579 | + return false; | |
| 6580 | + } | |
| 6581 | + function injectStyle12(targetDocument, hash, css) { | |
| 6582 | + if (!targetDocument.head) { | |
| 6583 | + return; | |
| 6584 | + } | |
| 6585 | + const runtime = getRuntime12(); | |
| 6586 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 6587 | + if (!injectedStyles) { | |
| 6588 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 6589 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 6590 | + } | |
| 6591 | + if (injectedStyles.has(hash)) { | |
| 6592 | + return; | |
| 6593 | + } | |
| 6594 | + if (documentContainsStyleHash12(targetDocument, hash)) { | |
| 6595 | + injectedStyles.add(hash); | |
| 6596 | + return; | |
| 6597 | + } | |
| 6598 | + const style = targetDocument.createElement("style"); | |
| 6599 | + style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); | |
| 6600 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 6601 | + targetDocument.head.appendChild(style); | |
| 6602 | + injectedStyles.add(hash); | |
| 6603 | + } | |
| 6604 | + function registerDocument12(targetDocument) { | |
| 6605 | + const runtime = getRuntime12(); | |
| 6606 | + runtime.documents.set( | |
| 6607 | + targetDocument, | |
| 6608 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 6609 | + ); | |
| 6610 | + for (const [hash, css] of runtime.styles) { | |
| 6611 | + injectStyle12(targetDocument, hash, css); | |
| 6612 | + } | |
| 6613 | + return () => { | |
| 6614 | + const count = runtime.documents.get(targetDocument); | |
| 6615 | + if (count === void 0) { | |
| 6616 | + return; | |
| 6617 | + } | |
| 6618 | + if (count <= 1) { | |
| 6619 | + runtime.documents.delete(targetDocument); | |
| 6620 | + return; | |
| 6621 | + } | |
| 6622 | + runtime.documents.set(targetDocument, count - 1); | |
| 6623 | + }; | |
| 6624 | + } | |
| 6625 | + function registerStyle12(hash, css) { | |
| 6626 | + const runtime = getRuntime12(); | |
| 6627 | + runtime.styles.set(hash, css); | |
| 6628 | + for (const targetDocument of runtime.documents.keys()) { | |
| 6629 | + injectStyle12(targetDocument, hash, css); | |
| 6630 | + } | |
| 6631 | + } | |
| 6632 | + if (typeof process === "undefined" || true) { | |
| 6633 | + registerStyle12("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 6634 | + } | |
| 6635 | + var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 6636 | + var Details = (0, import_element16.forwardRef)( | |
| 6637 | + function Details2({ className, ...restProps }, ref) { | |
| 6638 | + return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [ | |
| 6639 | + /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(index_parts_exports.Description, {}), children: (0, import_i18n6.__)("More details follow the field.") }), | |
| 6640 | + /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( | |
| 6641 | + "div", | |
| 6642 | + { | |
| 6643 | + ref, | |
| 6644 | + className: clsx_default(field_default3.description, className), | |
| 6645 | + ...restProps | |
| 6646 | + } | |
| 6647 | + ) | |
| 6648 | + ] }); | |
| 6649 | + } | |
| 6650 | + ); | |
| 6651 | + | |
| 6652 | + // packages/ui/build-module/form/primitives/field/control.mjs | |
| 6653 | + var import_element17 = __toESM(require_element(), 1); | |
| 6654 | + var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); | |
| 6655 | + var Control = (0, import_element17.forwardRef)( | |
| 6656 | + function Control2(props, ref) { | |
| 6657 | + return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(index_parts_exports.Control, { ref, ...props }); | |
| 6658 | + } | |
| 6659 | + ); | |
| 6660 | + | |
| 6661 | + // packages/ui/build-module/form/primitives/field/visual-label.mjs | |
| 6662 | + var import_element18 = __toESM(require_element(), 1); | |
| 6663 | + var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; | |
| 6664 | + function getRuntime13() { | |
| 6665 | + const globalScope = globalThis; | |
| 6666 | + if (globalScope.__wpStyleRuntime) { | |
| 6667 | + return globalScope.__wpStyleRuntime; | |
| 6668 | + } | |
| 6669 | + globalScope.__wpStyleRuntime = { | |
| 6670 | + documents: /* @__PURE__ */ new Map(), | |
| 6671 | + styles: /* @__PURE__ */ new Map(), | |
| 6672 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 6673 | + }; | |
| 6674 | + if (typeof document !== "undefined") { | |
| 6675 | + registerDocument13(document); | |
| 6676 | + } | |
| 6677 | + return globalScope.__wpStyleRuntime; | |
| 6678 | + } | |
| 6679 | + function documentContainsStyleHash13(targetDocument, hash) { | |
| 6680 | + if (!targetDocument.head) { | |
| 6681 | + return false; | |
| 6682 | + } | |
| 6683 | + for (const style of targetDocument.head.querySelectorAll( | |
| 6684 | + `style[${STYLE_HASH_ATTRIBUTE13}]` | |
| 6685 | + )) { | |
| 6686 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { | |
| 6687 | + return true; | |
| 6688 | + } | |
| 6689 | + } | |
| 6690 | + return false; | |
| 6691 | + } | |
| 6692 | + function injectStyle13(targetDocument, hash, css) { | |
| 6693 | + if (!targetDocument.head) { | |
| 6694 | + return; | |
| 6695 | + } | |
| 6696 | + const runtime = getRuntime13(); | |
| 6697 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 6698 | + if (!injectedStyles) { | |
| 6699 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 6700 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 6701 | + } | |
| 6702 | + if (injectedStyles.has(hash)) { | |
| 6703 | + return; | |
| 6704 | + } | |
| 6705 | + if (documentContainsStyleHash13(targetDocument, hash)) { | |
| 6706 | + injectedStyles.add(hash); | |
| 6707 | + return; | |
| 6708 | + } | |
| 6709 | + const style = targetDocument.createElement("style"); | |
| 6710 | + style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); | |
| 6711 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 6712 | + targetDocument.head.appendChild(style); | |
| 6713 | + injectedStyles.add(hash); | |
| 6714 | + } | |
| 6715 | + function registerDocument13(targetDocument) { | |
| 6716 | + const runtime = getRuntime13(); | |
| 6717 | + runtime.documents.set( | |
| 6718 | + targetDocument, | |
| 6719 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 6720 | + ); | |
| 6721 | + for (const [hash, css] of runtime.styles) { | |
| 6722 | + injectStyle13(targetDocument, hash, css); | |
| 6723 | + } | |
| 6724 | + return () => { | |
| 6725 | + const count = runtime.documents.get(targetDocument); | |
| 6726 | + if (count === void 0) { | |
| 6727 | + return; | |
| 6728 | + } | |
| 6729 | + if (count <= 1) { | |
| 6730 | + runtime.documents.delete(targetDocument); | |
| 6731 | + return; | |
| 6732 | + } | |
| 6733 | + runtime.documents.set(targetDocument, count - 1); | |
| 6734 | + }; | |
| 6735 | + } | |
| 6736 | + function registerStyle13(hash, css) { | |
| 6737 | + const runtime = getRuntime13(); | |
| 6738 | + runtime.styles.set(hash, css); | |
| 6739 | + for (const targetDocument of runtime.documents.keys()) { | |
| 6740 | + injectStyle13(targetDocument, hash, css); | |
| 6741 | + } | |
| 6742 | + } | |
| 6743 | + if (typeof process === "undefined" || true) { | |
| 6744 | + registerStyle13("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); | |
| 6745 | + } | |
| 6746 | + var field_default4 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; | |
| 6747 | + var VisualLabel = (0, import_element18.forwardRef)( | |
| 6748 | + function VisualLabel2({ className, render, variant, ...restProps }, ref) { | |
| 6749 | + return useRender({ | |
| 6750 | + defaultTagName: "span", | |
| 6751 | + render, | |
| 6752 | + ref, | |
| 6753 | + props: mergeProps(restProps, { | |
| 6754 | + className: clsx_default( | |
| 6755 | + field_default4.label, | |
| 6756 | + variant && field_default4[`is-${variant}`], | |
| 6757 | + className | |
| 6758 | + ) | |
| 6759 | + }) | |
| 6760 | + }); | |
| 6761 | + } | |
| 6762 | + ); | |
| 6763 | + VisualLabel.displayName = "Field.VisualLabel"; | |
| 6764 | + | |
| 6765 | + // packages/ui/build-module/form/input-control/input-control.mjs | |
| 6766 | + var import_element19 = __toESM(require_element(), 1); | |
| 6767 | + var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); | |
| 6768 | + var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; | |
| 6769 | + function getRuntime14() { | |
| 6770 | + const globalScope = globalThis; | |
| 6771 | + if (globalScope.__wpStyleRuntime) { | |
| 6772 | + return globalScope.__wpStyleRuntime; | |
| 6773 | + } | |
| 6774 | + globalScope.__wpStyleRuntime = { | |
| 6775 | + documents: /* @__PURE__ */ new Map(), | |
| 6776 | + styles: /* @__PURE__ */ new Map(), | |
| 6777 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 6778 | + }; | |
| 6779 | + if (typeof document !== "undefined") { | |
| 6780 | + registerDocument14(document); | |
| 6781 | + } | |
| 6782 | + return globalScope.__wpStyleRuntime; | |
| 6783 | + } | |
| 6784 | + function documentContainsStyleHash14(targetDocument, hash) { | |
| 6785 | + if (!targetDocument.head) { | |
| 6786 | + return false; | |
| 6787 | + } | |
| 6788 | + for (const style of targetDocument.head.querySelectorAll( | |
| 6789 | + `style[${STYLE_HASH_ATTRIBUTE14}]` | |
| 6790 | + )) { | |
| 6791 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { | |
| 6792 | + return true; | |
| 6793 | + } | |
| 6794 | + } | |
| 6795 | + return false; | |
| 6796 | + } | |
| 6797 | + function injectStyle14(targetDocument, hash, css) { | |
| 6798 | + if (!targetDocument.head) { | |
| 6799 | + return; | |
| 6800 | + } | |
| 6801 | + const runtime = getRuntime14(); | |
| 6802 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 6803 | + if (!injectedStyles) { | |
| 6804 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 6805 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 6806 | + } | |
| 6807 | + if (injectedStyles.has(hash)) { | |
| 6808 | + return; | |
| 6809 | + } | |
| 6810 | + if (documentContainsStyleHash14(targetDocument, hash)) { | |
| 6811 | + injectedStyles.add(hash); | |
| 6812 | + return; | |
| 6813 | + } | |
| 6814 | + const style = targetDocument.createElement("style"); | |
| 6815 | + style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); | |
| 6816 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 6817 | + targetDocument.head.appendChild(style); | |
| 6818 | + injectedStyles.add(hash); | |
| 6819 | + } | |
| 6820 | + function registerDocument14(targetDocument) { | |
| 6821 | + const runtime = getRuntime14(); | |
| 6822 | + runtime.documents.set( | |
| 6823 | + targetDocument, | |
| 6824 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 6825 | + ); | |
| 6826 | + for (const [hash, css] of runtime.styles) { | |
| 6827 | + injectStyle14(targetDocument, hash, css); | |
| 6828 | + } | |
| 6829 | + return () => { | |
| 6830 | + const count = runtime.documents.get(targetDocument); | |
| 6831 | + if (count === void 0) { | |
| 6832 | + return; | |
| 6833 | + } | |
| 6834 | + if (count <= 1) { | |
| 6835 | + runtime.documents.delete(targetDocument); | |
| 6836 | + return; | |
| 6837 | + } | |
| 6838 | + runtime.documents.set(targetDocument, count - 1); | |
| 6839 | + }; | |
| 6840 | + } | |
| 6841 | + function registerStyle14(hash, css) { | |
| 6842 | + const runtime = getRuntime14(); | |
| 6843 | + runtime.styles.set(hash, css); | |
| 6844 | + for (const targetDocument of runtime.documents.keys()) { | |
| 6845 | + injectStyle14(targetDocument, hash, css); | |
| 6846 | + } | |
| 6847 | + } | |
| 6848 | + if (typeof process === "undefined" || true) { | |
| 6849 | + registerStyle14("0c752c3d08", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.a9211a7e6af24bed__root input[type=date]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=datetime-local]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=time]:not([data-filled]):not(:focus){--_gcd-input-color:transparent;--_gcd-input-color-disabled:transparent;color:transparent;&:disabled::-webkit-datetime-edit-text{color:transparent}}}}}"); | |
| 6850 | + } | |
| 6851 | + var style_default9 = { "root": "a9211a7e6af24bed__root" }; | |
| 6852 | + var InputControl = (0, import_element19.forwardRef)( | |
| 6853 | + function InputControl2({ | |
| 6854 | + className, | |
| 6855 | + label, | |
| 6856 | + description, | |
| 6857 | + details, | |
| 6858 | + hideLabelFromVision, | |
| 6859 | + ...restProps | |
| 6860 | + }, ref) { | |
| 6861 | + return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(field_exports.Root, { className: clsx_default(style_default9.root, className), children: [ | |
| 6862 | + /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }), | |
| 6863 | + /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Input3, { ref, ...restProps }), | |
| 6864 | + description && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(field_exports.Description, { children: description }), | |
| 6865 | + details && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(field_exports.Details, { children: details }) | |
| 6866 | + ] }); | |
| 6867 | + } | |
| 6868 | + ); | |
| 6869 | + | |
| 6870 | + // packages/ui/build-module/form/with-validation/validated-input-control/validated-input-control.mjs | |
| 6871 | + var import_element20 = __toESM(require_element(), 1); | |
| 6872 | + var import_compose2 = __toESM(require_compose(), 1); | |
| 6873 | + var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); | |
| 6874 | + var ValidatedInputControl = (0, import_element20.forwardRef)(function ValidatedInputControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) { | |
| 6875 | + const validityTargetRef = (0, import_element20.useRef)(null); | |
| 6876 | + const mergedRefs = (0, import_compose2.useMergeRefs)([forwardedRef, validityTargetRef]); | |
| 6877 | + return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( | |
| 6878 | + ControlWithError, | |
| 6879 | + { | |
| 6880 | + required, | |
| 6881 | + markWhenOptional, | |
| 6882 | + customValidity, | |
| 6883 | + getValidityTarget: () => validityTargetRef.current, | |
| 6884 | + children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(InputControl, { ref: mergedRefs, ...restProps }) | |
| 6885 | + } | |
| 6886 | + ); | |
| 6887 | + }); | |
| 6888 | + | |
| 6889 | + // packages/ui/build-module/tabs/index.mjs | |
| 6890 | + var tabs_exports = {}; | |
| 6891 | + __export(tabs_exports, { | |
| 6892 | + List: () => List, | |
| 6893 | + Panel: () => Panel, | |
| 6894 | + Root: () => Root3, | |
| 6895 | + Tab: () => Tab | |
| 6896 | + }); | |
| 6897 | + | |
| 6898 | + // packages/ui/build-module/tabs/list.mjs | |
| 6899 | + var import_element21 = __toESM(require_element(), 1); | |
| 6900 | + var import_compose3 = __toESM(require_compose(), 1); | |
| 6901 | + var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); | |
| 6902 | + var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; | |
| 6903 | + function getRuntime15() { | |
| 6904 | + const globalScope = globalThis; | |
| 6905 | + if (globalScope.__wpStyleRuntime) { | |
| 6906 | + return globalScope.__wpStyleRuntime; | |
| 6907 | + } | |
| 6908 | + globalScope.__wpStyleRuntime = { | |
| 6909 | + documents: /* @__PURE__ */ new Map(), | |
| 6910 | + styles: /* @__PURE__ */ new Map(), | |
| 6911 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 6912 | + }; | |
| 6913 | + if (typeof document !== "undefined") { | |
| 6914 | + registerDocument15(document); | |
| 6915 | + } | |
| 6916 | + return globalScope.__wpStyleRuntime; | |
| 6917 | + } | |
| 6918 | + function documentContainsStyleHash15(targetDocument, hash) { | |
| 6919 | + if (!targetDocument.head) { | |
| 6920 | + return false; | |
| 6921 | + } | |
| 6922 | + for (const style of targetDocument.head.querySelectorAll( | |
| 6923 | + `style[${STYLE_HASH_ATTRIBUTE15}]` | |
| 6924 | + )) { | |
| 6925 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { | |
| 6926 | + return true; | |
| 6927 | + } | |
| 6928 | + } | |
| 6929 | + return false; | |
| 6930 | + } | |
| 6931 | + function injectStyle15(targetDocument, hash, css) { | |
| 6932 | + if (!targetDocument.head) { | |
| 6933 | + return; | |
| 6934 | + } | |
| 6935 | + const runtime = getRuntime15(); | |
| 6936 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 6937 | + if (!injectedStyles) { | |
| 6938 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 6939 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 6940 | + } | |
| 6941 | + if (injectedStyles.has(hash)) { | |
| 6942 | + return; | |
| 6943 | + } | |
| 6944 | + if (documentContainsStyleHash15(targetDocument, hash)) { | |
| 6945 | + injectedStyles.add(hash); | |
| 6946 | + return; | |
| 6947 | + } | |
| 6948 | + const style = targetDocument.createElement("style"); | |
| 6949 | + style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); | |
| 6950 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 6951 | + targetDocument.head.appendChild(style); | |
| 6952 | + injectedStyles.add(hash); | |
| 6953 | + } | |
| 6954 | + function registerDocument15(targetDocument) { | |
| 6955 | + const runtime = getRuntime15(); | |
| 6956 | + runtime.documents.set( | |
| 6957 | + targetDocument, | |
| 6958 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 6959 | + ); | |
| 6960 | + for (const [hash, css] of runtime.styles) { | |
| 6961 | + injectStyle15(targetDocument, hash, css); | |
| 6962 | + } | |
| 6963 | + return () => { | |
| 6964 | + const count = runtime.documents.get(targetDocument); | |
| 6965 | + if (count === void 0) { | |
| 6966 | + return; | |
| 6967 | + } | |
| 6968 | + if (count <= 1) { | |
| 6969 | + runtime.documents.delete(targetDocument); | |
| 6970 | + return; | |
| 6971 | + } | |
| 6972 | + runtime.documents.set(targetDocument, count - 1); | |
| 6973 | + }; | |
| 6974 | + } | |
| 6975 | + function registerStyle15(hash, css) { | |
| 6976 | + const runtime = getRuntime15(); | |
| 6977 | + runtime.styles.set(hash, css); | |
| 6978 | + for (const targetDocument of runtime.documents.keys()) { | |
| 6979 | + injectStyle15(targetDocument, hash, css); | |
| 6980 | + } | |
| 6981 | + } | |
| 6982 | + if (typeof process === "undefined" || true) { | |
| 6983 | + registerStyle15("54ae3f4680", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}'); | |
| 6984 | + } | |
| 6985 | + var style_default10 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" }; | |
| 6986 | + var SCROLL_EPSILON = 1; | |
| 6987 | + var List = (0, import_element21.forwardRef)( | |
| 6988 | + function TabList({ | |
| 6989 | + children, | |
| 6990 | + variant = "default", | |
| 6991 | + className, | |
| 6992 | + activateOnFocus, | |
| 6993 | + ...otherProps | |
| 6994 | + }, forwardedRef) { | |
| 6995 | + const [listEl, setListEl] = (0, import_element21.useState)(null); | |
| 6996 | + const [overflow, setOverflow] = (0, import_element21.useState)({ | |
| 6997 | + first: false, | |
| 6998 | + last: false, | |
| 6999 | + isScrolling: false | |
| 7000 | + }); | |
| 7001 | + (0, import_element21.useEffect)(() => { | |
| 7002 | + if (!listEl) { | |
| 7003 | + return; | |
| 7004 | + } | |
| 7005 | + const measureOverflow = () => { | |
| 7006 | + const { scrollWidth, clientWidth, scrollLeft } = listEl; | |
| 7007 | + const maxScroll = Math.max(scrollWidth - clientWidth, 0); | |
| 7008 | + const direction = listEl.dir || (typeof window !== "undefined" ? window.getComputedStyle(listEl).direction : "ltr"); | |
| 7009 | + const scrollFromStart = direction === "rtl" && scrollLeft < 0 ? ( | |
| 7010 | + // In RTL layouts, scrollLeft is typically 0 at the visual "start" | |
| 7011 | + // (right edge) and becomes negative toward the "end" (left edge). | |
| 7012 | + // Normalize value for correct first/last detection logic. | |
| 7013 | + -scrollLeft | |
| 7014 | + ) : scrollLeft; | |
| 7015 | + const next = { | |
| 7016 | + first: scrollFromStart > SCROLL_EPSILON, | |
| 7017 | + last: scrollFromStart < maxScroll - SCROLL_EPSILON, | |
| 7018 | + isScrolling: scrollWidth > clientWidth | |
| 7019 | + }; | |
| 7020 | + setOverflow( | |
| 7021 | + (prev) => prev.first === next.first && prev.last === next.last && prev.isScrolling === next.isScrolling ? prev : next | |
| 7022 | + ); | |
| 7023 | + }; | |
| 7024 | + const resizeObserver = new ResizeObserver(measureOverflow); | |
| 7025 | + const observeTabs = () => { | |
| 7026 | + resizeObserver.disconnect(); | |
| 7027 | + resizeObserver.observe(listEl); | |
| 7028 | + listEl.querySelectorAll('[role="tab"]').forEach((tab) => resizeObserver.observe(tab)); | |
| 7029 | + }; | |
| 7030 | + const mutationObserver = new MutationObserver(observeTabs); | |
| 7031 | + mutationObserver.observe(listEl, { | |
| 7032 | + childList: true, | |
| 7033 | + subtree: true | |
| 7034 | + }); | |
| 7035 | + let scrollTick = false; | |
| 7036 | + const throttleMeasureOverflowOnScroll = () => { | |
| 7037 | + if (!scrollTick) { | |
| 7038 | + requestAnimationFrame(() => { | |
| 7039 | + measureOverflow(); | |
| 7040 | + scrollTick = false; | |
| 7041 | + }); | |
| 7042 | + scrollTick = true; | |
| 7043 | + } | |
| 7044 | + }; | |
| 7045 | + listEl.addEventListener( | |
| 7046 | + "scroll", | |
| 7047 | + throttleMeasureOverflowOnScroll, | |
| 7048 | + { passive: true } | |
| 7049 | + ); | |
| 7050 | + observeTabs(); | |
| 7051 | + measureOverflow(); | |
| 7052 | + return () => { | |
| 7053 | + listEl.removeEventListener( | |
| 7054 | + "scroll", | |
| 7055 | + throttleMeasureOverflowOnScroll | |
| 7056 | + ); | |
| 7057 | + resizeObserver.disconnect(); | |
| 7058 | + mutationObserver.disconnect(); | |
| 7059 | + }; | |
| 7060 | + }, [listEl]); | |
| 7061 | + const mergedListRef = (0, import_compose3.useMergeRefs)([ | |
| 7062 | + forwardedRef, | |
| 7063 | + (el) => setListEl(el) | |
| 7064 | + ]); | |
| 7065 | + return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)( | |
| 7066 | + index_parts_exports2.List, | |
| 7067 | + { | |
| 7068 | + ref: mergedListRef, | |
| 7069 | + activateOnFocus, | |
| 7070 | + "data-select-on-move": activateOnFocus ? "true" : "false", | |
| 7071 | + className: clsx_default( | |
| 7072 | + style_default10.tablist, | |
| 7073 | + overflow.first && style_default10["is-overflowing-first"], | |
| 7074 | + overflow.last && style_default10["is-overflowing-last"], | |
| 7075 | + style_default10[`is-${variant}-variant`], | |
| 7076 | + className | |
| 7077 | + ), | |
| 7078 | + ...otherProps, | |
| 7079 | + tabIndex: otherProps.tabIndex ?? (overflow.isScrolling ? -1 : void 0), | |
| 7080 | + children: [ | |
| 7081 | + children, | |
| 7082 | + /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(index_parts_exports2.Indicator, { className: style_default10.indicator }) | |
| 7083 | + ] | |
| 7084 | + } | |
| 7085 | + ); | |
| 7086 | + } | |
| 7087 | + ); | |
| 7088 | + | |
| 7089 | + // packages/ui/build-module/tabs/panel.mjs | |
| 7090 | + var import_element23 = __toESM(require_element(), 1); | |
| 7091 | + | |
| 7092 | + // packages/ui/build-module/tabs/context.mjs | |
| 7093 | + var import_element22 = __toESM(require_element(), 1); | |
| 7094 | + var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); | |
| 7095 | + var VALIDATION_ENABLED = true; | |
| 7096 | + var TabsValidationContext = VALIDATION_ENABLED ? (0, import_element22.createContext)(null) : null; | |
| 7097 | + function useRegisterTabDev() { | |
| 7098 | + const context = (0, import_element22.useContext)(TabsValidationContext); | |
| 7099 | + (0, import_element22.useEffect)(() => { | |
| 7100 | + if (context) { | |
| 7101 | + return context.registerTab(); | |
| 7102 | + } | |
| 7103 | + return void 0; | |
| 7104 | + }, [context]); | |
| 7105 | + } | |
| 7106 | + function useRegisterTabProd() { | |
| 7107 | + } | |
| 7108 | + var useRegisterTab = VALIDATION_ENABLED ? useRegisterTabDev : useRegisterTabProd; | |
| 7109 | + function useRegisterPanelDev() { | |
| 7110 | + const context = (0, import_element22.useContext)(TabsValidationContext); | |
| 7111 | + (0, import_element22.useEffect)(() => { | |
| 7112 | + if (context) { | |
| 7113 | + return context.registerPanel(); | |
| 7114 | + } | |
| 7115 | + return void 0; | |
| 7116 | + }, [context]); | |
| 7117 | + } | |
| 7118 | + function useRegisterPanelProd() { | |
| 7119 | + } | |
| 7120 | + var useRegisterPanel = VALIDATION_ENABLED ? useRegisterPanelDev : useRegisterPanelProd; | |
| 7121 | + function TabsValidationProviderDev({ | |
| 7122 | + children | |
| 7123 | + }) { | |
| 7124 | + const tabCountRef = (0, import_element22.useRef)(0); | |
| 7125 | + const panelCountRef = (0, import_element22.useRef)(0); | |
| 7126 | + const scheduleValidation = useScheduleValidation(() => { | |
| 7127 | + const tabCount = tabCountRef.current; | |
| 7128 | + const panelCount = panelCountRef.current; | |
| 7129 | + if (tabCount !== panelCount) { | |
| 7130 | + throw new Error( | |
| 7131 | + `Tabs: Tab/Panel count mismatch (${tabCount} Tabs, ${panelCount} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.` | |
| 7132 | + ); | |
| 7133 | + } | |
| 7134 | + }); | |
| 7135 | + const registerTab = (0, import_element22.useCallback)(() => { | |
| 7136 | + tabCountRef.current += 1; | |
| 7137 | + scheduleValidation(); | |
| 7138 | + return () => { | |
| 7139 | + tabCountRef.current -= 1; | |
| 7140 | + scheduleValidation(); | |
| 7141 | + }; | |
| 7142 | + }, [scheduleValidation]); | |
| 7143 | + const registerPanel = (0, import_element22.useCallback)(() => { | |
| 7144 | + panelCountRef.current += 1; | |
| 7145 | + scheduleValidation(); | |
| 7146 | + return () => { | |
| 7147 | + panelCountRef.current -= 1; | |
| 7148 | + scheduleValidation(); | |
| 7149 | + }; | |
| 7150 | + }, [scheduleValidation]); | |
| 7151 | + const contextValue = (0, import_element22.useMemo)( | |
| 7152 | + () => ({ | |
| 7153 | + registerTab, | |
| 7154 | + registerPanel | |
| 7155 | + }), | |
| 7156 | + [registerTab, registerPanel] | |
| 7157 | + ); | |
| 7158 | + return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TabsValidationContext.Provider, { value: contextValue, children }); | |
| 7159 | + } | |
| 7160 | + function TabsValidationProviderProd({ | |
| 7161 | + children | |
| 7162 | + }) { | |
| 7163 | + return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children }); | |
| 7164 | + } | |
| 7165 | + var TabsValidationProvider = VALIDATION_ENABLED ? TabsValidationProviderDev : TabsValidationProviderProd; | |
| 7166 | + | |
| 7167 | + // packages/ui/build-module/tabs/panel.mjs | |
| 7168 | + var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); | |
| 7169 | + var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; | |
| 7170 | + function getRuntime16() { | |
| 7171 | + const globalScope = globalThis; | |
| 7172 | + if (globalScope.__wpStyleRuntime) { | |
| 7173 | + return globalScope.__wpStyleRuntime; | |
| 7174 | + } | |
| 7175 | + globalScope.__wpStyleRuntime = { | |
| 7176 | + documents: /* @__PURE__ */ new Map(), | |
| 7177 | + styles: /* @__PURE__ */ new Map(), | |
| 7178 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 7179 | + }; | |
| 7180 | + if (typeof document !== "undefined") { | |
| 7181 | + registerDocument16(document); | |
| 7182 | + } | |
| 7183 | + return globalScope.__wpStyleRuntime; | |
| 7184 | + } | |
| 7185 | + function documentContainsStyleHash16(targetDocument, hash) { | |
| 7186 | + if (!targetDocument.head) { | |
| 7187 | + return false; | |
| 7188 | + } | |
| 7189 | + for (const style of targetDocument.head.querySelectorAll( | |
| 7190 | + `style[${STYLE_HASH_ATTRIBUTE16}]` | |
| 7191 | + )) { | |
| 7192 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { | |
| 7193 | + return true; | |
| 7194 | + } | |
| 7195 | + } | |
| 7196 | + return false; | |
| 7197 | + } | |
| 7198 | + function injectStyle16(targetDocument, hash, css) { | |
| 7199 | + if (!targetDocument.head) { | |
| 7200 | + return; | |
| 7201 | + } | |
| 7202 | + const runtime = getRuntime16(); | |
| 7203 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 7204 | + if (!injectedStyles) { | |
| 7205 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 7206 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 7207 | + } | |
| 7208 | + if (injectedStyles.has(hash)) { | |
| 7209 | + return; | |
| 7210 | + } | |
| 7211 | + if (documentContainsStyleHash16(targetDocument, hash)) { | |
| 7212 | + injectedStyles.add(hash); | |
| 7213 | + return; | |
| 7214 | + } | |
| 7215 | + const style = targetDocument.createElement("style"); | |
| 7216 | + style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); | |
| 7217 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 7218 | + targetDocument.head.appendChild(style); | |
| 7219 | + injectedStyles.add(hash); | |
| 7220 | + } | |
| 7221 | + function registerDocument16(targetDocument) { | |
| 7222 | + const runtime = getRuntime16(); | |
| 7223 | + runtime.documents.set( | |
| 7224 | + targetDocument, | |
| 7225 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 7226 | + ); | |
| 7227 | + for (const [hash, css] of runtime.styles) { | |
| 7228 | + injectStyle16(targetDocument, hash, css); | |
| 7229 | + } | |
| 7230 | + return () => { | |
| 7231 | + const count = runtime.documents.get(targetDocument); | |
| 7232 | + if (count === void 0) { | |
| 7233 | + return; | |
| 7234 | + } | |
| 7235 | + if (count <= 1) { | |
| 7236 | + runtime.documents.delete(targetDocument); | |
| 7237 | + return; | |
| 7238 | + } | |
| 7239 | + runtime.documents.set(targetDocument, count - 1); | |
| 7240 | + }; | |
| 7241 | + } | |
| 7242 | + function registerStyle16(hash, css) { | |
| 7243 | + const runtime = getRuntime16(); | |
| 7244 | + runtime.styles.set(hash, css); | |
| 7245 | + for (const targetDocument of runtime.documents.keys()) { | |
| 7246 | + injectStyle16(targetDocument, hash, css); | |
| 7247 | + } | |
| 7248 | + } | |
| 7249 | + if (typeof process === "undefined" || true) { | |
| 7250 | + registerStyle16("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)}"); | |
| 7251 | + } | |
| 7252 | + var global_css_defense_default6 = { "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" }; | |
| 7253 | + if (typeof process === "undefined" || true) { | |
| 7254 | + registerStyle16("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))}}}"); | |
| 7255 | + } | |
| 7256 | + var focus_module_default3 = { "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" }; | |
| 7257 | + var Panel = (0, import_element23.forwardRef)( | |
| 7258 | + function TabPanel({ className, ...otherProps }, forwardedRef) { | |
| 7259 | + useRegisterPanel(); | |
| 7260 | + return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( | |
| 7261 | + index_parts_exports2.Panel, | |
| 7262 | + { | |
| 7263 | + ref: forwardedRef, | |
| 7264 | + className: clsx_default( | |
| 7265 | + global_css_defense_default6.div, | |
| 7266 | + focus_module_default3["outset-ring--focus-visible"], | |
| 7267 | + className | |
| 7268 | + ), | |
| 7269 | + ...otherProps | |
| 7270 | + } | |
| 7271 | + ); | |
| 7272 | + } | |
| 7273 | + ); | |
| 7274 | + | |
| 7275 | + // packages/ui/build-module/tabs/root.mjs | |
| 7276 | + var import_element24 = __toESM(require_element(), 1); | |
| 7277 | + var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); | |
| 7278 | + var Root3 = (0, import_element24.forwardRef)( | |
| 7279 | + function TabsRoot3({ ...otherProps }, forwardedRef) { | |
| 7280 | + return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TabsValidationProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(index_parts_exports2.Root, { ref: forwardedRef, ...otherProps }) }) }); | |
| 7281 | + } | |
| 7282 | + ); | |
| 7283 | + | |
| 7284 | + // packages/ui/build-module/tabs/tab.mjs | |
| 7285 | + var import_element25 = __toESM(require_element(), 1); | |
| 7286 | + var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); | |
| 7287 | + var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; | |
| 7288 | + function getRuntime17() { | |
| 7289 | + const globalScope = globalThis; | |
| 7290 | + if (globalScope.__wpStyleRuntime) { | |
| 7291 | + return globalScope.__wpStyleRuntime; | |
| 7292 | + } | |
| 7293 | + globalScope.__wpStyleRuntime = { | |
| 7294 | + documents: /* @__PURE__ */ new Map(), | |
| 7295 | + styles: /* @__PURE__ */ new Map(), | |
| 7296 | + injectedStyles: /* @__PURE__ */ new WeakMap() | |
| 7297 | + }; | |
| 7298 | + if (typeof document !== "undefined") { | |
| 7299 | + registerDocument17(document); | |
| 7300 | + } | |
| 7301 | + return globalScope.__wpStyleRuntime; | |
| 7302 | + } | |
| 7303 | + function documentContainsStyleHash17(targetDocument, hash) { | |
| 7304 | + if (!targetDocument.head) { | |
| 7305 | + return false; | |
| 7306 | + } | |
| 7307 | + for (const style of targetDocument.head.querySelectorAll( | |
| 7308 | + `style[${STYLE_HASH_ATTRIBUTE17}]` | |
| 7309 | + )) { | |
| 7310 | + if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { | |
| 7311 | + return true; | |
| 7312 | + } | |
| 7313 | + } | |
| 7314 | + return false; | |
| 7315 | + } | |
| 7316 | + function injectStyle17(targetDocument, hash, css) { | |
| 7317 | + if (!targetDocument.head) { | |
| 7318 | + return; | |
| 7319 | + } | |
| 7320 | + const runtime = getRuntime17(); | |
| 7321 | + let injectedStyles = runtime.injectedStyles.get(targetDocument); | |
| 7322 | + if (!injectedStyles) { | |
| 7323 | + injectedStyles = /* @__PURE__ */ new Set(); | |
| 7324 | + runtime.injectedStyles.set(targetDocument, injectedStyles); | |
| 7325 | + } | |
| 7326 | + if (injectedStyles.has(hash)) { | |
| 7327 | + return; | |
| 7328 | + } | |
| 7329 | + if (documentContainsStyleHash17(targetDocument, hash)) { | |
| 7330 | + injectedStyles.add(hash); | |
| 7331 | + return; | |
| 7332 | + } | |
| 7333 | + const style = targetDocument.createElement("style"); | |
| 7334 | + style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); | |
| 7335 | + style.appendChild(targetDocument.createTextNode(css)); | |
| 7336 | + targetDocument.head.appendChild(style); | |
| 7337 | + injectedStyles.add(hash); | |
| 7338 | + } | |
| 7339 | + function registerDocument17(targetDocument) { | |
| 7340 | + const runtime = getRuntime17(); | |
| 7341 | + runtime.documents.set( | |
| 7342 | + targetDocument, | |
| 7343 | + (runtime.documents.get(targetDocument) ?? 0) + 1 | |
| 7344 | + ); | |
| 7345 | + for (const [hash, css] of runtime.styles) { | |
| 7346 | + injectStyle17(targetDocument, hash, css); | |
| 7347 | + } | |
| 7348 | + return () => { | |
| 7349 | + const count = runtime.documents.get(targetDocument); | |
| 7350 | + if (count === void 0) { | |
| 7351 | + return; | |
| 7352 | + } | |
| 7353 | + if (count <= 1) { | |
| 7354 | + runtime.documents.delete(targetDocument); | |
| 7355 | + return; | |
| 7356 | + } | |
| 7357 | + runtime.documents.set(targetDocument, count - 1); | |
| 7358 | + }; | |
| 7359 | + } | |
| 7360 | + function registerStyle17(hash, css) { | |
| 7361 | + const runtime = getRuntime17(); | |
| 7362 | + runtime.styles.set(hash, css); | |
| 7363 | + for (const targetDocument of runtime.documents.keys()) { | |
| 7364 | + injectStyle17(targetDocument, hash, css); | |
| 7365 | + } | |
| 7366 | + } | |
| 7367 | + if (typeof process === "undefined" || true) { | |
| 7368 | + registerStyle17("54ae3f4680", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7313adbc8a112e90__tablist{--direction-start:left;--direction-end:right;align-items:stretch;display:flex;overflow-inline:auto;overscroll-behavior-inline:none;position:relative;&:dir(rtl){--direction-start:right;--direction-end:left}&[data-orientation=horizontal]{--fade-width:4rem;--fade-gradient-base:transparent 0%,#000 var(--fade-width);--fade-gradient-composed:var(--fade-gradient-base),#000 60%,transparent 50%;width:fit-content;&._9f2ac729c68a735a__is-overflowing-first{mask-image:linear-gradient(to var(--direction-end),var(--fade-gradient-base))}&._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to var(--direction-start),var(--fade-gradient-base))}&._9f2ac729c68a735a__is-overflowing-first._81c799c1f3cdd261__is-overflowing-last{mask-image:linear-gradient(to right,var(--fade-gradient-composed)),linear-gradient(to left,var(--fade-gradient-composed))}&._59228b5227f38a99__is-minimal-variant{gap:1rem}}&[data-orientation=vertical]{flex-direction:column}}._1c37dcfaa1ad8cda__indicator{@media not (prefers-reduced-motion){transition-duration:.2s;transition-property:translate,width,height,border-radius,border-block;transition-timing-function:ease-out}outline:2px solid transparent;outline-offset:-1px;pointer-events:none;position:absolute;&[data-orientation=horizontal]{background-color:var(--wpds-color-stroke-interactive-neutral-strong,#6e6e6e);bottom:0;height:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px));left:0;translate:var(--active-tab-left) 0;width:var(--active-tab-width);z-index:1}&[data-orientation=vertical]{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-radius:var(--wpds-border-radius-sm,2px);height:var(--active-tab-height);left:50%;top:0;translate:-50% var(--active-tab-top);width:100%;z-index:0}._7313adbc8a112e90__tablist[data-select-on-move=true]:has(:focus-visible)\n &[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:transparent;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:var(--wpds-dimension-size-lg,40px);padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]\n [role=tab]:is([aria-selected=true])\n &{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}}'); | |
| 7369 | + } | |
| 7370 | + var style_default11 = { "tablist": "_7313adbc8a112e90__tablist", "is-overflowing-first": "_9f2ac729c68a735a__is-overflowing-first", "is-overflowing-last": "_81c799c1f3cdd261__is-overflowing-last", "is-minimal-variant": "_59228b5227f38a99__is-minimal-variant", "indicator": "_1c37dcfaa1ad8cda__indicator", "tab": "a5fd8814f195aa5e__tab", "tab-children": "_5dfc77e6edd345d4__tab-children", "tab-chevron": "_4a20e969d15e5ac1__tab-chevron" }; | |
| 7371 | + var Tab = (0, import_element25.forwardRef)(function Tab2({ className, children, ...otherProps }, forwardedRef) { | |
| 7372 | + useRegisterTab(); | |
| 7373 | + return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)( | |
| 7374 | + index_parts_exports2.Tab, | |
| 7375 | + { | |
| 7376 | + ref: forwardedRef, | |
| 7377 | + className: clsx_default(style_default11.tab, className), | |
| 7378 | + ...otherProps, | |
| 7379 | + children: [ | |
| 7380 | + /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: style_default11["tab-children"], children }), | |
| 7381 | + /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Icon, { icon: chevron_right_default, className: style_default11["tab-chevron"] }) | |
| 7382 | + ] | |
| 7383 | + } | |
| 7384 | + ); | |
| 7385 | + }); | |
| 7386 | + | |
| 7387 | + // packages/format-library/build-module/image/index.mjs | |
| 7388 | + var import_i18n7 = __toESM(require_i18n(), 1); | |
| 7389 | + var import_element26 = __toESM(require_element(), 1); | |
| 7390 | + var import_rich_text3 = __toESM(require_rich_text(), 1); | |
| 7391 | + var import_block_editor3 = __toESM(require_block_editor(), 1); | |
| 7392 | + var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); | |
| 7393 | + var ALLOWED_MEDIA_TYPES = ["image"]; | |
| 7394 | + var name3 = "core/image"; | |
| 7395 | + var title3 = (0, import_i18n7.__)("Inline image"); | |
| 7396 | + function getCurrentImageId(activeObjectAttributes) { | |
| 7397 | + if (!activeObjectAttributes?.className) { | |
| 7398 | + return void 0; | |
| 7399 | + } | |
| 7400 | + const [, id] = activeObjectAttributes.className.match(/wp-image-(\d+)/) ?? []; | |
| 7401 | + return id ? parseInt(id, 10) : void 0; | |
| 7402 | + } | |
| 7403 | + var image = { | |
| 7404 | + name: name3, | |
| 7405 | + title: title3, | |
| 7406 | + keywords: [(0, import_i18n7.__)("photo"), (0, import_i18n7.__)("media")], | |
| 7407 | + object: true, | |
| 7408 | + tagName: "img", | |
| 7409 | + className: null, | |
| 7410 | + attributes: { | |
| 7411 | + className: "class", | |
| 7412 | + style: "style", | |
| 7413 | + url: "src", | |
| 7414 | + alt: "alt" | |
| 7415 | + }, | |
| 7416 | + edit: Edit | |
| 7417 | + }; | |
| 7418 | + function InlineUI({ | |
| 7419 | + value, | |
| 7420 | + onChange, | |
| 7421 | + activeObjectAttributes, | |
| 7422 | + contentRef | |
| 7423 | + }) { | |
| 7424 | + const style = activeObjectAttributes?.style; | |
| 7425 | + const alt = activeObjectAttributes?.alt; | |
| 7426 | + const width = style?.replace(/\D/g, ""); | |
| 7427 | + const [editedWidth, setEditedWidth] = (0, import_element26.useState)(width); | |
| 7428 | + const [editedAlt, setEditedAlt] = (0, import_element26.useState)(alt); | |
| 7429 | + const hasChanged = editedWidth !== width || editedAlt !== alt; | |
| 7430 | + const popoverAnchor = (0, import_rich_text3.useAnchor)({ | |
| 7431 | + // eslint-disable-next-line react-hooks/refs | |
| 7432 | + editableContentElement: contentRef.current, | |
| 7433 | + settings: image | |
| 7434 | + }); | |
| 7435 | + return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7436 | + import_components.Popover, | |
| 7437 | + { | |
| 7438 | + focusOnMount: false, | |
| 7439 | + anchor: popoverAnchor, | |
| 7440 | + className: "block-editor-format-toolbar__image-popover", | |
| 7441 | + children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7442 | + "form", | |
| 7443 | + { | |
| 7444 | + className: "block-editor-format-toolbar__image-container-content", | |
| 7445 | + onSubmit: (event) => { | |
| 7446 | + const newReplacements = value.replacements.slice(); | |
| 7447 | + newReplacements[value.start] = { | |
| 7448 | + type: name3, | |
| 7449 | + attributes: { | |
| 7450 | + ...activeObjectAttributes, | |
| 7451 | + style: editedWidth ? `width: ${editedWidth}px;` : "", | |
| 7452 | + alt: editedAlt ?? "" | |
| 7453 | + } | |
| 7454 | + }; | |
| 7455 | + onChange({ | |
| 7456 | + ...value, | |
| 7457 | + replacements: newReplacements | |
| 7458 | + }); | |
| 7459 | + event.preventDefault(); | |
| 7460 | + }, | |
| 7461 | + children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Stack, { direction: "column", gap: "lg", children: [ | |
| 7462 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7463 | + import_components.__experimentalNumberControl, | |
| 7464 | + { | |
| 7465 | + label: (0, import_i18n7.__)("Width"), | |
| 7466 | + value: editedWidth, | |
| 7467 | + min: 1, | |
| 7468 | + onChange: (newWidth) => { | |
| 7469 | + setEditedWidth(newWidth); | |
| 7470 | + } | |
| 7471 | + } | |
| 7472 | + ), | |
| 7473 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7474 | + import_components.TextareaControl, | |
| 7475 | + { | |
| 7476 | + label: (0, import_i18n7.__)("Alternative text"), | |
| 7477 | + value: editedAlt ?? "", | |
| 7478 | + onChange: (newAlt) => { | |
| 7479 | + setEditedAlt(newAlt); | |
| 7480 | + }, | |
| 7481 | + help: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [ | |
| 7482 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7483 | + Link, | |
| 7484 | + { | |
| 7485 | + openInNewTab: true, | |
| 7486 | + href: ( | |
| 7487 | + // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. | |
| 7488 | + (0, import_i18n7.__)( | |
| 7489 | + "https://www.w3.org/WAI/tutorials/images/decision-tree/" | |
| 7490 | + ) | |
| 7491 | + ), | |
| 7492 | + children: (0, import_i18n7.__)( | |
| 7493 | + "Describe the purpose of the image." | |
| 7494 | + ) | |
| 7495 | + } | |
| 7496 | + ), | |
| 7497 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("br", {}), | |
| 7498 | + (0, import_i18n7.__)("Leave empty if decorative.") | |
| 7499 | + ] }) | |
| 7500 | + } | |
| 7501 | + ), | |
| 7502 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Stack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7503 | + import_components.Button, | |
| 7504 | + { | |
| 7505 | + disabled: !hasChanged, | |
| 7506 | + accessibleWhenDisabled: true, | |
| 7507 | + variant: "primary", | |
| 7508 | + type: "submit", | |
| 7509 | + size: "compact", | |
| 7510 | + children: (0, import_i18n7.__)("Apply") | |
| 7511 | + } | |
| 7512 | + ) }) | |
| 7513 | + ] }) | |
| 7514 | + } | |
| 7515 | + ) | |
| 7516 | + } | |
| 7517 | + ); | |
| 7518 | + } | |
| 7519 | + function Edit({ | |
| 7520 | + value, | |
| 7521 | + onChange, | |
| 7522 | + onFocus, | |
| 7523 | + isObjectActive, | |
| 7524 | + activeObjectAttributes, | |
| 7525 | + contentRef | |
| 7526 | + }) { | |
| 7527 | + return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_block_editor3.MediaUploadCheck, { children: [ | |
| 7528 | + /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7529 | + import_block_editor3.MediaUpload, | |
| 7530 | + { | |
| 7531 | + allowedTypes: ALLOWED_MEDIA_TYPES, | |
| 7532 | + value: getCurrentImageId(activeObjectAttributes), | |
| 7533 | + onSelect: ({ | |
| 7534 | + id, | |
| 7535 | + url, | |
| 7536 | + alt, | |
| 7537 | + width: imgWidth | |
| 7538 | + }) => { | |
| 7539 | + onChange( | |
| 7540 | + (0, import_rich_text3.insertObject)(value, { | |
| 7541 | + type: name3, | |
| 7542 | + attributes: { | |
| 7543 | + className: `wp-image-${id}`, | |
| 7544 | + style: `width: ${Math.min( | |
| 7545 | + imgWidth, | |
| 7546 | + 150 | |
| 7547 | + )}px;`, | |
| 7548 | + url, | |
| 7549 | + alt | |
| 7550 | + } | |
| 7551 | + }) | |
| 7552 | + ); | |
| 7553 | + onFocus(); | |
| 7554 | + }, | |
| 7555 | + render: ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7556 | + import_block_editor3.RichTextToolbarButton, | |
| 7557 | + { | |
| 7558 | + icon: inline_image_default, | |
| 7559 | + title: isObjectActive ? (0, import_i18n7.__)("Replace image") : title3, | |
| 7560 | + onClick: open, | |
| 7561 | + isActive: isObjectActive | |
| 7562 | + } | |
| 7563 | + ) | |
| 7564 | + } | |
| 7565 | + ), | |
| 7566 | + isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( | |
| 7567 | + InlineUI, | |
| 7568 | + { | |
| 7569 | + value, | |
| 7570 | + onChange, | |
| 7571 | + activeObjectAttributes, | |
| 7572 | + contentRef | |
| 7573 | + } | |
| 7574 | + ) | |
| 7575 | + ] }); | |
| 7576 | + } | |
| 7577 | + | |
| 7578 | + // packages/format-library/build-module/italic/index.mjs | |
| 7579 | + var import_i18n8 = __toESM(require_i18n(), 1); | |
| 7580 | + var import_rich_text4 = __toESM(require_rich_text(), 1); | |
| 7581 | + var import_block_editor4 = __toESM(require_block_editor(), 1); | |
| 7582 | + var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); | |
| 7583 | + var name4 = "core/italic"; | |
| 7584 | + var title4 = (0, import_i18n8.__)("Italic"); | |
| 7585 | + var italic = { | |
| 7586 | + name: name4, | |
| 7587 | + title: title4, | |
| 7588 | + tagName: "em", | |
| 7589 | + className: null, | |
| 7590 | + edit({ | |
| 7591 | + isActive, | |
| 7592 | + value, | |
| 7593 | + onChange, | |
| 7594 | + onFocus, | |
| 7595 | + isVisible = true | |
| 7596 | + }) { | |
| 7597 | + function onToggle() { | |
| 7598 | + onChange((0, import_rich_text4.toggleFormat)(value, { type: name4, title: title4 })); | |
| 7599 | + } | |
| 7600 | + function onClick() { | |
| 7601 | + onChange((0, import_rich_text4.toggleFormat)(value, { type: name4, title: title4 })); | |
| 7602 | + onFocus(); | |
| 7603 | + } | |
| 7604 | + return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [ | |
| 7605 | + /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( | |
| 7606 | + import_block_editor4.RichTextShortcut, | |
| 7607 | + { | |
| 7608 | + type: "primary", | |
| 7609 | + character: "i", | |
| 7610 | + onUse: onToggle | |
| 7611 | + } | |
| 7612 | + ), | |
| 7613 | + isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( | |
| 7614 | + import_block_editor4.RichTextToolbarButton, | |
| 7615 | + { | |
| 7616 | + name: "italic", | |
| 7617 | + icon: format_italic_default, | |
| 7618 | + title: title4, | |
| 7619 | + onClick, | |
| 7620 | + isActive, | |
| 7621 | + shortcutType: "primary", | |
| 7622 | + shortcutCharacter: "i" | |
| 7623 | + } | |
| 7624 | + ), | |
| 7625 | + /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( | |
| 7626 | + import_block_editor4.__unstableRichTextInputEvent, | |
| 7627 | + { | |
| 7628 | + inputType: "formatItalic", | |
| 7629 | + onInput: onToggle | |
| 7630 | + } | |
| 7631 | + ) | |
| 7632 | + ] }); | |
| 7633 | + } | |
| 7634 | + }; | |
| 7635 | + | |
| 7636 | + // packages/format-library/build-module/link/index.mjs | |
| 7637 | + var import_i18n11 = __toESM(require_i18n(), 1); | |
| 7638 | + var import_element29 = __toESM(require_element(), 1); | |
| 7639 | + var import_rich_text6 = __toESM(require_rich_text(), 1); | |
| 7640 | + var import_url3 = __toESM(require_url(), 1); | |
| 7641 | + var import_block_editor6 = __toESM(require_block_editor(), 1); | |
| 7642 | + var import_html_entities = __toESM(require_html_entities(), 1); | |
| 7643 | + var import_a11y2 = __toESM(require_a11y(), 1); | |
| 7644 | + | |
| 7645 | + // packages/format-library/build-module/link/inline.mjs | |
| 7646 | + var import_element28 = __toESM(require_element(), 1); | |
| 7647 | + var import_i18n10 = __toESM(require_i18n(), 1); | |
| 7648 | + var import_a11y = __toESM(require_a11y(), 1); | |
| 7649 | + var import_components3 = __toESM(require_components(), 1); | |
| 7650 | + var import_url2 = __toESM(require_url(), 1); | |
| 7651 | + var import_rich_text5 = __toESM(require_rich_text(), 1); | |
| 7652 | + var import_block_editor5 = __toESM(require_block_editor(), 1); | |
| 7653 | + var import_data = __toESM(require_data(), 1); | |
| 7654 | + | |
| 7655 | + // packages/format-library/build-module/link/utils.mjs | |
| 7656 | + var import_url = __toESM(require_url(), 1); | |
| 7657 | + function isValidHref(href) { | |
| 7658 | + if (!href) { | |
| 7659 | + return false; | |
| 7660 | + } | |
| 7661 | + const trimmedHref = href.trim(); | |
| 7662 | + if (!trimmedHref) { | |
| 7663 | + return false; | |
| 7664 | + } | |
| 7665 | + if (/^\S+:/.test(trimmedHref)) { | |
| 7666 | + const protocol = (0, import_url.getProtocol)(trimmedHref); | |
| 7667 | + if (!protocol || !(0, import_url.isValidProtocol)(protocol)) { | |
| 7668 | + return false; | |
| 7669 | + } | |
| 7670 | + if (protocol.startsWith("http") && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) { | |
| 7671 | + return false; | |
| 7672 | + } | |
| 7673 | + const authority = (0, import_url.getAuthority)(trimmedHref); | |
| 7674 | + if (!authority || !(0, import_url.isValidAuthority)(authority)) { | |
| 7675 | + return false; | |
| 7676 | + } | |
| 7677 | + const path = (0, import_url.getPath)(trimmedHref); | |
| 7678 | + if (path && !(0, import_url.isValidPath)(path)) { | |
| 7679 | + return false; | |
| 7680 | + } | |
| 7681 | + const queryString = (0, import_url.getQueryString)(trimmedHref); | |
| 7682 | + if (queryString && !(0, import_url.isValidQueryString)(queryString)) { | |
| 7683 | + return false; | |
| 7684 | + } | |
| 7685 | + const fragment = (0, import_url.getFragment)(trimmedHref); | |
| 7686 | + if (fragment && !(0, import_url.isValidFragment)(fragment)) { | |
| 7687 | + return false; | |
| 7688 | + } | |
| 7689 | + } | |
| 7690 | + if (trimmedHref.startsWith("#") && !(0, import_url.isValidFragment)(trimmedHref)) { | |
| 7691 | + return false; | |
| 7692 | + } | |
| 7693 | + return true; | |
| 7694 | + } | |
| 7695 | + function createLinkFormat({ | |
| 7696 | + url, | |
| 7697 | + type, | |
| 7698 | + id, | |
| 7699 | + opensInNewWindow, | |
| 7700 | + nofollow, | |
| 7701 | + cssClasses | |
| 7702 | + }) { | |
| 7703 | + const format = { | |
| 7704 | + type: "core/link", | |
| 7705 | + attributes: { | |
| 7706 | + url | |
| 7707 | + } | |
| 7708 | + }; | |
| 7709 | + if (type) { | |
| 7710 | + format.attributes.type = type; | |
| 7711 | + } | |
| 7712 | + if (id) { | |
| 7713 | + format.attributes.id = id; | |
| 7714 | + } | |
| 7715 | + if (opensInNewWindow) { | |
| 7716 | + format.attributes.target = "_blank"; | |
| 7717 | + format.attributes.rel = format.attributes.rel ? format.attributes.rel + " noopener" : "noopener"; | |
| 7718 | + } | |
| 7719 | + if (nofollow) { | |
| 7720 | + format.attributes.rel = format.attributes.rel ? format.attributes.rel + " nofollow" : "nofollow"; | |
| 7721 | + } | |
| 7722 | + const trimmedCssClasses = cssClasses?.trim(); | |
| 7723 | + if (trimmedCssClasses?.length) { | |
| 7724 | + format.attributes.class = trimmedCssClasses; | |
| 7725 | + } | |
| 7726 | + return format; | |
| 7727 | + } | |
| 7728 | + function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) { | |
| 7729 | + const EMPTY_BOUNDARIES = { | |
| 7730 | + start: void 0, | |
| 7731 | + end: void 0 | |
| 7732 | + }; | |
| 7733 | + const { formats } = value; | |
| 7734 | + let targetFormat; | |
| 7735 | + let initialIndex; | |
| 7736 | + if (!formats?.length) { | |
| 7737 | + return EMPTY_BOUNDARIES; | |
| 7738 | + } | |
| 7739 | + const newFormats = formats.slice(); | |
| 7740 | + const formatAtStart = newFormats[startIndex]?.find( | |
| 7741 | + ({ type }) => type === format.type | |
| 7742 | + ); | |
| 7743 | + const formatAtEnd = newFormats[endIndex]?.find( | |
| 7744 | + ({ type }) => type === format.type | |
| 7745 | + ); | |
| 7746 | + const formatAtEndMinusOne = newFormats[endIndex - 1]?.find( | |
| 7747 | + ({ type }) => type === format.type | |
| 7748 | + ); | |
| 7749 | + if (!!formatAtStart) { | |
| 7750 | + targetFormat = formatAtStart; | |
| 7751 | + initialIndex = startIndex; | |
| 7752 | + } else if (!!formatAtEnd) { | |
| 7753 | + targetFormat = formatAtEnd; | |
| 7754 | + initialIndex = endIndex; | |
| 7755 | + } else if (!!formatAtEndMinusOne) { | |
| 7756 | + targetFormat = formatAtEndMinusOne; | |
| 7757 | + initialIndex = endIndex - 1; | |
| 7758 | + } else { | |
| 7759 | + return EMPTY_BOUNDARIES; | |
| 7760 | + } | |
| 7761 | + const index2 = newFormats[initialIndex].indexOf(targetFormat); | |
| 7762 | + startIndex = walkToStart(newFormats, initialIndex, targetFormat, index2); | |
| 7763 | + endIndex = walkToEnd(newFormats, initialIndex, targetFormat, index2); | |
| 7764 | + startIndex = startIndex < 0 ? 0 : startIndex; | |
| 7765 | + return { | |
| 7766 | + start: startIndex, | |
| 7767 | + end: endIndex + 1 | |
| 7768 | + }; | |
| 7769 | + } | |
| 7770 | + function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) { | |
| 7771 | + let index2 = initialIndex; | |
| 7772 | + const directions = { | |
| 7773 | + forwards: 1, | |
| 7774 | + backwards: -1 | |
| 7775 | + }; | |
| 7776 | + const directionIncrement = directions[direction] || 1; | |
| 7777 | + const inverseDirectionIncrement = directionIncrement * -1; | |
| 7778 | + while (formats[index2] && formats[index2][formatIndex] === targetFormatRef) { | |
| 7779 | + index2 = index2 + directionIncrement; | |
| 7780 | + } | |
| 7781 | + index2 = index2 + inverseDirectionIncrement; | |
| 7782 | + return index2; | |
| 7783 | + } | |
| 7784 | + var walkToStart = (...args) => walkToBoundary(...args, "backwards"); | |
| 7785 | + var walkToEnd = (...args) => walkToBoundary(...args, "forwards"); | |
| 7786 | + | |
| 1305 | 7787 | // packages/format-library/build-module/link/css-classes-setting.mjs |
| 1306 | - var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); | |
| 1307 | - var CSSClassesSettingComponent = ({ setting, value, onChange }) => { | |
| 1308 | - const hasValue = value ? value?.cssClasses?.length > 0 : false; | |
| 1309 | - const [isSettingActive, setIsSettingActive] = (0, import_element4.useState)(hasValue); | |
| 1310 | - const instanceId = (0, import_compose.useInstanceId)(CSSClassesSettingComponent); | |
| 7788 | + var import_element27 = __toESM(require_element(), 1); | |
| 7789 | + var import_compose4 = __toESM(require_compose(), 1); | |
| 7790 | + var import_i18n9 = __toESM(require_i18n(), 1); | |
| 7791 | + var import_components2 = __toESM(require_components(), 1); | |
| 7792 | + var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); | |
| 7793 | + var CSSClassesSettingComponent = ({ | |
| 7794 | + setting, | |
| 7795 | + value, | |
| 7796 | + onChange | |
| 7797 | + }) => { | |
| 7798 | + const hasValue = !!value?.cssClasses?.length; | |
| 7799 | + const [isSettingActive, setIsSettingActive] = (0, import_element27.useState)(hasValue); | |
| 7800 | + const instanceId = (0, import_compose4.useInstanceId)(CSSClassesSettingComponent); | |
| 1311 | 7801 | const controlledRegionId = `css-classes-setting-${instanceId}`; |
| 1312 | 7802 | const handleSettingChange = (newValue) => { |
| 1313 | 7803 | const sanitizedValue = typeof newValue === "string" ? newValue.replace(/,/g, " ").replace(/\s+/g, " ").trim() : newValue; |
| 1314 | 7804 | onChange({ |
| @@ -1325,12 +7815,12 @@ | ||
| 1325 | 7815 | } else { |
| 1326 | 7816 | setIsSettingActive(true); |
| 1327 | 7817 | } |
| 1328 | 7818 | }; |
| 1329 | - return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("fieldset", { children: [ | |
| 1330 | - /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("legend", {}), children: setting.title }), | |
| 1331 | - /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_components2.__experimentalVStack, { spacing: 3, children: [ | |
| 1332 | - /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 7819 | + return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("fieldset", { children: [ | |
| 7820 | + /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("legend", {}), children: setting.title }), | |
| 7821 | + /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Stack, { direction: "column", gap: "md", children: [ | |
| 7822 | + /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( | |
| 1333 | 7823 | import_components2.CheckboxControl, |
| 1334 | 7824 | { |
| 1335 | 7825 | label: setting.title, |
| 1336 | 7826 | onChange: handleCheckboxChange, |
| @@ -1338,19 +7828,18 @@ | ||
| 1338 | 7828 | "aria-expanded": isSettingActive, |
| 1339 | 7829 | "aria-controls": isSettingActive ? controlledRegionId : void 0 |
| 1340 | 7830 | } |
| 1341 | 7831 | ), |
| 1342 | - isSettingActive && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id: controlledRegionId, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( | |
| 7832 | + isSettingActive && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { id: controlledRegionId, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( | |
| 1343 | 7833 | import_components2.__experimentalInputControl, |
| 1344 | 7834 | { |
| 1345 | - label: (0, import_i18n5.__)("CSS classes"), | |
| 7835 | + label: (0, import_i18n9.__)("CSS classes"), | |
| 1346 | 7836 | value: value?.cssClasses, |
| 1347 | 7837 | onChange: handleSettingChange, |
| 1348 | - help: (0, import_i18n5.__)( | |
| 7838 | + help: (0, import_i18n9.__)( | |
| 1349 | 7839 | "Separate multiple classes with spaces." |
| 1350 | 7840 | ), |
| 1351 | - __unstableInputWidth: "100%", | |
| 1352 | - __next40pxDefaultSize: true | |
| 7841 | + __unstableInputWidth: "100%" | |
| 1353 | 7842 | } |
| 1354 | 7843 | ) }) |
| 1355 | 7844 | ] }) |
| 1356 | 7845 | ] }); |
| @@ -1357,28 +7846,26 @@ | ||
| 1357 | 7846 | }; |
| 1358 | 7847 | var css_classes_setting_default = CSSClassesSettingComponent; |
| 1359 | 7848 | |
| 1360 | 7849 | // packages/format-library/build-module/link/inline.mjs |
| 1361 | - var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); | |
| 7850 | + var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); | |
| 1362 | 7851 | var LINK_SETTINGS = [ |
| 1363 | 7852 | ...import_block_editor5.LinkControl.DEFAULT_LINK_SETTINGS, |
| 1364 | 7853 | { |
| 1365 | 7854 | id: "nofollow", |
| 1366 | - title: (0, import_i18n6.__)("Mark as nofollow") | |
| 7855 | + title: (0, import_i18n10.__)("Mark as nofollow") | |
| 1367 | 7856 | }, |
| 1368 | 7857 | { |
| 1369 | 7858 | id: "cssClasses", |
| 1370 | - title: (0, import_i18n6.__)("Additional CSS class(es)"), | |
| 1371 | - render: (setting, value, onChange) => { | |
| 1372 | - return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( | |
| 1373 | - css_classes_setting_default, | |
| 1374 | - { | |
| 1375 | - setting, | |
| 1376 | - value, | |
| 1377 | - onChange | |
| 1378 | - } | |
| 1379 | - ); | |
| 1380 | - } | |
| 7859 | + title: (0, import_i18n10.__)("Additional CSS class(es)"), | |
| 7860 | + render: (setting, value, onChange) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)( | |
| 7861 | + css_classes_setting_default, | |
| 7862 | + { | |
| 7863 | + setting, | |
| 7864 | + value, | |
| 7865 | + onChange | |
| 7866 | + } | |
| 7867 | + ) | |
| 1381 | 7868 | } |
| 1382 | 7869 | ]; |
| 1383 | 7870 | function InlineLinkUI({ |
| 1384 | 7871 | isActive, |
| @@ -1404,9 +7891,9 @@ | ||
| 1404 | 7891 | }; |
| 1405 | 7892 | }, |
| 1406 | 7893 | [] |
| 1407 | 7894 | ); |
| 1408 | - const linkValue = (0, import_element5.useMemo)( | |
| 7895 | + const linkValue = (0, import_element28.useMemo)( | |
| 1409 | 7896 | () => ({ |
| 1410 | 7897 | url: activeAttributes.url, |
| 1411 | 7898 | type: activeAttributes.type, |
| 1412 | 7899 | id: activeAttributes.id, |
| @@ -1428,9 +7915,9 @@ | ||
| 1428 | 7915 | function removeLink() { |
| 1429 | 7916 | const newValue = (0, import_rich_text5.removeFormat)(value, "core/link"); |
| 1430 | 7917 | onChange(newValue); |
| 1431 | 7918 | stopAddingLink(); |
| 1432 | - (0, import_a11y.speak)((0, import_i18n6.__)("Link removed."), "assertive"); | |
| 7919 | + (0, import_a11y.speak)((0, import_i18n10.__)("Link removed."), "assertive"); | |
| 1433 | 7920 | } |
| 1434 | 7921 | function onChangeLink(nextValue) { |
| 1435 | 7922 | const hasLink = linkValue?.url; |
| 1436 | 7923 | const isNewLink = !hasLink; |
| @@ -1437,9 +7924,9 @@ | ||
| 1437 | 7924 | nextValue = { |
| 1438 | 7925 | ...linkValue, |
| 1439 | 7926 | ...nextValue |
| 1440 | 7927 | }; |
| 1441 | - const newUrl = (0, import_url2.prependHTTPS)(nextValue.url); | |
| 7928 | + const newUrl = (0, import_url2.prependHTTPS)(nextValue?.url ?? ""); | |
| 1442 | 7929 | const linkFormat = createLinkFormat({ |
| 1443 | 7930 | url: newUrl, |
| 1444 | 7931 | type: nextValue.type, |
| 1445 | 7932 | id: nextValue.id !== void 0 && nextValue.id !== null ? String(nextValue.id) : void 0, |
| @@ -1480,13 +7967,13 @@ | ||
| 1480 | 7967 | newValue = (0, import_rich_text5.applyFormat)(newValue, linkFormat, 0, newText.length); |
| 1481 | 7968 | const boundary = getFormatBoundary(value, { |
| 1482 | 7969 | type: "core/link" |
| 1483 | 7970 | }); |
| 1484 | - const [valBefore, valAfter] = (0, import_rich_text5.split)( | |
| 1485 | - value, | |
| 1486 | - boundary.start, | |
| 1487 | - boundary.start | |
| 1488 | - ); | |
| 7971 | + const splitValue = (0, import_rich_text5.split)(value, boundary.start, boundary.start); | |
| 7972 | + if (!splitValue) { | |
| 7973 | + return; | |
| 7974 | + } | |
| 7975 | + const [valBefore, valAfter] = splitValue; | |
| 1489 | 7976 | const newValAfter = (0, import_rich_text5.replace)(valAfter, richTextText, newValue); |
| 1490 | 7977 | newValue = (0, import_rich_text5.concat)(valBefore, newValAfter); |
| 1491 | 7978 | } |
| 1492 | 7979 | onChange(newValue); |
| @@ -1494,25 +7981,24 @@ | ||
| 1494 | 7981 | stopAddingLink(); |
| 1495 | 7982 | } |
| 1496 | 7983 | if (!isValidHref(newUrl)) { |
| 1497 | 7984 | (0, import_a11y.speak)( |
| 1498 | - (0, import_i18n6.__)( | |
| 7985 | + (0, import_i18n10.__)( | |
| 1499 | 7986 | "Warning: the link has been inserted but may have errors. Please test it." |
| 1500 | 7987 | ), |
| 1501 | 7988 | "assertive" |
| 1502 | 7989 | ); |
| 1503 | 7990 | } else if (isActive) { |
| 1504 | - (0, import_a11y.speak)((0, import_i18n6.__)("Link edited."), "assertive"); | |
| 7991 | + (0, import_a11y.speak)((0, import_i18n10.__)("Link edited."), "assertive"); | |
| 1505 | 7992 | } else { |
| 1506 | - (0, import_a11y.speak)((0, import_i18n6.__)("Link inserted."), "assertive"); | |
| 7993 | + (0, import_a11y.speak)((0, import_i18n10.__)("Link inserted."), "assertive"); | |
| 1507 | 7994 | } |
| 1508 | 7995 | } |
| 7996 | + const anchorSettings = { ...link, isActive }; | |
| 1509 | 7997 | const popoverAnchor = (0, import_rich_text5.useAnchor)({ |
| 7998 | + // eslint-disable-next-line react-hooks/refs | |
| 1510 | 7999 | editableContentElement: contentRef.current, |
| 1511 | - settings: { | |
| 1512 | - ...link, | |
| 1513 | - isActive | |
| 1514 | - } | |
| 8000 | + settings: anchorSettings | |
| 1515 | 8001 | }); |
| 1516 | 8002 | async function handleCreate(pageTitle) { |
| 1517 | 8003 | const page = await createPageEntity({ |
| 1518 | 8004 | title: pageTitle, |
| @@ -1526,18 +8012,18 @@ | ||
| 1526 | 8012 | kind: "post-type" |
| 1527 | 8013 | }; |
| 1528 | 8014 | } |
| 1529 | 8015 | function createButtonText(searchTerm) { |
| 1530 | - return (0, import_element5.createInterpolateElement)( | |
| 1531 | - (0, import_i18n6.sprintf)( | |
| 8016 | + return (0, import_element28.createInterpolateElement)( | |
| 8017 | + (0, import_i18n10.sprintf)( | |
| 1532 | 8018 | /* translators: %s: search term. */ |
| 1533 | - (0, import_i18n6.__)("Create page: <mark>%s</mark>"), | |
| 8019 | + (0, import_i18n10.__)("Create page: <mark>%s</mark>"), | |
| 1534 | 8020 | searchTerm |
| 1535 | 8021 | ), |
| 1536 | - { mark: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("mark", {}) } | |
| 8022 | + { mark: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("mark", {}) } | |
| 1537 | 8023 | ); |
| 1538 | 8024 | } |
| 1539 | - return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( | |
| 8025 | + return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)( | |
| 1540 | 8026 | import_components3.Popover, |
| 1541 | 8027 | { |
| 1542 | 8028 | anchor: popoverAnchor, |
| 1543 | 8029 | animate: false, |
| @@ -1547,9 +8033,9 @@ | ||
| 1547 | 8033 | offset: 8, |
| 1548 | 8034 | shift: true, |
| 1549 | 8035 | focusOnMount, |
| 1550 | 8036 | constrainTabbing: true, |
| 1551 | - children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( | |
| 8037 | + children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)( | |
| 1552 | 8038 | import_block_editor5.LinkControl, |
| 1553 | 8039 | { |
| 1554 | 8040 | value: linkValue, |
| 1555 | 8041 | onChange: onChangeLink, |
| @@ -1580,10 +8066,10 @@ | ||
| 1580 | 8066 | if (isActive) { |
| 1581 | 8067 | const boundary = getFormatBoundary(value, { |
| 1582 | 8068 | type: "core/link" |
| 1583 | 8069 | }); |
| 1584 | - textStart = boundary.start; | |
| 1585 | - textEnd = boundary.end; | |
| 8070 | + textStart = boundary.start ?? value.start; | |
| 8071 | + textEnd = boundary.end ?? value.end; | |
| 1586 | 8072 | } |
| 1587 | 8073 | return (0, import_rich_text5.slice)(value, textStart, textEnd); |
| 1588 | 8074 | } |
| 1589 | 8075 | var inline_default = InlineLinkUI; |
| @@ -1588,11 +8074,11 @@ | ||
| 1588 | 8074 | } |
| 1589 | 8075 | var inline_default = InlineLinkUI; |
| 1590 | 8076 | |
| 1591 | 8077 | // packages/format-library/build-module/link/index.mjs |
| 1592 | - var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); | |
| 8078 | + var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); | |
| 1593 | 8079 | var name5 = "core/link"; |
| 1594 | - var title5 = (0, import_i18n7.__)("Link"); | |
| 8080 | + var title5 = (0, import_i18n11.__)("Link"); | |
| 1595 | 8081 | function Edit2({ |
| 1596 | 8082 | isActive, |
| 1597 | 8083 | activeAttributes, |
| 1598 | 8084 | value, |
| @@ -1600,22 +8086,24 @@ | ||
| 1600 | 8086 | onFocus, |
| 1601 | 8087 | contentRef, |
| 1602 | 8088 | isVisible = true |
| 1603 | 8089 | }) { |
| 1604 | - const [addingLink, setAddingLink] = (0, import_element6.useState)(false); | |
| 1605 | - const [openedBy, setOpenedBy] = (0, import_element6.useState)(null); | |
| 1606 | - (0, import_element6.useEffect)(() => { | |
| 8090 | + const [addingLink, setAddingLink] = (0, import_element29.useState)(false); | |
| 8091 | + const [openedBy, setOpenedBy] = (0, import_element29.useState)(null); | |
| 8092 | + (0, import_element29.useEffect)(() => { | |
| 1607 | 8093 | if (!isActive) { |
| 1608 | 8094 | setAddingLink(false); |
| 1609 | 8095 | } |
| 1610 | 8096 | }, [isActive]); |
| 1611 | - (0, import_element6.useLayoutEffect)(() => { | |
| 8097 | + (0, import_element29.useLayoutEffect)(() => { | |
| 1612 | 8098 | const editableContentElement = contentRef.current; |
| 1613 | 8099 | if (!editableContentElement) { |
| 1614 | 8100 | return; |
| 1615 | 8101 | } |
| 1616 | 8102 | function handleClick(event) { |
| 1617 | - const link2 = event.target.closest("[contenteditable] a"); | |
| 8103 | + const link2 = event.target.closest( | |
| 8104 | + "[contenteditable] a" | |
| 8105 | + ); | |
| 1618 | 8106 | if (!link2 || // other formats (e.g. bold) may be nested within the link. |
| 1619 | 8107 | !isActive) { |
| 1620 | 8108 | return; |
| 1621 | 8109 | } |
| @@ -1678,14 +8166,14 @@ | ||
| 1678 | 8166 | setOpenedBy(null); |
| 1679 | 8167 | } |
| 1680 | 8168 | function onRemoveFormat() { |
| 1681 | 8169 | onChange((0, import_rich_text6.removeFormat)(value, name5)); |
| 1682 | - (0, import_a11y2.speak)((0, import_i18n7.__)("Link removed."), "assertive"); | |
| 8170 | + (0, import_a11y2.speak)((0, import_i18n11.__)("Link removed."), "assertive"); | |
| 1683 | 8171 | } |
| 1684 | 8172 | const shouldAutoFocus = !(openedBy?.el?.tagName === "A" && openedBy?.action === "click"); |
| 1685 | 8173 | const hasSelection = !(0, import_rich_text6.isCollapsed)(value); |
| 1686 | - return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [ | |
| 1687 | - hasSelection && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 8174 | + return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [ | |
| 8175 | + hasSelection && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( | |
| 1688 | 8176 | import_block_editor6.RichTextShortcut, |
| 1689 | 8177 | { |
| 1690 | 8178 | type: "primary", |
| 1691 | 8179 | character: "k", |
| @@ -1691,9 +8179,9 @@ | ||
| 1691 | 8179 | character: "k", |
| 1692 | 8180 | onUse: addLink |
| 1693 | 8181 | } |
| 1694 | 8182 | ), |
| 1695 | - /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 8183 | + /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( | |
| 1696 | 8184 | import_block_editor6.RichTextShortcut, |
| 1697 | 8185 | { |
| 1698 | 8186 | type: "primaryShift", |
| 1699 | 8187 | character: "k", |
| @@ -1699,14 +8187,14 @@ | ||
| 1699 | 8187 | character: "k", |
| 1700 | 8188 | onUse: onRemoveFormat |
| 1701 | 8189 | } |
| 1702 | 8190 | ), |
| 1703 | - isVisible && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 8191 | + isVisible && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( | |
| 1704 | 8192 | import_block_editor6.RichTextToolbarButton, |
| 1705 | 8193 | { |
| 1706 | 8194 | name: "link", |
| 1707 | 8195 | icon: link_default, |
| 1708 | - title: isActive ? (0, import_i18n7.__)("Link") : title5, | |
| 8196 | + title: isActive ? (0, import_i18n11.__)("Link") : title5, | |
| 1709 | 8197 | onClick: (event) => { |
| 1710 | 8198 | addLink(event.currentTarget); |
| 1711 | 8199 | }, |
| 1712 | 8200 | isActive: isActive || addingLink, |
| @@ -1715,9 +8203,9 @@ | ||
| 1715 | 8203 | "aria-haspopup": "true", |
| 1716 | 8204 | "aria-expanded": addingLink |
| 1717 | 8205 | } |
| 1718 | 8206 | ), |
| 1719 | - isVisible && addingLink && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( | |
| 8207 | + isVisible && addingLink && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( | |
| 1720 | 8208 | inline_default, |
| 1721 | 8209 | { |
| 1722 | 8210 | stopAddingLink, |
| 1723 | 8211 | onFocusOutside, |
| @@ -1773,14 +8261,14 @@ | ||
| 1773 | 8261 | edit: Edit2 |
| 1774 | 8262 | }; |
| 1775 | 8263 | |
| 1776 | 8264 | // packages/format-library/build-module/strikethrough/index.mjs |
| 1777 | - var import_i18n8 = __toESM(require_i18n(), 1); | |
| 8265 | + var import_i18n12 = __toESM(require_i18n(), 1); | |
| 1778 | 8266 | var import_rich_text7 = __toESM(require_rich_text(), 1); |
| 1779 | 8267 | var import_block_editor7 = __toESM(require_block_editor(), 1); |
| 1780 | - var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); | |
| 8268 | + var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); | |
| 1781 | 8269 | var name6 = "core/strikethrough"; |
| 1782 | - var title6 = (0, import_i18n8.__)("Strikethrough"); | |
| 8270 | + var title6 = (0, import_i18n12.__)("Strikethrough"); | |
| 1783 | 8271 | var strikethrough = { |
| 1784 | 8272 | name: name6, |
| 1785 | 8273 | title: title6, |
| 1786 | 8274 | tagName: "s", |
| @@ -1789,10 +8277,10 @@ | ||
| 1789 | 8277 | function onClick() { |
| 1790 | 8278 | onChange((0, import_rich_text7.toggleFormat)(value, { type: name6, title: title6 })); |
| 1791 | 8279 | onFocus(); |
| 1792 | 8280 | } |
| 1793 | - return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [ | |
| 1794 | - /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( | |
| 8281 | + return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [ | |
| 8282 | + /* @__PURE__ */ (0, import_jsx_runtime60.jsx)( | |
| 1795 | 8283 | import_block_editor7.RichTextShortcut, |
| 1796 | 8284 | { |
| 1797 | 8285 | type: "access", |
| 1798 | 8286 | character: "d", |
| @@ -1798,9 +8286,9 @@ | ||
| 1798 | 8286 | character: "d", |
| 1799 | 8287 | onUse: onClick |
| 1800 | 8288 | } |
| 1801 | 8289 | ), |
| 1802 | - /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( | |
| 8290 | + /* @__PURE__ */ (0, import_jsx_runtime60.jsx)( | |
| 1803 | 8291 | import_block_editor7.RichTextToolbarButton, |
| 1804 | 8292 | { |
| 1805 | 8293 | icon: format_strikethrough_default, |
| 1806 | 8294 | title: title6, |
| @@ -1813,14 +8301,14 @@ | ||
| 1813 | 8301 | } |
| 1814 | 8302 | }; |
| 1815 | 8303 | |
| 1816 | 8304 | // packages/format-library/build-module/underline/index.mjs |
| 1817 | - var import_i18n9 = __toESM(require_i18n(), 1); | |
| 8305 | + var import_i18n13 = __toESM(require_i18n(), 1); | |
| 1818 | 8306 | var import_rich_text8 = __toESM(require_rich_text(), 1); |
| 1819 | 8307 | var import_block_editor8 = __toESM(require_block_editor(), 1); |
| 1820 | - var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); | |
| 8308 | + var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); | |
| 1821 | 8309 | var name7 = "core/underline"; |
| 1822 | - var title7 = (0, import_i18n9.__)("Underline"); | |
| 8310 | + var title7 = (0, import_i18n13.__)("Underline"); | |
| 1823 | 8311 | var underline = { |
| 1824 | 8312 | name: name7, |
| 1825 | 8313 | title: title7, |
| 1826 | 8314 | tagName: "span", |
| @@ -1839,10 +8327,10 @@ | ||
| 1839 | 8327 | title: title7 |
| 1840 | 8328 | }) |
| 1841 | 8329 | ); |
| 1842 | 8330 | }; |
| 1843 | - return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [ | |
| 1844 | - /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( | |
| 8331 | + return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [ | |
| 8332 | + /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( | |
| 1845 | 8333 | import_block_editor8.RichTextShortcut, |
| 1846 | 8334 | { |
| 1847 | 8335 | type: "primary", |
| 1848 | 8336 | character: "u", |
| @@ -1848,9 +8336,9 @@ | ||
| 1848 | 8336 | character: "u", |
| 1849 | 8337 | onUse: onToggle |
| 1850 | 8338 | } |
| 1851 | 8339 | ), |
| 1852 | - /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( | |
| 8340 | + /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( | |
| 1853 | 8341 | import_block_editor8.__unstableRichTextInputEvent, |
| 1854 | 8342 | { |
| 1855 | 8343 | inputType: "formatUnderline", |
| 1856 | 8344 | onInput: onToggle |
| @@ -1860,48 +8348,41 @@ | ||
| 1860 | 8348 | } |
| 1861 | 8349 | }; |
| 1862 | 8350 | |
| 1863 | 8351 | // packages/format-library/build-module/text-color/index.mjs |
| 1864 | - var import_i18n11 = __toESM(require_i18n(), 1); | |
| 1865 | - var import_element8 = __toESM(require_element(), 1); | |
| 8352 | + var import_i18n15 = __toESM(require_i18n(), 1); | |
| 8353 | + var import_element31 = __toESM(require_element(), 1); | |
| 1866 | 8354 | var import_block_editor10 = __toESM(require_block_editor(), 1); |
| 1867 | 8355 | var import_rich_text10 = __toESM(require_rich_text(), 1); |
| 1868 | 8356 | |
| 1869 | 8357 | // packages/format-library/build-module/text-color/inline.mjs |
| 1870 | - var import_element7 = __toESM(require_element(), 1); | |
| 8358 | + var import_element30 = __toESM(require_element(), 1); | |
| 1871 | 8359 | var import_data2 = __toESM(require_data(), 1); |
| 1872 | 8360 | var import_rich_text9 = __toESM(require_rich_text(), 1); |
| 1873 | 8361 | var import_block_editor9 = __toESM(require_block_editor(), 1); |
| 1874 | 8362 | var import_components4 = __toESM(require_components(), 1); |
| 1875 | - var import_i18n10 = __toESM(require_i18n(), 1); | |
| 1876 | - | |
| 1877 | - // packages/format-library/build-module/lock-unlock.mjs | |
| 1878 | - var import_private_apis = __toESM(require_private_apis(), 1); | |
| 1879 | - var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( | |
| 1880 | - "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", | |
| 1881 | - "@wordpress/format-library" | |
| 1882 | - ); | |
| 1883 | - | |
| 1884 | - // packages/format-library/build-module/text-color/inline.mjs | |
| 1885 | - var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); | |
| 1886 | - var { Tabs } = unlock(import_components4.privateApis); | |
| 8363 | + var import_i18n14 = __toESM(require_i18n(), 1); | |
| 8364 | + var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); | |
| 1887 | 8365 | var TABS = [ |
| 1888 | - { name: "color", title: (0, import_i18n10.__)("Text") }, | |
| 1889 | - { name: "backgroundColor", title: (0, import_i18n10.__)("Background") } | |
| 8366 | + { name: "color", title: (0, import_i18n14.__)("Text") }, | |
| 8367 | + { name: "backgroundColor", title: (0, import_i18n14.__)("Background") } | |
| 1890 | 8368 | ]; |
| 1891 | 8369 | function parseCSS(css = "") { |
| 1892 | - return css.split(";").reduce((accumulator, rule) => { | |
| 1893 | - if (rule) { | |
| 1894 | - const [property, value] = rule.split(":"); | |
| 1895 | - if (property === "color") { | |
| 1896 | - accumulator.color = value; | |
| 8370 | + return css.split(";").reduce( | |
| 8371 | + (accumulator, rule) => { | |
| 8372 | + if (rule) { | |
| 8373 | + const [property, value] = rule.split(":"); | |
| 8374 | + if (property === "color") { | |
| 8375 | + accumulator.color = value; | |
| 8376 | + } | |
| 8377 | + if (property === "background-color" && value !== transparentValue) { | |
| 8378 | + accumulator.backgroundColor = value; | |
| 8379 | + } | |
| 1897 | 8380 | } |
| 1898 | - if (property === "background-color" && value !== transparentValue) { | |
| 1899 | - accumulator.backgroundColor = value; | |
| 1900 | - } | |
| 1901 | - } | |
| 1902 | - return accumulator; | |
| 1903 | - }, {}); | |
| 8381 | + return accumulator; | |
| 8382 | + }, | |
| 8383 | + {} | |
| 8384 | + ); | |
| 1904 | 8385 | } |
| 1905 | 8386 | function parseClassName(className = "", colorSettings) { |
| 1906 | 8387 | return className.split(" ").reduce((accumulator, name16) => { |
| 1907 | 8388 | if (name16.startsWith("has-") && name16.endsWith("-color")) { |
| @@ -1920,10 +8401,10 @@ | ||
| 1920 | 8401 | if (!activeColorFormat) { |
| 1921 | 8402 | return {}; |
| 1922 | 8403 | } |
| 1923 | 8404 | return { |
| 1924 | - ...parseCSS(activeColorFormat.attributes.style), | |
| 1925 | - ...parseClassName(activeColorFormat.attributes.class, colorSettings) | |
| 8405 | + ...parseCSS(activeColorFormat.attributes?.style), | |
| 8406 | + ...parseClassName(activeColorFormat.attributes?.class, colorSettings) | |
| 1926 | 8407 | }; |
| 1927 | 8408 | } |
| 1928 | 8409 | function setColors(value, name16, colorSettings, colors) { |
| 1929 | 8410 | const { color, backgroundColor } = { |
| @@ -1942,10 +8423,16 @@ | ||
| 1942 | 8423 | styles.push(["background-color", transparentValue].join(":")); |
| 1943 | 8424 | } |
| 1944 | 8425 | if (color) { |
| 1945 | 8426 | const colorObject = (0, import_block_editor9.getColorObjectByColorValue)(colorSettings, color); |
| 1946 | - if (colorObject) { | |
| 1947 | - classNames.push((0, import_block_editor9.getColorClassName)("color", colorObject.slug)); | |
| 8427 | + if (colorObject && colorObject.slug) { | |
| 8428 | + const colorClassName = (0, import_block_editor9.getColorClassName)( | |
| 8429 | + "color", | |
| 8430 | + colorObject.slug | |
| 8431 | + ); | |
| 8432 | + if (colorClassName) { | |
| 8433 | + classNames.push(colorClassName); | |
| 8434 | + } | |
| 1948 | 8435 | } else { |
| 1949 | 8436 | styles.push(["color", color].join(":")); |
| 1950 | 8437 | } |
| 1951 | 8438 | } |
| @@ -1961,13 +8448,13 @@ | ||
| 1961 | 8448 | const colors = (0, import_data2.useSelect)((select) => { |
| 1962 | 8449 | const { getSettings } = select(import_block_editor9.store); |
| 1963 | 8450 | return getSettings().colors ?? []; |
| 1964 | 8451 | }, []); |
| 1965 | - const activeColors = (0, import_element7.useMemo)( | |
| 8452 | + const activeColors = (0, import_element30.useMemo)( | |
| 1966 | 8453 | () => getActiveColors(value, name16, colors), |
| 1967 | 8454 | [name16, value, colors] |
| 1968 | 8455 | ); |
| 1969 | - return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( | |
| 8456 | + return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( | |
| 1970 | 8457 | import_block_editor9.ColorPalette, |
| 1971 | 8458 | { |
| 1972 | 8459 | value: activeColors[property], |
| 1973 | 8460 | onChange: (color) => { |
| @@ -1987,26 +8474,28 @@ | ||
| 1987 | 8474 | onClose, |
| 1988 | 8475 | contentRef, |
| 1989 | 8476 | isActive |
| 1990 | 8477 | }) { |
| 8478 | + const anchorSettings = { ...textColor, isActive }; | |
| 1991 | 8479 | const popoverAnchor = (0, import_rich_text9.useAnchor)({ |
| 8480 | + // eslint-disable-next-line react-hooks/refs | |
| 1992 | 8481 | editableContentElement: contentRef.current, |
| 1993 | - settings: { ...textColor, isActive } | |
| 8482 | + settings: anchorSettings | |
| 1994 | 8483 | }); |
| 1995 | - return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( | |
| 8484 | + return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( | |
| 1996 | 8485 | import_components4.Popover, |
| 1997 | 8486 | { |
| 1998 | 8487 | onClose, |
| 1999 | 8488 | className: "format-library__inline-color-popover", |
| 2000 | 8489 | anchor: popoverAnchor, |
| 2001 | - children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tabs, { children: [ | |
| 2002 | - /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Tabs.TabList, { children: TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Tabs.Tab, { tabId: tab.name, children: tab.title }, tab.name)) }), | |
| 2003 | - TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( | |
| 2004 | - Tabs.TabPanel, | |
| 8490 | + children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(tabs_exports.Root, { defaultValue: TABS[0].name, children: [ | |
| 8491 | + /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(tabs_exports.List, { children: TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(tabs_exports.Tab, { value: tab.name, children: tab.title }, tab.name)) }), | |
| 8492 | + TABS.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( | |
| 8493 | + tabs_exports.Panel, | |
| 2005 | 8494 | { |
| 2006 | - tabId: tab.name, | |
| 2007 | - focusable: false, | |
| 2008 | - children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( | |
| 8495 | + value: tab.name, | |
| 8496 | + tabIndex: -1, | |
| 8497 | + children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( | |
| 2009 | 8498 | ColorPicker, |
| 2010 | 8499 | { |
| 2011 | 8500 | name: name16, |
| 2012 | 8501 | property: tab.name, |
| @@ -2022,18 +8511,18 @@ | ||
| 2022 | 8511 | ); |
| 2023 | 8512 | } |
| 2024 | 8513 | |
| 2025 | 8514 | // packages/format-library/build-module/text-color/index.mjs |
| 2026 | - var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); | |
| 8515 | + var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); | |
| 2027 | 8516 | var transparentValue = "rgba(0, 0, 0, 0)"; |
| 2028 | 8517 | var name8 = "core/text-color"; |
| 2029 | - var title8 = (0, import_i18n11.__)("Highlight"); | |
| 8518 | + var title8 = (0, import_i18n15.__)("Highlight"); | |
| 2030 | 8519 | var EMPTY_ARRAY2 = []; |
| 2031 | 8520 | function getComputedStyleProperty(element, property) { |
| 2032 | - const { ownerDocument } = element; | |
| 2033 | - const { defaultView } = ownerDocument; | |
| 2034 | - const style = defaultView.getComputedStyle(element); | |
| 2035 | - const value = style.getPropertyValue(property); | |
| 8521 | + const { ownerDocument: ownerDocument2 } = element; | |
| 8522 | + const { defaultView } = ownerDocument2; | |
| 8523 | + const style = defaultView?.getComputedStyle(element); | |
| 8524 | + const value = style?.getPropertyValue(property); | |
| 2036 | 8525 | if (property === "background-color" && value === transparentValue && element.parentElement) { |
| 2037 | 8526 | return getComputedStyleProperty(element.parentElement, property); |
| 2038 | 8527 | } |
| 2039 | 8528 | return value; |
| @@ -2038,9 +8527,9 @@ | ||
| 2038 | 8527 | } |
| 2039 | 8528 | return value; |
| 2040 | 8529 | } |
| 2041 | 8530 | function fillComputedColors(element, { color, backgroundColor }) { |
| 2042 | - if (!color && !backgroundColor) { | |
| 8531 | + if (!element || !color && !backgroundColor) { | |
| 2043 | 8532 | return; |
| 2044 | 8533 | } |
| 2045 | 8534 | return { |
| 2046 | 8535 | color: color || getComputedStyleProperty(element, "color"), |
| @@ -2057,10 +8546,10 @@ | ||
| 2057 | 8546 | const [allowCustomControl, colors = EMPTY_ARRAY2] = (0, import_block_editor10.useSettings)( |
| 2058 | 8547 | "color.custom", |
| 2059 | 8548 | "color.palette" |
| 2060 | 8549 | ); |
| 2061 | - const [isAddingColor, setIsAddingColor] = (0, import_element8.useState)(false); | |
| 2062 | - const colorIndicatorStyle = (0, import_element8.useMemo)( | |
| 8550 | + const [isAddingColor, setIsAddingColor] = (0, import_element31.useState)(false); | |
| 8551 | + const colorIndicatorStyle = (0, import_element31.useMemo)( | |
| 2063 | 8552 | () => fillComputedColors( |
| 2064 | 8553 | contentRef.current, |
| 2065 | 8554 | getActiveColors(value, name8, colors) |
| 2066 | 8555 | ), |
| @@ -2069,15 +8558,15 @@ | ||
| 2069 | 8558 | const hasColorsToChoose = !!colors.length || allowCustomControl; |
| 2070 | 8559 | if (!hasColorsToChoose && !isActive) { |
| 2071 | 8560 | return null; |
| 2072 | 8561 | } |
| 2073 | - return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [ | |
| 2074 | - /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( | |
| 8562 | + return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [ | |
| 8563 | + /* @__PURE__ */ (0, import_jsx_runtime63.jsx)( | |
| 2075 | 8564 | import_block_editor10.RichTextToolbarButton, |
| 2076 | 8565 | { |
| 2077 | 8566 | className: "format-library-text-color-button", |
| 2078 | 8567 | isActive, |
| 2079 | - icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( | |
| 8568 | + icon: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)( | |
| 2080 | 8569 | icon_default, |
| 2081 | 8570 | { |
| 2082 | 8571 | icon: Object.keys(activeAttributes).length ? text_color_default : color_default, |
| 2083 | 8572 | style: colorIndicatorStyle |
| @@ -2087,14 +8576,13 @@ | ||
| 2087 | 8576 | onClick: hasColorsToChoose ? () => setIsAddingColor(true) : () => onChange((0, import_rich_text10.removeFormat)(value, name8)), |
| 2088 | 8577 | role: "menuitemcheckbox" |
| 2089 | 8578 | } |
| 2090 | 8579 | ), |
| 2091 | - isAddingColor && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( | |
| 8580 | + isAddingColor && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)( | |
| 2092 | 8581 | InlineColorUI, |
| 2093 | 8582 | { |
| 2094 | 8583 | name: name8, |
| 2095 | 8584 | onClose: () => setIsAddingColor(false), |
| 2096 | - activeAttributes, | |
| 2097 | 8585 | value, |
| 2098 | 8586 | onChange, |
| 2099 | 8587 | contentRef, |
| 2100 | 8588 | isActive |
| @@ -2114,14 +8602,14 @@ | ||
| 2114 | 8602 | edit: TextColorEdit |
| 2115 | 8603 | }; |
| 2116 | 8604 | |
| 2117 | 8605 | // packages/format-library/build-module/subscript/index.mjs |
| 2118 | - var import_i18n12 = __toESM(require_i18n(), 1); | |
| 8606 | + var import_i18n16 = __toESM(require_i18n(), 1); | |
| 2119 | 8607 | var import_rich_text11 = __toESM(require_rich_text(), 1); |
| 2120 | 8608 | var import_block_editor11 = __toESM(require_block_editor(), 1); |
| 2121 | - var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); | |
| 8609 | + var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); | |
| 2122 | 8610 | var name9 = "core/subscript"; |
| 2123 | - var title9 = (0, import_i18n12.__)("Subscript"); | |
| 8611 | + var title9 = (0, import_i18n16.__)("Subscript"); | |
| 2124 | 8612 | var subscript = { |
| 2125 | 8613 | name: name9, |
| 2126 | 8614 | title: title9, |
| 2127 | 8615 | tagName: "sub", |
| @@ -2133,9 +8621,9 @@ | ||
| 2133 | 8621 | function onClick() { |
| 2134 | 8622 | onToggle(); |
| 2135 | 8623 | onFocus(); |
| 2136 | 8624 | } |
| 2137 | - return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( | |
| 8625 | + return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( | |
| 2138 | 8626 | import_block_editor11.RichTextToolbarButton, |
| 2139 | 8627 | { |
| 2140 | 8628 | icon: subscript_default, |
| 2141 | 8629 | title: title9, |
| @@ -2147,14 +8635,14 @@ | ||
| 2147 | 8635 | } |
| 2148 | 8636 | }; |
| 2149 | 8637 | |
| 2150 | 8638 | // packages/format-library/build-module/superscript/index.mjs |
| 2151 | - var import_i18n13 = __toESM(require_i18n(), 1); | |
| 8639 | + var import_i18n17 = __toESM(require_i18n(), 1); | |
| 2152 | 8640 | var import_rich_text12 = __toESM(require_rich_text(), 1); |
| 2153 | 8641 | var import_block_editor12 = __toESM(require_block_editor(), 1); |
| 2154 | - var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); | |
| 8642 | + var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); | |
| 2155 | 8643 | var name10 = "core/superscript"; |
| 2156 | - var title10 = (0, import_i18n13.__)("Superscript"); | |
| 8644 | + var title10 = (0, import_i18n17.__)("Superscript"); | |
| 2157 | 8645 | var superscript = { |
| 2158 | 8646 | name: name10, |
| 2159 | 8647 | title: title10, |
| 2160 | 8648 | tagName: "sup", |
| @@ -2166,9 +8654,9 @@ | ||
| 2166 | 8654 | function onClick() { |
| 2167 | 8655 | onToggle(); |
| 2168 | 8656 | onFocus(); |
| 2169 | 8657 | } |
| 2170 | - return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( | |
| 8658 | + return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( | |
| 2171 | 8659 | import_block_editor12.RichTextToolbarButton, |
| 2172 | 8660 | { |
| 2173 | 8661 | icon: superscript_default, |
| 2174 | 8662 | title: title10, |
| @@ -2180,15 +8668,15 @@ | ||
| 2180 | 8668 | } |
| 2181 | 8669 | }; |
| 2182 | 8670 | |
| 2183 | 8671 | // packages/format-library/build-module/keyboard/index.mjs |
| 2184 | - var import_i18n14 = __toESM(require_i18n(), 1); | |
| 8672 | + var import_i18n18 = __toESM(require_i18n(), 1); | |
| 2185 | 8673 | var import_rich_text13 = __toESM(require_rich_text(), 1); |
| 2186 | 8674 | var import_block_editor13 = __toESM(require_block_editor(), 1); |
| 2187 | - var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); | |
| 8675 | + var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); | |
| 2188 | 8676 | var name11 = "core/keyboard"; |
| 2189 | - var title11 = (0, import_i18n14.__)("Keyboard input"); | |
| 2190 | - var keyboard = { | |
| 8677 | + var title11 = (0, import_i18n18.__)("Keyboard input"); | |
| 8678 | + var keyboard2 = { | |
| 2191 | 8679 | name: name11, |
| 2192 | 8680 | title: title11, |
| 2193 | 8681 | tagName: "kbd", |
| 2194 | 8682 | className: null, |
| @@ -2199,9 +8687,9 @@ | ||
| 2199 | 8687 | function onClick() { |
| 2200 | 8688 | onToggle(); |
| 2201 | 8689 | onFocus(); |
| 2202 | 8690 | } |
| 2203 | - return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( | |
| 8691 | + return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( | |
| 2204 | 8692 | import_block_editor13.RichTextToolbarButton, |
| 2205 | 8693 | { |
| 2206 | 8694 | icon: button_default, |
| 2207 | 8695 | title: title11, |
| @@ -2213,14 +8701,14 @@ | ||
| 2213 | 8701 | } |
| 2214 | 8702 | }; |
| 2215 | 8703 | |
| 2216 | 8704 | // packages/format-library/build-module/unknown/index.mjs |
| 2217 | - var import_i18n15 = __toESM(require_i18n(), 1); | |
| 8705 | + var import_i18n19 = __toESM(require_i18n(), 1); | |
| 2218 | 8706 | var import_rich_text14 = __toESM(require_rich_text(), 1); |
| 2219 | 8707 | var import_block_editor14 = __toESM(require_block_editor(), 1); |
| 2220 | - var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); | |
| 8708 | + var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); | |
| 2221 | 8709 | var name12 = "core/unknown"; |
| 2222 | - var title12 = (0, import_i18n15.__)("Clear Unknown Formatting"); | |
| 8710 | + var title12 = (0, import_i18n19.__)("Clear Unknown Formatting"); | |
| 2223 | 8711 | function selectionContainsUnknownFormats(value) { |
| 2224 | 8712 | if ((0, import_rich_text14.isCollapsed)(value)) { |
| 2225 | 8713 | return false; |
| 2226 | 8714 | } |
| @@ -2241,9 +8729,9 @@ | ||
| 2241 | 8729 | function onClick() { |
| 2242 | 8730 | onChange((0, import_rich_text14.removeFormat)(value, name12)); |
| 2243 | 8731 | onFocus(); |
| 2244 | 8732 | } |
| 2245 | - return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( | |
| 8733 | + return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( | |
| 2246 | 8734 | import_block_editor14.RichTextToolbarButton, |
| 2247 | 8735 | { |
| 2248 | 8736 | name: "unknown", |
| 2249 | 8737 | icon: help_default, |
| @@ -2255,16 +8743,16 @@ | ||
| 2255 | 8743 | } |
| 2256 | 8744 | }; |
| 2257 | 8745 | |
| 2258 | 8746 | // packages/format-library/build-module/language/index.mjs |
| 2259 | - var import_i18n16 = __toESM(require_i18n(), 1); | |
| 8747 | + var import_i18n20 = __toESM(require_i18n(), 1); | |
| 2260 | 8748 | var import_block_editor15 = __toESM(require_block_editor(), 1); |
| 2261 | 8749 | var import_components5 = __toESM(require_components(), 1); |
| 2262 | - var import_element9 = __toESM(require_element(), 1); | |
| 8750 | + var import_element32 = __toESM(require_element(), 1); | |
| 2263 | 8751 | var import_rich_text15 = __toESM(require_rich_text(), 1); |
| 2264 | - var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); | |
| 8752 | + var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); | |
| 2265 | 8753 | var name13 = "core/language"; |
| 2266 | - var title13 = (0, import_i18n16.__)("Language"); | |
| 8754 | + var title13 = (0, import_i18n20.__)("Language"); | |
| 2267 | 8755 | var language = { |
| 2268 | 8756 | name: name13, |
| 2269 | 8757 | title: title13, |
| 2270 | 8758 | tagName: "bdo", |
| @@ -2275,14 +8763,14 @@ | ||
| 2275 | 8763 | }, |
| 2276 | 8764 | edit: Edit3 |
| 2277 | 8765 | }; |
| 2278 | 8766 | function Edit3({ isActive, value, onChange, contentRef }) { |
| 2279 | - const [isPopoverVisible, setIsPopoverVisible] = (0, import_element9.useState)(false); | |
| 8767 | + const [isPopoverVisible, setIsPopoverVisible] = (0, import_element32.useState)(false); | |
| 2280 | 8768 | const togglePopover = () => { |
| 2281 | 8769 | setIsPopoverVisible((state) => !state); |
| 2282 | 8770 | }; |
| 2283 | - return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [ | |
| 2284 | - /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( | |
| 8771 | + return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [ | |
| 8772 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2285 | 8773 | import_block_editor15.RichTextToolbarButton, |
| 2286 | 8774 | { |
| 2287 | 8775 | icon: language_default, |
| 2288 | 8776 | label: title13, |
| @@ -2297,9 +8785,9 @@ | ||
| 2297 | 8785 | isActive, |
| 2298 | 8786 | role: "menuitemcheckbox" |
| 2299 | 8787 | } |
| 2300 | 8788 | ), |
| 2301 | - isPopoverVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( | |
| 8789 | + isPopoverVisible && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2302 | 8790 | InlineLanguageUI, |
| 2303 | 8791 | { |
| 2304 | 8792 | value, |
| 2305 | 8793 | onChange, |
| @@ -2308,26 +8796,33 @@ | ||
| 2308 | 8796 | } |
| 2309 | 8797 | ) |
| 2310 | 8798 | ] }); |
| 2311 | 8799 | } |
| 2312 | - function InlineLanguageUI({ value, contentRef, onChange, onClose }) { | |
| 8800 | + function InlineLanguageUI({ | |
| 8801 | + value, | |
| 8802 | + contentRef, | |
| 8803 | + onChange, | |
| 8804 | + onClose | |
| 8805 | + }) { | |
| 2313 | 8806 | const popoverAnchor = (0, import_rich_text15.useAnchor)({ |
| 8807 | + // eslint-disable-next-line react-hooks/refs | |
| 2314 | 8808 | editableContentElement: contentRef.current, |
| 2315 | 8809 | settings: language |
| 2316 | 8810 | }); |
| 2317 | - const [lang, setLang] = (0, import_element9.useState)(""); | |
| 2318 | - const [dir, setDir] = (0, import_element9.useState)("ltr"); | |
| 2319 | - return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( | |
| 8811 | + const [lang, setLang] = (0, import_element32.useState)(""); | |
| 8812 | + const [dir, setDir] = (0, import_element32.useState)("ltr"); | |
| 8813 | + return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2320 | 8814 | import_components5.Popover, |
| 2321 | 8815 | { |
| 2322 | 8816 | className: "block-editor-format-toolbar__language-popover", |
| 2323 | 8817 | anchor: popoverAnchor, |
| 2324 | 8818 | onClose, |
| 2325 | - children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)( | |
| 2326 | - import_components5.__experimentalVStack, | |
| 8819 | + children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)( | |
| 8820 | + Stack, | |
| 2327 | 8821 | { |
| 2328 | - as: "form", | |
| 2329 | - spacing: 4, | |
| 8822 | + render: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("form", {}), | |
| 8823 | + direction: "column", | |
| 8824 | + gap: "lg", | |
| 2330 | 8825 | className: "block-editor-format-toolbar__language-container-content", |
| 2331 | 8826 | onSubmit: (event) => { |
| 2332 | 8827 | event.preventDefault(); |
| 2333 | 8828 | onChange( |
| @@ -2341,33 +8836,31 @@ | ||
| 2341 | 8836 | ); |
| 2342 | 8837 | onClose(); |
| 2343 | 8838 | }, |
| 2344 | 8839 | children: [ |
| 2345 | - /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( | |
| 8840 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2346 | 8841 | import_components5.TextControl, |
| 2347 | 8842 | { |
| 2348 | - __next40pxDefaultSize: true, | |
| 2349 | 8843 | label: title13, |
| 2350 | 8844 | value: lang, |
| 2351 | 8845 | onChange: (val) => setLang(val), |
| 2352 | - help: (0, import_i18n16.__)( | |
| 8846 | + help: (0, import_i18n20.__)( | |
| 2353 | 8847 | 'A valid language attribute, like "en" or "fr".' |
| 2354 | 8848 | ) |
| 2355 | 8849 | } |
| 2356 | 8850 | ), |
| 2357 | - /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( | |
| 8851 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2358 | 8852 | import_components5.SelectControl, |
| 2359 | 8853 | { |
| 2360 | - __next40pxDefaultSize: true, | |
| 2361 | - label: (0, import_i18n16.__)("Text direction"), | |
| 8854 | + label: (0, import_i18n20.__)("Text direction"), | |
| 2362 | 8855 | value: dir, |
| 2363 | 8856 | options: [ |
| 2364 | 8857 | { |
| 2365 | - label: (0, import_i18n16.__)("Left to right"), | |
| 8858 | + label: (0, import_i18n20.__)("Left to right"), | |
| 2366 | 8859 | value: "ltr" |
| 2367 | 8860 | }, |
| 2368 | 8861 | { |
| 2369 | - label: (0, import_i18n16.__)("Right to left"), | |
| 8862 | + label: (0, import_i18n20.__)("Right to left"), | |
| 2370 | 8863 | value: "rtl" |
| 2371 | 8864 | } |
| 2372 | 8865 | ], |
| 2373 | 8866 | onChange: (val) => setDir(val) |
| @@ -2372,15 +8865,15 @@ | ||
| 2372 | 8865 | ], |
| 2373 | 8866 | onChange: (val) => setDir(val) |
| 2374 | 8867 | } |
| 2375 | 8868 | ), |
| 2376 | - /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components5.__experimentalHStack, { alignment: "right", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( | |
| 8869 | + /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Stack, { justify: "right", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( | |
| 2377 | 8870 | import_components5.Button, |
| 2378 | 8871 | { |
| 2379 | 8872 | __next40pxDefaultSize: true, |
| 2380 | 8873 | variant: "primary", |
| 2381 | 8874 | type: "submit", |
| 2382 | - text: (0, import_i18n16.__)("Apply") | |
| 8875 | + text: (0, import_i18n20.__)("Apply") | |
| 2383 | 8876 | } |
| 2384 | 8877 | ) }) |
| 2385 | 8878 | ] |
| 2386 | 8879 | } |
| @@ -2389,18 +8882,16 @@ | ||
| 2389 | 8882 | ); |
| 2390 | 8883 | } |
| 2391 | 8884 | |
| 2392 | 8885 | // packages/format-library/build-module/math/index.mjs |
| 2393 | - var import_i18n17 = __toESM(require_i18n(), 1); | |
| 2394 | - var import_element10 = __toESM(require_element(), 1); | |
| 8886 | + var import_i18n21 = __toESM(require_i18n(), 1); | |
| 8887 | + var import_element33 = __toESM(require_element(), 1); | |
| 2395 | 8888 | var import_rich_text16 = __toESM(require_rich_text(), 1); |
| 2396 | 8889 | var import_block_editor16 = __toESM(require_block_editor(), 1); |
| 2397 | 8890 | var import_components6 = __toESM(require_components(), 1); |
| 2398 | - var import_a11y3 = __toESM(require_a11y(), 1); | |
| 2399 | - var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); | |
| 2400 | - var { Badge: WCBadge } = unlock(import_components6.privateApis); | |
| 8891 | + var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); | |
| 2401 | 8892 | var name14 = "core/math"; |
| 2402 | - var title14 = (0, import_i18n17.__)("Math"); | |
| 8893 | + var title14 = (0, import_i18n21.__)("Math"); | |
| 2403 | 8894 | function InlineUI2({ |
| 2404 | 8895 | value, |
| 2405 | 8896 | onChange, |
| 2406 | 8897 | activeAttributes, |
| @@ -2406,34 +8897,32 @@ | ||
| 2406 | 8897 | activeAttributes, |
| 2407 | 8898 | contentRef, |
| 2408 | 8899 | latexToMathML |
| 2409 | 8900 | }) { |
| 2410 | - const [latex, setLatex] = (0, import_element10.useState)( | |
| 8901 | + const [latex, setLatex] = (0, import_element33.useState)( | |
| 2411 | 8902 | activeAttributes?.["data-latex"] || "" |
| 2412 | 8903 | ); |
| 2413 | - const [error, setError] = (0, import_element10.useState)(null); | |
| 8904 | + const [error2, setError] = (0, import_element33.useState)(null); | |
| 8905 | + const formRef = (0, import_element33.useRef)(null); | |
| 2414 | 8906 | const popoverAnchor = (0, import_rich_text16.useAnchor)({ |
| 8907 | + // eslint-disable-next-line react-hooks/refs | |
| 2415 | 8908 | editableContentElement: contentRef.current, |
| 2416 | 8909 | settings: math |
| 2417 | 8910 | }); |
| 2418 | 8911 | const handleLatexChange = (newLatex) => { |
| 8912 | + setLatex(newLatex); | |
| 2419 | 8913 | let mathML = ""; |
| 2420 | - setLatex(newLatex); | |
| 2421 | - if (newLatex) { | |
| 8914 | + if (newLatex && latexToMathML) { | |
| 2422 | 8915 | try { |
| 2423 | 8916 | mathML = latexToMathML(newLatex, { displayMode: false }); |
| 2424 | 8917 | setError(null); |
| 2425 | 8918 | } catch (err) { |
| 2426 | - setError(err.message); | |
| 2427 | - (0, import_a11y3.speak)( | |
| 2428 | - (0, import_i18n17.sprintf)( | |
| 2429 | - /* translators: %s: error message returned when parsing LaTeX. */ | |
| 2430 | - (0, import_i18n17.__)("Error parsing mathematical expression: %s"), | |
| 2431 | - err.message | |
| 2432 | - ) | |
| 8919 | + setError( | |
| 8920 | + err instanceof Error ? err.message : (0, import_i18n21.__)("Could not parse the LaTeX math syntax.") | |
| 2433 | 8921 | ); |
| 2434 | - return; | |
| 2435 | 8922 | } |
| 8923 | + } else { | |
| 8924 | + setError(null); | |
| 2436 | 8925 | } |
| 2437 | 8926 | const newReplacements = value.replacements.slice(); |
| 2438 | 8927 | newReplacements[value.start] = { |
| 2439 | 8928 | type: name14, |
| @@ -2446,9 +8935,9 @@ | ||
| 2446 | 8935 | ...value, |
| 2447 | 8936 | replacements: newReplacements |
| 2448 | 8937 | }); |
| 2449 | 8938 | }; |
| 2450 | - return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 8939 | + return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 2451 | 8940 | import_components6.Popover, |
| 2452 | 8941 | { |
| 2453 | 8942 | placement: "bottom-start", |
| 2454 | 8943 | offset: 8, |
| @@ -2453,39 +8942,43 @@ | ||
| 2453 | 8942 | placement: "bottom-start", |
| 2454 | 8943 | offset: 8, |
| 2455 | 8944 | focusOnMount: false, |
| 2456 | 8945 | anchor: popoverAnchor, |
| 8946 | + onFocusOutside: () => formRef.current?.reportValidity(), | |
| 2457 | 8947 | className: "block-editor-format-toolbar__math-popover", |
| 2458 | - children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { minWidth: "300px", padding: "4px" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_components6.__experimentalVStack, { spacing: 1, children: [ | |
| 2459 | - /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 2460 | - import_components6.TextControl, | |
| 2461 | - { | |
| 2462 | - __next40pxDefaultSize: true, | |
| 2463 | - hideLabelFromVision: true, | |
| 2464 | - label: (0, import_i18n17.__)("LaTeX math syntax"), | |
| 2465 | - value: latex, | |
| 2466 | - onChange: handleLatexChange, | |
| 2467 | - placeholder: (0, import_i18n17.__)("e.g., x^2, \\frac{a}{b}"), | |
| 2468 | - autoComplete: "off", | |
| 2469 | - className: "block-editor-format-toolbar__math-input" | |
| 2470 | - } | |
| 2471 | - ), | |
| 2472 | - error && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [ | |
| 2473 | - /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 2474 | - WCBadge, | |
| 2475 | - { | |
| 2476 | - intent: "error", | |
| 2477 | - className: "wp-block-math__error", | |
| 2478 | - children: (0, import_i18n17.sprintf)( | |
| 2479 | - /* translators: %s: error message returned when parsing LaTeX. */ | |
| 2480 | - (0, import_i18n17.__)("Error: %s"), | |
| 2481 | - error | |
| 2482 | - ) | |
| 2483 | - } | |
| 2484 | - ), | |
| 2485 | - /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("style", { children: ".wp-block-math__error .components-badge__content{white-space:normal}" }) | |
| 2486 | - ] }) | |
| 2487 | - ] }) }) | |
| 8948 | + children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)( | |
| 8949 | + "form", | |
| 8950 | + { | |
| 8951 | + ref: formRef, | |
| 8952 | + style: { minWidth: "300px", padding: "16px" }, | |
| 8953 | + onSubmit: (event) => event.preventDefault(), | |
| 8954 | + children: [ | |
| 8955 | + /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 8956 | + ValidatedInputControl, | |
| 8957 | + { | |
| 8958 | + label: (0, import_i18n21.__)("LaTeX math syntax"), | |
| 8959 | + value: latex, | |
| 8960 | + customValidity: error2 ? { type: "invalid", message: error2 } : void 0, | |
| 8961 | + onValueChange: handleLatexChange, | |
| 8962 | + placeholder: (0, import_i18n21.__)("e.g., x^2, \\frac{a}{b}, \\sqrt{x}"), | |
| 8963 | + autoComplete: "off", | |
| 8964 | + className: "block-editor-format-toolbar__math-input" | |
| 8965 | + } | |
| 8966 | + ), | |
| 8967 | + /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 8968 | + Link, | |
| 8969 | + { | |
| 8970 | + openInNewTab: true, | |
| 8971 | + className: "block-editor-format-toolbar__math-learn-more", | |
| 8972 | + href: (0, import_i18n21.__)( | |
| 8973 | + "https://wordpress.org/documentation/article/math-block/" | |
| 8974 | + ), | |
| 8975 | + children: (0, import_i18n21.__)("Learn more about LaTeX syntax") | |
| 8976 | + } | |
| 8977 | + ) | |
| 8978 | + ] | |
| 8979 | + } | |
| 8980 | + ) | |
| 2488 | 8981 | } |
| 2489 | 8982 | ); |
| 2490 | 8983 | } |
| 2491 | 8984 | function Edit4({ |
| @@ -2495,36 +8988,52 @@ | ||
| 2495 | 8988 | isObjectActive, |
| 2496 | 8989 | activeObjectAttributes, |
| 2497 | 8990 | contentRef |
| 2498 | 8991 | }) { |
| 2499 | - const [latexToMathML, setLatexToMathML] = (0, import_element10.useState)(); | |
| 2500 | - (0, import_element10.useEffect)(() => { | |
| 8992 | + const [latexToMathML, setLatexToMathML] = (0, import_element33.useState)(); | |
| 8993 | + (0, import_element33.useEffect)(() => { | |
| 2501 | 8994 | import("@wordpress/latex-to-mathml").then((module) => { |
| 2502 | 8995 | setLatexToMathML(() => module.default); |
| 2503 | 8996 | }); |
| 2504 | 8997 | }, []); |
| 2505 | - return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [ | |
| 2506 | - /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 8998 | + function onClick() { | |
| 8999 | + let newValue; | |
| 9000 | + if (isObjectActive) { | |
| 9001 | + const latex = activeObjectAttributes?.["data-latex"] || ""; | |
| 9002 | + newValue = (0, import_rich_text16.insert)(value, latex); | |
| 9003 | + newValue.start = newValue.end - latex.length; | |
| 9004 | + } else { | |
| 9005 | + const selectedText = (0, import_rich_text16.getTextContent)((0, import_rich_text16.slice)(value)); | |
| 9006 | + let innerHTML = ""; | |
| 9007 | + if (selectedText && latexToMathML) { | |
| 9008 | + try { | |
| 9009 | + innerHTML = latexToMathML(selectedText, { | |
| 9010 | + displayMode: false | |
| 9011 | + }); | |
| 9012 | + } catch { | |
| 9013 | + } | |
| 9014 | + } | |
| 9015 | + newValue = (0, import_rich_text16.insertObject)(value, { | |
| 9016 | + type: name14, | |
| 9017 | + attributes: { "data-latex": selectedText }, | |
| 9018 | + innerHTML | |
| 9019 | + }); | |
| 9020 | + newValue.start = newValue.end - 1; | |
| 9021 | + } | |
| 9022 | + onChange(newValue); | |
| 9023 | + onFocus(); | |
| 9024 | + } | |
| 9025 | + return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [ | |
| 9026 | + /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 2507 | 9027 | import_block_editor16.RichTextToolbarButton, |
| 2508 | 9028 | { |
| 2509 | 9029 | icon: math_default, |
| 2510 | 9030 | title: title14, |
| 2511 | - onClick: () => { | |
| 2512 | - const newValue = (0, import_rich_text16.insertObject)(value, { | |
| 2513 | - type: name14, | |
| 2514 | - attributes: { | |
| 2515 | - "data-latex": "" | |
| 2516 | - }, | |
| 2517 | - innerHTML: "" | |
| 2518 | - }); | |
| 2519 | - newValue.start = newValue.end - 1; | |
| 2520 | - onChange(newValue); | |
| 2521 | - onFocus(); | |
| 2522 | - }, | |
| 9031 | + onClick, | |
| 2523 | 9032 | isActive: isObjectActive |
| 2524 | 9033 | } |
| 2525 | 9034 | ), |
| 2526 | - isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( | |
| 9035 | + isObjectActive && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( | |
| 2527 | 9036 | InlineUI2, |
| 2528 | 9037 | { |
| 2529 | 9038 | value, |
| 2530 | 9039 | onChange, |
| @@ -2547,31 +9056,63 @@ | ||
| 2547 | 9056 | edit: Edit4 |
| 2548 | 9057 | }; |
| 2549 | 9058 | |
| 2550 | 9059 | // packages/format-library/build-module/non-breaking-space/index.mjs |
| 2551 | - var import_i18n18 = __toESM(require_i18n(), 1); | |
| 9060 | + var import_i18n22 = __toESM(require_i18n(), 1); | |
| 2552 | 9061 | var import_rich_text17 = __toESM(require_rich_text(), 1); |
| 2553 | 9062 | var import_block_editor17 = __toESM(require_block_editor(), 1); |
| 2554 | - var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); | |
| 9063 | + var import_components7 = __toESM(require_components(), 1); | |
| 9064 | + var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); | |
| 2555 | 9065 | var name15 = "core/non-breaking-space"; |
| 2556 | - var title15 = (0, import_i18n18.__)("Non breaking space"); | |
| 9066 | + var title15 = (0, import_i18n22.__)("Non breaking space"); | |
| 9067 | + function PopoverAnchor({ contentRef }) { | |
| 9068 | + const popoverAnchor = (0, import_rich_text17.useAnchor)({ | |
| 9069 | + // eslint-disable-next-line react-hooks/refs | |
| 9070 | + editableContentElement: contentRef.current, | |
| 9071 | + settings: nonBreakingSpace | |
| 9072 | + }); | |
| 9073 | + return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components7.Popover, { anchor: popoverAnchor, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { style: { whiteSpace: "nowrap", padding: "4px" }, children: (0, import_i18n22.__)("Non-breaking space") }) }); | |
| 9074 | + } | |
| 2557 | 9075 | var nonBreakingSpace = { |
| 2558 | 9076 | name: name15, |
| 2559 | 9077 | title: title15, |
| 2560 | - tagName: "nbsp", | |
| 2561 | - className: null, | |
| 2562 | - edit({ value, onChange }) { | |
| 9078 | + tagName: "span", | |
| 9079 | + className: "non-breaking-space", | |
| 9080 | + edit({ value, onChange, contentRef }) { | |
| 2563 | 9081 | function addNonBreakingSpace() { |
| 2564 | 9082 | onChange((0, import_rich_text17.insert)(value, "\xA0")); |
| 2565 | 9083 | } |
| 2566 | - return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( | |
| 2567 | - import_block_editor17.RichTextShortcut, | |
| 2568 | - { | |
| 2569 | - type: "primaryShift", | |
| 2570 | - character: " ", | |
| 2571 | - onUse: addNonBreakingSpace | |
| 2572 | - } | |
| 2573 | - ); | |
| 9084 | + const selectedValue = value.start && value.end ? value.text.slice(value.start, value.end) : null; | |
| 9085 | + return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [ | |
| 9086 | + /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( | |
| 9087 | + import_block_editor17.RichTextShortcut, | |
| 9088 | + { | |
| 9089 | + type: "primaryShift", | |
| 9090 | + character: " ", | |
| 9091 | + onUse: addNonBreakingSpace | |
| 9092 | + } | |
| 9093 | + ), | |
| 9094 | + selectedValue === "\xA0" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PopoverAnchor, { contentRef }) | |
| 9095 | + ] }); | |
| 9096 | + }, | |
| 9097 | + __experimentalCreatePrepareEditableTree() { | |
| 9098 | + return (formats, text) => { | |
| 9099 | + const NBSP = "\xA0"; | |
| 9100 | + let record = { formats, text }; | |
| 9101 | + let index2 = -1; | |
| 9102 | + do { | |
| 9103 | + index2 = text.indexOf(NBSP, index2 + 1); | |
| 9104 | + if (index2 !== -1) { | |
| 9105 | + record = (0, import_rich_text17.applyFormat)( | |
| 9106 | + record, | |
| 9107 | + { type: name15 }, | |
| 9108 | + index2, | |
| 9109 | + index2 + 1 | |
| 9110 | + ); | |
| 9111 | + } | |
| 9112 | + } while (index2 !== -1); | |
| 9113 | + return record.formats; | |
| 9114 | + }; | |
| 2574 | 9115 | } |
| 2575 | 9116 | }; |
| 2576 | 9117 | |
| 2577 | 9118 | // packages/format-library/build-module/default-formats.mjs |
| @@ -2585,9 +9126,9 @@ | ||
| 2585 | 9126 | underline, |
| 2586 | 9127 | textColor, |
| 2587 | 9128 | subscript, |
| 2588 | 9129 | superscript, |
| 2589 | - keyboard, | |
| 9130 | + keyboard2, | |
| 2590 | 9131 | unknown, |
| 2591 | 9132 | language, |
| 2592 | 9133 | math, |
| 2593 | 9134 | nonBreakingSpace |
| @@ -2596,6 +9137,21 @@ | ||
| 2596 | 9137 | // packages/format-library/build-module/index.mjs |
| 2597 | 9138 | default_formats_default.forEach( |
| 2598 | 9139 | ({ name: name16, ...settings }) => (0, import_rich_text18.registerFormatType)(name16, settings) |
| 2599 | 9140 | ); |
| 9141 | +})(); | |
| 9142 | +/*! Bundled license information: | |
| 9143 | + | |
| 9144 | +use-sync-external-store/cjs/use-sync-external-store-shim.development.js: | |
| 9145 | + (** | |
| 9146 | + * @license React | |
| 9147 | + * use-sync-external-store-shim.development.js | |
| 9148 | + * | |
| 9149 | + * Copyright (c) Meta Platforms, Inc. and affiliates. | |
| 9150 | + * | |
| 9151 | + * This source code is licensed under the MIT license found in the | |
| 9152 | + * LICENSE file in the root directory of this source tree. | |
| 9153 | + *) | |
| 9154 | +*/ | |
| 9155 | +(window.wp ||= {}).formatLibrary = wp.formatLibrary; | |
| 2600 | 9156 | })(); |
| 2601 | 9157 | //# sourceMappingURL=index.js.map |