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