@spscommerce/ds-web-components 6.37.3 → 7.0.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/lib/index.es.js CHANGED
@@ -1,7 +1,10 @@
1
- import { noI18nI18n, SpsIcon, SpsInsightCardKind, SpsInsightCardIcons } from "@spscommerce/ds-shared";
2
- import { parseFileSize, code } from "@spscommerce/utils";
3
- var incrementalDomCjs = {};
4
- Object.defineProperty(incrementalDomCjs, "__esModule", { value: true });
1
+ var it = Object.defineProperty;
2
+ var rt = (e, t, s) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var a = (e, t, s) => (rt(e, typeof t != "symbol" ? t + "" : t, s), s);
4
+ import { noI18nI18n as at, SpsIcon as Se, SpsInsightCardKind as ot, SpsInsightCardIcons as lt } from "@spscommerce/ds-shared";
5
+ import { code as c, parseFileSize as ct } from "@spscommerce/utils";
6
+ var d = {};
7
+ Object.defineProperty(d, "__esModule", { value: !0 });
5
8
  /**
6
9
  * @license
7
10
  * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
@@ -18,7 +21,7 @@ Object.defineProperty(incrementalDomCjs, "__esModule", { value: true });
18
21
  * See the License for the specific language governing permissions and
19
22
  * limitations under the License.
20
23
  */
