@verbb/formie-browser 1.0.3 → 1.0.5

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 (206) hide show
  1. package/CHANGELOG.md +65 -17
  2. package/dist/chunks/address-country-Rx6GQTND.js +68 -0
  3. package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
  4. package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
  5. package/dist/chunks/api-CmwLRq_n.js +780 -0
  6. package/dist/chunks/api-DMK8NSUI.js +407 -0
  7. package/dist/chunks/api-sPqGbOww.js +125 -0
  8. package/dist/chunks/async-nPFRNQ06.js +25 -0
  9. package/dist/chunks/bpoint-DSjqRv63.js +24 -0
  10. package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
  11. package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
  12. package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
  13. package/dist/chunks/chunk-3b4jIN3o.js +13 -0
  14. package/dist/chunks/combobox-D-2b42wn.js +1954 -0
  15. package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
  16. package/dist/chunks/constants-DVcJAvc5.js +38 -0
  17. package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
  18. package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
  19. package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
  20. package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
  21. package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
  22. package/dist/chunks/debug-BV0DvdHx.js +41 -0
  23. package/dist/chunks/dist-BF5GU3_9.js +2674 -0
  24. package/dist/chunks/event-names-BCI2FLD8.js +51 -0
  25. package/dist/chunks/eway-D3ctTbEk.js +70 -0
  26. package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
  27. package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
  28. package/dist/chunks/file-upload-D49m8-DR.js +287 -0
  29. package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
  30. package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
  31. package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
  32. package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
  33. package/dist/chunks/google-address-OhKilPWE.js +161 -0
  34. package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
  35. package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
  36. package/dist/chunks/http-D-JExro7.js +27 -0
  37. package/dist/chunks/i18n-BY1ds1BL.js +121 -0
  38. package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
  39. package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
  40. package/dist/chunks/mollie-COG-ko2D.js +23 -0
  41. package/dist/chunks/moneris-CMH8PlRc.js +117 -0
  42. package/dist/chunks/opayo-D2jsR5vh.js +113 -0
  43. package/dist/chunks/paddle-DxF88RfC.js +55 -0
  44. package/dist/chunks/paypal-b5pnwrA2.js +95 -0
  45. package/dist/chunks/payway-BJYu9DIR.js +55 -0
  46. package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
  47. package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
  48. package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
  49. package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
  50. package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
  51. package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
  52. package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
  53. package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
  54. package/dist/chunks/repeater-B5leVxZU.js +102 -0
  55. package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
  56. package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
  57. package/dist/chunks/sdk-BhHAYgga.js +1397 -0
  58. package/dist/chunks/shared-Bx9s0i0P.js +100 -0
  59. package/dist/chunks/signature-CpgqHCEx.js +463 -0
  60. package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
  61. package/dist/chunks/square-BP8RWAKB.js +40 -0
  62. package/dist/chunks/stripe-MihN63uC.js +184 -0
  63. package/dist/chunks/styles-BfoIZwJp.js +19 -0
  64. package/dist/chunks/summary-D3AjxpYN.js +114 -0
  65. package/dist/chunks/table-C-lkQN6I.js +78 -0
  66. package/dist/chunks/text-limit-B09elPDB.js +125 -0
  67. package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
  68. package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
  69. package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
  70. package/dist/css/formie-theme.css +2 -0
  71. package/dist/css/theme/fields/_address-state.css +94 -0
  72. package/dist/css/theme/fields/_combobox.css +246 -0
  73. package/dist/css/theme/fields/_select.css +13 -0
  74. package/dist/index.js +2447 -39
  75. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  76. package/dist/js/core/field-error-container.d.ts +4 -0
  77. package/dist/js/core/field-error-container.d.ts.map +1 -0
  78. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  79. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  80. package/dist/js/core/validation-focus.d.ts +4 -0
  81. package/dist/js/core/validation-focus.d.ts.map +1 -0
  82. package/dist/js/modules/address/api.d.ts +1 -0
  83. package/dist/js/modules/address/api.d.ts.map +1 -1
  84. package/dist/js/modules/address/constants.d.ts +22 -1
  85. package/dist/js/modules/address/constants.d.ts.map +1 -1
  86. package/dist/js/modules/address/host.d.ts +2 -2
  87. package/dist/js/modules/address/host.d.ts.map +1 -1
  88. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  89. package/dist/js/modules/fields/address-country.d.ts +3 -0
  90. package/dist/js/modules/fields/address-country.d.ts.map +1 -0
  91. package/dist/js/modules/fields/address-state.d.ts +3 -0
  92. package/dist/js/modules/fields/address-state.d.ts.map +1 -0
  93. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  94. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
  95. package/dist/js/modules/fields/combobox.d.ts +17 -0
  96. package/dist/js/modules/fields/combobox.d.ts.map +1 -0
  97. package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
  98. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
  99. package/dist/js/modules/fields/custom-link.d.ts +3 -0
  100. package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
  101. package/dist/js/modules/fields/custom-maps.d.ts +3 -0
  102. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
  103. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  104. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  105. package/dist/js/modules/fields/index.d.ts.map +1 -1
  106. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  107. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  108. package/dist/js/submit/pipeline.d.ts.map +1 -1
  109. package/dist/js/utils/country-from-ip.d.ts +7 -0
  110. package/dist/js/utils/country-from-ip.d.ts.map +1 -0
  111. package/dist/js/utils/field-references.d.ts +1 -0
  112. package/dist/js/utils/field-references.d.ts.map +1 -1
  113. package/dist/js/utils/field-references.row-scope.d.ts +11 -0
  114. package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
  115. package/dist/js/utils/i18n.d.ts.map +1 -1
  116. package/dist/js/validation/rules/email.d.ts.map +1 -1
  117. package/dist/js/validation/rules/number.d.ts.map +1 -1
  118. package/dist/js/validation/validator.d.ts.map +1 -1
  119. package/package.json +6 -3
  120. package/src/css/formie-theme.css +2 -0
  121. package/src/css/theme/fields/_address-state.css +94 -0
  122. package/src/css/theme/fields/_combobox.css +246 -0
  123. package/src/css/theme/fields/_select.css +13 -0
  124. package/src/js/core/create-formie-client.ts +27 -0
  125. package/src/js/core/field-error-container.ts +39 -0
  126. package/src/js/core/submit-result-state.ts +12 -2
  127. package/src/js/core/submit-result-ui.ts +7 -13
  128. package/src/js/core/validation-focus.ts +117 -0
  129. package/src/js/modules/address/api.ts +7 -0
  130. package/src/js/modules/address/constants.ts +82 -2
  131. package/src/js/modules/address/host.ts +16 -6
  132. package/src/js/modules/address/loqate.ts +3 -17
  133. package/src/js/modules/fields/address-country.ts +156 -0
  134. package/src/js/modules/fields/address-state.ts +946 -0
  135. package/src/js/modules/fields/calculations.ts +32 -0
  136. package/src/js/modules/fields/checkbox-radio.ts +21 -15
  137. package/src/js/modules/fields/combobox.ts +188 -0
  138. package/src/js/modules/fields/custom-google-maps.ts +416 -0
  139. package/src/js/modules/fields/custom-link.ts +95 -0
  140. package/src/js/modules/fields/custom-maps.ts +339 -0
  141. package/src/js/modules/fields/date-picker.ts +96 -3
  142. package/src/js/modules/fields/file-upload.ts +12 -9
  143. package/src/js/modules/fields/index.ts +6 -0
  144. package/src/js/modules/fields/phone-country.ts +6 -0
  145. package/src/js/modules/fields/text-limit.ts +87 -22
  146. package/src/js/submit/pipeline.ts +11 -1
  147. package/src/js/utils/country-from-ip.ts +54 -0
  148. package/src/js/utils/field-references.row-scope.ts +303 -0
  149. package/src/js/utils/field-references.ts +1 -0
  150. package/src/js/utils/i18n.ts +184 -5
  151. package/src/js/validation/rules/email.ts +3 -2
  152. package/src/js/validation/rules/match.ts +2 -2
  153. package/src/js/validation/rules/minmax.ts +4 -4
  154. package/src/js/validation/rules/number.ts +9 -5
  155. package/src/js/validation/rules/pattern.ts +4 -4
  156. package/src/js/validation/rules/required.ts +1 -1
  157. package/src/js/validation/rules/url.ts +1 -1
  158. package/src/js/validation/validator.ts +7 -7
  159. package/dist/chunks/address-finder-BjMuEiwF.js +0 -37
  160. package/dist/chunks/bpoint-KudsBCo2.js +0 -26
  161. package/dist/chunks/calculations-DlGSkQ3W.js +0 -147
  162. package/dist/chunks/captcha-eu-CterYFok.js +0 -34
  163. package/dist/chunks/checkbox-radio-CBvgk3hR.js +0 -136
  164. package/dist/chunks/conditions-DYy1-Hwt.js +0 -459
  165. package/dist/chunks/date-picker-BlD--zfe.js +0 -4994
  166. package/dist/chunks/eway-qwc-B5Us.js +0 -74
  167. package/dist/chunks/file-upload-CIgHrXfp.js +0 -316
  168. package/dist/chunks/friendly-captcha-v1-EDFac33c.js +0 -33
  169. package/dist/chunks/friendly-captcha-v2-BDpSvFGR.js +0 -38
  170. package/dist/chunks/go-cardless-DuDMVsnz.js +0 -24
  171. package/dist/chunks/google-address-Bmjp01pH.js +0 -181
  172. package/dist/chunks/hcaptcha-BTQ6An6g.js +0 -56
  173. package/dist/chunks/hidden-DbPdOxKb.js +0 -31
  174. package/dist/chunks/index-BEsfee-D.js +0 -1839
  175. package/dist/chunks/index-BP7Unm5Y.js +0 -863
  176. package/dist/chunks/index-BcqwpPNE.js +0 -4314
  177. package/dist/chunks/loqate-BdNGv93o.js +0 -55
  178. package/dist/chunks/mollie-DFOjTuGX.js +0 -24
  179. package/dist/chunks/moneris-BbFfl-EL.js +0 -101
  180. package/dist/chunks/opayo-CmgYa9ya.js +0 -122
  181. package/dist/chunks/paddle-BUi7w1_o.js +0 -60
  182. package/dist/chunks/paypal-A-ePfh6k.js +0 -100
  183. package/dist/chunks/payway-BqFCbhyo.js +0 -56
  184. package/dist/chunks/phone-country-DPMiqk4L.js +0 -3765
  185. package/dist/chunks/place-kit-CX7tamAg.js +0 -42
  186. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
  187. package/dist/chunks/recaptcha-enterprise-DxF6cW95.js +0 -71
  188. package/dist/chunks/recaptcha-shared-DhGcbiaq.js +0 -15
  189. package/dist/chunks/recaptcha-v2-checkbox-R9EfbZ4k.js +0 -41
  190. package/dist/chunks/recaptcha-v2-invisible-DV9hswAp.js +0 -59
  191. package/dist/chunks/recaptcha-v3-V0xc-Edh.js +0 -28
  192. package/dist/chunks/repeater-DKUT6TGI.js +0 -124
  193. package/dist/chunks/rich-text-SH7KiaKH.js +0 -304
  194. package/dist/chunks/scripts-D9N2d5rN.js +0 -36
  195. package/dist/chunks/sdk-3SicTWby.js +0 -1559
  196. package/dist/chunks/shared-BmntPmnW.js +0 -80
  197. package/dist/chunks/signature-BA3tQsGT.js +0 -550
  198. package/dist/chunks/snaptcha-DV7p6J9k.js +0 -8
  199. package/dist/chunks/square-Bs-ndqYK.js +0 -46
  200. package/dist/chunks/stripe-DkZAHxtn.js +0 -202
  201. package/dist/chunks/styles-C3aqgtek.js +0 -21
  202. package/dist/chunks/summary-Dq2i9TQk.js +0 -126
  203. package/dist/chunks/table-Cu4WfVcw.js +0 -95
  204. package/dist/chunks/text-limit-2ycmB-Ae.js +0 -135
  205. package/dist/chunks/turnstile-CId90tRr.js +0 -59
  206. package/dist/chunks/utils-BntI3W4S.js +0 -6149
