@picked/client 0.0.1-dev.1765971320697 → 0.0.1-dev.1767586122445

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/esm/index.js CHANGED
@@ -1,39 +1,39 @@
1
- var Y = Object.defineProperty;
2
- var J = (t, e, r) => e in t ? Y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var m = (t, e, r) => J(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { createDomain as b, createApi as F, createEffect as M, attach as Q, sample as x, combine as z, createEvent as C } from "effector";
5
- import { createFactory as k, invoke as w } from "@withease/factories";
6
- import { g as G, t as X, c as Z, i as ee, e as E, a as te, b as re, d as ne } from "../experience-instance-C4INDX6a.js";
7
- import { f as It } from "../experience-instance-C4INDX6a.js";
8
- import { l as S } from "../logger-C9a75KZn.js";
9
- import { c as R, l as $, s as O } from "../storage-BLmAhfhl.js";
10
- import { a as Ft } from "../storage-BLmAhfhl.js";
11
- import { g as se } from "../id-BW-g3y32.js";
12
- import { i as ie } from "../object-JwZ58NOH.js";
13
- import { s as D, a as U, b as oe, c as ae, d as ce } from "../supports-BjhuLJ8z.js";
14
- import { h as Et, f as jt, j as Pt, e as Rt, g as Bt, i as At, k as $t } from "../supports-BjhuLJ8z.js";
15
- const H = b("experience"), ue = k(
1
+ var J = Object.defineProperty;
2
+ var Q = (t, e, r) => e in t ? J(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var h = (t, e, r) => Q(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { createDomain as b, createApi as F, createEffect as N, attach as X, sample as x, combine as z, createEvent as D } from "effector";
5
+ import { createFactory as w, invoke as I } from "@withease/factories";
6
+ import { g as H, t as Z, c as ee, i as te, e as j, a as re, b as ne, d as se } from "../experience-instance-C4INDX6a.js";
7
+ import { f as Pt } from "../experience-instance-C4INDX6a.js";
8
+ import { l as k } from "../logger-C9a75KZn.js";
9
+ import { c as A, l as O, s as C } from "../storage-BLmAhfhl.js";
10
+ import { a as Rt } from "../storage-BLmAhfhl.js";
11
+ import { g as ie } from "../id-BW-g3y32.js";
12
+ import { i as oe } from "../object-JwZ58NOH.js";
13
+ import { s as U, a as M, b as ae, c as ce, d as ue } from "../supports-BjhuLJ8z.js";
14
+ import { h as Bt, f as Ot, j as Ct, e as zt, g as Dt, i as Ut, k as Mt } from "../supports-BjhuLJ8z.js";
15
+ const q = b("experience"), de = w(
16
16
  ({ client: t, experience: e }) => {
17
- const r = H.store(e), n = F(r, {
18
- merge(d, h) {
17
+ const r = q.store(e), n = F(r, {
18
+ merge(c, g) {
19
19
  return {
20
- ...d,
21
- ...h.experience
20
+ ...c,
21
+ ...g.experience
22
22
  };
23
23
  }
24
- }), i = r.map((d) => ({
25
- name: d.name,
26
- decisionLogic: d.condition ?? d.decide,
27
- targetSelectors: d.targets,
24
+ }), i = r.map((c) => ({
25
+ name: c.name,
26
+ decisionLogic: c.condition ?? c.decide,
27
+ targetSelectors: c.targets,
28
28
  initializeOpenLogic: e.initializeOpen
29
29
  })), a = t.components.listStore.map(
30
- (d) => d.find((h) => h.name === `experience:${e.id}`) || d.find((h) => h.name === "experience"),
30
+ (c) => c.find((g) => g.name === `experience:${e.id}`) || c.find((g) => g.name === "experience"),
31
31
  { skipVoid: !1 }
32
- ), s = r.map((d) => ({
33
- steps: d.steps,
34
- nodes: d.nodes,
35
- edges: d.edges,
36
- conditionals: d.conditionals
32
+ ), s = r.map((c) => ({
33
+ steps: c.steps,
34
+ nodes: c.nodes,
35
+ edges: c.edges,
36
+ conditionals: c.conditionals
37
37
  })), o = e.actions ?? [];
38
38
  return {
39
39
  id: e.id,
@@ -45,11 +45,11 @@ const H = b("experience"), ue = k(
45
45
  };
46
46
  }
47
47
  );
48
- function de(t) {
49
- return w(ue, t);
48
+ function le(t) {
49
+ return I(de, t);
50
50
  }
51
- const le = k(({ client: t }) => {
52
- const e = H.store({}), r = F(e, {
51
+ const pe = w(({ client: t }) => {
52
+ const e = q.store({}), r = F(e, {
53
53
  register(s, o) {
54
54
  return {
55
55
  ...s,
@@ -63,8 +63,8 @@ const le = k(({ client: t }) => {
63
63
  o.merge({ experience: s, strategy: "override" });
64
64
  return;
65
65
  }
66
- const d = de({ client: t, experience: s });
67
- r.register(d);
66
+ const c = le({ client: t, experience: s });
67
+ r.register(c);
68
68
  }
69
69
  const i = e.map((s) => Object.values(s));
70
70
  function a(s) {
@@ -76,34 +76,34 @@ const le = k(({ client: t }) => {
76
76
  listStore: i
77
77
  };
78
78
  });
79
- function pe(t) {
80
- return w(le, t);
79
+ function fe(t) {
80
+ return I(pe, t);
81
81
  }
82
82
  const ge = (t, e) => {
83
83
  e.register(t);
84
- }, q = (t, e) => {
85
- const { targetSelectors: r } = e.configStore.getState(), n = G(r, e.id);
84
+ }, K = (t, e) => {
85
+ const { targetSelectors: r } = e.configStore.getState(), n = H(r, e.id);
86
86
  n.forEach(
87
- ({ elements: a }) => a.forEach((s) => X(s, e.id))
88
- ), Z(n, e.id).forEach((a) => {
87
+ ({ elements: a }) => a.forEach((s) => Z(s, e.id))
88
+ ), ee(n, e.id).forEach((a) => {
89
89
  t.experienceInstances.spawn(e, a);
90
90
  });
91
- }, T = async (t) => {
91
+ }, V = async (t) => {
92
92
  await Promise.all(
93
93
  t.experiences.listStore.getState().map(async (e) => {
94
- await fe(t, e) && q(t, e);
94
+ await me(t, e) && K(t, e);
95
95
  })
96
96
  );
97
- }, fe = async (t, e) => {
97
+ }, me = async (t, e) => {
98
98
  const { decisionLogic: r, targetSelectors: n } = e.configStore.getState();
99
- return G(n, e.id).length < 1 || n.length === 0 ? !1 : r && ee(r) ? await E(t, r) === !0 : !0;
100
- }, me = (t, e, r) => {
99
+ return H(n, e.id).length < 1 || n.length === 0 ? !1 : r && te(r) ? await j(t, r) === !0 : !0;
100
+ }, he = (t, e, r) => {
101
101
  const n = e.name, i = e.setup(t);
102
102
  if (i) {
103
103
  const a = r[n] ?? {};
104
104
  r[n] = Object.freeze({ ...a, ...i });
105
105
  }
106
- }, he = b("component"), ye = k(
106
+ }, ye = b("component"), Se = w(
107
107
  ({ client: t, component: e, name: r }) => {
108
108
  const n = t.frameworks.getByName(e.frameworkName);
109
109
  return {
@@ -113,11 +113,11 @@ const ge = (t, e) => {
113
113
  };
114
114
  }
115
115
  );
116
- function ve(t) {
117
- return w(ye, t);
116
+ function ke(t) {
117
+ return I(Se, t);
118
118
  }
119
- const Se = k(({ client: t }) => {
120
- const e = he.store({}), r = F(e, {
119
+ const we = w(({ client: t }) => {
120
+ const e = ye.store({}), r = F(e, {
121
121
  register(s, o) {
122
122
  return {
123
123
  ...s,
@@ -126,12 +126,12 @@ const Se = k(({ client: t }) => {
126
126
  }
127
127
  });
128
128
  function n(s, o) {
129
- e.getState()[s] && S(
129
+ e.getState()[s] && k(
130
130
  "warn",
131
131
  `Component '${s}' already registered. Registering again will override the previous registration.`
132
132
  );
133
- const h = ve({ client: t, name: s, component: o });
134
- r.register(h);
133
+ const g = ke({ client: t, name: s, component: o });
134
+ r.register(g);
135
135
  }
136
136
  const i = e.map((s) => Object.values(s));
137
137
  function a(s) {
@@ -143,13 +143,13 @@ const Se = k(({ client: t }) => {
143
143
  listStore: i
144
144
  };
145
145
  });
146
- function ke(t) {
147
- return w(Se, t);
146
+ function Ie(t) {
147
+ return I(we, t);
148
148
  }
149
- const V = (t, e, r) => {
149
+ const T = (t, e, r) => {
150
150
  r.register(t, e);
151
- }, we = b("framework"), Ie = k(({ client: t }) => {
152
- const e = we.store({}), r = F(e, {
151
+ }, ve = b("framework"), be = w(({ client: t }) => {
152
+ const e = ve.store({}), r = F(e, {
153
153
  register(s, o) {
154
154
  return {
155
155
  ...s,
@@ -158,7 +158,7 @@ const V = (t, e, r) => {
158
158
  }
159
159
  });
160
160
  function n(s, o) {
161
- e.getState()[s] && S(
161
+ e.getState()[s] && k(
162
162
  "warn",
163
163
  `Framework '${s}' already registered. Registering again will override the previous registration.`
164
164
  ), r.register({ name: s, framework: o });
@@ -173,24 +173,24 @@ const V = (t, e, r) => {
173
173
  listStore: i
174
174
  };
175
175
  });
176
- function be(t) {
177
- return w(Ie, t);
176
+ function Fe(t) {
177
+ return I(be, t);
178
178
  }
179
- const Fe = (t, e) => {
179
+ const xe = (t, e) => {
180
180
  e.register(t.name, t);
181
- }, xe = 6e3, Ee = R("last_ping", "global"), je = (t) => `${t}/api/v1/ping`, Pe = async (t) => {
181
+ }, je = 6e3, Ee = A("last_ping", "global"), Pe = (t) => `${t}/api/v1/ping`, Ae = async (t) => {
182
182
  try {
183
- const e = Date.now(), r = $.get(Ee);
183
+ const e = Date.now(), r = O.get(Ee);
184
184
  let n = 0;
185
- if (r.isSet() && (n = r.json() ?? 0), n && e - n < xe)
185
+ if (r.isSet() && (n = r.json() ?? 0), n && e - n < je)
186
186
  return !0;
187
- const i = je(t.apiUrl), a = {
187
+ const i = Pe(t.apiUrl), a = {
188
188
  projectId: t.projectId,
189
189
  path: window.location.pathname
190
190
  }, s = JSON.stringify(a), o = {
191
191
  "Content-Type": "application/json"
192
- }, d = document.getElementById("picked_script"), h = d == null ? void 0 : d.dataset.verceltoken;
193
- h && (o["x-vercel-protection-bypass"] = h);
192
+ }, c = document.getElementById("picked_script"), g = c == null ? void 0 : c.dataset.verceltoken;
193
+ g && (o["x-vercel-protection-bypass"] = g);
194
194
  const l = (await fetch(i, {
195
195
  method: "POST",
196
196
  headers: o,
@@ -198,7 +198,7 @@ const Fe = (t, e) => {
198
198
  })).ok;
199
199
  return l && r.set(e), l;
200
200
  } catch (e) {
201
- return S("error", e), !1;
201
+ return k("error", e), !1;
202
202
  }
203
203
  };
204
204
  function Re(t) {
@@ -213,8 +213,8 @@ function Re(t) {
213
213
  };
214
214
  return Object.freeze(r);
215
215
  }
216
- const Be = b("predicate"), Ae = k(({ client: t }) => {
217
- const e = Be.store({}), r = F(e, {
216
+ const $e = b("predicate"), Be = w(({ client: t }) => {
217
+ const e = $e.store({}), r = F(e, {
218
218
  register(s, o) {
219
219
  return {
220
220
  ...s,
@@ -226,7 +226,7 @@ const Be = b("predicate"), Ae = k(({ client: t }) => {
226
226
  }
227
227
  });
228
228
  function n(s, o) {
229
- e.getState()[s] && S(
229
+ e.getState()[s] && k(
230
230
  "warn",
231
231
  `Predicate '${s}' already registered. Registering again will override the previous registration.`
232
232
  ), r.register(Object.freeze({ name: s, predicate: o }));
@@ -241,29 +241,29 @@ const Be = b("predicate"), Ae = k(({ client: t }) => {
241
241
  listStore: i
242
242
  };
243
243
  });
244
- function $e(t) {
245
- return w(Ae, t);
244
+ function Oe(t) {
245
+ return I(Be, t);
246
246
  }
247
- const Oe = (t, e, r) => {
247
+ const Ce = (t, e, r) => {
248
248
  r.register(t, e);
249
- }, N = b("feature"), ze = k(({ client: t }) => {
250
- const e = N.store({}), r = N.store([]), n = F(e, {
251
- register(l, u) {
249
+ }, _ = b("feature"), ze = w(({ client: t }) => {
250
+ const e = _.store({}), r = _.store([]), n = F(e, {
251
+ register(l, d) {
252
252
  return {
253
253
  ...l,
254
- [u.id]: u.feature
254
+ [d.id]: d.feature
255
255
  };
256
256
  }
257
257
  });
258
- function i(l, u) {
259
- e.getState()[l] && S(
258
+ function i(l, d) {
259
+ e.getState()[l] && k(
260
260
  "warn",
261
261
  `Feature '${l}' already registered. Registering again will override the previous registration.`
262
262
  );
263
263
  const p = {
264
264
  id: l,
265
265
  feature: {
266
- ...u,
266
+ ...d,
267
267
  id: l
268
268
  }
269
269
  };
@@ -274,154 +274,154 @@ const Oe = (t, e, r) => {
274
274
  })
275
275
  );
276
276
  }
277
- const a = M(
277
+ const a = N(
278
278
  async ({
279
279
  id: l,
280
- key: u,
281
- storage: c = "local"
280
+ key: d,
281
+ storage: u = "local"
282
282
  }) => {
283
- const p = R(`feature:${l}:${u}`, "global"), g = (c === "session" ? O : $).get(p).boolean();
284
- return g === null ? null : { id: l, key: u, bucket: g, storage: c };
283
+ const p = A(`feature:${l}:${d}`, "global"), f = (u === "session" ? C : O).get(p).boolean();
284
+ return f === null ? null : { id: l, key: d, bucket: f, storage: u };
285
285
  }
286
- ), s = M((l) => {
286
+ ), s = N((l) => {
287
287
  if (!l)
288
288
  return null;
289
- const u = R(`feature:${l.id}:${l.key}`, "global");
290
- (l.storage === "session" ? O : $).set(u, l.bucket);
291
- }), o = /* @__PURE__ */ new Map(), d = Q({
289
+ const d = A(`feature:${l.id}:${l.key}`, "global");
290
+ (l.storage === "session" ? C : O).set(d, l.bucket);
291
+ }), o = /* @__PURE__ */ new Map(), c = X({
292
292
  source: { allFeaturesStore: e, resolvedFeaturesStore: r },
293
- effect: async ({ allFeaturesStore: l, resolvedFeaturesStore: u }, { id: c, decide: p, key: f }) => {
294
- const g = u.find(
295
- (A) => A.id === c && A.key === f
293
+ effect: async ({ allFeaturesStore: l, resolvedFeaturesStore: d }, { id: u, decide: p, key: m }) => {
294
+ const f = d.find(
295
+ ($) => $.id === u && $.key === m
296
296
  );
297
- if (g)
298
- return g;
299
- const y = l[c];
297
+ if (f)
298
+ return f;
299
+ const y = l[u];
300
300
  if (!y)
301
- throw new Error(`Feature with id '${c}' not found`);
302
- const I = o.get(`${c}:${f}`);
303
- if (I !== void 0) {
304
- const A = await I;
305
- return { id: y.id, bucket: A, key: f, storage: y.feature.storage };
301
+ throw new Error(`Feature with id '${u}' not found`);
302
+ const v = o.get(`${u}:${m}`);
303
+ if (v !== void 0) {
304
+ const $ = await v;
305
+ return { id: y.id, bucket: $, key: m, storage: y.feature.storage };
306
306
  }
307
- const B = p();
308
- o.set(`${c}:${f}`, B);
309
- const j = await B;
310
- return { id: y.id, bucket: j, key: f, storage: y.feature.storage };
307
+ const R = p();
308
+ o.set(`${u}:${m}`, R);
309
+ const E = await R;
310
+ return { id: y.id, bucket: E, key: m, storage: y.feature.storage };
311
311
  }
312
312
  });
313
313
  x({
314
314
  clock: n.register,
315
315
  fn: (l) => {
316
- const { id: u, feature: c } = l;
317
- return { id: u, key: c.feature.key, storage: c.feature.storage };
316
+ const { id: d, feature: u } = l;
317
+ return { id: d, key: u.feature.key, storage: u.feature.storage };
318
318
  },
319
319
  target: a
320
320
  }), x({
321
321
  source: e,
322
- clock: d.doneData,
323
- fn: (l, u) => {
322
+ clock: c.doneData,
323
+ fn: (l, d) => {
324
324
  var y;
325
- const { id: c, bucket: p, storage: f } = u, g = (y = l[c]) == null ? void 0 : y.feature.key;
326
- return g ? { key: g, id: c, bucket: p, storage: f } : null;
325
+ const { id: u, bucket: p, storage: m } = d, f = (y = l[u]) == null ? void 0 : y.feature.key;
326
+ return f ? { key: f, id: u, bucket: p, storage: m } : null;
327
327
  },
328
328
  target: s
329
329
  });
330
- const h = z({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
330
+ const g = z({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
331
331
  ({
332
332
  allFeaturesStore: l,
333
- resolvedFeaturesStore: u
334
- }) => Object.values(l).map((c) => {
335
- const p = u.find(
336
- (f) => f.id === c.id && f.key === c.feature.key
333
+ resolvedFeaturesStore: d
334
+ }) => Object.values(l).map((u) => {
335
+ const p = d.find(
336
+ (m) => m.id === u.id && m.key === u.feature.key
337
337
  );
338
338
  return p ? {
339
- id: c.id,
340
- name: c.feature.name,
341
- key: c.feature.key,
342
- getBucket: () => ({ id: c.id, bucket: p.bucket }),
339
+ id: u.id,
340
+ name: u.feature.name,
341
+ key: u.feature.key,
342
+ getBucket: () => ({ id: u.id, bucket: p.bucket }),
343
343
  isResolved: !0
344
344
  } : {
345
- id: c.id,
346
- name: c.feature.name,
347
- key: c.feature.key,
348
- getBucket: async () => await d(c.feature),
345
+ id: u.id,
346
+ name: u.feature.name,
347
+ key: u.feature.key,
348
+ getBucket: async () => await c(u.feature),
349
349
  isResolved: !1
350
350
  };
351
351
  })
352
352
  );
353
353
  x({
354
- clock: d.doneData,
354
+ clock: c.doneData,
355
355
  source: { resolvedFeatures: r },
356
- filter: ({ resolvedFeatures: l }, { id: u, key: c }) => !l.some(
357
- (f) => f.id === u && f.key === c
356
+ filter: ({ resolvedFeatures: l }, { id: d, key: u }) => !l.some(
357
+ (m) => m.id === d && m.key === u
358
358
  ),
359
- fn: (l, u) => u,
359
+ fn: (l, d) => d,
360
360
  target: t.eventBus.prepend((l) => ({
361
361
  type: "feature_decide",
362
362
  feature: l
363
363
  }))
364
364
  }), x({
365
- clock: [a.doneData, d.doneData],
365
+ clock: [a.doneData, c.doneData],
366
366
  source: r,
367
- fn: (l, u) => !u || l.some(
368
- (p) => p.id === u.id && p.key === u.key
369
- ) ? l : [...l, u],
367
+ fn: (l, d) => !d || l.some(
368
+ (p) => p.id === d.id && p.key === d.key
369
+ ) ? l : [...l, d],
370
370
  target: r
371
371
  });
372
- function v(l) {
373
- return e.map((u) => u[l], { skipVoid: !1 });
372
+ function S(l) {
373
+ return e.map((d) => d[l], { skipVoid: !1 });
374
374
  }
375
375
  return {
376
376
  register: i,
377
- getByName: v,
378
- listStore: h
377
+ getByName: S,
378
+ listStore: g
379
379
  };
380
380
  });
381
- function Ce(t) {
382
- return w(ze, t);
381
+ function De(t) {
382
+ return I(ze, t);
383
383
  }
384
- const De = (t, e, r) => {
384
+ const Ue = (t, e, r) => {
385
385
  r.register(t, e);
386
386
  }, P = b("history");
387
- function _(t, e) {
387
+ function L(t, e) {
388
388
  return {
389
389
  // eslint-disable-next-line sonarjs/pseudo-random
390
- id: se(`history-entry-${Date.now()}-${Math.random()}}`),
390
+ id: ie(`history-entry-${Date.now()}-${Math.random()}}`),
391
391
  node: e,
392
392
  at: Date.now(),
393
393
  experienceId: t
394
394
  };
395
395
  }
396
- const Ue = k(() => {
396
+ const Me = w(() => {
397
397
  const t = P.store({ entries: [] }), e = P.event(), r = P.event(), n = P.event(), i = P.event();
398
398
  t.on(e, (s, o) => ({
399
- entries: [...s.entries, _(o.experienceId, o.node)]
399
+ entries: [...s.entries, L(o.experienceId, o.node)]
400
400
  })), t.on(r, (s, o) => ({
401
401
  entries: [
402
402
  ...s.entries.slice(0, -1),
403
- _(o.experienceId, o.node)
403
+ L(o.experienceId, o.node)
404
404
  ]
405
405
  })), t.on(i, (s, o) => o);
406
406
  function a(s, o) {
407
- const d = { lastStepIndex: -1, secondLastStepIndex: -1 };
408
- for (let h = s.length - 1; h >= 0; h--) {
409
- const v = s[h], l = v == null ? void 0 : v.node;
410
- if (!(!l || !te(l)) && !(o && (v == null ? void 0 : v.experienceId) !== o))
411
- if (d.lastStepIndex === -1)
412
- d.lastStepIndex = h;
407
+ const c = { lastStepIndex: -1, secondLastStepIndex: -1 };
408
+ for (let g = s.length - 1; g >= 0; g--) {
409
+ const S = s[g], l = S == null ? void 0 : S.node;
410
+ if (!(!l || !re(l)) && !(o && (S == null ? void 0 : S.experienceId) !== o))
411
+ if (c.lastStepIndex === -1)
412
+ c.lastStepIndex = g;
413
413
  else {
414
- d.secondLastStepIndex = h;
414
+ c.secondLastStepIndex = g;
415
415
  break;
416
416
  }
417
417
  }
418
- return d;
418
+ return c;
419
419
  }
420
420
  return t.on(n, (s, o) => {
421
- const { secondLastStepIndex: d } = a(s.entries, o.experienceId), h = d !== -1 ? s.entries.slice(0, d + 1) : s.entries;
421
+ const { secondLastStepIndex: c } = a(s.entries, o.experienceId), g = c !== -1 ? s.entries.slice(0, c + 1) : s.entries;
422
422
  return {
423
423
  ...s,
424
- entries: h
424
+ entries: g
425
425
  };
426
426
  }), {
427
427
  push: e,
@@ -431,42 +431,52 @@ const Ue = k(() => {
431
431
  entriesStore: t.map((s) => s.entries)
432
432
  };
433
433
  });
434
- function Me() {
435
- return w(Ue);
434
+ function Ne() {
435
+ return I(Me);
436
436
  }
437
- const Te = () => C(), Ve = b("field"), Ne = k(() => {
438
- const t = Ve.store({}), e = F(t, {
439
- register(s, o) {
437
+ const Ve = () => D(), Te = b("field"), _e = w(() => {
438
+ const t = Te.store({}), e = F(t, {
439
+ register(o, c) {
440
440
  return {
441
- ...s,
442
- [o.field.id]: o.field
441
+ ...o,
442
+ [c.field.id]: c.field
443
443
  };
444
444
  }
445
445
  });
446
- function r(s) {
447
- e.register({ field: s });
446
+ function r(o) {
447
+ e.register({ field: o });
448
+ }
449
+ function n(o, c) {
450
+ const g = a(o).getState();
451
+ if (!g)
452
+ return;
453
+ const S = Object.assign({}, g, {
454
+ ...c
455
+ });
456
+ e.register({ field: { ...S } });
448
457
  }
449
- const n = t.map((s) => Object.values(s));
450
- function i(s) {
451
- return t.map((o) => o[s] || null);
458
+ const i = t.map((o) => Object.values(o));
459
+ function a(o) {
460
+ return t.map((c) => c[o] || null);
452
461
  }
453
- function a(s) {
454
- return t.map((o) => Object.values(o).find((d) => d.name === s) || null);
462
+ function s(o) {
463
+ return t.map((c) => Object.values(c).find((g) => g.name === o) || null);
455
464
  }
456
465
  return {
457
466
  register: r,
458
- getById: i,
459
- listStore: n,
460
- getByName: a
467
+ update: n,
468
+ getById: a,
469
+ listStore: i,
470
+ getByName: s
461
471
  };
462
472
  });
463
- function _e() {
464
- return w(Ne);
473
+ function Le() {
474
+ return I(_e);
465
475
  }
466
- const Le = (t, e) => {
476
+ const Ge = (t, e) => {
467
477
  e.register(t);
468
- }, Ge = b("action"), He = k(() => {
469
- const t = Ge.store({}), e = F(t, {
478
+ }, He = b("action"), qe = w(() => {
479
+ const t = He.store({}), e = F(t, {
470
480
  register(a, s) {
471
481
  return {
472
482
  ...a,
@@ -490,125 +500,125 @@ const Le = (t, e) => {
490
500
  listStore: n
491
501
  };
492
502
  });
493
- function qe() {
494
- return w(He);
503
+ function Ke() {
504
+ return I(qe);
495
505
  }
496
- const Ke = (t, e, r) => {
506
+ const We = (t, e, r) => {
497
507
  r.register(t, e);
498
508
  };
499
- function L(t) {
509
+ function G(t) {
500
510
  return typeof t > "u" || t === null || t === "" || Array.isArray(t) && !t.length;
501
511
  }
502
- const We = b("response"), Ye = k(({ client: t }) => {
503
- const e = We.store({}), r = C(), n = C(), i = F(e, {
504
- register(u, c) {
512
+ const Ye = b("response"), Je = w(({ client: t }) => {
513
+ const e = Ye.store({}), r = D(), n = D(), i = F(e, {
514
+ register(d, u) {
505
515
  return {
506
- ...u,
507
- [c.fieldId]: c.response
516
+ ...d,
517
+ [u.fieldId]: u.response
508
518
  };
509
519
  },
510
- registerBatch(u, c) {
520
+ registerBatch(d, u) {
511
521
  return {
512
- ...u,
513
- ...c
522
+ ...d,
523
+ ...u
514
524
  };
515
525
  },
516
- clear(u, c) {
517
- const { [c]: p, ...f } = u;
518
- return f;
526
+ clear(d, u) {
527
+ const { [u]: p, ...m } = d;
528
+ return m;
519
529
  },
520
530
  clearAll() {
521
531
  return {};
522
532
  }
523
533
  });
524
- function a(u, c) {
525
- i.register({ fieldId: u, response: c });
534
+ function a(d, u) {
535
+ i.register({ fieldId: d, response: u });
526
536
  }
527
- async function s(u) {
528
- const c = [];
537
+ async function s(d) {
538
+ const u = [];
529
539
  return await Promise.allSettled(
530
- Object.entries(u).map(async ([p, f]) => {
531
- let g = f;
540
+ Object.entries(d).map(async ([p, m]) => {
541
+ let f = m;
532
542
  const y = t.fields.getById(p).getState();
533
543
  if (!y) {
534
- c.push({
544
+ u.push({
535
545
  fieldId: p,
536
546
  userMessage: `Field '${p}' not found`,
537
547
  systemMessage: `No field with ID '${p}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
538
- value: g
548
+ value: f
539
549
  });
540
550
  return;
541
551
  }
542
- if (y.multiple && (typeof g == "string" || typeof g == "number" || typeof g == "boolean") && (g = [g]), y.validation && !ie(y.validation) && !L(g)) {
543
- const I = await E(t, y.validation, {
544
- $input: g
552
+ if (y.multiple && (typeof f == "string" || typeof f == "number" || typeof f == "boolean") && (f = [f]), y.validation && !oe(y.validation) && !G(f)) {
553
+ const v = await j(t, y.validation, {
554
+ $input: f
545
555
  });
546
- if (typeof I == "string") {
547
- c.push({
556
+ if (typeof v == "string") {
557
+ u.push({
548
558
  fieldId: p,
549
- userMessage: I,
550
- systemMessage: `Field validation resulted in an error: ${I}.`,
551
- value: g
559
+ userMessage: v,
560
+ systemMessage: `Field validation resulted in an error: ${v}.`,
561
+ value: f
552
562
  });
553
563
  return;
554
564
  }
555
- if (I === !1) {
556
- c.push({
565
+ if (v === !1) {
566
+ u.push({
557
567
  fieldId: p,
558
568
  userMessage: "This field is invalid",
559
569
  systemMessage: "Field validation resulted in an unspecified error.",
560
- value: g
570
+ value: f
561
571
  });
562
572
  return;
563
573
  }
564
574
  }
565
- if (y.required && L(g)) {
566
- c.push({
575
+ if (y.required && G(f)) {
576
+ u.push({
567
577
  fieldId: p,
568
578
  userMessage: "This field is required",
569
579
  systemMessage: "Field is required.",
570
- value: g
580
+ value: f
571
581
  });
572
582
  return;
573
583
  }
574
- if (!y.multiple && Array.isArray(g) && g.length > 1) {
575
- c.push({
584
+ if (!y.multiple && Array.isArray(f) && f.length > 1) {
585
+ u.push({
576
586
  fieldId: p,
577
587
  userMessage: "This field expects a single response",
578
588
  systemMessage: "Field expects a single response.",
579
- value: g
589
+ value: f
580
590
  });
581
591
  return;
582
592
  }
583
593
  if (y.options) {
584
- const I = y.options.map((j) => j.value), B = Array.isArray(g) ? g : [g];
585
- Array.isArray(g) && (B.every((j) => I.includes(j)) || c.push({
594
+ const v = y.options.map((E) => E.value), R = Array.isArray(f) ? f : [f];
595
+ Array.isArray(f) && (R.every((E) => v.includes(E)) || u.push({
586
596
  fieldId: p,
587
597
  userMessage: "This field expects a valid option",
588
- systemMessage: `Field expects a valid option. Valid options are: ${I.join(", ")}`,
589
- value: g
598
+ systemMessage: `Field expects a valid option. Valid options are: ${v.join(", ")}`,
599
+ value: f
590
600
  }));
591
601
  }
592
602
  })
593
- ), { responsesToCommit: u, validationErrors: c };
603
+ ), { responsesToCommit: d, validationErrors: u };
594
604
  }
595
- async function o(u) {
596
- const { responsesToCommit: c, validationErrors: p } = await s(u);
597
- return p.length ? { errors: p } : (i.registerBatch(c), { errors: [] });
605
+ async function o(d) {
606
+ const { responsesToCommit: u, validationErrors: p } = await s(d);
607
+ return p.length ? { errors: p } : (i.registerBatch(u), { errors: [] });
598
608
  }
599
- const d = e.map((u) => u), h = e.map((u) => Object.keys(u).map((p) => ({
609
+ const c = e.map((d) => d), g = e.map((d) => Object.keys(d).map((p) => ({
600
610
  fieldId: p,
601
- value: u[p]
611
+ value: d[p]
602
612
  })));
603
- function v(u) {
604
- const c = t.fields.getById(u), p = e.map((f) => f[u] || null);
605
- return z({ f: c, r: p }, ({ f, r: g }) => g || (f != null && f.defaultValue ? f.defaultValue : null));
606
- }
607
- function l(u) {
608
- const c = t.fields.getByName(u);
609
- return z({ f: c, s: e }, ({ f: p, s: f }) => {
610
- const g = p && f[p.id] || null;
611
- return g || (p != null && p.defaultValue ? p.defaultValue : null);
613
+ function S(d) {
614
+ const u = t.fields.getById(d), p = e.map((m) => m[d] || null);
615
+ return z({ f: u, r: p }, ({ f: m, r: f }) => f || (m != null && m.defaultValue ? m.defaultValue : null));
616
+ }
617
+ function l(d) {
618
+ const u = t.fields.getByName(d);
619
+ return z({ f: u, s: e }, ({ f: p, s: m }) => {
620
+ const f = p && m[p.id] || null;
621
+ return f || (p != null && p.defaultValue ? p.defaultValue : null);
612
622
  });
613
623
  }
614
624
  return x({
@@ -623,18 +633,18 @@ const We = b("response"), Ye = k(({ client: t }) => {
623
633
  clear: n,
624
634
  commit: o,
625
635
  getResponsesToCommit: s,
626
- listStore: h,
627
- getAllStore: d,
628
- getByFieldId: v,
636
+ listStore: g,
637
+ getAllStore: c,
638
+ getByFieldId: S,
629
639
  getByFieldName: l
630
640
  };
631
641
  });
632
- function Je(t) {
633
- return w(Ye, t);
642
+ function Qe(t) {
643
+ return I(Je, t);
634
644
  }
635
- const Qe = () => "0.0.1-dev.1765971320697";
636
- function Xe() {
637
- if (D()) {
645
+ const Xe = () => "0.0.1-dev.1767586122445";
646
+ function Ze() {
647
+ if (U()) {
638
648
  const t = [
639
649
  document.currentScript,
640
650
  document.getElementById("picked_script"),
@@ -648,8 +658,8 @@ function Xe() {
648
658
  }
649
659
  return "https://api.picked.app";
650
660
  }
651
- function Ze() {
652
- if (!U())
661
+ function et() {
662
+ if (!M())
653
663
  return {};
654
664
  const t = new URLSearchParams(window.location.search), e = {}, r = /* @__PURE__ */ new Set();
655
665
  for (const [i] of t.entries())
@@ -658,24 +668,24 @@ function Ze() {
658
668
  const a = i.replace("picked-", "");
659
669
  e[a] = t.getAll(i);
660
670
  }
661
- const n = R("s");
671
+ const n = A("s");
662
672
  if (r.size > 0)
663
- O.set(n, e);
673
+ C.set(n, e);
664
674
  else {
665
- const i = O.get(n);
675
+ const i = C.get(n);
666
676
  if (i)
667
677
  return i.json() || {};
668
678
  }
669
679
  return e;
670
680
  }
671
- function et() {
672
- if (ae())
681
+ function tt() {
682
+ if (ce())
673
683
  return crypto.randomUUID();
674
684
  const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), r = Math.random().toString(36).substring(2, 15), n = Math.random().toString(36).substring(2, 15);
675
685
  return `${t}-${e}-${r}-${n}`;
676
686
  }
677
- const tt = R("session", "global"), rt = () => {
678
- const t = $.get(tt);
687
+ const rt = A("session", "global"), nt = () => {
688
+ const t = O.get(rt);
679
689
  let e;
680
690
  t.isSet() && (e = t.json());
681
691
  const r = (i) => t.set({
@@ -683,7 +693,7 @@ const tt = R("session", "global"), rt = () => {
683
693
  isUser: i.isUser,
684
694
  identifiers: i.identifiers
685
695
  }), n = {
686
- id: (e == null ? void 0 : e.id) ?? et(),
696
+ id: (e == null ? void 0 : e.id) ?? tt(),
687
697
  isUser: (e == null ? void 0 : e.isUser) ?? void 0,
688
698
  identifiers: (e == null ? void 0 : e.identifiers) ?? void 0,
689
699
  setIsUser(i) {
@@ -699,19 +709,19 @@ const tt = R("session", "global"), rt = () => {
699
709
  }
700
710
  };
701
711
  return r(n), n;
702
- }, nt = () => oe() ? rt() : null;
703
- function st() {
704
- if (U())
712
+ }, st = () => ae() ? nt() : null;
713
+ function it() {
714
+ if (M())
705
715
  return globalThis.window.pickedConfig;
706
716
  }
707
- function it() {
708
- if (!U())
717
+ function ot() {
718
+ if (!M())
709
719
  return;
710
- const t = st(), e = t == null ? void 0 : t.organizationId, r = t == null ? void 0 : t.projectId;
720
+ const t = it(), e = t == null ? void 0 : t.organizationId, r = t == null ? void 0 : t.projectId;
711
721
  return e && r ? { organizationId: e, projectId: r } : void 0;
712
722
  }
713
- function ot() {
714
- if (!D())
723
+ function at() {
724
+ if (!U())
715
725
  return;
716
726
  const t = document.getElementById("picked_script") || document.querySelector("script#picked") || // legacy support for 'cvly' script tag
717
727
  document.getElementById("cvly");
@@ -720,14 +730,14 @@ function ot() {
720
730
  const e = t.dataset.organizationid || t.getAttribute("organization-id"), r = t.dataset.projectid || t.getAttribute("project-id");
721
731
  return e && r ? { organizationId: e, projectId: r } : void 0;
722
732
  }
723
- function at(t) {
733
+ function ct(t) {
724
734
  const { organizationId: e, projectId: r } = t;
725
735
  if (e && r)
726
736
  return { organizationId: e, projectId: r };
727
- const n = it();
737
+ const n = ot();
728
738
  if (n)
729
739
  return n;
730
- const i = ot();
740
+ const i = at();
731
741
  if (i)
732
742
  return i;
733
743
  throw new Error(
@@ -737,73 +747,184 @@ function at(t) {
737
747
  (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.`
738
748
  );
739
749
  }
740
- class K {
750
+ function B(t) {
751
+ return t == null || t === "" || Number.isNaN(t);
752
+ }
753
+ const ut = {
754
+ default: (t, e) => B(t) ? String(e ?? "") : String(t),
755
+ append: (t, e) => e && !B(t) ? `${t} ${e}` : t,
756
+ prepend: (t, e) => e && !B(t) ? `${e} ${t}` : t,
757
+ upper: (t) => typeof t == "string" ? t.toUpperCase() : t,
758
+ lower: (t) => typeof t == "string" ? t.toLowerCase() : t,
759
+ capitalize: (t) => typeof t == "string" ? t.charAt(0).toUpperCase() + t.slice(1) : t,
760
+ list: (t) => {
761
+ if (!t || typeof t != "object")
762
+ return t;
763
+ const e = new Intl.ListFormat("en", { style: "long", type: "conjunction" });
764
+ if (Array.isArray(t))
765
+ return e.format(t.map(String));
766
+ if (t instanceof Map) {
767
+ const r = Array.from(t.entries()).map(([n, i]) => `${n}: ${i}`);
768
+ return e.format(r);
769
+ }
770
+ return t instanceof Set ? e.format(Array.from(t).map(String)) : t;
771
+ }
772
+ };
773
+ function dt(t) {
774
+ return typeof t == "object" && t !== null;
775
+ }
776
+ function lt(t, e) {
777
+ let r = e;
778
+ for (const n of t.split("."))
779
+ if (dt(r) && n in r)
780
+ r = r[n];
781
+ else
782
+ return;
783
+ return typeof r == "function" ? r() : r;
784
+ }
785
+ function pt(t, e) {
786
+ const r = t.split("|").map((a) => a.trim()), n = r.shift() ?? "";
787
+ let i = lt(n, e);
788
+ for (const a of r) {
789
+ const [s, ...o] = a.split(":"), c = (s == null ? void 0 : s.trim()) ?? "", g = o.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), S = ut[c];
790
+ S && (i = S(i, g));
791
+ }
792
+ return B(i) ? "" : typeof i == "object" ? JSON.stringify(i) : String(i);
793
+ }
794
+ function ft(t, e) {
795
+ let r = "", n = 0;
796
+ for (; n < t.length; )
797
+ if (t[n] === "{" && t[n + 1] === "{") {
798
+ n += 2;
799
+ let i = "";
800
+ for (; n < t.length; ) {
801
+ if (t[n] === "}" && t[n + 1] === "}") {
802
+ n += 2;
803
+ break;
804
+ }
805
+ i += t[n++];
806
+ }
807
+ r += pt(i.trim(), e);
808
+ } else
809
+ r += t[n++];
810
+ return r;
811
+ }
812
+ class W {
741
813
  constructor(e) {
742
- m(this, "options");
743
- m(this, "isReady", !1);
744
- m(this, "project");
745
- m(this, "plugins", {});
746
- m(this, "eventBus", Te());
747
- m(this, "organizationId");
748
- m(this, "projectId");
749
- m(this, "apiUrl");
750
- m(this, "session");
751
- m(this, "precondition");
752
- m(this, "condition");
753
- m(this, "searchParams", Ze());
754
- m(this, "history", Me());
755
- m(this, "components", ke({ client: this }));
756
- m(this, "experienceInstances", re({ client: this }));
757
- m(this, "experiences", pe({ client: this }));
758
- m(this, "frameworks", be({ client: this }));
759
- m(this, "predicates", $e({ client: this }));
760
- m(this, "features", Ce({ client: this }));
761
- m(this, "responses", Je({ client: this }));
762
- m(this, "fields", _e());
763
- m(this, "actions", qe());
764
- S("info", "Picked client initializing.");
765
- const { organizationId: r, projectId: n } = at(e);
766
- this.organizationId = r, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Xe(), this.session = nt(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: Qe() }), S("info", "Picked client initialized.");
814
+ h(this, "options");
815
+ h(this, "isReady", !1);
816
+ h(this, "project");
817
+ h(this, "plugins", {});
818
+ h(this, "eventBus", Ve());
819
+ h(this, "organizationId");
820
+ h(this, "projectId");
821
+ h(this, "apiUrl");
822
+ h(this, "session");
823
+ h(this, "precondition");
824
+ h(this, "condition");
825
+ h(this, "searchParams", et());
826
+ h(this, "history", Ne());
827
+ h(this, "components", Ie({ client: this }));
828
+ h(this, "experienceInstances", ne({ client: this }));
829
+ h(this, "experiences", fe({ client: this }));
830
+ h(this, "frameworks", Fe({ client: this }));
831
+ h(this, "predicates", Oe({ client: this }));
832
+ h(this, "features", De({ client: this }));
833
+ h(this, "responses", Qe({ client: this }));
834
+ h(this, "fields", Le());
835
+ h(this, "actions", Ke());
836
+ /**
837
+ * Interpolates a template string using values from the client's response store and/or a provided context.
838
+ * Supports dot-notation, modifiers, and executing functions found in the context.
839
+ *
840
+ * Sources:
841
+ * - responses.*: Loaded automatically from the client's internal response store by fieldId (e.g. {{ responses.email }}).
842
+ * - Context: Any non-responses.* key must be supplied in the context; nested dot-notation is supported.
843
+ * - Functions: If a context value is a function, it is invoked and its result is rendered.
844
+ *
845
+ * Placeholders:
846
+ * - {{ key | modifier: arg | modifier2: arg2 }} with modifiers applied left-to-right.
847
+ *
848
+ * Modifiers:
849
+ * - default: Use the argument when the value is null, undefined, NaN, or empty string; otherwise return the value as a string.
850
+ * - append: Append the argument (space-separated) when the value is non-empty.
851
+ * - prepend: Prepend the argument (space-separated) when the value is non-empty.
852
+ * - upper: Uppercase string values.
853
+ * - lower: Lowercase string values.
854
+ * - capitalize: Capitalize the first letter of string values.
855
+ * - list: Format Arrays, Maps, and Sets via Intl.ListFormat (Maps render as key: value pairs).
856
+ *
857
+ * Behavior:
858
+ * - Empty values (null, undefined, empty string, NaN) render as empty. Numeric 0 renders as "0", boolean false renders as "false", and boolean true renders as "true".
859
+ * - Objects and arrays are JSON-stringified; Maps/Sets serialize to {} unless the list modifier is used.
860
+ * - Unknown modifiers are ignored.
861
+ *
862
+ * @param template Template containing placeholders.
863
+ * @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
864
+ * @returns Interpolated string.
865
+ *
866
+ * @example
867
+ * renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
868
+ * // => "Hello Alice! Email: alice@example.com."
869
+ *
870
+ * @example
871
+ * renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
872
+ * // => "User: Alice"
873
+ *
874
+ * @example
875
+ * renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
876
+ * // => "Fruits: apple, banana, and cherry"
877
+ */
878
+ h(this, "renderString", (e, r) => {
879
+ const n = this.responses.listStore.getState().reduce((i, a) => (i[a.fieldId] = a.value, i), {});
880
+ return ft(e, {
881
+ ...r,
882
+ responses: n
883
+ });
884
+ });
885
+ k("info", "Picked client initializing.");
886
+ const { organizationId: r, projectId: n } = ct(e);
887
+ this.organizationId = r, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Ze(), this.session = st(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: Xe() }), k("info", "Picked client initialized.");
767
888
  }
768
889
  start() {
769
- Pe(this), (async () => {
770
- if (!D())
890
+ Ae(this), (async () => {
891
+ if (!U())
771
892
  return;
772
893
  let r;
773
- typeof this.precondition > "u" ? r = !0 : typeof this.precondition == "boolean" ? r = this.precondition : r = await E(this, this.precondition) === !0;
894
+ typeof this.precondition > "u" ? r = !0 : typeof this.precondition == "boolean" ? r = this.precondition : r = await j(this, this.precondition) === !0;
774
895
  let n;
775
- r && (this.condition === void 0 ? n = !0 : typeof this.condition == "boolean" ? n = this.condition : n = await E(this, this.condition) === !0);
896
+ r && (this.condition === void 0 ? n = !0 : typeof this.condition == "boolean" ? n = this.condition : n = await j(this, this.condition) === !0);
776
897
  const i = r && n === !0;
777
898
  if (typeof n == "boolean" && this.session) {
778
899
  const a = n;
779
900
  this.session.setIsUser(a), this.eventBus({ type: "user_decide", value: a });
780
901
  }
781
- this.eventBus({ type: "initialize" }), document.body && i && T(this), await ne(), i && T(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
902
+ this.eventBus({ type: "initialize" }), document.body && i && V(this), await se(), i && V(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
782
903
  })();
783
904
  }
784
905
  registerFramework(e) {
785
- Fe(e, this.frameworks);
906
+ xe(e, this.frameworks);
786
907
  }
787
908
  registerComponent(e, r) {
788
- V(e, r, this.components);
909
+ T(e, r, this.components);
789
910
  }
790
911
  registerPlugin(e) {
791
- me(this, e, this.plugins);
912
+ he(this, e, this.plugins);
792
913
  }
793
914
  registerFeature(e, r) {
794
- De(e, r, this.features);
915
+ Ue(e, r, this.features);
795
916
  }
796
917
  registerPredicate(e, r) {
797
- Oe(e, r, this.predicates);
918
+ Ce(e, r, this.predicates);
798
919
  }
799
920
  registerField(e) {
800
- Le(e, this.fields);
921
+ Ge(e, this.fields);
801
922
  }
802
923
  registerAction(e, r) {
803
- Ke(e, r, this.actions);
924
+ We(e, r, this.actions);
804
925
  }
805
926
  registerExperience(e) {
806
- e.component && V(`experience:${e.id}`, e.component, this.components), ge(e, this.experiences);
927
+ e.component && T(`experience:${e.id}`, e.component, this.components), ge(e, this.experiences);
807
928
  }
808
929
  getStateSnapshot() {
809
930
  return Re(this);
@@ -811,10 +932,10 @@ class K {
811
932
  async launchExperienceById(e) {
812
933
  const r = this.experiences.getById(e).getState();
813
934
  if (!r) {
814
- S("warn", `Experience with id '${e}' not found.`);
935
+ k("warn", `Experience with id '${e}' not found.`);
815
936
  return;
816
937
  }
817
- q(this, r);
938
+ K(this, r);
818
939
  }
819
940
  // private async fetchProject() {
820
941
  // if (this.project) {
@@ -869,7 +990,7 @@ class K {
869
990
  const e = this.options.predicates;
870
991
  e && Object.entries(e).forEach(([r, n]) => {
871
992
  if (typeof n != "function") {
872
- S("warn", `Predicate "${r}" is not a function.`);
993
+ k("warn", `Predicate "${r}" is not a function.`);
873
994
  return;
874
995
  }
875
996
  this.registerPredicate(r, n);
@@ -879,7 +1000,7 @@ class K {
879
1000
  const e = this.options.actions;
880
1001
  e && Object.entries(e).forEach(([r, n]) => {
881
1002
  if (typeof n != "function") {
882
- S("warn", `Action "${r}" is not a function.`);
1003
+ k("warn", `Action "${r}" is not a function.`);
883
1004
  return;
884
1005
  }
885
1006
  this.registerAction(r, n);
@@ -889,52 +1010,52 @@ class K {
889
1010
  return this.plugins[e] ?? {};
890
1011
  }
891
1012
  }
892
- m(K, "logger", S);
893
- function W(t) {
1013
+ h(W, "logger", k);
1014
+ function Y(t) {
894
1015
  var e;
895
1016
  return ((e = t.options) == null ? void 0 : e.some((r) => "condition" in r)) ?? !1;
896
1017
  }
897
- function ct(t) {
898
- return t.some((e) => e.condition || W(e));
1018
+ function gt(t) {
1019
+ return t.some((e) => e.condition || Y(e));
899
1020
  }
900
- async function vt(t, e) {
901
- return e.length === 0 || !ct(e) ? e : (await Promise.all(
1021
+ async function Ft(t, e) {
1022
+ return e.length === 0 || !gt(e) ? e : (await Promise.all(
902
1023
  e.map(async (n) => {
903
- if (!(n.condition ? await E(t, n.condition) : !0))
1024
+ if (!(n.condition ? await j(t, n.condition) : !0))
904
1025
  return null;
905
- if (!n.options || !W(n))
1026
+ if (!n.options || !Y(n))
906
1027
  return n;
907
1028
  const s = (await Promise.all(
908
- n.options.map(async (d) => d.condition ? await E(t, d.condition) ? d : null : d)
909
- )).filter((d) => d !== null);
1029
+ n.options.map(async (c) => c.condition ? await j(t, c.condition) ? c : null : c)
1030
+ )).filter((c) => c !== null);
910
1031
  return s.length === n.options.length ? n : s.length === 0 ? null : { ...n, options: s };
911
1032
  })
912
1033
  )).filter((n) => n !== null);
913
1034
  }
914
- const St = (t) => {
915
- const e = new K(t);
916
- return ce(e), e;
1035
+ const xt = (t) => {
1036
+ const e = new W(t);
1037
+ return ue(e), e;
917
1038
  };
918
1039
  export {
919
- K as Picked,
920
- St as createClient,
921
- R as createStorageKey,
922
- E as evaluateRuleLogic,
923
- st as getPickedConfig,
924
- vt as getStepFields,
925
- It as isPickedRoot,
926
- $ as localStore,
927
- O as sessionStore,
928
- Ft as subscribe,
929
- Et as supportsCookies,
930
- ae as supportsCryptoRandomUUID,
931
- D as supportsDocument,
932
- jt as supportsHistory,
933
- Pt as supportsIntersectionObserver,
934
- oe as supportsLocalStorage,
935
- Rt as supportsLocation,
936
- Bt as supportsSessionStorage,
937
- At as supportsShadowRoot,
938
- $t as supportsWebComponents,
939
- U as supportsWindow
1040
+ W as Picked,
1041
+ xt as createClient,
1042
+ A as createStorageKey,
1043
+ j as evaluateRuleLogic,
1044
+ it as getPickedConfig,
1045
+ Ft as getStepFields,
1046
+ Pt as isPickedRoot,
1047
+ O as localStore,
1048
+ C as sessionStore,
1049
+ Rt as subscribe,
1050
+ Bt as supportsCookies,
1051
+ ce as supportsCryptoRandomUUID,
1052
+ U as supportsDocument,
1053
+ Ot as supportsHistory,
1054
+ Ct as supportsIntersectionObserver,
1055
+ ae as supportsLocalStorage,
1056
+ zt as supportsLocation,
1057
+ Dt as supportsSessionStorage,
1058
+ Ut as supportsShadowRoot,
1059
+ Mt as supportsWebComponents,
1060
+ M as supportsWindow
940
1061
  };