@picked/client 0.0.1-dev.1784003142683 → 0.0.1-dev.1784265353357

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.
Files changed (43) hide show
  1. package/dist/{api-CsddE4DI.js → api-Dh6rss_Z.js} +1 -1
  2. package/dist/{api-U2LgcKqF.cjs → api-DoUBwN6K.cjs} +1 -1
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/plugins/dom-observer/index.js +1 -1
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  7. package/dist/cjs/server/index.js +1 -1
  8. package/dist/docs/content/asset-library.mdx +43 -0
  9. package/dist/{dom-CZyRgp2P.js → dom-BwmTHeT7.js} +12 -17
  10. package/dist/dom-CDrHc_j9.cjs +1 -0
  11. package/dist/esm/index.js +340 -421
  12. package/dist/esm/plugins/dom-observer/index.js +1 -1
  13. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  14. package/dist/esm/plugins/history-browser-storage/index.js +11 -33
  15. package/dist/esm/server/index.js +2 -2
  16. package/dist/{experience-instance-QSrdjfn6.js → experience-instance-DCcKZrdI.js} +229 -250
  17. package/dist/experience-instance-Nl39IDKx.cjs +1 -0
  18. package/dist/{plugin-CWvFEvt5.cjs → plugin-D2xYyTWf.cjs} +1 -1
  19. package/dist/{plugin-CnCP2N-8.js → plugin-DTYpuy6Q.js} +1 -1
  20. package/dist/types/entities/action/action.d.ts +1 -1
  21. package/dist/types/entities/experience/experience.d.ts +2 -2
  22. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  23. package/dist/types/entities/experience-instance/experience-instance.d.ts +0 -23
  24. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  25. package/dist/types/entities/history/history.d.ts +12 -43
  26. package/dist/types/entities/history/history.d.ts.map +1 -1
  27. package/dist/types/entities/response/response.d.ts +0 -1
  28. package/dist/types/entities/response/response.d.ts.map +1 -1
  29. package/dist/types/exports.d.ts +3 -0
  30. package/dist/types/exports.d.ts.map +1 -1
  31. package/dist/types/picked.d.ts +10 -14
  32. package/dist/types/picked.d.ts.map +1 -1
  33. package/dist/types/plugins/history-browser-storage/plugin.d.ts +0 -17
  34. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  35. package/dist/types/utils/dom.d.ts +0 -94
  36. package/dist/types/utils/dom.d.ts.map +1 -1
  37. package/dist/types/utils/html-asset-value.d.ts +20 -0
  38. package/dist/types/utils/html-asset-value.d.ts.map +1 -0
  39. package/dist/types/utils/rehydrate-scripts.d.ts +35 -0
  40. package/dist/types/utils/rehydrate-scripts.d.ts.map +1 -0
  41. package/package.json +2 -2
  42. package/dist/dom-CdxDV3e-.cjs +0 -1
  43. package/dist/experience-instance-BWL-yghq.cjs +0 -1
package/dist/esm/index.js CHANGED
@@ -2,25 +2,16 @@ import { t as e } from "../object-BUDGxEqy.js";
2
2
  import { n as t, t as n } from "../rules-logic-HesIUCu6.js";
3
3
  import { t as r } from "../logger-DMN6TxJJ.js";
4
4
  import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g } from "../supports-CO9bJGNl.js";
5
- import { a as _, c as v, i as y, o as b, r as ee, t as x } from "../dom-CZyRgp2P.js";
6
- import { l as S, n as C, r as w, u as T } from "../experience-instance-QSrdjfn6.js";
7
- import { i as E, n as D, r as O, t as k } from "../storage-1MW3-_As.js";
8
- import { n as te, r as ne } from "../api-CsddE4DI.js";
5
+ import { a as _, i as v, r as ee, s as y, t as b } from "../dom-BwmTHeT7.js";
6
+ import { l as x, n as S, r as C, u as w } from "../experience-instance-DCcKZrdI.js";
7
+ import { i as T, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
8
+ import { n as te, r as ne } from "../api-Dh6rss_Z.js";
9
9
  import { t as re } from "../id-Bo4RBeOs.js";
10
- import { attach as A, combine as j, createApi as M, createDomain as N, createEffect as P, createEvent as F, createStore as I, sample as L } from "effector";
11
- import { createFactory as R, invoke as z } from "@withease/factories";
10
+ import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, sample as I } from "effector";
11
+ import { createFactory as L, invoke as R } from "@withease/factories";
12
12
  //#region src/entities/experience/experience.ts
