@ed.yakovich/component-library 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/components/Accordion/context/index.js +7 -0
  2. package/dist/components/Accordion/index.js +38 -0
  3. package/dist/components/Accordion/types/index.js +1 -0
  4. package/dist/components/Cart/index.js +34 -0
  5. package/dist/components/EquipmentSummary/context/index.js +10 -0
  6. package/dist/components/EquipmentSummary/index.js +65 -0
  7. package/dist/components/EquipmentSummary/types/index.js +1 -0
  8. package/dist/components/Grid/index.js +19 -0
  9. package/dist/components/HeroBanner/context/index.js +7 -0
  10. package/dist/components/HeroBanner/index.js +33 -0
  11. package/dist/components/HeroBanner/types/index.js +1 -0
  12. package/dist/components/InfoBanner/index.js +24 -4
  13. package/dist/components/Nav/index.js +19 -0
  14. package/dist/components/OfferCards/context/index.js +7 -0
  15. package/dist/components/OfferCards/index.js +30 -0
  16. package/dist/components/OfferCards/subComponents/OfferCard.js +61 -0
  17. package/dist/components/OfferCards/types/index.js +1 -0
  18. package/dist/components/SaleBanner/context/index.js +7 -0
  19. package/dist/components/SaleBanner/index.js +58 -0
  20. package/dist/components/SaleBanner/types/index.js +1 -0
  21. package/dist/{index-ba31999b-V1s4iffq.js → index-0d8e0844-BJzWsYCM.js} +2443 -2491
  22. package/dist/index-CIJ0X8ia.js +29141 -0
  23. package/dist/index-b30029d4-CYulIFrS.js +12 -0
  24. package/dist/index-e6818ded-r_t6ryaW.js +57 -0
  25. package/dist/{index.esm-a7c99373-DUoLYEEM.js → index.esm-322571ff-D1REhsOg.js} +1 -1
  26. package/dist/lib/components/Accordion/context/index.d.ts +10 -0
  27. package/dist/lib/components/Accordion/index.d.ts +2 -0
  28. package/dist/lib/components/Accordion/types/index.d.ts +13 -0
  29. package/dist/lib/components/Cart/index.d.ts +6 -0
  30. package/dist/lib/components/EquipmentSummary/context/index.d.ts +10 -0
  31. package/dist/lib/components/EquipmentSummary/index.d.ts +2 -0
  32. package/dist/lib/components/EquipmentSummary/types/index.d.ts +14 -0
  33. package/dist/lib/components/Grid/index.d.ts +13 -0
  34. package/dist/lib/components/HeroBanner/context/index.d.ts +10 -0
  35. package/dist/lib/components/HeroBanner/index.d.ts +2 -0
  36. package/dist/lib/components/HeroBanner/types/index.d.ts +11 -0
  37. package/dist/lib/components/Nav/index.d.ts +8 -0
  38. package/dist/lib/components/OfferCards/context/index.d.ts +9 -0
  39. package/dist/lib/components/OfferCards/index.d.ts +2 -0
  40. package/dist/lib/components/OfferCards/subComponents/OfferCard.d.ts +3 -0
  41. package/dist/lib/components/OfferCards/types/index.d.ts +26 -0
  42. package/dist/lib/components/SaleBanner/context/index.d.ts +10 -0
  43. package/dist/lib/components/SaleBanner/index.d.ts +2 -0
  44. package/dist/lib/components/SaleBanner/types/index.d.ts +11 -0
  45. package/dist/lib/main.d.ts +13 -0
  46. package/dist/main.js +32 -6
  47. package/dist/prism-accordion.entry-BxWxJTzN.js +51 -0
  48. package/dist/prism-avatar_2.entry-D13WJm8L.js +68 -0
  49. package/dist/prism-badge.entry-DxUacM3U.js +58 -0
  50. package/dist/prism-banner.entry-C2PB-eYg.js +82 -0
  51. package/dist/prism-breadcrumb.entry-Xs2uvtMJ.js +33 -0
  52. package/dist/prism-button_2.entry-Bu7aTvL3.js +110 -0
  53. package/dist/prism-card.entry-DN_z84zN.js +119 -0
  54. package/dist/prism-carousel.entry-R9W3QWAj.js +3111 -0
  55. package/dist/prism-checkbox-group.entry-D6r-q0Hm.js +62 -0
  56. package/dist/prism-checkbox.entry-w99uqUBB.js +99 -0
  57. package/dist/prism-data-table.entry-Ckducvo-.js +10475 -0
  58. package/dist/prism-datepicker.entry-QpabfLme.js +249 -0
  59. package/dist/{prism-form.entry-C8VzGp6c.js → prism-form.entry-B0of8RQh.js} +11 -11
  60. package/dist/prism-grid.entry-CFnOi_Vc.js +28 -0
  61. package/dist/prism-header.entry-0LjtG822.js +202 -0
  62. package/dist/prism-hero.entry-DVipQrOc.js +23 -0
  63. package/dist/prism-icon_2.entry-FQ8c7tJr.js +118 -0
  64. package/dist/prism-image.entry-BtjBPMeE.js +38 -0
  65. package/dist/prism-input-file.entry-CXYV9xtO.js +119 -0
  66. package/dist/prism-input-otp.entry-CXBN1WBi.js +63 -0
  67. package/dist/prism-input-text.entry-D5yPqcBS.js +228 -0
  68. package/dist/prism-input-textarea.entry-6O7qdk_r.js +140 -0
  69. package/dist/prism-layout.entry-CJcjgXky.js +20 -0
  70. package/dist/prism-lineitem.entry-BSBcpGKE.js +44 -0
  71. package/dist/prism-menu.entry-hxjFECbL.js +231 -0
  72. package/dist/prism-modal.entry-BIavEySL.js +94 -0
  73. package/dist/prism-pagination.entry-cJjWcUeH.js +60 -0
  74. package/dist/prism-popover.entry-EiL6rh8c.js +1013 -0
  75. package/dist/prism-popper.entry-B3NAqQHK.js +959 -0
  76. package/dist/prism-progress.entry-DkyB0j-F.js +79 -0
  77. package/dist/prism-radio-group.entry-nR5BA0H-.js +66 -0
  78. package/dist/prism-radio.entry-2oHibUZp.js +101 -0
  79. package/dist/prism-select.entry-DaSGr0dP.js +230 -0
  80. package/dist/prism-switch.entry-CiUr8IHK.js +95 -0
  81. package/dist/prism-tab.entry-Db7WSxCT.js +20 -0
  82. package/dist/prism-tabs.entry-BSS5u08w.js +70 -0
  83. package/dist/prism-tooltip.entry-Dqu6PskB.js +52 -0
  84. package/dist/prism-typeahead.entry-BMyMjXSV.js +1234 -0
  85. package/package.json +3 -2
  86. package/dist/index-44540db3-BN5vFHKr.js +0 -44
  87. package/dist/index-4d46d9ca-BtyZMEt1.js +0 -12
  88. package/dist/index-D9BZSjMp.js +0 -21158
  89. package/dist/prism-accordion.entry-D4g7wdXB.js +0 -51
  90. package/dist/prism-avatar_3.entry-C1H9bg9y.js +0 -335
  91. package/dist/prism-badge.entry-CWLalQsR.js +0 -56
  92. package/dist/prism-banner.entry-D1sce4tY.js +0 -105
  93. package/dist/prism-breadcrumb.entry-C282yHQl.js +0 -33
  94. package/dist/prism-button_3.entry-DIg1AEXF.js +0 -240
  95. package/dist/prism-card.entry-DaxGD-uX.js +0 -152
  96. package/dist/prism-carousel.entry-BGmaoDVM.js +0 -3346
  97. package/dist/prism-checkbox-group.entry-Dwa_mvjd.js +0 -62
  98. package/dist/prism-checkbox.entry-CZvx2AHI.js +0 -116
  99. package/dist/prism-data-table.entry-DACAS8BE.js +0 -3591
  100. package/dist/prism-datepicker.entry-CHUyjilE.js +0 -279
  101. package/dist/prism-dialog.entry-DdO9Kt32.js +0 -73
  102. package/dist/prism-drawer.entry-Dn0rvW9U.js +0 -43
  103. package/dist/prism-header.entry-D0PypuC3.js +0 -227
  104. package/dist/prism-hero.entry-DQ8G7Jb_.js +0 -23
  105. package/dist/prism-image.entry-tx9Pc3k_.js +0 -38
  106. package/dist/prism-input-file.entry-CO-2LZxG.js +0 -119
  107. package/dist/prism-input-otp.entry-ZAxExI2D.js +0 -79
  108. package/dist/prism-input-text.entry-EXsN4rgi.js +0 -278
  109. package/dist/prism-input-textarea.entry-CRqY4mr9.js +0 -145
  110. package/dist/prism-input-time.entry-BJ9he6MX.js +0 -85
  111. package/dist/prism-layout.entry-ulDWjtj8.js +0 -20
  112. package/dist/prism-lineitem.entry-DJk6X6mR.js +0 -47
  113. package/dist/prism-modal.entry-C795YZic.js +0 -95
  114. package/dist/prism-pagination.entry-DYQieAu3.js +0 -69
  115. package/dist/prism-popover.entry-BgLcACZw.js +0 -1114
  116. package/dist/prism-progress.entry-Z21rpoTm.js +0 -79
  117. package/dist/prism-radio_2.entry-C0HPCb3G.js +0 -159
  118. package/dist/prism-select.entry-B_l-ab1d.js +0 -286
  119. package/dist/prism-switch.entry-OkC8X1bD.js +0 -95
  120. package/dist/prism-tab.entry-szftB_wL.js +0 -20
  121. package/dist/prism-tabs.entry-0UR3WF52.js +0 -72
  122. package/dist/prism-text.entry-BEAZ8xEV.js +0 -28
  123. package/dist/prism-treelist.entry-UX4FM4Bi.js +0 -135
  124. package/dist/prism-typeahead.entry-CwOiAFQE.js +0 -1264
  125. package/dist/purify-9647b094-0-ZyuBNz.js +0 -572
