@spiffcommerce/theme-bridge 1.13.0 → 1.14.1

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.d.ts CHANGED
@@ -48,7 +48,9 @@ declare enum FieldType {
48
48
  Boolean = "Boolean",
49
49
  Color = "Color",
50
50
  Heading = "Heading",
51
+ List = "List",
51
52
  Number = "Number",
53
+ Object = "Object",
52
54
  Select = "Select",
53
55
  Text = "Text"
54
56
  }
@@ -64,6 +66,9 @@ interface FieldBase {
64
66
  */
65
67
  title: string;
66
68
  }
69
+ /**
70
+ * Base type for a field that is actually configurable by a user.
71
+ */
67
72
  interface ConfigurableField extends FieldBase {
68
73
  /**
69
74
  * A locally unique identifier for the field.
@@ -123,10 +128,42 @@ interface TextFieldBase extends ConfigurableField {
123
128
  type: FieldType.Text;
124
129
  }
125
130
  type TextField = TextFieldBase & (RequiredOption | DefaultValueOption);
131
+ /**
132
+ * Displays a heading in the Configuration Editor page in Hub.
133
+ */
126
134
  interface HeadingField extends FieldBase {
127
135
  type: FieldType.Heading;
128
136
  }
129
- type ThemeConfigurationSchemaField = GenericField | AssetField | SelectField | HeadingField | TextField;
137
+ /**
138
+ * A list of one specific field type.
139
+ */
140
+ interface ListField extends ConfigurableField, RequiredOption {
141
+ type: FieldType.List;
142
+ /**
143
+ * Defines the configuration schema for the entries in this list.
144
+ */
145
+ items: DistributiveOmit<ThemeConfigurationConfigurableFields, "key" | "title" | "description">;
146
+ }
147
+ /**
148
+ * A collection of any number of different fields.
149
+ */
150
+ interface ObjectField extends ConfigurableField, RequiredOption {
151
+ type: FieldType.Object;
152
+ /**
153
+ * Defines the configuration schema for the fields in this object.
154
+ */
155
+ fields: ThemeConfigurationSchemaField[];
156
+ }
157
+ /** https://stackoverflow.com/a/57103940/23523714 */
158
+ type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
159
+ /**
160
+ * All fields that are configurable by a user in Hub.
161
+ */
162
+ type ThemeConfigurationConfigurableFields = GenericField | AssetField | SelectField | TextField | ListField | ObjectField;
163
+ /**
164
+ * All fields.
165
+ */
166
+ type ThemeConfigurationSchemaField = ThemeConfigurationConfigurableFields | HeadingField;
130
167
  declare enum AssetType {
131
168
  Color = "Color",
132
169
  ColorProfile = "ColorProfile",
@@ -172,6 +209,10 @@ interface ThemeConfigurationSchemaFieldResource {
172
209
  }[];
173
210
  assetType?: string;
174
211
  multiLine?: boolean;
212
+ /** When this field is type `List`, this is the schema for the entries. */
213
+ items?: ThemeConfigurationSchemaFieldResource;
214
+ /** When this field is type `Object`, this array contains the schemas for the sub-fields. */
215
+ fields?: ThemeConfigurationSchemaFieldResource[];
175
216
  }
176
217
  interface ThemeLaunchDataResource {
177
218
  targetFiles: ThemeLaunchDataTargetFileResource[];
@@ -190,15 +231,23 @@ interface ThemeInstallConfigurationResource {
190
231
  themeVersion: ThemeVersionResource;
191
232
  createdAt: string;
192
233
  updatedAt: string;
193
- fields: ThemeInstallConfigurationField[];
234
+ fields: ThemeInstallConfigurationFieldResource[];
194
235
  }
195
- interface ThemeInstallConfigurationField {
236
+ interface ThemeInstallConfigurationFieldResource {
196
237
  key?: string;
197
238
  fallbackToDefaultConfiguration?: boolean;
198
239
  value?: string;
199
240
  type: FieldType;
200
241
  asset?: AssetResource;
242
+ /** When the type is `List`, this will be the configured values */
243
+ listValues?: ThemeInstallConfigurationFieldResource[];
244
+ /** When the type is `Object`, this will be the configured field values */
245
+ objectValues?: ThemeInstallConfigurationFieldResource[];
201
246
  }
247
+ /**
248
+ * @deprecated This has been renamed to `ThemeInstallConfigurationFieldResource` for consistency.
249
+ */
250
+ type ThemeInstallConfigurationField = ThemeInstallConfigurationFieldResource;
202
251
  interface AssetResource {
203
252
  key: string;
204
253
  name: string;
@@ -301,10 +350,39 @@ type SpiffThemeLoader = {
301
350
  navigateToCustomerPortal(): void;
302
351
  };
303
352
 
353
+ type ThemeVersionGraphQl = Omit<ThemeVersionResource, "configurationSchema"> & {
354
+ configurationSchema: ThemeConfigurationSchemaGraphQl;
355
+ };
356
+ type ThemeConfigurationSchemaGraphQl = Omit<ThemeConfigurationSchemaResource, "fields"> & {
357
+ fields: ThemeConfigurationSchemaFieldGraphQl[];
358
+ };
359
+ type ThemeConfigurationSchemaFieldGraphQl = Omit<ThemeConfigurationSchemaFieldResource, "items" | "fields"> & {
360
+ /** When this field is type `List`, this is the index of the schema for the entries. */
361
+ items?: number;
362
+ /** When this field is type `Object`, this array contains the indices of the schemas for the sub-fields. */
363
+ fields?: number[];
364
+ /** Whether this field is on the root. Otherwise this is a child. */
365
+ root?: boolean;
366
+ };
367
+ type ThemeInstallConfigurationGraphQl = Omit<ThemeInstallConfigurationResource, "fields"> & {
368
+ fields: ThemeInstallConfigurationFieldGraphQl[];
369
+ };
370
+ type ThemeInstallConfigurationFieldGraphQl = Omit<ThemeInstallConfigurationFieldResource, "listValues" | "objectValues"> & {
371
+ /** When the type is `List`, this will be the indices of the configured values */
372
+ listValues?: number[];
373
+ /** When the type is `Object`, this will be the indices of the configured field values */
374
+ objectValues?: number[];
375
+ /** Whether this field is on the root. Otherwise this is a child. */
376
+ root?: boolean;
377
+ };
378
+ declare function themeVersionConfigurationGraphQlToResource(gql: ThemeConfigurationSchemaGraphQl): ThemeConfigurationSchemaResource;
379
+ declare function themeVersionGraphQlToResource(gql: ThemeVersionGraphQl): ThemeVersionResource;
380
+ declare function themeInstallConfigurationGraphQlToResource(gql: ThemeInstallConfigurationGraphQl): ThemeInstallConfigurationResource;
381
+
304
382
  type SpiffDevOptions = Omit<ThemeContextTransaction, "container"> | Omit<ThemeContextBundle, "container">;
305
383
  declare function setSpiffDevOptions(container: HTMLElement | string, context: SpiffDevOptions): void;
306
384
  declare function exampleThemeInstallConfig(opts?: Partial<ThemeInstallConfigurationResource>): ThemeInstallConfigurationResource;
307
- declare function getDefaultsForSchema(schema: ThemeConfigurationSchema, ...excludeKeys: string[]): ThemeInstallConfigurationField[];
385
+ declare function getDefaultsForSchema(schema: ThemeConfigurationSchema, ...excludeKeys: string[]): ThemeInstallConfigurationFieldResource[];
308
386
 
309
387
  interface PluginOptions {
310
388
  /**
@@ -335,4 +413,4 @@ interface PluginOptions {
335
413
  */
336
414
  declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
337
415
 
338
- export { type AssetResource, AssetType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin };
416
+ export { type AssetResource, AssetType, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationConfigurableFields, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldGraphQl, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaGraphQl, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsNewBase, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationFieldGraphQl, type ThemeInstallConfigurationFieldResource, type ThemeInstallConfigurationGraphQl, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionGraphQl, type ThemeVersionResource, exampleThemeInstallConfig, getDefaultsForSchema, setSpiffDevOptions, spiffThemePlugin, themeInstallConfigurationGraphQlToResource, themeVersionConfigurationGraphQlToResource, themeVersionGraphQlToResource };
package/dist/index.js CHANGED
@@ -1,140 +1,185 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- var Ce = Object.defineProperty;
3
- var Se = (e, t, _) => t in e ? Ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: _ }) : e[t] = _;
4
- var B = (e, t, _) => (Se(e, typeof t != "symbol" ? t + "" : t, _), _);
5
- import Ee from "fs";
6
- import we from "path";
7
- var q = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(q || {}), De = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.Number = "Number", e.Select = "Select", e.Text = "Text", e))(De || {}), $e = /* @__PURE__ */ ((e) => (e.Color = "Color", e.ColorProfile = "ColorProfile", e.Data = "Data", e.Environment = "Environment", e.Font = "Font", e.Frame = "Frame", e.Illustration = "Illustration", e.Image = "Image", e.Material = "Material", e.Model = "Model", e.Video = "Video", e))($e || {}), V, f, ue, S, X, fe, Z, D = {}, pe = [], He = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, G = Array.isArray;
8
- function C(e, t) {
9
- for (var _ in t)
10
- e[_] = t[_];
2
+ var Se = Object.defineProperty;
3
+ var we = (e, t, n) => t in e ? Se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
+ var R = (e, t, n) => (we(e, typeof t != "symbol" ? t + "" : t, n), n);
5
+ import De from "fs";
6
+ import $e from "path";
7
+ var B = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(B || {}), Pe = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.List = "List", e.Number = "Number", e.Object = "Object", e.Select = "Select", e.Text = "Text", e))(Pe || {}), Te = /* @__PURE__ */ ((e) => (e.Color = "Color", e.ColorProfile = "ColorProfile", e.Data = "Data", e.Environment = "Environment", e.Font = "Font", e.Frame = "Frame", e.Illustration = "Illustration", e.Image = "Image", e.Material = "Material", e.Model = "Model", e.Video = "Video", e))(Te || {});
8
+ function G(e, t) {
9
+ const n = {
10
+ ...e,
11
+ items: void 0,
12
+ fields: void 0
13
+ };
14
+ return e.items !== void 0 && (n.items = G(t[e.items], t)), e.fields !== void 0 && (n.fields = e.fields.map((_) => G(t[_], t))), n;
15
+ }
16
+ function He(e) {
17
+ const t = {
18
+ ...e,
19
+ fields: []
20
+ }, n = [];
21
+ if (e.fields.forEach((_) => {
22
+ _.root && n.push(G(_, e.fields));
23
+ }), e.fields.length > 0 && n.length === 0)
24
+ throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");
25
+ return t.fields = n, t;
26
+ }
27
+ function ft(e) {
28
+ return {
29
+ ...e,
30
+ configurationSchema: He(e.configurationSchema)
31
+ };
32
+ }
33
+ function Z(e, t) {
34
+ const n = {
35
+ ...e,
36
+ listValues: void 0,
37
+ objectValues: void 0
38
+ };
39
+ return e.listValues !== void 0 && (n.listValues = e.listValues.map((_) => Z(t[_], t))), e.objectValues !== void 0 && (n.objectValues = e.objectValues.map((_) => Z(t[_], t))), n;
40
+ }
41
+ function pt(e) {
42
+ const t = {
43
+ ...e,
44
+ fields: []
45
+ }, n = [];
46
+ if (e.fields.forEach((_) => {
47
+ _.root && n.push(Z(_, e.fields));
48
+ }), e.fields.length > 0 && n.length === 0)
49
+ throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");
50
+ return t.fields = n, t;
51
+ }
52
+ var M, f, pe, E, te, de, Q, D = {}, he = [], Ve = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, q = Array.isArray;
53
+ function x(e, t) {
54
+ for (var n in t)
55
+ e[n] = t[n];
11
56
  return e;
12
57
  }