13
- var B = N("experience");
14
- function ie(e, t, n) {
15
- let r = new Set(t.filter((e) => e.elements.length > 0).map((e) => e.selector));
16
- for (let t of e) {
17
- if (t.placement !== "replace" || r.has(t.selector)) continue;
18
- let e = y(t.selector);
19
- !e || e === n || `${t.selector}${e}${n}`;
20
- }
21
- }
22
- var ae = R(({ client: e, experience: r }) => {
23
- let i = B.store(r), a = M(i, { merge(e, t) {
13
+ var z = M("experience"), ie = L(({ client: e, experience: r }) => {
14
+ let i = z.store(r), a = j(i, { merge(e, t) {
24
15
  return {
25
16
  ...e,
26
17
  ...t.experience
@@ -30,24 +21,24 @@ var ae = R(({ client: e, experience: r }) => {
30
21
  decisionLogic: e.condition,
31
22
  targetSelectors: e.targets,
32
23
  initializeOpenLogic: e.initializeOpen
33
- })), s = j(i, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), c = j(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
34
- let r = e.nodes.filter(T).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(S).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
24
+ })), s = A(i, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), c = A(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
25
+ let r = e.nodes.filter(w).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(x).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
35
26
  return {
36
27
  steps: r,
37
28
  nodes: e.nodes,
38
29
  edges: e.edges,
39
30
  conditions: i
40
31
  };
41
- }), l = r.actions ?? [], u, d = A({
32
+ }), l = r.actions ?? [], u, d = k({
42
33
  source: o,
43
34
  effect: (t, n) => {
44
- let i = _(t.targetSelectors, r.id);
45
- i.forEach(({ elements: e }) => e.forEach((e) => v(e, r.id))), x(i, r.id, r.key).forEach((t) => {
35
+ let i = v(t.targetSelectors, r.id);
36
+ i.forEach(({ elements: e }) => e.forEach((e) => y(e, r.id))), b(i, r.id, r.key).forEach((t) => {
46
37
  n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
47
- }), ie(t.targetSelectors, i, r.id);
38
+ });
48
39
  }
49
- }), f = A({
50
- source: j({
40
+ }), f = k({
41
+ source: A({
51
42
  preconditionPassed: e.preconditionPassedStore,
52
43
  isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
53
44
  config: o
@@ -55,9 +46,9 @@ var ae = R(({ client: e, experience: r }) => {
55
46
  effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
56
47
  if (!i || !a) return !1;
57
48
  let { decisionLogic: s, targetSelectors: c } = o;
58
- return c.length === 0 || _(c, r.id).length < 1 ? !1 : s === void 0 ? !0 : t(s) ? await n(e, s) === !0 : !0;
49
+ return c.length === 0 || v(c, r.id).length < 1 ? !1 : s === void 0 ? !0 : t(s) ? await n(e, s) === !0 : !0;
59
50
  }
60
- }), p = P(async () => {
51
+ }), p = N(async () => {
61
52
  if (!e.contentLoader) return !0;
62
53
  try {
63
54
  await e.contentLoader({
@@ -68,26 +59,26 @@ var ae = R(({ client: e, experience: r }) => {
68
59
  `${r.id}`;
69
60
  }
70
61
  return !0;
71
- }), m = F(), h = F(), g = B.createStore(void 0, { skipVoid: !1 }).on(m, (e, t) => t).on(h, (e, t) => t);
72
- return L({
62
+ }), m = P(), h = P(), g = z.createStore(void 0, { skipVoid: !1 }).on(m, (e, t) => t).on(h, (e, t) => t);
63
+ return I({
73
64
  clock: m,
74
65
  target: f
75
- }), L({
66
+ }), I({
76
67
  clock: f.doneData,
77
68
  source: g,
78
69
  filter: (e, t) => t,
79
70
  fn: (e) => e,
80
71
  target: d
81
- }), L({
72
+ }), I({
82
73
  clock: f.doneData,
83
74
  filter: Boolean,
84
75
  target: p
85
- }), L({
76
+ }), I({
86
77
  clock: h,
87
78
  source: g,
88
79
  fn: (e) => e,
89
80
  target: d
90
- }), L({
81
+ }), I({
91
82
  clock: h,
92
83
  target: p
93
84
  }), u = {
@@ -106,60 +97,22 @@ var ae = R(({ client: e, experience: r }) => {
106
97
  prepareExperienceContentFx: p
107
98
  }, u;
108
99
  });
109
- function oe(e) {
110
- return z(ae, e);
111
- }
112
- var se = 5e3;
113
- function ce(e, t) {
114
- return new Promise((n) => {
115
- let r = setTimeout(n, t);
116
- e.then(() => {
117
- clearTimeout(r), n();
118
- });
119
- });
120
- }
121
- function le(e) {
122
- return e.configStore.getState().targetSelectors.filter((e) => e.placement === "replace").map((e) => e.selector);
123
- }
124
- function ue(e) {
125
- let t = /* @__PURE__ */ new Map();
126
- for (let n of e) for (let e of le(n)) t.set(e, (t.get(e) ?? 0) + 1);
127
- let n = [], r = [];
128
- for (let i of e) le(i).some((e) => (t.get(e) ?? 0) > 1) ? n.push(i) : r.push(i);
129
- return {
130
- serialised: n,
131
- parallel: r
132
- };
133
- }
134
- async function de(e) {
135
- let t;
136
- try {
137
- let n = new Promise((n) => {
138
- t = e.initialiseFx.finally.watch(() => n());
139
- });
140
- await e.shouldInitialiseFx() && await ce(n, se);
141
- } catch {
142
- `${e.id}`;
143
- } finally {
144
- t?.();
145
- }
100
+ function ae(e) {
101
+ return R(ie, e);
146
102
  }
147
- async function fe(e) {
148
- for (let t of e) await de(t);
149
- }
150
- var pe = R(({ client: e }) => {
151
- let t = B.store({}), n = M(t, { register(e, t) {
103
+ var oe = L(({ client: e }) => {
104
+ let t = z.store({}), n = j(t, { register(e, t) {
152
105
  return {
153
106
  ...e,
154
107
  [t.id]: t
155
108
  };
156
- } }), r = F(), i = P((t) => {
157
- n.register(oe({
109
+ } }), r = P(), i = N((t) => {
110
+ n.register(ae({
158
111
  client: e,
159
112
  experience: t
160
113
  }));
161
114
  });
162
- L({
115
+ I({
163
116
  clock: r,
164
117
  source: t,
165
118
  filter: (e, t) => e[t.id] !== void 0,
@@ -172,7 +125,7 @@ var pe = R(({ client: e }) => {
172
125
  experience: t,
173
126
  strategy: "override"
174
127
  });
175
- }), L({
128
+ }), I({
176
129
  clock: r,
177
130
  source: t,
178
131
  filter: (e, t) => e[t.id] === void 0,
@@ -186,7 +139,7 @@ var pe = R(({ client: e }) => {
186
139
  function s(e) {
187
140
  return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
188
141
  }
189
- let c = A({
142
+ let c = k({
190
143
  source: t,
191
144
  effect: (e, t) => {
192
145
  let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
@@ -204,7 +157,7 @@ var pe = R(({ client: e }) => {
204
157
  getById: o,
205
158
  getByKey: s,
206
159
  launch: c,
207
- open: A({
160
+ open: k({
208
161
  source: {
209
162
  experiences: t,
210
163
  instances: e.experienceInstances.listStore
@@ -231,29 +184,28 @@ var pe = R(({ client: e }) => {
231
184
  }
232
185
  }),
233
186
  listStore: a,
234
- initialiseExperiencesFx: A({
187
+ initialiseExperiencesFx: k({
235
188
  source: a,
236
- effect: async (e) => {
237
- let { serialised: t, parallel: n } = ue(e);
238
- await Promise.all([fe(t), ...n.map((e) => de(e))]);
189
+ effect: (e) => {
190
+ for (let t of e) t.initialiseRequested(void 0);
239
191
  }
240
192
  })
241
193
  };
242
194
  });
243
- function me(e) {
244
- return z(pe, e);
195
+ function se(e) {
196
+ return R(oe, e);
245
197
  }
246
- var he = async (e) => {
198
+ var ce = async (e) => {
247
199
  await e.experiences.initialiseExperiencesFx();
248
200
  };
249
201
  //#endregion
250
202
  //#region src/entities/plugin/plugin.ts
251
- function ge(e) {
252
- return P(async () => {
203
+ function le(e) {
204
+ return N(async () => {
253
205
  await e();
254
206
  });
255
207
  }
256
- var _e = (e, t, n) => {
208
+ var ue = (e, t, n) => {
257
209
  let r = t.name, i = t.setup(e);
258
210
  if (i) {
259
211
  let e = n[r] ?? {};
@@ -262,29 +214,29 @@ var _e = (e, t, n) => {
262
214
  ...i
263
215
  });
264
216
  }
265
- }, ve = N("component"), ye = R(({ client: e, component: t, name: n }) => ({
217
+ }, de = M("component"), fe = L(({ client: e, component: t, name: n }) => ({
266
218
  name: n,
267
219
  component: t,
268
220
  frameworkStore: e.frameworks.getByName(t.frameworkName)
269
221
  }));
270
- function be(e) {
271
- return z(ye, e);
222
+ function pe(e) {
223
+ return R(fe, e);
272
224
  }
273
- var xe = R(({ client: e }) => {
274
- let t = ve.store({}), n = M(t, { register(e, t) {
225
+ var me = L(({ client: e }) => {
226
+ let t = de.store({}), n = j(t, { register(e, t) {
275
227
  return {
276
228
  ...e,
277
229
  [t.name]: t
278
230
  };
279
- } }), i = F();
280
- L({
231
+ } }), i = P();
232
+ I({
281
233
  clock: i,
282
234
  source: t,
283
235
  filter: (e, { name: t }) => e[t] !== void 0,
284
236
  fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
285
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
237
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
286
238
  clock: i,
287
- fn: ({ name: t, component: n }) => be({
239
+ fn: ({ name: t, component: n }) => pe({
288
240
  client: e,
289
241
  name: t,
290
242
  component: n
@@ -301,27 +253,27 @@ var xe = R(({ client: e }) => {
301
253
  listStore: a
302
254
  };
303
255
  });
304
- function Se(e) {
305
- return z(xe, e);
256
+ function he(e) {
257
+ return R(me, e);
306
258
  }
307
- var Ce = (e, t, n) => {
259
+ var B = (e, t, n) => {
308
260
  n.register({
309
261
  name: e,
310
262
  component: t
311
263
  });
312
- }, we = N("framework"), Te = R((e) => {
313
- let t = we.store({}), n = M(t, { register(e, t) {
264
+ }, ge = M("framework"), _e = L((e) => {
265
+ let t = ge.store({}), n = j(t, { register(e, t) {
314
266
  return {
315
267
  ...e,
316
268
  [t.name]: t.framework
317
269
  };
318
- } }), i = F();
319
- L({
270
+ } }), i = P();
271
+ I({
320
272
  clock: i,
321
273
  source: t,
322
274
  filter: (e, { name: t }) => e[t] !== void 0,
323
275
  fn: (e, { name: t }) => `Framework '${t}' already registered. Registering again will override the previous registration.`
324
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
276
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
325
277
  clock: i,
326
278
  target: n.register
327
279
  });
@@ -335,34 +287,34 @@ var Ce = (e, t, n) => {
335
287
  listStore: a
336
288
  };
337
289
  });
338
- function Ee(e) {
339
- return z(Te, e);
290
+ function ve(e) {
291
+ return R(_e, e);
340
292
  }
341
- var De = (e, t) => {
293
+ var ye = (e, t) => {
342
294
  t.register({
343
295
  name: e.name,
344
296
  framework: e
345
297
  });
346
- }, Oe = R(({ client: e }) => {
298
+ }, be = L(({ client: e }) => {
347
299
  let t = "window" in globalThis, n = {
348
300
  location: t ? globalThis.location : void 0,
349
301
  document: t ? globalThis.document : void 0,
350
302
  sessionStorage: t ? globalThis.sessionStorage : void 0,
351
303
  localStorage: t ? globalThis.localStorage : void 0
352
304
  };
353
- return j(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
305
+ return A(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
354
306
  client: e,
355
307
  responses: t,
356
308
  fields: r,
357
309
  ...n
358
310
  }));
359
311
  });
360
- function ke(e) {
361
- return z(Oe, e);
312
+ function xe(e) {
313
+ return R(be, e);
362
314
  }
363
315
  //#endregion
364
316
  //#region src/logic-engine.ts
365
- function Ae(e) {
317
+ function Se(e) {
366
318
  return typeof e == "number" && !isNaN(e);
367
319
  }
368
320
  function V(e) {
@@ -371,21 +323,21 @@ function V(e) {
371
323
  function H(e) {
372
324
  return Array.isArray(e);
373
325
  }
374
- function je(e) {
326
+ function Ce(e) {
375
327
  return e instanceof Promise;
376
328
  }
377
- function Me(e) {
329
+ function we(e) {
378
330
  return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
379
331
  }
380
332
  function U(e) {
381
- if (Ae(e)) return e;
333
+ if (Se(e)) return e;
382
334
  let t = parseFloat(`${e}`);
383
335
  return isNaN(t) ? 0 : t;
384
336
  }
385
337
  function W(e) {
386
338
  return `${e}`;
387
339
  }
388
- var Ne = {
340
+ var Te = {
389
341
  "==": (e, t) => e == t,
390
342
  "===": (e, t) => e === t,
391
343
  "!=": (e, t) => e != t,
@@ -480,10 +432,10 @@ var Ne = {
480
432
  };
481
433
  async function G(e, t) {
482
434
  if (!e) return e;
483
- if (je(e)) return G(await e, t);
435
+ if (Ce(e)) return G(await e, t);
484
436
  if (H(e)) return Promise.all(e.map((e) => G(e, t)));
485
- if (!Me(e)) return e;
486
- let n = Pe(e), r = n ? e[n] ?? [] : [];
437
+ if (!we(e)) return e;
438
+ let n = Ee(e), r = n ? e[n] ?? [] : [];
487
439
  switch (H(r) || (r = [r]), n) {
488
440
  case "if":
489
441
  case "?:":
@@ -541,17 +493,17 @@ async function G(e, t) {
541
493
  case "catch": try {
542
494
  return await G(r[0], t);
543
495
  } catch (e) {
544
- return Me(e) ? await G(e, t) : r[1] ? await G(r[1], e) : e instanceof Error ? e.message : e;
496
+ return we(e) ? await G(e, t) : r[1] ? await G(r[1], e) : e instanceof Error ? e.message : e;
545
497
  }
546
498
  }
547
- let i = await Promise.all(r.map((e) => G(e, t))), a = n ? Ne[n] : void 0;
499
+ let i = await Promise.all(r.map((e) => G(e, t))), a = n ? Te[n] : void 0;
548
500
  if (!a) throw Error(`Unrecognized operation ${n}`);
549
501
  return a.apply(t, i);
550
502
  }
551
503
  async function K(e) {
552
- return je(e) ? K(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
504
+ return Ce(e) ? K(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
553
505
  }
554
- function Pe(e) {
506
+ function Ee(e) {
555
507
  return Object.keys(e)[0];
556
508
  }
557
509
  //#endregion
@@ -566,7 +518,7 @@ function q(e, t, n) {
566
518
  }) === !0;
567
519
  } });
568
520
  }
569
- var Fe = R(({ client: e }) => A({
521
+ var De = L(({ client: e }) => k({
570
522
  source: {
571
523
  stateSnapshot: e.stateSnapshotStore,
572
524
  predicates: e.predicates.listStore,
@@ -609,15 +561,15 @@ var Fe = R(({ client: e }) => A({
609
561
  });
610
562
  }
611
563
  }));
612
- function Ie(e) {
613
- return z(Fe, e);
564
+ function Oe(e) {
565
+ return R(De, e);
614
566
  }
615
567
  //#endregion
616
568
  //#region src/ping.ts
617
- var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
569
+ var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
618
570
  try {
619
- let t = Date.now(), n = D.get(Re), r = 0;
620
- if (n.isSet() && (r = n.json() ?? 0), r && t - r < Le) return !0;
571
+ let t = Date.now(), n = E.get(Ae), r = 0;
572
+ if (n.isSet() && (r = n.json() ?? 0), r && t - r < ke) return !0;
621
573
  let i = {
622
574
  projectId: e.projectId,
623
575
  path: window.location.pathname
@@ -628,120 +580,120 @@ var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
628
580
  } catch {
629
581
  return !1;
630
582
  }
631
- }, J = N("lifecycle"), Be = R(({ client: e }) => {
632
- let t = J.store(!1), r = I(void 0, {
583
+ }, J = M("lifecycle"), Me = L(({ client: e }) => {
584
+ let t = J.store(!1), r = F(void 0, {
633
585
  skipVoid: !1,
634
586
  domain: J
635
- }), i = I(void 0, {
587
+ }), i = F(void 0, {
636
588
  skipVoid: !1,
637
589
  domain: J
638
- }), a = J.store("idle"), o = J.store([]), s = I(void 0, {
590
+ }), a = J.store("idle"), o = J.store([]), s = F(void 0, {
639
591
  skipVoid: !1,
640
592
  domain: J
641
- }), l = I(void 0, {
593
+ }), l = F(void 0, {
642
594
  skipVoid: !1,
643
595
  domain: J
644
- }), u = F(), d = F(), f = F(), p = F(), m = F(), h = F();
596
+ }), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
645
597
  o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
646
- let g = P(() => {
647
- ze(e);
648
- }), _ = P(async () => {
598
+ let g = N(() => {
599
+ je(e);
600
+ }), _ = N(async () => {
649
601
  await ee();
650
- }), v = P(async () => {
651
- await he(e);
652
- }), y = A({ effect: v }), b = A({
602
+ }), v = N(async () => {
603
+ await ce(e);
604
+ }), y = k({ effect: v }), b = k({
653
605
  source: o,
654
606
  effect: async (e) => {
655
607
  for (let t of e) await t();
656
608
  }
657
- }), x = A({
609
+ }), x = k({
658
610
  source: s,
659
611
  effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
660
- }), S = A({
612
+ }), S = k({
661
613
  source: l,
662
614
  effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
663
- }), C = L({
615
+ }), C = I({
664
616
  clock: u,
665
617
  source: a,
666
618
  filter: (e) => e === "idle" && c(),
667
619
  fn: () => void 0
668
620
  });
669
- L({
621
+ I({
670
622
  clock: C,
671
623
  fn: () => "starting",
672
624
  target: a
673
- }), L({
625
+ }), I({
674
626
  clock: C,
675
627
  target: g
676
- }), L({
628
+ }), I({
677
629
  clock: C,
678
630
  target: b
679
- }), L({
631
+ }), I({
680
632
  clock: C,
681
633
  target: _
682
- }), L({
634
+ }), I({
683
635
  clock: b.done,
684
636
  target: x
685
- }), L({
637
+ }), I({
686
638
  clock: x.doneData,
687
639
  target: r
688
- }), L({
640
+ }), I({
689
641
  clock: S.doneData,
690
642
  target: i
691
- }), L({
643
+ }), I({
692
644
  clock: x.doneData,
693
645
  filter: (e) => e,
694
646
  target: S
695
- }), L({
647
+ }), I({
696
648
  clock: S.doneData,
697
649
  target: e.session.setIsUser
698
- }), L({
650
+ }), I({
699
651
  clock: S.doneData,
700
652
  fn: (e) => ({
701
653
  type: "user_decide",
702
654
  value: e
703
655
  }),
704
656
  target: e.eventBus
705
- }), L({
657
+ }), I({
706
658
  clock: x.doneData,
707
659
  filter: (e) => !e,
708
660
  fn: () => void 0,
709
661
  target: f
710
- }), L({
662
+ }), I({
711
663
  clock: S.doneData,
712
664
  fn: () => void 0,
713
665
  target: f
714
- }), L({
666
+ }), I({
715
667
  clock: f,
716
668
  fn: () => ({ type: "initialize" }),
717
669
  target: e.eventBus
718
670
  });
719
- let w = I(!1).on(_.done, () => !0), T = I(!1).on(f, () => !0), E = I(!1).on(y.done, () => !0), D = j(r, i, (e, t) => e === !0 && t === !0);
720
- return L({
671
+ let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0), E = F(!1).on(y.done, () => !0), D = A(r, i, (e, t) => e === !0 && t === !0);
672
+ return I({
721
673
  clock: f,
722
674
  source: D,
723
675
  filter: (e) => e,
724
676
  fn: () => void 0,
725
677
  target: v
726
- }), L({
727
- clock: j(w, T, D, (e, t, n) => e && t && n),
678
+ }), I({
679
+ clock: A(w, T, D, (e, t, n) => e && t && n),
728
680
  filter: (e) => e,
729
681
  fn: () => void 0,
730
682
  target: y
731
- }), L({
732
- clock: j(w, T, D, E, (e, t, n, r) => e && t && (!n || r)),
683
+ }), I({
684
+ clock: A(w, T, D, E, (e, t, n, r) => e && t && (!n || r)),
733
685
  filter: (e) => e,
734
686
  fn: () => void 0,
735
687
  target: d
736
- }), L({
688
+ }), I({
737
689
  clock: d,
738
690
  fn: () => "ready",
739
691
  target: a
740
- }), L({
692
+ }), I({
741
693
  clock: d,
742
694
  fn: () => ({ type: "ready" }),
743
695
  target: e.eventBus
744
- }), L({
696
+ }), I({
745
697
  clock: d,
746
698
  source: e.session.store,
747
699
  fn: ({ id: e, isUser: t, identifiers: n }) => ({
@@ -751,7 +703,7 @@ var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
751
703
  identifiers: n
752
704
  }),
753
705
  target: e.eventBus
754
- }), L({
706
+ }), I({
755
707
  clock: [
756
708
  b.fail,
757
709
  x.fail,
@@ -773,13 +725,13 @@ var Le = 6e3, Re = k("last_ping", "global"), ze = async (e) => {
773
725
  setCondition: h
774
726
  };
775
727
  });
776
- function Ve(e) {
777
- return z(Be, e);
728
+ function Ne(e) {
729
+ return R(Me, e);
778
730
  }
779
731
  //#endregion
780
732
  //#region src/entities/predicate/predicate.ts
781
- var He = N("predicate"), Ue = R(({ client: e }) => {
782
- let t = He.store({}), n = M(t, { register(e, t) {
733
+ var Pe = M("predicate"), Fe = L(({ client: e }) => {
734
+ let t = Pe.store({}), n = j(t, { register(e, t) {
783
735
  return {
784
736
  ...e,
785
737
  [t.name]: {
@@ -787,13 +739,13 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
787
739
  predicate: t.predicate
788
740
  }
789
741
  };
790
- } }), i = F();
791
- L({
742
+ } }), i = P();
743
+ I({
792
744
  clock: i,
793
745
  source: t,
794
746
  filter: (e, { name: t }) => e[t] !== void 0,
795
747
  fn: (e, { name: t }) => `Predicate '${t}' already registered. Registering again will override the previous registration.`
796
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
748
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
797
749
  clock: i,
798
750
  fn: ({ name: e, predicate: t }) => Object.freeze({
799
751
  name: e,
@@ -806,7 +758,7 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
806
758
  return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
807
759
  }
808
760
  function s(t) {
809
- let n = I(() => void 0, { skipVoid: !1 }), r = A({
761
+ let n = F(() => void 0, { skipVoid: !1 }), r = k({
810
762
  source: {
811
763
  predicate: o(t),
812
764
  snapshot: e.stateSnapshotStore
@@ -818,13 +770,13 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
818
770
  });
819
771
  }
820
772
  });
821
- return L({
773
+ return I({
822
774
  source: {
823
775
  responses: e.responses.listStore,
824
776
  fields: e.fields.listStore
825
777
  },
826
778
  target: r
827
- }), L({
779
+ }), I({
828
780
  clock: r.doneData,
829
781
  filter: (e) => e !== void 0,
830
782
  target: n
@@ -837,27 +789,27 @@ var He = N("predicate"), Ue = R(({ client: e }) => {
837
789
  getEvokablePredicate: s
838
790
  };
839
791
  });
840
- function We(e) {
841
- return z(Ue, e);
792
+ function Ie(e) {
793
+ return R(Fe, e);
842
794
  }
843
- var Ge = (e, t, n) => {
795
+ var Le = (e, t, n) => {
844
796
  n.register({
845
797
  name: e,
846
798
  predicate: t
847
799
  });
848
- }, Ke = N("feature"), qe = R(({ client: e }) => {
849
- let t = Ke.store({}), n = Ke.store([]), i = M(t, { register(e, t) {
800
+ }, Y = M("feature"), Re = L(({ client: e }) => {
801
+ let t = Y.store({}), n = Y.store([]), i = j(t, { register(e, t) {
850
802
  return {
851
803
  ...e,
852
804
  [t.id]: t.feature
853
805
  };
854
- } }), a = F();
855
- L({
806
+ } }), a = P();
807
+ I({
856
808
  clock: a,
857
809
  source: t,
858
810
  filter: (e, { id: t }) => e[t] !== void 0,
859
811
  fn: (e, { id: t }) => `Feature '${t}' already registered. Registering again will override the previous registration.`
860
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
812
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
861
813
  clock: a,
862
814
  fn: ({ id: e, feature: t }) => Object.freeze({
863
815
  id: e,
@@ -871,19 +823,19 @@ var Ge = (e, t, n) => {
871
823
  }),
872
824
  target: i.register
873
825
  });
874
- let o = P(async ({ id: e, key: t, storage: n = "local" }) => {
875
- let r = k(`feature:${e}:${t}`, "global"), i = (n === "session" ? O : D).get(r).boolean();
826
+ let o = N(async ({ id: e, key: t, storage: n = "local" }) => {
827
+ let r = O(`feature:${e}:${t}`, "global"), i = (n === "session" ? D : E).get(r).boolean();
876
828
  return i === null ? null : {
877
829
  id: e,
878
830
  key: t,
879
831
  bucket: i,
880
832
  storage: n
881
833
  };
882
- }), s = P((e) => {
834
+ }), s = N((e) => {
883
835
  if (!e) return null;
884
- let t = k(`feature:${e.id}:${e.key}`, "global");
885
- (e.storage === "session" ? O : D).set(t, e.bucket);
886
- }), c = /* @__PURE__ */ new Map(), l = A({
836
+ let t = O(`feature:${e.id}:${e.key}`, "global");
837
+ (e.storage === "session" ? D : E).set(t, e.bucket);
838
+ }), c = /* @__PURE__ */ new Map(), l = k({
887
839
  source: {
888
840
  allFeaturesStore: t,
889
841
  resolvedFeaturesStore: n
@@ -914,7 +866,7 @@ var Ge = (e, t, n) => {
914
866
  };
915
867
  }
916
868
  });
917
- L({
869
+ I({
918
870
  clock: i.register,
919
871
  fn: (e) => {
920
872
  let { id: t, feature: n } = e;
@@ -925,7 +877,7 @@ var Ge = (e, t, n) => {
925
877
  };
926
878
  },
927
879
  target: o
928
- }), L({
880
+ }), I({
929
881
  source: t,
930
882
  clock: l.doneData,
931
883
  fn: (e, t) => {
@@ -939,7 +891,7 @@ var Ge = (e, t, n) => {
939
891
  },
940
892
  target: s
941
893
  });
942
- let u = j({
894
+ let u = A({
943
895
  allFeaturesStore: t,
944
896
  resolvedFeaturesStore: n
945
897
  }).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
@@ -961,7 +913,7 @@ var Ge = (e, t, n) => {
961
913
  isResolved: !1
962
914
  };
963
915
  }));
964
- L({
916
+ I({
965
917
  clock: l.doneData,
966
918
  source: { resolvedFeatures: n },
967
919
  filter: ({ resolvedFeatures: e }, { id: t, key: n }) => !e.some((e) => e.id === t && e.key === n),
@@ -970,7 +922,7 @@ var Ge = (e, t, n) => {
970
922
  type: "feature_decide",
971
923
  feature: e
972
924
  }))
973
- }), L({
925
+ }), I({
974
926
  clock: [o.doneData, l.doneData],
975
927
  source: n,
976
928
  fn: (e, t) => !t || e.some((e) => e.id === t.id && e.key === t.key) ? e : [...e, t],
@@ -983,17 +935,17 @@ var Ge = (e, t, n) => {
983
935
  return t.map((t) => t[e], { skipVoid: !1 });
984
936
  }
985
937
  function p(e) {
986
- let t = I(async () => void 0, { skipVoid: !1 }), r = A({
938
+ let t = F(async () => void 0, { skipVoid: !1 }), r = k({
987
939
  source: d(e),
988
940
  effect: async (e) => {
989
941
  if (e) return async () => (await e.getBucket()).bucket;
990
942
  }
991
943
  });
992
- return L({
944
+ return I({
993
945
  source: n,
994
946
  filter: (t) => t.some((t) => t.id === e),
995
947
  target: r
996
- }), L({
948
+ }), I({
997
949
  clock: r.doneData,
998
950
  filter: (e) => e !== void 0,
999
951
  target: t
@@ -1007,115 +959,69 @@ var Ge = (e, t, n) => {
1007
959
  getEvokableFeature: p
1008
960
  };
1009
961
  });
1010
- function Je(e) {
1011
- return z(qe, e);
962
+ function ze(e) {
963
+ return R(Re, e);
1012
964
  }
1013
- var Ye = (e, t, n) => {
965
+ var Be = (e, t, n) => {
1014
966
  n.register({
1015
967
  id: e,
1016
968
  feature: t
1017
969
  });
1018
- }, Y = N("history");
1019
- function X(e, t, n) {
970
+ }, X = M("history");
971
+ function Ve(e, t) {
1020
972
  return {
1021
- id: re("history-entry"),
1022
- node: n,
973
+ id: re(`history-entry-${Date.now()}-${Math.random()}}`),
974
+ node: t,
1023
975
  at: Date.now(),
1024
- instanceId: e,
1025
- experienceId: t
976
+ experienceId: e
1026
977
  };
1027
978
  }
1028
- function Xe(e) {
1029
- for (let t = e.length - 1; t >= 0; t--) {
1030
- let n = e[t];
1031
- if (n && T(n.node)) return e.slice(0, t + 1);
1032
- }
1033
- return [];
1034
- }
1035
- var Ze = R(() => {
1036
- let e = Y.store([]), t = Y.event(), n = Y.event(), r = Y.event(), i = Y.event(), a = Y.event(), o = Y.event(), s = Y.event(), c = Y.event();
1037
- e.on(t, (e, t) => [...e, X(t.instanceId ?? t.experienceId, t.experienceId, t.node)]), e.on(n, (e, t) => {
1038
- let n = t.instanceId ?? t.experienceId, r = X(n, t.experienceId, t.node), i = -1;
1039
- for (let t = e.length - 1; t >= 0; t--) if (e[t]?.instanceId === n) {
1040
- i = t;
1041
- break;
1042
- }
1043
- return i === -1 ? [...e, r] : [
1044
- ...e.slice(0, i),
1045
- r,
1046
- ...e.slice(i + 1)
1047
- ];
1048
- }), e.on(r, (e, t) => {
1049
- let n = (e) => (t.instanceId === void 0 || e.instanceId === t.instanceId) && (t.experienceId === void 0 || e.experienceId === t.experienceId), r = 0, i = -1;
1050
- for (let t = e.length - 1; t >= 0; t--) {
1051
- let a = e[t];
1052
- if (!(!a || !n(a) || !T(a.node)) && ++r === 2) {
1053
- i = t;
979
+ var He = L(() => {
980
+ let e = X.store({ entries: [] }), t = X.event(), n = X.event(), r = X.event(), i = X.event();
981
+ e.on(t, (e, t) => ({ entries: [...e.entries, Ve(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Ve(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
982
+ function a(e, t) {
983
+ let n = {
984
+ lastStepIndex: -1,
985
+ secondLastStepIndex: -1
986
+ };
987
+ for (let r = e.length - 1; r >= 0; r--) {
988
+ let i = e[r], a = i?.node;
989
+ if (!(!a || !w(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
990
+ else {
991
+ n.secondLastStepIndex = r;
1054
992
  break;
1055
993
  }
1056
994
  }
1057
- return i === -1 ? e : e.filter((e, t) => !n(e) || t <= i);
1058
- }), e.on(i, (e, { entries: t }) => t.map((e) => ({
1059
- ...e,
1060
- instanceId: e.instanceId ?? e.experienceId
1061
- }))), e.on(a, (e, { snapshots: t }) => {
1062
- let n = new Set(e.map((e) => e.experienceId)), r = [];
1063
- for (let e of Object.keys(t)) {
1064
- if (n.has(e)) continue;
1065
- let i = t[e];
1066
- i && r.push(...i);
1067
- }
1068
- return r.length === 0 ? e : [...e, ...r];
1069
- }), e.on(c, (e, t) => [...e, ...t]), e.on(s, (e, { instanceId: t }) => {
1070
- let n = e.filter((e) => e.instanceId !== t);
1071
- return n.length === e.length ? e : n;
1072
- });
1073
- let l = e.map((e) => {
1074
- let t = /* @__PURE__ */ new Map();
1075
- for (let n of e) t.set(n.experienceId, n.instanceId);
1076
- let n = {};
1077
- for (let r of e) {
1078
- if (t.get(r.experienceId) !== r.instanceId) continue;
1079
- let e = n[r.experienceId] ?? [];
1080
- e.push(r), n[r.experienceId] = e;
1081
- }
1082
995
  return n;
1083
- });
1084
- return L({
1085
- clock: o,
1086
- source: l,
1087
- fn: (e, { instanceId: t, experienceId: n }) => Xe(e[n] ?? []).map((e) => ({
996
+ }
997
+ return e.on(r, (e, t) => {
998
+ let { secondLastStepIndex: n } = a(e.entries, t.experienceId), r = n === -1 ? e.entries : e.entries.slice(0, n + 1);
999
+ return {
1088
1000
  ...e,
1089
- id: re("history-entry"),
1090
- instanceId: t
1091
- })),
1092
- target: c
1001
+ entries: r
1002
+ };
1093
1003
  }), {
1094
1004
  push: t,
1095
1005
  replace: n,
1096
1006
  back: r,
1097
1007
  restore: i,
1098
- restoreSnapshots: a,
1099
- seedInstanceFromSnapshot: o,
1100
- clearForInstance: s,
1101
- entriesStore: e,
1102
- snapshotStore: l
1008
+ entriesStore: e.map((e) => e.entries)
1103
1009
  };
1104
1010
  });
1105
- function Qe() {
1106
- return z(Ze);
1011
+ function Ue() {
1012
+ return R(He);
1107
1013
  }
1108
1014
  //#endregion
1109
1015
  //#region src/utils/events.ts
1110
- var $e = 0, et = (e) => {
1111
- let t = I([]);
1016
+ var We = 0, Ge = (e) => {
1017
+ let t = F([]);
1112
1018
  return t.on(e, (e, t) => [...e, {
1113
- id: $e++,
1019
+ id: We++,
1114
1020
  at: /* @__PURE__ */ new Date(),
1115
1021
  payload: t
1116
1022
  }]), t;
1117
- }, tt = N("field"), nt = R(() => {
1118
- let e = tt.store({}), t = M(e, {
1023
+ }, Ke = M("field"), qe = L(() => {
1024
+ let e = Ke.store({}), t = j(e, {
1119
1025
  register(e, t) {
1120
1026
  return {
1121
1027
  ...e,
@@ -1163,13 +1069,13 @@ var $e = 0, et = (e) => {
1163
1069
  getByName: c
1164
1070
  };
1165
1071
  });
1166
- function rt() {
1167
- return z(nt);
1072
+ function Je() {
1073
+ return R(qe);
1168
1074
  }
1169
1075
  //#endregion
1170
1076
  //#region src/entities/step/step.ts
1171
- var it = N("step"), at = R(() => {
1172
- let e = it.store({}), t = M(e, { register(e, t) {
1077
+ var Ye = M("step"), Xe = L(() => {
1078
+ let e = Ye.store({}), t = j(e, { register(e, t) {
1173
1079
  return {
1174
1080
  ...e,
1175
1081
  [t.step.id]: t.step
@@ -1193,16 +1099,16 @@ var it = N("step"), at = R(() => {
1193
1099
  indexStore: e
1194
1100
  };
1195
1101
  });
1196
- function ot() {
1197
- return z(at);
1102
+ function Ze() {
1103
+ return R(Xe);
1198
1104
  }
1199
- function st(e, t) {
1105
+ function Qe(e, t) {
1200
1106
  t.register(e);
1201
1107
  }
1202
1108
  //#endregion
1203
1109
  //#region src/entities/content/content.ts
1204
- var ct = N("content"), lt = R(() => {
1205
- let e = ct.store({}), t = M(e, { register(e, t) {
1110
+ var $e = M("content"), et = L(() => {
1111
+ let e = $e.store({}), t = j(e, { register(e, t) {
1206
1112
  return {
1207
1113
  ...e,
1208
1114
  [t.content.id]: t.content
@@ -1222,16 +1128,16 @@ var ct = N("content"), lt = R(() => {
1222
1128
  indexStore: e
1223
1129
  };
1224
1130
  });
1225
- function ut() {
1226
- return z(lt);
1131
+ function tt() {
1132
+ return R(et);
1227
1133
  }
1228
- function dt(e, t) {
1134
+ function nt(e, t) {
1229
1135
  t.register(e);
1230
1136
  }
1231
1137
  //#endregion
1232
1138
  //#region src/entities/action/action.ts
1233
- var ft = N("action"), pt = R(({ client: e }) => {
1234
- let t = ft.store({}), n = M(t, { register(e, t) {
1139
+ var rt = M("action"), it = L(({ client: e }) => {
1140
+ let t = rt.store({}), n = j(t, { register(e, t) {
1235
1141
  return {
1236
1142
  ...e,
1237
1143
  [t.key]: {
@@ -1239,13 +1145,13 @@ var ft = N("action"), pt = R(({ client: e }) => {
1239
1145
  action: t.action
1240
1146
  }
1241
1147
  };
1242
- } }), i = F();
1243
- L({
1148
+ } }), i = P();
1149
+ I({
1244
1150
  clock: i,
1245
1151
  source: t,
1246
1152
  filter: (e, { key: t }) => e[t] !== void 0,
1247
1153
  fn: (e, { key: t }) => `Action '${t}' already registered. Registering again will override the previous registration.`
1248
- }).watch((e) => /* @__PURE__ */ r("warn", e)), L({
1154
+ }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
1249
1155
  clock: i,
1250
1156
  fn: ({ key: e, action: t }) => Object.freeze({
1251
1157
  key: e,
@@ -1258,7 +1164,7 @@ var ft = N("action"), pt = R(({ client: e }) => {
1258
1164
  return t.map((t) => t[e]?.action, { skipVoid: !1 });
1259
1165
  }
1260
1166
  function s(t, n) {
1261
- let r = I(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = A({
1167
+ let r = F(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = k({
1262
1168
  source: {
1263
1169
  action: o(t),
1264
1170
  snapshot: e.stateSnapshotStore
@@ -1270,13 +1176,13 @@ var ft = N("action"), pt = R(({ client: e }) => {
1270
1176
  }, i);
1271
1177
  }
1272
1178
  });
1273
- return L({
1179
+ return I({
1274
1180
  source: {
1275
1181
  responses: e.responses.listStore,
1276
1182
  fields: e.fields.listStore
1277
1183
  },
1278
1184
  target: a
1279
- }), L({
1185
+ }), I({
1280
1186
  clock: a.doneData,
1281
1187
  filter: (e) => e !== void 0,
1282
1188
  target: r
@@ -1289,10 +1195,10 @@ var ft = N("action"), pt = R(({ client: e }) => {
1289
1195
  getEvokableAction: s
1290
1196
  };
1291
1197
  });
1292
- function mt(e) {
1293
- return z(pt, e);
1198
+ function at(e) {
1199
+ return R(it, e);
1294
1200
  }
1295
- var ht = (e, t, n) => {
1201
+ var ot = (e, t, n) => {
1296
1202
  n.register({
1297
1203
  key: e,
1298
1204
  action: t
@@ -1311,35 +1217,35 @@ function Z(e, t, n, r) {
1311
1217
  function Q(e) {
1312
1218
  return e === null || e === "" || Array.isArray(e) && !e.length;
1313
1219
  }
1314
- function gt(e) {
1220
+ function st(e) {
1315
1221
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
1316
1222
  }
1317
- function _t(e) {
1223
+ function ct(e) {
1318
1224
  try {
1319
1225
  return JSON.stringify(e), !0;
1320
1226
  } catch {
1321
1227
  return !1;
1322
1228
  }
1323
1229
  }
1324
- function vt(e, t) {
1230
+ function lt(e, t) {
1325
1231
  return t.find((t) => t.key === e) ?? null;
1326
1232
  }
1327
- function yt(e, t) {
1233
+ function ut(e, t) {
1328
1234
  return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
1329
1235
  }
1330
- function bt(e, t) {
1236
+ function dt(e, t) {
1331
1237
  if (e.type !== "object" || Q(t)) return null;
1332
1238
  if (e.multiple) {
1333
1239
  if (!Array.isArray(t)) return Z(e, t, "This field expects multiple values", "Field expects an array of objects.");
1334
1240
  for (let n of t) {
1335
1241
  if (typeof n != "object" || !n) return Z(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
1336
- if (!_t(n)) return Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1242
+ if (!ct(n)) return Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1337
1243
  }
1338
1244
  return null;
1339
1245
  }
1340
- return Array.isArray(t) ? Z(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Z(e, t, "This field expects an object value", "Field expects an object value.") : _t(t) ? null : Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1246
+ return Array.isArray(t) ? Z(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Z(e, t, "This field expects an object value", "Field expects an object value.") : ct(t) ? null : Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1341
1247
  }
1342
- function xt(e, t) {
1248
+ function ft(e, t) {
1343
1249
  if (Q(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
1344
1250
  let n = Array.isArray(t) ? t : [t];
1345
1251
  if (e.type === "object") {
@@ -1347,9 +1253,9 @@ function xt(e, t) {
1347
1253
  return n.every((e) => r.has(JSON.stringify(e))) ? null : Z(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
1348
1254
  }
1349
1255
  let r = e.options.map((e) => e.value);
1350
- return n.every((e) => !gt(e) || e === null ? !1 : r.includes(e)) ? null : Z(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
1256
+ return n.every((e) => !st(e) || e === null ? !1 : r.includes(e)) ? null : Z(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
1351
1257
  }
1352
- async function St(t, n, r, i) {
1258
+ async function pt(t, n, r, i) {
1353
1259
  if (n.validation && !e(n.validation) && !Q(r)) {
1354
1260
  let e = i ? {
1355
1261
  $input: r,
@@ -1362,8 +1268,8 @@ async function St(t, n, r, i) {
1362
1268
  }
1363
1269
  //#endregion
1364
1270
  //#region src/entities/response/response.ts
1365
- var Ct = N("response"), wt = R(({ client: e }) => {
1366
- let t = Ct.store({}), r = F(), i = F(), a = M(t, {
1271
+ var mt = M("response"), ht = L(({ client: e }) => {
1272
+ let t = mt.store({}), r = P(), i = P(), a = j(t, {
1367
1273
  register(e, t) {
1368
1274
  return {
1369
1275
  ...e,
@@ -1392,7 +1298,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1392
1298
  });
1393
1299
  } else a.registerBatch(e);
1394
1300
  }
1395
- let s = (t, r) => n(e, t, r), c = A({
1301
+ let s = (t, r) => n(e, t, r), c = k({
1396
1302
  source: {
1397
1303
  allFields: e.fields.listStore,
1398
1304
  existingResponses: t
@@ -1402,7 +1308,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1402
1308
  ...t,
1403
1309
  ...n
1404
1310
  }, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
1405
- let o = vt(t, e);
1311
+ let o = lt(t, e);
1406
1312
  if (!o) {
1407
1313
  r.push({
1408
1314
  fieldKey: t,
@@ -1412,17 +1318,17 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1412
1318
  });
1413
1319
  return;
1414
1320
  }
1415
- let c = yt(o, n), l = await St(s, o, c, a);
1321
+ let c = ut(o, n), l = await pt(s, o, c, a);
1416
1322
  if (l) {
1417
1323
  r.push(l);
1418
1324
  return;
1419
1325
  }
1420
- let u = bt(o, c);
1326
+ let u = dt(o, c);
1421
1327
  if (u) {
1422
1328
  r.push(u);
1423
1329
  return;
1424
1330
  }
1425
- let d = xt(o, c);
1331
+ let d = ft(o, c);
1426
1332
  if (d) {
1427
1333
  r.push(d);
1428
1334
  return;
@@ -1450,7 +1356,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1450
1356
  async function l(e) {
1451
1357
  return c(e);
1452
1358
  }
1453
- let u = A({
1359
+ let u = k({
1454
1360
  source: t,
1455
1361
  effect: async (e, t) => {
1456
1362
  let { responsesToCommit: n, validationErrors: r } = await c(t);
@@ -1465,7 +1371,7 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1465
1371
  value: t
1466
1372
  })));
1467
1373
  function m(e) {
1468
- return j({
1374
+ return A({
1469
1375
  f: e,
1470
1376
  s: t
1471
1377
  }, ({ f: e, s: t }) => {
@@ -1482,30 +1388,16 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1482
1388
  function _(t) {
1483
1389
  return m(e.fields.getByName(t));
1484
1390
  }
1485
- L({
1391
+ return I({
1486
1392
  clock: r,
1487
1393
  target: a.clearAll
1488
- }), L({
1394
+ }), I({
1489
1395
  clock: i,
1490
1396
  target: a.clear
1491
- });
1492
- let v = A({
1493
- source: e.experiences.listStore,
1494
- effect: (e, t) => {
1495
- let n = e.find((e) => e.id === t);
1496
- if (!n) return;
1497
- let { steps: r } = n.treeStore.getState(), a = r.flatMap((e) => e.fieldKeys);
1498
- for (let e of a) i(e);
1499
- }
1500
- });
1501
- function y(e) {
1502
- v(e);
1503
- }
1504
- return {
1397
+ }), {
1505
1398
  register: o,
1506
1399
  clearAll: r,
1507
1400
  clear: i,
1508
- clearByExperience: y,
1509
1401
  commit: d,
1510
1402
  getResponsesToCommit: l,
1511
1403
  listStore: p,
@@ -1515,13 +1407,13 @@ var Ct = N("response"), wt = R(({ client: e }) => {
1515
1407
  getByFieldName: _
1516
1408
  };
1517
1409
  });
1518
- function Tt(e) {
1519
- return z(wt, e);
1410
+ function gt(e) {
1411
+ return R(ht, e);
1520
1412
  }
1521
1413
  //#endregion
1522
1414
  //#region src/entities/condition/condition.ts
1523
- var Et = N("condition"), Dt = R(() => {
1524
- let e = Et.store({}), t = M(e, { register(e, t) {
1415
+ var _t = M("condition"), vt = L(() => {
1416
+ let e = _t.store({}), t = j(e, { register(e, t) {
1525
1417
  return {
1526
1418
  ...e,
1527
1419
  [t.condition.id]: t.condition
@@ -1545,12 +1437,12 @@ var Et = N("condition"), Dt = R(() => {
1545
1437
  indexStore: e
1546
1438
  };
1547
1439
  });
1548
- function Ot() {
1549
- return z(Dt);
1440
+ function yt() {
1441
+ return R(vt);
1550
1442
  }
1551
1443
  //#endregion
1552
1444
  //#region src/utils/api-url.ts
1553
- function kt() {
1445
+ function bt() {
1554
1446
  if (c()) {
1555
1447
  let e = [
1556
1448
  document.currentScript,
@@ -1565,7 +1457,7 @@ function kt() {
1565
1457
  }
1566
1458
  //#endregion
1567
1459
  //#region src/utils/search-params.ts
1568
- function At() {
1460
+ function xt() {
1569
1461
  if (!s()) return {};
1570
1462
  let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
1571
1463
  for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
@@ -1573,23 +1465,23 @@ function At() {
1573
1465
  let n = r.replace("picked-", "");
1574
1466
  t[n] = e.getAll(r);
1575
1467
  }
1576
- let r = k("s");
1577
- if (n.size > 0) O.set(r, t);
1468
+ let r = O("s");
1469
+ if (n.size > 0) D.set(r, t);
1578
1470
  else {
1579
- let e = O.get(r);
1471
+ let e = D.get(r);
1580
1472
  if (e) return e.json() || {};
1581
1473
  }
1582
1474
  return t;
1583
1475
  }
1584
1476
  //#endregion
1585
1477
  //#region src/entities/session/session.ts
1586
- var jt = k("session", "global");
1587
- function Mt() {
1478
+ var St = O("session", "global");
1479
+ function Ct() {
1588
1480
  return p() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
1589
1481
  }
1590
- function Nt() {
1482
+ function wt() {
1591
1483
  if (!m()) return null;
1592
- let e = D.get(jt);
1484
+ let e = E.get(St);
1593
1485
  if (!e.isSet()) return null;
1594
1486
  try {
1595
1487
  return e.json();
@@ -1597,10 +1489,10 @@ function Nt() {
1597
1489
  return null;
1598
1490
  }
1599
1491
  }
1600
- var Pt = R(() => {
1601
- let e = Nt(), t = { id: e?.id ?? Mt() };
1492
+ var Tt = L(() => {
1493
+ let e = wt(), t = { id: e?.id ?? Ct() };
1602
1494
  e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
1603
- let n = I(t), r = M(n, {
1495
+ let n = F(t), r = j(n, {
1604
1496
  setIsUser: (e, t) => ({
1605
1497
  ...e,
1606
1498
  isUser: t
@@ -1621,13 +1513,13 @@ var Pt = R(() => {
1621
1513
  return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
1622
1514
  }
1623
1515
  });
1624
- return L({
1516
+ return I({
1625
1517
  source: n,
1626
- target: A({
1518
+ target: k({
1627
1519
  source: n,
1628
1520
  effect: (e) => {
1629
1521
  if (m()) try {
1630
- D.get(jt).set(e);
1522
+ E.get(St).set(e);
1631
1523
  } catch {}
1632
1524
  }
1633
1525
  })
@@ -1638,27 +1530,27 @@ var Pt = R(() => {
1638
1530
  removeIdentifier: r.removeIdentifier
1639
1531
  };
1640
1532
  });
1641
- function Ft() {
1642
- return z(Pt, void 0);
1533
+ function Et() {
1534
+ return R(Tt, void 0);
1643
1535
  }
1644
1536
  //#endregion
1645
1537
  //#region src/utils/picked-config.ts
1646
- function It() {
1538
+ function Dt() {
1647
1539
  if (s()) return globalThis.window.pickedConfig;
1648
1540
  }
1649
- function Lt() {
1650
- if (s()) return It()?.projectId;
1541
+ function Ot() {
1542
+ if (s()) return Dt()?.projectId;
1651
1543
  }
1652
- function Rt() {
1544
+ function kt() {
1653
1545
  if (!c()) return;
1654
1546
  let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
1655
1547
  if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
1656
1548
  }
1657
- function zt(e) {
1549
+ function At(e) {
1658
1550
  if (e.projectId) return e.projectId;
1659
- let t = Lt();
1551
+ let t = Ot();
1660
1552
  if (t) return t;
1661
- let n = Rt();
1553
+ let n = kt();
1662
1554
  if (n) return n;
1663
1555
  throw Error("projectId is required. You can provide it via one of:\n (1) createClient({ projectId }) options;\n (2) window.pickedConfig = { projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes a data-projectid (or project-id) attribute.");
1664
1556
  }
@@ -1667,7 +1559,7 @@ function zt(e) {
1667
1559
  function $(e) {
1668
1560
  return e == null || e === "" || Number.isNaN(e);
1669
1561
  }
1670
- var Bt = {
1562
+ var jt = {
1671
1563
  default: (e, t) => $(e) ? String(t ?? "") : String(e),
1672
1564
  append: (e, t) => t && !$(e) ? `${e} ${t}` : e,
1673
1565
  prepend: (e, t) => t && !$(e) ? `${t} ${e}` : e,
@@ -1688,24 +1580,24 @@ var Bt = {
1688
1580
  return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
1689
1581
  }
1690
1582
  };
1691
- function Vt(e) {
1583
+ function Mt(e) {
1692
1584
  return typeof e == "object" && !!e;
1693
1585
  }
1694
- function Ht(e, t) {
1586
+ function Nt(e, t) {
1695
1587
  let n = t;
1696
- for (let t of e.split(".")) if (Vt(n) && t in n) n = n[t];
1588
+ for (let t of e.split(".")) if (Mt(n) && t in n) n = n[t];
1697
1589
  else return;
1698
1590
  return typeof n == "function" ? n() : n;
1699
1591
  }
1700
- function Ut(e, t) {
1701
- let n = e.split("|").map((e) => e.trim()), r = Ht(n.shift() ?? "", t);
1592
+ function Pt(e, t) {
1593
+ let n = e.split("|").map((e) => e.trim()), r = Nt(n.shift() ?? "", t);
1702
1594
  for (let e of n) {
1703
- let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Bt[i];
1595
+ let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = jt[i];
1704
1596
  o && (r = o(r, a));
1705
1597
  }
1706
1598
  return $(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1707
1599
  }
1708
- function Wt(e, t) {
1600
+ function Ft(e, t) {
1709
1601
  let n = "", r = 0;
1710
1602
  for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
1711
1603
  r += 2;
@@ -1717,61 +1609,61 @@ function Wt(e, t) {
1717
1609
  }
1718
1610
  i += e[r++];
1719
1611
  }
1720
- n += Ut(i.trim(), t);
1612
+ n += Pt(i.trim(), t);
1721
1613
  } else n += e[r++];
1722
1614
  return n;
1723
1615
  }
1724
1616
  //#endregion
1725
1617
  //#region src/picked.ts
1726
- var Gt = class {
1618
+ var It = class {
1727
1619
  static logger = r;
1728
1620
  options;
1729
1621
  dataSource = null;
1730
1622
  contentLoader;
1731
1623
  plugins = {};
1732
- eventBus = F();
1624
+ eventBus = P();
1733
1625
  events;
1734
1626
  projectId;
1735
1627
  apiUrl;
1736
1628
  dashboardUrl;
1737
1629
  documentationSiteUrl;
1738
- session = Ft();
1739
- searchParams = At();
1740
- history = Qe();
1741
- components = Se({ client: this });
1742
- experienceInstances = C({ client: this });
1743
- experiences = me({ client: this });
1744
- frameworks = Ee({ client: this });
1745
- predicates = We({ client: this });
1746
- features = Je({ client: this });
1747
- conditions = Ot();
1748
- fields = rt();
1749
- responses = Tt({ client: this });
1750
- steps = ot();
1751
- contents = ut();
1752
- actions = mt({ client: this });
1753
- conditionResults = w();
1754
- stateSnapshotStore = ke({ client: this });
1755
- evaluateRuleLogicFx = Ie({ client: this });
1630
+ session = Et();
1631
+ searchParams = xt();
1632
+ history = Ue();
1633
+ components = he({ client: this });
1634
+ experienceInstances = S({ client: this });
1635
+ experiences = se({ client: this });
1636
+ frameworks = ve({ client: this });
1637
+ predicates = Ie({ client: this });
1638
+ features = ze({ client: this });
1639
+ conditions = yt();
1640
+ fields = Je();
1641
+ responses = gt({ client: this });
1642
+ steps = Ze();
1643
+ contents = tt();
1644
+ actions = at({ client: this });
1645
+ conditionResults = C();
1646
+ stateSnapshotStore = xe({ client: this });
1647
+ evaluateRuleLogicFx = Oe({ client: this });
1756
1648
  start;
1757
1649
  readyStore;
1758
1650
  preconditionPassedStore;
1759
1651
  conditionPassedStore;
1760
1652
  lifecycleStageStore;
1761
- lifecycle = Ve({ client: this });
1762
- renderStringFx = A({
1653
+ lifecycle = Ne({ client: this });
1654
+ renderStringFx = k({
1763
1655
  source: this.responses.listStore,
1764
1656
  effect: (e, { template: t, context: n }) => {
1765
1657
  let r = {};
1766
1658
  for (let t of e) r[t.fieldKey] = t.value;
1767
- return Wt(t, {
1659
+ return Ft(t, {
1768
1660
  ...n,
1769
1661
  responses: r
1770
1662
  });
1771
1663
  }
1772
1664
  });
1773
1665
  constructor(e) {
1774
- this.events = et(this.eventBus), this.projectId = zt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || kt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
1666
+ this.events = Ge(this.eventBus), this.projectId = At(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || bt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
1775
1667
  type: "load",
1776
1668
  version: ne()
1777
1669
  }), this.maybeStartPreviewBridge();
@@ -1780,21 +1672,21 @@ var Gt = class {
1780
1672
  !s() || !h() || this.searchParams["preview-token"]?.[0] && import("../preview-bridge-D76l-dPy.js").then((e) => e.initPreviewBridge()).catch(() => void 0);
1781
1673
  }
1782
1674
  registerFramework = (e) => {
1783
- De(e, this.frameworks);
1675
+ ye(e, this.frameworks);
1784
1676
  };
1785
1677
  registerComponent = (e, t) => {
1786
- Ce(e, t, this.components);
1678
+ B(e, t, this.components);
1787
1679
  };
1788
1680
  registerPlugin = (e) => {
1789
- _e(this, e, this.plugins);
1681
+ ue(this, e, this.plugins);
1790
1682
  let t = this.plugins[e.name];
1791
1683
  t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
1792
1684
  };
1793
1685
  registerFeature = (e, t) => {
1794
- Ye(e, t, this.features);
1686
+ Be(e, t, this.features);
1795
1687
  };
1796
1688
  registerPredicate = (e, t) => {
1797
- Ge(e, t, this.predicates);
1689
+ Le(e, t, this.predicates);
1798
1690
  };
1799
1691
  registerCondition = (e) => {
1800
1692
  this.conditions.register(e);
@@ -1803,16 +1695,16 @@ var Gt = class {
1803
1695
  this.fields.register(e);
1804
1696
  };
1805
1697
  registerStep = (e) => {
1806
- st(e, this.steps);
1698
+ Qe(e, this.steps);
1807
1699
  };
1808
1700
  registerContent = (e) => {
1809
- dt(e, this.contents);
1701
+ nt(e, this.contents);
1810
1702
  };
1811
1703
  registerAction = (e, t) => {
1812
- ht(e, t, this.actions);
1704
+ ot(e, t, this.actions);
1813
1705
  };
1814
1706
  registerExperience = (e) => {
1815
- e.component && Ce(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1707
+ e.component && B(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1816
1708
  };
1817
1709
  launchExperienceById = async (e, t) => {
1818
1710
  this.experiences.launch({
@@ -1894,23 +1786,50 @@ var Gt = class {
1894
1786
  });
1895
1787
  }
1896
1788
  getPluginConfig = (e) => this.plugins[e] ?? {};
1897
- };
1789
+ }, Lt = "application/picked-javascript", Rt = "application/picked-module", zt = "data-picked-hydrated";
1790
+ async function Bt(e) {
1791
+ if (!("document" in globalThis)) return;
1792
+ let t = "application/picked-module", n = "data-picked-hydrated";
1793
+ function r(e, t) {
1794
+ let r = document.createElement("script");
1795
+ for (let t of Array.from(e.attributes)) t.name !== "type" && r.setAttribute(t.name, t.value);
1796
+ t && r.setAttribute("type", t), r.setAttribute(n, ""), e.src ? r.async = !1 : r.textContent = e.textContent;
1797
+ let i = e.src ? new Promise((e) => {
1798
+ r.addEventListener("load", () => e(), { once: !0 }), r.addEventListener("error", () => e(), { once: !0 });
1799
+ }) : null;
1800
+ return e.replaceWith(r), i;
1801
+ }
1802
+ let i = Array.from(e.querySelectorAll(`script[type="application/picked-javascript"]:not([${n}]), script[type="${t}"]:not([${n}])`)).filter((e) => e instanceof HTMLScriptElement);
1803
+ for (let e of i) {
1804
+ if (!e.isConnected) continue;
1805
+ let n = r(e, e.getAttribute("type") === t ? "module" : null);
1806
+ n && await n;
1807
+ }
1808
+ }
1809
+ function Vt() {
1810
+ return `<script>(${Bt.toString()})(document)<\/script>`;
1811
+ }
1812
+ //#endregion
1813
+ //#region src/utils/html-asset-value.ts
1814
+ function Ht(e) {
1815
+ return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
1816
+ }
1898
1817
  //#endregion
1899
1818
  //#region src/entities/component/lazyComponent.ts
1900
- function Kt(e) {
1819
+ function Ut(e) {
1901
1820
  return {
1902
1821
  $$type: "lazy-component",
1903
1822
  load: e
1904
1823
  };
1905
1824
  }
1906
- function qt(e) {
1825
+ function Wt(e) {
1907
1826
  return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
1908
1827
  }
1909
1828
  //#endregion
1910
1829
  //#region src/exports.ts
1911
- var Jt = (e) => {
1912
- let t = new Gt(e);
1830
+ var Gt = (e) => {
1831
+ let t = new It(e);
1913
1832
  return u(t), t;
1914
1833
  };
1915
1834
  //#endregion
1916
- export { Gt as Picked, Jt as createClient, ge as createPluginEffect, k as createStorageKey, n as evaluateRuleLogic, It as getPickedConfig, h as isInsideIframe, qt as isLazyLoader, b as isPickedRoot, Kt as lazyComponent, D as localStore, O as sessionStore, E as subscribe, d as supportsCookies, p as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, m as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, g as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow };
1835
+ export { zt as PICKED_HYDRATED_ATTR, Rt as PICKED_MODULE_SCRIPT_TYPE, Lt as PICKED_SCRIPT_TYPE, It as Picked, Vt as buildRehydrateBootstrap, Gt as createClient, le as createPluginEffect, O as createStorageKey, n as evaluateRuleLogic, Dt as getPickedConfig, Ht as isHtmlAssetValue, h as isInsideIframe, Wt as isLazyLoader, _ as isPickedRoot, Ut as lazyComponent, E as localStore, Bt as rehydrateScripts, D as sessionStore, T as subscribe, d as supportsCookies, p as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, m as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, g as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow };