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