@picked/client 0.0.1-dev.1785287094311 → 0.0.1-dev.1785826066660

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 (209) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/api-Djuh2gfe.cjs +1 -0
  3. package/dist/api-d0qKmzPH.js +38 -0
  4. package/dist/cjs/form/index.js +1 -1
  5. package/dist/cjs/index.js +2 -2
  6. package/dist/cjs/plugins/dom-observer/index.js +1 -1
  7. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  8. package/dist/cjs/preview/index.js +1 -0
  9. package/dist/cjs/server/index.js +1 -1
  10. package/dist/docs/actions.mdx +38 -18
  11. package/dist/docs/api/authentication.md +75 -48
  12. package/dist/docs/api/authorization-and-scopes.md +63 -47
  13. package/dist/docs/api/error-handling.md +70 -54
  14. package/dist/docs/api/index.md +41 -22
  15. package/dist/docs/api/pagination.md +30 -20
  16. package/dist/docs/api-keys.mdx +11 -6
  17. package/dist/docs/chrome-extension.md +22 -5
  18. package/dist/docs/conditions.mdx +32 -19
  19. package/dist/docs/content/asset-library.mdx +65 -34
  20. package/dist/docs/content/content-entries.mdx +8 -2
  21. package/dist/docs/content/layouts.mdx +45 -29
  22. package/dist/docs/content/pages.mdx +29 -14
  23. package/dist/docs/content/sections.mdx +19 -8
  24. package/dist/docs/delivery-api/experience-content.md +10 -5
  25. package/dist/docs/delivery-api/index.md +19 -12
  26. package/dist/docs/delivery-api/preview-caching-crawling.md +27 -14
  27. package/dist/docs/delivery-api/project-config.md +6 -4
  28. package/dist/docs/experiences.mdx +26 -10
  29. package/dist/docs/features.mdx +93 -22
  30. package/dist/docs/fields.mdx +42 -27
  31. package/dist/docs/flow-builder/building-flows.md +38 -20
  32. package/dist/docs/flow-builder/condition-builder.md +32 -21
  33. package/dist/docs/flow-builder/keyboard-shortcuts.md +18 -18
  34. package/dist/docs/flow-builder/nodes.md +26 -13
  35. package/dist/docs/flow-builder/overview.mdx +28 -15
  36. package/dist/docs/gtm-template.md +35 -26
  37. package/dist/docs/guides/build-a-personalized-page.mdx +36 -18
  38. package/dist/docs/image-optimisation-service.md +33 -17
  39. package/dist/docs/index.md +28 -17
  40. package/dist/docs/mcp.md +47 -39
  41. package/dist/docs/pickedql/data-sources.md +65 -43
  42. package/dist/docs/pickedql/dimensions.md +27 -12
  43. package/dist/docs/pickedql/examples.md +38 -26
  44. package/dist/docs/pickedql/filtering.md +10 -6
  45. package/dist/docs/pickedql/index.md +32 -14
  46. package/dist/docs/pickedql/schema.md +85 -76
  47. package/dist/docs/pickedql/virtual-functions.md +62 -36
  48. package/dist/docs/projects.mdx +14 -7
  49. package/dist/docs/reports.mdx +5 -3
  50. package/dist/docs/sdk/actions.md +33 -17
  51. package/dist/docs/sdk/conditions.md +8 -5
  52. package/dist/docs/sdk/content-security-policy.md +5 -4
  53. package/dist/docs/sdk/experiences.md +29 -11
  54. package/dist/docs/sdk/feature-allocation.md +161 -0
  55. package/dist/docs/sdk/features.md +181 -73
  56. package/dist/docs/sdk/fields.md +66 -42
  57. package/dist/docs/sdk/index.md +25 -10
  58. package/dist/docs/sdk/plugins/create-experience.md +18 -15
  59. package/dist/docs/sdk/plugins/dynamic-experiences.md +43 -17
  60. package/dist/docs/sdk/predicates.md +53 -37
  61. package/dist/docs/sdk/ssr/index.md +25 -8
  62. package/dist/docs/sdk/ssr/rendering-and-hydration.md +37 -16
  63. package/dist/docs/sdk/ssr/serialize.md +38 -20
  64. package/dist/docs/sdk/ssr/slots-and-placements.md +28 -10
  65. package/dist/docs/sdk/steps.md +100 -55
  66. package/dist/docs/steps.mdx +20 -11
  67. package/dist/docs/team-management.md +17 -11
  68. package/dist/docs/vite-plugin.md +26 -19
  69. package/dist/docs/workspace-versioning.mdx +14 -8
  70. package/dist/docs/workspaces.mdx +55 -24
  71. package/dist/{dom-BwmTHeT7.js → dom-BqcToNL0.js} +1 -3
  72. package/dist/{dom-CDrHc_j9.cjs → dom-DlLH3FxV.cjs} +1 -1
  73. package/dist/esm/form/index.js +2 -4
  74. package/dist/esm/index.js +434 -334
  75. package/dist/esm/plugins/dom-observer/index.js +1 -1
  76. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  77. package/dist/esm/preview/index.js +2 -0
  78. package/dist/esm/server/index.js +13 -11
  79. package/dist/{experience-instance-DOJShRk5.js → experience-instance-DGk11d8a.js} +3 -3
  80. package/dist/experience-instance-Dej3P1sE.cjs +1 -0
  81. package/dist/inert-script-report-B_bMPRzp.js +18 -0
  82. package/dist/inert-script-report-ijRHPtcY.cjs +1 -0
  83. package/dist/{plugin-C46DEiGE.js → plugin-BVAFWjpT.js} +61 -56
  84. package/dist/plugin-BcCn2llk.cjs +1 -0
  85. package/dist/preview-channel-CSr96XAo.js +98 -0
  86. package/dist/preview-channel-Cx0e6fye.cjs +1 -0
  87. package/dist/protocol-Bb_vpLKE.cjs +1 -0
  88. package/dist/protocol-C5KkkiZc.js +84 -0
  89. package/dist/types/client.d.ts +7 -6
  90. package/dist/types/entities/action/action.d.ts +5 -4
  91. package/dist/types/entities/action/action.d.ts.map +1 -1
  92. package/dist/types/entities/component/component.d.ts +6 -5
  93. package/dist/types/entities/component/component.d.ts.map +1 -1
  94. package/dist/types/entities/condition/condition.d.ts +5 -5
  95. package/dist/types/entities/content/content.d.ts +14 -3
  96. package/dist/types/entities/content/content.d.ts.map +1 -1
  97. package/dist/types/entities/content/reference.d.ts +101 -0
  98. package/dist/types/entities/content/reference.d.ts.map +1 -0
  99. package/dist/types/entities/experience/experience.d.ts +11 -10
  100. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  101. package/dist/types/entities/experience-instance/experience-instance.d.ts +10 -9
  102. package/dist/types/entities/feature/feature.d.ts +3 -2
  103. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  104. package/dist/types/entities/field/field.d.ts +7 -6
  105. package/dist/types/entities/framework/framework.d.ts +7 -6
  106. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  107. package/dist/types/entities/history/history.d.ts +6 -6
  108. package/dist/types/entities/plugin/plugin.d.ts +3 -2
  109. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  110. package/dist/types/entities/predicate/predicate.d.ts +4 -3
  111. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  112. package/dist/types/entities/response/response-validation.d.ts +3 -2
  113. package/dist/types/entities/response/response.d.ts +12 -11
  114. package/dist/types/entities/session/session.d.ts +2 -1
  115. package/dist/types/entities/step/step.d.ts +6 -5
  116. package/dist/types/exports.d.ts +6 -1
  117. package/dist/types/exports.d.ts.map +1 -1
  118. package/dist/types/form/build-responses.d.ts +2 -1
  119. package/dist/types/form/create-field-evaluator.d.ts +4 -3
  120. package/dist/types/form/create-field-validation.d.ts +5 -4
  121. package/dist/types/form/create-form.d.ts +7 -6
  122. package/dist/types/form/create-submit-pipeline.d.ts +7 -6
  123. package/dist/types/form/get-step-fields.d.ts +3 -2
  124. package/dist/types/index.d.ts +1 -0
  125. package/dist/types/index.d.ts.map +1 -1
  126. package/dist/types/lifecycle/condition-selection.d.ts +14 -4
  127. package/dist/types/lifecycle/lifecycle.d.ts +4 -3
  128. package/dist/types/lifecycle/rules-logic.d.ts +4 -3
  129. package/dist/types/lifecycle/state-snapshot.d.ts +4 -3
  130. package/dist/types/picked.d.ts +102 -68
  131. package/dist/types/picked.d.ts.map +1 -1
  132. package/dist/types/ping.d.ts +1 -1
  133. package/dist/types/ping.d.ts.map +1 -1
  134. package/dist/types/plugins/create-experience/create-experience.d.ts +9 -8
  135. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  136. package/dist/types/plugins/create-experience/plugin.d.ts +3 -2
  137. package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
  138. package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -1
  139. package/dist/types/plugins/dom-observer/plugin.d.ts +1 -1
  140. package/dist/types/plugins/dynamic-experiences/hash.d.ts +40 -5
  141. package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -1
  142. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +3 -3
  143. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  144. package/dist/types/plugins/dynamic-experiences/types.d.ts +24 -5
  145. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  146. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -1
  147. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  148. package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -1
  149. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  150. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -1
  151. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  152. package/dist/types/plugins/responses-indexeddb/plugin.d.ts +1 -1
  153. package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
  154. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  155. package/dist/types/plugins/web-components/plugin.d.ts +2 -1
  156. package/dist/types/plugins/window-object/plugin.d.ts +2 -2
  157. package/dist/types/preview/index.d.ts +18 -0
  158. package/dist/types/preview/index.d.ts.map +1 -0
  159. package/dist/types/preview-channel.d.ts +16 -0
  160. package/dist/types/preview-channel.d.ts.map +1 -0
  161. package/dist/types/preview-receiver/apply-ops.d.ts +32 -0
  162. package/dist/types/preview-receiver/apply-ops.d.ts.map +1 -0
  163. package/dist/types/preview-receiver/index.d.ts +32 -0
  164. package/dist/types/preview-receiver/index.d.ts.map +1 -0
  165. package/dist/types/preview-receiver/protocol.d.ts +69 -0
  166. package/dist/types/preview-receiver/protocol.d.ts.map +1 -0
  167. package/dist/types/server/index.d.ts +3 -3
  168. package/dist/types/server/serialize.d.ts +8 -3
  169. package/dist/types/server/serialize.d.ts.map +1 -1
  170. package/dist/types/utils/content-path.d.ts +37 -0
  171. package/dist/types/utils/content-path.d.ts.map +1 -0
  172. package/dist/types/utils/dom.d.ts +2 -1
  173. package/dist/types/utils/events.d.ts +6 -6
  174. package/dist/types/utils/events.d.ts.map +1 -1
  175. package/dist/types/utils/global-obj.d.ts +1 -1
  176. package/dist/types/utils/global-obj.d.ts.map +1 -1
  177. package/dist/types/utils/id.d.ts.map +1 -1
  178. package/dist/types/utils/inert-script-report.d.ts +40 -0
  179. package/dist/types/utils/inert-script-report.d.ts.map +1 -0
  180. package/dist/types/utils/logger.d.ts +2 -1
  181. package/dist/types/utils/logger.d.ts.map +1 -1
  182. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +2 -1
  183. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +2 -1
  184. package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
  185. package/dist/types/utils/node-tree/get-next-node.d.ts.map +1 -1
  186. package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
  187. package/dist/types/utils/node-tree/get-origin-node.d.ts.map +1 -1
  188. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +1 -1
  189. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  190. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +1 -1
  191. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  192. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +1 -1
  193. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  194. package/dist/types/utils/nodes.d.ts +1 -1
  195. package/dist/types/utils/picked-config.d.ts +2 -1
  196. package/dist/types/utils/preview-session.d.ts +12 -0
  197. package/dist/types/utils/preview-session.d.ts.map +1 -0
  198. package/dist/types/utils/rehydrate-scripts.d.ts +6 -0
  199. package/dist/types/utils/rehydrate-scripts.d.ts.map +1 -1
  200. package/dist/types/utils/rules-logic.d.ts +6 -2
  201. package/dist/types/utils/storage.d.ts +1 -1
  202. package/dist/types/utils/storage.d.ts.map +1 -1
  203. package/package.json +35 -24
  204. package/dist/api-BzcdC_7V.cjs +0 -1
  205. package/dist/api-o8w9kJwm.js +0 -40
  206. package/dist/experience-instance-DurC3pE-.cjs +0 -1
  207. package/dist/plugin-nrEJGTuE.cjs +0 -1
  208. package/dist/preview-bridge-CpX1BkSA.cjs +0 -1
  209. package/dist/preview-bridge-D76l-dPy.js +0 -33