13
- function de(e) {
58
+ function me(e) {
14
59
  var t = e.parentNode;
15
60
  t && t.removeChild(e);
16
61
  }
17
- function Pe(e, t, _) {
18
- var n, o, i, c = {};
62
+ function Ne(e, t, n) {
63
+ var _, o, i, c = {};
19
64
  for (i in t)
20
- i == "key" ? n = t[i] : i == "ref" ? o = t[i] : c[i] = t[i];
21
- if (arguments.length > 2 && (c.children = arguments.length > 3 ? V.call(arguments, 2) : _), typeof e == "function" && e.defaultProps != null)
65
+ i == "key" ? _ = t[i] : i == "ref" ? o = t[i] : c[i] = t[i];
66
+ if (arguments.length > 2 && (c.children = arguments.length > 3 ? M.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null)
22
67
  for (i in e.defaultProps)
23
68
  c[i] === void 0 && (c[i] = e.defaultProps[i]);
24
- return T(e, c, n, o, null);
69
+ return V(e, c, _, o, null);
25
70
  }
26
- function T(e, t, _, n, o) {
27
- var i = { type: e, props: t, key: _, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++ue, __i: -1, __u: 0 };
71
+ function V(e, t, n, _, o) {
72
+ var i = { type: e, props: t, key: n, ref: _, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++pe, __i: -1, __u: 0 };
28
73
  return o == null && f.vnode != null && f.vnode(i), i;
29
74
  }
30
75
  function W(e) {
31
76
  return e.children;
32
77
  }
33
- function I(e, t) {
78
+ function N(e, t) {
34
79
  this.props = e, this.context = t;
35
80
  }
36
- function E(e, t) {
81
+ function S(e, t) {
37
82
  if (t == null)
38
- return e.__ ? E(e.__, e.__i + 1) : null;
39
- for (var _; t < e.__k.length; t++)
40
- if ((_ = e.__k[t]) != null && _.__e != null)
41
- return _.__e;
42
- return typeof e.type == "function" ? E(e) : null;
43
- }
44
- function he(e) {
45
- var t, _;
83
+ return e.__ ? S(e.__, e.__i + 1) : null;
84
+ for (var n; t < e.__k.length; t++)
85
+ if ((n = e.__k[t]) != null && n.__e != null)
86
+ return n.__e;
87
+ return typeof e.type == "function" ? S(e) : null;
88
+ }
89
+ function ve(e) {
90
+ var t, n;
46
91
  if ((e = e.__) != null && e.__c != null) {
47
92
  for (e.__e = e.__c.base = null, t = 0; t < e.__k.length; t++)
48
- if ((_ = e.__k[t]) != null && _.__e != null) {
49
- e.__e = e.__c.base = _.__e;
93
+ if ((n = e.__k[t]) != null && n.__e != null) {
94
+ e.__e = e.__c.base = n.__e;
50
95
  break;
51
96
  }
52
- return he(e);
97
+ return ve(e);
53
98
  }
54
99
  }
55
- function ee(e) {
56
- (!e.__d && (e.__d = !0) && S.push(e) && !F.__r++ || X !== f.debounceRendering) && ((X = f.debounceRendering) || fe)(F);
57
- }
58
- function F() {
59
- var e, t, _, n, o, i, c, s, a;
60
- for (S.sort(Z); e = S.shift(); )
61
- e.__d && (t = S.length, n = void 0, i = (o = (_ = e).__v).__e, s = [], a = [], (c = _.__P) && ((n = C({}, o)).__v = o.__v + 1, f.vnode && f.vnode(n), Y(c, n, o, _.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, s, i ?? E(o), !!(32 & o.__u), a), n.__.__k[n.__i] = n, ge(s, n, a), n.__e != i && he(n)), S.length > t && S.sort(Z));
62
- F.__r = 0;
63
- }
64
- function ve(e, t, _, n, o, i, c, s, a, l, p) {
65
- var r, d, u, m, k, g = n && n.__k || pe, h = t.length;
66
- for (_.__d = a, Ne(_, t, g), a = _.__d, r = 0; r < h; r++)
67
- (u = _.__k[r]) != null && typeof u != "boolean" && typeof u != "function" && (d = u.__i === -1 ? D : g[u.__i] || D, u.__i = r, Y(e, u, d, o, i, c, s, a, l, p), m = u.__e, u.ref && d.ref != u.ref && (d.ref && K(d.ref, null, u), p.push(u.ref, u.__c || m, u)), k == null && m != null && (k = m), 65536 & u.__u || d.__k === u.__k ? a = me(u, a, e) : typeof u.type == "function" && u.__d !== void 0 ? a = u.__d : m && (a = m.nextSibling), u.__d = void 0, u.__u &= -196609);
68
- _.__d = a, _.__e = k;
69
- }
70
- function Ne(e, t, _) {
71
- var n, o, i, c, s, a = t.length, l = _.length, p = l, r = 0;
72
- for (e.__k = [], n = 0; n < a; n++)
73
- (o = e.__k[n] = (o = t[n]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? T(null, o, null, null, o) : G(o) ? T(W, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? T(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, s = Te(o, _, c = n + r, p), o.__i = s, i = null, s !== -1 && (p--, (i = _[s]) && (i.__u |= 131072)), i == null || i.__v === null ? (s == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : s !== c && (s === c + 1 ? r++ : s > c ? p > a - c ? r += s - c : r-- : r = s < c && s == c - 1 ? s - c : 0, s !== n + r && (o.__u |= 65536))) : (i = _[n]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = E(i)), z(i, i, !1), _[n] = null, p--);
100
+ function ne(e) {
101
+ (!e.__d && (e.__d = !0) && E.push(e) && !L.__r++ || te !== f.debounceRendering) && ((te = f.debounceRendering) || de)(L);
102
+ }
103
+ function L() {
104
+ var e, t, n, _, o, i, c, l, u;
105
+ for (E.sort(Q); e = E.shift(); )
106
+ e.__d && (t = E.length, _ = void 0, i = (o = (n = e).__v).__e, l = [], u = [], (c = n.__P) && ((_ = x({}, o)).__v = o.__v + 1, f.vnode && f.vnode(_), K(c, _, o, n.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? S(o), !!(32 & o.__u), u), _.__.__k[_.__i] = _, be(l, _, u), _.__e != i && ve(_)), E.length > t && E.sort(Q));
107
+ L.__r = 0;
108
+ }
109
+ function ge(e, t, n, _, o, i, c, l, u, s, p) {
110
+ var r, d, a, v, k, g = _ && _.__k || he, h = t.length;
111
+ for (n.__d = u, Ie(n, t, g), u = n.__d, r = 0; r < h; r++)
112
+ (a = n.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? D : g[a.__i] || D, a.__i = r, K(e, a, d, o, i, c, l, u, s, p), v = a.__e, a.ref && d.ref != a.ref && (d.ref && X(d.ref, null, a), p.push(a.ref, a.__c || v, a)), k == null && v != null && (k = v), 65536 & a.__u || d.__k === a.__k ? u = ye(a, u, e) : typeof a.type == "function" && a.__d !== void 0 ? u = a.__d : v && (u = v.nextSibling), a.__d = void 0, a.__u &= -196609);
113
+ n.__d = u, n.__e = k;
114
+ }
115
+ function Ie(e, t, n) {
116
+ var _, o, i, c, l, u = t.length, s = n.length, p = s, r = 0;
117
+ for (e.__k = [], _ = 0; _ < u; _++)
118
+ (o = e.__k[_] = (o = t[_]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? V(null, o, null, null, o) : q(o) ? V(W, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? V(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, l = je(o, n, c = _ + r, p), o.__i = l, i = null, l !== -1 && (p--, (i = n[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : l !== c && (l === c + 1 ? r++ : l > c ? p > u - c ? r += l - c : r-- : r = l < c && l == c - 1 ? l - c : 0, l !== _ + r && (o.__u |= 65536))) : (i = n[_]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = S(i)), z(i, i, !1), n[_] = null, p--);
74
119
  if (p)
75
- for (n = 0; n < l; n++)
76
- (i = _[n]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = E(i)), z(i, i));
120
+ for (_ = 0; _ < s; _++)
121
+ (i = n[_]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = S(i)), z(i, i));
77
122
  }
78
- function me(e, t, _) {
79
- var n, o;
123
+ function ye(e, t, n) {
124
+ var _, o;
80
125
  if (typeof e.type == "function") {
81
- for (n = e.__k, o = 0; n && o < n.length; o++)
82
- n[o] && (n[o].__ = e, t = me(n[o], t, _));
126
+ for (_ = e.__k, o = 0; _ && o < _.length; o++)
127
+ _[o] && (_[o].__ = e, t = ye(_[o], t, n));
83
128
  return t;
84
129
  }
85
- return e.__e != t && (_.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
86
- }
87
- function Te(e, t, _, n) {
88
- var o = e.key, i = e.type, c = _ - 1, s = _ + 1, a = t[_];
89
- if (a === null || a && o == a.key && i === a.type)
90
- return _;
91
- if (n > (a != null && !(131072 & a.__u) ? 1 : 0))
92
- for (; c >= 0 || s < t.length; ) {
130
+ return e.__e != t && (n.insertBefore(e.__e, t || null), t = e.__e), t && t.nextSibling;
131
+ }
132
+ function je(e, t, n, _) {
133
+ var o = e.key, i = e.type, c = n - 1, l = n + 1, u = t[n];
134
+ if (u === null || u && o == u.key && i === u.type)
135
+ return n;
136
+ if (_ > (u != null && !(131072 & u.__u) ? 1 : 0))
137
+ for (; c >= 0 || l < t.length; ) {
93
138
  if (c >= 0) {
94
- if ((a = t[c]) && !(131072 & a.__u) && o == a.key && i === a.type)
139
+ if ((u = t[c]) && !(131072 & u.__u) && o == u.key && i === u.type)
95
140
  return c;
96
141
  c--;
97
142
  }
98
- if (s < t.length) {
99
- if ((a = t[s]) && !(131072 & a.__u) && o == a.key && i === a.type)
100
- return s;
101
- s++;
143
+ if (l < t.length) {
144
+ if ((u = t[l]) && !(131072 & u.__u) && o == u.key && i === u.type)
145
+ return l;
146
+ l++;
102
147
  }
103
148
  }
104
149
  return -1;
105
150
  }
106
- function te(e, t, _) {
107
- t[0] === "-" ? e.setProperty(t, _ ?? "") : e[t] = _ == null ? "" : typeof _ != "number" || He.test(t) ? _ : _ + "px";
151
+ function _e(e, t, n) {
152
+ t[0] === "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || Ve.test(t) ? n : n + "px";
108
153
  }
109
- function N(e, t, _, n, o) {
154
+ function H(e, t, n, _, o) {
110
155
  var i;
111
156
  e:
112
157
  if (t === "style")
113
- if (typeof _ == "string")
114
- e.style.cssText = _;
158
+ if (typeof n == "string")
159
+ e.style.cssText = n;
115
160
  else {
116
- if (typeof n == "string" && (e.style.cssText = n = ""), n)
117
- for (t in n)
118
- _ && t in _ || te(e.style, t, "");
119
- if (_)
161
+ if (typeof _ == "string" && (e.style.cssText = _ = ""), _)
120
162
  for (t in _)
121
- n && _[t] === n[t] || te(e.style, t, _[t]);
163
+ n && t in n || _e(e.style, t, "");
164
+ if (n)
165
+ for (t in n)
166
+ _ && n[t] === _[t] || _e(e.style, t, n[t]);
122
167
  }
123
168
  else if (t[0] === "o" && t[1] === "n")
124
- i = t !== (t = t.replace(/(PointerCapture)$|Capture$/, "$1")), t = t.toLowerCase() in e ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + i] = _, _ ? n ? _.u = n.u : (_.u = Date.now(), e.addEventListener(t, i ? ne : _e, i)) : e.removeEventListener(t, i ? ne : _e, i);
169
+ i = t !== (t = t.replace(/(PointerCapture)$|Capture$/, "$1")), t = t.toLowerCase() in e ? t.toLowerCase().slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + i] = n, n ? _ ? n.u = _.u : (n.u = Date.now(), e.addEventListener(t, i ? re : oe, i)) : e.removeEventListener(t, i ? re : oe, i);
125
170
  else {
126
171
  if (o)
127
172
  t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
128
173
  else if (t !== "width" && t !== "height" && t !== "href" && t !== "list" && t !== "form" && t !== "tabIndex" && t !== "download" && t !== "rowSpan" && t !== "colSpan" && t !== "role" && t in e)
129
174
  try {
130
- e[t] = _ ?? "";
175
+ e[t] = n ?? "";
131
176
  break e;
132
177
  } catch {
133
178
  }
134
- typeof _ == "function" || (_ == null || _ === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, _));
179
+ typeof n == "function" || (n == null || n === !1 && t[4] !== "-" ? e.removeAttribute(t) : e.setAttribute(t, n));
135
180
  }
136
181
  }
137
- function _e(e) {
182
+ function oe(e) {
138
183
  var t = this.l[e.type + !1];
139
184
  if (e.t) {
140
185
  if (e.t <= t.u)
@@ -143,52 +188,52 @@ function _e(e) {
143
188
  e.t = Date.now();
144
189
  return t(f.event ? f.event(e) : e);
145
190
  }
146
- function ne(e) {
191
+ function re(e) {
147
192
  return this.l[e.type + !0](f.event ? f.event(e) : e);
148
193
  }
149
- function Y(e, t, _, n, o, i, c, s, a, l) {
150
- var p, r, d, u, m, k, g, h, y, x, $, w, Q, H, A, b = t.type;
194
+ function K(e, t, n, _, o, i, c, l, u, s) {
195
+ var p, r, d, a, v, k, g, h, y, C, $, w, ee, P, A, b = t.type;
151
196
  if (t.constructor !== void 0)
152
197
  return null;
153
- 128 & _.__u && (a = !!(32 & _.__u), i = [s = t.__e = _.__e]), (p = f.__b) && p(t);
198
+ 128 & n.__u && (u = !!(32 & n.__u), i = [l = t.__e = n.__e]), (p = f.__b) && p(t);
154
199
  e:
155
200
  if (typeof b == "function")
156
201
  try {
157
- if (h = t.props, y = (p = b.contextType) && n[p.__c], x = p ? y ? y.props.value : p.__ : n, _.__c ? g = (r = t.__c = _.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, x) : (t.__c = r = new I(h, x), r.constructor = b, r.render = je), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = x, r.__n = n, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = C({}, r.__s)), C(r.__s, b.getDerivedStateFromProps(h, r.__s))), u = r.props, m = r.state, r.__v = t, d)
202
+ if (h = t.props, y = (p = b.contextType) && _[p.__c], C = p ? y ? y.props.value : p.__ : _, n.__c ? g = (r = t.__c = n.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? t.__c = r = new b(h, C) : (t.__c = r = new N(h, C), r.constructor = b, r.render = Ue), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = C, r.__n = _, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = x({}, r.__s)), x(r.__s, b.getDerivedStateFromProps(h, r.__s))), a = r.props, v = r.state, r.__v = t, d)
158
203
  b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
159
204
  else {
160
- if (b.getDerivedStateFromProps == null && h !== u && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, x), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, x) === !1 || t.__v === _.__v)) {
161
- for (t.__v !== _.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = _.__e, t.__k = _.__k, t.__k.forEach(function(P) {
162
- P && (P.__ = t);
205
+ if (b.getDerivedStateFromProps == null && h !== a && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, C), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, C) === !1 || t.__v === n.__v)) {
206
+ for (t.__v !== n.__v && (r.props = h, r.state = r.__s, r.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.forEach(function(T) {
207
+ T && (T.__ = t);
163
208
  }), $ = 0; $ < r._sb.length; $++)
164
209
  r.__h.push(r._sb[$]);
165
210
  r._sb = [], r.__h.length && c.push(r);
166
211
  break e;
167
212
  }
168
- r.componentWillUpdate != null && r.componentWillUpdate(h, r.__s, x), r.componentDidUpdate != null && r.__h.push(function() {
169
- r.componentDidUpdate(u, m, k);
213
+ r.componentWillUpdate != null && r.componentWillUpdate(h, r.__s, C), r.componentDidUpdate != null && r.__h.push(function() {
214
+ r.componentDidUpdate(a, v, k);
170
215
  });
171
216
  }
172
- if (r.context = x, r.props = h, r.__P = e, r.__e = !1, w = f.__r, Q = 0, "prototype" in b && b.prototype.render) {
173
- for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), H = 0; H < r._sb.length; H++)
174
- r.__h.push(r._sb[H]);
217
+ if (r.context = C, r.props = h, r.__P = e, r.__e = !1, w = f.__r, ee = 0, "prototype" in b && b.prototype.render) {
218
+ for (r.state = r.__s, r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), P = 0; P < r._sb.length; P++)
219
+ r.__h.push(r._sb[P]);
175
220
  r._sb = [];
176
221
  } else
177
222
  do
178
223
  r.__d = !1, w && w(t), p = r.render(r.props, r.state, r.context), r.state = r.__s;
179
- while (r.__d && ++Q < 25);
180
- r.state = r.__s, r.getChildContext != null && (n = C(C({}, n), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(u, m)), ve(e, G(A = p != null && p.type === W && p.key == null ? p.props.children : p) ? A : [A], t, _, n, o, i, c, s, a, l), r.base = t.__e, t.__u &= -161, r.__h.length && c.push(r), g && (r.__E = r.__ = null);
181
- } catch (P) {
182
- t.__v = null, a || i != null ? (t.__e = s, t.__u |= a ? 160 : 32, i[i.indexOf(s)] = null) : (t.__e = _.__e, t.__k = _.__k), f.__e(P, t, _);
224
+ while (r.__d && ++ee < 25);
225
+ r.state = r.__s, r.getChildContext != null && (_ = x(x({}, _), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, v)), ge(e, q(A = p != null && p.type === W && p.key == null ? p.props.children : p) ? A : [A], t, n, _, o, i, c, l, u, s), r.base = t.__e, t.__u &= -161, r.__h.length && c.push(r), g && (r.__E = r.__ = null);
226
+ } catch (T) {
227
+ t.__v = null, u || i != null ? (t.__e = l, t.__u |= u ? 160 : 32, i[i.indexOf(l)] = null) : (t.__e = n.__e, t.__k = n.__k), f.__e(T, t, n);
183
228
  }
184
229
  else
185
- i == null && t.__v === _.__v ? (t.__k = _.__k, t.__e = _.__e) : t.__e = Ie(_.__e, t, _, n, o, i, c, a, l);
230
+ i == null && t.__v === n.__v ? (t.__k = n.__k, t.__e = n.__e) : t.__e = Le(n.__e, t, n, _, o, i, c, u, s);
186
231
  (p = f.diffed) && p(t);
187
232
  }
188
- function ge(e, t, _) {
233
+ function be(e, t, n) {
189
234
  t.__d = void 0;
190
- for (var n = 0; n < _.length; n++)
191
- K(_[n], _[++n], _[++n]);
235
+ for (var _ = 0; _ < n.length; _++)
236
+ X(n[_], n[++_], n[++_]);
192
237
  f.__c && f.__c(t, e), e.some(function(o) {
193
238
  try {
194
239
  e = o.__h, o.__h = [], e.some(function(i) {
@@ -199,220 +244,220 @@ function ge(e, t, _) {
199
244
  }
200
245
  });
201
246
  }
202
- function Ie(e, t, _, n, o, i, c, s, a) {
203
- var l, p, r, d, u, m, k, g = _.props, h = t.props, y = t.type;
247
+ function Le(e, t, n, _, o, i, c, l, u) {
248
+ var s, p, r, d, a, v, k, g = n.props, h = t.props, y = t.type;
204
249
  if (y === "svg" && (o = !0), i != null) {
205
- for (l = 0; l < i.length; l++)
206
- if ((u = i[l]) && "setAttribute" in u == !!y && (y ? u.localName === y : u.nodeType === 3)) {
207
- e = u, i[l] = null;
250
+ for (s = 0; s < i.length; s++)
251
+ if ((a = i[s]) && "setAttribute" in a == !!y && (y ? a.localName === y : a.nodeType === 3)) {
252
+ e = a, i[s] = null;
208
253
  break;
209
254
  }
210
255
  }
211
256
  if (e == null) {
212
257
  if (y === null)
213
258
  return document.createTextNode(h);
214
- e = o ? document.createElementNS("http://www.w3.org/2000/svg", y) : document.createElement(y, h.is && h), i = null, s = !1;
259
+ e = o ? document.createElementNS("http://www.w3.org/2000/svg", y) : document.createElement(y, h.is && h), i = null, l = !1;
215
260
  }
216
261
  if (y === null)
217
- g === h || s && e.data === h || (e.data = h);
262
+ g === h || l && e.data === h || (e.data = h);
218
263
  else {
219
- if (i = i && V.call(e.childNodes), g = _.props || D, !s && i != null)
220
- for (g = {}, l = 0; l < e.attributes.length; l++)
221
- g[(u = e.attributes[l]).name] = u.value;
222
- for (l in g)
223
- u = g[l], l == "children" || (l == "dangerouslySetInnerHTML" ? r = u : l === "key" || l in h || N(e, l, null, u, o));
224
- for (l in h)
225
- u = h[l], l == "children" ? d = u : l == "dangerouslySetInnerHTML" ? p = u : l == "value" ? m = u : l == "checked" ? k = u : l === "key" || s && typeof u != "function" || g[l] === u || N(e, l, u, g[l], o);
264
+ if (i = i && M.call(e.childNodes), g = n.props || D, !l && i != null)
265
+ for (g = {}, s = 0; s < e.attributes.length; s++)
266
+ g[(a = e.attributes[s]).name] = a.value;
267
+ for (s in g)
268
+ a = g[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = a : s === "key" || s in h || H(e, s, null, a, o));
269
+ for (s in h)
270
+ a = h[s], s == "children" ? d = a : s == "dangerouslySetInnerHTML" ? p = a : s == "value" ? v = a : s == "checked" ? k = a : s === "key" || l && typeof a != "function" || g[s] === a || H(e, s, a, g[s], o);
226
271
  if (p)
227
- s || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
228
- else if (r && (e.innerHTML = ""), ve(e, G(d) ? d : [d], t, _, n, o && y !== "foreignObject", i, c, i ? i[0] : _.__k && E(_, 0), s, a), i != null)
229
- for (l = i.length; l--; )
230
- i[l] != null && de(i[l]);
231
- s || (l = "value", m !== void 0 && (m !== e[l] || y === "progress" && !m || y === "option" && m !== g[l]) && N(e, l, m, g[l], !1), l = "checked", k !== void 0 && k !== e[l] && N(e, l, k, g[l], !1));
272
+ l || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), t.__k = [];
273
+ else if (r && (e.innerHTML = ""), ge(e, q(d) ? d : [d], t, n, _, o && y !== "foreignObject", i, c, i ? i[0] : n.__k && S(n, 0), l, u), i != null)
274
+ for (s = i.length; s--; )
275
+ i[s] != null && me(i[s]);
276
+ l || (s = "value", v !== void 0 && (v !== e[s] || y === "progress" && !v || y === "option" && v !== g[s]) && H(e, s, v, g[s], !1), s = "checked", k !== void 0 && k !== e[s] && H(e, s, k, g[s], !1));
232
277
  }
233
278
  return e;
234
279
  }
235
- function K(e, t, _) {
280
+ function X(e, t, n) {
236
281
  try {
237
282
  typeof e == "function" ? e(t) : e.current = t;
238
- } catch (n) {
239
- f.__e(n, _);
283
+ } catch (_) {
284
+ f.__e(_, n);
240
285
  }
241
286
  }
242
- function z(e, t, _) {
243
- var n, o;
244
- if (f.unmount && f.unmount(e), (n = e.ref) && (n.current && n.current !== e.__e || K(n, null, t)), (n = e.__c) != null) {
245
- if (n.componentWillUnmount)
287
+ function z(e, t, n) {
288
+ var _, o;
289
+ if (f.unmount && f.unmount(e), (_ = e.ref) && (_.current && _.current !== e.__e || X(_, null, t)), (_ = e.__c) != null) {
290
+ if (_.componentWillUnmount)
246
291
  try {
247
- n.componentWillUnmount();
292
+ _.componentWillUnmount();
248
293
  } catch (i) {
249
294
  f.__e(i, t);
250
295
  }
251
- n.base = n.__P = null, e.__c = void 0;
296
+ _.base = _.__P = null, e.__c = void 0;
252
297
  }
253
- if (n = e.__k)
254
- for (o = 0; o < n.length; o++)
255
- n[o] && z(n[o], t, _ || typeof e.type != "function");
256
- _ || e.__e == null || de(e.__e), e.__ = e.__e = e.__d = void 0;
298
+ if (_ = e.__k)
299
+ for (o = 0; o < _.length; o++)
300
+ _[o] && z(_[o], t, n || typeof e.type != "function");
301
+ n || e.__e == null || me(e.__e), e.__ = e.__e = e.__d = void 0;
257
302
  }
258
- function je(e, t, _) {
259
- return this.constructor(e, _);
303
+ function Ue(e, t, n) {
304
+ return this.constructor(e, n);
260
305
  }
261
- function Ue(e, t, _) {
262
- var n, o, i, c;
263
- f.__ && f.__(e, t), o = (n = typeof _ == "function") ? null : _ && _.__k || t.__k, i = [], c = [], Y(t, e = (!n && _ || t).__k = Pe(W, null, [e]), o || D, D, t.ownerSVGElement !== void 0, !n && _ ? [_] : o ? null : t.firstChild ? V.call(t.childNodes) : null, i, !n && _ ? _ : o ? o.__e : t.firstChild, n, c), ge(i, e, c);
306
+ function Fe(e, t, n) {
307
+ var _, o, i, c;
308
+ f.__ && f.__(e, t), o = (_ = typeof n == "function") ? null : n && n.__k || t.__k, i = [], c = [], K(t, e = (!_ && n || t).__k = Ne(W, null, [e]), o || D, D, t.ownerSVGElement !== void 0, !_ && n ? [n] : o ? null : t.firstChild ? M.call(t.childNodes) : null, i, !_ && n ? n : o ? o.__e : t.firstChild, _, c), be(i, e, c);
264
309
  }
265
- V = pe.slice, f = { __e: function(e, t, _, n) {
310
+ M = he.slice, f = { __e: function(e, t, n, _) {
266
311
  for (var o, i, c; t = t.__; )
267
312
  if ((o = t.__c) && !o.__)
268
313
  try {
269
- if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), c = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, n || {}), c = o.__d), c)
314
+ if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), c = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, _ || {}), c = o.__d), c)
270
315
  return o.__E = o;
271
- } catch (s) {
272
- e = s;
316
+ } catch (l) {
317
+ e = l;
273
318
  }
274
319
  throw e;
275
- } }, ue = 0, I.prototype.setState = function(e, t) {
276
- var _;
277
- _ = this.__s != null && this.__s !== this.state ? this.__s : this.__s = C({}, this.state), typeof e == "function" && (e = e(C({}, _), this.props)), e && C(_, e), e != null && this.__v && (t && this._sb.push(t), ee(this));
278
- }, I.prototype.forceUpdate = function(e) {
279
- this.__v && (this.__e = !0, e && this.__h.push(e), ee(this));
280
- }, I.prototype.render = W, S = [], fe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Z = function(e, t) {
320
+ } }, pe = 0, N.prototype.setState = function(e, t) {
321
+ var n;
322
+ n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = x({}, this.state), typeof e == "function" && (e = e(x({}, n), this.props)), e && x(n, e), e != null && this.__v && (t && this._sb.push(t), ne(this));
323
+ }, N.prototype.forceUpdate = function(e) {
324
+ this.__v && (this.__e = !0, e && this.__h.push(e), ne(this));
325
+ }, N.prototype.render = W, E = [], de = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Q = function(e, t) {
281
326
  return e.__v.__b - t.__v.__b;
282
- }, F.__r = 0;
283
- var L, v, O, oe, J = 0, ye = [], j = [], re = f.__b, ie = f.__r, le = f.diffed, se = f.__c, ce = f.unmount;
284
- function be(e, t) {
285
- f.__h && f.__h(v, e, J || t), J = 0;
286
- var _ = v.__H || (v.__H = { __: [], __h: [] });
287
- return e >= _.__.length && _.__.push({ __V: j }), _.__[e];
288
- }
289
- function Fe(e) {
290
- return J = 1, Le(ke, e);
291
- }
292
- function Le(e, t, _) {
293
- var n = be(L++, 2);
294
- if (n.t = e, !n.__c && (n.__ = [_ ? _(t) : ke(void 0, t), function(s) {
295
- var a = n.__N ? n.__N[0] : n.__[0], l = n.t(a, s);
296
- a !== l && (n.__N = [l, n.__[1]], n.__c.setState({}));
297
- }], n.__c = v, !v.u)) {
298
- var o = function(s, a, l) {
299
- if (!n.__c.__H)
327
+ }, L.__r = 0;
328
+ var U, m, O, ie, J = 0, ke = [], I = [], se = f.__b, le = f.__r, ce = f.diffed, ue = f.__c, ae = f.unmount;
329
+ function Ce(e, t) {
330
+ f.__h && f.__h(m, e, J || t), J = 0;
331
+ var n = m.__H || (m.__H = { __: [], __h: [] });
332
+ return e >= n.__.length && n.__.push({ __V: I }), n.__[e];
333
+ }
334
+ function Me(e) {
335
+ return J = 1, We(xe, e);
336
+ }
337
+ function We(e, t, n) {
338
+ var _ = Ce(U++, 2);
339
+ if (_.t = e, !_.__c && (_.__ = [n ? n(t) : xe(void 0, t), function(l) {
340
+ var u = _.__N ? _.__N[0] : _.__[0], s = _.t(u, l);
341
+ u !== s && (_.__N = [s, _.__[1]], _.__c.setState({}));
342
+ }], _.__c = m, !m.u)) {
343
+ var o = function(l, u, s) {
344
+ if (!_.__c.__H)
300
345
  return !0;
301
- var p = n.__c.__H.__.filter(function(d) {
346
+ var p = _.__c.__H.__.filter(function(d) {
302
347
  return d.__c;
303
348
  });
304
349
  if (p.every(function(d) {
305
350
  return !d.__N;
306
351
  }))
307
- return !i || i.call(this, s, a, l);
352
+ return !i || i.call(this, l, u, s);
308
353
  var r = !1;
309
354
  return p.forEach(function(d) {
310
355
  if (d.__N) {
311
- var u = d.__[0];
312
- d.__ = d.__N, d.__N = void 0, u !== d.__[0] && (r = !0);
356
+ var a = d.__[0];
357
+ d.__ = d.__N, d.__N = void 0, a !== d.__[0] && (r = !0);
313
358
  }
314
- }), !(!r && n.__c.props === s) && (!i || i.call(this, s, a, l));
359
+ }), !(!r && _.__c.props === l) && (!i || i.call(this, l, u, s));
315
360
  };
316
- v.u = !0;
317
- var i = v.shouldComponentUpdate, c = v.componentWillUpdate;
318
- v.componentWillUpdate = function(s, a, l) {
361
+ m.u = !0;
362
+ var i = m.shouldComponentUpdate, c = m.componentWillUpdate;
363
+ m.componentWillUpdate = function(l, u, s) {
319
364
  if (this.__e) {
320
365
  var p = i;
321
- i = void 0, o(s, a, l), i = p;
366
+ i = void 0, o(l, u, s), i = p;
322
367
  }
323
- c && c.call(this, s, a, l);
324
- }, v.shouldComponentUpdate = o;
368
+ c && c.call(this, l, u, s);
369
+ }, m.shouldComponentUpdate = o;
325
370
  }
326
- return n.__N || n.__;
371
+ return _.__N || _.__;
327
372
  }
328
- function Me(e, t) {
329
- var _ = be(L++, 3);
330
- !f.__s && Ae(_.__H, t) && (_.__ = e, _.i = t, v.__H.__h.push(_));
373
+ function Ae(e, t) {
374
+ var n = Ce(U++, 3);
375
+ !f.__s && Be(n.__H, t) && (n.__ = e, n.i = t, m.__H.__h.push(n));
331
376
  }
332
- function Ve() {
333
- for (var e; e = ye.shift(); )
377
+ function Re() {
378
+ for (var e; e = ke.shift(); )
334
379
  if (e.__P && e.__H)
335
380
  try {
336
- e.__H.__h.forEach(U), e.__H.__h.forEach(R), e.__H.__h = [];
381
+ e.__H.__h.forEach(j), e.__H.__h.forEach(Y), e.__H.__h = [];
337
382
  } catch (t) {
338
383
  e.__H.__h = [], f.__e(t, e.__v);
339
384
  }
340
385
  }
341
386
  f.__b = function(e) {
342
- v = null, re && re(e);
387
+ m = null, se && se(e);
343
388
  }, f.__r = function(e) {
344
- ie && ie(e), L = 0;
345
- var t = (v = e.__c).__H;
346
- t && (O === v ? (t.__h = [], v.__h = [], t.__.forEach(function(_) {
347
- _.__N && (_.__ = _.__N), _.__V = j, _.__N = _.i = void 0;
348
- })) : (t.__h.forEach(U), t.__h.forEach(R), t.__h = [], L = 0)), O = v;
389
+ le && le(e), U = 0;
390
+ var t = (m = e.__c).__H;
391
+ t && (O === m ? (t.__h = [], m.__h = [], t.__.forEach(function(n) {
392
+ n.__N && (n.__ = n.__N), n.__V = I, n.__N = n.i = void 0;
393
+ })) : (t.__h.forEach(j), t.__h.forEach(Y), t.__h = [], U = 0)), O = m;
349
394
  }, f.diffed = function(e) {
350
- le && le(e);
395
+ ce && ce(e);
351
396
  var t = e.__c;
352
- t && t.__H && (t.__H.__h.length && (ye.push(t) !== 1 && oe === f.requestAnimationFrame || ((oe = f.requestAnimationFrame) || We)(Ve)), t.__H.__.forEach(function(_) {
353
- _.i && (_.__H = _.i), _.__V !== j && (_.__ = _.__V), _.i = void 0, _.__V = j;
354
- })), O = v = null;
397
+ t && t.__H && (t.__H.__h.length && (ke.push(t) !== 1 && ie === f.requestAnimationFrame || ((ie = f.requestAnimationFrame) || Oe)(Re)), t.__H.__.forEach(function(n) {
398
+ n.i && (n.__H = n.i), n.__V !== I && (n.__ = n.__V), n.i = void 0, n.__V = I;
399
+ })), O = m = null;
355
400
  }, f.__c = function(e, t) {
356
- t.some(function(_) {
401
+ t.some(function(n) {
357
402
  try {
358
- _.__h.forEach(U), _.__h = _.__h.filter(function(n) {
359
- return !n.__ || R(n);
403
+ n.__h.forEach(j), n.__h = n.__h.filter(function(_) {
404
+ return !_.__ || Y(_);
360
405
  });
361
- } catch (n) {
406
+ } catch (_) {
362
407
  t.some(function(o) {
363
408
  o.__h && (o.__h = []);
364
- }), t = [], f.__e(n, _.__v);
409
+ }), t = [], f.__e(_, n.__v);
365
410
  }
366
- }), se && se(e, t);
411
+ }), ue && ue(e, t);
367
412
  }, f.unmount = function(e) {
368
- ce && ce(e);
369
- var t, _ = e.__c;
370
- _ && _.__H && (_.__H.__.forEach(function(n) {
413
+ ae && ae(e);
414
+ var t, n = e.__c;
415
+ n && n.__H && (n.__H.__.forEach(function(_) {
371
416
  try {
372
- U(n);
417
+ j(_);
373
418
  } catch (o) {
374
419
  t = o;
375
420
  }
376
- }), _.__H = void 0, t && f.__e(t, _.__v));
421
+ }), n.__H = void 0, t && f.__e(t, n.__v));
377
422
  };
378
- var ae = typeof requestAnimationFrame == "function";
379
- function We(e) {
380
- var t, _ = function() {
381
- clearTimeout(n), ae && cancelAnimationFrame(t), setTimeout(e);
382
- }, n = setTimeout(_, 100);
383
- ae && (t = requestAnimationFrame(_));
384
- }
385
- function U(e) {
386
- var t = v, _ = e.__c;
387
- typeof _ == "function" && (e.__c = void 0, _()), v = t;
388
- }
389
- function R(e) {
390
- var t = v;
391
- e.__c = e.__(), v = t;
392
- }
393
- function Ae(e, t) {
394
- return !e || e.length !== t.length || t.some(function(_, n) {
395
- return _ !== e[n];
423
+ var fe = typeof requestAnimationFrame == "function";
424
+ function Oe(e) {
425
+ var t, n = function() {
426
+ clearTimeout(_), fe && cancelAnimationFrame(t), setTimeout(e);
427
+ }, _ = setTimeout(n, 100);
428
+ fe && (t = requestAnimationFrame(n));
429
+ }
430
+ function j(e) {
431
+ var t = m, n = e.__c;
432
+ typeof n == "function" && (e.__c = void 0, n()), m = t;
433
+ }
434
+ function Y(e) {
435
+ var t = m;
436
+ e.__c = e.__(), m = t;
437
+ }
438
+ function Be(e, t) {
439
+ return !e || e.length !== t.length || t.some(function(n, _) {
440
+ return n !== e[_];
396
441
  });
397
442
  }
398
- function ke(e, t) {
443
+ function xe(e, t) {
399
444
  return typeof t == "function" ? t(e) : t;
400
445
  }
401
- var Be = 0;
402
- function xe(e, t, _, n, o, i) {
403
- var c, s, a = {};
404
- for (s in t)
405
- s == "ref" ? c = t[s] : a[s] = t[s];
406
- var l = { type: e, props: a, key: _, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Be, __i: -1, __u: 0, __source: o, __self: i };
446
+ var Ge = 0;
447
+ function Ee(e, t, n, _, o, i) {
448
+ var c, l, u = {};
449
+ for (l in t)
450
+ l == "ref" ? c = t[l] : u[l] = t[l];
451
+ var s = { type: e, props: u, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Ge, __i: -1, __u: 0, __source: o, __self: i };
407
452
  if (typeof e == "function" && (c = e.defaultProps))
408
- for (s in c)
409
- a[s] === void 0 && (a[s] = c[s]);
410
- return f.vnode && f.vnode(l), l;
453
+ for (l in c)
454
+ u[l] === void 0 && (u[l] = c[l]);
455
+ return f.vnode && f.vnode(s), s;
411
456
  }
412
- class Oe {
457
+ class Ze {
413
458
  constructor() {
414
- B(this, "_context");
415
- B(this, "_getContextCallbacks", []);
459
+ R(this, "_context");
460
+ R(this, "_getContextCallbacks", []);
416
461
  }
417
462
  async getContext() {
418
463
  return this._context ? this._context : new Promise((t) => {
@@ -420,7 +465,7 @@ class Oe {
420
465
  });
421
466
  }
422
467
  setContext(t) {
423
- this._context = t, this._getContextCallbacks.forEach((_) => _(t)), this._getContextCallbacks = [];
468
+ this._context = t, this._getContextCallbacks.forEach((n) => n(t)), this._getContextCallbacks = [];
424
469
  }
425
470
  configureClient(t) {
426
471
  console.log("Client configured");
@@ -438,33 +483,33 @@ class Oe {
438
483
  console.log("Navigating to customer portal");
439
484
  }
440
485
  }
441
- let M;
442
- const qe = ({
486
+ let F;
487
+ const Qe = ({
443
488
  context: e
444
489
  }) => {
445
- const [t, _] = Fe(null);
446
- return Me(() => {
490
+ const [t, n] = Me(null);
491
+ return Ae(() => {
447
492
  if (t) {
448
- if (M === void 0)
493
+ if (F === void 0)
449
494
  throw new Error("Please call setSpiffDevOptions before requesting the context.");
450
- M.setContext({
495
+ F.setContext({
451
496
  ...e,
452
497
  container: t
453
498
  });
454
499
  }
455
- }, [t, e]), xe("div", {
456
- ref: _,
500
+ }, [t, e]), Ee("div", {
501
+ ref: n,
457
502
  id: "spiffThemeWrapper"
458
503
  });
459
504
  };
460
- function ct(e, t) {
461
- M = new Oe(), window.SpiffThemeLoader = M;
462
- let _;
463
- typeof e == "string" ? _ = document.getElementById(e) : _ = e, Ue(xe(qe, {
505
+ function dt(e, t) {
506
+ F = new Ze(), window.SpiffThemeLoader = F;
507
+ let n;
508
+ typeof e == "string" ? n = document.getElementById(e) : n = e, Fe(Ee(Qe, {
464
509
  context: t
465
- }), _);
510
+ }), n);
466
511
  }
467
- function at(e) {
512
+ function ht(e) {
468
513
  return {
469
514
  id: "example",
470
515
  themeInstallId: (e == null ? void 0 : e.themeInstallId) ?? "example",
@@ -493,30 +538,30 @@ function at(e) {
493
538
  ...e
494
539
  };
495
540
  }
496
- const Ze = (e) => {
541
+ const ze = (e) => {
497
542
  if (Object.keys(e).includes("defaultValue"))
498
543
  return e.defaultValue;
499
544
  };
500
- function ut(e, ...t) {
501
- return e.fields.filter((_) => !_.key || !t.includes(_.key)).map((_) => ({
502
- key: _.key,
545
+ function mt(e, ...t) {
546
+ return e.fields.filter((n) => !n.key || !t.includes(n.key)).map((n) => ({
547
+ key: n.key,
503
548
  fallbackToDefaultConfiguration: !1,
504
- value: Ze(_),
505
- type: _.type,
549
+ value: ze(n),
550
+ type: n.type,
506
551
  asset: void 0
507
552
  }));
508
553
  }
509
- const ze = "@spiffcommerce/theme-bridge", Je = "1.12.2-0", Re = "module", Ge = {
554
+ const Je = "@spiffcommerce/theme-bridge", Ye = "1.14.1", qe = "module", Ke = {
510
555
  build: "tsc && vite build",
511
556
  preview: "vite preview",
512
557
  dev: "ladle serve",
513
558
  schema: "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"
514
- }, Ye = "./dist/index.umd.cjs", Ke = "./dist/index.js", Qe = "./dist/index.d.ts", Xe = [
559
+ }, Xe = "./dist/index.umd.cjs", et = "./dist/index.js", tt = "./dist/index.d.ts", nt = [
515
560
  "./dist"
516
- ], et = {
561
+ ], _t = {
517
562
  import: "./dist/index.js",
518
563
  require: "./dist/index.umd.cjs"
519
- }, tt = {}, _t = {
564
+ }, ot = {}, rt = {
520
565
  "@ladle/react": "^4.0.2",
521
566
  "@preact/preset-vite": "^2.7.0",
522
567
  "@spiffcommerce/core": "^21.0.1",
@@ -536,73 +581,76 @@ const ze = "@spiffcommerce/theme-bridge", Je = "1.12.2-0", Re = "module", Ge = {
536
581
  vite: "^5.0.8",
537
582
  "vite-plugin-css-injected-by-js": "^3.4.0",
538
583
  "vite-plugin-externalize-deps": "^0.8.0"
539
- }, nt = {
584
+ }, it = {
540
585
  "@spiffcommerce/core": "^21.0.1"
541
- }, ot = {
542
- name: ze,
543
- version: Je,
544
- type: Re,
545
- scripts: Ge,
546
- main: Ye,
547
- module: Ke,
548
- types: Qe,
549
- files: Xe,
550
- exports: et,
551
- dependencies: tt,
552
- devDependencies: _t,
553
- peerDependencies: nt
586
+ }, st = {
587
+ name: Je,
588
+ version: Ye,
589
+ type: qe,
590
+ scripts: Ke,
591
+ main: Xe,
592
+ module: et,
593
+ types: tt,
594
+ files: nt,
595
+ exports: _t,
596
+ dependencies: ot,
597
+ devDependencies: rt,
598
+ peerDependencies: it
554
599
  };
555
- function rt(e, t, _) {
600
+ function lt(e, t, n) {
556
601
  if (t.type === "chunk") {
557
- if (console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`), !t.isEntry && !_)
602
+ if (console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`), !t.isEntry && !n)
558
603
  return null;
559
604
  if (!t.isDynamicEntry)
560
605
  return {
561
- type: q.Javascript,
606
+ type: B.Javascript,
562
607
  mimeType: "text/javascript",
563
608
  preload: !t.isEntry,
564
609
  filename: e
565
610
  };
566
611
  } else if (e.endsWith(".css"))
567
612
  return {
568
- type: q.CSS,
613
+ type: B.CSS,
569
614
  mimeType: "text/css",
570
615
  filename: e
571
616
  };
572
617
  return null;
573
618
  }
574
- function ft(e) {
619
+ function vt(e) {
575
620
  const {
576
621
  autoGenerateTargetFiles: t = !0,
577
- configurationSchema: _,
578
- includePreloadChunks: n = !1,
622
+ configurationSchema: n,
623
+ includePreloadChunks: _ = !1,
579
624
  targetFiles: o
580
625
  } = e ?? {};
581
626
  return {
582
627
  name: "spiff-theme-plugin",
583
- version: ot.version,
628
+ version: st.version,
584
629
  config(i, c) {
585
630
  i.base !== void 0 && i.base !== "" && console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'), i.base = "";
586
631
  },
587
632
  writeBundle(i, c) {
588
- const s = t ? Object.keys(c).map((l) => o != null && o.some((p) => p.filename === l) ? null : rt(l, c[l], n)).filter((l) => l !== null) : [];
589
- o && s.push(...o);
590
- const a = {
633
+ const l = t ? Object.keys(c).map((s) => o != null && o.some((p) => p.filename === s) ? null : lt(s, c[s], _)).filter((s) => s !== null) : [];
634
+ o && l.push(...o);
635
+ const u = {
591
636
  launchData: {
592
- targetFiles: s
637
+ targetFiles: l
593
638
  },
594
- configurationSchema: _
639
+ configurationSchema: n
595
640
  };
596
- Ee.writeFileSync(we.join(i.dir, "spiffTheme.json"), JSON.stringify(a, void 0, 4));
641
+ De.writeFileSync($e.join(i.dir, "spiffTheme.json"), JSON.stringify(u, void 0, 4));
597
642
  }
598
643
  };
599
644
  }
600
645
  export {
601
- $e as AssetType,
602
- De as FieldType,
603
- q as ThemeFileType,
604
- at as exampleThemeInstallConfig,
605
- ut as getDefaultsForSchema,
606
- ct as setSpiffDevOptions,
607
- ft as spiffThemePlugin
646
+ Te as AssetType,
647
+ Pe as FieldType,
648
+ B as ThemeFileType,
649
+ ht as exampleThemeInstallConfig,
650
+ mt as getDefaultsForSchema,
651
+ dt as setSpiffDevOptions,
652
+ vt as spiffThemePlugin,
653
+ pt as themeInstallConfigurationGraphQlToResource,
654
+ He as themeVersionConfigurationGraphQlToResource,
655
+ ft as themeVersionGraphQlToResource
608
656
  };
@@ -1,2 +1,2 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- (function(v,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(v=typeof globalThis<"u"?globalThis:v||self,k(v.theme={},v.fs,v.path))})(this,function(v,k,w){"use strict";var Ke=Object.defineProperty;var Qe=(v,k,w)=>k in v?Ke(v,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[k]=w;var ee=(v,k,w)=>(Qe(v,typeof k!="symbol"?k+"":k,w),w);var H=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(H||{}),te=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.Number="Number",e.Select="Select",e.Text="Text",e))(te||{}),_e=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(_e||{}),N,f,ne,D,oe,re,Z,T={},ie=[],$e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function S(e,t){for(var _ in t)e[_]=t[_];return e}function le(e){var t=e.parentNode;t&&t.removeChild(e)}function Te(e,t,_){var n,o,i,c={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:c[i]=t[i];if(arguments.length>2&&(c.children=arguments.length>3?N.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return I(e,c,n,o,null)}function I(e,t,_,n,o){var i={type:e,props:t,key:_,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ne,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function j(e){return e.children}function F(e,t){this.props=e,this.context=t}function $(e,t){if(t==null)return e.__?$(e.__,e.__i+1):null;for(var _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?$(e):null}function se(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return se(e)}}function ce(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!M.__r++||oe!==f.debounceRendering)&&((oe=f.debounceRendering)||re)(M)}function M(){var e,t,_,n,o,i,c,s,u;for(D.sort(Z);e=D.shift();)e.__d&&(t=D.length,n=void 0,i=(o=(_=e).__v).__e,s=[],u=[],(c=_.__P)&&((n=S({},o)).__v=o.__v+1,f.vnode&&f.vnode(n),J(c,n,o,_.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,s,i??$(o),!!(32&o.__u),u),n.__.__k[n.__i]=n,he(s,n,u),n.__e!=i&&se(n)),D.length>t&&D.sort(Z));M.__r=0}function ue(e,t,_,n,o,i,c,s,u,l,p){var r,d,a,y,C,g=n&&n.__k||ie,h=t.length;for(_.__d=u,Pe(_,t,g),u=_.__d,r=0;r<h;r++)(a=_.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?T:g[a.__i]||T,a.__i=r,J(e,a,d,o,i,c,s,u,l,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&R(d.ref,null,a),p.push(a.ref,a.__c||y,a)),C==null&&y!=null&&(C=y),65536&a.__u||d.__k===a.__k?u=ae(a,u,e):typeof a.type=="function"&&a.__d!==void 0?u=a.__d:y&&(u=y.nextSibling),a.__d=void 0,a.__u&=-196609);_.__d=u,_.__e=C}function Pe(e,t,_){var n,o,i,c,s,u=t.length,l=_.length,p=l,r=0;for(e.__k=[],n=0;n<u;n++)(o=e.__k[n]=(o=t[n])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?I(null,o,null,null,o):z(o)?I(j,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?I(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,s=He(o,_,c=n+r,p),o.__i=s,i=null,s!==-1&&(p--,(i=_[s])&&(i.__u|=131072)),i==null||i.__v===null?(s==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):s!==c&&(s===c+1?r++:s>c?p>u-c?r+=s-c:r--:r=s<c&&s==c-1?s-c:0,s!==n+r&&(o.__u|=65536))):(i=_[n])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=$(i)),G(i,i,!1),_[n]=null,p--);if(p)for(n=0;n<l;n++)(i=_[n])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=$(i)),G(i,i))}function ae(e,t,_){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=ae(n[o],t,_));return t}return e.__e!=t&&(_.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function He(e,t,_,n){var o=e.key,i=e.type,c=_-1,s=_+1,u=t[_];if(u===null||u&&o==u.key&&i===u.type)return _;if(n>(u!=null&&!(131072&u.__u)?1:0))for(;c>=0||s<t.length;){if(c>=0){if((u=t[c])&&!(131072&u.__u)&&o==u.key&&i===u.type)return c;c--}if(s<t.length){if((u=t[s])&&!(131072&u.__u)&&o==u.key&&i===u.type)return s;s++}}return-1}function fe(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||$e.test(t)?_:_+"px"}function U(e,t,_,n,o){var i;e:if(t==="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)_&&t in _||fe(e.style,t,"");if(_)for(t in _)n&&_[t]===n[t]||fe(e.style,t,_[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=_,_?n?_.u=n.u:(_.u=Date.now(),e.addEventListener(t,i?de:pe,i)):e.removeEventListener(t,i?de:pe,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,_))}}function pe(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function de(e){return this.l[e.type+!0](f.event?f.event(e):e)}function J(e,t,_,n,o,i,c,s,u,l){var p,r,d,a,y,C,g,h,b,E,O,P,De,q,X,x=t.type;if(t.constructor!==void 0)return null;128&_.__u&&(u=!!(32&_.__u),i=[s=t.__e=_.__e]),(p=f.__b)&&p(t);e:if(typeof x=="function")try{if(h=t.props,b=(p=x.contextType)&&n[p.__c],E=p?b?b.props.value:p.__:n,_.__c?g=(r=t.__c=_.__c).__=r.__E:("prototype"in x&&x.prototype.render?t.__c=r=new x(h,E):(t.__c=r=new F(h,E),r.constructor=x,r.render=Ie),b&&b.sub(r),r.props=h,r.state||(r.state={}),r.context=E,r.__n=n,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),x.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=S({},r.__s)),S(r.__s,x.getDerivedStateFromProps(h,r.__s))),a=r.props,y=r.state,r.__v=t,d)x.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(h,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(h,r.__s,E)===!1||t.__v===_.__v)){for(t.__v!==_.__v&&(r.props=h,r.state=r.__s,r.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.forEach(function(B){B&&(B.__=t)}),O=0;O<r._sb.length;O++)r.__h.push(r._sb[O]);r._sb=[],r.__h.length&&c.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(h,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,C)})}if(r.context=E,r.props=h,r.__P=e,r.__e=!1,P=f.__r,De=0,"prototype"in x&&x.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),q=0;q<r._sb.length;q++)r.__h.push(r._sb[q]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++De<25);r.state=r.__s,r.getChildContext!=null&&(n=S(S({},n),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(C=r.getSnapshotBeforeUpdate(a,y)),ue(e,z(X=p!=null&&p.type===j&&p.key==null?p.props.children:p)?X:[X],t,_,n,o,i,c,s,u,l),r.base=t.__e,t.__u&=-161,r.__h.length&&c.push(r),g&&(r.__E=r.__=null)}catch(B){t.__v=null,u||i!=null?(t.__e=s,t.__u|=u?160:32,i[i.indexOf(s)]=null):(t.__e=_.__e,t.__k=_.__k),f.__e(B,t,_)}else i==null&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=Ne(_.__e,t,_,n,o,i,c,u,l);(p=f.diffed)&&p(t)}function he(e,t,_){t.__d=void 0;for(var n=0;n<_.length;n++)R(_[n],_[++n],_[++n]);f.__c&&f.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){f.__e(i,o.__v)}})}function Ne(e,t,_,n,o,i,c,s,u){var l,p,r,d,a,y,C,g=_.props,h=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(l=0;l<i.length;l++)if((a=i[l])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[l]=null;break}}if(e==null){if(b===null)return document.createTextNode(h);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,h.is&&h),i=null,s=!1}if(b===null)g===h||s&&e.data===h||(e.data=h);else{if(i=i&&N.call(e.childNodes),g=_.props||T,!s&&i!=null)for(g={},l=0;l<e.attributes.length;l++)g[(a=e.attributes[l]).name]=a.value;for(l in g)a=g[l],l=="children"||(l=="dangerouslySetInnerHTML"?r=a:l==="key"||l in h||U(e,l,null,a,o));for(l in h)a=h[l],l=="children"?d=a:l=="dangerouslySetInnerHTML"?p=a:l=="value"?y=a:l=="checked"?C=a:l==="key"||s&&typeof a!="function"||g[l]===a||U(e,l,a,g[l],o);if(p)s||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),ue(e,z(d)?d:[d],t,_,n,o&&b!=="foreignObject",i,c,i?i[0]:_.__k&&$(_,0),s,u),i!=null)for(l=i.length;l--;)i[l]!=null&&le(i[l]);s||(l="value",y!==void 0&&(y!==e[l]||b==="progress"&&!y||b==="option"&&y!==g[l])&&U(e,l,y,g[l],!1),l="checked",C!==void 0&&C!==e[l]&&U(e,l,C,g[l],!1))}return e}function R(e,t,_){try{typeof e=="function"?e(t):e.current=t}catch(n){f.__e(n,_)}}function G(e,t,_){var n,o;if(f.unmount&&f.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||R(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){f.__e(i,t)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&G(n[o],t,_||typeof e.type!="function");_||e.__e==null||le(e.__e),e.__=e.__e=e.__d=void 0}function Ie(e,t,_){return this.constructor(e,_)}function je(e,t,_){var n,o,i,c;f.__&&f.__(e,t),o=(n=typeof _=="function")?null:_&&_.__k||t.__k,i=[],c=[],J(t,e=(!n&&_||t).__k=Te(j,null,[e]),o||T,T,t.ownerSVGElement!==void 0,!n&&_?[_]:o?null:t.firstChild?N.call(t.childNodes):null,i,!n&&_?_:o?o.__e:t.firstChild,n,c),he(i,e,c)}N=ie.slice,f={__e:function(e,t,_,n){for(var o,i,c;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),c=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),c=o.__d),c)return o.__E=o}catch(s){e=s}throw e}},ne=0,F.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=S({},this.state),typeof e=="function"&&(e=e(S({},_),this.props)),e&&S(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),ce(this))},F.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ce(this))},F.prototype.render=j,D=[],re=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,t){return e.__v.__b-t.__v.__b},M.__r=0;var L,m,Y,me,K=0,ve=[],A=[],ye=f.__b,ge=f.__r,be=f.diffed,ke=f.__c,xe=f.unmount;function Ce(e,t){f.__h&&f.__h(m,e,K||t),K=0;var _=m.__H||(m.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({__V:A}),_.__[e]}function Fe(e){return K=1,Me(Ee,e)}function Me(e,t,_){var n=Ce(L++,2);if(n.t=e,!n.__c&&(n.__=[_?_(t):Ee(void 0,t),function(s){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,s);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=m,!m.u)){var o=function(s,u,l){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,s,u,l);var r=!1;return p.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(r=!0)}}),!(!r&&n.__c.props===s)&&(!i||i.call(this,s,u,l))};m.u=!0;var i=m.shouldComponentUpdate,c=m.componentWillUpdate;m.componentWillUpdate=function(s,u,l){if(this.__e){var p=i;i=void 0,o(s,u,l),i=p}c&&c.call(this,s,u,l)},m.shouldComponentUpdate=o}return n.__N||n.__}function Ue(e,t){var _=Ce(L++,3);!f.__s&&Ve(_.__H,t)&&(_.__=e,_.i=t,m.__H.__h.push(_))}function Le(){for(var e;e=ve.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(V),e.__H.__h.forEach(Q),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){m=null,ye&&ye(e)},f.__r=function(e){ge&&ge(e),L=0;var t=(m=e.__c).__H;t&&(Y===m?(t.__h=[],m.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.__V=A,_.__N=_.i=void 0})):(t.__h.forEach(V),t.__h.forEach(Q),t.__h=[],L=0)),Y=m},f.diffed=function(e){be&&be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ve.push(t)!==1&&me===f.requestAnimationFrame||((me=f.requestAnimationFrame)||Ae)(Le)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.__V!==A&&(_.__=_.__V),_.i=void 0,_.__V=A})),Y=m=null},f.__c=function(e,t){t.some(function(_){try{_.__h.forEach(V),_.__h=_.__h.filter(function(n){return!n.__||Q(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(n,_.__v)}}),ke&&ke(e,t)},f.unmount=function(e){xe&&xe(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(n){try{V(n)}catch(o){t=o}}),_.__H=void 0,t&&f.__e(t,_.__v))};var Se=typeof requestAnimationFrame=="function";function Ae(e){var t,_=function(){clearTimeout(n),Se&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(_,100);Se&&(t=requestAnimationFrame(_))}function V(e){var t=m,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),m=t}function Q(e){var t=m;e.__c=e.__(),m=t}function Ve(e,t){return!e||e.length!==t.length||t.some(function(_,n){return _!==e[n]})}function Ee(e,t){return typeof t=="function"?t(e):t}var We=0;function we(e,t,_,n,o,i){var c,s,u={};for(s in t)s=="ref"?c=t[s]:u[s]=t[s];var l={type:e,props:u,key:_,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--We,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(c=e.defaultProps))for(s in c)u[s]===void 0&&(u[s]=c[s]);return f.vnode&&f.vnode(l),l}class Oe{constructor(){ee(this,"_context");ee(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(_=>_(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let W;const qe=({context:e})=>{const[t,_]=Fe(null);return Ue(()=>{if(t){if(W===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");W.setContext({...e,container:t})}},[t,e]),we("div",{ref:_,id:"spiffThemeWrapper"})};function Be(e,t){W=new Oe,window.SpiffThemeLoader=W;let _;typeof e=="string"?_=document.getElementById(e):_=e,je(we(qe,{context:t}),_)}function Ze(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const ze=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function Je(e,...t){return e.fields.filter(_=>!_.key||!t.includes(_.key)).map(_=>({key:_.key,fallbackToDefaultConfiguration:!1,value:ze(_),type:_.type,asset:void 0}))}const Re={name:"@spiffcommerce/theme-bridge",version:"1.12.2-0",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function Ge(e,t,_){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!_)return null;if(!t.isDynamicEntry)return{type:H.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:H.CSS,mimeType:"text/css",filename:e};return null}function Ye(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:_,includePreloadChunks:n=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:Re.version,config(i,c){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,c){const s=t?Object.keys(c).map(l=>o!=null&&o.some(p=>p.filename===l)?null:Ge(l,c[l],n)).filter(l=>l!==null):[];o&&s.push(...o);const u={launchData:{targetFiles:s},configurationSchema:_};k.writeFileSync(w.join(i.dir,"spiffTheme.json"),JSON.stringify(u,void 0,4))}}}v.AssetType=_e,v.FieldType=te,v.ThemeFileType=H,v.exampleThemeInstallConfig=Ze,v.getDefaultsForSchema=Je,v.setSpiffDevOptions=Be,v.spiffThemePlugin=Ye,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
2
+ (function(h,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(h=typeof globalThis<"u"?globalThis:h||self,k(h.theme={},h.fs,h.path))})(this,function(h,k,w){"use strict";var nt=Object.defineProperty;var _t=(h,k,w)=>k in h?nt(h,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):h[k]=w;var ne=(h,k,w)=>(_t(h,typeof k!="symbol"?k+"":k,w),w);var H=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(H||{}),_e=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.List="List",e.Number="Number",e.Object="Object",e.Select="Select",e.Text="Text",e))(_e||{}),oe=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(oe||{});function B(e,t){const n={...e,items:void 0,fields:void 0};return e.items!==void 0&&(n.items=B(t[e.items],t)),e.fields!==void 0&&(n.fields=e.fields.map(_=>B(t[_],t))),n}function re(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(B(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeVersionConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeConfigurationSchemaField");return t.fields=n,t}function He(e){return{...e,configurationSchema:re(e.configurationSchema)}}function Q(e,t){const n={...e,listValues:void 0,objectValues:void 0};return e.listValues!==void 0&&(n.listValues=e.listValues.map(_=>Q(t[_],t))),e.objectValues!==void 0&&(n.objectValues=e.objectValues.map(_=>Q(t[_],t))),n}function Ve(e){const t={...e,fields:[]},n=[];if(e.fields.forEach(_=>{_.root&&n.push(Q(_,e.fields))}),e.fields.length>0&&n.length===0)throw new Error("Failed to map ThemeInstallConfiguration GraphQL type to Resource type. Please ensure you've selected the `root` field on ThemeInstallConfigurationField");return t.fields=n,t}var V,f,ie,T,se,le,Z,$={},ce=[],Ie=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function ue(e){var t=e.parentNode;t&&t.removeChild(e)}function je(e,t,n){var _,o,i,c={};for(i in t)i=="key"?_=t[i]:i=="ref"?o=t[i]:c[i]=t[i];if(arguments.length>2&&(c.children=arguments.length>3?V.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return I(e,c,_,o,null)}function I(e,t,n,_,o){var i={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ie,__i:-1,__u:0};return o==null&&f.vnode!=null&&f.vnode(i),i}function j(e){return e.children}function N(e,t){this.props=e,this.context=t}function D(e,t){if(t==null)return e.__?D(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?D(e):null}function ae(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return ae(e)}}function fe(e){(!e.__d&&(e.__d=!0)&&T.push(e)&&!L.__r++||se!==f.debounceRendering)&&((se=f.debounceRendering)||le)(L)}function L(){var e,t,n,_,o,i,c,l,u;for(T.sort(Z);e=T.shift();)e.__d&&(t=T.length,_=void 0,i=(o=(n=e).__v).__e,l=[],u=[],(c=n.__P)&&((_=x({},o)).__v=o.__v+1,f.vnode&&f.vnode(_),J(c,_,o,n.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??D(o),!!(32&o.__u),u),_.__.__k[_.__i]=_,ye(l,_,u),_.__e!=i&&ae(_)),T.length>t&&T.sort(Z));L.__r=0}function pe(e,t,n,_,o,i,c,l,u,s,p){var r,d,a,y,S,g=_&&_.__k||ce,m=t.length;for(n.__d=u,Ne(n,t,g),u=n.__d,r=0;r<m;r++)(a=n.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?$:g[a.__i]||$,a.__i=r,J(e,a,d,o,i,c,l,u,s,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&q(d.ref,null,a),p.push(a.ref,a.__c||y,a)),S==null&&y!=null&&(S=y),65536&a.__u||d.__k===a.__k?u=de(a,u,e):typeof a.type=="function"&&a.__d!==void 0?u=a.__d:y&&(u=y.nextSibling),a.__d=void 0,a.__u&=-196609);n.__d=u,n.__e=S}function Ne(e,t,n){var _,o,i,c,l,u=t.length,s=n.length,p=s,r=0;for(e.__k=[],_=0;_<u;_++)(o=e.__k[_]=(o=t[_])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?I(null,o,null,null,o):z(o)?I(j,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?I(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=Le(o,n,c=_+r,p),o.__i=l,i=null,l!==-1&&(p--,(i=n[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):l!==c&&(l===c+1?r++:l>c?p>u-c?r+=l-c:r--:r=l<c&&l==c-1?l-c:0,l!==_+r&&(o.__u|=65536))):(i=n[_])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=D(i)),Y(i,i,!1),n[_]=null,p--);if(p)for(_=0;_<s;_++)(i=n[_])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=D(i)),Y(i,i))}function de(e,t,n){var _,o;if(typeof e.type=="function"){for(_=e.__k,o=0;_&&o<_.length;o++)_[o]&&(_[o].__=e,t=de(_[o],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Le(e,t,n,_){var o=e.key,i=e.type,c=n-1,l=n+1,u=t[n];if(u===null||u&&o==u.key&&i===u.type)return n;if(_>(u!=null&&!(131072&u.__u)?1:0))for(;c>=0||l<t.length;){if(c>=0){if((u=t[c])&&!(131072&u.__u)&&o==u.key&&i===u.type)return c;c--}if(l<t.length){if((u=t[l])&&!(131072&u.__u)&&o==u.key&&i===u.type)return l;l++}}return-1}function he(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ie.test(t)?n:n+"px"}function F(e,t,n,_,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof _=="string"&&(e.style.cssText=_=""),_)for(t in _)n&&t in n||he(e.style,t,"");if(n)for(t in n)_&&n[t]===_[t]||he(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?_?n.u=_.u:(n.u=Date.now(),e.addEventListener(t,i?ve:me,i)):e.removeEventListener(t,i?ve:me,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function me(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(f.event?f.event(e):e)}function ve(e){return this.l[e.type+!0](f.event?f.event(e):e)}function J(e,t,n,_,o,i,c,l,u,s){var p,r,d,a,y,S,g,m,b,E,W,P,Pe,O,te,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),i=[l=t.__e=n.__e]),(p=f.__b)&&p(t);e:if(typeof C=="function")try{if(m=t.props,b=(p=C.contextType)&&_[p.__c],E=p?b?b.props.value:p.__:_,n.__c?g=(r=t.__c=n.__c).__=r.__E:("prototype"in C&&C.prototype.render?t.__c=r=new C(m,E):(t.__c=r=new N(m,E),r.constructor=C,r.render=Me),b&&b.sub(r),r.props=m,r.state||(r.state={}),r.context=E,r.__n=_,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),C.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=x({},r.__s)),x(r.__s,C.getDerivedStateFromProps(m,r.__s))),a=r.props,y=r.state,r.__v=t,d)C.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(C.getDerivedStateFromProps==null&&m!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(m,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(m,r.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(r.props=m,r.state=r.__s,r.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(G){G&&(G.__=t)}),W=0;W<r._sb.length;W++)r.__h.push(r._sb[W]);r._sb=[],r.__h.length&&c.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(m,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,S)})}if(r.context=E,r.props=m,r.__P=e,r.__e=!1,P=f.__r,Pe=0,"prototype"in C&&C.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),O=0;O<r._sb.length;O++)r.__h.push(r._sb[O]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Pe<25);r.state=r.__s,r.getChildContext!=null&&(_=x(x({},_),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(S=r.getSnapshotBeforeUpdate(a,y)),pe(e,z(te=p!=null&&p.type===j&&p.key==null?p.props.children:p)?te:[te],t,n,_,o,i,c,l,u,s),r.base=t.__e,t.__u&=-161,r.__h.length&&c.push(r),g&&(r.__E=r.__=null)}catch(G){t.__v=null,u||i!=null?(t.__e=l,t.__u|=u?160:32,i[i.indexOf(l)]=null):(t.__e=n.__e,t.__k=n.__k),f.__e(G,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Fe(n.__e,t,n,_,o,i,c,u,s);(p=f.diffed)&&p(t)}function ye(e,t,n){t.__d=void 0;for(var _=0;_<n.length;_++)q(n[_],n[++_],n[++_]);f.__c&&f.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){f.__e(i,o.__v)}})}function Fe(e,t,n,_,o,i,c,l,u){var s,p,r,d,a,y,S,g=n.props,m=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(s=0;s<i.length;s++)if((a=i[s])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(m);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,m.is&&m),i=null,l=!1}if(b===null)g===m||l&&e.data===m||(e.data=m);else{if(i=i&&V.call(e.childNodes),g=n.props||$,!l&&i!=null)for(g={},s=0;s<e.attributes.length;s++)g[(a=e.attributes[s]).name]=a.value;for(s in g)a=g[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=a:s==="key"||s in m||F(e,s,null,a,o));for(s in m)a=m[s],s=="children"?d=a:s=="dangerouslySetInnerHTML"?p=a:s=="value"?y=a:s=="checked"?S=a:s==="key"||l&&typeof a!="function"||g[s]===a||F(e,s,a,g[s],o);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),pe(e,z(d)?d:[d],t,n,_,o&&b!=="foreignObject",i,c,i?i[0]:n.__k&&D(n,0),l,u),i!=null)for(s=i.length;s--;)i[s]!=null&&ue(i[s]);l||(s="value",y!==void 0&&(y!==e[s]||b==="progress"&&!y||b==="option"&&y!==g[s])&&F(e,s,y,g[s],!1),s="checked",S!==void 0&&S!==e[s]&&F(e,s,S,g[s],!1))}return e}function q(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(_){f.__e(_,n)}}function Y(e,t,n){var _,o;if(f.unmount&&f.unmount(e),(_=e.ref)&&(_.current&&_.current!==e.__e||q(_,null,t)),(_=e.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(i){f.__e(i,t)}_.base=_.__P=null,e.__c=void 0}if(_=e.__k)for(o=0;o<_.length;o++)_[o]&&Y(_[o],t,n||typeof e.type!="function");n||e.__e==null||ue(e.__e),e.__=e.__e=e.__d=void 0}function Me(e,t,n){return this.constructor(e,n)}function Ue(e,t,n){var _,o,i,c;f.__&&f.__(e,t),o=(_=typeof n=="function")?null:n&&n.__k||t.__k,i=[],c=[],J(t,e=(!_&&n||t).__k=je(j,null,[e]),o||$,$,t.ownerSVGElement!==void 0,!_&&n?[n]:o?null:t.firstChild?V.call(t.childNodes):null,i,!_&&n?n:o?o.__e:t.firstChild,_,c),ye(i,e,c)}V=ce.slice,f={__e:function(e,t,n,_){for(var o,i,c;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),c=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),c=o.__d),c)return o.__E=o}catch(l){e=l}throw e}},ie=0,N.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=x({},this.state),typeof e=="function"&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),fe(this))},N.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),fe(this))},N.prototype.render=j,T=[],le=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,t){return e.__v.__b-t.__v.__b},L.__r=0;var M,v,K,ge,X=0,be=[],U=[],ke=f.__b,Ce=f.__r,Se=f.diffed,xe=f.__c,Ee=f.unmount;function we(e,t){f.__h&&f.__h(v,e,X||t),X=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:U}),n.__[e]}function Re(e){return X=1,Ae(De,e)}function Ae(e,t,n){var _=we(M++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):De(void 0,t),function(l){var u=_.__N?_.__N[0]:_.__[0],s=_.t(u,l);u!==s&&(_.__N=[s,_.__[1]],_.__c.setState({}))}],_.__c=v,!v.u)){var o=function(l,u,s){if(!_.__c.__H)return!0;var p=_.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,l,u,s);var r=!1;return p.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(r=!0)}}),!(!r&&_.__c.props===l)&&(!i||i.call(this,l,u,s))};v.u=!0;var i=v.shouldComponentUpdate,c=v.componentWillUpdate;v.componentWillUpdate=function(l,u,s){if(this.__e){var p=i;i=void 0,o(l,u,s),i=p}c&&c.call(this,l,u,s)},v.shouldComponentUpdate=o}return _.__N||_.__}function We(e,t){var n=we(M++,3);!f.__s&&Be(n.__H,t)&&(n.__=e,n.i=t,v.__H.__h.push(n))}function Oe(){for(var e;e=be.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(R),e.__H.__h.forEach(ee),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){v=null,ke&&ke(e)},f.__r=function(e){Ce&&Ce(e),M=0;var t=(v=e.__c).__H;t&&(K===v?(t.__h=[],v.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=U,n.__N=n.i=void 0})):(t.__h.forEach(R),t.__h.forEach(ee),t.__h=[],M=0)),K=v},f.diffed=function(e){Se&&Se(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(be.push(t)!==1&&ge===f.requestAnimationFrame||((ge=f.requestAnimationFrame)||Ge)(Oe)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==U&&(n.__=n.__V),n.i=void 0,n.__V=U})),K=v=null},f.__c=function(e,t){t.some(function(n){try{n.__h.forEach(R),n.__h=n.__h.filter(function(_){return!_.__||ee(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],f.__e(_,n.__v)}}),xe&&xe(e,t)},f.unmount=function(e){Ee&&Ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{R(_)}catch(o){t=o}}),n.__H=void 0,t&&f.__e(t,n.__v))};var Te=typeof requestAnimationFrame=="function";function Ge(e){var t,n=function(){clearTimeout(_),Te&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);Te&&(t=requestAnimationFrame(n))}function R(e){var t=v,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),v=t}function ee(e){var t=v;e.__c=e.__(),v=t}function Be(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function De(e,t){return typeof t=="function"?t(e):t}var Qe=0;function $e(e,t,n,_,o,i){var c,l,u={};for(l in t)l=="ref"?c=t[l]:u[l]=t[l];var s={type:e,props:u,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Qe,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(c=e.defaultProps))for(l in c)u[l]===void 0&&(u[l]=c[l]);return f.vnode&&f.vnode(s),s}class Ze{constructor(){ne(this,"_context");ne(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(n=>n(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}navigateToCustomerPortal(){console.log("Navigating to customer portal")}}let A;const ze=({context:e})=>{const[t,n]=Re(null);return We(()=>{if(t){if(A===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");A.setContext({...e,container:t})}},[t,e]),$e("div",{ref:n,id:"spiffThemeWrapper"})};function Je(e,t){A=new Ze,window.SpiffThemeLoader=A;let n;typeof e=="string"?n=document.getElementById(e):n=e,Ue($e(ze,{context:t}),n)}function qe(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const Ye=e=>{if(Object.keys(e).includes("defaultValue"))return e.defaultValue};function Ke(e,...t){return e.fields.filter(n=>!n.key||!t.includes(n.key)).map(n=>({key:n.key,fallbackToDefaultConfiguration:!1,value:Ye(n),type:n.type,asset:void 0}))}const Xe={name:"@spiffcommerce/theme-bridge",version:"1.14.1",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^21.0.1","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"},peerDependencies:{"@spiffcommerce/core":"^21.0.1"}};function et(e,t,n){if(t.type==="chunk"){if(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),!t.isEntry&&!n)return null;if(!t.isDynamicEntry)return{type:H.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:H.CSS,mimeType:"text/css",filename:e};return null}function tt(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:n,includePreloadChunks:_=!1,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:Xe.version,config(i,c){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,c){const l=t?Object.keys(c).map(s=>o!=null&&o.some(p=>p.filename===s)?null:et(s,c[s],_)).filter(s=>s!==null):[];o&&l.push(...o);const u={launchData:{targetFiles:l},configurationSchema:n};k.writeFileSync(w.join(i.dir,"spiffTheme.json"),JSON.stringify(u,void 0,4))}}}h.AssetType=oe,h.FieldType=_e,h.ThemeFileType=H,h.exampleThemeInstallConfig=qe,h.getDefaultsForSchema=Ke,h.setSpiffDevOptions=Je,h.spiffThemePlugin=tt,h.themeInstallConfigurationGraphQlToResource=Ve,h.themeVersionConfigurationGraphQlToResource=re,h.themeVersionGraphQlToResource=He,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/theme-bridge",
3
- "version": "1.13.0",
3
+ "version": "1.14.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "tsc && vite build",