| 1 |
"use strict"; |
| 2 |
var wp; |
| 3 |
(wp ||= {}).element = (() => { |
| 4 |
var __create = Object.create; |
| 5 |
var __defProp = Object.defineProperty; |
| 6 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 7 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
| 8 |
var __getProtoOf = Object.getPrototypeOf; |
| 9 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 10 |
var __commonJS = (cb, mod) => function __require() { |
| 11 |
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 12 |
}; |
| 13 |
var __export = (target, all) => { |
| 14 |
for (var name in all) |
| 15 |
__defProp(target, name, { get: all[name], enumerable: true }); |
| 16 |
}; |
| 17 |
var __copyProps = (to, from, except, desc) => { |
| 18 |
if (from && typeof from === "object" || typeof from === "function") { |
| 19 |
for (let key of __getOwnPropNames(from)) |
| 20 |
if (!__hasOwnProp.call(to, key) && key !== except) |
| 21 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 22 |
} |
| 23 |
return to; |
| 24 |
}; |
| 25 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
| 26 |
// If the importer is in node compatibility mode or this is not an ESM |
| 27 |
// file that has been converted to a CommonJS file using a Babel- |
| 28 |
// compatible transform (i.e. "__esModule" has not been set), then set |
| 29 |
// "default" to the CommonJS "module.exports" for node compatibility. |
| 30 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
| 31 |
mod |
| 32 |
)); |
| 33 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
| 34 |
|
| 35 |
// vendor-external:react |
| 36 |
var require_react = __commonJS({ |
| 37 |
"vendor-external:react"(exports, module) { |
| 38 |
module.exports = window.React; |
| 39 |
} |
| 40 |
}); |
| 41 |
|
| 42 |
// vendor-external:react-dom |
| 43 |
var require_react_dom = __commonJS({ |
| 44 |
"vendor-external:react-dom"(exports, module) { |
| 45 |
module.exports = window.ReactDOM; |
| 46 |
} |
| 47 |
}); |
| 48 |
|
| 49 |
// node_modules/react-dom/client.js |
| 50 |
var require_client = __commonJS({ |
| 51 |
"node_modules/react-dom/client.js"(exports) { |
| 52 |
"use strict"; |
| 53 |
var m = require_react_dom(); |
| 54 |
if (false) { |
| 55 |
exports.createRoot = m.createRoot; |
| 56 |
exports.hydrateRoot = m.hydrateRoot; |
| 57 |
} else { |
| 58 |
i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; |
| 59 |
exports.createRoot = function(c, o) { |
| 60 |
i.usingClientEntryPoint = true; |
| 61 |
try { |
| 62 |
return m.createRoot(c, o); |
| 63 |
} finally { |
| 64 |
i.usingClientEntryPoint = false; |
| 65 |
} |
| 66 |
}; |
| 67 |
exports.hydrateRoot = function(c, h, o) { |
| 68 |
i.usingClientEntryPoint = true; |
| 69 |
try { |
| 70 |
return m.hydrateRoot(c, h, o); |
| 71 |
} finally { |
| 72 |
i.usingClientEntryPoint = false; |
| 73 |
} |
| 74 |
}; |
| 75 |
} |
| 76 |
var i; |
| 77 |
} |
| 78 |
}); |
| 79 |
|
| 80 |
// package-external:@wordpress/escape-html |
| 81 |
var require_escape_html = __commonJS({ |
| 82 |
"package-external:@wordpress/escape-html"(exports, module) { |
| 83 |
module.exports = window.wp.escapeHtml; |
| 84 |
} |
| 85 |
}); |
| 86 |
|
| 87 |
// packages/element/build-module/index.mjs |
| 88 |
var index_exports = {}; |
| 89 |
__export(index_exports, { |
| 90 |
Children: () => import_react.Children, |
| 91 |
Component: () => import_react.Component, |
| 92 |
Fragment: () => import_react.Fragment, |
| 93 |
Platform: () => platform_default, |
| 94 |
PureComponent: () => import_react.PureComponent, |
| 95 |
RawHTML: () => RawHTML, |
| 96 |
StrictMode: () => import_react.StrictMode, |
| 97 |
Suspense: () => import_react.Suspense, |
| 98 |
cloneElement: () => import_react.cloneElement, |
| 99 |
concatChildren: () => concatChildren, |
| 100 |
createContext: () => import_react.createContext, |
| 101 |
createElement: () => import_react.createElement, |
| 102 |
createInterpolateElement: () => create_interpolate_element_default, |
| 103 |
createPortal: () => import_react_dom.createPortal, |
| 104 |
createRef: () => import_react.createRef, |
| 105 |
createRoot: () => import_client.createRoot, |
| 106 |
findDOMNode: () => import_react_dom.findDOMNode, |
| 107 |
flushSync: () => import_react_dom.flushSync, |
| 108 |
forwardRef: () => import_react.forwardRef, |
| 109 |
hydrate: () => import_react_dom.hydrate, |
| 110 |
hydrateRoot: () => import_client.hydrateRoot, |
| 111 |
isEmptyElement: () => isEmptyElement, |
| 112 |
isValidElement: () => import_react.isValidElement, |
| 113 |
lazy: () => import_react.lazy, |
| 114 |
memo: () => import_react.memo, |
| 115 |
render: () => import_react_dom.render, |
| 116 |
renderToString: () => serialize_default, |
| 117 |
startTransition: () => import_react.startTransition, |
| 118 |
switchChildrenNodeName: () => switchChildrenNodeName, |
| 119 |
unmountComponentAtNode: () => import_react_dom.unmountComponentAtNode, |
| 120 |
useCallback: () => import_react.useCallback, |
| 121 |
useContext: () => import_react.useContext, |
| 122 |
useDebugValue: () => import_react.useDebugValue, |
| 123 |
useDeferredValue: () => import_react.useDeferredValue, |
| 124 |
useEffect: () => import_react.useEffect, |
| 125 |
useId: () => import_react.useId, |
| 126 |
useImperativeHandle: () => import_react.useImperativeHandle, |
| 127 |
useInsertionEffect: () => import_react.useInsertionEffect, |
| 128 |
useLayoutEffect: () => import_react.useLayoutEffect, |
| 129 |
useMemo: () => import_react.useMemo, |
| 130 |
useReducer: () => import_react.useReducer, |
| 131 |
useRef: () => import_react.useRef, |
| 132 |
useState: () => import_react.useState, |
| 133 |
useSyncExternalStore: () => import_react.useSyncExternalStore, |
| 134 |
useTransition: () => import_react.useTransition |
| 135 |
}); |
| 136 |
|
| 137 |
// packages/element/build-module/react.mjs |
| 138 |
var import_react = __toESM(require_react(), 1); |
| 139 |
function concatChildren(...childrenArguments) { |
| 140 |
return childrenArguments.reduce( |
| 141 |
(accumulator, children, i) => { |
| 142 |
import_react.Children.forEach(children, (child, j) => { |
| 143 |
if ((0, import_react.isValidElement)(child) && typeof child !== "string") { |
| 144 |
child = (0, import_react.cloneElement)(child, { |
| 145 |
key: [i, j].join() |
| 146 |
}); |
| 147 |
} |
| 148 |
accumulator.push(child); |
| 149 |
}); |
| 150 |
return accumulator; |
| 151 |
}, |
| 152 |
[] |
| 153 |
); |
| 154 |
} |
| 155 |
function switchChildrenNodeName(children, nodeName) { |
| 156 |
return children && import_react.Children.map(children, (elt, index) => { |
| 157 |
if (typeof elt?.valueOf() === "string") { |
| 158 |
return (0, import_react.createElement)(nodeName, { key: index }, elt); |
| 159 |
} |
| 160 |
if (!(0, import_react.isValidElement)(elt)) { |
| 161 |
return elt; |
| 162 |
} |
| 163 |
const { children: childrenProp, ...props } = elt.props; |
| 164 |
return (0, import_react.createElement)( |
| 165 |
nodeName, |
| 166 |
{ key: index, ...props }, |
| 167 |
childrenProp |
| 168 |
); |
| 169 |
}); |
| 170 |
} |
| 171 |
|
| 172 |
// packages/element/build-module/create-interpolate-element.mjs |
| 173 |
var indoc; |
| 174 |
var offset; |
| 175 |
var output; |
| 176 |
var stack; |
| 177 |
var tokenizer = /<(\/)?(\w+)\s*(\/)?>/g; |
| 178 |
function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) { |
| 179 |
return { |
| 180 |
element, |
| 181 |
tokenStart, |
| 182 |
tokenLength, |
| 183 |
prevOffset, |
| 184 |
leadingTextStart, |
| 185 |
children: [] |
| 186 |
}; |
| 187 |
} |
| 188 |
function createInterpolateElement(interpolatedString, conversionMap) { |
| 189 |
indoc = interpolatedString; |
| 190 |
offset = 0; |
| 191 |
output = []; |
| 192 |
stack = []; |
| 193 |
tokenizer.lastIndex = 0; |
| 194 |
if (!isValidConversionMap(conversionMap)) { |
| 195 |
throw new TypeError( |
| 196 |
"The conversionMap provided is not valid. It must be an object with values that are React Elements" |
| 197 |
); |
| 198 |
} |
| 199 |
do { |
| 200 |
} while (proceed(conversionMap)); |
| 201 |
return (0, import_react.createElement)(import_react.Fragment, null, ...output); |
| 202 |
} |
| 203 |
var isValidConversionMap = (conversionMap) => { |
| 204 |
const isObject2 = typeof conversionMap === "object" && conversionMap !== null; |
| 205 |
const values = isObject2 && Object.values(conversionMap); |
| 206 |
return isObject2 && values.length > 0 && values.every((element) => (0, import_react.isValidElement)(element)); |
| 207 |
}; |
| 208 |
function proceed(conversionMap) { |
| 209 |
const next = nextToken(); |
| 210 |
const [tokenType, name, startOffset, tokenLength] = next; |
| 211 |
const stackDepth = stack.length; |
| 212 |
const leadingTextStart = startOffset > offset ? offset : null; |
| 213 |
if (name && !conversionMap[name]) { |
| 214 |
addText(); |
| 215 |
return false; |
| 216 |
} |
| 217 |
switch (tokenType) { |
| 218 |
case "no-more-tokens": |
| 219 |
if (stackDepth !== 0) { |
| 220 |
const { leadingTextStart: stackLeadingText, tokenStart } = stack.pop(); |
| 221 |
output.push(indoc.substr(stackLeadingText, tokenStart)); |
| 222 |
} |
| 223 |
addText(); |
| 224 |
return false; |
| 225 |
case "self-closed": |
| 226 |
if (0 === stackDepth) { |
| 227 |
if (null !== leadingTextStart) { |
| 228 |
output.push( |
| 229 |
indoc.substr( |
| 230 |
leadingTextStart, |
| 231 |
startOffset - leadingTextStart |
| 232 |
) |
| 233 |
); |
| 234 |
} |
| 235 |
output.push(conversionMap[name]); |
| 236 |
offset = startOffset + tokenLength; |
| 237 |
return true; |
| 238 |
} |
| 239 |
addChild( |
| 240 |
createFrame(conversionMap[name], startOffset, tokenLength) |
| 241 |
); |
| 242 |
offset = startOffset + tokenLength; |
| 243 |
return true; |
| 244 |
case "opener": |
| 245 |
stack.push( |
| 246 |
createFrame( |
| 247 |
conversionMap[name], |
| 248 |
startOffset, |
| 249 |
tokenLength, |
| 250 |
startOffset + tokenLength, |
| 251 |
leadingTextStart |
| 252 |
) |
| 253 |
); |
| 254 |
offset = startOffset + tokenLength; |
| 255 |
return true; |
| 256 |
case "closer": |
| 257 |
if (1 === stackDepth) { |
| 258 |
closeOuterElement(startOffset); |
| 259 |
offset = startOffset + tokenLength; |
| 260 |
return true; |
| 261 |
} |
| 262 |
const stackTop = stack.pop(); |
| 263 |
const text = indoc.substr( |
| 264 |
stackTop.prevOffset, |
| 265 |
startOffset - stackTop.prevOffset |
| 266 |
); |
| 267 |
stackTop.children.push(text); |
| 268 |
stackTop.prevOffset = startOffset + tokenLength; |
| 269 |
const frame = createFrame( |
| 270 |
stackTop.element, |
| 271 |
stackTop.tokenStart, |
| 272 |
stackTop.tokenLength, |
| 273 |
startOffset + tokenLength |
| 274 |
); |
| 275 |
frame.children = stackTop.children; |
| 276 |
addChild(frame); |
| 277 |
offset = startOffset + tokenLength; |
| 278 |
return true; |
| 279 |
default: |
| 280 |
addText(); |
| 281 |
return false; |
| 282 |
} |
| 283 |
} |
| 284 |
function nextToken() { |
| 285 |
const matches = tokenizer.exec(indoc); |
| 286 |
if (null === matches) { |
| 287 |
return ["no-more-tokens"]; |
| 288 |
} |
| 289 |
const startedAt = matches.index; |
| 290 |
const [match, isClosing, name, isSelfClosed] = matches; |
| 291 |
const length = match.length; |
| 292 |
if (isSelfClosed) { |
| 293 |
return ["self-closed", name, startedAt, length]; |
| 294 |
} |
| 295 |
if (isClosing) { |
| 296 |
return ["closer", name, startedAt, length]; |
| 297 |
} |
| 298 |
return ["opener", name, startedAt, length]; |
| 299 |
} |
| 300 |
function addText() { |
| 301 |
const length = indoc.length - offset; |
| 302 |
if (0 === length) { |
| 303 |
return; |
| 304 |
} |
| 305 |
output.push(indoc.substr(offset, length)); |
| 306 |
} |
| 307 |
function addChild(frame) { |
| 308 |
const { element, tokenStart, tokenLength, prevOffset, children } = frame; |
| 309 |
const parent = stack[stack.length - 1]; |
| 310 |
const text = indoc.substr( |
| 311 |
parent.prevOffset, |
| 312 |
tokenStart - parent.prevOffset |
| 313 |
); |
| 314 |
if (text) { |
| 315 |
parent.children.push(text); |
| 316 |
} |
| 317 |
parent.children.push((0, import_react.cloneElement)(element, null, ...children)); |
| 318 |
parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength; |
| 319 |
} |
| 320 |
function closeOuterElement(endOffset) { |
| 321 |
const { element, leadingTextStart, prevOffset, tokenStart, children } = stack.pop(); |
| 322 |
const text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset); |
| 323 |
if (text) { |
| 324 |
children.push(text); |
| 325 |
} |
| 326 |
if (null !== leadingTextStart) { |
| 327 |
output.push( |
| 328 |
indoc.substr(leadingTextStart, tokenStart - leadingTextStart) |
| 329 |
); |
| 330 |
} |
| 331 |
output.push((0, import_react.cloneElement)(element, null, ...children)); |
| 332 |
} |
| 333 |
var create_interpolate_element_default = createInterpolateElement; |
| 334 |
|
| 335 |
// packages/element/build-module/react-platform.mjs |
| 336 |
var import_react_dom = __toESM(require_react_dom(), 1); |
| 337 |
var import_client = __toESM(require_client(), 1); |
| 338 |
|
| 339 |
// packages/element/build-module/utils.mjs |
| 340 |
var isEmptyElement = (element) => { |
| 341 |
if (typeof element === "number") { |
| 342 |
return false; |
| 343 |
} |
| 344 |
if (typeof element?.valueOf() === "string" || Array.isArray(element)) { |
| 345 |
return !element.length; |
| 346 |
} |
| 347 |
return !element; |
| 348 |
}; |
| 349 |
|
| 350 |
// packages/element/build-module/platform.mjs |
| 351 |
var Platform = { |
| 352 |
/** Platform identifier. Will always be `'web'` in this module. */ |
| 353 |
OS: "web", |
| 354 |
/** |
| 355 |
* Select a value based on the platform. |
| 356 |
* |
| 357 |
* @template T |
| 358 |
* @param spec - Object with optional platform-specific values. |
| 359 |
* @return The selected value. |
| 360 |
*/ |
| 361 |
select(spec) { |
| 362 |
return "web" in spec ? spec.web : spec.default; |
| 363 |
}, |
| 364 |
/** Whether the platform is web */ |
| 365 |
isWeb: true |
| 366 |
}; |
| 367 |
var platform_default = Platform; |
| 368 |
|
| 369 |
// node_modules/is-plain-object/dist/is-plain-object.mjs |
| 370 |
function isObject(o) { |
| 371 |
return Object.prototype.toString.call(o) === "[object Object]"; |
| 372 |
} |
| 373 |
function isPlainObject(o) { |
| 374 |
var ctor, prot; |
| 375 |
if (isObject(o) === false) return false; |
| 376 |
ctor = o.constructor; |
| 377 |
if (ctor === void 0) return true; |
| 378 |
prot = ctor.prototype; |
| 379 |
if (isObject(prot) === false) return false; |
| 380 |
if (prot.hasOwnProperty("isPrototypeOf") === false) { |
| 381 |
return false; |
| 382 |
} |
| 383 |
return true; |
| 384 |
} |
| 385 |
|
| 386 |
// node_modules/tslib/tslib.es6.mjs |
| 387 |
var __assign = function() { |
| 388 |
__assign = Object.assign || function __assign2(t) { |
| 389 |
for (var s, i = 1, n = arguments.length; i < n; i++) { |
| 390 |
s = arguments[i]; |
| 391 |
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; |
| 392 |
} |
| 393 |
return t; |
| 394 |
}; |
| 395 |
return __assign.apply(this, arguments); |
| 396 |
}; |
| 397 |
|
| 398 |
// node_modules/lower-case/dist.es2015/index.js |
| 399 |
function lowerCase(str) { |
| 400 |
return str.toLowerCase(); |
| 401 |
} |
| 402 |
|
| 403 |
// node_modules/no-case/dist.es2015/index.js |
| 404 |
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; |
| 405 |
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; |
| 406 |
function noCase(input, options) { |
| 407 |
if (options === void 0) { |
| 408 |
options = {}; |
| 409 |
} |
| 410 |
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; |
| 411 |
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); |
| 412 |
var start = 0; |
| 413 |
var end = result.length; |
| 414 |
while (result.charAt(start) === "\0") |
| 415 |
start++; |
| 416 |
while (result.charAt(end - 1) === "\0") |
| 417 |
end--; |
| 418 |
return result.slice(start, end).split("\0").map(transform).join(delimiter); |
| 419 |
} |
| 420 |
function replace(input, re, value) { |
| 421 |
if (re instanceof RegExp) |
| 422 |
return input.replace(re, value); |
| 423 |
return re.reduce(function(input2, re2) { |
| 424 |
return input2.replace(re2, value); |
| 425 |
}, input); |
| 426 |
} |
| 427 |
|
| 428 |
// node_modules/dot-case/dist.es2015/index.js |
| 429 |
function dotCase(input, options) { |
| 430 |
if (options === void 0) { |
| 431 |
options = {}; |
| 432 |
} |
| 433 |
return noCase(input, __assign({ delimiter: "." }, options)); |
| 434 |
} |
| 435 |
|
| 436 |
// node_modules/param-case/dist.es2015/index.js |
| 437 |
function paramCase(input, options) { |
| 438 |
if (options === void 0) { |
| 439 |
options = {}; |
| 440 |
} |
| 441 |
return dotCase(input, __assign({ delimiter: "-" }, options)); |
| 442 |
} |
| 443 |
|
| 444 |
// packages/element/build-module/serialize.mjs |
| 445 |
var import_escape_html = __toESM(require_escape_html(), 1); |
| 446 |
|
| 447 |
// packages/element/build-module/raw-html.mjs |
| 448 |
function RawHTML({ children, ...props }) { |
| 449 |
let rawHtml = ""; |
| 450 |
import_react.Children.toArray(children).forEach((child) => { |
| 451 |
if (typeof child === "string" && child.trim() !== "") { |
| 452 |
rawHtml += child; |
| 453 |
} |
| 454 |
}); |
| 455 |
return (0, import_react.createElement)("div", { |
| 456 |
dangerouslySetInnerHTML: { __html: rawHtml }, |
| 457 |
...props |
| 458 |
}); |
| 459 |
} |
| 460 |
|
| 461 |
// packages/element/build-module/serialize.mjs |
| 462 |
var Context = (0, import_react.createContext)(void 0); |
| 463 |
Context.displayName = "ElementContext"; |
| 464 |
var { Provider, Consumer } = Context; |
| 465 |
var ForwardRef = (0, import_react.forwardRef)(() => { |
| 466 |
return null; |
| 467 |
}); |
| 468 |
var ATTRIBUTES_TYPES = /* @__PURE__ */ new Set(["string", "boolean", "number"]); |
| 469 |
var SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([ |
| 470 |
"area", |
| 471 |
"base", |
| 472 |
"br", |
| 473 |
"col", |
| 474 |
"command", |
| 475 |
"embed", |
| 476 |
"hr", |
| 477 |
"img", |
| 478 |
"input", |
| 479 |
"keygen", |
| 480 |
"link", |
| 481 |
"meta", |
| 482 |
"param", |
| 483 |
"source", |
| 484 |
"track", |
| 485 |
"wbr" |
| 486 |
]); |
| 487 |
var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([ |
| 488 |
"allowfullscreen", |
| 489 |
"allowpaymentrequest", |
| 490 |
"allowusermedia", |
| 491 |
"async", |
| 492 |
"autofocus", |
| 493 |
"autoplay", |
| 494 |
"checked", |
| 495 |
"controls", |
| 496 |
"default", |
| 497 |
"defer", |
| 498 |
"disabled", |
| 499 |
"download", |
| 500 |
"formnovalidate", |
| 501 |
"hidden", |
| 502 |
"ismap", |
| 503 |
"itemscope", |
| 504 |
"loop", |
| 505 |
"multiple", |
| 506 |
"muted", |
| 507 |
"nomodule", |
| 508 |
"novalidate", |
| 509 |
"open", |
| 510 |
"playsinline", |
| 511 |
"readonly", |
| 512 |
"required", |
| 513 |
"reversed", |
| 514 |
"selected", |
| 515 |
"typemustmatch" |
| 516 |
]); |
| 517 |
var ENUMERATED_ATTRIBUTES = /* @__PURE__ */ new Set([ |
| 518 |
"autocapitalize", |
| 519 |
"autocomplete", |
| 520 |
"charset", |
| 521 |
"contenteditable", |
| 522 |
"crossorigin", |
| 523 |
"decoding", |
| 524 |
"dir", |
| 525 |
"draggable", |
| 526 |
"enctype", |
| 527 |
"formenctype", |
| 528 |
"formmethod", |
| 529 |
"http-equiv", |
| 530 |
"inputmode", |
| 531 |
"kind", |
| 532 |
"method", |
| 533 |
"preload", |
| 534 |
"scope", |
| 535 |
"shape", |
| 536 |
"spellcheck", |
| 537 |
"translate", |
| 538 |
"type", |
| 539 |
"wrap" |
| 540 |
]); |
| 541 |
var CSS_PROPERTIES_SUPPORTS_UNITLESS = /* @__PURE__ */ new Set([ |
| 542 |
"animation", |
| 543 |
"animationIterationCount", |
| 544 |
"baselineShift", |
| 545 |
"borderImageOutset", |
| 546 |
"borderImageSlice", |
| 547 |
"borderImageWidth", |
| 548 |
"columnCount", |
| 549 |
"cx", |
| 550 |
"cy", |
| 551 |
"fillOpacity", |
| 552 |
"flexGrow", |
| 553 |
"flexShrink", |
| 554 |
"floodOpacity", |
| 555 |
"fontWeight", |
| 556 |
"gridColumnEnd", |
| 557 |
"gridColumnStart", |
| 558 |
"gridRowEnd", |
| 559 |
"gridRowStart", |
| 560 |
"lineHeight", |
| 561 |
"opacity", |
| 562 |
"order", |
| 563 |
"orphans", |
| 564 |
"r", |
| 565 |
"rx", |
| 566 |
"ry", |
| 567 |
"shapeImageThreshold", |
| 568 |
"stopOpacity", |
| 569 |
"strokeDasharray", |
| 570 |
"strokeDashoffset", |
| 571 |
"strokeMiterlimit", |
| 572 |
"strokeOpacity", |
| 573 |
"strokeWidth", |
| 574 |
"tabSize", |
| 575 |
"widows", |
| 576 |
"x", |
| 577 |
"y", |
| 578 |
"zIndex", |
| 579 |
"zoom" |
| 580 |
]); |
| 581 |
function hasPrefix(string, prefixes) { |
| 582 |
return prefixes.some((prefix) => string.indexOf(prefix) === 0); |
| 583 |
} |
| 584 |
function isInternalAttribute(attribute) { |
| 585 |
return "key" === attribute || "children" === attribute; |
| 586 |
} |
| 587 |
function getNormalAttributeValue(attribute, value) { |
| 588 |
switch (attribute) { |
| 589 |
case "style": |
| 590 |
return renderStyle(value); |
| 591 |
} |
| 592 |
return value; |
| 593 |
} |
| 594 |
var SVG_ATTRIBUTE_WITH_DASHES_LIST = [ |
| 595 |
"accentHeight", |
| 596 |
"alignmentBaseline", |
| 597 |
"arabicForm", |
| 598 |
"baselineShift", |
| 599 |
"capHeight", |
| 600 |
"clipPath", |
| 601 |
"clipRule", |
| 602 |
"colorInterpolation", |
| 603 |
"colorInterpolationFilters", |
| 604 |
"colorProfile", |
| 605 |
"colorRendering", |
| 606 |
"dominantBaseline", |
| 607 |
"enableBackground", |
| 608 |
"fillOpacity", |
| 609 |
"fillRule", |
| 610 |
"floodColor", |
| 611 |
"floodOpacity", |
| 612 |
"fontFamily", |
| 613 |
"fontSize", |
| 614 |
"fontSizeAdjust", |
| 615 |
"fontStretch", |
| 616 |
"fontStyle", |
| 617 |
"fontVariant", |
| 618 |
"fontWeight", |
| 619 |
"glyphName", |
| 620 |
"glyphOrientationHorizontal", |
| 621 |
"glyphOrientationVertical", |
| 622 |
"horizAdvX", |
| 623 |
"horizOriginX", |
| 624 |
"imageRendering", |
| 625 |
"letterSpacing", |
| 626 |
"lightingColor", |
| 627 |
"markerEnd", |
| 628 |
"markerMid", |
| 629 |
"markerStart", |
| 630 |
"overlinePosition", |
| 631 |
"overlineThickness", |
| 632 |
"paintOrder", |
| 633 |
"panose1", |
| 634 |
"pointerEvents", |
| 635 |
"renderingIntent", |
| 636 |
"shapeRendering", |
| 637 |
"stopColor", |
| 638 |
"stopOpacity", |
| 639 |
"strikethroughPosition", |
| 640 |
"strikethroughThickness", |
| 641 |
"strokeDasharray", |
| 642 |
"strokeDashoffset", |
| 643 |
"strokeLinecap", |
| 644 |
"strokeLinejoin", |
| 645 |
"strokeMiterlimit", |
| 646 |
"strokeOpacity", |
| 647 |
"strokeWidth", |
| 648 |
"textAnchor", |
| 649 |
"textDecoration", |
| 650 |
"textRendering", |
| 651 |
"underlinePosition", |
| 652 |
"underlineThickness", |
| 653 |
"unicodeBidi", |
| 654 |
"unicodeRange", |
| 655 |
"unitsPerEm", |
| 656 |
"vAlphabetic", |
| 657 |
"vHanging", |
| 658 |
"vIdeographic", |
| 659 |
"vMathematical", |
| 660 |
"vectorEffect", |
| 661 |
"vertAdvY", |
| 662 |
"vertOriginX", |
| 663 |
"vertOriginY", |
| 664 |
"wordSpacing", |
| 665 |
"writingMode", |
| 666 |
"xmlnsXlink", |
| 667 |
"xHeight" |
| 668 |
].reduce( |
| 669 |
(map, attribute) => { |
| 670 |
map[attribute.toLowerCase()] = attribute; |
| 671 |
return map; |
| 672 |
}, |
| 673 |
{} |
| 674 |
); |
| 675 |
var CASE_SENSITIVE_SVG_ATTRIBUTES = [ |
| 676 |
"allowReorder", |
| 677 |
"attributeName", |
| 678 |
"attributeType", |
| 679 |
"autoReverse", |
| 680 |
"baseFrequency", |
| 681 |
"baseProfile", |
| 682 |
"calcMode", |
| 683 |
"clipPathUnits", |
| 684 |
"contentScriptType", |
| 685 |
"contentStyleType", |
| 686 |
"diffuseConstant", |
| 687 |
"edgeMode", |
| 688 |
"externalResourcesRequired", |
| 689 |
"filterRes", |
| 690 |
"filterUnits", |
| 691 |
"glyphRef", |
| 692 |
"gradientTransform", |
| 693 |
"gradientUnits", |
| 694 |
"kernelMatrix", |
| 695 |
"kernelUnitLength", |
| 696 |
"keyPoints", |
| 697 |
"keySplines", |
| 698 |
"keyTimes", |
| 699 |
"lengthAdjust", |
| 700 |
"limitingConeAngle", |
| 701 |
"markerHeight", |
| 702 |
"markerUnits", |
| 703 |
"markerWidth", |
| 704 |
"maskContentUnits", |
| 705 |
"maskUnits", |
| 706 |
"numOctaves", |
| 707 |
"pathLength", |
| 708 |
"patternContentUnits", |
| 709 |
"patternTransform", |
| 710 |
"patternUnits", |
| 711 |
"pointsAtX", |
| 712 |
"pointsAtY", |
| 713 |
"pointsAtZ", |
| 714 |
"preserveAlpha", |
| 715 |
"preserveAspectRatio", |
| 716 |
"primitiveUnits", |
| 717 |
"refX", |
| 718 |
"refY", |
| 719 |
"repeatCount", |
| 720 |
"repeatDur", |
| 721 |
"requiredExtensions", |
| 722 |
"requiredFeatures", |
| 723 |
"specularConstant", |
| 724 |
"specularExponent", |
| 725 |
"spreadMethod", |
| 726 |
"startOffset", |
| 727 |
"stdDeviation", |
| 728 |
"stitchTiles", |
| 729 |
"suppressContentEditableWarning", |
| 730 |
"suppressHydrationWarning", |
| 731 |
"surfaceScale", |
| 732 |
"systemLanguage", |
| 733 |
"tableValues", |
| 734 |
"targetX", |
| 735 |
"targetY", |
| 736 |
"textLength", |
| 737 |
"viewBox", |
| 738 |
"viewTarget", |
| 739 |
"xChannelSelector", |
| 740 |
"yChannelSelector" |
| 741 |
].reduce( |
| 742 |
(map, attribute) => { |
| 743 |
map[attribute.toLowerCase()] = attribute; |
| 744 |
return map; |
| 745 |
}, |
| 746 |
{} |
| 747 |
); |
| 748 |
var SVG_ATTRIBUTES_WITH_COLONS = [ |
| 749 |
"xlink:actuate", |
| 750 |
"xlink:arcrole", |
| 751 |
"xlink:href", |
| 752 |
"xlink:role", |
| 753 |
"xlink:show", |
| 754 |
"xlink:title", |
| 755 |
"xlink:type", |
| 756 |
"xml:base", |
| 757 |
"xml:lang", |
| 758 |
"xml:space", |
| 759 |
"xmlns:xlink" |
| 760 |
].reduce( |
| 761 |
(map, attribute) => { |
| 762 |
map[attribute.replace(":", "").toLowerCase()] = attribute; |
| 763 |
return map; |
| 764 |
}, |
| 765 |
{} |
| 766 |
); |
| 767 |
function getNormalAttributeName(attribute) { |
| 768 |
switch (attribute) { |
| 769 |
case "htmlFor": |
| 770 |
return "for"; |
| 771 |
case "className": |
| 772 |
return "class"; |
| 773 |
} |
| 774 |
const attributeLowerCase = attribute.toLowerCase(); |
| 775 |
if (CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]) { |
| 776 |
return CASE_SENSITIVE_SVG_ATTRIBUTES[attributeLowerCase]; |
| 777 |
} else if (SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase]) { |
| 778 |
return paramCase( |
| 779 |
SVG_ATTRIBUTE_WITH_DASHES_LIST[attributeLowerCase] |
| 780 |
); |
| 781 |
} else if (SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]) { |
| 782 |
return SVG_ATTRIBUTES_WITH_COLONS[attributeLowerCase]; |
| 783 |
} |
| 784 |
return attributeLowerCase; |
| 785 |
} |
| 786 |
function getNormalStylePropertyName(property) { |
| 787 |
if (property.startsWith("--")) { |
| 788 |
return property; |
| 789 |
} |
| 790 |
if (hasPrefix(property, ["ms", "O", "Moz", "Webkit"])) { |
| 791 |
return "-" + paramCase(property); |
| 792 |
} |
| 793 |
return paramCase(property); |
| 794 |
} |
| 795 |
function getNormalStylePropertyValue(property, value) { |
| 796 |
if (typeof value === "number" && 0 !== value && !hasPrefix(property, ["--"]) && !CSS_PROPERTIES_SUPPORTS_UNITLESS.has(property)) { |
| 797 |
return value + "px"; |
| 798 |
} |
| 799 |
return value; |
| 800 |
} |
| 801 |
function renderElement(element, context, legacyContext = {}) { |
| 802 |
if (null === element || void 0 === element || false === element) { |
| 803 |
return ""; |
| 804 |
} |
| 805 |
if (Array.isArray(element)) { |
| 806 |
return renderChildren(element, context, legacyContext); |
| 807 |
} |
| 808 |
switch (typeof element) { |
| 809 |
case "string": |
| 810 |
return (0, import_escape_html.escapeHTML)(element); |
| 811 |
case "number": |
| 812 |
return element.toString(); |
| 813 |
} |
| 814 |
const { type, props } = element; |
| 815 |
switch (type) { |
| 816 |
case import_react.StrictMode: |
| 817 |
case import_react.Fragment: |
| 818 |
return renderChildren(props.children, context, legacyContext); |
| 819 |
case RawHTML: |
| 820 |
const { children, ...wrapperProps } = props; |
| 821 |
return renderNativeComponent( |
| 822 |
!Object.keys(wrapperProps).length ? null : "div", |
| 823 |
{ |
| 824 |
...wrapperProps, |
| 825 |
dangerouslySetInnerHTML: { __html: children } |
| 826 |
}, |
| 827 |
context, |
| 828 |
legacyContext |
| 829 |
); |
| 830 |
} |
| 831 |
switch (typeof type) { |
| 832 |
case "string": |
| 833 |
return renderNativeComponent(type, props, context, legacyContext); |
| 834 |
case "function": |
| 835 |
if (type.prototype && typeof type.prototype.render === "function") { |
| 836 |
return renderComponent(type, props, context, legacyContext); |
| 837 |
} |
| 838 |
return renderElement( |
| 839 |
type(props, legacyContext), |
| 840 |
context, |
| 841 |
legacyContext |
| 842 |
); |
| 843 |
} |
| 844 |
switch (type && type.$$typeof) { |
| 845 |
case Provider.$$typeof: |
| 846 |
return renderChildren(props.children, props.value, legacyContext); |
| 847 |
case Consumer.$$typeof: |
| 848 |
return renderElement( |
| 849 |
props.children(context || type._currentValue), |
| 850 |
context, |
| 851 |
legacyContext |
| 852 |
); |
| 853 |
case ForwardRef.$$typeof: |
| 854 |
return renderElement( |
| 855 |
type.render(props), |
| 856 |
context, |
| 857 |
legacyContext |
| 858 |
); |
| 859 |
} |
| 860 |
return ""; |
| 861 |
} |
| 862 |
function renderNativeComponent(type, props, context, legacyContext = {}) { |
| 863 |
let content = ""; |
| 864 |
if (type === "textarea" && props.hasOwnProperty("value")) { |
| 865 |
content = renderChildren(props.value, context, legacyContext); |
| 866 |
const { value, ...restProps } = props; |
| 867 |
props = restProps; |
| 868 |
} else if (props.dangerouslySetInnerHTML && typeof props.dangerouslySetInnerHTML.__html === "string") { |
| 869 |
content = props.dangerouslySetInnerHTML.__html; |
| 870 |
} else if (typeof props.children !== "undefined") { |
| 871 |
content = renderChildren(props.children, context, legacyContext); |
| 872 |
} |
| 873 |
if (!type) { |
| 874 |
return content; |
| 875 |
} |
| 876 |
const attributes = renderAttributes(props); |
| 877 |
if (SELF_CLOSING_TAGS.has(type)) { |
| 878 |
return "<" + type + attributes + "/>"; |
| 879 |
} |
| 880 |
return "<" + type + attributes + ">" + content + "</" + type + ">"; |
| 881 |
} |
| 882 |
function renderComponent(Component2, props, context, legacyContext = {}) { |
| 883 |
const instance = new Component2(props, legacyContext); |
| 884 |
if (typeof instance.getChildContext === "function") { |
| 885 |
Object.assign(legacyContext, instance.getChildContext()); |
| 886 |
} |
| 887 |
const html = renderElement(instance.render(), context, legacyContext); |
| 888 |
return html; |
| 889 |
} |
| 890 |
function renderChildren(children, context, legacyContext = {}) { |
| 891 |
let result = ""; |
| 892 |
const childrenArray = Array.isArray(children) ? children : [children]; |
| 893 |
for (let i = 0; i < childrenArray.length; i++) { |
| 894 |
const child = childrenArray[i]; |
| 895 |
result += renderElement(child, context, legacyContext); |
| 896 |
} |
| 897 |
return result; |
| 898 |
} |
| 899 |
function renderAttributes(props) { |
| 900 |
let result = ""; |
| 901 |
for (const key in props) { |
| 902 |
const attribute = getNormalAttributeName(key); |
| 903 |
if (!(0, import_escape_html.isValidAttributeName)(attribute)) { |
| 904 |
continue; |
| 905 |
} |
| 906 |
let value = getNormalAttributeValue(key, props[key]); |
| 907 |
if (!ATTRIBUTES_TYPES.has(typeof value)) { |
| 908 |
continue; |
| 909 |
} |
| 910 |
if (isInternalAttribute(key)) { |
| 911 |
continue; |
| 912 |
} |
| 913 |
const isBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attribute); |
| 914 |
if (isBooleanAttribute && value === false) { |
| 915 |
continue; |
| 916 |
} |
| 917 |
const isMeaningfulAttribute = isBooleanAttribute || hasPrefix(key, ["data-", "aria-"]) || ENUMERATED_ATTRIBUTES.has(attribute); |
| 918 |
if (typeof value === "boolean" && !isMeaningfulAttribute) { |
| 919 |
continue; |
| 920 |
} |
| 921 |
result += " " + attribute; |
| 922 |
if (isBooleanAttribute) { |
| 923 |
continue; |
| 924 |
} |
| 925 |
if (typeof value === "string") { |
| 926 |
value = (0, import_escape_html.escapeAttribute)(value); |
| 927 |
} |
| 928 |
result += '="' + value + '"'; |
| 929 |
} |
| 930 |
return result; |
| 931 |
} |
| 932 |
function renderStyle(style) { |
| 933 |
if (!isPlainObject(style)) { |
| 934 |
return style; |
| 935 |
} |
| 936 |
let result; |
| 937 |
const styleObj = style; |
| 938 |
for (const property in styleObj) { |
| 939 |
const value = styleObj[property]; |
| 940 |
if (null === value || void 0 === value) { |
| 941 |
continue; |
| 942 |
} |
| 943 |
if (result) { |
| 944 |
result += ";"; |
| 945 |
} else { |
| 946 |
result = ""; |
| 947 |
} |
| 948 |
const normalName = getNormalStylePropertyName(property); |
| 949 |
const normalValue = getNormalStylePropertyValue(property, value); |
| 950 |
result += normalName + ":" + normalValue; |
| 951 |
} |
| 952 |
return result; |
| 953 |
} |
| 954 |
var serialize_default = renderElement; |
| 955 |
return __toCommonJS(index_exports); |
| 956 |
})(); |
| 957 |
/*! Bundled license information: |
| 958 |
|
| 959 |
is-plain-object/dist/is-plain-object.mjs: |
| 960 |
(*! |
| 961 |
* is-plain-object <https://github.com/jonschlinkert/is-plain-object> |
| 962 |
* |
| 963 |
* Copyright (c) 2014-2017, Jon Schlinkert. |
| 964 |
* Released under the MIT License. |
| 965 |
*) |
| 966 |
*/ |
| 967 |
//# sourceMappingURL=index.js.map |
| 968 |
|