@fragmentsx/render-web 0.0.1 → 0.1.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 +1395 -679
- package/dist/index.es.js +1395 -679
- package/package.json +9 -6
package/dist/index.cjs.js
CHANGED
|
@@ -1,222 +1,623 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var isBrowser_default$2 = typeof window !== "undefined";
|
|
3
|
-
var r$3 = (e2) => !e2 && e2 == null, y$4 = (e2) => !r$3(e2), a$3 = (e2) => typeof e2 == "object" && !Array.isArray(e2) && y$4(e2), f$3 = (e2) => typeof Node == "object" ? e2 instanceof Node : e2 && typeof e2 == "object" && typeof e2.nodeType == "number" && typeof e2.nodeName == "string", i$2 = (e2) => typeof e2 == "string" || t$2(e2), t$2 = (e2) => typeof e2 == "object" && typeof e2._type == "string", s$
|
|
3
|
+
var r$3 = (e2) => !e2 && e2 == null, y$4 = (e2) => !r$3(e2), a$3 = (e2) => typeof e2 == "object" && !Array.isArray(e2) && y$4(e2), f$3 = (e2) => typeof Node == "object" ? e2 instanceof Node : e2 && typeof e2 == "object" && typeof e2.nodeType == "number" && typeof e2.nodeName == "string", i$2 = (e2) => typeof e2 == "string" || t$2(e2), t$2 = (e2) => typeof e2 == "object" && typeof e2._type == "string", s$2 = (e2) => typeof e2 == "string" && e2.split(":").length >= 2, l$2 = (e2) => typeof e2 != "object" && typeof e2 != "function" || e2 === null, g$2 = (e2) => typeof e2 == "string" ? /<\/?[a-z][\s\S]*>/i.test(e2) : false, u$2 = (e2) => (n2) => {
|
|
4
4
|
var _a;
|
|
5
5
|
if (!n2) return false;
|
|
6
6
|
let o2 = null;
|
|
7
|
-
return s$
|
|
8
|
-
};
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
return s$2(n2) && (o2 = (_a = n2.split(":")) == null ? void 0 : _a[0]), t$2(n2) && (o2 = n2._type), o2 ? !e2.includes(o2) : false;
|
|
8
|
+
};
|
|
9
|
+
var isLinkKey = (input) => s$2(input);
|
|
10
|
+
var isGraphOrKey = (input) => i$2(input);
|
|
11
|
+
var isGraph = (input) => t$2(input);
|
|
12
|
+
var isObject$1$1 = (input) => a$3(input);
|
|
13
|
+
var shallowEqual = (a2, b) => {
|
|
14
|
+
if (a2 === b)
|
|
15
|
+
return true;
|
|
16
|
+
if (Array.isArray(a2) && Array.isArray(b)) {
|
|
17
|
+
return a2.length === b.length && a2.every((val, index2) => b[index2] === val);
|
|
18
|
+
}
|
|
19
|
+
if (!isObject$1$1(a2) || !isObject$1$1(b))
|
|
20
|
+
return false;
|
|
21
|
+
const keysA = Object.keys(a2);
|
|
22
|
+
const keysB = Object.keys(b);
|
|
23
|
+
if (keysA.length !== keysB.length)
|
|
24
|
+
return false;
|
|
25
|
+
for (const key of keysA) {
|
|
26
|
+
if (!keysB.includes(key))
|
|
27
|
+
return false;
|
|
28
|
+
const aValue = a2[key];
|
|
29
|
+
const bValue = b[key];
|
|
30
|
+
if (l$2(aValue) && l$2(bValue) && aValue !== bValue)
|
|
31
|
+
return false;
|
|
19
32
|
}
|
|
20
33
|
return true;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
};
|
|
35
|
+
var deepEqual = (a2, b) => {
|
|
36
|
+
if (a2 === b)
|
|
37
|
+
return true;
|
|
38
|
+
if (Array.isArray(a2) && Array.isArray(b)) {
|
|
39
|
+
return a2.length === b.length && a2.every((val, i2) => deepEqual(val, b[i2]));
|
|
40
|
+
}
|
|
41
|
+
if (!isObject$1$1(b) || !isObject$1$1(a2))
|
|
42
|
+
return a2 === b;
|
|
43
|
+
const keysA = Object.keys(a2);
|
|
44
|
+
const keysB = Object.keys(b);
|
|
45
|
+
if (keysA.length !== keysB.length)
|
|
46
|
+
return false;
|
|
47
|
+
for (const key of keysA) {
|
|
48
|
+
if (!keysB.includes(key))
|
|
49
|
+
return false;
|
|
50
|
+
if (!deepEqual(a2[key], b[key]))
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
28
53
|
return true;
|
|
29
54
|
};
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
var unique = (...values) => Array.from(new Set(values));
|
|
56
|
+
var uniqueLinks = (...values) => values.filter((item, index2, arr) => s$2(item) ? arr.indexOf(item) === index2 : true);
|
|
57
|
+
var isPartialKey = (key) => key && key.split(".").length > 1;
|
|
58
|
+
var isPartialGraph = (entity) => {
|
|
59
|
+
if (isObject$1$1(entity) && "_id" in entity && typeof entity._id === "string") {
|
|
60
|
+
return entity._id.includes(".");
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
};
|
|
64
|
+
var isPartOfGraph = (entityKey, graphKey) => {
|
|
65
|
+
if (!entityKey || !graphKey)
|
|
66
|
+
return false;
|
|
67
|
+
if (typeof entityKey !== "string" || typeof graphKey !== "string")
|
|
68
|
+
return null;
|
|
69
|
+
const [entityType, entityId] = entityKey.split(":");
|
|
70
|
+
const [graphType, graphId] = graphKey.split(":");
|
|
71
|
+
if (entityType !== graphType)
|
|
72
|
+
return false;
|
|
73
|
+
return entityId.startsWith(graphId);
|
|
74
|
+
};
|
|
75
|
+
var getGraphLink = (input) => {
|
|
76
|
+
if (isLinkKey(input)) {
|
|
77
|
+
if (isPartialKey(input)) {
|
|
78
|
+
return input.split(".")[0];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return input;
|
|
82
|
+
};
|
|
83
|
+
var createCache = () => {
|
|
84
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
85
|
+
const types2 = /* @__PURE__ */ new Map();
|
|
86
|
+
const links = /* @__PURE__ */ new Map();
|
|
87
|
+
const parentRefs = /* @__PURE__ */ new Map();
|
|
88
|
+
const childrenRefs = /* @__PURE__ */ new Map();
|
|
89
|
+
const refCount = /* @__PURE__ */ new Map();
|
|
90
|
+
const gbLinks = /* @__PURE__ */ new Set([]);
|
|
91
|
+
const addRefs = (targetKey, depKey) => {
|
|
39
92
|
var _a;
|
|
40
|
-
|
|
41
|
-
|
|
93
|
+
parentRefs.set(targetKey, unique(...parentRefs.get(targetKey) || [], depKey));
|
|
94
|
+
childrenRefs.set(depKey, unique(...childrenRefs.get(depKey) ?? [], targetKey));
|
|
95
|
+
updateRefCountForLink(targetKey, ((_a = parentRefs.get(targetKey)) == null ? void 0 : _a.length) || 0);
|
|
96
|
+
};
|
|
97
|
+
const removeRefs = (targetKey, depKey) => {
|
|
42
98
|
var _a;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
99
|
+
parentRefs.set(
|
|
100
|
+
depKey,
|
|
101
|
+
(parentRefs.get(depKey) || []).filter((key) => key !== targetKey)
|
|
102
|
+
);
|
|
103
|
+
childrenRefs.set(
|
|
104
|
+
targetKey,
|
|
105
|
+
(childrenRefs.get(targetKey) ?? []).filter((key) => key !== depKey)
|
|
106
|
+
);
|
|
107
|
+
updateRefCountForLink(depKey, ((_a = parentRefs.get(depKey)) == null ? void 0 : _a.length) || 0);
|
|
108
|
+
};
|
|
109
|
+
const getLinkedRefs = (key, stack = []) => {
|
|
110
|
+
const deps = parentRefs.get(key) || [];
|
|
111
|
+
stack.push(...deps);
|
|
112
|
+
const deepDeps = deps.map((ref) => getLinkedRefs(ref, stack)).flat();
|
|
113
|
+
stack.push(...deepDeps);
|
|
114
|
+
return Array.from(new Set(stack).values());
|
|
115
|
+
};
|
|
116
|
+
const invalidate = (key) => {
|
|
117
|
+
updateRefCountForLink(key, 0);
|
|
118
|
+
runGarbageCollector();
|
|
119
|
+
};
|
|
120
|
+
const readLink = (key) => {
|
|
121
|
+
if (key) {
|
|
122
|
+
return links.get(key);
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
};
|
|
126
|
+
const writeLink = (key, value, depKey) => {
|
|
52
127
|
var _a;
|
|
53
|
-
if (typeof
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
128
|
+
if (typeof key === "string") {
|
|
129
|
+
links.set(key, value);
|
|
130
|
+
const [type] = key.split(":");
|
|
131
|
+
if (!isPartialKey(key)) {
|
|
132
|
+
if (!types2.has(type)) {
|
|
133
|
+
types2.set(type, /* @__PURE__ */ new Set([key]));
|
|
134
|
+
} else {
|
|
135
|
+
(_a = types2.get(type)) == null ? void 0 : _a.add(key);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (depKey && key && key !== depKey) {
|
|
140
|
+
addRefs(key, depKey);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const hasLink = (key) => {
|
|
144
|
+
if (key) {
|
|
145
|
+
return links.has(key);
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
};
|
|
149
|
+
const updateRefCountForLink = (link, count) => {
|
|
150
|
+
if (Array.isArray(link)) {
|
|
151
|
+
link.forEach((link2, index2) => updateRefCountForLink(link2, index2));
|
|
152
|
+
} else {
|
|
153
|
+
const prevCount = refCount.get(link);
|
|
154
|
+
refCount.set(link, count);
|
|
155
|
+
if (!count) {
|
|
156
|
+
gbLinks.add(link);
|
|
157
|
+
} else if (!prevCount && count) {
|
|
158
|
+
gbLinks.delete(link);
|
|
159
|
+
}
|
|
64
160
|
}
|
|
65
|
-
}
|
|
161
|
+
};
|
|
162
|
+
const getLinkEntries = () => Array.from(links.entries());
|
|
163
|
+
const getRefCount = (link) => refCount.get(link) ?? 0;
|
|
164
|
+
const runGarbageCollector = () => {
|
|
66
165
|
var _a, _b;
|
|
67
|
-
for (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
166
|
+
for (const link of gbLinks.keys()) {
|
|
167
|
+
const count = getRefCount(link);
|
|
168
|
+
if (count > 0)
|
|
169
|
+
continue;
|
|
170
|
+
const currentValue = links.get(link);
|
|
171
|
+
gbLinks.delete(link);
|
|
172
|
+
links.delete(link);
|
|
173
|
+
refCount.delete(link);
|
|
174
|
+
const parents = parentRefs.get(link) ?? [];
|
|
175
|
+
const children = childrenRefs.get(link) ?? [];
|
|
176
|
+
parents.forEach((parentKey) => {
|
|
73
177
|
var _a2, _b2;
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
|
|
178
|
+
childrenRefs.set(parentKey, ((_b2 = (_a2 = childrenRefs.get(parentKey)) == null ? void 0 : _a2.filter) == null ? void 0 : _b2.call(_a2, (childLink) => childLink !== link)) ?? []);
|
|
179
|
+
});
|
|
180
|
+
children.forEach((childKey) => {
|
|
181
|
+
updateRefCountForLink(childKey, getRefCount(childKey) - 1);
|
|
77
182
|
});
|
|
78
|
-
|
|
79
|
-
|
|
183
|
+
const [type] = link.split(":");
|
|
184
|
+
if (!isPartialKey(link)) {
|
|
185
|
+
(_a = types2.get(type)) == null ? void 0 : _a.delete(link);
|
|
186
|
+
if (!((_b = types2.get(type)) == null ? void 0 : _b.size)) {
|
|
187
|
+
types2.delete(type);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
parentRefs.delete(link);
|
|
191
|
+
(listeners.get("onRemoveLink") ?? []).forEach((listener) => listener(link, currentValue ?? null));
|
|
80
192
|
}
|
|
81
193
|
};
|
|
82
|
-
return {
|
|
194
|
+
return {
|
|
195
|
+
readLink,
|
|
196
|
+
writeLink,
|
|
197
|
+
hasLink,
|
|
198
|
+
getLinkEntries,
|
|
199
|
+
parentRefs,
|
|
200
|
+
childrenRefs,
|
|
201
|
+
addRefs,
|
|
202
|
+
removeRefs,
|
|
203
|
+
getChildren: (key) => childrenRefs.get(key),
|
|
204
|
+
getParents: (key) => parentRefs.get(key),
|
|
205
|
+
getLinkedRefs,
|
|
206
|
+
invalidate,
|
|
207
|
+
links,
|
|
208
|
+
types: types2,
|
|
209
|
+
refCount,
|
|
210
|
+
runGarbageCollector,
|
|
211
|
+
onRemoveLink: (callback) => listeners.set("onRemoveLink", [...(listeners == null ? void 0 : listeners.get("onRemoveLink")) ?? [], callback])
|
|
212
|
+
};
|
|
83
213
|
};
|
|
84
|
-
var
|
|
214
|
+
var joinKeys = (...keys) => {
|
|
85
215
|
var _a;
|
|
86
|
-
return (_a =
|
|
87
|
-
};
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return !r2 || u2.length < 1 ? null : { _type: r2, _id: u2.join(":") };
|
|
120
|
-
};
|
|
121
|
-
var he = 0, Ae = 100, Ke = "State", me = "$EACH:ROOT$", mt = (e2) => {
|
|
122
|
-
let r2 = (e2 == null ? void 0 : e2._id) ?? `${he++}`, u2 = (e2 == null ? void 0 : e2._type) ?? Ke, p2 = `${u2}:${r2}`, c2 = [ue, ...(e2 == null ? void 0 : e2.skip) ?? []], i2 = ce(), E2 = le(), V2 = fe(e2 == null ? void 0 : e2.plugins), D2 = /* @__PURE__ */ new Map(), I2 = 0, w2 = (t2) => c2.some((s2) => s2(t2)), S2 = (t2, s2) => {
|
|
123
|
-
let a2 = (s2 == null ? void 0 : s2.deep) ?? false, o2 = (s2 == null ? void 0 : s2.safe) ?? false, l2 = (s2 == null ? void 0 : s2.keepLinks) ?? false, { selector: m2, ...h3 } = s2 || {}, y$12 = y$4(t2) ? g2(t2) : null;
|
|
124
|
-
E2.debug({ type: "resolve", entity: t2, options: s2 });
|
|
125
|
-
let f2 = y$12 ? i2.readLink(y$12) : null;
|
|
126
|
-
return w2(f2) ? f2 : ((O$2(f2) || Array.isArray(f2)) && (f2 = Object.entries(f2).reduce((L2, [A2, v2]) => {
|
|
127
|
-
let K2 = v2;
|
|
128
|
-
return w2(K2) || (Array.isArray(v2) ? (K2 = v2.map((T2) => w2(T2) ? T2 : G$2(T2) && !o2 && !i2.hasLink(T2) ? null : J$1(T2, y$12) && !l2 || a2 ? j2(T2, h3) : T2), o2 || (K2 = K2.filter(y$4))) : G$2(v2) && !o2 && !i2.hasLink(v2) ? K2 = null : (J$1(g2(v2), y$12) && !l2 || a2) && (K2 = j2(v2, h3))), L2[A2] = K2, L2;
|
|
129
|
-
}, {})), f2 ? m2 ? m2({ ...f2 }) : { ...f2 } : o2 ? t2 : null);
|
|
130
|
-
}, j2 = (t2, s2) => S2(t2, s2) ?? t2, H2 = (t2) => {
|
|
131
|
-
let s2 = g2(t2);
|
|
132
|
-
s2 && (i2.getChildren(s2) || []).forEach((o2) => {
|
|
133
|
-
M$1(o2) || i2.removeRefs(s2, o2);
|
|
216
|
+
return (_a = keys == null ? void 0 : keys.filter(Boolean)) == null ? void 0 : _a.join(".");
|
|
217
|
+
};
|
|
218
|
+
var createPluginsState = (initialPlugins = []) => {
|
|
219
|
+
const plugins = [];
|
|
220
|
+
const use = (plugin) => {
|
|
221
|
+
plugins.push(plugin);
|
|
222
|
+
};
|
|
223
|
+
const runPlugins = (state) => {
|
|
224
|
+
return plugins.reduce((graphState, plugin) => plugin(graphState) ?? graphState, state);
|
|
225
|
+
};
|
|
226
|
+
initialPlugins.forEach(use);
|
|
227
|
+
return {
|
|
228
|
+
use,
|
|
229
|
+
runPlugins
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
var isGraphState = (input) => {
|
|
233
|
+
if (!input)
|
|
234
|
+
return false;
|
|
235
|
+
if (isObject$1$1(input)) {
|
|
236
|
+
const fields = ["_id", "_type", "key", "mutate", "resolve"];
|
|
237
|
+
return fields.every((field) => field in input);
|
|
238
|
+
}
|
|
239
|
+
return false;
|
|
240
|
+
};
|
|
241
|
+
var createDebugState = () => {
|
|
242
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
243
|
+
const onDebugEvent = (callback) => {
|
|
244
|
+
listeners.add(callback);
|
|
245
|
+
};
|
|
246
|
+
const debug = (event) => {
|
|
247
|
+
listeners.forEach((callback) => {
|
|
248
|
+
callback({ ...event, timestamp: Date.now() });
|
|
134
249
|
});
|
|
135
|
-
}
|
|
250
|
+
};
|
|
251
|
+
return {
|
|
252
|
+
debug,
|
|
253
|
+
onDebugEvent
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
var cache = /* @__PURE__ */ new Set();
|
|
257
|
+
var wrapMessage = (message) => `[GraphState]: ${message}`;
|
|
258
|
+
function warn(message) {
|
|
259
|
+
if (!cache.has(message)) {
|
|
260
|
+
console.warn(wrapMessage(message));
|
|
261
|
+
cache.add(message);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
var keyOfEntity$1 = (entity) => {
|
|
265
|
+
if (typeof entity === "string") {
|
|
266
|
+
return entityOfKey$1(entity) ? entity : null;
|
|
267
|
+
}
|
|
268
|
+
if (!(entity == null ? void 0 : entity._type)) {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
let entityId = null;
|
|
272
|
+
if (y$4(entity.id) || y$4(entity._id)) {
|
|
273
|
+
entityId = `${entity.id ?? entity._id}`;
|
|
274
|
+
}
|
|
275
|
+
return !entityId ? entityId : `${entity._type}:${entityId}`;
|
|
276
|
+
};
|
|
277
|
+
var entityOfKey$1 = (entity) => {
|
|
278
|
+
if (isObject$1$1(entity) && (entity == null ? void 0 : entity._type) && keyOfEntity$1(entity)) {
|
|
279
|
+
return entity;
|
|
280
|
+
}
|
|
281
|
+
if (!entity || typeof entity !== "string")
|
|
282
|
+
return null;
|
|
283
|
+
const [typeName, ...restTypes] = entity.split(":");
|
|
284
|
+
if (!typeName || restTypes.length < 1)
|
|
285
|
+
return null;
|
|
286
|
+
return {
|
|
287
|
+
_type: typeName,
|
|
288
|
+
_id: restTypes.join(":")
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
function omit$1(obj, ...props) {
|
|
292
|
+
const result = { ...obj };
|
|
293
|
+
props.forEach((prop) => {
|
|
294
|
+
delete result[prop];
|
|
295
|
+
});
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
var ID = 0;
|
|
299
|
+
var DEEP_LIMIT = 100;
|
|
300
|
+
var STATE_TYPE = "State";
|
|
301
|
+
var EACH_UPDATED = "$EACH:ROOT$";
|
|
302
|
+
var createState = (options) => {
|
|
303
|
+
const id = (options == null ? void 0 : options._id) ?? `${ID++}`;
|
|
304
|
+
const type = (options == null ? void 0 : options._type) ?? STATE_TYPE;
|
|
305
|
+
const stateKey = `${type}:${id}`;
|
|
306
|
+
const skipPredictors = [isGraphState, ...(options == null ? void 0 : options.skip) ?? []];
|
|
307
|
+
const cache2 = createCache();
|
|
308
|
+
const debugState = createDebugState();
|
|
309
|
+
const pluginsStore = createPluginsState(options == null ? void 0 : options.plugins);
|
|
310
|
+
const subscribers = /* @__PURE__ */ new Map();
|
|
311
|
+
let deepIndex = 0;
|
|
312
|
+
const isSkipped = (entity) => {
|
|
313
|
+
return skipPredictors.some((predictor) => predictor(entity));
|
|
314
|
+
};
|
|
315
|
+
const getReferences = (entity, options2) => {
|
|
316
|
+
const withPartialKeys = (options2 == null ? void 0 : options2.withPartialKeys) ?? false;
|
|
317
|
+
const key = keyOfEntity2(entity);
|
|
318
|
+
if (!key)
|
|
319
|
+
return [];
|
|
320
|
+
const values = cache2.getParents(key) ?? [];
|
|
321
|
+
return values.filter((v2) => withPartialKeys ? !isPartialKey(v2) : v2);
|
|
322
|
+
};
|
|
323
|
+
const resolve = (input, options2) => {
|
|
324
|
+
const isDeep = (options2 == null ? void 0 : options2.deep) ?? false;
|
|
325
|
+
const isSafe = (options2 == null ? void 0 : options2.safe) ?? false;
|
|
326
|
+
const keepLinks = (options2 == null ? void 0 : options2.keepLinks) ?? false;
|
|
327
|
+
const removeLinkFromSubGraph = (options2 == null ? void 0 : options2.removeLinkFromSubGraph) ?? true;
|
|
328
|
+
const { selector, ...coreOptions } = options2 || {};
|
|
329
|
+
const inputKey = y$4(input) ? keyOfEntity2(input) : null;
|
|
330
|
+
debugState.debug({ type: "resolve", entity: input, options: options2 });
|
|
331
|
+
let value = inputKey ? cache2.readLink(inputKey) : null;
|
|
332
|
+
if (isSkipped(value))
|
|
333
|
+
return value;
|
|
334
|
+
if (isObject$1$1(value) || Array.isArray(value)) {
|
|
335
|
+
value = Object.entries(value).reduce((acc, [key, value2]) => {
|
|
336
|
+
let resultValue = value2;
|
|
337
|
+
if (!isSkipped(resultValue)) {
|
|
338
|
+
if (Array.isArray(value2)) {
|
|
339
|
+
resultValue = value2.map((v2) => {
|
|
340
|
+
if (isSkipped(v2))
|
|
341
|
+
return v2;
|
|
342
|
+
if (isLinkKey(v2) && !isSafe && !cache2.hasLink(v2)) {
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
return isPartOfGraph(v2, inputKey) && !keepLinks || isDeep ? safeResolve(v2, coreOptions) : v2;
|
|
346
|
+
});
|
|
347
|
+
if (!isSafe) {
|
|
348
|
+
resultValue = resultValue.filter(y$4);
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
if (isLinkKey(value2) && !isSafe && !cache2.hasLink(value2)) {
|
|
352
|
+
resultValue = null;
|
|
353
|
+
} else if (isPartOfGraph(keyOfEntity2(value2), inputKey) && !keepLinks || isDeep) {
|
|
354
|
+
resultValue = safeResolve(value2, coreOptions);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
acc[key] = isPartialGraph(resultValue) && removeLinkFromSubGraph ? omit$1(resultValue, "_type", "_id") : resultValue;
|
|
359
|
+
return acc;
|
|
360
|
+
}, {});
|
|
361
|
+
}
|
|
362
|
+
return value ? selector ? selector({ ...value }) : { ...value } : isSafe ? input : null;
|
|
363
|
+
};
|
|
364
|
+
const safeResolve = (input, options2) => resolve(input, options2) ?? input;
|
|
365
|
+
const unlinkGraph = (entity) => {
|
|
366
|
+
const graphKey = keyOfEntity2(entity);
|
|
367
|
+
if (graphKey) {
|
|
368
|
+
const deps = cache2.getChildren(graphKey) || [];
|
|
369
|
+
deps.forEach((depLink) => {
|
|
370
|
+
if (!isPartialKey(depLink)) {
|
|
371
|
+
cache2.removeRefs(graphKey, depLink);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
const mutateField = (input, parentFieldKey, options2) => {
|
|
136
377
|
var _a, _b, _c, _d;
|
|
137
|
-
if ((!
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
378
|
+
if ((!input || l$2(input)) && !isLinkKey(input) || isSkipped(input)) {
|
|
379
|
+
return input;
|
|
380
|
+
}
|
|
381
|
+
const inputLinkKey = isGraphOrKey(input) ? keyOfEntity2(input) : input;
|
|
382
|
+
if (isLinkKey(inputLinkKey)) {
|
|
383
|
+
const parentGraph = getGraphLink(parentFieldKey) ?? "";
|
|
384
|
+
const parentPaths = ((_a = options2 == null ? void 0 : options2.internal) == null ? void 0 : _a.visitors.get(parentGraph)) ?? [];
|
|
385
|
+
const visitorsPaths = ((_b = options2 == null ? void 0 : options2.internal) == null ? void 0 : _b.visitors.get(inputLinkKey)) ?? [];
|
|
386
|
+
if (parentPaths.includes(inputLinkKey) || inputLinkKey === parentGraph) {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
(_d = (_c = options2 == null ? void 0 : options2.internal) == null ? void 0 : _c.visitors) == null ? void 0 : _d.set(inputLinkKey, [...visitorsPaths, parentGraph]);
|
|
390
|
+
}
|
|
391
|
+
if (Array.isArray(input)) {
|
|
392
|
+
return input.map((item) => {
|
|
393
|
+
const indexKey = parentFieldKey ? joinKeys(parentFieldKey, `${ID++}`) : void 0;
|
|
394
|
+
return mutateField(item, indexKey, options2);
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
const entityKey = isLinkKey(input) ? input : isGraph(input) ? keyOfEntity2(input) : null;
|
|
398
|
+
const childKey = entityKey ?? parentFieldKey;
|
|
399
|
+
const mutateMethod = (options2 == null ? void 0 : options2.overrideMutateMethod) || mutate;
|
|
400
|
+
return mutateMethod(childKey, input, options2);
|
|
401
|
+
};
|
|
402
|
+
const mutate = (entity, ...args) => {
|
|
403
|
+
const { graphKey: entityGraphKey, options: options2, data: rawData } = getArgumentsForMutate(entity, ...args);
|
|
404
|
+
debugState.debug({ type: "beforeMutate", entity: entityGraphKey, data: rawData, options: options2 });
|
|
405
|
+
const data = isLinkKey(rawData) ? entityOfKey2(rawData) : rawData;
|
|
406
|
+
const graphKey = entityGraphKey ?? stateKey;
|
|
407
|
+
const partialKey = isPartialKey == null ? void 0 : isPartialKey(graphKey);
|
|
408
|
+
const parentKey = options2 == null ? void 0 : options2.parent;
|
|
409
|
+
const prevGraph = resolve(graphKey ?? "", { removeLinkFromSubGraph: false });
|
|
410
|
+
const internal = (options2 == null ? void 0 : options2.internal) || { hasChange: false, visitors: /* @__PURE__ */ new Map([]) };
|
|
411
|
+
let graphData = {
|
|
412
|
+
...data,
|
|
413
|
+
...entityOfKey2(graphKey)
|
|
414
|
+
};
|
|
415
|
+
const isTopLevelGraph = !(options2 == null ? void 0 : options2.parent);
|
|
416
|
+
const isReplace = (options2 == null ? void 0 : options2.replace) ? typeof (options2 == null ? void 0 : options2.replace) === "function" ? options2.replace(graphData) : (options2 == null ? void 0 : options2.replace) === "deep" ? true : isTopLevelGraph || partialKey : false;
|
|
417
|
+
if (isSkipped(data)) {
|
|
418
|
+
cache2.writeLink(graphKey, data, parentKey);
|
|
419
|
+
return graphKey;
|
|
420
|
+
}
|
|
421
|
+
if (!isReplace && isObject$1$1(prevGraph) && isObject$1$1(graphData)) {
|
|
422
|
+
graphData = {
|
|
423
|
+
...prevGraph,
|
|
424
|
+
...graphData
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
if (isReplace) {
|
|
428
|
+
unlinkGraph(graphKey);
|
|
429
|
+
}
|
|
430
|
+
const nextGraph = Object.entries(graphData).reduce((acc, [key, value]) => {
|
|
431
|
+
const fieldKey = joinKeys(graphKey, key);
|
|
432
|
+
let fieldValue = value;
|
|
433
|
+
const prevValue = prevGraph == null ? void 0 : prevGraph[key];
|
|
434
|
+
const isUpdateField = isObject$1$1(data) && key in data;
|
|
435
|
+
if (!isSkipped(fieldValue)) {
|
|
436
|
+
if (!isReplace && isUpdateField && Array.isArray(fieldValue) && Array.isArray(prevValue)) {
|
|
437
|
+
fieldValue = [...prevValue, ...fieldValue];
|
|
438
|
+
}
|
|
439
|
+
if (isObject$1$1(fieldValue) || Array.isArray(fieldValue) || isLinkKey(fieldValue)) {
|
|
440
|
+
fieldValue = mutateField(fieldValue, fieldKey, {
|
|
441
|
+
...options2,
|
|
442
|
+
parent: graphKey,
|
|
443
|
+
internal
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
if (Array.isArray(fieldValue) && (options2 == null ? void 0 : options2.dedup) !== false) {
|
|
447
|
+
fieldValue = uniqueLinks(...fieldValue);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
const isEqual = shallowEqual(prevValue, fieldKey === fieldValue ? safeResolve(fieldValue) : fieldValue);
|
|
451
|
+
internal.hasChange = internal.hasChange || !isEqual;
|
|
452
|
+
if (!isReplace && isLinkKey(prevValue) && prevValue !== fieldValue) {
|
|
453
|
+
cache2.removeRefs(graphKey, prevValue);
|
|
454
|
+
}
|
|
455
|
+
acc[key] = fieldValue;
|
|
456
|
+
return acc;
|
|
161
457
|
}, {});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
458
|
+
cache2.writeLink(graphKey, nextGraph, parentKey);
|
|
459
|
+
if (!parentKey) {
|
|
460
|
+
cache2.runGarbageCollector();
|
|
461
|
+
}
|
|
462
|
+
if ((internal.hasChange || isReplace) && !parentKey) {
|
|
463
|
+
notify(graphKey, prevGraph);
|
|
464
|
+
}
|
|
465
|
+
debugState.debug({
|
|
466
|
+
type: "afterMutate",
|
|
467
|
+
entity: entityGraphKey,
|
|
468
|
+
data: rawData,
|
|
469
|
+
nextData: nextGraph,
|
|
470
|
+
options: options2,
|
|
471
|
+
hasChange: internal.hasChange
|
|
472
|
+
});
|
|
473
|
+
return graphKey;
|
|
474
|
+
};
|
|
475
|
+
const invalidate = (entity) => {
|
|
476
|
+
const key = keyOfEntity2(entity);
|
|
477
|
+
debugState.debug({ type: "invalidate", entity: key });
|
|
478
|
+
if (key) {
|
|
479
|
+
const parents = cache2.getParents(key) || [];
|
|
480
|
+
cache2.invalidate(key);
|
|
481
|
+
parents.forEach((parentKey) => {
|
|
482
|
+
const prevParent = cache2.readLink(parentKey);
|
|
483
|
+
const freshParent = resolve(parentKey, { safe: false, keepLinks: true, removeLinkFromSubGraph: false });
|
|
484
|
+
cache2.writeLink(parentKey, freshParent);
|
|
485
|
+
notify(parentKey, prevParent);
|
|
170
486
|
});
|
|
171
487
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
488
|
+
};
|
|
489
|
+
const notify = (entity, prevState, _internal) => {
|
|
490
|
+
if (deepIndex > DEEP_LIMIT) {
|
|
491
|
+
throw new Error("Too deep notify.");
|
|
492
|
+
}
|
|
493
|
+
const depth = (_internal == null ? void 0 : _internal.depth) ?? 0;
|
|
494
|
+
const key = keyOfEntity2(entity);
|
|
495
|
+
debugState.debug({ type: "notify", entity: key });
|
|
496
|
+
if (key) {
|
|
497
|
+
deepIndex++;
|
|
498
|
+
const subs = [...subscribers.get(key) || [], ...subscribers.get(EACH_UPDATED) || []];
|
|
499
|
+
const deps = cache2.getChildren(key) || [];
|
|
500
|
+
const nextResult = resolve(key);
|
|
501
|
+
const getSelectedValues = (selector) => {
|
|
502
|
+
const next = nextResult && (selector == null ? void 0 : selector(nextResult));
|
|
503
|
+
const prev = prevState && (selector == null ? void 0 : selector(prevState));
|
|
504
|
+
return { next, prev, hasChange: !deepEqual(next, prev) };
|
|
180
505
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
506
|
+
subs.forEach(({ callback, options: options2 }) => {
|
|
507
|
+
const selector = options2 == null ? void 0 : options2.selector;
|
|
508
|
+
const directChangesOnly = (options2 == null ? void 0 : options2.directChangesOnly) ?? false;
|
|
509
|
+
if (directChangesOnly && depth > 0) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
if (selector) {
|
|
513
|
+
const { next, prev, hasChange } = getSelectedValues(selector);
|
|
514
|
+
if (hasChange)
|
|
515
|
+
callback(next, prev);
|
|
516
|
+
} else {
|
|
517
|
+
callback(nextResult, prevState);
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
deps.forEach(
|
|
521
|
+
(dep) => notify(dep, prevState, {
|
|
522
|
+
depth: depth + 1
|
|
523
|
+
})
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
deepIndex = 0;
|
|
527
|
+
};
|
|
528
|
+
const subscribe = (...args) => {
|
|
529
|
+
const input = typeof args[0] === "function" ? EACH_UPDATED : args[0];
|
|
530
|
+
const callback = typeof args[0] === "function" ? args[0] : args[1];
|
|
531
|
+
const options2 = typeof args[0] === "function" ? args[1] : args[2];
|
|
532
|
+
const key = keyOfEntity2(input);
|
|
533
|
+
if (key) {
|
|
534
|
+
if (subscribers.has(key)) {
|
|
535
|
+
subscribers.set(key, [...Array.from(subscribers.get(key) || []), { callback, options: options2 }]);
|
|
536
|
+
} else {
|
|
537
|
+
subscribers.set(key, [{ callback, options: options2 }]);
|
|
538
|
+
}
|
|
539
|
+
cache2.onRemoveLink((link, prevValue) => {
|
|
540
|
+
if (link === key) {
|
|
541
|
+
notify(key, prevValue);
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
const unsubscribe = () => {
|
|
546
|
+
if (key) {
|
|
547
|
+
const subIndex = (subscribers.get(key) || []).findIndex((sub) => sub.callback === callback);
|
|
548
|
+
if (subIndex !== -1) {
|
|
549
|
+
const nextSubscribers = subscribers.get(key) || [];
|
|
550
|
+
nextSubscribers.splice(subIndex, 1);
|
|
551
|
+
subscribers.set(key, nextSubscribers);
|
|
200
552
|
}
|
|
201
553
|
}
|
|
202
554
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
555
|
+
if (options2 == null ? void 0 : options2.signal) {
|
|
556
|
+
options2.signal.addEventListener("abort", unsubscribe, { once: true });
|
|
557
|
+
}
|
|
558
|
+
return unsubscribe;
|
|
559
|
+
};
|
|
560
|
+
const inspectFields = (graphType) => [...cache2.types.get(graphType) ?? []];
|
|
561
|
+
const resolveParents = (field) => {
|
|
562
|
+
const key = (typeof field === "string" ? field : keyOfEntity2(field)) || "";
|
|
563
|
+
const refs = cache2.getParents(key) ?? [];
|
|
564
|
+
return refs.map((ref) => resolve(ref));
|
|
565
|
+
};
|
|
566
|
+
const keyOfEntity2 = (entity) => {
|
|
567
|
+
warn("Instance keyOfEntity is deprecated. Use static method keyOfEntity.");
|
|
568
|
+
return keyOfEntity$1(entity);
|
|
569
|
+
};
|
|
570
|
+
const entityOfKey2 = (entity) => {
|
|
571
|
+
warn("Instance entityOfKey is deprecated. Use static method entityOfKey.");
|
|
572
|
+
return entityOfKey$1(entity);
|
|
573
|
+
};
|
|
574
|
+
const getArgumentsForMutate = (entity, ...args) => {
|
|
575
|
+
let data = typeof entity === "string" ? args[0] : entity;
|
|
576
|
+
if (typeof data === "function") {
|
|
577
|
+
data = data(resolve(entity));
|
|
578
|
+
} else if (isLinkKey(data)) {
|
|
579
|
+
data = entityOfKey2(data);
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
graphKey: typeof entity === "string" ? entity : keyOfEntity2(entity),
|
|
583
|
+
options: typeof entity === "string" ? args[1] : args[0],
|
|
584
|
+
data
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
function use(plugin) {
|
|
588
|
+
pluginsStore.use(plugin);
|
|
589
|
+
plugin(this);
|
|
590
|
+
}
|
|
591
|
+
const addSkip = (predictor) => {
|
|
592
|
+
skipPredictors.push(predictor);
|
|
593
|
+
};
|
|
594
|
+
if (options == null ? void 0 : options.initialState) {
|
|
595
|
+
mutate(options.initialState, { replace: "deep" });
|
|
213
596
|
}
|
|
214
|
-
|
|
215
|
-
|
|
597
|
+
const graphState = {
|
|
598
|
+
_type: type,
|
|
599
|
+
_id: id,
|
|
600
|
+
key: stateKey,
|
|
601
|
+
getReferences,
|
|
602
|
+
mutate,
|
|
603
|
+
subscribe,
|
|
604
|
+
resolve,
|
|
605
|
+
safeResolve,
|
|
606
|
+
resolveParents,
|
|
607
|
+
inspectFields,
|
|
608
|
+
invalidate,
|
|
609
|
+
keyOfEntity: keyOfEntity2,
|
|
610
|
+
entityOfKey: entityOfKey2,
|
|
611
|
+
getArgumentsForMutate,
|
|
612
|
+
types: cache2.types,
|
|
613
|
+
cache: cache2,
|
|
614
|
+
use,
|
|
615
|
+
addSkip,
|
|
616
|
+
subscribers: void 0,
|
|
617
|
+
onDebugEvent: debugState.onDebugEvent
|
|
216
618
|
};
|
|
217
|
-
(
|
|
218
|
-
|
|
219
|
-
return i2.onRemoveLink((t2, s2) => E2.debug({ type: "garbageRemove", entity: t2, prevValue: s2 })), V2.runPlugins(ke);
|
|
619
|
+
cache2.onRemoveLink((link, prevValue) => debugState.debug({ type: "garbageRemove", entity: link, prevValue }));
|
|
620
|
+
return pluginsStore.runPlugins(graphState);
|
|
220
621
|
};
|
|
221
622
|
const createConstants$1 = (...constants) => {
|
|
222
623
|
return constants.reduce((acc, constant) => {
|
|
@@ -330,12 +731,13 @@ const variableTransforms$1 = createConstants$1(
|
|
|
330
731
|
);
|
|
331
732
|
const renderTarget$1 = createConstants$1("canvas", "document");
|
|
332
733
|
const renderMode$1 = createConstants$1("viewport", "parent", "fixed");
|
|
333
|
-
const interactions$1 = createConstants$1("click", "mouseover");
|
|
334
|
-
const eventMode$1 = createConstants$1("goal", "callback");
|
|
734
|
+
const interactions$1 = createConstants$1("click", "mouseover", "appear");
|
|
735
|
+
const eventMode$1 = createConstants$1("goal", "callback", "tracker");
|
|
335
736
|
const scopeTypes$1 = createConstants$1(
|
|
336
737
|
"InstanceScope",
|
|
337
738
|
"FragmentScope",
|
|
338
|
-
"CollectionScope"
|
|
739
|
+
"CollectionScope",
|
|
740
|
+
"CollectionItemScope"
|
|
339
741
|
);
|
|
340
742
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
341
743
|
__proto__: null,
|
|
@@ -1146,8 +1548,28 @@ const PositionSchema$1 = /* @__PURE__ */ object$1({
|
|
|
1146
1548
|
position: layerField$1(/* @__PURE__ */ enum_$1(Object.keys(positionType$1)), {
|
|
1147
1549
|
fallback: positionType$1.absolute
|
|
1148
1550
|
}),
|
|
1149
|
-
top: layerField$1(/* @__PURE__ */ number$1(), {
|
|
1150
|
-
|
|
1551
|
+
top: layerField$1(/* @__PURE__ */ nullable$1(/* @__PURE__ */ number$1()), {
|
|
1552
|
+
fallback: null,
|
|
1553
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1554
|
+
}),
|
|
1555
|
+
left: layerField$1(/* @__PURE__ */ nullable$1(/* @__PURE__ */ number$1()), {
|
|
1556
|
+
fallback: null,
|
|
1557
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1558
|
+
}),
|
|
1559
|
+
right: layerField$1(/* @__PURE__ */ nullable$1(/* @__PURE__ */ number$1()), {
|
|
1560
|
+
fallback: null,
|
|
1561
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1562
|
+
}),
|
|
1563
|
+
bottom: layerField$1(/* @__PURE__ */ nullable$1(/* @__PURE__ */ number$1()), {
|
|
1564
|
+
fallback: null,
|
|
1565
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
1566
|
+
}),
|
|
1567
|
+
centerAnchorX: layerField$1(/* @__PURE__ */ number$1(), {
|
|
1568
|
+
fallback: 0.5
|
|
1569
|
+
}),
|
|
1570
|
+
centerAnchorY: layerField$1(/* @__PURE__ */ number$1(), {
|
|
1571
|
+
fallback: 0.5
|
|
1572
|
+
})
|
|
1151
1573
|
});
|
|
1152
1574
|
const SceneSchema$1 = /* @__PURE__ */ object$1({
|
|
1153
1575
|
opacity: layerField$1(/* @__PURE__ */ pipe$1(/* @__PURE__ */ number$1(), /* @__PURE__ */ minValue$1(0), /* @__PURE__ */ maxValue$1(1)), {
|
|
@@ -1155,6 +1577,7 @@ const SceneSchema$1 = /* @__PURE__ */ object$1({
|
|
|
1155
1577
|
variable: true
|
|
1156
1578
|
}),
|
|
1157
1579
|
visible: layerField$1(/* @__PURE__ */ boolean$1(), { fallback: true, variable: true }),
|
|
1580
|
+
rotate: layerField$1(/* @__PURE__ */ number$1(), { fallback: null }),
|
|
1158
1581
|
zIndex: layerField$1(/* @__PURE__ */ number$1(), { fallback: -1 })
|
|
1159
1582
|
});
|
|
1160
1583
|
const FillSchema$1 = /* @__PURE__ */ object$1({
|
|
@@ -1304,33 +1727,22 @@ const LinkSchema$1 = /* @__PURE__ */ object$1({
|
|
|
1304
1727
|
whiteSpace: layerField$1(/* @__PURE__ */ enum_$1(Object.keys(whiteSpace$1)), {
|
|
1305
1728
|
fallback: whiteSpace$1.pre
|
|
1306
1729
|
}),
|
|
1307
|
-
|
|
1730
|
+
textAlign: layerField$1(/* @__PURE__ */ string$1(), { fallback: "left" }),
|
|
1308
1731
|
parent: layerField$1(/* @__PURE__ */ nullable$1(/* @__PURE__ */ string$1()), { overridable: false }),
|
|
1309
|
-
attributes: /* @__PURE__ */ optional$1(
|
|
1310
|
-
/* @__PURE__ */ object$1({
|
|
1311
|
-
fontSize: layerField$1(/* @__PURE__ */ string$1(), { fallback: "14px" }),
|
|
1312
|
-
color: layerField$1(/* @__PURE__ */ string$1(), { fallback: "#000", variable: true }),
|
|
1313
|
-
lineHeight: layerField$1(/* @__PURE__ */ string$1(), { fallback: "14px" }),
|
|
1314
|
-
fontWeight: layerField$1(/* @__PURE__ */ string$1(), { fallback: "normal" }),
|
|
1315
|
-
letterSpacing: layerField$1(/* @__PURE__ */ string$1(), { fallback: "0px" }),
|
|
1316
|
-
textTransform: layerField$1(/* @__PURE__ */ string$1(), { fallback: "none" }),
|
|
1317
|
-
textDecoration: layerField$1(/* @__PURE__ */ string$1(), { fallback: "none" }),
|
|
1318
|
-
whiteSpace: layerField$1(/* @__PURE__ */ string$1(), { fallback: "pre" }),
|
|
1319
|
-
textAlign: layerField$1(/* @__PURE__ */ string$1(), { fallback: "left" })
|
|
1320
|
-
})
|
|
1321
|
-
),
|
|
1322
1732
|
...GraphFieldSchema$1.entries,
|
|
1323
1733
|
...OverridesSchema$1.entries,
|
|
1324
1734
|
...CssOverrideSchema$1.entries,
|
|
1325
1735
|
...PositionSchema$1.entries,
|
|
1326
1736
|
...SceneSchema$1.entries,
|
|
1327
|
-
...SizeSchema$1.entries
|
|
1737
|
+
...SizeSchema$1.entries,
|
|
1738
|
+
...InteractionsSchema$1.entries,
|
|
1739
|
+
...LinkSchema$1.entries
|
|
1328
1740
|
});
|
|
1329
1741
|
/* @__PURE__ */ object$1({
|
|
1330
1742
|
name: layerField$1(/* @__PURE__ */ string$1(), { fallback: "Fragment", overridable: false }),
|
|
1331
1743
|
parent: layerField$1(/* @__PURE__ */ nullable$1(/* @__PURE__ */ string$1()), { overridable: false }),
|
|
1332
1744
|
horizontalGrow: layerField$1(/* @__PURE__ */ enum_$1(Object.keys(fragmentGrowingMode$1)), {
|
|
1333
|
-
fallback: fragmentGrowingMode$1.
|
|
1745
|
+
fallback: fragmentGrowingMode$1.fill,
|
|
1334
1746
|
overridable: false
|
|
1335
1747
|
}),
|
|
1336
1748
|
verticalGrow: layerField$1(/* @__PURE__ */ enum_$1(Object.keys(fragmentGrowingMode$1)), {
|
|
@@ -1371,6 +1783,7 @@ const LinkSchema$1 = /* @__PURE__ */ object$1({
|
|
|
1371
1783
|
...PositionSchema$1.entries,
|
|
1372
1784
|
...SizeSchema$1.entries,
|
|
1373
1785
|
...SceneSchema$1.entries,
|
|
1786
|
+
...InteractionsSchema$1.entries,
|
|
1374
1787
|
...LinkSchema$1.entries
|
|
1375
1788
|
});
|
|
1376
1789
|
/* @__PURE__ */ object$1({
|
|
@@ -1555,7 +1968,7 @@ const LinkSchema$1 = /* @__PURE__ */ object$1({
|
|
|
1555
1968
|
}),
|
|
1556
1969
|
parent: layerField$1(/* @__PURE__ */ nullable$1(/* @__PURE__ */ string$1()), { overridable: false }),
|
|
1557
1970
|
defaultValue: layerField$1(/* @__PURE__ */ array$1(/* @__PURE__ */ any$1()), { fallback: [] }),
|
|
1558
|
-
definition: layerField$1(
|
|
1971
|
+
definition: layerField$1(linkValidator$1, { fallback: null }),
|
|
1559
1972
|
required: layerField$1(/* @__PURE__ */ boolean$1(), { fallback: false }),
|
|
1560
1973
|
...GraphFieldSchema$1.entries
|
|
1561
1974
|
});
|
|
@@ -1563,13 +1976,13 @@ const BASE_HEADERS = {
|
|
|
1563
1976
|
"Content-Type": "application/json"
|
|
1564
1977
|
};
|
|
1565
1978
|
const createFetcher = (baseUrl, defaultHeaders = {}) => {
|
|
1566
|
-
const
|
|
1979
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
1567
1980
|
const inflightRequests = /* @__PURE__ */ new Map();
|
|
1568
1981
|
const getCacheKey = (query2, variables, options) => JSON.stringify({ query: query2, variables, options });
|
|
1569
1982
|
const query = async (query2, variables = {}, options = {}) => {
|
|
1570
1983
|
const cacheKey = getCacheKey(query2, variables, options);
|
|
1571
|
-
if (
|
|
1572
|
-
return
|
|
1984
|
+
if (cache2.has(cacheKey)) {
|
|
1985
|
+
return cache2.get(cacheKey);
|
|
1573
1986
|
}
|
|
1574
1987
|
if (inflightRequests.has(cacheKey)) {
|
|
1575
1988
|
return inflightRequests.get(cacheKey);
|
|
@@ -1588,7 +2001,7 @@ const createFetcher = (baseUrl, defaultHeaders = {}) => {
|
|
|
1588
2001
|
if (!res.ok) throw new Error(`Fetch error: ${res.status}`);
|
|
1589
2002
|
const data = await res.json();
|
|
1590
2003
|
if (!query2.includes("mutation")) {
|
|
1591
|
-
|
|
2004
|
+
cache2.set(cacheKey, data);
|
|
1592
2005
|
}
|
|
1593
2006
|
return data;
|
|
1594
2007
|
}).finally(() => {
|
|
@@ -1598,9 +2011,9 @@ const createFetcher = (baseUrl, defaultHeaders = {}) => {
|
|
|
1598
2011
|
return request;
|
|
1599
2012
|
};
|
|
1600
2013
|
const invalidate = (endpoint, options) => {
|
|
1601
|
-
|
|
2014
|
+
cache2.delete(getCacheKey(endpoint, options));
|
|
1602
2015
|
};
|
|
1603
|
-
const clearCache = () =>
|
|
2016
|
+
const clearCache = () => cache2.clear();
|
|
1604
2017
|
return { query, invalidate, clearCache };
|
|
1605
2018
|
};
|
|
1606
2019
|
const getFragmentQuery = (fragmentId, isSelf) => {
|
|
@@ -1666,10 +2079,10 @@ const fetchBeacon = (baseUrl) => {
|
|
|
1666
2079
|
sendBeacon
|
|
1667
2080
|
};
|
|
1668
2081
|
};
|
|
1669
|
-
const
|
|
2082
|
+
const getAreaListQuery = (areaCodes) => {
|
|
1670
2083
|
return {
|
|
1671
|
-
query: `query($
|
|
1672
|
-
|
|
2084
|
+
query: `query($areaCodes: [String!]!) {
|
|
2085
|
+
clientAreas(areaCodes: $areaCodes) {
|
|
1673
2086
|
variant {
|
|
1674
2087
|
fragment {
|
|
1675
2088
|
props
|
|
@@ -1686,7 +2099,7 @@ const getAreaQuery = (areaCode) => {
|
|
|
1686
2099
|
}
|
|
1687
2100
|
}`,
|
|
1688
2101
|
variables: {
|
|
1689
|
-
|
|
2102
|
+
areaCodes
|
|
1690
2103
|
}
|
|
1691
2104
|
};
|
|
1692
2105
|
};
|
|
@@ -1708,7 +2121,8 @@ const fetchPlugin = (state) => {
|
|
|
1708
2121
|
const fragmentQuery = getFragmentQuery(fragmentId, isSelf);
|
|
1709
2122
|
const response = await fetcher.query(
|
|
1710
2123
|
fragmentQuery.query,
|
|
1711
|
-
fragmentQuery.variables
|
|
2124
|
+
fragmentQuery.variables,
|
|
2125
|
+
{ referrerPolicy: "unsafe-url" }
|
|
1712
2126
|
);
|
|
1713
2127
|
let fragment2 = null;
|
|
1714
2128
|
if (!!(response == null ? void 0 : response.data) && "clientFragment" in response.data) {
|
|
@@ -1737,36 +2151,46 @@ const fetchPlugin = (state) => {
|
|
|
1737
2151
|
return null;
|
|
1738
2152
|
};
|
|
1739
2153
|
const queryArea = async (areaCode) => {
|
|
2154
|
+
return queryAreaList([areaCode]).then((res) => res == null ? void 0 : res.at(0));
|
|
2155
|
+
};
|
|
2156
|
+
const queryAreaList = async (areaCodes) => {
|
|
1740
2157
|
var _a2;
|
|
1741
|
-
if (!apiToken || !
|
|
1742
|
-
|
|
1743
|
-
|
|
2158
|
+
if (!apiToken || !areaCodes) return null;
|
|
2159
|
+
const nonLoadedAreas = areaCodes.filter(
|
|
2160
|
+
(code) => !state.$fetch.cacheAreaDocuments.has(code)
|
|
2161
|
+
);
|
|
2162
|
+
if (!nonLoadedAreas.length) {
|
|
2163
|
+
return areaCodes.map(state.$fetch.cacheAreaDocuments.get);
|
|
1744
2164
|
}
|
|
1745
|
-
const areaQuery =
|
|
2165
|
+
const areaQuery = getAreaListQuery(areaCodes);
|
|
1746
2166
|
const response = await fetcher.query(
|
|
1747
2167
|
areaQuery.query,
|
|
1748
|
-
areaQuery.variables
|
|
2168
|
+
areaQuery.variables,
|
|
2169
|
+
{ referrerPolicy: "unsafe-url" }
|
|
1749
2170
|
);
|
|
1750
|
-
const
|
|
1751
|
-
if (
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
area.variant.fragment.fragment.linkedFragments.forEach(
|
|
1758
|
-
(linkedFragment) => state.$fetch.cacheDocuments.set(
|
|
1759
|
-
linkedFragment.id,
|
|
1760
|
-
linkedFragment.document
|
|
1761
|
-
)
|
|
2171
|
+
const areas = (_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.clientAreas;
|
|
2172
|
+
if (areas) {
|
|
2173
|
+
areas.forEach((area, index2) => {
|
|
2174
|
+
const areaCode = areaCodes == null ? void 0 : areaCodes.at(index2);
|
|
2175
|
+
state.$fetch.cacheDocuments.set(
|
|
2176
|
+
area.variant.fragment.fragment.id,
|
|
2177
|
+
area.variant.fragment.fragment.document
|
|
1762
2178
|
);
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
2179
|
+
if (Array.isArray(area.variant.fragment.fragment.linkedFragments)) {
|
|
2180
|
+
area.variant.fragment.fragment.linkedFragments.forEach(
|
|
2181
|
+
(linkedFragment) => state.$fetch.cacheDocuments.set(
|
|
2182
|
+
linkedFragment.id,
|
|
2183
|
+
linkedFragment.document
|
|
2184
|
+
)
|
|
2185
|
+
);
|
|
2186
|
+
}
|
|
2187
|
+
const entity = {
|
|
2188
|
+
fragmentId: area.variant.fragment.fragment.id,
|
|
2189
|
+
props: area.variant.fragment.props
|
|
2190
|
+
};
|
|
2191
|
+
state.$fetch.cacheAreaDocuments.set(areaCode, entity);
|
|
2192
|
+
});
|
|
2193
|
+
return areaCodes.map((code) => state.$fetch.cacheAreaDocuments.get(code));
|
|
1770
2194
|
}
|
|
1771
2195
|
return null;
|
|
1772
2196
|
};
|
|
@@ -1775,6 +2199,7 @@ const fetchPlugin = (state) => {
|
|
|
1775
2199
|
cacheAreaDocuments: /* @__PURE__ */ new Map(),
|
|
1776
2200
|
queryFragment,
|
|
1777
2201
|
queryArea,
|
|
2202
|
+
queryAreaList,
|
|
1778
2203
|
query: fetcher.query,
|
|
1779
2204
|
sendBeacon: beaconFetcher.sendBeacon,
|
|
1780
2205
|
readFragment: (fragmentId) => state.$fetch.cacheDocuments.get(fragmentId) ?? null,
|
|
@@ -1785,11 +2210,11 @@ const getAllChildren = (layerResolver, layerKey, acc = []) => {
|
|
|
1785
2210
|
var _a;
|
|
1786
2211
|
const layer = layerResolver(layerKey) ?? {};
|
|
1787
2212
|
if (acc.length === 0) {
|
|
1788
|
-
acc.push(layerKey);
|
|
2213
|
+
acc.push(keyOfEntity$1(layerKey));
|
|
1789
2214
|
}
|
|
1790
2215
|
(_a = layer == null ? void 0 : layer.children) == null ? void 0 : _a.forEach((child) => {
|
|
1791
2216
|
if (child) {
|
|
1792
|
-
acc.push(child);
|
|
2217
|
+
acc.push(keyOfEntity$1(child));
|
|
1793
2218
|
getAllChildren(layerResolver, child, acc);
|
|
1794
2219
|
}
|
|
1795
2220
|
});
|
|
@@ -1811,8 +2236,8 @@ const findGroups = (styles2, layerResolver) => {
|
|
|
1811
2236
|
const primaryBreakpoint = breakpoints.find(
|
|
1812
2237
|
(breakpoint) => breakpoint == null ? void 0 : breakpoint.isPrimary
|
|
1813
2238
|
);
|
|
1814
|
-
const smaller = breakpoints.filter((f2) => !!f2 && (f2 == null ? void 0 : f2.width) < (primaryBreakpoint == null ? void 0 : primaryBreakpoint.width)).sort((a2,
|
|
1815
|
-
const larger = breakpoints.filter((f2) => !!f2 && (f2 == null ? void 0 : f2.width) > (primaryBreakpoint == null ? void 0 : primaryBreakpoint.width)).sort((a2,
|
|
2239
|
+
const smaller = breakpoints.filter((f2) => !!f2 && (f2 == null ? void 0 : f2.width) < (primaryBreakpoint == null ? void 0 : primaryBreakpoint.width)).sort((a2, b) => b.width - a2.width);
|
|
2240
|
+
const larger = breakpoints.filter((f2) => !!f2 && (f2 == null ? void 0 : f2.width) > (primaryBreakpoint == null ? void 0 : primaryBreakpoint.width)).sort((a2, b) => a2.width - b.width);
|
|
1816
2241
|
return {
|
|
1817
2242
|
fragmentLayerKey,
|
|
1818
2243
|
fragment: rootLayer,
|
|
@@ -1848,27 +2273,59 @@ const makeCss = (styles2, layerResolver) => (layerKey) => {
|
|
|
1848
2273
|
const cssOverride = (cacheLayer == null ? void 0 : cacheLayer.cssOverride) ?? "";
|
|
1849
2274
|
return {
|
|
1850
2275
|
hash: layerHash,
|
|
1851
|
-
css:
|
|
2276
|
+
css: toCSS(resultCssRules) + cssOverride
|
|
1852
2277
|
};
|
|
1853
2278
|
};
|
|
1854
2279
|
const autoInjector = (key, state, graphKey, transformStyles) => {
|
|
2280
|
+
const removeStyle = () => {
|
|
2281
|
+
if (!isBrowser_default$1) return;
|
|
2282
|
+
const el = document.getElementById(key);
|
|
2283
|
+
if (el) el.remove();
|
|
2284
|
+
};
|
|
1855
2285
|
const injectStyle = (styles2) => {
|
|
1856
|
-
if (isBrowser_default$1
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
2286
|
+
if (!isBrowser_default$1) return;
|
|
2287
|
+
if (!styles2) {
|
|
2288
|
+
removeStyle();
|
|
2289
|
+
return;
|
|
2290
|
+
}
|
|
2291
|
+
const existing = document.getElementById(key);
|
|
2292
|
+
if (existing && existing.tagName === "STYLE") {
|
|
2293
|
+
existing.textContent = styles2;
|
|
2294
|
+
return;
|
|
2295
|
+
}
|
|
2296
|
+
if (existing) existing.remove();
|
|
2297
|
+
const style = document.createElement("style");
|
|
2298
|
+
style.id = key;
|
|
2299
|
+
style.textContent = styles2;
|
|
2300
|
+
document.head.appendChild(style);
|
|
2301
|
+
};
|
|
2302
|
+
let isMounted = false;
|
|
2303
|
+
let pendingStyles = "";
|
|
2304
|
+
state.subscribe(
|
|
2305
|
+
graphKey,
|
|
2306
|
+
(next) => {
|
|
2307
|
+
const styles2 = (transformStyles == null ? void 0 : transformStyles(next)) ?? (next == null ? void 0 : next.styles) ?? [];
|
|
2308
|
+
const resultStyle = styles2.join("\n");
|
|
2309
|
+
pendingStyles = resultStyle;
|
|
2310
|
+
if (isMounted) {
|
|
2311
|
+
injectStyle(resultStyle);
|
|
1860
2312
|
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
2313
|
+
},
|
|
2314
|
+
{ directChangesOnly: true }
|
|
2315
|
+
);
|
|
2316
|
+
const mount = () => {
|
|
2317
|
+
isMounted = true;
|
|
2318
|
+
if (pendingStyles) {
|
|
2319
|
+
injectStyle(pendingStyles);
|
|
2320
|
+
} else {
|
|
2321
|
+
removeStyle();
|
|
1865
2322
|
}
|
|
1866
2323
|
};
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
}
|
|
2324
|
+
const unmount = () => {
|
|
2325
|
+
isMounted = false;
|
|
2326
|
+
removeStyle();
|
|
2327
|
+
};
|
|
2328
|
+
return { mount, unmount };
|
|
1872
2329
|
};
|
|
1873
2330
|
function generatePrimaryCssBlocks(layerResolver, group, cssMaker) {
|
|
1874
2331
|
const children = getAllChildren(layerResolver, group.primary);
|
|
@@ -1930,12 +2387,24 @@ const fragmentStylesheetPlugin = (state) => {
|
|
|
1930
2387
|
state.mutate(KEY, {
|
|
1931
2388
|
styles: {}
|
|
1932
2389
|
});
|
|
1933
|
-
autoInjector(state.key, state, KEY, (graph) => {
|
|
2390
|
+
const fragmentStyleInjector = autoInjector(state.key, state, KEY, (graph) => {
|
|
1934
2391
|
return extractStyleSheet(graph.styles, state.resolve);
|
|
1935
2392
|
});
|
|
2393
|
+
const destroyStyles = () => {
|
|
2394
|
+
state.mutate(
|
|
2395
|
+
KEY,
|
|
2396
|
+
{
|
|
2397
|
+
styles: {}
|
|
2398
|
+
},
|
|
2399
|
+
{ replace: true }
|
|
2400
|
+
);
|
|
2401
|
+
fragmentStyleInjector.unmount();
|
|
2402
|
+
};
|
|
1936
2403
|
state.$styleSheet = {
|
|
1937
2404
|
key: KEY,
|
|
1938
2405
|
addStyle,
|
|
2406
|
+
mount: fragmentStyleInjector.mount,
|
|
2407
|
+
unmount: destroyStyles,
|
|
1939
2408
|
extract: (withTag) => {
|
|
1940
2409
|
var _a;
|
|
1941
2410
|
const graph = state.resolve(KEY);
|
|
@@ -1950,7 +2419,7 @@ const fragmentStylesheetPlugin = (state) => {
|
|
|
1950
2419
|
};
|
|
1951
2420
|
return state;
|
|
1952
2421
|
};
|
|
1953
|
-
const globalCss = '[data-key^="Fragment"] {\n [data-key^="Text"] {\n p {\n margin: 0;\n }\n }\n\n /* 1. Use a more-intuitive box-sizing model */\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n /* 2. Remove default margin */\n\n * {\n margin: 0;\n }\n\n /* 3. Enable keyword animations */\n @media (prefers-reduced-motion: no-preference) {\n html {\n interpolate-size: allow-keywords;\n }\n }\n\n body {\n /* 4. Add accessible line-height */\n line-height: 1.5;\n /* 5. Improve text rendering */\n -webkit-font-smoothing: antialiased;\n }\n\n /* 6. Improve media defaults */\n\n img, picture, video, canvas, svg {\n display: block;\n max-width: 100%;\n }\n\n /* 7. Inherit fonts for form controls */\n\n input, button, textarea, select {\n font: inherit;\n }\n\n /* 8. Avoid text overflows */\n\n p, h1, h2, h3, h4, h5, h6 {\n overflow-wrap: break-word;\n }\n\n /*\n 10. Create a root stacking context\n */\n\n #root, #__next {\n isolation: isolate;\n }\n\n a {\n text-decoration: none;\n }\n}\n';
|
|
2422
|
+
const globalCss = '[data-key^="Fragment"] {\n [data-key^="Text"] {\n p {\n margin: 0;\n font-size: 14px;\n color: #000;\n font-weight: 400;\n }\n }\n\n /* 1. Use a more-intuitive box-sizing model */\n\n *, *::before, *::after {\n box-sizing: border-box;\n }\n\n /* 2. Remove default margin */\n\n * {\n margin: 0;\n }\n\n /* 3. Enable keyword animations */\n @media (prefers-reduced-motion: no-preference) {\n html {\n interpolate-size: allow-keywords;\n }\n }\n\n body {\n /* 4. Add accessible line-height */\n line-height: 1.5;\n /* 5. Improve text rendering */\n -webkit-font-smoothing: antialiased;\n }\n\n /* 6. Improve media defaults */\n\n img, picture, video, canvas, svg {\n display: block;\n max-width: 100%;\n }\n\n /* 7. Inherit fonts for form controls */\n\n input, button, textarea, select {\n font: inherit;\n }\n\n /* 8. Avoid text overflows */\n\n p, h1, h2, h3, h4, h5, h6 {\n overflow-wrap: break-word;\n }\n\n /*\n 10. Create a root stacking context\n */\n\n #root, #__next {\n isolation: isolate;\n }\n\n a {\n text-decoration: none;\n }\n}\n';
|
|
1954
2423
|
const globalStylesheetPlugin = (state) => {
|
|
1955
2424
|
if (!("$fragments" in state)) {
|
|
1956
2425
|
throw new Error("GlobalStylesheetPlugin need $fragments plugin");
|
|
@@ -1966,10 +2435,12 @@ const globalStylesheetPlugin = (state) => {
|
|
|
1966
2435
|
_id: "root",
|
|
1967
2436
|
styles: []
|
|
1968
2437
|
});
|
|
1969
|
-
autoInjector("global", state, KEY);
|
|
2438
|
+
const globalStyleInjector = autoInjector("global", state, KEY);
|
|
1970
2439
|
state.$globalStylesheet = {
|
|
1971
2440
|
key: KEY,
|
|
1972
2441
|
addStyle,
|
|
2442
|
+
mount: globalStyleInjector.mount,
|
|
2443
|
+
unmount: globalStyleInjector.unmount,
|
|
1973
2444
|
extractStyles: () => {
|
|
1974
2445
|
const allFragments = state.$fragments.getManagers();
|
|
1975
2446
|
const styles2 = Object.entries(allFragments).filter(([, value]) => !!(value == null ? void 0 : value.resolve)).map(([, manager]) => manager.$styleSheet.extract(true));
|
|
@@ -1977,6 +2448,7 @@ const globalStylesheetPlugin = (state) => {
|
|
|
1977
2448
|
}
|
|
1978
2449
|
};
|
|
1979
2450
|
addStyle(globalCss);
|
|
2451
|
+
globalStyleInjector.mount();
|
|
1980
2452
|
return state;
|
|
1981
2453
|
};
|
|
1982
2454
|
const scopesPlugin = (state) => {
|
|
@@ -1990,7 +2462,8 @@ const scopesPlugin = (state) => {
|
|
|
1990
2462
|
};
|
|
1991
2463
|
return state;
|
|
1992
2464
|
};
|
|
1993
|
-
const fragmentsPlugin = (state) => {
|
|
2465
|
+
const fragmentsPlugin = (options) => (state) => {
|
|
2466
|
+
const plugins = (options == null ? void 0 : options.plugins) ?? [];
|
|
1994
2467
|
const createFragmentManager = (fragmentId, initialDocument = {}) => {
|
|
1995
2468
|
var _a, _b;
|
|
1996
2469
|
if (!fragmentId || !initialDocument) return null;
|
|
@@ -2011,7 +2484,7 @@ const fragmentsPlugin = (state) => {
|
|
|
2011
2484
|
_type: "Spring",
|
|
2012
2485
|
_id: "root"
|
|
2013
2486
|
};
|
|
2014
|
-
const manager =
|
|
2487
|
+
const manager = createState({
|
|
2015
2488
|
_type: "FragmentManager",
|
|
2016
2489
|
_id: fragmentId,
|
|
2017
2490
|
initialState: initialDocument,
|
|
@@ -2024,7 +2497,8 @@ const fragmentsPlugin = (state) => {
|
|
|
2024
2497
|
},
|
|
2025
2498
|
// cssPlugin,
|
|
2026
2499
|
fragmentStylesheetPlugin,
|
|
2027
|
-
scopesPlugin
|
|
2500
|
+
scopesPlugin,
|
|
2501
|
+
...plugins
|
|
2028
2502
|
],
|
|
2029
2503
|
skip: [
|
|
2030
2504
|
g$2,
|
|
@@ -2070,34 +2544,94 @@ const fragmentsPlugin = (state) => {
|
|
|
2070
2544
|
const addClientMetric = `mutation AddClientMetric($type: ClientMetricType!, $value: String) {
|
|
2071
2545
|
addClientMetric(metric: {metricType: $type, metricValue: $value})
|
|
2072
2546
|
}`;
|
|
2547
|
+
const pendingPixels = /* @__PURE__ */ new Set();
|
|
2548
|
+
const sendWithImage = (url) => {
|
|
2549
|
+
try {
|
|
2550
|
+
const pixel = new Image();
|
|
2551
|
+
pixel.referrerPolicy = "no-referrer";
|
|
2552
|
+
const handleCleanup = () => {
|
|
2553
|
+
pixel.removeEventListener("load", handleCleanup);
|
|
2554
|
+
pixel.removeEventListener("error", handleCleanup);
|
|
2555
|
+
pendingPixels.delete(pixel);
|
|
2556
|
+
};
|
|
2557
|
+
pixel.addEventListener("load", handleCleanup, { once: true });
|
|
2558
|
+
pixel.addEventListener("error", handleCleanup, { once: true });
|
|
2559
|
+
pendingPixels.add(pixel);
|
|
2560
|
+
pixel.src = url;
|
|
2561
|
+
} catch {
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
const sendWithFetch = (url) => {
|
|
2565
|
+
if (typeof fetch !== "function") {
|
|
2566
|
+
return false;
|
|
2567
|
+
}
|
|
2568
|
+
try {
|
|
2569
|
+
fetch(url, {
|
|
2570
|
+
method: "GET",
|
|
2571
|
+
mode: "no-cors",
|
|
2572
|
+
keepalive: true
|
|
2573
|
+
}).catch(() => void 0);
|
|
2574
|
+
return true;
|
|
2575
|
+
} catch {
|
|
2576
|
+
return false;
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
const sendWithNavigatorBeacon = (url) => {
|
|
2580
|
+
if (typeof navigator === "undefined" || typeof navigator.sendBeacon !== "function") {
|
|
2581
|
+
return false;
|
|
2582
|
+
}
|
|
2583
|
+
try {
|
|
2584
|
+
return navigator.sendBeacon(url);
|
|
2585
|
+
} catch {
|
|
2586
|
+
return false;
|
|
2587
|
+
}
|
|
2588
|
+
};
|
|
2589
|
+
const trackAdPixel = (pixelUrl, customBeacon) => {
|
|
2590
|
+
if (!isBrowser_default$1) {
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
const url = pixelUrl == null ? void 0 : pixelUrl.trim();
|
|
2594
|
+
if (!url) {
|
|
2595
|
+
return;
|
|
2596
|
+
}
|
|
2597
|
+
if (typeof customBeacon === "function") {
|
|
2598
|
+
try {
|
|
2599
|
+
const result = customBeacon(url);
|
|
2600
|
+
if (result === true) {
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
} catch {
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
if (sendWithNavigatorBeacon(url)) {
|
|
2607
|
+
return;
|
|
2608
|
+
}
|
|
2609
|
+
if (sendWithFetch(url)) {
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
sendWithImage(url);
|
|
2613
|
+
};
|
|
2073
2614
|
const types = createConstants$2(
|
|
2074
2615
|
"INIT_SESSION",
|
|
2075
2616
|
"RELEASE_SESSION",
|
|
2076
2617
|
"REACH_PROJECT_GOAL"
|
|
2077
2618
|
);
|
|
2078
2619
|
const globalMetricsPlugin = (state) => {
|
|
2079
|
-
var _a;
|
|
2080
|
-
const history = /* @__PURE__ */ new Set([]);
|
|
2081
2620
|
const sendMetric = async (type, value) => {
|
|
2082
|
-
var
|
|
2083
|
-
|
|
2084
|
-
return;
|
|
2085
|
-
}
|
|
2086
|
-
const query = (_a2 = state == null ? void 0 : state.$fetch) == null ? void 0 : _a2.query;
|
|
2621
|
+
var _a;
|
|
2622
|
+
const query = (_a = state == null ? void 0 : state.$fetch) == null ? void 0 : _a.query;
|
|
2087
2623
|
await query(addClientMetric, { type, value });
|
|
2088
|
-
history.add(type);
|
|
2089
2624
|
};
|
|
2090
2625
|
const reachGoal = (goal) => {
|
|
2091
2626
|
sendMetric(types.REACH_PROJECT_GOAL, goal);
|
|
2092
2627
|
};
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
});
|
|
2098
|
-
}
|
|
2628
|
+
const sendAdPixel = (pixelUrl) => {
|
|
2629
|
+
var _a;
|
|
2630
|
+
trackAdPixel(pixelUrl, (_a = state == null ? void 0 : state.$fetch) == null ? void 0 : _a.sendBeacon);
|
|
2631
|
+
};
|
|
2099
2632
|
state.$metrics = {
|
|
2100
|
-
reachGoal
|
|
2633
|
+
reachGoal,
|
|
2634
|
+
trackAdPixel: sendAdPixel
|
|
2101
2635
|
};
|
|
2102
2636
|
};
|
|
2103
2637
|
const loadPlugin = (state) => {
|
|
@@ -2161,6 +2695,7 @@ const loadPlugin = (state) => {
|
|
|
2161
2695
|
const loader = async () => {
|
|
2162
2696
|
var _a2;
|
|
2163
2697
|
const areaEntity = await ((_a2 = state == null ? void 0 : state.$fetch) == null ? void 0 : _a2.queryArea(areaCode));
|
|
2698
|
+
console.log(areaEntity);
|
|
2164
2699
|
await loadFragment(areaEntity == null ? void 0 : areaEntity.fragmentId, {
|
|
2165
2700
|
suspense: false
|
|
2166
2701
|
});
|
|
@@ -2188,7 +2723,7 @@ const PLUGIN_TYPES = createConstants$2(
|
|
|
2188
2723
|
);
|
|
2189
2724
|
const createFragmentsClient = (options) => {
|
|
2190
2725
|
const BACKEND_TARGET = (options == null ? void 0 : options.isSelf) ? "/graphql" : "http://85.192.29.65/graphql";
|
|
2191
|
-
return
|
|
2726
|
+
return createState({
|
|
2192
2727
|
_type: "GlobalManager",
|
|
2193
2728
|
initialState: {},
|
|
2194
2729
|
skip: [
|
|
@@ -2206,14 +2741,16 @@ const createFragmentsClient = (options) => {
|
|
|
2206
2741
|
};
|
|
2207
2742
|
},
|
|
2208
2743
|
fetchPlugin,
|
|
2209
|
-
fragmentsPlugin
|
|
2744
|
+
fragmentsPlugin({
|
|
2745
|
+
plugins: options == null ? void 0 : options.fragmentPlugins
|
|
2746
|
+
}),
|
|
2210
2747
|
loadPlugin,
|
|
2211
2748
|
globalMetricsPlugin,
|
|
2212
2749
|
globalStylesheetPlugin
|
|
2213
2750
|
]
|
|
2214
2751
|
});
|
|
2215
2752
|
};
|
|
2216
|
-
var n, l$1, t$1, i$1, r$2, o$1, e$1, f$2, c$1, s$
|
|
2753
|
+
var n, l$1, t$1, i$1, r$2, o$1, e$1, f$2, c$1, s$1, a$2, h$1, p$1 = {}, v$1 = [], y$3 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, d$1 = Array.isArray;
|
|
2217
2754
|
function w$1(n2, l2) {
|
|
2218
2755
|
for (var t2 in l2) n2[t2] = l2[t2];
|
|
2219
2756
|
return n2;
|
|
@@ -2234,7 +2771,7 @@ function m$1(n2, u2, i2, r2, o2) {
|
|
|
2234
2771
|
function k$1(n2) {
|
|
2235
2772
|
return n2.children;
|
|
2236
2773
|
}
|
|
2237
|
-
function x$
|
|
2774
|
+
function x$3(n2, l2) {
|
|
2238
2775
|
this.props = n2, this.context = l2;
|
|
2239
2776
|
}
|
|
2240
2777
|
function S$1(n2, l2) {
|
|
@@ -2256,18 +2793,18 @@ function M(n2) {
|
|
|
2256
2793
|
(!n2.__d && (n2.__d = true) && i$1.push(n2) && !$.__r++ || r$2 !== l$1.debounceRendering) && ((r$2 = l$1.debounceRendering) || o$1)($);
|
|
2257
2794
|
}
|
|
2258
2795
|
function $() {
|
|
2259
|
-
for (var n2, t2, u2, r2, o2, f2, c2, s2 = 1; i$1.length; ) i$1.length > s2 && i$1.sort(e$1), n2 = i$1.shift(), s2 = i$1.length, n2.__d && (u2 = void 0, o2 = (r2 = (t2 = n2).__v).__e, f2 = [], c2 = [], t2.__P && ((u2 = w$1({}, r2)).__v = r2.__v + 1, l$1.vnode && l$1.vnode(u2), O
|
|
2796
|
+
for (var n2, t2, u2, r2, o2, f2, c2, s2 = 1; i$1.length; ) i$1.length > s2 && i$1.sort(e$1), n2 = i$1.shift(), s2 = i$1.length, n2.__d && (u2 = void 0, o2 = (r2 = (t2 = n2).__v).__e, f2 = [], c2 = [], t2.__P && ((u2 = w$1({}, r2)).__v = r2.__v + 1, l$1.vnode && l$1.vnode(u2), O(t2.__P, u2, r2, t2.__n, t2.__P.namespaceURI, 32 & r2.__u ? [o2] : null, f2, null == o2 ? S$1(r2) : o2, !!(32 & r2.__u), c2), u2.__v = r2.__v, u2.__.__k[u2.__i] = u2, z$1(f2, u2, c2), u2.__e != o2 && C$2(u2)));
|
|
2260
2797
|
$.__r = 0;
|
|
2261
2798
|
}
|
|
2262
2799
|
function I(n2, l2, t2, u2, i2, r2, o2, e2, f2, c2, s2) {
|
|
2263
|
-
var a2,
|
|
2264
|
-
for (f2 = P$2(t2, l2, _2, f2, m2), a2 = 0; a2 < m2; a2++) null != (y2 = t2.__k[a2]) && (
|
|
2800
|
+
var a2, h2, y2, d2, w2, g2, _2 = u2 && u2.__k || v$1, m2 = l2.length;
|
|
2801
|
+
for (f2 = P$2(t2, l2, _2, f2, m2), a2 = 0; a2 < m2; a2++) null != (y2 = t2.__k[a2]) && (h2 = -1 === y2.__i ? p$1 : _2[y2.__i] || p$1, y2.__i = a2, g2 = O(n2, y2, h2, i2, r2, o2, e2, f2, c2, s2), d2 = y2.__e, y2.ref && h2.ref != y2.ref && (h2.ref && q$2(h2.ref, null, y2), s2.push(y2.ref, y2.__c || d2, y2)), null == w2 && null != d2 && (w2 = d2), 4 & y2.__u || h2.__k === y2.__k ? f2 = A$1(y2, f2, n2) : "function" == typeof y2.type && void 0 !== g2 ? f2 = g2 : d2 && (f2 = d2.nextSibling), y2.__u &= -7);
|
|
2265
2802
|
return t2.__e = w2, f2;
|
|
2266
2803
|
}
|
|
2267
2804
|
function P$2(n2, l2, t2, u2, i2) {
|
|
2268
|
-
var r2, o2, e2, f2, c2, s2 = t2.length, a2 = s2,
|
|
2269
|
-
for (n2.__k = new Array(i2), r2 = 0; r2 < i2; r2++) null != (o2 = l2[r2]) && "boolean" != typeof o2 && "function" != typeof o2 ? (f2 = r2 +
|
|
2270
|
-
if (a2) for (r2 = 0; r2 < s2; r2++) null != (e2 = t2[r2]) && 0 == (2 & e2.__u) && (e2.__e == u2 && (u2 = S$1(e2)), B$
|
|
2805
|
+
var r2, o2, e2, f2, c2, s2 = t2.length, a2 = s2, h2 = 0;
|
|
2806
|
+
for (n2.__k = new Array(i2), r2 = 0; r2 < i2; r2++) null != (o2 = l2[r2]) && "boolean" != typeof o2 && "function" != typeof o2 ? (f2 = r2 + h2, (o2 = n2.__k[r2] = "string" == typeof o2 || "number" == typeof o2 || "bigint" == typeof o2 || o2.constructor == String ? m$1(null, o2, null, null, null) : d$1(o2) ? m$1(k$1, { children: o2 }, null, null, null) : void 0 === o2.constructor && o2.__b > 0 ? m$1(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 ? h2-- : i2 < s2 && h2++), "function" != typeof o2.type && (o2.__u |= 4)) : c2 != f2 && (c2 == f2 - 1 ? h2-- : c2 == f2 + 1 ? h2++ : (c2 > f2 ? h2-- : h2++, o2.__u |= 4))) : n2.__k[r2] = null;
|
|
2807
|
+
if (a2) for (r2 = 0; r2 < s2; r2++) null != (e2 = t2[r2]) && 0 == (2 & e2.__u) && (e2.__e == u2 && (u2 = S$1(e2)), B$2(e2, e2));
|
|
2271
2808
|
return u2;
|
|
2272
2809
|
}
|
|
2273
2810
|
function A$1(n2, l2, t2) {
|
|
@@ -2312,7 +2849,7 @@ function j$2(n2, l2, t2, u2, i2) {
|
|
|
2312
2849
|
if ("string" == typeof u2 && (n2.style.cssText = u2 = ""), u2) for (l2 in u2) t2 && l2 in t2 || T$2(n2.style, l2, "");
|
|
2313
2850
|
if (t2) for (l2 in t2) u2 && t2[l2] === u2[l2] || T$2(n2.style, l2, t2[l2]);
|
|
2314
2851
|
}
|
|
2315
|
-
else if ("o" == l2[0] && "n" == l2[1]) r2 = l2 != (l2 = l2.replace(f$2, "$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 ? u2 ? t2.t = u2.t : (t2.t = c$1, n2.addEventListener(l2, r2 ? a$2 : s$
|
|
2852
|
+
else if ("o" == l2[0] && "n" == l2[1]) r2 = l2 != (l2 = l2.replace(f$2, "$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 ? u2 ? t2.t = u2.t : (t2.t = c$1, n2.addEventListener(l2, r2 ? a$2 : s$1, r2)) : n2.removeEventListener(l2, r2 ? a$2 : s$1, r2);
|
|
2316
2853
|
else {
|
|
2317
2854
|
if ("http://www.w3.org/2000/svg" == i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
2318
2855
|
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 {
|
|
@@ -2333,31 +2870,31 @@ function F$1(n2) {
|
|
|
2333
2870
|
}
|
|
2334
2871
|
};
|
|
2335
2872
|
}
|
|
2336
|
-
function O
|
|
2337
|
-
var a2,
|
|
2873
|
+
function O(n2, t2, u2, i2, r2, o2, e2, f2, c2, s2) {
|
|
2874
|
+
var a2, h2, p2, v2, y2, _2, m2, b, S2, C2, M2, $2, P2, A2, H2, L2, T2, j2 = t2.type;
|
|
2338
2875
|
if (void 0 !== t2.constructor) return null;
|
|
2339
2876
|
128 & u2.__u && (c2 = !!(32 & u2.__u), o2 = [f2 = t2.__e = u2.__e]), (a2 = l$1.__b) && a2(t2);
|
|
2340
2877
|
n: if ("function" == typeof j2) try {
|
|
2341
|
-
if (
|
|
2878
|
+
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, u2.__c ? m2 = (h2 = t2.__c = u2.__c).__ = h2.__E : (S2 ? t2.__c = h2 = new j2(b, M2) : (t2.__c = h2 = new x$3(b, M2), h2.constructor = j2, h2.render = D$1), C2 && C2.sub(h2), h2.props = b, h2.state || (h2.state = {}), h2.context = M2, h2.__n = i2, p2 = h2.__d = true, h2.__h = [], h2._sb = []), S2 && null == h2.__s && (h2.__s = h2.state), S2 && null != j2.getDerivedStateFromProps && (h2.__s == h2.state && (h2.__s = w$1({}, h2.__s)), w$1(h2.__s, j2.getDerivedStateFromProps(b, h2.__s))), v2 = h2.props, y2 = h2.state, h2.__v = t2, p2) S2 && null == j2.getDerivedStateFromProps && null != h2.componentWillMount && h2.componentWillMount(), S2 && null != h2.componentDidMount && h2.__h.push(h2.componentDidMount);
|
|
2342
2879
|
else {
|
|
2343
|
-
if (S2 && null == j2.getDerivedStateFromProps &&
|
|
2344
|
-
for (t2.__v != u2.__v && (
|
|
2880
|
+
if (S2 && null == j2.getDerivedStateFromProps && b !== v2 && null != h2.componentWillReceiveProps && h2.componentWillReceiveProps(b, M2), !h2.__e && (null != h2.shouldComponentUpdate && false === h2.shouldComponentUpdate(b, h2.__s, M2) || t2.__v == u2.__v)) {
|
|
2881
|
+
for (t2.__v != u2.__v && (h2.props = b, h2.state = h2.__s, h2.__d = false), t2.__e = u2.__e, t2.__k = u2.__k, t2.__k.some(function(n3) {
|
|
2345
2882
|
n3 && (n3.__ = t2);
|
|
2346
|
-
}), $2 = 0; $2 <
|
|
2347
|
-
|
|
2883
|
+
}), $2 = 0; $2 < h2._sb.length; $2++) h2.__h.push(h2._sb[$2]);
|
|
2884
|
+
h2._sb = [], h2.__h.length && e2.push(h2);
|
|
2348
2885
|
break n;
|
|
2349
2886
|
}
|
|
2350
|
-
null !=
|
|
2351
|
-
|
|
2887
|
+
null != h2.componentWillUpdate && h2.componentWillUpdate(b, h2.__s, M2), S2 && null != h2.componentDidUpdate && h2.__h.push(function() {
|
|
2888
|
+
h2.componentDidUpdate(v2, y2, _2);
|
|
2352
2889
|
});
|
|
2353
2890
|
}
|
|
2354
|
-
if (
|
|
2355
|
-
for (
|
|
2356
|
-
|
|
2891
|
+
if (h2.context = M2, h2.props = b, h2.__P = n2, h2.__e = false, P2 = l$1.__r, A2 = 0, S2) {
|
|
2892
|
+
for (h2.state = h2.__s, h2.__d = false, P2 && P2(t2), a2 = h2.render(h2.props, h2.state, h2.context), H2 = 0; H2 < h2._sb.length; H2++) h2.__h.push(h2._sb[H2]);
|
|
2893
|
+
h2._sb = [];
|
|
2357
2894
|
} else do {
|
|
2358
|
-
|
|
2359
|
-
} while (
|
|
2360
|
-
|
|
2895
|
+
h2.__d = false, P2 && P2(t2), a2 = h2.render(h2.props, h2.state, h2.context), h2.state = h2.__s;
|
|
2896
|
+
} while (h2.__d && ++A2 < 25);
|
|
2897
|
+
h2.state = h2.__s, null != h2.getChildContext && (i2 = w$1(w$1({}, i2), h2.getChildContext())), S2 && !p2 && null != h2.getSnapshotBeforeUpdate && (_2 = h2.getSnapshotBeforeUpdate(v2, y2)), L2 = a2, null != a2 && a2.type === k$1 && null == a2.key && (L2 = N$1(a2.props.children)), f2 = I(n2, d$1(L2) ? L2 : [L2], t2, u2, i2, r2, o2, e2, f2, c2, s2), h2.base = t2.__e, t2.__u &= -161, h2.__h.length && e2.push(h2), m2 && (h2.__E = h2.__ = null);
|
|
2361
2898
|
} catch (n3) {
|
|
2362
2899
|
if (t2.__v = null, c2 || null != o2) if (n3.then) {
|
|
2363
2900
|
for (t2.__u |= c2 ? 160 : 128; f2 && 8 == f2.nodeType && f2.nextSibling; ) f2 = f2.nextSibling;
|
|
@@ -2370,7 +2907,7 @@ function O$1(n2, t2, u2, i2, r2, o2, e2, f2, c2, s2) {
|
|
|
2370
2907
|
return (a2 = l$1.diffed) && a2(t2), 128 & t2.__u ? void 0 : f2;
|
|
2371
2908
|
}
|
|
2372
2909
|
function z$1(n2, t2, u2) {
|
|
2373
|
-
for (var i2 = 0; i2 < u2.length; i2++) q$
|
|
2910
|
+
for (var i2 = 0; i2 < u2.length; i2++) q$2(u2[i2], u2[++i2], u2[++i2]);
|
|
2374
2911
|
l$1.__c && l$1.__c(t2, n2), n2.some(function(t3) {
|
|
2375
2912
|
try {
|
|
2376
2913
|
n2 = t3.__h, t3.__h = [], n2.some(function(n3) {
|
|
@@ -2385,7 +2922,7 @@ function N$1(n2) {
|
|
|
2385
2922
|
return "object" != typeof n2 || null == n2 ? n2 : d$1(n2) ? n2.map(N$1) : w$1({}, n2);
|
|
2386
2923
|
}
|
|
2387
2924
|
function V$1(t2, u2, i2, r2, o2, e2, f2, c2, s2) {
|
|
2388
|
-
var a2,
|
|
2925
|
+
var a2, h2, v2, y2, w2, _2, m2, b = i2.props, k2 = u2.props, x2 = u2.type;
|
|
2389
2926
|
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) {
|
|
2390
2927
|
for (a2 = 0; a2 < e2.length; a2++) if ((w2 = e2[a2]) && "setAttribute" in w2 == !!x2 && (x2 ? w2.localName == x2 : 3 == w2.nodeType)) {
|
|
2391
2928
|
t2 = w2, e2[a2] = null;
|
|
@@ -2396,23 +2933,23 @@ function V$1(t2, u2, i2, r2, o2, e2, f2, c2, s2) {
|
|
|
2396
2933
|
if (null == x2) return document.createTextNode(k2);
|
|
2397
2934
|
t2 = document.createElementNS(o2, x2, k2.is && k2), c2 && (l$1.__m && l$1.__m(u2, e2), c2 = false), e2 = null;
|
|
2398
2935
|
}
|
|
2399
|
-
if (null === x2)
|
|
2936
|
+
if (null === x2) b === k2 || c2 && t2.data === k2 || (t2.data = k2);
|
|
2400
2937
|
else {
|
|
2401
|
-
if (e2 = e2 && n.call(t2.childNodes),
|
|
2402
|
-
for (a2 in
|
|
2938
|
+
if (e2 = e2 && n.call(t2.childNodes), b = i2.props || p$1, !c2 && null != e2) for (b = {}, a2 = 0; a2 < t2.attributes.length; a2++) b[(w2 = t2.attributes[a2]).name] = w2.value;
|
|
2939
|
+
for (a2 in b) if (w2 = b[a2], "children" == a2) ;
|
|
2403
2940
|
else if ("dangerouslySetInnerHTML" == a2) v2 = w2;
|
|
2404
2941
|
else if (!(a2 in k2)) {
|
|
2405
2942
|
if ("value" == a2 && "defaultValue" in k2 || "checked" == a2 && "defaultChecked" in k2) continue;
|
|
2406
2943
|
j$2(t2, a2, null, w2, o2);
|
|
2407
2944
|
}
|
|
2408
|
-
for (a2 in k2) w2 = k2[a2], "children" == a2 ? y2 = w2 : "dangerouslySetInnerHTML" == a2 ?
|
|
2409
|
-
if (
|
|
2945
|
+
for (a2 in k2) w2 = k2[a2], "children" == a2 ? y2 = w2 : "dangerouslySetInnerHTML" == a2 ? h2 = w2 : "value" == a2 ? _2 = w2 : "checked" == a2 ? m2 = w2 : c2 && "function" != typeof w2 || b[a2] === w2 || j$2(t2, a2, w2, b[a2], o2);
|
|
2946
|
+
if (h2) c2 || v2 && (h2.__html === v2.__html || h2.__html === t2.innerHTML) || (t2.innerHTML = h2.__html), u2.__k = [];
|
|
2410
2947
|
else if (v2 && (t2.innerHTML = ""), I("template" === u2.type ? t2.content : t2, d$1(y2) ? y2 : [y2], u2, 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$1(e2[a2]);
|
|
2411
|
-
c2 || (a2 = "value", "progress" == x2 && null == _2 ? t2.removeAttribute("value") : void 0 !== _2 && (_2 !== t2[a2] || "progress" == x2 && !_2 || "option" == x2 && _2 !==
|
|
2948
|
+
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$2(t2, a2, _2, b[a2], o2), a2 = "checked", void 0 !== m2 && m2 !== t2[a2] && j$2(t2, a2, m2, b[a2], o2));
|
|
2412
2949
|
}
|
|
2413
2950
|
return t2;
|
|
2414
2951
|
}
|
|
2415
|
-
function q$
|
|
2952
|
+
function q$2(n2, t2, u2) {
|
|
2416
2953
|
try {
|
|
2417
2954
|
if ("function" == typeof n2) {
|
|
2418
2955
|
var i2 = "function" == typeof n2.__u;
|
|
@@ -2422,9 +2959,9 @@ function q$3(n2, t2, u2) {
|
|
|
2422
2959
|
l$1.__e(n3, u2);
|
|
2423
2960
|
}
|
|
2424
2961
|
}
|
|
2425
|
-
function B$
|
|
2962
|
+
function B$2(n2, t2, u2) {
|
|
2426
2963
|
var i2, r2;
|
|
2427
|
-
if (l$1.unmount && l$1.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || q$
|
|
2964
|
+
if (l$1.unmount && l$1.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || q$2(i2, null, t2)), null != (i2 = n2.__c)) {
|
|
2428
2965
|
if (i2.componentWillUnmount) try {
|
|
2429
2966
|
i2.componentWillUnmount();
|
|
2430
2967
|
} catch (n3) {
|
|
@@ -2432,7 +2969,7 @@ function B$3(n2, t2, u2) {
|
|
|
2432
2969
|
}
|
|
2433
2970
|
i2.base = i2.__P = null;
|
|
2434
2971
|
}
|
|
2435
|
-
if (i2 = n2.__k) for (r2 = 0; r2 < i2.length; r2++) i2[r2] && B$
|
|
2972
|
+
if (i2 = n2.__k) for (r2 = 0; r2 < i2.length; r2++) i2[r2] && B$2(i2[r2], t2, u2 || "function" != typeof n2.type);
|
|
2436
2973
|
u2 || g$1(n2.__e), n2.__c = n2.__ = n2.__e = void 0;
|
|
2437
2974
|
}
|
|
2438
2975
|
function D$1(n2, l2, t2) {
|
|
@@ -2440,7 +2977,7 @@ function D$1(n2, l2, t2) {
|
|
|
2440
2977
|
}
|
|
2441
2978
|
function E$1(t2, u2, i2) {
|
|
2442
2979
|
var r2, o2, e2, f2;
|
|
2443
|
-
u2 == document && (u2 = document.documentElement), l$1.__ && l$1.__(t2, u2), o2 = (r2 = false) ? null : u2.__k, e2 = [], f2 = [], O
|
|
2980
|
+
u2 == document && (u2 = document.documentElement), l$1.__ && l$1.__(t2, u2), o2 = (r2 = false) ? null : u2.__k, e2 = [], f2 = [], O(u2, t2 = u2.__k = _$1(k$1, null, [t2]), o2 || p$1, p$1, u2.namespaceURI, o2 ? null : u2.firstChild ? n.call(u2.childNodes) : null, e2, o2 ? o2.__e : u2.firstChild, r2, f2), z$1(e2, t2, f2);
|
|
2444
2981
|
}
|
|
2445
2982
|
function K$1(n2) {
|
|
2446
2983
|
function l2(n3) {
|
|
@@ -2472,15 +3009,15 @@ n = v$1.slice, l$1 = { __e: function(n2, l2, t2, u2) {
|
|
|
2472
3009
|
n2 = l3;
|
|
2473
3010
|
}
|
|
2474
3011
|
throw n2;
|
|
2475
|
-
} }, t$1 = 0, x$
|
|
3012
|
+
} }, t$1 = 0, x$3.prototype.setState = function(n2, l2) {
|
|
2476
3013
|
var t2;
|
|
2477
3014
|
t2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = w$1({}, this.state), "function" == typeof n2 && (n2 = n2(w$1({}, t2), this.props)), n2 && w$1(t2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), M(this));
|
|
2478
|
-
}, x$
|
|
3015
|
+
}, x$3.prototype.forceUpdate = function(n2) {
|
|
2479
3016
|
this.__v && (this.__e = true, n2 && this.__h.push(n2), M(this));
|
|
2480
|
-
}, x$
|
|
3017
|
+
}, x$3.prototype.render = k$1, i$1 = [], o$1 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e$1 = function(n2, l2) {
|
|
2481
3018
|
return n2.__v.__b - l2.__v.__b;
|
|
2482
|
-
}, $.__r = 0, f$2 = /(PointerCapture)$|Capture$/i, c$1 = 0, s$
|
|
2483
|
-
var t, r$1, u$1, i, o = 0, f$1 = [], c = l$1, e = c.__b, a$1 = c.__r, v = c.diffed, l = c.__c, m = c.unmount, s
|
|
3019
|
+
}, $.__r = 0, f$2 = /(PointerCapture)$|Capture$/i, c$1 = 0, s$1 = F$1(false), a$2 = F$1(true), h$1 = 0;
|
|
3020
|
+
var t, r$1, u$1, i, o = 0, f$1 = [], c = l$1, e = c.__b, a$1 = c.__r, v = c.diffed, l = c.__c, m = c.unmount, s = c.__;
|
|
2484
3021
|
function p(n2, t2) {
|
|
2485
3022
|
c.__h && c.__h(r$1, n2, o || t2), o = 0;
|
|
2486
3023
|
var u2 = r$1.__H || (r$1.__H = { __: [], __h: [] });
|
|
@@ -2540,12 +3077,12 @@ function T$1(n2, r2) {
|
|
|
2540
3077
|
var u2 = p(t++, 7);
|
|
2541
3078
|
return C$1(u2.__H, r2) && (u2.__ = n2(), u2.__H = r2, u2.__h = n2), u2.__;
|
|
2542
3079
|
}
|
|
2543
|
-
function q$
|
|
3080
|
+
function q$1(n2, t2) {
|
|
2544
3081
|
return o = 8, T$1(function() {
|
|
2545
3082
|
return n2;
|
|
2546
3083
|
}, t2);
|
|
2547
3084
|
}
|
|
2548
|
-
function x$
|
|
3085
|
+
function x$2(n2) {
|
|
2549
3086
|
var u2 = r$1.context[n2.__c], i2 = p(t++, 9);
|
|
2550
3087
|
return i2.c = n2, u2 ? (null == i2.__ && (i2.__ = true, u2.sub(r$1)), u2.props.value) : n2.__;
|
|
2551
3088
|
}
|
|
@@ -2554,7 +3091,7 @@ function P$1(n2, t2) {
|
|
|
2554
3091
|
}
|
|
2555
3092
|
function j$1() {
|
|
2556
3093
|
for (var n2; n2 = f$1.shift(); ) if (n2.__P && n2.__H) try {
|
|
2557
|
-
n2.__H.__h.forEach(z), n2.__H.__h.forEach(B$
|
|
3094
|
+
n2.__H.__h.forEach(z), n2.__H.__h.forEach(B$1), n2.__H.__h = [];
|
|
2558
3095
|
} catch (t2) {
|
|
2559
3096
|
n2.__H.__h = [], c.__e(t2, n2.__v);
|
|
2560
3097
|
}
|
|
@@ -2562,13 +3099,13 @@ function j$1() {
|
|
|
2562
3099
|
c.__b = function(n2) {
|
|
2563
3100
|
r$1 = null, e && e(n2);
|
|
2564
3101
|
}, c.__ = function(n2, t2) {
|
|
2565
|
-
n2 && t2.__k && t2.__k.__m && (n2.__m = t2.__k.__m), s
|
|
3102
|
+
n2 && t2.__k && t2.__k.__m && (n2.__m = t2.__k.__m), s && s(n2, t2);
|
|
2566
3103
|
}, c.__r = function(n2) {
|
|
2567
3104
|
a$1 && a$1(n2), t = 0;
|
|
2568
3105
|
var i2 = (r$1 = n2.__c).__H;
|
|
2569
3106
|
i2 && (u$1 === r$1 ? (i2.__h = [], r$1.__h = [], i2.__.forEach(function(n3) {
|
|
2570
3107
|
n3.__N && (n3.__ = n3.__N), n3.u = n3.__N = void 0;
|
|
2571
|
-
})) : (i2.__h.forEach(z), i2.__h.forEach(B$
|
|
3108
|
+
})) : (i2.__h.forEach(z), i2.__h.forEach(B$1), i2.__h = [], t = 0)), u$1 = r$1;
|
|
2572
3109
|
}, c.diffed = function(n2) {
|
|
2573
3110
|
v && v(n2);
|
|
2574
3111
|
var t2 = n2.__c;
|
|
@@ -2579,7 +3116,7 @@ c.__b = function(n2) {
|
|
|
2579
3116
|
t2.some(function(n3) {
|
|
2580
3117
|
try {
|
|
2581
3118
|
n3.__h.forEach(z), n3.__h = n3.__h.filter(function(n4) {
|
|
2582
|
-
return !n4.__ || B$
|
|
3119
|
+
return !n4.__ || B$1(n4);
|
|
2583
3120
|
});
|
|
2584
3121
|
} catch (r2) {
|
|
2585
3122
|
t2.some(function(n4) {
|
|
@@ -2609,7 +3146,7 @@ function z(n2) {
|
|
|
2609
3146
|
var t2 = r$1, u2 = n2.__c;
|
|
2610
3147
|
"function" == typeof u2 && (n2.__c = void 0, u2()), r$1 = t2;
|
|
2611
3148
|
}
|
|
2612
|
-
function B$
|
|
3149
|
+
function B$1(n2) {
|
|
2613
3150
|
var t2 = r$1;
|
|
2614
3151
|
n2.__c = n2.__(), r$1 = t2;
|
|
2615
3152
|
}
|
|
@@ -2633,14 +3170,14 @@ function E(n2, t2) {
|
|
|
2633
3170
|
function C(n2, t2) {
|
|
2634
3171
|
var e2 = t2(), r2 = d({ t: { __: e2, u: t2 } }), u2 = r2[0].t, o2 = r2[1];
|
|
2635
3172
|
return _(function() {
|
|
2636
|
-
u2.__ = e2, u2.u = t2, x(u2) && o2({ t: u2 });
|
|
3173
|
+
u2.__ = e2, u2.u = t2, x$1(u2) && o2({ t: u2 });
|
|
2637
3174
|
}, [n2, e2, t2]), y$2(function() {
|
|
2638
|
-
return x(u2) && o2({ t: u2 }), n2(function() {
|
|
2639
|
-
x(u2) && o2({ t: u2 });
|
|
3175
|
+
return x$1(u2) && o2({ t: u2 }), n2(function() {
|
|
3176
|
+
x$1(u2) && o2({ t: u2 });
|
|
2640
3177
|
});
|
|
2641
3178
|
}, [n2]), e2;
|
|
2642
3179
|
}
|
|
2643
|
-
function x(n2) {
|
|
3180
|
+
function x$1(n2) {
|
|
2644
3181
|
var t2, e2, r2 = n2.u, u2 = n2.__;
|
|
2645
3182
|
try {
|
|
2646
3183
|
var o2 = r2();
|
|
@@ -2652,7 +3189,7 @@ function x(n2) {
|
|
|
2652
3189
|
function N(n2, t2) {
|
|
2653
3190
|
this.props = n2, this.context = t2;
|
|
2654
3191
|
}
|
|
2655
|
-
(N.prototype = new x$
|
|
3192
|
+
(N.prototype = new x$3()).isPureReactComponent = true, N.prototype.shouldComponentUpdate = function(n2, t2) {
|
|
2656
3193
|
return E(this.props, n2) || E(this.state, t2);
|
|
2657
3194
|
};
|
|
2658
3195
|
var T = l$1.__b;
|
|
@@ -2686,13 +3223,13 @@ function j(n2) {
|
|
|
2686
3223
|
var t2 = n2.__.__c;
|
|
2687
3224
|
return t2 && t2.__a && t2.__a(n2);
|
|
2688
3225
|
}
|
|
2689
|
-
function B
|
|
3226
|
+
function B() {
|
|
2690
3227
|
this.i = null, this.l = null;
|
|
2691
3228
|
}
|
|
2692
3229
|
l$1.unmount = function(n2) {
|
|
2693
3230
|
var t2 = n2.__c;
|
|
2694
3231
|
t2 && t2.__R && t2.__R(), t2 && 32 & n2.__u && (n2.type = null), U && U(n2);
|
|
2695
|
-
}, (P.prototype = new x$
|
|
3232
|
+
}, (P.prototype = new x$3()).__c = function(n2, t2) {
|
|
2696
3233
|
var e2 = t2.__c, r2 = this;
|
|
2697
3234
|
null == r2.o && (r2.o = []), r2.o.push(e2);
|
|
2698
3235
|
var u2 = j(r2.__v), o2 = false, i2 = function() {
|
|
@@ -2730,7 +3267,7 @@ var H = function(n2, t2, e2) {
|
|
|
2730
3267
|
n2.i = e2 = e2[2];
|
|
2731
3268
|
}
|
|
2732
3269
|
};
|
|
2733
|
-
(B
|
|
3270
|
+
(B.prototype = new x$3()).__a = function(n2) {
|
|
2734
3271
|
var t2 = this, e2 = j(t2.__v), r2 = t2.l.get(n2);
|
|
2735
3272
|
return r2[0]++, function(u2) {
|
|
2736
3273
|
var o2 = function() {
|
|
@@ -2738,23 +3275,23 @@ var H = function(n2, t2, e2) {
|
|
|
2738
3275
|
};
|
|
2739
3276
|
e2 ? e2(o2) : o2();
|
|
2740
3277
|
};
|
|
2741
|
-
}, B
|
|
3278
|
+
}, B.prototype.render = function(n2) {
|
|
2742
3279
|
this.i = null, this.l = /* @__PURE__ */ new Map();
|
|
2743
3280
|
var t2 = H$1(n2.children);
|
|
2744
3281
|
n2.revealOrder && "b" === n2.revealOrder[0] && t2.reverse();
|
|
2745
3282
|
for (var e2 = t2.length; e2--; ) this.l.set(t2[e2], this.i = [1, 0, this.i]);
|
|
2746
3283
|
return n2.children;
|
|
2747
|
-
}, B
|
|
3284
|
+
}, B.prototype.componentDidUpdate = B.prototype.componentDidMount = function() {
|
|
2748
3285
|
var n2 = this;
|
|
2749
3286
|
this.l.forEach(function(t2, e2) {
|
|
2750
3287
|
H(n2, e2, t2);
|
|
2751
3288
|
});
|
|
2752
3289
|
};
|
|
2753
|
-
var q
|
|
3290
|
+
var q = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103, G = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, J = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, K = /[A-Z0-9]/g, Q = "undefined" != typeof document, X = function(n2) {
|
|
2754
3291
|
return ("undefined" != typeof Symbol && "symbol" == typeof Symbol() ? /fil|che|rad/ : /fil|che|ra/).test(n2);
|
|
2755
3292
|
};
|
|
2756
|
-
x$
|
|
2757
|
-
Object.defineProperty(x$
|
|
3293
|
+
x$3.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(t2) {
|
|
3294
|
+
Object.defineProperty(x$3.prototype, t2, { configurable: true, get: function() {
|
|
2758
3295
|
return this["UNSAFE_" + t2];
|
|
2759
3296
|
}, set: function(n2) {
|
|
2760
3297
|
Object.defineProperty(this, t2, { configurable: true, writable: true, value: n2 });
|
|
@@ -2782,7 +3319,7 @@ l$1.vnode = function(n2) {
|
|
|
2782
3319
|
var c2 = t2[i2];
|
|
2783
3320
|
if (!("value" === i2 && "defaultValue" in t2 && null == c2 || Q && "children" === i2 && "noscript" === e2 || "class" === i2 || "className" === i2)) {
|
|
2784
3321
|
var l2 = i2.toLowerCase();
|
|
2785
|
-
"defaultValue" === i2 && "value" in t2 && null == t2.value ? i2 = "value" : "download" === i2 && true === c2 ? c2 = "" : "translate" === l2 && "no" === c2 ? c2 = false : "o" === l2[0] && "n" === l2[1] ? "ondoubleclick" === l2 ? i2 = "ondblclick" : "onchange" !== l2 || "input" !== e2 && "textarea" !== e2 || X(t2.type) ? "onfocus" === l2 ? i2 = "onfocusin" : "onblur" === l2 ? i2 = "onfocusout" : J.test(i2) && (i2 = l2) : l2 = i2 = "oninput" : o2 && G
|
|
3322
|
+
"defaultValue" === i2 && "value" in t2 && null == t2.value ? i2 = "value" : "download" === i2 && true === c2 ? c2 = "" : "translate" === l2 && "no" === c2 ? c2 = false : "o" === l2[0] && "n" === l2[1] ? "ondoubleclick" === l2 ? i2 = "ondblclick" : "onchange" !== l2 || "input" !== e2 && "textarea" !== e2 || X(t2.type) ? "onfocus" === l2 ? i2 = "onfocusin" : "onblur" === l2 ? i2 = "onfocusout" : J.test(i2) && (i2 = l2) : l2 = i2 = "oninput" : o2 && G.test(i2) ? i2 = i2.replace(K, "-$&").toLowerCase() : null === c2 && (c2 = void 0), "oninput" === l2 && u2[i2 = l2] && (i2 = "oninputCapture"), u2[i2] = c2;
|
|
2786
3323
|
}
|
|
2787
3324
|
}
|
|
2788
3325
|
"select" == e2 && u2.multiple && Array.isArray(u2.value) && (u2.value = H$1(t2.children).forEach(function(n4) {
|
|
@@ -2790,7 +3327,7 @@ l$1.vnode = function(n2) {
|
|
|
2790
3327
|
})), "select" == e2 && null != u2.defaultValue && (u2.value = H$1(t2.children).forEach(function(n4) {
|
|
2791
3328
|
n4.props.selected = u2.multiple ? -1 != u2.defaultValue.indexOf(n4.props.value) : u2.defaultValue == n4.props.value;
|
|
2792
3329
|
})), t2.class && !t2.className ? (u2.class = t2.class, Object.defineProperty(u2, "className", ln)) : (t2.className && !t2.class || t2.class && t2.className) && (u2.class = u2.className = t2.className), n3.props = u2;
|
|
2793
|
-
}(n2), n2.$$typeof = q
|
|
3330
|
+
}(n2), n2.$$typeof = q, fn && fn(n2);
|
|
2794
3331
|
};
|
|
2795
3332
|
var an = l$1.__r;
|
|
2796
3333
|
l$1.__r = function(n2) {
|
|
@@ -2803,19 +3340,34 @@ l$1.diffed = function(n2) {
|
|
|
2803
3340
|
null != e2 && "textarea" === n2.type && "value" in t2 && t2.value !== e2.value && (e2.value = null == t2.value ? "" : t2.value);
|
|
2804
3341
|
};
|
|
2805
3342
|
var Rn = { useState: d, useEffect: y$2, useLayoutEffect: _, useSyncExternalStore: C, useRef: A, useMemo: T$1, useDebugValue: P$1 };
|
|
2806
|
-
var r = (e2) => !e2 && e2 == null, y$1 = (e2) => !r(e2), a = (e2) => typeof e2 == "object" && !Array.isArray(e2) && y$1(e2)
|
|
2807
|
-
var
|
|
2808
|
-
var
|
|
2809
|
-
if (typeof
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
if (
|
|
2817
|
-
|
|
2818
|
-
|
|
3343
|
+
var r = (e2) => !e2 && e2 == null, y$1 = (e2) => !r(e2), a = (e2) => typeof e2 == "object" && !Array.isArray(e2) && y$1(e2);
|
|
3344
|
+
var isObject$2 = (input) => a(input);
|
|
3345
|
+
var keyOfEntity = (entity) => {
|
|
3346
|
+
if (typeof entity === "string") {
|
|
3347
|
+
return entityOfKey(entity) ? entity : null;
|
|
3348
|
+
}
|
|
3349
|
+
if (!(entity == null ? void 0 : entity._type)) {
|
|
3350
|
+
return null;
|
|
3351
|
+
}
|
|
3352
|
+
let entityId = null;
|
|
3353
|
+
if (y$1(entity.id) || y$1(entity._id)) {
|
|
3354
|
+
entityId = `${entity.id ?? entity._id}`;
|
|
3355
|
+
}
|
|
3356
|
+
return !entityId ? entityId : `${entity._type}:${entityId}`;
|
|
3357
|
+
};
|
|
3358
|
+
var entityOfKey = (entity) => {
|
|
3359
|
+
if (isObject$2(entity) && (entity == null ? void 0 : entity._type) && keyOfEntity(entity)) {
|
|
3360
|
+
return entity;
|
|
3361
|
+
}
|
|
3362
|
+
if (!entity || typeof entity !== "string")
|
|
3363
|
+
return null;
|
|
3364
|
+
const [typeName, ...restTypes] = entity.split(":");
|
|
3365
|
+
if (!typeName || restTypes.length < 1)
|
|
3366
|
+
return null;
|
|
3367
|
+
return {
|
|
3368
|
+
_type: typeName,
|
|
3369
|
+
_id: restTypes.join(":")
|
|
3370
|
+
};
|
|
2819
3371
|
};
|
|
2820
3372
|
(function() {
|
|
2821
3373
|
try {
|
|
@@ -2949,12 +3501,13 @@ const variableTransforms = createConstants(
|
|
|
2949
3501
|
);
|
|
2950
3502
|
const renderTarget = createConstants("canvas", "document");
|
|
2951
3503
|
const renderMode = createConstants("viewport", "parent", "fixed");
|
|
2952
|
-
const interactions = createConstants("click", "mouseover");
|
|
2953
|
-
const eventMode = createConstants("goal", "callback");
|
|
3504
|
+
const interactions = createConstants("click", "mouseover", "appear");
|
|
3505
|
+
const eventMode = createConstants("goal", "callback", "tracker");
|
|
2954
3506
|
const scopeTypes = createConstants(
|
|
2955
3507
|
"InstanceScope",
|
|
2956
3508
|
"FragmentScope",
|
|
2957
|
-
"CollectionScope"
|
|
3509
|
+
"CollectionScope",
|
|
3510
|
+
"CollectionItemScope"
|
|
2958
3511
|
);
|
|
2959
3512
|
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2960
3513
|
__proto__: null,
|
|
@@ -3811,8 +4364,28 @@ const PositionSchema = /* @__PURE__ */ object({
|
|
|
3811
4364
|
position: layerField(/* @__PURE__ */ enum_(Object.keys(positionType)), {
|
|
3812
4365
|
fallback: positionType.absolute
|
|
3813
4366
|
}),
|
|
3814
|
-
top: layerField(/* @__PURE__ */ number(), {
|
|
3815
|
-
|
|
4367
|
+
top: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
4368
|
+
fallback: null,
|
|
4369
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
4370
|
+
}),
|
|
4371
|
+
left: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
4372
|
+
fallback: null,
|
|
4373
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
4374
|
+
}),
|
|
4375
|
+
right: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
4376
|
+
fallback: null,
|
|
4377
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
4378
|
+
}),
|
|
4379
|
+
bottom: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
|
|
4380
|
+
fallback: null,
|
|
4381
|
+
transform: (value) => typeof value === "number" ? Math.ceil(value) : value
|
|
4382
|
+
}),
|
|
4383
|
+
centerAnchorX: layerField(/* @__PURE__ */ number(), {
|
|
4384
|
+
fallback: 0.5
|
|
4385
|
+
}),
|
|
4386
|
+
centerAnchorY: layerField(/* @__PURE__ */ number(), {
|
|
4387
|
+
fallback: 0.5
|
|
4388
|
+
})
|
|
3816
4389
|
});
|
|
3817
4390
|
const SceneSchema = /* @__PURE__ */ object({
|
|
3818
4391
|
opacity: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0), /* @__PURE__ */ maxValue(1)), {
|
|
@@ -3820,6 +4393,7 @@ const SceneSchema = /* @__PURE__ */ object({
|
|
|
3820
4393
|
variable: true
|
|
3821
4394
|
}),
|
|
3822
4395
|
visible: layerField(/* @__PURE__ */ boolean(), { fallback: true, variable: true }),
|
|
4396
|
+
rotate: layerField(/* @__PURE__ */ number(), { fallback: null }),
|
|
3823
4397
|
zIndex: layerField(/* @__PURE__ */ number(), { fallback: -1 })
|
|
3824
4398
|
});
|
|
3825
4399
|
const FillSchema = /* @__PURE__ */ object({
|
|
@@ -3969,33 +4543,22 @@ const TextSchema = /* @__PURE__ */ object({
|
|
|
3969
4543
|
whiteSpace: layerField(/* @__PURE__ */ enum_(Object.keys(whiteSpace)), {
|
|
3970
4544
|
fallback: whiteSpace.pre
|
|
3971
4545
|
}),
|
|
3972
|
-
|
|
4546
|
+
textAlign: layerField(/* @__PURE__ */ string(), { fallback: "left" }),
|
|
3973
4547
|
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
3974
|
-
attributes: /* @__PURE__ */ optional(
|
|
3975
|
-
/* @__PURE__ */ object({
|
|
3976
|
-
fontSize: layerField(/* @__PURE__ */ string(), { fallback: "14px" }),
|
|
3977
|
-
color: layerField(/* @__PURE__ */ string(), { fallback: "#000", variable: true }),
|
|
3978
|
-
lineHeight: layerField(/* @__PURE__ */ string(), { fallback: "14px" }),
|
|
3979
|
-
fontWeight: layerField(/* @__PURE__ */ string(), { fallback: "normal" }),
|
|
3980
|
-
letterSpacing: layerField(/* @__PURE__ */ string(), { fallback: "0px" }),
|
|
3981
|
-
textTransform: layerField(/* @__PURE__ */ string(), { fallback: "none" }),
|
|
3982
|
-
textDecoration: layerField(/* @__PURE__ */ string(), { fallback: "none" }),
|
|
3983
|
-
whiteSpace: layerField(/* @__PURE__ */ string(), { fallback: "pre" }),
|
|
3984
|
-
textAlign: layerField(/* @__PURE__ */ string(), { fallback: "left" })
|
|
3985
|
-
})
|
|
3986
|
-
),
|
|
3987
4548
|
...GraphFieldSchema.entries,
|
|
3988
4549
|
...OverridesSchema.entries,
|
|
3989
4550
|
...CssOverrideSchema.entries,
|
|
3990
4551
|
...PositionSchema.entries,
|
|
3991
4552
|
...SceneSchema.entries,
|
|
3992
|
-
...SizeSchema.entries
|
|
4553
|
+
...SizeSchema.entries,
|
|
4554
|
+
...InteractionsSchema.entries,
|
|
4555
|
+
...LinkSchema.entries
|
|
3993
4556
|
});
|
|
3994
4557
|
const FragmentSchema = /* @__PURE__ */ object({
|
|
3995
4558
|
name: layerField(/* @__PURE__ */ string(), { fallback: "Fragment", overridable: false }),
|
|
3996
4559
|
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
3997
4560
|
horizontalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
|
|
3998
|
-
fallback: fragmentGrowingMode.
|
|
4561
|
+
fallback: fragmentGrowingMode.fill,
|
|
3999
4562
|
overridable: false
|
|
4000
4563
|
}),
|
|
4001
4564
|
verticalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
|
|
@@ -4036,6 +4599,7 @@ const InstanceSchema = /* @__PURE__ */ object({
|
|
|
4036
4599
|
...PositionSchema.entries,
|
|
4037
4600
|
...SizeSchema.entries,
|
|
4038
4601
|
...SceneSchema.entries,
|
|
4602
|
+
...InteractionsSchema.entries,
|
|
4039
4603
|
...LinkSchema.entries
|
|
4040
4604
|
});
|
|
4041
4605
|
const NumberVariableSchema = /* @__PURE__ */ object({
|
|
@@ -4220,7 +4784,7 @@ const ArrayVariableSchema = /* @__PURE__ */ object({
|
|
|
4220
4784
|
}),
|
|
4221
4785
|
parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
|
|
4222
4786
|
defaultValue: layerField(/* @__PURE__ */ array(/* @__PURE__ */ any()), { fallback: [] }),
|
|
4223
|
-
definition: layerField(
|
|
4787
|
+
definition: layerField(linkValidator, { fallback: null }),
|
|
4224
4788
|
required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
|
|
4225
4789
|
...GraphFieldSchema.entries
|
|
4226
4790
|
});
|
|
@@ -4252,7 +4816,7 @@ const getLayerSchema = (layer) => {
|
|
|
4252
4816
|
const isObject$1 = (x2) => !!x2 && typeof x2 === "object" && !Array.isArray(x2);
|
|
4253
4817
|
const normalizeLayer = (schema, rawLayer, options2) => {
|
|
4254
4818
|
try {
|
|
4255
|
-
if (!rawLayer) return null;
|
|
4819
|
+
if (!rawLayer || !schema.entries) return null;
|
|
4256
4820
|
const withFallback = (options2 == null ? void 0 : options2.withFallback) ?? true;
|
|
4257
4821
|
const overrideTarget = options2 == null ? void 0 : options2.overrideTarget;
|
|
4258
4822
|
const parsedLayer = parse(schema, rawLayer);
|
|
@@ -4265,6 +4829,13 @@ const normalizeLayer = (schema, rawLayer, options2) => {
|
|
|
4265
4829
|
if (isObject$1(layerValue) && isObject$1(overrideValue)) {
|
|
4266
4830
|
layerValue = { ...overrideValue, ...layerValue };
|
|
4267
4831
|
}
|
|
4832
|
+
if (schemaEntity && "wrapped" in schemaEntity && "entries" in schemaEntity.wrapped && isObject$1(schemaEntity.wrapped.entries)) {
|
|
4833
|
+
layerValue = normalizeLayer(
|
|
4834
|
+
schemaEntity.wrapped,
|
|
4835
|
+
layerValue,
|
|
4836
|
+
options2
|
|
4837
|
+
);
|
|
4838
|
+
}
|
|
4268
4839
|
const resultValue = layerValue ?? overrideValue ?? fallback;
|
|
4269
4840
|
return [key, resultValue];
|
|
4270
4841
|
})
|
|
@@ -4274,12 +4845,13 @@ const normalizeLayer = (schema, rawLayer, options2) => {
|
|
|
4274
4845
|
return null;
|
|
4275
4846
|
}
|
|
4276
4847
|
};
|
|
4277
|
-
const getNormalizeLayer$1 = (layer, overrider) => {
|
|
4848
|
+
const getNormalizeLayer$1 = (layer, overrider, withFallback) => {
|
|
4278
4849
|
if (!layer) return null;
|
|
4279
4850
|
const schema = getLayerSchema(layer);
|
|
4280
4851
|
if (!schema) return null;
|
|
4281
4852
|
return normalizeLayer(schema, layer, {
|
|
4282
|
-
overrideTarget: overrider
|
|
4853
|
+
overrideTarget: overrider,
|
|
4854
|
+
withFallback
|
|
4283
4855
|
});
|
|
4284
4856
|
};
|
|
4285
4857
|
function findSchemaByPath(schema, path) {
|
|
@@ -4310,7 +4882,7 @@ const RenderTargetContext = K$1(
|
|
|
4310
4882
|
);
|
|
4311
4883
|
RenderTargetContext.Provider;
|
|
4312
4884
|
const useRenderTarget = () => {
|
|
4313
|
-
const renderTarget2 = x$
|
|
4885
|
+
const renderTarget2 = x$2(RenderTargetContext);
|
|
4314
4886
|
return {
|
|
4315
4887
|
renderTarget: renderTarget2,
|
|
4316
4888
|
isCanvas: renderTarget2 === index.renderTarget.canvas,
|
|
@@ -4468,35 +5040,37 @@ function requireWithSelector() {
|
|
|
4468
5040
|
return withSelector.exports;
|
|
4469
5041
|
}
|
|
4470
5042
|
var withSelectorExports = requireWithSelector();
|
|
4471
|
-
var
|
|
5043
|
+
var x = (t2) => t2, y = (t2, e2, n2) => {
|
|
4472
5044
|
var _a, _b;
|
|
4473
|
-
let r2 = A((_a = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a.call(t2, e2, n2)),
|
|
5045
|
+
let r2 = A((_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 = q$1((p2) => {
|
|
4474
5046
|
var _a2, _b2;
|
|
4475
|
-
return
|
|
5047
|
+
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, () => {
|
|
4476
5048
|
var _a3;
|
|
4477
|
-
return r2.current = (_a3 = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a3.call(t2,
|
|
5049
|
+
return r2.current = (_a3 = t2 == null ? void 0 : t2.resolve) == null ? void 0 : _a3.call(t2, s2, n2), p2();
|
|
4478
5050
|
}, n2)) : () => {
|
|
4479
5051
|
};
|
|
4480
|
-
}, [t2,
|
|
4481
|
-
let
|
|
4482
|
-
e2 &&
|
|
4483
|
-
}, [t2, e2]),
|
|
4484
|
-
return [withSelectorExports.useSyncExternalStoreWithSelector(
|
|
4485
|
-
};
|
|
4486
|
-
var
|
|
4487
|
-
let r2 = q$
|
|
5052
|
+
}, [t2, s2]), a2 = q$1((p2, c2) => {
|
|
5053
|
+
let u2 = typeof e2 == "string" ? e2 : keyOfEntity(e2);
|
|
5054
|
+
e2 && u2 && t2.mutate(u2, p2, c2);
|
|
5055
|
+
}, [t2, e2]), i2 = () => (n2 == null ? void 0 : n2.pause) ? null : r2.current;
|
|
5056
|
+
return [withSelectorExports.useSyncExternalStoreWithSelector(o2, i2, i2, x), a2];
|
|
5057
|
+
};
|
|
5058
|
+
var R = (t2) => t2, S = (t2, e2, n2) => {
|
|
5059
|
+
let r2 = q$1((c2) => c2.map((u2) => t2.resolve(u2, n2)).filter(Boolean), [t2, n2]), s2 = T$1(() => e2.map((c2) => t2.keyOfEntity(c2) || c2).join(), [e2]), o2 = A(r2(e2));
|
|
5060
|
+
A([]);
|
|
5061
|
+
let i2 = q$1((c2) => {
|
|
4488
5062
|
if (e2) {
|
|
4489
5063
|
let u2 = () => {
|
|
4490
|
-
|
|
4491
|
-
},
|
|
4492
|
-
return e2.forEach((
|
|
4493
|
-
|
|
4494
|
-
}), u2(), () =>
|
|
5064
|
+
o2.current = r2(e2), c2();
|
|
5065
|
+
}, l2 = new AbortController();
|
|
5066
|
+
return e2.forEach((f2) => {
|
|
5067
|
+
f2 && t2.subscribe(f2, u2, { signal: l2.signal, ...n2 });
|
|
5068
|
+
}), u2(), () => l2.abort("unsubscribe");
|
|
4495
5069
|
}
|
|
4496
5070
|
return () => {
|
|
4497
5071
|
};
|
|
4498
|
-
}, [t2,
|
|
4499
|
-
return withSelectorExports.useSyncExternalStoreWithSelector(i2,
|
|
5072
|
+
}, [t2, s2]), p2 = () => o2.current;
|
|
5073
|
+
return withSelectorExports.useSyncExternalStoreWithSelector(i2, p2, p2, R);
|
|
4500
5074
|
};
|
|
4501
5075
|
const GlobalManager = K$1(null);
|
|
4502
5076
|
var __defProp = Object.defineProperty;
|
|
@@ -4504,14 +5078,14 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
4504
5078
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4505
5079
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4506
5080
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4507
|
-
var __spreadValues = (a2,
|
|
4508
|
-
for (var prop in
|
|
4509
|
-
if (__hasOwnProp.call(
|
|
4510
|
-
__defNormalProp(a2, prop,
|
|
5081
|
+
var __spreadValues = (a2, b) => {
|
|
5082
|
+
for (var prop in b || (b = {}))
|
|
5083
|
+
if (__hasOwnProp.call(b, prop))
|
|
5084
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
4511
5085
|
if (__getOwnPropSymbols)
|
|
4512
|
-
for (var prop of __getOwnPropSymbols(
|
|
4513
|
-
if (__propIsEnum.call(
|
|
4514
|
-
__defNormalProp(a2, prop,
|
|
5086
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
5087
|
+
if (__propIsEnum.call(b, prop))
|
|
5088
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
4515
5089
|
}
|
|
4516
5090
|
return a2;
|
|
4517
5091
|
};
|
|
@@ -4538,7 +5112,7 @@ var set = (obj, path, value) => {
|
|
|
4538
5112
|
return acc[key];
|
|
4539
5113
|
}, obj);
|
|
4540
5114
|
};
|
|
4541
|
-
var
|
|
5115
|
+
var isPrimitive = (value) => typeof value !== "object" && typeof value !== "function" || value === null;
|
|
4542
5116
|
var noop = () => void 0;
|
|
4543
5117
|
var pick = (obj, ...props) => {
|
|
4544
5118
|
return props.reduce((result, prop) => {
|
|
@@ -4553,7 +5127,28 @@ function omit(obj, ...props) {
|
|
|
4553
5127
|
});
|
|
4554
5128
|
return result;
|
|
4555
5129
|
}
|
|
5130
|
+
var cleanGraph = (input) => isObject(input) ? omit(input, "_type", "_id") : input;
|
|
4556
5131
|
var isBrowser_default = typeof window !== "undefined";
|
|
5132
|
+
var flattenObject = (obj) => {
|
|
5133
|
+
const result = {};
|
|
5134
|
+
function flatten(current) {
|
|
5135
|
+
for (let key in current) {
|
|
5136
|
+
if (current.hasOwnProperty(key)) {
|
|
5137
|
+
const value = current[key];
|
|
5138
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
5139
|
+
flatten(value);
|
|
5140
|
+
} else {
|
|
5141
|
+
result[key] = value;
|
|
5142
|
+
}
|
|
5143
|
+
}
|
|
5144
|
+
}
|
|
5145
|
+
}
|
|
5146
|
+
flatten(obj);
|
|
5147
|
+
return result;
|
|
5148
|
+
};
|
|
5149
|
+
function isFiniteNumber(value) {
|
|
5150
|
+
return typeof value === "number" && isFinite(value);
|
|
5151
|
+
}
|
|
4557
5152
|
function hashGenerator(layerKey) {
|
|
4558
5153
|
let hash = 0;
|
|
4559
5154
|
for (let i2 = 0; i2 < layerKey.length; i2++) {
|
|
@@ -4565,7 +5160,7 @@ function hashGenerator(layerKey) {
|
|
|
4565
5160
|
}
|
|
4566
5161
|
const useGlobalManager = (globalManager) => {
|
|
4567
5162
|
var _a, _b;
|
|
4568
|
-
const currentGlobalManager = x$
|
|
5163
|
+
const currentGlobalManager = x$2(GlobalManager);
|
|
4569
5164
|
const resultManager = globalManager ?? currentGlobalManager;
|
|
4570
5165
|
const [fragmentsGraph] = y(
|
|
4571
5166
|
resultManager,
|
|
@@ -4657,58 +5252,189 @@ const isInheritField = (manager, layerEntity, field) => {
|
|
|
4657
5252
|
}
|
|
4658
5253
|
return false;
|
|
4659
5254
|
};
|
|
4660
|
-
const
|
|
5255
|
+
const isVariableLink = (value) => {
|
|
5256
|
+
var _a;
|
|
5257
|
+
return isLink(value) && ((_a = value == null ? void 0 : value.split(":")) == null ? void 0 : _a.at(0)) === index.nodes.Variable;
|
|
5258
|
+
};
|
|
5259
|
+
const isLink = (value) => {
|
|
5260
|
+
var _a, _b;
|
|
5261
|
+
return value && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.length) === 2;
|
|
5262
|
+
};
|
|
5263
|
+
const getCssVariables = (props) => {
|
|
5264
|
+
return Object.entries(cleanGraph(flattenObject(props))).reduce(
|
|
5265
|
+
(acc, [key, value]) => {
|
|
5266
|
+
var _a;
|
|
5267
|
+
if (isVariableLink(value)) {
|
|
5268
|
+
const nestedVariableId = (_a = entityOfKey(value)) == null ? void 0 : _a._id;
|
|
5269
|
+
value = `var(--${nestedVariableId})`;
|
|
5270
|
+
}
|
|
5271
|
+
acc[`--${key}`] = value;
|
|
5272
|
+
return acc;
|
|
5273
|
+
},
|
|
5274
|
+
{}
|
|
5275
|
+
);
|
|
5276
|
+
};
|
|
5277
|
+
const layerFieldSetter = (manager, layerKey, fieldKey, currentValue) => (value, options2) => {
|
|
5278
|
+
var _a;
|
|
5279
|
+
const { success, output } = parseLayerField(
|
|
5280
|
+
manager.resolve(layerKey),
|
|
5281
|
+
fieldKey,
|
|
5282
|
+
value
|
|
5283
|
+
);
|
|
5284
|
+
if (success) {
|
|
5285
|
+
if (isVariableLink$1(value)) {
|
|
5286
|
+
manager.mutate((_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.temp, {
|
|
5287
|
+
[layerKey]: {
|
|
5288
|
+
[fieldKey]: currentValue
|
|
5289
|
+
}
|
|
5290
|
+
});
|
|
5291
|
+
}
|
|
5292
|
+
manager.mutate(
|
|
5293
|
+
layerKey,
|
|
5294
|
+
(prev) => {
|
|
5295
|
+
set(prev, fieldKey, output);
|
|
5296
|
+
return prev;
|
|
5297
|
+
},
|
|
5298
|
+
options2
|
|
5299
|
+
);
|
|
5300
|
+
}
|
|
5301
|
+
};
|
|
5302
|
+
const getLayer = (manager, layer, options2) => {
|
|
4661
5303
|
if (!manager || !layer) return null;
|
|
4662
5304
|
const layerKey = manager.keyOfEntity(layer);
|
|
4663
5305
|
const layerData = manager.resolve(layerKey);
|
|
4664
5306
|
const overrider = getOverrider(manager, layerKey);
|
|
4665
|
-
return getNormalizeLayer$1(layerData, overrider);
|
|
5307
|
+
return getNormalizeLayer$1(layerData, overrider, options2 == null ? void 0 : options2.withFallback);
|
|
4666
5308
|
};
|
|
4667
|
-
const getNormalizeLayer = (layerKey, manager) => {
|
|
5309
|
+
const getNormalizeLayer = (layerKey, manager, options2) => {
|
|
4668
5310
|
const layer = manager == null ? void 0 : manager.resolve(layerKey);
|
|
4669
|
-
const parsedLayer = getLayer(manager, layerKey);
|
|
5311
|
+
const parsedLayer = getLayer(manager, layerKey, options2);
|
|
4670
5312
|
return {
|
|
4671
5313
|
rawLayer: layer,
|
|
4672
5314
|
layer: parsedLayer
|
|
4673
5315
|
};
|
|
4674
5316
|
};
|
|
4675
|
-
const useNormalizeLayer = (layerKey, manager) => {
|
|
4676
|
-
const { manager: fragmentManager } = x$
|
|
5317
|
+
const useNormalizeLayer = (layerKey, manager, options2) => {
|
|
5318
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
4677
5319
|
const resultManager = manager ?? fragmentManager;
|
|
4678
|
-
return getNormalizeLayer(layerKey, resultManager);
|
|
5320
|
+
return getNormalizeLayer(layerKey, resultManager, options2);
|
|
4679
5321
|
};
|
|
4680
5322
|
const ScopeContext = K$1([]);
|
|
4681
|
-
const
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
(scope) => {
|
|
4693
|
-
var _a3;
|
|
4694
|
-
return scope.type === index.scopeTypes.FragmentScope && ((_a3 = scope == null ? void 0 : scope.definitions) == null ? void 0 : _a3.find((def) => def === variableKey2));
|
|
5323
|
+
const extractVariableValue = (input, variableId) => {
|
|
5324
|
+
if (isObject(input)) {
|
|
5325
|
+
if (variableId in input) {
|
|
5326
|
+
return input[variableId];
|
|
5327
|
+
}
|
|
5328
|
+
for (let key in input) {
|
|
5329
|
+
if (input.hasOwnProperty(key)) {
|
|
5330
|
+
const result = extractVariableValue(input[key], variableId);
|
|
5331
|
+
if (result !== void 0) {
|
|
5332
|
+
return result;
|
|
5333
|
+
}
|
|
4695
5334
|
}
|
|
5335
|
+
}
|
|
5336
|
+
}
|
|
5337
|
+
return void 0;
|
|
5338
|
+
};
|
|
5339
|
+
function deepMerge(a2, b) {
|
|
5340
|
+
if (!isObject(a2) || !isObject(b)) return a2;
|
|
5341
|
+
const result = { ...b };
|
|
5342
|
+
for (const [key, value] of Object.entries(a2)) {
|
|
5343
|
+
if (key in result && typeof result[key] === "object" && typeof value === "object") {
|
|
5344
|
+
result[key] = deepMerge(value, result[key]);
|
|
5345
|
+
} else {
|
|
5346
|
+
result[key] = value;
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
return result;
|
|
5350
|
+
}
|
|
5351
|
+
const useReadVariable = (variableKey) => {
|
|
5352
|
+
const scopes = x$2(ScopeContext);
|
|
5353
|
+
const extractVariableDefaultValue = (manager, variableEntity) => {
|
|
5354
|
+
const variableLayer = manager.resolve(variableEntity);
|
|
5355
|
+
if ((variableLayer == null ? void 0 : variableLayer.type) !== index.variableType.Object)
|
|
5356
|
+
return variableLayer == null ? void 0 : variableLayer.defaultValue;
|
|
5357
|
+
return Object.values((variableLayer == null ? void 0 : variableLayer.fields) ?? {}).reduce(
|
|
5358
|
+
(acc, fieldLink) => {
|
|
5359
|
+
var _a;
|
|
5360
|
+
if (!!fieldLink && isVariableLink$1(fieldLink)) {
|
|
5361
|
+
const _id = (_a = entityOfKey(fieldLink)) == null ? void 0 : _a._id;
|
|
5362
|
+
if (_id) {
|
|
5363
|
+
acc[_id] = extractVariableDefaultValue(manager, fieldLink);
|
|
5364
|
+
}
|
|
5365
|
+
}
|
|
5366
|
+
return acc;
|
|
5367
|
+
},
|
|
5368
|
+
{}
|
|
4696
5369
|
);
|
|
4697
|
-
|
|
5370
|
+
};
|
|
5371
|
+
const resolveVariableLayer = (manager, variableLink, customProps) => {
|
|
5372
|
+
var _a;
|
|
5373
|
+
const variableLayer = manager == null ? void 0 : manager.resolve(variableLink);
|
|
5374
|
+
if (!variableLayer) return null;
|
|
5375
|
+
if ((variableLayer == null ? void 0 : variableLayer.type) === index.variableType.Array) {
|
|
5376
|
+
const definitionLayer = manager.resolve(variableLayer == null ? void 0 : variableLayer.definition);
|
|
5377
|
+
if (!((_a = variableLayer == null ? void 0 : variableLayer.defaultValue) == null ? void 0 : _a.length) || (definitionLayer == null ? void 0 : definitionLayer.type) !== index.variableType.Object)
|
|
5378
|
+
return variableLayer;
|
|
5379
|
+
const definitionDefaultValue = extractVariableDefaultValue(
|
|
5380
|
+
manager,
|
|
5381
|
+
definitionLayer
|
|
5382
|
+
);
|
|
5383
|
+
const customValue = customProps == null ? void 0 : customProps[variableLayer == null ? void 0 : variableLayer._id];
|
|
5384
|
+
return {
|
|
5385
|
+
...variableLayer,
|
|
5386
|
+
defaultValue: (variableLayer == null ? void 0 : variableLayer.defaultValue).map((item, index2) => {
|
|
5387
|
+
const customItemValue = Array.isArray(customValue) ? customValue.at(index2) : null;
|
|
5388
|
+
return deepMerge(
|
|
5389
|
+
customItemValue ? { ...item, ...customItemValue } : item,
|
|
5390
|
+
definitionDefaultValue
|
|
5391
|
+
);
|
|
5392
|
+
})
|
|
5393
|
+
};
|
|
5394
|
+
}
|
|
5395
|
+
return variableLayer;
|
|
5396
|
+
};
|
|
5397
|
+
const readVariable = (variableKey2) => {
|
|
5398
|
+
var _a, _b, _c;
|
|
5399
|
+
const variableId = (_a = entityOfKey(variableKey2)) == null ? void 0 : _a._id;
|
|
5400
|
+
if (!isVariableLink$1(variableKey2)) {
|
|
4698
5401
|
return {
|
|
4699
5402
|
value: null,
|
|
4700
5403
|
layer: null
|
|
4701
5404
|
};
|
|
4702
5405
|
}
|
|
4703
|
-
const
|
|
4704
|
-
(
|
|
4705
|
-
|
|
4706
|
-
|
|
5406
|
+
const instanceScope = scopes.findLast(
|
|
5407
|
+
(scope) => {
|
|
5408
|
+
var _a2;
|
|
5409
|
+
return (scope == null ? void 0 : scope.type) === index.scopeTypes.InstanceScope && !!((_a2 = scope.documentManager) == null ? void 0 : _a2.resolve(variableKey2));
|
|
5410
|
+
}
|
|
5411
|
+
);
|
|
5412
|
+
const variableLayer = resolveVariableLayer(
|
|
5413
|
+
instanceScope == null ? void 0 : instanceScope.documentManager,
|
|
5414
|
+
variableKey2
|
|
4707
5415
|
);
|
|
4708
|
-
|
|
5416
|
+
let instanceProp = (_b = instanceScope == null ? void 0 : instanceScope.props) == null ? void 0 : _b[variableId];
|
|
5417
|
+
if (Array.isArray(instanceProp)) {
|
|
5418
|
+
instanceProp = instanceProp.map(
|
|
5419
|
+
(rawProp, index2) => {
|
|
5420
|
+
var _a2;
|
|
5421
|
+
return deepMerge(rawProp, (_a2 = variableLayer == null ? void 0 : variableLayer.defaultValue) == null ? void 0 : _a2.at(index2));
|
|
5422
|
+
}
|
|
5423
|
+
);
|
|
5424
|
+
}
|
|
5425
|
+
const lastCollectionItem = scopes.findLast(
|
|
5426
|
+
(scope) => (scope == null ? void 0 : scope.type) === index.scopeTypes.CollectionItemScope
|
|
5427
|
+
);
|
|
5428
|
+
resolveVariableLayer(
|
|
5429
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.manager,
|
|
5430
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition,
|
|
5431
|
+
lastCollectionItem == null ? void 0 : lastCollectionItem.value
|
|
5432
|
+
);
|
|
5433
|
+
const collectionItemProp = isPrimitive(lastCollectionItem == null ? void 0 : lastCollectionItem.value) && ((_c = 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);
|
|
5434
|
+
const currentValue = variableKey2 === instanceProp ? null : collectionItemProp ?? instanceProp ?? null;
|
|
4709
5435
|
const required = (variableLayer == null ? void 0 : variableLayer.required) ?? false;
|
|
4710
5436
|
const defaultValue = (variableLayer == null ? void 0 : variableLayer.defaultValue) ?? null;
|
|
4711
|
-
const resultValue = required ? currentValue : currentValue ?? defaultValue;
|
|
5437
|
+
const resultValue = required ? currentValue : currentValue ?? collectionItemProp ?? defaultValue;
|
|
4712
5438
|
if (isVariableLink$1(resultValue)) {
|
|
4713
5439
|
return readVariable(resultValue);
|
|
4714
5440
|
}
|
|
@@ -4725,7 +5451,7 @@ const useReadVariable = (variableKey) => {
|
|
|
4725
5451
|
};
|
|
4726
5452
|
};
|
|
4727
5453
|
const useLayerCssVariable = (inputValue) => {
|
|
4728
|
-
const { manager } = x$
|
|
5454
|
+
const { manager } = x$2(FragmentContext);
|
|
4729
5455
|
const isVariable = isVariableLink$1(inputValue);
|
|
4730
5456
|
const [variableValue] = y(isVariable ? manager : null, inputValue, {
|
|
4731
5457
|
selector: (graph) => pick(graph, "defaultValue", "_id")
|
|
@@ -4734,22 +5460,27 @@ const useLayerCssVariable = (inputValue) => {
|
|
|
4734
5460
|
value: isVariable ? `var(--${variableValue == null ? void 0 : variableValue._id}, ${variableValue == null ? void 0 : variableValue.defaultValue})` : null
|
|
4735
5461
|
};
|
|
4736
5462
|
};
|
|
4737
|
-
const useLayerValue = (layerKey, fieldKey,
|
|
4738
|
-
const
|
|
4739
|
-
const
|
|
5463
|
+
const useLayerValue = (layerKey, fieldKey, options2) => {
|
|
5464
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5465
|
+
const resultManager = (options2 == null ? void 0 : options2.manager) ?? fragmentManager;
|
|
5466
|
+
if (!resultManager) {
|
|
5467
|
+
return [null, noop, {}];
|
|
5468
|
+
}
|
|
5469
|
+
const key = keyOfEntity(layerKey);
|
|
4740
5470
|
const [, updateLayerData] = y(resultManager, key, {
|
|
4741
|
-
selector: (data) => data ? pick(data, fieldKey) : data
|
|
5471
|
+
// selector: (data) => (data ? pick(data, fieldKey) : data),
|
|
4742
5472
|
});
|
|
4743
|
-
const { layer, rawLayer } = useNormalizeLayer(key, resultManager);
|
|
5473
|
+
const { layer, rawLayer } = useNormalizeLayer(key, resultManager, options2);
|
|
4744
5474
|
const rawValue = get(rawLayer, fieldKey);
|
|
4745
5475
|
const layerValue = get(layer, fieldKey);
|
|
4746
5476
|
const { value: variableValue } = useReadVariable(layerValue);
|
|
4747
5477
|
const currentValue = variableValue ?? layerValue;
|
|
4748
5478
|
const isInherit = isInheritField(resultManager, key, fieldKey);
|
|
4749
5479
|
const isOverride = !isInherit && !isPartOfPrimary(resultManager, key);
|
|
4750
|
-
const
|
|
5480
|
+
const setter = layerFieldSetter(resultManager, key, fieldKey, currentValue);
|
|
5481
|
+
const resetOverride = q$1(() => {
|
|
4751
5482
|
resultManager.mutate(
|
|
4752
|
-
|
|
5483
|
+
key,
|
|
4753
5484
|
(prev) => {
|
|
4754
5485
|
const r2 = omit(prev, fieldKey);
|
|
4755
5486
|
return r2;
|
|
@@ -4757,34 +5488,20 @@ const useLayerValue = (layerKey, fieldKey, manager) => {
|
|
|
4757
5488
|
{ replace: true }
|
|
4758
5489
|
);
|
|
4759
5490
|
}, [updateLayerData]);
|
|
4760
|
-
const restore = q$
|
|
5491
|
+
const restore = q$1(
|
|
4761
5492
|
(fallbackValue) => {
|
|
4762
5493
|
var _a, _b, _c;
|
|
4763
|
-
const tempValue = (_c = (_b = resultManager.resolve((_a = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _a.temp)) == null ? void 0 : _b[
|
|
4764
|
-
updateLayerData({ [fieldKey]: tempValue
|
|
5494
|
+
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;
|
|
5495
|
+
updateLayerData({ [fieldKey]: tempValue });
|
|
5496
|
+
return tempValue;
|
|
4765
5497
|
},
|
|
4766
5498
|
[updateLayerData, resultManager]
|
|
4767
5499
|
);
|
|
4768
|
-
const updateValue = q$
|
|
4769
|
-
(value,
|
|
4770
|
-
|
|
4771
|
-
const { success, output } = parseLayerField(layer, fieldKey, value);
|
|
4772
|
-
if (success) {
|
|
4773
|
-
if (isVariableLink$1(value)) {
|
|
4774
|
-
resultManager.mutate((_a = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _a.temp, {
|
|
4775
|
-
[layerKey]: {
|
|
4776
|
-
[fieldKey]: currentValue
|
|
4777
|
-
}
|
|
4778
|
-
});
|
|
4779
|
-
resultManager.resolve((_b = resultManager == null ? void 0 : resultManager.$fragment) == null ? void 0 : _b.temp);
|
|
4780
|
-
}
|
|
4781
|
-
updateLayerData((prev) => {
|
|
4782
|
-
set(prev, fieldKey, output);
|
|
4783
|
-
return prev;
|
|
4784
|
-
}, options2);
|
|
4785
|
-
}
|
|
5500
|
+
const updateValue = q$1(
|
|
5501
|
+
(value, options22) => {
|
|
5502
|
+
setter(value, options22);
|
|
4786
5503
|
},
|
|
4787
|
-
[
|
|
5504
|
+
[setter]
|
|
4788
5505
|
);
|
|
4789
5506
|
const { value: cssValue } = useLayerCssVariable(rawValue ?? layerValue);
|
|
4790
5507
|
return [
|
|
@@ -4801,14 +5518,48 @@ const useLayerValue = (layerKey, fieldKey, manager) => {
|
|
|
4801
5518
|
}
|
|
4802
5519
|
];
|
|
4803
5520
|
};
|
|
5521
|
+
const processOptionalSize = (value, type) => {
|
|
5522
|
+
if (value === -1) return "";
|
|
5523
|
+
if (type === index.sizing.Fixed) return toPx(value);
|
|
5524
|
+
if (type === index.sizing.Relative) return `${value}%`;
|
|
5525
|
+
return "";
|
|
5526
|
+
};
|
|
5527
|
+
const useOptionalSize = (type, layerKey) => {
|
|
5528
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5529
|
+
const [value] = useLayerValue(layerKey, type, fragmentManager);
|
|
5530
|
+
const [valueType] = useLayerValue(layerKey, `${type}Type`, fragmentManager);
|
|
5531
|
+
return T$1(
|
|
5532
|
+
() => processOptionalSize(value, valueType),
|
|
5533
|
+
[valueType, value]
|
|
5534
|
+
);
|
|
5535
|
+
};
|
|
5536
|
+
const useLayerSize = (layerKey) => {
|
|
5537
|
+
const { manager } = x$2(FragmentContext);
|
|
5538
|
+
const minWidth = useOptionalSize("minWidth", layerKey);
|
|
5539
|
+
const minHeight = useOptionalSize("minHeight", layerKey);
|
|
5540
|
+
const maxWidth = useOptionalSize("maxWidth", layerKey);
|
|
5541
|
+
const maxHeight = useOptionalSize("maxHeight", layerKey);
|
|
5542
|
+
return {
|
|
5543
|
+
// width: widthCalc(widthValue),
|
|
5544
|
+
// height: heightCalc(heightValue),
|
|
5545
|
+
minWidth,
|
|
5546
|
+
minHeight,
|
|
5547
|
+
maxWidth,
|
|
5548
|
+
maxHeight
|
|
5549
|
+
};
|
|
5550
|
+
};
|
|
4804
5551
|
const autoSizes = [index.sizing.Hug];
|
|
4805
5552
|
const useLayerSizeValue = (layerKey, sizeType) => {
|
|
4806
|
-
const { manager: fragmentManager } = x$
|
|
4807
|
-
const { layerKey: instanceLayerKey } = x$
|
|
5553
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5554
|
+
const { layerKey: instanceLayerKey } = x$2(InstanceContext);
|
|
4808
5555
|
const { isDocument } = useRenderTarget();
|
|
4809
5556
|
const isTop = isTopLevel(fragmentManager, layerKey);
|
|
4810
5557
|
const isPartOfInstance = !!instanceLayerKey;
|
|
4811
5558
|
const layerParent = getParent(fragmentManager, layerKey);
|
|
5559
|
+
const { layer: normalizeParentLayer } = useNormalizeLayer(
|
|
5560
|
+
layerParent,
|
|
5561
|
+
fragmentManager
|
|
5562
|
+
);
|
|
4812
5563
|
const layerNode = fragmentManager.resolve(layerKey);
|
|
4813
5564
|
const [instanceType] = useLayerValue(
|
|
4814
5565
|
instanceLayerKey,
|
|
@@ -4821,9 +5572,9 @@ const useLayerSizeValue = (layerKey, sizeType) => {
|
|
|
4821
5572
|
fragmentManager
|
|
4822
5573
|
);
|
|
4823
5574
|
const growType = sizeType === "width" ? "horizontalGrow" : "verticalGrow";
|
|
4824
|
-
return q$
|
|
5575
|
+
return q$1(
|
|
4825
5576
|
(value) => {
|
|
4826
|
-
if (isTop && isDocument && (
|
|
5577
|
+
if (isTop && isDocument && (normalizeParentLayer == null ? void 0 : normalizeParentLayer[growType]) === index.fragmentGrowingMode.fill) {
|
|
4827
5578
|
return "100%";
|
|
4828
5579
|
}
|
|
4829
5580
|
if (isTop && isPartOfInstance && !autoSizes.includes(instanceType)) {
|
|
@@ -4852,67 +5603,63 @@ const useLayerSizeValue = (layerKey, sizeType) => {
|
|
|
4852
5603
|
]
|
|
4853
5604
|
);
|
|
4854
5605
|
};
|
|
4855
|
-
const processOptionalSize = (value, type) => {
|
|
4856
|
-
if (value === -1) return "";
|
|
4857
|
-
if (type === index.sizing.Fixed) return toPx(value);
|
|
4858
|
-
if (type === index.sizing.Relative) return `${value}%`;
|
|
4859
|
-
return "";
|
|
4860
|
-
};
|
|
4861
|
-
const useOptionalSize = (type, layerKey) => {
|
|
4862
|
-
const { manager: fragmentManager } = x$1(FragmentContext);
|
|
4863
|
-
const [value] = useLayerValue(layerKey, type, fragmentManager);
|
|
4864
|
-
const [valueType] = useLayerValue(layerKey, `${type}Type`, fragmentManager);
|
|
4865
|
-
return T$1(
|
|
4866
|
-
() => processOptionalSize(value, valueType),
|
|
4867
|
-
[valueType, value]
|
|
4868
|
-
);
|
|
4869
|
-
};
|
|
4870
|
-
const useLayerSize = (layerKey) => {
|
|
4871
|
-
const { manager } = x$1(FragmentContext);
|
|
4872
|
-
const [widthValue] = useLayerValue(layerKey, "width", manager);
|
|
4873
|
-
const [heightValue] = useLayerValue(layerKey, "height", manager);
|
|
4874
|
-
const widthCalc = useLayerSizeValue(layerKey, "width");
|
|
4875
|
-
const heightCalc = useLayerSizeValue(layerKey, "height");
|
|
4876
|
-
const minWidth = useOptionalSize("minWidth", layerKey);
|
|
4877
|
-
const minHeight = useOptionalSize("minHeight", layerKey);
|
|
4878
|
-
const maxWidth = useOptionalSize("maxWidth", layerKey);
|
|
4879
|
-
const maxHeight = useOptionalSize("maxHeight", layerKey);
|
|
4880
|
-
return {
|
|
4881
|
-
width: widthCalc(widthValue),
|
|
4882
|
-
height: heightCalc(heightValue),
|
|
4883
|
-
minWidth,
|
|
4884
|
-
minHeight,
|
|
4885
|
-
maxWidth,
|
|
4886
|
-
maxHeight
|
|
4887
|
-
};
|
|
4888
|
-
};
|
|
4889
5606
|
const useLayerPosition = (layerKey) => {
|
|
4890
|
-
const { layerKey: instanceLayerKey } = x$
|
|
4891
|
-
const { manager: fragmentManager } = x$
|
|
5607
|
+
const { layerKey: instanceLayerKey } = x$2(InstanceContext);
|
|
5608
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
4892
5609
|
const { isDocument } = useRenderTarget();
|
|
4893
5610
|
const isTop = isTopLevel(fragmentManager, layerKey);
|
|
5611
|
+
const [width] = useLayerValue(layerKey, "width");
|
|
5612
|
+
const [height] = useLayerValue(layerKey, "height");
|
|
5613
|
+
const widthCalc = useLayerSizeValue(layerKey, "width")(width);
|
|
5614
|
+
const heightCalc = useLayerSizeValue(layerKey, "height")(height);
|
|
5615
|
+
const [position] = useLayerValue(layerKey, "position");
|
|
5616
|
+
const [centerAnchorX] = useLayerValue(layerKey, "centerAnchorX");
|
|
5617
|
+
const [centerAnchorY] = useLayerValue(layerKey, "centerAnchorY");
|
|
5618
|
+
const [top] = useLayerValue(layerKey, "top");
|
|
5619
|
+
const [left] = useLayerValue(layerKey, "left");
|
|
5620
|
+
const [right] = useLayerValue(layerKey, "right");
|
|
5621
|
+
const [bottom] = useLayerValue(layerKey, "bottom");
|
|
4894
5622
|
const skipPosition = isTop && isDocument || !!instanceLayerKey && isTop;
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
5623
|
+
if (isTop && !skipPosition) {
|
|
5624
|
+
return {
|
|
5625
|
+
position: index.positionType.absolute,
|
|
5626
|
+
top: toPx(top),
|
|
5627
|
+
left: toPx(left),
|
|
5628
|
+
width,
|
|
5629
|
+
height
|
|
5630
|
+
};
|
|
5631
|
+
}
|
|
5632
|
+
if (position === index.positionType.relative || skipPosition) {
|
|
5633
|
+
return {
|
|
5634
|
+
position: index.positionType.relative,
|
|
5635
|
+
width: widthCalc,
|
|
5636
|
+
height: heightCalc
|
|
5637
|
+
};
|
|
5638
|
+
}
|
|
5639
|
+
const hasConstrainX = isFiniteNumber(left) && isFiniteNumber(right);
|
|
5640
|
+
const hasConstrainY = isFiniteNumber(top) && isFiniteNumber(bottom);
|
|
5641
|
+
const hasAnyConstrainX = isFiniteNumber(left) || isFiniteNumber(right);
|
|
5642
|
+
const hasAnyConstrainY = isFiniteNumber(top) || isFiniteNumber(bottom);
|
|
5643
|
+
return {
|
|
5644
|
+
position,
|
|
5645
|
+
left: isFiniteNumber(left) ? toPx(left) : !isFiniteNumber(right) ? `${centerAnchorX * 100}%` : null,
|
|
5646
|
+
top: isFiniteNumber(top) ? toPx(top) : !isFiniteNumber(bottom) ? `${centerAnchorY * 100}%` : null,
|
|
5647
|
+
right: isFiniteNumber(right) ? toPx(right) : null,
|
|
5648
|
+
bottom: isFiniteNumber(bottom) ? toPx(bottom) : null,
|
|
5649
|
+
width: hasConstrainX ? null : widthCalc,
|
|
5650
|
+
height: hasConstrainY ? null : heightCalc,
|
|
5651
|
+
transform: !hasAnyConstrainX || !hasAnyConstrainY ? `translate3d(${!hasAnyConstrainX ? "-50%" : 0}, ${!hasAnyConstrainY ? "-50%" : 0}, 0px)` : null
|
|
5652
|
+
};
|
|
4906
5653
|
};
|
|
4907
5654
|
const useLayerBackground = (layerKey) => {
|
|
4908
|
-
const { manager: fragmentManager } = x$
|
|
5655
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
4909
5656
|
const [fillType] = useLayerValue(layerKey, "fillType", fragmentManager);
|
|
4910
5657
|
const [, , { cssVariableValue: cssSolidFill }] = useLayerValue(
|
|
4911
5658
|
layerKey,
|
|
4912
5659
|
"solidFill",
|
|
4913
5660
|
fragmentManager
|
|
4914
5661
|
);
|
|
4915
|
-
const [, , { cssVariableValue: cssImageFill }] = useLayerValue(
|
|
5662
|
+
const [imageFill, , { cssVariableValue: cssImageFill }] = useLayerValue(
|
|
4916
5663
|
layerKey,
|
|
4917
5664
|
"imageFill",
|
|
4918
5665
|
fragmentManager
|
|
@@ -4930,7 +5677,7 @@ const useLayerBackground = (layerKey) => {
|
|
|
4930
5677
|
}
|
|
4931
5678
|
if (fillType === index.paintMode.Image && cssImageFill) {
|
|
4932
5679
|
return {
|
|
4933
|
-
background: `url(${
|
|
5680
|
+
background: `url(${imageFill})`,
|
|
4934
5681
|
backgroundSize: cssImageSize == null ? void 0 : cssImageSize.toLowerCase(),
|
|
4935
5682
|
backgroundRepeat: "no-repeat"
|
|
4936
5683
|
};
|
|
@@ -4941,7 +5688,7 @@ const useLayerBackground = (layerKey) => {
|
|
|
4941
5688
|
}, [fillType, cssImageFill, cssSolidFill]);
|
|
4942
5689
|
};
|
|
4943
5690
|
const useLayerDisplay = (layerKey) => {
|
|
4944
|
-
const { manager } = x$
|
|
5691
|
+
const { manager } = x$2(FragmentContext);
|
|
4945
5692
|
const [layerModeValue] = useLayerValue(layerKey, "layerMode", manager);
|
|
4946
5693
|
const [visible] = useLayerValue(layerKey, "visible", manager);
|
|
4947
5694
|
return T$1(() => {
|
|
@@ -4952,7 +5699,7 @@ const useLayerDisplay = (layerKey) => {
|
|
|
4952
5699
|
}, [layerModeValue, visible]);
|
|
4953
5700
|
};
|
|
4954
5701
|
const useCalcLayerBorder = (layerKey) => {
|
|
4955
|
-
const { manager: fragmentManager } = x$
|
|
5702
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
4956
5703
|
const [borderTypeValue] = useLayerValue(
|
|
4957
5704
|
layerKey,
|
|
4958
5705
|
"borderType",
|
|
@@ -4989,7 +5736,7 @@ const useCalcLayerBorder = (layerKey) => {
|
|
|
4989
5736
|
};
|
|
4990
5737
|
};
|
|
4991
5738
|
const useLayerBorder = (layerKey) => {
|
|
4992
|
-
const { manager: fragmentManager } = x$
|
|
5739
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
4993
5740
|
const [borderWidth] = useLayerValue(layerKey, "borderWidth", fragmentManager);
|
|
4994
5741
|
const [borderColor] = useLayerValue(layerKey, "borderColor", fragmentManager);
|
|
4995
5742
|
const calcBorder = useCalcLayerBorder(layerKey);
|
|
@@ -4999,7 +5746,7 @@ const useLayerBorder = (layerKey) => {
|
|
|
4999
5746
|
);
|
|
5000
5747
|
};
|
|
5001
5748
|
const useLayerLayout = (layerKey) => {
|
|
5002
|
-
const { manager: fragmentManager } = x$
|
|
5749
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5003
5750
|
const [layerModeValue] = useLayerValue(
|
|
5004
5751
|
layerKey,
|
|
5005
5752
|
"layerMode",
|
|
@@ -5041,7 +5788,7 @@ const useLayerLayout = (layerKey) => {
|
|
|
5041
5788
|
);
|
|
5042
5789
|
};
|
|
5043
5790
|
const useLayerTextStyles = (layerKey) => {
|
|
5044
|
-
const { manager: fragmentManager } = x$
|
|
5791
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5045
5792
|
const [attributes] = useLayerValue(layerKey, "attributes", fragmentManager);
|
|
5046
5793
|
const [color] = useLayerValue(layerKey, "attributes.color", fragmentManager);
|
|
5047
5794
|
const cleanAttributes = omit(attributes, "_id", "_type");
|
|
@@ -5055,15 +5802,16 @@ const useLayerStyles = (layerKey) => {
|
|
|
5055
5802
|
if (!layerKey) {
|
|
5056
5803
|
throw new Error("Empty layer key");
|
|
5057
5804
|
}
|
|
5058
|
-
const { manager: fragmentManager } = x$
|
|
5805
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5059
5806
|
const [opacity] = useLayerValue(layerKey, "opacity", fragmentManager);
|
|
5060
5807
|
const layerSize = useLayerSize(layerKey);
|
|
5061
|
-
const
|
|
5808
|
+
const position = useLayerPosition(layerKey);
|
|
5062
5809
|
const display = useLayerDisplay(layerKey);
|
|
5063
5810
|
const background = useLayerBackground(layerKey);
|
|
5064
5811
|
const border = useLayerBorder(layerKey);
|
|
5065
5812
|
const layout = useLayerLayout(layerKey);
|
|
5066
5813
|
const [zIndex] = useLayerValue(layerKey, "zIndex", fragmentManager);
|
|
5814
|
+
const [rotate] = useLayerValue(layerKey, "rotate", fragmentManager);
|
|
5067
5815
|
const [borderRadius] = useLayerValue(
|
|
5068
5816
|
layerKey,
|
|
5069
5817
|
"borderRadius",
|
|
@@ -5075,10 +5823,9 @@ const useLayerStyles = (layerKey) => {
|
|
|
5075
5823
|
// ...(props ?? {}),
|
|
5076
5824
|
...border,
|
|
5077
5825
|
...background,
|
|
5078
|
-
position,
|
|
5079
|
-
top,
|
|
5080
|
-
left,
|
|
5826
|
+
...position,
|
|
5081
5827
|
opacity,
|
|
5828
|
+
rotate: isValue(rotate) ? `${rotate}deg` : null,
|
|
5082
5829
|
"border-radius": borderRadius,
|
|
5083
5830
|
"white-space": whiteSpace2,
|
|
5084
5831
|
"z-index": zIndex !== -1 ? zIndex : null,
|
|
@@ -5090,7 +5837,6 @@ const useLayerStyles = (layerKey) => {
|
|
|
5090
5837
|
// ...cssOverride,
|
|
5091
5838
|
};
|
|
5092
5839
|
} catch (e2) {
|
|
5093
|
-
console.debug(e2);
|
|
5094
5840
|
return {};
|
|
5095
5841
|
}
|
|
5096
5842
|
};
|
|
@@ -5099,7 +5845,7 @@ const useFragmentProperties = (fragmentId) => {
|
|
|
5099
5845
|
const { manager } = useFragmentManager(fragmentId);
|
|
5100
5846
|
const [instanceFragment] = y(manager, (_a = manager == null ? void 0 : manager.$fragment) == null ? void 0 : _a.root);
|
|
5101
5847
|
return {
|
|
5102
|
-
properties: (instanceFragment == null ? void 0 : instanceFragment.properties) ?? [],
|
|
5848
|
+
properties: ((instanceFragment == null ? void 0 : instanceFragment.properties) ?? []).map((manager == null ? void 0 : manager.resolve) ?? noop).filter((prop) => !(prop == null ? void 0 : prop.parent)).map(keyOfEntity),
|
|
5103
5849
|
manager
|
|
5104
5850
|
};
|
|
5105
5851
|
};
|
|
@@ -5109,24 +5855,15 @@ const useHash = (layerKey, manager) => {
|
|
|
5109
5855
|
const overrideFrom = getKey(layer == null ? void 0 : layer.overrideFrom);
|
|
5110
5856
|
return hashGenerator(overrideFrom ?? layerKey);
|
|
5111
5857
|
};
|
|
5112
|
-
const isVariableLink = (value) => {
|
|
5113
|
-
var _a;
|
|
5114
|
-
return isLink(value) && ((_a = value == null ? void 0 : value.split(":")) == null ? void 0 : _a.at(0)) === index.nodes.Variable;
|
|
5115
|
-
};
|
|
5116
|
-
const isLink = (value) => {
|
|
5117
|
-
var _a, _b;
|
|
5118
|
-
return value && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.length) === 2;
|
|
5119
|
-
};
|
|
5120
5858
|
const useInstanceProps = (instanceProps) => {
|
|
5121
5859
|
const isTopInstance = !(instanceProps == null ? void 0 : instanceProps.layerKey);
|
|
5122
5860
|
const { manager: loadedManager } = useFragmentManager(
|
|
5123
5861
|
isTopInstance ? instanceProps == null ? void 0 : instanceProps.fragmentId : null
|
|
5124
5862
|
);
|
|
5125
|
-
const { manager: fragmentContextManager } = x$
|
|
5863
|
+
const { manager: fragmentContextManager } = x$2(FragmentContext);
|
|
5126
5864
|
const { properties: definitions, manager: innerFragmentManager } = useFragmentProperties(instanceProps == null ? void 0 : instanceProps.fragmentId);
|
|
5127
5865
|
const definitionsData = S(innerFragmentManager, definitions);
|
|
5128
5866
|
const fragmentManager = isTopInstance ? loadedManager : fragmentContextManager;
|
|
5129
|
-
useReadVariable(null);
|
|
5130
5867
|
const [instanceLayer] = y(fragmentManager, instanceProps.layerKey);
|
|
5131
5868
|
const instanceLayerProps = (instanceLayer == null ? void 0 : instanceLayer.props) ?? {};
|
|
5132
5869
|
const mergedProps = T$1(() => {
|
|
@@ -5146,30 +5883,59 @@ const useInstanceProps = (instanceProps) => {
|
|
|
5146
5883
|
}
|
|
5147
5884
|
return omit(base, "_type", "_id");
|
|
5148
5885
|
}, [isTopInstance, fragmentManager, instanceLayerProps, definitionsData]);
|
|
5149
|
-
const drilledProps = Object.values(mergedProps).filter(isVariableLink);
|
|
5150
|
-
const resolveDrilledProps = S(fragmentManager, drilledProps);
|
|
5151
|
-
const resultProps = T$1(() => {
|
|
5152
|
-
const props = { ...mergedProps };
|
|
5153
|
-
return props;
|
|
5154
|
-
}, [resolveDrilledProps, mergedProps]);
|
|
5155
|
-
const cssProps = Object.entries(resultProps).reduce((acc, [key, value]) => {
|
|
5156
|
-
var _a;
|
|
5157
|
-
if (isVariableLink(value)) {
|
|
5158
|
-
const nestedVariableId = (_a = fragmentManager.entityOfKey(value)) == null ? void 0 : _a._id;
|
|
5159
|
-
value = `var(--${nestedVariableId})`;
|
|
5160
|
-
}
|
|
5161
|
-
acc[`--${key}`] = value;
|
|
5162
|
-
return acc;
|
|
5163
|
-
}, {});
|
|
5164
5886
|
return {
|
|
5165
|
-
props:
|
|
5166
|
-
cssProps
|
|
5887
|
+
props: mergedProps,
|
|
5888
|
+
cssProps: getCssVariables(mergedProps)
|
|
5167
5889
|
};
|
|
5168
5890
|
};
|
|
5891
|
+
const useLayerInteractions = (layerKey, options2) => {
|
|
5892
|
+
const pause = (options2 == null ? void 0 : options2.pauseInteractions) ?? false;
|
|
5893
|
+
const { manager: globalManager } = useGlobalManager();
|
|
5894
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5895
|
+
const [interactions2] = useLayerValue(
|
|
5896
|
+
layerKey,
|
|
5897
|
+
"interactions",
|
|
5898
|
+
fragmentManager
|
|
5899
|
+
);
|
|
5900
|
+
const { readVariable } = useReadVariable();
|
|
5901
|
+
const fireEvent = q$1(
|
|
5902
|
+
(eventLink) => {
|
|
5903
|
+
var _a, _b, _c, _d;
|
|
5904
|
+
const event = fragmentManager.resolve(eventLink);
|
|
5905
|
+
const { value: eventValue } = readVariable(eventLink);
|
|
5906
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.code)) {
|
|
5907
|
+
(_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);
|
|
5908
|
+
}
|
|
5909
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.tracker && eventValue) {
|
|
5910
|
+
(_d = (_c = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _c.trackAdPixel) == null ? void 0 : _d.call(_c, eventValue);
|
|
5911
|
+
}
|
|
5912
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.callback && typeof eventValue === "function") {
|
|
5913
|
+
eventValue();
|
|
5914
|
+
}
|
|
5915
|
+
},
|
|
5916
|
+
[globalManager, fragmentManager]
|
|
5917
|
+
);
|
|
5918
|
+
y$2(() => {
|
|
5919
|
+
if (!pause && Array.isArray(interactions2)) {
|
|
5920
|
+
interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.appear).map((el) => el.event).forEach(fireEvent);
|
|
5921
|
+
}
|
|
5922
|
+
}, [pause]);
|
|
5923
|
+
return T$1(() => {
|
|
5924
|
+
if (!pause && !interactions2 || !Array.isArray(interactions2)) return {};
|
|
5925
|
+
if (pause) return {};
|
|
5926
|
+
const clickEvents = interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.click).map((el) => el.event);
|
|
5927
|
+
return {
|
|
5928
|
+
onClick: () => {
|
|
5929
|
+
clickEvents.map(fireEvent);
|
|
5930
|
+
}
|
|
5931
|
+
};
|
|
5932
|
+
}, [interactions2, fireEvent, pause]);
|
|
5933
|
+
};
|
|
5169
5934
|
const useInstance = (instanceProps) => {
|
|
5170
|
-
const { manager: parentManager } = x$
|
|
5935
|
+
const { manager: parentManager } = x$2(FragmentContext);
|
|
5171
5936
|
const [instanceLayer] = y(parentManager, instanceProps.layerKey);
|
|
5172
5937
|
const styles2 = useLayerStyles(instanceProps.layerKey);
|
|
5938
|
+
const events = useLayerInteractions(instanceProps.layerKey, instanceProps);
|
|
5173
5939
|
const { manager: resultGlobalManager } = useGlobalManager(
|
|
5174
5940
|
instanceProps == null ? void 0 : instanceProps.globalManager
|
|
5175
5941
|
);
|
|
@@ -5180,6 +5946,7 @@ const useInstance = (instanceProps) => {
|
|
|
5180
5946
|
return {
|
|
5181
5947
|
hash,
|
|
5182
5948
|
styles: styles2,
|
|
5949
|
+
events,
|
|
5183
5950
|
definitions,
|
|
5184
5951
|
props,
|
|
5185
5952
|
cssProps,
|
|
@@ -5196,7 +5963,7 @@ const Scope = ({
|
|
|
5196
5963
|
layerKey
|
|
5197
5964
|
}) => {
|
|
5198
5965
|
var _a, _b;
|
|
5199
|
-
const currentScope = x$
|
|
5966
|
+
const currentScope = x$2(ScopeContext) ?? [];
|
|
5200
5967
|
const nextScope = [...currentScope, value];
|
|
5201
5968
|
(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.registerScope) == null ? void 0 : _b.call(_a, layerKey, nextScope);
|
|
5202
5969
|
return /* @__PURE__ */ u(ScopeContext.Provider, { value: nextScope, children });
|
|
@@ -5270,20 +6037,20 @@ const Instance = (props) => {
|
|
|
5270
6037
|
return "globalManager" in props ? /* @__PURE__ */ u(GlobalManager, { value: props.globalManager, children: /* @__PURE__ */ u(InstanceInitial, { ...props }) }) : /* @__PURE__ */ u(InstanceInitial, { ...props });
|
|
5271
6038
|
};
|
|
5272
6039
|
const useLayerChildren = (layerKey, customManager) => {
|
|
5273
|
-
const { manager: fragmentManager } = x$
|
|
6040
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5274
6041
|
const [layerData] = y(customManager ?? fragmentManager, layerKey, {
|
|
5275
6042
|
selector: (data) => pick(data, "children")
|
|
5276
6043
|
});
|
|
5277
6044
|
return (layerData == null ? void 0 : layerData.children) ?? [];
|
|
5278
6045
|
};
|
|
5279
6046
|
const useFragmentChildren = (fragmentId) => {
|
|
5280
|
-
const { layerKey: instanceLayerKey } = x$
|
|
6047
|
+
const { layerKey: instanceLayerKey } = x$2(InstanceContext);
|
|
5281
6048
|
const { manager, fragmentLayerKey } = useFragmentManager(fragmentId);
|
|
5282
6049
|
const children = useLayerChildren(fragmentLayerKey, manager);
|
|
5283
6050
|
const { isDocument } = useRenderTarget();
|
|
5284
6051
|
const [resizeChildren, setResizeChildren] = d(null);
|
|
5285
6052
|
A();
|
|
5286
|
-
const setRef = q$
|
|
6053
|
+
const setRef = q$1(
|
|
5287
6054
|
(node) => {
|
|
5288
6055
|
},
|
|
5289
6056
|
[isDocument, instanceLayerKey, manager, children]
|
|
@@ -5302,56 +6069,26 @@ const useFragmentChildren = (fragmentId) => {
|
|
|
5302
6069
|
setRef
|
|
5303
6070
|
};
|
|
5304
6071
|
};
|
|
5305
|
-
const getStylesheetKey = (fragmentKey) => {
|
|
5306
|
-
const isLink2 = G(fragmentKey);
|
|
5307
|
-
if (isLink2) {
|
|
5308
|
-
const [type, id] = fragmentKey.split(":");
|
|
5309
|
-
return `stylesheet-${id}`;
|
|
5310
|
-
}
|
|
5311
|
-
return `stylesheet-${fragmentKey ?? "unknown"}`;
|
|
5312
|
-
};
|
|
5313
|
-
function useInjectedStyle() {
|
|
5314
|
-
const { manager } = x$1(FragmentContext);
|
|
5315
|
-
const injectStyle = () => {
|
|
5316
|
-
var _a, _b;
|
|
5317
|
-
const styles2 = (_b = (_a = manager == null ? void 0 : manager.$styleSheet.extract()) == null ? void 0 : _a.at(0)) == null ? void 0 : _b.styles;
|
|
5318
|
-
if (isBrowser_default && styles2) {
|
|
5319
|
-
const stylesheetKey = getStylesheetKey(manager == null ? void 0 : manager.key);
|
|
5320
|
-
if (document.getElementById(stylesheetKey)) {
|
|
5321
|
-
const el = document.getElementById(stylesheetKey);
|
|
5322
|
-
if (el) el.remove();
|
|
5323
|
-
}
|
|
5324
|
-
const style = document.createElement("style");
|
|
5325
|
-
style.id = stylesheetKey;
|
|
5326
|
-
style.textContent = styles2.join("");
|
|
5327
|
-
document.head.appendChild(style);
|
|
5328
|
-
}
|
|
5329
|
-
};
|
|
5330
|
-
return {
|
|
5331
|
-
injectStyle
|
|
5332
|
-
};
|
|
5333
|
-
}
|
|
5334
6072
|
const useStyleSheet = (manager) => {
|
|
5335
|
-
|
|
5336
|
-
const addLayerStyle = q$
|
|
6073
|
+
var _a, _b;
|
|
6074
|
+
const addLayerStyle = q$1(
|
|
5337
6075
|
(layerKey, styles2, layer) => {
|
|
5338
|
-
var
|
|
6076
|
+
var _a2, _b2;
|
|
5339
6077
|
if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
|
|
5340
|
-
(
|
|
5341
|
-
if (isBrowser_default) {
|
|
5342
|
-
injectStyle();
|
|
5343
|
-
}
|
|
6078
|
+
(_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addStyle) == null ? void 0 : _b2.call(_a2, layerKey, styles2, layer);
|
|
5344
6079
|
}
|
|
5345
6080
|
},
|
|
5346
6081
|
[manager]
|
|
5347
6082
|
);
|
|
5348
6083
|
return {
|
|
5349
|
-
addLayerStyle
|
|
6084
|
+
addLayerStyle,
|
|
6085
|
+
mount: ((_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.mount) ?? noop,
|
|
6086
|
+
unmount: ((_b = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _b.unmount) ?? noop
|
|
5350
6087
|
};
|
|
5351
6088
|
};
|
|
5352
6089
|
const useFragment = (fragmentId, globalManager) => {
|
|
5353
6090
|
var _a, _b;
|
|
5354
|
-
const instanceContext = x$
|
|
6091
|
+
const instanceContext = x$2(InstanceContext);
|
|
5355
6092
|
const fragmentContext = useFragmentManager(fragmentId);
|
|
5356
6093
|
const { isDocument } = useRenderTarget();
|
|
5357
6094
|
const { setRef, children, isResize } = useFragmentChildren(fragmentId);
|
|
@@ -5360,9 +6097,11 @@ const useFragment = (fragmentId, globalManager) => {
|
|
|
5360
6097
|
fragmentContext.manager
|
|
5361
6098
|
);
|
|
5362
6099
|
const { properties: definitions } = useFragmentProperties(fragmentId);
|
|
5363
|
-
const scopes = x$
|
|
6100
|
+
const scopes = x$2(ScopeContext);
|
|
5364
6101
|
!(scopes == null ? void 0 : scopes.length);
|
|
5365
|
-
const { addLayerStyle } = useStyleSheet(
|
|
6102
|
+
const { addLayerStyle, mount, unmount } = useStyleSheet(
|
|
6103
|
+
fragmentContext.manager
|
|
6104
|
+
);
|
|
5366
6105
|
if (fragmentContext.manager) {
|
|
5367
6106
|
addLayerStyle(
|
|
5368
6107
|
fragmentContext.fragmentLayerKey,
|
|
@@ -5374,7 +6113,13 @@ const useFragment = (fragmentId, globalManager) => {
|
|
|
5374
6113
|
(_a = fragmentContext.manager) == null ? void 0 : _a.resolve(fragmentContext.fragmentLayerKey),
|
|
5375
6114
|
(_b = fragmentContext.manager) == null ? void 0 : _b.key
|
|
5376
6115
|
);
|
|
6116
|
+
mount();
|
|
5377
6117
|
}
|
|
6118
|
+
y$2(() => {
|
|
6119
|
+
return () => {
|
|
6120
|
+
unmount();
|
|
6121
|
+
};
|
|
6122
|
+
}, []);
|
|
5378
6123
|
return {
|
|
5379
6124
|
hash,
|
|
5380
6125
|
isDocument,
|
|
@@ -5391,41 +6136,8 @@ const fragment = "_fragment_1c708_1";
|
|
|
5391
6136
|
const styles = {
|
|
5392
6137
|
fragment
|
|
5393
6138
|
};
|
|
5394
|
-
const useLayerInteractions = (layerKey) => {
|
|
5395
|
-
const { manager: globalManager } = useGlobalManager();
|
|
5396
|
-
const { manager: fragmentManager } = x$1(FragmentContext);
|
|
5397
|
-
const [interactions2] = useLayerValue(
|
|
5398
|
-
layerKey,
|
|
5399
|
-
"interactions",
|
|
5400
|
-
fragmentManager
|
|
5401
|
-
);
|
|
5402
|
-
const { readVariable } = useReadVariable();
|
|
5403
|
-
const fireEvent = q$2(
|
|
5404
|
-
(eventLink) => {
|
|
5405
|
-
var _a, _b;
|
|
5406
|
-
const event = fragmentManager.resolve(eventLink);
|
|
5407
|
-
const { value: eventValue } = readVariable(eventLink);
|
|
5408
|
-
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.code)) {
|
|
5409
|
-
(_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);
|
|
5410
|
-
}
|
|
5411
|
-
if ((event == null ? void 0 : event.mode) === index.eventMode.callback && typeof eventValue === "function") {
|
|
5412
|
-
eventValue();
|
|
5413
|
-
}
|
|
5414
|
-
},
|
|
5415
|
-
[globalManager, fragmentManager]
|
|
5416
|
-
);
|
|
5417
|
-
return T$1(() => {
|
|
5418
|
-
if (!interactions2 || !Array.isArray(interactions2)) return {};
|
|
5419
|
-
const clickEvents = interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.click).map((el) => el.event);
|
|
5420
|
-
return {
|
|
5421
|
-
onClick: () => {
|
|
5422
|
-
clickEvents.map(fireEvent);
|
|
5423
|
-
}
|
|
5424
|
-
};
|
|
5425
|
-
}, [interactions2, fireEvent]);
|
|
5426
|
-
};
|
|
5427
6139
|
const useLayerLink = (layerKey) => {
|
|
5428
|
-
const { manager: fragmentManager } = x$
|
|
6140
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5429
6141
|
const [href] = useLayerValue(layerKey, "href", fragmentManager);
|
|
5430
6142
|
const [hrefNewTab] = useLayerValue(layerKey, "hrefNewTab", fragmentManager);
|
|
5431
6143
|
const isLink2 = isValue(href) && typeof href === "string" && !!(href == null ? void 0 : href.length);
|
|
@@ -5447,13 +6159,13 @@ const useLayerLink = (layerKey) => {
|
|
|
5447
6159
|
};
|
|
5448
6160
|
};
|
|
5449
6161
|
const useFrame = (layerKey, options2) => {
|
|
5450
|
-
const { manager: fragmentManager } = x$
|
|
6162
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5451
6163
|
const layer = fragmentManager.entityOfKey(layerKey);
|
|
5452
6164
|
const styles2 = useLayerStyles(layerKey);
|
|
5453
6165
|
const children = useLayerChildren(layerKey);
|
|
5454
6166
|
const hash = useHash(layerKey, fragmentManager);
|
|
5455
6167
|
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
5456
|
-
const events = useLayerInteractions(layerKey);
|
|
6168
|
+
const events = useLayerInteractions(layerKey, options2);
|
|
5457
6169
|
const link = useLayerLink(layerKey);
|
|
5458
6170
|
{
|
|
5459
6171
|
addLayerStyle(layerKey, styles2, fragmentManager.resolve(layerKey));
|
|
@@ -5473,44 +6185,48 @@ const text = "_text_1liuf_1";
|
|
|
5473
6185
|
const cssStyles = {
|
|
5474
6186
|
text
|
|
5475
6187
|
};
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
"
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
6188
|
+
function extractVariablesFromHtml(html) {
|
|
6189
|
+
if (!html) return [];
|
|
6190
|
+
const regex = /<span(?=\s)(?=(?:[^>]*?\s)?class="[^"]*variable[^"]*")(?=(?:[^>]*?\s)?data-type="mention")(?=(?:[^>]*?\s)?data-id="([^"]+)")[^>]*>.*?<\/span>/gi;
|
|
6191
|
+
const mentions = [];
|
|
6192
|
+
let match;
|
|
6193
|
+
while ((match = regex.exec(html)) !== null) {
|
|
6194
|
+
mentions.push({
|
|
6195
|
+
fullMatch: match[0],
|
|
6196
|
+
dataId: match[1],
|
|
6197
|
+
variableKey: keyOfEntity({
|
|
6198
|
+
_type: index.nodes.Variable,
|
|
6199
|
+
_id: match[1]
|
|
6200
|
+
}),
|
|
6201
|
+
position: match.index
|
|
6202
|
+
});
|
|
6203
|
+
}
|
|
6204
|
+
return mentions;
|
|
6205
|
+
}
|
|
5493
6206
|
const useTextContent = (layerKey, manager) => {
|
|
5494
|
-
const { manager: fragmentManager } = x$
|
|
6207
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5495
6208
|
const [content, , contentInfo] = useLayerValue(
|
|
5496
6209
|
layerKey,
|
|
5497
6210
|
"content",
|
|
5498
6211
|
fragmentManager
|
|
5499
6212
|
);
|
|
5500
|
-
const
|
|
5501
|
-
const
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
6213
|
+
const variables = extractVariablesFromHtml(content);
|
|
6214
|
+
const { readVariable } = useReadVariable();
|
|
6215
|
+
S(
|
|
6216
|
+
fragmentManager,
|
|
6217
|
+
variables.map((variable) => variable.variableKey)
|
|
6218
|
+
);
|
|
6219
|
+
let nextContent = content;
|
|
6220
|
+
variables.forEach((variable) => {
|
|
6221
|
+
nextContent = nextContent.replace(
|
|
6222
|
+
variable.fullMatch,
|
|
6223
|
+
readVariable(variable.variableKey).value
|
|
6224
|
+
);
|
|
6225
|
+
});
|
|
6226
|
+
return nextContent;
|
|
5511
6227
|
};
|
|
5512
6228
|
const useTextAttributes = (layerKey, options2) => {
|
|
5513
|
-
const { manager: fragmentManager } = x$
|
|
6229
|
+
const { manager: fragmentManager } = x$2(FragmentContext);
|
|
5514
6230
|
const styles2 = useLayerStyles(layerKey);
|
|
5515
6231
|
const content = useTextContent(layerKey);
|
|
5516
6232
|
const hash = useHash(layerKey, fragmentManager);
|