@fragmentsx/render-react 0.0.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +3896 -401
- package/dist/index.es.js +3898 -403
- package/dist/render-react.css +7 -0
- package/package.json +22 -16
- package/dist/components/GlobalManager.d.ts +0 -2
- package/dist/components/GlobalManager.d.ts.map +0 -1
- package/dist/hooks/useFragmentManager.d.ts +0 -5
- package/dist/hooks/useFragmentManager.d.ts.map +0 -1
- package/dist/hooks/useFragmentProperties.d.ts +0 -2
- package/dist/hooks/useFragmentProperties.d.ts.map +0 -1
- package/dist/hooks/useGlobalManager.d.ts +0 -2
- package/dist/hooks/useGlobalManager.d.ts.map +0 -1
- package/dist/hooks/useRenderTarget.d.ts +0 -7
- package/dist/hooks/useRenderTarget.d.ts.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/reactAdapter.d.ts +0 -3
- package/dist/reactAdapter.d.ts.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,464 +1,3959 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const require$$0 = require("react");
|
|
5
|
-
require("react/jsx-runtime");
|
|
6
5
|
const definition = require("@fragmentsx/definition");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
const core = require("@graph-state/core");
|
|
7
|
+
const collectStyles = (globalManager) => {
|
|
8
|
+
if (!globalManager) return null;
|
|
9
|
+
const allFragments = globalManager.$fragments.getManagers();
|
|
10
|
+
const extractors = Object.entries(allFragments).filter(([, value]) => !!(value == null ? void 0 : value.resolve)).map(([fragmentId, manager]) => {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
return (_c = (_b = (_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.extract) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.at(0);
|
|
13
|
+
});
|
|
14
|
+
return extractors.map((extractor) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
"style",
|
|
16
|
+
{
|
|
17
|
+
id: `fragments-${extractor == null ? void 0 : extractor.fragment}`,
|
|
18
|
+
dangerouslySetInnerHTML: { __html: extractor == null ? void 0 : extractor.styles.join("") }
|
|
19
|
+
}
|
|
20
|
+
));
|
|
21
|
+
};
|
|
22
|
+
var n, l, t, i, r, o, e, f, c, s, a, p = {}, v = [], y$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, d = Array.isArray;
|
|
23
|
+
function w(n2, l2) {
|
|
24
|
+
for (var t2 in l2) n2[t2] = l2[t2];
|
|
25
|
+
return n2;
|
|
26
|
+
}
|
|
27
|
+
function g(n2) {
|
|
28
|
+
n2 && n2.parentNode && n2.parentNode.removeChild(n2);
|
|
29
|
+
}
|
|
30
|
+
function _(l2, t2, u) {
|
|
31
|
+
var i2, r2, o2, e2 = {};
|
|
32
|
+
for (o2 in t2) "key" == o2 ? i2 = t2[o2] : "ref" == o2 ? r2 = t2[o2] : e2[o2] = t2[o2];
|
|
33
|
+
if (arguments.length > 2 && (e2.children = arguments.length > 3 ? n.call(arguments, 2) : u), "function" == typeof l2 && null != l2.defaultProps) for (o2 in l2.defaultProps) void 0 === e2[o2] && (e2[o2] = l2.defaultProps[o2]);
|
|
34
|
+
return m(l2, e2, i2, r2, null);
|
|
35
|
+
}
|
|
36
|
+
function m(n2, u, i2, r2, o2) {
|
|
37
|
+
var e2 = { type: n2, props: u, key: i2, ref: r2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o2 ? ++t : o2, __i: -1, __u: 0 };
|
|
38
|
+
return null == o2 && null != l.vnode && l.vnode(e2), e2;
|
|
39
|
+
}
|
|
40
|
+
function k(n2) {
|
|
41
|
+
return n2.children;
|
|
42
|
+
}
|
|
43
|
+
function x$1(n2, l2) {
|
|
44
|
+
this.props = n2, this.context = l2;
|
|
45
|
+
}
|
|
46
|
+
function S$1(n2, l2) {
|
|
47
|
+
if (null == l2) return n2.__ ? S$1(n2.__, n2.__i + 1) : null;
|
|
48
|
+
for (var t2; l2 < n2.__k.length; l2++) if (null != (t2 = n2.__k[l2]) && null != t2.__e) return t2.__e;
|
|
49
|
+
return "function" == typeof n2.type ? S$1(n2) : null;
|
|
50
|
+
}
|
|
51
|
+
function C(n2) {
|
|
52
|
+
var l2, t2;
|
|
53
|
+
if (null != (n2 = n2.__) && null != n2.__c) {
|
|
54
|
+
for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++) if (null != (t2 = n2.__k[l2]) && null != t2.__e) {
|
|
55
|
+
n2.__e = n2.__c.base = t2.__e;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return C(n2);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function M(n2) {
|
|
62
|
+
(!n2.__d && (n2.__d = true) && i.push(n2) && !$.__r++ || r !== l.debounceRendering) && ((r = l.debounceRendering) || o)($);
|
|
63
|
+
}
|
|
64
|
+
function $() {
|
|
65
|
+
for (var n2, t2, u, r2, o2, f2, c2, s2 = 1; i.length; ) i.length > s2 && i.sort(e), n2 = i.shift(), s2 = i.length, n2.__d && (u = void 0, o2 = (r2 = (t2 = n2).__v).__e, f2 = [], c2 = [], t2.__P && ((u = w({}, r2)).__v = r2.__v + 1, l.vnode && l.vnode(u), O(t2.__P, u, r2, t2.__n, t2.__P.namespaceURI, 32 & r2.__u ? [o2] : null, f2, null == o2 ? S$1(r2) : o2, !!(32 & r2.__u), c2), u.__v = r2.__v, u.__.__k[u.__i] = u, z(f2, u, c2), u.__e != o2 && C(u)));
|
|
66
|
+
$.__r = 0;
|
|
67
|
+
}
|
|
68
|
+
function I(n2, l2, t2, u, i2, r2, o2, e2, f2, c2, s2) {
|
|
69
|
+
var a2, h, y2, d2, w2, g2, _2 = u && u.__k || v, m2 = l2.length;
|
|
70
|
+
for (f2 = P(t2, l2, _2, f2, m2), a2 = 0; a2 < m2; a2++) null != (y2 = t2.__k[a2]) && (h = -1 === y2.__i ? p : _2[y2.__i] || p, y2.__i = a2, g2 = O(n2, y2, h, i2, r2, o2, e2, f2, c2, s2), d2 = y2.__e, y2.ref && h.ref != y2.ref && (h.ref && q(h.ref, null, y2), s2.push(y2.ref, y2.__c || d2, y2)), null == w2 && null != d2 && (w2 = d2), 4 & y2.__u || h.__k === y2.__k ? f2 = A(y2, f2, n2) : "function" == typeof y2.type && void 0 !== g2 ? f2 = g2 : d2 && (f2 = d2.nextSibling), y2.__u &= -7);
|
|
71
|
+
return t2.__e = w2, f2;
|
|
72
|
+
}
|
|
73
|
+
function P(n2, l2, t2, u, i2) {
|
|
74
|
+
var r2, o2, e2, f2, c2, s2 = t2.length, a2 = s2, h = 0;
|
|
75
|
+
for (n2.__k = new Array(i2), r2 = 0; r2 < i2; r2++) null != (o2 = l2[r2]) && "boolean" != typeof o2 && "function" != typeof o2 ? (f2 = r2 + h, (o2 = n2.__k[r2] = "string" == typeof o2 || "number" == typeof o2 || "bigint" == typeof o2 || o2.constructor == String ? m(null, o2, null, null, null) : d(o2) ? m(k, { children: o2 }, null, null, null) : void 0 === o2.constructor && o2.__b > 0 ? m(o2.type, o2.props, o2.key, o2.ref ? o2.ref : null, o2.__v) : o2).__ = n2, o2.__b = n2.__b + 1, e2 = null, -1 !== (c2 = o2.__i = L(o2, t2, f2, a2)) && (a2--, (e2 = t2[c2]) && (e2.__u |= 2)), null == e2 || null === e2.__v ? (-1 == c2 && (i2 > s2 ? h-- : i2 < s2 && h++), "function" != typeof o2.type && (o2.__u |= 4)) : c2 != f2 && (c2 == f2 - 1 ? h-- : c2 == f2 + 1 ? h++ : (c2 > f2 ? h-- : h++, o2.__u |= 4))) : n2.__k[r2] = null;
|
|
76
|
+
if (a2) for (r2 = 0; r2 < s2; r2++) null != (e2 = t2[r2]) && 0 == (2 & e2.__u) && (e2.__e == u && (u = S$1(e2)), B(e2, e2));
|
|
77
|
+
return u;
|
|
78
|
+
}
|
|
79
|
+
function A(n2, l2, t2) {
|
|
80
|
+
var u, i2;
|
|
81
|
+
if ("function" == typeof n2.type) {
|
|
82
|
+
for (u = n2.__k, i2 = 0; u && i2 < u.length; i2++) u[i2] && (u[i2].__ = n2, l2 = A(u[i2], l2, t2));
|
|
83
|
+
return l2;
|
|
84
|
+
}
|
|
85
|
+
n2.__e != l2 && (l2 && n2.type && !t2.contains(l2) && (l2 = S$1(n2)), t2.insertBefore(n2.__e, l2 || null), l2 = n2.__e);
|
|
86
|
+
do {
|
|
87
|
+
l2 = l2 && l2.nextSibling;
|
|
88
|
+
} while (null != l2 && 8 == l2.nodeType);
|
|
89
|
+
return l2;
|
|
90
|
+
}
|
|
91
|
+
function L(n2, l2, t2, u) {
|
|
92
|
+
var i2, r2, o2 = n2.key, e2 = n2.type, f2 = l2[t2];
|
|
93
|
+
if (null === f2 && null == n2.key || f2 && o2 == f2.key && e2 === f2.type && 0 == (2 & f2.__u)) return t2;
|
|
94
|
+
if (u > (null != f2 && 0 == (2 & f2.__u) ? 1 : 0)) for (i2 = t2 - 1, r2 = t2 + 1; i2 >= 0 || r2 < l2.length; ) {
|
|
95
|
+
if (i2 >= 0) {
|
|
96
|
+
if ((f2 = l2[i2]) && 0 == (2 & f2.__u) && o2 == f2.key && e2 === f2.type) return i2;
|
|
97
|
+
i2--;
|
|
98
|
+
}
|
|
99
|
+
if (r2 < l2.length) {
|
|
100
|
+
if ((f2 = l2[r2]) && 0 == (2 & f2.__u) && o2 == f2.key && e2 === f2.type) return r2;
|
|
101
|
+
r2++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return -1;
|
|
105
|
+
}
|
|
106
|
+
function T(n2, l2, t2) {
|
|
107
|
+
"-" == l2[0] ? n2.setProperty(l2, null == t2 ? "" : t2) : n2[l2] = null == t2 ? "" : "number" != typeof t2 || y$1.test(l2) ? t2 : t2 + "px";
|
|
108
|
+
}
|
|
109
|
+
function j(n2, l2, t2, u, i2) {
|
|
110
|
+
var r2;
|
|
111
|
+
n: if ("style" == l2) if ("string" == typeof t2) n2.style.cssText = t2;
|
|
112
|
+
else {
|
|
113
|
+
if ("string" == typeof u && (n2.style.cssText = u = ""), u) for (l2 in u) t2 && l2 in t2 || T(n2.style, l2, "");
|
|
114
|
+
if (t2) for (l2 in t2) u && t2[l2] === u[l2] || T(n2.style, l2, t2[l2]);
|
|
115
|
+
}
|
|
116
|
+
else if ("o" == l2[0] && "n" == l2[1]) r2 = l2 != (l2 = l2.replace(f, "$1")), l2 = l2.toLowerCase() in n2 || "onFocusOut" == l2 || "onFocusIn" == l2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + r2] = t2, t2 ? u ? t2.t = u.t : (t2.t = c, n2.addEventListener(l2, r2 ? a : s, r2)) : n2.removeEventListener(l2, r2 ? a : s, r2);
|
|
117
|
+
else {
|
|
118
|
+
if ("http://www.w3.org/2000/svg" == i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
119
|
+
else if ("width" != l2 && "height" != l2 && "href" != l2 && "list" != l2 && "form" != l2 && "tabIndex" != l2 && "download" != l2 && "rowSpan" != l2 && "colSpan" != l2 && "role" != l2 && "popover" != l2 && l2 in n2) try {
|
|
120
|
+
n2[l2] = null == t2 ? "" : t2;
|
|
121
|
+
break n;
|
|
122
|
+
} catch (n3) {
|
|
123
|
+
}
|
|
124
|
+
"function" == typeof t2 || (null == t2 || false === t2 && "-" != l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, "popover" == l2 && 1 == t2 ? "" : t2));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function F(n2) {
|
|
128
|
+
return function(t2) {
|
|
129
|
+
if (this.l) {
|
|
130
|
+
var u = this.l[t2.type + n2];
|
|
131
|
+
if (null == t2.u) t2.u = c++;
|
|
132
|
+
else if (t2.u < u.t) return;
|
|
133
|
+
return u(l.event ? l.event(t2) : t2);
|
|
134
|
+
}
|
|
29
135
|
};
|
|
30
136
|
}
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var e = require$$0;
|
|
48
|
-
function h(a, b) {
|
|
49
|
-
return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
|
|
50
|
-
}
|
|
51
|
-
var k = "function" === typeof Object.is ? Object.is : h, l = e.useState, m = e.useEffect, n = e.useLayoutEffect, p = e.useDebugValue;
|
|
52
|
-
function q(a, b) {
|
|
53
|
-
var d = b(), f = l({ inst: { value: d, getSnapshot: b } }), c = f[0].inst, g = f[1];
|
|
54
|
-
n(function() {
|
|
55
|
-
c.value = d;
|
|
56
|
-
c.getSnapshot = b;
|
|
57
|
-
r(c) && g({ inst: c });
|
|
58
|
-
}, [a, d, b]);
|
|
59
|
-
m(function() {
|
|
60
|
-
r(c) && g({ inst: c });
|
|
61
|
-
return a(function() {
|
|
62
|
-
r(c) && g({ inst: c });
|
|
137
|
+
function O(n2, t2, u, i2, r2, o2, e2, f2, c2, s2) {
|
|
138
|
+
var a2, h, p2, v2, y2, _2, m2, b, S2, C2, M2, $2, P2, A2, H, L2, T2, j2 = t2.type;
|
|
139
|
+
if (void 0 !== t2.constructor) return null;
|
|
140
|
+
128 & u.__u && (c2 = !!(32 & u.__u), o2 = [f2 = t2.__e = u.__e]), (a2 = l.__b) && a2(t2);
|
|
141
|
+
n: if ("function" == typeof j2) try {
|
|
142
|
+
if (b = t2.props, S2 = "prototype" in j2 && j2.prototype.render, C2 = (a2 = j2.contextType) && i2[a2.__c], M2 = a2 ? C2 ? C2.props.value : a2.__ : i2, u.__c ? m2 = (h = t2.__c = u.__c).__ = h.__E : (S2 ? t2.__c = h = new j2(b, M2) : (t2.__c = h = new x$1(b, M2), h.constructor = j2, h.render = D), C2 && C2.sub(h), h.props = b, h.state || (h.state = {}), h.context = M2, h.__n = i2, p2 = h.__d = true, h.__h = [], h._sb = []), S2 && null == h.__s && (h.__s = h.state), S2 && null != j2.getDerivedStateFromProps && (h.__s == h.state && (h.__s = w({}, h.__s)), w(h.__s, j2.getDerivedStateFromProps(b, h.__s))), v2 = h.props, y2 = h.state, h.__v = t2, p2) S2 && null == j2.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), S2 && null != h.componentDidMount && h.__h.push(h.componentDidMount);
|
|
143
|
+
else {
|
|
144
|
+
if (S2 && null == j2.getDerivedStateFromProps && b !== v2 && null != h.componentWillReceiveProps && h.componentWillReceiveProps(b, M2), !h.__e && (null != h.shouldComponentUpdate && false === h.shouldComponentUpdate(b, h.__s, M2) || t2.__v == u.__v)) {
|
|
145
|
+
for (t2.__v != u.__v && (h.props = b, h.state = h.__s, h.__d = false), t2.__e = u.__e, t2.__k = u.__k, t2.__k.some(function(n3) {
|
|
146
|
+
n3 && (n3.__ = t2);
|
|
147
|
+
}), $2 = 0; $2 < h._sb.length; $2++) h.__h.push(h._sb[$2]);
|
|
148
|
+
h._sb = [], h.__h.length && e2.push(h);
|
|
149
|
+
break n;
|
|
150
|
+
}
|
|
151
|
+
null != h.componentWillUpdate && h.componentWillUpdate(b, h.__s, M2), S2 && null != h.componentDidUpdate && h.__h.push(function() {
|
|
152
|
+
h.componentDidUpdate(v2, y2, _2);
|
|
63
153
|
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
154
|
+
}
|
|
155
|
+
if (h.context = M2, h.props = b, h.__P = n2, h.__e = false, P2 = l.__r, A2 = 0, S2) {
|
|
156
|
+
for (h.state = h.__s, h.__d = false, P2 && P2(t2), a2 = h.render(h.props, h.state, h.context), H = 0; H < h._sb.length; H++) h.__h.push(h._sb[H]);
|
|
157
|
+
h._sb = [];
|
|
158
|
+
} else do {
|
|
159
|
+
h.__d = false, P2 && P2(t2), a2 = h.render(h.props, h.state, h.context), h.state = h.__s;
|
|
160
|
+
} while (h.__d && ++A2 < 25);
|
|
161
|
+
h.state = h.__s, null != h.getChildContext && (i2 = w(w({}, i2), h.getChildContext())), S2 && !p2 && null != h.getSnapshotBeforeUpdate && (_2 = h.getSnapshotBeforeUpdate(v2, y2)), L2 = a2, null != a2 && a2.type === k && null == a2.key && (L2 = N(a2.props.children)), f2 = I(n2, d(L2) ? L2 : [L2], t2, u, i2, r2, o2, e2, f2, c2, s2), h.base = t2.__e, t2.__u &= -161, h.__h.length && e2.push(h), m2 && (h.__E = h.__ = null);
|
|
162
|
+
} catch (n3) {
|
|
163
|
+
if (t2.__v = null, c2 || null != o2) if (n3.then) {
|
|
164
|
+
for (t2.__u |= c2 ? 160 : 128; f2 && 8 == f2.nodeType && f2.nextSibling; ) f2 = f2.nextSibling;
|
|
165
|
+
o2[o2.indexOf(f2)] = null, t2.__e = f2;
|
|
166
|
+
} else for (T2 = o2.length; T2--; ) g(o2[T2]);
|
|
167
|
+
else t2.__e = u.__e, t2.__k = u.__k;
|
|
168
|
+
l.__e(n3, t2, u);
|
|
67
169
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
170
|
+
else null == o2 && t2.__v == u.__v ? (t2.__k = u.__k, t2.__e = u.__e) : f2 = t2.__e = V(u.__e, t2, u, i2, r2, o2, e2, c2, s2);
|
|
171
|
+
return (a2 = l.diffed) && a2(t2), 128 & t2.__u ? void 0 : f2;
|
|
172
|
+
}
|
|
173
|
+
function z(n2, t2, u) {
|
|
174
|
+
for (var i2 = 0; i2 < u.length; i2++) q(u[i2], u[++i2], u[++i2]);
|
|
175
|
+
l.__c && l.__c(t2, n2), n2.some(function(t3) {
|
|
71
176
|
try {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
177
|
+
n2 = t3.__h, t3.__h = [], n2.some(function(n3) {
|
|
178
|
+
n3.call(t3);
|
|
179
|
+
});
|
|
180
|
+
} catch (n3) {
|
|
181
|
+
l.__e(n3, t3.__v);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function N(n2) {
|
|
186
|
+
return "object" != typeof n2 || null == n2 ? n2 : d(n2) ? n2.map(N) : w({}, n2);
|
|
187
|
+
}
|
|
188
|
+
function V(t2, u, i2, r2, o2, e2, f2, c2, s2) {
|
|
189
|
+
var a2, h, v2, y2, w2, _2, m2, b = i2.props, k2 = u.props, x2 = u.type;
|
|
190
|
+
if ("svg" == x2 ? o2 = "http://www.w3.org/2000/svg" : "math" == x2 ? o2 = "http://www.w3.org/1998/Math/MathML" : o2 || (o2 = "http://www.w3.org/1999/xhtml"), null != e2) {
|
|
191
|
+
for (a2 = 0; a2 < e2.length; a2++) if ((w2 = e2[a2]) && "setAttribute" in w2 == !!x2 && (x2 ? w2.localName == x2 : 3 == w2.nodeType)) {
|
|
192
|
+
t2 = w2, e2[a2] = null;
|
|
193
|
+
break;
|
|
76
194
|
}
|
|
77
195
|
}
|
|
78
|
-
|
|
79
|
-
return
|
|
196
|
+
if (null == t2) {
|
|
197
|
+
if (null == x2) return document.createTextNode(k2);
|
|
198
|
+
t2 = document.createElementNS(o2, x2, k2.is && k2), c2 && (l.__m && l.__m(u, e2), c2 = false), e2 = null;
|
|
199
|
+
}
|
|
200
|
+
if (null === x2) b === k2 || c2 && t2.data === k2 || (t2.data = k2);
|
|
201
|
+
else {
|
|
202
|
+
if (e2 = e2 && n.call(t2.childNodes), b = i2.props || p, !c2 && null != e2) for (b = {}, a2 = 0; a2 < t2.attributes.length; a2++) b[(w2 = t2.attributes[a2]).name] = w2.value;
|
|
203
|
+
for (a2 in b) if (w2 = b[a2], "children" == a2) ;
|
|
204
|
+
else if ("dangerouslySetInnerHTML" == a2) v2 = w2;
|
|
205
|
+
else if (!(a2 in k2)) {
|
|
206
|
+
if ("value" == a2 && "defaultValue" in k2 || "checked" == a2 && "defaultChecked" in k2) continue;
|
|
207
|
+
j(t2, a2, null, w2, o2);
|
|
208
|
+
}
|
|
209
|
+
for (a2 in k2) w2 = k2[a2], "children" == a2 ? y2 = w2 : "dangerouslySetInnerHTML" == a2 ? h = w2 : "value" == a2 ? _2 = w2 : "checked" == a2 ? m2 = w2 : c2 && "function" != typeof w2 || b[a2] === w2 || j(t2, a2, w2, b[a2], o2);
|
|
210
|
+
if (h) c2 || v2 && (h.__html === v2.__html || h.__html === t2.innerHTML) || (t2.innerHTML = h.__html), u.__k = [];
|
|
211
|
+
else if (v2 && (t2.innerHTML = ""), I("template" === u.type ? t2.content : t2, d(y2) ? y2 : [y2], u, i2, r2, "foreignObject" == x2 ? "http://www.w3.org/1999/xhtml" : o2, e2, f2, e2 ? e2[0] : i2.__k && S$1(i2, 0), c2, s2), null != e2) for (a2 = e2.length; a2--; ) g(e2[a2]);
|
|
212
|
+
c2 || (a2 = "value", "progress" == x2 && null == _2 ? t2.removeAttribute("value") : void 0 !== _2 && (_2 !== t2[a2] || "progress" == x2 && !_2 || "option" == x2 && _2 !== b[a2]) && j(t2, a2, _2, b[a2], o2), a2 = "checked", void 0 !== m2 && m2 !== t2[a2] && j(t2, a2, m2, b[a2], o2));
|
|
80
213
|
}
|
|
81
|
-
|
|
82
|
-
useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u;
|
|
83
|
-
return useSyncExternalStoreShim_production_min;
|
|
214
|
+
return t2;
|
|
84
215
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
216
|
+
function q(n2, t2, u) {
|
|
217
|
+
try {
|
|
218
|
+
if ("function" == typeof n2) {
|
|
219
|
+
var i2 = "function" == typeof n2.__u;
|
|
220
|
+
i2 && n2.__u(), i2 && null == t2 || (n2.__u = n2(t2));
|
|
221
|
+
} else n2.current = t2;
|
|
222
|
+
} catch (n3) {
|
|
223
|
+
l.__e(n3, u);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function B(n2, t2, u) {
|
|
227
|
+
var i2, r2;
|
|
228
|
+
if (l.unmount && l.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || q(i2, null, t2)), null != (i2 = n2.__c)) {
|
|
229
|
+
if (i2.componentWillUnmount) try {
|
|
230
|
+
i2.componentWillUnmount();
|
|
231
|
+
} catch (n3) {
|
|
232
|
+
l.__e(n3, t2);
|
|
233
|
+
}
|
|
234
|
+
i2.base = i2.__P = null;
|
|
235
|
+
}
|
|
236
|
+
if (i2 = n2.__k) for (r2 = 0; r2 < i2.length; r2++) i2[r2] && B(i2[r2], t2, u || "function" != typeof n2.type);
|
|
237
|
+
u || g(n2.__e), n2.__c = n2.__ = n2.__e = void 0;
|
|
238
|
+
}
|
|
239
|
+
function D(n2, l2, t2) {
|
|
240
|
+
return this.constructor(n2, t2);
|
|
241
|
+
}
|
|
242
|
+
function E(t2, u, i2) {
|
|
243
|
+
var r2, o2, e2, f2;
|
|
244
|
+
u == document && (u = document.documentElement), l.__ && l.__(t2, u), o2 = (r2 = "function" == typeof i2) ? null : i2 && i2.__k || u.__k, e2 = [], f2 = [], O(u, t2 = (!r2 && i2 || u).__k = _(k, null, [t2]), o2 || p, p, u.namespaceURI, !r2 && i2 ? [i2] : o2 ? null : u.firstChild ? n.call(u.childNodes) : null, e2, !r2 && i2 ? i2 : o2 ? o2.__e : u.firstChild, r2, f2), z(e2, t2, f2);
|
|
245
|
+
}
|
|
246
|
+
function G(n2, l2) {
|
|
247
|
+
E(n2, l2, G);
|
|
248
|
+
}
|
|
249
|
+
function J(l2, t2, u) {
|
|
250
|
+
var i2, r2, o2, e2, f2 = w({}, l2.props);
|
|
251
|
+
for (o2 in l2.type && l2.type.defaultProps && (e2 = l2.type.defaultProps), t2) "key" == o2 ? i2 = t2[o2] : "ref" == o2 ? r2 = t2[o2] : f2[o2] = void 0 === t2[o2] && void 0 !== e2 ? e2[o2] : t2[o2];
|
|
252
|
+
return arguments.length > 2 && (f2.children = arguments.length > 3 ? n.call(arguments, 2) : u), m(l2.type, f2, i2 || l2.key, r2 || l2.ref, null);
|
|
253
|
+
}
|
|
254
|
+
n = v.slice, l = { __e: function(n2, l2, t2, u) {
|
|
255
|
+
for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
|
|
256
|
+
if ((r2 = i2.constructor) && null != r2.getDerivedStateFromError && (i2.setState(r2.getDerivedStateFromError(n2)), o2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, u || {}), o2 = i2.__d), o2) return i2.__E = i2;
|
|
257
|
+
} catch (l3) {
|
|
258
|
+
n2 = l3;
|
|
259
|
+
}
|
|
260
|
+
throw n2;
|
|
261
|
+
} }, t = 0, x$1.prototype.setState = function(n2, l2) {
|
|
262
|
+
var t2;
|
|
263
|
+
t2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = w({}, this.state), "function" == typeof n2 && (n2 = n2(w({}, t2), this.props)), n2 && w(t2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), M(this));
|
|
264
|
+
}, x$1.prototype.forceUpdate = function(n2) {
|
|
265
|
+
this.__v && (this.__e = true, n2 && this.__h.push(n2), M(this));
|
|
266
|
+
}, x$1.prototype.render = k, i = [], o = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n2, l2) {
|
|
267
|
+
return n2.__v.__b - l2.__v.__b;
|
|
268
|
+
}, $.__r = 0, f = /(PointerCapture)$|Capture$/i, c = 0, s = F(false), a = F(true);
|
|
269
|
+
(function() {
|
|
270
|
+
try {
|
|
271
|
+
if (typeof document != "undefined") {
|
|
272
|
+
var elementStyle = document.createElement("style");
|
|
273
|
+
elementStyle.appendChild(document.createTextNode("._fragment_1c708_1 {\n width: 100%;\n height: 100%;\n}\n\n._fragmentDocument_1c708_6 {\n display: contents;\n}\n._text_1liuf_1 {\n white-space: pre;\n :where(p) {\n margin: 0;\n }\n}"));
|
|
274
|
+
document.head.appendChild(elementStyle);
|
|
275
|
+
}
|
|
276
|
+
} catch (e2) {
|
|
277
|
+
console.error("vite-plugin-css-injected-by-js", e2);
|
|
278
|
+
}
|
|
279
|
+
})();
|
|
280
|
+
const createConstants = (...constants) => {
|
|
281
|
+
return constants.reduce((acc, constant) => {
|
|
282
|
+
acc[constant] = constant;
|
|
283
|
+
return acc;
|
|
284
|
+
}, {});
|
|
285
|
+
};
|
|
286
|
+
const nodes = createConstants(
|
|
287
|
+
"Fragment",
|
|
288
|
+
"FragmentInstance",
|
|
289
|
+
"Instance",
|
|
290
|
+
"Collection",
|
|
291
|
+
"Breakpoint",
|
|
292
|
+
"Frame",
|
|
293
|
+
"Image",
|
|
294
|
+
"Text",
|
|
295
|
+
"SolidPaintStyle",
|
|
296
|
+
"CssLink",
|
|
297
|
+
"Variable",
|
|
298
|
+
"ComputedValue",
|
|
299
|
+
"TransformValue"
|
|
300
|
+
);
|
|
301
|
+
const fragmentGrowingMode = createConstants("auto", "fill");
|
|
302
|
+
const borderType = createConstants("None", "Solid", "Dashed", "Dotted");
|
|
303
|
+
const linkTarget = createConstants("_blank", "none");
|
|
304
|
+
const paintMode = createConstants("None", "Solid", "Image");
|
|
305
|
+
const imagePaintScaleModes = createConstants("Auto", "Contain", "Cover");
|
|
306
|
+
const constrain = createConstants(
|
|
307
|
+
"Min",
|
|
308
|
+
"Center",
|
|
309
|
+
"Max",
|
|
310
|
+
"Stretch",
|
|
311
|
+
"Scale"
|
|
312
|
+
);
|
|
313
|
+
const positionType = createConstants("absolute", "relative");
|
|
314
|
+
const sizing = createConstants("Fixed", "Hug", "Fill", "Relative");
|
|
315
|
+
const layerMode = createConstants("none", "flex");
|
|
316
|
+
const layerDirection = createConstants("vertical", "horizontal");
|
|
317
|
+
const layerAlign = createConstants("start", "center", "end");
|
|
318
|
+
const layerDistribute = createConstants(
|
|
319
|
+
"start",
|
|
320
|
+
"center",
|
|
321
|
+
"end",
|
|
322
|
+
"space-between",
|
|
323
|
+
"space-around"
|
|
324
|
+
);
|
|
325
|
+
const textTransform = createConstants(
|
|
326
|
+
"none",
|
|
327
|
+
"uppercase",
|
|
328
|
+
"lowercase",
|
|
329
|
+
"capitalize"
|
|
330
|
+
);
|
|
331
|
+
const textDecorations = createConstants(
|
|
332
|
+
"none",
|
|
333
|
+
"underline",
|
|
334
|
+
"line-through"
|
|
335
|
+
);
|
|
336
|
+
const effectType = createConstants("loop", "appear", "hover", "tap");
|
|
337
|
+
const effectName = createConstants(
|
|
338
|
+
"fade",
|
|
339
|
+
"slide",
|
|
340
|
+
"bounce",
|
|
341
|
+
"wiggle",
|
|
342
|
+
"increase"
|
|
343
|
+
);
|
|
344
|
+
const variableType = createConstants(
|
|
345
|
+
"Event",
|
|
346
|
+
"String",
|
|
347
|
+
"Link",
|
|
348
|
+
"Boolean",
|
|
349
|
+
"Array",
|
|
350
|
+
"Color",
|
|
351
|
+
"ComponentInstance",
|
|
352
|
+
"Date",
|
|
353
|
+
"Enum",
|
|
354
|
+
"Number",
|
|
355
|
+
"Image",
|
|
356
|
+
"Object"
|
|
357
|
+
);
|
|
358
|
+
const whiteSpace = createConstants(
|
|
359
|
+
"normal",
|
|
360
|
+
"nowrap",
|
|
361
|
+
"pre",
|
|
362
|
+
"pre-wrap",
|
|
363
|
+
"pre-line",
|
|
364
|
+
"break-spaces"
|
|
365
|
+
);
|
|
366
|
+
const overflow = createConstants("visible", "hidden", "scroll");
|
|
367
|
+
const variableTransforms = createConstants(
|
|
368
|
+
"convert",
|
|
369
|
+
"exists",
|
|
370
|
+
"equals",
|
|
371
|
+
"startWith",
|
|
372
|
+
"endWith",
|
|
373
|
+
"contains",
|
|
374
|
+
"dateBefore",
|
|
375
|
+
"dateAfter",
|
|
376
|
+
"dateBetween",
|
|
377
|
+
"feature",
|
|
378
|
+
"notFeature",
|
|
379
|
+
"gt",
|
|
380
|
+
// Greater than
|
|
381
|
+
"gte",
|
|
382
|
+
// Greater than or equals
|
|
383
|
+
"lt",
|
|
384
|
+
// Less than
|
|
385
|
+
"lte",
|
|
386
|
+
// Less than or equals,
|
|
387
|
+
"convertFromBoolean",
|
|
388
|
+
"negative"
|
|
389
|
+
);
|
|
390
|
+
const renderTarget = createConstants("canvas", "document");
|
|
391
|
+
const renderMode = createConstants("viewport", "parent", "fixed");
|
|
392
|
+
const interactions = createConstants("click", "mouseover", "appear");
|
|
393
|
+
const eventMode = createConstants("goal", "callback", "tracker");
|
|
394
|
+
const scopeTypes = createConstants(
|
|
395
|
+
"InstanceScope",
|
|
396
|
+
"FragmentScope",
|
|
397
|
+
"CollectionScope",
|
|
398
|
+
"CollectionItemScope"
|
|
399
|
+
);
|
|
400
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
401
|
+
__proto__: null,
|
|
402
|
+
borderType,
|
|
403
|
+
constrain,
|
|
404
|
+
createConstants,
|
|
405
|
+
effectName,
|
|
406
|
+
effectType,
|
|
407
|
+
eventMode,
|
|
408
|
+
fragmentGrowingMode,
|
|
409
|
+
imagePaintScaleModes,
|
|
410
|
+
interactions,
|
|
411
|
+
layerAlign,
|
|
412
|
+
layerDirection,
|
|
413
|
+
layerDistribute,
|
|
414
|
+
layerMode,
|
|
415
|
+
linkTarget,
|
|
416
|
+
nodes,
|
|
417
|
+
overflow,
|
|
418
|
+
paintMode,
|
|
419
|
+
positionType,
|
|
420
|
+
renderMode,
|
|
421
|
+
renderTarget,
|
|
422
|
+
scopeTypes,
|
|
423
|
+
sizing,
|
|
424
|
+
textDecorations,
|
|
425
|
+
textTransform,
|
|
426
|
+
variableTransforms,
|
|
427
|
+
variableType,
|
|
428
|
+
whiteSpace
|
|
429
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
430
|
+
// @__NO_SIDE_EFFECTS__
|
|
431
|
+
function getGlobalConfig(config2) {
|
|
432
|
+
return {
|
|
433
|
+
lang: (config2 == null ? void 0 : config2.lang) ?? void 0,
|
|
434
|
+
message: config2 == null ? void 0 : config2.message,
|
|
435
|
+
abortEarly: (config2 == null ? void 0 : config2.abortEarly) ?? void 0,
|
|
436
|
+
abortPipeEarly: (config2 == null ? void 0 : config2.abortPipeEarly) ?? void 0
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
// @__NO_SIDE_EFFECTS__
|
|
440
|
+
function getGlobalMessage(lang) {
|
|
441
|
+
return void 0;
|
|
442
|
+
}
|
|
443
|
+
// @__NO_SIDE_EFFECTS__
|
|
444
|
+
function getSchemaMessage(lang) {
|
|
445
|
+
return void 0;
|
|
446
|
+
}
|
|
447
|
+
// @__NO_SIDE_EFFECTS__
|
|
448
|
+
function getSpecificMessage(reference, lang) {
|
|
449
|
+
var _a;
|
|
450
|
+
return (_a = void 0) == null ? void 0 : _a.get(lang);
|
|
451
|
+
}
|
|
452
|
+
// @__NO_SIDE_EFFECTS__
|
|
453
|
+
function _stringify(input) {
|
|
454
|
+
var _a, _b;
|
|
455
|
+
const type = typeof input;
|
|
456
|
+
if (type === "string") {
|
|
457
|
+
return `"${input}"`;
|
|
458
|
+
}
|
|
459
|
+
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
460
|
+
return `${input}`;
|
|
461
|
+
}
|
|
462
|
+
if (type === "object" || type === "function") {
|
|
463
|
+
return (input && ((_b = (_a = Object.getPrototypeOf(input)) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name)) ?? "null";
|
|
464
|
+
}
|
|
465
|
+
return type;
|
|
466
|
+
}
|
|
467
|
+
function _addIssue(context, label, dataset, config2, other) {
|
|
468
|
+
const input = other && "input" in other ? other.input : dataset.value;
|
|
469
|
+
const expected = (other == null ? void 0 : other.expected) ?? context.expects ?? null;
|
|
470
|
+
const received = (other == null ? void 0 : other.received) ?? /* @__PURE__ */ _stringify(input);
|
|
471
|
+
const issue = {
|
|
472
|
+
kind: context.kind,
|
|
473
|
+
type: context.type,
|
|
474
|
+
input,
|
|
475
|
+
expected,
|
|
476
|
+
received,
|
|
477
|
+
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
478
|
+
requirement: context.requirement,
|
|
479
|
+
path: other == null ? void 0 : other.path,
|
|
480
|
+
issues: other == null ? void 0 : other.issues,
|
|
481
|
+
lang: config2.lang,
|
|
482
|
+
abortEarly: config2.abortEarly,
|
|
483
|
+
abortPipeEarly: config2.abortPipeEarly
|
|
484
|
+
};
|
|
485
|
+
const isSchema = context.kind === "schema";
|
|
486
|
+
const message = (other == null ? void 0 : other.message) ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
487
|
+
if (message !== void 0) {
|
|
488
|
+
issue.message = typeof message === "function" ? (
|
|
489
|
+
// @ts-expect-error
|
|
490
|
+
message(issue)
|
|
491
|
+
) : message;
|
|
492
|
+
}
|
|
493
|
+
if (isSchema) {
|
|
494
|
+
dataset.typed = false;
|
|
495
|
+
}
|
|
496
|
+
if (dataset.issues) {
|
|
497
|
+
dataset.issues.push(issue);
|
|
498
|
+
} else {
|
|
499
|
+
dataset.issues = [issue];
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
// @__NO_SIDE_EFFECTS__
|
|
503
|
+
function _getStandardProps(context) {
|
|
504
|
+
return {
|
|
505
|
+
version: 1,
|
|
506
|
+
vendor: "valibot",
|
|
507
|
+
validate(value2) {
|
|
508
|
+
return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
// @__NO_SIDE_EFFECTS__
|
|
513
|
+
function _isValidObjectKey(object2, key) {
|
|
514
|
+
return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
515
|
+
}
|
|
516
|
+
// @__NO_SIDE_EFFECTS__
|
|
517
|
+
function _joinExpects(values2, separator) {
|
|
518
|
+
const list = [...new Set(values2)];
|
|
519
|
+
if (list.length > 1) {
|
|
520
|
+
return `(${list.join(` ${separator} `)})`;
|
|
521
|
+
}
|
|
522
|
+
return list[0] ?? "never";
|
|
523
|
+
}
|
|
524
|
+
// @__NO_SIDE_EFFECTS__
|
|
525
|
+
function isOfKind(kind, object2) {
|
|
526
|
+
return object2.kind === kind;
|
|
527
|
+
}
|
|
528
|
+
var ValiError = class extends Error {
|
|
529
|
+
/**
|
|
530
|
+
* Creates a Valibot error with useful information.
|
|
531
|
+
*
|
|
532
|
+
* @param issues The error issues.
|
|
533
|
+
*/
|
|
534
|
+
constructor(issues) {
|
|
535
|
+
super(issues[0].message);
|
|
536
|
+
this.name = "ValiError";
|
|
537
|
+
this.issues = issues;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
// @__NO_SIDE_EFFECTS__
|
|
541
|
+
function check(requirement, message) {
|
|
542
|
+
return {
|
|
543
|
+
kind: "validation",
|
|
544
|
+
type: "check",
|
|
545
|
+
reference: check,
|
|
546
|
+
async: false,
|
|
547
|
+
expects: null,
|
|
548
|
+
requirement,
|
|
549
|
+
message,
|
|
550
|
+
"~run"(dataset, config2) {
|
|
551
|
+
if (dataset.typed && !this.requirement(dataset.value)) {
|
|
552
|
+
_addIssue(this, "input", dataset, config2);
|
|
115
553
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
554
|
+
return dataset;
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
// @__NO_SIDE_EFFECTS__
|
|
559
|
+
function maxValue(requirement, message) {
|
|
560
|
+
return {
|
|
561
|
+
kind: "validation",
|
|
562
|
+
type: "max_value",
|
|
563
|
+
reference: maxValue,
|
|
564
|
+
async: false,
|
|
565
|
+
expects: `<=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
566
|
+
requirement,
|
|
567
|
+
message,
|
|
568
|
+
"~run"(dataset, config2) {
|
|
569
|
+
if (dataset.typed && !(dataset.value <= this.requirement)) {
|
|
570
|
+
_addIssue(this, "value", dataset, config2, {
|
|
571
|
+
received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value)
|
|
572
|
+
});
|
|
130
573
|
}
|
|
131
|
-
|
|
132
|
-
|
|
574
|
+
return dataset;
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
// @__NO_SIDE_EFFECTS__
|
|
579
|
+
function metadata(metadata_) {
|
|
580
|
+
return {
|
|
581
|
+
kind: "metadata",
|
|
582
|
+
type: "metadata",
|
|
583
|
+
reference: metadata,
|
|
584
|
+
metadata: metadata_
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
// @__NO_SIDE_EFFECTS__
|
|
588
|
+
function minValue(requirement, message) {
|
|
589
|
+
return {
|
|
590
|
+
kind: "validation",
|
|
591
|
+
type: "min_value",
|
|
592
|
+
reference: minValue,
|
|
593
|
+
async: false,
|
|
594
|
+
expects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
595
|
+
requirement,
|
|
596
|
+
message,
|
|
597
|
+
"~run"(dataset, config2) {
|
|
598
|
+
if (dataset.typed && !(dataset.value >= this.requirement)) {
|
|
599
|
+
_addIssue(this, "value", dataset, config2, {
|
|
600
|
+
received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value)
|
|
601
|
+
});
|
|
133
602
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
603
|
+
return dataset;
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
// @__NO_SIDE_EFFECTS__
|
|
608
|
+
function transform(operation) {
|
|
609
|
+
return {
|
|
610
|
+
kind: "transformation",
|
|
611
|
+
type: "transform",
|
|
612
|
+
reference: transform,
|
|
613
|
+
async: false,
|
|
614
|
+
operation,
|
|
615
|
+
"~run"(dataset) {
|
|
616
|
+
dataset.value = this.operation(dataset.value);
|
|
617
|
+
return dataset;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
// @__NO_SIDE_EFFECTS__
|
|
622
|
+
function getFallback(schema, dataset, config2) {
|
|
623
|
+
return typeof schema.fallback === "function" ? (
|
|
624
|
+
// @ts-expect-error
|
|
625
|
+
schema.fallback(dataset, config2)
|
|
626
|
+
) : (
|
|
627
|
+
// @ts-expect-error
|
|
628
|
+
schema.fallback
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
// @__NO_SIDE_EFFECTS__
|
|
632
|
+
function getDefault(schema, dataset, config2) {
|
|
633
|
+
return typeof schema.default === "function" ? (
|
|
634
|
+
// @ts-expect-error
|
|
635
|
+
schema.default(dataset, config2)
|
|
636
|
+
) : (
|
|
637
|
+
// @ts-expect-error
|
|
638
|
+
schema.default
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
// @__NO_SIDE_EFFECTS__
|
|
642
|
+
function any() {
|
|
643
|
+
return {
|
|
644
|
+
kind: "schema",
|
|
645
|
+
type: "any",
|
|
646
|
+
reference: any,
|
|
647
|
+
expects: "any",
|
|
648
|
+
async: false,
|
|
649
|
+
get "~standard"() {
|
|
650
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
651
|
+
},
|
|
652
|
+
"~run"(dataset) {
|
|
653
|
+
dataset.typed = true;
|
|
654
|
+
return dataset;
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
// @__NO_SIDE_EFFECTS__
|
|
659
|
+
function array(item, message) {
|
|
660
|
+
return {
|
|
661
|
+
kind: "schema",
|
|
662
|
+
type: "array",
|
|
663
|
+
reference: array,
|
|
664
|
+
expects: "Array",
|
|
665
|
+
async: false,
|
|
666
|
+
item,
|
|
667
|
+
message,
|
|
668
|
+
get "~standard"() {
|
|
669
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
670
|
+
},
|
|
671
|
+
"~run"(dataset, config2) {
|
|
672
|
+
var _a;
|
|
673
|
+
const input = dataset.value;
|
|
674
|
+
if (Array.isArray(input)) {
|
|
675
|
+
dataset.typed = true;
|
|
676
|
+
dataset.value = [];
|
|
677
|
+
for (let key = 0; key < input.length; key++) {
|
|
678
|
+
const value2 = input[key];
|
|
679
|
+
const itemDataset = this.item["~run"]({ value: value2 }, config2);
|
|
680
|
+
if (itemDataset.issues) {
|
|
681
|
+
const pathItem = {
|
|
682
|
+
type: "array",
|
|
683
|
+
origin: "value",
|
|
684
|
+
input,
|
|
685
|
+
key,
|
|
686
|
+
value: value2
|
|
687
|
+
};
|
|
688
|
+
for (const issue of itemDataset.issues) {
|
|
689
|
+
if (issue.path) {
|
|
690
|
+
issue.path.unshift(pathItem);
|
|
691
|
+
} else {
|
|
692
|
+
issue.path = [pathItem];
|
|
693
|
+
}
|
|
694
|
+
(_a = dataset.issues) == null ? void 0 : _a.push(issue);
|
|
144
695
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (!objectIs(value, cachedValue)) {
|
|
152
|
-
error("The result of getSnapshot should be cached to avoid an infinite loop");
|
|
153
|
-
didWarnUncachedGetSnapshot = true;
|
|
696
|
+
if (!dataset.issues) {
|
|
697
|
+
dataset.issues = itemDataset.issues;
|
|
698
|
+
}
|
|
699
|
+
if (config2.abortEarly) {
|
|
700
|
+
dataset.typed = false;
|
|
701
|
+
break;
|
|
154
702
|
}
|
|
155
703
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
inst: {
|
|
159
|
-
value,
|
|
160
|
-
getSnapshot
|
|
161
|
-
}
|
|
162
|
-
}), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
163
|
-
useLayoutEffect(function() {
|
|
164
|
-
inst.value = value;
|
|
165
|
-
inst.getSnapshot = getSnapshot;
|
|
166
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
167
|
-
forceUpdate({
|
|
168
|
-
inst
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}, [subscribe, value, getSnapshot]);
|
|
172
|
-
useEffect(function() {
|
|
173
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
174
|
-
forceUpdate({
|
|
175
|
-
inst
|
|
176
|
-
});
|
|
704
|
+
if (!itemDataset.typed) {
|
|
705
|
+
dataset.typed = false;
|
|
177
706
|
}
|
|
178
|
-
|
|
179
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
180
|
-
forceUpdate({
|
|
181
|
-
inst
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
return subscribe(handleStoreChange);
|
|
186
|
-
}, [subscribe]);
|
|
187
|
-
useDebugValue(value);
|
|
188
|
-
return value;
|
|
189
|
-
}
|
|
190
|
-
function checkIfSnapshotChanged(inst) {
|
|
191
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
192
|
-
var prevValue = inst.value;
|
|
193
|
-
try {
|
|
194
|
-
var nextValue = latestGetSnapshot();
|
|
195
|
-
return !objectIs(prevValue, nextValue);
|
|
196
|
-
} catch (error2) {
|
|
197
|
-
return true;
|
|
707
|
+
dataset.value.push(itemDataset.value);
|
|
198
708
|
}
|
|
709
|
+
} else {
|
|
710
|
+
_addIssue(this, "type", dataset, config2);
|
|
199
711
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
712
|
+
return dataset;
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
// @__NO_SIDE_EFFECTS__
|
|
717
|
+
function boolean(message) {
|
|
718
|
+
return {
|
|
719
|
+
kind: "schema",
|
|
720
|
+
type: "boolean",
|
|
721
|
+
reference: boolean,
|
|
722
|
+
expects: "boolean",
|
|
723
|
+
async: false,
|
|
724
|
+
message,
|
|
725
|
+
get "~standard"() {
|
|
726
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
727
|
+
},
|
|
728
|
+
"~run"(dataset, config2) {
|
|
729
|
+
if (typeof dataset.value === "boolean") {
|
|
730
|
+
dataset.typed = true;
|
|
731
|
+
} else {
|
|
732
|
+
_addIssue(this, "type", dataset, config2);
|
|
210
733
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
734
|
+
return dataset;
|
|
735
|
+
}
|
|
736
|
+
};
|
|
214
737
|
}
|
|
215
|
-
|
|
216
|
-
function
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
738
|
+
// @__NO_SIDE_EFFECTS__
|
|
739
|
+
function enum_(enum__, message) {
|
|
740
|
+
const options2 = [];
|
|
741
|
+
for (const key in enum__) {
|
|
742
|
+
if (`${+key}` !== key || typeof enum__[key] !== "string" || !Object.is(enum__[enum__[key]], +key)) {
|
|
743
|
+
options2.push(enum__[key]);
|
|
744
|
+
}
|
|
223
745
|
}
|
|
224
|
-
return
|
|
746
|
+
return {
|
|
747
|
+
kind: "schema",
|
|
748
|
+
type: "enum",
|
|
749
|
+
reference: enum_,
|
|
750
|
+
expects: /* @__PURE__ */ _joinExpects(options2.map(_stringify), "|"),
|
|
751
|
+
async: false,
|
|
752
|
+
enum: enum__,
|
|
753
|
+
options: options2,
|
|
754
|
+
message,
|
|
755
|
+
get "~standard"() {
|
|
756
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
757
|
+
},
|
|
758
|
+
"~run"(dataset, config2) {
|
|
759
|
+
if (this.options.includes(dataset.value)) {
|
|
760
|
+
dataset.typed = true;
|
|
761
|
+
} else {
|
|
762
|
+
_addIssue(this, "type", dataset, config2);
|
|
763
|
+
}
|
|
764
|
+
return dataset;
|
|
765
|
+
}
|
|
766
|
+
};
|
|
225
767
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
var c = t(null);
|
|
249
|
-
if (null === c.current) {
|
|
250
|
-
var f = { hasValue: false, value: null };
|
|
251
|
-
c.current = f;
|
|
252
|
-
} else f = c.current;
|
|
253
|
-
c = v(function() {
|
|
254
|
-
function a2(a3) {
|
|
255
|
-
if (!c2) {
|
|
256
|
-
c2 = true;
|
|
257
|
-
d2 = a3;
|
|
258
|
-
a3 = l(a3);
|
|
259
|
-
if (void 0 !== g && f.hasValue) {
|
|
260
|
-
var b2 = f.value;
|
|
261
|
-
if (g(b2, a3)) return k = b2;
|
|
262
|
-
}
|
|
263
|
-
return k = a3;
|
|
264
|
-
}
|
|
265
|
-
b2 = k;
|
|
266
|
-
if (q(d2, a3)) return b2;
|
|
267
|
-
var e2 = l(a3);
|
|
268
|
-
if (void 0 !== g && g(b2, e2)) return b2;
|
|
269
|
-
d2 = a3;
|
|
270
|
-
return k = e2;
|
|
271
|
-
}
|
|
272
|
-
var c2 = false, d2, k, m = void 0 === e ? null : e;
|
|
273
|
-
return [function() {
|
|
274
|
-
return a2(b());
|
|
275
|
-
}, null === m ? void 0 : function() {
|
|
276
|
-
return a2(m());
|
|
277
|
-
}];
|
|
278
|
-
}, [b, e, l, g]);
|
|
279
|
-
var d = r(a, c[0], c[1]);
|
|
280
|
-
u(function() {
|
|
281
|
-
f.hasValue = true;
|
|
282
|
-
f.value = d;
|
|
283
|
-
}, [d]);
|
|
284
|
-
w(d);
|
|
285
|
-
return d;
|
|
286
|
-
};
|
|
287
|
-
return withSelector_production_min;
|
|
768
|
+
// @__NO_SIDE_EFFECTS__
|
|
769
|
+
function literal(literal_, message) {
|
|
770
|
+
return {
|
|
771
|
+
kind: "schema",
|
|
772
|
+
type: "literal",
|
|
773
|
+
reference: literal,
|
|
774
|
+
expects: /* @__PURE__ */ _stringify(literal_),
|
|
775
|
+
async: false,
|
|
776
|
+
literal: literal_,
|
|
777
|
+
message,
|
|
778
|
+
get "~standard"() {
|
|
779
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
780
|
+
},
|
|
781
|
+
"~run"(dataset, config2) {
|
|
782
|
+
if (dataset.value === this.literal) {
|
|
783
|
+
dataset.typed = true;
|
|
784
|
+
} else {
|
|
785
|
+
_addIssue(this, "type", dataset, config2);
|
|
786
|
+
}
|
|
787
|
+
return dataset;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
288
790
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
307
|
-
}
|
|
308
|
-
var React = require$$0;
|
|
309
|
-
var shim2 = requireShim();
|
|
310
|
-
function is(x, y2) {
|
|
311
|
-
return x === y2 && (x !== 0 || 1 / x === 1 / y2) || x !== x && y2 !== y2;
|
|
312
|
-
}
|
|
313
|
-
var objectIs = typeof Object.is === "function" ? Object.is : is;
|
|
314
|
-
var useSyncExternalStore = shim2.useSyncExternalStore;
|
|
315
|
-
var useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
|
|
316
|
-
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
317
|
-
var instRef = useRef(null);
|
|
318
|
-
var inst;
|
|
319
|
-
if (instRef.current === null) {
|
|
320
|
-
inst = {
|
|
321
|
-
hasValue: false,
|
|
322
|
-
value: null
|
|
323
|
-
};
|
|
324
|
-
instRef.current = inst;
|
|
325
|
-
} else {
|
|
326
|
-
inst = instRef.current;
|
|
791
|
+
// @__NO_SIDE_EFFECTS__
|
|
792
|
+
function nullable(wrapped, default_) {
|
|
793
|
+
return {
|
|
794
|
+
kind: "schema",
|
|
795
|
+
type: "nullable",
|
|
796
|
+
reference: nullable,
|
|
797
|
+
expects: `(${wrapped.expects} | null)`,
|
|
798
|
+
async: false,
|
|
799
|
+
wrapped,
|
|
800
|
+
default: default_,
|
|
801
|
+
get "~standard"() {
|
|
802
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
803
|
+
},
|
|
804
|
+
"~run"(dataset, config2) {
|
|
805
|
+
if (dataset.value === null) {
|
|
806
|
+
if (this.default !== void 0) {
|
|
807
|
+
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
|
|
327
808
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
809
|
+
if (dataset.value === null) {
|
|
810
|
+
dataset.typed = true;
|
|
811
|
+
return dataset;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
return this.wrapped["~run"](dataset, config2);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
// @__NO_SIDE_EFFECTS__
|
|
819
|
+
function number(message) {
|
|
820
|
+
return {
|
|
821
|
+
kind: "schema",
|
|
822
|
+
type: "number",
|
|
823
|
+
reference: number,
|
|
824
|
+
expects: "number",
|
|
825
|
+
async: false,
|
|
826
|
+
message,
|
|
827
|
+
get "~standard"() {
|
|
828
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
829
|
+
},
|
|
830
|
+
"~run"(dataset, config2) {
|
|
831
|
+
if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
|
|
832
|
+
dataset.typed = true;
|
|
833
|
+
} else {
|
|
834
|
+
_addIssue(this, "type", dataset, config2);
|
|
835
|
+
}
|
|
836
|
+
return dataset;
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
// @__NO_SIDE_EFFECTS__
|
|
841
|
+
function object(entries, message) {
|
|
842
|
+
return {
|
|
843
|
+
kind: "schema",
|
|
844
|
+
type: "object",
|
|
845
|
+
reference: object,
|
|
846
|
+
expects: "Object",
|
|
847
|
+
async: false,
|
|
848
|
+
entries,
|
|
849
|
+
message,
|
|
850
|
+
get "~standard"() {
|
|
851
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
852
|
+
},
|
|
853
|
+
"~run"(dataset, config2) {
|
|
854
|
+
var _a;
|
|
855
|
+
const input = dataset.value;
|
|
856
|
+
if (input && typeof input === "object") {
|
|
857
|
+
dataset.typed = true;
|
|
858
|
+
dataset.value = {};
|
|
859
|
+
for (const key in this.entries) {
|
|
860
|
+
const valueSchema = this.entries[key];
|
|
861
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && // @ts-expect-error
|
|
862
|
+
valueSchema.default !== void 0) {
|
|
863
|
+
const value2 = key in input ? (
|
|
864
|
+
// @ts-expect-error
|
|
865
|
+
input[key]
|
|
866
|
+
) : /* @__PURE__ */ getDefault(valueSchema);
|
|
867
|
+
const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
|
|
868
|
+
if (valueDataset.issues) {
|
|
869
|
+
const pathItem = {
|
|
870
|
+
type: "object",
|
|
871
|
+
origin: "value",
|
|
872
|
+
input,
|
|
873
|
+
key,
|
|
874
|
+
value: value2
|
|
875
|
+
};
|
|
876
|
+
for (const issue of valueDataset.issues) {
|
|
877
|
+
if (issue.path) {
|
|
878
|
+
issue.path.unshift(pathItem);
|
|
879
|
+
} else {
|
|
880
|
+
issue.path = [pathItem];
|
|
344
881
|
}
|
|
882
|
+
(_a = dataset.issues) == null ? void 0 : _a.push(issue);
|
|
883
|
+
}
|
|
884
|
+
if (!dataset.issues) {
|
|
885
|
+
dataset.issues = valueDataset.issues;
|
|
886
|
+
}
|
|
887
|
+
if (config2.abortEarly) {
|
|
888
|
+
dataset.typed = false;
|
|
889
|
+
break;
|
|
345
890
|
}
|
|
346
|
-
memoizedSelection = _nextSelection;
|
|
347
|
-
return _nextSelection;
|
|
348
891
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
352
|
-
return prevSelection;
|
|
892
|
+
if (!valueDataset.typed) {
|
|
893
|
+
dataset.typed = false;
|
|
353
894
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
895
|
+
dataset.value[key] = valueDataset.value;
|
|
896
|
+
} else if (valueSchema.fallback !== void 0) {
|
|
897
|
+
dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
898
|
+
} else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
899
|
+
_addIssue(this, "key", dataset, config2, {
|
|
900
|
+
input: void 0,
|
|
901
|
+
expected: `"${key}"`,
|
|
902
|
+
path: [
|
|
903
|
+
{
|
|
904
|
+
type: "object",
|
|
905
|
+
origin: "key",
|
|
906
|
+
input,
|
|
907
|
+
key,
|
|
908
|
+
// @ts-expect-error
|
|
909
|
+
value: input[key]
|
|
910
|
+
}
|
|
911
|
+
]
|
|
912
|
+
});
|
|
913
|
+
if (config2.abortEarly) {
|
|
914
|
+
break;
|
|
357
915
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
var maybeGetServerSnapshot = getServerSnapshot === void 0 ? null : getServerSnapshot;
|
|
363
|
-
var getSnapshotWithSelector = function() {
|
|
364
|
-
return memoizedSelector(getSnapshot());
|
|
365
|
-
};
|
|
366
|
-
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? void 0 : function() {
|
|
367
|
-
return memoizedSelector(maybeGetServerSnapshot());
|
|
368
|
-
};
|
|
369
|
-
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
370
|
-
}, [getSnapshot, getServerSnapshot, selector, isEqual]), getSelection = _useMemo[0], getServerSelection = _useMemo[1];
|
|
371
|
-
var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
372
|
-
useEffect(function() {
|
|
373
|
-
inst.hasValue = true;
|
|
374
|
-
inst.value = value;
|
|
375
|
-
}, [value]);
|
|
376
|
-
useDebugValue(value);
|
|
377
|
-
return value;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
} else {
|
|
919
|
+
_addIssue(this, "type", dataset, config2);
|
|
378
920
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
921
|
+
return dataset;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
// @__NO_SIDE_EFFECTS__
|
|
926
|
+
function optional(wrapped, default_) {
|
|
927
|
+
return {
|
|
928
|
+
kind: "schema",
|
|
929
|
+
type: "optional",
|
|
930
|
+
reference: optional,
|
|
931
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
932
|
+
async: false,
|
|
933
|
+
wrapped,
|
|
934
|
+
default: default_,
|
|
935
|
+
get "~standard"() {
|
|
936
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
937
|
+
},
|
|
938
|
+
"~run"(dataset, config2) {
|
|
939
|
+
if (dataset.value === void 0) {
|
|
940
|
+
if (this.default !== void 0) {
|
|
941
|
+
dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
|
|
942
|
+
}
|
|
943
|
+
if (dataset.value === void 0) {
|
|
944
|
+
dataset.typed = true;
|
|
945
|
+
return dataset;
|
|
946
|
+
}
|
|
382
947
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
948
|
+
return this.wrapped["~run"](dataset, config2);
|
|
949
|
+
}
|
|
950
|
+
};
|
|
386
951
|
}
|
|
387
|
-
|
|
388
|
-
function
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
952
|
+
// @__NO_SIDE_EFFECTS__
|
|
953
|
+
function picklist(options2, message) {
|
|
954
|
+
return {
|
|
955
|
+
kind: "schema",
|
|
956
|
+
type: "picklist",
|
|
957
|
+
reference: picklist,
|
|
958
|
+
expects: /* @__PURE__ */ _joinExpects(options2.map(_stringify), "|"),
|
|
959
|
+
async: false,
|
|
960
|
+
options: options2,
|
|
961
|
+
message,
|
|
962
|
+
get "~standard"() {
|
|
963
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
964
|
+
},
|
|
965
|
+
"~run"(dataset, config2) {
|
|
966
|
+
if (this.options.includes(dataset.value)) {
|
|
967
|
+
dataset.typed = true;
|
|
968
|
+
} else {
|
|
969
|
+
_addIssue(this, "type", dataset, config2);
|
|
970
|
+
}
|
|
971
|
+
return dataset;
|
|
972
|
+
}
|
|
973
|
+
};
|
|
397
974
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
975
|
+
// @__NO_SIDE_EFFECTS__
|
|
976
|
+
function record(key, value2, message) {
|
|
977
|
+
return {
|
|
978
|
+
kind: "schema",
|
|
979
|
+
type: "record",
|
|
980
|
+
reference: record,
|
|
981
|
+
expects: "Object",
|
|
982
|
+
async: false,
|
|
983
|
+
key,
|
|
984
|
+
value: value2,
|
|
985
|
+
message,
|
|
986
|
+
get "~standard"() {
|
|
987
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
988
|
+
},
|
|
989
|
+
"~run"(dataset, config2) {
|
|
990
|
+
var _a, _b;
|
|
991
|
+
const input = dataset.value;
|
|
992
|
+
if (input && typeof input === "object") {
|
|
993
|
+
dataset.typed = true;
|
|
994
|
+
dataset.value = {};
|
|
995
|
+
for (const entryKey in input) {
|
|
996
|
+
if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
997
|
+
const entryValue = input[entryKey];
|
|
998
|
+
const keyDataset = this.key["~run"]({ value: entryKey }, config2);
|
|
999
|
+
if (keyDataset.issues) {
|
|
1000
|
+
const pathItem = {
|
|
1001
|
+
type: "object",
|
|
1002
|
+
origin: "key",
|
|
1003
|
+
input,
|
|
1004
|
+
key: entryKey,
|
|
1005
|
+
value: entryValue
|
|
1006
|
+
};
|
|
1007
|
+
for (const issue of keyDataset.issues) {
|
|
1008
|
+
issue.path = [pathItem];
|
|
1009
|
+
(_a = dataset.issues) == null ? void 0 : _a.push(issue);
|
|
1010
|
+
}
|
|
1011
|
+
if (!dataset.issues) {
|
|
1012
|
+
dataset.issues = keyDataset.issues;
|
|
1013
|
+
}
|
|
1014
|
+
if (config2.abortEarly) {
|
|
1015
|
+
dataset.typed = false;
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
const valueDataset = this.value["~run"](
|
|
1020
|
+
{ value: entryValue },
|
|
1021
|
+
config2
|
|
1022
|
+
);
|
|
1023
|
+
if (valueDataset.issues) {
|
|
1024
|
+
const pathItem = {
|
|
1025
|
+
type: "object",
|
|
1026
|
+
origin: "value",
|
|
1027
|
+
input,
|
|
1028
|
+
key: entryKey,
|
|
1029
|
+
value: entryValue
|
|
1030
|
+
};
|
|
1031
|
+
for (const issue of valueDataset.issues) {
|
|
1032
|
+
if (issue.path) {
|
|
1033
|
+
issue.path.unshift(pathItem);
|
|
1034
|
+
} else {
|
|
1035
|
+
issue.path = [pathItem];
|
|
1036
|
+
}
|
|
1037
|
+
(_b = dataset.issues) == null ? void 0 : _b.push(issue);
|
|
1038
|
+
}
|
|
1039
|
+
if (!dataset.issues) {
|
|
1040
|
+
dataset.issues = valueDataset.issues;
|
|
1041
|
+
}
|
|
1042
|
+
if (config2.abortEarly) {
|
|
1043
|
+
dataset.typed = false;
|
|
1044
|
+
break;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if (!keyDataset.typed || !valueDataset.typed) {
|
|
1048
|
+
dataset.typed = false;
|
|
1049
|
+
}
|
|
1050
|
+
if (keyDataset.typed) {
|
|
1051
|
+
dataset.value[keyDataset.value] = valueDataset.value;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
} else {
|
|
1056
|
+
_addIssue(this, "type", dataset, config2);
|
|
1057
|
+
}
|
|
1058
|
+
return dataset;
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
// @__NO_SIDE_EFFECTS__
|
|
1063
|
+
function string(message) {
|
|
1064
|
+
return {
|
|
1065
|
+
kind: "schema",
|
|
1066
|
+
type: "string",
|
|
1067
|
+
reference: string,
|
|
1068
|
+
expects: "string",
|
|
1069
|
+
async: false,
|
|
1070
|
+
message,
|
|
1071
|
+
get "~standard"() {
|
|
1072
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1073
|
+
},
|
|
1074
|
+
"~run"(dataset, config2) {
|
|
1075
|
+
if (typeof dataset.value === "string") {
|
|
1076
|
+
dataset.typed = true;
|
|
1077
|
+
} else {
|
|
1078
|
+
_addIssue(this, "type", dataset, config2);
|
|
1079
|
+
}
|
|
1080
|
+
return dataset;
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
// @__NO_SIDE_EFFECTS__
|
|
1085
|
+
function _subIssues(datasets) {
|
|
1086
|
+
let issues;
|
|
1087
|
+
if (datasets) {
|
|
1088
|
+
for (const dataset of datasets) {
|
|
1089
|
+
if (issues) {
|
|
1090
|
+
issues.push(...dataset.issues);
|
|
1091
|
+
} else {
|
|
1092
|
+
issues = dataset.issues;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return issues;
|
|
1097
|
+
}
|
|
1098
|
+
// @__NO_SIDE_EFFECTS__
|
|
1099
|
+
function union(options2, message) {
|
|
1100
|
+
return {
|
|
1101
|
+
kind: "schema",
|
|
1102
|
+
type: "union",
|
|
1103
|
+
reference: union,
|
|
1104
|
+
expects: /* @__PURE__ */ _joinExpects(
|
|
1105
|
+
options2.map((option) => option.expects),
|
|
1106
|
+
"|"
|
|
1107
|
+
),
|
|
1108
|
+
async: false,
|
|
1109
|
+
options: options2,
|
|
1110
|
+
message,
|
|
1111
|
+
get "~standard"() {
|
|
1112
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1113
|
+
},
|
|
1114
|
+
"~run"(dataset, config2) {
|
|
1115
|
+
let validDataset;
|
|
1116
|
+
let typedDatasets;
|
|
1117
|
+
let untypedDatasets;
|
|
1118
|
+
for (const schema of this.options) {
|
|
1119
|
+
const optionDataset = schema["~run"]({ value: dataset.value }, config2);
|
|
1120
|
+
if (optionDataset.typed) {
|
|
1121
|
+
if (optionDataset.issues) {
|
|
1122
|
+
if (typedDatasets) {
|
|
1123
|
+
typedDatasets.push(optionDataset);
|
|
1124
|
+
} else {
|
|
1125
|
+
typedDatasets = [optionDataset];
|
|
1126
|
+
}
|
|
1127
|
+
} else {
|
|
1128
|
+
validDataset = optionDataset;
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
} else {
|
|
1132
|
+
if (untypedDatasets) {
|
|
1133
|
+
untypedDatasets.push(optionDataset);
|
|
1134
|
+
} else {
|
|
1135
|
+
untypedDatasets = [optionDataset];
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
if (validDataset) {
|
|
1140
|
+
return validDataset;
|
|
1141
|
+
}
|
|
1142
|
+
if (typedDatasets) {
|
|
1143
|
+
if (typedDatasets.length === 1) {
|
|
1144
|
+
return typedDatasets[0];
|
|
1145
|
+
}
|
|
1146
|
+
_addIssue(this, "type", dataset, config2, {
|
|
1147
|
+
issues: /* @__PURE__ */ _subIssues(typedDatasets)
|
|
1148
|
+
});
|
|
1149
|
+
dataset.typed = true;
|
|
1150
|
+
} else if ((untypedDatasets == null ? void 0 : untypedDatasets.length) === 1) {
|
|
1151
|
+
return untypedDatasets[0];
|
|
1152
|
+
} else {
|
|
1153
|
+
_addIssue(this, "type", dataset, config2, {
|
|
1154
|
+
issues: /* @__PURE__ */ _subIssues(untypedDatasets)
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
return dataset;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
function parse(schema, input, config2) {
|
|
1162
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
1163
|
+
if (dataset.issues) {
|
|
1164
|
+
throw new ValiError(dataset.issues);
|
|
1165
|
+
}
|
|
1166
|
+
return dataset.value;
|
|
1167
|
+
}
|
|
1168
|
+
// @__NO_SIDE_EFFECTS__
|
|
1169
|
+
function pipe(...pipe2) {
|
|
1170
|
+
return {
|
|
1171
|
+
...pipe2[0],
|
|
1172
|
+
pipe: pipe2,
|
|
1173
|
+
get "~standard"() {
|
|
1174
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1175
|
+
},
|
|
1176
|
+
"~run"(dataset, config2) {
|
|
1177
|
+
for (const item of pipe2) {
|
|
1178
|
+
if (item.kind !== "metadata") {
|
|
1179
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1180
|
+
dataset.typed = false;
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
|
|
1184
|
+
dataset = item["~run"](dataset, config2);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return dataset;
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
// @__NO_SIDE_EFFECTS__
|
|
1193
|
+
function safeParse(schema, input, config2) {
|
|
1194
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
1195
|
+
return {
|
|
1196
|
+
typed: dataset.typed,
|
|
1197
|
+
success: !dataset.issues,
|
|
1198
|
+
output: dataset.value,
|
|
1199
|
+
issues: dataset.issues
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
const linkValidator = /* @__PURE__ */ check(
|
|
1203
|
+
(value) => {
|
|
1204
|
+
var _a, _b;
|
|
1205
|
+
return !!value && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.length) === 2;
|
|
1206
|
+
}
|
|
1207
|
+
);
|
|
1208
|
+
const isLink$1 = (value) => {
|
|
1209
|
+
var _a;
|
|
1210
|
+
return (_a = /* @__PURE__ */ safeParse(linkValidator, value)) == null ? void 0 : _a.success;
|
|
1211
|
+
};
|
|
1212
|
+
const isVariableLink$1 = (value) => {
|
|
1213
|
+
var _a, _b;
|
|
1214
|
+
return isLink$1(value) && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.at(0)) === nodes.Variable;
|
|
1215
|
+
};
|
|
1216
|
+
const getMetadata = (schema) => {
|
|
1217
|
+
var _a;
|
|
1218
|
+
const pipelines = (schema == null ? void 0 : schema.pipe) ?? [];
|
|
1219
|
+
return ((_a = pipelines == null ? void 0 : pipelines.find((pipe2) => /* @__PURE__ */ isOfKind("metadata", pipe2))) == null ? void 0 : _a.metadata) ?? null;
|
|
1220
|
+
};
|
|
1221
|
+
const layerField = (schema, meta) => {
|
|
1222
|
+
const overridable = (meta == null ? void 0 : meta.overridable) ?? true;
|
|
1223
|
+
const variable = (meta == null ? void 0 : meta.variable) ?? false;
|
|
1224
|
+
const schemaParts = [schema];
|
|
1225
|
+
if (variable) {
|
|
1226
|
+
schemaParts.push(/* @__PURE__ */ pipe(/* @__PURE__ */ string(), linkValidator));
|
|
1227
|
+
}
|
|
1228
|
+
if (overridable) {
|
|
1229
|
+
schemaParts.push(/* @__PURE__ */ any());
|
|
1230
|
+
}
|
|
1231
|
+
return /* @__PURE__ */ pipe(
|
|
1232
|
+
/* @__PURE__ */ optional(/* @__PURE__ */ union(schemaParts)),
|
|
1233
|
+
/* @__PURE__ */ transform((meta == null ? void 0 : meta.transform) ?? ((v2) => v2)),
|
|
1234
|
+
/* @__PURE__ */ metadata(meta ?? {})
|
|
1235
|
+
);
|
|
1236
|
+
};
|
|
1237
|
+
const ChildrenSchema = /* @__PURE__ */ object({
|
|
1238
|
+
children: layerField(/* @__PURE__ */ array(/* @__PURE__ */ string()), {
|
|
1239
|
+
fallback: [],
|
|
1240
|
+
overridable: false
|
|
1241
|
+
})
|
|
1242
|
+
});
|
|
1243
|
+
const GraphFieldSchema = /* @__PURE__ */ object({
|
|
1244
|
+
_id: /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ number()]),
|
|
1245
|
+
_type: /* @__PURE__ */ picklist(Object.keys(nodes))
|
|
1246
|
+
});
|
|
1247
|
+
const OverridesSchema = /* @__PURE__ */ object({
|
|
1248
|
+
overrides: layerField(/* @__PURE__ */ array(/* @__PURE__ */ string()), { overridable: false }),
|
|
1249
|
+
overrideFrom: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false })
|
|
1250
|
+
});
|
|
1251
|
+
const PositionSchema = /* @__PURE__ */ object({
|
|
1252
|
+
position: layerField(/* @__PURE__ */ enum_(Object.keys(positionType)), {
|
|
1253
|
+
fallback: positionType.absolute
|
|
1254
|
+
}),
|
|
1255
|
+
top: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1256
|
+
fallback: null,
|
|
1257
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1258
|
+
}),
|
|
1259
|
+
left: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1260
|
+
fallback: null,
|
|
1261
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1262
|
+
}),
|
|
1263
|
+
right: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1264
|
+
fallback: null,
|
|
1265
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1266
|
+
}),
|
|
1267
|
+
bottom: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
1268
|
+
fallback: null,
|
|
1269
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1270
|
+
}),
|
|
1271
|
+
centerAnchorX: layerField(/* @__PURE__ */ number(), {
|
|
1272
|
+
fallback: 0.5
|
|
1273
|
+
}),
|
|
1274
|
+
centerAnchorY: layerField(/* @__PURE__ */ number(), {
|
|
1275
|
+
fallback: 0.5
|
|
1276
|
+
})
|
|
1277
|
+
});
|
|
1278
|
+
const SceneSchema = /* @__PURE__ */ object({
|
|
1279
|
+
opacity: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0), /* @__PURE__ */ maxValue(1)), {
|
|
1280
|
+
fallback: 1,
|
|
1281
|
+
variable: true
|
|
1282
|
+
}),
|
|
1283
|
+
visible: layerField(/* @__PURE__ */ boolean(), { fallback: true, variable: true }),
|
|
1284
|
+
rotate: layerField(/* @__PURE__ */ number(), { fallback: null }),
|
|
1285
|
+
zIndex: layerField(/* @__PURE__ */ number(), { fallback: -1 })
|
|
1286
|
+
});
|
|
1287
|
+
const FillSchema = /* @__PURE__ */ object({
|
|
1288
|
+
fillType: layerField(/* @__PURE__ */ picklist(Object.keys(paintMode)), {
|
|
1289
|
+
fallback: paintMode.None
|
|
1290
|
+
}),
|
|
1291
|
+
solidFill: layerField(/* @__PURE__ */ string(), { fallback: "#fff" }),
|
|
1292
|
+
imageFill: layerField(/* @__PURE__ */ string()),
|
|
1293
|
+
imageSize: layerField(/* @__PURE__ */ picklist(Object.keys(imagePaintScaleModes)), {
|
|
1294
|
+
fallback: imagePaintScaleModes.Auto
|
|
1295
|
+
})
|
|
1296
|
+
});
|
|
1297
|
+
const BorderSchema = /* @__PURE__ */ object({
|
|
1298
|
+
borderType: layerField(/* @__PURE__ */ picklist(Object.keys(borderType)), {
|
|
1299
|
+
fallback: borderType.None
|
|
1300
|
+
}),
|
|
1301
|
+
borderWidth: layerField(/* @__PURE__ */ string(), {
|
|
1302
|
+
fallback: "1px",
|
|
1303
|
+
transform: (value) => {
|
|
1304
|
+
if (typeof value === "number") {
|
|
1305
|
+
return `${value}px`;
|
|
1306
|
+
}
|
|
1307
|
+
return value;
|
|
1308
|
+
}
|
|
1309
|
+
}),
|
|
1310
|
+
borderColor: layerField(/* @__PURE__ */ string(), { fallback: "#fff" })
|
|
1311
|
+
});
|
|
1312
|
+
const SizeSchema = /* @__PURE__ */ object({
|
|
1313
|
+
widthType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
|
|
1314
|
+
fallback: sizing.Fixed
|
|
1315
|
+
}),
|
|
1316
|
+
heightType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
|
|
1317
|
+
fallback: sizing.Fixed
|
|
1318
|
+
}),
|
|
1319
|
+
width: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), {
|
|
1320
|
+
fallback: 0,
|
|
1321
|
+
transform: Math.ceil
|
|
1322
|
+
}),
|
|
1323
|
+
height: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), {
|
|
1324
|
+
fallback: 0,
|
|
1325
|
+
transform: Math.ceil
|
|
1326
|
+
}),
|
|
1327
|
+
aspectRatio: layerField(/* @__PURE__ */ number(), { fallback: -1 }),
|
|
1328
|
+
minWidth: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
|
|
1329
|
+
fallback: -1,
|
|
1330
|
+
transform: Math.ceil
|
|
1331
|
+
}),
|
|
1332
|
+
minWidthType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
|
|
1333
|
+
fallback: sizing.Fixed
|
|
1334
|
+
}),
|
|
1335
|
+
maxWidth: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
|
|
1336
|
+
fallback: -1,
|
|
1337
|
+
transform: Math.ceil
|
|
1338
|
+
}),
|
|
1339
|
+
maxWidthType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
|
|
1340
|
+
fallback: sizing.Fixed
|
|
1341
|
+
}),
|
|
1342
|
+
minHeight: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
|
|
1343
|
+
fallback: -1,
|
|
1344
|
+
transform: Math.ceil
|
|
1345
|
+
}),
|
|
1346
|
+
minHeightType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
|
|
1347
|
+
fallback: sizing.Fixed
|
|
1348
|
+
}),
|
|
1349
|
+
maxHeight: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
|
|
1350
|
+
fallback: -1,
|
|
1351
|
+
transform: Math.ceil
|
|
1352
|
+
}),
|
|
1353
|
+
maxHeightType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
|
|
1354
|
+
fallback: sizing.Fixed
|
|
1355
|
+
})
|
|
1356
|
+
});
|
|
1357
|
+
const LayerSchema = /* @__PURE__ */ object({
|
|
1358
|
+
layerMode: layerField(/* @__PURE__ */ picklist(Object.keys(layerMode)), {
|
|
1359
|
+
fallback: layerMode.none
|
|
1360
|
+
}),
|
|
1361
|
+
layerAlign: layerField(/* @__PURE__ */ picklist(Object.keys(layerAlign)), {
|
|
1362
|
+
fallback: layerAlign.start
|
|
1363
|
+
}),
|
|
1364
|
+
layerDirection: layerField(/* @__PURE__ */ picklist(Object.keys(layerDirection)), {
|
|
1365
|
+
fallback: layerDirection.horizontal
|
|
1366
|
+
}),
|
|
1367
|
+
layerDistribute: layerField(/* @__PURE__ */ picklist(Object.keys(layerDistribute)), {
|
|
1368
|
+
fallback: layerDistribute.start
|
|
1369
|
+
}),
|
|
1370
|
+
layerWrap: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1371
|
+
layerGap: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), { fallback: 0 }),
|
|
1372
|
+
padding: layerField(/* @__PURE__ */ string(), { fallback: "0px" })
|
|
1373
|
+
});
|
|
1374
|
+
const OverflowSchema = layerField(/* @__PURE__ */ picklist(Object.keys(overflow)), {
|
|
1375
|
+
fallback: overflow.hidden
|
|
1376
|
+
});
|
|
1377
|
+
const BorderRadiusSchema = layerField(/* @__PURE__ */ string(), { fallback: "0px" });
|
|
1378
|
+
const InteractionsSchema = /* @__PURE__ */ object({
|
|
1379
|
+
interactions: layerField(
|
|
1380
|
+
/* @__PURE__ */ array(
|
|
1381
|
+
/* @__PURE__ */ object({
|
|
1382
|
+
on: /* @__PURE__ */ enum_(Object.keys(interactions)),
|
|
1383
|
+
event: /* @__PURE__ */ nullable(linkValidator)
|
|
1384
|
+
})
|
|
1385
|
+
),
|
|
1386
|
+
{ fallback: [] }
|
|
1387
|
+
)
|
|
1388
|
+
});
|
|
1389
|
+
const CssOverrideSchema = /* @__PURE__ */ object({
|
|
1390
|
+
cssOverride: layerField(/* @__PURE__ */ string(), { fallback: "" })
|
|
1391
|
+
});
|
|
1392
|
+
const LinkSchema = /* @__PURE__ */ object({
|
|
1393
|
+
href: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1394
|
+
hrefNewTab: layerField(/* @__PURE__ */ boolean(), {
|
|
1395
|
+
fallback: true
|
|
1396
|
+
})
|
|
1397
|
+
// hrefTarget: layerField(v.picklist(Object.keys(linkTarget)), {
|
|
1398
|
+
// fallback: linkTarget._blank,
|
|
1399
|
+
// }),
|
|
1400
|
+
});
|
|
1401
|
+
const FrameSchema = /* @__PURE__ */ pipe(
|
|
1402
|
+
/* @__PURE__ */ object({
|
|
1403
|
+
name: layerField(/* @__PURE__ */ string(), { fallback: "Frame", overridable: false }),
|
|
1404
|
+
isBreakpoint: layerField(/* @__PURE__ */ boolean(), {
|
|
1405
|
+
fallback: false,
|
|
1406
|
+
overridable: false
|
|
1407
|
+
}),
|
|
1408
|
+
isPrimary: layerField(/* @__PURE__ */ boolean(), { fallback: false, overridable: false }),
|
|
1409
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1410
|
+
...ChildrenSchema.entries,
|
|
1411
|
+
...GraphFieldSchema.entries,
|
|
1412
|
+
...OverridesSchema.entries,
|
|
1413
|
+
...PositionSchema.entries,
|
|
1414
|
+
...SceneSchema.entries,
|
|
1415
|
+
...FillSchema.entries,
|
|
1416
|
+
...BorderSchema.entries,
|
|
1417
|
+
...SizeSchema.entries,
|
|
1418
|
+
...LayerSchema.entries,
|
|
1419
|
+
...InteractionsSchema.entries,
|
|
1420
|
+
...CssOverrideSchema.entries,
|
|
1421
|
+
...LinkSchema.entries,
|
|
1422
|
+
overflow: OverflowSchema,
|
|
1423
|
+
borderRadius: BorderRadiusSchema
|
|
1424
|
+
})
|
|
1425
|
+
);
|
|
1426
|
+
const TextSchema = /* @__PURE__ */ object({
|
|
1427
|
+
name: layerField(/* @__PURE__ */ string(), { fallback: "Text", overridable: false }),
|
|
1428
|
+
content: layerField(/* @__PURE__ */ string(), {
|
|
1429
|
+
fallback: ""
|
|
1430
|
+
}),
|
|
1431
|
+
whiteSpace: layerField(/* @__PURE__ */ enum_(Object.keys(whiteSpace)), {
|
|
1432
|
+
fallback: whiteSpace.pre
|
|
1433
|
+
}),
|
|
1434
|
+
textAlign: layerField(/* @__PURE__ */ string(), { fallback: "left" }),
|
|
1435
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1436
|
+
...GraphFieldSchema.entries,
|
|
1437
|
+
...OverridesSchema.entries,
|
|
1438
|
+
...CssOverrideSchema.entries,
|
|
1439
|
+
...PositionSchema.entries,
|
|
1440
|
+
...SceneSchema.entries,
|
|
1441
|
+
...SizeSchema.entries,
|
|
1442
|
+
...InteractionsSchema.entries,
|
|
1443
|
+
...LinkSchema.entries
|
|
1444
|
+
});
|
|
1445
|
+
const FragmentSchema = /* @__PURE__ */ object({
|
|
1446
|
+
name: layerField(/* @__PURE__ */ string(), { fallback: "Fragment", overridable: false }),
|
|
1447
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1448
|
+
horizontalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
|
|
1449
|
+
fallback: fragmentGrowingMode.fill,
|
|
1450
|
+
overridable: false
|
|
1451
|
+
}),
|
|
1452
|
+
verticalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
|
|
1453
|
+
fallback: fragmentGrowingMode.auto,
|
|
1454
|
+
overridable: false
|
|
1455
|
+
}),
|
|
1456
|
+
properties: layerField(/* @__PURE__ */ array(/* @__PURE__ */ string()), {
|
|
1457
|
+
fallback: [],
|
|
1458
|
+
overridable: false
|
|
1459
|
+
}),
|
|
1460
|
+
...GraphFieldSchema.entries,
|
|
1461
|
+
...ChildrenSchema.entries
|
|
1462
|
+
});
|
|
1463
|
+
const InstanceSchema = /* @__PURE__ */ object({
|
|
1464
|
+
name: layerField(/* @__PURE__ */ string(), { fallback: "Instance", overridable: false }),
|
|
1465
|
+
fragment: layerField(/* @__PURE__ */ number()),
|
|
1466
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1467
|
+
props: layerField(
|
|
1468
|
+
/* @__PURE__ */ record(
|
|
1469
|
+
/* @__PURE__ */ string(),
|
|
1470
|
+
/* @__PURE__ */ union([
|
|
1471
|
+
/* @__PURE__ */ string(),
|
|
1472
|
+
/* @__PURE__ */ number(),
|
|
1473
|
+
/* @__PURE__ */ boolean(),
|
|
1474
|
+
// For goals
|
|
1475
|
+
/* @__PURE__ */ object({
|
|
1476
|
+
code: /* @__PURE__ */ string(),
|
|
1477
|
+
name: /* @__PURE__ */ string()
|
|
1478
|
+
})
|
|
1479
|
+
])
|
|
1480
|
+
),
|
|
1481
|
+
{
|
|
1482
|
+
fallback: {}
|
|
1483
|
+
}
|
|
1484
|
+
),
|
|
1485
|
+
...GraphFieldSchema.entries,
|
|
1486
|
+
...OverridesSchema.entries,
|
|
1487
|
+
...PositionSchema.entries,
|
|
1488
|
+
...SizeSchema.entries,
|
|
1489
|
+
...SceneSchema.entries,
|
|
1490
|
+
...InteractionsSchema.entries,
|
|
1491
|
+
...LinkSchema.entries
|
|
1492
|
+
});
|
|
1493
|
+
const NumberVariableSchema = /* @__PURE__ */ object({
|
|
1494
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1495
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1496
|
+
fallback: "Number",
|
|
1497
|
+
overridable: false
|
|
1498
|
+
}),
|
|
1499
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1500
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Number), {
|
|
1501
|
+
fallback: variableType.Number
|
|
1502
|
+
}),
|
|
1503
|
+
defaultValue: layerField(/* @__PURE__ */ number(), { fallback: 0 }),
|
|
1504
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1505
|
+
min: layerField(/* @__PURE__ */ number(), { fallback: 1 }),
|
|
1506
|
+
max: layerField(/* @__PURE__ */ number(), { fallback: 100 }),
|
|
1507
|
+
step: layerField(/* @__PURE__ */ number(), { fallback: 1 }),
|
|
1508
|
+
displayStepper: layerField(/* @__PURE__ */ boolean(), { fallback: true }),
|
|
1509
|
+
...GraphFieldSchema.entries
|
|
1510
|
+
});
|
|
1511
|
+
const BooleanVariableSchema = /* @__PURE__ */ object({
|
|
1512
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1513
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1514
|
+
fallback: "Boolean",
|
|
1515
|
+
overridable: false
|
|
1516
|
+
}),
|
|
1517
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1518
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Boolean), {
|
|
1519
|
+
fallback: variableType.Boolean
|
|
1520
|
+
}),
|
|
1521
|
+
defaultValue: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1522
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1523
|
+
...GraphFieldSchema.entries
|
|
1524
|
+
});
|
|
1525
|
+
const ColorVariableSchema = /* @__PURE__ */ object({
|
|
1526
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1527
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1528
|
+
fallback: "String",
|
|
1529
|
+
overridable: false
|
|
1530
|
+
}),
|
|
1531
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1532
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Color), {
|
|
1533
|
+
fallback: variableType.Color
|
|
1534
|
+
}),
|
|
1535
|
+
// TODO Add color validator
|
|
1536
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "#000" }),
|
|
1537
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1538
|
+
...GraphFieldSchema.entries
|
|
1539
|
+
});
|
|
1540
|
+
const StringVariableSchema = /* @__PURE__ */ object({
|
|
1541
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1542
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1543
|
+
fallback: "String",
|
|
1544
|
+
overridable: false
|
|
1545
|
+
}),
|
|
1546
|
+
type: layerField(/* @__PURE__ */ literal(variableType.String), {
|
|
1547
|
+
fallback: variableType.String
|
|
1548
|
+
}),
|
|
1549
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1550
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
1551
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1552
|
+
placeholder: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
1553
|
+
isTextarea: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1554
|
+
...GraphFieldSchema.entries
|
|
1555
|
+
});
|
|
1556
|
+
const EventVariableSchema = /* @__PURE__ */ object({
|
|
1557
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1558
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1559
|
+
fallback: "Event",
|
|
1560
|
+
overridable: false
|
|
1561
|
+
}),
|
|
1562
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1563
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Event), {
|
|
1564
|
+
fallback: variableType.Event
|
|
1565
|
+
}),
|
|
1566
|
+
mode: layerField(/* @__PURE__ */ picklist(Object.keys(eventMode)), {
|
|
1567
|
+
fallback: eventMode.callback
|
|
1568
|
+
}),
|
|
1569
|
+
defaultValue: layerField(/* @__PURE__ */ any()),
|
|
1570
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1571
|
+
...GraphFieldSchema.entries
|
|
1572
|
+
});
|
|
1573
|
+
const LinkVariableSchema = /* @__PURE__ */ object({
|
|
1574
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1575
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1576
|
+
fallback: "Link",
|
|
1577
|
+
overridable: false
|
|
1578
|
+
}),
|
|
1579
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1580
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Link), {
|
|
1581
|
+
fallback: variableType.Link
|
|
1582
|
+
}),
|
|
1583
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
1584
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1585
|
+
...GraphFieldSchema.entries
|
|
1586
|
+
});
|
|
1587
|
+
const EnumVariableSchema = /* @__PURE__ */ object({
|
|
1588
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1589
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1590
|
+
fallback: "Option",
|
|
1591
|
+
overridable: false
|
|
1592
|
+
}),
|
|
1593
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1594
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Enum), {
|
|
1595
|
+
fallback: variableType.Enum
|
|
1596
|
+
}),
|
|
1597
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
|
|
1598
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1599
|
+
cases: layerField(
|
|
1600
|
+
/* @__PURE__ */ array(
|
|
1601
|
+
/* @__PURE__ */ object({
|
|
1602
|
+
id: /* @__PURE__ */ string(),
|
|
1603
|
+
name: /* @__PURE__ */ string()
|
|
1604
|
+
})
|
|
1605
|
+
),
|
|
1606
|
+
{ fallback: [] }
|
|
1607
|
+
),
|
|
1608
|
+
...GraphFieldSchema.entries
|
|
1609
|
+
});
|
|
1610
|
+
const ObjectVariableSchema = /* @__PURE__ */ object({
|
|
1611
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1612
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1613
|
+
fallback: "Object",
|
|
1614
|
+
overridable: false
|
|
1615
|
+
}),
|
|
1616
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Object), {
|
|
1617
|
+
fallback: variableType.Object
|
|
1618
|
+
}),
|
|
1619
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1620
|
+
defaultValue: layerField(/* @__PURE__ */ object({}), { fallback: {} }),
|
|
1621
|
+
fields: layerField(/* @__PURE__ */ record(/* @__PURE__ */ string(), linkValidator), { fallback: {} }),
|
|
1622
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1623
|
+
...GraphFieldSchema.entries
|
|
1624
|
+
});
|
|
1625
|
+
const ImageVariableSchema = /* @__PURE__ */ object({
|
|
1626
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1627
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1628
|
+
fallback: "Image",
|
|
1629
|
+
overridable: false
|
|
1630
|
+
}),
|
|
1631
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Image), {
|
|
1632
|
+
fallback: variableType.Image
|
|
1633
|
+
}),
|
|
1634
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1635
|
+
defaultValue: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1636
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1637
|
+
imageSize: layerField(/* @__PURE__ */ picklist(Object.keys(imagePaintScaleModes)), {
|
|
1638
|
+
fallback: imagePaintScaleModes.Auto
|
|
1639
|
+
}),
|
|
1640
|
+
...GraphFieldSchema.entries
|
|
1641
|
+
});
|
|
1642
|
+
const CollectionSchema = /* @__PURE__ */ pipe(
|
|
1643
|
+
/* @__PURE__ */ object({
|
|
1644
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1645
|
+
fallback: "Collection",
|
|
1646
|
+
overridable: false
|
|
1647
|
+
}),
|
|
1648
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1649
|
+
source: layerField(linkValidator, {}),
|
|
1650
|
+
...ChildrenSchema.entries,
|
|
1651
|
+
...GraphFieldSchema.entries,
|
|
1652
|
+
...OverridesSchema.entries,
|
|
1653
|
+
...PositionSchema.entries,
|
|
1654
|
+
...SceneSchema.entries,
|
|
1655
|
+
...FillSchema.entries,
|
|
1656
|
+
...BorderSchema.entries,
|
|
1657
|
+
...SizeSchema.entries,
|
|
1658
|
+
...LayerSchema.entries,
|
|
1659
|
+
...InteractionsSchema.entries,
|
|
1660
|
+
...CssOverrideSchema.entries,
|
|
1661
|
+
...LinkSchema.entries
|
|
1662
|
+
})
|
|
1663
|
+
);
|
|
1664
|
+
const ArrayVariableSchema = /* @__PURE__ */ object({
|
|
1665
|
+
nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
|
|
1666
|
+
name: layerField(/* @__PURE__ */ string(), {
|
|
1667
|
+
fallback: "Collection",
|
|
1668
|
+
overridable: false
|
|
1669
|
+
}),
|
|
1670
|
+
type: layerField(/* @__PURE__ */ literal(variableType.Array), {
|
|
1671
|
+
fallback: variableType.Array
|
|
1672
|
+
}),
|
|
1673
|
+
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
1674
|
+
defaultValue: layerField(/* @__PURE__ */ array(/* @__PURE__ */ any()), { fallback: [] }),
|
|
1675
|
+
definition: layerField(linkValidator, { fallback: null }),
|
|
1676
|
+
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
1677
|
+
...GraphFieldSchema.entries
|
|
1678
|
+
});
|
|
1679
|
+
const getLayerSchema = (layer) => {
|
|
1680
|
+
if (!(layer == null ? void 0 : layer._type)) return null;
|
|
1681
|
+
if ((layer == null ? void 0 : layer._type) === nodes.Frame) return FrameSchema;
|
|
1682
|
+
if ((layer == null ? void 0 : layer._type) === nodes.Text) return TextSchema;
|
|
1683
|
+
if ((layer == null ? void 0 : layer._type) === nodes.Fragment) return FragmentSchema;
|
|
1684
|
+
if ((layer == null ? void 0 : layer._type) === nodes.Instance) return InstanceSchema;
|
|
1685
|
+
if ((layer == null ? void 0 : layer._type) === nodes.Collection) return CollectionSchema;
|
|
1686
|
+
if (layer._type === nodes.Variable) {
|
|
1687
|
+
const types = {
|
|
1688
|
+
[variableType.Number]: NumberVariableSchema,
|
|
1689
|
+
[variableType.Boolean]: BooleanVariableSchema,
|
|
1690
|
+
[variableType.String]: StringVariableSchema,
|
|
1691
|
+
[variableType.Color]: ColorVariableSchema,
|
|
1692
|
+
[variableType.Event]: EventVariableSchema,
|
|
1693
|
+
[variableType.Link]: LinkVariableSchema,
|
|
1694
|
+
[variableType.Enum]: EnumVariableSchema,
|
|
1695
|
+
[variableType.Object]: ObjectVariableSchema,
|
|
1696
|
+
[variableType.Image]: ImageVariableSchema,
|
|
1697
|
+
[variableType.Array]: ArrayVariableSchema
|
|
1698
|
+
};
|
|
1699
|
+
if (layer.type in types) {
|
|
1700
|
+
return types[layer.type];
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
const isObject$1 = (x2) => !!x2 && typeof x2 === "object" && !Array.isArray(x2);
|
|
1705
|
+
const normalizeLayer = (schema, rawLayer, options2) => {
|
|
1706
|
+
try {
|
|
1707
|
+
if (!rawLayer || !schema.entries) return null;
|
|
1708
|
+
const withFallback = (options2 == null ? void 0 : options2.withFallback) ?? true;
|
|
1709
|
+
const overrideTarget = options2 == null ? void 0 : options2.overrideTarget;
|
|
1710
|
+
const parsedLayer = parse(schema, rawLayer);
|
|
1711
|
+
return Object.fromEntries(
|
|
1712
|
+
Object.entries(schema.entries).map(([key, schemaEntity]) => {
|
|
1713
|
+
const schemaMeta = getMetadata(schemaEntity);
|
|
1714
|
+
const fallback = withFallback ? schemaMeta == null ? void 0 : schemaMeta.fallback : null;
|
|
1715
|
+
const overrideValue = (schemaMeta == null ? void 0 : schemaMeta.overridable) !== false && overrideTarget ? overrideTarget == null ? void 0 : overrideTarget[key] : null;
|
|
1716
|
+
let layerValue = parsedLayer[key];
|
|
1717
|
+
if (isObject$1(layerValue) && isObject$1(overrideValue)) {
|
|
1718
|
+
layerValue = { ...overrideValue, ...layerValue };
|
|
1719
|
+
}
|
|
1720
|
+
if (schemaEntity && "wrapped" in schemaEntity && "entries" in schemaEntity.wrapped && isObject$1(schemaEntity.wrapped.entries)) {
|
|
1721
|
+
layerValue = normalizeLayer(
|
|
1722
|
+
schemaEntity.wrapped,
|
|
1723
|
+
layerValue,
|
|
1724
|
+
options2
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
const resultValue = layerValue ?? overrideValue ?? fallback;
|
|
1728
|
+
return [key, resultValue];
|
|
1729
|
+
})
|
|
1730
|
+
);
|
|
1731
|
+
} catch (e2) {
|
|
1732
|
+
console.error(e2);
|
|
1733
|
+
return null;
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
const getNormalizeLayer$1 = (layer, overrider, withFallback) => {
|
|
1737
|
+
if (!layer) return null;
|
|
1738
|
+
const schema = getLayerSchema(layer);
|
|
1739
|
+
if (!schema) return null;
|
|
1740
|
+
return normalizeLayer(schema, layer, {
|
|
1741
|
+
overrideTarget: overrider,
|
|
1742
|
+
withFallback
|
|
1743
|
+
});
|
|
1744
|
+
};
|
|
1745
|
+
function findSchemaByPath(schema, path) {
|
|
1746
|
+
if (!path) return void 0;
|
|
1747
|
+
const parts = path.split(".");
|
|
1748
|
+
let current = schema;
|
|
1749
|
+
for (const part of parts) {
|
|
1750
|
+
if (!current || typeof current !== "object") return void 0;
|
|
1751
|
+
if ("entries" in current) {
|
|
1752
|
+
if (!(part in current.entries)) return void 0;
|
|
1753
|
+
current = current.entries[part];
|
|
1754
|
+
} else if ("wrapped" in current && "entries" in current.wrapped) {
|
|
1755
|
+
current = current.wrapped.entries[part];
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
return current;
|
|
1759
|
+
}
|
|
1760
|
+
const parseLayerField = (layer, field, value) => {
|
|
1761
|
+
const schema = getLayerSchema(layer);
|
|
1762
|
+
const fieldSchema = findSchemaByPath(schema, field);
|
|
1763
|
+
if (fieldSchema) {
|
|
1764
|
+
return /* @__PURE__ */ safeParse(fieldSchema, value);
|
|
1765
|
+
}
|
|
1766
|
+
return { success: false, output: value };
|
|
1767
|
+
};
|
|
1768
|
+
const RenderTargetContext = require$$0.createContext(
|
|
1769
|
+
index.renderTarget.document
|
|
1770
|
+
);
|
|
1771
|
+
const RenderTargetProvider = RenderTargetContext.Provider;
|
|
1772
|
+
const useRenderTarget = () => {
|
|
1773
|
+
const renderTarget2 = require$$0.useContext(RenderTargetContext);
|
|
1774
|
+
return {
|
|
1775
|
+
renderTarget: renderTarget2,
|
|
1776
|
+
isCanvas: renderTarget2 === index.renderTarget.canvas,
|
|
1777
|
+
isDocument: renderTarget2 === index.renderTarget.document
|
|
1778
|
+
};
|
|
1779
|
+
};
|
|
1780
|
+
var withSelector = { exports: {} };
|
|
1781
|
+
var withSelector_production = {};
|
|
1782
|
+
var shim = { exports: {} };
|
|
1783
|
+
var useSyncExternalStoreShim_production = {};
|
|
1784
|
+
/**
|
|
1785
|
+
* @license React
|
|
1786
|
+
* use-sync-external-store-shim.production.js
|
|
1787
|
+
*
|
|
1788
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1789
|
+
*
|
|
1790
|
+
* This source code is licensed under the MIT license found in the
|
|
1791
|
+
* LICENSE file in the root directory of this source tree.
|
|
1792
|
+
*/
|
|
1793
|
+
var hasRequiredUseSyncExternalStoreShim_production;
|
|
1794
|
+
function requireUseSyncExternalStoreShim_production() {
|
|
1795
|
+
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
1796
|
+
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
1797
|
+
var React = require$$0;
|
|
1798
|
+
function is(x2, y2) {
|
|
1799
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
1800
|
+
}
|
|
1801
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue;
|
|
1802
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
1803
|
+
var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
1804
|
+
useLayoutEffect(
|
|
1805
|
+
function() {
|
|
1806
|
+
inst.value = value;
|
|
1807
|
+
inst.getSnapshot = getSnapshot;
|
|
1808
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1809
|
+
},
|
|
1810
|
+
[subscribe, value, getSnapshot]
|
|
1811
|
+
);
|
|
1812
|
+
useEffect2(
|
|
1813
|
+
function() {
|
|
1814
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1815
|
+
return subscribe(function() {
|
|
1816
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1817
|
+
});
|
|
1818
|
+
},
|
|
1819
|
+
[subscribe]
|
|
1820
|
+
);
|
|
1821
|
+
useDebugValue(value);
|
|
1822
|
+
return value;
|
|
1823
|
+
}
|
|
1824
|
+
function checkIfSnapshotChanged(inst) {
|
|
1825
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
1826
|
+
inst = inst.value;
|
|
1827
|
+
try {
|
|
1828
|
+
var nextValue = latestGetSnapshot();
|
|
1829
|
+
return !objectIs(inst, nextValue);
|
|
1830
|
+
} catch (error) {
|
|
1831
|
+
return true;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
1835
|
+
return getSnapshot();
|
|
1836
|
+
}
|
|
1837
|
+
var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
1838
|
+
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
|
|
1839
|
+
return useSyncExternalStoreShim_production;
|
|
1840
|
+
}
|
|
1841
|
+
var useSyncExternalStoreShim_development = {};
|
|
1842
|
+
/**
|
|
1843
|
+
* @license React
|
|
1844
|
+
* use-sync-external-store-shim.development.js
|
|
1845
|
+
*
|
|
1846
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1847
|
+
*
|
|
1848
|
+
* This source code is licensed under the MIT license found in the
|
|
1849
|
+
* LICENSE file in the root directory of this source tree.
|
|
1850
|
+
*/
|
|
1851
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
1852
|
+
function requireUseSyncExternalStoreShim_development() {
|
|
1853
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
1854
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
1855
|
+
"production" !== process.env.NODE_ENV && function() {
|
|
1856
|
+
function is(x2, y2) {
|
|
1857
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
1858
|
+
}
|
|
1859
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
1860
|
+
didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
1861
|
+
"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."
|
|
1862
|
+
));
|
|
1863
|
+
var value = getSnapshot();
|
|
1864
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
1865
|
+
var cachedValue = getSnapshot();
|
|
1866
|
+
objectIs(value, cachedValue) || (console.error(
|
|
1867
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
1868
|
+
), didWarnUncachedGetSnapshot = true);
|
|
1869
|
+
}
|
|
1870
|
+
cachedValue = useState2({
|
|
1871
|
+
inst: { value, getSnapshot }
|
|
1872
|
+
});
|
|
1873
|
+
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
1874
|
+
useLayoutEffect(
|
|
1875
|
+
function() {
|
|
1876
|
+
inst.value = value;
|
|
1877
|
+
inst.getSnapshot = getSnapshot;
|
|
1878
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1879
|
+
},
|
|
1880
|
+
[subscribe, value, getSnapshot]
|
|
1881
|
+
);
|
|
1882
|
+
useEffect2(
|
|
1883
|
+
function() {
|
|
1884
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1885
|
+
return subscribe(function() {
|
|
1886
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
1887
|
+
});
|
|
1888
|
+
},
|
|
1889
|
+
[subscribe]
|
|
1890
|
+
);
|
|
1891
|
+
useDebugValue(value);
|
|
1892
|
+
return value;
|
|
1893
|
+
}
|
|
1894
|
+
function checkIfSnapshotChanged(inst) {
|
|
1895
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
1896
|
+
inst = inst.value;
|
|
1897
|
+
try {
|
|
1898
|
+
var nextValue = latestGetSnapshot();
|
|
1899
|
+
return !objectIs(inst, nextValue);
|
|
1900
|
+
} catch (error) {
|
|
1901
|
+
return true;
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
1905
|
+
return getSnapshot();
|
|
1906
|
+
}
|
|
1907
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1908
|
+
var React = require$$0, objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
1909
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim2;
|
|
1910
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1911
|
+
}();
|
|
1912
|
+
return useSyncExternalStoreShim_development;
|
|
1913
|
+
}
|
|
1914
|
+
var hasRequiredShim;
|
|
1915
|
+
function requireShim() {
|
|
1916
|
+
if (hasRequiredShim) return shim.exports;
|
|
1917
|
+
hasRequiredShim = 1;
|
|
1918
|
+
if (process.env.NODE_ENV === "production") {
|
|
1919
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
1920
|
+
} else {
|
|
1921
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
1922
|
+
}
|
|
1923
|
+
return shim.exports;
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* @license React
|
|
1927
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
1928
|
+
*
|
|
1929
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1930
|
+
*
|
|
1931
|
+
* This source code is licensed under the MIT license found in the
|
|
1932
|
+
* LICENSE file in the root directory of this source tree.
|
|
1933
|
+
*/
|
|
1934
|
+
var hasRequiredWithSelector_production;
|
|
1935
|
+
function requireWithSelector_production() {
|
|
1936
|
+
if (hasRequiredWithSelector_production) return withSelector_production;
|
|
1937
|
+
hasRequiredWithSelector_production = 1;
|
|
1938
|
+
var React = require$$0, shim2 = requireShim();
|
|
1939
|
+
function is(x2, y2) {
|
|
1940
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
1941
|
+
}
|
|
1942
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim2.useSyncExternalStore, useRef2 = React.useRef, useEffect2 = React.useEffect, useMemo2 = React.useMemo, useDebugValue = React.useDebugValue;
|
|
1943
|
+
withSelector_production.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
1944
|
+
var instRef = useRef2(null);
|
|
1945
|
+
if (null === instRef.current) {
|
|
1946
|
+
var inst = { hasValue: false, value: null };
|
|
1947
|
+
instRef.current = inst;
|
|
1948
|
+
} else inst = instRef.current;
|
|
1949
|
+
instRef = useMemo2(
|
|
1950
|
+
function() {
|
|
1951
|
+
function memoizedSelector(nextSnapshot) {
|
|
1952
|
+
if (!hasMemo) {
|
|
1953
|
+
hasMemo = true;
|
|
1954
|
+
memoizedSnapshot = nextSnapshot;
|
|
1955
|
+
nextSnapshot = selector(nextSnapshot);
|
|
1956
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
1957
|
+
var currentSelection = inst.value;
|
|
1958
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
1959
|
+
return memoizedSelection = currentSelection;
|
|
1960
|
+
}
|
|
1961
|
+
return memoizedSelection = nextSnapshot;
|
|
1962
|
+
}
|
|
1963
|
+
currentSelection = memoizedSelection;
|
|
1964
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
1965
|
+
var nextSelection = selector(nextSnapshot);
|
|
1966
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
1967
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
1968
|
+
memoizedSnapshot = nextSnapshot;
|
|
1969
|
+
return memoizedSelection = nextSelection;
|
|
1970
|
+
}
|
|
1971
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
1972
|
+
return [
|
|
1973
|
+
function() {
|
|
1974
|
+
return memoizedSelector(getSnapshot());
|
|
1975
|
+
},
|
|
1976
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
1977
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
1978
|
+
}
|
|
1979
|
+
];
|
|
1980
|
+
},
|
|
1981
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
1982
|
+
);
|
|
1983
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
1984
|
+
useEffect2(
|
|
1985
|
+
function() {
|
|
1986
|
+
inst.hasValue = true;
|
|
1987
|
+
inst.value = value;
|
|
1988
|
+
},
|
|
1989
|
+
[value]
|
|
1990
|
+
);
|
|
1991
|
+
useDebugValue(value);
|
|
1992
|
+
return value;
|
|
1993
|
+
};
|
|
1994
|
+
return withSelector_production;
|
|
1995
|
+
}
|
|
1996
|
+
var withSelector_development = {};
|
|
1997
|
+
/**
|
|
1998
|
+
* @license React
|
|
1999
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
2000
|
+
*
|
|
2001
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2002
|
+
*
|
|
2003
|
+
* This source code is licensed under the MIT license found in the
|
|
2004
|
+
* LICENSE file in the root directory of this source tree.
|
|
2005
|
+
*/
|
|
2006
|
+
var hasRequiredWithSelector_development;
|
|
2007
|
+
function requireWithSelector_development() {
|
|
2008
|
+
if (hasRequiredWithSelector_development) return withSelector_development;
|
|
2009
|
+
hasRequiredWithSelector_development = 1;
|
|
2010
|
+
"production" !== process.env.NODE_ENV && function() {
|
|
2011
|
+
function is(x2, y2) {
|
|
2012
|
+
return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
|
|
2013
|
+
}
|
|
2014
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
2015
|
+
var React = require$$0, shim2 = requireShim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim2.useSyncExternalStore, useRef2 = React.useRef, useEffect2 = React.useEffect, useMemo2 = React.useMemo, useDebugValue = React.useDebugValue;
|
|
2016
|
+
withSelector_development.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
2017
|
+
var instRef = useRef2(null);
|
|
2018
|
+
if (null === instRef.current) {
|
|
2019
|
+
var inst = { hasValue: false, value: null };
|
|
2020
|
+
instRef.current = inst;
|
|
2021
|
+
} else inst = instRef.current;
|
|
2022
|
+
instRef = useMemo2(
|
|
2023
|
+
function() {
|
|
2024
|
+
function memoizedSelector(nextSnapshot) {
|
|
2025
|
+
if (!hasMemo) {
|
|
2026
|
+
hasMemo = true;
|
|
2027
|
+
memoizedSnapshot = nextSnapshot;
|
|
2028
|
+
nextSnapshot = selector(nextSnapshot);
|
|
2029
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
2030
|
+
var currentSelection = inst.value;
|
|
2031
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
2032
|
+
return memoizedSelection = currentSelection;
|
|
2033
|
+
}
|
|
2034
|
+
return memoizedSelection = nextSnapshot;
|
|
2035
|
+
}
|
|
2036
|
+
currentSelection = memoizedSelection;
|
|
2037
|
+
if (objectIs(memoizedSnapshot, nextSnapshot))
|
|
2038
|
+
return currentSelection;
|
|
2039
|
+
var nextSelection = selector(nextSnapshot);
|
|
2040
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
2041
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
2042
|
+
memoizedSnapshot = nextSnapshot;
|
|
2043
|
+
return memoizedSelection = nextSelection;
|
|
2044
|
+
}
|
|
2045
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
2046
|
+
return [
|
|
2047
|
+
function() {
|
|
2048
|
+
return memoizedSelector(getSnapshot());
|
|
2049
|
+
},
|
|
2050
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
2051
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
2052
|
+
}
|
|
2053
|
+
];
|
|
2054
|
+
},
|
|
2055
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
2056
|
+
);
|
|
2057
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
2058
|
+
useEffect2(
|
|
2059
|
+
function() {
|
|
2060
|
+
inst.hasValue = true;
|
|
2061
|
+
inst.value = value;
|
|
2062
|
+
},
|
|
2063
|
+
[value]
|
|
2064
|
+
);
|
|
2065
|
+
useDebugValue(value);
|
|
2066
|
+
return value;
|
|
2067
|
+
};
|
|
2068
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
2069
|
+
}();
|
|
2070
|
+
return withSelector_development;
|
|
2071
|
+
}
|
|
2072
|
+
var hasRequiredWithSelector;
|
|
2073
|
+
function requireWithSelector() {
|
|
2074
|
+
if (hasRequiredWithSelector) return withSelector.exports;
|
|
2075
|
+
hasRequiredWithSelector = 1;
|
|
2076
|
+
if (process.env.NODE_ENV === "production") {
|
|
2077
|
+
withSelector.exports = requireWithSelector_production();
|
|
2078
|
+
} else {
|
|
2079
|
+
withSelector.exports = requireWithSelector_development();
|
|
2080
|
+
}
|
|
2081
|
+
return withSelector.exports;
|
|
2082
|
+
}
|
|
2083
|
+
var withSelectorExports = requireWithSelector();
|
|
2084
|
+
var x = (t2) => t2, y = (t2, e2, n2) => {
|
|
2085
|
+
var _a, _b;
|
|
2086
|
+
let r2 = require$$0.useRef((_a = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a.call(t2, e2, n2)), s2 = ((_b = t2 == null ? void 0 : t2.keyOfEntity) == null ? void 0 : _b.call(t2, e2)) ?? e2, o2 = require$$0.useCallback((p2) => {
|
|
402
2087
|
var _a2, _b2;
|
|
403
|
-
return
|
|
2088
|
+
return s2 ? (r2.current = (_a2 = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a2.call(t2, s2, n2), p2(), (_b2 = t2 == null ? void 0 : t2.subscribe) == null ? void 0 : _b2.call(t2, s2, () => {
|
|
404
2089
|
var _a3;
|
|
405
|
-
return
|
|
406
|
-
},
|
|
2090
|
+
return r2.current = (_a3 = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a3.call(t2, s2, n2), p2();
|
|
2091
|
+
}, n2)) : () => {
|
|
407
2092
|
};
|
|
408
|
-
}, [
|
|
409
|
-
let
|
|
410
|
-
|
|
411
|
-
}, [
|
|
412
|
-
return [
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
2093
|
+
}, [t2, s2]), a2 = require$$0.useCallback((p2, c2) => {
|
|
2094
|
+
let u2 = typeof e2 == "string" ? e2 : core.keyOfEntity(e2);
|
|
2095
|
+
e2 && u2 && t2.mutate(u2, p2, c2);
|
|
2096
|
+
}, [t2, e2]), i2 = () => (n2 == null ? void 0 : n2.pause) ? null : r2.current;
|
|
2097
|
+
return [withSelectorExports.useSyncExternalStoreWithSelector(o2, i2, i2, x), a2];
|
|
2098
|
+
};
|
|
2099
|
+
var R = (t2) => t2, S = (t2, e2, n2) => {
|
|
2100
|
+
let r2 = require$$0.useCallback((c2) => c2.map((u2) => t2.resolve(u2, n2)).filter(Boolean), [t2, n2]), s2 = require$$0.useMemo(() => e2.map((c2) => t2.keyOfEntity(c2) || c2).join(), [e2]), o2 = require$$0.useRef(r2(e2));
|
|
2101
|
+
require$$0.useRef([]);
|
|
2102
|
+
let i2 = require$$0.useCallback((c2) => {
|
|
2103
|
+
if (e2) {
|
|
2104
|
+
let u2 = () => {
|
|
2105
|
+
o2.current = r2(e2), c2();
|
|
2106
|
+
}, l2 = new AbortController();
|
|
2107
|
+
return e2.forEach((f2) => {
|
|
2108
|
+
f2 && t2.subscribe(f2, u2, { signal: l2.signal, ...n2 });
|
|
2109
|
+
}), u2(), () => l2.abort("unsubscribe");
|
|
2110
|
+
}
|
|
2111
|
+
return () => {
|
|
2112
|
+
};
|
|
2113
|
+
}, [t2, s2]), p2 = () => o2.current;
|
|
2114
|
+
return withSelectorExports.useSyncExternalStoreWithSelector(i2, p2, p2, R);
|
|
2115
|
+
};
|
|
2116
|
+
const GlobalManager = require$$0.createContext(null);
|
|
2117
|
+
var __defProp = Object.defineProperty;
|
|
2118
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2119
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2120
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2121
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2122
|
+
var __spreadValues = (a2, b) => {
|
|
2123
|
+
for (var prop in b || (b = {}))
|
|
2124
|
+
if (__hasOwnProp.call(b, prop))
|
|
2125
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
2126
|
+
if (__getOwnPropSymbols)
|
|
2127
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
2128
|
+
if (__propIsEnum.call(b, prop))
|
|
2129
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
2130
|
+
}
|
|
2131
|
+
return a2;
|
|
2132
|
+
};
|
|
2133
|
+
var toPx = (val) => typeof val === "string" || typeof val === "number" ? `${val}px` : "0px";
|
|
2134
|
+
var isObject = (input) => {
|
|
2135
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
2136
|
+
};
|
|
2137
|
+
var isEmptyValue = (value) => !value && (value === null || value === void 0);
|
|
2138
|
+
var isValue = (value) => !isEmptyValue(value);
|
|
2139
|
+
var get = (obj, path, defValue) => {
|
|
2140
|
+
if (!path)
|
|
2141
|
+
return void 0;
|
|
2142
|
+
const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);
|
|
2143
|
+
const result = pathArray.reduce((prevObj, key) => prevObj && prevObj[key], obj);
|
|
2144
|
+
return result === void 0 ? defValue : result;
|
|
2145
|
+
};
|
|
2146
|
+
var set = (obj, path, value) => {
|
|
2147
|
+
const pathArray = Array.isArray(path) ? path : path.match(/([^[.\]])+/g);
|
|
2148
|
+
return pathArray.reduce((acc, key, i2) => {
|
|
2149
|
+
if (acc[key] === void 0)
|
|
2150
|
+
acc[key] = {};
|
|
2151
|
+
if (i2 === pathArray.length - 1)
|
|
2152
|
+
acc[key] = value;
|
|
2153
|
+
return acc[key];
|
|
2154
|
+
}, obj);
|
|
2155
|
+
};
|
|
2156
|
+
var isPrimitive = (value) => typeof value !== "object" && typeof value !== "function" || value === null;
|
|
2157
|
+
var toKebabCase = (value) => value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($2, ofs) => (ofs ? "-" : "") + $2.toLowerCase());
|
|
2158
|
+
var noop = () => void 0;
|
|
2159
|
+
var pick = (obj, ...props) => {
|
|
2160
|
+
return props.reduce((result, prop) => {
|
|
2161
|
+
result[prop] = obj[prop];
|
|
2162
|
+
return result;
|
|
2163
|
+
}, {});
|
|
2164
|
+
};
|
|
2165
|
+
function omit(obj, ...props) {
|
|
2166
|
+
const result = __spreadValues({}, obj);
|
|
2167
|
+
props.forEach((prop) => {
|
|
2168
|
+
delete result[prop];
|
|
2169
|
+
});
|
|
2170
|
+
return result;
|
|
2171
|
+
}
|
|
2172
|
+
var cleanGraph = (input) => isObject(input) ? omit(input, "_type", "_id") : input;
|
|
2173
|
+
var isBrowser_default = typeof window !== "undefined";
|
|
2174
|
+
var generateId = () => Math.random().toString(16).slice(2);
|
|
2175
|
+
var flattenObject = (obj) => {
|
|
2176
|
+
const result = {};
|
|
2177
|
+
function flatten(current) {
|
|
2178
|
+
for (let key in current) {
|
|
2179
|
+
if (current.hasOwnProperty(key)) {
|
|
2180
|
+
const value = current[key];
|
|
2181
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2182
|
+
flatten(value);
|
|
2183
|
+
} else {
|
|
2184
|
+
result[key] = value;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
flatten(obj);
|
|
2190
|
+
return result;
|
|
2191
|
+
};
|
|
2192
|
+
function isFiniteNumber(value) {
|
|
2193
|
+
return typeof value === "number" && isFinite(value);
|
|
2194
|
+
}
|
|
2195
|
+
var setKey$1 = (v2) => `$${v2}`;
|
|
2196
|
+
function hashGenerator(layerKey) {
|
|
2197
|
+
let hash = 0;
|
|
2198
|
+
for (let i2 = 0; i2 < layerKey.length; i2++) {
|
|
2199
|
+
hash = (hash << 5) - hash + layerKey.charCodeAt(i2);
|
|
2200
|
+
hash |= 0;
|
|
2201
|
+
}
|
|
2202
|
+
const raw = Math.abs(hash).toString(36);
|
|
2203
|
+
return /^[0-9]/.test(raw) ? `h${raw}` : raw;
|
|
2204
|
+
}
|
|
2205
|
+
const useGlobalManager = (globalManager) => {
|
|
2206
|
+
var _a, _b;
|
|
2207
|
+
const currentGlobalManager = require$$0.useContext(GlobalManager);
|
|
2208
|
+
const resultManager = globalManager ?? currentGlobalManager;
|
|
2209
|
+
const [fragmentsGraph] = y(
|
|
2210
|
+
resultManager,
|
|
2211
|
+
(_a = resultManager == null ? void 0 : resultManager.$fragments) == null ? void 0 : _a.key
|
|
2212
|
+
);
|
|
2213
|
+
const queryFragmentManager = (id) => {
|
|
2214
|
+
var _a2, _b2;
|
|
2215
|
+
return (_b2 = (_a2 = resultManager == null ? void 0 : resultManager.$load) == null ? void 0 : _a2.loadFragment) == null ? void 0 : _b2.call(_a2, id);
|
|
2216
|
+
};
|
|
2217
|
+
const queryArea = (id) => {
|
|
2218
|
+
var _a2, _b2;
|
|
2219
|
+
return (_b2 = (_a2 = resultManager == null ? void 0 : resultManager.$load) == null ? void 0 : _a2.loadArea) == null ? void 0 : _b2.call(_a2, id);
|
|
421
2220
|
};
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
const fragmentDocument = await globalGraph.fetchManager.queryFragment(id);
|
|
425
|
-
const res = globalManager == null ? void 0 : globalManager.createFragmentManager(id, fragmentDocument);
|
|
426
|
-
setLoading(false);
|
|
427
|
-
return res;
|
|
2221
|
+
const setRenderTarget = (value) => {
|
|
2222
|
+
resultManager == null ? void 0 : resultManager.setRenderTarget(value);
|
|
428
2223
|
};
|
|
2224
|
+
return {
|
|
2225
|
+
fragmentsGraph,
|
|
2226
|
+
manager: resultManager,
|
|
2227
|
+
queryFragmentManager,
|
|
2228
|
+
queryArea,
|
|
2229
|
+
getFragmentManager: ((_b = resultManager == null ? void 0 : resultManager.$fragments) == null ? void 0 : _b.getManager) ?? noop,
|
|
2230
|
+
setRenderTarget
|
|
2231
|
+
};
|
|
2232
|
+
};
|
|
2233
|
+
const useFragmentManager = (fragmentId, inputGlobalManager, aa) => {
|
|
2234
|
+
var _a;
|
|
2235
|
+
const {
|
|
2236
|
+
fragmentsGraph,
|
|
2237
|
+
manager: gg,
|
|
2238
|
+
getFragmentManager,
|
|
2239
|
+
queryFragmentManager
|
|
2240
|
+
} = useGlobalManager(inputGlobalManager);
|
|
2241
|
+
const [loading, setLoading] = require$$0.useState(false);
|
|
2242
|
+
const manager = getFragmentManager(fragmentId);
|
|
429
2243
|
require$$0.useEffect(() => {
|
|
430
|
-
|
|
431
|
-
|
|
2244
|
+
(async () => {
|
|
2245
|
+
if (fragmentsGraph && !getFragmentManager(fragmentId) && !!fragmentId) {
|
|
2246
|
+
setLoading(true);
|
|
2247
|
+
await queryFragmentManager(fragmentId);
|
|
2248
|
+
setLoading(false);
|
|
2249
|
+
}
|
|
2250
|
+
})();
|
|
2251
|
+
}, [fragmentId, fragmentsGraph]);
|
|
432
2252
|
return {
|
|
433
2253
|
loading,
|
|
434
|
-
manager
|
|
2254
|
+
manager,
|
|
2255
|
+
fragmentLayerKey: (_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.root,
|
|
2256
|
+
queryFragmentManager
|
|
2257
|
+
// loadFragmentManager,
|
|
2258
|
+
};
|
|
2259
|
+
};
|
|
2260
|
+
const FragmentContext = require$$0.createContext({
|
|
2261
|
+
manager: null
|
|
2262
|
+
});
|
|
2263
|
+
const setKey = (v2) => `$${v2}`;
|
|
2264
|
+
const getKey = (v2) => isKey(v2) ? v2.slice(1) : null;
|
|
2265
|
+
const isKey = (v2) => typeof v2 === "string" && v2.startsWith("$");
|
|
2266
|
+
const getParent = (manager, layerKey) => {
|
|
2267
|
+
const layer = manager.resolve(layerKey);
|
|
2268
|
+
return manager.resolve(getKey(layer == null ? void 0 : layer.parent) ?? null);
|
|
2269
|
+
};
|
|
2270
|
+
const isRootLayer = (manager, layerKey) => {
|
|
2271
|
+
var _a, _b;
|
|
2272
|
+
const resolvedNode = (_a = manager == null ? void 0 : manager.resolve) == null ? void 0 : _a.call(manager, layerKey);
|
|
2273
|
+
return ((_b = getParent(manager, layerKey)) == null ? void 0 : _b._type) === index.nodes.Fragment && !(resolvedNode == null ? void 0 : resolvedNode.isBreakpoint);
|
|
2274
|
+
};
|
|
2275
|
+
const isTopLevel = (manager, layerKey) => {
|
|
2276
|
+
var _a;
|
|
2277
|
+
return ((_a = getParent(manager, layerKey)) == null ? void 0 : _a._type) === index.nodes.Fragment;
|
|
2278
|
+
};
|
|
2279
|
+
const getAllParents = (manager, layerKey, stack = []) => {
|
|
2280
|
+
const parent = getParent(manager, layerKey);
|
|
2281
|
+
if (parent) {
|
|
2282
|
+
stack.push(parent);
|
|
2283
|
+
getAllParents(manager, manager.keyOfEntity(parent), stack);
|
|
2284
|
+
}
|
|
2285
|
+
return stack;
|
|
2286
|
+
};
|
|
2287
|
+
const isPartOfPrimary = (manager, layerKey) => {
|
|
2288
|
+
var _a;
|
|
2289
|
+
const allParents = getAllParents(manager, manager.keyOfEntity(layerKey));
|
|
2290
|
+
const layer = manager.resolve(layerKey);
|
|
2291
|
+
return (layer == null ? void 0 : layer.isPrimary) ?? !!((_a = allParents == null ? void 0 : allParents.find) == null ? void 0 : _a.call(allParents, (parent) => !!(parent == null ? void 0 : parent.isPrimary)));
|
|
2292
|
+
};
|
|
2293
|
+
const createLayer = (externalLayerData, overrideId = false) => {
|
|
2294
|
+
if (!externalLayerData || !isObject(externalLayerData)) return null;
|
|
2295
|
+
const cleanLayer = Object.entries(externalLayerData).reduce(
|
|
2296
|
+
(acc, [key, value]) => {
|
|
2297
|
+
if (isObject(value) && "_type" in value && "_id" in value && core.isPartialKey(`${value._type}:${value._id}`)) {
|
|
2298
|
+
delete value._id;
|
|
2299
|
+
delete value._type;
|
|
2300
|
+
}
|
|
2301
|
+
acc[key] = value;
|
|
2302
|
+
return acc;
|
|
2303
|
+
},
|
|
2304
|
+
{}
|
|
2305
|
+
);
|
|
2306
|
+
return overrideId ? {
|
|
2307
|
+
...cleanLayer,
|
|
2308
|
+
_id: generateId()
|
|
2309
|
+
} : {
|
|
2310
|
+
_id: generateId(),
|
|
2311
|
+
...cleanLayer
|
|
2312
|
+
};
|
|
2313
|
+
};
|
|
2314
|
+
const cloneLayer = (manager, layer, externalProps = {}, _parent) => {
|
|
2315
|
+
const layerGraph = manager.resolve(layer);
|
|
2316
|
+
const layerKey = manager.keyOfEntity(layer);
|
|
2317
|
+
const layerParent = _parent ?? manager.keyOfEntity(getParent(manager, layerKey));
|
|
2318
|
+
if (layerGraph) {
|
|
2319
|
+
const clonedLayer = createLayer(
|
|
2320
|
+
{
|
|
2321
|
+
_type: layerGraph._type,
|
|
2322
|
+
overrideFrom: setKey(layerKey),
|
|
2323
|
+
parent: setKey(layerParent),
|
|
2324
|
+
...(layerGraph == null ? void 0 : layerGraph._type) === index.nodes.Instance ? pick(layerGraph, "fragment") : {},
|
|
2325
|
+
...externalProps
|
|
2326
|
+
},
|
|
2327
|
+
true
|
|
2328
|
+
);
|
|
2329
|
+
const clonedChildren = ((layerGraph == null ? void 0 : layerGraph.children) ?? []).map(
|
|
2330
|
+
(child) => cloneLayer(manager, child, {}, manager.keyOfEntity(clonedLayer))
|
|
2331
|
+
);
|
|
2332
|
+
const clonedKey = manager.mutate({
|
|
2333
|
+
...clonedLayer,
|
|
2334
|
+
children: clonedChildren
|
|
2335
|
+
});
|
|
2336
|
+
manager.mutate(layerKey, {
|
|
2337
|
+
overrides: [clonedKey]
|
|
2338
|
+
});
|
|
2339
|
+
return clonedKey;
|
|
2340
|
+
}
|
|
2341
|
+
return null;
|
|
2342
|
+
};
|
|
2343
|
+
function makeSnapshot(globalManager, targetFragmentId) {
|
|
2344
|
+
var _a, _b;
|
|
2345
|
+
if (!globalManager || !targetFragmentId) return null;
|
|
2346
|
+
const targetFragment = (_b = (_a = globalManager == null ? void 0 : globalManager.$fragments) == null ? void 0 : _a.getManager) == null ? void 0 : _b.call(_a, targetFragmentId);
|
|
2347
|
+
if (!targetFragment) return null;
|
|
2348
|
+
const fragmentDocument = targetFragment.resolve(
|
|
2349
|
+
targetFragment.$fragment.root,
|
|
2350
|
+
{ deep: true }
|
|
2351
|
+
);
|
|
2352
|
+
const linkedFragments = Array.from(
|
|
2353
|
+
new Set(
|
|
2354
|
+
targetFragment.inspectFields(index.nodes.Instance).map((link) => {
|
|
2355
|
+
var _a2;
|
|
2356
|
+
return (_a2 = targetFragment.resolve(link)) == null ? void 0 : _a2.fragment;
|
|
2357
|
+
}).values()
|
|
2358
|
+
)
|
|
2359
|
+
);
|
|
2360
|
+
const linkedGoals = Array.from(
|
|
2361
|
+
new Set(
|
|
2362
|
+
targetFragment.inspectFields(index.nodes.Variable).map(targetFragment == null ? void 0 : targetFragment.resolve).filter((graph) => {
|
|
2363
|
+
return (graph == null ? void 0 : graph.type) === index.variableType.Event && (graph == null ? void 0 : graph.mode) === index.eventMode.goal;
|
|
2364
|
+
}).map((graph) => {
|
|
2365
|
+
var _a2;
|
|
2366
|
+
return (_a2 = graph == null ? void 0 : graph.defaultValue) == null ? void 0 : _a2.goalId;
|
|
2367
|
+
}).filter(Boolean).values()
|
|
2368
|
+
)
|
|
2369
|
+
);
|
|
2370
|
+
return {
|
|
2371
|
+
document: fragmentDocument,
|
|
2372
|
+
linkedFragments,
|
|
2373
|
+
linkedGoals
|
|
2374
|
+
};
|
|
2375
|
+
}
|
|
2376
|
+
const getOverrider = (manager, layerEntity) => {
|
|
2377
|
+
const layer = manager.resolve(layerEntity);
|
|
2378
|
+
return manager.resolve(getKey(layer == null ? void 0 : layer.overrideFrom) ?? layerEntity);
|
|
2379
|
+
};
|
|
2380
|
+
const isInheritField = (manager, layerEntity, field) => {
|
|
2381
|
+
const layer = manager.resolve(layerEntity);
|
|
2382
|
+
if (layer) {
|
|
2383
|
+
const overrider = getOverrider(manager, layer);
|
|
2384
|
+
if ((overrider == null ? void 0 : overrider._id) === (layer == null ? void 0 : layer._id)) return false;
|
|
2385
|
+
return !!overrider && !isValue(layer == null ? void 0 : layer[field]);
|
|
2386
|
+
}
|
|
2387
|
+
return false;
|
|
2388
|
+
};
|
|
2389
|
+
const declareFragmentProperty = (manager, property, fragmentLink = manager.$fragment.root) => {
|
|
2390
|
+
const propertyLayer = createLayer(property);
|
|
2391
|
+
if (propertyLayer && "type" in propertyLayer) {
|
|
2392
|
+
manager.mutate(manager.keyOfEntity(fragmentLink), {
|
|
2393
|
+
properties: [propertyLayer]
|
|
2394
|
+
});
|
|
2395
|
+
return manager.keyOfEntity(propertyLayer);
|
|
2396
|
+
}
|
|
2397
|
+
return null;
|
|
2398
|
+
};
|
|
2399
|
+
const appendChildren = (manager, target, ...children) => {
|
|
2400
|
+
const targetEntity = manager.entityOfKey(target);
|
|
2401
|
+
const parseChildren = children.map(
|
|
2402
|
+
(child) => createLayer({
|
|
2403
|
+
...manager.entityOfKey(child) ?? child,
|
|
2404
|
+
parent: setKey(manager.keyOfEntity(target))
|
|
2405
|
+
})
|
|
2406
|
+
).filter(Boolean);
|
|
2407
|
+
if (targetEntity._type !== index.nodes.Frame) {
|
|
2408
|
+
manager.mutate(manager.keyOfEntity(target), {
|
|
2409
|
+
children: parseChildren
|
|
2410
|
+
});
|
|
2411
|
+
return;
|
|
2412
|
+
}
|
|
2413
|
+
const primaryTarget = getOverrider(manager, target);
|
|
2414
|
+
const isPrimaryTarget = isPartOfPrimary(manager, target);
|
|
2415
|
+
((primaryTarget == null ? void 0 : primaryTarget.overrides) ?? []).forEach((override) => {
|
|
2416
|
+
const overridesChildren = parseChildren.map((child) => {
|
|
2417
|
+
const nextChild = createLayer(
|
|
2418
|
+
{
|
|
2419
|
+
...pick(child, "parent", "_type"),
|
|
2420
|
+
overrideFrom: setKey(manager.keyOfEntity(child))
|
|
2421
|
+
},
|
|
2422
|
+
true
|
|
2423
|
+
);
|
|
2424
|
+
if (!isPrimaryTarget) {
|
|
2425
|
+
nextChild.visible = true;
|
|
2426
|
+
}
|
|
2427
|
+
return nextChild;
|
|
2428
|
+
}).filter(Boolean);
|
|
2429
|
+
overridesChildren.forEach((child, index2) => {
|
|
2430
|
+
const primaryChild = parseChildren.at(index2);
|
|
2431
|
+
if ("overrides" in primaryChild) {
|
|
2432
|
+
primaryChild.overrides.push(manager.keyOfEntity(child));
|
|
2433
|
+
} else {
|
|
2434
|
+
primaryChild.overrides = [manager.keyOfEntity(child)];
|
|
2435
|
+
}
|
|
2436
|
+
});
|
|
2437
|
+
manager.mutate(manager.keyOfEntity(override), {
|
|
2438
|
+
children: overridesChildren
|
|
2439
|
+
});
|
|
2440
|
+
});
|
|
2441
|
+
manager.mutate(manager.keyOfEntity(primaryTarget), {
|
|
2442
|
+
children: parseChildren.map((child) => ({
|
|
2443
|
+
...child,
|
|
2444
|
+
visible: isPrimaryTarget
|
|
2445
|
+
}))
|
|
2446
|
+
});
|
|
2447
|
+
return parseChildren.map(manager.keyOfEntity);
|
|
2448
|
+
};
|
|
2449
|
+
const insertChildren = (manager, target, index2, ...layerKeys) => {
|
|
2450
|
+
appendChildren(manager, target, ...layerKeys);
|
|
2451
|
+
const targetLayer = manager.resolve(target);
|
|
2452
|
+
const overrideLayers = ((targetLayer == null ? void 0 : targetLayer.overrides) ?? []).map(manager.resolve);
|
|
2453
|
+
[targetLayer, ...overrideLayers].forEach((layer) => {
|
|
2454
|
+
const children = (layer == null ? void 0 : layer.children) ?? [];
|
|
2455
|
+
const appendedLayers = children.slice(layerKeys.length * -1);
|
|
2456
|
+
const nextChildren = children.slice(0, layerKeys.length * -1);
|
|
2457
|
+
nextChildren.splice(index2, 0, ...appendedLayers);
|
|
2458
|
+
manager.mutate(
|
|
2459
|
+
manager.keyOfEntity(layer),
|
|
2460
|
+
(prev) => ({
|
|
2461
|
+
...prev,
|
|
2462
|
+
children: nextChildren
|
|
2463
|
+
}),
|
|
2464
|
+
{ replace: true }
|
|
2465
|
+
);
|
|
2466
|
+
});
|
|
2467
|
+
};
|
|
2468
|
+
const removeChildren = (manager, ...layerKeys) => {
|
|
2469
|
+
layerKeys.map(manager.resolve).forEach((layer) => {
|
|
2470
|
+
const isPrimary = isPartOfPrimary(manager, layer);
|
|
2471
|
+
if (isPrimary || (layer == null ? void 0 : layer.isBreakpoint)) {
|
|
2472
|
+
((layer == null ? void 0 : layer.overrides) ?? []).concat((layer == null ? void 0 : layer.children) ?? []).forEach(manager.invalidate);
|
|
2473
|
+
manager.invalidate(layer);
|
|
2474
|
+
} else {
|
|
2475
|
+
manager.mutate(manager.keyOfEntity(layer), {
|
|
2476
|
+
visible: false
|
|
2477
|
+
});
|
|
2478
|
+
}
|
|
2479
|
+
});
|
|
2480
|
+
};
|
|
2481
|
+
const moveChildren = (manager, targetKey, toKey, index2) => {
|
|
2482
|
+
const targetClone = duplicateLayer(manager, targetKey, true);
|
|
2483
|
+
insertChildren(manager, toKey, index2, targetClone);
|
|
2484
|
+
removeChildren(manager, targetKey);
|
|
2485
|
+
};
|
|
2486
|
+
const duplicateLayer = (manager, layer, _deep, _newParent) => {
|
|
2487
|
+
var _a;
|
|
2488
|
+
const layerGraph = manager.resolve(layer);
|
|
2489
|
+
if (layerGraph) {
|
|
2490
|
+
const nextId = generateId();
|
|
2491
|
+
const nextLayerKey = core.keyOfEntity({
|
|
2492
|
+
_type: layerGraph._type,
|
|
2493
|
+
_id: nextId
|
|
2494
|
+
});
|
|
2495
|
+
const clonedChildren = ((layerGraph == null ? void 0 : layerGraph.children) ?? []).map(
|
|
2496
|
+
(child) => duplicateLayer(manager, child, true, nextLayerKey)
|
|
2497
|
+
);
|
|
2498
|
+
const duplicatedLayer = createLayer(
|
|
2499
|
+
{
|
|
2500
|
+
_type: layerGraph._type,
|
|
2501
|
+
...layerGraph,
|
|
2502
|
+
_id: nextId,
|
|
2503
|
+
parent: _deep ? setKey$1(_newParent) : layerGraph == null ? void 0 : layerGraph.parent,
|
|
2504
|
+
children: clonedChildren
|
|
2505
|
+
},
|
|
2506
|
+
false
|
|
2507
|
+
);
|
|
2508
|
+
const duplicatedKey = manager.mutate(duplicatedLayer);
|
|
2509
|
+
if (!_deep) {
|
|
2510
|
+
const parent = getParent(manager, layer);
|
|
2511
|
+
if (parent) {
|
|
2512
|
+
const layerIndex = (_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a.findIndex(
|
|
2513
|
+
(child) => child === manager.keyOfEntity(layer)
|
|
2514
|
+
);
|
|
2515
|
+
insertChildren(manager, parent, layerIndex + 1, duplicatedKey);
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
return duplicatedKey;
|
|
2519
|
+
}
|
|
2520
|
+
return null;
|
|
2521
|
+
};
|
|
2522
|
+
const isVariableLink = (value) => {
|
|
2523
|
+
var _a;
|
|
2524
|
+
return isLink(value) && ((_a = value == null ? void 0 : value.split(":")) == null ? void 0 : _a.at(0)) === index.nodes.Variable;
|
|
2525
|
+
};
|
|
2526
|
+
const isLink = (value) => {
|
|
2527
|
+
var _a, _b;
|
|
2528
|
+
return value && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.length) === 2;
|
|
2529
|
+
};
|
|
2530
|
+
const getCssVariables = (props) => {
|
|
2531
|
+
return Object.entries(cleanGraph(flattenObject(props))).reduce(
|
|
2532
|
+
(acc, [key, value]) => {
|
|
2533
|
+
var _a;
|
|
2534
|
+
if (isVariableLink(value)) {
|
|
2535
|
+
const nestedVariableId = (_a = core.entityOfKey(value)) == null ? void 0 : _a._id;
|
|
2536
|
+
value = `var(--${nestedVariableId})`;
|
|
2537
|
+
}
|
|
2538
|
+
acc[`--${key}`] = value;
|
|
2539
|
+
return acc;
|
|
2540
|
+
},
|
|
2541
|
+
{}
|
|
2542
|
+
);
|
|
2543
|
+
};
|
|
2544
|
+
const layerFieldSetter = (manager, layerKey, fieldKey, currentValue) => (value, options2) => {
|
|
2545
|
+
var _a;
|
|
2546
|
+
const { success, output } = parseLayerField(
|
|
2547
|
+
manager.resolve(layerKey),
|
|
2548
|
+
fieldKey,
|
|
2549
|
+
value
|
|
2550
|
+
);
|
|
2551
|
+
if (success) {
|
|
2552
|
+
if (isVariableLink$1(value)) {
|
|
2553
|
+
manager.mutate((_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.temp, {
|
|
2554
|
+
[layerKey]: {
|
|
2555
|
+
[fieldKey]: currentValue
|
|
2556
|
+
}
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
manager.mutate(
|
|
2560
|
+
layerKey,
|
|
2561
|
+
(prev) => {
|
|
2562
|
+
set(prev, fieldKey, output);
|
|
2563
|
+
return prev;
|
|
2564
|
+
},
|
|
2565
|
+
options2
|
|
2566
|
+
);
|
|
2567
|
+
}
|
|
2568
|
+
};
|
|
2569
|
+
const getLayer = (manager, layer, options2) => {
|
|
2570
|
+
if (!manager || !layer) return null;
|
|
2571
|
+
const layerKey = manager.keyOfEntity(layer);
|
|
2572
|
+
const layerData = manager.resolve(layerKey);
|
|
2573
|
+
const overrider = getOverrider(manager, layerKey);
|
|
2574
|
+
return getNormalizeLayer$1(layerData, overrider, options2 == null ? void 0 : options2.withFallback);
|
|
2575
|
+
};
|
|
2576
|
+
const getNormalizeLayer = (layerKey, manager, options2) => {
|
|
2577
|
+
const layer = manager == null ? void 0 : manager.resolve(layerKey);
|
|
2578
|
+
const parsedLayer = getLayer(manager, layerKey, options2);
|
|
2579
|
+
return {
|
|
2580
|
+
rawLayer: layer,
|
|
2581
|
+
layer: parsedLayer
|
|
2582
|
+
};
|
|
2583
|
+
};
|
|
2584
|
+
const useNormalizeLayer = (layerKey, manager, options2) => {
|
|
2585
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
2586
|
+
const resultManager = manager ?? fragmentManager;
|
|
2587
|
+
return getNormalizeLayer(layerKey, resultManager, options2);
|
|
2588
|
+
};
|
|
2589
|
+
const ScopeContext = require$$0.createContext([]);
|
|
2590
|
+
const extractVariableValue = (input, variableId) => {
|
|
2591
|
+
if (isObject(input)) {
|
|
2592
|
+
if (variableId in input) {
|
|
2593
|
+
return input[variableId];
|
|
2594
|
+
}
|
|
2595
|
+
for (let key in input) {
|
|
2596
|
+
if (input.hasOwnProperty(key)) {
|
|
2597
|
+
const result = extractVariableValue(input[key], variableId);
|
|
2598
|
+
if (result !== void 0) {
|
|
2599
|
+
return result;
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
return void 0;
|
|
2605
|
+
};
|
|
2606
|
+
function deepMerge(a2, b) {
|
|
2607
|
+
if (!isObject(a2) || !isObject(b)) return a2;
|
|
2608
|
+
const result = { ...b };
|
|
2609
|
+
for (const [key, value] of Object.entries(a2)) {
|
|
2610
|
+
if (key in result && typeof result[key] === "object" && typeof value === "object") {
|
|
2611
|
+
result[key] = deepMerge(value, result[key]);
|
|
2612
|
+
} else {
|
|
2613
|
+
result[key] = value;
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
return result;
|
|
2617
|
+
}
|
|
2618
|
+
const useReadVariable = (variableKey) => {
|
|
2619
|
+
const scopes = require$$0.useContext(ScopeContext);
|
|
2620
|
+
const extractVariableDefaultValue = (manager, variableEntity) => {
|
|
2621
|
+
const variableLayer = manager.resolve(variableEntity);
|
|
2622
|
+
if ((variableLayer == null ? void 0 : variableLayer.type) !== index.variableType.Object)
|
|
2623
|
+
return variableLayer == null ? void 0 : variableLayer.defaultValue;
|
|
2624
|
+
return Object.values((variableLayer == null ? void 0 : variableLayer.fields) ?? {}).reduce(
|
|
2625
|
+
(acc, fieldLink) => {
|
|
2626
|
+
var _a;
|
|
2627
|
+
if (!!fieldLink && isVariableLink$1(fieldLink)) {
|
|
2628
|
+
const _id = (_a = core.entityOfKey(fieldLink)) == null ? void 0 : _a._id;
|
|
2629
|
+
if (_id) {
|
|
2630
|
+
acc[_id] = extractVariableDefaultValue(manager, fieldLink);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
return acc;
|
|
2634
|
+
},
|
|
2635
|
+
{}
|
|
2636
|
+
);
|
|
435
2637
|
};
|
|
2638
|
+
const resolveVariableLayer = (manager, variableLink, customProps) => {
|
|
2639
|
+
var _a;
|
|
2640
|
+
const variableLayer = manager == null ? void 0 : manager.resolve(variableLink);
|
|
2641
|
+
if (!variableLayer) return null;
|
|
2642
|
+
if ((variableLayer == null ? void 0 : variableLayer.type) === index.variableType.Array) {
|
|
2643
|
+
const definitionLayer = manager.resolve(variableLayer == null ? void 0 : variableLayer.definition);
|
|
2644
|
+
if (!((_a = variableLayer == null ? void 0 : variableLayer.defaultValue) == null ? void 0 : _a.length) || (definitionLayer == null ? void 0 : definitionLayer.type) !== index.variableType.Object)
|
|
2645
|
+
return variableLayer;
|
|
2646
|
+
const definitionDefaultValue = extractVariableDefaultValue(
|
|
2647
|
+
manager,
|
|
2648
|
+
definitionLayer
|
|
2649
|
+
);
|
|
2650
|
+
const customValue = customProps == null ? void 0 : customProps[variableLayer == null ? void 0 : variableLayer._id];
|
|
2651
|
+
return {
|
|
2652
|
+
...variableLayer,
|
|
2653
|
+
defaultValue: (variableLayer == null ? void 0 : variableLayer.defaultValue).map((item, index2) => {
|
|
2654
|
+
const customItemValue = Array.isArray(customValue) ? customValue.at(index2) : null;
|
|
2655
|
+
return deepMerge(
|
|
2656
|
+
customItemValue ? { ...item, ...customItemValue } : item,
|
|
2657
|
+
definitionDefaultValue
|
|
2658
|
+
);
|
|
2659
|
+
})
|
|
2660
|
+
};
|
|
2661
|
+
}
|
|
2662
|
+
return variableLayer;
|
|
2663
|
+
};
|
|
2664
|
+
const readVariable = (variableKey2) => {
|
|
2665
|
+
var _a, _b, _c;
|
|
2666
|
+
const variableId = (_a = core.entityOfKey(variableKey2)) == null ? void 0 : _a._id;
|
|
2667
|
+
if (!isVariableLink$1(variableKey2)) {
|
|
2668
|
+
return {
|
|
2669
|
+
value: null,
|
|
2670
|
+
layer: null
|
|
2671
|
+
};
|
|
2672
|
+
}
|
|
2673
|
+
const instanceScope = scopes.findLast(
|
|
2674
|
+
(scope) => {
|
|
2675
|
+
var _a2;
|
|
2676
|
+
return (scope == null ? void 0 : scope.type) === index.scopeTypes.InstanceScope && !!((_a2 = scope.documentManager) == null ? void 0 : _a2.resolve(variableKey2));
|
|
2677
|
+
}
|
|
2678
|
+
);
|
|
2679
|
+
const variableLayer = resolveVariableLayer(
|
|
2680
|
+
instanceScope == null ? void 0 : instanceScope.documentManager,
|
|
2681
|
+
variableKey2
|
|
2682
|
+
);
|
|
2683
|
+
let instanceProp = (_b = instanceScope == null ? void 0 : instanceScope.props) == null ? void 0 : _b[variableId];
|
|
2684
|
+
if (Array.isArray(instanceProp)) {
|
|
2685
|
+
instanceProp = instanceProp.map(
|
|
2686
|
+
(rawProp, index2) => {
|
|
2687
|
+
var _a2;
|
|
2688
|
+
return deepMerge(rawProp, (_a2 = variableLayer == null ? void 0 : variableLayer.defaultValue) == null ? void 0 : _a2.at(index2));
|
|
2689
|
+
}
|
|
2690
|
+
);
|
|
2691
|
+
}
|
|
2692
|
+
const lastCollectionItem = scopes.findLast(
|
|
2693
|
+
(scope) => (scope == null ? void 0 : scope.type) === index.scopeTypes.CollectionItemScope
|
|
2694
|
+
);
|
|
2695
|
+
resolveVariableLayer(
|
|
2696
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.manager,
|
|
2697
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition,
|
|
2698
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.value
|
|
2699
|
+
);
|
|
2700
|
+
const collectionItemProp = isPrimitive(lastCollectionItem == null ? void 0 : lastCollectionItem.value) && ((_c = core.entityOfKey(lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition)) == null ? void 0 : _c._id) === variableId ? lastCollectionItem == null ? void 0 : lastCollectionItem.value : extractVariableValue(lastCollectionItem == null ? void 0 : lastCollectionItem.value, variableId);
|
|
2701
|
+
const currentValue = variableKey2 === instanceProp ? null : collectionItemProp ?? instanceProp ?? null;
|
|
2702
|
+
const required = (variableLayer == null ? void 0 : variableLayer.required) ?? false;
|
|
2703
|
+
const defaultValue = (variableLayer == null ? void 0 : variableLayer.defaultValue) ?? null;
|
|
2704
|
+
const resultValue = required ? currentValue : currentValue ?? collectionItemProp ?? defaultValue;
|
|
2705
|
+
if (isVariableLink$1(resultValue)) {
|
|
2706
|
+
return readVariable(resultValue);
|
|
2707
|
+
}
|
|
2708
|
+
return {
|
|
2709
|
+
value: resultValue,
|
|
2710
|
+
layer: variableLayer
|
|
2711
|
+
};
|
|
2712
|
+
};
|
|
2713
|
+
const { layer, value } = readVariable(variableKey);
|
|
2714
|
+
return {
|
|
2715
|
+
value,
|
|
2716
|
+
layer,
|
|
2717
|
+
readVariable
|
|
2718
|
+
};
|
|
2719
|
+
};
|
|
2720
|
+
const useLayerCssVariable = (inputValue) => {
|
|
2721
|
+
const { manager } = require$$0.useContext(FragmentContext);
|
|
2722
|
+
const isVariable = isVariableLink$1(inputValue);
|
|
2723
|
+
const [variableValue] = y(isVariable ? manager : null, inputValue, {
|
|
2724
|
+
selector: (graph) => pick(graph, "defaultValue", "_id")
|
|
2725
|
+
});
|
|
2726
|
+
return {
|
|
2727
|
+
value: isVariable ? `var(--${variableValue == null ? void 0 : variableValue._id}, ${variableValue == null ? void 0 : variableValue.defaultValue})` : null
|
|
2728
|
+
};
|
|
2729
|
+
};
|
|
2730
|
+
const useLayerValue = (layerKey, fieldKey, options2) => {
|
|
2731
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
2732
|
+
const resultManager = (options2 == null ? void 0 : options2.manager) ?? fragmentManager;
|
|
2733
|
+
if (!resultManager) {
|
|
2734
|
+
return [null, noop, {}];
|
|
2735
|
+
}
|
|
2736
|
+
const key = core.keyOfEntity(layerKey);
|
|
2737
|
+
const [, updateLayerData] = y(resultManager, key, {
|
|
2738
|
+
// selector: (data) => (data ? pick(data, fieldKey) : data),
|
|
2739
|
+
});
|
|
2740
|
+
const { layer, rawLayer } = useNormalizeLayer(key, resultManager, options2);
|
|
2741
|
+
const rawValue = get(rawLayer, fieldKey);
|
|
2742
|
+
const layerValue = get(layer, fieldKey);
|
|
2743
|
+
const { value: variableValue } = useReadVariable(layerValue);
|
|
2744
|
+
const currentValue = variableValue ?? layerValue;
|
|
2745
|
+
const isInherit = isInheritField(resultManager, key, fieldKey);
|
|
2746
|
+
const isOverride = !isInherit && !isPartOfPrimary(resultManager, key);
|
|
2747
|
+
const setter = layerFieldSetter(resultManager, key, fieldKey, currentValue);
|
|
2748
|
+
const resetOverride = require$$0.useCallback(() => {
|
|
2749
|
+
resultManager.mutate(
|
|
2750
|
+
key,
|
|
2751
|
+
(prev) => {
|
|
2752
|
+
const r2 = omit(prev, fieldKey);
|
|
2753
|
+
return r2;
|
|
2754
|
+
},
|
|
2755
|
+
{ replace: true }
|
|
2756
|
+
);
|
|
2757
|
+
}, [updateLayerData]);
|
|
2758
|
+
const restore = require$$0.useCallback(
|
|
2759
|
+
(fallbackValue) => {
|
|
2760
|
+
var _a, _b, _c;
|
|
2761
|
+
const tempValue = ((_c = (_b = resultManager.resolve((_a = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _a.temp)) == null ? void 0 : _b[key]) == null ? void 0 : _c[fieldKey]) ?? fallbackValue;
|
|
2762
|
+
updateLayerData({ [fieldKey]: tempValue });
|
|
2763
|
+
return tempValue;
|
|
2764
|
+
},
|
|
2765
|
+
[updateLayerData, resultManager]
|
|
2766
|
+
);
|
|
2767
|
+
const updateValue = require$$0.useCallback(
|
|
2768
|
+
(value, options22) => {
|
|
2769
|
+
setter(value, options22);
|
|
2770
|
+
},
|
|
2771
|
+
[setter]
|
|
2772
|
+
);
|
|
2773
|
+
const { value: cssValue } = useLayerCssVariable(rawValue ?? layerValue);
|
|
2774
|
+
return [
|
|
2775
|
+
currentValue,
|
|
2776
|
+
updateValue,
|
|
2777
|
+
{
|
|
2778
|
+
isOverride,
|
|
2779
|
+
resetOverride,
|
|
2780
|
+
isVariable: isVariableLink$1(rawValue ?? layerValue),
|
|
2781
|
+
cssVariableValue: cssValue ?? currentValue,
|
|
2782
|
+
rawValue,
|
|
2783
|
+
restore,
|
|
2784
|
+
...resultManager.entityOfKey(key)
|
|
2785
|
+
}
|
|
2786
|
+
];
|
|
2787
|
+
};
|
|
2788
|
+
const processOptionalSize = (value, type) => {
|
|
2789
|
+
if (value === -1) return "";
|
|
2790
|
+
if (type === index.sizing.Fixed) return toPx(value);
|
|
2791
|
+
if (type === index.sizing.Relative) return `${value}%`;
|
|
2792
|
+
return "";
|
|
2793
|
+
};
|
|
2794
|
+
const useOptionalSize = (type, layerKey) => {
|
|
2795
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
2796
|
+
const [value] = useLayerValue(layerKey, type, fragmentManager);
|
|
2797
|
+
const [valueType] = useLayerValue(layerKey, `${type}Type`, fragmentManager);
|
|
2798
|
+
return require$$0.useMemo(
|
|
2799
|
+
() => processOptionalSize(value, valueType),
|
|
2800
|
+
[valueType, value]
|
|
2801
|
+
);
|
|
2802
|
+
};
|
|
2803
|
+
const useLayerSize = (layerKey) => {
|
|
2804
|
+
const { manager } = require$$0.useContext(FragmentContext);
|
|
2805
|
+
const minWidth = useOptionalSize("minWidth", layerKey);
|
|
2806
|
+
const minHeight = useOptionalSize("minHeight", layerKey);
|
|
2807
|
+
const maxWidth = useOptionalSize("maxWidth", layerKey);
|
|
2808
|
+
const maxHeight = useOptionalSize("maxHeight", layerKey);
|
|
2809
|
+
return {
|
|
2810
|
+
// width: widthCalc(widthValue),
|
|
2811
|
+
// height: heightCalc(heightValue),
|
|
2812
|
+
minWidth,
|
|
2813
|
+
minHeight,
|
|
2814
|
+
maxWidth,
|
|
2815
|
+
maxHeight
|
|
2816
|
+
};
|
|
2817
|
+
};
|
|
2818
|
+
const autoSizes = [index.sizing.Hug];
|
|
2819
|
+
const useLayerSizeValue = (layerKey, sizeType) => {
|
|
2820
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
2821
|
+
const { layerKey: instanceLayerKey } = require$$0.useContext(InstanceContext);
|
|
2822
|
+
const { isDocument, renderTarget: renderTarget2 } = useRenderTarget();
|
|
2823
|
+
const isTop = isTopLevel(fragmentManager, layerKey);
|
|
2824
|
+
const isPartOfInstance = !!instanceLayerKey;
|
|
2825
|
+
const layerParent = getParent(fragmentManager, layerKey);
|
|
2826
|
+
const { layer: normalizeParentLayer } = useNormalizeLayer(
|
|
2827
|
+
layerParent,
|
|
2828
|
+
fragmentManager
|
|
2829
|
+
);
|
|
2830
|
+
const layerNode = fragmentManager.resolve(layerKey);
|
|
2831
|
+
const [instanceType] = useLayerValue(
|
|
2832
|
+
instanceLayerKey,
|
|
2833
|
+
`${sizeType}Type`,
|
|
2834
|
+
fragmentManager
|
|
2835
|
+
);
|
|
2836
|
+
const [valueType] = useLayerValue(
|
|
2837
|
+
layerKey,
|
|
2838
|
+
`${sizeType}Type`,
|
|
2839
|
+
fragmentManager
|
|
2840
|
+
);
|
|
2841
|
+
const growType = sizeType === "width" ? "horizontalGrow" : "verticalGrow";
|
|
2842
|
+
return require$$0.useCallback(
|
|
2843
|
+
(value) => {
|
|
2844
|
+
if (isTop && isDocument && (normalizeParentLayer == null ? void 0 : normalizeParentLayer[growType]) === index.fragmentGrowingMode.fill) {
|
|
2845
|
+
return "100%";
|
|
2846
|
+
}
|
|
2847
|
+
if (isTop && isPartOfInstance && !autoSizes.includes(instanceType)) {
|
|
2848
|
+
return "100%";
|
|
2849
|
+
}
|
|
2850
|
+
if (autoSizes.includes(valueType)) {
|
|
2851
|
+
return layerNode._type === index.nodes.Instance ? "auto" : "min-content";
|
|
2852
|
+
}
|
|
2853
|
+
if (valueType === index.sizing.Relative) {
|
|
2854
|
+
return `${value}%`;
|
|
2855
|
+
}
|
|
2856
|
+
if (valueType === index.sizing.Fill) {
|
|
2857
|
+
return `100%`;
|
|
2858
|
+
}
|
|
2859
|
+
return toPx(value);
|
|
2860
|
+
},
|
|
2861
|
+
[
|
|
2862
|
+
isTop,
|
|
2863
|
+
isDocument,
|
|
2864
|
+
layerParent,
|
|
2865
|
+
growType,
|
|
2866
|
+
isPartOfInstance,
|
|
2867
|
+
instanceType,
|
|
2868
|
+
valueType,
|
|
2869
|
+
layerNode
|
|
2870
|
+
]
|
|
2871
|
+
);
|
|
2872
|
+
};
|
|
2873
|
+
const useLayerPosition = (layerKey) => {
|
|
2874
|
+
const { layerKey: instanceLayerKey } = require$$0.useContext(InstanceContext);
|
|
2875
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
2876
|
+
const { isDocument } = useRenderTarget();
|
|
2877
|
+
const isTop = isTopLevel(fragmentManager, layerKey);
|
|
2878
|
+
const [width] = useLayerValue(layerKey, "width");
|
|
2879
|
+
const [height] = useLayerValue(layerKey, "height");
|
|
2880
|
+
const widthCalc = useLayerSizeValue(layerKey, "width")(width);
|
|
2881
|
+
const heightCalc = useLayerSizeValue(layerKey, "height")(height);
|
|
2882
|
+
const [position] = useLayerValue(layerKey, "position");
|
|
2883
|
+
const [centerAnchorX] = useLayerValue(layerKey, "centerAnchorX");
|
|
2884
|
+
const [centerAnchorY] = useLayerValue(layerKey, "centerAnchorY");
|
|
2885
|
+
const [top] = useLayerValue(layerKey, "top");
|
|
2886
|
+
const [left] = useLayerValue(layerKey, "left");
|
|
2887
|
+
const [right] = useLayerValue(layerKey, "right");
|
|
2888
|
+
const [bottom] = useLayerValue(layerKey, "bottom");
|
|
2889
|
+
const skipPosition = isTop && isDocument || !!instanceLayerKey && isTop;
|
|
2890
|
+
if (isTop && !skipPosition) {
|
|
2891
|
+
return {
|
|
2892
|
+
position: index.positionType.absolute,
|
|
2893
|
+
top: toPx(top),
|
|
2894
|
+
left: toPx(left),
|
|
2895
|
+
width,
|
|
2896
|
+
height
|
|
2897
|
+
};
|
|
2898
|
+
}
|
|
2899
|
+
if (position === index.positionType.relative || skipPosition) {
|
|
2900
|
+
return {
|
|
2901
|
+
position: index.positionType.relative,
|
|
2902
|
+
width: widthCalc,
|
|
2903
|
+
height: heightCalc
|
|
2904
|
+
};
|
|
2905
|
+
}
|
|
2906
|
+
const hasConstrainX = isFiniteNumber(left) && isFiniteNumber(right);
|
|
2907
|
+
const hasConstrainY = isFiniteNumber(top) && isFiniteNumber(bottom);
|
|
2908
|
+
const hasAnyConstrainX = isFiniteNumber(left) || isFiniteNumber(right);
|
|
2909
|
+
const hasAnyConstrainY = isFiniteNumber(top) || isFiniteNumber(bottom);
|
|
2910
|
+
return {
|
|
2911
|
+
position,
|
|
2912
|
+
left: isFiniteNumber(left) ? toPx(left) : !isFiniteNumber(right) ? `${centerAnchorX * 100}%` : null,
|
|
2913
|
+
top: isFiniteNumber(top) ? toPx(top) : !isFiniteNumber(bottom) ? `${centerAnchorY * 100}%` : null,
|
|
2914
|
+
right: isFiniteNumber(right) ? toPx(right) : null,
|
|
2915
|
+
bottom: isFiniteNumber(bottom) ? toPx(bottom) : null,
|
|
2916
|
+
width: hasConstrainX ? null : widthCalc,
|
|
2917
|
+
height: hasConstrainY ? null : heightCalc,
|
|
2918
|
+
transform: !hasAnyConstrainX || !hasAnyConstrainY ? `translate3d(${!hasAnyConstrainX ? "-50%" : 0}, ${!hasAnyConstrainY ? "-50%" : 0}, 0px)` : null
|
|
2919
|
+
};
|
|
2920
|
+
};
|
|
2921
|
+
const useLayerBackground = (layerKey) => {
|
|
2922
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
2923
|
+
const [fillType] = useLayerValue(layerKey, "fillType", fragmentManager);
|
|
2924
|
+
const [, , { cssVariableValue: cssSolidFill }] = useLayerValue(
|
|
2925
|
+
layerKey,
|
|
2926
|
+
"solidFill",
|
|
2927
|
+
fragmentManager
|
|
2928
|
+
);
|
|
2929
|
+
const [imageFill, , { cssVariableValue: cssImageFill }] = useLayerValue(
|
|
2930
|
+
layerKey,
|
|
2931
|
+
"imageFill",
|
|
2932
|
+
fragmentManager
|
|
2933
|
+
);
|
|
2934
|
+
const [, , { cssVariableValue: cssImageSize }] = useLayerValue(
|
|
2935
|
+
layerKey,
|
|
2936
|
+
"imageSize",
|
|
2937
|
+
fragmentManager
|
|
2938
|
+
);
|
|
2939
|
+
return require$$0.useMemo(() => {
|
|
2940
|
+
if (fillType === index.paintMode.Solid) {
|
|
2941
|
+
return {
|
|
2942
|
+
background: cssSolidFill
|
|
2943
|
+
};
|
|
2944
|
+
}
|
|
2945
|
+
if (fillType === index.paintMode.Image && cssImageFill) {
|
|
2946
|
+
return {
|
|
2947
|
+
background: `url(${imageFill})`,
|
|
2948
|
+
backgroundSize: cssImageSize == null ? void 0 : cssImageSize.toLowerCase(),
|
|
2949
|
+
backgroundRepeat: "no-repeat"
|
|
2950
|
+
};
|
|
2951
|
+
}
|
|
2952
|
+
return {
|
|
2953
|
+
background: "transparent"
|
|
2954
|
+
};
|
|
2955
|
+
}, [fillType, cssImageFill, cssSolidFill]);
|
|
2956
|
+
};
|
|
2957
|
+
const useLayerDisplay = (layerKey) => {
|
|
2958
|
+
const { manager } = require$$0.useContext(FragmentContext);
|
|
2959
|
+
const [layerModeValue] = useLayerValue(layerKey, "layerMode", manager);
|
|
2960
|
+
const [visible] = useLayerValue(layerKey, "visible", manager);
|
|
2961
|
+
return require$$0.useMemo(() => {
|
|
2962
|
+
if (!visible) {
|
|
2963
|
+
return "none";
|
|
2964
|
+
}
|
|
2965
|
+
return layerModeValue === index.layerMode.flex ? "flex" : null;
|
|
2966
|
+
}, [layerModeValue, visible]);
|
|
2967
|
+
};
|
|
2968
|
+
const useCalcLayerBorder = (layerKey) => {
|
|
2969
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
2970
|
+
const [borderTypeValue] = useLayerValue(
|
|
2971
|
+
layerKey,
|
|
2972
|
+
"borderType",
|
|
2973
|
+
fragmentManager
|
|
2974
|
+
);
|
|
2975
|
+
return (width, color) => {
|
|
2976
|
+
let value = {
|
|
2977
|
+
borderTop: ``,
|
|
2978
|
+
borderRight: ``,
|
|
2979
|
+
borderBottom: ``,
|
|
2980
|
+
borderLeft: ``
|
|
2981
|
+
};
|
|
2982
|
+
if (typeof borderTypeValue === "string" && borderTypeValue !== index.borderType.None) {
|
|
2983
|
+
const staticPart = `${borderTypeValue.toLowerCase()} ${color}`;
|
|
2984
|
+
const widthSides = width == null ? void 0 : width.split(" ");
|
|
2985
|
+
if (widthSides.length === 1) {
|
|
2986
|
+
const widthValue = widthSides == null ? void 0 : widthSides.at(0);
|
|
2987
|
+
value = {
|
|
2988
|
+
borderTop: `${widthValue} ${staticPart}`,
|
|
2989
|
+
borderRight: `${widthValue} ${staticPart}`,
|
|
2990
|
+
borderBottom: `${widthValue} ${staticPart}`,
|
|
2991
|
+
borderLeft: `${widthValue} ${staticPart}`
|
|
2992
|
+
};
|
|
2993
|
+
} else {
|
|
2994
|
+
value = {
|
|
2995
|
+
borderTop: `${widthSides == null ? void 0 : widthSides.at(0)} ${staticPart}`,
|
|
2996
|
+
borderRight: `${widthSides == null ? void 0 : widthSides.at(1)} ${staticPart}`,
|
|
2997
|
+
borderBottom: `${widthSides == null ? void 0 : widthSides.at(2)} ${staticPart}`,
|
|
2998
|
+
borderLeft: `${widthSides == null ? void 0 : widthSides.at(3)} ${staticPart}`
|
|
2999
|
+
};
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
return value;
|
|
3003
|
+
};
|
|
3004
|
+
};
|
|
3005
|
+
const useLayerBorder = (layerKey) => {
|
|
3006
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3007
|
+
const [borderWidth] = useLayerValue(layerKey, "borderWidth", fragmentManager);
|
|
3008
|
+
const [borderColor] = useLayerValue(layerKey, "borderColor", fragmentManager);
|
|
3009
|
+
const calcBorder = useCalcLayerBorder(layerKey);
|
|
3010
|
+
return require$$0.useMemo(
|
|
3011
|
+
() => calcBorder(borderWidth, borderColor),
|
|
3012
|
+
[borderWidth, borderColor]
|
|
3013
|
+
);
|
|
3014
|
+
};
|
|
3015
|
+
const useLayerLayout = (layerKey) => {
|
|
3016
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3017
|
+
const [layerModeValue] = useLayerValue(
|
|
3018
|
+
layerKey,
|
|
3019
|
+
"layerMode",
|
|
3020
|
+
fragmentManager
|
|
3021
|
+
);
|
|
3022
|
+
const [layerWrap] = useLayerValue(layerKey, "layerWrap", fragmentManager);
|
|
3023
|
+
const [layerDistribute2] = useLayerValue(
|
|
3024
|
+
layerKey,
|
|
3025
|
+
"layerDistribute",
|
|
3026
|
+
fragmentManager
|
|
3027
|
+
);
|
|
3028
|
+
const [layerDirectionValue] = useLayerValue(
|
|
3029
|
+
layerKey,
|
|
3030
|
+
"layerDirection",
|
|
3031
|
+
fragmentManager
|
|
3032
|
+
);
|
|
3033
|
+
const [layerAlign2] = useLayerValue(layerKey, "layerAlign", fragmentManager);
|
|
3034
|
+
const [padding] = useLayerValue(layerKey, "padding", fragmentManager);
|
|
3035
|
+
const [gap] = useLayerValue(layerKey, "layerGap", fragmentManager);
|
|
3036
|
+
const isFlex = layerModeValue === index.layerMode.flex;
|
|
3037
|
+
return require$$0.useMemo(
|
|
3038
|
+
() => ({
|
|
3039
|
+
display: isFlex ? "flex" : null,
|
|
3040
|
+
gap: toPx(gap),
|
|
3041
|
+
flexWrap: isFlex ? layerWrap ? "wrap" : null : null,
|
|
3042
|
+
justifyContent: isFlex ? layerDistribute2 : null,
|
|
3043
|
+
flexDirection: isFlex ? layerDirectionValue === index.layerDirection.vertical ? "column" : "row" : null,
|
|
3044
|
+
alignItems: isFlex ? layerAlign2 : null,
|
|
3045
|
+
padding: isFlex ? padding : null
|
|
3046
|
+
}),
|
|
3047
|
+
[
|
|
3048
|
+
isFlex,
|
|
3049
|
+
layerWrap,
|
|
3050
|
+
layerDistribute2,
|
|
3051
|
+
layerDirectionValue,
|
|
3052
|
+
layerAlign2,
|
|
3053
|
+
padding
|
|
3054
|
+
]
|
|
3055
|
+
);
|
|
3056
|
+
};
|
|
3057
|
+
const useLayerTextStyles = (layerKey) => {
|
|
3058
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3059
|
+
const [attributes] = useLayerValue(layerKey, "attributes", fragmentManager);
|
|
3060
|
+
const [color] = useLayerValue(layerKey, "attributes.color", fragmentManager);
|
|
3061
|
+
const cleanAttributes = omit(attributes, "_id", "_type");
|
|
3062
|
+
return {
|
|
3063
|
+
...cleanAttributes,
|
|
3064
|
+
color
|
|
3065
|
+
};
|
|
3066
|
+
};
|
|
3067
|
+
const useLayerStyles = (layerKey) => {
|
|
3068
|
+
try {
|
|
3069
|
+
if (!layerKey) {
|
|
3070
|
+
throw new Error("Empty layer key");
|
|
3071
|
+
}
|
|
3072
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3073
|
+
const [opacity] = useLayerValue(layerKey, "opacity", fragmentManager);
|
|
3074
|
+
const layerSize = useLayerSize(layerKey);
|
|
3075
|
+
const position = useLayerPosition(layerKey);
|
|
3076
|
+
const display = useLayerDisplay(layerKey);
|
|
3077
|
+
const background = useLayerBackground(layerKey);
|
|
3078
|
+
const border = useLayerBorder(layerKey);
|
|
3079
|
+
const layout = useLayerLayout(layerKey);
|
|
3080
|
+
const [zIndex] = useLayerValue(layerKey, "zIndex", fragmentManager);
|
|
3081
|
+
const [rotate] = useLayerValue(layerKey, "rotate", fragmentManager);
|
|
3082
|
+
const [borderRadius] = useLayerValue(
|
|
3083
|
+
layerKey,
|
|
3084
|
+
"borderRadius",
|
|
3085
|
+
fragmentManager
|
|
3086
|
+
);
|
|
3087
|
+
const [whiteSpace2] = useLayerValue(layerKey, "whiteSpace", fragmentManager);
|
|
3088
|
+
const textStyles = useLayerTextStyles(layerKey);
|
|
3089
|
+
return {
|
|
3090
|
+
// ...(props ?? {}),
|
|
3091
|
+
...border,
|
|
3092
|
+
...background,
|
|
3093
|
+
...position,
|
|
3094
|
+
opacity,
|
|
3095
|
+
rotate: isValue(rotate) ? `${rotate}deg` : null,
|
|
3096
|
+
"border-radius": borderRadius,
|
|
3097
|
+
"white-space": whiteSpace2,
|
|
3098
|
+
"z-index": zIndex !== -1 ? zIndex : null,
|
|
3099
|
+
...layout,
|
|
3100
|
+
...layerSize,
|
|
3101
|
+
...textStyles,
|
|
3102
|
+
display,
|
|
3103
|
+
"user-select": "none"
|
|
3104
|
+
// ...cssOverride,
|
|
3105
|
+
};
|
|
3106
|
+
} catch (e2) {
|
|
3107
|
+
return {};
|
|
3108
|
+
}
|
|
436
3109
|
};
|
|
437
3110
|
const useFragmentProperties = (fragmentId) => {
|
|
438
3111
|
var _a;
|
|
439
3112
|
const { manager } = useFragmentManager(fragmentId);
|
|
440
3113
|
const [instanceFragment] = y(manager, (_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.root);
|
|
441
|
-
return
|
|
3114
|
+
return {
|
|
3115
|
+
properties: ((instanceFragment == null ? void 0 : instanceFragment.properties) ?? []).map((manager == null ? void 0 : manager.resolve) ?? noop).filter((prop) => !(prop == null ? void 0 : prop.parent)).map(core.keyOfEntity),
|
|
3116
|
+
manager
|
|
3117
|
+
};
|
|
442
3118
|
};
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
const
|
|
3119
|
+
const useHash = (layerKey, manager) => {
|
|
3120
|
+
if (!layerKey || !manager) return null;
|
|
3121
|
+
const layer = manager.resolve(layerKey);
|
|
3122
|
+
const overrideFrom = getKey(layer == null ? void 0 : layer.overrideFrom);
|
|
3123
|
+
return hashGenerator(overrideFrom ?? layerKey);
|
|
3124
|
+
};
|
|
3125
|
+
const useInstanceProps = (instanceProps) => {
|
|
3126
|
+
const isTopInstance = !(instanceProps == null ? void 0 : instanceProps.layerKey);
|
|
3127
|
+
const { manager: loadedManager } = useFragmentManager(
|
|
3128
|
+
isTopInstance ? instanceProps == null ? void 0 : instanceProps.fragmentId : null
|
|
3129
|
+
);
|
|
3130
|
+
const { manager: fragmentContextManager } = require$$0.useContext(FragmentContext);
|
|
3131
|
+
const { properties: definitions, manager: innerFragmentManager } = useFragmentProperties(instanceProps == null ? void 0 : instanceProps.fragmentId);
|
|
3132
|
+
const definitionsData = S(innerFragmentManager, definitions);
|
|
3133
|
+
const fragmentManager = isTopInstance ? loadedManager : fragmentContextManager;
|
|
3134
|
+
const [instanceLayer] = y(fragmentManager, instanceProps.layerKey);
|
|
3135
|
+
const instanceLayerProps = (instanceLayer == null ? void 0 : instanceLayer.props) ?? {};
|
|
3136
|
+
const mergedProps = require$$0.useMemo(() => {
|
|
3137
|
+
let base = instanceLayerProps;
|
|
3138
|
+
if (isTopInstance && isObject(base) && isObject(instanceProps == null ? void 0 : instanceProps.props)) {
|
|
3139
|
+
base = {
|
|
3140
|
+
...base,
|
|
3141
|
+
...instanceProps == null ? void 0 : instanceProps.props
|
|
3142
|
+
};
|
|
3143
|
+
}
|
|
3144
|
+
if (isTopInstance && fragmentManager) {
|
|
3145
|
+
definitionsData.forEach((definition2) => {
|
|
3146
|
+
var _a;
|
|
3147
|
+
const defId = definition2._id;
|
|
3148
|
+
base[defId] = ((_a = instanceProps == null ? void 0 : instanceProps.props) == null ? void 0 : _a[defId]) ?? (definition2 == null ? void 0 : definition2.defaultValue);
|
|
3149
|
+
});
|
|
3150
|
+
}
|
|
3151
|
+
return omit(base, "_type", "_id");
|
|
3152
|
+
}, [isTopInstance, fragmentManager, instanceLayerProps, definitionsData]);
|
|
3153
|
+
return {
|
|
3154
|
+
props: mergedProps,
|
|
3155
|
+
cssProps: getCssVariables(mergedProps)
|
|
3156
|
+
};
|
|
3157
|
+
};
|
|
3158
|
+
const useLayerInteractions = (layerKey, options2) => {
|
|
3159
|
+
const pause = (options2 == null ? void 0 : options2.pauseInteractions) ?? false;
|
|
3160
|
+
const { manager: globalManager } = useGlobalManager();
|
|
3161
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3162
|
+
const [interactions2] = useLayerValue(
|
|
3163
|
+
layerKey,
|
|
3164
|
+
"interactions",
|
|
3165
|
+
fragmentManager
|
|
3166
|
+
);
|
|
3167
|
+
const { readVariable } = useReadVariable();
|
|
3168
|
+
const fireEvent = require$$0.useCallback(
|
|
3169
|
+
(eventLink) => {
|
|
3170
|
+
var _a, _b, _c, _d;
|
|
3171
|
+
const event = fragmentManager.resolve(eventLink);
|
|
3172
|
+
const { value: eventValue } = readVariable(eventLink);
|
|
3173
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.code)) {
|
|
3174
|
+
(_b = (_a = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _a.reachGoal) == null ? void 0 : _b.call(_a, eventValue == null ? void 0 : eventValue.code);
|
|
3175
|
+
}
|
|
3176
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.tracker && eventValue) {
|
|
3177
|
+
(_d = (_c = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _c.trackAdPixel) == null ? void 0 : _d.call(_c, eventValue);
|
|
3178
|
+
}
|
|
3179
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.callback && typeof eventValue === "function") {
|
|
3180
|
+
eventValue();
|
|
3181
|
+
}
|
|
3182
|
+
},
|
|
3183
|
+
[globalManager, fragmentManager]
|
|
3184
|
+
);
|
|
3185
|
+
require$$0.useEffect(() => {
|
|
3186
|
+
if (!pause && Array.isArray(interactions2)) {
|
|
3187
|
+
interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.appear).map((el) => el.event).forEach(fireEvent);
|
|
3188
|
+
}
|
|
3189
|
+
}, [pause]);
|
|
3190
|
+
return require$$0.useMemo(() => {
|
|
3191
|
+
if (!pause && !interactions2 || !Array.isArray(interactions2)) return {};
|
|
3192
|
+
if (pause) return {};
|
|
3193
|
+
const clickEvents = interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.click).map((el) => el.event);
|
|
3194
|
+
return {
|
|
3195
|
+
onClick: () => {
|
|
3196
|
+
clickEvents.map(fireEvent);
|
|
3197
|
+
}
|
|
3198
|
+
};
|
|
3199
|
+
}, [interactions2, fireEvent, pause]);
|
|
3200
|
+
};
|
|
3201
|
+
const useInstance = (instanceProps) => {
|
|
3202
|
+
const { manager: parentManager } = require$$0.useContext(FragmentContext);
|
|
3203
|
+
const [instanceLayer] = y(parentManager, instanceProps.layerKey);
|
|
3204
|
+
const styles2 = useLayerStyles(instanceProps.layerKey);
|
|
3205
|
+
const events = useLayerInteractions(instanceProps.layerKey, instanceProps);
|
|
3206
|
+
const { manager: resultGlobalManager } = useGlobalManager(
|
|
3207
|
+
instanceProps == null ? void 0 : instanceProps.globalManager
|
|
3208
|
+
);
|
|
3209
|
+
const resultFragmentId = (instanceProps == null ? void 0 : instanceProps.fragmentId) ?? (instanceLayer == null ? void 0 : instanceLayer.fragment);
|
|
3210
|
+
const { properties: definitions, manager: innerFragmentManager } = useFragmentProperties(resultFragmentId);
|
|
3211
|
+
const { props, cssProps } = useInstanceProps(instanceProps);
|
|
3212
|
+
const hash = useHash(instanceProps.layerKey, innerFragmentManager);
|
|
3213
|
+
return {
|
|
3214
|
+
hash,
|
|
3215
|
+
styles: styles2,
|
|
3216
|
+
events,
|
|
3217
|
+
definitions,
|
|
3218
|
+
props,
|
|
3219
|
+
cssProps,
|
|
3220
|
+
parentManager,
|
|
3221
|
+
innerManager: innerFragmentManager,
|
|
3222
|
+
fragmentId: resultFragmentId,
|
|
3223
|
+
globalManager: resultGlobalManager
|
|
3224
|
+
};
|
|
3225
|
+
};
|
|
3226
|
+
const InstanceContext = require$$0.createContext({
|
|
3227
|
+
layerKey: null,
|
|
3228
|
+
parentManager: null,
|
|
3229
|
+
innerManager: null,
|
|
3230
|
+
props: {},
|
|
3231
|
+
definitions: []
|
|
3232
|
+
});
|
|
3233
|
+
const useLayerChildren = (layerKey, customManager) => {
|
|
3234
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3235
|
+
const [layerData] = y(customManager ?? fragmentManager, layerKey, {
|
|
3236
|
+
selector: (data) => pick(data, "children")
|
|
3237
|
+
});
|
|
3238
|
+
return (layerData == null ? void 0 : layerData.children) ?? [];
|
|
3239
|
+
};
|
|
3240
|
+
const useFragmentChildren = (fragmentId) => {
|
|
3241
|
+
const { layerKey: instanceLayerKey } = require$$0.useContext(InstanceContext);
|
|
3242
|
+
const { manager, fragmentLayerKey } = useFragmentManager(fragmentId);
|
|
3243
|
+
const children = useLayerChildren(fragmentLayerKey, manager);
|
|
3244
|
+
const { isDocument, renderTarget: renderTarget2 } = useRenderTarget();
|
|
3245
|
+
const [resizeChildren, setResizeChildren] = require$$0.useState(null);
|
|
3246
|
+
require$$0.useRef();
|
|
3247
|
+
const setRef = require$$0.useCallback(
|
|
3248
|
+
(node) => {
|
|
3249
|
+
},
|
|
3250
|
+
[isDocument, instanceLayerKey, manager, children]
|
|
3251
|
+
);
|
|
3252
|
+
const primary = children == null ? void 0 : children.find(
|
|
3253
|
+
(breakpoint) => {
|
|
3254
|
+
var _a;
|
|
3255
|
+
return (_a = manager.resolve(breakpoint)) == null ? void 0 : _a.isPrimary;
|
|
3256
|
+
}
|
|
3257
|
+
);
|
|
3258
|
+
return {
|
|
3259
|
+
primary,
|
|
3260
|
+
children,
|
|
3261
|
+
//isBrowser && resizeChildren ? resizeChildren : children, //isStyleSheetRender ? children ?? [] : primary ? [primary] : [],
|
|
3262
|
+
isResize: isBrowser_default && resizeChildren,
|
|
3263
|
+
setRef
|
|
3264
|
+
};
|
|
3265
|
+
};
|
|
3266
|
+
const useStyleSheet = (manager) => {
|
|
3267
|
+
var _a, _b;
|
|
3268
|
+
const addLayerStyle = require$$0.useCallback(
|
|
3269
|
+
(layerKey, styles2, layer) => {
|
|
3270
|
+
var _a2, _b2;
|
|
3271
|
+
if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
|
|
3272
|
+
(_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addStyle) == null ? void 0 : _b2.call(_a2, layerKey, styles2, layer);
|
|
3273
|
+
}
|
|
3274
|
+
},
|
|
3275
|
+
[manager]
|
|
3276
|
+
);
|
|
3277
|
+
return {
|
|
3278
|
+
addLayerStyle,
|
|
3279
|
+
mount: ((_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.mount) ?? noop,
|
|
3280
|
+
unmount: ((_b = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _b.unmount) ?? noop
|
|
3281
|
+
};
|
|
3282
|
+
};
|
|
3283
|
+
const useFragment = (fragmentId, globalManager) => {
|
|
3284
|
+
var _a, _b;
|
|
3285
|
+
const instanceContext = require$$0.useContext(InstanceContext);
|
|
3286
|
+
const fragmentContext = useFragmentManager(fragmentId);
|
|
3287
|
+
const { isDocument } = useRenderTarget();
|
|
3288
|
+
const { setRef, children, isResize, primary } = useFragmentChildren(fragmentId);
|
|
3289
|
+
const hash = useHash(
|
|
3290
|
+
fragmentContext.fragmentLayerKey,
|
|
3291
|
+
fragmentContext.manager
|
|
3292
|
+
);
|
|
3293
|
+
const { properties: definitions } = useFragmentProperties(fragmentId);
|
|
3294
|
+
const scopes = require$$0.useContext(ScopeContext);
|
|
3295
|
+
!(scopes == null ? void 0 : scopes.length);
|
|
3296
|
+
const { addLayerStyle, mount, unmount } = useStyleSheet(
|
|
3297
|
+
fragmentContext.manager
|
|
3298
|
+
);
|
|
3299
|
+
if (fragmentContext.manager) {
|
|
3300
|
+
addLayerStyle(
|
|
3301
|
+
fragmentContext.fragmentLayerKey,
|
|
3302
|
+
{
|
|
3303
|
+
width: "100%",
|
|
3304
|
+
height: "100%",
|
|
3305
|
+
"container-type": (children == null ? void 0 : children.length) === 1 ? "normal" : "inline-size"
|
|
3306
|
+
},
|
|
3307
|
+
(_a = fragmentContext.manager) == null ? void 0 : _a.resolve(fragmentContext.fragmentLayerKey),
|
|
3308
|
+
(_b = fragmentContext.manager) == null ? void 0 : _b.key
|
|
3309
|
+
);
|
|
3310
|
+
mount();
|
|
3311
|
+
}
|
|
3312
|
+
require$$0.useEffect(() => {
|
|
3313
|
+
return () => {
|
|
3314
|
+
unmount();
|
|
3315
|
+
};
|
|
3316
|
+
}, []);
|
|
3317
|
+
return {
|
|
3318
|
+
hash,
|
|
3319
|
+
isDocument,
|
|
3320
|
+
fragmentContext,
|
|
3321
|
+
layerKey: fragmentContext.fragmentLayerKey,
|
|
3322
|
+
isTopFragment: !instanceContext.layerKey,
|
|
3323
|
+
setRef,
|
|
3324
|
+
children,
|
|
3325
|
+
isResize,
|
|
3326
|
+
definitions
|
|
3327
|
+
};
|
|
3328
|
+
};
|
|
3329
|
+
const useLayerLink = (layerKey) => {
|
|
3330
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3331
|
+
const [href] = useLayerValue(layerKey, "href", fragmentManager);
|
|
3332
|
+
const [hrefNewTab] = useLayerValue(layerKey, "hrefNewTab", fragmentManager);
|
|
3333
|
+
const isLink2 = isValue(href) && typeof href === "string" && !!(href == null ? void 0 : href.length);
|
|
3334
|
+
const linkTarget2 = hrefNewTab ? "_blank" : "";
|
|
3335
|
+
const linkProps = require$$0.useMemo(() => {
|
|
3336
|
+
if (isLink2) {
|
|
3337
|
+
return {
|
|
3338
|
+
target: linkTarget2,
|
|
3339
|
+
href
|
|
3340
|
+
};
|
|
3341
|
+
}
|
|
3342
|
+
return {};
|
|
3343
|
+
}, [linkTarget2, href, isLink2]);
|
|
3344
|
+
return {
|
|
3345
|
+
isLink: isLink2,
|
|
3346
|
+
linkHref: href,
|
|
3347
|
+
linkTarget: hrefNewTab ? "_blank" : "",
|
|
3348
|
+
linkProps
|
|
3349
|
+
};
|
|
3350
|
+
};
|
|
3351
|
+
const useFrame = (layerKey, options2) => {
|
|
3352
|
+
const collectStyle = (options2 == null ? void 0 : options2.collectStyle) ?? true;
|
|
3353
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3354
|
+
const layer = fragmentManager.entityOfKey(layerKey);
|
|
3355
|
+
const styles2 = useLayerStyles(layerKey);
|
|
3356
|
+
const children = useLayerChildren(layerKey);
|
|
3357
|
+
const hash = useHash(layerKey, fragmentManager);
|
|
3358
|
+
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3359
|
+
const events = useLayerInteractions(layerKey, options2);
|
|
3360
|
+
const link = useLayerLink(layerKey);
|
|
3361
|
+
if (collectStyle) {
|
|
3362
|
+
addLayerStyle(layerKey, styles2, fragmentManager.resolve(layerKey));
|
|
3363
|
+
}
|
|
3364
|
+
return {
|
|
3365
|
+
Tag: (link == null ? void 0 : link.isLink) ? (options2 == null ? void 0 : options2.FrameTag) ?? "a" : (options2 == null ? void 0 : options2.FrameTag) ?? "div",
|
|
3366
|
+
type: layer == null ? void 0 : layer._type,
|
|
3367
|
+
hash,
|
|
3368
|
+
styles: {},
|
|
3369
|
+
//isBrowser ? pick(styles, "background") : {},
|
|
3370
|
+
children,
|
|
3371
|
+
events,
|
|
3372
|
+
linkProps: link.linkProps
|
|
3373
|
+
};
|
|
3374
|
+
};
|
|
3375
|
+
function extractVariablesFromHtml(html) {
|
|
3376
|
+
if (!html) return [];
|
|
3377
|
+
const regex = /<span(?=\s)(?=(?:[^>]*?\s)?class="[^"]*variable[^"]*")(?=(?:[^>]*?\s)?data-type="mention")(?=(?:[^>]*?\s)?data-id="([^"]+)")[^>]*>.*?<\/span>/gi;
|
|
3378
|
+
const mentions = [];
|
|
3379
|
+
let match;
|
|
3380
|
+
while ((match = regex.exec(html)) !== null) {
|
|
3381
|
+
mentions.push({
|
|
3382
|
+
fullMatch: match[0],
|
|
3383
|
+
dataId: match[1],
|
|
3384
|
+
variableKey: core.keyOfEntity({
|
|
3385
|
+
_type: index.nodes.Variable,
|
|
3386
|
+
_id: match[1]
|
|
3387
|
+
}),
|
|
3388
|
+
position: match.index
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
return mentions;
|
|
3392
|
+
}
|
|
3393
|
+
const useTextContent = (layerKey, manager) => {
|
|
3394
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3395
|
+
const [content, , contentInfo] = useLayerValue(
|
|
3396
|
+
layerKey,
|
|
3397
|
+
"content",
|
|
3398
|
+
fragmentManager
|
|
3399
|
+
);
|
|
3400
|
+
const variables = extractVariablesFromHtml(content);
|
|
3401
|
+
const { readVariable } = useReadVariable();
|
|
3402
|
+
S(
|
|
3403
|
+
fragmentManager,
|
|
3404
|
+
variables.map((variable) => variable.variableKey)
|
|
3405
|
+
);
|
|
3406
|
+
let nextContent = content;
|
|
3407
|
+
variables.forEach((variable) => {
|
|
3408
|
+
nextContent = nextContent.replace(
|
|
3409
|
+
variable.fullMatch,
|
|
3410
|
+
readVariable(variable.variableKey).value
|
|
3411
|
+
);
|
|
3412
|
+
});
|
|
3413
|
+
return nextContent;
|
|
3414
|
+
};
|
|
3415
|
+
const useTextAttributes = (layerKey, options2) => {
|
|
3416
|
+
const collectStyle = (options2 == null ? void 0 : options2.collectStyle) ?? true;
|
|
3417
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3418
|
+
const styles2 = useLayerStyles(layerKey);
|
|
3419
|
+
const content = useTextContent(layerKey);
|
|
3420
|
+
const hash = useHash(layerKey, fragmentManager);
|
|
3421
|
+
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3422
|
+
if (collectStyle) {
|
|
3423
|
+
addLayerStyle(layerKey, styles2, fragmentManager.resolve(layerKey));
|
|
3424
|
+
}
|
|
3425
|
+
return {
|
|
3426
|
+
styles: styles2,
|
|
3427
|
+
hash,
|
|
3428
|
+
content
|
|
3429
|
+
};
|
|
3430
|
+
};
|
|
3431
|
+
function useMounted() {
|
|
3432
|
+
const [isMounted, setIsMounted] = require$$0.useState(false);
|
|
3433
|
+
require$$0.useEffect(() => {
|
|
3434
|
+
setIsMounted(true);
|
|
3435
|
+
return () => {
|
|
3436
|
+
setIsMounted(false);
|
|
3437
|
+
};
|
|
3438
|
+
}, []);
|
|
3439
|
+
return isMounted;
|
|
3440
|
+
}
|
|
3441
|
+
const allowAttributes = [
|
|
3442
|
+
"fontSize",
|
|
3443
|
+
"fontWeight",
|
|
3444
|
+
"color",
|
|
3445
|
+
"lineHeight",
|
|
3446
|
+
"letterSpacing",
|
|
3447
|
+
"textTransform",
|
|
3448
|
+
"textDecoration",
|
|
3449
|
+
"textAlign"
|
|
3450
|
+
];
|
|
3451
|
+
const wrapTextInParagraphWithAttributes = (text2, attributes) => {
|
|
3452
|
+
if (text2.startsWith("<p")) return text2;
|
|
3453
|
+
const style = Object.entries(attributes).filter(
|
|
3454
|
+
([key, value]) => isValue(value) && allowAttributes.includes(key) && typeof value === "string" && !!value.length
|
|
3455
|
+
).map(([key, value]) => `${toKebabCase(key)}: ${value}`).join("; ");
|
|
3456
|
+
return `<p style="${style}">${text2}</p>`;
|
|
3457
|
+
};
|
|
3458
|
+
const findBreakpoint = (breakpoints = [], width) => {
|
|
3459
|
+
if (!(breakpoints == null ? void 0 : breakpoints.length)) return null;
|
|
3460
|
+
const sortBreakpoints = breakpoints.toSorted((a2, b) => (a2 == null ? void 0 : a2.width) - (b == null ? void 0 : b.width));
|
|
3461
|
+
return sortBreakpoints.reduce(
|
|
3462
|
+
(prev, curr) => width >= curr.width ? curr : prev
|
|
3463
|
+
);
|
|
3464
|
+
};
|
|
3465
|
+
const copyLayer = (manager, layer) => {
|
|
3466
|
+
const layerGraph = manager.resolve(layer);
|
|
3467
|
+
if (layerGraph) {
|
|
3468
|
+
const layer2 = createLayer(
|
|
3469
|
+
{
|
|
3470
|
+
_type: layerGraph._type,
|
|
3471
|
+
...layerGraph
|
|
3472
|
+
},
|
|
3473
|
+
true
|
|
3474
|
+
);
|
|
3475
|
+
if ((layerGraph == null ? void 0 : layerGraph.children) && layer2) {
|
|
3476
|
+
layer2.children = ((layerGraph == null ? void 0 : layerGraph.children) ?? []).map(
|
|
3477
|
+
(child) => copyLayer(manager, child)
|
|
3478
|
+
);
|
|
3479
|
+
}
|
|
3480
|
+
return layer2;
|
|
3481
|
+
}
|
|
3482
|
+
return null;
|
|
3483
|
+
};
|
|
3484
|
+
const getStylesheetKey = (fragmentKey) => {
|
|
3485
|
+
const isLink2 = core.isLinkKey(fragmentKey);
|
|
3486
|
+
if (isLink2) {
|
|
3487
|
+
const [type, id] = fragmentKey.split(":");
|
|
3488
|
+
return `stylesheet-${id}`;
|
|
3489
|
+
}
|
|
3490
|
+
return `stylesheet-${fragmentKey ?? "unknown"}`;
|
|
3491
|
+
};
|
|
3492
|
+
function useInjectedStyle() {
|
|
3493
|
+
const { manager } = require$$0.useContext(FragmentContext);
|
|
3494
|
+
const injectStyle = () => {
|
|
3495
|
+
var _a, _b;
|
|
3496
|
+
const styles2 = (_b = (_a = manager == null ? void 0 : manager.$styleSheet.extract()) == null ? void 0 : _a.at(0)) == null ? void 0 : _b.styles;
|
|
3497
|
+
if (isBrowser_default && styles2) {
|
|
3498
|
+
const stylesheetKey = getStylesheetKey(manager == null ? void 0 : manager.key);
|
|
3499
|
+
if (document.getElementById(stylesheetKey)) {
|
|
3500
|
+
const el = document.getElementById(stylesheetKey);
|
|
3501
|
+
if (el) el.remove();
|
|
3502
|
+
}
|
|
3503
|
+
const style = document.createElement("style");
|
|
3504
|
+
style.id = stylesheetKey;
|
|
3505
|
+
style.textContent = styles2.join("");
|
|
3506
|
+
document.head.appendChild(style);
|
|
3507
|
+
}
|
|
3508
|
+
};
|
|
447
3509
|
return {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
3510
|
+
injectStyle
|
|
3511
|
+
};
|
|
3512
|
+
}
|
|
3513
|
+
const useLayerScopes = (fragmentManager, layerKey) => {
|
|
3514
|
+
var _a, _b;
|
|
3515
|
+
const layerParents = getAllParents(fragmentManager, layerKey);
|
|
3516
|
+
const resultScopes = [(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.scopes) == null ? void 0 : _b.get(void 0)];
|
|
3517
|
+
layerParents.forEach((parent) => {
|
|
3518
|
+
var _a2, _b2, _c, _d;
|
|
3519
|
+
const parentLink = core.keyOfEntity(parent);
|
|
3520
|
+
if ((_b2 = (_a2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a2.scopes) == null ? void 0 : _b2.has(parentLink)) {
|
|
3521
|
+
resultScopes.push((_d = (_c = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c.scopes) == null ? void 0 : _d.get(parentLink));
|
|
453
3522
|
}
|
|
3523
|
+
});
|
|
3524
|
+
return resultScopes;
|
|
3525
|
+
};
|
|
3526
|
+
function cssToJsStyle(cssKey) {
|
|
3527
|
+
return cssKey.replace(/-([a-z])/g, (_2, letter) => letter.toUpperCase());
|
|
3528
|
+
}
|
|
3529
|
+
function cssStringToJsObject(cssString) {
|
|
3530
|
+
const jsStyles = {};
|
|
3531
|
+
const declarations = cssString.split(";");
|
|
3532
|
+
declarations.forEach((decl) => {
|
|
3533
|
+
if (!decl.trim()) return;
|
|
3534
|
+
const [property, value] = decl.split(":").map((s2) => s2.trim());
|
|
3535
|
+
if (!property || !value) return;
|
|
3536
|
+
const jsProperty = cssToJsStyle(property);
|
|
3537
|
+
jsStyles[jsProperty] = value;
|
|
3538
|
+
});
|
|
3539
|
+
return jsStyles;
|
|
3540
|
+
}
|
|
3541
|
+
const useLayerCssOverride = (layerKey) => {
|
|
3542
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3543
|
+
const [cssOverride] = useLayerValue(layerKey, "cssOverride", fragmentManager);
|
|
3544
|
+
return isValue(cssOverride) ? cssStringToJsObject(cssOverride) : {};
|
|
3545
|
+
};
|
|
3546
|
+
const StyleSheetContext = require$$0.createContext(null);
|
|
3547
|
+
const StyleSheetProvider = StyleSheetContext.Provider;
|
|
3548
|
+
const useArea = (options2) => {
|
|
3549
|
+
const { manager: resultGlobalManager, queryArea } = useGlobalManager(
|
|
3550
|
+
options2 == null ? void 0 : options2.globalManager
|
|
3551
|
+
);
|
|
3552
|
+
const [areaData, setAreaData] = require$$0.useState(queryArea(options2.areaCode));
|
|
3553
|
+
require$$0.useEffect(() => {
|
|
3554
|
+
(async () => {
|
|
3555
|
+
const response = await queryArea(options2.areaCode);
|
|
3556
|
+
if (response) {
|
|
3557
|
+
setAreaData(response);
|
|
3558
|
+
}
|
|
3559
|
+
})();
|
|
3560
|
+
}, []);
|
|
3561
|
+
return {
|
|
3562
|
+
...areaData,
|
|
3563
|
+
globalManager: resultGlobalManager
|
|
454
3564
|
};
|
|
455
3565
|
};
|
|
456
|
-
const
|
|
457
|
-
|
|
3566
|
+
const useCollection = (layerKey, options2) => {
|
|
3567
|
+
var _a;
|
|
3568
|
+
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3569
|
+
const frame = useFrame(layerKey, options2);
|
|
3570
|
+
const children = useLayerChildren(layerKey, fragmentManager);
|
|
3571
|
+
const [collectionLayer] = y(fragmentManager, layerKey, {
|
|
3572
|
+
selector: (graph) => pick(graph, "source")
|
|
3573
|
+
});
|
|
3574
|
+
const source = collectionLayer == null ? void 0 : collectionLayer.source;
|
|
3575
|
+
const sourceDefinition = (_a = fragmentManager == null ? void 0 : fragmentManager.resolve(source)) == null ? void 0 : _a.definition;
|
|
3576
|
+
const [sourceValue] = useLayerValue(layerKey, "source", fragmentManager);
|
|
3577
|
+
return {
|
|
3578
|
+
source,
|
|
3579
|
+
sourceDefinition,
|
|
3580
|
+
sourceValue: sourceValue ?? [],
|
|
3581
|
+
fragmentManager,
|
|
3582
|
+
children,
|
|
3583
|
+
...frame
|
|
3584
|
+
};
|
|
3585
|
+
};
|
|
3586
|
+
const text = "_text_1tdzv_1";
|
|
3587
|
+
const styles = {
|
|
3588
|
+
text
|
|
3589
|
+
};
|
|
3590
|
+
const Text = ({
|
|
3591
|
+
layerKey,
|
|
3592
|
+
Tag = "div",
|
|
3593
|
+
collectStyle,
|
|
3594
|
+
...restProps
|
|
3595
|
+
}) => {
|
|
3596
|
+
const { hash, content } = useTextAttributes(layerKey, { collectStyle });
|
|
3597
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tag, { className: hash, "data-key": layerKey, ...restProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3598
|
+
"div",
|
|
3599
|
+
{
|
|
3600
|
+
className: styles.text,
|
|
3601
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
3602
|
+
}
|
|
3603
|
+
) });
|
|
3604
|
+
};
|
|
3605
|
+
const Scope = ({
|
|
3606
|
+
value,
|
|
3607
|
+
children,
|
|
3608
|
+
fragmentManager,
|
|
3609
|
+
layerKey
|
|
3610
|
+
}) => {
|
|
3611
|
+
var _a, _b;
|
|
3612
|
+
const currentScope = require$$0.useContext(ScopeContext) ?? [];
|
|
3613
|
+
const nextScope = [...currentScope, value];
|
|
3614
|
+
(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.registerScope) == null ? void 0 : _b.call(_a, layerKey, value);
|
|
3615
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScopeContext.Provider, { value: nextScope, children });
|
|
3616
|
+
};
|
|
3617
|
+
const Collection = ({
|
|
3618
|
+
layerKey,
|
|
3619
|
+
styles: inputStyles,
|
|
3620
|
+
...restProps
|
|
3621
|
+
}) => {
|
|
3622
|
+
var _a;
|
|
3623
|
+
const {
|
|
3624
|
+
fragmentManager,
|
|
3625
|
+
styles: styles2,
|
|
3626
|
+
sourceDefinition,
|
|
3627
|
+
hash,
|
|
3628
|
+
source,
|
|
3629
|
+
children,
|
|
3630
|
+
sourceValue
|
|
3631
|
+
} = useCollection(layerKey, restProps);
|
|
3632
|
+
const FrameTag = (restProps == null ? void 0 : restProps.FrameTag) ?? "div";
|
|
3633
|
+
const FrameElement = (restProps == null ? void 0 : restProps.FrameElement) ?? Frame;
|
|
3634
|
+
const resultStyles = inputStyles ?? styles2;
|
|
3635
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3636
|
+
Scope,
|
|
3637
|
+
{
|
|
3638
|
+
fragmentManager,
|
|
3639
|
+
layerKey,
|
|
3640
|
+
value: {
|
|
3641
|
+
type: definition.definition.scopeTypes.CollectionScope,
|
|
3642
|
+
source,
|
|
3643
|
+
manager: fragmentManager
|
|
3644
|
+
},
|
|
3645
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3646
|
+
FrameTag,
|
|
3647
|
+
{
|
|
3648
|
+
className: hash,
|
|
3649
|
+
"data-key": layerKey,
|
|
3650
|
+
style: resultStyles,
|
|
3651
|
+
...restProps,
|
|
3652
|
+
children: (_a = sourceValue == null ? void 0 : sourceValue.map) == null ? void 0 : _a.call(sourceValue, (collectionItem, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3653
|
+
Scope,
|
|
3654
|
+
{
|
|
3655
|
+
fragmentManager,
|
|
3656
|
+
layerKey: `${layerKey}.${index2}`,
|
|
3657
|
+
value: {
|
|
3658
|
+
type: definition.definition.scopeTypes.CollectionItemScope,
|
|
3659
|
+
source,
|
|
3660
|
+
sourceDefinition,
|
|
3661
|
+
value: collectionItem,
|
|
3662
|
+
manager: fragmentManager
|
|
3663
|
+
},
|
|
3664
|
+
children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3665
|
+
"div",
|
|
3666
|
+
{
|
|
3667
|
+
style: {
|
|
3668
|
+
display: "contents",
|
|
3669
|
+
...getCssVariables(collectionItem ?? {})
|
|
3670
|
+
},
|
|
3671
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(FrameElement, { ...restProps, layerKey: child })
|
|
3672
|
+
},
|
|
3673
|
+
child
|
|
3674
|
+
))
|
|
3675
|
+
}
|
|
3676
|
+
))
|
|
3677
|
+
}
|
|
3678
|
+
)
|
|
3679
|
+
}
|
|
3680
|
+
);
|
|
3681
|
+
};
|
|
3682
|
+
const Frame = ({
|
|
3683
|
+
layerKey,
|
|
3684
|
+
styles: inputStyles,
|
|
3685
|
+
hidden,
|
|
3686
|
+
interactive,
|
|
3687
|
+
...restProps
|
|
3688
|
+
}) => {
|
|
3689
|
+
const { styles: styles2, hash, children, type, events, linkProps, Tag } = useFrame(
|
|
3690
|
+
layerKey,
|
|
3691
|
+
{
|
|
3692
|
+
...restProps,
|
|
3693
|
+
pauseInteractions: !interactive
|
|
3694
|
+
}
|
|
3695
|
+
);
|
|
3696
|
+
const resultStyles = inputStyles ?? styles2;
|
|
3697
|
+
const isMounted = useMounted();
|
|
3698
|
+
if (isMounted && hidden) {
|
|
3699
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {});
|
|
3700
|
+
}
|
|
3701
|
+
if (type === definition.definition.nodes.Collection) {
|
|
3702
|
+
const Tag2 = (restProps == null ? void 0 : restProps.CollectionElement) ?? Collection;
|
|
3703
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tag2, { layerKey, ...restProps });
|
|
3704
|
+
}
|
|
3705
|
+
if (type === definition.definition.nodes.Text) {
|
|
3706
|
+
const Tag2 = (restProps == null ? void 0 : restProps.TextElement) ?? Text;
|
|
3707
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tag2, { layerKey, ...restProps });
|
|
3708
|
+
}
|
|
3709
|
+
if (type === definition.definition.nodes.Instance) {
|
|
3710
|
+
const Tag2 = (restProps == null ? void 0 : restProps.InstanceElement) ?? Instance;
|
|
3711
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tag2, { layerKey, ...restProps });
|
|
3712
|
+
}
|
|
3713
|
+
const FrameElement = (restProps == null ? void 0 : restProps.FrameElement) ?? Frame;
|
|
3714
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3715
|
+
Tag,
|
|
3716
|
+
{
|
|
3717
|
+
className: hash,
|
|
3718
|
+
"data-key": layerKey,
|
|
3719
|
+
style: {
|
|
3720
|
+
...resultStyles,
|
|
3721
|
+
display: hidden ? "none" : resultStyles.display
|
|
3722
|
+
},
|
|
3723
|
+
...events,
|
|
3724
|
+
...linkProps,
|
|
3725
|
+
...restProps,
|
|
3726
|
+
children: children.map((childLink) => /* @__PURE__ */ jsxRuntime.jsx(FrameElement, { layerKey: childLink, ...restProps }, childLink))
|
|
3727
|
+
}
|
|
3728
|
+
);
|
|
3729
|
+
};
|
|
3730
|
+
const FragmentInternal = ({
|
|
3731
|
+
fragmentId,
|
|
3732
|
+
globalManager,
|
|
3733
|
+
interactive,
|
|
3734
|
+
collectStyle,
|
|
3735
|
+
FrameElement = Frame
|
|
3736
|
+
}) => {
|
|
3737
|
+
const {
|
|
3738
|
+
children,
|
|
3739
|
+
fragmentContext,
|
|
3740
|
+
hash,
|
|
3741
|
+
isResize,
|
|
3742
|
+
isTopFragment,
|
|
3743
|
+
definitions,
|
|
3744
|
+
layerKey
|
|
3745
|
+
} = useFragment(fragmentId);
|
|
3746
|
+
if (!fragmentContext.manager) return null;
|
|
3747
|
+
return (
|
|
3748
|
+
// <Scope
|
|
3749
|
+
// fragmentManager={fragmentContext.manager}
|
|
3750
|
+
// layerKey={layerKey}
|
|
3751
|
+
// value={{
|
|
3752
|
+
// type: definition.scopeTypes.FragmentScope,
|
|
3753
|
+
// manager: fragmentContext.manager,
|
|
3754
|
+
// definitions,
|
|
3755
|
+
// }}
|
|
3756
|
+
// >
|
|
3757
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-key": layerKey, className: hash, children: children.map((childLink) => {
|
|
3758
|
+
var _a;
|
|
3759
|
+
const childLayer = (_a = fragmentContext.manager) == null ? void 0 : _a.resolve(childLink);
|
|
3760
|
+
const isPrimary = (childLayer == null ? void 0 : childLayer.isPrimary) ?? false;
|
|
3761
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3762
|
+
FrameElement,
|
|
3763
|
+
{
|
|
3764
|
+
layerKey: childLink,
|
|
3765
|
+
interactive,
|
|
3766
|
+
collectStyle,
|
|
3767
|
+
hidden: !isResize && !isPrimary && !isTopFragment,
|
|
3768
|
+
style: { display: isPrimary ? null : "none" }
|
|
3769
|
+
},
|
|
3770
|
+
childLink
|
|
3771
|
+
);
|
|
3772
|
+
}) })
|
|
3773
|
+
);
|
|
3774
|
+
};
|
|
3775
|
+
const Fragment = (props) => {
|
|
3776
|
+
const currentGlobalManager = require$$0.useContext(GlobalManager);
|
|
3777
|
+
const { manager: resultGlobalManager } = useGlobalManager(
|
|
3778
|
+
props.globalManager
|
|
3779
|
+
);
|
|
3780
|
+
const { manager } = useFragmentManager(props.fragmentId, resultGlobalManager);
|
|
3781
|
+
const Base = /* @__PURE__ */ jsxRuntime.jsx(FragmentContext.Provider, { value: { manager }, children: /* @__PURE__ */ jsxRuntime.jsx(FragmentInternal, { ...props }) });
|
|
3782
|
+
if (!currentGlobalManager) {
|
|
3783
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GlobalManager.Provider, { value: resultGlobalManager, children: Base });
|
|
3784
|
+
}
|
|
3785
|
+
return Base;
|
|
3786
|
+
};
|
|
3787
|
+
const InstanceInitial = ({
|
|
3788
|
+
Tag: inputTag,
|
|
3789
|
+
style = {},
|
|
3790
|
+
interactive = true,
|
|
3791
|
+
FrameElement,
|
|
3792
|
+
...instanceProps
|
|
3793
|
+
}) => {
|
|
3794
|
+
var _a, _b, _c;
|
|
3795
|
+
const ssr = ((_a = instanceProps == null ? void 0 : instanceProps.options) == null ? void 0 : _a.ssr) ?? true;
|
|
3796
|
+
const link = useLayerLink(instanceProps.layerKey);
|
|
3797
|
+
const Tag = (link == null ? void 0 : link.isLink) ? inputTag ?? "a" : inputTag ?? "div";
|
|
3798
|
+
const {
|
|
3799
|
+
fragmentId,
|
|
3800
|
+
cssProps,
|
|
3801
|
+
parentManager,
|
|
3802
|
+
events,
|
|
3803
|
+
props,
|
|
3804
|
+
hash,
|
|
3805
|
+
innerManager,
|
|
3806
|
+
definitions,
|
|
3807
|
+
globalManager
|
|
3808
|
+
} = useInstance({
|
|
3809
|
+
...instanceProps,
|
|
3810
|
+
pauseInteractions: !interactive
|
|
3811
|
+
});
|
|
3812
|
+
if (ssr) {
|
|
3813
|
+
(_c = (_b = globalManager == null ? void 0 : globalManager.$load) == null ? void 0 : _b.loadFragment) == null ? void 0 : _c.call(_b, fragmentId, { suspense: true });
|
|
3814
|
+
}
|
|
3815
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3816
|
+
Scope,
|
|
3817
|
+
{
|
|
3818
|
+
fragmentManager: innerManager,
|
|
3819
|
+
layerKey: instanceProps.layerKey,
|
|
3820
|
+
value: {
|
|
3821
|
+
type: definition.definition.scopeTypes.InstanceScope,
|
|
3822
|
+
props,
|
|
3823
|
+
definitions,
|
|
3824
|
+
fragmentId,
|
|
3825
|
+
documentManager: innerManager,
|
|
3826
|
+
layerKey: instanceProps.layerKey
|
|
3827
|
+
},
|
|
3828
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3829
|
+
InstanceContext.Provider,
|
|
3830
|
+
{
|
|
3831
|
+
value: {
|
|
3832
|
+
layerKey: instanceProps.layerKey,
|
|
3833
|
+
definitions,
|
|
3834
|
+
innerManager,
|
|
3835
|
+
parentManager,
|
|
3836
|
+
props
|
|
3837
|
+
},
|
|
3838
|
+
children: parentManager ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3839
|
+
Tag,
|
|
3840
|
+
{
|
|
3841
|
+
className: hash,
|
|
3842
|
+
"data-key": instanceProps.layerKey,
|
|
3843
|
+
style: { ...style, ...cssProps },
|
|
3844
|
+
...link.linkProps,
|
|
3845
|
+
...events,
|
|
3846
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3847
|
+
Fragment,
|
|
3848
|
+
{
|
|
3849
|
+
fragmentId,
|
|
3850
|
+
globalManager,
|
|
3851
|
+
FrameElement,
|
|
3852
|
+
interactive
|
|
3853
|
+
}
|
|
3854
|
+
)
|
|
3855
|
+
}
|
|
3856
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Tag, { style: { ...style, ...cssProps }, ...link.linkProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3857
|
+
Fragment,
|
|
3858
|
+
{
|
|
3859
|
+
fragmentId,
|
|
3860
|
+
globalManager,
|
|
3861
|
+
FrameElement,
|
|
3862
|
+
interactive
|
|
3863
|
+
}
|
|
3864
|
+
) })
|
|
3865
|
+
}
|
|
3866
|
+
)
|
|
3867
|
+
}
|
|
3868
|
+
);
|
|
3869
|
+
};
|
|
3870
|
+
const Instance = (props) => {
|
|
3871
|
+
return "globalManager" in props ? /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("h1", { children: "Test" }), children: /* @__PURE__ */ jsxRuntime.jsx(GlobalManager, { value: props.globalManager, children: /* @__PURE__ */ jsxRuntime.jsx(InstanceInitial, { ...props }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx("h1", { children: "Test" }), children: /* @__PURE__ */ jsxRuntime.jsx(InstanceInitial, { ...props }) });
|
|
3872
|
+
};
|
|
3873
|
+
const isBrowser = typeof window !== "undefined";
|
|
3874
|
+
const AreaInitial = (areaProps) => {
|
|
3875
|
+
var _a, _b, _c;
|
|
3876
|
+
const { manager: globalManager } = useGlobalManager(areaProps == null ? void 0 : areaProps.globalManager);
|
|
3877
|
+
const ssr = ((_a = areaProps == null ? void 0 : areaProps.options) == null ? void 0 : _a.ssr) ?? true;
|
|
3878
|
+
if (isBrowser || ssr) {
|
|
3879
|
+
(_c = (_b = globalManager == null ? void 0 : globalManager.$load) == null ? void 0 : _b.loadArea) == null ? void 0 : _c.call(_b, areaProps.areaCode, {
|
|
3880
|
+
suspense: true
|
|
3881
|
+
});
|
|
3882
|
+
}
|
|
3883
|
+
const areaData = useArea(areaProps);
|
|
3884
|
+
if (!areaData) return null;
|
|
3885
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Instance, { fragmentId: areaData.fragmentId, props: areaData == null ? void 0 : areaData.props });
|
|
3886
|
+
};
|
|
3887
|
+
const Area = (props) => {
|
|
3888
|
+
return "globalManager" in props ? /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(GlobalManager, { value: props.globalManager, children: /* @__PURE__ */ jsxRuntime.jsx(AreaInitial, { ...props }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(AreaInitial, { ...props }) });
|
|
3889
|
+
};
|
|
3890
|
+
exports.Area = Area;
|
|
3891
|
+
exports.Collection = Collection;
|
|
458
3892
|
exports.Fragment = Fragment;
|
|
3893
|
+
exports.FragmentContext = FragmentContext;
|
|
3894
|
+
exports.Frame = Frame;
|
|
459
3895
|
exports.GlobalManager = GlobalManager;
|
|
460
3896
|
exports.Instance = Instance;
|
|
3897
|
+
exports.InstanceContext = InstanceContext;
|
|
3898
|
+
exports.RenderTargetContext = RenderTargetContext;
|
|
3899
|
+
exports.RenderTargetProvider = RenderTargetProvider;
|
|
3900
|
+
exports.Scope = Scope;
|
|
3901
|
+
exports.ScopeContext = ScopeContext;
|
|
3902
|
+
exports.StyleSheetContext = StyleSheetContext;
|
|
3903
|
+
exports.StyleSheetProvider = StyleSheetProvider;
|
|
3904
|
+
exports.Text = Text;
|
|
3905
|
+
exports.appendChildren = appendChildren;
|
|
3906
|
+
exports.cloneElement = J;
|
|
3907
|
+
exports.cloneLayer = cloneLayer;
|
|
3908
|
+
exports.collectStyles = collectStyles;
|
|
3909
|
+
exports.copyLayer = copyLayer;
|
|
3910
|
+
exports.createElement = _;
|
|
3911
|
+
exports.createLayer = createLayer;
|
|
3912
|
+
exports.declareFragmentProperty = declareFragmentProperty;
|
|
3913
|
+
exports.duplicateLayer = duplicateLayer;
|
|
3914
|
+
exports.findBreakpoint = findBreakpoint;
|
|
3915
|
+
exports.getAllParents = getAllParents;
|
|
3916
|
+
exports.getCssVariables = getCssVariables;
|
|
3917
|
+
exports.getNormalizeLayer = getNormalizeLayer;
|
|
3918
|
+
exports.getOverrider = getOverrider;
|
|
3919
|
+
exports.getParent = getParent;
|
|
3920
|
+
exports.h = _;
|
|
3921
|
+
exports.hydrate = G;
|
|
3922
|
+
exports.insertChildren = insertChildren;
|
|
3923
|
+
exports.isInheritField = isInheritField;
|
|
3924
|
+
exports.isPartOfPrimary = isPartOfPrimary;
|
|
3925
|
+
exports.isRootLayer = isRootLayer;
|
|
3926
|
+
exports.isTopLevel = isTopLevel;
|
|
3927
|
+
exports.layerFieldSetter = layerFieldSetter;
|
|
3928
|
+
exports.makeSnapshot = makeSnapshot;
|
|
3929
|
+
exports.moveChildren = moveChildren;
|
|
3930
|
+
exports.processOptionalSize = processOptionalSize;
|
|
3931
|
+
exports.removeChildren = removeChildren;
|
|
3932
|
+
exports.render = E;
|
|
3933
|
+
exports.useArea = useArea;
|
|
3934
|
+
exports.useCalcLayerBorder = useCalcLayerBorder;
|
|
3935
|
+
exports.useCollection = useCollection;
|
|
3936
|
+
exports.useFragment = useFragment;
|
|
3937
|
+
exports.useFragmentChildren = useFragmentChildren;
|
|
461
3938
|
exports.useFragmentManager = useFragmentManager;
|
|
462
3939
|
exports.useFragmentProperties = useFragmentProperties;
|
|
3940
|
+
exports.useFrame = useFrame;
|
|
463
3941
|
exports.useGlobalManager = useGlobalManager;
|
|
3942
|
+
exports.useInjectedStyle = useInjectedStyle;
|
|
3943
|
+
exports.useInstance = useInstance;
|
|
3944
|
+
exports.useLayerChildren = useLayerChildren;
|
|
3945
|
+
exports.useLayerCssOverride = useLayerCssOverride;
|
|
3946
|
+
exports.useLayerDisplay = useLayerDisplay;
|
|
3947
|
+
exports.useLayerLayout = useLayerLayout;
|
|
3948
|
+
exports.useLayerLink = useLayerLink;
|
|
3949
|
+
exports.useLayerScopes = useLayerScopes;
|
|
3950
|
+
exports.useLayerSizeValue = useLayerSizeValue;
|
|
3951
|
+
exports.useLayerTextStyles = useLayerTextStyles;
|
|
3952
|
+
exports.useLayerValue = useLayerValue;
|
|
3953
|
+
exports.useMounted = useMounted;
|
|
3954
|
+
exports.useNormalizeLayer = useNormalizeLayer;
|
|
3955
|
+
exports.useReadVariable = useReadVariable;
|
|
464
3956
|
exports.useRenderTarget = useRenderTarget;
|
|
3957
|
+
exports.useTextAttributes = useTextAttributes;
|
|
3958
|
+
exports.useTextContent = useTextContent;
|
|
3959
|
+
exports.wrapTextInParagraphWithAttributes = wrapTextInParagraphWithAttributes;
|