@picked/client 0.0.2-next.2 → 0.0.2
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/cjs/index.js +1 -1
- package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/history-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +25 -26
- package/dist/esm/plugins/{experience-browser-storage → experience-browserstorage-plugin}/index.js +1 -1
- package/dist/esm/plugins/{history-browser-storage → history-browserstorage-plugin}/index.js +1 -1
- package/dist/esm/plugins/{responses-browser-storage → responses-browserstorage-plugin}/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +1 -1
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-6ZKZS7dF.cjs +1 -0
- package/dist/{experience-instance-DYZovD6a.js → experience-instance-BA0EXYg5.js} +237 -244
- package/dist/{supports-yKVnaaMQ.js → supports-BvrzQAVk.js} +8 -16
- package/dist/supports-C0y3-V5V.cjs +1 -0
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +1 -0
- package/dist/types/utils/dom.d.ts +5 -5
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +0 -1
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/package.json +21 -27
- package/dist/cjs/plugins/experience-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/web-components/index.js +0 -1
- package/dist/esm/plugins/web-components/index.js +0 -21
- package/dist/experience-instance-DwO_yZK0.cjs +0 -1
- package/dist/supports-B6KShYPU.cjs +0 -1
- package/dist/types/plugins/experience-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/history-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +0 -1
- package/dist/types/plugins/web-components/index.d.ts +0 -2
- package/dist/types/plugins/web-components/index.d.ts.map +0 -1
- package/dist/types/plugins/web-components/plugin.d.ts +0 -3
- package/dist/types/plugins/web-components/plugin.d.ts.map +0 -1
- /package/dist/cjs/plugins/{responses-indexeddb → responses-indexeddb-plugin}/index.js +0 -0
- /package/dist/esm/plugins/{responses-indexeddb → responses-indexeddb-plugin}/index.js +0 -0
- /package/dist/types/plugins/{experience-browser-storage → experience-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{experience-browser-storage → experience-browserstorage-plugin}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{responses-browser-storage → responses-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-browser-storage → responses-browserstorage-plugin}/plugin.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb → responses-indexeddb-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb → responses-indexeddb-plugin}/plugin.d.ts +0 -0
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { createDomain as ft, createEvent as b, combine as
|
|
2
|
-
import { createFactory as Q, invoke as
|
|
3
|
-
import { h as lt, s as
|
|
4
|
-
import { l as
|
|
5
|
-
import { i as
|
|
6
|
-
function
|
|
1
|
+
import { createDomain as ft, createEvent as b, combine as O, createApi as J, sample as S, createEffect as v, attach as A, split as pt } from "effector";
|
|
2
|
+
import { createFactory as Q, invoke as X } from "@withease/factories";
|
|
3
|
+
import { h as lt, s as Y, a as dt } from "./supports-BvrzQAVk.js";
|
|
4
|
+
import { l as P } from "./logger-C9a75KZn.js";
|
|
5
|
+
import { i as mt } from "./object-JwZ58NOH.js";
|
|
6
|
+
function gt(t) {
|
|
7
7
|
return typeof t == "number" && !isNaN(t);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function T(t) {
|
|
10
10
|
return typeof t == "string";
|
|
11
11
|
}
|
|
12
12
|
function w(t) {
|
|
13
13
|
return Array.isArray(t);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function Z(t) {
|
|
16
16
|
return t instanceof Promise;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function K(t) {
|
|
19
19
|
return typeof t == "object" && t !== null && !Array.isArray(t) && Object.keys(t).length === 1;
|
|
20
20
|
}
|
|
21
21
|
function d(t) {
|
|
22
|
-
if (
|
|
22
|
+
if (gt(t)) return t;
|
|
23
23
|
const e = parseFloat(`${t}`);
|
|
24
24
|
return isNaN(e) ? 0 : e;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function B(t) {
|
|
27
27
|
return `${t}`;
|
|
28
28
|
}
|
|
29
29
|
const ht = {
|
|
@@ -36,34 +36,34 @@ const ht = {
|
|
|
36
36
|
">": (t, e) => d(t) > d(e),
|
|
37
37
|
">=": (t, e) => d(t) >= d(e),
|
|
38
38
|
"<": (t, e, r) => {
|
|
39
|
-
const n = d(t),
|
|
40
|
-
if (r === void 0) return n <
|
|
41
|
-
const
|
|
42
|
-
return n <
|
|
39
|
+
const n = d(t), c = d(e);
|
|
40
|
+
if (r === void 0) return n < c;
|
|
41
|
+
const i = d(r);
|
|
42
|
+
return n < c && c < i;
|
|
43
43
|
},
|
|
44
44
|
"<=": (t, e, r) => {
|
|
45
|
-
const n = d(t),
|
|
46
|
-
if (r === void 0) return n <=
|
|
47
|
-
const
|
|
48
|
-
return n <=
|
|
45
|
+
const n = d(t), c = d(e);
|
|
46
|
+
if (r === void 0) return n <= c;
|
|
47
|
+
const i = d(r);
|
|
48
|
+
return n <= c && c <= i;
|
|
49
49
|
},
|
|
50
|
-
"!!": async (t) => await
|
|
51
|
-
"!": async (t) => !await
|
|
50
|
+
"!!": async (t) => await E(t),
|
|
51
|
+
"!": async (t) => !await E(t),
|
|
52
52
|
"%": (t, e) => d(t) % d(e),
|
|
53
53
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
54
54
|
log: (t) => (console.log(t), t),
|
|
55
|
-
in: (t, e) => e ?
|
|
56
|
-
cat: (...t) => t.map(
|
|
55
|
+
in: (t, e) => e ? T(e) ? e.indexOf(B(t)) !== -1 : w(e) ? e.includes(t) : !1 : !1,
|
|
56
|
+
cat: (...t) => t.map(B).join(""),
|
|
57
57
|
/* eslint-disable sonarjs/deprecation */
|
|
58
58
|
substr: (t, e, r) => {
|
|
59
|
-
const n =
|
|
60
|
-
if (r === void 0) return n.substr(
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const o = n.substr(
|
|
64
|
-
return o.substr(0, o.length +
|
|
59
|
+
const n = B(t), c = d(e);
|
|
60
|
+
if (r === void 0) return n.substr(c);
|
|
61
|
+
const i = d(r);
|
|
62
|
+
if (i < 0) {
|
|
63
|
+
const o = n.substr(c);
|
|
64
|
+
return o.substr(0, o.length + i);
|
|
65
65
|
}
|
|
66
|
-
return n.substr(
|
|
66
|
+
return n.substr(c, i);
|
|
67
67
|
},
|
|
68
68
|
/* eslint-enable sonarjs/deprecation */
|
|
69
69
|
"+": (...t) => t.reduce((e, r) => d(e) + d(r), 0),
|
|
@@ -82,35 +82,35 @@ const ht = {
|
|
|
82
82
|
return this;
|
|
83
83
|
if (typeof t == "number" && Array.isArray(this))
|
|
84
84
|
return t >= 0 && t < this.length ? this[t] : r;
|
|
85
|
-
const n =
|
|
85
|
+
const n = B(t);
|
|
86
86
|
if (n === "" || n === ".")
|
|
87
87
|
return this;
|
|
88
|
-
const
|
|
89
|
-
let
|
|
90
|
-
for (const o of
|
|
91
|
-
if (
|
|
88
|
+
const c = n.split(".");
|
|
89
|
+
let i = this;
|
|
90
|
+
for (const o of c) {
|
|
91
|
+
if (i == null)
|
|
92
92
|
return r;
|
|
93
|
-
if (Array.isArray(
|
|
93
|
+
if (Array.isArray(i)) {
|
|
94
94
|
const a = parseInt(o, 10);
|
|
95
|
-
isNaN(a) ?
|
|
95
|
+
isNaN(a) ? i = i[o] : i = i[a];
|
|
96
96
|
} else
|
|
97
|
-
|
|
97
|
+
i = i[o];
|
|
98
98
|
}
|
|
99
|
-
return
|
|
99
|
+
return i !== void 0 ? i : r;
|
|
100
100
|
},
|
|
101
101
|
async missing(...t) {
|
|
102
102
|
const e = w(t[0]) ? t[0] : t, r = [];
|
|
103
103
|
for (const n of e) {
|
|
104
|
-
const
|
|
105
|
-
(
|
|
104
|
+
const c = await l({ var: n }, this);
|
|
105
|
+
(c === null || c === "") && r.push(`${n}`);
|
|
106
106
|
}
|
|
107
107
|
return r;
|
|
108
108
|
},
|
|
109
109
|
async missing_some(t, e) {
|
|
110
110
|
const r = await l({ missing: e }, this);
|
|
111
111
|
if (!w(r) || !w(e)) return [];
|
|
112
|
-
const n = r.filter(
|
|
113
|
-
return e.filter(
|
|
112
|
+
const n = r.filter(T);
|
|
113
|
+
return e.filter(T).length - n.length >= d(t) ? [] : n;
|
|
114
114
|
},
|
|
115
115
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
116
116
|
invoke(t) {
|
|
@@ -119,42 +119,42 @@ const ht = {
|
|
|
119
119
|
regexp_matches(t, e) {
|
|
120
120
|
let r = t, n = "";
|
|
121
121
|
if (w(t)) {
|
|
122
|
-
const [
|
|
123
|
-
r =
|
|
122
|
+
const [i, o] = t;
|
|
123
|
+
r = i, n = o;
|
|
124
124
|
}
|
|
125
|
-
return !
|
|
125
|
+
return !T(r) || !T(n) ? !1 : new RegExp(r, n).test(B(e));
|
|
126
126
|
},
|
|
127
127
|
throw(t) {
|
|
128
|
-
throw new Error(
|
|
128
|
+
throw new Error(B(t));
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
async function l(t, e) {
|
|
132
132
|
if (!t) return t;
|
|
133
|
-
if (
|
|
133
|
+
if (Z(t))
|
|
134
134
|
return l(await t, e);
|
|
135
135
|
if (w(t))
|
|
136
136
|
return Promise.all(t.map((o) => l(o, e)));
|
|
137
|
-
if (!
|
|
137
|
+
if (!K(t)) return t;
|
|
138
138
|
const r = St(t);
|
|
139
139
|
let n = r ? t[r] ?? [] : [];
|
|
140
140
|
switch (w(n) || (n = [n]), r) {
|
|
141
141
|
case "if":
|
|
142
142
|
case "?:":
|
|
143
143
|
for (let o = 0; o < n.length - 1; o += 2)
|
|
144
|
-
if (await
|
|
144
|
+
if (await E(await l(n[o], e)))
|
|
145
145
|
return l(n[o + 1], e);
|
|
146
146
|
return n.length % 2 === 1 ? l(n[n.length - 1], e) : null;
|
|
147
147
|
case "and": {
|
|
148
148
|
let o = null;
|
|
149
149
|
for (const a of n)
|
|
150
|
-
if (o = await l(a, e), !await
|
|
150
|
+
if (o = await l(a, e), !await E(o))
|
|
151
151
|
return o;
|
|
152
152
|
return o;
|
|
153
153
|
}
|
|
154
154
|
case "or": {
|
|
155
155
|
let o = null;
|
|
156
156
|
for (const a of n)
|
|
157
|
-
if (o = await l(a, e), await
|
|
157
|
+
if (o = await l(a, e), await E(o)) return o;
|
|
158
158
|
return o;
|
|
159
159
|
}
|
|
160
160
|
case "map": {
|
|
@@ -165,7 +165,7 @@ async function l(t, e) {
|
|
|
165
165
|
const o = await l(n[0], e);
|
|
166
166
|
return w(o) ? (await Promise.all(
|
|
167
167
|
o.map(async (u) => {
|
|
168
|
-
const h = await
|
|
168
|
+
const h = await E(await l(n[1], u));
|
|
169
169
|
return { item: u, shouldInclude: h };
|
|
170
170
|
})
|
|
171
171
|
)).filter(({ shouldInclude: u }) => u).map(({ item: u }) => u) : [];
|
|
@@ -176,56 +176,56 @@ async function l(t, e) {
|
|
|
176
176
|
return n.length > 2 ? await l(n[2], e) : null;
|
|
177
177
|
const a = n[1];
|
|
178
178
|
let h = n.length > 2 ? await l(n[2], e) : null;
|
|
179
|
-
for (const
|
|
180
|
-
h = await l(a, { current:
|
|
179
|
+
for (const I of o)
|
|
180
|
+
h = await l(a, { current: I, accumulator: h });
|
|
181
181
|
return h;
|
|
182
182
|
}
|
|
183
183
|
case "all": {
|
|
184
184
|
const o = await l(n[0], e);
|
|
185
185
|
if (!w(o) || o.length === 0) return !1;
|
|
186
186
|
for (const a of o)
|
|
187
|
-
if (!await
|
|
187
|
+
if (!await E(await l(n[1], a))) return !1;
|
|
188
188
|
return !0;
|
|
189
189
|
}
|
|
190
190
|
case "some": {
|
|
191
191
|
const o = await l(n[0], e);
|
|
192
192
|
if (!w(o)) return !1;
|
|
193
193
|
for (const a of o)
|
|
194
|
-
if (await
|
|
194
|
+
if (await E(await l(n[1], a))) return !0;
|
|
195
195
|
return !1;
|
|
196
196
|
}
|
|
197
197
|
case "none": {
|
|
198
198
|
const o = await l(n[0], e);
|
|
199
199
|
if (!w(o)) return !0;
|
|
200
200
|
for (const a of o)
|
|
201
|
-
if (await
|
|
201
|
+
if (await E(await l(n[1], a))) return !1;
|
|
202
202
|
return !0;
|
|
203
203
|
}
|
|
204
204
|
case "catch":
|
|
205
205
|
try {
|
|
206
206
|
return await l(n[0], e);
|
|
207
207
|
} catch (o) {
|
|
208
|
-
return
|
|
208
|
+
return K(o) ? await l(o, e) : n[1] ? await l(n[1], o) : o instanceof Error ? o.message : o;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
if (!
|
|
213
|
-
return
|
|
211
|
+
const c = await Promise.all(n.map((o) => l(o, e))), i = r ? ht[r] : void 0;
|
|
212
|
+
if (!i) throw new Error(`Unrecognized operation ${r}`);
|
|
213
|
+
return i.apply(e, c);
|
|
214
214
|
}
|
|
215
|
-
async function
|
|
216
|
-
return
|
|
215
|
+
async function E(t) {
|
|
216
|
+
return Z(t) ? E(await t) : !(Array.isArray(t) && t.length === 0) && !!t;
|
|
217
217
|
}
|
|
218
218
|
function St(t) {
|
|
219
219
|
return Object.keys(t)[0];
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return !
|
|
221
|
+
function $t(t) {
|
|
222
|
+
return !mt(t);
|
|
223
223
|
}
|
|
224
224
|
async function yt(t, e, r) {
|
|
225
|
-
const n = t.getStateSnapshot(),
|
|
225
|
+
const n = t.getStateSnapshot(), c = t.predicates.listStore.getState().reduce((a, u) => ({
|
|
226
226
|
...a,
|
|
227
227
|
[u.name]: () => u.predicate(n)
|
|
228
|
-
}), {}),
|
|
228
|
+
}), {}), i = t.features.listStore.getState().reduce((a, u) => ({
|
|
229
229
|
...a,
|
|
230
230
|
[u.id]: async () => {
|
|
231
231
|
const { bucket: h } = await u.getBucket();
|
|
@@ -245,191 +245,184 @@ async function yt(t, e, r) {
|
|
|
245
245
|
protocol: n.location.protocol,
|
|
246
246
|
search: n.location.search
|
|
247
247
|
} : void 0,
|
|
248
|
-
predicates:
|
|
249
|
-
features:
|
|
248
|
+
predicates: c,
|
|
249
|
+
features: i
|
|
250
250
|
};
|
|
251
251
|
return await l(e, o);
|
|
252
252
|
}
|
|
253
253
|
function wt(t) {
|
|
254
|
-
return !dt() || !
|
|
254
|
+
return !dt() || !Y() ? [] : Array.from(window.document.querySelectorAll(t)).filter(
|
|
255
255
|
(e) => e instanceof HTMLElement
|
|
256
256
|
);
|
|
257
257
|
}
|
|
258
258
|
function xt(t) {
|
|
259
259
|
if (!lt())
|
|
260
260
|
throw new Error("Shadow DOM is not supported in this environment");
|
|
261
|
-
return t.attachShadow({ mode: "
|
|
261
|
+
return t.attachShadow({ mode: "open" });
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Ht() {
|
|
264
264
|
return new Promise((t, e) => {
|
|
265
|
-
if (!
|
|
265
|
+
if (!Y()) {
|
|
266
266
|
e();
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
269
|
document.readyState !== "loading" ? t() : document.addEventListener("readystatechange", () => t(), { once: !0 });
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function It(t, e) {
|
|
273
273
|
const r = new MutationObserver((n) => {
|
|
274
274
|
document.contains(t) || (r.disconnect(), e());
|
|
275
275
|
});
|
|
276
276
|
r.observe(document.body, { childList: !0, subtree: !0 });
|
|
277
277
|
}
|
|
278
|
-
const
|
|
279
|
-
function
|
|
280
|
-
return
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
{
|
|
284
|
-
selector: `${kt}[experience-id="${e}"]`,
|
|
285
|
-
placement: "replace"
|
|
286
|
-
}
|
|
287
|
-
].flatMap((n) => {
|
|
288
|
-
const i = wt(n.selector).filter(
|
|
289
|
-
(c) => !It(c, e) && !Nt(c, e)
|
|
278
|
+
const tt = "picked-root", U = "picked-target";
|
|
279
|
+
function jt(t, e) {
|
|
280
|
+
return t.flatMap((r) => {
|
|
281
|
+
const n = wt(r.selector).filter(
|
|
282
|
+
(c) => !kt(c, e)
|
|
290
283
|
);
|
|
291
284
|
return {
|
|
292
|
-
...
|
|
293
|
-
elements:
|
|
285
|
+
...r,
|
|
286
|
+
elements: n
|
|
294
287
|
};
|
|
295
288
|
});
|
|
296
289
|
}
|
|
297
|
-
function Ut(t
|
|
298
|
-
return t.flatMap((
|
|
290
|
+
function Ut(t) {
|
|
291
|
+
return t.flatMap((e) => e.elements.map((r) => Nt(r, e.placement)));
|
|
299
292
|
}
|
|
300
293
|
function Vt(t, e) {
|
|
301
|
-
t.classList.add(
|
|
294
|
+
t.classList.add(U), t.classList.add(`${U}-${e}`);
|
|
302
295
|
}
|
|
303
|
-
function
|
|
304
|
-
return
|
|
296
|
+
function kt(t, e) {
|
|
297
|
+
return t.classList.contains(`${U}-${e}`);
|
|
305
298
|
}
|
|
306
|
-
function
|
|
307
|
-
return
|
|
299
|
+
function qt(t) {
|
|
300
|
+
return t.classList.contains(tt);
|
|
308
301
|
}
|
|
309
|
-
function
|
|
310
|
-
const
|
|
311
|
-
return
|
|
302
|
+
function Et() {
|
|
303
|
+
const t = document.createElement("div");
|
|
304
|
+
return t.style.display = "block", t.classList.add(tt), t;
|
|
312
305
|
}
|
|
313
|
-
function
|
|
314
|
-
let
|
|
315
|
-
const
|
|
306
|
+
function Nt(t, e) {
|
|
307
|
+
let r;
|
|
308
|
+
const n = Et();
|
|
316
309
|
if (t instanceof Document)
|
|
317
|
-
|
|
310
|
+
r = t.body.appendChild(n);
|
|
318
311
|
else {
|
|
319
312
|
switch (e) {
|
|
320
313
|
case "replace":
|
|
321
|
-
t.replaceWith(
|
|
314
|
+
t.replaceWith(n);
|
|
322
315
|
break;
|
|
323
316
|
case "before":
|
|
324
|
-
t.before(
|
|
317
|
+
t.before(n);
|
|
325
318
|
break;
|
|
326
319
|
case "after":
|
|
327
|
-
t.after(
|
|
320
|
+
t.after(n);
|
|
328
321
|
break;
|
|
329
322
|
case "prepend":
|
|
330
|
-
t.prepend(
|
|
323
|
+
t.prepend(n);
|
|
331
324
|
break;
|
|
332
325
|
default:
|
|
333
|
-
t.append(
|
|
326
|
+
t.append(n);
|
|
334
327
|
break;
|
|
335
328
|
}
|
|
336
|
-
|
|
329
|
+
r = n;
|
|
337
330
|
}
|
|
338
|
-
return
|
|
331
|
+
return r;
|
|
339
332
|
}
|
|
340
|
-
function
|
|
333
|
+
function bt(t) {
|
|
341
334
|
return t.type === "conditional";
|
|
342
335
|
}
|
|
343
|
-
function
|
|
336
|
+
function D(t) {
|
|
344
337
|
return t.type === "step";
|
|
345
338
|
}
|
|
346
|
-
function
|
|
339
|
+
function vt(t) {
|
|
347
340
|
return t.type === "experience";
|
|
348
341
|
}
|
|
349
|
-
function
|
|
342
|
+
function W(t) {
|
|
350
343
|
return t.type === "origin";
|
|
351
344
|
}
|
|
352
|
-
const et = (t, e, r, n,
|
|
345
|
+
const et = (t, e, r, n, c = /* @__PURE__ */ new Set()) => c.has(r.id) ? [] : (c.add(r.id), D(r) && !n ? [r] : e.filter((o) => o.sourceNodeId === r.id).flatMap((o) => {
|
|
353
346
|
const a = t.find((u) => u.id === o.destinationNodeId);
|
|
354
|
-
return a ? et(t, e, a, !1,
|
|
355
|
-
})),
|
|
356
|
-
if (
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
347
|
+
return a ? et(t, e, a, !1, c) : [];
|
|
348
|
+
})), At = (t, e, r) => et(t, e, r, !0, /* @__PURE__ */ new Set()), nt = (t, e, r, n, c = /* @__PURE__ */ new Set()) => {
|
|
349
|
+
if (c.has(r.id)) return [-1, -1];
|
|
350
|
+
c.add(r.id);
|
|
351
|
+
const i = e.filter((u) => u.sourceNodeId === r.id);
|
|
352
|
+
if (i.length === 0) return [0, 0];
|
|
360
353
|
let o = 1 / 0, a = -1 / 0;
|
|
361
|
-
for (const u of
|
|
354
|
+
for (const u of i) {
|
|
362
355
|
const h = t.find((k) => k.id === u.destinationNodeId);
|
|
363
356
|
if (!h) continue;
|
|
364
|
-
const [
|
|
357
|
+
const [I, y] = nt(
|
|
365
358
|
t,
|
|
366
359
|
e,
|
|
367
360
|
h,
|
|
368
361
|
!1,
|
|
369
|
-
new Set(
|
|
362
|
+
new Set(c)
|
|
370
363
|
);
|
|
371
|
-
|
|
364
|
+
I !== -1 && (o = Math.min(o, I + 1), a = Math.max(a, y + 1));
|
|
372
365
|
}
|
|
373
366
|
return o === 1 / 0 ? [-1, -1] : [o, a];
|
|
374
|
-
},
|
|
367
|
+
}, Ft = (t, e, r) => nt(t, e, r, !0, /* @__PURE__ */ new Set()), rt = (t, e, r, n = /* @__PURE__ */ new Set()) => {
|
|
375
368
|
if (n.has(r.id)) return [-1, -1];
|
|
376
369
|
if (n.add(r.id), r.type === "origin") return [0, 0];
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
let
|
|
380
|
-
for (const a of
|
|
370
|
+
const c = e.filter((a) => a.destinationNodeId === r.id);
|
|
371
|
+
if (c.length === 0) return [-1, -1];
|
|
372
|
+
let i = 1 / 0, o = -1 / 0;
|
|
373
|
+
for (const a of c) {
|
|
381
374
|
const u = t.find((y) => y.id === a.sourceNodeId);
|
|
382
375
|
if (!u) continue;
|
|
383
|
-
const [h,
|
|
376
|
+
const [h, I] = rt(
|
|
384
377
|
t,
|
|
385
378
|
e,
|
|
386
379
|
u,
|
|
387
380
|
new Set(n)
|
|
388
381
|
);
|
|
389
|
-
h !== -1 && (
|
|
382
|
+
h !== -1 && (i = Math.min(i, h + 1), o = Math.max(o, I + 1));
|
|
390
383
|
}
|
|
391
|
-
return
|
|
392
|
-
},
|
|
384
|
+
return i === 1 / 0 ? [-1, -1] : [i, o];
|
|
385
|
+
}, _t = (t, e, r) => rt(t, e, r, /* @__PURE__ */ new Set()), ot = (t) => t.find((r) => r.type === "origin") || null, j = (t, e, r) => {
|
|
393
386
|
if (!t)
|
|
394
387
|
return ot(e);
|
|
395
|
-
const n = r.find((
|
|
388
|
+
const n = r.find((i) => i.sourceNodeId === t.id);
|
|
396
389
|
if (!n)
|
|
397
390
|
return null;
|
|
398
|
-
const
|
|
399
|
-
return
|
|
391
|
+
const c = e.find((i) => i.id === n.destinationNodeId);
|
|
392
|
+
return c || null;
|
|
400
393
|
};
|
|
401
394
|
async function Bt(t, e, r, n) {
|
|
402
|
-
const
|
|
403
|
-
(o) => o.sourceNodeHandle ===
|
|
395
|
+
const c = t ? "true" : "false", i = n.find(
|
|
396
|
+
(o) => o.sourceNodeHandle === c && o.sourceNodeId === e
|
|
404
397
|
);
|
|
405
|
-
return r.find((o) => o.id === (
|
|
398
|
+
return r.find((o) => o.id === (i == null ? void 0 : i.destinationNodeId));
|
|
406
399
|
}
|
|
407
|
-
const
|
|
400
|
+
const V = ft("experience-instance"), Mt = Q(
|
|
408
401
|
({
|
|
409
402
|
client: t,
|
|
410
403
|
experience: e,
|
|
411
404
|
target: r
|
|
412
405
|
}) => {
|
|
413
|
-
const n = b(),
|
|
406
|
+
const n = b(), c = b(), i = b(), o = b(), a = e.componentStore, u = V.store("transitioning"), h = t.history.entriesStore.map((s) => s.filter((p) => p.experienceId === e.id)), I = h.map((s) => s.filter((p) => D(p.node))), y = h.map((s) => {
|
|
414
407
|
var p;
|
|
415
408
|
return ((p = s[s.length - 1]) == null ? void 0 : p.node) || null;
|
|
416
|
-
}), k =
|
|
409
|
+
}), k = O(
|
|
417
410
|
e.treeStore,
|
|
418
411
|
y,
|
|
419
|
-
({ steps: s }, p) => s.find((
|
|
420
|
-
),
|
|
412
|
+
({ steps: s }, p) => s.find((m) => p && D(p) && m.id === p.stepId) || null
|
|
413
|
+
), R = O(
|
|
421
414
|
e.treeStore,
|
|
422
415
|
y,
|
|
423
|
-
({ nodes: s, edges: p },
|
|
424
|
-
), f =
|
|
416
|
+
({ nodes: s, edges: p }, m) => m ? At(s, p, m) : []
|
|
417
|
+
), f = O(
|
|
425
418
|
e.treeStore,
|
|
426
419
|
y,
|
|
427
|
-
({ nodes: s, edges: p },
|
|
428
|
-
),
|
|
420
|
+
({ nodes: s, edges: p }, m) => m ? _t(s, p, m) : [-1, -1]
|
|
421
|
+
), g = O(
|
|
429
422
|
e.treeStore,
|
|
430
423
|
y,
|
|
431
|
-
({ nodes: s, edges: p },
|
|
432
|
-
), x =
|
|
424
|
+
({ nodes: s, edges: p }, m) => m ? Ft(s, p, m) : [-1, -1]
|
|
425
|
+
), x = V.store(!0), N = J(x, {
|
|
433
426
|
open: () => !0,
|
|
434
427
|
close: () => !1,
|
|
435
428
|
toggle: (s) => !s,
|
|
@@ -450,73 +443,73 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
450
443
|
experience: e
|
|
451
444
|
}))
|
|
452
445
|
});
|
|
453
|
-
const
|
|
446
|
+
const F = v(async () => {
|
|
454
447
|
t.history.back({ experienceId: e.id });
|
|
455
|
-
}),
|
|
448
|
+
}), M = A({
|
|
456
449
|
source: e.treeStore,
|
|
457
450
|
effect: async (s, p) => {
|
|
458
|
-
const
|
|
459
|
-
|
|
451
|
+
const m = s.nodes.find((_) => D(_) && _.stepId === p);
|
|
452
|
+
m && t.history.push({ experienceId: e.id, node: m });
|
|
460
453
|
}
|
|
461
|
-
}),
|
|
454
|
+
}), q = A({
|
|
462
455
|
source: y,
|
|
463
456
|
effect: (s) => {
|
|
464
457
|
}
|
|
465
|
-
}),
|
|
458
|
+
}), C = A({
|
|
466
459
|
source: e.treeStore,
|
|
467
460
|
effect: async ({ nodes: s }) => ot(s)
|
|
468
|
-
}),
|
|
461
|
+
}), $ = A({
|
|
469
462
|
source: e.treeStore,
|
|
470
|
-
effect: async ({ nodes: s, edges: p },
|
|
471
|
-
}),
|
|
463
|
+
effect: async ({ nodes: s, edges: p }, m) => j(m, s, p)
|
|
464
|
+
}), H = A({
|
|
472
465
|
source: e.treeStore,
|
|
473
|
-
effect: async ({ nodes: s, edges: p, conditionals:
|
|
474
|
-
if (!
|
|
466
|
+
effect: async ({ nodes: s, edges: p, conditionals: m }, _) => {
|
|
467
|
+
if (!_)
|
|
475
468
|
return;
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
469
|
+
const G = m.find((ut) => ut.id === _.conditionalId);
|
|
470
|
+
if (!G)
|
|
478
471
|
return;
|
|
479
|
-
const ct =
|
|
472
|
+
const ct = _.id, at = await yt(t, G.condition);
|
|
480
473
|
return Bt(!!at, ct, s, p);
|
|
481
474
|
}
|
|
482
475
|
}), st = v((s) => {
|
|
483
476
|
if (s)
|
|
484
477
|
return t.launchExperienceById(s.experienceId);
|
|
485
|
-
}),
|
|
478
|
+
}), z = A({
|
|
486
479
|
source: [y, e.treeStore],
|
|
487
|
-
effect: async ([s, { nodes: p, edges:
|
|
488
|
-
}),
|
|
480
|
+
effect: async ([s, { nodes: p, edges: m }]) => j(s, p, m)
|
|
481
|
+
}), L = A({
|
|
489
482
|
source: [y, e.treeStore],
|
|
490
|
-
effect: async ([s, { nodes: p, edges:
|
|
483
|
+
effect: async ([s, { nodes: p, edges: m }]) => j(s, p, m)
|
|
491
484
|
}), it = v((s) => {
|
|
492
485
|
t.history.push({ experienceId: e.id, node: s });
|
|
493
486
|
});
|
|
494
487
|
return pt({
|
|
495
488
|
source: y,
|
|
496
|
-
match: (s) => s ?
|
|
489
|
+
match: (s) => s ? bt(s) ? "condition" : D(s) ? "step" : vt(s) ? "launchExperience" : W(s) ? "origin" : "other" : "none",
|
|
497
490
|
cases: {
|
|
498
|
-
none:
|
|
499
|
-
origin:
|
|
500
|
-
condition:
|
|
501
|
-
step:
|
|
491
|
+
none: C,
|
|
492
|
+
origin: $,
|
|
493
|
+
condition: H,
|
|
494
|
+
step: q,
|
|
502
495
|
launchExperience: st,
|
|
503
496
|
__: b()
|
|
504
497
|
}
|
|
505
498
|
}), S({
|
|
506
499
|
clock: [
|
|
507
|
-
G.doneData,
|
|
508
|
-
j.doneData,
|
|
509
500
|
H.doneData,
|
|
510
|
-
|
|
511
|
-
|
|
501
|
+
$.doneData,
|
|
502
|
+
C.doneData,
|
|
503
|
+
L.doneData,
|
|
504
|
+
z.doneData
|
|
512
505
|
],
|
|
513
506
|
filter: Boolean,
|
|
514
507
|
target: it
|
|
515
508
|
}), S({
|
|
516
|
-
clock:
|
|
517
|
-
target:
|
|
509
|
+
clock: c,
|
|
510
|
+
target: L
|
|
518
511
|
}), S({
|
|
519
|
-
clock:
|
|
512
|
+
clock: c,
|
|
520
513
|
source: k,
|
|
521
514
|
target: t.eventBus.prepend((s) => ({
|
|
522
515
|
type: "step_submit",
|
|
@@ -524,7 +517,7 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
524
517
|
experience: e
|
|
525
518
|
}))
|
|
526
519
|
}), S({
|
|
527
|
-
clock:
|
|
520
|
+
clock: L.done,
|
|
528
521
|
source: k,
|
|
529
522
|
target: t.eventBus.prepend((s) => ({
|
|
530
523
|
type: "step_submit_success",
|
|
@@ -532,7 +525,7 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
532
525
|
experience: e
|
|
533
526
|
}))
|
|
534
527
|
}), S({
|
|
535
|
-
clock:
|
|
528
|
+
clock: L.fail,
|
|
536
529
|
source: k,
|
|
537
530
|
target: t.eventBus.prepend((s) => ({
|
|
538
531
|
type: "step_submit_error",
|
|
@@ -540,27 +533,27 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
540
533
|
experience: e
|
|
541
534
|
}))
|
|
542
535
|
}), S({
|
|
543
|
-
clock:
|
|
544
|
-
target:
|
|
536
|
+
clock: i,
|
|
537
|
+
target: F
|
|
545
538
|
}), S({
|
|
546
|
-
clock:
|
|
539
|
+
clock: i,
|
|
547
540
|
source: k,
|
|
548
541
|
target: t.eventBus.prepend((s) => ({
|
|
549
542
|
type: "step_submit",
|
|
550
543
|
step: s ?? void 0,
|
|
551
544
|
experience: e
|
|
552
545
|
}))
|
|
553
|
-
}), S({ clock: o, target:
|
|
554
|
-
source:
|
|
555
|
-
G.pending,
|
|
556
|
-
j.pending,
|
|
546
|
+
}), S({ clock: o, target: M }), S({
|
|
547
|
+
source: O([
|
|
557
548
|
H.pending,
|
|
558
|
-
|
|
549
|
+
$.pending,
|
|
550
|
+
C.pending,
|
|
551
|
+
L.pending
|
|
559
552
|
]),
|
|
560
553
|
fn: (s) => s.some(Boolean) ? "transitioning" : "ready",
|
|
561
554
|
target: u
|
|
562
555
|
}), S({
|
|
563
|
-
clock:
|
|
556
|
+
clock: q.doneData,
|
|
564
557
|
source: k,
|
|
565
558
|
target: t.eventBus.prepend((s) => ({
|
|
566
559
|
type: "step_enter",
|
|
@@ -570,8 +563,8 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
570
563
|
}), S({
|
|
571
564
|
source: y,
|
|
572
565
|
clock: n,
|
|
573
|
-
filter: (s) => s ?
|
|
574
|
-
target:
|
|
566
|
+
filter: (s) => s ? W(s) : !0,
|
|
567
|
+
target: z
|
|
575
568
|
}), n(), {
|
|
576
569
|
// config
|
|
577
570
|
experienceId: e.id,
|
|
@@ -590,35 +583,35 @@ const U = ft("experience-instance"), Ft = Q(
|
|
|
590
583
|
treeStore: e.treeStore,
|
|
591
584
|
currentNodeStore: y,
|
|
592
585
|
currentStepStore: k,
|
|
593
|
-
nextReachableStepNodesStore:
|
|
586
|
+
nextReachableStepNodesStore: R,
|
|
594
587
|
stepsToOriginStore: f,
|
|
595
|
-
stepsToLeafStore:
|
|
588
|
+
stepsToLeafStore: g,
|
|
596
589
|
// history
|
|
597
|
-
goToNextStep:
|
|
598
|
-
goToPreviousStep:
|
|
590
|
+
goToNextStep: c,
|
|
591
|
+
goToPreviousStep: i,
|
|
599
592
|
goToStepById: o,
|
|
600
|
-
stepsHistoryStore:
|
|
593
|
+
stepsHistoryStore: I
|
|
601
594
|
};
|
|
602
595
|
}
|
|
603
596
|
);
|
|
604
|
-
function
|
|
605
|
-
return
|
|
597
|
+
function Lt(t) {
|
|
598
|
+
return X(Mt, t);
|
|
606
599
|
}
|
|
607
|
-
const
|
|
608
|
-
const e =
|
|
609
|
-
register(f,
|
|
600
|
+
const Ot = Q(({ client: t }) => {
|
|
601
|
+
const e = V.store({}), r = b(), n = b(), c = b(), i = J(e, {
|
|
602
|
+
register(f, g) {
|
|
610
603
|
const x = [
|
|
611
|
-
...f[
|
|
604
|
+
...f[g.experienceId] ?? []
|
|
612
605
|
];
|
|
613
|
-
return x.push(
|
|
606
|
+
return x.push(g), {
|
|
614
607
|
...f,
|
|
615
|
-
[
|
|
608
|
+
[g.experienceId]: x
|
|
616
609
|
};
|
|
617
610
|
},
|
|
618
|
-
unregister(f,
|
|
619
|
-
var
|
|
620
|
-
const x =
|
|
621
|
-
(
|
|
611
|
+
unregister(f, g) {
|
|
612
|
+
var F;
|
|
613
|
+
const x = g.experienceId, N = (F = f[x]) == null ? void 0 : F.filter(
|
|
614
|
+
(M) => M !== g
|
|
622
615
|
);
|
|
623
616
|
return {
|
|
624
617
|
...f,
|
|
@@ -626,51 +619,51 @@ const $t = Q(({ client: t }) => {
|
|
|
626
619
|
};
|
|
627
620
|
}
|
|
628
621
|
}), o = v(
|
|
629
|
-
({ experience: f, target:
|
|
622
|
+
({ experience: f, target: g }) => Lt({ client: t, experience: f, target: g })
|
|
630
623
|
), a = v((f) => {
|
|
631
|
-
|
|
624
|
+
i.register(f);
|
|
632
625
|
}), u = v(
|
|
633
626
|
(f) => {
|
|
634
|
-
f.target &&
|
|
635
|
-
|
|
627
|
+
f.target && It(f.target, () => {
|
|
628
|
+
c(f);
|
|
636
629
|
});
|
|
637
630
|
}
|
|
638
631
|
), h = v((f) => {
|
|
639
|
-
|
|
640
|
-
}),
|
|
641
|
-
const
|
|
642
|
-
if (!
|
|
643
|
-
|
|
632
|
+
i.unregister(f);
|
|
633
|
+
}), I = v((f) => {
|
|
634
|
+
const g = f.componentStore.getState();
|
|
635
|
+
if (!g) {
|
|
636
|
+
P("warn", "No app component registered. Skipping init.");
|
|
644
637
|
return;
|
|
645
638
|
}
|
|
646
|
-
const x =
|
|
639
|
+
const x = g.frameworkStore.getState();
|
|
647
640
|
if (!x) {
|
|
648
|
-
|
|
641
|
+
P(
|
|
649
642
|
"error",
|
|
650
|
-
`No framework registered for component '${
|
|
643
|
+
`No framework registered for component '${g.name}'. Skipping rendering.`
|
|
651
644
|
);
|
|
652
645
|
return;
|
|
653
646
|
}
|
|
654
647
|
const N = f.target;
|
|
655
648
|
if (!N) {
|
|
656
|
-
|
|
649
|
+
P(
|
|
657
650
|
"error",
|
|
658
651
|
`No target element registered for experience '${f.experienceId}'. Skipping rendering.`
|
|
659
652
|
);
|
|
660
653
|
return;
|
|
661
654
|
}
|
|
662
|
-
const
|
|
655
|
+
const F = xt(N);
|
|
663
656
|
try {
|
|
664
|
-
x.render(
|
|
665
|
-
} catch (
|
|
666
|
-
|
|
657
|
+
x.render(F, g.component, t, f);
|
|
658
|
+
} catch (M) {
|
|
659
|
+
P("error", M);
|
|
667
660
|
}
|
|
668
661
|
});
|
|
669
662
|
S({
|
|
670
663
|
clock: r,
|
|
671
664
|
target: o
|
|
672
665
|
}), S({
|
|
673
|
-
clock:
|
|
666
|
+
clock: c,
|
|
674
667
|
target: h
|
|
675
668
|
}), S({
|
|
676
669
|
clock: o.doneData,
|
|
@@ -687,33 +680,33 @@ const $t = Q(({ client: t }) => {
|
|
|
687
680
|
}))
|
|
688
681
|
}), S({
|
|
689
682
|
clock: n,
|
|
690
|
-
target:
|
|
683
|
+
target: I
|
|
691
684
|
});
|
|
692
|
-
function y(f,
|
|
693
|
-
r({ experience: f, target:
|
|
685
|
+
function y(f, g) {
|
|
686
|
+
r({ experience: f, target: g });
|
|
694
687
|
}
|
|
695
688
|
const k = e.map((f) => Object.values(f).flat());
|
|
696
|
-
function
|
|
697
|
-
return e.map((
|
|
689
|
+
function R(f) {
|
|
690
|
+
return e.map((g) => g[f] || [], { skipVoid: !1 });
|
|
698
691
|
}
|
|
699
692
|
return {
|
|
700
693
|
spawn: y,
|
|
701
|
-
getByExperienceId:
|
|
694
|
+
getByExperienceId: R,
|
|
702
695
|
listStore: k
|
|
703
696
|
};
|
|
704
697
|
});
|
|
705
|
-
function
|
|
706
|
-
return
|
|
698
|
+
function zt(t) {
|
|
699
|
+
return X(Ot, t);
|
|
707
700
|
}
|
|
708
701
|
export {
|
|
709
|
-
|
|
710
|
-
|
|
702
|
+
D as a,
|
|
703
|
+
zt as b,
|
|
711
704
|
Ut as c,
|
|
712
|
-
|
|
705
|
+
Ht as d,
|
|
713
706
|
yt as e,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
707
|
+
qt as f,
|
|
708
|
+
jt as g,
|
|
709
|
+
Lt as h,
|
|
710
|
+
$t as i,
|
|
718
711
|
Vt as t
|
|
719
712
|
};
|