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