@spiffcommerce/core 26.41.1-beta.cc87c98f-e30a-5e14-ad02-fdadcd3db1bc → 26.41.1-beta.cfe1b2be-79ed-58e3-a363-a42c2516a93e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -20,7 +20,7 @@ import { split as Ze } from "unicode-default-word-boundary";
20
20
  import cn from "lodash.debounce";
21
21
  import "fs";
22
22
  import "path";
23
- var fe = /* @__PURE__ */ ((r) => (r.Data = "Data", r.Font = "Font", r.Frame = "Frame", r.Illustration = "Illustration", r.Image = "Image", r.Model = "Model", r.Material = "Material", r.Color = "Color", r.QuestionnaireCollateral = "QuestionnaireCollateral", r.RequestCollateral = "RequestCollateral", r.SignupCollateral = "SignupCollateral", r.Video = "Video", r.ColorProfile = "ColorProfile", r.Environment = "Environment", r))(fe || {}), et = /* @__PURE__ */ ((r) => (r.FileUpload = "FileUpload", r.Option = "Option", r.ColorOption = "ColorOption", r.Text = "Text", r))(et || {}), P = /* @__PURE__ */ ((r) => (r.Information = "Information", r.Bulk = "Bulk", r.DigitalContent = "DigitalContent", r.Finish = "Finish", r.Frame = "Frame", r.Illustration = "Illustration", r.Introduction = "Introduction", r.Material = "Material", r.Model = "Model", r.Module = "Module", r.Picture = "Picture", r.Photo = "Photo", r.ProductOverlay = "ProductOverlay", r.Question = "Question", r.Shape = "Shape", r.SilentIllustration = "SilentIllustration", r.Text = "Text", r))(P || {}), wr = /* @__PURE__ */ ((r) => (r.Color = "Color", r.Colors = "Colors", r.Selection = "Selection", r.Selections = "Selections", r.Text = "Text", r.Upload = "Upload", r))(wr || {}), Wt = /* @__PURE__ */ ((r) => (r.ThreeD = "ThreeD", r.FreeDesign = "FreeDesign", r.Print = "Print", r))(Wt || {}), T = /* @__PURE__ */ ((r) => (r.Frame = "frame", r.Group = "group", r.Image = "image", r.Pattern = "pattern", r.Illustration = "illustration", r.Textbox = "textbox", r))(T || {}), yr = /* @__PURE__ */ ((r) => (r.Default = "Default", r.FirstTransaction = "FirstTransaction", r.OneToOne = "OneToOne", r))(yr || {}), Sr = /* @__PURE__ */ ((r) => (r.Hyperlink = "Hyperlink", r.Edit = "Edit", r.Approve = "Approve", r))(Sr || {}), vr = /* @__PURE__ */ ((r) => (r.Hub = "Hub", r.Shopify = "Shopify", r))(vr || {}), ha = /* @__PURE__ */ ((r) => (r.BackgroundRemover = "BackgroundRemover", r.ConversionAccelerator = "Conversion Accelerator", r.ProcessBuilder = "ProcessBuilder", r))(ha || {}), Er = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(Er || {}), Ce = /* @__PURE__ */ ((r) => (r.Owner = "Owner", r.Approver = "Approver", r.Editor = "Editor", r.Viewer = "Viewer", r))(Ce || {}), Mt = /* @__PURE__ */ ((r) => (r.Autosize = "Autosize", r.Traditional = "Traditional", r))(Mt || {}), j = /* @__PURE__ */ ((r) => (r[r.North = 0] = "North", r[r.Northeast = 1] = "Northeast", r[r.East = 2] = "East", r[r.Southeast = 3] = "Southeast", r[r.South = 4] = "South", r[r.Southwest = 5] = "Southwest", r[r.West = 6] = "West", r[r.Northwest = 7] = "Northwest", r))(j || {}), Br = /* @__PURE__ */ ((r) => (r.Pixel = "px", r.Millimeter = "mm", r.Centimeter = "cm", r))(Br || {});
23
+ var fe = /* @__PURE__ */ ((r) => (r.Data = "Data", r.Font = "Font", r.Frame = "Frame", r.Illustration = "Illustration", r.Image = "Image", r.Model = "Model", r.Material = "Material", r.Color = "Color", r.QuestionnaireCollateral = "QuestionnaireCollateral", r.RequestCollateral = "RequestCollateral", r.SignupCollateral = "SignupCollateral", r.Video = "Video", r.ColorProfile = "ColorProfile", r.Environment = "Environment", r))(fe || {}), et = /* @__PURE__ */ ((r) => (r.FileUpload = "FileUpload", r.Option = "Option", r.ColorOption = "ColorOption", r.Text = "Text", r))(et || {}), P = /* @__PURE__ */ ((r) => (r.Information = "Information", r.Bulk = "Bulk", r.DigitalContent = "DigitalContent", r.Finish = "Finish", r.Frame = "Frame", r.Illustration = "Illustration", r.Introduction = "Introduction", r.Material = "Material", r.Model = "Model", r.Module = "Module", r.Picture = "Picture", r.Photo = "Photo", r.ProductOverlay = "ProductOverlay", r.Question = "Question", r.Shape = "Shape", r.SilentIllustration = "SilentIllustration", r.Text = "Text", r))(P || {}), wr = /* @__PURE__ */ ((r) => (r.Color = "Color", r.Colors = "Colors", r.Selection = "Selection", r.Selections = "Selections", r.Text = "Text", r.Upload = "Upload", r))(wr || {}), Wt = /* @__PURE__ */ ((r) => (r.ThreeD = "ThreeD", r.FreeDesign = "FreeDesign", r.Print = "Print", r))(Wt || {}), T = /* @__PURE__ */ ((r) => (r.Frame = "frame", r.Group = "group", r.Image = "image", r.Pattern = "pattern", r.Illustration = "illustration", r.Textbox = "textbox", r))(T || {}), yr = /* @__PURE__ */ ((r) => (r.Default = "Default", r.FirstTransaction = "FirstTransaction", r.OneToOne = "OneToOne", r))(yr || {}), Sr = /* @__PURE__ */ ((r) => (r.Hyperlink = "Hyperlink", r.Edit = "Edit", r.Approve = "Approve", r))(Sr || {}), Er = /* @__PURE__ */ ((r) => (r.Hub = "Hub", r.Shopify = "Shopify", r))(Er || {}), ha = /* @__PURE__ */ ((r) => (r.BackgroundRemover = "BackgroundRemover", r.ConversionAccelerator = "Conversion Accelerator", r.ProcessBuilder = "ProcessBuilder", r))(ha || {}), vr = /* @__PURE__ */ ((r) => (r[r.Orbit = 0] = "Orbit", r[r.Pan = 1] = "Pan", r))(vr || {}), Ce = /* @__PURE__ */ ((r) => (r.Owner = "Owner", r.Approver = "Approver", r.Editor = "Editor", r.Viewer = "Viewer", r))(Ce || {}), Mt = /* @__PURE__ */ ((r) => (r.Autosize = "Autosize", r.Traditional = "Traditional", r))(Mt || {}), j = /* @__PURE__ */ ((r) => (r[r.North = 0] = "North", r[r.Northeast = 1] = "Northeast", r[r.East = 2] = "East", r[r.Southeast = 3] = "Southeast", r[r.South = 4] = "South", r[r.Southwest = 5] = "Southwest", r[r.West = 6] = "West", r[r.Northwest = 7] = "Northwest", r))(j || {}), Br = /* @__PURE__ */ ((r) => (r.Pixel = "px", r.Millimeter = "mm", r.Centimeter = "cm", r))(Br || {});
24
24
  class dn extends Error {
25
25
  constructor(t) {
26
26
  super(t), this.name = this.constructor.name;
@@ -41,7 +41,7 @@ class q extends Jt {
41
41
  super(`Panel not Found: ${t.panelId}`), this.panelId = (t == null ? void 0 : t.panelId) || "N/A";
42
42
  }
43
43
  }
44
- class vt extends Jt {
44
+ class Et extends Jt {
45
45
  constructor(t) {
46
46
  super(`Asset not found for variant: ${t.name}`), this.variant = t;
47
47
  }
@@ -162,7 +162,7 @@ let ta, ea;
162
162
  function Sc(r) {
163
163
  ta = r;
164
164
  }
165
- function vc(r) {
165
+ function Ec(r) {
166
166
  ea = r;
167
167
  }
168
168
  function Kt() {
@@ -257,7 +257,7 @@ const An = /* @__PURE__ */ new Map(), Ta = /* @__PURE__ */ new Map(), Na = /* @_
257
257
  }
258
258
  const e = t();
259
259
  return e || "image/svg+xml";
260
- }, Ec = async (r) => {
260
+ }, vc = async (r) => {
261
261
  const t = await un(r), e = An.get(r) || xe(t);
262
262
  return await Nr(new Blob([t], { type: e }));
263
263
  }, Mr = (r) => {
@@ -318,49 +318,52 @@ async function Lr(r, t) {
318
318
  return n.type === "opaqueredirect" && (typeof r != "string" && "url" in r ? n = await rt({ ...r, url: `${a}/graphql` }, t) : n = await rt(`${a}/graphql`, t)), n;
319
319
  }
320
320
  class Vr {
321
- constructor(t) {
322
- this.shadowGraphqlClient = this.constructShadowGraphqlClient(t), mt.addServerUrlCallback(() => {
323
- this.shadowGraphqlClient = this.constructShadowGraphqlClient(t);
321
+ constructor() {
322
+ this.shadowGraphqlClient = this.constructShadowGraphqlClient(), mt.addServerUrlCallback(() => {
323
+ this.shadowGraphqlClient = this.constructShadowGraphqlClient();
324
324
  });
325
325
  }
326
+ setSpiffCommerceClient(t) {
327
+ this.spiffClient = t, this.shadowGraphqlClient = this.constructShadowGraphqlClient();
328
+ }
326
329
  getShadowGraphqlClient() {
327
330
  return this.shadowGraphqlClient;
328
331
  }
329
- constructShadowGraphqlClient(t) {
330
- const e = sr({
332
+ constructShadowGraphqlClient() {
333
+ const t = sr({
331
334
  uri: `${mt.getServerUrl()}/graphql`,
332
335
  fetch: Lr
333
- }), a = dr(async (s, o) => {
334
- const { headers: l } = o, c = l || {}, d = await Ur();
335
- let A = o.bearer ?? d.bearer;
336
- if (t)
336
+ }), e = dr(async (i, s) => {
337
+ const { headers: o } = s, l = o || {}, c = await Ur();
338
+ let d = s.bearer ?? c.bearer;
339
+ if (this.spiffClient)
337
340
  try {
338
- A = await t.loggedInBearerToken();
341
+ d = await this.spiffClient.loggedInBearerToken();
339
342
  } catch {
340
343
  }
341
- const u = o.partnerId ?? d.partnerId, h = o.activeIntegration ?? d.activeIntegration, m = o.transactionOwnerId, g = o.customerToken ?? d.customerToken, p = o.applicationKey ?? d.applicationKey, f = o.bundleOwnerId;
344
+ const A = s.partnerId ?? c.partnerId, u = s.activeIntegration ?? c.activeIntegration, h = s.transactionOwnerId, m = s.customerToken ?? c.customerToken, g = s.applicationKey ?? c.applicationKey, p = s.bundleOwnerId;
342
345
  try {
343
346
  if (window && window.__SENTRY__) {
344
- const C = window.__SENTRY__.hub;
345
- if (C) {
346
- const w = C.traceHeaders();
347
- Object.entries(w).forEach(([v, S]) => {
348
- c[v] = S;
347
+ const f = window.__SENTRY__.hub;
348
+ if (f) {
349
+ const C = f.traceHeaders();
350
+ Object.entries(C).forEach(([w, E]) => {
351
+ l[w] = E;
349
352
  });
350
353
  }
351
354
  }
352
355
  } catch {
353
356
  }
354
- return A && (c.Authorization = `Bearer ${A}`), u && (c.partnerId = u), h && (c.activeIntegration = h), m && (c.transactionOwnerId = m), g && (c.customerToken = g), p && (c["X-Application-Key"] = p), f && (c.bundleOwnerId = f), c["Allow-Moonlight-Redirect"] = "true", {
355
- headers: c
357
+ return d && (l.Authorization = `Bearer ${d}`), A && (l.partnerId = A), u && (l.activeIntegration = u), h && (l.transactionOwnerId = h), m && (l.customerToken = m), g && (l["X-Application-Key"] = g), p && (l.bundleOwnerId = p), l["Allow-Moonlight-Redirect"] = "true", {
358
+ headers: l
356
359
  };
357
- }), n = Ar(({ operation: s, graphQLErrors: o, networkError: l }) => {
358
- var A, u;
359
- const c = o || [], d = s.getContext();
360
- l && !((u = (A = d == null ? void 0 : d.fetchOptions) == null ? void 0 : A.signal) != null && u.aborted) && console.log("GraphQL Network error"), c.forEach(() => console.log("GraphQL Error: " + s.operationName));
361
- }), i = hr();
360
+ }), a = Ar(({ operation: i, graphQLErrors: s, networkError: o }) => {
361
+ var d, A;
362
+ const l = s || [], c = i.getContext();
363
+ o && !((A = (d = c == null ? void 0 : c.fetchOptions) == null ? void 0 : d.signal) != null && A.aborted) && console.log("GraphQL Network error"), l.forEach(() => console.log("GraphQL Error: " + i.operationName));
364
+ }), n = hr();
362
365
  return new or({
363
- link: lr([i, n, a, e]),
366
+ link: lr([n, a, e, t]),
364
367
  cache: new cr(),
365
368
  name: "Core"
366
369
  });
@@ -3337,16 +3340,16 @@ const se = (r) => {
3337
3340
  }
3338
3341
  });
3339
3342
  });
3340
- }, vn = (r) => bt().serializeToString(r), Ca = (r, t, e, a, n) => {
3343
+ }, En = (r) => bt().serializeToString(r), Ca = (r, t, e, a, n) => {
3341
3344
  const i = yn(r);
3342
3345
  if (!i)
3343
3346
  throw new Error("Failed to read SVG.");
3344
- return ti(i, t, e), Sn(i, a, n), vn(i);
3347
+ return ti(i, t, e), Sn(i, a, n), En(i);
3345
3348
  }, wa = (r, t, e) => {
3346
3349
  const a = yn(r);
3347
3350
  if (!a)
3348
3351
  throw new Error("Failed to read SVG.");
3349
- return Sn(a, t, e), vn(a);
3352
+ return Sn(a, t, e), En(a);
3350
3353
  }, ei = (r) => {
3351
3354
  const t = /<svg.*<\/svg>/s, e = r.match(t) || [], a = (e == null ? void 0 : e.length) > 0 ? e[0] : "";
3352
3355
  return dt().parseFromString(a, "image/svg+xml");
@@ -3713,7 +3716,7 @@ class ci {
3713
3716
  }
3714
3717
  }
3715
3718
  }
3716
- const Rt = "persistentAssets", En = class Ct {
3719
+ const Rt = "persistentAssets", vn = class Ct {
3717
3720
  /**
3718
3721
  * Add a new asset to persistence
3719
3722
  * @param asset The asset to add.
@@ -3764,8 +3767,8 @@ const Rt = "persistentAssets", En = class Ct {
3764
3767
  Ct.callbacks.forEach((t) => t());
3765
3768
  }
3766
3769
  };
3767
- En.callbacks = [];
3768
- let It = En;
3770
+ vn.callbacks = [];
3771
+ let It = vn;
3769
3772
  const Ua = "bgrmPersistentAssets";
3770
3773
  class Y {
3771
3774
  static has(t) {
@@ -4420,14 +4423,14 @@ const _ = new gi(), bn = y`
4420
4423
  ` : ""}
4421
4424
  }
4422
4425
  }
4423
- `, vi = (r) => y`
4426
+ `, Ei = (r) => y`
4424
4427
  ${Fn(r)}
4425
4428
  query GetIntegrationProducts($ids: [String!]!) {
4426
4429
  integrationProducts(ids: $ids) {
4427
4430
  ...IntegrationProductFields
4428
4431
  }
4429
4432
  }
4430
- `, Ei = (r) => y`
4433
+ `, vi = (r) => y`
4431
4434
  ${Fn(r)}
4432
4435
  query GetIntegrationProductFromExternalIds($externalIntegrationId: String!, $externalProductId: String!) {
4433
4436
  integrationProductFromExternalIds(
@@ -5317,14 +5320,14 @@ const Q = () => {
5317
5320
  width: u
5318
5321
  }) => {
5319
5322
  var B;
5320
- const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = Q(), C = a.purpose === Wt.FreeDesign && /* @__PURE__ */ x("defs", { children: /* @__PURE__ */ x("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ x("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (B = a.colorProfiles) == null ? void 0 : B.map((E, I) => (
5323
+ const h = e || 0, m = 2 * ((l == null ? void 0 : l.scale) || 1), g = A || { x: 0, y: 0, width: u, height: i }, p = `${g.x} ${g.y} ${g.width} ${g.height}`, f = Q(), C = a.purpose === Wt.FreeDesign && /* @__PURE__ */ x("defs", { children: /* @__PURE__ */ x("clipPath", { id: "viewboxClip", children: /* @__PURE__ */ x("rect", { width: g.width, height: g.height, rx: h }) }) }), w = (B = a.colorProfiles) == null ? void 0 : B.map((v, I) => (
5321
5324
  /* @ts-ignore */
5322
- /* @__PURE__ */ x("color-profile", { name: E.name, xlinkHref: E.key, children: " " }, I)
5323
- )), v = n.map((E) => ({
5324
- ...E,
5325
+ /* @__PURE__ */ x("color-profile", { name: v.name, xlinkHref: v.key, children: " " }, I)
5326
+ )), E = n.map((v) => ({
5327
+ ...v,
5325
5328
  _renderingConfiguration: a,
5326
5329
  mask: l ? `url(#viewmask-${f})` : void 0
5327
- })), S = Ea(v);
5330
+ })), S = va(E);
5328
5331
  return /* @__PURE__ */ ct(
5329
5332
  "svg",
5330
5333
  {
@@ -5361,7 +5364,7 @@ const Q = () => {
5361
5364
  {
5362
5365
  id: "element-group",
5363
5366
  clipPath: a.purpose === Wt.FreeDesign ? "url(#viewboxClip)" : void 0,
5364
- children: S.map((E) => On(E)).filter((E) => !!E)
5367
+ children: S.map((v) => On(v)).filter((v) => !!v)
5365
5368
  }
5366
5369
  ),
5367
5370
  l && /* @__PURE__ */ x(
@@ -5403,10 +5406,10 @@ const Q = () => {
5403
5406
  }
5404
5407
  );
5405
5408
  }, Pc = (r, t, e, a, n) => {
5406
- const i = pt(n), s = e / 2, o = a / 2, l = r + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * A - m * d, f = h * A - g * d, C = u * d + m * A, w = h * d + g * A, v = Math.max(Math.abs(p), Math.abs(f)), S = Math.max(Math.abs(C), Math.abs(w));
5409
+ const i = pt(n), s = e / 2, o = a / 2, l = r + s, c = t + o, d = Math.sin(i), A = Math.cos(i), u = s, h = s, m = -o, g = o, p = u * A - m * d, f = h * A - g * d, C = u * d + m * A, w = h * d + g * A, E = Math.max(Math.abs(p), Math.abs(f)), S = Math.max(Math.abs(C), Math.abs(w));
5407
5410
  return {
5408
- minX: l - v,
5409
- maxX: l + v,
5411
+ minX: l - E,
5412
+ maxX: l + E,
5410
5413
  minY: c - S,
5411
5414
  maxY: c + S
5412
5415
  };
@@ -5504,7 +5507,7 @@ const Q = () => {
5504
5507
  ) });
5505
5508
  }, Tn = (r) => {
5506
5509
  var l;
5507
- const t = `spiff-group-clip-${r.id}`, e = r.rotation || 0, a = pt(e), n = Math.cos(a), i = -Math.sin(a), s = Ea(r.children);
5510
+ const t = `spiff-group-clip-${r.id}`, e = r.rotation || 0, a = pt(e), n = Math.cos(a), i = -Math.sin(a), s = va(r.children);
5508
5511
  return /* @__PURE__ */ ct(zt, { children: [
5509
5512
  /* @__PURE__ */ x("defs", { children: (() => /* @__PURE__ */ x("clipPath", { id: t, preserveAspectRatio: "none", children: r.clipPath ? /* @__PURE__ */ x("path", { d: r.clipPath }) : /* @__PURE__ */ x("rect", { x: 0, y: 0, width: r.width, height: r.height }) }))() }),
5510
5513
  /* @__PURE__ */ ct(
@@ -5566,8 +5569,8 @@ const Q = () => {
5566
5569
  /* @__PURE__ */ x("feFuncB", { type: "discrete", tableValues: n() })
5567
5570
  ] })
5568
5571
  ] }) }) }), s = r.rotation || 0, o = pt(s), l = Math.cos(o), c = -Math.sin(o), d = () => {
5569
- var w, v, S, B, E, I, D, F, k, N;
5570
- const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((v = r.pattern) == null ? void 0 : v.y) || 0, h = ((S = r.pattern) == null ? void 0 : S.width) || 0, m = ((B = r.pattern) == null ? void 0 : B.height) || 0, g = ((E = r.pattern) == null ? void 0 : E.scaleX) || 1, p = ((I = r.pattern) == null ? void 0 : I.scaleY) || 1, f = ((D = r.pattern) == null ? void 0 : D.rotation) || 0;
5572
+ var w, E, S, B, v, I, D, F, k, N;
5573
+ const A = ((w = r.pattern) == null ? void 0 : w.x) || 0, u = ((E = r.pattern) == null ? void 0 : E.y) || 0, h = ((S = r.pattern) == null ? void 0 : S.width) || 0, m = ((B = r.pattern) == null ? void 0 : B.height) || 0, g = ((v = r.pattern) == null ? void 0 : v.scaleX) || 1, p = ((I = r.pattern) == null ? void 0 : I.scaleY) || 1, f = ((D = r.pattern) == null ? void 0 : D.rotation) || 0;
5571
5574
  return [(F = r.pattern) != null && F.svg ? {
5572
5575
  id: `${t}-contents`,
5573
5576
  type: T.Illustration,
@@ -5682,7 +5685,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5682
5685
  return Le.get(r);
5683
5686
  const e = (async () => {
5684
5687
  try {
5685
- return Et(r).getFont();
5688
+ return vt(r).getFont();
5686
5689
  } catch {
5687
5690
  if (ji(r)) {
5688
5691
  const a = mn(r), n = Xe(a);
@@ -5697,7 +5700,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5697
5700
  }, Hi = (r) => {
5698
5701
  const t = mn(r), e = Xe(t);
5699
5702
  return ia(r, e), e;
5700
- }, Et = (r) => {
5703
+ }, vt = (r) => {
5701
5704
  const t = Nn.get(r);
5702
5705
  if (t)
5703
5706
  return t;
@@ -5713,8 +5716,8 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5713
5716
  var m, g, p;
5714
5717
  if (h.type === "font-face" && h.declarations) {
5715
5718
  const f = (m = h.declarations.find(
5716
- (v) => v.property === "font-family"
5717
- )) == null ? void 0 : m.value, C = (g = h.declarations.find((v) => v.property === "src")) == null ? void 0 : g.value, w = (p = C == null ? void 0 : C.match(/'(https.*?)'/)) == null ? void 0 : p[1];
5719
+ (E) => E.property === "font-family"
5720
+ )) == null ? void 0 : m.value, C = (g = h.declarations.find((E) => E.property === "src")) == null ? void 0 : g.value, w = (p = C == null ? void 0 : C.match(/'(https.*?)'/)) == null ? void 0 : p[1];
5718
5721
  f && w && n.set(f, w);
5719
5722
  }
5720
5723
  });
@@ -5726,18 +5729,18 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5726
5729
  0,
5727
5730
  0,
5728
5731
  parseInt(u.getAttribute("font-size") ?? "72")
5729
- ), v = w.getBoundingBox().x2 - w.getBoundingBox().x1;
5732
+ ), E = w.getBoundingBox().x2 - w.getBoundingBox().x1;
5730
5733
  let S = 0;
5731
5734
  const B = A.getAttribute("text-anchor");
5732
- B === "middle" ? S = v / 2 : B === "end" && (S = v);
5733
- const E = g.getPath(
5735
+ B === "middle" ? S = E / 2 : B === "end" && (S = E);
5736
+ const v = g.getPath(
5734
5737
  A.innerHTML,
5735
5738
  parseFloat(A.getAttribute("x") ?? "0") - S,
5736
5739
  parseFloat(A.getAttribute("y") ?? "0"),
5737
5740
  parseInt(u.getAttribute("font-size") ?? "72")
5738
5741
  );
5739
- E.fill = p, E.stroke = f, E.strokeWidth = parseFloat(C ?? "0");
5740
- const I = E.toSVG(2), F = t.parseFromString(I, "image/svg+xml").firstElementChild;
5742
+ v.fill = p, v.stroke = f, v.strokeWidth = parseFloat(C ?? "0");
5743
+ const I = v.toSVG(2), F = t.parseFromString(I, "image/svg+xml").firstElementChild;
5741
5744
  h.appendChild(F);
5742
5745
  }
5743
5746
  return e.querySelectorAll("text").forEach((d) => d.remove()), bt().serializeToString(a);
@@ -5798,7 +5801,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5798
5801
  return Math.min(A, d);
5799
5802
  }, Yi = (r, t, e, a) => {
5800
5803
  var c;
5801
- const n = Et(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
5804
+ const n = vt(t.fontData.assetUrl), i = n.getFont(), s = t.fontSize / i.unitsPerEm;
5802
5805
  if (!e)
5803
5806
  return La(t, r, t.fontSize, s, n, a);
5804
5807
  let o;
@@ -5819,9 +5822,9 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5819
5822
  fontSize: qi(o, n, i, t.width, t.height, a)
5820
5823
  } : La(t, r, t.fontSize, s, n, a);
5821
5824
  }, Ji = (r, t, e, a, n) => {
5822
- const s = Et(t.assetUrl).getFont();
5825
+ const s = vt(t.assetUrl).getFont();
5823
5826
  let o = { ...r };
5824
- const l = { ...r }, c = Qn(a, e / s.unitsPerEm, Et(t.assetUrl));
5827
+ const l = { ...r }, c = Qn(a, e / s.unitsPerEm, vt(t.assetUrl));
5825
5828
  return c && c < o.width && (l.width = c, n === "left" ? (l.left += Math.sin(o.rotation * Math.PI / 360) * (o.width - c), l.top += Math.sin(o.rotation * Math.PI / 180) * (c - o.width) / 2) : n === "right" ? l.left += o.width - c : l.left += (o.width - c) / 2, a && _i(a, a).every(([d, A]) => d === A) && (o = l)), o;
5826
5829
  }, Ve = 1, ht = (r, t, e) => {
5827
5830
  let a = 0;
@@ -5850,7 +5853,7 @@ const ji = (r) => r.substring(0, 5).toLowerCase().trim() === "data:", Le = /* @_
5850
5853
  stripControlCharacters: !0,
5851
5854
  vertical: !1,
5852
5855
  uppercase: !1
5853
- }, ve = (r, t = Va) => {
5856
+ }, Ee = (r, t = Va) => {
5854
5857
  const e = { ...Va, ...t };
5855
5858
  let a = r || "";
5856
5859
  return e.stripControlCharacters && (a = a.replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, "")), e.uppercase && (a = a.toUpperCase()), e.vertical && (a = a.split("").join(`
@@ -6092,7 +6095,7 @@ class ns {
6092
6095
  layout: t,
6093
6096
  elements: e
6094
6097
  },
6095
- getComponentWithProps: (a) => va(t, e, a)
6098
+ getComponentWithProps: (a) => Ea(t, e, a)
6096
6099
  };
6097
6100
  }
6098
6101
  initialize(t, e) {
@@ -6117,7 +6120,7 @@ class ns {
6117
6120
  return { ...t, transaction: e.apply(a) };
6118
6121
  }
6119
6122
  }
6120
- const On = (r) => r.type === T.Image ? /* @__PURE__ */ x(Mn, { ...r }, r.id) : r.type === T.Frame ? /* @__PURE__ */ x(Gi, { ...r }, r.id) : r.type === T.Illustration ? /* @__PURE__ */ x(as, { ...r }, r.id) : r.type === T.Textbox ? /* @__PURE__ */ x(Zi, { ...r }, r.id) : r.type === T.Group ? /* @__PURE__ */ x(Tn, { ...r }, r.id) : null, va = (r, t, e) => {
6123
+ const On = (r) => r.type === T.Image ? /* @__PURE__ */ x(Mn, { ...r }, r.id) : r.type === T.Frame ? /* @__PURE__ */ x(Gi, { ...r }, r.id) : r.type === T.Illustration ? /* @__PURE__ */ x(as, { ...r }, r.id) : r.type === T.Textbox ? /* @__PURE__ */ x(Zi, { ...r }, r.id) : r.type === T.Group ? /* @__PURE__ */ x(Tn, { ...r }, r.id) : null, Ea = (r, t, e) => {
6121
6124
  const a = e.renderingConfiguration, n = a != null && a.removeExcludedElements ? t.filter((i) => !i.excludeFromExport) : t;
6122
6125
  return /* @__PURE__ */ x(
6123
6126
  zi,
@@ -6148,7 +6151,7 @@ const On = (r) => r.type === T.Image ? /* @__PURE__ */ x(Mn, { ...r }, r.id) : r
6148
6151
  }
6149
6152
  );
6150
6153
  };
6151
- function Ea(r) {
6154
+ function va(r) {
6152
6155
  return r.sort((t, e) => {
6153
6156
  const a = t.layer || 0, n = e.layer || 0;
6154
6157
  if (a < n)
@@ -6352,7 +6355,7 @@ const te = (r) => {
6352
6355
  }
6353
6356
  if (e && t === T.Textbox && (a != null && a.text) && (a != null && a.fontScale)) {
6354
6357
  await Nt(e);
6355
- const l = Et(e), c = ht(a.text, a == null ? void 0 : a.fontScale, l);
6358
+ const l = vt(e), c = ht(a.text, a == null ? void 0 : a.fontScale, l);
6356
6359
  o.width = Math.min(c, n.width * 0.85), o.left = n.x + n.width / 2 - o.width / 2;
6357
6360
  }
6358
6361
  return o;
@@ -6406,7 +6409,7 @@ class Lc {
6406
6409
  const { configuration: a, fontSrc: n, designInputStep: i } = e, s = await Nt(n), o = {
6407
6410
  assetUrl: n,
6408
6411
  name: s.names.fullName.en
6409
- }, l = (i == null ? void 0 : i.text) || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d = ve(c, {
6412
+ }, l = (i == null ? void 0 : i.text) || a.defaultText || "", c = a.replaceableText ? a.replaceableText.replace("{{}}", l) : l, d = Ee(c, {
6410
6413
  vertical: a.vertical,
6411
6414
  uppercase: a.uppercase
6412
6415
  }), A = e.region || await Ut(t, T.Textbox, n, {
@@ -6524,7 +6527,7 @@ const L = (r, t) => K(r, t).elements.find((n) => n.id === r), K = (r, t) => {
6524
6527
  throw new V();
6525
6528
  return e;
6526
6529
  }, X = (r, t) => {
6527
- const e = [...t.elements.filter((n) => n.id !== r.id), r], a = Ea(e);
6530
+ const e = [...t.elements.filter((n) => n.id !== r.id), r], a = va(e);
6528
6531
  return {
6529
6532
  layout: t.layout,
6530
6533
  elements: a,
@@ -7424,14 +7427,14 @@ class hs {
7424
7427
  }
7425
7428
  }
7426
7429
  const Gn = new hs();
7427
- class Ee {
7430
+ class ve {
7428
7431
  constructor() {
7429
7432
  this.frameSourceSvg = async (t, e) => {
7430
7433
  if (!t)
7431
7434
  return sa(e);
7432
7435
  const a = t.asset;
7433
7436
  if (!a)
7434
- throw new vt(t);
7437
+ throw new Et(t);
7435
7438
  const n = a.fileLink;
7436
7439
  if (n)
7437
7440
  return at(n, !0);
@@ -7538,7 +7541,7 @@ class Ee {
7538
7541
  }
7539
7542
  selectImage(t, e, a, n = !0) {
7540
7543
  var l;
7541
- const i = Ee.patternSource(e), s = (l = a.getStepStorage(t.stepName)) == null ? void 0 : l.framePatternSrc;
7544
+ const i = ve.patternSource(e), s = (l = a.getStepStorage(t.stepName)) == null ? void 0 : l.framePatternSrc;
7542
7545
  if (s && s === i)
7543
7546
  return Promise.resolve();
7544
7547
  a.setEditedStatus(t.stepName, !0);
@@ -7720,7 +7723,7 @@ class Ee {
7720
7723
  p,
7721
7724
  c && !t.data.forceImageCover ? { scale: c } : void 0,
7722
7725
  t.data.forceImageCover
7723
- ) : void 0, v = f ? {
7726
+ ) : void 0, E = f ? {
7724
7727
  id: Q(),
7725
7728
  src: f.src,
7726
7729
  x: (w == null ? void 0 : w.x) || 0,
@@ -7730,13 +7733,13 @@ class Ee {
7730
7733
  scaleX: (w == null ? void 0 : w.zoom) || 1,
7731
7734
  scaleY: (w == null ? void 0 : w.zoom) || 1,
7732
7735
  rotation: 0
7733
- } : void 0, S = Q(), E = n.getLayouts().find((I) => I.panelId === m.panelId);
7734
- if (!E)
7736
+ } : void 0, S = Q(), v = n.getLayouts().find((I) => I.panelId === m.panelId);
7737
+ if (!v)
7735
7738
  throw new q(m);
7736
7739
  return {
7737
- command: this.getCreateElementCommand(S, m, E, {
7740
+ command: this.getCreateElementCommand(S, m, v, {
7738
7741
  frameData: p,
7739
- pattern: v,
7742
+ pattern: E,
7740
7743
  disablePlaceholder: t.data.disablePlaceholder,
7741
7744
  stepName: t.stepName
7742
7745
  }),
@@ -7783,7 +7786,7 @@ class Ee {
7783
7786
  }
7784
7787
  async loadPatternFromAsset(t, e, a, n) {
7785
7788
  var c, d;
7786
- const i = Ee.patternSource(t), s = a.markUpdatePending(), o = (c = a.getWorkflowExperience().getStepById(e.stepName)) == null ? void 0 : c.frameService;
7789
+ const i = ve.patternSource(t), s = a.markUpdatePending(), o = (c = a.getWorkflowExperience().getStepById(e.stepName)) == null ? void 0 : c.frameService;
7787
7790
  if (!o)
7788
7791
  throw a.markUpdateCompleted(s), new Error("Frame service unavailable, cannot load pattern!");
7789
7792
  try {
@@ -7810,7 +7813,7 @@ class Ee {
7810
7813
  ), this.validateColorCount(e, a);
7811
7814
  }
7812
7815
  }
7813
- const wt = new Ee();
7816
+ const wt = new ve();
7814
7817
  class ms {
7815
7818
  async getIllustrationBody(t) {
7816
7819
  return new Promise((e) => {
@@ -7981,7 +7984,7 @@ class ms {
7981
7984
  t.mandatory && i.setMandatoryFulfilled(t.stepName, !1);
7982
7985
  const o = e.asset;
7983
7986
  if (!o)
7984
- throw new vt(e);
7987
+ throw new Et(e);
7985
7988
  const l = o.fileLink;
7986
7989
  if (!l)
7987
7990
  throw new jt(o);
@@ -7989,10 +7992,10 @@ class ms {
7989
7992
  const w = i.getLayouts().find((S) => S.panelId === C.panelId);
7990
7993
  if (!w)
7991
7994
  throw new q(C);
7992
- const v = Q();
7995
+ const E = Q();
7993
7996
  return {
7994
- regionElement: { id: v, region: C },
7995
- command: this.getCreateElementCommand(v, C, w, {
7997
+ regionElement: { id: E, region: C },
7998
+ command: this.getCreateElementCommand(E, C, w, {
7996
7999
  stepName: t.stepName,
7997
8000
  src: l,
7998
8001
  objectURL: d,
@@ -8004,13 +8007,13 @@ class ms {
8004
8007
  const p = t.data.colorOption;
8005
8008
  return p && ((f = p.variants) == null || f.forEach((C) => {
8006
8009
  g = g.map((w) => {
8007
- var v;
8008
- return w.toLowerCase() === ((v = C.color) == null ? void 0 : v.toLowerCase()) ? C.name : w;
8010
+ var E;
8011
+ return w.toLowerCase() === ((E = C.color) == null ? void 0 : E.toLowerCase()) ? C.name : w;
8009
8012
  });
8010
8013
  })), i.updateMetadata(t.stepName, { colors: g }), {
8011
8014
  command: new $(m),
8012
8015
  followup: async () => {
8013
- var w, v;
8016
+ var w, E;
8014
8017
  await i.setSelectionsAndElements(
8015
8018
  t.stepName,
8016
8019
  [e],
@@ -8022,21 +8025,21 @@ class ms {
8022
8025
  const C = ((w = o.assetConfiguration) == null ? void 0 : w.defaultColorVariants) || [];
8023
8026
  if (C.length !== 0) {
8024
8027
  const S = {};
8025
- (((v = o.assetConfiguration) == null ? void 0 : v.channelNumbers) || []).forEach((E) => {
8028
+ (((E = o.assetConfiguration) == null ? void 0 : E.channelNumbers) || []).forEach((v) => {
8026
8029
  var D;
8027
- const I = C.find((F) => F.channelNumber === E.number);
8028
- I && (S[`${E.id.replace(/\W/g, "")}`] = { browserValue: ((D = I == null ? void 0 : I.variant) == null ? void 0 : D.color) || "" });
8030
+ const I = C.find((F) => F.channelNumber === v.number);
8031
+ I && (S[`${v.id.replace(/\W/g, "")}`] = { browserValue: ((D = I == null ? void 0 : I.variant) == null ? void 0 : D.color) || "" });
8029
8032
  }), await this.changeColors(
8030
8033
  t,
8031
- u.map((E) => E.regionElement),
8034
+ u.map((v) => v.regionElement),
8032
8035
  i,
8033
8036
  () => i.getCommandContext().getAllLayouts(),
8034
8037
  new Map(Object.entries(S))
8035
8038
  );
8036
8039
  }
8037
8040
  if (t.data.colorPickerEnabled) {
8038
- const S = await this.availableColors(t, i) || [], B = Object.keys(c.colors), E = S.length === 1 && B.length === 1;
8039
- if (E) {
8041
+ const S = await this.availableColors(t, i) || [], B = Object.keys(c.colors), v = S.length === 1 && B.length === 1;
8042
+ if (v) {
8040
8043
  const I = S[0], D = B[0];
8041
8044
  await this.changeColors(
8042
8045
  t,
@@ -8046,7 +8049,7 @@ class ms {
8046
8049
  /* @__PURE__ */ new Map([[D, I.variant.color]])
8047
8050
  );
8048
8051
  }
8049
- !E && C.length === 0 && await this.changeColors(
8052
+ !v && C.length === 0 && await this.changeColors(
8050
8053
  t,
8051
8054
  u.map((I) => I.regionElement),
8052
8055
  i,
@@ -8119,7 +8122,7 @@ class gs {
8119
8122
  n(!0);
8120
8123
  const s = e.material;
8121
8124
  if (!s)
8122
- throw n(!1), new vt(e);
8125
+ throw n(!1), new Et(e);
8123
8126
  return {
8124
8127
  command: void 0,
8125
8128
  followup: async () => {
@@ -8174,7 +8177,7 @@ class ps {
8174
8177
  if (h && t.option) {
8175
8178
  const g = (m = A.asset) == null ? void 0 : m.fileLink;
8176
8179
  if (!g)
8177
- throw new vt(A);
8180
+ throw new Et(A);
8178
8181
  await h.applyModelVariant(
8179
8182
  t.stepName || "",
8180
8183
  {
@@ -8199,7 +8202,7 @@ class ps {
8199
8202
  n(!0);
8200
8203
  const i = (s = e.asset) == null ? void 0 : s.fileLink;
8201
8204
  if (!i)
8202
- throw new vt(e);
8205
+ throw new Et(e);
8203
8206
  return {
8204
8207
  command: void 0,
8205
8208
  followup: async () => {
@@ -8379,7 +8382,7 @@ class Cs {
8379
8382
  async selectVariantCommand(t, e, a, n) {
8380
8383
  const i = e.asset;
8381
8384
  if (!i)
8382
- throw new vt(e);
8385
+ throw new Et(e);
8383
8386
  const s = i == null ? void 0 : i.fileLink;
8384
8387
  if (!s)
8385
8388
  return console.error("No URL for picture!"), null;
@@ -8685,7 +8688,7 @@ class Ss {
8685
8688
  );
8686
8689
  }
8687
8690
  }
8688
- const vs = new Ss(), He = (r, t, e, a, n) => {
8691
+ const Es = new Ss(), He = (r, t, e, a, n) => {
8689
8692
  if (t.some((d) => d == null))
8690
8693
  throw new Error(`Failed to autosize lines: ${t.join(", ")}`);
8691
8694
  let i = t.map((d) => d.split(`
@@ -8714,7 +8717,7 @@ const vs = new Ss(), He = (r, t, e, a, n) => {
8714
8717
  return [null, null];
8715
8718
  }, ge = (r, t, e, a, n) => {
8716
8719
  let i, s;
8717
- const o = Et(t.assetUrl), l = o.getFont();
8720
+ const o = vt(t.assetUrl), l = o.getFont();
8718
8721
  if (n.size) {
8719
8722
  const u = r / l.unitsPerEm;
8720
8723
  return [i, s] = He(e, a, r, u, o), [n.size, i, s];
@@ -8735,7 +8738,7 @@ class Be extends Error {
8735
8738
  super(t), Object.setPrototypeOf(this, new.target.prototype), this.name = Be.name;
8736
8739
  }
8737
8740
  }
8738
- const Es = ["‘", "’", "“", "”", `
8741
+ const vs = ["‘", "’", "“", "”", `
8739
8742
  `];
8740
8743
  class be extends Error {
8741
8744
  constructor(t) {
@@ -8749,9 +8752,9 @@ class Bs {
8749
8752
  /(\r\n|\r|(\u2665|\u00a9|\u00ae|[\u2000-\u2017]|[\u201E-\u3300]]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))/gm,
8750
8753
  ""
8751
8754
  );
8752
- const n = [], i = e ? Et(e.assetUrl) : void 0;
8755
+ const n = [], i = e ? vt(e.assetUrl) : void 0;
8753
8756
  if (i) {
8754
- const s = a.split("").filter((l) => !Es.includes(l)).join(""), o = s.split("").map((l) => i.getFont().charToGlyph(l));
8757
+ const s = a.split("").filter((l) => !vs.includes(l)).join(""), o = s.split("").map((l) => i.getFont().charToGlyph(l));
8755
8758
  for (let l = 0; l < o.length; l++)
8756
8759
  o[l].name === ".notdef" && n.push(String.fromCharCode(s.charCodeAt(l)));
8757
8760
  }
@@ -8953,7 +8956,7 @@ class Bs {
8953
8956
  }
8954
8957
  getProcessedInput(t, e, a) {
8955
8958
  const n = a ? t : this.injectReplaceableText(t, e);
8956
- return ve(n, {
8959
+ return Ee(n, {
8957
8960
  vertical: e.vertical,
8958
8961
  uppercase: e.uppercase
8959
8962
  });
@@ -9029,8 +9032,8 @@ class Bs {
9029
9032
  g,
9030
9033
  async () => {
9031
9034
  e.updateMetadata(t.stepName, { color: p, text: f }), e.updateStorage(t.stepName, { text: f, inputText: f });
9032
- const w = o.map((S) => new ja(S.id, m)), v = new $(w);
9033
- e.getCommandDispatcher()(v);
9035
+ const w = o.map((S) => new ja(S.id, m)), E = new $(w);
9036
+ e.getCommandDispatcher()(E);
9034
9037
  }
9035
9038
  );
9036
9039
  const { command: C } = H.updateInputText(
@@ -9069,7 +9072,7 @@ class Bs {
9069
9072
  async fontDataFromVariant(t) {
9070
9073
  const e = t.asset;
9071
9074
  if (!e)
9072
- throw new vt(t);
9075
+ throw new Et(t);
9073
9076
  const a = e.fileLink;
9074
9077
  if (!a)
9075
9078
  throw new jt(e);
@@ -9178,7 +9181,7 @@ class Bs {
9178
9181
  colorProfileAssetKey: (g = p.colorProfile) == null ? void 0 : g.key
9179
9182
  });
9180
9183
  }
9181
- const C = await this.getDefaultColor(a), w = C || "#000000", v = {
9184
+ const C = await this.getDefaultColor(a), w = C || "#000000", E = {
9182
9185
  stepRegion: A,
9183
9186
  stepName: t,
9184
9187
  align: this.textAlign(a),
@@ -9202,41 +9205,41 @@ class Bs {
9202
9205
  curved: a.curved,
9203
9206
  paths: a.paths,
9204
9207
  fillSpotColorDefinition: f
9205
- }, S = [], B = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
9206
- if (!v.fontData)
9208
+ }, S = [], B = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
9209
+ if (!E.fontData)
9207
9210
  throw new z("Failed to resolve font data for text.");
9208
9211
  const [I, D] = ge(
9209
- v.fontSize,
9210
- v.fontData,
9212
+ E.fontSize,
9213
+ E.fontData,
9211
9214
  {
9212
- left: v.x,
9213
- top: v.y,
9214
- width: v.width,
9215
- height: v.height,
9216
- rotation: v.rotation,
9215
+ left: E.x,
9216
+ top: E.y,
9217
+ width: E.width,
9218
+ height: E.height,
9219
+ rotation: E.rotation,
9217
9220
  panelId: ""
9218
9221
  },
9219
9222
  [l],
9220
9223
  { size: a.size, minSize: a.minSize, maxSize: a.maxSize }
9221
9224
  );
9222
- B.set(v.id, I), E.set(v.id, D);
9225
+ B.set(E.id, I), v.set(E.id, D);
9223
9226
  const F = a.curved || a.vertical ? l : (D || []).join(`
9224
9227
  `);
9225
9228
  S.push(
9226
- this.generateTextChangeCommandsForRegion(I, a, v.id, F)
9229
+ this.generateTextChangeCommandsForRegion(I, a, E.id, F)
9227
9230
  );
9228
- const k = new G(v, h);
9231
+ const k = new G(E, h);
9229
9232
  return {
9230
9233
  regionElement: { id: m, region: A },
9231
9234
  commands: [k, ...S],
9232
- newElement: v,
9235
+ newElement: E,
9233
9236
  fontData: n
9234
9237
  };
9235
9238
  } catch (p) {
9236
9239
  throw console.log(p), new Be("Error adding font to region");
9237
9240
  }
9238
9241
  }, d = await Promise.all(a.regions.map(c)).catch((A) => {
9239
- throw A instanceof Be ? (vs.setLatestToast("Failed to load font.", Qe.Error), A) : A instanceof be ? A : new Error(A);
9242
+ throw A instanceof Be ? (Es.setLatestToast("Failed to load font.", Qe.Error), A) : A instanceof be ? A : new Error(A);
9240
9243
  });
9241
9244
  return await s.setSelectionsAndElements(
9242
9245
  t,
@@ -9264,29 +9267,29 @@ class Bs {
9264
9267
  */
9265
9268
  async changeInputTextWithRegion(t, e, a, n, i, s, o, l, c, d) {
9266
9269
  const A = (n || "").replace(/^(?![\u000A\u000D])[\u0000-\u001F\u007F-\u009F]/g, ""), u = this.getProcessedInput(A, t.data, o), h = s.getRegionElements(t.stepName), m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
9267
- for (const v of h)
9268
- if (v.region) {
9270
+ for (const E of h)
9271
+ if (E.region) {
9269
9272
  const [S, B] = ge(
9270
9273
  e,
9271
9274
  a,
9272
- v.region,
9275
+ E.region,
9273
9276
  [u],
9274
9277
  { size: t.data.size, minSize: t.data.minSize, maxSize: t.data.maxSize }
9275
9278
  );
9276
- m.set(v.id, S), g.set(v.id, B);
9279
+ m.set(E.id, S), g.set(E.id, B);
9277
9280
  }
9278
9281
  const f = (() => {
9279
9282
  if (t.data && t.data.maxLength && u.length > t.data.maxLength)
9280
9283
  return d && d(!0), { info: "0" };
9281
- const v = s.getProfanities(), S = Ze(u.toLowerCase());
9284
+ const E = s.getProfanities(), S = Ze(u.toLowerCase());
9282
9285
  for (const B of S)
9283
- for (const E in v) {
9284
- const I = v[E].toLowerCase().replace(/\s/g, "");
9286
+ for (const v in E) {
9287
+ const I = E[v].toLowerCase().replace(/\s/g, "");
9285
9288
  if (B === I)
9286
9289
  return l(!0), { error: "Blocked profanity." };
9287
9290
  }
9288
9291
  return !t.data.vertical && !t.data.allowNewlines && (u.includes(`
9289
- `) || u.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((E) => E) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - u.length).toString() });
9292
+ `) || u.includes("\r")) ? (l(!0), { error: "Cannot span multiple lines." }) : !t.data.curved && !Array.from(g.values()).every((v) => v) ? (l(!0), { error: "Does not fit." }) : (l(!1), { info: (t.data.maxLength - u.length).toString() });
9290
9293
  })();
9291
9294
  if (f.error) {
9292
9295
  c(f.error);
@@ -9298,14 +9301,14 @@ class Bs {
9298
9301
  text: this.injectReplaceableText(A, t.data)
9299
9302
  }), (i.defaultCleared || !t.data.deleteDefaultOnFocus) && A.trim() !== "" && s.setMandatoryFulfilled(t.stepName, !0);
9300
9303
  const C = [];
9301
- for (const v of h) {
9302
- const S = t.data.curved ? u : (g.get(v.id) || []).join(`
9304
+ for (const E of h) {
9305
+ const S = t.data.curved ? u : (g.get(E.id) || []).join(`
9303
9306
  `);
9304
9307
  C.push(
9305
9308
  this.generateTextChangeCommandsForRegion(
9306
- m.get(v.id) || 1,
9309
+ m.get(E.id) || 1,
9307
9310
  t.data,
9308
- v.id,
9311
+ E.id,
9309
9312
  S
9310
9313
  )
9311
9314
  );
@@ -9472,14 +9475,14 @@ class Ts extends bs {
9472
9475
  const a = Hi(Is), i = t !== "" ? ((w) => w.charAt(0).toUpperCase() + w.substr(1).toLowerCase())(t) : "", s = a.getPath(i, 0, 72, 72), o = s.toSVG(2), l = s.getBoundingBox(), c = l.x2 - l.x1, d = s.toPathData(3), A = () => {
9473
9476
  const w = tt("g");
9474
9477
  w.classList.add("module-text-group");
9475
- const v = tt("defs");
9476
- w.appendChild(v), v.appendChild(Ds(0, 2, 2, "shadow"));
9478
+ const E = tt("defs");
9479
+ w.appendChild(E), E.appendChild(Ds(0, 2, 2, "shadow"));
9477
9480
  const S = tt("path");
9478
- S.setAttribute("d", d), S.setAttribute("stroke", "black"), S.setAttribute("stroke-width", "3"), v.appendChild(S);
9481
+ S.setAttribute("d", d), S.setAttribute("stroke", "black"), S.setAttribute("stroke-width", "3"), E.appendChild(S);
9479
9482
  const B = tt("g");
9480
9483
  B.classList.add("module-layer0"), w.appendChild(B), B.setAttribute("filter", "url(#shadow)"), B.innerHTML = S.outerHTML;
9481
- const E = tt("g");
9482
- E.classList.add("module-layer1"), w.appendChild(E), E.setAttribute("stroke-width", "3"), E.setAttribute("stroke", "rgb(45,41,38)"), E.setAttribute("fill", "rgb(45,41,38)"), E.setAttribute("transform", "translate(0.5,0)"), E.innerHTML = o;
9484
+ const v = tt("g");
9485
+ v.classList.add("module-layer1"), w.appendChild(v), v.setAttribute("stroke-width", "3"), v.setAttribute("stroke", "rgb(45,41,38)"), v.setAttribute("fill", "rgb(45,41,38)"), v.setAttribute("transform", "translate(0.5,0)"), v.innerHTML = o;
9483
9486
  const I = tt("g");
9484
9487
  I.classList.add("module-layer2"), w.appendChild(I), I.setAttribute("fill", "rgb(255,209,0)"), I.setAttribute("transform", "translate(1,-0.1)"), I.innerHTML = o;
9485
9488
  const D = tt("g");
@@ -10188,9 +10191,9 @@ class uo {
10188
10191
  var S;
10189
10192
  if (!this.previewService)
10190
10193
  return;
10191
- const w = this.getCommandContext().getAllLayouts(), v = (S = this.getLayoutPreviewService()) == null ? void 0 : S.getAll();
10192
- if (v)
10193
- for (const [, B] of v)
10194
+ const w = this.getCommandContext().getAllLayouts(), E = (S = this.getLayoutPreviewService()) == null ? void 0 : S.getAll();
10195
+ if (E)
10196
+ for (const [, B] of E)
10194
10197
  B.render(w);
10195
10198
  }, this.experience = t, this.client = e, this.updateTransaction = o, this.graphQlClient = l, this.commandContext = s, this.reloadedState = h, this.transaction = c, this.readOnly = m, this.singleVariantsRenderable = f, this.confirmedDesign = !1, this.editedSteps = {}, this.informationResults = [], this.mandatorySteps = {}, this.pendingUpdates = [], this.selectionCost = 0, this.workflow = a, this.stepSpecificServices = {}, this.profanityFilter = n, this.pollers = [], this.allScenes = [], this.layouts = i, this.product = d, this.previewService = A, this.modelContainer = g, this.stepElements = {}, this.stepInitialised = {}, this.stepMetadata = {}, this.stepSelections = {}, this.storage = {}, this.validationErrors = { steps: /* @__PURE__ */ new Map() }, this.confirmCallbacks = [], this.editedCallbacks = [], this.elementsCallbacks = [], this.informationResultCallbacks = [], this.initCallbacks = [], this.mandatoryCallbacks = [], this.makingAdjustmentsCallback = [], this.metadataCallbacks = [], this.selectionCallbacks = [], this.stepSpecificStorageCallbacks = {}, this.storageCallbacks = [], this.validationCallbacks = [], this.recipientCallbacks = [], this.currentAdjustingStepId = "", this.renderableContextService = u, this.isReloadedTransaction = p, this.workflow.steps.forEach((w) => {
10196
10199
  this.stepTags[w.stepName] = w.tags ?? [];
@@ -10755,11 +10758,11 @@ class uo {
10755
10758
  this.stepSelections = {
10756
10759
  ...this.stepSelections,
10757
10760
  [t]: { selectedVariants: e }
10758
- }, this.selectionCost = Object.values(this.stepSelections).reduce((B, E) => B + E.selectedVariants.map((I) => I.priceModifier || 0).reduce((I, D) => I + D, 0), 0), this.workflow.steps.forEach((B) => {
10761
+ }, this.selectionCost = Object.values(this.stepSelections).reduce((B, v) => B + v.selectedVariants.map((I) => I.priceModifier || 0).reduce((I, D) => I + D, 0), 0), this.workflow.steps.forEach((B) => {
10759
10762
  yt(B, this.stepSelections) || (this.stepInitialised[B.stepName] = !1, delete this.stepMetadata[B.stepName], delete this.stepSelections[B.stepName], delete this.storage[B.stepName]);
10760
10763
  });
10761
10764
  const s = this.allScenes, o = Dt(s, i), l = Dt(s, this.stepSelections), c = o.map((B) => B.silentSteps).flat(), A = l.map((B) => B.silentSteps).flat().filter(
10762
- (B) => !c.some((E) => E.stepName === B.stepName)
10765
+ (B) => !c.some((v) => v.stepName === B.stepName)
10763
10766
  );
10764
10767
  c.forEach((B) => {
10765
10768
  yt(B, this.stepSelections) || (this.stepInitialised[B.stepName] = !1);
@@ -10773,15 +10776,15 @@ class uo {
10773
10776
  const g = this.workflow.steps.find((B) => B.stepName === t);
10774
10777
  if ((g == null ? void 0 : g.type) === P.Frame) {
10775
10778
  const B = (S = this.getWorkflowExperience().getStepById(g.stepName)) == null ? void 0 : S.frameService;
10776
- B == null || B.setTargetElements(a.map((E) => E.id));
10779
+ B == null || B.setTargetElements(a.map((v) => v.id));
10777
10780
  }
10778
10781
  const p = u.map((B) => new Bt(B.id)), f = new Wa(this.constructSerializableWorkflow()), C = [...m, ...p, f];
10779
10782
  C.length > 0 && this.commandContext.apply(new $(C), !0), await this.ensureStepsAreLoaded(), this.onElementsChange();
10780
- const w = this.getInvalidModelVariants(), v = this.modelContainer;
10781
- if (v) {
10783
+ const w = this.getInvalidModelVariants(), E = this.modelContainer;
10784
+ if (E) {
10782
10785
  const B = w.map(
10783
- (E) => v.applyModelVariant(
10784
- E,
10786
+ (v) => E.applyModelVariant(
10787
+ v,
10785
10788
  {
10786
10789
  contextService: this.getLayoutPreviewService()
10787
10790
  },
@@ -11557,7 +11560,7 @@ class So extends it {
11557
11560
  );
11558
11561
  }
11559
11562
  }
11560
- class vo extends it {
11563
+ class Eo extends it {
11561
11564
  constructor(t, e, a) {
11562
11565
  super(t, e, a);
11563
11566
  }
@@ -11629,7 +11632,7 @@ class le {
11629
11632
  case P.Frame:
11630
11633
  return new Nl(t, e, t.getStepTags(e.stepName));
11631
11634
  case P.Module:
11632
- return new vo(t, e, t.getStepTags(e.stepName));
11635
+ return new Eo(t, e, t.getStepTags(e.stepName));
11633
11636
  default:
11634
11637
  throw new z(`Step type ${e.type} not yet supported in Core SDK`);
11635
11638
  }
@@ -11660,7 +11663,7 @@ const _n = y`
11660
11663
  externalProductVariantId
11661
11664
  }
11662
11665
  }
11663
- `, Eo = y`
11666
+ `, vo = y`
11664
11667
  ${_n}
11665
11668
  mutation CreateDesign(
11666
11669
  $name: String!
@@ -11725,7 +11728,7 @@ const bo = async (r, t) => {
11725
11728
  c && !Ie(c) && (e.Authorization = `Bearer ${c}`);
11726
11729
  }
11727
11730
  return (i = (await b.getShadowGraphqlClient().mutate({
11728
- mutation: Eo,
11731
+ mutation: vo,
11729
11732
  errorPolicy: "all",
11730
11733
  fetchPolicy: "no-cache",
11731
11734
  variables: {
@@ -11903,10 +11906,10 @@ const bo = async (r, t) => {
11903
11906
  return [F, k];
11904
11907
  }, [C] = await f(!0), w = Object.fromEntries(
11905
11908
  Object.keys(C).map((D) => [D, C[D].map((F) => F.id)])
11906
- ), [v] = await f(!1), S = Object.fromEntries(
11907
- Object.keys(v).map((D) => [
11909
+ ), [E] = await f(!1), S = Object.fromEntries(
11910
+ Object.keys(E).map((D) => [
11908
11911
  D,
11909
- v[D].map((F) => F.id)
11912
+ E[D].map((F) => F.id)
11910
11913
  ])
11911
11914
  );
11912
11915
  let B = await o(m, n.id);
@@ -12252,9 +12255,9 @@ class Qo {
12252
12255
  }
12253
12256
  let i = 2048;
12254
12257
  e && e <= 2048 && (i = e);
12255
- const s = gt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((v) => {
12258
+ const s = gt(i, i), o = this.commandContext.getAllLayouts(), l = a.defaultPreviewPanelIndex || 0, c = a.panels[l], d = o.find((E) => {
12256
12259
  var S;
12257
- return ((S = v.layoutState) == null ? void 0 : S.layout.panelId) === (c == null ? void 0 : c.name);
12260
+ return ((S = E.layoutState) == null ? void 0 : S.layout.panelId) === (c == null ? void 0 : c.name);
12258
12261
  }) || o[0], A = d.layoutState.layout.previewRegion ? {
12259
12262
  x: d.layoutState.layout.previewRegion.left,
12260
12263
  y: d.layoutState.layout.previewRegion.top,
@@ -12268,7 +12271,7 @@ class Qo {
12268
12271
  }, u = this.commandContext.getLayoutById(d.layoutState.layout.id), h = s.getContext("2d");
12269
12272
  if (!h)
12270
12273
  throw new De("Failed to obtain 2D context for preview image creation");
12271
- const m = va(u.layoutState.layout, u.layoutState.elements, {
12274
+ const m = Ea(u.layoutState.layout, u.layoutState.elements, {
12272
12275
  renderingConfiguration: {
12273
12276
  purpose: Wt.Print,
12274
12277
  region: { left: A.x, top: A.y, width: A.width, height: A.height }
@@ -12669,7 +12672,7 @@ const Ro = [
12669
12672
  const n = e.data, i = a.option;
12670
12673
  if (!i)
12671
12674
  return console.error(`No option for step ${a.stepName}.`), [];
12672
- const s = ((S = i.variants) == null ? void 0 : S.find((E) => E.id === n.illustrationVariantId)) || te(i);
12675
+ const s = ((S = i.variants) == null ? void 0 : S.find((v) => v.id === n.illustrationVariantId)) || te(i);
12673
12676
  if (!s)
12674
12677
  return console.error(`No variant with ID: ${n.illustrationVariantId}`), [];
12675
12678
  if (!s.asset)
@@ -12683,32 +12686,32 @@ const Ro = [
12683
12686
  return console.error("Failed to read SVG."), [];
12684
12687
  fa(m);
12685
12688
  const g = {};
12686
- kt(m, (E) => {
12687
- Ro.includes(E.tagName) && !E.attributes.getNamedItem("fill") && E.setAttribute("fill", "#000000");
12688
- const I = E.attributes.getNamedItem("fill");
12689
+ kt(m, (v) => {
12690
+ Ro.includes(v.tagName) && !v.attributes.getNamedItem("fill") && v.setAttribute("fill", "#000000");
12691
+ const I = v.attributes.getNamedItem("fill");
12689
12692
  if (I && I.value !== "none") {
12690
12693
  const F = I.value, N = `spiff-fill-${F.replace(/\W/g, "")}`;
12691
- E.classList.add(N), g[N] = { browserValue: F };
12694
+ v.classList.add(N), g[N] = { browserValue: F };
12692
12695
  }
12693
- const D = E.attributes.getNamedItem("stroke");
12696
+ const D = v.attributes.getNamedItem("stroke");
12694
12697
  if (D && D.value !== "none") {
12695
12698
  const F = D.value, N = `spiff-stroke-${F.replace(/\W/g, "")}`;
12696
- E.classList.add(N), g[N] = { browserValue: F };
12699
+ v.classList.add(N), g[N] = { browserValue: F };
12697
12700
  }
12698
12701
  });
12699
12702
  const f = bt().serializeToString(m), C = n.colors;
12700
12703
  if (C) {
12701
- for (const [E, I] of Object.entries(g))
12704
+ for (const [v, I] of Object.entries(g))
12702
12705
  for (const D of Object.keys(C))
12703
12706
  if (I.browserValue === D) {
12704
- g[E] = { browserValue: C[D] };
12707
+ g[v] = { browserValue: C[D] };
12705
12708
  break;
12706
12709
  }
12707
12710
  }
12708
- const w = (E) => {
12709
- const I = r.find((F) => F.panelId === E.panelId);
12711
+ const w = (v) => {
12712
+ const I = r.find((F) => F.panelId === v.panelId);
12710
12713
  if (!I)
12711
- throw new q(E);
12714
+ throw new q(v);
12712
12715
  const D = Q();
12713
12716
  return new G(
12714
12717
  {
@@ -12716,22 +12719,22 @@ const Ro = [
12716
12719
  id: D,
12717
12720
  svg: f,
12718
12721
  type: T.Illustration,
12719
- y: E.top,
12720
- x: E.left,
12721
- rotation: E.rotation,
12722
- width: E.width,
12723
- height: E.height,
12724
- layer: E.layer,
12725
- layerIndex: E.layerIndex,
12726
- immutable: E.immutable
12722
+ y: v.top,
12723
+ x: v.left,
12724
+ rotation: v.rotation,
12725
+ width: v.width,
12726
+ height: v.height,
12727
+ layer: v.layer,
12728
+ layerIndex: v.layerIndex,
12729
+ immutable: v.immutable
12727
12730
  },
12728
12731
  I
12729
12732
  );
12730
- }, v = a.data.regions;
12733
+ }, E = a.data.regions;
12731
12734
  try {
12732
- return v.map(w);
12733
- } catch (E) {
12734
- return console.error(E), [];
12735
+ return E.map(w);
12736
+ } catch (v) {
12737
+ return console.error(v), [];
12735
12738
  }
12736
12739
  }, Lo = async (r, t, e) => {
12737
12740
  const a = await Jn(e.data.module), n = t.data, i = (o, l) => {
@@ -12935,7 +12938,7 @@ const Ro = [
12935
12938
  const p = a.option;
12936
12939
  if (!p)
12937
12940
  return;
12938
- const f = ((w = p.variants) == null ? void 0 : w.find((v) => v.id === i.fontVariantId)) || te(p);
12941
+ const f = ((w = p.variants) == null ? void 0 : w.find((E) => E.id === i.fontVariantId)) || te(p);
12939
12942
  if (!f || !f.asset)
12940
12943
  return;
12941
12944
  t[a.stepName] = { selectedVariants: [f] };
@@ -12951,7 +12954,7 @@ const Ro = [
12951
12954
  assetUrl: p,
12952
12955
  name: f.names.fullName.en
12953
12956
  };
12954
- })(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = ve(A, {
12957
+ })(), A = (a.data.replaceableText ? a.data.replaceableText.replace("{{}}", i.text) : i.text) || "", u = Ee(A, {
12955
12958
  vertical: a.data.vertical,
12956
12959
  uppercase: a.data.uppercase
12957
12960
  }), h = async (p) => {
@@ -12987,12 +12990,12 @@ const Ro = [
12987
12990
  y: p.top
12988
12991
  };
12989
12992
  if (d) {
12990
- const [w, v] = ge(
12993
+ const [w, E] = ge(
12991
12994
  a.data.size || s,
12992
12995
  d,
12993
12996
  p,
12994
12997
  [
12995
- ve(u, {
12998
+ Ee(u, {
12996
12999
  vertical: a.data.vertical,
12997
13000
  uppercase: a.data.uppercase
12998
13001
  })
@@ -13008,7 +13011,7 @@ const Ro = [
13008
13011
  {
13009
13012
  ...C,
13010
13013
  fontSize: w,
13011
- text: C.curved ? C.text : (v || []).join(`
13014
+ text: C.curved ? C.text : (E || []).join(`
13012
13015
  `)
13013
13016
  },
13014
13017
  f
@@ -13228,7 +13231,7 @@ class _o extends xn {
13228
13231
  l = g.width, c = g.height;
13229
13232
  } else
13230
13233
  l = i.width, c = i.height;
13231
- const d = va(t.layoutState.layout, e, {
13234
+ const d = Ea(t.layoutState.layout, e, {
13232
13235
  renderingConfiguration: { purpose: Wt.ThreeD }
13233
13236
  }), A = hn(d), u = await ua.from(this.ctx, A, {
13234
13237
  anonymousCrossOrigin: !0,
@@ -14270,7 +14273,7 @@ class er {
14270
14273
  let A = !1;
14271
14274
  const u = c.subscribe({
14272
14275
  next(h) {
14273
- var g, p, f, C, w, v;
14276
+ var g, p, f, C, w, E;
14274
14277
  if (A || h.partial && (!h.data.productCollections || h.data.productCollections.length === 0 || !((g = h.data.productCollections[0].productCollectionProductsFeed) != null && g.items) || ((p = h.data.productCollections[0].productCollectionProductsFeed) == null ? void 0 : p.items.length) === 0))
14275
14278
  return;
14276
14279
  o.abort(), A = !0, u.unsubscribe();
@@ -14278,7 +14281,7 @@ class er {
14278
14281
  d({
14279
14282
  items: m,
14280
14283
  // Clone items because it could be cached data (immutable)
14281
- total: ((v = (w = h.data.productCollections) == null ? void 0 : w[0].productCollectionProductsFeed) == null ? void 0 : v.total) ?? 0
14284
+ total: ((E = (w = h.data.productCollections) == null ? void 0 : w[0].productCollectionProductsFeed) == null ? void 0 : E.total) ?? 0
14282
14285
  });
14283
14286
  },
14284
14287
  error() {
@@ -15541,11 +15544,11 @@ const Ae = y`
15541
15544
  }
15542
15545
  }
15543
15546
  }
15544
- `, vl = y`
15547
+ `, El = y`
15545
15548
  mutation CustomerGenerateVerificationCode($emailAddress: String!) {
15546
15549
  customerGenerateVerificationCode(emailAddress: $emailAddress)
15547
15550
  }
15548
- `, El = y`
15551
+ `, vl = y`
15549
15552
  mutation CustomerVerifyCode($emailAddress: String!, $verificationCode: String!) {
15550
15553
  customerVerifyCode(emailAddress: $emailAddress, verificationCode: $verificationCode) {
15551
15554
  id
@@ -15690,7 +15693,7 @@ class ed {
15690
15693
  } catch (a) {
15691
15694
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15692
15695
  }
15693
- }, this.options = t, this.options.applicationKey && Qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.41.1-beta.d08056f5-bf8a-5ac1-8ce3-cdc0f4f69df6"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15696
+ }, this.options = t, this.options.applicationKey && Qr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.41.1-beta.9ba3cec9-4f93-56ee-b8f1-aeeedc5bf8b3"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15694
15697
  }
15695
15698
  configure(t) {
15696
15699
  mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, this.userPoolClientId = t.userPoolClientId, this.userPoolRegion = t.userPoolRegion, this.spiffRegion = t.spiffRegion, t.bearerAuthenticationToken && Or(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration();
@@ -15793,13 +15796,13 @@ class ed {
15793
15796
  if (p && await this.authenticateCustomerId(p)) {
15794
15797
  const C = ((h = (u = this.customer) == null ? void 0 : u.bundleStakeholders) == null ? void 0 : h.find(
15795
15798
  (w) => {
15796
- var v, S;
15797
- return (S = (v = w.bundle) == null ? void 0 : v.transactions) == null ? void 0 : S.some((B) => B.id === t);
15799
+ var E, S;
15800
+ return (S = (E = w.bundle) == null ? void 0 : E.transactions) == null ? void 0 : S.some((B) => B.id === t);
15798
15801
  }
15799
15802
  )) || ((g = (m = this.customer) == null ? void 0 : m.stakeholders) == null ? void 0 : g.find(
15800
15803
  (w) => {
15801
- var v;
15802
- return ((v = w.transaction) == null ? void 0 : v.id) === t;
15804
+ var E;
15805
+ return ((E = w.transaction) == null ? void 0 : E.id) === t;
15803
15806
  }
15804
15807
  ));
15805
15808
  if (C)
@@ -15916,7 +15919,7 @@ class ed {
15916
15919
  */
15917
15920
  async generateVerificationCode(t) {
15918
15921
  await b.getShadowGraphqlClient().mutate({
15919
- mutation: vl,
15922
+ mutation: El,
15920
15923
  variables: {
15921
15924
  emailAddress: t
15922
15925
  }
@@ -15931,7 +15934,7 @@ class ed {
15931
15934
  async verifyCode(t, e) {
15932
15935
  var i, s;
15933
15936
  const n = (i = (await b.getShadowGraphqlClient().mutate({
15934
- mutation: El,
15937
+ mutation: vl,
15935
15938
  errorPolicy: "all",
15936
15939
  fetchPolicy: "no-cache",
15937
15940
  variables: {
@@ -16020,22 +16023,23 @@ class ed {
16020
16023
  const t = localStorage.getItem("last-refreshed-cognito-tokens"), e = localStorage.getItem("cognito-tokens"), a = localStorage.getItem("cognito-email");
16021
16024
  if (!t || !e || !a)
16022
16025
  return;
16023
- const n = JSON.parse(e);
16024
- (/* @__PURE__ */ new Date()).getTime() / 1e3;
16025
- const s = await new ne({ region: this.userPoolRegion }).send(
16026
- new Re({
16027
- AuthFlow: "REFRESH_TOKEN_AUTH",
16028
- ClientId: this.userPoolClientId,
16029
- AuthParameters: {
16030
- REFRESH_TOKEN: n.RefreshToken || ""
16031
- }
16032
- })
16033
- );
16034
- if (s.AuthenticationResult)
16035
- console.log(`refresh response: ${JSON.stringify(s.AuthenticationResult)}`), localStorage.setItem("last-refreshed-cognito-tokens", `${(/* @__PURE__ */ new Date()).getTime() / 1e3}`), localStorage.setItem("cognito-tokens", JSON.stringify(s.AuthenticationResult));
16036
- else
16037
- throw new Error("Failed to refresh tokens.");
16038
- const l = (await b.getShadowGraphqlClient().query({
16026
+ const n = JSON.parse(e), i = (/* @__PURE__ */ new Date()).getTime() / 1e3;
16027
+ if (!n.ExpiresIn || n.ExpiresIn < i - parseInt(t)) {
16028
+ const c = await new ne({ region: this.userPoolRegion }).send(
16029
+ new Re({
16030
+ AuthFlow: "REFRESH_TOKEN_AUTH",
16031
+ ClientId: this.userPoolClientId,
16032
+ AuthParameters: {
16033
+ REFRESH_TOKEN: n.RefreshToken || ""
16034
+ }
16035
+ })
16036
+ );
16037
+ if (c.AuthenticationResult)
16038
+ console.log(`refresh response: ${JSON.stringify(c.AuthenticationResult)}`), localStorage.setItem("last-refreshed-cognito-tokens", `${(/* @__PURE__ */ new Date()).getTime() / 1e3}`);
16039
+ else
16040
+ throw this.logOut(), new Error("Failed to refresh tokens.");
16041
+ }
16042
+ const o = (await b.getShadowGraphqlClient().query({
16039
16043
  query: Ae,
16040
16044
  errorPolicy: "all",
16041
16045
  fetchPolicy: "no-cache",
@@ -16043,30 +16047,31 @@ class ed {
16043
16047
  emailAddress: a
16044
16048
  }
16045
16049
  })).data.customer;
16046
- if (!l.id)
16050
+ if (!o.id)
16047
16051
  throw new Error("Failed to get customer.");
16048
- this.customer = l, console.log(`set customer to ${JSON.stringify(this.customer)}`);
16052
+ this.customer = o, console.log(`set customer to ${JSON.stringify(this.customer)}`);
16049
16053
  }
16050
16054
  // Get a Cognito bearer token from local storage, attempting to refresh if it's old.
16051
16055
  async loggedInBearerToken() {
16052
16056
  const t = localStorage.getItem("last-refreshed-cognito-tokens"), e = localStorage.getItem("cognito-tokens");
16053
16057
  if (!t || !e)
16054
16058
  throw new Error("No token data in storage.");
16055
- const a = JSON.parse(e);
16056
- (/* @__PURE__ */ new Date()).getTime() / 1e3;
16057
- const i = await new ne({ region: this.userPoolRegion }).send(
16058
- new Re({
16059
- AuthFlow: "REFRESH_TOKEN_AUTH",
16060
- ClientId: this.userPoolClientId,
16061
- AuthParameters: {
16062
- REFRESH_TOKEN: a.RefreshToken || ""
16063
- }
16064
- })
16065
- );
16066
- if (i.AuthenticationResult)
16067
- console.log(`refresh response: ${JSON.stringify(i.AuthenticationResult)}`), localStorage.setItem("last-refreshed-cognito-tokens", `${(/* @__PURE__ */ new Date()).getTime() / 1e3}`), localStorage.setItem("cognito-tokens", JSON.stringify(i.AuthenticationResult));
16068
- else
16069
- throw new Error("Failed to refresh tokens.");
16059
+ const a = JSON.parse(e), n = (/* @__PURE__ */ new Date()).getTime() / 1e3;
16060
+ if (!a.ExpiresIn || a.ExpiresIn < n - parseInt(t)) {
16061
+ const s = await new ne({ region: this.userPoolRegion }).send(
16062
+ new Re({
16063
+ AuthFlow: "REFRESH_TOKEN_AUTH",
16064
+ ClientId: this.userPoolClientId,
16065
+ AuthParameters: {
16066
+ REFRESH_TOKEN: a.RefreshToken || ""
16067
+ }
16068
+ })
16069
+ );
16070
+ if (s.AuthenticationResult)
16071
+ console.log(`refresh response: ${JSON.stringify(s.AuthenticationResult)}`), localStorage.setItem("last-refreshed-cognito-tokens", `${(/* @__PURE__ */ new Date()).getTime() / 1e3}`);
16072
+ else
16073
+ throw this.logOut(), new Error("Failed to refresh tokens.");
16074
+ }
16070
16075
  if (!a.AccessToken)
16071
16076
  throw new Error("No bearer token in storage.");
16072
16077
  return a.AccessToken;
@@ -16118,7 +16123,7 @@ class ed {
16118
16123
  * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
16119
16124
  */
16120
16125
  async getExistingBundle(t, e, a, n) {
16121
- var h, m, g, p, f, C, w, v, S, B, E;
16126
+ var h, m, g, p, f, C, w, E, S, B, v;
16122
16127
  const i = M.getMap("bundleOwnerIds"), s = i == null ? void 0 : i.get(t), o = {};
16123
16128
  try {
16124
16129
  const I = await this.loggedInBearerToken();
@@ -16143,11 +16148,11 @@ class ed {
16143
16148
  });
16144
16149
  if (!((f = c.data) != null && f.bundles) || ((C = c.data) == null ? void 0 : C.bundles.length) === 0 || !((w = c.data) != null && w.bundles[0]))
16145
16150
  throw new Error(`Unable to find bundle: ${t}`);
16146
- const d = (v = c.data) == null ? void 0 : v.bundles[0], A = M.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
16151
+ const d = (E = c.data) == null ? void 0 : E.bundles[0], A = M.getMap("bundlePartnerIds") || /* @__PURE__ */ new Map();
16147
16152
  A.set(d.id, d.partner.id), M.setMap("bundlePartnerIds", A);
16148
16153
  const u = new Je(this, d, e, a, s, {
16149
16154
  additionalHeaders: (S = n == null ? void 0 : n.graphql) == null ? void 0 : S.additionalHeaders,
16150
- eagerFetchProducts: (E = (B = n == null ? void 0 : n.graphql) == null ? void 0 : B.productCollection) == null ? void 0 : E.eagerFetchProducts,
16155
+ eagerFetchProducts: (v = (B = n == null ? void 0 : n.graphql) == null ? void 0 : B.productCollection) == null ? void 0 : v.eagerFetchProducts,
16151
16156
  existingGlobalPropertyState: c.data.globalPropertyState,
16152
16157
  readonly: n == null ? void 0 : n.readonly
16153
16158
  });
@@ -16160,15 +16165,17 @@ class ed {
16160
16165
  * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
16161
16166
  */
16162
16167
  async duplicateBundle(t, e, a, n) {
16163
- var h, m, g, p, f, C, w, v;
16168
+ var h, m, g, p, f, C, w, E;
16164
16169
  const i = (h = M.getMap("bundleOwnerIds")) == null ? void 0 : h.get(t), s = {};
16165
16170
  try {
16166
16171
  const S = await this.loggedInBearerToken();
16167
- s.Authorization = `Bearer ${S}`;
16168
- } catch {
16169
- const E = ((m = Object.entries(localStorage).find(([D, F]) => D.startsWith("CognitoIdentityServiceProvider") && D.endsWith("idToken"))) == null ? void 0 : m[0]) || "", I = localStorage.getItem(E);
16172
+ console.log(`token from cognito is ${S}`), s.Authorization = `Bearer ${S}`;
16173
+ } catch (S) {
16174
+ console.log(S);
16175
+ const v = ((m = Object.entries(localStorage).find(([D, F]) => D.startsWith("CognitoIdentityServiceProvider") && D.endsWith("idToken"))) == null ? void 0 : m[0]) || "", I = localStorage.getItem(v);
16170
16176
  I && !Ie(I) && (s.Authorization = `Bearer ${I}`);
16171
16177
  }
16178
+ console.log("attempted to set bearer token");
16172
16179
  const o = {
16173
16180
  bundleOwnerId: i,
16174
16181
  ...s,
@@ -16194,7 +16201,7 @@ class ed {
16194
16201
  const A = M.getMap("bundleOwnerIds") || /* @__PURE__ */ new Map();
16195
16202
  A.set(c.id, c.bundleOwnerId), M.setMap("bundleOwnerIds", A);
16196
16203
  const u = new Je(this, c, void 0, void 0, c.bundleOwnerId, {
16197
- eagerFetchProducts: (v = (w = n == null ? void 0 : n.graphql) == null ? void 0 : w.productCollection) == null ? void 0 : v.eagerFetchProducts,
16204
+ eagerFetchProducts: (E = (w = n == null ? void 0 : n.graphql) == null ? void 0 : w.productCollection) == null ? void 0 : E.eagerFetchProducts,
16198
16205
  existingGlobalPropertyState: c.globalPropertyState
16199
16206
  });
16200
16207
  return await u.getInitializationPromise(), u;
@@ -16271,16 +16278,16 @@ class ed {
16271
16278
  var D, F, k;
16272
16279
  if (S.length === 0)
16273
16280
  return [];
16274
- const B = S.map((N) => N.option.transactionId), E = await a.query({
16281
+ const B = S.map((N) => N.option.transactionId), v = await a.query({
16275
16282
  query: fi,
16276
16283
  variables: {
16277
16284
  ids: B
16278
16285
  },
16279
16286
  errorPolicy: "all",
16280
16287
  fetchPolicy: "no-cache"
16281
- }), I = E.data.transactions;
16288
+ }), I = v.data.transactions;
16282
16289
  if (I.length !== S.length) {
16283
- const N = ((F = (D = E.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
16290
+ const N = ((F = (D = v.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
16284
16291
  throw new ut(`Not all transactions were found: ${N}`);
16285
16292
  }
16286
16293
  return !this.activeIntegration && ((k = I[0].integrationProduct) != null && k.integration) && (this.activeIntegration = Promise.resolve(I[0].integrationProduct.integration)), I.map((N, nt) => {
@@ -16312,12 +16319,12 @@ class ed {
16312
16319
  },
16313
16320
  errorPolicy: "all",
16314
16321
  fetchPolicy: "no-cache"
16315
- }), E = (I = B.data) == null ? void 0 : I.transactionCreateMany;
16316
- if (!E || E.length === 0) {
16322
+ }), v = (I = B.data) == null ? void 0 : I.transactionCreateMany;
16323
+ if (!v || v.length === 0) {
16317
16324
  const k = ((F = (D = B.errors) == null ? void 0 : D[0]) == null ? void 0 : F.message) || "Unknown error";
16318
16325
  throw new ut(`Failed to create transactions: ${k}`);
16319
16326
  }
16320
- return E.map((k, N) => ({
16327
+ return v.map((k, N) => ({
16321
16328
  transaction: k,
16322
16329
  workflowId: k.workflowId,
16323
16330
  readOnly: !1,
@@ -16330,7 +16337,7 @@ class ed {
16330
16337
  ...d.map(i)
16331
16338
  ])).flat(), u = [...new Set(A.map((S) => S.workflowId))], h = await nr(u, e), m = new Map(h.map((S) => [S.id, S])), g = M.getMap("transactionOwnerIds") || /* @__PURE__ */ new Map(), p = A.map(async (S) => {
16332
16339
  var Z;
16333
- const { transaction: B, workflowId: E, readOnly: I, index: D } = S, F = m.get(E), k = t[D];
16340
+ const { transaction: B, workflowId: v, readOnly: I, index: D } = S, F = m.get(v), k = t[D];
16334
16341
  !g.get(B.id) && B.transactionOwnerId && g.set(B.id, B.transactionOwnerId);
16335
16342
  const N = g.get(B.id) || void 0, nt = new bl({
16336
16343
  onMutate: () => ({ context: { transactionOwnerId: N, bundleOwnerId: e == null ? void 0 : e.bundleOwnerId } }),
@@ -16368,10 +16375,10 @@ class ed {
16368
16375
  }), f = await Promise.all(p);
16369
16376
  M.setMap("transactionOwnerIds", g);
16370
16377
  const w = f.sort((S, B) => S.index - B.index).map(async (S) => {
16371
- const { experienceOptions: B, options: E } = S, I = new Qo(this, B);
16372
- return await I.getWorkflowManager().getInitializationPromise(), E.type !== "transaction" && this.customer && await I.attachCustomerDetails({ email: this.customer.emailAddress }), I;
16373
- }), v = await Promise.all(w);
16374
- return v.forEach((S) => S.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), v;
16378
+ const { experienceOptions: B, options: v } = S, I = new Qo(this, B);
16379
+ return await I.getWorkflowManager().getInitializationPromise(), v.type !== "transaction" && this.customer && await I.attachCustomerDetails({ email: this.customer.emailAddress }), I;
16380
+ }), E = await Promise.all(w);
16381
+ return E.forEach((S) => S.getWorkflowManager().setWorkflowStateSyncEnabled(!0)), E;
16375
16382
  }
16376
16383
  storeCustomer(t) {
16377
16384
  const e = M.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map();
@@ -16380,7 +16387,7 @@ class ed {
16380
16387
  async getIntegrationProductById(t, e) {
16381
16388
  var s, o;
16382
16389
  const i = (s = (await b.getShadowGraphqlClient().query({
16383
- query: vi(e),
16390
+ query: Ei(e),
16384
16391
  variables: {
16385
16392
  ids: [t]
16386
16393
  },
@@ -16394,7 +16401,7 @@ class ed {
16394
16401
  async getIntegrationProductFromExternalIds(t, e, a) {
16395
16402
  var o;
16396
16403
  const s = (o = (await b.getShadowGraphqlClient().query({
16397
- query: Ei(a),
16404
+ query: vi(a),
16398
16405
  variables: {
16399
16406
  externalProductId: e,
16400
16407
  externalIntegrationId: t
@@ -17534,7 +17541,7 @@ export {
17534
17541
  _l as AddressValidationResultConfirmationLevel,
17535
17542
  Zc as ArrayInput,
17536
17543
  et as AspectType,
17537
- vt as AssetNotFoundError,
17544
+ Et as AssetNotFoundError,
17538
17545
  fe as AssetType,
17539
17546
  qc as BringForwardCommand,
17540
17547
  Hc as BringToBackCommand,
@@ -17567,7 +17574,7 @@ export {
17567
17574
  Qe as InformationMessageType,
17568
17575
  yo as InformationStepHandle,
17569
17576
  _a as IntegrationProduct,
17570
- vr as IntegrationType,
17577
+ Er as IntegrationType,
17571
17578
  Lc as LayoutElementFactory,
17572
17579
  T as LayoutElementType,
17573
17580
  q as LayoutNotFoundError,
@@ -17576,7 +17583,7 @@ export {
17576
17583
  ye as MisconfigurationError,
17577
17584
  sd as MockWorkflowManager,
17578
17585
  go as ModelStepHandle,
17579
- vo as ModuleStepHandle,
17586
+ Eo as ModuleStepHandle,
17580
17587
  Vc as MoveCommand,
17581
17588
  ar as ObjectInput,
17582
17589
  wl as ObjectInputType,
@@ -17584,7 +17591,7 @@ export {
17584
17591
  we as OptionNotFoundError,
17585
17592
  Ft as ParseError,
17586
17593
  po as PictureStepHandle,
17587
- Er as ProductCameraRig,
17594
+ vr as ProductCameraRig,
17588
17595
  er as ProductCollection,
17589
17596
  ll as ProductCollectionProductSortKey,
17590
17597
  Gt as ProductWorkflow,
@@ -17622,7 +17629,7 @@ export {
17622
17629
  $c as cmPerPixel,
17623
17630
  Do as createDesign,
17624
17631
  Qc as currentDirection,
17625
- Ec as dataUrlFromExternalUrl,
17632
+ vc as dataUrlFromExternalUrl,
17626
17633
  Ye as designService,
17627
17634
  ge as determineCorrectFontSizeAndLines,
17628
17635
  Gn as digitalContentStepService,
@@ -17656,7 +17663,7 @@ export {
17656
17663
  kc as getPointOfRotation,
17657
17664
  _c as getProductCollections,
17658
17665
  Nc as getSEPoint,
17659
- va as getSvgElement,
17666
+ Ea as getSvgElement,
17660
17667
  fd as getTemplateBundles,
17661
17668
  pd as getTemplateTransactions,
17662
17669
  ad as getTransaction,
@@ -17687,7 +17694,7 @@ export {
17687
17694
  qn as pictureStepService,
17688
17695
  Bc as pmsToRgb,
17689
17696
  Yn as questionStepService,
17690
- vc as registerFetchImplementation,
17697
+ Ec as registerFetchImplementation,
17691
17698
  Sc as registerWindowImplementation,
17692
17699
  Ga as rehydrateSerializedLayout,
17693
17700
  Hr as rgbToPms,
@@ -17703,7 +17710,7 @@ export {
17703
17710
  Un as svgStringDimensions,
17704
17711
  ma as svgToDataUrl,
17705
17712
  H as textStepService,
17706
- vs as toast,
17713
+ Es as toast,
17707
17714
  yd as validateWorkflowExperienceRecipient,
17708
17715
  Sd as validateWorkflowExperienceRecipients,
17709
17716
  bt as xmlSerializer