21
- var symbols = {
24
+ var fe = {
22
25
  default: "__default"
23
26
  };
24
27
  /**
@@ -37,20 +40,19 @@ var symbols = {
37
40
  * See the License for the specific language governing permissions and
38
41
  * limitations under the License.
39
42
  */
40
- var hasOwnProperty = Object.prototype.hasOwnProperty;
41
- function Blank() {
43
+ var pt = Object.prototype.hasOwnProperty;
44
+ function ke() {
42
45
  }
43
- Blank.prototype = Object.create(null);
44
- function has(map, property) {
45
- return hasOwnProperty.call(map, property);
46
+ ke.prototype = /* @__PURE__ */ Object.create(null);
47
+ function dt(e, t) {
48
+ return pt.call(e, t);
46
49
  }
47
- function createMap() {
48
- return new Blank();
50
+ function Le() {
51
+ return new ke();
49
52
  }
50
- function truncateArray(arr, length) {
51
- while (arr.length > length) {
52
- arr.pop();
53
- }
53
+ function ge(e, t) {
54
+ for (; e.length > t; )
55
+ e.pop();
54
56
  }
55
57
  /**
56
58
  * @license
@@ -68,64 +70,46 @@ function truncateArray(arr, length) {
68
70
  * See the License for the specific language governing permissions and
69
71
  * limitations under the License.
70
72
  */
71
- function getNamespace(name) {
72
- if (name.lastIndexOf("xml:", 0) === 0) {
73
+ function ht(e) {
74
+ if (e.lastIndexOf("xml:", 0) === 0)
73
75
  return "http://www.w3.org/XML/1998/namespace";
74
- }
75
- if (name.lastIndexOf("xlink:", 0) === 0) {
76
+ if (e.lastIndexOf("xlink:", 0) === 0)
76
77
  return "http://www.w3.org/1999/xlink";
77
- }
78
- return void 0;
79
- }
80
- function applyAttr(el, name, value) {
81
- if (value == null) {
82
- el.removeAttribute(name);
83
- } else {
84
- var attrNS = getNamespace(name);
85
- if (attrNS) {
86
- el.setAttributeNS(attrNS, name, String(value));
87
- } else {
88
- el.setAttribute(name, String(value));
89
- }
78
+ }
79
+ function Fe(e, t, s) {
80
+ if (s == null)
81
+ e.removeAttribute(t);
82
+ else {
83
+ var n = ht(t);
84
+ n ? e.setAttributeNS(n, t, String(s)) : e.setAttribute(t, String(s));
90
85
  }
91
86
  }
92
- function applyProp(el, name, value) {
93
- el[name] = value;
87
+ function Re(e, t, s) {
88
+ e[t] = s;
94
89
  }
95
- function setStyleValue(style, prop, value) {
96
- if (prop.indexOf("-") >= 0) {
97
- style.setProperty(prop, value);
98
- } else {
99
- style[prop] = value;
100
- }
90
+ function ut(e, t, s) {
91
+ t.indexOf("-") >= 0 ? e.setProperty(t, s) : e[t] = s;
101
92
  }
102
- function applyStyle(el, name, style) {
103
- if (typeof style === "string") {
104
- el.style.cssText = style;
105
- } else {
106
- el.style.cssText = "";
107
- var elStyle = el.style;
108
- for (var prop in style) {
109
- if (has(style, prop)) {
110
- setStyleValue(elStyle, prop, style[prop]);
111
- }
112
- }
93
+ function ft(e, t, s) {
94
+ if (typeof s == "string")
95
+ e.style.cssText = s;
96
+ else {
97
+ e.style.cssText = "";
98
+ var n = e.style;
99
+ for (var i in s)
100
+ dt(s, i) && ut(n, i, s[i]);
113
101
  }
114
102
  }
115
- function applyAttributeTyped(el, name, value) {
116
- var type = typeof value;
117
- if (type === "object" || type === "function") {
118
- applyProp(el, name, value);
119
- } else {
120
- applyAttr(el, name, value);
121
- }
103
+ function gt(e, t, s) {
104
+ var n = typeof s;
105
+ n === "object" || n === "function" ? Re(e, t, s) : Fe(e, t, s);
122
106
  }
123
- var attributes = createMap();
124
- attributes[symbols.default] = applyAttributeTyped;
125
- attributes["style"] = applyStyle;
126
- function updateAttribute(el, name, value) {
127
- var mutator = attributes[name] || attributes[symbols.default];
128
- mutator(el, name, value);
107
+ var W = Le();
108
+ W[fe.default] = gt;
109
+ W.style = ft;
110
+ function z(e, t, s) {
111
+ var n = W[t] || W[fe.default];
112
+ n(e, t, s);
129
113
  }
130
114
  /**
131
115
  * @license
@@ -143,46 +127,65 @@ function updateAttribute(el, name, value) {
143
127
  * See the License for the specific language governing permissions and
144
128
  * limitations under the License.
145
129
  */
146
- var inAttributes = false;
147
- function assertNoUnclosedTags(openElement, root) {
148
- if (openElement === root) {
149
- return;
150
- }
151
- var currentElement2 = openElement;
152
- var openTags = [];
153
- while (currentElement2 && currentElement2 !== root) {
154
- openTags.push(currentElement2.nodeName.toLowerCase());
155
- currentElement2 = currentElement2.parentNode;
156
- }
157
- throw new Error("One or more tags were not closed:\n" + openTags.join("\n"));
130
+ var H = !1, oe = !1;
131
+ function Be(e, t) {
132
+ if (!t)
133
+ throw new Error("Cannot call " + e + "() unless in patch.");
158
134
  }
159
- function assertPatchOuterHasParentNode(parent) {
160
- if (!parent) {
161
- console.warn("patchOuter requires the node have a parent if there is a key.");
135
+ function mt(e, t) {
136
+ if (e !== t) {
137
+ for (var s = e, n = []; s && s !== t; )
138
+ n.push(s.nodeName.toLowerCase()), s = s.parentNode;
139
+ throw new Error(`One or more tags were not closed:
140
+ ` + n.join(`
141
+ `));
162
142
  }
163
143
  }
164
- function assertVirtualAttributesClosed() {
165
- if (inAttributes) {
144
+ function vt(e) {
145
+ e || console.warn("patchOuter requires the node have a parent if there is a key.");
146
+ }
147
+ function B(e) {
148
+ if (H)
149
+ throw new Error(e + "() can not be called between elementOpenStart() and elementOpenEnd().");
150
+ }
151
+ function $e(e) {
152
+ if (oe)
153
+ throw new Error(e + "() may not be called inside an element that has called skip().");
154
+ }
155
+ function me(e) {
156
+ if (!H)
157
+ throw new Error(e + "() can only be called after calling elementOpenStart().");
158
+ }
159
+ function bt() {
160
+ if (H)
166
161
  throw new Error("elementOpenEnd() must be called after calling elementOpenStart().");
167
- }
168
162
  }
169
- function assertPatchElementNoExtras(maybeStartNode, maybeCurrentNode, expectedNextNode, expectedPrevNode) {
170
- var startNode = maybeStartNode;
171
- var currentNode2 = maybeCurrentNode;
172
- var wasUpdated = currentNode2.nextSibling === expectedNextNode && currentNode2.previousSibling === expectedPrevNode;
173
- var wasChanged = currentNode2.nextSibling === startNode.nextSibling && currentNode2.previousSibling === expectedPrevNode;
174
- var wasRemoved = currentNode2 === startNode;
175
- if (!wasUpdated && !wasChanged && !wasRemoved) {
163
+ function Ct(e, t) {
164
+ if (e !== t)
165
+ throw new Error('Received a call to close "' + t + '" but "' + e + '" was open.');
166
+ }
167
+ function wt(e, t) {
168
+ if (t !== null)
169
+ throw new Error(e + "() must come before any child declarations inside the current element.");
170
+ }
171
+ function _t(e, t, s, n) {
172
+ se(e);
173
+ var i = e, r = t, l = r.nextSibling === s && r.previousSibling === n, h = r.nextSibling === i.nextSibling && r.previousSibling === n, C = r === i;
174
+ if (!l && !h && !C)
176
175
  throw new Error("There must be exactly one top level call corresponding to the patched element.");
177
- }
178
176
  }
179
- function setInAttributes(value) {
180
- var previous = inAttributes;
181
- inAttributes = value;
182
- return previous;
177
+ function M(e) {
178
+ var t = H;
179
+ return H = e, t;
180
+ }
181
+ function ee(e) {
182
+ var t = oe;
183
+ return oe = e, t;
183
184
  }
184
- function assert(val) {
185
- return val;
185
+ function se(e) {
186
+ if (process.env.NODE_ENV !== "production" && !e)
187
+ throw new Error("Expected value to be defined");
188
+ return e;
186
189
  }
187
190
  /**
188
191
  * @license
@@ -200,7 +203,7 @@ function assert(val) {
200
203
  * See the License for the specific language governing permissions and
201
204
  * limitations under the License.
202
205
  */
203
- var notifications = {
206
+ var U = {
204
207
  nodesCreated: null,
205
208
  nodesDeleted: null
206
209
  };
@@ -220,26 +223,17 @@ var notifications = {
220
223
  * See the License for the specific language governing permissions and
221
224
  * limitations under the License.
222
225
  */
223
- var Context = function() {
224
- function Context2() {
225
- this.created = [];
226
- this.deleted = [];
227
- }
228
- Context2.prototype.markCreated = function(node) {
229
- this.created.push(node);
230
- };
231
- Context2.prototype.markDeleted = function(node) {
232
- this.deleted.push(node);
233
- };
234
- Context2.prototype.notifyChanges = function() {
235
- if (notifications.nodesCreated && this.created.length > 0) {
236
- notifications.nodesCreated(this.created);
237
- }
238
- if (notifications.nodesDeleted && this.deleted.length > 0) {
239
- notifications.nodesDeleted(this.deleted);
240
- }
241
- };
242
- return Context2;
226
+ var Nt = function() {
227
+ function e() {
228
+ this.created = [], this.deleted = [];
229
+ }
230
+ return e.prototype.markCreated = function(t) {
231
+ this.created.push(t);
232
+ }, e.prototype.markDeleted = function(t) {
233
+ this.deleted.push(t);
234
+ }, e.prototype.notifyChanges = function() {
235
+ U.nodesCreated && this.created.length > 0 && U.nodesCreated(this.created), U.nodesDeleted && this.deleted.length > 0 && U.nodesDeleted(this.deleted);
236
+ }, e;
243
237
  }();
244
238
  /**
245
239
  * @license
@@ -257,52 +251,39 @@ var Context = function() {
257
251
  * See the License for the specific language governing permissions and
258
252
  * limitations under the License.
259
253
  */
260
- function isDocumentRoot(node) {
261
- return node.nodeType === 11 || node.nodeType === 9;
262
- }
263
- function isElement(node) {
264
- return node.nodeType === 1;
265
- }
266
- function isText(node) {
267
- return node.nodeType === 3;
268
- }
269
- function getAncestry(node, root) {
270
- var ancestry = [];
271
- var cur = node;
272
- while (cur !== root) {
273
- var n = cur;
274
- ancestry.push(n);
275
- cur = n.parentNode;
276
- }
277
- return ancestry;
278
- }
279
- var getRootNode = Node.prototype.getRootNode || function() {
280
- var cur = this;
281
- var prev = cur;
282
- while (cur) {
283
- prev = cur;
284
- cur = cur.parentNode;
254
+ function xt(e) {
255
+ return e.nodeType === 11 || e.nodeType === 9;
256
+ }
257
+ function ae(e) {
258
+ return e.nodeType === 1;
259
+ }
260
+ function yt(e) {
261
+ return e.nodeType === 3;
262
+ }
263
+ function St(e, t) {
264
+ for (var s = [], n = e; n !== t; ) {
265
+ var i = n;
266
+ s.push(i), n = i.parentNode;
285
267
  }
286
- return prev;
268
+ return s;
269
+ }
270
+ var Ot = Node.prototype.getRootNode || function() {
271
+ for (var e = this, t = e; e; )
272
+ t = e, e = e.parentNode;
273
+ return t;
287
274
  };
288
- function getActiveElement(node) {
289
- var root = getRootNode.call(node);
290
- return isDocumentRoot(root) ? root.activeElement : null;
291
- }
292
- function getFocusedPath(node, root) {
293
- var activeElement = getActiveElement(node);
294
- if (!activeElement || !node.contains(activeElement)) {
295
- return [];
296
- }
297
- return getAncestry(activeElement, root);
298
- }
299
- function moveBefore(parentNode, node, referenceNode) {
300
- var insertReferenceNode = node.nextSibling;
301
- var cur = referenceNode;
302
- while (cur !== null && cur !== node) {
303
- var next = cur.nextSibling;
304
- parentNode.insertBefore(cur, insertReferenceNode);
305
- cur = next;
275
+ function At(e) {
276
+ var t = Ot.call(e);
277
+ return xt(t) ? t.activeElement : null;
278
+ }
279
+ function Dt(e, t) {
280
+ var s = At(e);
281
+ return !s || !e.contains(s) ? [] : St(s, t);
282
+ }
283
+ function Pt(e, t, s) {
284
+ for (var n = t.nextSibling, i = s; i !== null && i !== t; ) {
285
+ var r = i.nextSibling;
286
+ e.insertBefore(i, n), i = r;
306
287
  }
307
288
  }
308
289
  /**
@@ -321,77 +302,53 @@ function moveBefore(parentNode, node, referenceNode) {
321
302
  * See the License for the specific language governing permissions and
322
303
  * limitations under the License.
323
304
  */
324
- var NodeData = function() {
325
- function NodeData2(nameOrCtor, key2, text2) {
326
- this._attrsArr = null;
327
- this.staticsApplied = false;
328
- this.nameOrCtor = nameOrCtor;
329
- this.key = key2;
330
- this.text = text2;
331
- }
332
- NodeData2.prototype.hasEmptyAttrsArr = function() {
333
- var attrs = this._attrsArr;
334
- return !attrs || !attrs.length;
335
- };
336
- NodeData2.prototype.getAttrsArr = function(length) {
337
- return this._attrsArr || (this._attrsArr = new Array(length));
338
- };
339
- return NodeData2;
305
+ var Et = function() {
306
+ function e(t, s, n) {
307
+ this._attrsArr = null, this.staticsApplied = !1, this.nameOrCtor = t, this.key = s, this.text = n;
308
+ }
309
+ return e.prototype.hasEmptyAttrsArr = function() {
310
+ var t = this._attrsArr;
311
+ return !t || !t.length;
312
+ }, e.prototype.getAttrsArr = function(t) {
313
+ return this._attrsArr || (this._attrsArr = new Array(t));
314
+ }, e;
340
315
  }();
341
- function initData(node, nameOrCtor, key2, text2) {
342
- var data = new NodeData(nameOrCtor, key2, text2);
343
- node["__incrementalDOMData"] = data;
344
- return data;
316
+ function ve(e, t, s, n) {
317
+ var i = new Et(t, s, n);
318
+ return e.__incrementalDOMData = i, i;
345
319
  }
346
- function getData(node, key2) {
347
- return importSingleNode(node, key2);
320
+ function $(e, t) {
321
+ return Te(e, t);
348
322
  }
349
- function isDataInitialized(node) {
350
- return Boolean(node["__incrementalDOMData"]);
323
+ function It(e) {
324
+ return Boolean(e.__incrementalDOMData);
351
325
  }
352
- function getKey(node) {
353
- assert(node["__incrementalDOMData"]);
354
- return getData(node).key;
326
+ function kt(e) {
327
+ return se(e.__incrementalDOMData), $(e).key;
355
328
  }
356
- function importSingleNode(node, fallbackKey) {
357
- if (node["__incrementalDOMData"]) {
358
- return node["__incrementalDOMData"];
359
- }
360
- var nodeName = isElement(node) ? node.localName : node.nodeName;
361
- var key2 = isElement(node) ? node.getAttribute("key") || fallbackKey : null;
362
- var text2 = isText(node) ? node.data : void 0;
363
- var data = initData(node, nodeName, key2, text2);
364
- if (isElement(node)) {
365
- recordAttributes(node, data);
366
- }
367
- return data;
329
+ function Te(e, t) {
330
+ if (e.__incrementalDOMData)
331
+ return e.__incrementalDOMData;
332
+ var s = ae(e) ? e.localName : e.nodeName, n = ae(e) ? e.getAttribute("key") || t : null, i = yt(e) ? e.data : void 0, r = ve(e, s, n, i);
333
+ return ae(e) && Lt(e, r), r;
368
334
  }
369
- function importNode(node) {
370
- importSingleNode(node);
371
- for (var child = node.firstChild; child; child = child.nextSibling) {
372
- importNode(child);
373
- }
335
+ function je(e) {
336
+ Te(e);
337
+ for (var t = e.firstChild; t; t = t.nextSibling)
338
+ je(t);
374
339
  }
375
- function clearCache(node) {
376
- node["__incrementalDOMData"] = null;
377
- for (var child = node.firstChild; child; child = child.nextSibling) {
378
- clearCache(child);
379
- }
340
+ function Ue(e) {
341
+ e.__incrementalDOMData = null;
342
+ for (var t = e.firstChild; t; t = t.nextSibling)
343
+ Ue(t);
380
344
  }
381
- function recordAttributes(node, data) {
382
- var attributes2 = node.attributes;
383
- var length = attributes2.length;
384
- if (!length) {
385
- return;
386
- }
387
- var attrsArr = data.getAttrsArr(length);
388
- for (var i = 0, j = 0; i < length; i += 1, j += 2) {
389
- var attr2 = attributes2[i];
390
- var name = attr2.name;
391
- var value = attr2.value;
392
- attrsArr[j] = name;
393
- attrsArr[j + 1] = value;
394
- }
345
+ function Lt(e, t) {
346
+ var s = e.attributes, n = s.length;
347
+ if (!!n)
348
+ for (var i = t.getAttrsArr(n), r = 0, l = 0; r < n; r += 1, l += 2) {
349
+ var h = s[r], C = h.name, g = h.value;
350
+ i[l] = C, i[l + 1] = g;
351
+ }
395
352
  }
396
353
  /**
397
354
  * @license
@@ -409,40 +366,22 @@ function recordAttributes(node, data) {
409
366
  * See the License for the specific language governing permissions and
410
367
  * limitations under the License.
411
368
  */
412
- function getNamespaceForTag(tag, parent) {
413
- if (tag === "svg") {
414
- return "http://www.w3.org/2000/svg";
415
- }
416
- if (tag === "math") {
417
- return "http://www.w3.org/1998/Math/MathML";
418
- }
419
- if (parent == null) {
420
- return null;
421
- }
422
- if (getData(parent).nameOrCtor === "foreignObject") {
423
- return null;
424
- }
425
- return parent.namespaceURI;
426
- }
427
- function createElement(doc2, parent, nameOrCtor, key2) {
428
- var el;
429
- if (typeof nameOrCtor === "function") {
430
- el = new nameOrCtor();
431
- } else {
432
- var namespace = getNamespaceForTag(nameOrCtor, parent);
433
- if (namespace) {
434
- el = doc2.createElementNS(namespace, nameOrCtor);
435
- } else {
436
- el = doc2.createElement(nameOrCtor);
437
- }
369
+ function Ft(e, t) {
370
+ return e === "svg" ? "http://www.w3.org/2000/svg" : e === "math" ? "http://www.w3.org/1998/Math/MathML" : t == null || $(t).nameOrCtor === "foreignObject" ? null : t.namespaceURI;
371
+ }
372
+ function Rt(e, t, s, n) {
373
+ var i;
374
+ if (typeof s == "function")
375
+ i = new s();
376
+ else {
377
+ var r = Ft(s, t);
378
+ r ? i = e.createElementNS(r, s) : i = e.createElement(s);
438
379
  }
439
- initData(el, nameOrCtor, key2);
440
- return el;
380
+ return ve(i, s, n), i;
441
381
  }
442
- function createText(doc2) {
443
- var node = doc2.createTextNode("");
444
- initData(node, "#text", null);
445
- return node;
382
+ function Bt(e) {
383
+ var t = e.createTextNode("");
384
+ return ve(t, "#text", null), t;
446
385
  }
447
386
  /**
448
387
  * @license
@@ -460,166 +399,88 @@ function createText(doc2) {
460
399
  * See the License for the specific language governing permissions and
461
400
  * limitations under the License.
462
401
  */
463
- var context = null;
464
- var currentNode = null;
465
- var currentParent = null;
466
- var doc = null;
467
- var focusPath = [];
468
- var argsBuilder = [];
469
- function getArgsBuilder() {
470
- return argsBuilder;
471
- }
472
- function patchFactory(run) {
473
- var f = function(node, fn, data) {
474
- var prevContext = context;
475
- var prevDoc = doc;
476
- var prevFocusPath = focusPath;
477
- var prevArgsBuilder = argsBuilder;
478
- var prevCurrentNode = currentNode;
479
- var prevCurrentParent = currentParent;
480
- var previousInAttributes = false;
481
- context = new Context();
482
- doc = node.ownerDocument;
483
- argsBuilder = [];
484
- currentParent = node.parentNode;
485
- focusPath = getFocusedPath(node, currentParent);
402
+ var R = null, u = null, b = null, k = null, J = [], Y = [];
403
+ function ne() {
404
+ return Y;
405
+ }
406
+ function ze(e) {
407
+ var t = function(s, n, i) {
408
+ var r = R, l = k, h = J, C = Y, g = u, w = b, S = !1, V = !1;
409
+ R = new Nt(), k = s.ownerDocument, Y = [], b = s.parentNode, J = Dt(s, b), process.env.NODE_ENV !== "production" && (S = M(!1), V = ee(!1));
486
410
  try {
487
- var retVal = run(node, fn, data);
488
- if (false)
489
- ;
490
- return retVal;
411
+ var nt = e(s, n, i);
412
+ return process.env.NODE_ENV !== "production" && bt(), nt;
491
413
  } finally {
492
- doc = prevDoc;
493
- argsBuilder = prevArgsBuilder;
494
- currentNode = prevCurrentNode;
495
- currentParent = prevCurrentParent;
496
- focusPath = prevFocusPath;
497
- context.notifyChanges();
498
- setInAttributes(previousInAttributes);
499
- context = prevContext;
414
+ k = l, Y = C, u = g, b = w, J = h, R.notifyChanges(), M(S), ee(V), R = r;
500
415
  }
501
416
  };
502
- return f;
503
- }
504
- var patchInner = patchFactory(function(node, fn, data) {
505
- currentNode = node;
506
- enterNode();
507
- fn(data);
508
- exitNode();
509
- if (false)
510
- ;
511
- return node;
512
- });
513
- var patchOuter = patchFactory(function(node, fn, data) {
514
- var startNode = { nextSibling: node };
515
- var expectedNextNode = null;
516
- var expectedPrevNode = null;
517
- if (false)
518
- ;
519
- currentNode = startNode;
520
- fn(data);
521
- if (false)
522
- ;
523
- if (currentParent) {
524
- clearUnvisitedDOM(currentParent, getNextNode(), node.nextSibling);
525
- }
526
- return startNode === currentNode ? null : currentNode;
417
+ return t;
418
+ }
419
+ var We = ze(function(e, t, s) {
420
+ return u = e, qe(), t(s), Ge(), process.env.NODE_ENV !== "production" && mt(u, e), e;
421
+ }), $t = ze(function(e, t, s) {
422
+ var n = { nextSibling: e }, i = null, r = null;
423
+ return process.env.NODE_ENV !== "production" && (i = e.nextSibling, r = e.previousSibling), u = n, t(s), process.env.NODE_ENV !== "production" && (vt(b), _t(n, u, i, r)), b && Ve(b, ie(), e.nextSibling), n === u ? null : u;
527
424
  });
528
- function matches(matchNode, nameOrCtor, key2) {
529
- var data = getData(matchNode, key2);
530
- return nameOrCtor == data.nameOrCtor && key2 == data.key;
425
+ function Oe(e, t, s) {
426
+ var n = $(e, s);
427
+ return t == n.nameOrCtor && s == n.key;
531
428
  }
532
- function getMatchingNode(matchNode, nameOrCtor, key2) {
533
- if (!matchNode) {
429
+ function Tt(e, t, s) {
430
+ if (!e)
534
431
  return null;
535
- }
536
- if (matches(matchNode, nameOrCtor, key2)) {
537
- return matchNode;
538
- }
539
- if (key2) {
540
- while (matchNode = matchNode.nextSibling) {
541
- if (matches(matchNode, nameOrCtor, key2)) {
542
- return matchNode;
543
- }
544
- }
432
+ if (Oe(e, t, s))
433
+ return e;
434
+ if (s) {
435
+ for (; e = e.nextSibling; )
436
+ if (Oe(e, t, s))
437
+ return e;
545
438
  }
546
439
  return null;
547
440
  }
548
- function createNode(nameOrCtor, key2) {
549
- var node;
550
- if (nameOrCtor === "#text") {
551
- node = createText(doc);
552
- } else {
553
- node = createElement(doc, currentParent, nameOrCtor, key2);
554
- }
555
- context.markCreated(node);
556
- return node;
557
- }
558
- function alignWithDOM(nameOrCtor, key2) {
559
- var existingNode = getMatchingNode(currentNode, nameOrCtor, key2);
560
- var node = existingNode || createNode(nameOrCtor, key2);
561
- if (node === currentNode) {
562
- return;
563
- }
564
- if (focusPath.indexOf(node) >= 0) {
565
- moveBefore(currentParent, node, currentNode);
566
- } else {
567
- currentParent.insertBefore(node, currentNode);
568
- }
569
- currentNode = node;
570
- }
571
- function clearUnvisitedDOM(maybeParentNode, startNode, endNode) {
572
- var parentNode = maybeParentNode;
573
- var child = startNode;
574
- while (child !== endNode) {
575
- var next = child.nextSibling;
576
- parentNode.removeChild(child);
577
- context.markDeleted(child);
578
- child = next;
579
- }
441
+ function jt(e, t) {
442
+ var s;
443
+ return e === "#text" ? s = Bt(k) : s = Rt(k, b, e, t), R.markCreated(s), s;
580
444
  }
581
- function enterNode() {
582
- currentParent = currentNode;
583
- currentNode = null;
445
+ function He(e, t) {
446
+ var s = Tt(u, e, t), n = s || jt(e, t);
447
+ n !== u && (J.indexOf(n) >= 0 ? Pt(b, n, u) : b.insertBefore(n, u), u = n);
584
448
  }
585
- function getNextNode() {
586
- if (currentNode) {
587
- return currentNode.nextSibling;
588
- } else {
589
- return currentParent.firstChild;
449
+ function Ve(e, t, s) {
450
+ for (var n = e, i = t; i !== s; ) {
451
+ var r = i.nextSibling;
452
+ n.removeChild(i), R.markDeleted(i), i = r;
590
453
  }
591
454
  }
592
- function nextNode() {
593
- currentNode = getNextNode();
455
+ function qe() {
456
+ b = u, u = null;
457
+ }
458
+ function ie() {
459
+ return u ? u.nextSibling : b.firstChild;
594
460
  }
595
- function exitNode() {
596
- clearUnvisitedDOM(currentParent, getNextNode(), null);
597
- currentNode = currentParent;
598
- currentParent = currentParent.parentNode;
461
+ function be() {
462
+ u = ie();
599
463
  }
600
- function open(nameOrCtor, key2) {
601
- nextNode();
602
- alignWithDOM(nameOrCtor, key2);
603
- enterNode();
604
- return currentParent;
464
+ function Ge() {
465
+ Ve(b, ie(), null), u = b, b = b.parentNode;
605
466
  }
606
- function close() {
607
- exitNode();
608
- return currentNode;
467
+ function Xe(e, t) {
468
+ return be(), He(e, t), qe(), b;
609
469
  }
610
- function text() {
611
- nextNode();
612
- alignWithDOM("#text", null);
613
- return currentNode;
470
+ function Ke() {
471
+ return process.env.NODE_ENV !== "production" && ee(!1), Ge(), u;
614
472
  }
615
- function currentElement() {
616
- return currentParent;
473
+ function Ut() {
474
+ return be(), He("#text", null), u;
617
475
  }
618
- function currentPointer() {
619
- return getNextNode();
476
+ function zt() {
477
+ return process.env.NODE_ENV !== "production" && (Be("currentElement", k), B("currentElement")), b;
620
478
  }
621
- function skip() {
622
- currentNode = currentParent.lastChild;
479
+ function Wt() {
480
+ return process.env.NODE_ENV !== "production" && (Be("currentPointer", k), B("currentPointer")), ie();
481
+ }
482
+ function Ht() {
483
+ process.env.NODE_ENV !== "production" && (wt("skip", u), ee(!0)), u = b.lastChild;
623
484
  }
624
485
  /**
625
486
  * @license
@@ -637,148 +498,96 @@ function skip() {
637
498
  * See the License for the specific language governing permissions and
638
499
  * limitations under the License.
639
500
  */
640
- var ATTRIBUTES_OFFSET = 3;
641
- var prevAttrsMap = createMap();
642
- function applyStatics(node, data, statics) {
643
- data.staticsApplied = true;
644
- if (!statics || !statics.length) {
645
- return;
646
- }
647
- if (data.hasEmptyAttrsArr()) {
648
- for (var i = 0; i < statics.length; i += 2) {
649
- updateAttribute(node, statics[i], statics[i + 1]);
650
- }
651
- return;
652
- }
653
- for (var i = 0; i < statics.length; i += 2) {
654
- prevAttrsMap[statics[i]] = i + 1;
655
- }
656
- var attrsArr = data.getAttrsArr(0);
657
- var j = 0;
658
- for (var i = 0; i < attrsArr.length; i += 2) {
659
- var name = attrsArr[i];
660
- var value = attrsArr[i + 1];
661
- var staticsIndex = prevAttrsMap[name];
662
- if (staticsIndex) {
663
- if (statics[staticsIndex] === value) {
664
- delete prevAttrsMap[name];
501
+ var Ae = 3, x = Le();
502
+ function Vt(e, t, s) {
503
+ if (t.staticsApplied = !0, !(!s || !s.length)) {
504
+ if (t.hasEmptyAttrsArr()) {
505
+ for (var n = 0; n < s.length; n += 2)
506
+ z(e, s[n], s[n + 1]);
507
+ return;
508
+ }
509
+ for (var n = 0; n < s.length; n += 2)
510
+ x[s[n]] = n + 1;
511
+ for (var i = t.getAttrsArr(0), r = 0, n = 0; n < i.length; n += 2) {
512
+ var l = i[n], h = i[n + 1], C = x[l];
513
+ if (C) {
514
+ s[C] === h && delete x[l];
515
+ continue;
665
516
  }
666
- continue;
667
- }
668
- attrsArr[j] = name;
669
- attrsArr[j + 1] = value;
670
- j += 2;
671
- }
672
- truncateArray(attrsArr, j);
673
- for (var name in prevAttrsMap) {
674
- updateAttribute(node, name, statics[prevAttrsMap[name]]);
675
- delete prevAttrsMap[name];
676
- }
677
- }
678
- function elementOpen(nameOrCtor, key2, statics) {
679
- var varArgs = [];
680
- for (var _i = 3; _i < arguments.length; _i++) {
681
- varArgs[_i - 3] = arguments[_i];
682
- }
683
- var node = open(nameOrCtor, key2);
684
- var data = getData(node);
685
- if (!data.staticsApplied) {
686
- applyStatics(node, data, statics);
687
- }
688
- var attrsLength = Math.max(0, arguments.length - ATTRIBUTES_OFFSET);
689
- var hadNoAttrs = data.hasEmptyAttrsArr();
690
- if (!attrsLength && hadNoAttrs) {
691
- return node;
692
- }
693
- var attrsArr = data.getAttrsArr(attrsLength);
694
- var i = ATTRIBUTES_OFFSET;
695
- var j = 0;
696
- for (; i < arguments.length; i += 2, j += 2) {
697
- var name = arguments[i];
698
- if (hadNoAttrs) {
699
- attrsArr[j] = name;
700
- } else if (attrsArr[j] !== name) {
517
+ i[r] = l, i[r + 1] = h, r += 2;
518
+ }
519
+ ge(i, r);
520
+ for (var l in x)
521
+ z(e, l, s[x[l]]), delete x[l];
522
+ }
523
+ }
524
+ function Ce(e, t, s) {
525
+ process.env.NODE_ENV !== "production" && (B("elementOpen"), $e("elementOpen"));
526
+ var n = Xe(e, t), i = $(n);
527
+ i.staticsApplied || Vt(n, i, s);
528
+ var r = Math.max(0, arguments.length - Ae), l = i.hasEmptyAttrsArr();
529
+ if (!r && l)
530
+ return n;
531
+ for (var h = i.getAttrsArr(r), C = Ae, g = 0; C < arguments.length; C += 2, g += 2) {
532
+ var w = arguments[C];
533
+ if (l)
534
+ h[g] = w;
535
+ else if (h[g] !== w)
701
536
  break;
702
- }
703
- var value = arguments[i + 1];
704
- if (hadNoAttrs || attrsArr[j + 1] !== value) {
705
- attrsArr[j + 1] = value;
706
- updateAttribute(node, name, value);
707
- }
537
+ var S = arguments[C + 1];
538
+ (l || h[g + 1] !== S) && (h[g + 1] = S, z(n, w, S));
708
539
  }
709
- if (i < arguments.length || j < attrsArr.length) {
710
- var attrsStart = j;
711
- for (; j < attrsArr.length; j += 2) {
712
- prevAttrsMap[attrsArr[j]] = attrsArr[j + 1];
713
- }
714
- for (j = attrsStart; i < arguments.length; i += 2, j += 2) {
715
- var name = arguments[i];
716
- var value = arguments[i + 1];
717
- if (prevAttrsMap[name] !== value) {
718
- updateAttribute(node, name, value);
719
- }
720
- attrsArr[j] = name;
721
- attrsArr[j + 1] = value;
722
- delete prevAttrsMap[name];
540
+ if (C < arguments.length || g < h.length) {
541
+ for (var V = g; g < h.length; g += 2)
542
+ x[h[g]] = h[g + 1];
543
+ for (g = V; C < arguments.length; C += 2, g += 2) {
544
+ var w = arguments[C], S = arguments[C + 1];
545
+ x[w] !== S && z(n, w, S), h[g] = w, h[g + 1] = S, delete x[w];
723
546
  }
724
- truncateArray(attrsArr, j);
725
- for (var name in prevAttrsMap) {
726
- updateAttribute(node, name, void 0);
727
- delete prevAttrsMap[name];
728
- }
729
- }
730
- return node;
731
- }
732
- function elementOpenStart(nameOrCtor, key2, statics) {
733
- var argsBuilder2 = getArgsBuilder();
734
- argsBuilder2[0] = nameOrCtor;
735
- argsBuilder2[1] = key2;
736
- argsBuilder2[2] = statics;
737
- }
738
- function key(key2) {
739
- var argsBuilder2 = getArgsBuilder();
740
- argsBuilder2[1] = key2;
741
- }
742
- function attr(name, value) {
743
- var argsBuilder2 = getArgsBuilder();
744
- argsBuilder2.push(name);
745
- argsBuilder2.push(value);
746
- }
747
- function elementOpenEnd() {
748
- var argsBuilder2 = getArgsBuilder();
749
- var node = elementOpen.apply(null, argsBuilder2);
750
- truncateArray(argsBuilder2, 0);
751
- return node;
752
- }
753
- function elementClose(nameOrCtor) {
754
- var node = close();
755
- return node;
756
- }
757
- function elementVoid(nameOrCtor, key2, statics) {
758
- var varArgs = [];
759
- for (var _i = 3; _i < arguments.length; _i++) {
760
- varArgs[_i - 3] = arguments[_i];
547
+ ge(h, g);
548
+ for (var w in x)
549
+ z(n, w, void 0), delete x[w];
761
550
  }
762
- elementOpen.apply(null, arguments);
763
- return elementClose();
551
+ return n;
764
552
  }
765
- function text$1(value) {
766
- var varArgs = [];
767
- for (var _i = 1; _i < arguments.length; _i++) {
768
- varArgs[_i - 1] = arguments[_i];
769
- }
770
- var node = text();
771
- var data = getData(node);
772
- if (data.text !== value) {
773
- data.text = value;
774
- var formatted = value;
775
- for (var i = 1; i < arguments.length; i += 1) {
776
- var fn = arguments[i];
777
- formatted = fn(formatted);
553
+ function qt(e, t, s) {
554
+ var n = ne();
555
+ process.env.NODE_ENV !== "production" && (B("elementOpenStart"), M(!0)), n[0] = e, n[1] = t, n[2] = s;
556
+ }
557
+ function Gt(e) {
558
+ var t = ne();
559
+ process.env.NODE_ENV !== "production" && (me("key"), se(t)), t[1] = e;
560
+ }
561
+ function Xt(e, t) {
562
+ var s = ne();
563
+ process.env.NODE_ENV !== "production" && me("attr"), s.push(e), s.push(t);
564
+ }
565
+ function Kt() {
566
+ var e = ne();
567
+ process.env.NODE_ENV !== "production" && (me("elementOpenEnd"), M(!1)), se(e);
568
+ var t = Ce.apply(null, e);
569
+ return ge(e, 0), t;
570
+ }
571
+ function Qe(e) {
572
+ process.env.NODE_ENV !== "production" && B("elementClose");
573
+ var t = Ke();
574
+ return process.env.NODE_ENV !== "production" && Ct($(t).nameOrCtor, e), t;
575
+ }
576
+ function Qt(e, t, s) {
577
+ return Ce.apply(null, arguments), Qe(e);
578
+ }
579
+ function Zt(e) {
580
+ process.env.NODE_ENV !== "production" && (B("text"), $e("text"));
581
+ var t = Ut(), s = $(t);
582
+ if (s.text !== e) {
583
+ s.text = e;
584
+ for (var n = e, i = 1; i < arguments.length; i += 1) {
585
+ var r = arguments[i];
586
+ n = r(n);
778
587
  }
779
- node.data = formatted;
588
+ t.data = n;
780
589
  }
781
- return node;
590
+ return t;
782
591
  }
783
592
  /**
784
593
  * @license
@@ -796,799 +605,807 @@ function text$1(value) {
796
605
  * See the License for the specific language governing permissions and
797
606
  * limitations under the License.
798
607
  */
799
- incrementalDomCjs.applyAttr = applyAttr;
800
- incrementalDomCjs.applyProp = applyProp;
801
- incrementalDomCjs.attributes = attributes;
802
- incrementalDomCjs.close = close;
803
- var currentElement_1 = incrementalDomCjs.currentElement = currentElement;
804
- var currentPointer_1 = incrementalDomCjs.currentPointer = currentPointer;
805
- incrementalDomCjs.open = open;
806
- var patch = incrementalDomCjs.patch = patchInner;
807
- incrementalDomCjs.patchInner = patchInner;
808
- incrementalDomCjs.patchOuter = patchOuter;
809
- incrementalDomCjs.skip = skip;
810
- var skipNode = incrementalDomCjs.skipNode = nextNode;
811
- incrementalDomCjs.getKey = getKey;
812
- incrementalDomCjs.clearCache = clearCache;
813
- incrementalDomCjs.importNode = importNode;
814
- incrementalDomCjs.isDataInitialized = isDataInitialized;
815
- incrementalDomCjs.notifications = notifications;
816
- incrementalDomCjs.symbols = symbols;
817
- var attr_1 = incrementalDomCjs.attr = attr;
818
- var elementClose_1 = incrementalDomCjs.elementClose = elementClose;
819
- incrementalDomCjs.elementOpen = elementOpen;
820
- var elementOpenEnd_1 = incrementalDomCjs.elementOpenEnd = elementOpenEnd;
821
- var elementOpenStart_1 = incrementalDomCjs.elementOpenStart = elementOpenStart;
822
- incrementalDomCjs.elementVoid = elementVoid;
823
- var text_1 = incrementalDomCjs.text = text$1;
824
- incrementalDomCjs.key = key;
825
- function comment(content) {
826
- let node = currentPointer_1();
827
- if (node instanceof Comment && node.data !== content) {
828
- node.data = content;
829
- } else {
830
- node = document.createComment(content);
831
- currentElement_1().appendChild(node);
832
- }
833
- skipNode();
834
- return node;
835
- }
836
- let theI18n = noI18nI18n;
837
- function webComponentsUseI18n(i18n) {
838
- theI18n = i18n;
839
- }
840
- function getI18n() {
841
- return theI18n;
842
- }
843
- const SYMBOL_COMPONENT_META = Symbol("ComponentMetadata");
844
- const Metadata = Object.freeze({
845
- has(target, key2) {
846
- return Boolean(target[SYMBOL_COMPONENT_META] && Object.prototype.hasOwnProperty.call(target[SYMBOL_COMPONENT_META], key2));
608
+ d.applyAttr = Fe;
609
+ d.applyProp = Re;
610
+ d.attributes = W;
611
+ d.close = Ke;
612
+ var we = d.currentElement = zt, le = d.currentPointer = Wt;
613
+ d.open = Xe;
614
+ var Jt = d.patch = We;
615
+ d.patchInner = We;
616
+ d.patchOuter = $t;
617
+ d.skip = Ht;
618
+ var ce = d.skipNode = be;
619
+ d.getKey = kt;
620
+ d.clearCache = Ue;
621
+ d.importNode = je;
622
+ d.isDataInitialized = It;
623
+ d.notifications = U;
624
+ d.symbols = fe;
625
+ var De = d.attr = Xt, Yt = d.elementClose = Qe;
626
+ d.elementOpen = Ce;
627
+ var Mt = d.elementOpenEnd = Kt, es = d.elementOpenStart = qt;
628
+ d.elementVoid = Qt;
629
+ var ts = d.text = Zt;
630
+ d.key = Gt;
631
+ function Pe(e) {
632
+ let t = le();
633
+ return t instanceof Comment && t.data !== e ? t.data = e : (t = document.createComment(e), we().appendChild(t)), ce(), t;
634
+ }
635
+ let Ze = at;
636
+ function Ns(e) {
637
+ Ze = e;
638
+ }
639
+ function ss() {
640
+ return Ze;
641
+ }
642
+ const I = Symbol("ComponentMetadata"), N = Object.freeze({
643
+ has(e, t) {
644
+ return Boolean(
645
+ e[I] && Object.prototype.hasOwnProperty.call(e[I], t)
646
+ );
847
647
  },
848
- add(target, metadata) {
849
- if (target[SYMBOL_COMPONENT_META]) {
850
- Object.assign(target[SYMBOL_COMPONENT_META], metadata);
851
- } else {
852
- target[SYMBOL_COMPONENT_META] = metadata;
853
- }
648
+ add(e, t) {
649
+ e[I] ? Object.assign(e[I], t) : e[I] = t;
854
650
  },
855
- get(target, key2, defaultValue) {
856
- return target[SYMBOL_COMPONENT_META] ? target[SYMBOL_COMPONENT_META][key2] || defaultValue : defaultValue;
857
- }
858
- });
859
- const SYMBOL_LISTENERS_ATTACHED = Symbol("ds-web-components:pragma:listeners-attached");
860
- const MARK_CONTENT_START = "idom-pragma:content-begin";
861
- const MARK_CONTENT_END = "idom-pragma:content-end";
862
- function handleChildren(children) {
863
- for (const child of children) {
864
- if (typeof child === "function") {
865
- child();
866
- } else if (typeof child === "string") {
867
- text_1(child);
868
- } else if (child instanceof Set) {
869
- handleChildren(Array.from(child));
870
- } else if (Array.isArray(child) && child.length > 0) {
871
- let ptr = currentPointer_1();
872
- comment(MARK_CONTENT_START);
873
- if (ptr === null) {
874
- const ce = currentElement_1();
875
- for (let i = 0; i < child.length; i += 1) {
876
- if (!ce.contains(child[i])) {
877
- ce.appendChild(child[i]);
878
- }
879
- skipNode();
880
- }
651
+ get(e, t, s) {
652
+ return e[I] && e[I][t] || s;
653
+ }
654
+ }), Ee = Symbol("ds-web-components:pragma:listeners-attached"), Je = "idom-pragma:content-begin", pe = "idom-pragma:content-end";
655
+ function de(e) {
656
+ for (const t of e)
657
+ if (typeof t == "function")
658
+ t();
659
+ else if (typeof t == "string")
660
+ ts(t);
661
+ else if (t instanceof Set)
662
+ de(Array.from(t));
663
+ else if (Array.isArray(t) && t.length > 0) {
664
+ let s = le();
665
+ if (Pe(Je), s === null) {
666
+ const n = we();
667
+ for (let i = 0; i < t.length; i += 1)
668
+ n.contains(t[i]) || n.appendChild(t[i]), ce();
881
669
  }
882
- while (ptr && ptr.data !== MARK_CONTENT_END) {
883
- skipNode();
884
- ptr = currentPointer_1();
885
- }
886
- comment(MARK_CONTENT_END);
670
+ for (; s && s.data !== pe; )
671
+ ce(), s = le();
672
+ Pe(pe);
887
673
  }
888
- }
889
674
  }
890
- function h(tagName, attrs, ...children) {
891
- if (attrs) {
892
- for (const key2 of Object.keys(attrs)) {
893
- if (key2.toUpperCase() === "DATA-FRAGMENT") {
894
- return () => handleChildren(children);
895
- }
896
- }
675
+ function o(e, t, ...s) {
676
+ if (t) {
677
+ for (const n of Object.keys(t))
678
+ if (n.toUpperCase() === "DATA-FRAGMENT")
679
+ return () => de(s);
897
680
  }
898
681
  return () => {
899
- elementOpenStart_1(tagName);
900
- const eventListenerKeys = [];
901
- if (attrs) {
902
- for (const key2 of Object.keys(attrs)) {
903
- if (key2.toUpperCase() === "CLASSNAME") {
904
- attr_1("class", attrs[key2]);
905
- } else if (/^on[A-Z]/.test(key2)) {
906
- eventListenerKeys.push(key2);
907
- } else {
908
- attr_1(key2, attrs[key2]);
909
- }
910
- }
911
- }
912
- elementOpenEnd_1(tagName);
913
- const ce = currentElement_1();
914
- if (!ce[SYMBOL_LISTENERS_ATTACHED]) {
915
- for (const key2 of eventListenerKeys) {
916
- ce.addEventListener(key2.substr(2).toLowerCase(), attrs[key2]);
917
- }
918
- ce[SYMBOL_LISTENERS_ATTACHED] = true;
919
- }
920
- handleChildren(children);
921
- elementClose_1(tagName);
682
+ es(e);
683
+ const n = [];
684
+ if (t)
685
+ for (const r of Object.keys(t))
686
+ r.toUpperCase() === "CLASSNAME" ? De("class", t[r]) : /^on[A-Z]/.test(r) ? n.push(r) : De(r, t[r]);
687
+ Mt(e);
688
+ const i = we();
689
+ if (!i[Ee]) {
690
+ for (const r of n)
691
+ i.addEventListener(r.substr(2).toLowerCase(), t[r]);
692
+ i[Ee] = !0;
693
+ }
694
+ de(s), Yt(e);
922
695
  };
923
696
  }
924
- function ensureDefined(tag, Component2) {
925
- if (!customElements.get(tag)) {
926
- customElements.define(tag, Component2);
927
- }
697
+ function Ye(e, t) {
698
+ customElements.get(e) || customElements.define(e, t);
928
699
  }
929
- function register(...Components) {
930
- for (const Component2 of Components) {
931
- ensureDefined(Metadata.get(Component2, "tag"), Component2);
932
- }
700
+ function xs(...e) {
701
+ for (const t of e)
702
+ Ye(N.get(t, "tag"), t);
933
703
  }
934
- function namespaceOverrideRegistrar(overrideNamespace) {
935
- return function register2(...Components) {
936
- for (const Component2 of Components) {
937
- const tag = `${overrideNamespace}${Metadata.get(Component2, "tag").substr(3)}`;
938
- ensureDefined(tag, Component2);
704
+ function ys(e) {
705
+ return function(...s) {
706
+ for (const n of s) {
707
+ const i = `${e}${N.get(n, "tag").substr(3)}`;
708
+ Ye(i, n);
939
709
  }
940
710
  };
941
711
  }
942
- const AttrBindings = Symbol("Component Attribute Bindings");
943
- const ClassBindings = Symbol("Component Class Bindings");
944
- const StyleBindings = Symbol("Component Style Bindings");
945
- const ext = {
946
- __initialized: false,
712
+ const Ie = Symbol("Component Attribute Bindings"), T = Symbol("Component Class Bindings"), he = Symbol("Component Style Bindings"), ns = {
713
+ __initialized: !1,
947
714
  __observer: null,
948
715
  __queuedUpdate: null,
949
- __managedClasses: new Set(),
716
+ __managedClasses: /* @__PURE__ */ new Set(),
950
717
  __updateHostBindings() {
951
- const self = this;
952
- for (const attrName of Object.keys(self[AttrBindings] || {})) {
953
- self.setAttribute(attrName, self[AttrBindings][attrName]);
954
- }
955
- for (const styleKey of Object.keys(self[StyleBindings] || {})) {
956
- self.style[styleKey] = self[StyleBindings][styleKey];
957
- }
958
- for (const className of self.__managedClasses) {
959
- self.classList.remove(className);
960
- }
961
- for (const className of (self[ClassBindings] || []).filter(Boolean)) {
962
- self.__managedClasses.add(className);
963
- self.classList.add(className);
964
- }
965
- for (const className of (self.getAttribute("classname") || "").split(/\w+/).filter(Boolean)) {
966
- self.classList.add(className);
967
- }
718
+ const e = this;
719
+ for (const t of Object.keys(e[Ie] || {}))
720
+ e.setAttribute(t, e[Ie][t]);
721
+ for (const t of Object.keys(e[he] || {}))
722
+ e.style[t] = e[he][t];
723
+ for (const t of e.__managedClasses)
724
+ e.classList.remove(t);
725
+ for (const t of (e[T] || []).filter(Boolean))
726
+ e.__managedClasses.add(t), e.classList.add(t);
727
+ for (const t of (e.getAttribute("classname") || "").split(/\w+/).filter(Boolean))
728
+ e.classList.add(t);
968
729
  },
969
- __updateChildQueries(adhereToRefreshOption) {
970
- const self = this;
971
- for (const childQuery of Metadata.get(self.constructor, "childQueries", [])) {
972
- if (!adhereToRefreshOption || adhereToRefreshOption && childQuery.refresh) {
973
- const queryMethod = childQuery.all ? self.querySelectorAll : self.querySelector;
974
- self[childQuery.key] = queryMethod.call(self, childQuery.selector);
730
+ __updateChildQueries(e) {
731
+ const t = this;
732
+ for (const s of N.get(t.constructor, "childQueries", []))
733
+ if (!e || e && s.refresh) {
734
+ const n = s.all ? t.querySelectorAll : t.querySelector;
735
+ t[s.key] = n.call(t, s.selector);
975
736
  }
976
- }
977
737
  },
978
738
  __gatherChildren() {
979
- const self = this;
980
- let childNodes = Array.from(self.childNodes);
981
- let contentStartIndex = null;
982
- let contentEndIndex = childNodes.length;
983
- for (let i = 0; i < childNodes.length; i += 1) {
984
- const node = childNodes[i];
985
- if (node instanceof Comment) {
986
- if (node.data === MARK_CONTENT_START) {
987
- contentStartIndex = i + 1;
988
- } else if (node.data === MARK_CONTENT_END) {
989
- contentEndIndex = i - 1;
990
- }
991
- }
992
- }
993
- if (contentStartIndex === null) {
994
- for (const node of childNodes) {
995
- node.parentNode.removeChild(node);
996
- }
997
- } else {
998
- childNodes = childNodes.slice(contentStartIndex, contentEndIndex);
999
- }
1000
- if (Metadata.has(self.constructor, "contentProp")) {
1001
- self[Metadata.get(self.constructor, "contentProp")] = childNodes;
1002
- }
739
+ const e = this;
740
+ let t = Array.from(e.childNodes), s = null, n = t.length;
741
+ for (let i = 0; i < t.length; i += 1) {
742
+ const r = t[i];
743
+ r instanceof Comment && (r.data === Je ? s = i + 1 : r.data === pe && (n = i - 1));
744
+ }
745
+ if (s === null)
746
+ for (const i of t)
747
+ i.parentNode.removeChild(i);
748
+ else
749
+ t = t.slice(s, n);
750
+ N.has(e.constructor, "contentProp") && (e[N.get(e.constructor, "contentProp")] = t);
1003
751
  },
1004
752
  __startMutObs() {
1005
- const self = this;
1006
- if (!self.__observer) {
1007
- self.__observer = new MutationObserver(() => {
1008
- if (self.contentChangedCallback) {
1009
- self.contentChangedCallback();
1010
- }
1011
- self.__gatherChildren();
1012
- self.update();
1013
- });
1014
- }
1015
- self.__observer.observe(self, { childList: true });
753
+ const e = this;
754
+ e.__observer || (e.__observer = new MutationObserver(() => {
755
+ e.contentChangedCallback && e.contentChangedCallback(), e.__gatherChildren(), e.update();
756
+ })), e.__observer.observe(e, { childList: !0 });
1016
757
  },
1017
758
  __stopMutObs() {
1018
- const self = this;
1019
- if (self.__observer) {
1020
- self.__observer.disconnect();
1021
- }
759
+ const e = this;
760
+ e.__observer && e.__observer.disconnect();
1022
761
  },
1023
762
  __doRender() {
1024
- const self = this;
1025
- self.__stopMutObs();
1026
- patch(self, self.render(getI18n()));
1027
- self.__startMutObs();
763
+ const e = this;
764
+ e.__stopMutObs(), Jt(e, e.render(ss())), e.__startMutObs();
1028
765
  },
1029
766
  update() {
1030
- const self = this;
1031
- if (self.__initialized && !self.__queuedUpdate) {
1032
- self.__queuedUpdate = window.requestAnimationFrame(() => {
1033
- self.__doRender();
1034
- setTimeout(() => {
1035
- self.__updateChildQueries(true);
1036
- self.__updateHostBindings();
1037
- }, 0);
1038
- self.__queuedUpdate = null;
1039
- });
1040
- }
767
+ const e = this;
768
+ e.__initialized && !e.__queuedUpdate && (e.__queuedUpdate = window.requestAnimationFrame(() => {
769
+ e.__doRender(), setTimeout(() => {
770
+ e.__updateChildQueries(!0), e.__updateHostBindings();
771
+ }, 0), e.__queuedUpdate = null;
772
+ }));
1041
773
  },
1042
- attributeChangedCallback(key2, oldValue, newValue) {
1043
- const self = this;
1044
- const value = newValue === "" ? true : newValue;
1045
- if (value !== oldValue) {
1046
- if (self.__cbAttributeChanged) {
1047
- self.__cbAttributeChanged(key2, self[key2], value);
1048
- }
1049
- if (key2 !== "style") {
1050
- self[key2] = value;
1051
- }
1052
- if (self.__initialized) {
1053
- self.update();
1054
- }
1055
- }
774
+ attributeChangedCallback(e, t, s) {
775
+ const n = this, i = s === "" ? !0 : s;
776
+ i !== t && (n.__cbAttributeChanged && n.__cbAttributeChanged(e, n[e], i), e !== "style" && (n[e] = i), n.__initialized && n.update());
1056
777
  },
1057
778
  connectedCallback() {
1058
- const self = this;
1059
- if (self.__cbConnected) {
1060
- self.__cbConnected();
1061
- }
1062
- const listeners = Metadata.get(self.constructor, "eventListeners", []);
779
+ const e = this;
780
+ e.__cbConnected && e.__cbConnected();
781
+ const t = N.get(e.constructor, "eventListeners", []);
1063
782
  setTimeout(() => {
1064
- if (!self.__initialized) {
1065
- self.__gatherChildren();
1066
- for (const [, key2] of listeners) {
1067
- self[key2] = self[key2].bind(self);
1068
- }
1069
- self.__initialized = true;
1070
- }
1071
- for (const [eventName, key2] of listeners) {
1072
- self.addEventListener(eventName, self[key2]);
783
+ if (!e.__initialized) {
784
+ e.__gatherChildren();
785
+ for (const [, s] of t)
786
+ e[s] = e[s].bind(e);
787
+ e.__initialized = !0;
1073
788
  }
1074
- self.__doRender();
1075
- setTimeout(() => {
1076
- self.__updateChildQueries();
1077
- self.__updateHostBindings();
789
+ for (const [s, n] of t)
790
+ e.addEventListener(s, e[n]);
791
+ e.__doRender(), setTimeout(() => {
792
+ e.__updateChildQueries(), e.__updateHostBindings();
1078
793
  }, 0);
1079
794
  }, 0);
1080
795
  },
1081
796
  disconnectedCallback() {
1082
- const self = this;
1083
- if (self.__cbDisconnected) {
1084
- self.__cbDisconnected();
1085
- }
1086
- for (const [eventName, key2] of Metadata.get(self.constructor, "eventListeners", [])) {
1087
- self.removeEventListener(eventName, self[key2]);
1088
- }
1089
- self.__stopMutObs();
797
+ const e = this;
798
+ e.__cbDisconnected && e.__cbDisconnected();
799
+ for (const [t, s] of N.get(e.constructor, "eventListeners", []))
800
+ e.removeEventListener(t, e[s]);
801
+ e.__stopMutObs();
1090
802
  }
1091
803
  };
1092
- function Component(config) {
1093
- return (target) => {
1094
- Metadata.add(target, config);
1095
- Object.assign(target.prototype, {
1096
- __cbAttributeChanged: target.prototype.attributeChangedCallback,
1097
- __cbConnected: target.prototype.connectedCallback,
1098
- __cbDisconnected: target.prototype.disconnectedCallback
1099
- }, ext);
804
+ function j(e) {
805
+ return (t) => {
806
+ N.add(t, e), Object.assign(t.prototype, {
807
+ __cbAttributeChanged: t.prototype.attributeChangedCallback,
808
+ __cbConnected: t.prototype.connectedCallback,
809
+ __cbDisconnected: t.prototype.disconnectedCallback
810
+ }, ns);
1100
811
  };
1101
812
  }
1102
- function Content() {
1103
- return (target, key2) => {
1104
- Metadata.add(target.constructor, { contentProp: key2 });
813
+ function _e() {
814
+ return (e, t) => {
815
+ N.add(e.constructor, { contentProp: t });
1105
816
  };
1106
817
  }
1107
- function EventDispatcher(eventName) {
1108
- return (target, key2) => {
1109
- Object.defineProperty(target, key2, {
818
+ function Ne(e) {
819
+ return (t, s) => {
820
+ Object.defineProperty(t, s, {
1110
821
  get() {
1111
- Object.defineProperty(this, key2, {
822
+ return Object.defineProperty(this, s, {
1112
823
  value: {
1113
- dispatch: (detail) => {
1114
- const event = new CustomEvent(eventName || key2, { detail });
1115
- this.dispatchEvent(event);
1116
- return event;
824
+ dispatch: (n) => {
825
+ const i = new CustomEvent(e || s, { detail: n });
826
+ return this.dispatchEvent(i), i;
1117
827
  }
1118
828
  }
1119
- });
1120
- return this[key2];
829
+ }), this[s];
1121
830
  },
1122
- configurable: true
831
+ configurable: !0
1123
832
  });
1124
833
  };
1125
834
  }
1126
- function EventListener(eventName) {
1127
- return (target, key2) => {
1128
- const eventListeners = Metadata.get(target.constructor, "eventListeners", []);
1129
- eventListeners.push([eventName, key2]);
1130
- Metadata.add(target.constructor, { eventListeners });
835
+ function re(e) {
836
+ return (t, s) => {
837
+ const n = N.get(t.constructor, "eventListeners", []);
838
+ n.push([e, s]), N.add(t.constructor, { eventListeners: n });
1131
839
  };
1132
840
  }
1133
- function Prop(castToType) {
1134
- return (target, key2) => {
1135
- const c = target.constructor;
1136
- const keyLowercase = key2.toLowerCase();
1137
- c.observedAttributes = c.observedAttributes || [
841
+ function p(e) {
842
+ return (t, s) => {
843
+ const n = t.constructor, i = s.toLowerCase();
844
+ if (n.observedAttributes = n.observedAttributes || [
1138
845
  "classname",
1139
846
  "className",
1140
847
  "style"
1141
- ];
1142
- c.observedAttributes.push(key2);
1143
- c.observedAttributes.push(keyLowercase);
1144
- if (keyLowercase !== key2) {
1145
- Object.defineProperty(target, key2, {
1146
- get() {
1147
- return this[keyLowercase];
1148
- },
1149
- set(newValue) {
1150
- this[keyLowercase] = newValue;
1151
- }
1152
- });
1153
- }
1154
- if (castToType) {
1155
- const privateKey = Symbol.for(key2);
1156
- Object.defineProperty(target, keyLowercase, {
848
+ ], n.observedAttributes.push(s), n.observedAttributes.push(i), i !== s && Object.defineProperty(t, s, {
849
+ get() {
850
+ return this[i];
851
+ },
852
+ set(r) {
853
+ this[i] = r;
854
+ }
855
+ }), e) {
856
+ const r = Symbol.for(s);
857
+ Object.defineProperty(t, i, {
1157
858
  get() {
1158
- return this[privateKey];
859
+ return this[r];
1159
860
  },
1160
- set(newValue) {
1161
- let castValue = newValue;
1162
- if (castToType === Boolean && typeof newValue === "string" && newValue.toLowerCase() === "false") {
1163
- castValue = false;
1164
- } else {
1165
- castValue = castToType(newValue);
1166
- }
1167
- this[privateKey] = castValue;
861
+ set(l) {
862
+ let h = l;
863
+ e === Boolean && typeof l == "string" && l.toLowerCase() === "false" ? h = !1 : h = e(l), this[r] = h;
1168
864
  }
1169
865
  });
1170
866
  }
1171
867
  };
1172
868
  }
1173
- function querySelectorDecorator(selector, options, all) {
1174
- return (target, key2) => {
1175
- const childQueries = Metadata.get(target.constructor, "childQueries", []);
1176
- childQueries.push({
1177
- key: key2,
1178
- selector,
1179
- all,
1180
- refresh: options.refresh
1181
- });
1182
- Metadata.add(target.constructor, { childQueries });
869
+ function Me(e, t, s) {
870
+ return (n, i) => {
871
+ const r = N.get(n.constructor, "childQueries", []);
872
+ r.push({
873
+ key: i,
874
+ selector: e,
875
+ all: s,
876
+ refresh: t.refresh
877
+ }), N.add(n.constructor, { childQueries: r });
1183
878
  };
1184
879
  }
1185
- function QuerySelector(selector, options = {}) {
1186
- return querySelectorDecorator(selector, options);
1187
- }
1188
- function QuerySelectorAll(selector, options = {}) {
1189
- return querySelectorDecorator(selector, options, true);
1190
- }
1191
- function Watch() {
1192
- return (target, key2) => {
1193
- const privateKey = Symbol(key2);
1194
- Object.defineProperties(target, {
1195
- [privateKey]: {
1196
- writable: true,
1197
- enumerable: false,
1198
- configurable: false,
1199
- value: target[key2]
880
+ function xe(e, t = {}) {
881
+ return Me(e, t);
882
+ }
883
+ function is(e, t = {}) {
884
+ return Me(e, t, !0);
885
+ }
886
+ function et() {
887
+ return (e, t) => {
888
+ const s = Symbol(t);
889
+ Object.defineProperties(e, {
890
+ [s]: {
891
+ writable: !0,
892
+ enumerable: !1,
893
+ configurable: !1,
894
+ value: e[t]
1200
895
  },
1201
- [key2]: {
896
+ [t]: {
1202
897
  get() {
1203
- return this[privateKey];
898
+ return this[s];
1204
899
  },
1205
- set(newValue) {
1206
- if (this[privateKey] !== newValue) {
1207
- this[privateKey] = newValue;
1208
- this.update();
1209
- }
900
+ set(n) {
901
+ this[s] !== n && (this[s] = n, this.update());
1210
902
  }
1211
903
  }
1212
904
  });
1213
905
  };
1214
906
  }
1215
- var MIMEType;
1216
- (function(MIMEType2) {
1217
- MIMEType2["7Z"] = "application/x-7z-compressed";
1218
- MIMEType2["AAC"] = "audio/aac";
1219
- MIMEType2["ABW"] = "application/x-abiword";
1220
- MIMEType2["ARC"] = "application/octet-stream";
1221
- MIMEType2["AVI"] = "video/x-msvideo";
1222
- MIMEType2["AZW"] = "application/vnd.amazon.ebook";
1223
- MIMEType2["BIN"] = "application/octet-stream";
1224
- MIMEType2["BMP"] = "image/bmp";
1225
- MIMEType2["BZ"] = "application/x-bzip";
1226
- MIMEType2["BZ2"] = "application/x-bzip2";
1227
- MIMEType2["CSH"] = "application/x-csh";
1228
- MIMEType2["CSS"] = "text/css";
1229
- MIMEType2["CSV"] = "text/csv,application/vnd.ms-excel";
1230
- MIMEType2["DOC"] = "application/msword";
1231
- MIMEType2["DOCX"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
1232
- MIMEType2["EOT"] = "application/vnd.ms-fontobject";
1233
- MIMEType2["EPUB"] = "application/epub+zip";
1234
- MIMEType2["ES"] = "application/ecmascript";
1235
- MIMEType2["FLV"] = "video/x-flv";
1236
- MIMEType2["GIF"] = "image/gif";
1237
- MIMEType2["GZ"] = "application/x-gzip";
1238
- MIMEType2["HTM"] = "text/html";
1239
- MIMEType2["HTML"] = "text/html";
1240
- MIMEType2["ICO"] = "image/x-icon";
1241
- MIMEType2["ICS"] = "text/calendar";
1242
- MIMEType2["JAR"] = "application/java-archive";
1243
- MIMEType2["JPEG"] = "image/jpeg";
1244
- MIMEType2["JPG"] = "image/jpeg";
1245
- MIMEType2["JS"] = "application/javascript";
1246
- MIMEType2["JSON"] = "application/json";
1247
- MIMEType2["M3U"] = "audio/x-mpequrl";
1248
- MIMEType2["MID"] = "audio/midi";
1249
- MIMEType2["MIDI"] = "audio/midi";
1250
- MIMEType2["MOV"] = "video/quicktime";
1251
- MIMEType2["MP3"] = "audio/mpeg3";
1252
- MIMEType2["MP4"] = "video/mp4";
1253
- MIMEType2["MPEG"] = "video/mpeg";
1254
- MIMEType2["MPKG"] = "application/vnd.apple.installer+xml";
1255
- MIMEType2["ODP"] = "application/vnd.oasis.opendocument.presentation";
1256
- MIMEType2["ODS"] = "application/vnd.oasis.opendocument.spreadsheet";
1257
- MIMEType2["ODT"] = "application/vnd.oasis.opendocument.text";
1258
- MIMEType2["OGA"] = "audio/ogg";
1259
- MIMEType2["OGV"] = "video/ogg";
1260
- MIMEType2["OGX"] = "application/ogg";
1261
- MIMEType2["OTF"] = "font/otf";
1262
- MIMEType2["PNG"] = "image/png";
1263
- MIMEType2["PDF"] = "application/pdf";
1264
- MIMEType2["PPT"] = "application/vnd.ms-powerpoint";
1265
- MIMEType2["PPTX"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
1266
- MIMEType2["RAR"] = "application/x-rar-compressed";
1267
- MIMEType2["RTF"] = "application/rtf";
1268
- MIMEType2["SH"] = "application/x-sh";
1269
- MIMEType2["SVG"] = "image/svg+xml";
1270
- MIMEType2["SWF"] = "application/x-shockwave-flash";
1271
- MIMEType2["TAR"] = "application/x-tar";
1272
- MIMEType2["TIF"] = "image/tiff";
1273
- MIMEType2["TIFF"] = "image/tiff";
1274
- MIMEType2["TS"] = "application/typescript";
1275
- MIMEType2["TTF"] = "font/ttf";
1276
- MIMEType2["TXT"] = "text/plain";
1277
- MIMEType2["VSD"] = "application/vnd.visio";
1278
- MIMEType2["WAV"] = "audio/wav";
1279
- MIMEType2["WEBA"] = "audio/webm";
1280
- MIMEType2["WEBM"] = "video/webm";
1281
- MIMEType2["WEBP"] = "image/webp";
1282
- MIMEType2["WOFF"] = "font/woff";
1283
- MIMEType2["WOFF2"] = "font/woff2";
1284
- MIMEType2["XHTML"] = "application/xhtml+xml";
1285
- MIMEType2["XLS"] = "application/vnd.ms-excel";
1286
- MIMEType2["XLSX"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1287
- MIMEType2["XML"] = "application/xml";
1288
- MIMEType2["XUL"] = "application/vnd.mozilla.xul+xml";
1289
- MIMEType2["ZIP"] = "application/zip";
1290
- })(MIMEType || (MIMEType = {}));
1291
- var __defProp$5 = Object.defineProperty;
1292
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1293
- var __decorateClass$5 = (decorators, target, key2, kind) => {
1294
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key2) : target;
1295
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1296
- if (decorator = decorators[i])
1297
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
1298
- if (kind && result)
1299
- __defProp$5(target, key2, result);
1300
- return result;
1301
- };
1302
- const CPT_NAME$3 = "sps-file-upload";
1303
- let SpsFileUploadComponent = class extends HTMLElement {
907
+ var rs = Object.defineProperty, as = Object.getOwnPropertyDescriptor, E = (e, t, s, n) => {
908
+ for (var i = n > 1 ? void 0 : n ? as(t, s) : t, r = e.length - 1, l; r >= 0; r--)
909
+ (l = e[r]) && (i = (n ? l(t, s, i) : l(i)) || i);
910
+ return n && i && rs(t, s, i), i;
911
+ }, os = /* @__PURE__ */ ((e) => (e.FIT = "fit", e.FILL = "fill", e))(os || {});
912
+ const F = "sps-photo";
913
+ var q;
914
+ let O = (q = class extends HTMLElement {
1304
915
  constructor() {
1305
- super();
1306
- this.shown = true;
1307
- this.files = [];
1308
- this.acceptMIMETypes = new Set();
1309
- this.active = false;
1310
- this.error = false;
1311
- this.namesOfUnsupportedFiles = [];
1312
- this.handleBrowseLinkClick = this.handleBrowseLinkClick.bind(this);
1313
- this.handleDownloadButtonClick = this.handleDownloadButtonClick.bind(this);
1314
- this.handleFileInputChange = this.handleFileInputChange.bind(this);
1315
- this.dismiss = this.dismiss.bind(this);
916
+ super(...arguments);
917
+ a(this, "src");
918
+ a(this, "altText");
919
+ a(this, "mode", "fill");
920
+ a(this, "placeholderIcon");
921
+ a(this, "width");
922
+ a(this, "fitWidth");
923
+ a(this, "imageInternal");
924
+ a(this, "waitForWidthInterval");
925
+ a(this, "waitForImgHeightInterval");
1316
926
  }
1317
- get [ClassBindings]() {
1318
- return [
1319
- CPT_NAME$3,
1320
- this.active && `${CPT_NAME$3}--active`,
1321
- this.error && `${CPT_NAME$3}--error`,
1322
- !this.shown && `${CPT_NAME$3}--hidden`,
1323
- this.mini && `${CPT_NAME$3}--mini`,
1324
- this.constrainContentWidth && `${CPT_NAME$3}--constrained-content-width`
1325
- ];
927
+ get image() {
928
+ return this.imageInternal;
1326
929
  }
1327
- connectedCallback() {
1328
- this.description = this.description || (this.multiple ? "Files" : "File");
1329
- if (this.acceptExtensions) {
1330
- this.processAcceptExtensions(this.acceptExtensions);
1331
- }
1332
- if (this.maxSize) {
1333
- this.parseAndValidateMaxSize(this.maxSize);
1334
- }
930
+ set image(t) {
931
+ this.imageInternal = t, t && (this.waitForImgHeightInterval && window.clearInterval(this.waitForImgHeightInterval), this.waitForImgHeightInterval = window.setInterval(() => {
932
+ const s = t.getBoundingClientRect();
933
+ if (s.height) {
934
+ window.clearInterval(this.waitForImgHeightInterval), delete this.waitForImgHeightInterval;
935
+ let n = !0;
936
+ n = s.width / s.height > 1, this.fitWidth = n === (this.mode === "fit");
937
+ }
938
+ }, 1e3 / 60));
1335
939
  }
1336
- attributeChangedCallback(attrName, oldValue, newValue) {
1337
- if (attrName === "acceptExtensions") {
1338
- this.processAcceptExtensions(newValue);
1339
- }
1340
- if (attrName === "maxSize") {
1341
- this.parseAndValidateMaxSize(newValue);
1342
- }
940
+ get [T]() {
941
+ return [
942
+ F,
943
+ this.fitWidth ? `${F}--fit-width` : `${F}--fit-height`,
944
+ this.placeholderIcon && `${F}--placeholder`
945
+ ];
1343
946
  }
1344
- dismiss() {
1345
- if (this.dismissable) {
1346
- this.shown = false;
1347
- this.update();
1348
- this.dismissal.dispatch();
1349
- }
947
+ get [he]() {
948
+ return {
949
+ fontSize: `${this.width * 0.05}rem`,
950
+ width: `${this.width}rem`,
951
+ height: `${0.75 * this.width}rem`
952
+ };
1350
953
  }
1351
- show() {
1352
- if (this.dismissable) {
1353
- this.shown = true;
1354
- this.update();
1355
- }
954
+ connectedCallback() {
955
+ this.waitForWidthInterval = window.setInterval(() => {
956
+ const t = this.getBoundingClientRect();
957
+ t.width && (this.setWidth(t.width), window.clearInterval(this.waitForWidthInterval), delete this.waitForWidthInterval);
958
+ }, 1e3 / 60);
1356
959
  }
1357
- render({ t }) {
1358
- const icon = this.error ? SpsIcon.EXCLAMATION_CIRCLE : SpsIcon.UPLOAD_CLOUD;
1359
- const instructions = (this.multiple ? t("design-system:fileUpload.instructions_plural") : t("design-system:fileUpload.instructions")).split("|");
1360
- return /* @__PURE__ */ h("div", {
1361
- "data-fragment": true
1362
- }, /* @__PURE__ */ h("div", {
1363
- className: `${CPT_NAME$3}__content`
1364
- }, this.processing ? /* @__PURE__ */ h("div", {
1365
- "data-fragment": true
1366
- }, /* @__PURE__ */ h("i", {
1367
- className: "sps-spinner sps-spinner--medium",
1368
- "aria-hidden": "true"
1369
- }), /* @__PURE__ */ h("div", {
1370
- className: `${CPT_NAME$3}__instructions`
1371
- }, t("design-system:fileUpload.processing"))) : /* @__PURE__ */ h("div", {
1372
- "data-fragment": true
1373
- }, /* @__PURE__ */ h("i", {
1374
- className: `sps-icon sps-icon-${icon} ${CPT_NAME$3}__icon-primary`,
1375
- "aria-hidden": "true"
1376
- }), /* @__PURE__ */ h("div", {
1377
- className: `${CPT_NAME$3}__title`
1378
- }, this.error ? /* @__PURE__ */ h("div", {
1379
- "data-fragment": true
1380
- }, t(this.namesOfUnsupportedFiles.length > 1 ? "design-system:fileUpload.cancelled_plural" : "design-system:fileUpload.cancelled")) : /* @__PURE__ */ h("div", {
1381
- "data-fragment": true
1382
- }, t("design-system:fileUpload.title", { description: this.description }))), this.error ? /* @__PURE__ */ h("div", {
1383
- className: `${CPT_NAME$3}__errored-files`
1384
- }, new Set(this.namesOfUnsupportedFiles.map((name, i) => {
1385
- const breakpoint = Math.floor(name.length / 2);
1386
- return /* @__PURE__ */ h("div", {
1387
- className: `${CPT_NAME$3}__errored-filename`,
1388
- key: name
1389
- }, /* @__PURE__ */ h("span", {
1390
- className: `${CPT_NAME$3}__errored-filename-segment`
1391
- }, name.substr(0, breakpoint)), /* @__PURE__ */ h("div", {
1392
- className: `${CPT_NAME$3}__errored-filename-segment`
1393
- }, /* @__PURE__ */ h("span", null, name.substr(breakpoint))), i < this.namesOfUnsupportedFiles.length - 1 ? "," : "");
1394
- }))) : /* @__PURE__ */ h("span", null), /* @__PURE__ */ h("div", {
1395
- className: `${CPT_NAME$3}__instructions`
1396
- }, /* @__PURE__ */ h("div", {
1397
- "data-fragment": true
1398
- }, /* @__PURE__ */ h("span", null, instructions[0]), /* @__PURE__ */ h("a", {
1399
- href: "",
1400
- onClick: this.handleBrowseLinkClick
1401
- }, instructions[1]), /* @__PURE__ */ h("span", null, instructions[2]))), /* @__PURE__ */ h("div", {
1402
- className: `${CPT_NAME$3}__requirements`
1403
- }, this.acceptExtensions ? /* @__PURE__ */ h("span", null, "(", " ", t("design-system:fileUpload.acceptedTypes", { fileTypes: this.acceptExtensionsDescription }), " ", ")") : "", this.maxSize ? /* @__PURE__ */ h("span", null, "(", " ", t("design-system:fileUpload.maximumSize", { size: this.maxSize }), " ", ")") : "", this.customRequirement ? /* @__PURE__ */ h("span", null, " ", this.customRequirement, " ") : ""), this.downloadLabel && /* @__PURE__ */ h("div", {
1404
- className: `sps-button sps-button--link ${CPT_NAME$3}__download-button`,
1405
- onClick: this.handleDownloadButtonClick
1406
- }, /* @__PURE__ */ h("button", {
1407
- type: "button"
1408
- }, /* @__PURE__ */ h("i", {
1409
- className: "sps-icon sps-icon-download-cloud",
1410
- "aria-hidden": "true"
1411
- }), " ", this.downloadLabel)))), this.dismissable && !this.processing && /* @__PURE__ */ h("div", {
1412
- className: `sps-button sps-button--icon ${CPT_NAME$3}__close-button`,
1413
- onClick: this.dismiss
1414
- }, /* @__PURE__ */ h("button", {
1415
- type: "button",
1416
- title: t("design-system:fileUpload.close")
1417
- }, /* @__PURE__ */ h("i", {
1418
- className: "sps-icon sps-icon-x",
1419
- "aria-hidden": "true"
1420
- }))), /* @__PURE__ */ h("form", null, /* @__PURE__ */ h("input", {
1421
- type: "file",
1422
- accept: this.accept || "*/*",
1423
- multiple: this.multiple || null,
1424
- onChange: this.handleFileInputChange
1425
- })));
960
+ disconnectedCallback() {
961
+ this.waitForWidthInterval && window.clearInterval(this.waitForWidthInterval), this.waitForImgHeightInterval && window.clearInterval(this.waitForImgHeightInterval);
1426
962
  }
1427
- parseAndValidateMaxSize(maxSize) {
1428
- try {
1429
- this.maxSizeBytes = parseFileSize(maxSize);
1430
- } catch (error) {
1431
- throw new Error(`Could not parse "${maxSize}" as a file size.`);
1432
- }
963
+ render() {
964
+ return this.src ? this.width ? /* @__PURE__ */ o("img", {
965
+ src: this.src,
966
+ alt: this.altText
967
+ }) : /* @__PURE__ */ o("span", null) : /* @__PURE__ */ o("i", {
968
+ className: `sps-icon sps-icon-${this.placeholderIcon}`
969
+ });
1433
970
  }
1434
- processAcceptExtensions(acceptExtensions) {
1435
- const splitExtensions = Array.isArray(acceptExtensions) ? acceptExtensions : acceptExtensions.trim().split(/\s?,\s?/);
1436
- const trimmedExtensions = splitExtensions.map((ext2) => ext2.replace(/^\./, ""));
1437
- const extList = trimmedExtensions.map((ext2) => `.${ext2}`.toLowerCase());
1438
- this.acceptExtensionsDescription = extList.map((ext2, i) => i > 0 && i === extList.length - 1 ? `or ${ext2}` : ext2).join(extList.length > 2 ? ", " : " ");
1439
- this.acceptMIMETypes.clear();
1440
- for (const ext2 of trimmedExtensions) {
1441
- for (const type of MIMEType[ext2.toUpperCase()].split(",")) {
1442
- this.acceptMIMETypes.add(type);
1443
- }
971
+ setWidth(t) {
972
+ if (t && !this.width) {
973
+ const s = document.body.parentElement.style.fontSize || "16px", n = Number(s.substr(0, s.length - 2));
974
+ this.width = t / n;
1444
975
  }
1445
- this.accept = extList.concat(Array.from(this.acceptMIMETypes)).join(",");
1446
976
  }
1447
- selectFiles(files) {
1448
- this.namesOfUnsupportedFiles = [];
1449
- const fileArray = Array.from(files);
1450
- for (const file of fileArray) {
1451
- if (this.acceptExtensions && !this.acceptMIMETypes.has(file.type)) {
1452
- this.namesOfUnsupportedFiles.push(file.name);
1453
- }
1454
- if (this.maxSize && file.size > this.maxSizeBytes && this.namesOfUnsupportedFiles.indexOf(file.name) === -1) {
1455
- this.namesOfUnsupportedFiles.push(file.name);
977
+ }, a(q, "displayName", F), a(q, "props", {
978
+ src: "string",
979
+ altText: "string",
980
+ mode: "SpsPhotoDisplayMode",
981
+ placeholderIcon: "SpsIcon"
982
+ }), q);
983
+ E([
984
+ p()
985
+ ], O.prototype, "src", 2);
986
+ E([
987
+ p()
988
+ ], O.prototype, "altText", 2);
989
+ E([
990
+ p()
991
+ ], O.prototype, "mode", 2);
992
+ E([
993
+ p()
994
+ ], O.prototype, "placeholderIcon", 2);
995
+ E([
996
+ et()
997
+ ], O.prototype, "width", 2);
998
+ E([
999
+ et()
1000
+ ], O.prototype, "fitWidth", 2);
1001
+ E([
1002
+ xe("img", { refresh: !0 })
1003
+ ], O.prototype, "image", 1);
1004
+ O = E([
1005
+ j({ tag: F })
1006
+ ], O);
1007
+ const ls = {
1008
+ sizing: {
1009
+ label: "Sizing",
1010
+ description: c`
1011
+ <p>
1012
+ Photos are block elements, so a photo fills its container's width unless
1013
+ an explicit width is set. It is always a 4:3 aspect ratio. In this example,
1014
+ photos have been placed in cards which have different widths in the 12
1015
+ column grid.
1016
+ </p>
1017
+ `,
1018
+ examples: {
1019
+ basic: {
1020
+ jsx: c`
1021
+ <div className="sfg-row">
1022
+ <div className="sfg-col-2">
1023
+ <sps-card>
1024
+ <sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
1025
+ </sps-card>
1026
+ </div>
1027
+ <div className="sfg-col-4">
1028
+ <sps-card>
1029
+ <sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
1030
+ </sps-card>
1031
+ </div>
1032
+ <div className="sfg-col-6">
1033
+ <sps-card>
1034
+ <sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
1035
+ </sps-card>
1036
+ </div>
1037
+ </div>
1038
+ `
1456
1039
  }
1457
1040
  }
1458
- if (this.namesOfUnsupportedFiles.length) {
1459
- this.error = true;
1460
- this.fileInput.value = null;
1461
- this.update();
1462
- } else {
1463
- this.files = fileArray;
1464
- this.selection.dispatch(fileArray);
1465
- }
1466
- }
1467
- handleDragOver(event) {
1468
- event.preventDefault();
1469
- event.stopPropagation();
1470
- }
1471
- handleDragEnter(event) {
1472
- event.preventDefault();
1473
- this.active = true;
1474
- this.error = false;
1475
- this.update();
1476
- }
1477
- handleDragLeave(event) {
1478
- event.preventDefault();
1479
- this.active = false;
1480
- this.update();
1481
- }
1482
- handleDrop(event) {
1483
- event.preventDefault();
1484
- event.stopPropagation();
1485
- this.active = false;
1486
- if (event.dataTransfer.items) {
1487
- this.selectFiles(Array.from(event.dataTransfer.items).map((item) => item.getAsFile()));
1488
- } else {
1489
- this.selectFiles(event.dataTransfer.files);
1490
- }
1491
- this.update();
1492
- }
1493
- handleBrowseLinkClick(event) {
1494
- event.preventDefault();
1495
- this.error = false;
1496
- this.update();
1497
- this.fileInput.click();
1498
- }
1499
- handleDownloadButtonClick() {
1500
- this.download.dispatch();
1501
- }
1502
- handleFileInputChange(event) {
1503
- event.stopPropagation();
1504
- this.selectFiles(event.target.files);
1505
- }
1506
- };
1507
- SpsFileUploadComponent.displayName = CPT_NAME$3;
1508
- SpsFileUploadComponent.props = {
1509
- description: "string",
1510
- multiple: "boolean",
1511
- dismissable: "boolean",
1512
- processing: "boolean",
1513
- mini: "boolean",
1041
+ },
1042
+ displayMode: {
1043
+ label: "Fill vs. Fit",
1044
+ description: c`
1045
+ <p>
1046
+ There are two display modes available:
1047
+ <ul>
1048
+ <li><b>"fill"</b> fills the entire 4:3 container, cropping off any excess portions of the image.
1049
+ <li><b>"fit"</b> fits the entire image into the container, leaving any excess portions of the container blank.
1050
+ </ul>
1051
+ </p>
1052
+ `,
1053
+ examples: {
1054
+ landscape: {
1055
+ description: "<p>Landscape oriented photo (container outline added for illustrative purposes)</p>",
1056
+ jsx: c`
1057
+ <div className="sfg-row">
1058
+ <div className="sfg-col-4">
1059
+ <sps-photo src="assets/images/photo-landscape.jpg" mode="fill"></sps-photo>
1060
+ </div>
1061
+ <div className="sfg-col-4">
1062
+ <sps-photo src="assets/images/photo-landscape.jpg" mode="fit"></sps-photo>
1063
+ </div>
1064
+ </div>
1065
+ `
1066
+ },
1067
+ portrait: {
1068
+ description: "<p>Portrait oriented photo (container outline added for illustrative purposes)</p>",
1069
+ jsx: c`
1070
+ <div className="sfg-row">
1071
+ <div className="sfg-col-4">
1072
+ <sps-photo src="assets/images/photo-portrait.jpg" mode="fill"></sps-photo>
1073
+ </div>
1074
+ <div className="sfg-col-4">
1075
+ <sps-photo id="foo" src="assets/images/photo-portrait.jpg" mode="fit"></sps-photo>
1076
+ </div>
1077
+ </div>
1078
+ `
1079
+ }
1080
+ }
1081
+ },
1082
+ placeholder: {
1083
+ label: "Placeholders",
1084
+ description: c`
1085
+ <p>
1086
+ When an image is not provided for a particular use case (such as a user avatar,
1087
+ a company photo, item image, etc.), a placeholder should be shown in its place.
1088
+
1089
+ The placeholder's icon, selected from our SPS icon set, should represent the
1090
+ type of image it is substituting for.
1091
+ </p>
1092
+ `,
1093
+ examples: {
1094
+ general: {
1095
+ description: "<p>General Photo</p>",
1096
+ jsx: c`
1097
+ <div className="sfg-row">
1098
+ <div className="sfg-col-3">
1099
+ <sps-photo placeholderIcon="photo"></sps-photo>
1100
+ </div>
1101
+ </div>
1102
+ `
1103
+ },
1104
+ photoAlt: {
1105
+ description: "<p>Photo Alt</p>",
1106
+ jsx: c`
1107
+ <div className="sfg-row">
1108
+ <div className="sfg-col-3">
1109
+ <sps-photo placeholderIcon="camera"></sps-photo>
1110
+ </div>
1111
+ </div>
1112
+ `
1113
+ },
1114
+ user: {
1115
+ description: "<p>User / Single Person</p>",
1116
+ jsx: c`
1117
+ <div className="sfg-row">
1118
+ <div className="sfg-col-3">
1119
+ <sps-photo placeholderIcon="user"></sps-photo>
1120
+ </div>
1121
+ </div>
1122
+ `
1123
+ },
1124
+ group: {
1125
+ description: "<p>Group / Multiple People</p>",
1126
+ jsx: c`
1127
+ <div className="sfg-row">
1128
+ <div className="sfg-col-3">
1129
+ <sps-photo placeholderIcon="group"></sps-photo>
1130
+ </div>
1131
+ </div>
1132
+ `
1133
+ },
1134
+ company: {
1135
+ description: "<p>Company / Building</p>",
1136
+ jsx: c`
1137
+ <div className="sfg-row">
1138
+ <div className="sfg-col-3">
1139
+ <sps-photo placeholderIcon="building"></sps-photo>
1140
+ </div>
1141
+ </div>
1142
+ `
1143
+ }
1144
+ }
1145
+ }
1146
+ }, Ss = {
1147
+ Photos: {
1148
+ components: [O],
1149
+ examples: ls
1150
+ }
1151
+ };
1152
+ var tt = /* @__PURE__ */ ((e) => (e["7Z"] = "application/x-7z-compressed", e.AAC = "audio/aac", e.ABW = "application/x-abiword", e.ARC = "application/octet-stream", e.AVI = "video/x-msvideo", e.AZW = "application/vnd.amazon.ebook", e.BIN = "application/octet-stream", e.BMP = "image/bmp", e.BZ = "application/x-bzip", e.BZ2 = "application/x-bzip2", e.CSH = "application/x-csh", e.CSS = "text/css", e.CSV = "text/csv,application/vnd.ms-excel", e.DOC = "application/msword", e.DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", e.EOT = "application/vnd.ms-fontobject", e.EPUB = "application/epub+zip", e.ES = "application/ecmascript", e.FLV = "video/x-flv", e.GIF = "image/gif", e.GZ = "application/x-gzip", e.HTM = "text/html", e.HTML = "text/html", e.ICO = "image/x-icon", e.ICS = "text/calendar", e.JAR = "application/java-archive", e.JPEG = "image/jpeg", e.JPG = "image/jpeg", e.JS = "application/javascript", e.JSON = "application/json", e.M3U = "audio/x-mpequrl", e.MID = "audio/midi", e.MIDI = "audio/midi", e.MOV = "video/quicktime", e.MP3 = "audio/mpeg3", e.MP4 = "video/mp4", e.MPEG = "video/mpeg", e.MPKG = "application/vnd.apple.installer+xml", e.ODP = "application/vnd.oasis.opendocument.presentation", e.ODS = "application/vnd.oasis.opendocument.spreadsheet", e.ODT = "application/vnd.oasis.opendocument.text", e.OGA = "audio/ogg", e.OGV = "video/ogg", e.OGX = "application/ogg", e.OTF = "font/otf", e.PNG = "image/png", e.PDF = "application/pdf", e.PPT = "application/vnd.ms-powerpoint", e.PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation", e.RAR = "application/x-rar-compressed", e.RTF = "application/rtf", e.SH = "application/x-sh", e.SVG = "image/svg+xml", e.SWF = "application/x-shockwave-flash", e.TAR = "application/x-tar", e.TIF = "image/tiff", e.TIFF = "image/tiff", e.TS = "application/typescript", e.TTF = "font/ttf", e.TXT = "text/plain", e.VSD = "application/vnd.visio", e.WAV = "audio/wav", e.WEBA = "audio/webm", e.WEBM = "video/webm", e.WEBP = "image/webp", e.WOFF = "font/woff", e.WOFF2 = "font/woff2", e.XHTML = "application/xhtml+xml", e.XLS = "application/vnd.ms-excel", e.XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", e.XML = "application/xml", e.XUL = "application/vnd.mozilla.xul+xml", e.ZIP = "application/zip", e))(tt || {}), cs = Object.defineProperty, ps = Object.getOwnPropertyDescriptor, v = (e, t, s, n) => {
1153
+ for (var i = n > 1 ? void 0 : n ? ps(t, s) : t, r = e.length - 1, l; r >= 0; r--)
1154
+ (l = e[r]) && (i = (n ? l(t, s, i) : l(i)) || i);
1155
+ return n && i && cs(t, s, i), i;
1156
+ };
1157
+ const m = "sps-file-upload";
1158
+ var G;
1159
+ let f = (G = class extends HTMLElement {
1160
+ constructor() {
1161
+ super();
1162
+ a(this, "description");
1163
+ a(this, "multiple");
1164
+ a(this, "shown", !0);
1165
+ a(this, "dismissable");
1166
+ a(this, "processing");
1167
+ a(this, "mini");
1168
+ a(this, "constrainContentWidth");
1169
+ a(this, "downloadLabel");
1170
+ a(this, "acceptExtensions");
1171
+ a(this, "maxSize");
1172
+ a(this, "customRequirement");
1173
+ a(this, "selection");
1174
+ a(this, "dismissal");
1175
+ a(this, "download");
1176
+ a(this, "fileInput");
1177
+ a(this, "files", []);
1178
+ a(this, "accept");
1179
+ a(this, "acceptMIMETypes", /* @__PURE__ */ new Set());
1180
+ a(this, "acceptExtensionsDescription");
1181
+ a(this, "maxSizeBytes");
1182
+ a(this, "active", !1);
1183
+ a(this, "error", !1);
1184
+ a(this, "namesOfUnsupportedFiles", []);
1185
+ this.handleBrowseLinkClick = this.handleBrowseLinkClick.bind(this), this.handleDownloadButtonClick = this.handleDownloadButtonClick.bind(this), this.handleFileInputChange = this.handleFileInputChange.bind(this), this.dismiss = this.dismiss.bind(this);
1186
+ }
1187
+ get [T]() {
1188
+ return [
1189
+ m,
1190
+ this.active && `${m}--active`,
1191
+ this.error && `${m}--error`,
1192
+ !this.shown && `${m}--hidden`,
1193
+ this.mini && `${m}--mini`,
1194
+ this.constrainContentWidth && `${m}--constrained-content-width`
1195
+ ];
1196
+ }
1197
+ connectedCallback() {
1198
+ this.description = this.description || (this.multiple ? "Files" : "File"), this.acceptExtensions && this.processAcceptExtensions(this.acceptExtensions), this.maxSize && this.parseAndValidateMaxSize(this.maxSize);
1199
+ }
1200
+ attributeChangedCallback(t, s, n) {
1201
+ t === "acceptExtensions" && this.processAcceptExtensions(n), t === "maxSize" && this.parseAndValidateMaxSize(n);
1202
+ }
1203
+ dismiss() {
1204
+ this.dismissable && (this.shown = !1, this.update(), this.dismissal.dispatch());
1205
+ }
1206
+ show() {
1207
+ this.dismissable && (this.shown = !0, this.update());
1208
+ }
1209
+ render({ t }) {
1210
+ const s = this.error ? Se.EXCLAMATION_CIRCLE : Se.UPLOAD_CLOUD, n = (this.multiple ? t("design-system:fileUpload.instructions_plural") : t("design-system:fileUpload.instructions")).split("|");
1211
+ return /* @__PURE__ */ o("div", {
1212
+ "data-fragment": !0
1213
+ }, /* @__PURE__ */ o("div", {
1214
+ className: `${m}__content`
1215
+ }, this.processing ? /* @__PURE__ */ o("div", {
1216
+ "data-fragment": !0
1217
+ }, /* @__PURE__ */ o("i", {
1218
+ className: "sps-spinner sps-spinner--medium",
1219
+ "aria-hidden": "true"
1220
+ }), /* @__PURE__ */ o("div", {
1221
+ className: `${m}__instructions`
1222
+ }, t("design-system:fileUpload.processing"))) : /* @__PURE__ */ o("div", {
1223
+ "data-fragment": !0
1224
+ }, /* @__PURE__ */ o("i", {
1225
+ className: `sps-icon sps-icon-${s} ${m}__icon-primary`,
1226
+ "aria-hidden": "true"
1227
+ }), /* @__PURE__ */ o("div", {
1228
+ className: `${m}__title`
1229
+ }, this.error ? /* @__PURE__ */ o("div", {
1230
+ "data-fragment": !0
1231
+ }, t(
1232
+ this.namesOfUnsupportedFiles.length > 1 ? "design-system:fileUpload.cancelled_plural" : "design-system:fileUpload.cancelled"
1233
+ )) : /* @__PURE__ */ o("div", {
1234
+ "data-fragment": !0
1235
+ }, t("design-system:fileUpload.title", { description: this.description }))), this.error ? /* @__PURE__ */ o("div", {
1236
+ className: `${m}__errored-files`
1237
+ }, new Set(this.namesOfUnsupportedFiles.map((i, r) => {
1238
+ const l = Math.floor(i.length / 2);
1239
+ return /* @__PURE__ */ o("div", {
1240
+ className: `${m}__errored-filename`,
1241
+ key: i
1242
+ }, /* @__PURE__ */ o("span", {
1243
+ className: `${m}__errored-filename-segment`
1244
+ }, i.substr(0, l)), /* @__PURE__ */ o("div", {
1245
+ className: `${m}__errored-filename-segment`
1246
+ }, /* @__PURE__ */ o("span", null, i.substr(l))), r < this.namesOfUnsupportedFiles.length - 1 ? "," : "");
1247
+ }))) : /* @__PURE__ */ o("span", null), /* @__PURE__ */ o("div", {
1248
+ className: `${m}__instructions`
1249
+ }, /* @__PURE__ */ o("div", {
1250
+ "data-fragment": !0
1251
+ }, /* @__PURE__ */ o("span", null, n[0]), /* @__PURE__ */ o("a", {
1252
+ href: "",
1253
+ onClick: this.handleBrowseLinkClick
1254
+ }, n[1]), /* @__PURE__ */ o("span", null, n[2]))), /* @__PURE__ */ o("div", {
1255
+ className: `${m}__requirements`
1256
+ }, this.acceptExtensions ? /* @__PURE__ */ o("span", null, "(", " ", t("design-system:fileUpload.acceptedTypes", { fileTypes: this.acceptExtensionsDescription }), " ", ")") : "", this.maxSize ? /* @__PURE__ */ o("span", null, "(", " ", t("design-system:fileUpload.maximumSize", { size: this.maxSize }), " ", ")") : "", this.customRequirement ? /* @__PURE__ */ o("span", null, " ", this.customRequirement, " ") : ""), this.downloadLabel && /* @__PURE__ */ o("div", {
1257
+ className: `sps-button sps-button--link ${m}__download-button`,
1258
+ onClick: this.handleDownloadButtonClick
1259
+ }, /* @__PURE__ */ o("button", {
1260
+ type: "button"
1261
+ }, /* @__PURE__ */ o("i", {
1262
+ className: "sps-icon sps-icon-download-cloud",
1263
+ "aria-hidden": "true"
1264
+ }), " ", this.downloadLabel)))), this.dismissable && !this.processing && /* @__PURE__ */ o("div", {
1265
+ className: `sps-button sps-button--icon ${m}__close-button`,
1266
+ onClick: this.dismiss
1267
+ }, /* @__PURE__ */ o("button", {
1268
+ type: "button",
1269
+ title: t("design-system:fileUpload.close")
1270
+ }, /* @__PURE__ */ o("i", {
1271
+ className: "sps-icon sps-icon-x",
1272
+ "aria-hidden": "true"
1273
+ }))), /* @__PURE__ */ o("form", null, /* @__PURE__ */ o("input", {
1274
+ type: "file",
1275
+ accept: this.accept || "*/*",
1276
+ multiple: this.multiple || null,
1277
+ onChange: this.handleFileInputChange
1278
+ })));
1279
+ }
1280
+ parseAndValidateMaxSize(t) {
1281
+ try {
1282
+ this.maxSizeBytes = ct(t);
1283
+ } catch {
1284
+ throw new Error(`Could not parse "${t}" as a file size.`);
1285
+ }
1286
+ }
1287
+ processAcceptExtensions(t) {
1288
+ const n = (Array.isArray(t) ? t : t.trim().split(/\s?,\s?/)).map((r) => r.replace(/^\./, "")), i = n.map((r) => `.${r}`.toLowerCase());
1289
+ this.acceptExtensionsDescription = i.map((r, l) => l > 0 && l === i.length - 1 ? `or ${r}` : r).join(i.length > 2 ? ", " : " "), this.acceptMIMETypes.clear();
1290
+ for (const r of n)
1291
+ for (const l of tt[r.toUpperCase()].split(","))
1292
+ this.acceptMIMETypes.add(l);
1293
+ this.accept = i.concat(Array.from(this.acceptMIMETypes)).join(",");
1294
+ }
1295
+ selectFiles(t) {
1296
+ this.namesOfUnsupportedFiles = [];
1297
+ const s = Array.from(t);
1298
+ for (const n of s)
1299
+ this.acceptExtensions && !this.acceptMIMETypes.has(n.type) && this.namesOfUnsupportedFiles.push(n.name), this.maxSize && n.size > this.maxSizeBytes && this.namesOfUnsupportedFiles.indexOf(n.name) === -1 && this.namesOfUnsupportedFiles.push(n.name);
1300
+ this.namesOfUnsupportedFiles.length ? (this.error = !0, this.fileInput.value = null, this.update()) : (this.files = s, this.selection.dispatch(s));
1301
+ }
1302
+ handleDragOver(t) {
1303
+ t.preventDefault(), t.stopPropagation();
1304
+ }
1305
+ handleDragEnter(t) {
1306
+ t.preventDefault(), this.active = !0, this.error = !1, this.update();
1307
+ }
1308
+ handleDragLeave(t) {
1309
+ t.preventDefault(), this.active = !1, this.update();
1310
+ }
1311
+ handleDrop(t) {
1312
+ t.preventDefault(), t.stopPropagation(), this.active = !1, t.dataTransfer.items ? this.selectFiles(Array.from(t.dataTransfer.items).map(
1313
+ (s) => s.getAsFile()
1314
+ )) : this.selectFiles(t.dataTransfer.files), this.update();
1315
+ }
1316
+ handleBrowseLinkClick(t) {
1317
+ t.preventDefault(), this.error = !1, this.update(), this.fileInput.click();
1318
+ }
1319
+ handleDownloadButtonClick() {
1320
+ this.download.dispatch();
1321
+ }
1322
+ handleFileInputChange(t) {
1323
+ t.stopPropagation(), this.selectFiles(t.target.files);
1324
+ }
1325
+ }, a(G, "displayName", m), a(G, "props", {
1326
+ description: "string",
1327
+ multiple: "boolean",
1328
+ dismissable: "boolean",
1329
+ processing: "boolean",
1330
+ mini: "boolean",
1514
1331
  downloadLabel: "string",
1515
1332
  acceptExtensions: "Array<string> | string",
1516
1333
  maxSize: "string",
1517
1334
  customRequirement: "string",
1518
- selection: { event: true, type: "CustomEvent<Array<File>>" },
1519
- dismissal: { event: true, type: "CustomEvent<void>" },
1520
- download: { event: true, type: "CustomEvent<void>" }
1521
- };
1522
- __decorateClass$5([
1523
- Prop()
1524
- ], SpsFileUploadComponent.prototype, "description", 2);
1525
- __decorateClass$5([
1526
- Prop(Boolean)
1527
- ], SpsFileUploadComponent.prototype, "multiple", 2);
1528
- __decorateClass$5([
1529
- Prop(Boolean)
1530
- ], SpsFileUploadComponent.prototype, "shown", 2);
1531
- __decorateClass$5([
1532
- Prop(Boolean)
1533
- ], SpsFileUploadComponent.prototype, "dismissable", 2);
1534
- __decorateClass$5([
1535
- Prop(Boolean)
1536
- ], SpsFileUploadComponent.prototype, "processing", 2);
1537
- __decorateClass$5([
1538
- Prop(Boolean)
1539
- ], SpsFileUploadComponent.prototype, "mini", 2);
1540
- __decorateClass$5([
1541
- Prop(Boolean)
1542
- ], SpsFileUploadComponent.prototype, "constrainContentWidth", 2);
1543
- __decorateClass$5([
1544
- Prop()
1545
- ], SpsFileUploadComponent.prototype, "downloadLabel", 2);
1546
- __decorateClass$5([
1547
- Prop()
1548
- ], SpsFileUploadComponent.prototype, "acceptExtensions", 2);
1549
- __decorateClass$5([
1550
- Prop()
1551
- ], SpsFileUploadComponent.prototype, "maxSize", 2);
1552
- __decorateClass$5([
1553
- Prop()
1554
- ], SpsFileUploadComponent.prototype, "customRequirement", 2);
1555
- __decorateClass$5([
1556
- EventDispatcher()
1557
- ], SpsFileUploadComponent.prototype, "selection", 2);
1558
- __decorateClass$5([
1559
- EventDispatcher()
1560
- ], SpsFileUploadComponent.prototype, "dismissal", 2);
1561
- __decorateClass$5([
1562
- EventDispatcher()
1563
- ], SpsFileUploadComponent.prototype, "download", 2);
1564
- __decorateClass$5([
1565
- QuerySelector("input[type='file']")
1566
- ], SpsFileUploadComponent.prototype, "fileInput", 2);
1567
- __decorateClass$5([
1568
- EventListener("dragover")
1569
- ], SpsFileUploadComponent.prototype, "handleDragOver", 1);
1570
- __decorateClass$5([
1571
- EventListener("dragenter")
1572
- ], SpsFileUploadComponent.prototype, "handleDragEnter", 1);
1573
- __decorateClass$5([
1574
- EventListener("dragleave")
1575
- ], SpsFileUploadComponent.prototype, "handleDragLeave", 1);
1576
- __decorateClass$5([
1577
- EventListener("drop")
1578
- ], SpsFileUploadComponent.prototype, "handleDrop", 1);
1579
- SpsFileUploadComponent = __decorateClass$5([
1580
- Component({ tag: CPT_NAME$3 })
1581
- ], SpsFileUploadComponent);
1582
- const SpsFileUploadExamples = {
1335
+ selection: { event: !0, type: "CustomEvent<Array<File>>" },
1336
+ dismissal: { event: !0, type: "CustomEvent<void>" },
1337
+ download: { event: !0, type: "CustomEvent<void>" }
1338
+ }), G);
1339
+ v([
1340
+ p()
1341
+ ], f.prototype, "description", 2);
1342
+ v([
1343
+ p(Boolean)
1344
+ ], f.prototype, "multiple", 2);
1345
+ v([
1346
+ p(Boolean)
1347
+ ], f.prototype, "shown", 2);
1348
+ v([
1349
+ p(Boolean)
1350
+ ], f.prototype, "dismissable", 2);
1351
+ v([
1352
+ p(Boolean)
1353
+ ], f.prototype, "processing", 2);
1354
+ v([
1355
+ p(Boolean)
1356
+ ], f.prototype, "mini", 2);
1357
+ v([
1358
+ p(Boolean)
1359
+ ], f.prototype, "constrainContentWidth", 2);
1360
+ v([
1361
+ p()
1362
+ ], f.prototype, "downloadLabel", 2);
1363
+ v([
1364
+ p()
1365
+ ], f.prototype, "acceptExtensions", 2);
1366
+ v([
1367
+ p()
1368
+ ], f.prototype, "maxSize", 2);
1369
+ v([
1370
+ p()
1371
+ ], f.prototype, "customRequirement", 2);
1372
+ v([
1373
+ Ne()
1374
+ ], f.prototype, "selection", 2);
1375
+ v([
1376
+ Ne()
1377
+ ], f.prototype, "dismissal", 2);
1378
+ v([
1379
+ Ne()
1380
+ ], f.prototype, "download", 2);
1381
+ v([
1382
+ xe("input[type='file']")
1383
+ ], f.prototype, "fileInput", 2);
1384
+ v([
1385
+ re("dragover")
1386
+ ], f.prototype, "handleDragOver", 1);
1387
+ v([
1388
+ re("dragenter")
1389
+ ], f.prototype, "handleDragEnter", 1);
1390
+ v([
1391
+ re("dragleave")
1392
+ ], f.prototype, "handleDragLeave", 1);
1393
+ v([
1394
+ re("drop")
1395
+ ], f.prototype, "handleDrop", 1);
1396
+ f = v([
1397
+ j({ tag: m })
1398
+ ], f);
1399
+ const Os = {
1583
1400
  basic: {
1584
1401
  label: "Basic File Upload",
1585
- description: code`
1402
+ description: c`
1586
1403
  <p>Simply allow the user to drag-and-drop or select either a single file or multiple files at once.</p>
1587
1404
  `,
1588
1405
  examples: {
1589
1406
  single: {
1590
1407
  description: "<p>Single file upload</p>",
1591
- react: code`
1408
+ react: c`
1592
1409
  function Component() {
1593
1410
  const ref = React.useRef()
1594
1411
 
@@ -1615,7 +1432,7 @@ const SpsFileUploadExamples = {
1615
1432
  },
1616
1433
  multiple: {
1617
1434
  description: "<p>Multiple file upload</p>",
1618
- react: code`
1435
+ react: c`
1619
1436
  function Component() {
1620
1437
  const ref = React.useRef()
1621
1438
 
@@ -1644,13 +1461,13 @@ const SpsFileUploadExamples = {
1644
1461
  },
1645
1462
  restrictions: {
1646
1463
  label: "Restrictions",
1647
- description: code`
1464
+ description: c`
1648
1465
  <p>You can place restrictions on what files will be accepted with an extension whitelist and/or a maximum size.</p>
1649
1466
  `,
1650
1467
  examples: {
1651
1468
  size: {
1652
1469
  description: "<p>Maximum size</p>",
1653
- react: code`
1470
+ react: c`
1654
1471
  function Component() {
1655
1472
  const ref = React.useRef()
1656
1473
 
@@ -1677,7 +1494,7 @@ const SpsFileUploadExamples = {
1677
1494
  },
1678
1495
  type: {
1679
1496
  description: "<p>File type whitelist</p>",
1680
- react: code`
1497
+ react: c`
1681
1498
  function Component() {
1682
1499
  const ref = React.useRef()
1683
1500
 
@@ -1709,7 +1526,7 @@ const SpsFileUploadExamples = {
1709
1526
  },
1710
1527
  both: {
1711
1528
  description: "<p>Both restrictions</p>",
1712
- react: code`
1529
+ react: c`
1713
1530
  function Component() {
1714
1531
  const ref = React.useRef()
1715
1532
 
@@ -1744,13 +1561,13 @@ const SpsFileUploadExamples = {
1744
1561
  },
1745
1562
  dismissable: {
1746
1563
  label: "Dismissable",
1747
- description: code`
1564
+ description: c`
1748
1565
  <p>With this option, the file upload component can be dismissed by the user. If the user does dismiss it, you can
1749
1566
  show it again programmatically if you need to.</p>
1750
1567
  `,
1751
1568
  examples: {
1752
1569
  dismissable: {
1753
- react: code`
1570
+ react: c`
1754
1571
  function Component() {
1755
1572
  const [showFileUpload, setShowFileUpload] = React.useState(true)
1756
1573
  const ref = React.useRef()
@@ -1787,592 +1604,177 @@ const SpsFileUploadExamples = {
1787
1604
  }
1788
1605
  }
1789
1606
  },
1790
- downloadButton: {
1791
- label: "Download Button",
1792
- description: code`
1793
- <p>You can optionally provide a button to download a file. Typically this will be a template for
1794
- whatever the user is expected to upload. They can then fill out the template, save it, and upload it.</p>
1795
- `,
1796
- examples: {
1797
- downloadButton: {
1798
- react: code`
1799
- function Component() {
1800
- const ref = React.useRef()
1801
-
1802
- function handleDownload() {
1803
- console.log("Download triggered.")
1804
- }
1805
-
1806
- React.useEffect(() => {
1807
- ref.current.addEventListener("download", handleDownload)
1808
- return () => {
1809
- ref.current.removeEventListener("download", handleDownload)
1810
- }
1811
- })
1812
-
1813
- return (
1814
- <div className="sps-row">
1815
- <div className="col-12">
1816
- <sps-file-upload
1817
- ref={ref}
1818
- description="Spreadsheet"
1819
- acceptExtensions="xlsx"
1820
- downloadLabel="Download Excel Template"
1821
- />
1822
- </div>
1823
- </div>
1824
- )
1825
- }
1826
- `
1827
- }
1828
- }
1829
- },
1830
- mini: {
1831
- label: "Mini File Upload",
1832
- description: code`
1833
- <p>When the file upload component is to be placed in a small container,
1834
- it should be marked as a mini file upload so that everything fits.</p>
1835
- `,
1836
- examples: {
1837
- single: {
1838
- react: code`
1839
- function Component() {
1840
- const ref = React.useRef()
1841
-
1842
- function handleChange(event) {
1843
- console.log(event.detail)
1844
- }
1845
-
1846
- React.useEffect(() => {
1847
- ref.current.addEventListener("selection", handleChange)
1848
- return () => {
1849
- ref.current.removeEventListener("selection", handleChange)
1850
- }
1851
- })
1852
-
1853
- return (
1854
- <div className="sps-row">
1855
- <div className="col-4">
1856
- <sps-file-upload ref={ref} mini/>
1857
- </div>
1858
- </div>
1859
- )
1860
- }
1861
- `
1862
- }
1863
- }
1864
- },
1865
- constrainContentWidth: {
1866
- label: "Constrain Content Width",
1867
- description: code`
1868
- <p>If this prop is provided, the content will be restricted to 50% of
1869
- the overall width of the component. Consult your product designer if
1870
- you're not sure whether to use this variant.</p>
1871
- `,
1872
- examples: {
1873
- constrainContentWidth: {
1874
- react: code`
1875
- function Component() {
1876
- const ref = React.useRef()
1877
-
1878
- function handleChange(event: CustomEvent<Array<File>>) {
1879
- console.log(event.detail)
1880
- }
1881
-
1882
- React.useEffect(() => {
1883
- ref.current.addEventListener("selection", handleChange)
1884
- return () => {
1885
- ref.current.removeEventListener("selection", handleChange)
1886
- }
1887
- })
1888
-
1889
- return (
1890
- <div className="sps-row">
1891
- <div className="col-4">
1892
- <sps-file-upload ref={ref} constrainContentWidth/>
1893
- </div>
1894
- </div>
1895
- )
1896
- }
1897
- `
1898
- }
1899
- }
1900
- }
1901
- };
1902
- var __defProp$4 = Object.defineProperty;
1903
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1904
- var __decorateClass$4 = (decorators, target, key2, kind) => {
1905
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key2) : target;
1906
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1907
- if (decorator = decorators[i])
1908
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
1909
- if (kind && result)
1910
- __defProp$4(target, key2, result);
1911
- return result;
1912
- };
1913
- let SpsNavTabComponent = class extends HTMLElement {
1914
- constructor() {
1915
- super(...arguments);
1916
- this.active = false;
1917
- this.label = "";
1918
- this.tag = "";
1919
- }
1920
- get [ClassBindings]() {
1921
- return [
1922
- "sps-tabbed-nav__nav-item",
1923
- this.active && "sps-tabbed-nav__nav-item--active"
1924
- ];
1925
- }
1926
- render() {
1927
- return /* @__PURE__ */ h("a", {
1928
- href: this.href,
1929
- target: this.target,
1930
- className: "sps-tabbed-nav__nav-item-link",
1931
- tabIndex: 0
1932
- }, this.icon && /* @__PURE__ */ h("i", {
1933
- className: `sps-icon sps-icon-${this.icon}`
1934
- }), this.label && /* @__PURE__ */ h("span", null, this.label), this.tag && /* @__PURE__ */ h("span", {
1935
- className: "sps-tag sps-tag--default"
1936
- }, this.tag));
1937
- }
1938
- };
1939
- SpsNavTabComponent.displayName = "sps-nav-tab";
1940
- SpsNavTabComponent.props = {
1941
- active: "boolean",
1942
- label: "string",
1943
- icon: "SpsIcon",
1944
- tag: "string",
1945
- href: "string",
1946
- target: "string"
1947
- };
1948
- __decorateClass$4([
1949
- Prop()
1950
- ], SpsNavTabComponent.prototype, "active", 2);
1951
- __decorateClass$4([
1952
- Prop()
1953
- ], SpsNavTabComponent.prototype, "label", 2);
1954
- __decorateClass$4([
1955
- Prop()
1956
- ], SpsNavTabComponent.prototype, "icon", 2);
1957
- __decorateClass$4([
1958
- Prop()
1959
- ], SpsNavTabComponent.prototype, "tag", 2);
1960
- __decorateClass$4([
1961
- Prop()
1962
- ], SpsNavTabComponent.prototype, "href", 2);
1963
- __decorateClass$4([
1964
- Prop()
1965
- ], SpsNavTabComponent.prototype, "target", 2);
1966
- SpsNavTabComponent = __decorateClass$4([
1967
- Component({ tag: "sps-nav-tab" })
1968
- ], SpsNavTabComponent);
1969
- var __defProp$3 = Object.defineProperty;
1970
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
1971
- var __decorateClass$3 = (decorators, target, key2, kind) => {
1972
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key2) : target;
1973
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1974
- if (decorator = decorators[i])
1975
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
1976
- if (kind && result)
1977
- __defProp$3(target, key2, result);
1978
- return result;
1979
- };
1980
- let SpsNavTabSetComponent = class extends HTMLElement {
1981
- constructor() {
1982
- super(...arguments);
1983
- this.content = [];
1984
- }
1985
- render() {
1986
- return /* @__PURE__ */ h("nav", {
1987
- className: "sps-tabbed-nav"
1988
- }, this.content);
1989
- }
1990
- };
1991
- SpsNavTabSetComponent.displayName = "sps-nav-tab-set";
1992
- SpsNavTabSetComponent.props = {};
1993
- __decorateClass$3([
1994
- Content()
1995
- ], SpsNavTabSetComponent.prototype, "content", 2);
1996
- SpsNavTabSetComponent = __decorateClass$3([
1997
- Component({ tag: "sps-nav-tab-set" })
1998
- ], SpsNavTabSetComponent);
1999
- const SpsNavTabsExamples = {
2000
- basic: {
2001
- label: "Basic Navigation Tabs",
2002
- description: code`
2003
- <p>Navigation tabs native web component</p>
2004
- `,
2005
- examples: {
2006
- basic: {
2007
- react: code`
2008
- function DemoComponent() {
2009
- const tabs = [
2010
- { label: "Tab A", icon: "chart-line" },
2011
- { label: "Tab B", icon: "chart-bar", tag: "12" },
2012
- { label: "Tab C", icon: "chart-pie" }
2013
- ]
2014
-
2015
- const [activeTab, setActiveTab] = React.useState(0)
2016
-
2017
- return (
2018
- <sps-nav-tab-set>
2019
- {tabs.map((tab, index) => (
2020
- <sps-nav-tab
2021
- key={index}
2022
- icon={tab.icon}
2023
- label={tab.label}
2024
- tag={tab.tag}
2025
- active={index === activeTab || null}
2026
- onClick={() => setActiveTab(index)}
2027
- />
2028
- ))}
2029
- </sps-nav-tab-set>
2030
- )
2031
- }
2032
- `
2033
- }
2034
- }
2035
- }
2036
- };
2037
- var __defProp$2 = Object.defineProperty;
2038
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
2039
- var __decorateClass$2 = (decorators, target, key2, kind) => {
2040
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key2) : target;
2041
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2042
- if (decorator = decorators[i])
2043
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2044
- if (kind && result)
2045
- __defProp$2(target, key2, result);
2046
- return result;
2047
- };
2048
- var SpsPhotoDisplayMode;
2049
- (function(SpsPhotoDisplayMode2) {
2050
- SpsPhotoDisplayMode2["FIT"] = "fit";
2051
- SpsPhotoDisplayMode2["FILL"] = "fill";
2052
- })(SpsPhotoDisplayMode || (SpsPhotoDisplayMode = {}));
2053
- const CPT_NAME$2 = "sps-photo";
2054
- let SpsPhotoComponent = class extends HTMLElement {
2055
- constructor() {
2056
- super(...arguments);
2057
- this.mode = SpsPhotoDisplayMode.FILL;
2058
- }
2059
- get image() {
2060
- return this.imageInternal;
2061
- }
2062
- set image(newValue) {
2063
- this.imageInternal = newValue;
2064
- if (newValue) {
2065
- if (this.waitForImgHeightInterval) {
2066
- window.clearInterval(this.waitForImgHeightInterval);
2067
- }
2068
- this.waitForImgHeightInterval = window.setInterval(() => {
2069
- const imgRect = newValue.getBoundingClientRect();
2070
- if (imgRect.height) {
2071
- window.clearInterval(this.waitForImgHeightInterval);
2072
- delete this.waitForImgHeightInterval;
2073
- let imageIsLandscape = true;
2074
- imageIsLandscape = imgRect.width / imgRect.height > 1;
2075
- this.fitWidth = imageIsLandscape === (this.mode === SpsPhotoDisplayMode.FIT);
2076
- }
2077
- }, 1e3 / 60);
2078
- }
2079
- }
2080
- get [ClassBindings]() {
2081
- return [
2082
- CPT_NAME$2,
2083
- this.fitWidth ? `${CPT_NAME$2}--fit-width` : `${CPT_NAME$2}--fit-height`,
2084
- this.placeholderIcon && `${CPT_NAME$2}--placeholder`
2085
- ];
2086
- }
2087
- get [StyleBindings]() {
2088
- return {
2089
- fontSize: `${this.width * 0.05}rem`,
2090
- width: `${this.width}rem`,
2091
- height: `${0.75 * this.width}rem`
2092
- };
2093
- }
2094
- connectedCallback() {
2095
- this.waitForWidthInterval = window.setInterval(() => {
2096
- const boundingClientRect = this.getBoundingClientRect();
2097
- if (boundingClientRect.width) {
2098
- this.setWidth(boundingClientRect.width);
2099
- window.clearInterval(this.waitForWidthInterval);
2100
- delete this.waitForWidthInterval;
2101
- }
2102
- }, 1e3 / 60);
2103
- }
2104
- disconnectedCallback() {
2105
- if (this.waitForWidthInterval) {
2106
- window.clearInterval(this.waitForWidthInterval);
2107
- }
2108
- if (this.waitForImgHeightInterval) {
2109
- window.clearInterval(this.waitForImgHeightInterval);
2110
- }
2111
- }
2112
- render() {
2113
- if (this.src) {
2114
- return this.width ? /* @__PURE__ */ h("img", {
2115
- src: this.src,
2116
- alt: this.altText
2117
- }) : /* @__PURE__ */ h("span", null);
2118
- }
2119
- return /* @__PURE__ */ h("i", {
2120
- className: `sps-icon sps-icon-${this.placeholderIcon}`
2121
- });
2122
- }
2123
- setWidth(hostWidth) {
2124
- if (hostWidth && !this.width) {
2125
- const baseFontSize = document.body.parentElement.style.fontSize || "16px";
2126
- const remPx = Number(baseFontSize.substr(0, baseFontSize.length - 2));
2127
- this.width = hostWidth / remPx;
2128
- }
2129
- }
2130
- };
2131
- SpsPhotoComponent.displayName = CPT_NAME$2;
2132
- SpsPhotoComponent.props = {
2133
- src: "string",
2134
- altText: "string",
2135
- mode: "SpsPhotoDisplayMode",
2136
- placeholderIcon: "SpsIcon"
2137
- };
2138
- __decorateClass$2([
2139
- Prop()
2140
- ], SpsPhotoComponent.prototype, "src", 2);
2141
- __decorateClass$2([
2142
- Prop()
2143
- ], SpsPhotoComponent.prototype, "altText", 2);
2144
- __decorateClass$2([
2145
- Prop()
2146
- ], SpsPhotoComponent.prototype, "mode", 2);
2147
- __decorateClass$2([
2148
- Prop()
2149
- ], SpsPhotoComponent.prototype, "placeholderIcon", 2);
2150
- __decorateClass$2([
2151
- Watch()
2152
- ], SpsPhotoComponent.prototype, "width", 2);
2153
- __decorateClass$2([
2154
- Watch()
2155
- ], SpsPhotoComponent.prototype, "fitWidth", 2);
2156
- __decorateClass$2([
2157
- QuerySelector("img", { refresh: true })
2158
- ], SpsPhotoComponent.prototype, "image", 1);
2159
- SpsPhotoComponent = __decorateClass$2([
2160
- Component({ tag: CPT_NAME$2 })
2161
- ], SpsPhotoComponent);
2162
- const SpsPhotoExamples = {
2163
- sizing: {
2164
- label: "Sizing",
2165
- description: code`
2166
- <p>
2167
- Photos are block elements, so a photo fills its container's width unless
2168
- an explicit width is set. It is always a 4:3 aspect ratio. In this example,
2169
- photos have been placed in cards which have different widths in the 12
2170
- column grid.
2171
- </p>
2172
- `,
2173
- examples: {
2174
- basic: {
2175
- jsx: code`
2176
- <div className="sfg-row">
2177
- <div className="sfg-col-2">
2178
- <sps-card>
2179
- <sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
2180
- </sps-card>
2181
- </div>
2182
- <div className="sfg-col-4">
2183
- <sps-card>
2184
- <sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
2185
- </sps-card>
2186
- </div>
2187
- <div className="sfg-col-6">
2188
- <sps-card>
2189
- <sps-photo src="assets/images/photo-landscape.jpg"></sps-photo>
2190
- </sps-card>
2191
- </div>
2192
- </div>
2193
- `
2194
- }
2195
- }
2196
- },
2197
- displayMode: {
2198
- label: "Fill vs. Fit",
2199
- description: code`
2200
- <p>
2201
- There are two display modes available:
2202
- <ul>
2203
- <li><b>"fill"</b> fills the entire 4:3 container, cropping off any excess portions of the image.
2204
- <li><b>"fit"</b> fits the entire image into the container, leaving any excess portions of the container blank.
2205
- </ul>
2206
- </p>
2207
- `,
1607
+ downloadButton: {
1608
+ label: "Download Button",
1609
+ description: c`
1610
+ <p>You can optionally provide a button to download a file. Typically this will be a template for
1611
+ whatever the user is expected to upload. They can then fill out the template, save it, and upload it.</p>
1612
+ `,
2208
1613
  examples: {
2209
- landscape: {
2210
- description: "<p>Landscape oriented photo (container outline added for illustrative purposes)</p>",
2211
- jsx: code`
2212
- <div className="sfg-row">
2213
- <div className="sfg-col-4">
2214
- <sps-photo src="assets/images/photo-landscape.jpg" mode="fill"></sps-photo>
2215
- </div>
2216
- <div className="sfg-col-4">
2217
- <sps-photo src="assets/images/photo-landscape.jpg" mode="fit"></sps-photo>
2218
- </div>
2219
- </div>
2220
- `
2221
- },
2222
- portrait: {
2223
- description: "<p>Portrait oriented photo (container outline added for illustrative purposes)</p>",
2224
- jsx: code`
2225
- <div className="sfg-row">
2226
- <div className="sfg-col-4">
2227
- <sps-photo src="assets/images/photo-portrait.jpg" mode="fill"></sps-photo>
2228
- </div>
2229
- <div className="sfg-col-4">
2230
- <sps-photo id="foo" src="assets/images/photo-portrait.jpg" mode="fit"></sps-photo>
2231
- </div>
2232
- </div>
2233
- `
1614
+ downloadButton: {
1615
+ react: c`
1616
+ function Component() {
1617
+ const ref = React.useRef()
1618
+
1619
+ function handleDownload() {
1620
+ console.log("Download triggered.")
1621
+ }
1622
+
1623
+ React.useEffect(() => {
1624
+ ref.current.addEventListener("download", handleDownload)
1625
+ return () => {
1626
+ ref.current.removeEventListener("download", handleDownload)
1627
+ }
1628
+ })
1629
+
1630
+ return (
1631
+ <div className="sps-row">
1632
+ <div className="col-12">
1633
+ <sps-file-upload
1634
+ ref={ref}
1635
+ description="Spreadsheet"
1636
+ acceptExtensions="xlsx"
1637
+ downloadLabel="Download Excel Template"
1638
+ />
1639
+ </div>
1640
+ </div>
1641
+ )
1642
+ }
1643
+ `
2234
1644
  }
2235
1645
  }
2236
1646
  },
2237
- placeholder: {
2238
- label: "Placeholders",
2239
- description: code`
2240
- <p>
2241
- When an image is not provided for a particular use case (such as a user avatar,
2242
- a company photo, item image, etc.), a placeholder should be shown in its place.
2243
-
2244
- The placeholder's icon, selected from our SPS icon set, should represent the
2245
- type of image it is substituting for.
2246
- </p>
2247
- `,
1647
+ mini: {
1648
+ label: "Mini File Upload",
1649
+ description: c`
1650
+ <p>When the file upload component is to be placed in a small container,
1651
+ it should be marked as a mini file upload so that everything fits.</p>
1652
+ `,
2248
1653
  examples: {
2249
- general: {
2250
- description: "<p>General Photo</p>",
2251
- jsx: code`
2252
- <div className="sfg-row">
2253
- <div className="sfg-col-3">
2254
- <sps-photo placeholderIcon="photo"></sps-photo>
2255
- </div>
2256
- </div>
2257
- `
2258
- },
2259
- photoAlt: {
2260
- description: "<p>Photo Alt</p>",
2261
- jsx: code`
2262
- <div className="sfg-row">
2263
- <div className="sfg-col-3">
2264
- <sps-photo placeholderIcon="camera"></sps-photo>
2265
- </div>
2266
- </div>
2267
- `
2268
- },
2269
- user: {
2270
- description: "<p>User / Single Person</p>",
2271
- jsx: code`
2272
- <div className="sfg-row">
2273
- <div className="sfg-col-3">
2274
- <sps-photo placeholderIcon="user"></sps-photo>
2275
- </div>
2276
- </div>
2277
- `
2278
- },
2279
- group: {
2280
- description: "<p>Group / Multiple People</p>",
2281
- jsx: code`
2282
- <div className="sfg-row">
2283
- <div className="sfg-col-3">
2284
- <sps-photo placeholderIcon="group"></sps-photo>
2285
- </div>
2286
- </div>
2287
- `
2288
- },
2289
- company: {
2290
- description: "<p>Company / Building</p>",
2291
- jsx: code`
2292
- <div className="sfg-row">
2293
- <div className="sfg-col-3">
2294
- <sps-photo placeholderIcon="building"></sps-photo>
2295
- </div>
2296
- </div>
2297
- `
1654
+ single: {
1655
+ react: c`
1656
+ function Component() {
1657
+ const ref = React.useRef()
1658
+
1659
+ function handleChange(event) {
1660
+ console.log(event.detail)
1661
+ }
1662
+
1663
+ React.useEffect(() => {
1664
+ ref.current.addEventListener("selection", handleChange)
1665
+ return () => {
1666
+ ref.current.removeEventListener("selection", handleChange)
1667
+ }
1668
+ })
1669
+
1670
+ return (
1671
+ <div className="sps-row">
1672
+ <div className="col-4">
1673
+ <sps-file-upload ref={ref} mini/>
1674
+ </div>
1675
+ </div>
1676
+ )
1677
+ }
1678
+ `
2298
1679
  }
2299
1680
  }
2300
- }
2301
- };
2302
- const MANIFEST = {
2303
- "File Upload": {
2304
- components: [SpsFileUploadComponent],
2305
- examples: SpsFileUploadExamples
2306
1681
  },
2307
- "Tabbed Navigation": {
2308
- components: [SpsNavTabComponent, SpsNavTabSetComponent],
2309
- examples: SpsNavTabsExamples
2310
- },
2311
- Photos: {
2312
- components: [SpsPhotoComponent],
2313
- examples: SpsPhotoExamples
1682
+ constrainContentWidth: {
1683
+ label: "Constrain Content Width",
1684
+ description: c`
1685
+ <p>If this prop is provided, the content will be restricted to 50% of
1686
+ the overall width of the component. Consult your product designer if
1687
+ you're not sure whether to use this variant.</p>
1688
+ `,
1689
+ examples: {
1690
+ constrainContentWidth: {
1691
+ react: c`
1692
+ function Component() {
1693
+ const ref = React.useRef()
1694
+
1695
+ function handleChange(event: CustomEvent<Array<File>>) {
1696
+ console.log(event.detail)
1697
+ }
1698
+
1699
+ React.useEffect(() => {
1700
+ ref.current.addEventListener("selection", handleChange)
1701
+ return () => {
1702
+ ref.current.removeEventListener("selection", handleChange)
1703
+ }
1704
+ })
1705
+
1706
+ return (
1707
+ <div className="sps-row">
1708
+ <div className="col-4">
1709
+ <sps-file-upload ref={ref} constrainContentWidth/>
1710
+ </div>
1711
+ </div>
1712
+ )
1713
+ }
1714
+ `
1715
+ }
1716
+ }
2314
1717
  }
2315
1718
  };
2316
- var __defProp$1 = Object.defineProperty;
2317
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
2318
- var __decorateClass$1 = (decorators, target, key2, kind) => {
2319
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key2) : target;
2320
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2321
- if (decorator = decorators[i])
2322
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2323
- if (kind && result)
2324
- __defProp$1(target, key2, result);
2325
- return result;
1719
+ var ds = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, A = (e, t, s, n) => {
1720
+ for (var i = n > 1 ? void 0 : n ? hs(t, s) : t, r = e.length - 1, l; r >= 0; r--)
1721
+ (l = e[r]) && (i = (n ? l(t, s, i) : l(i)) || i);
1722
+ return n && i && ds(t, s, i), i;
2326
1723
  };
2327
- const CPT_NAME$1 = "sps-insight-card";
2328
- let SpsInsightCardComponent = class extends HTMLElement {
1724
+ const _ = "sps-insight-card";
1725
+ var X;
1726
+ let y = (X = class extends HTMLElement {
2329
1727
  constructor() {
2330
1728
  super(...arguments);
2331
- this.kind = SpsInsightCardKind.GENERAL;
2332
- }
2333
- get [ClassBindings]() {
1729
+ a(this, "icon");
1730
+ a(this, "kind", ot.GENERAL);
1731
+ a(this, "title");
1732
+ a(this, "metric");
1733
+ a(this, "partnerCount");
1734
+ a(this, "totalPartners");
1735
+ a(this, "secondary");
1736
+ a(this, "content");
1737
+ a(this, "detail");
1738
+ }
1739
+ get [T]() {
2334
1740
  return [
2335
- CPT_NAME$1,
2336
- `${CPT_NAME$1}--${this.kind}`,
2337
- this.detail && this.detail.children.length ? `${CPT_NAME$1}--has-detail` : null
1741
+ _,
1742
+ `${_}--${this.kind}`,
1743
+ this.detail && this.detail.children.length ? `${_}--has-detail` : null
2338
1744
  ];
2339
1745
  }
2340
1746
  render({ t }) {
2341
- const metric = /* @__PURE__ */ h("div", {
2342
- className: `${CPT_NAME$1}__metric-count`
2343
- }, this.metric);
2344
- const description = /* @__PURE__ */ h("div", {
2345
- className: `${CPT_NAME$1}__description`
2346
- }, /* @__PURE__ */ h("div", {
2347
- className: `${CPT_NAME$1}__title`,
1747
+ const s = /* @__PURE__ */ o("div", {
1748
+ className: `${_}__metric-count`
1749
+ }, this.metric), n = /* @__PURE__ */ o("div", {
1750
+ className: `${_}__description`
1751
+ }, /* @__PURE__ */ o("div", {
1752
+ className: `${_}__title`,
2348
1753
  style: { "-webkit-box-orient": "vertical" }
2349
- }, this.title), /* @__PURE__ */ h("div", {
2350
- className: `${CPT_NAME$1}__detail`
2351
- }, this.content));
2352
- const [
2353
- count,
2354
- ofText,
2355
- total
1754
+ }, this.title), /* @__PURE__ */ o("div", {
1755
+ className: `${_}__detail`
1756
+ }, this.content)), [
1757
+ i,
1758
+ r,
1759
+ l
2356
1760
  ] = (this.partnerCount ? t("design-system:insightCard.partnerCount", { count: this.partnerCount, total: this.totalPartners }) : "").split("|");
2357
- return /* @__PURE__ */ h("div", {
2358
- "data-fragment": true
2359
- }, /* @__PURE__ */ h("div", {
2360
- className: `${CPT_NAME$1}__body`
2361
- }, this.icon ? /* @__PURE__ */ h("i", {
1761
+ return /* @__PURE__ */ o("div", {
1762
+ "data-fragment": !0
1763
+ }, /* @__PURE__ */ o("div", {
1764
+ className: `${_}__body`
1765
+ }, this.icon ? /* @__PURE__ */ o("i", {
2362
1766
  className: `sps-icon sps-icon-${this.icon}`
2363
- }) : /* @__PURE__ */ h("i", {
2364
- className: `sps-icon sps-icon-${SpsInsightCardIcons[this.kind]}`
2365
- }), metric, description), this.partnerCount && /* @__PURE__ */ h("div", {
2366
- className: `${CPT_NAME$1}__partner-count`
2367
- }, this.partnerCount === this.totalPartners ? /* @__PURE__ */ h("div", null, t("design-system:insightCard.all")) : /* @__PURE__ */ h("div", {
2368
- "data-fragment": true
2369
- }, /* @__PURE__ */ h("div", null, count), /* @__PURE__ */ h("div", null, ofText), /* @__PURE__ */ h("div", null, total)), /* @__PURE__ */ h("div", {
2370
- className: `${CPT_NAME$1}__partners-text`
1767
+ }) : /* @__PURE__ */ o("i", {
1768
+ className: `sps-icon sps-icon-${lt[this.kind]}`
1769
+ }), s, n), this.partnerCount && /* @__PURE__ */ o("div", {
1770
+ className: `${_}__partner-count`
1771
+ }, this.partnerCount === this.totalPartners ? /* @__PURE__ */ o("div", null, t("design-system:insightCard.all")) : /* @__PURE__ */ o("div", {
1772
+ "data-fragment": !0
1773
+ }, /* @__PURE__ */ o("div", null, i), /* @__PURE__ */ o("div", null, r), /* @__PURE__ */ o("div", null, l)), /* @__PURE__ */ o("div", {
1774
+ className: `${_}__partners-text`
2371
1775
  }, t("design-system:insightCard.partners"))));
2372
1776
  }
2373
- };
2374
- SpsInsightCardComponent.displayName = CPT_NAME$1;
2375
- SpsInsightCardComponent.props = {
1777
+ }, a(X, "displayName", _), a(X, "props", {
2376
1778
  icon: "SpsIcon",
2377
1779
  kind: "SpsInsightCardKind",
2378
1780
  title: "string",
@@ -2380,98 +1782,91 @@ SpsInsightCardComponent.props = {
2380
1782
  partnerCount: "number",
2381
1783
  totalPartners: "number",
2382
1784
  secondary: "boolean"
1785
+ }), X);
1786
+ A([
1787
+ p()
1788
+ ], y.prototype, "icon", 2);
1789
+ A([
1790
+ p()
1791
+ ], y.prototype, "kind", 2);
1792
+ A([
1793
+ p()
1794
+ ], y.prototype, "title", 2);
1795
+ A([
1796
+ p()
1797
+ ], y.prototype, "metric", 2);
1798
+ A([
1799
+ p()
1800
+ ], y.prototype, "partnerCount", 2);
1801
+ A([
1802
+ p()
1803
+ ], y.prototype, "totalPartners", 2);
1804
+ A([
1805
+ p()
1806
+ ], y.prototype, "secondary", 2);
1807
+ A([
1808
+ _e()
1809
+ ], y.prototype, "content", 2);
1810
+ A([
1811
+ xe(`.${_}__detail`)
1812
+ ], y.prototype, "detail", 2);
1813
+ y = A([
1814
+ j({ tag: _ })
1815
+ ], y);
1816
+ var us = Object.defineProperty, fs = Object.getOwnPropertyDescriptor, ye = (e, t, s, n) => {
1817
+ for (var i = n > 1 ? void 0 : n ? fs(t, s) : t, r = e.length - 1, l; r >= 0; r--)
1818
+ (l = e[r]) && (i = (n ? l(t, s, i) : l(i)) || i);
1819
+ return n && i && us(t, s, i), i;
2383
1820
  };
2384
- __decorateClass$1([
2385
- Prop()
2386
- ], SpsInsightCardComponent.prototype, "icon", 2);
2387
- __decorateClass$1([
2388
- Prop()
2389
- ], SpsInsightCardComponent.prototype, "kind", 2);
2390
- __decorateClass$1([
2391
- Prop()
2392
- ], SpsInsightCardComponent.prototype, "title", 2);
2393
- __decorateClass$1([
2394
- Prop()
2395
- ], SpsInsightCardComponent.prototype, "metric", 2);
2396
- __decorateClass$1([
2397
- Prop()
2398
- ], SpsInsightCardComponent.prototype, "partnerCount", 2);
2399
- __decorateClass$1([
2400
- Prop()
2401
- ], SpsInsightCardComponent.prototype, "totalPartners", 2);
2402
- __decorateClass$1([
2403
- Prop()
2404
- ], SpsInsightCardComponent.prototype, "secondary", 2);
2405
- __decorateClass$1([
2406
- Content()
2407
- ], SpsInsightCardComponent.prototype, "content", 2);
2408
- __decorateClass$1([
2409
- QuerySelector(`.${CPT_NAME$1}__detail`)
2410
- ], SpsInsightCardComponent.prototype, "detail", 2);
2411
- SpsInsightCardComponent = __decorateClass$1([
2412
- Component({ tag: CPT_NAME$1 })
2413
- ], SpsInsightCardComponent);
2414
- var __defProp = Object.defineProperty;
2415
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2416
- var __decorateClass = (decorators, target, key2, kind) => {
2417
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;
2418
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2419
- if (decorator = decorators[i])
2420
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2421
- if (kind && result)
2422
- __defProp(target, key2, result);
2423
- return result;
2424
- };
2425
- const CPT_NAME = "sps-insights";
2426
- let SpsInsightsComponent = class extends HTMLElement {
1821
+ const D = "sps-insights";
1822
+ var K;
1823
+ let te = (K = class extends HTMLElement {
2427
1824
  constructor() {
2428
1825
  super();
2429
- this.content = [];
2430
- this.showAdditionalInsights = false;
1826
+ a(this, "content", []);
1827
+ a(this, "details");
1828
+ a(this, "showAdditionalInsights", !1);
2431
1829
  this.toggleAdditionalInsights = this.toggleAdditionalInsights.bind(this);
2432
1830
  }
2433
- get [ClassBindings]() {
1831
+ get [T]() {
2434
1832
  return [
2435
- CPT_NAME,
2436
- this.showAdditionalInsights && `${CPT_NAME}--show-additional`,
2437
- this.details && Array.from(this.details).every((d) => !d.textContent) ? `${CPT_NAME}--no-details` : null,
2438
- this.content.length === 6 ? `${CPT_NAME}--break-4` : null,
2439
- this.content.length === 7 ? `${CPT_NAME}--break-5` : null,
2440
- this.content.length === 8 ? `${CPT_NAME}--break-5` : null
1833
+ D,
1834
+ this.showAdditionalInsights && `${D}--show-additional`,
1835
+ this.details && Array.from(this.details).every((t) => !t.textContent) ? `${D}--no-details` : null,
1836
+ this.content.length === 6 ? `${D}--break-4` : null,
1837
+ this.content.length === 7 ? `${D}--break-5` : null,
1838
+ this.content.length === 8 ? `${D}--break-5` : null
2441
1839
  ];
2442
1840
  }
2443
1841
  toggleAdditionalInsights() {
2444
- this.showAdditionalInsights = !this.showAdditionalInsights;
2445
- this.update();
1842
+ this.showAdditionalInsights = !this.showAdditionalInsights, this.update();
2446
1843
  }
2447
1844
  render() {
2448
- return /* @__PURE__ */ h("div", {
2449
- "data-fragment": true
2450
- }, this.content, this.content.length > 10 && /* @__PURE__ */ h("div", {
1845
+ return /* @__PURE__ */ o("div", {
1846
+ "data-fragment": !0
1847
+ }, this.content, this.content.length > 10 && /* @__PURE__ */ o("div", {
2451
1848
  className: "sps-button sps-button--link",
2452
1849
  onClick: this.toggleAdditionalInsights
2453
- }, /* @__PURE__ */ h("button", {
1850
+ }, /* @__PURE__ */ o("button", {
2454
1851
  type: "button"
2455
1852
  }, this.showAdditionalInsights ? "Hide " : "Show ", "Additional Insights")));
2456
1853
  }
2457
- };
2458
- SpsInsightsComponent.displayName = CPT_NAME;
2459
- SpsInsightsComponent.props = {};
2460
- __decorateClass([
2461
- Content()
2462
- ], SpsInsightsComponent.prototype, "content", 2);
2463
- __decorateClass([
2464
- QuerySelectorAll(".sps-insight-card__detail")
2465
- ], SpsInsightsComponent.prototype, "details", 2);
2466
- SpsInsightsComponent = __decorateClass([
2467
- Component({ tag: CPT_NAME })
2468
- ], SpsInsightsComponent);
2469
- const SpsInsightCardExamples = {
1854
+ }, a(K, "displayName", D), a(K, "props", {}), K);
1855
+ ye([
1856
+ _e()
1857
+ ], te.prototype, "content", 2);
1858
+ ye([
1859
+ is(".sps-insight-card__detail")
1860
+ ], te.prototype, "details", 2);
1861
+ te = ye([
1862
+ j({ tag: D })
1863
+ ], te);
1864
+ const As = {
2470
1865
  basic: {
2471
1866
  label: "Basic Insight Cards",
2472
1867
  examples: {
2473
1868
  basic: {
2474
- jsx: code`
1869
+ jsx: c`
2475
1870
  <sps-insights>
2476
1871
  <sps-insight-card kind="general"
2477
1872
  metric="1234"
@@ -2502,7 +1897,7 @@ const SpsInsightCardExamples = {
2502
1897
  label: "With Details",
2503
1898
  examples: {
2504
1899
  details: {
2505
- jsx: code`
1900
+ jsx: c`
2506
1901
  <sps-insights>
2507
1902
  <sps-insight-card kind="general"
2508
1903
  metric="1234"
@@ -2555,7 +1950,7 @@ const SpsInsightCardExamples = {
2555
1950
  label: "Partner Count",
2556
1951
  examples: {
2557
1952
  partner_count: {
2558
- jsx: code`
1953
+ jsx: c`
2559
1954
  <sps-insights>
2560
1955
  <sps-insight-card kind="general"
2561
1956
  metric="1234"
@@ -2596,7 +1991,7 @@ const SpsInsightCardExamples = {
2596
1991
  label: "10+ Insight Cards",
2597
1992
  examples: {
2598
1993
  expansion: {
2599
- jsx: code`
1994
+ jsx: c`
2600
1995
  <sps-insights>
2601
1996
  <sps-insight-card kind="general"
2602
1997
  metric="1234"
@@ -2711,13 +2106,13 @@ const SpsInsightCardExamples = {
2711
2106
  },
2712
2107
  events: {
2713
2108
  label: "Adding a click handler",
2714
- description: code`
2109
+ description: c`
2715
2110
  <p>Attaching event handlers to native web components in React cannot be done the usual way at this time.
2716
2111
  Here is how to do it:</p>
2717
2112
  `,
2718
2113
  examples: {
2719
2114
  events: {
2720
- react: code`
2115
+ react: c`
2721
2116
  function Component() {
2722
2117
  function handleClick() {
2723
2118
  window.alert("Insight card clicked");
@@ -2757,7 +2152,7 @@ const SpsInsightCardExamples = {
2757
2152
  label: "Using alternate icons",
2758
2153
  examples: {
2759
2154
  basic: {
2760
- react: code`
2155
+ react: c`
2761
2156
  function DemoComponent() {
2762
2157
  return (
2763
2158
  <sps-insights>
@@ -2799,4 +2194,155 @@ const SpsInsightCardExamples = {
2799
2194
  }
2800
2195
  }
2801
2196
  };
2802
- export { AttrBindings, ClassBindings, Component, Content, EventDispatcher, EventListener, MANIFEST, MIMEType, Prop, QuerySelector, QuerySelectorAll, SpsFileUploadComponent, SpsFileUploadExamples, SpsInsightCardComponent, SpsInsightCardExamples, SpsInsightsComponent, SpsNavTabComponent, SpsNavTabSetComponent, SpsNavTabsExamples, SpsPhotoComponent, SpsPhotoDisplayMode, SpsPhotoExamples, StyleBindings, Watch, h, namespaceOverrideRegistrar, register, webComponentsUseI18n };
2197
+ var gs = Object.defineProperty, ms = Object.getOwnPropertyDescriptor, L = (e, t, s, n) => {
2198
+ for (var i = n > 1 ? void 0 : n ? ms(t, s) : t, r = e.length - 1, l; r >= 0; r--)
2199
+ (l = e[r]) && (i = (n ? l(t, s, i) : l(i)) || i);
2200
+ return n && i && gs(t, s, i), i;
2201
+ }, Q;
2202
+ let P = (Q = class extends HTMLElement {
2203
+ constructor() {
2204
+ super(...arguments);
2205
+ a(this, "active", !1);
2206
+ a(this, "label", "");
2207
+ a(this, "icon");
2208
+ a(this, "tag", "");
2209
+ a(this, "href");
2210
+ a(this, "target");
2211
+ }
2212
+ get [T]() {
2213
+ return [
2214
+ "sps-tabbed-nav__nav-item",
2215
+ this.active && "sps-tabbed-nav__nav-item--active"
2216
+ ];
2217
+ }
2218
+ render() {
2219
+ return /* @__PURE__ */ o("a", {
2220
+ href: this.href,
2221
+ target: this.target,
2222
+ className: "sps-tabbed-nav__nav-item-link",
2223
+ tabIndex: 0
2224
+ }, this.icon && /* @__PURE__ */ o("i", {
2225
+ className: `sps-icon sps-icon-${this.icon}`
2226
+ }), this.label && /* @__PURE__ */ o("span", null, this.label), this.tag && /* @__PURE__ */ o("span", {
2227
+ className: "sps-tag sps-tag--default"
2228
+ }, this.tag));
2229
+ }
2230
+ }, a(Q, "displayName", "sps-nav-tab"), a(Q, "props", {
2231
+ active: "boolean",
2232
+ label: "string",
2233
+ icon: "SpsIcon",
2234
+ tag: "string",
2235
+ href: "string",
2236
+ target: "string"
2237
+ }), Q);
2238
+ L([
2239
+ p()
2240
+ ], P.prototype, "active", 2);
2241
+ L([
2242
+ p()
2243
+ ], P.prototype, "label", 2);
2244
+ L([
2245
+ p()
2246
+ ], P.prototype, "icon", 2);
2247
+ L([
2248
+ p()
2249
+ ], P.prototype, "tag", 2);
2250
+ L([
2251
+ p()
2252
+ ], P.prototype, "href", 2);
2253
+ L([
2254
+ p()
2255
+ ], P.prototype, "target", 2);
2256
+ P = L([
2257
+ j({ tag: "sps-nav-tab" })
2258
+ ], P);
2259
+ var vs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, st = (e, t, s, n) => {
2260
+ for (var i = n > 1 ? void 0 : n ? bs(t, s) : t, r = e.length - 1, l; r >= 0; r--)
2261
+ (l = e[r]) && (i = (n ? l(t, s, i) : l(i)) || i);
2262
+ return n && i && vs(t, s, i), i;
2263
+ }, Z;
2264
+ let ue = (Z = class extends HTMLElement {
2265
+ constructor() {
2266
+ super(...arguments);
2267
+ a(this, "content", []);
2268
+ }
2269
+ render() {
2270
+ return /* @__PURE__ */ o("nav", {
2271
+ className: "sps-tabbed-nav"
2272
+ }, this.content);
2273
+ }
2274
+ }, a(Z, "displayName", "sps-nav-tab-set"), a(Z, "props", {}), Z);
2275
+ st([
2276
+ _e()
2277
+ ], ue.prototype, "content", 2);
2278
+ ue = st([
2279
+ j({ tag: "sps-nav-tab-set" })
2280
+ ], ue);
2281
+ const Ds = {
2282
+ basic: {
2283
+ label: "Basic Navigation Tabs",
2284
+ description: c`
2285
+ <p>Navigation tabs native web component</p>
2286
+ `,
2287
+ examples: {
2288
+ basic: {
2289
+ react: c`
2290
+ function DemoComponent() {
2291
+ const tabs = [
2292
+ { label: "Tab A", icon: "chart-line" },
2293
+ { label: "Tab B", icon: "chart-bar", tag: "12" },
2294
+ { label: "Tab C", icon: "chart-pie" }
2295
+ ]
2296
+
2297
+ const [activeTab, setActiveTab] = React.useState(0)
2298
+
2299
+ return (
2300
+ <sps-nav-tab-set>
2301
+ {tabs.map((tab, index) => (
2302
+ <sps-nav-tab
2303
+ key={index}
2304
+ icon={tab.icon}
2305
+ label={tab.label}
2306
+ tag={tab.tag}
2307
+ active={index === activeTab || null}
2308
+ onClick={() => setActiveTab(index)}
2309
+ />
2310
+ ))}
2311
+ </sps-nav-tab-set>
2312
+ )
2313
+ }
2314
+ `
2315
+ }
2316
+ }
2317
+ }
2318
+ };
2319
+ export {
2320
+ Ie as AttrBindings,
2321
+ T as ClassBindings,
2322
+ j as Component,
2323
+ _e as Content,
2324
+ Ne as EventDispatcher,
2325
+ re as EventListener,
2326
+ Ss as MANIFEST,
2327
+ tt as MIMEType,
2328
+ p as Prop,
2329
+ xe as QuerySelector,
2330
+ is as QuerySelectorAll,
2331
+ f as SpsFileUploadComponent,
2332
+ Os as SpsFileUploadExamples,
2333
+ y as SpsInsightCardComponent,
2334
+ As as SpsInsightCardExamples,
2335
+ te as SpsInsightsComponent,
2336
+ P as SpsNavTabComponent,
2337
+ ue as SpsNavTabSetComponent,
2338
+ Ds as SpsNavTabsExamples,
2339
+ O as SpsPhotoComponent,
2340
+ os as SpsPhotoDisplayMode,
2341
+ ls as SpsPhotoExamples,
2342
+ he as StyleBindings,
2343
+ et as Watch,
2344
+ o as h,
2345
+ ys as namespaceOverrideRegistrar,
2346
+ xs as register,
2347
+ Ns as webComponentsUseI18n
2348
+ };