@@ -0,0 +1,1954 @@
1
+ import { t as e } from "./debug-BV0DvdHx.js";
2
+ import { t } from "./styles-BfoIZwJp.js";
3
+ import { r as n, t as r } from "./shared-Bx9s0i0P.js";
4
+ //#region ../../node_modules/tom-select/dist/esm/contrib/microevent.js
5
+ function i(e, t) {
6
+ e.split(/\s+/).forEach((e) => {
7
+ t(e);
8
+ });
9
+ }
10
+ var a = class {
11
+ constructor() {
12
+ this._events = {};
13
+ }
14
+ on(e, t) {
15
+ i(e, (e) => {
16
+ let n = this._events[e] || [];
17
+ n.push(t), this._events[e] = n;
18
+ });
19
+ }
20
+ off(e, t) {
21
+ var n = arguments.length;
22
+ if (n === 0) {
23
+ this._events = {};
24
+ return;
25
+ }
26
+ i(e, (e) => {
27
+ if (n === 1) {
28
+ delete this._events[e];
29
+ return;
30
+ }
31
+ let r = this._events[e];
32
+ r !== void 0 && (r.splice(r.indexOf(t), 1), this._events[e] = r);
33
+ });
34
+ }
35
+ trigger(e, ...t) {
36
+ var n = this;
37
+ i(e, (e) => {
38
+ let r = n._events[e];
39
+ r !== void 0 && r.forEach((e) => {
40
+ e.apply(n, t);
41
+ });
42
+ });
43
+ }
44
+ };
45
+ //#endregion
46
+ //#region ../../node_modules/tom-select/dist/esm/contrib/microplugin.js
47
+ function o(e) {
48
+ return e.plugins = {}, class extends e {
49
+ constructor() {
50
+ super(...arguments), this.plugins = {
51
+ names: [],
52
+ settings: {},
53
+ requested: {},
54
+ loaded: {}
55
+ };
56
+ }
57
+ static define(t, n) {
58
+ e.plugins[t] = {
59
+ name: t,
60
+ fn: n
61
+ };
62
+ }
63
+ initializePlugins(e) {
64
+ var t, n;
65
+ let r = this, i = [];
66
+ if (Array.isArray(e)) e.forEach((e) => {
67
+ typeof e == "string" ? i.push(e) : (r.plugins.settings[e.name] = e.options, i.push(e.name));
68
+ });
69
+ else if (e) for (t in e) e.hasOwnProperty(t) && (r.plugins.settings[t] = e[t], i.push(t));
70
+ for (; n = i.shift();) r.require(n);
71
+ }
72
+ loadPlugin(t) {
73
+ var n = this, r = n.plugins, i = e.plugins[t];
74
+ if (!e.plugins.hasOwnProperty(t)) throw Error("Unable to find \"" + t + "\" plugin");
75
+ r.requested[t] = !0, r.loaded[t] = i.fn.apply(n, [n.plugins.settings[t] || {}]), r.names.push(t);
76
+ }
77
+ require(e) {
78
+ var t = this, n = t.plugins;
79
+ if (!t.plugins.loaded.hasOwnProperty(e)) {
80
+ if (n.requested[e]) throw Error("Plugin has circular dependency (\"" + e + "\")");
81
+ t.loadPlugin(e);
82
+ }
83
+ return n.loaded[e];
84
+ }
85
+ };
86
+ }
87
+ //#endregion
88
+ //#region ../../node_modules/@orchidjs/unicode-variants/dist/esm/regex.js
89
+ var s = (e) => (e = e.filter(Boolean), e.length < 2 ? e[0] || "" : f(e) == 1 ? "[" + e.join("") + "]" : "(?:" + e.join("|") + ")"), c = (e) => {
90
+ if (!u(e)) return e.join("");
91
+ let t = "", n = 0, r = () => {
92
+ n > 1 && (t += "{" + n + "}");
93
+ };
94
+ return e.forEach((i, a) => {
95
+ if (i === e[a - 1]) {
96
+ n++;
97
+ return;
98
+ }
99
+ r(), t += i, n = 1;
100
+ }), r(), t;
101
+ }, l = (e) => s(Array.from(e)), u = (e) => new Set(e).size !== e.length, d = (e) => (e + "").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu, "\\$1"), f = (e) => e.reduce((e, t) => Math.max(e, p(t)), 0), p = (e) => Array.from(e).length, m = (e) => {
102
+ if (e.length === 1) return [[e]];
103
+ let t = [];
104
+ return m(e.substring(1)).forEach(function(n) {
105
+ let r = n.slice(0);
106
+ r[0] = e.charAt(0) + r[0], t.push(r), r = n.slice(0), r.unshift(e.charAt(0)), t.push(r);
107
+ }), t;
108
+ }, h = [[0, 65535]], g, _, v = 3, y = {}, b = {
109
+ "/": "⁄∕",
110
+ 0: "߀",
111
+ a: "ⱥɐɑ",
112
+ aa: "ꜳ",
113
+ ae: "æǽǣ",
114
+ ao: "ꜵ",
115
+ au: "ꜷ",
116
+ av: "ꜹꜻ",
117
+ ay: "ꜽ",
118
+ b: "ƀɓƃ",
119
+ c: "ꜿƈȼↄ",
120
+ d: "đɗɖᴅƌꮷԁɦ",
121
+ e: "ɛǝᴇɇ",
122
+ f: "ꝼƒ",
123
+ g: "ǥɠꞡᵹꝿɢ",
124
+ h: "ħⱨⱶɥ",
125
+ i: "ɨı",
126
+ j: "ɉȷ",
127
+ k: "ƙⱪꝁꝃꝅꞣ",
128
+ l: "łƚɫⱡꝉꝇꞁɭ",
129
+ m: "ɱɯϻ",
130
+ n: "ꞥƞɲꞑᴎлԉ",
131
+ o: "øǿɔɵꝋꝍᴑ",
132
+ oe: "œ",
133
+ oi: "ƣ",
134
+ oo: "ꝏ",
135
+ ou: "ȣ",
136
+ p: "ƥᵽꝑꝓꝕρ",
137
+ q: "ꝗꝙɋ",
138
+ r: "ɍɽꝛꞧꞃ",
139
+ s: "ßȿꞩꞅʂ",
140
+ t: "ŧƭʈⱦꞇ",
141
+ th: "þ",
142
+ tz: "ꜩ",
143
+ u: "ʉ",
144
+ v: "ʋꝟʌ",
145
+ vy: "ꝡ",
146
+ w: "ⱳ",
147
+ y: "ƴɏỿ",
148
+ z: "ƶȥɀⱬꝣ",
149
+ hv: "ƕ"
150
+ };
151
+ for (let e in b) {
152
+ let t = b[e] || "";
153
+ for (let n = 0; n < t.length; n++) {
154
+ let r = t.substring(n, n + 1);
155
+ y[r] = e;
156
+ }
157
+ }
158
+ var x = RegExp(Object.keys(y).join("|") + "|[̀-ͯ·ʾʼ]", "gu"), S = (e) => {
159
+ g === void 0 && (g = ie(e || h));
160
+ }, ee = (e, t = "NFKD") => e.normalize(t), C = (e) => Array.from(e).reduce((e, t) => e + te(t), ""), te = (e) => (e = ee(e).toLowerCase().replace(x, (e) => y[e] || ""), ee(e, "NFC"));
161
+ function* ne(e) {
162
+ for (let [t, n] of e) for (let e = t; e <= n; e++) {
163
+ let t = String.fromCharCode(e), n = C(t);
164
+ n != t.toLowerCase() && (n.length > v || n.length != 0 && (yield {
165
+ folded: n,
166
+ composed: t,
167
+ code_point: e
168
+ }));
169
+ }
170
+ }
171
+ var re = (e) => {
172
+ let t = {}, n = (e, n) => {
173
+ let r = t[e] || /* @__PURE__ */ new Set(), i = RegExp("^" + l(r) + "$", "iu");
174
+ n.match(i) || (r.add(d(n)), t[e] = r);
175
+ };
176
+ for (let t of ne(e)) n(t.folded, t.folded), n(t.folded, t.composed);
177
+ return t;
178
+ }, ie = (e) => {
179
+ let t = re(e), n = {}, r = [];
180
+ for (let e in t) {
181
+ let i = t[e];
182
+ i && (n[e] = l(i)), e.length > 1 && r.push(d(e));
183
+ }
184
+ r.sort((e, t) => t.length - e.length);
185
+ let i = s(r);
186
+ return _ = RegExp("^" + i, "u"), n;
187
+ }, ae = (e, t = 1) => {
188
+ let n = 0;
189
+ return e = e.map((e) => (g[e] && (n += e.length), g[e] || e)), n >= t ? c(e) : "";
190
+ }, oe = (e, t = 1) => (t = Math.max(t, e.length - 1), s(m(e).map((e) => ae(e, t)))), se = (e, t = !0) => {
191
+ let n = +(e.length > 1);
192
+ return s(e.map((e) => {
193
+ let r = [], i = t ? e.length() : e.length() - 1;
194
+ for (let t = 0; t < i; t++) r.push(oe(e.substrs[t] || "", n));
195
+ return c(r);
196
+ }));
197
+ }, ce = (e, t) => {
198
+ for (let n of t) {
199
+ if (n.start != e.start || n.end != e.end || n.substrs.join("") !== e.substrs.join("")) continue;
200
+ let t = e.parts;
201
+ if (!(n.parts.filter((e) => {
202
+ for (let n of t) {
203
+ if (n.start === e.start && n.substr === e.substr) return !1;
204
+ if (!(e.length == 1 || n.length == 1) && (e.start < n.start && e.end > n.start || n.start < e.start && n.end > e.start)) return !0;
205
+ }
206
+ return !1;
207
+ }).length > 0)) return !0;
208
+ }
209
+ return !1;
210
+ }, w = class e {
211
+ parts;
212
+ substrs;
213
+ start;
214
+ end;
215
+ constructor() {
216
+ this.parts = [], this.substrs = [], this.start = 0, this.end = 0;
217
+ }
218
+ add(e) {
219
+ e && (this.parts.push(e), this.substrs.push(e.substr), this.start = Math.min(e.start, this.start), this.end = Math.max(e.end, this.end));
220
+ }
221
+ last() {
222
+ return this.parts[this.parts.length - 1];
223
+ }
224
+ length() {
225
+ return this.parts.length;
226
+ }
227
+ clone(t, n) {
228
+ let r = new e(), i = JSON.parse(JSON.stringify(this.parts)), a = i.pop();
229
+ for (let e of i) r.add(e);
230
+ let o = n.substr.substring(0, t - a.start), s = o.length;
231
+ return r.add({
232
+ start: a.start,
233
+ end: a.start + s,
234
+ length: s,
235
+ substr: o
236
+ }), r;
237
+ }
238
+ }, le = (e) => {
239
+ S(), e = C(e);
240
+ let t = "", n = [new w()];
241
+ for (let r = 0; r < e.length; r++) {
242
+ let i = e.substring(r).match(_), a = e.substring(r, r + 1), o = i ? i[0] : null, s = [], c = /* @__PURE__ */ new Set();
243
+ for (let e of n) {
244
+ let t = e.last();
245
+ if (!t || t.length == 1 || t.end <= r) if (o) {
246
+ let t = o.length;
247
+ e.add({
248
+ start: r,
249
+ end: r + t,
250
+ length: t,
251
+ substr: o
252
+ }), c.add("1");
253
+ } else e.add({
254
+ start: r,
255
+ end: r + 1,
256
+ length: 1,
257
+ substr: a
258
+ }), c.add("2");
259
+ else if (o) {
260
+ let n = e.clone(r, t), i = o.length;
261
+ n.add({
262
+ start: r,
263
+ end: r + i,
264
+ length: i,
265
+ substr: o
266
+ }), s.push(n);
267
+ } else c.add("3");
268
+ }
269
+ if (s.length > 0) {
270
+ s = s.sort((e, t) => e.length() - t.length());
271
+ for (let e of s) ce(e, n) || n.push(e);
272
+ continue;
273
+ }
274
+ if (r > 0 && c.size == 1 && !c.has("3")) {
275
+ t += se(n, !1);
276
+ let e = new w(), r = n[0];
277
+ r && e.add(r.last()), n = [e];
278
+ }
279
+ }
280
+ return t += se(n, !0), t;
281
+ }, ue = (e, t) => {
282
+ if (e) return e[t];
283
+ }, de = (e, t) => {
284
+ if (e) {
285
+ for (var n, r = t.split("."); (n = r.shift()) && (e = e[n]););
286
+ return e;
287
+ }
288
+ }, T = (e, t, n) => {
289
+ var r, i;
290
+ return !e || (e += "", t.regex == null) || (i = e.search(t.regex), i === -1) ? 0 : (r = t.string.length / e.length, i === 0 && (r += .5), r * n);
291
+ }, E = (e, t) => {
292
+ var n = e[t];
293
+ if (typeof n == "function") return n;
294
+ n && !Array.isArray(n) && (e[t] = [n]);
295
+ }, D = (e, t) => {
296
+ if (Array.isArray(e)) e.forEach(t);
297
+ else for (var n in e) e.hasOwnProperty(n) && t(e[n], n);
298
+ }, fe = (e, t) => typeof e == "number" && typeof t == "number" ? e > t ? 1 : e < t ? -1 : 0 : (e = C(e + "").toLowerCase(), t = C(t + "").toLowerCase(), e > t ? 1 : t > e ? -1 : 0), pe = class {
299
+ items;
300
+ settings;
301
+ constructor(e, t) {
302
+ this.items = e, this.settings = t || { diacritics: !0 };
303
+ }
304
+ tokenize(e, t, n) {
305
+ if (!e || !e.length) return [];
306
+ let r = [], i = e.split(/\s+/);
307
+ var a;
308
+ return n && (a = RegExp("^(" + Object.keys(n).map(d).join("|") + "):(.*)$")), i.forEach((e) => {
309
+ let n, i = null, o = null;
310
+ a && (n = e.match(a)) && (i = n[1], e = n[2]), e.length > 0 && (o = this.settings.diacritics ? le(e) || null : d(e), o && t && (o = "\\b" + o)), r.push({
311
+ string: e,
312
+ regex: o ? new RegExp(o, "iu") : null,
313
+ field: i
314
+ });
315
+ }), r;
316
+ }
317
+ getScoreFunction(e, t) {
318
+ var n = this.prepareSearch(e, t);
319
+ return this._getScoreFunction(n);
320
+ }
321
+ _getScoreFunction(e) {
322
+ let t = e.tokens, n = t.length;
323
+ if (!n) return function() {
324
+ return 0;
325
+ };
326
+ let r = e.options.fields, i = e.weights, a = r.length, o = e.getAttrFn;
327
+ if (!a) return function() {
328
+ return 1;
329
+ };
330
+ let s = (function() {
331
+ return a === 1 ? function(e, t) {
332
+ let n = r[0].field;
333
+ return T(o(t, n), e, i[n] || 1);
334
+ } : function(e, t) {
335
+ var n = 0;
336
+ if (e.field) {
337
+ let r = o(t, e.field);
338
+ !e.regex && r ? n += 1 / a : n += T(r, e, 1);
339
+ } else D(i, (r, i) => {
340
+ n += T(o(t, i), e, r);
341
+ });
342
+ return n / a;
343
+ };
344
+ })();
345
+ return n === 1 ? function(e) {
346
+ return s(t[0], e);
347
+ } : e.options.conjunction === "and" ? function(e) {
348
+ var r, i = 0;
349
+ for (let n of t) {
350
+ if (r = s(n, e), r <= 0) return 0;
351
+ i += r;
352
+ }
353
+ return i / n;
354
+ } : function(e) {
355
+ var r = 0;
356
+ return D(t, (t) => {
357
+ r += s(t, e);
358
+ }), r / n;
359
+ };
360
+ }
361
+ getSortFunction(e, t) {
362
+ var n = this.prepareSearch(e, t);
363
+ return this._getSortFunction(n);
364
+ }
365
+ _getSortFunction(e) {
366
+ var t, n = [];
367
+ let r = this, i = e.options, a = !e.query && i.sort_empty ? i.sort_empty : i.sort;
368
+ if (typeof a == "function") return a.bind(this);
369
+ let o = function(t, n) {
370
+ return t === "$score" ? n.score : e.getAttrFn(r.items[n.id], t);
371
+ };
372
+ if (a) for (let t of a) (e.query || t.field !== "$score") && n.push(t);
373
+ if (e.query) {
374
+ t = !0;
375
+ for (let e of n) if (e.field === "$score") {
376
+ t = !1;
377
+ break;
378
+ }
379
+ t && n.unshift({
380
+ field: "$score",
381
+ direction: "desc"
382
+ });
383
+ } else n = n.filter((e) => e.field !== "$score");
384
+ return n.length ? function(e, t) {
385
+ var r, i;
386
+ for (let a of n) if (i = a.field, r = (a.direction === "desc" ? -1 : 1) * fe(o(i, e), o(i, t)), r) return r;
387
+ return 0;
388
+ } : null;
389
+ }
390
+ prepareSearch(e, t) {
391
+ let n = {};
392
+ var r = Object.assign({}, t);
393
+ if (E(r, "sort"), E(r, "sort_empty"), r.fields) {
394
+ E(r, "fields");
395
+ let e = [];
396
+ r.fields.forEach((t) => {
397
+ typeof t == "string" && (t = {
398
+ field: t,
399
+ weight: 1
400
+ }), e.push(t), n[t.field] = "weight" in t ? t.weight : 1;
401
+ }), r.fields = e;
402
+ }
403
+ return {
404
+ options: r,
405
+ query: e.toLowerCase().trim(),
406
+ tokens: this.tokenize(e, r.respect_word_boundaries, n),
407
+ total: 0,
408
+ items: [],
409
+ weights: n,
410
+ getAttrFn: r.nesting ? de : ue
411
+ };
412
+ }
413
+ search(e, t) {
414
+ var n = this, r, i = this.prepareSearch(e, t);
415
+ t = i.options, e = i.query;
416
+ let a = t.score || n._getScoreFunction(i);
417
+ e.length ? D(n.items, (e, n) => {
418
+ r = a(e), (t.filter === !1 || r > 0) && i.items.push({
419
+ score: r,
420
+ id: n
421
+ });
422
+ }) : D(n.items, (e, t) => {
423
+ i.items.push({
424
+ score: 1,
425
+ id: t
426
+ });
427
+ });
428
+ let o = n._getSortFunction(i);
429
+ return o && i.items.sort(o), i.total = i.items.length, typeof t.limit == "number" && (i.items = i.items.slice(0, t.limit)), i;
430
+ }
431
+ }, O = (e) => e == null ? null : k(e), k = (e) => typeof e == "boolean" ? e ? "1" : "0" : e + "", A = (e) => (e + "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), me = (e, t) => t > 0 ? window.setTimeout(e, t) : (e.call(null), null), he = (e, t) => {
432
+ var n;
433
+ return function(r, i) {
434
+ var a = this;
435
+ n && (a.loading = Math.max(a.loading - 1, 0), clearTimeout(n)), n = setTimeout(function() {
436
+ n = null, a.loadedSearches[r] = !0, e.call(a, r, i);
437
+ }, t);
438
+ };
439
+ }, ge = (e, t, n) => {
440
+ var r, i = e.trigger, a = {};
441
+ e.trigger = function() {
442
+ var n = arguments[0];
443
+ if (t.indexOf(n) !== -1) a[n] = arguments;
444
+ else return i.apply(e, arguments);
445
+ }, n.apply(e, []), e.trigger = i;
446
+ for (r of t) r in a && i.apply(e, a[r]);
447
+ }, _e = (e) => ({
448
+ start: e.selectionStart || 0,
449
+ length: (e.selectionEnd || 0) - (e.selectionStart || 0)
450
+ }), j = (e, t = !1) => {
451
+ e && (e.preventDefault(), t && e.stopPropagation());
452
+ }, M = (e, t, n, r) => {
453
+ e.addEventListener(t, n, r);
454
+ }, N = (e, t) => !t || !t[e] ? !1 : +!!t.altKey + +!!t.ctrlKey + +!!t.shiftKey + +!!t.metaKey == 1, P = (e, t) => e.getAttribute("id") || (e.setAttribute("id", t), t), F = (e) => e.replace(/[\\"']/g, "\\$&"), I = (e, t) => {
455
+ t && e.append(t);
456
+ }, L = (e, t) => {
457
+ if (Array.isArray(e)) e.forEach(t);
458
+ else for (var n in e) e.hasOwnProperty(n) && t(e[n], n);
459
+ }, R = (e) => {
460
+ if (e.jquery) return e[0];
461
+ if (e instanceof HTMLElement) return e;
462
+ if (z(e)) {
463
+ var t = document.createElement("template");
464
+ return t.innerHTML = e.trim(), t.content.firstChild;
465
+ }
466
+ return document.querySelector(e);
467
+ }, z = (e) => typeof e == "string" && e.indexOf("<") > -1, ve = (e) => e.replace(/['"\\]/g, "\\$&"), B = (e, t) => {
468
+ var n = document.createEvent("HTMLEvents");
469
+ n.initEvent(t, !0, !1), e.dispatchEvent(n);
470
+ }, V = (e, t) => {
471
+ Object.assign(e.style, t);
472
+ }, H = (e, ...t) => {
473
+ var n = ye(t);
474
+ e = be(e), e.map((e) => {
475
+ n.map((t) => {
476
+ e.classList.add(t);
477
+ });
478
+ });
479
+ }, U = (e, ...t) => {
480
+ var n = ye(t);
481
+ e = be(e), e.map((e) => {
482
+ n.map((t) => {
483
+ e.classList.remove(t);
484
+ });
485
+ });
486
+ }, ye = (e) => {
487
+ var t = [];
488
+ return L(e, (e) => {
489
+ typeof e == "string" && (e = e.trim().split(/[\t\n\f\r\s]/)), Array.isArray(e) && (t = t.concat(e));
490
+ }), t.filter(Boolean);
491
+ }, be = (e) => (Array.isArray(e) || (e = [e]), e), W = (e, t, n) => {
492
+ if (!(n && !n.contains(e))) for (; e && e.matches;) {
493
+ if (e.matches(t)) return e;
494
+ e = e.parentNode;
495
+ }
496
+ }, xe = (e, t = 0) => t > 0 ? e[e.length - 1] : e[0], Se = (e) => Object.keys(e).length === 0, Ce = (e, t) => {
497
+ if (!e) return -1;
498
+ t ||= e.nodeName;
499
+ for (var n = 0; e = e.previousElementSibling;) e.matches(t) && n++;
500
+ return n;
501
+ }, G = (e, t) => {
502
+ L(t, (t, n) => {
503
+ t == null ? e.removeAttribute(n) : e.setAttribute(n, "" + t);
504
+ });
505
+ }, K = (e, t) => {
506
+ e.parentNode && e.parentNode.replaceChild(t, e);
507
+ }, we = (e, t) => {
508
+ if (t === null) return;
509
+ if (typeof t == "string") {
510
+ if (!t.length) return;
511
+ t = new RegExp(t, "i");
512
+ }
513
+ let n = (e) => {
514
+ var n = e.data.match(t);
515
+ if (n && e.data.length > 0) {
516
+ var r = document.createElement("span");
517
+ r.className = "highlight";
518
+ var i = e.splitText(n.index);
519
+ i.splitText(n[0].length);
520
+ var a = i.cloneNode(!0);
521
+ return r.appendChild(a), K(i, r), 1;
522
+ }
523
+ return 0;
524
+ }, r = (e) => {
525
+ e.nodeType === 1 && e.childNodes && !/(script|style)/i.test(e.tagName) && (e.className !== "highlight" || e.tagName !== "SPAN") && Array.from(e.childNodes).forEach((e) => {
526
+ i(e);
527
+ });
528
+ }, i = (e) => e.nodeType === 3 ? n(e) : (r(e), 0);
529
+ i(e);
530
+ }, Te = (e) => {
531
+ var t = e.querySelectorAll("span.highlight");
532
+ Array.prototype.forEach.call(t, function(e) {
533
+ var t = e.parentNode;
534
+ t.replaceChild(e.firstChild, e), t.normalize();
535
+ });
536
+ }, q = !(typeof navigator > "u") && /Mac/.test(navigator.userAgent) ? "metaKey" : "ctrlKey", Ee = {
537
+ options: [],
538
+ optgroups: [],
539
+ plugins: [],
540
+ delimiter: ",",
541
+ splitOn: null,
542
+ persist: !0,
543
+ diacritics: !0,
544
+ create: null,
545
+ createOnBlur: !1,
546
+ createFilter: null,
547
+ clearAfterSelect: !1,
548
+ highlight: !0,
549
+ openOnFocus: !0,
550
+ shouldOpen: null,
551
+ maxOptions: 50,
552
+ maxItems: null,
553
+ hideSelected: null,
554
+ duplicates: !1,
555
+ addPrecedence: !1,
556
+ selectOnTab: !1,
557
+ preload: null,
558
+ allowEmptyOption: !1,
559
+ refreshThrottle: 300,
560
+ loadThrottle: 300,
561
+ loadingClass: "loading",
562
+ dataAttr: null,
563
+ optgroupField: "optgroup",
564
+ valueField: "value",
565
+ labelField: "text",
566
+ disabledField: "disabled",
567
+ optgroupLabelField: "label",
568
+ optgroupValueField: "value",
569
+ lockOptgroupOrder: !1,
570
+ sortField: "$order",
571
+ searchField: ["text"],
572
+ searchConjunction: "and",
573
+ mode: null,
574
+ wrapperClass: "ts-wrapper",
575
+ controlClass: "ts-control",
576
+ dropdownClass: "ts-dropdown",
577
+ dropdownContentClass: "ts-dropdown-content",
578
+ itemClass: "item",
579
+ optionClass: "option",
580
+ dropdownParent: null,
581
+ controlInput: "<input type=\"text\" autocomplete=\"off\" size=\"1\" />",
582
+ copyClassesToDropdown: !1,
583
+ placeholder: null,
584
+ hidePlaceholder: null,
585
+ shouldLoad: function(e) {
586
+ return e.length > 0;
587
+ },
588
+ render: {}
589
+ };
590
+ //#endregion
591
+ //#region ../../node_modules/tom-select/dist/esm/getSettings.js
592
+ function De(e, t) {
593
+ var n = Object.assign({}, Ee, t), r = n.dataAttr, i = n.labelField, a = n.valueField, o = n.disabledField, s = n.optgroupField, c = n.optgroupLabelField, l = n.optgroupValueField, u = e.tagName.toLowerCase(), d = e.getAttribute("placeholder") || e.getAttribute("data-placeholder");
594
+ if (!d && !n.allowEmptyOption) {
595
+ let t = e.querySelector("option[value=\"\"]");
596
+ t && (d = t.textContent);
597
+ }
598
+ var f = {
599
+ placeholder: d,
600
+ options: [],
601
+ optgroups: [],
602
+ items: [],
603
+ maxItems: null
604
+ };
605
+ return u === "select" ? (() => {
606
+ var t, u = f.options, d = {}, p = 1;
607
+ let m = 0;
608
+ var h = (e) => {
609
+ var t = Object.assign({}, e.dataset), n = r && t[r];
610
+ return typeof n == "string" && n.length && (t = Object.assign(t, JSON.parse(n))), t;
611
+ }, g = (e, t) => {
612
+ var r = O(e.value);
613
+ if (r != null && !(!r && !n.allowEmptyOption)) {
614
+ if (d.hasOwnProperty(r)) {
615
+ if (t) {
616
+ var c = d[r][s];
617
+ c ? Array.isArray(c) ? c.push(t) : d[r][s] = [c, t] : d[r][s] = t;
618
+ }
619
+ } else {
620
+ var l = h(e);
621
+ l[i] = l[i] || e.textContent, l[a] = l[a] || r, l[o] = l[o] || e.disabled, l[s] = l[s] || t, l.$option = e, l.$order = l.$order || ++m, d[r] = l, u.push(l);
622
+ }
623
+ e.selected && f.items.push(r);
624
+ }
625
+ }, _ = (e) => {
626
+ var t, n = h(e);
627
+ n[c] = n[c] || e.getAttribute("label") || "", n[l] = n[l] || p++, n[o] = n[o] || e.disabled, n.$order = n.$order || ++m, f.optgroups.push(n), t = n[l], L(e.children, (e) => {
628
+ g(e, t);
629
+ });
630
+ };
631
+ f.maxItems = e.hasAttribute("multiple") ? null : 1, L(e.children, (e) => {
632
+ t = e.tagName.toLowerCase(), t === "optgroup" ? _(e) : t === "option" && g(e);
633
+ });
634
+ })() : (() => {
635
+ let t = e.getAttribute(r);
636
+ if (t) f.options = JSON.parse(t), L(f.options, (e) => {
637
+ f.items.push(e[a]);
638
+ });
639
+ else {
640
+ var o = (e?.value)?.trim() ?? "";
641
+ if (!n.allowEmptyOption && !o.length) return;
642
+ let t = o.split(n.delimiter);
643
+ L(t, (e) => {
644
+ let t = {};
645
+ t[i] = e, t[a] = e, f.options.push(t);
646
+ }), f.items = t;
647
+ }
648
+ })(), Object.assign({}, Ee, f, t);
649
+ }
650
+ //#endregion
651
+ //#region ../../node_modules/tom-select/dist/esm/tom-select.js
652
+ var J = 0, Y = class extends o(a) {
653
+ constructor(e, t) {
654
+ super(), this.order = 0, this.isOpen = !1, this.isDisabled = !1, this.isReadOnly = !1, this.isInvalid = !1, this.isValid = !0, this.isLocked = !1, this.isFocused = !1, this.isInputHidden = !1, this.isSetup = !1, this.isDropdownContentStale = !0, this.ignoreFocus = !1, this.ignoreHover = !1, this.hasOptions = !1, this.lastValue = "", this.caretPos = 0, this.loading = 0, this.loadedSearches = {}, this.activeOption = null, this.activeItems = [], this.optgroups = {}, this.options = {}, this.userOptions = {}, this.items = [], this.refreshTimeout = null, J++;
655
+ var n, r = R(e);
656
+ if (r.tomselect) throw Error("Tom Select already initialized on this element");
657
+ r.tomselect = this, n = (window.getComputedStyle && window.getComputedStyle(r, null)).getPropertyValue("direction");
658
+ let i = De(r, t);
659
+ this.settings = i, this.input = r, this.tabIndex = r.tabIndex || 0, this.is_select_tag = r.tagName.toLowerCase() === "select", this.rtl = /rtl/i.test(n), this.inputId = P(r, "tomselect-" + J), this.isRequired = r.required, this.sifter = new pe(this.options, { diacritics: i.diacritics }), i.mode = i.mode || (i.maxItems === 1 ? "single" : "multi"), typeof i.hideSelected != "boolean" && (i.hideSelected = i.mode === "multi"), typeof i.hidePlaceholder != "boolean" && (i.hidePlaceholder = i.mode !== "multi");
660
+ var a = i.createFilter;
661
+ typeof a != "function" && (typeof a == "string" && (a = new RegExp(a)), a instanceof RegExp ? i.createFilter = (e) => a.test(e) : i.createFilter = (e) => this.settings.duplicates || !this.options[e]), this.initializePlugins(i.plugins), this.setupCallbacks(), this.setupTemplates();
662
+ let o = R("<div>"), s = R("<div>"), c = this._render("dropdown"), l = R("<div role=\"listbox\" tabindex=\"-1\">"), u = this.input.getAttribute("class") || "", d = i.mode;
663
+ var f;
664
+ H(o, i.wrapperClass, u, d), H(s, i.controlClass), I(o, s), H(c, i.dropdownClass, d), i.copyClassesToDropdown && H(c, u), H(l, i.dropdownContentClass), I(c, l), R(i.dropdownParent || o).appendChild(c), z(i.controlInput) ? (f = R(i.controlInput), L([
665
+ "autocorrect",
666
+ "autocapitalize",
667
+ "autocomplete",
668
+ "spellcheck",
669
+ "aria-label"
670
+ ], (e) => {
671
+ r.getAttribute(e) && G(f, { [e]: r.getAttribute(e) });
672
+ }), f.tabIndex = -1, s.appendChild(f), this.focus_node = f) : i.controlInput ? (f = R(i.controlInput), this.focus_node = f) : (f = R("<input/>"), this.focus_node = s), this.wrapper = o, this.dropdown = c, this.dropdown_content = l, this.control = s, this.control_input = f, this.setup();
673
+ }
674
+ setup() {
675
+ let e = this, t = e.settings, n = e.control_input, r = e.dropdown, i = e.dropdown_content, a = e.wrapper, o = e.control, s = e.input, c = e.focus_node, l = { passive: !0 }, u = e.inputId + "-ts-dropdown";
676
+ G(i, { id: u }), G(c, {
677
+ role: "combobox",
678
+ "aria-haspopup": "listbox",
679
+ "aria-expanded": "false",
680
+ "aria-controls": u
681
+ });
682
+ let f = P(c, e.inputId + "-ts-control"), p = "label[for='" + ve(e.inputId) + "']", m = document.querySelector(p), h = e.focus.bind(e);
683
+ if (m) {
684
+ M(m, "click", h), G(m, { for: f });
685
+ let t = P(m, e.inputId + "-ts-label");
686
+ G(c, { "aria-labelledby": t }), G(i, { "aria-labelledby": t });
687
+ }
688
+ if (a.style.width = s.style.width, a.style.minWidth = s.style.minWidth, a.style.maxWidth = s.style.maxWidth, e.plugins.names.length) {
689
+ let t = "plugin-" + e.plugins.names.join(" plugin-");
690
+ H([a, r], t);
691
+ }
692
+ (t.maxItems === null || t.maxItems > 1) && e.is_select_tag && G(s, { multiple: "multiple" }), t.placeholder && G(n, { placeholder: t.placeholder }), !t.splitOn && t.delimiter && (t.splitOn = RegExp("\\s*" + d(t.delimiter) + "+\\s*")), t.load && t.loadThrottle && (t.load = he(t.load, t.loadThrottle)), M(r, "mousemove", () => {
693
+ e.ignoreHover = !1;
694
+ }), M(r, "mouseenter", (t) => {
695
+ var n = W(t.target, "[data-selectable]", r);
696
+ n && e.onOptionHover(t, n);
697
+ }, { capture: !0 }), M(r, "click", (t) => {
698
+ let n = W(t.target, "[data-selectable]");
699
+ n && (e.onOptionSelect(t, n), j(t, !0));
700
+ }), M(o, "click", (t) => {
701
+ var r = W(t.target, "[data-ts-item]", o);
702
+ if (r && e.onItemSelect(t, r)) {
703
+ j(t, !0);
704
+ return;
705
+ }
706
+ n.value == "" && (e.onClick(), j(t, !0));
707
+ }), M(c, "keydown", (t) => e.onKeyDown(t)), M(n, "keypress", (t) => e.onKeyPress(t)), M(n, "input", (t) => e.onInput(t)), M(c, "blur", (t) => e.onBlur(t)), M(c, "focus", (t) => e.onFocus(t)), M(n, "paste", (t) => e.onPaste(t));
708
+ let g = (t) => {
709
+ let i = t.composedPath()[0];
710
+ if (!a.contains(i) && !r.contains(i)) {
711
+ e.isFocused && e.blur(), e.inputState();
712
+ return;
713
+ }
714
+ i == n && e.isOpen ? t.stopPropagation() : j(t, !0);
715
+ }, _ = () => {
716
+ e.isOpen && e.positionDropdown();
717
+ }, v = () => {
718
+ e.isValid && (e.isValid = !1, e.isInvalid = !0, e.refreshState());
719
+ };
720
+ M(s, "invalid", v), M(document, "mousedown", g), M(window, "scroll", _, l), M(window, "resize", _, l), this._destroy = () => {
721
+ s.removeEventListener("invalid", v), document.removeEventListener("mousedown", g), window.removeEventListener("scroll", _), window.removeEventListener("resize", _), m && m.removeEventListener("click", h);
722
+ }, this.revertSettings = {
723
+ innerHTML: s.innerHTML,
724
+ tabIndex: s.tabIndex
725
+ }, s.tabIndex = -1, s.insertAdjacentElement("afterend", e.wrapper), e.sync(!1), t.items = [], delete t.optgroups, delete t.options, e.refreshItems(), e.close(!1), e.inputState(), e.isSetup = !0, e.on("change", this.onChange), H(s, "tomselected", "ts-hidden-accessible"), e.trigger("initialize"), t.preload === !0 && e.preload();
726
+ }
727
+ setupOptions(e = [], t = []) {
728
+ this.addOptions(e), L(t, (e) => {
729
+ this.registerOptionGroup(e);
730
+ });
731
+ }
732
+ setupTemplates() {
733
+ var e = this, t = e.settings.labelField, n = e.settings.optgroupLabelField, r = {
734
+ optgroup: (e) => {
735
+ let t = document.createElement("div");
736
+ return t.className = "optgroup", t.appendChild(e.options), t;
737
+ },
738
+ optgroup_header: (e, t) => "<div class=\"optgroup-header\">" + t(e[n]) + "</div>",
739
+ option: (e, n) => "<div>" + n(e[t]) + "</div>",
740
+ item: (e, n) => "<div>" + n(e[t]) + "</div>",
741
+ option_create: (e, t) => "<div class=\"create\">Add <strong>" + t(e.input) + "</strong>&hellip;</div>",
742
+ no_results: () => "<div class=\"no-results\">No results found</div>",
743
+ loading: () => "<div class=\"spinner\"></div>",
744
+ not_loading: () => {},
745
+ dropdown: () => "<div></div>"
746
+ };
747
+ e.settings.render = Object.assign({}, r, e.settings.render);
748
+ }
749
+ setupCallbacks() {
750
+ var e, t, n = {
751
+ initialize: "onInitialize",
752
+ change: "onChange",
753
+ item_add: "onItemAdd",
754
+ item_remove: "onItemRemove",
755
+ item_select: "onItemSelect",
756
+ clear: "onClear",
757
+ option_add: "onOptionAdd",
758
+ option_remove: "onOptionRemove",
759
+ option_clear: "onOptionClear",
760
+ optgroup_add: "onOptionGroupAdd",
761
+ optgroup_remove: "onOptionGroupRemove",
762
+ optgroup_clear: "onOptionGroupClear",
763
+ dropdown_open: "onDropdownOpen",
764
+ dropdown_close: "onDropdownClose",
765
+ type: "onType",
766
+ load: "onLoad",
767
+ focus: "onFocus",
768
+ blur: "onBlur"
769
+ };
770
+ for (e in n) t = this.settings[n[e]], t && this.on(e, t);
771
+ }
772
+ sync(e = !0) {
773
+ let t = this, n = e ? De(t.input, {
774
+ delimiter: t.settings.delimiter,
775
+ allowEmptyOption: t.settings.allowEmptyOption
776
+ }) : t.settings;
777
+ t.setupOptions(n.options, n.optgroups), t.setValue(n.items || [], !0), t.input.disabled ? t.disable() : t.input.readOnly ? t.setReadOnly(!0) : t.enable(), t.lastQuery = null;
778
+ }
779
+ onClick() {
780
+ var e = this;
781
+ if (e.activeItems.length > 0) {
782
+ e.clearActiveItems(), e.focus();
783
+ return;
784
+ }
785
+ e.isFocused && e.isOpen ? e.blur() : e.focus();
786
+ }
787
+ onMouseDown() {}
788
+ onChange() {
789
+ B(this.input, "input"), B(this.input, "change");
790
+ }
791
+ onPaste(e) {
792
+ var t = this;
793
+ if (t.isInputHidden || t.isLocked) {
794
+ j(e);
795
+ return;
796
+ }
797
+ t.settings.splitOn && setTimeout(() => {
798
+ var e = t.inputValue();
799
+ e.match(t.settings.splitOn) && L(e.trim().split(t.settings.splitOn), (e) => {
800
+ O(e) && (this.options[e] ? t.addItem(e) : t.createItem(e));
801
+ });
802
+ }, 0);
803
+ }
804
+ onKeyPress(e) {
805
+ var t = this;
806
+ if (t.isLocked) {
807
+ j(e);
808
+ return;
809
+ }
810
+ var n = String.fromCharCode(e.keyCode || e.which);
811
+ if (t.settings.create && t.settings.mode === "multi" && n === t.settings.delimiter) {
812
+ t.createItem(), j(e);
813
+ return;
814
+ }
815
+ }
816
+ onKeyDown(e) {
817
+ var t = this;
818
+ if (t.ignoreHover = !0, t.isLocked) {
819
+ e.keyCode !== 9 && j(e);
820
+ return;
821
+ }
822
+ switch (e.keyCode) {
823
+ case 65:
824
+ if (N(q, e) && t.control_input.value == "") {
825
+ j(e), t.selectAll();
826
+ return;
827
+ }
828
+ break;
829
+ case 27:
830
+ t.isOpen && (j(e, !0), t.close()), t.clearActiveItems();
831
+ return;
832
+ case 40:
833
+ if (!t.isOpen && t.hasOptions) t.open();
834
+ else if (t.activeOption) {
835
+ let e = t.getAdjacent(t.activeOption, 1);
836
+ e && t.setActiveOption(e);
837
+ }
838
+ j(e);
839
+ return;
840
+ case 38:
841
+ if (t.activeOption) {
842
+ let e = t.getAdjacent(t.activeOption, -1);
843
+ e && t.setActiveOption(e);
844
+ }
845
+ j(e);
846
+ return;
847
+ case 13:
848
+ t.canSelect(t.activeOption) ? (t.onOptionSelect(e, t.activeOption), j(e)) : (t.settings.create && t.createItem() || document.activeElement == t.control_input && t.isOpen) && j(e);
849
+ return;
850
+ case 37:
851
+ t.advanceSelection(-1, e);
852
+ return;
853
+ case 39:
854
+ t.advanceSelection(1, e);
855
+ return;
856
+ case 9:
857
+ t.settings.selectOnTab && (t.canSelect(t.activeOption) ? (t.onOptionSelect(e, t.activeOption), j(e)) : t.settings.create && t.createItem() && j(e));
858
+ return;
859
+ case 8:
860
+ case 46:
861
+ t.deleteSelection(e);
862
+ return;
863
+ }
864
+ t.isInputHidden && !N(q, e) && j(e);
865
+ }
866
+ onInput(e) {
867
+ if (this.isLocked) return;
868
+ let t = this.inputValue();
869
+ if (this.lastValue !== t) {
870
+ if (this.lastValue = t, t == "") {
871
+ this._onInput();
872
+ return;
873
+ }
874
+ this.refreshTimeout && window.clearTimeout(this.refreshTimeout), this.refreshTimeout = me(() => {
875
+ this.refreshTimeout = null, this._onInput();
876
+ }, this.settings.refreshThrottle);
877
+ }
878
+ }
879
+ _onInput() {
880
+ let e = this.lastValue;
881
+ this.settings.shouldLoad.call(this, e) && this.load(e), this.refreshOptions(), this.trigger("type", e);
882
+ }
883
+ onOptionHover(e, t) {
884
+ this.ignoreHover || this.setActiveOption(t, !1);
885
+ }
886
+ onFocus(e) {
887
+ var t = this, n = t.isFocused;
888
+ if (t.isDisabled || t.isReadOnly) {
889
+ t.blur(), j(e);
890
+ return;
891
+ }
892
+ t.ignoreFocus || (t.isFocused = !0, t.settings.preload === "focus" && t.preload(), n || t.trigger("focus"), t.activeItems.length || (t.inputState(), t.refreshOptions(!!t.settings.openOnFocus)), t.refreshState());
893
+ }
894
+ onBlur(e) {
895
+ if (document.hasFocus() !== !1) {
896
+ var t = this;
897
+ if (t.isFocused) {
898
+ t.isFocused = !1, t.ignoreFocus = !1;
899
+ var n = () => {
900
+ t.close(), t.setActiveItem(), t.setCaret(t.items.length), t.trigger("blur");
901
+ };
902
+ t.settings.create && t.settings.createOnBlur ? t.createItem(null, n) : n();
903
+ }
904
+ }
905
+ }
906
+ onOptionSelect(e, t) {
907
+ var n, r = this;
908
+ t.parentElement && t.parentElement.matches("[data-disabled]") || (t.classList.contains("create") ? r.createItem(null, () => {
909
+ r.settings.closeAfterSelect ? r.close() : r.settings.clearAfterSelect && r.setTextboxValue();
910
+ }) : (n = t.dataset.value, n !== void 0 && (r.isDropdownContentStale = r.settings.hideSelected, r.addItem(n), r.settings.closeAfterSelect ? r.close() : r.settings.clearAfterSelect && r.setTextboxValue(), !r.settings.hideSelected && e.type && /click/.test(e.type) && r.setActiveOption(t))));
911
+ }
912
+ canSelect(e) {
913
+ return !!(this.isOpen && e && this.dropdown_content.contains(e));
914
+ }
915
+ onItemSelect(e, t) {
916
+ var n = this;
917
+ return !n.isLocked && n.settings.mode === "multi" ? (j(e), n.setActiveItem(t, e), !0) : !1;
918
+ }
919
+ canLoad(e) {
920
+ return !(!this.settings.load || this.loadedSearches.hasOwnProperty(e));
921
+ }
922
+ load(e) {
923
+ let t = this;
924
+ if (!t.canLoad(e)) return;
925
+ H(t.wrapper, t.settings.loadingClass), t.loading++;
926
+ let n = t.loadCallback.bind(t);
927
+ t.settings.load.call(t, e, n);
928
+ }
929
+ loadCallback(e, t) {
930
+ let n = this;
931
+ n.loading = Math.max(n.loading - 1, 0), n.isDropdownContentStale = !0, n.clearActiveOption(), n.setupOptions(e, t), n.refreshOptions(n.isFocused && !n.isInputHidden), n.loading || U(n.wrapper, n.settings.loadingClass), n.trigger("load", e, t);
932
+ }
933
+ preload() {
934
+ var e = this.wrapper.classList;
935
+ e.contains("preloaded") || (e.add("preloaded"), this.load(""));
936
+ }
937
+ setTextboxValue(e = "") {
938
+ var t = this.control_input;
939
+ t.value !== e && (t.value = e, B(t, "update"), this.lastValue = e);
940
+ }
941
+ getValue() {
942
+ return this.is_select_tag && this.input.hasAttribute("multiple") ? this.items : this.items.join(this.settings.delimiter);
943
+ }
944
+ setValue(e, t) {
945
+ var n = t ? [] : ["change"];
946
+ ge(this, n, () => {
947
+ this.clear(t), this.addItems(e, t);
948
+ });
949
+ }
950
+ setMaxItems(e) {
951
+ e === 0 && (e = null), this.settings.maxItems = e, this.refreshState();
952
+ }
953
+ setActiveItem(e, t) {
954
+ var n = this, r, i, a, o, s, c;
955
+ if (n.settings.mode !== "single") {
956
+ if (!e) {
957
+ n.clearActiveItems(), n.isFocused && n.inputState();
958
+ return;
959
+ }
960
+ if (r = t && t.type.toLowerCase(), r === "click" && N("shiftKey", t) && n.activeItems.length) {
961
+ for (c = n.getLastActive(), a = Array.prototype.indexOf.call(n.control.children, c), o = Array.prototype.indexOf.call(n.control.children, e), a > o && (s = a, a = o, o = s), i = a; i <= o; i++) e = n.control.children[i], n.activeItems.indexOf(e) === -1 && n.setActiveItemClass(e);
962
+ j(t);
963
+ } else r === "click" && N(q, t) || r === "keydown" && N("shiftKey", t) ? e.classList.contains("active") ? n.removeActiveItem(e) : n.setActiveItemClass(e) : (n.clearActiveItems(), n.setActiveItemClass(e));
964
+ n.inputState(), n.isFocused || n.focus();
965
+ }
966
+ }
967
+ setActiveItemClass(e) {
968
+ let t = this, n = t.control.querySelector(".last-active");
969
+ n && U(n, "last-active"), H(e, "active last-active"), t.trigger("item_select", e), t.activeItems.indexOf(e) == -1 && t.activeItems.push(e);
970
+ }
971
+ removeActiveItem(e) {
972
+ var t = this.activeItems.indexOf(e);
973
+ this.activeItems.splice(t, 1), U(e, "active");
974
+ }
975
+ clearActiveItems() {
976
+ U(this.activeItems, "active"), this.activeItems = [];
977
+ }
978
+ setActiveOption(e, t = !0) {
979
+ e !== this.activeOption && (this.clearActiveOption(), e && (this.activeOption = e, G(this.focus_node, { "aria-activedescendant": e.getAttribute("id") }), G(e, { "aria-selected": "true" }), H(e, "active"), t && this.scrollToOption(e)));
980
+ }
981
+ scrollToOption(e, t) {
982
+ if (!e) return;
983
+ let n = this.dropdown_content, r = n.clientHeight, i = n.scrollTop || 0, a = e.offsetHeight, o = e.getBoundingClientRect().top - n.getBoundingClientRect().top + i;
984
+ o + a > r + i ? this.scroll(o - r + a, t) : o < i && this.scroll(o, t);
985
+ }
986
+ scroll(e, t) {
987
+ let n = this.dropdown_content;
988
+ t && (n.style.scrollBehavior = t), n.scrollTop = e, n.style.scrollBehavior = "";
989
+ }
990
+ clearActiveOption() {
991
+ this.activeOption && (U(this.activeOption, "active"), G(this.activeOption, { "aria-selected": null })), this.activeOption = null, G(this.focus_node, { "aria-activedescendant": null });
992
+ }
993
+ selectAll() {
994
+ let e = this;
995
+ if (e.settings.mode === "single") return;
996
+ let t = e.controlChildren();
997
+ t.length && (e.inputState(), e.close(), e.activeItems = t, L(t, (t) => {
998
+ e.setActiveItemClass(t);
999
+ }));
1000
+ }
1001
+ inputState() {
1002
+ var e = this;
1003
+ e.control.contains(e.control_input) && (G(e.control_input, { placeholder: e.settings.placeholder }), e.activeItems.length > 0 || !e.isFocused && e.settings.hidePlaceholder && e.items.length > 0 ? (e.setTextboxValue(), e.isInputHidden = !0) : (e.settings.hidePlaceholder && e.items.length > 0 && G(e.control_input, { placeholder: "" }), e.isInputHidden = !1), e.wrapper.classList.toggle("input-hidden", e.isInputHidden));
1004
+ }
1005
+ inputValue() {
1006
+ return this.control_input.value.trim();
1007
+ }
1008
+ focus() {
1009
+ var e = this;
1010
+ if (e.isDisabled || e.isReadOnly) return;
1011
+ e.ignoreFocus = !0;
1012
+ let t = this.control_input.offsetWidth ? this.control_input : this.focus_node;
1013
+ t.focus(), setTimeout(() => {
1014
+ e.ignoreFocus = !1, t.getRootNode().activeElement === t && this.onFocus();
1015
+ }, 0);
1016
+ }
1017
+ blur() {
1018
+ this.focus_node.blur(), this.onBlur();
1019
+ }
1020
+ getScoreFunction(e) {
1021
+ return this.sifter.getScoreFunction(e, this.getSearchOptions());
1022
+ }
1023
+ getSearchOptions() {
1024
+ var e = this.settings, t = e.sortField;
1025
+ return typeof e.sortField == "string" && (t = [{ field: e.sortField }]), {
1026
+ fields: e.searchField,
1027
+ conjunction: e.searchConjunction,
1028
+ sort: t,
1029
+ nesting: e.nesting
1030
+ };
1031
+ }
1032
+ search(e) {
1033
+ var t, n, r = this, i = this.getSearchOptions();
1034
+ if (r.settings.score && (n = r.settings.score.call(r, e), typeof n != "function")) throw Error("Tom Select \"score\" setting must be a function that returns a function");
1035
+ return r.isDropdownContentStale || e !== r.lastQuery ? (r.lastQuery = e, /(.)\1{15,}/.test(e) && (e = ""), t = r.sifter.search(e, Object.assign(i, { score: n })), r.currentResults = t) : t = Object.assign({}, r.currentResults), r.settings.hideSelected && (t.items = t.items.filter((e) => {
1036
+ let t = O(e.id);
1037
+ return !(t !== null && r.items.indexOf(t) !== -1);
1038
+ })), t;
1039
+ }
1040
+ refreshOptions(e = !0) {
1041
+ var t, n, r, i, a, o, s, c, l, u;
1042
+ let d = {}, f = [];
1043
+ var p = this, m = p.inputValue();
1044
+ let h = m === p.lastQuery || m == "" && p.lastQuery == null;
1045
+ var g = p.search(m), _ = null, v = p.settings.shouldOpen || !1, y = p.dropdown_content;
1046
+ h && (_ = p.activeOption, _ && (l = _.closest("[data-group]"))), i = g.items.length, typeof p.settings.maxOptions == "number" && (i = Math.min(i, p.settings.maxOptions)), i > 0 && (v = !0);
1047
+ let b = (e, t) => {
1048
+ let n = d[e];
1049
+ if (n !== void 0) {
1050
+ let e = f[n];
1051
+ if (e !== void 0) return [n, e.fragment];
1052
+ }
1053
+ let r = document.createDocumentFragment();
1054
+ return n = f.length, f.push({
1055
+ fragment: r,
1056
+ order: t,
1057
+ optgroup: e
1058
+ }), [n, r];
1059
+ };
1060
+ for (t = 0; t < i; t++) {
1061
+ let e = g.items[t];
1062
+ if (!e) continue;
1063
+ let i = e.id, s = p.options[i];
1064
+ if (s === void 0) continue;
1065
+ let c = k(i), u = p.getOption(c, !0);
1066
+ for (p.settings.hideSelected || u.classList.toggle("selected", p.items.includes(c)), a = s[p.settings.optgroupField] || "", o = Array.isArray(a) ? a : [a], n = 0, r = o && o.length; n < r; n++) {
1067
+ a = o[n];
1068
+ let e = s.$order, t = p.optgroups[a];
1069
+ if (t === void 0 && typeof p.settings.optionGroupRegister == "function") {
1070
+ var x;
1071
+ (x = p.settings.optionGroupRegister.apply(p, [a])) && p.registerOptionGroup(x);
1072
+ }
1073
+ t = p.optgroups[a], t === void 0 ? a = "" : e = t.$order;
1074
+ let [r, c] = b(a, e);
1075
+ n > 0 && (u = u.cloneNode(!0), G(u, {
1076
+ id: s.$id + "-clone-" + n,
1077
+ "aria-selected": null
1078
+ }), u.classList.add("ts-cloned"), U(u, "active"), p.activeOption && p.activeOption.dataset.value == i && l && l.dataset.group === a.toString() && (_ = u)), c.appendChild(u), a != "" && (d[a] = r);
1079
+ }
1080
+ }
1081
+ p.settings.lockOptgroupOrder && f.sort((e, t) => e.order - t.order), s = document.createDocumentFragment(), L(f, (e) => {
1082
+ let t = e.fragment, n = e.optgroup;
1083
+ if (!t || !t.children.length) return;
1084
+ let r = p.optgroups[n];
1085
+ if (r !== void 0) {
1086
+ let e = document.createDocumentFragment();
1087
+ I(e, p.render("optgroup_header", r)), I(e, t);
1088
+ let n = p.render("optgroup", {
1089
+ group: r,
1090
+ options: e
1091
+ });
1092
+ I(s, n);
1093
+ } else I(s, t);
1094
+ }), y.innerHTML = "", I(y, s), p.isDropdownContentStale = !1, p.settings.highlight && (Te(y), g.query.length && g.tokens.length && L(g.tokens, (e) => {
1095
+ we(y, e.regex);
1096
+ }));
1097
+ var S = (e) => {
1098
+ let t = p.render(e, { input: m });
1099
+ return t && (v = !0, y.insertBefore(t, y.firstChild)), t;
1100
+ };
1101
+ if (p.loading ? S("loading") : p.settings.shouldLoad.call(p, m) ? g.items.length === 0 && S("no_results") : S("not_loading"), c = p.canCreate(m), c && (u = S("option_create")), p.hasOptions = g.items.length > 0 || c, v) {
1102
+ if (g.items.length > 0) {
1103
+ if (!_ && p.settings.mode === "single" && p.items[0] != null && (_ = p.getOption(p.items[0])), !y.contains(_)) {
1104
+ let e = 0;
1105
+ u && !p.settings.addPrecedence && (e = 1), _ = p.selectable()[e];
1106
+ }
1107
+ } else u && (_ = u);
1108
+ e && !p.isOpen && (p.open(), p.scrollToOption(_, "auto")), p.setActiveOption(_);
1109
+ } else p.clearActiveOption(), e && p.isOpen && p.close(!1);
1110
+ }
1111
+ selectable() {
1112
+ return this.dropdown_content.querySelectorAll("[data-selectable]");
1113
+ }
1114
+ addOption(e, t = !1) {
1115
+ let n = this;
1116
+ if (Array.isArray(e)) return n.addOptions(e, t), !1;
1117
+ let r = O(e[n.settings.valueField]);
1118
+ return r === null || n.options.hasOwnProperty(r) ? (n.updateOption(e[n.settings.valueField], e), !1) : (e.$order = e.$order || ++n.order, e.$id = n.inputId + "-opt-" + e.$order, n.options[r] = e, n.isDropdownContentStale = !0, t && (n.userOptions[r] = t, n.trigger("option_add", r, e)), r);
1119
+ }
1120
+ addOptions(e, t = !1) {
1121
+ L(e, (e) => {
1122
+ this.addOption(e, t);
1123
+ });
1124
+ }
1125
+ registerOption(e) {
1126
+ return this.addOption(e);
1127
+ }
1128
+ registerOptionGroup(e) {
1129
+ var t = O(e[this.settings.optgroupValueField]);
1130
+ return t === null ? !1 : (e.$order = e.$order || ++this.order, this.optgroups[t] = e, t);
1131
+ }
1132
+ addOptionGroup(e, t) {
1133
+ var n;
1134
+ t[this.settings.optgroupValueField] = e, (n = this.registerOptionGroup(t)) && this.trigger("optgroup_add", n, t);
1135
+ }
1136
+ removeOptionGroup(e) {
1137
+ this.optgroups.hasOwnProperty(e) && (delete this.optgroups[e], this.clearCache(), this.trigger("optgroup_remove", e));
1138
+ }
1139
+ clearOptionGroups() {
1140
+ this.optgroups = {}, this.clearCache(), this.trigger("optgroup_clear");
1141
+ }
1142
+ updateOption(e, t) {
1143
+ let n = this;
1144
+ var r, i;
1145
+ let a = O(e), o = O(t[n.settings.valueField]);
1146
+ if (a === null) return;
1147
+ let s = n.options[a];
1148
+ if (s == null) return;
1149
+ if (typeof o != "string") throw Error("Value must be set in option data");
1150
+ let c = n.getOption(a), l = n.getItem(a);
1151
+ if (t.$order = t.$order || s.$order, delete n.options[a], n.uncacheValue(o), n.options[o] = t, c) {
1152
+ if (n.dropdown_content.contains(c)) {
1153
+ let e = n._render("option", t);
1154
+ K(c, e), n.activeOption === c && n.setActiveOption(e);
1155
+ }
1156
+ c.remove();
1157
+ }
1158
+ l && (i = n.items.indexOf(a), i !== -1 && n.items.splice(i, 1, o), r = n._render("item", t), l.classList.contains("active") && H(r, "active"), K(l, r)), n.isDropdownContentStale = !0;
1159
+ }
1160
+ removeOption(e, t) {
1161
+ let n = this;
1162
+ e = k(e), n.uncacheValue(e), delete n.userOptions[e], delete n.options[e], n.isDropdownContentStale = !0, n.trigger("option_remove", e), n.removeItem(e, t);
1163
+ }
1164
+ clearOptions(e) {
1165
+ let t = (e || this.clearFilter).bind(this);
1166
+ this.loadedSearches = {}, this.userOptions = {}, this.clearCache();
1167
+ let n = {};
1168
+ L(this.options, (e, r) => {
1169
+ t(e, r) && (n[r] = e);
1170
+ }), this.options = this.sifter.items = n, this.isDropdownContentStale = !0, this.trigger("option_clear");
1171
+ }
1172
+ clearFilter(e, t) {
1173
+ return this.items.indexOf(t) >= 0;
1174
+ }
1175
+ getOption(e, t = !1) {
1176
+ let n = O(e);
1177
+ if (n === null) return null;
1178
+ let r = this.options[n];
1179
+ if (r != null) {
1180
+ if (r.$div) return r.$div;
1181
+ if (t) return this._render("option", r);
1182
+ }
1183
+ return null;
1184
+ }
1185
+ getAdjacent(e, t, n = "option") {
1186
+ var r = this, i;
1187
+ if (!e) return null;
1188
+ i = n == "item" ? r.controlChildren() : r.dropdown_content.querySelectorAll("[data-selectable]");
1189
+ for (let n = 0; n < i.length; n++) if (i[n] == e) return t > 0 ? i[n + 1] : i[n - 1];
1190
+ return null;
1191
+ }
1192
+ getItem(e) {
1193
+ if (typeof e == "object") return e;
1194
+ var t = O(e);
1195
+ return t === null ? null : this.control.querySelector(`[data-value="${F(t)}"]`);
1196
+ }
1197
+ addItems(e, t) {
1198
+ var n = this, r = Array.isArray(e) ? e : [e];
1199
+ r = r.filter((e) => n.items.indexOf(e) === -1);
1200
+ let i = r[r.length - 1];
1201
+ r.forEach((e) => {
1202
+ n.isPending = e !== i, n.addItem(e, t);
1203
+ });
1204
+ }
1205
+ addItem(e, t) {
1206
+ var n = t ? [] : ["change", "dropdown_close"];
1207
+ ge(this, n, () => {
1208
+ var n, r;
1209
+ let i = this, a = i.settings.mode, o = O(e);
1210
+ if (!(o && i.items.indexOf(o) !== -1 && (a === "single" && i.close(), a === "single" || !i.settings.duplicates)) && !(o === null || !i.options.hasOwnProperty(o)) && (a === "single" && i.clear(t), !(a === "multi" && i.isFull()))) {
1211
+ if (n = i._render("item", i.options[o]), i.control.contains(n) && (n = n.cloneNode(!0)), r = i.isFull(), i.items.splice(i.caretPos, 0, o), i.insertAtCaret(n), i.isSetup) {
1212
+ if (!i.isPending && i.settings.hideSelected) {
1213
+ let e = i.getOption(o), t = i.getAdjacent(e, 1);
1214
+ t && i.setActiveOption(t);
1215
+ }
1216
+ i.settings.clearAfterSelect && i.setTextboxValue(), !i.isPending && !i.settings.closeAfterSelect && i.refreshOptions(i.isFocused && a !== "single"), i.settings.closeAfterSelect != 0 && i.isFull() ? i.close() : i.isPending || i.positionDropdown(), i.trigger("item_add", o, n), i.isPending || i.updateOriginalInput({ silent: t });
1217
+ }
1218
+ (!i.isPending || !r && i.isFull()) && (i.inputState(), i.refreshState());
1219
+ }
1220
+ });
1221
+ }
1222
+ removeItem(e = null, t) {
1223
+ let n = this;
1224
+ if (e = n.getItem(e), !e) return;
1225
+ var r, i;
1226
+ let a = e.dataset.value;
1227
+ r = Ce(e), e.remove(), e.classList.contains("active") && (i = n.activeItems.indexOf(e), n.activeItems.splice(i, 1), U(e, "active")), n.items.splice(r, 1), n.isDropdownContentStale = !0, !n.settings.persist && n.userOptions.hasOwnProperty(a) && n.removeOption(a, t), r < n.caretPos && n.setCaret(n.caretPos - 1), n.updateOriginalInput({ silent: t }), n.refreshState(), n.positionDropdown(), n.trigger("item_remove", a, e);
1228
+ }
1229
+ createItem(e = null, t = () => {}) {
1230
+ arguments.length === 3 && (t = arguments[2]), typeof t != "function" && (t = () => {});
1231
+ var n = this, r = n.caretPos, i;
1232
+ if (e ||= n.inputValue(), !n.canCreate(e)) return O(e) && this.options[e] && n.addItem(e), t(), !1;
1233
+ n.lock();
1234
+ var a = !1, o = (e) => {
1235
+ if (n.unlock(), !e || typeof e != "object") return t();
1236
+ var i = O(e[n.settings.valueField]);
1237
+ if (typeof i != "string") return t();
1238
+ n.setTextboxValue(), n.addOption(e, !0), n.setCaret(r), n.addItem(i), t(e), a = !0;
1239
+ };
1240
+ return i = typeof n.settings.create == "function" ? n.settings.create.call(this, e, o) : {
1241
+ [n.settings.labelField]: e,
1242
+ [n.settings.valueField]: e
1243
+ }, a || o(i), !0;
1244
+ }
1245
+ refreshItems() {
1246
+ var e = this;
1247
+ e.isDropdownContentStale = !0, e.isSetup && e.addItems(e.items), e.updateOriginalInput(), e.refreshState();
1248
+ }
1249
+ refreshState() {
1250
+ let e = this;
1251
+ e.refreshValidityState();
1252
+ let t = e.isFull(), n = e.isLocked;
1253
+ e.wrapper.classList.toggle("rtl", e.rtl);
1254
+ let r = e.wrapper.classList;
1255
+ r.toggle("focus", e.isFocused), r.toggle("disabled", e.isDisabled), r.toggle("readonly", e.isReadOnly), r.toggle("required", e.isRequired), r.toggle("invalid", !e.isValid), r.toggle("locked", n), r.toggle("full", t), r.toggle("input-active", e.isFocused && !e.isInputHidden), r.toggle("dropdown-active", e.isOpen), r.toggle("has-options", Se(e.options)), r.toggle("has-items", e.items.length > 0);
1256
+ }
1257
+ refreshValidityState() {
1258
+ var e = this;
1259
+ e.input.validity && (e.isValid = e.input.validity.valid, e.isInvalid = !e.isValid);
1260
+ }
1261
+ isFull() {
1262
+ return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
1263
+ }
1264
+ updateOriginalInput(e = {}) {
1265
+ let t = this;
1266
+ var n, r;
1267
+ let i = t.input.querySelector("option[value=\"\"]");
1268
+ if (t.is_select_tag) {
1269
+ let e = [], a = t.input.querySelectorAll("option:checked").length;
1270
+ function o(n, r, o) {
1271
+ return n ||= R("<option value=\"" + A(r) + "\">" + A(o) + "</option>"), n != i && t.input.append(n), e.push(n), (n != i || a > 0) && (n.selected = !0), n;
1272
+ }
1273
+ t.input.querySelectorAll("option:checked").forEach((e) => {
1274
+ e.selected = !1;
1275
+ }), t.items.length == 0 && t.settings.mode == "single" ? o(i, "", "") : t.items.forEach((i) => {
1276
+ n = t.options[i], r = n[t.settings.labelField] || "", e.includes(n.$option) ? o(t.input.querySelector(`option[value="${F(i)}"]:not(:checked)`), i, r) : n.$option = o(n.$option, i, r);
1277
+ });
1278
+ } else t.input.value = t.getValue();
1279
+ t.isSetup && (e.silent || t.trigger("change", t.getValue()));
1280
+ }
1281
+ open() {
1282
+ var e = this;
1283
+ e.isLocked || e.isOpen || e.settings.mode === "multi" && e.isFull() || (e.isOpen = !0, G(e.focus_node, { "aria-expanded": "true" }), e.refreshState(), V(e.dropdown, {
1284
+ visibility: "hidden",
1285
+ display: "block"
1286
+ }), e.positionDropdown(), V(e.dropdown, {
1287
+ visibility: "visible",
1288
+ display: "block"
1289
+ }), e.focus(), e.trigger("dropdown_open", e.dropdown));
1290
+ }
1291
+ close(e = !0) {
1292
+ var t = this, n = t.isOpen;
1293
+ e && (t.setTextboxValue(), t.settings.mode === "single" && t.items.length && t.inputState()), t.isOpen = !1, G(t.focus_node, { "aria-expanded": "false" }), V(t.dropdown, { display: "none" }), t.settings.hideSelected && t.clearActiveOption(), t.refreshState(), n && t.trigger("dropdown_close", t.dropdown);
1294
+ }
1295
+ positionDropdown() {
1296
+ if (this.settings.dropdownParent === "body") {
1297
+ var e = this.control, t = e.getBoundingClientRect(), n = e.offsetHeight + t.top + window.scrollY, r = t.left + window.scrollX;
1298
+ V(this.dropdown, {
1299
+ width: t.width + "px",
1300
+ top: n + "px",
1301
+ left: r + "px"
1302
+ });
1303
+ }
1304
+ }
1305
+ clear(e) {
1306
+ var t = this;
1307
+ t.items.length && (L(t.controlChildren(), (e) => {
1308
+ t.removeItem(e, !0);
1309
+ }), t.inputState(), e || t.updateOriginalInput(), t.trigger("clear"));
1310
+ }
1311
+ insertAtCaret(e) {
1312
+ let t = this, n = t.caretPos, r = t.control;
1313
+ r.insertBefore(e, r.children[n] || null), t.setCaret(n + 1);
1314
+ }
1315
+ deleteSelection(e) {
1316
+ var t, n, r, i, a = this;
1317
+ t = e && e.keyCode === 8 ? -1 : 1, n = _e(a.control_input);
1318
+ let o = [];
1319
+ if (a.activeItems.length) i = xe(a.activeItems, t), r = Ce(i), t > 0 && r++, L(a.activeItems, (e) => o.push(e));
1320
+ else if ((a.isFocused || a.settings.mode === "single") && a.items.length) {
1321
+ let e = a.controlChildren(), r;
1322
+ t < 0 && n.start === 0 && n.length === 0 ? r = e[a.caretPos - 1] : t > 0 && n.start === a.inputValue().length && (r = e[a.caretPos]), r !== void 0 && o.push(r);
1323
+ }
1324
+ if (!a.shouldDelete(o, e)) return !1;
1325
+ for (j(e, !0), r !== void 0 && a.setCaret(r); o.length;) a.removeItem(o.pop());
1326
+ return a.inputState(), a.positionDropdown(), a.refreshOptions(!1), !0;
1327
+ }
1328
+ shouldDelete(e, t) {
1329
+ let n = e.map((e) => e.dataset.value);
1330
+ return !(!n.length || typeof this.settings.onDelete == "function" && this.settings.onDelete.call(this, n, t) === !1);
1331
+ }
1332
+ advanceSelection(e, t) {
1333
+ var n, r, i = this;
1334
+ i.rtl && (e *= -1), !i.inputValue().length && (N(q, t) || N("shiftKey", t) ? (n = i.getLastActive(e), r = n ? n.classList.contains("active") ? i.getAdjacent(n, e, "item") : n : e > 0 ? i.control_input.nextElementSibling : i.control_input.previousElementSibling, r && (r.classList.contains("active") && i.removeActiveItem(n), i.setActiveItemClass(r))) : i.moveCaret(e));
1335
+ }
1336
+ moveCaret(e) {}
1337
+ getLastActive(e) {
1338
+ let t = this.control.querySelector(".last-active");
1339
+ if (t) return t;
1340
+ var n = this.control.querySelectorAll(".active");
1341
+ if (n) return xe(n, e);
1342
+ }
1343
+ setCaret(e) {
1344
+ this.caretPos = this.items.length;
1345
+ }
1346
+ controlChildren() {
1347
+ return Array.from(this.control.querySelectorAll("[data-ts-item]"));
1348
+ }
1349
+ lock() {
1350
+ this.setLocked(!0);
1351
+ }
1352
+ unlock() {
1353
+ this.setLocked(!1);
1354
+ }
1355
+ setLocked(e = this.isReadOnly || this.isDisabled) {
1356
+ this.isLocked = e, this.refreshState();
1357
+ }
1358
+ disable() {
1359
+ this.setDisabled(!0), this.close();
1360
+ }
1361
+ enable() {
1362
+ this.setDisabled(!1);
1363
+ }
1364
+ setDisabled(e) {
1365
+ this.focus_node.tabIndex = e ? -1 : this.tabIndex, this.isDisabled = e, this.input.disabled = e, this.control_input.disabled = e, this.setLocked();
1366
+ }
1367
+ setReadOnly(e) {
1368
+ this.isReadOnly = e, this.input.readOnly = e, this.control_input.readOnly = e, this.setLocked();
1369
+ }
1370
+ destroy() {
1371
+ var e = this, t = e.revertSettings;
1372
+ e.trigger("destroy"), e.off(), e.wrapper.remove(), e.dropdown.remove(), e.input.innerHTML = t.innerHTML, e.input.tabIndex = t.tabIndex, U(e.input, "tomselected", "ts-hidden-accessible"), e._destroy(), delete e.input.tomselect;
1373
+ }
1374
+ render(e, t) {
1375
+ var n, r;
1376
+ let i = this;
1377
+ if (typeof this.settings.render[e] != "function" || (r = i.settings.render[e].call(this, t, A), !r)) return null;
1378
+ if (r = R(r), e === "option" || e === "option_create" ? t[i.settings.disabledField] ? G(r, { "aria-disabled": "true" }) : G(r, { "data-selectable": "" }) : e === "optgroup" && (n = t.group[i.settings.optgroupValueField], G(r, { "data-group": n }), t.group[i.settings.disabledField] && G(r, { "data-disabled": "" })), e === "option" || e === "item") {
1379
+ let n = k(t[i.settings.valueField]);
1380
+ G(r, { "data-value": n }), e === "item" ? (H(r, i.settings.itemClass), G(r, { "data-ts-item": "" })) : (H(r, i.settings.optionClass), G(r, {
1381
+ role: "option",
1382
+ id: t.$id
1383
+ }), t.$div = r, i.options[n] = t);
1384
+ }
1385
+ return r;
1386
+ }
1387
+ _render(e, t) {
1388
+ let n = this.render(e, t);
1389
+ if (n == null) throw "HTMLElement expected";
1390
+ return n;
1391
+ }
1392
+ clearCache() {
1393
+ L(this.options, (e) => {
1394
+ e.$div && (e.$div.remove(), delete e.$div);
1395
+ });
1396
+ }
1397
+ uncacheValue(e) {
1398
+ let t = this.getOption(e);
1399
+ t && t.remove();
1400
+ }
1401
+ canCreate(e) {
1402
+ return this.settings.create && e.length > 0 && this.settings.createFilter.call(this, e);
1403
+ }
1404
+ hook(e, t, n) {
1405
+ var r = this, i = r[t];
1406
+ r[t] = function() {
1407
+ var t, a;
1408
+ return e === "after" && (t = i.apply(r, arguments)), a = n.apply(r, arguments), e === "instead" ? a : (e === "before" && (t = i.apply(r, arguments)), t);
1409
+ };
1410
+ }
1411
+ }, Oe = (e, t, n, r) => {
1412
+ e.addEventListener(t, n, r);
1413
+ };
1414
+ function ke() {
1415
+ Oe(this.input, "change", () => {
1416
+ this.sync();
1417
+ });
1418
+ }
1419
+ //#endregion
1420
+ //#region ../../node_modules/tom-select/dist/esm/plugins/checkbox_options/plugin.js
1421
+ var Ae = (e) => e == null ? null : je(e), je = (e) => typeof e == "boolean" ? e ? "1" : "0" : e + "", Me = (e, t = !1) => {
1422
+ e && (e.preventDefault(), t && e.stopPropagation());
1423
+ }, Ne = (e) => {
1424
+ if (e.jquery) return e[0];
1425
+ if (e instanceof HTMLElement) return e;
1426
+ if (Pe(e)) {
1427
+ var t = document.createElement("template");
1428
+ return t.innerHTML = e.trim(), t.content.firstChild;
1429
+ }
1430
+ return document.querySelector(e);
1431
+ }, Pe = (e) => typeof e == "string" && e.indexOf("<") > -1;
1432
+ function Fe(e) {
1433
+ var t = this, n = t.onOptionSelect;
1434
+ t.settings.hideSelected = !1;
1435
+ let r = Object.assign({
1436
+ className: "tomselect-checkbox",
1437
+ checkedClassNames: void 0,
1438
+ uncheckedClassNames: void 0
1439
+ }, e);
1440
+ var i = function(e, t) {
1441
+ t ? (e.checked = !0, r.uncheckedClassNames && e.classList.remove(...r.uncheckedClassNames), r.checkedClassNames && e.classList.add(...r.checkedClassNames)) : (e.checked = !1, r.checkedClassNames && e.classList.remove(...r.checkedClassNames), r.uncheckedClassNames && e.classList.add(...r.uncheckedClassNames));
1442
+ }, a = function(e) {
1443
+ setTimeout(() => {
1444
+ var t = e.querySelector("input." + r.className);
1445
+ t instanceof HTMLInputElement && i(t, e.classList.contains("selected"));
1446
+ }, 1);
1447
+ };
1448
+ t.hook("after", "setupTemplates", () => {
1449
+ var e = t.settings.render.option;
1450
+ t.settings.render.option = (n, a) => {
1451
+ var o = Ne(e.call(t, n, a)), s = document.createElement("input");
1452
+ r.className && s.classList.add(r.className), s.addEventListener("click", function(e) {
1453
+ Me(e);
1454
+ }), s.type = "checkbox";
1455
+ let c = Ae(n[t.settings.valueField]);
1456
+ return i(s, !!(c && t.items.indexOf(c) > -1)), o.prepend(s), o;
1457
+ };
1458
+ }), t.on("item_remove", (e) => {
1459
+ var n = t.getOption(e);
1460
+ n && (n.classList.remove("selected"), a(n));
1461
+ }), t.on("item_add", (e) => {
1462
+ var n = t.getOption(e);
1463
+ n && a(n);
1464
+ }), t.hook("instead", "onOptionSelect", (e, r) => {
1465
+ if (r.classList.contains("selected")) {
1466
+ r.classList.remove("selected"), t.removeItem(r.dataset.value), t.refreshOptions(), Me(e, !0);
1467
+ return;
1468
+ }
1469
+ n.call(t, e, r), a(r);
1470
+ });
1471
+ }
1472
+ //#endregion
1473
+ //#region ../../node_modules/tom-select/dist/esm/plugins/clear_button/plugin.js
1474
+ var Ie = (e) => {
1475
+ if (e.jquery) return e[0];
1476
+ if (e instanceof HTMLElement) return e;
1477
+ if (Le(e)) {
1478
+ var t = document.createElement("template");
1479
+ return t.innerHTML = e.trim(), t.content.firstChild;
1480
+ }
1481
+ return document.querySelector(e);
1482
+ }, Le = (e) => typeof e == "string" && e.indexOf("<") > -1;
1483
+ function Re(e) {
1484
+ let t = this, n = Object.assign({
1485
+ className: "clear-button",
1486
+ title: "Clear All",
1487
+ role: "button",
1488
+ tabindex: 0,
1489
+ html: (e) => `<div class="${e.className}" title="${e.title}" role="${e.role}" tabindex="${e.tabindex}">&times;</div>`
1490
+ }, e);
1491
+ t.on("initialize", () => {
1492
+ var e = Ie(n.html(n));
1493
+ e.addEventListener("click", (e) => {
1494
+ t.isLocked || (t.clear(), t.settings.mode === "single" && t.settings.allowEmptyOption && t.addItem(""), t.refreshOptions(!1), e.preventDefault(), e.stopPropagation());
1495
+ }), t.control.appendChild(e);
1496
+ });
1497
+ }
1498
+ //#endregion
1499
+ //#region ../../node_modules/tom-select/dist/esm/plugins/drag_drop/plugin.js
1500
+ var ze = (e, t = !1) => {
1501
+ e && (e.preventDefault(), t && e.stopPropagation());
1502
+ }, X = (e, t, n, r) => {
1503
+ e.addEventListener(t, n, r);
1504
+ }, Be = (e, t) => {
1505
+ if (Array.isArray(e)) e.forEach(t);
1506
+ else for (var n in e) e.hasOwnProperty(n) && t(e[n], n);
1507
+ }, Ve = (e) => {
1508
+ if (e.jquery) return e[0];
1509
+ if (e instanceof HTMLElement) return e;
1510
+ if (He(e)) {
1511
+ var t = document.createElement("template");
1512
+ return t.innerHTML = e.trim(), t.content.firstChild;
1513
+ }
1514
+ return document.querySelector(e);
1515
+ }, He = (e) => typeof e == "string" && e.indexOf("<") > -1, Ue = (e, t) => {
1516
+ Be(t, (t, n) => {
1517
+ t == null ? e.removeAttribute(n) : e.setAttribute(n, "" + t);
1518
+ });
1519
+ }, We = (e, t) => {
1520
+ var n;
1521
+ (n = e.parentNode) == null || n.insertBefore(t, e.nextSibling);
1522
+ }, Ge = (e, t) => {
1523
+ var n;
1524
+ (n = e.parentNode) == null || n.insertBefore(t, e);
1525
+ }, Ke = (e, t) => {
1526
+ do
1527
+ if (t = t?.previousElementSibling, e == t) return !0;
1528
+ while (t && t.previousElementSibling);
1529
+ return !1;
1530
+ };
1531
+ function qe() {
1532
+ var e = this;
1533
+ if (e.settings.mode !== "multi") return;
1534
+ var t = e.lock, n = e.unlock;
1535
+ let r = !0, i;
1536
+ e.hook("after", "setupTemplates", () => {
1537
+ var t = e.settings.render.item;
1538
+ e.settings.render.item = (n, a) => {
1539
+ let o = Ve(t.call(e, n, a));
1540
+ Ue(o, { draggable: "true" });
1541
+ let s = (e) => {
1542
+ r || ze(e), e.stopPropagation();
1543
+ }, c = (e) => {
1544
+ i = o, setTimeout(() => {
1545
+ o.classList.add("ts-dragging");
1546
+ }, 0);
1547
+ }, l = (e) => {
1548
+ e.preventDefault(), o.classList.add("ts-drag-over"), d(o, i);
1549
+ }, u = () => {
1550
+ o.classList.remove("ts-drag-over");
1551
+ }, d = (e, t) => {
1552
+ t !== void 0 && (Ke(t, o) ? We(e, t) : Ge(e, t));
1553
+ };
1554
+ return X(o, "mousedown", s), X(o, "dragstart", c), X(o, "dragenter", l), X(o, "dragover", l), X(o, "dragleave", u), X(o, "dragend", () => {
1555
+ var t;
1556
+ document.querySelectorAll(".ts-drag-over").forEach((e) => e.classList.remove("ts-drag-over")), (t = i) == null || t.classList.remove("ts-dragging"), i = void 0;
1557
+ var n = [];
1558
+ e.control.querySelectorAll("[data-value]").forEach((e) => {
1559
+ if (e.dataset.value) {
1560
+ let t = e.dataset.value;
1561
+ t && n.push(t);
1562
+ }
1563
+ }), e.setValue(n);
1564
+ }), o;
1565
+ };
1566
+ }), e.hook("instead", "lock", () => (r = !1, t.call(e))), e.hook("instead", "unlock", () => (r = !0, n.call(e)));
1567
+ }
1568
+ //#endregion
1569
+ //#region ../../node_modules/tom-select/dist/esm/plugins/dropdown_header/plugin.js
1570
+ var Je = (e, t = !1) => {
1571
+ e && (e.preventDefault(), t && e.stopPropagation());
1572
+ }, Ye = (e) => {
1573
+ if (e.jquery) return e[0];
1574
+ if (e instanceof HTMLElement) return e;
1575
+ if (Xe(e)) {
1576
+ var t = document.createElement("template");
1577
+ return t.innerHTML = e.trim(), t.content.firstChild;
1578
+ }
1579
+ return document.querySelector(e);
1580
+ }, Xe = (e) => typeof e == "string" && e.indexOf("<") > -1;
1581
+ function Ze(e) {
1582
+ let t = this, n = Object.assign({
1583
+ title: "Untitled",
1584
+ headerClass: "dropdown-header",
1585
+ titleRowClass: "dropdown-header-title",
1586
+ labelClass: "dropdown-header-label",
1587
+ closeClass: "dropdown-header-close",
1588
+ html: (e) => "<div class=\"" + e.headerClass + "\"><div class=\"" + e.titleRowClass + "\"><span class=\"" + e.labelClass + "\">" + e.title + "</span><a class=\"" + e.closeClass + "\">&times;</a></div></div>"
1589
+ }, e);
1590
+ t.on("initialize", () => {
1591
+ var e = Ye(n.html(n)), r = e.querySelector("." + n.closeClass);
1592
+ r && r.addEventListener("click", (e) => {
1593
+ Je(e, !0), t.close();
1594
+ }), t.dropdown.insertBefore(e, t.dropdown.firstChild);
1595
+ });
1596
+ }
1597
+ //#endregion
1598
+ //#region ../../node_modules/tom-select/dist/esm/plugins/caret_position/plugin.js
1599
+ var Qe = (e, t) => {
1600
+ if (Array.isArray(e)) e.forEach(t);
1601
+ else for (var n in e) e.hasOwnProperty(n) && t(e[n], n);
1602
+ }, $e = (e, ...t) => {
1603
+ var n = et(t);
1604
+ e = tt(e), e.map((e) => {
1605
+ n.map((t) => {
1606
+ e.classList.remove(t);
1607
+ });
1608
+ });
1609
+ }, et = (e) => {
1610
+ var t = [];
1611
+ return Qe(e, (e) => {
1612
+ typeof e == "string" && (e = e.trim().split(/[\t\n\f\r\s]/)), Array.isArray(e) && (t = t.concat(e));
1613
+ }), t.filter(Boolean);
1614
+ }, tt = (e) => (Array.isArray(e) || (e = [e]), e), nt = (e, t) => {
1615
+ if (!e) return -1;
1616
+ t ||= e.nodeName;
1617
+ for (var n = 0; e = e.previousElementSibling;) e.matches(t) && n++;
1618
+ return n;
1619
+ };
1620
+ function rt() {
1621
+ var e = this;
1622
+ e.hook("instead", "setCaret", (t) => {
1623
+ e.settings.mode === "single" || !e.control.contains(e.control_input) ? t = e.items.length : (t = Math.max(0, Math.min(e.items.length, t)), t != e.caretPos && !e.isPending && e.controlChildren().forEach((n, r) => {
1624
+ r < t ? e.control_input.insertAdjacentElement("beforebegin", n) : e.control.appendChild(n);
1625
+ })), e.caretPos = t;
1626
+ }), e.hook("instead", "moveCaret", (t) => {
1627
+ if (!e.isFocused) return;
1628
+ let n = e.getLastActive(t);
1629
+ if (n) {
1630
+ let r = nt(n);
1631
+ e.setCaret(t > 0 ? r + 1 : r), e.setActiveItem(), $e(n, "last-active");
1632
+ } else e.setCaret(e.caretPos + t);
1633
+ });
1634
+ }
1635
+ //#endregion
1636
+ //#region ../../node_modules/tom-select/dist/esm/plugins/dropdown_input/plugin.js
1637
+ var it = 27, at = 9, ot = (e, t = !1) => {
1638
+ e && (e.preventDefault(), t && e.stopPropagation());
1639
+ }, st = (e, t, n, r) => {
1640
+ e.addEventListener(t, n, r);
1641
+ }, ct = (e, t) => {
1642
+ if (Array.isArray(e)) e.forEach(t);
1643
+ else for (var n in e) e.hasOwnProperty(n) && t(e[n], n);
1644
+ }, lt = (e) => {
1645
+ if (e.jquery) return e[0];
1646
+ if (e instanceof HTMLElement) return e;
1647
+ if (ut(e)) {
1648
+ var t = document.createElement("template");
1649
+ return t.innerHTML = e.trim(), t.content.firstChild;
1650
+ }
1651
+ return document.querySelector(e);
1652
+ }, ut = (e) => typeof e == "string" && e.indexOf("<") > -1, dt = (e, ...t) => {
1653
+ var n = ft(t);
1654
+ e = pt(e), e.map((e) => {
1655
+ n.map((t) => {
1656
+ e.classList.add(t);
1657
+ });
1658
+ });
1659
+ }, ft = (e) => {
1660
+ var t = [];
1661
+ return ct(e, (e) => {
1662
+ typeof e == "string" && (e = e.trim().split(/[\t\n\f\r\s]/)), Array.isArray(e) && (t = t.concat(e));
1663
+ }), t.filter(Boolean);
1664
+ }, pt = (e) => (Array.isArray(e) || (e = [e]), e);
1665
+ function mt() {
1666
+ let e = this;
1667
+ e.settings.shouldOpen = !0, e.hook("before", "setup", () => {
1668
+ e.focus_node = e.control, dt(e.control_input, "dropdown-input");
1669
+ let t = lt("<div class=\"dropdown-input-wrap\">");
1670
+ t.append(e.control_input), e.dropdown.insertBefore(t, e.dropdown.firstChild);
1671
+ let n = lt("<input class=\"items-placeholder\" tabindex=\"-1\" />");
1672
+ n.placeholder = e.settings.placeholder || "", e.control.append(n);
1673
+ let r = e.input?.getAttribute("aria-label");
1674
+ r && n.setAttribute("aria-label", r);
1675
+ }), e.on("initialize", () => {
1676
+ e.control_input.addEventListener("keydown", (t) => {
1677
+ switch (t.keyCode) {
1678
+ case it:
1679
+ e.isOpen && (ot(t, !0), e.close()), e.clearActiveItems();
1680
+ return;
1681
+ case at:
1682
+ e.focus_node.tabIndex = -1;
1683
+ break;
1684
+ }
1685
+ return e.onKeyDown.call(e, t);
1686
+ }), e.on("blur", () => {
1687
+ e.focus_node.tabIndex = e.isDisabled ? -1 : e.tabIndex;
1688
+ }), e.on("dropdown_open", () => {
1689
+ e.control_input.focus();
1690
+ });
1691
+ let t = e.onBlur;
1692
+ e.hook("instead", "onBlur", (n) => {
1693
+ if (!(n && n.relatedTarget == e.control_input)) return t.call(e);
1694
+ }), st(e.control_input, "blur", () => e.onBlur()), e.hook("before", "close", () => {
1695
+ e.isOpen && e.focus_node.focus({ preventScroll: !0 });
1696
+ });
1697
+ });
1698
+ }
1699
+ //#endregion
1700
+ //#region ../../node_modules/tom-select/dist/esm/plugins/input_autogrow/plugin.js
1701
+ var Z = (e, t, n, r) => {
1702
+ e.addEventListener(t, n, r);
1703
+ };
1704
+ function ht() {
1705
+ var e = this;
1706
+ e.on("initialize", () => {
1707
+ var t = document.createElement("span"), n = e.control_input;
1708
+ t.style.cssText = "position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; ", e.wrapper.appendChild(t);
1709
+ for (let e of [
1710
+ "letterSpacing",
1711
+ "fontSize",
1712
+ "fontFamily",
1713
+ "fontWeight",
1714
+ "textTransform"
1715
+ ]) t.style[e] = n.style[e];
1716
+ var r = () => {
1717
+ t.textContent = n.value, n.style.width = t.clientWidth + "px";
1718
+ };
1719
+ r(), e.on("update item_add item_remove", r), Z(n, "input", r), Z(n, "keyup", r), Z(n, "blur", r), Z(n, "update", r);
1720
+ });
1721
+ }
1722
+ //#endregion
1723
+ //#region ../../node_modules/tom-select/dist/esm/plugins/no_backspace_delete/plugin.js
1724
+ function gt() {
1725
+ var e = this, t = e.deleteSelection;
1726
+ this.hook("instead", "deleteSelection", (n) => e.activeItems.length ? t.call(e, n) : !1);
1727
+ }
1728
+ //#endregion
1729
+ //#region ../../node_modules/tom-select/dist/esm/plugins/no_active_items/plugin.js
1730
+ function _t() {
1731
+ this.hook("instead", "setActiveItem", () => {}), this.hook("instead", "selectAll", () => {});
1732
+ }
1733
+ //#endregion
1734
+ //#region ../../node_modules/tom-select/dist/esm/plugins/optgroup_columns/plugin.js
1735
+ var vt = 37, yt = 39, bt = (e, t, n) => {
1736
+ for (; e && e.matches;) {
1737
+ if (e.matches(t)) return e;
1738
+ e = e.parentNode;
1739
+ }
1740
+ }, xt = (e, t) => {
1741
+ if (!e) return -1;
1742
+ t ||= e.nodeName;
1743
+ for (var n = 0; e = e.previousElementSibling;) e.matches(t) && n++;
1744
+ return n;
1745
+ };
1746
+ function St() {
1747
+ var e = this, t = e.onKeyDown;
1748
+ e.hook("instead", "onKeyDown", (n) => {
1749
+ var r, i, a, o;
1750
+ if (!e.isOpen || !(n.keyCode === vt || n.keyCode === yt)) return t.call(e, n);
1751
+ e.ignoreHover = !0, o = bt(e.activeOption, "[data-group]"), r = xt(e.activeOption, "[data-selectable]"), o && (o = n.keyCode === vt ? o.previousSibling : o.nextSibling, o && (a = o.querySelectorAll("[data-selectable]"), i = a[Math.min(a.length - 1, r)], i && e.setActiveOption(i)));
1752
+ });
1753
+ }
1754
+ //#endregion
1755
+ //#region ../../node_modules/tom-select/dist/esm/plugins/remove_button/plugin.js
1756
+ var Ct = (e) => (e + "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), wt = (e, t = !1) => {
1757
+ e && (e.preventDefault(), t && e.stopPropagation());
1758
+ }, Tt = (e, t, n, r) => {
1759
+ e.addEventListener(t, n, r);
1760
+ }, Et = (e) => {
1761
+ if (e.jquery) return e[0];
1762
+ if (e instanceof HTMLElement) return e;
1763
+ if (Dt(e)) {
1764
+ var t = document.createElement("template");
1765
+ return t.innerHTML = e.trim(), t.content.firstChild;
1766
+ }
1767
+ return document.querySelector(e);
1768
+ }, Dt = (e) => typeof e == "string" && e.indexOf("<") > -1;
1769
+ function Ot(e) {
1770
+ let t = Object.assign({
1771
+ label: "&times;",
1772
+ title: "Remove",
1773
+ className: "remove",
1774
+ append: !0
1775
+ }, e);
1776
+ var n = this;
1777
+ if (t.append) {
1778
+ var r = "<a href=\"javascript:void(0)\" class=\"" + t.className + "\" tabindex=\"-1\" title=\"" + Ct(t.title) + "\">" + t.label + "</a>";
1779
+ n.hook("after", "setupTemplates", () => {
1780
+ var e = n.settings.render.item;
1781
+ n.settings.render.item = (t, i) => {
1782
+ var a = Et(e.call(n, t, i)), o = Et(r);
1783
+ return a.appendChild(o), Tt(o, "mousedown", (e) => {
1784
+ wt(e, !0);
1785
+ }), Tt(o, "click", (e) => {
1786
+ n.isLocked || (wt(e, !0), !n.isLocked && n.shouldDelete([a], e) && (n.removeItem(a), n.refreshOptions(!1), n.inputState()));
1787
+ }), a;
1788
+ };
1789
+ });
1790
+ }
1791
+ }
1792
+ //#endregion
1793
+ //#region ../../node_modules/tom-select/dist/esm/plugins/restore_on_backspace/plugin.js
1794
+ function kt(e) {
1795
+ let t = this, n = Object.assign({ text: (e) => e[t.settings.labelField] }, e);
1796
+ t.on("item_remove", function(e) {
1797
+ if (t.isFocused && t.control_input.value.trim() === "") {
1798
+ var r = t.options[e];
1799
+ r && t.setTextboxValue(n.text.call(t, r));
1800
+ }
1801
+ });
1802
+ }
1803
+ //#endregion
1804
+ //#region ../../node_modules/tom-select/dist/esm/plugins/virtual_scroll/plugin.js
1805
+ var At = (e, t) => {
1806
+ if (Array.isArray(e)) e.forEach(t);
1807
+ else for (var n in e) e.hasOwnProperty(n) && t(e[n], n);
1808
+ }, jt = (e, ...t) => {
1809
+ var n = Mt(t);
1810
+ e = Nt(e), e.map((e) => {
1811
+ n.map((t) => {
1812
+ e.classList.add(t);
1813
+ });
1814
+ });
1815
+ }, Mt = (e) => {
1816
+ var t = [];
1817
+ return At(e, (e) => {
1818
+ typeof e == "string" && (e = e.trim().split(/[\t\n\f\r\s]/)), Array.isArray(e) && (t = t.concat(e));
1819
+ }), t.filter(Boolean);
1820
+ }, Nt = (e) => (Array.isArray(e) || (e = [e]), e);
1821
+ function Pt() {
1822
+ let e = this, t = e.canLoad, n = e.clearActiveOption, r = e.loadCallback;
1823
+ var i = {}, a, o = !1, s, c = [], l = !1, u;
1824
+ if (e.settings.shouldLoadMore || (e.settings.shouldLoadMore = () => {
1825
+ if (a.clientHeight / (a.scrollHeight - a.scrollTop) > .9) return !0;
1826
+ if (e.activeOption) {
1827
+ var t = e.selectable();
1828
+ if (Array.from(t).indexOf(e.activeOption) >= t.length - 2) return !0;
1829
+ }
1830
+ return !1;
1831
+ }), !e.settings.firstUrl) throw "virtual_scroll plugin requires a firstUrl() method";
1832
+ e.settings.sortField = [{ field: "$order" }, { field: "$score" }];
1833
+ let d = (t) => typeof e.settings.maxOptions == "number" && a.children.length >= e.settings.maxOptions ? !1 : !!(t in i && i[t]), f = (t, n) => e.items.indexOf(n) >= 0 || c.indexOf(n) >= 0;
1834
+ e.setNextUrl = (e, t) => {
1835
+ i[e] = t;
1836
+ }, e.getUrl = (t) => {
1837
+ if (t in i) {
1838
+ let e = i[t];
1839
+ return i[t] = !1, e;
1840
+ }
1841
+ return e.clearPagination(), e.settings.firstUrl.call(e, t);
1842
+ }, e.clearPagination = () => {
1843
+ i = {};
1844
+ }, e.hook("instead", "clearActiveOption", () => {
1845
+ if (!o) return n.call(e);
1846
+ }), e.hook("instead", "canLoad", (n) => n in i ? d(n) : t.call(e, n)), e.hook("instead", "loadCallback", (t, n) => {
1847
+ if (!o) e.clearOptions(f);
1848
+ else if (s) {
1849
+ let n = t[0];
1850
+ n !== void 0 && (s.dataset.value = n[e.settings.valueField]);
1851
+ }
1852
+ r.call(e, t, n), !o && !l && (l = !0, e.lastValue === "" && (c = Object.keys(e.options), u = i[""])), o = !1;
1853
+ }), e.hook("before", "refreshOptions", () => {
1854
+ e.activeOption && e.activeOption.getAttribute("role") !== "option" && e.setActiveOption(e.activeOption.previousElementSibling);
1855
+ }), e.hook("after", "refreshOptions", () => {
1856
+ let t = e.lastValue;
1857
+ var n;
1858
+ d(t) ? (n = e.render("loading_more", { query: t }), n && (n.setAttribute("data-selectable", ""), s = n)) : t in i && !a.querySelector(".no-results") && (n = e.render("no_more_results", { query: t })), n && (jt(n, e.settings.optionClass), a.append(n));
1859
+ });
1860
+ let p = () => {
1861
+ l && (e.clearOptions(f), u && (i[""] = u));
1862
+ };
1863
+ e.on("type", (t) => {
1864
+ t === "" && (p(), e.refreshOptions(!1));
1865
+ }), e.on("dropdown_close", p), e.on("initialize", () => {
1866
+ c = Object.keys(e.options), a = e.dropdown_content, e.settings.render = Object.assign({}, {
1867
+ loading_more: () => "<div class=\"loading-more-results\">Loading more results ... </div>",
1868
+ no_more_results: () => "<div class=\"no-more-results\">No more results</div>"
1869
+ }, e.settings.render), a.addEventListener("scroll", () => {
1870
+ e.settings.shouldLoadMore.call(e) && d(e.lastValue) && (o || (o = !0, e.load.call(e, e.lastValue)));
1871
+ });
1872
+ });
1873
+ }
1874
+ Y.define("change_listener", ke), Y.define("checkbox_options", Fe), Y.define("clear_button", Re), Y.define("drag_drop", qe), Y.define("dropdown_header", Ze), Y.define("caret_position", rt), Y.define("dropdown_input", mt), Y.define("input_autogrow", ht), Y.define("no_backspace_delete", gt), Y.define("no_active_items", _t), Y.define("optgroup_columns", St), Y.define("remove_button", Ot), Y.define("restore_on_backspace", kt), Y.define("virtual_scroll", Pt);
1875
+ var Ft = Y, It = ".formie-field .ts-wrapper.formie-combobox{width:100%;min-height:0;box-shadow:none;background:0 0;border:0;padding:0;display:block;position:relative}.formie-field select[data-formie-combobox-input].tomselected,.formie-field select[data-formie-combobox-input].ts-hidden-accessible{display:none!important}.formie-field .ts-wrapper.formie-combobox .ts-control{box-sizing:border-box;z-index:1;border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm);background-color:var(--formie-color-surface);width:100%;min-height:var(--formie-control-height);padding:calc(var(--formie-control-padding-y) - 1px) var(--formie-control-padding-x);box-shadow:none;font-size:var(--formie-control-font-size);line-height:var(--formie-line-height-tight);color:var(--formie-color-text);align-items:center;gap:var(--formie-space-1);background-image:none;flex-wrap:wrap;transition:border-color .15s,box-shadow .15s,background-color .15s;display:flex;position:relative;overflow:hidden}.formie-field .ts-wrapper.formie-combobox.single .ts-control{--ts-pr-min:var(--formie-control-padding-x);--ts-pr-caret:calc(var(--formie-select-indicator-size) + var(--formie-space-1));background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M7 7l3-3 3 3m0 6l-3 3-3-3' stroke='%239CA3AF' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");background-position:right var(--formie-space-2) center;background-repeat:no-repeat;background-size:var(--formie-select-indicator-size) var(--formie-select-indicator-size);padding-right:calc(var(--formie-control-padding-x) + var(--formie-select-indicator-size) + var(--formie-space-2))!important}.formie-field .ts-wrapper.formie-combobox.single .ts-control:after{display:none}.formie-field .ts-wrapper.formie-combobox.multi .ts-control{padding:calc(var(--formie-control-padding-y) - 2px) var(--formie-control-padding-x) calc(var(--formie-control-padding-y) - 4px);--ts-pr-min:var(--formie-control-padding-x)}.formie-field .ts-wrapper.formie-combobox.multi.has-items .ts-control{padding-left:var(--formie-control-padding-x)}.formie-field .ts-wrapper.formie-combobox .ts-control>input{min-width:7rem;max-width:100%;color:var(--formie-color-text);font:inherit;font-size:var(--formie-control-font-size);line-height:inherit;flex:auto;min-height:0!important;max-height:none!important;box-shadow:none!important;background:0 0!important;border:0!important;margin:0!important;padding:0!important}.formie-field .ts-wrapper.formie-combobox .ts-control>input:focus{outline:none!important}.formie-field .ts-wrapper.formie-combobox.has-items .ts-control>input{margin:0 var(--formie-space-1)!important}.formie-field .ts-wrapper.formie-combobox.input-hidden .ts-control>input{opacity:0;position:absolute;left:-10000px}.formie-field .ts-wrapper.formie-combobox.single .ts-control,.formie-field .ts-wrapper.formie-combobox.single .ts-control>input{cursor:pointer}.formie-field .ts-wrapper.formie-combobox.single.input-active .ts-control,.formie-field .ts-wrapper.formie-combobox.single.input-active .ts-control>input{cursor:text}.formie-field .ts-wrapper.formie-combobox .ts-control .items-placeholder{color:var(--formie-color-text-muted);font:inherit;font-size:var(--formie-control-font-size)}.formie-field .ts-wrapper.formie-combobox .ts-control>input::placeholder{color:var(--formie-color-text-muted)}.formie-field .ts-wrapper.formie-combobox.focus .ts-control,.formie-field .ts-wrapper.formie-combobox .ts-control:focus-within,.formie-field .ts-wrapper.formie-combobox.dropdown-active .ts-control{border-color:var(--formie-color-focus-ring);box-shadow:var(--formie-shadow-focus);border-radius:var(--formie-radius-sm);outline:0}.formie-field-has-error .ts-wrapper.formie-combobox .ts-control{border-color:var(--formie-color-danger)}.formie-field-has-error .ts-wrapper.formie-combobox.focus .ts-control,.formie-field-has-error .ts-wrapper.formie-combobox .ts-control:focus-within,.formie-field-has-error .ts-wrapper.formie-combobox.dropdown-active .ts-control{border-color:var(--formie-color-danger);box-shadow:var(--formie-shadow-danger-focus)}.formie-field .ts-wrapper.formie-combobox.multi .ts-control>.item,.formie-field .ts-wrapper.formie-combobox.multi .ts-control [data-value]{align-items:center;gap:var(--formie-space-1);margin:0 var(--formie-space-1) var(--formie-space-1) 0;padding:0 var(--formie-space-2);background:var(--formie-color-surface-muted,#0f172a0f);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm);box-shadow:none;color:var(--formie-color-text);text-shadow:none;line-height:calc(var(--formie-control-height) - var(--formie-space-3));background-image:none;display:inline-flex}.formie-field .ts-wrapper.formie-combobox.multi .ts-control>.item.active,.formie-field .ts-wrapper.formie-combobox.multi .ts-control [data-value].active{background:var(--formie-color-surface-muted,#0f172a0f);color:var(--formie-color-text)}.formie-field .ts-wrapper.formie-combobox.plugin-remove_button .item{align-items:center;gap:var(--formie-space-1);display:inline-flex}.formie-field .ts-wrapper.formie-combobox.plugin-remove_button:not(.rtl) .item{padding-right:var(--formie-space-2)!important}.formie-field .ts-wrapper.formie-combobox.plugin-remove_button .item .remove{box-shadow:none;color:var(--formie-color-text-muted);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;margin:0;padding:0;font-size:1.125em;line-height:1;text-decoration:none;display:inline-flex}.formie-field .ts-wrapper.formie-combobox.plugin-remove_button .item .remove:hover,.formie-field .ts-wrapper.formie-combobox.plugin-remove_button .item .remove:focus{color:var(--formie-color-text);background:0 0;text-decoration:none}.formie-field .ts-wrapper.formie-combobox .ts-dropdown{width:100%;z-index:var(--formie-z-popover,30);border:var(--formie-border-width) solid var(--formie-color-border);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface);box-shadow:var(--formie-shadow-popover,0 8px 24px #0f172a1f);margin-top:var(--formie-space-1);box-sizing:border-box;position:absolute;top:100%;left:0}.formie-field .ts-wrapper.formie-combobox .ts-dropdown-content{scroll-behavior:smooth;max-height:200px;overflow:hidden auto}.formie-field .ts-wrapper.formie-combobox .ts-dropdown .option,.formie-field .ts-wrapper.formie-combobox .ts-dropdown .optgroup-header,.formie-field .ts-wrapper.formie-combobox .ts-dropdown .no-results{color:var(--formie-color-text);padding:var(--formie-space-2) var(--formie-control-padding-x)}.formie-field .ts-wrapper.formie-combobox .ts-dropdown [data-selectable]{cursor:pointer}.formie-field .ts-wrapper.formie-combobox .ts-dropdown .option.active,.formie-field .ts-wrapper.formie-combobox .ts-dropdown .option:hover,.formie-field .ts-wrapper.formie-combobox .ts-dropdown .active{background:var(--formie-color-surface-muted,#0f172a0d);color:var(--formie-color-text)}.formie-field .ts-wrapper.formie-combobox .ts-dropdown .highlight{background:#3b82f62e;border-radius:2px}.formie-field .ts-wrapper.formie-combobox.disabled .ts-control{opacity:.6;background-color:var(--formie-color-surface-muted,#0f172a0a);cursor:not-allowed}", Lt = "select[data-formie-combobox-input]", Q = "combobox", $ = e("fields", "combobox");
1876
+ t(Q, [It]);
1877
+ var Rt = [
1878
+ "formie-select",
1879
+ "formie-dropdown-input",
1880
+ "formie-input-error"
1881
+ ];
1882
+ function zt(e) {
1883
+ let t = [];
1884
+ return Rt.forEach((n) => {
1885
+ e.classList.contains(n) && (e.classList.remove(n), t.push(n));
1886
+ }), t;
1887
+ }
1888
+ function Bt(e, t) {
1889
+ t.forEach((t) => {
1890
+ e.classList.add(t);
1891
+ });
1892
+ }
1893
+ function Vt(e) {
1894
+ Rt.forEach((t) => {
1895
+ e.classList.remove(t);
1896
+ });
1897
+ }
1898
+ function Ht(e, t) {
1899
+ return t?.trim() || e.querySelector("option[value=\"\"]")?.textContent?.trim() || null;
1900
+ }
1901
+ function Ut(e) {
1902
+ e.options[""] && e.removeOption("", !0);
1903
+ }
1904
+ function Wt(e, t = {}) {
1905
+ e._formieTomSelect?.destroy();
1906
+ let n = t.multiple === !0, i = zt(e), a = Ht(e, t.placeholder), o = {
1907
+ create: !1,
1908
+ maxItems: n ? null : 1,
1909
+ plugins: n ? ["remove_button"] : [],
1910
+ hideSelected: n ? !0 : null,
1911
+ clearAfterSelect: n,
1912
+ closeAfterSelect: !n,
1913
+ allowEmptyOption: !n,
1914
+ openOnFocus: !0,
1915
+ diacritics: !0,
1916
+ copyClassesToDropdown: !1,
1917
+ wrapperClass: "ts-wrapper formie-combobox",
1918
+ onChange: () => {
1919
+ e.dispatchEvent(new Event("input", { bubbles: !0 })), e.dispatchEvent(new Event("change", { bubbles: !0 }));
1920
+ }
1921
+ };
1922
+ a && (o.placeholder = a), r(e, Q, "before-init", {
1923
+ select: e,
1924
+ options: o
1925
+ });
1926
+ let s = new Ft(e, o);
1927
+ return Ut(s), Vt(s.wrapper), s.dropdown && Vt(s.dropdown), e.style.display = "none", e._formieTomSelect = s, $.log("Initialized.", {
1928
+ inputName: e.name,
1929
+ multiple: n
1930
+ }), r(e, Q, "after-init", {
1931
+ combobox: s,
1932
+ options: o
1933
+ }), () => {
1934
+ s.destroy(), e.style.removeProperty("display"), Bt(e, i), delete e._formieTomSelect, $.log("Destroyed.", { inputName: e.name });
1935
+ };
1936
+ }
1937
+ var Gt = {
1938
+ id: Q,
1939
+ kind: "field",
1940
+ match: (e) => !!e.target.querySelector(Lt),
1941
+ setup: async (e) => {
1942
+ let t = e.options || {}, r = n(e), i = r.map((e) => {
1943
+ let n = e.querySelector(Lt);
1944
+ return n instanceof HTMLSelectElement ? Wt(n, t) : ($.warn("Field missing combobox select; skipping."), () => {});
1945
+ });
1946
+ return $.log("Module setup.", { fieldCount: r.length }), await e.emit("formie:module:combobox:init", { count: i.length }), { destroy: () => {
1947
+ i.forEach((e) => {
1948
+ e();
1949
+ }), $.log("Module destroy.", { fieldCount: r.length }), e.emit("formie:module:combobox:destroy", {});
1950
+ } };
1951
+ }
1952
+ };
1953
+ //#endregion
1954
+ export { Gt as comboboxModule, Wt as initFormieCombobox };