@@ -1,1264 +0,0 @@
1
- import { r as me, c as T, h, F as O, H as fe, g as ge } from "./index-D9BZSjMp.js";
2
- import { r as Z } from "./index.esm-a7c99373-DUoLYEEM.js";
3
- import { g as ye, r as be, m as ve } from "./index-44540db3-BN5vFHKr.js";
4
- import { D as Ae } from "./purify-9647b094-0-ZyuBNz.js";
5
- /*!
6
- * Copyright (c) 2025 Comcast. Prism UI - v8.28.0 - made with ❤️ in Philadelphia
7
- */
8
- function M(s) {
9
- return Array.isArray ? Array.isArray(s) : ne(s) === "[object Array]";
10
- }
11
- const xe = 1 / 0;
12
- function Ee(s) {
13
- if (typeof s == "string")
14
- return s;
15
- let e = s + "";
16
- return e == "0" && 1 / s == -xe ? "-0" : e;
17
- }
18
- function Ce(s) {
19
- return s == null ? "" : Ee(s);
20
- }
21
- function k(s) {
22
- return typeof s == "string";
23
- }
24
- function re(s) {
25
- return typeof s == "number";
26
- }
27
- function Fe(s) {
28
- return s === !0 || s === !1 || ke(s) && ne(s) == "[object Boolean]";
29
- }
30
- function ae(s) {
31
- return typeof s == "object";
32
- }
33
- function ke(s) {
34
- return ae(s) && s !== null;
35
- }
36
- function x(s) {
37
- return s != null;
38
- }
39
- function j(s) {
40
- return !s.trim().length;
41
- }
42
- function ne(s) {
43
- return s == null ? s === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(s);
44
- }
45
- const Me = "Incorrect 'index' type", _e = (s) => `Invalid value for key ${s}`, we = (s) => `Pattern length exceeds max of ${s}.`, De = (s) => `Missing ${s} property in key`, Ie = (s) => `Property 'weight' in key '${s}' must be a positive integer`, q = Object.prototype.hasOwnProperty;
46
- class Se {
47
- constructor(e) {
48
- this._keys = [], this._keyMap = {};
49
- let t = 0;
50
- e.forEach((i) => {
51
- let r = le(i);
52
- this._keys.push(r), this._keyMap[r.id] = r, t += r.weight;
53
- }), this._keys.forEach((i) => {
54
- i.weight /= t;
55
- });
56
- }
57
- get(e) {
58
- return this._keyMap[e];
59
- }
60
- keys() {
61
- return this._keys;
62
- }
63
- toJSON() {
64
- return JSON.stringify(this._keys);
65
- }
66
- }
67
- function le(s) {
68
- let e = null, t = null, i = null, r = 1, a = null;
69
- if (k(s) || M(s))
70
- i = s, e = ee(s), t = H(s);
71
- else {
72
- if (!q.call(s, "name"))
73
- throw new Error(De("name"));
74
- const n = s.name;
75
- if (i = n, q.call(s, "weight") && (r = s.weight, r <= 0))
76
- throw new Error(Ie(n));
77
- e = ee(n), t = H(n), a = s.getFn;
78
- }
79
- return { path: e, id: t, weight: r, src: i, getFn: a };
80
- }
81
- function ee(s) {
82
- return M(s) ? s : s.split(".");
83
- }
84
- function H(s) {
85
- return M(s) ? s.join(".") : s;
86
- }
87
- function Be(s, e) {
88
- let t = [], i = !1;
89
- const r = (a, n, l) => {
90
- if (x(a))
91
- if (!n[l])
92
- t.push(a);
93
- else {
94
- let o = n[l];
95
- const c = a[o];
96
- if (!x(c))
97
- return;
98
- if (l === n.length - 1 && (k(c) || re(c) || Fe(c)))
99
- t.push(Ce(c));
100
- else if (M(c)) {
101
- i = !0;
102
- for (let u = 0, m = c.length; u < m; u += 1)
103
- r(c[u], n, l + 1);
104
- } else n.length && r(c, n, l + 1);
105
- }
106
- };
107
- return r(s, k(e) ? e.split(".") : e, 0), i ? t : t[0];
108
- }
109
- const Re = {
110
- // Whether the matches should be included in the result set. When `true`, each record in the result
111
- // set will include the indices of the matched characters.
112
- // These can consequently be used for highlighting purposes.
113
- includeMatches: !1,
114
- // When `true`, the matching function will continue to the end of a search pattern even if
115
- // a perfect match has already been located in the string.
116
- findAllMatches: !1,
117
- // Minimum number of characters that must be matched before a result is considered a match
118
- minMatchCharLength: 1
119
- }, Le = {
120
- // When `true`, the algorithm continues searching to the end of the input even if a perfect
121
- // match is found before the end of the same input.
122
- isCaseSensitive: !1,
123
- // When `true`, the algorithm will ignore diacritics (accents) in comparisons
124
- ignoreDiacritics: !1,
125
- // When true, the matching function will continue to the end of a search pattern even if
126
- includeScore: !1,
127
- // List of properties that will be searched. This also supports nested properties.
128
- keys: [],
129
- // Whether to sort the result list, by score
130
- shouldSort: !0,
131
- // Default sort function: sort by ascending score, ascending index
132
- sortFn: (s, e) => s.score === e.score ? s.idx < e.idx ? -1 : 1 : s.score < e.score ? -1 : 1
133
- }, Oe = {
134
- // Approximately where in the text is the pattern expected to be found?
135
- location: 0,
136
- // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
137
- // (of both letters and location), a threshold of '1.0' would match anything.
138
- threshold: 0.6,
139
- // Determines how close the match must be to the fuzzy location (specified above).
140
- // An exact letter match which is 'distance' characters away from the fuzzy location
141
- // would score as a complete mismatch. A distance of '0' requires the match be at
142
- // the exact location specified, a threshold of '1000' would require a perfect match
143
- // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
144
- distance: 100
145
- }, ze = {
146
- // When `true`, it enables the use of unix-like search commands
147
- useExtendedSearch: !1,
148
- // The get function to use when fetching an object's properties.
149
- // The default will search nested paths *ie foo.bar.baz*
150
- getFn: Be,
151
- // When `true`, search will ignore `location` and `distance`, so it won't matter
152
- // where in the string the pattern appears.
153
- // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
154
- ignoreLocation: !1,
155
- // When `true`, the calculation for the relevance score (used for sorting) will
156
- // ignore the field-length norm.
157
- // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
158
- ignoreFieldNorm: !1,
159
- // The weight to determine how much field length norm effects scoring.
160
- fieldNormWeight: 1
161
- };
162
- var d = {
163
- ...Le,
164
- ...Re,
165
- ...Oe,
166
- ...ze
167
- };
168
- const Ve = /[^ ]+/g;
169
- function $e(s = 1, e = 3) {
170
- const t = /* @__PURE__ */ new Map(), i = Math.pow(10, e);
171
- return {
172
- get(r) {
173
- const a = r.match(Ve).length;
174
- if (t.has(a))
175
- return t.get(a);
176
- const n = 1 / Math.pow(a, 0.5 * s), l = parseFloat(Math.round(n * i) / i);
177
- return t.set(a, l), l;
178
- },
179
- clear() {
180
- t.clear();
181
- }
182
- };
183
- }
184
- class Q {
185
- constructor({
186
- getFn: e = d.getFn,
187
- fieldNormWeight: t = d.fieldNormWeight
188
- } = {}) {
189
- this.norm = $e(t, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
190
- }
191
- setSources(e = []) {
192
- this.docs = e;
193
- }
194
- setIndexRecords(e = []) {
195
- this.records = e;
196
- }
197
- setKeys(e = []) {
198
- this.keys = e, this._keysMap = {}, e.forEach((t, i) => {
199
- this._keysMap[t.id] = i;
200
- });
201
- }
202
- create() {
203
- this.isCreated || !this.docs.length || (this.isCreated = !0, k(this.docs[0]) ? this.docs.forEach((e, t) => {
204
- this._addString(e, t);
205
- }) : this.docs.forEach((e, t) => {
206
- this._addObject(e, t);
207
- }), this.norm.clear());
208
- }
209
- // Adds a doc to the end of the index
210
- add(e) {
211
- const t = this.size();
212
- k(e) ? this._addString(e, t) : this._addObject(e, t);
213
- }
214
- // Removes the doc at the specified index of the index
215
- removeAt(e) {
216
- this.records.splice(e, 1);
217
- for (let t = e, i = this.size(); t < i; t += 1)
218
- this.records[t].i -= 1;
219
- }
220
- getValueForItemAtKeyId(e, t) {
221
- return e[this._keysMap[t]];
222
- }
223
- size() {
224
- return this.records.length;
225
- }
226
- _addString(e, t) {
227
- if (!x(e) || j(e))
228
- return;
229
- let i = {
230
- v: e,
231
- i: t,
232
- n: this.norm.get(e)
233
- };
234
- this.records.push(i);
235
- }
236
- _addObject(e, t) {
237
- let i = { i: t, $: {} };
238
- this.keys.forEach((r, a) => {
239
- let n = r.getFn ? r.getFn(e) : this.getFn(e, r.path);
240
- if (x(n)) {
241
- if (M(n)) {
242
- let l = [];
243
- const o = [{ nestedArrIndex: -1, value: n }];
244
- for (; o.length; ) {
245
- const { nestedArrIndex: c, value: u } = o.pop();
246
- if (x(u))
247
- if (k(u) && !j(u)) {
248
- let m = {
249
- v: u,
250
- i: c,
251
- n: this.norm.get(u)
252
- };
253
- l.push(m);
254
- } else M(u) && u.forEach((m, f) => {
255
- o.push({
256
- nestedArrIndex: f,
257
- value: m
258
- });
259
- });
260
- }
261
- i.$[a] = l;
262
- } else if (k(n) && !j(n)) {
263
- let l = {
264
- v: n,
265
- n: this.norm.get(n)
266
- };
267
- i.$[a] = l;
268
- }
269
- }
270
- }), this.records.push(i);
271
- }
272
- toJSON() {
273
- return {
274
- keys: this.keys,
275
- records: this.records
276
- };
277
- }
278
- }
279
- function oe(s, e, { getFn: t = d.getFn, fieldNormWeight: i = d.fieldNormWeight } = {}) {
280
- const r = new Q({ getFn: t, fieldNormWeight: i });
281
- return r.setKeys(s.map(le)), r.setSources(e), r.create(), r;
282
- }
283
- function Ne(s, { getFn: e = d.getFn, fieldNormWeight: t = d.fieldNormWeight } = {}) {
284
- const { keys: i, records: r } = s, a = new Q({ getFn: e, fieldNormWeight: t });
285
- return a.setKeys(i), a.setIndexRecords(r), a;
286
- }
287
- function z(s, {
288
- errors: e = 0,
289
- currentLocation: t = 0,
290
- expectedLocation: i = 0,
291
- distance: r = d.distance,
292
- ignoreLocation: a = d.ignoreLocation
293
- } = {}) {
294
- const n = e / s.length;
295
- if (a)
296
- return n;
297
- const l = Math.abs(i - t);
298
- return r ? n + l / r : l ? 1 : n;
299
- }
300
- function Pe(s = [], e = d.minMatchCharLength) {
301
- let t = [], i = -1, r = -1, a = 0;
302
- for (let n = s.length; a < n; a += 1) {
303
- let l = s[a];
304
- l && i === -1 ? i = a : !l && i !== -1 && (r = a - 1, r - i + 1 >= e && t.push([i, r]), i = -1);
305
- }
306
- return s[a - 1] && a - i >= e && t.push([i, a - 1]), t;
307
- }
308
- const S = 32;
309
- function Te(s, e, t, {
310
- location: i = d.location,
311
- distance: r = d.distance,
312
- threshold: a = d.threshold,
313
- findAllMatches: n = d.findAllMatches,
314
- minMatchCharLength: l = d.minMatchCharLength,
315
- includeMatches: o = d.includeMatches,
316
- ignoreLocation: c = d.ignoreLocation
317
- } = {}) {
318
- if (e.length > S)
319
- throw new Error(we(S));
320
- const u = e.length, m = s.length, f = Math.max(0, Math.min(i, m));
321
- let p = a, g = f;
322
- const y = l > 1 || o, v = y ? Array(m) : [];
323
- let A;
324
- for (; (A = s.indexOf(e, g)) > -1; ) {
325
- let C = z(e, {
326
- currentLocation: A,
327
- expectedLocation: f,
328
- distance: r,
329
- ignoreLocation: c
330
- });
331
- if (p = Math.min(C, p), g = A + u, y) {
332
- let _ = 0;
333
- for (; _ < u; )
334
- v[A + _] = 1, _ += 1;
335
- }
336
- }
337
- g = -1;
338
- let b = [], E = 1, I = u + m;
339
- const pe = 1 << u - 1;
340
- for (let C = 0; C < u; C += 1) {
341
- let _ = 0, w = I;
342
- for (; _ < w; )
343
- z(e, {
344
- errors: C,
345
- currentLocation: f + w,
346
- expectedLocation: f,
347
- distance: r,
348
- ignoreLocation: c
349
- }) <= p ? _ = w : I = w, w = Math.floor((I - _) / 2 + _);
350
- I = w;
351
- let X = Math.max(1, f - w + 1), P = n ? m : Math.min(f + w, m) + u, B = Array(P + 2);
352
- B[P + 1] = (1 << C) - 1;
353
- for (let F = P; F >= X; F -= 1) {
354
- let L = F - 1, J = t[s.charAt(L)];
355
- if (y && (v[L] = +!!J), B[F] = (B[F + 1] << 1 | 1) & J, C && (B[F] |= (b[F + 1] | b[F]) << 1 | 1 | b[F + 1]), B[F] & pe && (E = z(e, {
356
- errors: C,
357
- currentLocation: L,
358
- expectedLocation: f,
359
- distance: r,
360
- ignoreLocation: c
361
- }), E <= p)) {
362
- if (p = E, g = L, g <= f)
363
- break;
364
- X = Math.max(1, 2 * f - g);
365
- }
366
- }
367
- if (z(e, {
368
- errors: C + 1,
369
- currentLocation: f,
370
- expectedLocation: f,
371
- distance: r,
372
- ignoreLocation: c
373
- }) > p)
374
- break;
375
- b = B;
376
- }
377
- const N = {
378
- isMatch: g >= 0,
379
- // Count exact matches (those with a score of 0) to be "almost" exact
380
- score: Math.max(1e-3, E)
381
- };
382
- if (y) {
383
- const C = Pe(v, l);
384
- C.length ? o && (N.indices = C) : N.isMatch = !1;
385
- }
386
- return N;
387
- }
388
- function je(s) {
389
- let e = {};
390
- for (let t = 0, i = s.length; t < i; t += 1) {
391
- const r = s.charAt(t);
392
- e[r] = (e[r] || 0) | 1 << i - t - 1;
393
- }
394
- return e;
395
- }
396
- const V = String.prototype.normalize ? (s) => s.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "") : (s) => s;
397
- class ce {
398
- constructor(e, {
399
- location: t = d.location,
400
- threshold: i = d.threshold,
401
- distance: r = d.distance,
402
- includeMatches: a = d.includeMatches,
403
- findAllMatches: n = d.findAllMatches,
404
- minMatchCharLength: l = d.minMatchCharLength,
405
- isCaseSensitive: o = d.isCaseSensitive,
406
- ignoreDiacritics: c = d.ignoreDiacritics,
407
- ignoreLocation: u = d.ignoreLocation
408
- } = {}) {
409
- if (this.options = {
410
- location: t,
411
- threshold: i,
412
- distance: r,
413
- includeMatches: a,
414
- findAllMatches: n,
415
- minMatchCharLength: l,
416
- isCaseSensitive: o,
417
- ignoreDiacritics: c,
418
- ignoreLocation: u
419
- }, e = o ? e : e.toLowerCase(), e = c ? V(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length)
420
- return;
421
- const m = (p, g) => {
422
- this.chunks.push({
423
- pattern: p,
424
- alphabet: je(p),
425
- startIndex: g
426
- });
427
- }, f = this.pattern.length;
428
- if (f > S) {
429
- let p = 0;
430
- const g = f % S, y = f - g;
431
- for (; p < y; )
432
- m(this.pattern.substr(p, S), p), p += S;
433
- if (g) {
434
- const v = f - S;
435
- m(this.pattern.substr(v), v);
436
- }
437
- } else
438
- m(this.pattern, 0);
439
- }
440
- searchIn(e) {
441
- const { isCaseSensitive: t, ignoreDiacritics: i, includeMatches: r } = this.options;
442
- if (e = t ? e : e.toLowerCase(), e = i ? V(e) : e, this.pattern === e) {
443
- let y = {
444
- isMatch: !0,
445
- score: 0
446
- };
447
- return r && (y.indices = [[0, e.length - 1]]), y;
448
- }
449
- const {
450
- location: a,
451
- distance: n,
452
- threshold: l,
453
- findAllMatches: o,
454
- minMatchCharLength: c,
455
- ignoreLocation: u
456
- } = this.options;
457
- let m = [], f = 0, p = !1;
458
- this.chunks.forEach(({ pattern: y, alphabet: v, startIndex: A }) => {
459
- const { isMatch: b, score: E, indices: I } = Te(e, y, v, {
460
- location: a + A,
461
- distance: n,
462
- threshold: l,
463
- findAllMatches: o,
464
- minMatchCharLength: c,
465
- includeMatches: r,
466
- ignoreLocation: u
467
- });
468
- b && (p = !0), f += E, b && I && (m = [...m, ...I]);
469
- });
470
- let g = {
471
- isMatch: p,
472
- score: p ? f / this.chunks.length : 1
473
- };
474
- return p && r && (g.indices = m), g;
475
- }
476
- }
477
- class D {
478
- constructor(e) {
479
- this.pattern = e;
480
- }
481
- static isMultiMatch(e) {
482
- return te(e, this.multiRegex);
483
- }
484
- static isSingleMatch(e) {
485
- return te(e, this.singleRegex);
486
- }
487
- search() {
488
- }
489
- }
490
- function te(s, e) {
491
- const t = s.match(e);
492
- return t ? t[1] : null;
493
- }
494
- class He extends D {
495
- constructor(e) {
496
- super(e);
497
- }
498
- static get type() {
499
- return "exact";
500
- }
501
- static get multiRegex() {
502
- return /^="(.*)"$/;
503
- }
504
- static get singleRegex() {
505
- return /^=(.*)$/;
506
- }
507
- search(e) {
508
- const t = e === this.pattern;
509
- return {
510
- isMatch: t,
511
- score: t ? 0 : 1,
512
- indices: [0, this.pattern.length - 1]
513
- };
514
- }
515
- }
516
- class Ke extends D {
517
- constructor(e) {
518
- super(e);
519
- }
520
- static get type() {
521
- return "inverse-exact";
522
- }
523
- static get multiRegex() {
524
- return /^!"(.*)"$/;
525
- }
526
- static get singleRegex() {
527
- return /^!(.*)$/;
528
- }
529
- search(e) {
530
- const i = e.indexOf(this.pattern) === -1;
531
- return {
532
- isMatch: i,
533
- score: i ? 0 : 1,
534
- indices: [0, e.length - 1]
535
- };
536
- }
537
- }
538
- class We extends D {
539
- constructor(e) {
540
- super(e);
541
- }
542
- static get type() {
543
- return "prefix-exact";
544
- }
545
- static get multiRegex() {
546
- return /^\^"(.*)"$/;
547
- }
548
- static get singleRegex() {
549
- return /^\^(.*)$/;
550
- }
551
- search(e) {
552
- const t = e.startsWith(this.pattern);
553
- return {
554
- isMatch: t,
555
- score: t ? 0 : 1,
556
- indices: [0, this.pattern.length - 1]
557
- };
558
- }
559
- }
560
- class Ue extends D {
561
- constructor(e) {
562
- super(e);
563
- }
564
- static get type() {
565
- return "inverse-prefix-exact";
566
- }
567
- static get multiRegex() {
568
- return /^!\^"(.*)"$/;
569
- }
570
- static get singleRegex() {
571
- return /^!\^(.*)$/;
572
- }
573
- search(e) {
574
- const t = !e.startsWith(this.pattern);
575
- return {
576
- isMatch: t,
577
- score: t ? 0 : 1,
578
- indices: [0, e.length - 1]
579
- };
580
- }
581
- }
582
- class Ge extends D {
583
- constructor(e) {
584
- super(e);
585
- }
586
- static get type() {
587
- return "suffix-exact";
588
- }
589
- static get multiRegex() {
590
- return /^"(.*)"\$$/;
591
- }
592
- static get singleRegex() {
593
- return /^(.*)\$$/;
594
- }
595
- search(e) {
596
- const t = e.endsWith(this.pattern);
597
- return {
598
- isMatch: t,
599
- score: t ? 0 : 1,
600
- indices: [e.length - this.pattern.length, e.length - 1]
601
- };
602
- }
603
- }
604
- class Ye extends D {
605
- constructor(e) {
606
- super(e);
607
- }
608
- static get type() {
609
- return "inverse-suffix-exact";
610
- }
611
- static get multiRegex() {
612
- return /^!"(.*)"\$$/;
613
- }
614
- static get singleRegex() {
615
- return /^!(.*)\$$/;
616
- }
617
- search(e) {
618
- const t = !e.endsWith(this.pattern);
619
- return {
620
- isMatch: t,
621
- score: t ? 0 : 1,
622
- indices: [0, e.length - 1]
623
- };
624
- }
625
- }
626
- class ue extends D {
627
- constructor(e, {
628
- location: t = d.location,
629
- threshold: i = d.threshold,
630
- distance: r = d.distance,
631
- includeMatches: a = d.includeMatches,
632
- findAllMatches: n = d.findAllMatches,
633
- minMatchCharLength: l = d.minMatchCharLength,
634
- isCaseSensitive: o = d.isCaseSensitive,
635
- ignoreDiacritics: c = d.ignoreDiacritics,
636
- ignoreLocation: u = d.ignoreLocation
637
- } = {}) {
638
- super(e), this._bitapSearch = new ce(e, {
639
- location: t,
640
- threshold: i,
641
- distance: r,
642
- includeMatches: a,
643
- findAllMatches: n,
644
- minMatchCharLength: l,
645
- isCaseSensitive: o,
646
- ignoreDiacritics: c,
647
- ignoreLocation: u
648
- });
649
- }
650
- static get type() {
651
- return "fuzzy";
652
- }
653
- static get multiRegex() {
654
- return /^"(.*)"$/;
655
- }
656
- static get singleRegex() {
657
- return /^(.*)$/;
658
- }
659
- search(e) {
660
- return this._bitapSearch.searchIn(e);
661
- }
662
- }
663
- class he extends D {
664
- constructor(e) {
665
- super(e);
666
- }
667
- static get type() {
668
- return "include";
669
- }
670
- static get multiRegex() {
671
- return /^'"(.*)"$/;
672
- }
673
- static get singleRegex() {
674
- return /^'(.*)$/;
675
- }
676
- search(e) {
677
- let t = 0, i;
678
- const r = [], a = this.pattern.length;
679
- for (; (i = e.indexOf(this.pattern, t)) > -1; )
680
- t = i + a, r.push([i, t - 1]);
681
- const n = !!r.length;
682
- return {
683
- isMatch: n,
684
- score: n ? 0 : 1,
685
- indices: r
686
- };
687
- }
688
- }
689
- const K = [
690
- He,
691
- he,
692
- We,
693
- Ue,
694
- Ye,
695
- Ge,
696
- Ke,
697
- ue
698
- ], se = K.length, Qe = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Xe = "|";
699
- function Je(s, e = {}) {
700
- return s.split(Xe).map((t) => {
701
- let i = t.trim().split(Qe).filter((a) => a && !!a.trim()), r = [];
702
- for (let a = 0, n = i.length; a < n; a += 1) {
703
- const l = i[a];
704
- let o = !1, c = -1;
705
- for (; !o && ++c < se; ) {
706
- const u = K[c];
707
- let m = u.isMultiMatch(l);
708
- m && (r.push(new u(m, e)), o = !0);
709
- }
710
- if (!o)
711
- for (c = -1; ++c < se; ) {
712
- const u = K[c];
713
- let m = u.isSingleMatch(l);
714
- if (m) {
715
- r.push(new u(m, e));
716
- break;
717
- }
718
- }
719
- }
720
- return r;
721
- });
722
- }
723
- const Ze = /* @__PURE__ */ new Set([ue.type, he.type]);
724
- class qe {
725
- constructor(e, {
726
- isCaseSensitive: t = d.isCaseSensitive,
727
- ignoreDiacritics: i = d.ignoreDiacritics,
728
- includeMatches: r = d.includeMatches,
729
- minMatchCharLength: a = d.minMatchCharLength,
730
- ignoreLocation: n = d.ignoreLocation,
731
- findAllMatches: l = d.findAllMatches,
732
- location: o = d.location,
733
- threshold: c = d.threshold,
734
- distance: u = d.distance
735
- } = {}) {
736
- this.query = null, this.options = {
737
- isCaseSensitive: t,
738
- ignoreDiacritics: i,
739
- includeMatches: r,
740
- minMatchCharLength: a,
741
- findAllMatches: l,
742
- ignoreLocation: n,
743
- location: o,
744
- threshold: c,
745
- distance: u
746
- }, e = t ? e : e.toLowerCase(), e = i ? V(e) : e, this.pattern = e, this.query = Je(this.pattern, this.options);
747
- }
748
- static condition(e, t) {
749
- return t.useExtendedSearch;
750
- }
751
- searchIn(e) {
752
- const t = this.query;
753
- if (!t)
754
- return {
755
- isMatch: !1,
756
- score: 1
757
- };
758
- const { includeMatches: i, isCaseSensitive: r, ignoreDiacritics: a } = this.options;
759
- e = r ? e : e.toLowerCase(), e = a ? V(e) : e;
760
- let n = 0, l = [], o = 0;
761
- for (let c = 0, u = t.length; c < u; c += 1) {
762
- const m = t[c];
763
- l.length = 0, n = 0;
764
- for (let f = 0, p = m.length; f < p; f += 1) {
765
- const g = m[f], { isMatch: y, indices: v, score: A } = g.search(e);
766
- if (y) {
767
- if (n += 1, o += A, i) {
768
- const b = g.constructor.type;
769
- Ze.has(b) ? l = [...l, ...v] : l.push(v);
770
- }
771
- } else {
772
- o = 0, n = 0, l.length = 0;
773
- break;
774
- }
775
- }
776
- if (n) {
777
- let f = {
778
- isMatch: !0,
779
- score: o / n
780
- };
781
- return i && (f.indices = l), f;
782
- }
783
- }
784
- return {
785
- isMatch: !1,
786
- score: 1
787
- };
788
- }
789
- }
790
- const W = [];
791
- function et(...s) {
792
- W.push(...s);
793
- }
794
- function U(s, e) {
795
- for (let t = 0, i = W.length; t < i; t += 1) {
796
- let r = W[t];
797
- if (r.condition(s, e))
798
- return new r(s, e);
799
- }
800
- return new ce(s, e);
801
- }
802
- const $ = {
803
- AND: "$and",
804
- OR: "$or"
805
- }, G = {
806
- PATH: "$path",
807
- PATTERN: "$val"
808
- }, Y = (s) => !!(s[$.AND] || s[$.OR]), tt = (s) => !!s[G.PATH], st = (s) => !M(s) && ae(s) && !Y(s), ie = (s) => ({
809
- [$.AND]: Object.keys(s).map((e) => ({
810
- [e]: s[e]
811
- }))
812
- });
813
- function de(s, e, { auto: t = !0 } = {}) {
814
- const i = (r) => {
815
- let a = Object.keys(r);
816
- const n = tt(r);
817
- if (!n && a.length > 1 && !Y(r))
818
- return i(ie(r));
819
- if (st(r)) {
820
- const o = n ? r[G.PATH] : a[0], c = n ? r[G.PATTERN] : r[o];
821
- if (!k(c))
822
- throw new Error(_e(o));
823
- const u = {
824
- keyId: H(o),
825
- pattern: c
826
- };
827
- return t && (u.searcher = U(c, e)), u;
828
- }
829
- let l = {
830
- children: [],
831
- operator: a[0]
832
- };
833
- return a.forEach((o) => {
834
- const c = r[o];
835
- M(c) && c.forEach((u) => {
836
- l.children.push(i(u));
837
- });
838
- }), l;
839
- };
840
- return Y(s) || (s = ie(s)), i(s);
841
- }
842
- function it(s, { ignoreFieldNorm: e = d.ignoreFieldNorm }) {
843
- s.forEach((t) => {
844
- let i = 1;
845
- t.matches.forEach(({ key: r, norm: a, score: n }) => {
846
- const l = r ? r.weight : null;
847
- i *= Math.pow(
848
- n === 0 && l ? Number.EPSILON : n,
849
- (l || 1) * (e ? 1 : a)
850
- );
851
- }), t.score = i;
852
- });
853
- }
854
- function rt(s, e) {
855
- const t = s.matches;
856
- e.matches = [], x(t) && t.forEach((i) => {
857
- if (!x(i.indices) || !i.indices.length)
858
- return;
859
- const { indices: r, value: a } = i;
860
- let n = {
861
- indices: r,
862
- value: a
863
- };
864
- i.key && (n.key = i.key.src), i.idx > -1 && (n.refIndex = i.idx), e.matches.push(n);
865
- });
866
- }
867
- function at(s, e) {
868
- e.score = s.score;
869
- }
870
- function nt(s, e, {
871
- includeMatches: t = d.includeMatches,
872
- includeScore: i = d.includeScore
873
- } = {}) {
874
- const r = [];
875
- return t && r.push(rt), i && r.push(at), s.map((a) => {
876
- const { idx: n } = a, l = {
877
- item: e[n],
878
- refIndex: n
879
- };
880
- return r.length && r.forEach((o) => {
881
- o(a, l);
882
- }), l;
883
- });
884
- }
885
- class R {
886
- constructor(e, t = {}, i) {
887
- this.options = { ...d, ...t }, this.options.useExtendedSearch, this._keyStore = new Se(this.options.keys), this.setCollection(e, i);
888
- }
889
- setCollection(e, t) {
890
- if (this._docs = e, t && !(t instanceof Q))
891
- throw new Error(Me);
892
- this._myIndex = t || oe(this.options.keys, this._docs, {
893
- getFn: this.options.getFn,
894
- fieldNormWeight: this.options.fieldNormWeight
895
- });
896
- }
897
- add(e) {
898
- x(e) && (this._docs.push(e), this._myIndex.add(e));
899
- }
900
- remove(e = () => !1) {
901
- const t = [];
902
- for (let i = 0, r = this._docs.length; i < r; i += 1) {
903
- const a = this._docs[i];
904
- e(a, i) && (this.removeAt(i), i -= 1, r -= 1, t.push(a));
905
- }
906
- return t;
907
- }
908
- removeAt(e) {
909
- this._docs.splice(e, 1), this._myIndex.removeAt(e);
910
- }
911
- getIndex() {
912
- return this._myIndex;
913
- }
914
- search(e, { limit: t = -1 } = {}) {
915
- const {
916
- includeMatches: i,
917
- includeScore: r,
918
- shouldSort: a,
919
- sortFn: n,
920
- ignoreFieldNorm: l
921
- } = this.options;
922
- let o = k(e) ? k(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
923
- return it(o, { ignoreFieldNorm: l }), a && o.sort(n), re(t) && t > -1 && (o = o.slice(0, t)), nt(o, this._docs, {
924
- includeMatches: i,
925
- includeScore: r
926
- });
927
- }
928
- _searchStringList(e) {
929
- const t = U(e, this.options), { records: i } = this._myIndex, r = [];
930
- return i.forEach(({ v: a, i: n, n: l }) => {
931
- if (!x(a))
932
- return;
933
- const { isMatch: o, score: c, indices: u } = t.searchIn(a);
934
- o && r.push({
935
- item: a,
936
- idx: n,
937
- matches: [{ score: c, value: a, norm: l, indices: u }]
938
- });
939
- }), r;
940
- }
941
- _searchLogical(e) {
942
- const t = de(e, this.options), i = (l, o, c) => {
943
- if (!l.children) {
944
- const { keyId: m, searcher: f } = l, p = this._findMatches({
945
- key: this._keyStore.get(m),
946
- value: this._myIndex.getValueForItemAtKeyId(o, m),
947
- searcher: f
948
- });
949
- return p && p.length ? [
950
- {
951
- idx: c,
952
- item: o,
953
- matches: p
954
- }
955
- ] : [];
956
- }
957
- const u = [];
958
- for (let m = 0, f = l.children.length; m < f; m += 1) {
959
- const p = l.children[m], g = i(p, o, c);
960
- if (g.length)
961
- u.push(...g);
962
- else if (l.operator === $.AND)
963
- return [];
964
- }
965
- return u;
966
- }, r = this._myIndex.records, a = {}, n = [];
967
- return r.forEach(({ $: l, i: o }) => {
968
- if (x(l)) {
969
- let c = i(t, l, o);
970
- c.length && (a[o] || (a[o] = { idx: o, item: l, matches: [] }, n.push(a[o])), c.forEach(({ matches: u }) => {
971
- a[o].matches.push(...u);
972
- }));
973
- }
974
- }), n;
975
- }
976
- _searchObjectList(e) {
977
- const t = U(e, this.options), { keys: i, records: r } = this._myIndex, a = [];
978
- return r.forEach(({ $: n, i: l }) => {
979
- if (!x(n))
980
- return;
981
- let o = [];
982
- i.forEach((c, u) => {
983
- o.push(
984
- ...this._findMatches({
985
- key: c,
986
- value: n[u],
987
- searcher: t
988
- })
989
- );
990
- }), o.length && a.push({
991
- idx: l,
992
- item: n,
993
- matches: o
994
- });
995
- }), a;
996
- }
997
- _findMatches({ key: e, value: t, searcher: i }) {
998
- if (!x(t))
999
- return [];
1000
- let r = [];
1001
- if (M(t))
1002
- t.forEach(({ v: a, i: n, n: l }) => {
1003
- if (!x(a))
1004
- return;
1005
- const { isMatch: o, score: c, indices: u } = i.searchIn(a);
1006
- o && r.push({
1007
- score: c,
1008
- key: e,
1009
- value: a,
1010
- idx: n,
1011
- norm: l,
1012
- indices: u
1013
- });
1014
- });
1015
- else {
1016
- const { v: a, n } = t, { isMatch: l, score: o, indices: c } = i.searchIn(a);
1017
- l && r.push({ score: o, key: e, value: a, norm: n, indices: c });
1018
- }
1019
- return r;
1020
- }
1021
- }
1022
- R.version = "7.1.0";
1023
- R.createIndex = oe;
1024
- R.parseIndex = Ne;
1025
- R.config = d;
1026
- R.parseQuery = de;
1027
- et(qe);
1028
- const lt = ".sc-prism-typeahead-h{display:block;position:relative}.announcement.sc-prism-typeahead{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.input-host.sc-prism-typeahead{margin:var(--prism-input-text-spacing-margin,inherit 0 0 0)}.results.sc-prism-typeahead{background-color:var(--prism-color-material-primary-base);border:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);border-radius:var(--prism-radius-size-md);box-shadow:var(--prism-shadow-xs-base);display:none;left:0;margin:var(--prism-typeahead-results-margin,var(--prism-spacer-size-xs) 0 0 0);max-height:var(--prism-typeahead-results-height,50vh);overflow:auto;position:absolute;top:0;width:var(--prism-typeahead-results-width,100%);z-index:var(--prism-layout-z-index-dropdown)}.results.top.sc-prism-typeahead{bottom:var(--internal-bottom);max-height:12rem;top:inherit}.results-header.sc-prism-typeahead{align-items:center;display:flex;justify-content:space-between;margin-bottom:.25rem;padding-left:1rem;padding-right:1rem;padding-top:.75rem}.clear.sc-prism-typeahead{display:none}.clear.show.sc-prism-typeahead{display:block}.mc-icon.sc-prism-typeahead{margin-right:var(--prism-spacer-size-xs)}.selections-container.sc-prism-typeahead{margin:var(--prism-typeahead-selections-margin,var(--prism-spacer-size-md) 0 0 0);max-height:var(--prism-typeahead-selections-max-height,50vh)}.selections.sc-prism-typeahead{display:flex;flex-direction:row;flex-wrap:wrap;gap:var(--prism-spacer-size-xs)}.selection-controls.sc-prism-typeahead{align-items:center;display:flex;gap:var(--prism-spacer-size-lg);margin-bottom:var(--prism-spacer-size-sm);width:100%}.results-container.sc-prism-typeahead{position:relative}.open.sc-prism-typeahead:not(.zero){display:block}.multi-controls.sc-prism-typeahead{display:flex;gap:var(--prism-spacer-size-md)}.result-list.sc-prism-typeahead{list-style:none;margin:0;padding:0}.multi.sc-prism-typeahead{padding:var(--prism-spacer-size-lg)}.result-list.sc-prism-typeahead:focus{outline:2px solid transparent;outline-offset:2px}.result-list.sc-prism-typeahead li.sc-prism-typeahead{transition:background-color var(--prism-animation-duration-normal) var(--prism-animation-timing-function)}.result-list.sc-prism-typeahead li.highlight.sc-prism-typeahead,.result-list.sc-prism-typeahead li.sc-prism-typeahead:hover{background-color:var(--prism-color-material-primary-hover)}.result-list.sc-prism-typeahead li.sc-prism-typeahead:active{background-color:var(--prism-color-material-primary-down)}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead{background-color:var(--prism-color-material-brand-primary-base)}.result-list.sc-prism-typeahead li.selected.highlight.sc-prism-typeahead,.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead:hover{background-color:var(--prism-color-material-brand-primary-hover)}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead:active{background-color:var(--prism-color-material-brand-primary-down)}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead:active .selected-icon.sc-prism-typeahead{color:var(--prism-color-text-brand-primary-down)}.checked-icon.hide.sc-prism-typeahead{display:none}.result.sc-prism-typeahead{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;border-style:none;cursor:pointer;display:flex;gap:var(--prism-spacer-size-lg);justify-content:space-between;padding:var(--prism-spacer-size-lg);text-align:left;width:100%}.result.sc-prism-typeahead .selected-icon.sc-prism-typeahead{color:var(--prism-color-text-brand-primary-base)}.result.sc-prism-typeahead:focus{background-color:var(--prism-color-material-primary-hover);outline:2px solid var(--prism-color-border-brand-primary-base);outline-offset:-3px}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead .result.sc-prism-typeahead:focus{background-color:var(--prism-color-material-brand-primary-hover)}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead .result.sc-prism-typeahead:focus .selected-icon.sc-prism-typeahead{color:var(--prism-color-text-brand-primary-focus)}.result.sc-prism-typeahead:disabled{cursor:not-allowed}.selection-content.sc-prism-typeahead{flex:1 1 auto}.no-results.sc-prism-typeahead{display:block}.add-item.sc-prism-typeahead,.no-results.sc-prism-typeahead{padding:var(--prism-spacer-size-md)}.add-item.sc-prism-typeahead{align-items:center;border-color:color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);border-top-width:1px;display:flex}@media (prefers-reduced-motion){.result-list.sc-prism-typeahead li.sc-prism-typeahead{transition:none}}.loading.sc-prism-typeahead{display:flex;gap:var(--prism-spacer-size-sm);padding:var(--prism-spacer-size-lg);text-align:left}.group-header.sc-prism-typeahead{margin-bottom:var(--prism-spacer-size-xs);padding:var(--prism-spacer-size-md)}.typeahead-size-xxs.sc-prism-typeahead{--prism-input-text-spacing-padding:var(--prism-spacer-size-xs) 2.5rem}.typeahead-as-minimal.typeahead-size-xxs.sc-prism-typeahead{--prism-input-text-spacing-padding:var(--prism-spacer-size-xs) 1.5rem}.container.sc-prism-typeahead{width:100%}@media (min-width:640px){.container.sc-prism-typeahead{max-width:640px}}@media (min-width:768px){.container.sc-prism-typeahead{max-width:768px}}@media (min-width:1024px){.container.sc-prism-typeahead{max-width:1024px}}@media (min-width:1280px){.container.sc-prism-typeahead{max-width:1280px}}@media (min-width:1536px){.container.sc-prism-typeahead{max-width:1536px}}", ot = lt, ct = class {
1029
- constructor(s) {
1030
- me(this, s), this.prismChange = T(this, "prismChange", 7), this.prismFocus = T(this, "prismFocus", 7), this.prismWatch = T(this, "prismWatch", 7), this.uid = ye(), this.singleResultId = `prism-typeahead-option-${this.uid}`, this.resultsListId = `prism-typeahead-results-${this.uid}`, this.customOptionId = `prism-typeahead-custom-${this.uid}`, this.textInput = `prism-input-text-${this.prismId}`, this.resultsHeadlineId = `${this.prismId}-results-headline`, this.debounceDelay = 500, this._hostTag = "prism-typeahead", this.generateHighlightedText = (e, t = []) => {
1031
- let i = "", r = 0;
1032
- return t.forEach((a) => {
1033
- const n = a[1] + 1;
1034
- i += [e.substring(r, a[0]), "<mark>", e.substring(a[0], n), "</mark>"].join(""), r = n;
1035
- }), i += e.substring(r), i;
1036
- }, this.announce = Z(() => {
1037
- this.liveMessage = this.matchingValues.length ? `${this.matchingValues.length} result${this.matchingValues.length > 1 ? "s" : ""} found` : this.noResultsMessage;
1038
- }, this.debounceDelay), this._handleResize = Z((e) => {
1039
- this._setResultsPosition(this.el.getBoundingClientRect());
1040
- }, this.debounceDelay), this._setResultsPosition = (e) => {
1041
- if (this.aware) {
1042
- let t = window.innerHeight / 2;
1043
- this.appearFrom === "top" && t > e.top && (this.resultsPosition = "bottom"), this.appearFrom === "bottom" && t < e.bottom && (this.resultsPosition = "top");
1044
- }
1045
- this.hostHeight = `${e.height}px`;
1046
- }, this.onBlur = (e) => {
1047
- this.forceResultsClosed = !1, e.target.closest(this._hostTag) !== this.el && (this.displayResults = !1);
1048
- }, this.close = () => {
1049
- var e;
1050
- (e = this.searchElement) === null || e === void 0 || e.setFocus(), this.displayResults = !1;
1051
- }, this.removeSelection = (e) => {
1052
- this.options = this.options.map((t) => (t[this.displayValue] === e[this.displayValue] && (t.selected = !e.selected), t), setTimeout(() => {
1053
- var t;
1054
- return (t = this.searchElement) === null || t === void 0 ? void 0 : t.setFocus();
1055
- }, 0));
1056
- }, this.setSelectedValue = (e, t) => {
1057
- var i;
1058
- const r = e.currentTarget;
1059
- this.type === "single" && (this.searchValue = t, this.unplug && (this.forceResultsClosed = !0), (i = this.searchElement) === null || i === void 0 || i.setFocus(), this.displayResults = !1), this.type === "multi" && (this.options = this.options.map((a) => (String(a[this.displayValue]) === t.replaceAll(" ", "") && (a.selected = !a.selected), a))), this.prismWatch.emit({
1060
- name: `${this.type}-value-selected`,
1061
- value: r.dataset.itemValue,
1062
- label: r.dataset.itemLabel
1063
- });
1064
- }, this._setFocus = () => {
1065
- this.resultsElement.querySelectorAll("[data-remove]")[0].firstChild.focus();
1066
- }, this.inputKeyListeners = (e) => {
1067
- switch (e.detail.key) {
1068
- case "ArrowUp":
1069
- e.preventDefault(), this.resultsElement && this.appearFrom === "top" && this.type === "single" && this._setFocus();
1070
- break;
1071
- case "ArrowDown":
1072
- e.preventDefault(), this.resultsElement && this.appearFrom === "bottom" && this.type === "single" && this._setFocus();
1073
- break;
1074
- case "Escape":
1075
- case "Enter":
1076
- this.displayResults = !1;
1077
- break;
1078
- }
1079
- }, this.resultsKeyListeners = (e) => {
1080
- var t, i, r;
1081
- let a = e.currentTarget, n = a == null ? void 0 : a.closest("ol").querySelectorAll("[data-remove]"), l = n[0], o = n[n.length - 1];
1082
- switch (e.key) {
1083
- case "ArrowDown":
1084
- e.preventDefault(), !((t = a.nextElementSibling) === null || t === void 0) && t.hasAttribute("data-remove") ? a.nextElementSibling.firstChild.focus() : l.firstChild.focus();
1085
- break;
1086
- case "ArrowUp":
1087
- e.preventDefault(), !((i = a.previousElementSibling) === null || i === void 0) && i.hasAttribute("data-remove") ? a.previousElementSibling.firstChild.focus() : o.lastChild.focus();
1088
- break;
1089
- case "Home":
1090
- l.firstChild.focus();
1091
- break;
1092
- case "End":
1093
- o.lastChild.focus();
1094
- break;
1095
- case "Escape":
1096
- this.displayResults = !1, (r = this.searchElement) === null || r === void 0 || r.setFocus();
1097
- break;
1098
- }
1099
- }, this._resultsMenuKeyListeners = (e) => {
1100
- let i = this.resultsElement.querySelectorAll("[data-remove]")[0];
1101
- switch (e.key) {
1102
- case "ArrowDown":
1103
- i.firstChild.focus();
1104
- }
1105
- }, this.clearAll = () => {
1106
- var e;
1107
- this.liveMessage = "all suggestions and the search value have been removed", this.searchValue = "", this.displayResults = !1, this.options = this.options.map((t) => (t.isFixed || (t.selected = !1), t)), (e = this.searchElement) === null || e === void 0 || e.setFocus();
1108
- }, this._clearSearch = () => {
1109
- var e;
1110
- this.searchValue = "", this.displayResults = !1, (e = this.searchElement) === null || e === void 0 || e.setFocus();
1111
- }, this.toggleSelect = (e) => {
1112
- var t;
1113
- (t = this.resultsElement) === null || t === void 0 || t.querySelectorAll("li").forEach((i) => {
1114
- let r = i.querySelector("button");
1115
- switch (e) {
1116
- case "select":
1117
- r.ariaChecked === "false" && r.click();
1118
- break;
1119
- case "remove":
1120
- r.ariaChecked === "true" && r.click();
1121
- break;
1122
- }
1123
- });
1124
- }, this.saveItem = (e) => {
1125
- let t = this.customOptionElement;
1126
- if (t.value === "") {
1127
- t.invalid = !0, t.invalidMessage = "Please enter a custom item";
1128
- return;
1129
- }
1130
- t.value && (this.customItem = t.value, this.close());
1131
- }, this.prismId = `prism-typeahead-${this.uid}`, this.label = void 0, this.hideLabel = !1, this.hideInvalid = !1, this.disabled = !1, this.pattern = void 0, this.required = !1, this.invalid = !1, this.invalidMessage = "This field is required", this.placeholder = "Type to see results...", this.start = 3, this.options = [], this.fuseOptions = {}, this.search = "include", this.delimiter = ",", this.type = "multi", this.name = void 0, this.noResultsMessage = "Sorry, we didn't find results. Would you like to try a new search?", this.hideNoresultsmessage = void 0, this.addOption = !1, this.addOptionPlaceholder = "Add a custom item", this.addOptionLabel = "Add a custom item", this.value = "", this.appearFrom = "bottom", this.aware = !1, this.variant = "contained", this.loading = !1, this.loadingMessage = "Loading...", this.keys = ["label", "value", "children.label", "children.value"], this.displayValue = "value", this.displayLabel = "label", this.ignoreLocation = !1, this.displayIcon = !0, this.iconName = "search", this.iconStyle = "fill", this.highlight = !1, this.hint = void 0, this.ignoredCharacters = void 0, this.unplug = !1, this.extendedSearch = "and", this.validation = "native", this.resultsTitle = "Search Suggestions", this.hideResultsTitle = !0, this.tone = void 0, this.size = void 0, this.searchValue = "", this.matchingValues = [], this.matchingValuesEnabledOnly = [], this.displayResults = !1, this.hiddenValue = void 0, this.liveMessage = void 0, this.customItem = void 0, this.resultsPosition = "bottom", this.hostHeight = "83", this.selectedOptions = [], this.forceResultsClosed = void 0;
1132
- }
1133
- /** Async Method to close results window */
1134
- async closeResults() {
1135
- this.close();
1136
- }
1137
- loadingHandler(s) {
1138
- s && (this.liveMessage = this.loadingMessage);
1139
- }
1140
- // Listen for Input Value Change
1141
- getValue(s) {
1142
- s.detail.target.id === this.textInput && s.detail.name === "input-change" && (s.detail.value.length < this.start && (this.liveMessage = ""), this.searchValue = s.detail.value, this.prismChange.emit({
1143
- name: "prism-typeahead",
1144
- target: this.el,
1145
- value: this.searchValue,
1146
- origin: s.detail
1147
- }), this.displayResults = s.detail.value.length >= this.start, this.displayResults && this.announce());
1148
- }
1149
- _inputFocus(s) {
1150
- this.start === 0 && document.activeElement.tagName === "INPUT" && this.forceResultsClosed === !1 && (this.displayResults = !0);
1151
- }
1152
- // Watch for changes to the form value
1153
- emitHiddenValue(s, e) {
1154
- s !== e && this.prismWatch.emit({
1155
- name: "multi-results-updated",
1156
- value: this.hiddenValue
1157
- });
1158
- }
1159
- // Watching Value Changes
1160
- updateSearchValue(s, e) {
1161
- this.searchValue = s;
1162
- }
1163
- // Watch for changes to the internal state `searchValue` and `options`
1164
- filterResults(s, e, t) {
1165
- var i, r;
1166
- let a = { findAllMatches: !0, includeMatches: !0, includeScore: !0, shouldSort: !0, useExtendedSearch: !0, fieldNormWeight: 1 }, n = { minMatchCharLength: this.start, ignoreLocation: this.ignoreLocation, keys: typeof this.keys == "string" ? [this.keys] : this.keys };
1167
- const l = Object.assign(Object.assign(Object.assign({}, a), this.fuseOptions), n), o = new R(this.options, l);
1168
- let c = this.searchValue.trim(), u = "";
1169
- switch (this.search) {
1170
- case "start":
1171
- u = "^";
1172
- break;
1173
- case "exact":
1174
- u = "=";
1175
- break;
1176
- case "include":
1177
- u = "'";
1178
- break;
1179
- default:
1180
- u = "";
1181
- break;
1182
- }
1183
- const m = (p) => {
1184
- const g = (y, v, A) => {
1185
- const b = v.split(".");
1186
- let E;
1187
- for (E = 0; E < b.length - 1; E++)
1188
- y = y[b[E]];
1189
- y[b[E]] = A;
1190
- };
1191
- return p.filter(({ matches: y }) => y && y.length).map(({ item: y, matches: v }) => {
1192
- const A = Object.assign({}, y);
1193
- return v.forEach((b) => {
1194
- g(A, b.key, this.generateHighlightedText(b.value, b.indices));
1195
- }), { highlight: A, item: y };
1196
- });
1197
- };
1198
- this.ignoredCharacters && (c = be(c, this.ignoredCharacters));
1199
- const f = o.search(`${u}"${this.extendedSearch === "and" ? c : c.replaceAll(" ", "|")}"`);
1200
- this.unplug ? (this.matchingValues = [], this.matchingValuesEnabledOnly = [], this.options.map((p) => {
1201
- this.matchingValues.push({ item: Object.assign({}, p) });
1202
- })) : this.matchingValues = this.highlight ? m(f) : f, this.matchingValuesEnabledOnly = this.matchingValues.filter((p) => {
1203
- var g;
1204
- return p.item && ((g = p == null ? void 0 : p.item) === null || g === void 0 ? void 0 : g.isFixed) !== !0;
1205
- }), ((i = this.options) === null || i === void 0 ? void 0 : i.filter((p) => p.value === s).length) === 0 && t === "customItem" && s !== e && o.add({ value: s, label: s, selected: !0 }), this.type === "multi" && (this.selectedOptions = (r = this.options) === null || r === void 0 ? void 0 : r.filter((p) => p.selected === !0), this.hiddenValue = this.selectedOptions.map((p) => p.value).join(this.delimiter)), this.prismWatch.emit({
1206
- name: `${this.type}-value-updated`,
1207
- value: this.searchValue
1208
- });
1209
- }
1210
- connectedCallback() {
1211
- document.addEventListener("mousedown", this.onBlur), document.addEventListener("keyup", this.onBlur), this.appearFrom ? this.resultsPosition = this.appearFrom : window.addEventListener("resize", this._handleResize), this.searchValue = this.value, ve("prism-typeahead");
1212
- }
1213
- disconnectedCallback() {
1214
- document.removeEventListener("mousedown", this.onBlur), document.removeEventListener("keyup", this.onBlur), window.removeEventListener("resize", this._handleResize);
1215
- }
1216
- componentWillLoad() {
1217
- var s;
1218
- this.type === "multi" && (this.selectedOptions = (s = this.options) === null || s === void 0 ? void 0 : s.filter((e) => e.selected === !0));
1219
- }
1220
- componentDidLoad() {
1221
- this._hostDimensions = this.el.getBoundingClientRect(), this.unplug && this.filterResults(this.options, [], "options");
1222
- }
1223
- componentWillRender() {
1224
- const s = this.el.querySelectorAll("ul.selections");
1225
- this.type === "multi" && s.length > 0 && s[0].addEventListener("focusin", () => {
1226
- this.displayResults = !1;
1227
- }), this._hostDimensions && this._setResultsPosition(this._hostDimensions), this.loadingHandler(this.loading);
1228
- }
1229
- // Buttons when in type multi to select all, remove all, and close the panel
1230
- /** @internal */
1231
- multiControls(s) {
1232
- s.detail.id === "select-button" && (this.toggleSelect("select"), this.liveMessage = `${this.matchingValues.length} results selected`), s.detail.id === "deselect-button" && (this.toggleSelect("remove"), this.liveMessage = `${this.matchingValues.length} results removed`), s.detail.id === "close-results" && (this.forceResultsClosed = !0, this.close());
1233
- }
1234
- render() {
1235
- var s;
1236
- return h(fe, { key: "476bb4110561f2fb0f51dcac3946f99170eeeec3", id: this.prismId }, h("div", { key: "f37e58f1512a528557db475e50872a13576b80e6", class: "announcement", "aria-live": "polite", "aria-atomic": "true" }, this.liveMessage), h("prism-input-text", { key: "f910718f40c4c8909e92c52f9a62f4d7784ba338", hint: this.hint, variant: this.variant, "prism-id": this.textInput, controls: this.resultsListId, expanded: this.displayResults.toString(), complete: this.type === "single" ? "list" : void 0, autocomplete: "off", disabled: this.disabled, required: this.required, pattern: this.pattern, invalid: this.invalid, validation: this.validation, invalidMessage: this.invalidMessage, hideInvalid: this.hideInvalid, setRole: this.type === "single" ? "combobox" : void 0, placeholder: this.placeholder, hideLabel: this.hideLabel, label: this.label, onPrismKeydown: (e) => this.inputKeyListeners(e), onPrismFocus: (e) => this._inputFocus(e), ref: (e) => this.searchElement = e, name: this.type === "single" ? this.name : "prism-typeahead-search", value: this.searchValue, class: { "input-host": !0, [`typeahead-as-${this.variant}`]: this.variant !== void 0, [`typeahead-size-${this.size}`]: this.size !== void 0 }, size: this.size, tone: this.tone }, h("span", { key: "ef474f305aec14d27a7e1c4acea4f77453473496", slot: "icon-trailing" }, !this.disabled && h("prism-button", { key: "b5c8f73470a27331ba0a7b98b50ddc86ee99aa68", display: "ghost-icon", size: ["xxs", "xs"].includes(this.size) ? "xxs" : "sm", class: { clear: !0, show: this.selectedOptions.length > 0 || this.searchValue !== "" }, label: "clear all values", onPrismClick: () => this._clearSearch(), slot: "icon-trailing" }, h("prism-icon", { key: "62d2005a4a328e2682b9a95c270a3b4658b08a64", name: "close", role: "presentation", size: ["xxs", "xs"].includes(this.size) ? "xxs" : "xs" })), h("slot", { key: "0f98ac14503ce8303bacdd390a1e6d7c4f7a28f4", name: "asset-trailing" })), h("span", { key: "d75f6442aaedc3c6f7a5ed2221bcbf9993dc005c", slot: "icon-leading" }, this.displayIcon && h("prism-icon", { key: "1b5a4d77a20b8db0ae3f7b1d25efec779b40a849", size: ["xxs"].includes(this.size) ? "xs" : "sm", name: this.iconName, display: this.iconStyle, role: "presentation" }))), h("div", { key: "5eafa826e45cd0fce4c4a3c8638d3e5f2aba0134", style: { "--internal-bottom": this.hostHeight }, class: { "results-container": !0 }, ref: (e) => this.resultsContainerElement = e }, h("div", { key: "6dfa06a3ae67c4c1b874401b2ee50a30949f09aa", class: {
1237
- results: !0,
1238
- open: this.displayResults || this.loading,
1239
- [this.resultsPosition]: !0,
1240
- zero: this.matchingValues.length === 0 && !this.addOption && this.hideNoresultsmessage
1241
- } }, this.loading && h("section", { key: "3fc61a75ff28fbe8d8d5e94fab9ed67f49a95d58", class: { loading: !0 } }, h("prism-loading", { key: "9252ec4cd95651674d7e784dc3b87d6051472a59", as: "spinner", container: "inline" }), this.loadingMessage), this.type === "multi" && this.matchingValues.length > 0 && h("section", { key: "4e3955e545b2b25ce1ced592156d908d8b6477a2", class: "results-header", onKeyDown: (e) => this._resultsMenuKeyListeners(e) }, h("div", { key: "0dfd66e814dceeceff6bf853e4bd3e750d64ccbe", class: "multi-controls" }, h("prism-button", { key: "6fa9c72b7bc1eea1c6b60b13491d3055f33e3707", "prism-id": "select-button", name: "toggle-button", size: "xs", display: "ghost", onPrismClick: (e) => this.multiControls(e) }, "Select All", h("prism-icon", { key: "8c22154b4817c1c36f702ba9c3b185c5bc306b0e", class: "mc-icon", size: "xs", role: "presentation", display: "fill", slot: "icon", name: "multi_select" })), h("prism-button", { key: "f9eac69d6bbb25c3b4b3d129ce2b5890ca4bcf17", "prism-id": "deselect-button", name: "toggle-button", size: "xs", display: "ghost", onPrismClick: (e) => this.multiControls(e) }, "Select None", h("prism-icon", { key: "cbae4fb1d38096c5288cfcd770d26f5d8fa59bff", class: "mc-icon", size: "xs", role: "presentation", slot: "icon", display: "outline", name: "multi_select" }))), h("prism-button", { key: "c061b6c265cccdebf81cf3b7c8a381ab34fd90a6", label: "close results", "prism-id": "close-results", name: "close-results", display: "ghost-icon", size: "xs", onPrismClick: (e) => this.multiControls(e) }, h("prism-icon", { key: "c6ca1c9a421d2c1dffc384eba529728a2822bcc4", name: this.appearFrom === "bottom" ? "caret_up_button" : "caret_down_button" }))), this.matchingValues.length ? h(O, null, !this.hideResultsTitle && h("prism-text", { "data-testid": this.resultsHeadlineId, id: this.resultsHeadlineId, "aria-hidden": "true", class: "group-header", as: "callout-sm", priority: "secondary" }, this.resultsTitle), h("ol", { class: "result-list", "aria-label": this.resultsTitle, id: this.resultsListId, role: this.type === "single" ? "listbox" : void 0, ref: (e) => this.resultsElement = e }, (s = this.matchingValues) === null || s === void 0 ? void 0 : s.map(({ highlight: e, item: t }, i) => {
1242
- var r;
1243
- let a = (t == null ? void 0 : t.selected) || (this.searchValue === (t == null ? void 0 : t.value) || this.searchValue === (t == null ? void 0 : t.label)) && this.type === "single", n = this.type === "multi" && a ? "true" : this.type !== "multi" ? !1 : "false", l = (r = this.matchingValuesEnabledOnly[0]) === null || r === void 0 ? void 0 : r.item;
1244
- return h(O, null, h("li", { "data-remove": !(t != null && t.isFixed), id: `${this.singleResultId}-result-${i}`, onKeyDown: (o) => this.resultsKeyListeners(o), class: { selected: a }, role: this.type === "single" ? "presentation" : void 0 }, h("button", { onClick: (o) => this.setSelectedValue(o, t[this.displayValue] || t[this.displayLabel]), key: t == null ? void 0 : t.value, type: "button", "data-item-label": t == null ? void 0 : t.label, "data-item-value": t == null ? void 0 : t.value, class: { result: !0 }, role: this.type === "multi" ? "checkbox" : "option", "aria-checked": n, "aria-selected": this.type === "single" ? a.toString() : void 0, tabindex: t === l ? void 0 : "-1", disabled: t == null ? void 0 : t.isFixed }, (t == null ? void 0 : t.icon) && h("prism-icon", { priority: t != null && t.isFixed ? "inactive" : "primary", "aria-hidden": "true", role: "presentation", label: t == null ? void 0 : t.iconLabel, display: (t == null ? void 0 : t.iconTheme) || "fill", name: t == null ? void 0 : t.icon }), h("section", { class: "selection-content" }, h("prism-text", { priority: t != null && t.isFixed ? "inactive" : "primary", family: "body", size: "400" }, this.highlight ? h("span", { innerHTML: Ae.sanitize(e[this.displayLabel] || e[this.displayValue], { USE_PROFILES: { html: !0 } }) }) : t[this.displayLabel] || t[this.displayValue]), (t == null ? void 0 : t.description) && h("prism-text", { family: "body", size: "300", priority: t != null && t.isFixed ? "inactive" : "secondary", class: "selection-description" }, t == null ? void 0 : t.description)), h("prism-icon", { class: { "checked-icon": !0, "selected-icon": a, hide: !a }, name: "check", role: "presentation", "aria-hidden": "true" }))));
1245
- }))) : h(O, null, !this.hideNoresultsmessage && !this.loading && h("strong", { class: "no-results" }, h("slot", { name: "no-results-asset" }), " ", this.noResultsMessage, " "), this.addOption && h("section", { class: "add-item" }, h("prism-input-text", { prismId: this.customOptionId, value: this.searchValue, ref: (e) => this.customOptionElement = e, label: this.addOptionLabel, placeholder: this.addOptionPlaceholder, variant: "minimal", hideLabel: !0, tone: this.tone }), h("prism-button", { "aria-describedby": this.customOptionId, prismId: `${this.customOptionId}-add-custom-item-`, onPrismClick: (e) => this.saveItem(e), display: "ghost-icon" }, h("prism-icon", { name: "add" }), "Add"))))), this.type === "multi" && h("div", { key: "91039f4497b3fb9ac9ec923b7a14b957d6ee1c41", class: "selections-container", ref: (e) => this.selectionsElement = e }, this.selectedOptions.length > 0 && h(O, { key: "8861b1472134f249fddc0f852dc9b744aeec4a3e" }, h("div", { key: "27d700cde7093ccbd995f7c8d85a0f5d3d5b8953", class: "selection-controls", "aria-labelledby": `${this.prismId}-selection-section-header` }, h("prism-text", { key: "06bfcb585ee1ad96ecfa9ae36f1e95c92f615031", id: `${this.prismId}-selection-section-header`, as: "callout-sm" }, "Selections:"), h("prism-button", { key: "f5c54b276e97eaa9c4a11ef91d28211a1848f176", display: "ghost", size: "xs", onPrismClick: () => this.clearAll(), class: { clear: !0, show: this.selectedOptions.length > 0 } }, "Remove All")), h("div", { key: "f9938cfa3e34a626a0bda1b6a64189dcead2de24", "aria-live": "polite", role: "alert", id: `${this.prismId}-selection-status` }, h("ul", { key: "a6022dc6d7f1683df4b8f741b0a8b3dfbbf309a6", class: "selections", "aria-label": "selected" }, this.selectedOptions.map((e, t) => h("li", null, h("prism-badge", { interactive: e.isFixed ? null : "trailing", size: "lg", "data-remove": !e.isFixed, key: t, class: "selection", tone: "primary-brand", label: `Remove ${e[this.displayLabel]}`, onPrismClick: () => this.removeSelection(e) }, e[this.displayLabel], !e.isFixed && h("prism-icon", { slot: "asset-trailing", size: "xs", name: "close" })))))))), this.type === "multi" && h("input", { key: "db3916bff259c3b59bf75286fda1dd15e0952f15", type: "hidden", name: this.name, value: this.hiddenValue }));
1246
- }
1247
- get el() {
1248
- return ge(this);
1249
- }
1250
- static get watchers() {
1251
- return {
1252
- loading: ["loadingHandler"],
1253
- hiddenValue: ["emitHiddenValue"],
1254
- value: ["updateSearchValue"],
1255
- options: ["filterResults"],
1256
- searchValue: ["filterResults"],
1257
- customItem: ["filterResults"]
1258
- };
1259
- }
1260
- };
1261
- ct.style = ot;
1262
- export {
1263
- ct as prism_typeahead
1264
- };