UNPKG

@ea-lab/reactive-json

Version:

A REACT-based lib that transforms JSON (or YAML) into interactive HTML markup.

696 lines (695 loc) 24.8 kB
import { jsxs as oe, jsx as z, Fragment as Re } from "react/jsx-runtime"; import { g as Oe } from "../../_commonjsHelpers-DaMA6jEr.js"; import "react"; import '../../assets/ParsingDebugDisplay.css';var H = { exports: {} }, X = { exports: {} }, m = {}; /** @license React v16.13.1 * react-is.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 de; function xe() { if (de) return m; de = 1; var o = typeof Symbol == "function" && Symbol.for, x = o ? Symbol.for("react.element") : 60103, P = o ? Symbol.for("react.portal") : 60106, p = o ? Symbol.for("react.fragment") : 60107, _ = o ? Symbol.for("react.strict_mode") : 60108, a = o ? Symbol.for("react.profiler") : 60114, S = o ? Symbol.for("react.provider") : 60109, l = o ? Symbol.for("react.context") : 60110, R = o ? Symbol.for("react.async_mode") : 60111, g = o ? Symbol.for("react.concurrent_mode") : 60111, b = o ? Symbol.for("react.forward_ref") : 60112, E = o ? Symbol.for("react.suspense") : 60113, C = o ? Symbol.for("react.suspense_list") : 60120, w = o ? Symbol.for("react.memo") : 60115, M = o ? Symbol.for("react.lazy") : 60116, O = o ? Symbol.for("react.block") : 60121, I = o ? Symbol.for("react.fundamental") : 60117, q = o ? Symbol.for("react.responder") : 60118, U = o ? Symbol.for("react.scope") : 60119; function j(t) { if (typeof t == "object" && t !== null) { var k = t.$$typeof; switch (k) { case x: switch (t = t.type, t) { case R: case g: case p: case a: case _: case E: return t; default: switch (t = t && t.$$typeof, t) { case l: case b: case M: case w: case S: return t; default: return k; } } case P: return k; } } } function A(t) { return j(t) === g; } return m.AsyncMode = R, m.ConcurrentMode = g, m.ContextConsumer = l, m.ContextProvider = S, m.Element = x, m.ForwardRef = b, m.Fragment = p, m.Lazy = M, m.Memo = w, m.Portal = P, m.Profiler = a, m.StrictMode = _, m.Suspense = E, m.isAsyncMode = function(t) { return A(t) || j(t) === R; }, m.isConcurrentMode = A, m.isContextConsumer = function(t) { return j(t) === l; }, m.isContextProvider = function(t) { return j(t) === S; }, m.isElement = function(t) { return typeof t == "object" && t !== null && t.$$typeof === x; }, m.isForwardRef = function(t) { return j(t) === b; }, m.isFragment = function(t) { return j(t) === p; }, m.isLazy = function(t) { return j(t) === M; }, m.isMemo = function(t) { return j(t) === w; }, m.isPortal = function(t) { return j(t) === P; }, m.isProfiler = function(t) { return j(t) === a; }, m.isStrictMode = function(t) { return j(t) === _; }, m.isSuspense = function(t) { return j(t) === E; }, m.isValidElementType = function(t) { return typeof t == "string" || typeof t == "function" || t === p || t === g || t === a || t === _ || t === E || t === C || typeof t == "object" && t !== null && (t.$$typeof === M || t.$$typeof === w || t.$$typeof === S || t.$$typeof === l || t.$$typeof === b || t.$$typeof === I || t.$$typeof === q || t.$$typeof === U || t.$$typeof === O); }, m.typeOf = j, m; } var h = {}; /** @license React v16.13.1 * react-is.development.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 ye; function Ce() { return ye || (ye = 1, process.env.NODE_ENV !== "production" && function() { var o = typeof Symbol == "function" && Symbol.for, x = o ? Symbol.for("react.element") : 60103, P = o ? Symbol.for("react.portal") : 60106, p = o ? Symbol.for("react.fragment") : 60107, _ = o ? Symbol.for("react.strict_mode") : 60108, a = o ? Symbol.for("react.profiler") : 60114, S = o ? Symbol.for("react.provider") : 60109, l = o ? Symbol.for("react.context") : 60110, R = o ? Symbol.for("react.async_mode") : 60111, g = o ? Symbol.for("react.concurrent_mode") : 60111, b = o ? Symbol.for("react.forward_ref") : 60112, E = o ? Symbol.for("react.suspense") : 60113, C = o ? Symbol.for("react.suspense_list") : 60120, w = o ? Symbol.for("react.memo") : 60115, M = o ? Symbol.for("react.lazy") : 60116, O = o ? Symbol.for("react.block") : 60121, I = o ? Symbol.for("react.fundamental") : 60117, q = o ? Symbol.for("react.responder") : 60118, U = o ? Symbol.for("react.scope") : 60119; function j(r) { return typeof r == "string" || typeof r == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. r === p || r === g || r === a || r === _ || r === E || r === C || typeof r == "object" && r !== null && (r.$$typeof === M || r.$$typeof === w || r.$$typeof === S || r.$$typeof === l || r.$$typeof === b || r.$$typeof === I || r.$$typeof === q || r.$$typeof === U || r.$$typeof === O); } function A(r) { if (typeof r == "object" && r !== null) { var Y = r.$$typeof; switch (Y) { case x: var J = r.type; switch (J) { case R: case g: case p: case a: case _: case E: return J; default: var pe = J && J.$$typeof; switch (pe) { case l: case b: case M: case w: case S: return pe; default: return Y; } } case P: return Y; } } } var t = R, k = g, G = l, K = S, Z = x, Q = b, B = p, ee = M, re = w, L = P, te = a, D = _, W = E, V = !1; function ne(r) { return V || (V = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), e(r) || A(r) === R; } function e(r) { return A(r) === g; } function n(r) { return A(r) === l; } function f(r) { return A(r) === S; } function c(r) { return typeof r == "object" && r !== null && r.$$typeof === x; } function i(r) { return A(r) === b; } function d(r) { return A(r) === p; } function s(r) { return A(r) === M; } function u(r) { return A(r) === w; } function y(r) { return A(r) === P; } function T(r) { return A(r) === a; } function v(r) { return A(r) === _; } function $(r) { return A(r) === E; } h.AsyncMode = t, h.ConcurrentMode = k, h.ContextConsumer = G, h.ContextProvider = K, h.Element = Z, h.ForwardRef = Q, h.Fragment = B, h.Lazy = ee, h.Memo = re, h.Portal = L, h.Profiler = te, h.StrictMode = D, h.Suspense = W, h.isAsyncMode = ne, h.isConcurrentMode = e, h.isContextConsumer = n, h.isContextProvider = f, h.isElement = c, h.isForwardRef = i, h.isFragment = d, h.isLazy = s, h.isMemo = u, h.isPortal = y, h.isProfiler = T, h.isStrictMode = v, h.isSuspense = $, h.isValidElementType = j, h.typeOf = A; }()), h; } var ve; function Se() { return ve || (ve = 1, process.env.NODE_ENV === "production" ? X.exports = xe() : X.exports = Ce()), X.exports; } /* object-assign (c) Sindre Sorhus @license MIT */ var ie, be; function we() { if (be) return ie; be = 1; var o = Object.getOwnPropertySymbols, x = Object.prototype.hasOwnProperty, P = Object.prototype.propertyIsEnumerable; function p(a) { if (a == null) throw new TypeError("Object.assign cannot be called with null or undefined"); return Object(a); } function _() { try { if (!Object.assign) return !1; var a = new String("abc"); if (a[5] = "de", Object.getOwnPropertyNames(a)[0] === "5") return !1; for (var S = {}, l = 0; l < 10; l++) S["_" + String.fromCharCode(l)] = l; var R = Object.getOwnPropertyNames(S).map(function(b) { return S[b]; }); if (R.join("") !== "0123456789") return !1; var g = {}; return "abcdefghijklmnopqrst".split("").forEach(function(b) { g[b] = b; }), Object.keys(Object.assign({}, g)).join("") === "abcdefghijklmnopqrst"; } catch { return !1; } } return ie = _() ? Object.assign : function(a, S) { for (var l, R = p(a), g, b = 1; b < arguments.length; b++) { l = Object(arguments[b]); for (var E in l) x.call(l, E) && (R[E] = l[E]); if (o) { g = o(l); for (var C = 0; C < g.length; C++) P.call(l, g[C]) && (R[g[C]] = l[g[C]]); } } return R; }, ie; } var ae, me; function le() { if (me) return ae; me = 1; var o = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; return ae = o, ae; } var se, he; function Pe() { return he || (he = 1, se = Function.call.bind(Object.prototype.hasOwnProperty)), se; } var ce, Te; function Ae() { if (Te) return ce; Te = 1; var o = function() { }; if (process.env.NODE_ENV !== "production") { var x = /* @__PURE__ */ le(), P = {}, p = /* @__PURE__ */ Pe(); o = function(a) { var S = "Warning: " + a; typeof console < "u" && console.error(S); try { throw new Error(S); } catch { } }; } function _(a, S, l, R, g) { if (process.env.NODE_ENV !== "production") { for (var b in a) if (p(a, b)) { var E; try { if (typeof a[b] != "function") { var C = Error( (R || "React class") + ": " + l + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`." ); throw C.name = "Invariant Violation", C; } E = a[b](S, b, R, l, null, x); } catch (M) { E = M; } if (E && !(E instanceof Error) && o( (R || "React class") + ": type specification of " + l + " `" + b + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof E + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)." ), E instanceof Error && !(E.message in P)) { P[E.message] = !0; var w = g ? g() : ""; o( "Failed " + l + " type: " + E.message + (w ?? "") ); } } } } return _.resetWarningCache = function() { process.env.NODE_ENV !== "production" && (P = {}); }, ce = _, ce; } var ue, Ee; function je() { if (Ee) return ue; Ee = 1; var o = Se(), x = we(), P = /* @__PURE__ */ le(), p = /* @__PURE__ */ Pe(), _ = /* @__PURE__ */ Ae(), a = function() { }; process.env.NODE_ENV !== "production" && (a = function(l) { var R = "Warning: " + l; typeof console < "u" && console.error(R); try { throw new Error(R); } catch { } }); function S() { return null; } return ue = function(l, R) { var g = typeof Symbol == "function" && Symbol.iterator, b = "@@iterator"; function E(e) { var n = e && (g && e[g] || e[b]); if (typeof n == "function") return n; } var C = "<<anonymous>>", w = { array: q("array"), bigint: q("bigint"), bool: q("boolean"), func: q("function"), number: q("number"), object: q("object"), string: q("string"), symbol: q("symbol"), any: U(), arrayOf: j, element: A(), elementType: t(), instanceOf: k, node: Q(), objectOf: K, oneOf: G, oneOfType: Z, shape: ee, exact: re }; function M(e, n) { return e === n ? e !== 0 || 1 / e === 1 / n : e !== e && n !== n; } function O(e, n) { this.message = e, this.data = n && typeof n == "object" ? n : {}, this.stack = ""; } O.prototype = Error.prototype; function I(e) { if (process.env.NODE_ENV !== "production") var n = {}, f = 0; function c(d, s, u, y, T, v, $) { if (y = y || C, v = v || u, $ !== P) { if (R) { var r = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types" ); throw r.name = "Invariant Violation", r; } else if (process.env.NODE_ENV !== "production" && typeof console < "u") { var Y = y + ":" + u; !n[Y] && // Avoid spamming the console because they are often not actionable except for lib authors f < 3 && (a( "You are manually calling a React.PropTypes validation function for the `" + v + "` prop on `" + y + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details." ), n[Y] = !0, f++); } } return s[u] == null ? d ? s[u] === null ? new O("The " + T + " `" + v + "` is marked as required " + ("in `" + y + "`, but its value is `null`.")) : new O("The " + T + " `" + v + "` is marked as required in " + ("`" + y + "`, but its value is `undefined`.")) : null : e(s, u, y, T, v); } var i = c.bind(null, !1); return i.isRequired = c.bind(null, !0), i; } function q(e) { function n(f, c, i, d, s, u) { var y = f[c], T = D(y); if (T !== e) { var v = W(y); return new O( "Invalid " + d + " `" + s + "` of type " + ("`" + v + "` supplied to `" + i + "`, expected ") + ("`" + e + "`."), { expectedType: e } ); } return null; } return I(n); } function U() { return I(S); } function j(e) { function n(f, c, i, d, s) { if (typeof e != "function") return new O("Property `" + s + "` of component `" + i + "` has invalid PropType notation inside arrayOf."); var u = f[c]; if (!Array.isArray(u)) { var y = D(u); return new O("Invalid " + d + " `" + s + "` of type " + ("`" + y + "` supplied to `" + i + "`, expected an array.")); } for (var T = 0; T < u.length; T++) { var v = e(u, T, i, d, s + "[" + T + "]", P); if (v instanceof Error) return v; } return null; } return I(n); } function A() { function e(n, f, c, i, d) { var s = n[f]; if (!l(s)) { var u = D(s); return new O("Invalid " + i + " `" + d + "` of type " + ("`" + u + "` supplied to `" + c + "`, expected a single ReactElement.")); } return null; } return I(e); } function t() { function e(n, f, c, i, d) { var s = n[f]; if (!o.isValidElementType(s)) { var u = D(s); return new O("Invalid " + i + " `" + d + "` of type " + ("`" + u + "` supplied to `" + c + "`, expected a single ReactElement type.")); } return null; } return I(e); } function k(e) { function n(f, c, i, d, s) { if (!(f[c] instanceof e)) { var u = e.name || C, y = ne(f[c]); return new O("Invalid " + d + " `" + s + "` of type " + ("`" + y + "` supplied to `" + i + "`, expected ") + ("instance of `" + u + "`.")); } return null; } return I(n); } function G(e) { if (!Array.isArray(e)) return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? a( "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])." ) : a("Invalid argument supplied to oneOf, expected an array.")), S; function n(f, c, i, d, s) { for (var u = f[c], y = 0; y < e.length; y++) if (M(u, e[y])) return null; var T = JSON.stringify(e, function($, r) { var Y = W(r); return Y === "symbol" ? String(r) : r; }); return new O("Invalid " + d + " `" + s + "` of value `" + String(u) + "` " + ("supplied to `" + i + "`, expected one of " + T + ".")); } return I(n); } function K(e) { function n(f, c, i, d, s) { if (typeof e != "function") return new O("Property `" + s + "` of component `" + i + "` has invalid PropType notation inside objectOf."); var u = f[c], y = D(u); if (y !== "object") return new O("Invalid " + d + " `" + s + "` of type " + ("`" + y + "` supplied to `" + i + "`, expected an object.")); for (var T in u) if (p(u, T)) { var v = e(u, T, i, d, s + "." + T, P); if (v instanceof Error) return v; } return null; } return I(n); } function Z(e) { if (!Array.isArray(e)) return process.env.NODE_ENV !== "production" && a("Invalid argument supplied to oneOfType, expected an instance of array."), S; for (var n = 0; n < e.length; n++) { var f = e[n]; if (typeof f != "function") return a( "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + V(f) + " at index " + n + "." ), S; } function c(i, d, s, u, y) { for (var T = [], v = 0; v < e.length; v++) { var $ = e[v], r = $(i, d, s, u, y, P); if (r == null) return null; r.data && p(r.data, "expectedType") && T.push(r.data.expectedType); } var Y = T.length > 0 ? ", expected one of type [" + T.join(", ") + "]" : ""; return new O("Invalid " + u + " `" + y + "` supplied to " + ("`" + s + "`" + Y + ".")); } return I(c); } function Q() { function e(n, f, c, i, d) { return L(n[f]) ? null : new O("Invalid " + i + " `" + d + "` supplied to " + ("`" + c + "`, expected a ReactNode.")); } return I(e); } function B(e, n, f, c, i) { return new O( (e || "React class") + ": " + n + " type `" + f + "." + c + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + i + "`." ); } function ee(e) { function n(f, c, i, d, s) { var u = f[c], y = D(u); if (y !== "object") return new O("Invalid " + d + " `" + s + "` of type `" + y + "` " + ("supplied to `" + i + "`, expected `object`.")); for (var T in e) { var v = e[T]; if (typeof v != "function") return B(i, d, s, T, W(v)); var $ = v(u, T, i, d, s + "." + T, P); if ($) return $; } return null; } return I(n); } function re(e) { function n(f, c, i, d, s) { var u = f[c], y = D(u); if (y !== "object") return new O("Invalid " + d + " `" + s + "` of type `" + y + "` " + ("supplied to `" + i + "`, expected `object`.")); var T = x({}, f[c], e); for (var v in T) { var $ = e[v]; if (p(e, v) && typeof $ != "function") return B(i, d, s, v, W($)); if (!$) return new O( "Invalid " + d + " `" + s + "` key `" + v + "` supplied to `" + i + "`.\nBad object: " + JSON.stringify(f[c], null, " ") + ` Valid keys: ` + JSON.stringify(Object.keys(e), null, " ") ); var r = $(u, v, i, d, s + "." + v, P); if (r) return r; } return null; } return I(n); } function L(e) { switch (typeof e) { case "number": case "string": case "undefined": return !0; case "boolean": return !e; case "object": if (Array.isArray(e)) return e.every(L); if (e === null || l(e)) return !0; var n = E(e); if (n) { var f = n.call(e), c; if (n !== e.entries) { for (; !(c = f.next()).done; ) if (!L(c.value)) return !1; } else for (; !(c = f.next()).done; ) { var i = c.value; if (i && !L(i[1])) return !1; } } else return !1; return !0; default: return !1; } } function te(e, n) { return e === "symbol" ? !0 : n ? n["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && n instanceof Symbol : !1; } function D(e) { var n = typeof e; return Array.isArray(e) ? "array" : e instanceof RegExp ? "object" : te(n, e) ? "symbol" : n; } function W(e) { if (typeof e > "u" || e === null) return "" + e; var n = D(e); if (n === "object") { if (e instanceof Date) return "date"; if (e instanceof RegExp) return "regexp"; } return n; } function V(e) { var n = W(e); switch (n) { case "array": case "object": return "an " + n; case "boolean": case "date": case "regexp": return "a " + n; default: return n; } } function ne(e) { return !e.constructor || !e.constructor.name ? C : e.constructor.name; } return w.checkPropTypes = _, w.resetWarningCache = _.resetWarningCache, w.PropTypes = w, w; }, ue; } var fe, ge; function Ie() { if (ge) return fe; ge = 1; var o = /* @__PURE__ */ le(); function x() { } function P() { } return P.resetWarningCache = x, fe = function() { function p(S, l, R, g, b, E) { if (E !== o) { var C = new Error( "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types" ); throw C.name = "Invariant Violation", C; } } p.isRequired = p; function _() { return p; } var a = { array: p, bigint: p, bool: p, func: p, number: p, object: p, string: p, symbol: p, any: p, arrayOf: _, element: p, elementType: p, instanceOf: _, node: p, objectOf: _, oneOf: _, oneOfType: _, shape: _, exact: _, checkPropTypes: P, resetWarningCache: x }; return a.PropTypes = a, a; }, fe; } var _e; function $e() { if (_e) return H.exports; if (_e = 1, process.env.NODE_ENV !== "production") { var o = Se(), x = !0; H.exports = /* @__PURE__ */ je()(o.isElement, x); } else H.exports = /* @__PURE__ */ Ie()(); return H.exports; } var Me = /* @__PURE__ */ $e(); const N = /* @__PURE__ */ Oe(Me), qe = "_container_16v39_1", De = "_subtitle_16v39_8", Ye = "_errorDetailsTitle_16v39_13", F = { container: qe, subtitle: De, errorDetailsTitle: Ye }, ke = ({ processedRjBuild: o, errorContext: x }) => /* @__PURE__ */ oe("div", { className: F.container, children: [ /* @__PURE__ */ z("h1", { children: "Parsing error" }), /* @__PURE__ */ oe("p", { className: F.subtitle, children: [ "The ", o.format, " content could not be parsed." ] }), /* @__PURE__ */ z("p", { className: F.errorDetailsTitle, children: "Error details:" }), /* @__PURE__ */ z("pre", { className: F.errorDetails, children: o.error.message }), x && /* @__PURE__ */ oe(Re, { children: [ /* @__PURE__ */ z("p", { className: F.errorDetailsTitle, children: "Error context:" }), /* @__PURE__ */ z("pre", { className: F.errorDetails, children: JSON.stringify(x, null, 2) }) ] }) ] }); ke.propTypes = { processedRjBuild: N.shape({ format: N.string.isRequired, error: N.shape({ message: N.string.isRequired }).isRequired }).isRequired, errorContext: N.object }; export { ke as default };