package/dist/esm/index.js CHANGED
@@ -2,15 +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 _, 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-DOJShRk5.js";
5
+ import { a as _, i as v, r as ee, s as y, t as b } from "../dom-BqcToNL0.js";
6
+ import { l as x, n as S, r as C, u as w } from "../experience-instance-DGk11d8a.js";
7
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-o8w9kJwm.js";
8
+ import { n as te, r as ne } from "../api-d0qKmzPH.js";
9
9
  import { t as re } from "../id-Bo4RBeOs.js";
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";
10
+ import { n as ie, r as ae, t as oe } from "../inert-script-report-B_bMPRzp.js";
11
+ import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, is as se, sample as I } from "effector";
11
12
  import { createFactory as L, invoke as R } from "@withease/factories";
12
13
  //#region src/entities/experience/experience.ts
13
- var z = M("experience"), ie = L(({ client: e, experience: r }) => {
14
+ var z = M("experience"), ce = L(({ client: e, experience: r }) => {
14
15
  let i = z.store(r), a = j(i, { merge(e, t) {
15
16
  return {
16
17
  ...e,
@@ -37,18 +38,18 @@ var z = M("experience"), ie = L(({ client: e, experience: r }) => {
37
38
  n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
38
39
  });
39
40
  }
40
- }), f = k({
41
- source: A({
42
- preconditionPassed: e.preconditionPassedStore,
43
- isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
44
- config: o
45
- }),
41
+ }), f = A({
42
+ preconditionPassed: e.preconditionPassedStore,
43
+ isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
44
+ config: o
45
+ }), p = k({
46
+ source: f,
46
47
  effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
47
48
  if (!i || !a) return !1;
48
49
  let { decisionLogic: s, targetSelectors: c } = o;
49
- return c.length === 0 || v(c, r.id).length < 1 ? !1 : s === void 0 ? !0 : t(s) ? await n(e, s) === !0 : !0;
50
+ return c.length === 0 || v(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
50
51
  }
51
- }), p = N(async () => {
52
+ }), m = N(async () => {
52
53
  if (!e.contentLoader) return !0;
53
54
  try {
54
55
  await e.contentLoader({
@@ -59,28 +60,28 @@ var z = M("experience"), ie = L(({ client: e, experience: r }) => {
59
60
  `${r.id}`;
60
61
  }
61
62
  return !0;
62
- }), m = P(), h = P(), g = z.createStore(void 0, { skipVoid: !1 }).on(m, (e, t) => t).on(h, (e, t) => t);
63
+ }), h = P(), g = P(), _ = z.createStore(void 0, { skipVoid: !1 }).on(h, (e, t) => t).on(g, (e, t) => t);
63
64
  return I({
64
- clock: m,
65
- target: f
65
+ clock: h,
66
+ target: p
66
67
  }), I({
67
- clock: f.doneData,
68
- source: g,
68
+ clock: p.doneData,
69
+ source: _,
69
70
  filter: (e, t) => t,
70
71
  fn: (e) => e,
71
72
  target: d
72
73
  }), I({
73
- clock: f.doneData,
74
+ clock: p.doneData,
74
75
  filter: Boolean,
75
- target: p
76
+ target: m
76
77
  }), I({
77
- clock: h,
78
- source: g,
78
+ clock: g,
79
+ source: _,
79
80
  fn: (e) => e,
80
81
  target: d
81
82
  }), I({
82
- clock: h,
83
- target: p
83
+ clock: g,
84
+ target: m
84
85
  }), u = {
85
86
  id: r.id,
86
87
  key: r.key,
@@ -91,23 +92,23 @@ var z = M("experience"), ie = L(({ client: e, experience: r }) => {
91
92
  actions: l,
92
93
  merge: a.merge,
93
94
  initialiseFx: d,
94
- shouldInitialiseFx: f,
95
- initialiseRequested: m,
96
- initialiseDirectly: h,
97
- prepareExperienceContentFx: p
95
+ shouldInitialiseFx: p,
96
+ initialiseRequested: h,
97
+ initialiseDirectly: g,
98
+ prepareExperienceContentFx: m
98
99
  }, u;
99
100
  });
100
- function ae(e) {
101
- return R(ie, e);
101
+ function le(e) {
102
+ return R(ce, e);
102
103
  }
103
- var oe = L(({ client: e }) => {
104
+ var ue = L(({ client: e }) => {
104
105
  let t = z.store({}), n = j(t, { register(e, t) {
105
106
  return {
106
107
  ...e,
107
108
  [t.id]: t
108
109
  };
109
110
  } }), r = P(), i = N((t) => {
110
- n.register(ae({
111
+ n.register(le({
111
112
  client: e,
112
113
  experience: t
113
114
  }));
@@ -168,7 +169,7 @@ var oe = L(({ client: e }) => {
168
169
  for (let e of i) e.open();
169
170
  return;
170
171
  }
171
- await c("key" in n ? {
172
+ let a = "key" in n ? {
172
173
  key: n.key,
173
174
  options: {
174
175
  ...n.options,
@@ -180,7 +181,8 @@ var oe = L(({ client: e }) => {
180
181
  ...n.options,
181
182
  initialiseOpen: !0
182
183
  }
183
- });
184
+ };
185
+ await c(a);
184
186
  }
185
187
  }),
186
188
  listStore: a,
@@ -192,20 +194,20 @@ var oe = L(({ client: e }) => {
192
194
  })
193
195
  };
194
196
  });
195
- function se(e) {
196
- return R(oe, e);
197
+ function de(e) {
198
+ return R(ue, e);
197
199
  }
198
- var ce = async (e) => {
200
+ var fe = async (e) => {
199
201
  await e.experiences.initialiseExperiencesFx();
200
202
  };
201
203
  //#endregion
202
204
  //#region src/entities/plugin/plugin.ts
203
- function le(e) {
205
+ function pe(e) {
204
206
  return N(async () => {
205
207
  await e();
206
208
  });
207
209
  }
208
- var ue = (e, t, n) => {
210
+ var me = (e, t, n) => {
209
211
  let r = t.name, i = t.setup(e);
210
212
  if (i) {
211
213
  let e = n[r] ?? {};
@@ -214,16 +216,16 @@ var ue = (e, t, n) => {
214
216
  ...i
215
217
  });
216
218
  }
217
- }, de = M("component"), fe = L(({ client: e, component: t, name: n }) => ({
219
+ }, he = M("component"), ge = L(({ client: e, component: t, name: n }) => ({
218
220
  name: n,
219
221
  component: t,
220
222
  frameworkStore: e.frameworks.getByName(t.frameworkName)
221
223
  }));
222
- function pe(e) {
223
- return R(fe, e);
224
+ function _e(e) {
225
+ return R(ge, e);
224
226
  }
225
- var me = L(({ client: e }) => {
226
- let t = de.store({}), n = j(t, { register(e, t) {
227
+ var ve = L(({ client: e }) => {
228
+ let t = he.store({}), n = j(t, { register(e, t) {
227
229
  return {
228
230
  ...e,
229
231
  [t.name]: t
@@ -236,7 +238,7 @@ var me = L(({ client: e }) => {
236
238
  fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
237
239
  }).watch((e) => /* @__PURE__ */ r("warn", e)), I({
238
240
  clock: i,
239
- fn: ({ name: t, component: n }) => pe({
241
+ fn: ({ name: t, component: n }) => _e({
240
242
  client: e,
241
243
  name: t,
242
244
  component: n
@@ -253,16 +255,16 @@ var me = L(({ client: e }) => {
253
255
  listStore: a
254
256
  };
255
257
  });
256
- function he(e) {
257
- return R(me, e);
258
+ function ye(e) {
259
+ return R(ve, e);
258
260
  }
259
- var B = (e, t, n) => {
261
+ var be = (e, t, n) => {
260
262
  n.register({
261
263
  name: e,
262
264
  component: t
263
265
  });
264
- }, ge = M("framework"), _e = L((e) => {
265
- let t = ge.store({}), n = j(t, { register(e, t) {
266
+ }, xe = M("framework"), Se = L((e) => {
267
+ let t = xe.store({}), n = j(t, { register(e, t) {
266
268
  return {
267
269
  ...e,
268
270
  [t.name]: t.framework
@@ -287,15 +289,15 @@ var B = (e, t, n) => {
287
289
  listStore: a
288
290
  };
289
291
  });
290
- function ve(e) {
291
- return R(_e, e);
292
+ function Ce(e) {
293
+ return R(Se, e);
292
294
  }
293
- var ye = (e, t) => {
295
+ var we = (e, t) => {
294
296
  t.register({
295
297
  name: e.name,
296
298
  framework: e
297
299
  });
298
- }, be = L(({ client: e }) => {
300
+ }, Te = L(({ client: e }) => {
299
301
  let t = "window" in globalThis, n = {
300
302
  location: t ? globalThis.location : void 0,
301
303
  document: t ? globalThis.document : void 0,
@@ -309,84 +311,84 @@ var ye = (e, t) => {
309
311
  ...n
310
312
  }));
311
313
  });
312
- function xe(e) {
313
- return R(be, e);
314
+ function Ee(e) {
315
+ return R(Te, e);
314
316
  }
315
317
  //#endregion
316
318
  //#region src/logic-engine.ts
317
- function Se(e) {
319
+ function De(e) {
318
320
  return typeof e == "number" && !isNaN(e);
319
321
  }
320
- function V(e) {
322
+ function B(e) {
321
323
  return typeof e == "string";
322
324
  }
323
- function H(e) {
325
+ function V(e) {
324
326
  return Array.isArray(e);
325
327
  }
326
- function Ce(e) {
328
+ function Oe(e) {
327
329
  return e instanceof Promise;
328
330
  }
329
- function we(e) {
331
+ function ke(e) {
330
332
  return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
331
333
  }
332
- function U(e) {
333
- if (Se(e)) return e;
334
+ function H(e) {
335
+ if (De(e)) return e;
334
336
  let t = parseFloat(`${e}`);
335
337
  return isNaN(t) ? 0 : t;
336
338
  }
337
- function W(e) {
339
+ function U(e) {
338
340
  return `${e}`;
339
341
  }
340
- var Te = {
342
+ var Ae = {
341
343
  "==": (e, t) => e == t,
342
344
  "===": (e, t) => e === t,
343
345
  "!=": (e, t) => e != t,
344
346
  "!==": (e, t) => e !== t,
345
- ">": (e, t) => U(e) > U(t),
346
- ">=": (e, t) => U(e) >= U(t),
347
+ ">": (e, t) => H(e) > H(t),
348
+ ">=": (e, t) => H(e) >= H(t),
347
349
  "<": (e, t, n) => {
348
- let r = U(e), i = U(t);
350
+ let r = H(e), i = H(t);
349
351
  if (n === void 0) return r < i;
350
- let a = U(n);
352
+ let a = H(n);
351
353
  return r < i && i < a;
352
354
  },
353
355
  "<=": (e, t, n) => {
354
- let r = U(e), i = U(t);
356
+ let r = H(e), i = H(t);
355
357
  if (n === void 0) return r <= i;
356
- let a = U(n);
358
+ let a = H(n);
357
359
  return r <= i && i <= a;
358
360
  },
359
- "!!": async (e) => await K(e),
360
- "!": async (e) => !await K(e),
361
- "%": (e, t) => U(e) % U(t),
361
+ "!!": async (e) => await G(e),
362
+ "!": async (e) => !await G(e),
363
+ "%": (e, t) => H(e) % H(t),
362
364
  log: (e) => (console.log(e), e),
363
- in: (e, t) => t ? V(t) ? t.indexOf(W(e)) !== -1 : H(t) ? t.includes(e) : !1 : !1,
364
- cat: (...e) => e.map(W).join(""),
365
+ in: (e, t) => t ? B(t) ? t.indexOf(U(e)) !== -1 : V(t) ? t.includes(e) : !1 : !1,
366
+ cat: (...e) => e.map(U).join(""),
365
367
  substr: (e, t, n) => {
366
- let r = W(e), i = U(t);
368
+ let r = U(e), i = H(t);
367
369
  if (n === void 0) return r.substr(i);
368
- let a = U(n);
370
+ let a = H(n);
369
371
  if (a < 0) {
370
372
  let e = r.substr(i);
371
373
  return e.substr(0, e.length + a);
372
374
  }
373
375
  return r.substr(i, a);
374
376
  },
375
- "+": (...e) => e.reduce((e, t) => U(e) + U(t), 0),
376
- "*": (...e) => e.reduce((e, t) => U(e) * U(t), 1),
377
+ "+": (...e) => e.reduce((e, t) => H(e) + H(t), 0),
378
+ "*": (...e) => e.reduce((e, t) => H(e) * H(t), 1),
377
379
  "-": (e, t) => {
378
- let n = U(e);
379
- return t === void 0 ? -n : n - U(t);
380
+ let n = H(e);
381
+ return t === void 0 ? -n : n - H(t);
380
382
  },
381
- "/": (e, t) => U(e) / U(t),
382
- min: (...e) => Math.min(...e.map(U)),
383
- max: (...e) => Math.max(...e.map(U)),
384
- merge: (...e) => e.reduce((e, t) => H(t) ? e.concat(t) : e.concat([t]), []),
383
+ "/": (e, t) => H(e) / H(t),
384
+ min: (...e) => Math.min(...e.map(H)),
385
+ max: (...e) => Math.max(...e.map(H)),
386
+ merge: (...e) => e.reduce((e, t) => V(t) ? e.concat(t) : e.concat([t]), []),
385
387
  var(e, t) {
386
388
  let n = arguments.length > 1 ? t : null;
387
389
  if (e === "" || e === "." || e == null) return this;
388
390
  if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
389
- let r = W(e);
391
+ let r = U(e);
390
392
  if (r === "" || r === ".") return this;
391
393
  let i = r.split("."), a = this;
392
394
  for (let e of i) {
@@ -399,126 +401,126 @@ var Te = {
399
401
  return a === void 0 ? n : a;
400
402
  },
401
403
  async missing(...e) {
402
- let t = H(e[0]) ? e[0] : e, n = [];
404
+ let t = V(e[0]) ? e[0] : e, n = [];
403
405
  for (let e of t) {
404
- let t = await G({ var: e }, this);
406
+ let t = await W({ var: e }, this);
405
407
  (t === null || t === "") && n.push(`${e}`);
406
408
  }
407
409
  return n;
408
410
  },
409
411
  async missing_some(e, t) {
410
- let n = await G({ missing: t }, this);
411
- if (!H(n) || !H(t)) return [];
412
- let r = n.filter(V);
413
- return t.filter(V).length - r.length >= U(e) ? [] : r;
412
+ let n = await W({ missing: t }, this);
413
+ if (!V(n) || !V(t)) return [];
414
+ let r = n.filter(B);
415
+ return t.filter(B).length - r.length >= H(e) ? [] : r;
414
416
  },
415
417
  invoke(...e) {
416
418
  let [t, ...n] = e;
417
419
  return typeof t == "function" ? Reflect.apply(t, null, n) : null;
418
420
  },
419
- startsWith: (e, t) => V(e) && V(t) && e.startsWith(t),
420
- endsWith: (e, t) => V(e) && V(t) && e.endsWith(t),
421
+ startsWith: (e, t) => B(e) && B(t) && e.startsWith(t),
422
+ endsWith: (e, t) => B(e) && B(t) && e.endsWith(t),
421
423
  regexp_matches(e, t) {
422
424
  let n = e, r = "";
423
- if (H(e)) {
425
+ if (V(e)) {
424
426
  let [t, i] = e;
425
427
  n = t, r = i;
426
428
  }
427
- return !V(n) || !V(r) ? !1 : new RegExp(n, r).test(W(t));
429
+ return !B(n) || !B(r) ? !1 : new RegExp(n, r).test(U(t));
428
430
  },
429
431
  throw(e) {
430
- throw Error(W(e));
432
+ throw Error(U(e));
431
433
  }
432
434
  };
433
- async function G(e, t) {
435
+ async function W(e, t) {
434
436
  if (!e) return e;
435
- if (Ce(e)) return G(await e, t);
436
- if (H(e)) return Promise.all(e.map((e) => G(e, t)));
437
- if (!we(e)) return e;
438
- let n = Ee(e), r = n ? e[n] ?? [] : [];
439
- switch (H(r) || (r = [r]), n) {
437
+ if (Oe(e)) return W(await e, t);
438
+ if (V(e)) return Promise.all(e.map((e) => W(e, t)));
439
+ if (!ke(e)) return e;
440
+ let n = je(e), r = n ? e[n] ?? [] : [];
441
+ switch (V(r) || (r = [r]), n) {
440
442
  case "if":
441
443
  case "?:":
442
- for (let e = 0; e < r.length - 1; e += 2) if (await K(await G(r[e], t))) return G(r[e + 1], t);
443
- return r.length % 2 == 1 ? G(r[r.length - 1], t) : null;
444
+ for (let e = 0; e < r.length - 1; e += 2) if (await G(await W(r[e], t))) return W(r[e + 1], t);
445
+ return r.length % 2 == 1 ? W(r[r.length - 1], t) : null;
444
446
  case "and": {
445
447
  let e = null;
446
- for (let n of r) if (e = await G(n, t), !await K(e)) return e;
448
+ for (let n of r) if (e = await W(n, t), !await G(e)) return e;
447
449
  return e;
448
450
  }
449
451
  case "or": {
450
452
  let e = null;
451
- for (let n of r) if (e = await G(n, t), await K(e)) return e;
453
+ for (let n of r) if (e = await W(n, t), await G(e)) return e;
452
454
  return e;
453
455
  }
454
456
  case "map": {
455
- let e = await G(r[0], t);
456
- return H(e) ? await Promise.all(e.map((e) => G(r[1], e))) : [];
457
+ let e = await W(r[0], t);
458
+ return V(e) ? await Promise.all(e.map((e) => W(r[1], e))) : [];
457
459
  }
458
460
  case "filter": {
459
- let e = await G(r[0], t);
460
- return H(e) ? (await Promise.all(e.map(async (e) => ({
461
+ let e = await W(r[0], t);
462
+ return V(e) ? (await Promise.all(e.map(async (e) => ({
461
463
  item: e,
462
- shouldInclude: await K(await G(r[1], e))
464
+ shouldInclude: await G(await W(r[1], e))
463
465
  })))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
464
466
  }
465
467
  case "reduce": {
466
- let e = await G(r[0], t);
467
- if (!H(e)) return r.length > 2 ? await G(r[2], t) : null;
468
- let n = r[1], i = r.length > 2 ? await G(r[2], t) : null;
469
- for (let t of e) i = await G(n, {
468
+ let e = await W(r[0], t);
469
+ if (!V(e)) return r.length > 2 ? await W(r[2], t) : null;
470
+ let n = r[1], i = r.length > 2 ? await W(r[2], t) : null;
471
+ for (let t of e) i = await W(n, {
470
472
  current: t,
471
473
  accumulator: i
472
474
  });
473
475
  return i;
474
476
  }
475
477
  case "all": {
476
- let e = await G(r[0], t);
477
- if (!H(e) || e.length === 0) return !1;
478
- for (let t of e) if (!await K(await G(r[1], t))) return !1;
478
+ let e = await W(r[0], t);
479
+ if (!V(e) || e.length === 0) return !1;
480
+ for (let t of e) if (!await G(await W(r[1], t))) return !1;
479
481
  return !0;
480
482
  }
481
483
  case "some": {
482
- let e = await G(r[0], t);
483
- if (!H(e)) return !1;
484
- for (let t of e) if (await K(await G(r[1], t))) return !0;
484
+ let e = await W(r[0], t);
485
+ if (!V(e)) return !1;
486
+ for (let t of e) if (await G(await W(r[1], t))) return !0;
485
487
  return !1;
486
488
  }
487
489
  case "none": {
488
- let e = await G(r[0], t);
489
- if (!H(e)) return !0;
490
- for (let t of e) if (await K(await G(r[1], t))) return !1;
490
+ let e = await W(r[0], t);
491
+ if (!V(e)) return !0;
492
+ for (let t of e) if (await G(await W(r[1], t))) return !1;
491
493
  return !0;
492
494
  }
493
495
  case "catch": try {
494
- return await G(r[0], t);
496
+ return await W(r[0], t);
495
497
  } catch (e) {
496
- return we(e) ? await G(e, t) : r[1] ? await G(r[1], e) : e instanceof Error ? e.message : e;
498
+ return ke(e) ? await W(e, t) : r[1] ? await W(r[1], e) : e instanceof Error ? e.message : e;
497
499
  }
498
500
  }
499
- let i = await Promise.all(r.map((e) => G(e, t))), a = n ? Te[n] : void 0;
501
+ let i = await Promise.all(r.map((e) => W(e, t))), a = n ? Ae[n] : void 0;
500
502
  if (!a) throw Error(`Unrecognized operation ${n}`);
501
503
  return a.apply(t, i);
502
504
  }
503
- async function K(e) {
504
- return Ce(e) ? K(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
505
+ async function G(e) {
506
+ return Oe(e) ? G(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
505
507
  }
506
- function Ee(e) {
508
+ function je(e) {
507
509
  return Object.keys(e)[0];
508
510
  }
509
511
  //#endregion
510
512
  //#region src/lifecycle/rules-logic.ts
511
- function q(e, t, n) {
513
+ function Me(e, t, n) {
512
514
  return new Proxy(Object.create(null), { get(r, i) {
513
515
  if (typeof i != "string") return;
514
516
  let a = e.find((e) => e.key === i);
515
- if (a !== void 0) return async () => n.has(i) ? !1 : await G(a.logic, {
517
+ if (a !== void 0) return async () => !n.has(i) && await W(a.logic, {
516
518
  ...t,
517
- conditions: q(e, t, new Set(n).add(i))
519
+ conditions: Me(e, t, new Set(n).add(i))
518
520
  }) === !0;
519
521
  } });
520
522
  }
521
- var De = L(({ client: e }) => k({
523
+ var Ne = L(({ client: e }) => k({
522
524
  source: {
523
525
  stateSnapshot: e.stateSnapshotStore,
524
526
  predicates: e.predicates.listStore,
@@ -555,21 +557,21 @@ var De = L(({ client: e }) => k({
555
557
  features: u,
556
558
  ...s
557
559
  };
558
- return await G(o, {
560
+ return await W(o, {
559
561
  ...d,
560
- conditions: q(a, d, /* @__PURE__ */ new Set())
562
+ conditions: Me(a, d, /* @__PURE__ */ new Set())
561
563
  });
562
564
  }
563
565
  }));
564
- function Oe(e) {
565
- return R(De, e);
566
+ function Pe(e) {
567
+ return R(Ne, e);
566
568
  }
567
569
  //#endregion
568
570
  //#region src/ping.ts
569
- var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
571
+ var Fe = 6e3, Ie = O("last_ping", "global"), Le = async (e) => {
570
572
  try {
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;
573
+ let t = Date.now(), n = E.get(Ie), r = 0;
574
+ if (n.isSet() && (r = n.json() ?? 0), r && t - r < Fe) return !0;
573
575
  let i = {
574
576
  projectId: e.projectId,
575
577
  path: window.location.pathname
@@ -580,27 +582,27 @@ var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
580
582
  } catch {
581
583
  return !1;
582
584
  }
583
- }, J = M("lifecycle"), Me = L(({ client: e }) => {
584
- let t = J.store(!1), r = F(void 0, {
585
+ }, K = M("lifecycle"), Re = L(({ client: e }) => {
586
+ let t = K.store(!1), r = F(void 0, {
585
587
  skipVoid: !1,
586
- domain: J
588
+ domain: K
587
589
  }), i = F(void 0, {
588
590
  skipVoid: !1,
589
- domain: J
590
- }), a = J.store("idle"), o = J.store([]), s = F(void 0, {
591
+ domain: K
592
+ }), a = K.store("idle"), o = K.store([]), s = F(void 0, {
591
593
  skipVoid: !1,
592
- domain: J
594
+ domain: K
593
595
  }), l = F(void 0, {
594
596
  skipVoid: !1,
595
- domain: J
597
+ domain: K
596
598
  }), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
597
599
  o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
598
600
  let g = N(() => {
599
- je(e);
601
+ Le(e);
600
602
  }), _ = N(async () => {
601
603
  await ee();
602
604
  }), v = N(async () => {
603
- await ce(e);
605
+ await fe(e);
604
606
  }), y = k({ effect: v }), b = k({
605
607
  source: o,
606
608
  effect: async (e) => {
@@ -669,19 +671,23 @@ var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
669
671
  target: e.eventBus
670
672
  });
671
673
  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({
674
+ I({
673
675
  clock: f,
674
676
  source: D,
675
677
  filter: (e) => e,
676
678
  fn: () => void 0,
677
679
  target: v
678
- }), I({
679
- clock: A(w, T, D, (e, t, n) => e && t && n),
680
+ });
681
+ let O = A(w, T, D, (e, t, n) => e && t && n);
682
+ I({
683
+ clock: O,
680
684
  filter: (e) => e,
681
685
  fn: () => void 0,
682
686
  target: y
683
- }), I({
684
- clock: A(w, T, D, E, (e, t, n, r) => e && t && (!n || r)),
687
+ });
688
+ let te = A(w, T, D, E, (e, t, n, r) => e && t && (!n || r));
689
+ return I({
690
+ clock: te,
685
691
  filter: (e) => e,
686
692
  fn: () => void 0,
687
693
  target: d
@@ -725,13 +731,13 @@ var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
725
731
  setCondition: h
726
732
  };
727
733
  });
728
- function Ne(e) {
729
- return R(Me, e);
734
+ function ze(e) {
735
+ return R(Re, e);
730
736
  }
731
737
  //#endregion
732
738
  //#region src/entities/predicate/predicate.ts
733
- var Pe = M("predicate"), Fe = L(({ client: e }) => {
734
- let t = Pe.store({}), n = j(t, { register(e, t) {
739
+ var Be = M("predicate"), Ve = L(({ client: e }) => {
740
+ let t = Be.store({}), n = j(t, { register(e, t) {
735
741
  return {
736
742
  ...e,
737
743
  [t.name]: {
@@ -789,16 +795,20 @@ var Pe = M("predicate"), Fe = L(({ client: e }) => {
789
795
  getEvokablePredicate: s
790
796
  };
791
797
  });
792
- function Ie(e) {
793
- return R(Fe, e);
798
+ function He(e) {
799
+ return R(Ve, e);
794
800
  }
795
- var Le = (e, t, n) => {
801
+ var Ue = (e, t, n) => {
796
802
  n.register({
797
803
  name: e,
798
804
  predicate: t
799
805
  });
800
- }, Y = M("feature"), Re = L(({ client: e }) => {
801
- let t = Y.store({}), n = Y.store([]), i = j(t, { register(e, t) {
806
+ }, We = M("feature");
807
+ function q(e) {
808
+ return e?.enabled === !1;
809
+ }
810
+ var Ge = L(({ client: e }) => {
811
+ let t = We.store({}), n = We.store([]), i = j(t, { register(e, t) {
802
812
  return {
803
813
  ...e,
804
814
  [t.id]: t.feature
@@ -823,12 +833,13 @@ var Le = (e, t, n) => {
823
833
  }),
824
834
  target: i.register
825
835
  });
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();
828
- return i === null ? null : {
836
+ let o = N(async ({ id: e, key: t, storage: n = "local", enabled: r }) => {
837
+ if (r === !1) return null;
838
+ let i = O(`feature:${e}:${t}`, "global"), a = (n === "session" ? D : E).get(i).boolean();
839
+ return a === null ? null : {
829
840
  id: e,
830
841
  key: t,
831
- bucket: i,
842
+ bucket: a,
832
843
  storage: n
833
844
  };
834
845
  }), s = N((e) => {
@@ -845,6 +856,12 @@ var Le = (e, t, n) => {
845
856
  if (a) return a;
846
857
  let o = e[n];
847
858
  if (!o) throw Error(`Feature with id '${n}' not found`);
859
+ if (q(o.feature)) return {
860
+ id: o.id,
861
+ bucket: !1,
862
+ key: i,
863
+ storage: o.feature.storage
864
+ };
848
865
  let s = c.get(`${n}:${i}`);
849
866
  if (s !== void 0) {
850
867
  let e = await s;
@@ -873,13 +890,15 @@ var Le = (e, t, n) => {
873
890
  return {
874
891
  id: t,
875
892
  key: n.feature.key,
876
- storage: n.feature.storage
893
+ storage: n.feature.storage,
894
+ enabled: n.feature.enabled
877
895
  };
878
896
  },
879
897
  target: o
880
898
  }), I({
881
899
  source: t,
882
900
  clock: l.doneData,
901
+ filter: (e, t) => !q(e[t.id]?.feature),
883
902
  fn: (e, t) => {
884
903
  let { id: n, bucket: r, storage: i } = t, a = e[n]?.feature.key;
885
904
  return a ? {
@@ -919,8 +938,11 @@ var Le = (e, t, n) => {
919
938
  }));
920
939
  I({
921
940
  clock: l.doneData,
922
- source: { resolvedFeatures: n },
923
- filter: ({ resolvedFeatures: e }, { id: t, key: n }) => !e.some((e) => e.id === t && e.key === n),
941
+ source: {
942
+ resolvedFeatures: n,
943
+ allFeatures: t
944
+ },
945
+ filter: ({ resolvedFeatures: e, allFeatures: t }, { id: n, key: r }) => !q(t[n]?.feature) && !e.some((e) => e.id === n && e.key === r),
924
946
  fn: (e, t) => t,
925
947
  target: e.eventBus.prepend((e) => ({
926
948
  type: "feature_decide",
@@ -928,8 +950,11 @@ var Le = (e, t, n) => {
928
950
  }))
929
951
  }), I({
930
952
  clock: [o.doneData, l.doneData],
931
- source: n,
932
- fn: (e, t) => !t || e.some((e) => e.id === t.id && e.key === t.key) ? e : [...e, t],
953
+ source: {
954
+ resolvedFeatures: n,
955
+ allFeatures: t
956
+ },
957
+ fn: ({ resolvedFeatures: e, allFeatures: t }, n) => !n || q(t[n.id]?.feature) || e.some((e) => e.id === n.id && e.key === n.key) ? e : [...e, n],
933
958
  target: n
934
959
  });
935
960
  function d(e) {
@@ -963,16 +988,16 @@ var Le = (e, t, n) => {
963
988
  getEvokableFeature: p
964
989
  };
965
990
  });
966
- function ze(e) {
967
- return R(Re, e);
991
+ function Ke(e) {
992
+ return R(Ge, e);
968
993
  }
969
- var Be = (e, t, n) => {
994
+ var qe = (e, t, n) => {
970
995
  n.register({
971
996
  id: e,
972
997
  feature: t
973
998
  });
974
- }, X = M("history");
975
- function Ve(e, t) {
999
+ }, J = M("history");
1000
+ function Je(e, t) {
976
1001
  return {
977
1002
  id: re(`history-entry-${Date.now()}-${Math.random()}}`),
978
1003
  node: t,
@@ -980,9 +1005,9 @@ function Ve(e, t) {
980
1005
  experienceId: e
981
1006
  };
982
1007
  }
983
- var He = L(() => {
984
- let e = X.store({ entries: [] }), t = X.event(), n = X.event(), r = X.event(), i = X.event();
985
- 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);
1008
+ var Ye = L(() => {
1009
+ let e = J.store({ entries: [] }), t = J.event(), n = J.event(), r = J.event(), i = J.event();
1010
+ e.on(t, (e, t) => ({ entries: [...e.entries, Je(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Je(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
986
1011
  function a(e, t) {
987
1012
  let n = {
988
1013
  lastStepIndex: -1,
@@ -1012,20 +1037,20 @@ var He = L(() => {
1012
1037
  entriesStore: e.map((e) => e.entries)
1013
1038
  };
1014
1039
  });
1015
- function Ue() {
1016
- return R(He);
1040
+ function Xe() {
1041
+ return R(Ye);
1017
1042
  }
1018
1043
  //#endregion
1019
1044
  //#region src/utils/events.ts
1020
- var We = 0, Ge = (e) => {
1045
+ var Ze = 0, Qe = (e) => {
1021
1046
  let t = F([]);
1022
1047
  return t.on(e, (e, t) => [...e, {
1023
- id: We++,
1048
+ id: Ze++,
1024
1049
  at: /* @__PURE__ */ new Date(),
1025
1050
  payload: t
1026
1051
  }]), t;
1027
- }, Ke = M("field"), qe = L(() => {
1028
- let e = Ke.store({}), t = j(e, {
1052
+ }, $e = M("field"), et = L(() => {
1053
+ let e = $e.store({}), t = j(e, {
1029
1054
  register(e, t) {
1030
1055
  return {
1031
1056
  ...e,
@@ -1073,13 +1098,13 @@ var We = 0, Ge = (e) => {
1073
1098
  getByName: c
1074
1099
  };
1075
1100
  });
1076
- function Je() {
1077
- return R(qe);
1101
+ function tt() {
1102
+ return R(et);
1078
1103
  }
1079
1104
  //#endregion
1080
1105
  //#region src/entities/step/step.ts
1081
- var Ye = M("step"), Xe = L(() => {
1082
- let e = Ye.store({}), t = j(e, { register(e, t) {
1106
+ var nt = M("step"), rt = L(() => {
1107
+ let e = nt.store({}), t = j(e, { register(e, t) {
1083
1108
  return {
1084
1109
  ...e,
1085
1110
  [t.step.id]: t.step
@@ -1103,45 +1128,66 @@ var Ye = M("step"), Xe = L(() => {
1103
1128
  indexStore: e
1104
1129
  };
1105
1130
  });
1106
- function Ze() {
1107
- return R(Xe);
1131
+ function it() {
1132
+ return R(rt);
1108
1133
  }
1109
- function Qe(e, t) {
1134
+ function at(e, t) {
1110
1135
  t.register(e);
1111
1136
  }
1112
1137
  //#endregion
1113
1138
  //#region src/entities/content/content.ts
1114
- var $e = M("content"), et = L(() => {
1115
- let e = $e.store({}), t = j(e, { register(e, t) {
1116
- return {
1117
- ...e,
1118
- [t.content.id]: t.content
1119
- };
1120
- } });
1139
+ var ot = M("content"), st = L(() => {
1140
+ let e = ot.store({}), t = j(e, {
1141
+ register(e, t) {
1142
+ return {
1143
+ ...e,
1144
+ [t.content.id]: t.content
1145
+ };
1146
+ },
1147
+ patch(e, t) {
1148
+ let n = e[t.id];
1149
+ if (!n) return e;
1150
+ let r = t.apply(n.data);
1151
+ return r === n.data ? e : {
1152
+ ...e,
1153
+ [t.id]: {
1154
+ ...n,
1155
+ data: r
1156
+ }
1157
+ };
1158
+ }
1159
+ });
1121
1160
  function n(e) {
1122
1161
  t.register({ content: e });
1123
1162
  }
1124
- let r = e.map((e) => Object.values(e));
1125
- function i(t) {
1163
+ function r(e, n) {
1164
+ t.patch({
1165
+ id: e,
1166
+ apply: n
1167
+ });
1168
+ }
1169
+ let i = e.map((e) => Object.values(e));
1170
+ function a(t) {
1126
1171
  return e.map((e) => e[t] ?? null, { skipVoid: !1 });
1127
1172
  }
1128
1173
  return {
1129
1174
  register: n,
1130
- getById: i,
1131
- listStore: r,
1175
+ patch: r,
1176
+ getById: a,
1177
+ listStore: i,
1132
1178
  indexStore: e
1133
1179
  };
1134
1180
  });
1135
- function tt() {
1136
- return R(et);
1181
+ function ct() {
1182
+ return R(st);
1137
1183
  }
1138
- function nt(e, t) {
1184
+ function lt(e, t) {
1139
1185
  t.register(e);
1140
1186
  }
1141
1187
  //#endregion
1142
1188
  //#region src/entities/action/action.ts
1143
- var rt = M("action"), it = L(({ client: e }) => {
1144
- let t = rt.store({}), n = j(t, { register(e, t) {
1189
+ var ut = M("action"), dt = L(({ client: e }) => {
1190
+ let t = ut.store({}), n = j(t, { register(e, t) {
1145
1191
  return {
1146
1192
  ...e,
1147
1193
  [t.key]: {
@@ -1199,10 +1245,10 @@ var rt = M("action"), it = L(({ client: e }) => {
1199
1245
  getEvokableAction: s
1200
1246
  };
1201
1247
  });
1202
- function at(e) {
1203
- return R(it, e);
1248
+ function ft(e) {
1249
+ return R(dt, e);
1204
1250
  }
1205
- var ot = (e, t, n) => {
1251
+ var pt = (e, t, n) => {
1206
1252
  n.register({
1207
1253
  key: e,
1208
1254
  action: t
@@ -1210,7 +1256,7 @@ var ot = (e, t, n) => {
1210
1256
  };
1211
1257
  //#endregion
1212
1258
  //#region src/entities/response/response-validation.ts
1213
- function Z(e, t, n, r) {
1259
+ function Y(e, t, n, r) {
1214
1260
  return {
1215
1261
  fieldKey: e.key,
1216
1262
  userMessage: n,
@@ -1218,62 +1264,62 @@ function Z(e, t, n, r) {
1218
1264
  value: t
1219
1265
  };
1220
1266
  }
1221
- function Q(e) {
1267
+ function X(e) {
1222
1268
  return e === null || e === "" || Array.isArray(e) && !e.length;
1223
1269
  }
1224
- function st(e) {
1270
+ function mt(e) {
1225
1271
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
1226
1272
  }
1227
- function ct(e) {
1273
+ function ht(e) {
1228
1274
  try {
1229
1275
  return JSON.stringify(e), !0;
1230
1276
  } catch {
1231
1277
  return !1;
1232
1278
  }
1233
1279
  }
1234
- function lt(e, t) {
1280
+ function gt(e, t) {
1235
1281
  return t.find((t) => t.key === e) ?? null;
1236
1282
  }
1237
- function ut(e, t) {
1283
+ function _t(e, t) {
1238
1284
  return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
1239
1285
  }
1240
- function dt(e, t) {
1241
- if (e.type !== "object" || Q(t)) return null;
1286
+ function vt(e, t) {
1287
+ if (e.type !== "object" || X(t)) return null;
1242
1288
  if (e.multiple) {
1243
- if (!Array.isArray(t)) return Z(e, t, "This field expects multiple values", "Field expects an array of objects.");
1289
+ if (!Array.isArray(t)) return Y(e, t, "This field expects multiple values", "Field expects an array of objects.");
1244
1290
  for (let n of t) {
1245
- 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.");
1246
- if (!ct(n)) return Z(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1291
+ if (typeof n != "object" || !n) return Y(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
1292
+ if (!ht(n)) return Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1247
1293
  }
1248
1294
  return null;
1249
1295
  }
1250
- 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.).");
1296
+ return Array.isArray(t) ? Y(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Y(e, t, "This field expects an object value", "Field expects an object value.") : ht(t) ? null : Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
1251
1297
  }
1252
- function ft(e, t) {
1253
- if (Q(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
1298
+ function yt(e, t) {
1299
+ if (X(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
1254
1300
  let n = Array.isArray(t) ? t : [t];
1255
1301
  if (e.type === "object") {
1256
1302
  let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
1257
- 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.");
1303
+ return n.every((e) => r.has(JSON.stringify(e))) ? null : Y(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
1258
1304
  }
1259
1305
  let r = e.options.map((e) => e.value);
1260
- 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(", ")}`);
1306
+ return n.every((e) => !mt(e) || e === null ? !1 : r.includes(e)) ? null : Y(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
1261
1307
  }
1262
- async function pt(t, n, r, i) {
1263
- if (n.validation && !e(n.validation) && !Q(r)) {
1308
+ async function bt(t, n, r, i) {
1309
+ if (n.validation && !e(n.validation) && !X(r)) {
1264
1310
  let e = i ? {
1265
1311
  $input: r,
1266
1312
  responses: i
1267
1313
  } : { $input: r }, a = await t(n.validation, e);
1268
- if (typeof a == "string") return Z(n, r, a, `Field validation resulted in an error: ${a}.`);
1269
- if (a === !1) return Z(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
1314
+ if (typeof a == "string") return Y(n, r, a, `Field validation resulted in an error: ${a}.`);
1315
+ if (a === !1) return Y(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
1270
1316
  }
1271
- return n.required && Q(r) ? Z(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? Z(n, r, "This field expects a single response", "Field expects a single response.") : null;
1317
+ return n.required && X(r) ? Y(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? Y(n, r, "This field expects a single response", "Field expects a single response.") : null;
1272
1318
  }
1273
1319
  //#endregion
1274
1320
  //#region src/entities/response/response.ts
1275
- var mt = M("response"), ht = L(({ client: e }) => {
1276
- let t = mt.store({}), r = P(), i = P(), a = j(t, {
1321
+ var xt = M("response"), St = L(({ client: e }) => {
1322
+ let t = xt.store({}), r = P(), i = P(), a = j(t, {
1277
1323
  register(e, t) {
1278
1324
  return {
1279
1325
  ...e,
@@ -1312,7 +1358,7 @@ var mt = M("response"), ht = L(({ client: e }) => {
1312
1358
  ...t,
1313
1359
  ...n
1314
1360
  }, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
1315
- let o = lt(t, e);
1361
+ let o = gt(t, e);
1316
1362
  if (!o) {
1317
1363
  r.push({
1318
1364
  fieldKey: t,
@@ -1322,17 +1368,17 @@ var mt = M("response"), ht = L(({ client: e }) => {
1322
1368
  });
1323
1369
  return;
1324
1370
  }
1325
- let c = ut(o, n), l = await pt(s, o, c, a);
1371
+ let c = _t(o, n), l = await bt(s, o, c, a);
1326
1372
  if (l) {
1327
1373
  r.push(l);
1328
1374
  return;
1329
1375
  }
1330
- let u = dt(o, c);
1376
+ let u = vt(o, c);
1331
1377
  if (u) {
1332
1378
  r.push(u);
1333
1379
  return;
1334
1380
  }
1335
- let d = ft(o, c);
1381
+ let d = yt(o, c);
1336
1382
  if (d) {
1337
1383
  r.push(d);
1338
1384
  return;
@@ -1411,13 +1457,13 @@ var mt = M("response"), ht = L(({ client: e }) => {
1411
1457
  getByFieldName: _
1412
1458
  };
1413
1459
  });
1414
- function gt(e) {
1415
- return R(ht, e);
1460
+ function Ct(e) {
1461
+ return R(St, e);
1416
1462
  }
1417
1463
  //#endregion
1418
1464
  //#region src/entities/condition/condition.ts
1419
- var _t = M("condition"), vt = L(() => {
1420
- let e = _t.store({}), t = j(e, { register(e, t) {
1465
+ var wt = M("condition"), Tt = L(() => {
1466
+ let e = wt.store({}), t = j(e, { register(e, t) {
1421
1467
  return {
1422
1468
  ...e,
1423
1469
  [t.condition.id]: t.condition
@@ -1441,12 +1487,12 @@ var _t = M("condition"), vt = L(() => {
1441
1487
  indexStore: e
1442
1488
  };
1443
1489
  });
1444
- function yt() {
1445
- return R(vt);
1490
+ function Et() {
1491
+ return R(Tt);
1446
1492
  }
1447
1493
  //#endregion
1448
1494
  //#region src/utils/api-url.ts
1449
- function bt() {
1495
+ function Dt() {
1450
1496
  if (c()) {
1451
1497
  let e = [
1452
1498
  document.currentScript,
@@ -1461,7 +1507,7 @@ function bt() {
1461
1507
  }
1462
1508
  //#endregion
1463
1509
  //#region src/utils/search-params.ts
1464
- function xt() {
1510
+ function Ot() {
1465
1511
  if (!s()) return {};
1466
1512
  let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
1467
1513
  for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
@@ -1479,13 +1525,13 @@ function xt() {
1479
1525
  }
1480
1526
  //#endregion
1481
1527
  //#region src/entities/session/session.ts
1482
- var St = O("session", "global");
1483
- function Ct() {
1528
+ var kt = O("session", "global");
1529
+ function At() {
1484
1530
  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)}`;
1485
1531
  }
1486
- function wt() {
1532
+ function jt() {
1487
1533
  if (!m()) return null;
1488
- let e = E.get(St);
1534
+ let e = E.get(kt);
1489
1535
  if (!e.isSet()) return null;
1490
1536
  try {
1491
1537
  return e.json();
@@ -1493,8 +1539,8 @@ function wt() {
1493
1539
  return null;
1494
1540
  }
1495
1541
  }
1496
- var Tt = L(() => {
1497
- let e = wt(), t = { id: e?.id ?? Ct() };
1542
+ var Mt = L(() => {
1543
+ let e = jt(), t = { id: e?.id ?? At() };
1498
1544
  e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
1499
1545
  let n = F(t), r = j(n, {
1500
1546
  setIsUser: (e, t) => ({
@@ -1516,17 +1562,17 @@ var Tt = L(() => {
1516
1562
  let i = { id: e.id };
1517
1563
  return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
1518
1564
  }
1565
+ }), i = k({
1566
+ source: n,
1567
+ effect: (e) => {
1568
+ if (m()) try {
1569
+ E.get(kt).set(e);
1570
+ } catch {}
1571
+ }
1519
1572
  });
1520
1573
  return I({
1521
1574
  source: n,
1522
- target: k({
1523
- source: n,
1524
- effect: (e) => {
1525
- if (m()) try {
1526
- E.get(St).set(e);
1527
- } catch {}
1528
- }
1529
- })
1575
+ target: i
1530
1576
  }), {
1531
1577
  store: n,
1532
1578
  setIsUser: r.setIsUser,
@@ -1534,39 +1580,39 @@ var Tt = L(() => {
1534
1580
  removeIdentifier: r.removeIdentifier
1535
1581
  };
1536
1582
  });
1537
- function Et() {
1538
- return R(Tt, void 0);
1583
+ function Nt() {
1584
+ return R(Mt, void 0);
1539
1585
  }
1540
1586
  //#endregion
1541
1587
  //#region src/utils/picked-config.ts
1542
- function Dt() {
1588
+ function Pt() {
1543
1589
  if (s()) return globalThis.window.pickedConfig;
1544
1590
  }
1545
- function Ot() {
1546
- if (s()) return Dt()?.projectId;
1591
+ function Ft() {
1592
+ if (s()) return Pt()?.projectId;
1547
1593
  }
1548
- function kt() {
1594
+ function It() {
1549
1595
  if (!c()) return;
1550
1596
  let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
1551
1597
  if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
1552
1598
  }
1553
- function At(e) {
1599
+ function Lt(e) {
1554
1600
  if (e.projectId) return e.projectId;
1555
- let t = Ot();
1601
+ let t = Ft();
1556
1602
  if (t) return t;
1557
- let n = kt();
1603
+ let n = It();
1558
1604
  if (n) return n;
1559
1605
  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.");
1560
1606
  }
1561
1607
  //#endregion
1562
1608
  //#region src/utils/render-string.ts
1563
- function $(e) {
1609
+ function Z(e) {
1564
1610
  return e == null || e === "" || Number.isNaN(e);
1565
1611
  }
1566
- var jt = {
1567
- default: (e, t) => $(e) ? String(t ?? "") : String(e),
1568
- append: (e, t) => t && !$(e) ? `${e} ${t}` : e,
1569
- prepend: (e, t) => t && !$(e) ? `${t} ${e}` : e,
1612
+ var Rt = {
1613
+ default: (e, t) => Z(e) ? String(t ?? "") : String(e),
1614
+ append: (e, t) => t && !Z(e) ? `${e} ${t}` : e,
1615
+ prepend: (e, t) => t && !Z(e) ? `${t} ${e}` : e,
1570
1616
  upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
1571
1617
  lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
1572
1618
  capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
@@ -1584,24 +1630,24 @@ var jt = {
1584
1630
  return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
1585
1631
  }
1586
1632
  };
1587
- function Mt(e) {
1633
+ function zt(e) {
1588
1634
  return typeof e == "object" && !!e;
1589
1635
  }
1590
- function Nt(e, t) {
1636
+ function Bt(e, t) {
1591
1637
  let n = t;
1592
- for (let t of e.split(".")) if (Mt(n) && t in n) n = n[t];
1638
+ for (let t of e.split(".")) if (zt(n) && t in n) n = n[t];
1593
1639
  else return;
1594
1640
  return typeof n == "function" ? n() : n;
1595
1641
  }
1596
- function Pt(e, t) {
1597
- let n = e.split("|").map((e) => e.trim()), r = Nt(n.shift() ?? "", t);
1642
+ function Vt(e, t) {
1643
+ let n = e.split("|").map((e) => e.trim()), r = Bt(n.shift() ?? "", t);
1598
1644
  for (let e of n) {
1599
- let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = jt[i];
1645
+ let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Rt[i];
1600
1646
  o && (r = o(r, a));
1601
1647
  }
1602
- return $(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1648
+ return Z(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1603
1649
  }
1604
- function Ft(e, t) {
1650
+ function Ht(e, t) {
1605
1651
  let n = "", r = 0;
1606
1652
  for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
1607
1653
  r += 2;
@@ -1613,17 +1659,24 @@ function Ft(e, t) {
1613
1659
  }
1614
1660
  i += e[r++];
1615
1661
  }
1616
- n += Pt(i.trim(), t);
1662
+ n += Vt(i.trim(), t);
1617
1663
  } else n += e[r++];
1618
1664
  return n;
1619
1665
  }
1620
1666
  //#endregion
1667
+ //#region src/utils/preview-session.ts
1668
+ var Ut = "preview-token";
1669
+ function Wt() {
1670
+ return !s() || !h() ? !1 : !!Ot()[Ut]?.[0];
1671
+ }
1672
+ //#endregion
1621
1673
  //#region src/picked.ts
1622
- var It = class {
1674
+ var Gt = class {
1623
1675
  static logger = r;
1624
1676
  options;
1625
1677
  dataSource = null;
1626
1678
  contentLoader;
1679
+ previewEmbedderOrigins = null;
1627
1680
  plugins = {};
1628
1681
  eventBus = P();
1629
1682
  events;
@@ -1631,66 +1684,66 @@ var It = class {
1631
1684
  apiUrl;
1632
1685
  dashboardUrl;
1633
1686
  documentationSiteUrl;
1634
- session = Et();
1635
- searchParams = xt();
1636
- history = Ue();
1637
- components = he({ client: this });
1687
+ session = Nt();
1688
+ searchParams = Ot();
1689
+ history = Xe();
1690
+ components = ye({ client: this });
1638
1691
  experienceInstances = S({ client: this });
1639
- experiences = se({ client: this });
1640
- frameworks = ve({ client: this });
1641
- predicates = Ie({ client: this });
1642
- features = ze({ client: this });
1643
- conditions = yt();
1644
- fields = Je();
1645
- responses = gt({ client: this });
1646
- steps = Ze();
1647
- contents = tt();
1648
- actions = at({ client: this });
1692
+ experiences = de({ client: this });
1693
+ frameworks = Ce({ client: this });
1694
+ predicates = He({ client: this });
1695
+ features = Ke({ client: this });
1696
+ conditions = Et();
1697
+ fields = tt();
1698
+ responses = Ct({ client: this });
1699
+ steps = it();
1700
+ contents = ct();
1701
+ actions = ft({ client: this });
1649
1702
  conditionResults = C();
1650
- stateSnapshotStore = xe({ client: this });
1651
- evaluateRuleLogicFx = Oe({ client: this });
1703
+ stateSnapshotStore = Ee({ client: this });
1704
+ evaluateRuleLogicFx = Pe({ client: this });
1652
1705
  start;
1653
1706
  readyStore;
1654
1707
  preconditionPassedStore;
1655
1708
  conditionPassedStore;
1656
1709
  lifecycleStageStore;
1657
- lifecycle = Ne({ client: this });
1710
+ lifecycle = ze({ client: this });
1658
1711
  renderStringFx = k({
1659
1712
  source: this.responses.listStore,
1660
1713
  effect: (e, { template: t, context: n }) => {
1661
1714
  let r = {};
1662
1715
  for (let t of e) r[t.fieldKey] = t.value;
1663
- return Ft(t, {
1716
+ return Ht(t, {
1664
1717
  ...n,
1665
1718
  responses: r
1666
1719
  });
1667
1720
  }
1668
1721
  });
1669
1722
  constructor(e) {
1670
- 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({
1723
+ this.events = Qe(this.eventBus), this.projectId = Lt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Dt(), 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({
1671
1724
  type: "load",
1672
1725
  version: ne()
1673
- }), this.maybeStartPreviewBridge();
1726
+ }), this.maybeStartPreviewChannel();
1674
1727
  }
1675
- maybeStartPreviewBridge() {
1676
- !s() || !h() || this.searchParams["preview-token"]?.[0] && import("../preview-bridge-D76l-dPy.js").then((e) => e.initPreviewBridge()).catch(() => void 0);
1728
+ maybeStartPreviewChannel() {
1729
+ Wt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
1677
1730
  }
1678
1731
  registerFramework = (e) => {
1679
- ye(e, this.frameworks);
1732
+ we(e, this.frameworks);
1680
1733
  };
1681
1734
  registerComponent = (e, t) => {
1682
- B(e, t, this.components);
1735
+ be(e, t, this.components);
1683
1736
  };
1684
1737
  registerPlugin = (e) => {
1685
- ue(this, e, this.plugins);
1738
+ me(this, e, this.plugins);
1686
1739
  let t = this.plugins[e.name];
1687
1740
  t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
1688
1741
  };
1689
1742
  registerFeature = (e, t) => {
1690
- Be(e, t, this.features);
1743
+ qe(e, t, this.features);
1691
1744
  };
1692
1745
  registerPredicate = (e, t) => {
1693
- Le(e, t, this.predicates);
1746
+ Ue(e, t, this.predicates);
1694
1747
  };
1695
1748
  registerCondition = (e) => {
1696
1749
  this.conditions.register(e);
@@ -1699,16 +1752,19 @@ var It = class {
1699
1752
  this.fields.register(e);
1700
1753
  };
1701
1754
  registerStep = (e) => {
1702
- Qe(e, this.steps);
1755
+ at(e, this.steps);
1703
1756
  };
1704
1757
  registerContent = (e) => {
1705
- nt(e, this.contents);
1758
+ lt(e, this.contents);
1759
+ };
1760
+ patchContent = (e, t) => {
1761
+ this.contents.patch(e, t);
1706
1762
  };
1707
1763
  registerAction = (e, t) => {
1708
- ot(e, t, this.actions);
1764
+ pt(e, t, this.actions);
1709
1765
  };
1710
1766
  registerExperience = (e) => {
1711
- e.component && B(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1767
+ e.component && be(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
1712
1768
  };
1713
1769
  launchExperienceById = async (e, t) => {
1714
1770
  this.experiences.launch({
@@ -1790,11 +1846,19 @@ var It = class {
1790
1846
  });
1791
1847
  }
1792
1848
  getPluginConfig = (e) => this.plugins[e] ?? {};
1793
- }, Lt = "application/picked-javascript", Rt = "application/picked-module", zt = "data-picked-hydrated";
1794
- async function Bt(e) {
1849
+ }, Kt = "application/picked-javascript", qt = "application/picked-module", Jt = "data-picked-hydrated";
1850
+ async function Yt(e) {
1795
1851
  if (!("document" in globalThis)) return;
1796
1852
  let t = "application/picked-module", n = "data-picked-hydrated";
1797
- function r(e, t) {
1853
+ function r(e) {
1854
+ try {
1855
+ Function(e.textContent);
1856
+ } catch (t) {
1857
+ return t instanceof SyntaxError && (console.error("[picked] Skipped a rehydrated inline script that failed to parse.", t), e.setAttribute(n, ""), !0);
1858
+ }
1859
+ return !1;
1860
+ }
1861
+ function i(e, t) {
1798
1862
  let r = document.createElement("script");
1799
1863
  for (let t of Array.from(e.attributes)) t.name !== "type" && r.setAttribute(t.name, t.value);
1800
1864
  t && r.setAttribute("type", t), r.setAttribute(n, ""), e.src ? r.async = !1 : r.textContent = e.textContent;
@@ -1803,37 +1867,73 @@ async function Bt(e) {
1803
1867
  }) : null;
1804
1868
  return e.src ? e.replaceWith(r) : (globalThis.__pickedEmbedScriptRoot = e.getRootNode(), e.replaceWith(r), globalThis.__pickedEmbedScriptRoot = null), i;
1805
1869
  }
1806
- let i = Array.from(e.querySelectorAll(`script[type="application/picked-javascript"]:not([${n}]), script[type="${t}"]:not([${n}])`)).filter((e) => e instanceof HTMLScriptElement);
1807
- for (let e of i) {
1870
+ let a = Array.from(e.querySelectorAll(`script[type="application/picked-javascript"]:not([${n}]), script[type="${t}"]:not([${n}])`)).filter((e) => e instanceof HTMLScriptElement);
1871
+ for (let e of a) {
1808
1872
  if (!e.isConnected) continue;
1809
- let n = r(e, e.getAttribute("type") === t ? "module" : null);
1810
- n && await n;
1873
+ let n = e.getAttribute("type") === t ? "module" : null;
1874
+ if (!e.src && n === null && r(e)) continue;
1875
+ let a = i(e, n);
1876
+ a && await a;
1811
1877
  }
1812
1878
  }
1813
- function Vt() {
1814
- return `<script>(${Bt.toString()})(document)<\/script>`;
1879
+ function Xt() {
1880
+ return `<script>(${Yt.toString()})(document)<\/script>`;
1815
1881
  }
1816
1882
  //#endregion
1817
1883
  //#region src/utils/html-asset-value.ts
1818
- function Ht(e) {
1884
+ function Zt(e) {
1819
1885
  return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
1820
1886
  }
1821
1887
  //#endregion
1822
1888
  //#region src/entities/component/lazyComponent.ts
1823
- function Ut(e) {
1889
+ function Qt(e) {
1824
1890
  return {
1825
1891
  $$type: "lazy-component",
1826
1892
  load: e
1827
1893
  };
1828
1894
  }
1829
- function Wt(e) {
1895
+ function $t(e) {
1830
1896
  return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
1831
1897
  }
1832
1898
  //#endregion
1899
+ //#region src/entities/content/reference.ts
1900
+ function Q(e) {
1901
+ return typeof e == "object" && !!e && !Array.isArray(e) && "contentEntryId" in e && typeof e.contentEntryId == "string";
1902
+ }
1903
+ function $(e) {
1904
+ return Q(e) ? e.contentEntryId : null;
1905
+ }
1906
+ function en(e) {
1907
+ let t = Array.isArray(e) ? e : [e], n = [];
1908
+ for (let e of t) Q(e) && n.push(e.contentEntryId);
1909
+ return n;
1910
+ }
1911
+ function tn(e, t) {
1912
+ return t === null ? null : e[t] ?? null;
1913
+ }
1914
+ function nn(e, t) {
1915
+ let n = [];
1916
+ for (let r of t) {
1917
+ let t = e[r];
1918
+ t !== void 0 && n.push(t);
1919
+ }
1920
+ return n;
1921
+ }
1922
+ function rn(e, t) {
1923
+ if (se.store(t)) return A(t, e.indexStore, (e, t) => tn(t, $(e)));
1924
+ let n = $(t);
1925
+ return e.indexStore.map((e) => tn(e, n), { skipVoid: !1 });
1926
+ }
1927
+ function an(e, t) {
1928
+ if (se.store(t)) return A(t, e.indexStore, (e, t) => nn(t, en(e)));
1929
+ let n = en(t);
1930
+ return e.indexStore.map((e) => nn(e, n), { skipVoid: !1 });
1931
+ }
1932
+ //#endregion
1833
1933
  //#region src/exports.ts
1834
- var Gt = (e) => {
1835
- let t = new It(e);
1934
+ var on = (e) => {
1935
+ let t = new Gt(e);
1836
1936
  return u(t), t;
1837
1937
  };
1838
1938
  //#endregion
1839
- 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 };
1939
+ export { Jt as PICKED_HYDRATED_ATTR, qt as PICKED_MODULE_SCRIPT_TYPE, Kt as PICKED_SCRIPT_TYPE, Ut as PREVIEW_TOKEN_PARAM, Gt as Picked, Xt as buildRehydrateBootstrap, on as createClient, pe as createPluginEffect, O as createStorageKey, rn as deriveReference, an as deriveReferences, n as evaluateRuleLogic, Pt as getPickedConfig, Q as isContentReference, Zt as isHtmlAssetValue, h as isInsideIframe, $t as isLazyLoader, _ as isPickedRoot, Wt as isPreviewSession, Qt as lazyComponent, E as localStore, oe as onInertScriptSubtrees, $ as readReferenceId, en as readReferenceIds, Yt as rehydrateScripts, ie as reportInertScriptSubtrees, ae as resetInertScriptReport, 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 };