diff --git a/README.md b/README.md index 170b055..07b9f96 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The crate aims to enable server side rendering on rust servers in the simplest a It uses an embedded version of the [V8](https://v8.dev/) javascript engine (rusty_v8) to parse and evaluate a built bundle file and return a string with the rendered html. -Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 17](https://react.dev/) - Check the examples folder. +Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 18](https://react.dev/) - Check the examples folder. > Check here the benchmark results. diff --git a/examples/vite-react/package.json b/examples/vite-react/package.json index 928402f..b11c005 100644 --- a/examples/vite-react/package.json +++ b/examples/vite-react/package.json @@ -11,8 +11,9 @@ "preview": "vite preview" }, "dependencies": { - "react": "^17.0.2", - "react-dom": "^17.0.2" + "fast-text-encoding": "^1.0.6", + "react": "^18.2.0", + "react-dom": "^18.2.0" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.2.3", diff --git a/examples/vite-react/pnpm-lock.yaml b/examples/vite-react/pnpm-lock.yaml index 73b921b..c99050e 100644 --- a/examples/vite-react/pnpm-lock.yaml +++ b/examples/vite-react/pnpm-lock.yaml @@ -5,12 +5,15 @@ settings: excludeLinksFromLockfile: false dependencies: + fast-text-encoding: + specifier: ^1.0.6 + version: 1.0.6 react: - specifier: ^17.0.2 - version: 17.0.2 + specifier: ^18.2.0 + version: 18.2.0 react-dom: - specifier: ^17.0.2 - version: 17.0.2(react@17.0.2) + specifier: ^18.2.0 + version: 18.2.0(react@18.2.0) devDependencies: '@rollup/plugin-node-resolve': @@ -1104,6 +1107,10 @@ packages: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} dev: true + /fast-text-encoding@1.0.6: + resolution: {integrity: sha512-VhXlQgj9ioXCqGstD37E/HBeqEGV/qOD/kmbVG8h5xKBYvM1L3lR1Zn4555cQ8GkYbJa8aJSipLPndE1k6zK2w==} + dev: false + /fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} dependencies: @@ -1395,11 +1402,6 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true - /object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - dev: false - /once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -1495,23 +1497,21 @@ packages: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true - /react-dom@17.0.2(react@17.0.2): - resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} + /react-dom@18.2.0(react@18.2.0): + resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} peerDependencies: - react: 17.0.2 + react: ^18.2.0 dependencies: loose-envify: 1.4.0 - object-assign: 4.1.1 - react: 17.0.2 - scheduler: 0.20.2 + react: 18.2.0 + scheduler: 0.23.0 dev: false - /react@17.0.2: - resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==} + /react@18.2.0: + resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} engines: {node: '>=0.10.0'} dependencies: loose-envify: 1.4.0 - object-assign: 4.1.1 dev: false /resolve-from@4.0.0: @@ -1569,11 +1569,10 @@ packages: queue-microtask: 1.2.3 dev: true - /scheduler@0.20.2: - resolution: {integrity: sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==} + /scheduler@0.23.0: + resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} dependencies: loose-envify: 1.4.0 - object-assign: 4.1.1 dev: false /semver@7.6.0: diff --git a/examples/vite-react/src/server-entry.tsx b/examples/vite-react/src/server-entry.tsx index 793ee80..66f712e 100644 --- a/examples/vite-react/src/server-entry.tsx +++ b/examples/vite-react/src/server-entry.tsx @@ -1,3 +1,4 @@ +import "fast-text-encoding"; // Mandatory for React18 import { renderToString } from "react-dom/server"; import App from "./App"; diff --git a/src/lib.rs b/src/lib.rs index 9872c5a..b9f9e1f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ //! //! It uses an embedded version of the [V8](https://v8.dev/) javascript engine (rusty_v8) to parse and evaluate a built bundle file and return a string with the rendered html. //! -//! Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 17](https://react.dev/) - Check the examples folder. +//! Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 18](https://react.dev/) - Check the examples folder. //! //! > Check here the //! benchmarks results. diff --git a/tests/assets/react-18-iife.js b/tests/assets/react-18-iife.js new file mode 100644 index 0000000..f19640e --- /dev/null +++ b/tests/assets/react-18-iife.js @@ -0,0 +1,4777 @@ +(function (exports) { + "use strict"; + var commonjsGlobal = + typeof globalThis !== "undefined" + ? globalThis + : typeof window !== "undefined" + ? window + : typeof global !== "undefined" + ? global + : typeof self !== "undefined" + ? self + : {}; + var jsxRuntime = { exports: {} }; + var reactJsxRuntime_production_min = {}; + var react = { exports: {} }; + var react_production_min = {}; + /** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + var l$4 = Symbol.for("react.element"), + n$2 = Symbol.for("react.portal"), + p$3 = Symbol.for("react.fragment"), + q$1 = Symbol.for("react.strict_mode"), + r$1 = Symbol.for("react.profiler"), + t$2 = Symbol.for("react.provider"), + u$2 = Symbol.for("react.context"), + v$1 = Symbol.for("react.forward_ref"), + w$2 = Symbol.for("react.suspense"), + x$2 = Symbol.for("react.memo"), + y$2 = Symbol.for("react.lazy"), + z$1 = Symbol.iterator; + function A$1(a) { + if (null === a || "object" !== typeof a) return null; + a = (z$1 && a[z$1]) || a["@@iterator"]; + return "function" === typeof a ? a : null; + } + var B$2 = { + isMounted: function () { + return false; + }, + enqueueForceUpdate: function () {}, + enqueueReplaceState: function () {}, + enqueueSetState: function () {}, + }, + C$1 = Object.assign, + D$1 = {}; + function E$2(a, b, e) { + this.props = a; + this.context = b; + this.refs = D$1; + this.updater = e || B$2; + } + E$2.prototype.isReactComponent = {}; + E$2.prototype.setState = function (a, b) { + if ("object" !== typeof a && "function" !== typeof a && null != a) + throw Error( + "setState(...): takes an object of state variables to update or a function which returns an object of state variables.", + ); + this.updater.enqueueSetState(this, a, b, "setState"); + }; + E$2.prototype.forceUpdate = function (a) { + this.updater.enqueueForceUpdate(this, a, "forceUpdate"); + }; + function F$1() {} + F$1.prototype = E$2.prototype; + function G$1(a, b, e) { + this.props = a; + this.context = b; + this.refs = D$1; + this.updater = e || B$2; + } + var H$2 = (G$1.prototype = new F$1()); + H$2.constructor = G$1; + C$1(H$2, E$2.prototype); + H$2.isPureReactComponent = true; + var I$2 = Array.isArray, + J$2 = Object.prototype.hasOwnProperty, + K$2 = { current: null }, + L$2 = { key: true, ref: true, __self: true, __source: true }; + function M$2(a, b, e) { + var d, + c = {}, + k2 = null, + h = null; + if (null != b) + for (d in (void 0 !== b.ref && (h = b.ref), + void 0 !== b.key && (k2 = "" + b.key), + b)) + J$2.call(b, d) && !L$2.hasOwnProperty(d) && (c[d] = b[d]); + var g = arguments.length - 2; + if (1 === g) c.children = e; + else if (1 < g) { + for (var f2 = Array(g), m2 = 0; m2 < g; m2++) f2[m2] = arguments[m2 + 2]; + c.children = f2; + } + if (a && a.defaultProps) + for (d in ((g = a.defaultProps), g)) void 0 === c[d] && (c[d] = g[d]); + return { + $$typeof: l$4, + type: a, + key: k2, + ref: h, + props: c, + _owner: K$2.current, + }; + } + function N$2(a, b) { + return { + $$typeof: l$4, + type: a.type, + key: b, + ref: a.ref, + props: a.props, + _owner: a._owner, + }; + } + function O$2(a) { + return "object" === typeof a && null !== a && a.$$typeof === l$4; + } + function escape(a) { + var b = { "=": "=0", ":": "=2" }; + return ( + "$" + + a.replace(/[=:]/g, function (a2) { + return b[a2]; + }) + ); + } + var P$2 = /\/+/g; + function Q$2(a, b) { + return "object" === typeof a && null !== a && null != a.key + ? escape("" + a.key) + : b.toString(36); + } + function R$2(a, b, e, d, c) { + var k2 = typeof a; + if ("undefined" === k2 || "boolean" === k2) a = null; + var h = false; + if (null === a) h = true; + else + switch (k2) { + case "string": + case "number": + h = true; + break; + case "object": + switch (a.$$typeof) { + case l$4: + case n$2: + h = true; + } + } + if (h) + return ( + (h = a), + (c = c(h)), + (a = "" === d ? "." + Q$2(h, 0) : d), + I$2(c) + ? ((e = ""), + null != a && (e = a.replace(P$2, "$&/") + "/"), + R$2(c, b, e, "", function (a2) { + return a2; + })) + : null != c && + (O$2(c) && + (c = N$2( + c, + e + + (!c.key || (h && h.key === c.key) + ? "" + : ("" + c.key).replace(P$2, "$&/") + "/") + + a, + )), + b.push(c)), + 1 + ); + h = 0; + d = "" === d ? "." : d + ":"; + if (I$2(a)) + for (var g = 0; g < a.length; g++) { + k2 = a[g]; + var f2 = d + Q$2(k2, g); + h += R$2(k2, b, e, f2, c); + } + else if (((f2 = A$1(a)), "function" === typeof f2)) + for (a = f2.call(a), g = 0; !(k2 = a.next()).done; ) + (k2 = k2.value), (f2 = d + Q$2(k2, g++)), (h += R$2(k2, b, e, f2, c)); + else if ("object" === k2) + throw ( + ((b = String(a)), + Error( + "Objects are not valid as a React child (found: " + + ("[object Object]" === b + ? "object with keys {" + Object.keys(a).join(", ") + "}" + : b) + + "). If you meant to render a collection of children, use an array instead.", + )) + ); + return h; + } + function S$2(a, b, e) { + if (null == a) return a; + var d = [], + c = 0; + R$2(a, d, "", "", function (a2) { + return b.call(e, a2, c++); + }); + return d; + } + function T$2(a) { + if (-1 === a._status) { + var b = a._result; + b = b(); + b.then( + function (b2) { + if (0 === a._status || -1 === a._status) + (a._status = 1), (a._result = b2); + }, + function (b2) { + if (0 === a._status || -1 === a._status) + (a._status = 2), (a._result = b2); + }, + ); + -1 === a._status && ((a._status = 0), (a._result = b)); + } + if (1 === a._status) return a._result.default; + throw a._result; + } + var U$2 = { current: null }, + V$2 = { transition: null }, + W$2 = { + ReactCurrentDispatcher: U$2, + ReactCurrentBatchConfig: V$2, + ReactCurrentOwner: K$2, + }; + react_production_min.Children = { + map: S$2, + forEach: function (a, b, e) { + S$2( + a, + function () { + b.apply(this, arguments); + }, + e, + ); + }, + count: function (a) { + var b = 0; + S$2(a, function () { + b++; + }); + return b; + }, + toArray: function (a) { + return ( + S$2(a, function (a2) { + return a2; + }) || [] + ); + }, + only: function (a) { + if (!O$2(a)) + throw Error( + "React.Children.only expected to receive a single React element child.", + ); + return a; + }, + }; + react_production_min.Component = E$2; + react_production_min.Fragment = p$3; + react_production_min.Profiler = r$1; + react_production_min.PureComponent = G$1; + react_production_min.StrictMode = q$1; + react_production_min.Suspense = w$2; + react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W$2; + react_production_min.cloneElement = function (a, b, e) { + if (null === a || void 0 === a) + throw Error( + "React.cloneElement(...): The argument must be a React element, but you passed " + + a + + ".", + ); + var d = C$1({}, a.props), + c = a.key, + k2 = a.ref, + h = a._owner; + if (null != b) { + void 0 !== b.ref && ((k2 = b.ref), (h = K$2.current)); + void 0 !== b.key && (c = "" + b.key); + if (a.type && a.type.defaultProps) var g = a.type.defaultProps; + for (f2 in b) + J$2.call(b, f2) && + !L$2.hasOwnProperty(f2) && + (d[f2] = void 0 === b[f2] && void 0 !== g ? g[f2] : b[f2]); + } + var f2 = arguments.length - 2; + if (1 === f2) d.children = e; + else if (1 < f2) { + g = Array(f2); + for (var m2 = 0; m2 < f2; m2++) g[m2] = arguments[m2 + 2]; + d.children = g; + } + return { + $$typeof: l$4, + type: a.type, + key: c, + ref: k2, + props: d, + _owner: h, + }; + }; + react_production_min.createContext = function (a) { + a = { + $$typeof: u$2, + _currentValue: a, + _currentValue2: a, + _threadCount: 0, + Provider: null, + Consumer: null, + _defaultValue: null, + _globalName: null, + }; + a.Provider = { $$typeof: t$2, _context: a }; + return (a.Consumer = a); + }; + react_production_min.createElement = M$2; + react_production_min.createFactory = function (a) { + var b = M$2.bind(null, a); + b.type = a; + return b; + }; + react_production_min.createRef = function () { + return { current: null }; + }; + react_production_min.forwardRef = function (a) { + return { $$typeof: v$1, render: a }; + }; + react_production_min.isValidElement = O$2; + react_production_min.lazy = function (a) { + return { $$typeof: y$2, _payload: { _status: -1, _result: a }, _init: T$2 }; + }; + react_production_min.memo = function (a, b) { + return { $$typeof: x$2, type: a, compare: void 0 === b ? null : b }; + }; + react_production_min.startTransition = function (a) { + var b = V$2.transition; + V$2.transition = {}; + try { + a(); + } finally { + V$2.transition = b; + } + }; + react_production_min.unstable_act = function () { + throw Error("act(...) is not supported in production builds of React."); + }; + react_production_min.useCallback = function (a, b) { + return U$2.current.useCallback(a, b); + }; + react_production_min.useContext = function (a) { + return U$2.current.useContext(a); + }; + react_production_min.useDebugValue = function () {}; + react_production_min.useDeferredValue = function (a) { + return U$2.current.useDeferredValue(a); + }; + react_production_min.useEffect = function (a, b) { + return U$2.current.useEffect(a, b); + }; + react_production_min.useId = function () { + return U$2.current.useId(); + }; + react_production_min.useImperativeHandle = function (a, b, e) { + return U$2.current.useImperativeHandle(a, b, e); + }; + react_production_min.useInsertionEffect = function (a, b) { + return U$2.current.useInsertionEffect(a, b); + }; + react_production_min.useLayoutEffect = function (a, b) { + return U$2.current.useLayoutEffect(a, b); + }; + react_production_min.useMemo = function (a, b) { + return U$2.current.useMemo(a, b); + }; + react_production_min.useReducer = function (a, b, e) { + return U$2.current.useReducer(a, b, e); + }; + react_production_min.useRef = function (a) { + return U$2.current.useRef(a); + }; + react_production_min.useState = function (a) { + return U$2.current.useState(a); + }; + react_production_min.useSyncExternalStore = function (a, b, e) { + return U$2.current.useSyncExternalStore(a, b, e); + }; + react_production_min.useTransition = function () { + return U$2.current.useTransition(); + }; + react_production_min.version = "18.2.0"; + { + react.exports = react_production_min; + } + var reactExports = react.exports; + /** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + var f = reactExports, + k$1 = Symbol.for("react.element"), + l$3 = Symbol.for("react.fragment"), + m = Object.prototype.hasOwnProperty, + n$1 = + f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, + p$2 = { key: true, ref: true, __self: true, __source: true }; + function q(c, a, g) { + var b, + d = {}, + e = null, + h = null; + void 0 !== g && (e = "" + g); + void 0 !== a.key && (e = "" + a.key); + void 0 !== a.ref && (h = a.ref); + for (b in a) m.call(a, b) && !p$2.hasOwnProperty(b) && (d[b] = a[b]); + if (c && c.defaultProps) + for (b in ((a = c.defaultProps), a)) void 0 === d[b] && (d[b] = a[b]); + return { + $$typeof: k$1, + type: c, + key: e, + ref: h, + props: d, + _owner: n$1.current, + }; + } + reactJsxRuntime_production_min.Fragment = l$3; + reactJsxRuntime_production_min.jsx = q; + reactJsxRuntime_production_min.jsxs = q; + { + jsxRuntime.exports = reactJsxRuntime_production_min; + } + var jsxRuntimeExports = jsxRuntime.exports; + (function (scope) { + function B2(r2, e) { + var f2; + return ( + r2 instanceof Buffer + ? (f2 = r2) + : (f2 = Buffer.from(r2.buffer, r2.byteOffset, r2.byteLength)), + f2.toString(e) + ); + } + var w2 = function (r2) { + return Buffer.from(r2); + }; + function h(r2) { + for ( + var e = 0, + f2 = Math.min(256 * 256, r2.length + 1), + n2 = new Uint16Array(f2), + i = [], + o = 0; + ; + + ) { + var t2 = e < r2.length; + if (!t2 || o >= f2 - 1) { + var s2 = n2.subarray(0, o), + m2 = s2; + if ((i.push(String.fromCharCode.apply(null, m2)), !t2)) + return i.join(""); + (r2 = r2.subarray(e)), (e = 0), (o = 0); + } + var a = r2[e++]; + if ((a & 128) === 0) n2[o++] = a; + else if ((a & 224) === 192) { + var d = r2[e++] & 63; + n2[o++] = ((a & 31) << 6) | d; + } else if ((a & 240) === 224) { + var d = r2[e++] & 63, + l2 = r2[e++] & 63; + n2[o++] = ((a & 31) << 12) | (d << 6) | l2; + } else if ((a & 248) === 240) { + var d = r2[e++] & 63, + l2 = r2[e++] & 63, + R2 = r2[e++] & 63, + c = ((a & 7) << 18) | (d << 12) | (l2 << 6) | R2; + c > 65535 && + ((c -= 65536), + (n2[o++] = ((c >>> 10) & 1023) | 55296), + (c = 56320 | (c & 1023))), + (n2[o++] = c); + } + } + } + function F2(r2) { + for ( + var e = 0, + f2 = r2.length, + n2 = 0, + i = Math.max(32, f2 + (f2 >>> 1) + 7), + o = new Uint8Array((i >>> 3) << 3); + e < f2; + + ) { + var t2 = r2.charCodeAt(e++); + if (t2 >= 55296 && t2 <= 56319) { + if (e < f2) { + var s2 = r2.charCodeAt(e); + (s2 & 64512) === 56320 && + (++e, (t2 = ((t2 & 1023) << 10) + (s2 & 1023) + 65536)); + } + if (t2 >= 55296 && t2 <= 56319) continue; + } + if (n2 + 4 > o.length) { + (i += 8), (i *= 1 + (e / r2.length) * 2), (i = (i >>> 3) << 3); + var m2 = new Uint8Array(i); + m2.set(o), (o = m2); + } + if ((t2 & 4294967168) === 0) { + o[n2++] = t2; + continue; + } else if ((t2 & 4294965248) === 0) o[n2++] = ((t2 >>> 6) & 31) | 192; + else if ((t2 & 4294901760) === 0) + (o[n2++] = ((t2 >>> 12) & 15) | 224), + (o[n2++] = ((t2 >>> 6) & 63) | 128); + else if ((t2 & 4292870144) === 0) + (o[n2++] = ((t2 >>> 18) & 7) | 240), + (o[n2++] = ((t2 >>> 12) & 63) | 128), + (o[n2++] = ((t2 >>> 6) & 63) | 128); + else continue; + o[n2++] = (t2 & 63) | 128; + } + return o.slice ? o.slice(0, n2) : o.subarray(0, n2); + } + var u2 = "Failed to ", + p2 = function (r2, e, f2) { + if (r2) + throw new Error( + "" + .concat(u2) + .concat(e, ": the '") + .concat(f2, "' option is unsupported."), + ); + }; + var x2 = typeof Buffer == "function" && Buffer.from; + var A2 = x2 ? w2 : F2; + function v2() { + this.encoding = "utf-8"; + } + v2.prototype.encode = function (r2, e) { + return p2(e && e.stream, "encode", "stream"), A2(r2); + }; + function U2(r2) { + var e; + try { + var f2 = new Blob([r2], { type: "text/plain;charset=UTF-8" }); + e = URL.createObjectURL(f2); + var n2 = new XMLHttpRequest(); + return n2.open("GET", e, false), n2.send(), n2.responseText; + } finally { + e && URL.revokeObjectURL(e); + } + } + var O2 = + !x2 && + typeof Blob == "function" && + typeof URL == "function" && + typeof URL.createObjectURL == "function", + S2 = ["utf-8", "utf8", "unicode-1-1-utf-8"], + T2 = h; + x2 + ? (T2 = B2) + : O2 && + (T2 = function (r2) { + try { + return U2(r2); + } catch (e) { + return h(r2); + } + }); + var y2 = "construct 'TextDecoder'", + E2 = "".concat(u2, " ").concat(y2, ": the "); + function g(r2, e) { + p2(e && e.fatal, y2, "fatal"), (r2 = r2 || "utf-8"); + var f2; + if ( + (x2 + ? (f2 = Buffer.isEncoding(r2)) + : (f2 = S2.indexOf(r2.toLowerCase()) !== -1), + !f2) + ) + throw new RangeError( + "" + .concat(E2, " encoding label provided ('") + .concat(r2, "') is invalid."), + ); + (this.encoding = r2), (this.fatal = false), (this.ignoreBOM = false); + } + g.prototype.decode = function (r2, e) { + p2(e && e.stream, "decode", "stream"); + var f2; + return ( + r2 instanceof Uint8Array + ? (f2 = r2) + : r2.buffer instanceof ArrayBuffer + ? (f2 = new Uint8Array(r2.buffer)) + : (f2 = new Uint8Array(r2)), + T2(f2, this.encoding) + ); + }; + scope.TextEncoder = scope.TextEncoder || v2; + scope.TextDecoder = scope.TextDecoder || g; + })( + typeof window !== "undefined" + ? window + : typeof commonjsGlobal !== "undefined" + ? commonjsGlobal + : commonjsGlobal, + ); + var reactDomServerLegacy_browser_production_min = {}; + /** + * @license React + * react-dom-server-legacy.browser.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + var aa$1 = reactExports; + function l$2(a) { + for ( + var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, + c = 1; + c < arguments.length; + c++ + ) + b += "&args[]=" + encodeURIComponent(arguments[c]); + return ( + "Minified React error #" + + a + + "; visit " + + b + + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." + ); + } + var p$1 = Object.prototype.hasOwnProperty, + fa$1 = + /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, + ha$1 = {}, + ia$1 = {}; + function ja$1(a) { + if (p$1.call(ia$1, a)) return true; + if (p$1.call(ha$1, a)) return false; + if (fa$1.test(a)) return (ia$1[a] = true); + ha$1[a] = true; + return false; + } + function r(a, b, c, d, f2, e, g) { + this.acceptsBooleans = 2 === b || 3 === b || 4 === b; + this.attributeName = d; + this.attributeNamespace = f2; + this.mustUseProperty = c; + this.propertyName = a; + this.type = b; + this.sanitizeURL = e; + this.removeEmptyString = g; + } + var t$1 = {}; + "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style" + .split(" ") + .forEach(function (a) { + t$1[a] = new r(a, 0, false, a, null, false, false); + }); + [ + ["acceptCharset", "accept-charset"], + ["className", "class"], + ["htmlFor", "for"], + ["httpEquiv", "http-equiv"], + ].forEach(function (a) { + var b = a[0]; + t$1[b] = new r(b, 1, false, a[1], null, false, false); + }); + ["contentEditable", "draggable", "spellCheck", "value"].forEach(function (a) { + t$1[a] = new r(a, 2, false, a.toLowerCase(), null, false, false); + }); + [ + "autoReverse", + "externalResourcesRequired", + "focusable", + "preserveAlpha", + ].forEach(function (a) { + t$1[a] = new r(a, 2, false, a, null, false, false); + }); + "allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope" + .split(" ") + .forEach(function (a) { + t$1[a] = new r(a, 3, false, a.toLowerCase(), null, false, false); + }); + ["checked", "multiple", "muted", "selected"].forEach(function (a) { + t$1[a] = new r(a, 3, true, a, null, false, false); + }); + ["capture", "download"].forEach(function (a) { + t$1[a] = new r(a, 4, false, a, null, false, false); + }); + ["cols", "rows", "size", "span"].forEach(function (a) { + t$1[a] = new r(a, 6, false, a, null, false, false); + }); + ["rowSpan", "start"].forEach(function (a) { + t$1[a] = new r(a, 5, false, a.toLowerCase(), null, false, false); + }); + var ka$1 = /[\-:]([a-z])/g; + function la$1(a) { + return a[1].toUpperCase(); + } + "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height" + .split(" ") + .forEach(function (a) { + var b = a.replace(ka$1, la$1); + t$1[b] = new r(b, 1, false, a, null, false, false); + }); + "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type" + .split(" ") + .forEach(function (a) { + var b = a.replace(ka$1, la$1); + t$1[b] = new r( + b, + 1, + false, + a, + "http://www.w3.org/1999/xlink", + false, + false, + ); + }); + ["xml:base", "xml:lang", "xml:space"].forEach(function (a) { + var b = a.replace(ka$1, la$1); + t$1[b] = new r( + b, + 1, + false, + a, + "http://www.w3.org/XML/1998/namespace", + false, + false, + ); + }); + ["tabIndex", "crossOrigin"].forEach(function (a) { + t$1[a] = new r(a, 1, false, a.toLowerCase(), null, false, false); + }); + t$1.xlinkHref = new r( + "xlinkHref", + 1, + false, + "xlink:href", + "http://www.w3.org/1999/xlink", + true, + false, + ); + ["src", "href", "action", "formAction"].forEach(function (a) { + t$1[a] = new r(a, 1, false, a.toLowerCase(), null, true, true); + }); + var u$1 = { + animationIterationCount: true, + aspectRatio: true, + borderImageOutset: true, + borderImageSlice: true, + borderImageWidth: true, + boxFlex: true, + boxFlexGroup: true, + boxOrdinalGroup: true, + columnCount: true, + columns: true, + flex: true, + flexGrow: true, + flexPositive: true, + flexShrink: true, + flexNegative: true, + flexOrder: true, + gridArea: true, + gridRow: true, + gridRowEnd: true, + gridRowSpan: true, + gridRowStart: true, + gridColumn: true, + gridColumnEnd: true, + gridColumnSpan: true, + gridColumnStart: true, + fontWeight: true, + lineClamp: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + tabSize: true, + widows: true, + zIndex: true, + zoom: true, + fillOpacity: true, + floodOpacity: true, + stopOpacity: true, + strokeDasharray: true, + strokeDashoffset: true, + strokeMiterlimit: true, + strokeOpacity: true, + strokeWidth: true, + }, + ma = ["Webkit", "ms", "Moz", "O"]; + Object.keys(u$1).forEach(function (a) { + ma.forEach(function (b) { + b = b + a.charAt(0).toUpperCase() + a.substring(1); + u$1[b] = u$1[a]; + }); + }); + var na = /["'&<>]/; + function v(a) { + if ("boolean" === typeof a || "number" === typeof a) return "" + a; + a = "" + a; + var b = na.exec(a); + if (b) { + var c = "", + d, + f2 = 0; + for (d = b.index; d < a.length; d++) { + switch (a.charCodeAt(d)) { + case 34: + b = """; + break; + case 38: + b = "&"; + break; + case 39: + b = "'"; + break; + case 60: + b = "<"; + break; + case 62: + b = ">"; + break; + default: + continue; + } + f2 !== d && (c += a.substring(f2, d)); + f2 = d + 1; + c += b; + } + a = f2 !== d ? c + a.substring(f2, d) : c; + } + return a; + } + var oa$1 = /([A-Z])/g, + pa$1 = /^ms-/, + qa$1 = Array.isArray; + function w$1(a, b) { + return { insertionMode: a, selectedValue: b }; + } + function ra$1(a, b, c) { + switch (b) { + case "select": + return w$1(1, null != c.value ? c.value : c.defaultValue); + case "svg": + return w$1(2, null); + case "math": + return w$1(3, null); + case "foreignObject": + return w$1(1, null); + case "table": + return w$1(4, null); + case "thead": + case "tbody": + case "tfoot": + return w$1(5, null); + case "colgroup": + return w$1(7, null); + case "tr": + return w$1(6, null); + } + return 4 <= a.insertionMode || 0 === a.insertionMode ? w$1(1, null) : a; + } + var sa$1 = /* @__PURE__ */ new Map(); + function ta$1(a, b, c) { + if ("object" !== typeof c) throw Error(l$2(62)); + b = true; + for (var d in c) + if (p$1.call(c, d)) { + var f2 = c[d]; + if (null != f2 && "boolean" !== typeof f2 && "" !== f2) { + if (0 === d.indexOf("--")) { + var e = v(d); + f2 = v(("" + f2).trim()); + } else { + e = d; + var g = sa$1.get(e); + void 0 !== g + ? (e = g) + : ((g = v( + e.replace(oa$1, "-$1").toLowerCase().replace(pa$1, "-ms-"), + )), + sa$1.set(e, g), + (e = g)); + f2 = + "number" === typeof f2 + ? 0 === f2 || p$1.call(u$1, d) + ? "" + f2 + : f2 + "px" + : v(("" + f2).trim()); + } + b + ? ((b = false), a.push(' style="', e, ":", f2)) + : a.push(";", e, ":", f2); + } + } + b || a.push('"'); + } + function x$1(a, b, c, d) { + switch (c) { + case "style": + ta$1(a, b, d); + return; + case "defaultValue": + case "defaultChecked": + case "innerHTML": + case "suppressContentEditableWarning": + case "suppressHydrationWarning": + return; + } + if ( + !(2 < c.length) || + ("o" !== c[0] && "O" !== c[0]) || + ("n" !== c[1] && "N" !== c[1]) + ) { + if (((b = t$1.hasOwnProperty(c) ? t$1[c] : null), null !== b)) { + switch (typeof d) { + case "function": + case "symbol": + return; + case "boolean": + if (!b.acceptsBooleans) return; + } + c = b.attributeName; + switch (b.type) { + case 3: + d && a.push(" ", c, '=""'); + break; + case 4: + true === d + ? a.push(" ", c, '=""') + : false !== d && a.push(" ", c, '="', v(d), '"'); + break; + case 5: + isNaN(d) || a.push(" ", c, '="', v(d), '"'); + break; + case 6: + !isNaN(d) && 1 <= d && a.push(" ", c, '="', v(d), '"'); + break; + default: + b.sanitizeURL && (d = "" + d), a.push(" ", c, '="', v(d), '"'); + } + } else if (ja$1(c)) { + switch (typeof d) { + case "function": + case "symbol": + return; + case "boolean": + if ( + ((b = c.toLowerCase().slice(0, 5)), + "data-" !== b && "aria-" !== b) + ) + return; + } + a.push(" ", c, '="', v(d), '"'); + } + } + } + function y$1(a, b, c) { + if (null != b) { + if (null != c) throw Error(l$2(60)); + if ("object" !== typeof b || !("__html" in b)) throw Error(l$2(61)); + b = b.__html; + null !== b && void 0 !== b && a.push("" + b); + } + } + function ua$1(a) { + var b = ""; + aa$1.Children.forEach(a, function (a2) { + null != a2 && (b += a2); + }); + return b; + } + function va$1(a, b, c, d) { + a.push(A(c)); + var f2 = (c = null), + e; + for (e in b) + if (p$1.call(b, e)) { + var g = b[e]; + if (null != g) + switch (e) { + case "children": + c = g; + break; + case "dangerouslySetInnerHTML": + f2 = g; + break; + default: + x$1(a, d, e, g); + } + } + a.push(">"); + y$1(a, f2, c); + return "string" === typeof c ? (a.push(v(c)), null) : c; + } + var wa$1 = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/, + xa$1 = /* @__PURE__ */ new Map(); + function A(a) { + var b = xa$1.get(a); + if (void 0 === b) { + if (!wa$1.test(a)) throw Error(l$2(65, a)); + b = "<" + a; + xa$1.set(a, b); + } + return b; + } + function ya$1(a, b, c, d, f2) { + switch (b) { + case "select": + a.push(A("select")); + var e = null, + g = null; + for (n2 in c) + if (p$1.call(c, n2)) { + var h = c[n2]; + if (null != h) + switch (n2) { + case "children": + e = h; + break; + case "dangerouslySetInnerHTML": + g = h; + break; + case "defaultValue": + case "value": + break; + default: + x$1(a, d, n2, h); + } + } + a.push(">"); + y$1(a, g, e); + return e; + case "option": + g = f2.selectedValue; + a.push(A("option")); + var k2 = (h = null), + m2 = null; + var n2 = null; + for (e in c) + if (p$1.call(c, e)) { + var q2 = c[e]; + if (null != q2) + switch (e) { + case "children": + h = q2; + break; + case "selected": + m2 = q2; + break; + case "dangerouslySetInnerHTML": + n2 = q2; + break; + case "value": + k2 = q2; + default: + x$1(a, d, e, q2); + } + } + if (null != g) + if (((c = null !== k2 ? "" + k2 : ua$1(h)), qa$1(g))) + for (d = 0; d < g.length; d++) { + if ("" + g[d] === c) { + a.push(' selected=""'); + break; + } + } + else "" + g === c && a.push(' selected=""'); + else m2 && a.push(' selected=""'); + a.push(">"); + y$1(a, n2, h); + return h; + case "textarea": + a.push(A("textarea")); + n2 = g = e = null; + for (h in c) + if (p$1.call(c, h) && ((k2 = c[h]), null != k2)) + switch (h) { + case "children": + n2 = k2; + break; + case "value": + e = k2; + break; + case "defaultValue": + g = k2; + break; + case "dangerouslySetInnerHTML": + throw Error(l$2(91)); + default: + x$1(a, d, h, k2); + } + null === e && null !== g && (e = g); + a.push(">"); + if (null != n2) { + if (null != e) throw Error(l$2(92)); + if (qa$1(n2) && 1 < n2.length) throw Error(l$2(93)); + e = "" + n2; + } + "string" === typeof e && "\n" === e[0] && a.push("\n"); + null !== e && a.push(v("" + e)); + return null; + case "input": + a.push(A("input")); + k2 = n2 = h = e = null; + for (g in c) + if (p$1.call(c, g) && ((m2 = c[g]), null != m2)) + switch (g) { + case "children": + case "dangerouslySetInnerHTML": + throw Error(l$2(399, "input")); + case "defaultChecked": + k2 = m2; + break; + case "defaultValue": + h = m2; + break; + case "checked": + n2 = m2; + break; + case "value": + e = m2; + break; + default: + x$1(a, d, g, m2); + } + null !== n2 + ? x$1(a, d, "checked", n2) + : null !== k2 && x$1(a, d, "checked", k2); + null !== e + ? x$1(a, d, "value", e) + : null !== h && x$1(a, d, "value", h); + a.push("/>"); + return null; + case "menuitem": + a.push(A("menuitem")); + for (var C2 in c) + if (p$1.call(c, C2) && ((e = c[C2]), null != e)) + switch (C2) { + case "children": + case "dangerouslySetInnerHTML": + throw Error(l$2(400)); + default: + x$1(a, d, C2, e); + } + a.push(">"); + return null; + case "title": + a.push(A("title")); + e = null; + for (q2 in c) + if (p$1.call(c, q2) && ((g = c[q2]), null != g)) + switch (q2) { + case "children": + e = g; + break; + case "dangerouslySetInnerHTML": + throw Error(l$2(434)); + default: + x$1(a, d, q2, g); + } + a.push(">"); + return e; + case "listing": + case "pre": + a.push(A(b)); + g = e = null; + for (k2 in c) + if (p$1.call(c, k2) && ((h = c[k2]), null != h)) + switch (k2) { + case "children": + e = h; + break; + case "dangerouslySetInnerHTML": + g = h; + break; + default: + x$1(a, d, k2, h); + } + a.push(">"); + if (null != g) { + if (null != e) throw Error(l$2(60)); + if ("object" !== typeof g || !("__html" in g)) throw Error(l$2(61)); + c = g.__html; + null !== c && + void 0 !== c && + ("string" === typeof c && 0 < c.length && "\n" === c[0] + ? a.push("\n", c) + : a.push("" + c)); + } + "string" === typeof e && "\n" === e[0] && a.push("\n"); + return e; + case "area": + case "base": + case "br": + case "col": + case "embed": + case "hr": + case "img": + case "keygen": + case "link": + case "meta": + case "param": + case "source": + case "track": + case "wbr": + a.push(A(b)); + for (var D2 in c) + if (p$1.call(c, D2) && ((e = c[D2]), null != e)) + switch (D2) { + case "children": + case "dangerouslySetInnerHTML": + throw Error(l$2(399, b)); + default: + x$1(a, d, D2, e); + } + a.push("/>"); + return null; + case "annotation-xml": + case "color-profile": + case "font-face": + case "font-face-src": + case "font-face-uri": + case "font-face-format": + case "font-face-name": + case "missing-glyph": + return va$1(a, c, b, d); + case "html": + return ( + 0 === f2.insertionMode && a.push(""), va$1(a, c, b, d) + ); + default: + if (-1 === b.indexOf("-") && "string" !== typeof c.is) + return va$1(a, c, b, d); + a.push(A(b)); + g = e = null; + for (m2 in c) + if (p$1.call(c, m2) && ((h = c[m2]), null != h)) + switch (m2) { + case "children": + e = h; + break; + case "dangerouslySetInnerHTML": + g = h; + break; + case "style": + ta$1(a, d, h); + break; + case "suppressContentEditableWarning": + case "suppressHydrationWarning": + break; + default: + ja$1(m2) && + "function" !== typeof h && + "symbol" !== typeof h && + a.push(" ", m2, '="', v(h), '"'); + } + a.push(">"); + y$1(a, g, e); + return e; + } + } + function za$1(a, b, c) { + a.push(''); + } + function Aa$1(a, b, c, d) { + switch (c.insertionMode) { + case 0: + case 1: + return ( + a.push('