tom-select-rails 2.2.1 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tom-select-rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.complete.js +691 -859
  4. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.complete.js.map +1 -1
  5. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.js +487 -723
  6. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.js.map +1 -1
  7. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.popular.js +512 -743
  8. data/vendor/assets/javascripts/tom-select-rails/cjs/tom-select.popular.js.map +1 -1
  9. data/vendor/assets/javascripts/tom-select-rails/cjs/utils.js +32 -28
  10. data/vendor/assets/javascripts/tom-select-rails/cjs/utils.js.map +1 -1
  11. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/caret_position/plugin.js +67 -23
  12. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/caret_position/plugin.js.map +1 -1
  13. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/change_listener/plugin.js +4 -3
  14. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/change_listener/plugin.js.map +1 -1
  15. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/checkbox_options/plugin.js +103 -41
  16. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/checkbox_options/plugin.js.map +1 -1
  17. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/clear_button/plugin.js +59 -20
  18. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/clear_button/plugin.js.map +1 -1
  19. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/drag_drop/plugin.js +249 -29
  20. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/drag_drop/plugin.js.map +1 -1
  21. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_header/plugin.js +59 -18
  22. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_header/plugin.js.map +1 -1
  23. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_input/plugin.js +72 -32
  24. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/dropdown_input/plugin.js.map +1 -1
  25. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/input_autogrow/plugin.js +5 -7
  26. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/input_autogrow/plugin.js.map +1 -1
  27. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_active_items/plugin.js +2 -1
  28. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_active_items/plugin.js.map +1 -1
  29. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_backspace_delete/plugin.js +2 -2
  30. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/no_backspace_delete/plugin.js.map +1 -1
  31. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/optgroup_columns/plugin.js +59 -22
  32. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/optgroup_columns/plugin.js.map +1 -1
  33. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/remove_button/plugin.js +68 -23
  34. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/remove_button/plugin.js.map +1 -1
  35. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/restore_on_backspace/plugin.js +2 -3
  36. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/restore_on_backspace/plugin.js.map +1 -1
  37. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/virtual_scroll/plugin.js +97 -57
  38. data/vendor/assets/javascripts/tom-select-rails/esm/plugins/virtual_scroll/plugin.js.map +1 -1
  39. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.complete.js +691 -859
  40. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.complete.js.map +1 -1
  41. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.js +487 -723
  42. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.js.map +1 -1
  43. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.popular.js +512 -743
  44. data/vendor/assets/javascripts/tom-select-rails/esm/tom-select.popular.js.map +1 -1
  45. data/vendor/assets/javascripts/tom-select-rails/esm/utils.js +32 -27
  46. data/vendor/assets/javascripts/tom-select-rails/esm/utils.js.map +1 -1
  47. data/vendor/assets/javascripts/tom-select-rails/js/plugins/caret_position.js +67 -23
  48. data/vendor/assets/javascripts/tom-select-rails/js/plugins/caret_position.js.map +1 -1
  49. data/vendor/assets/javascripts/tom-select-rails/js/plugins/change_listener.js +4 -3
  50. data/vendor/assets/javascripts/tom-select-rails/js/plugins/change_listener.js.map +1 -1
  51. data/vendor/assets/javascripts/tom-select-rails/js/plugins/checkbox_options.js +103 -41
  52. data/vendor/assets/javascripts/tom-select-rails/js/plugins/checkbox_options.js.map +1 -1
  53. data/vendor/assets/javascripts/tom-select-rails/js/plugins/clear_button.js +59 -20
  54. data/vendor/assets/javascripts/tom-select-rails/js/plugins/clear_button.js.map +1 -1
  55. data/vendor/assets/javascripts/tom-select-rails/js/plugins/drag_drop.js +249 -29
  56. data/vendor/assets/javascripts/tom-select-rails/js/plugins/drag_drop.js.map +1 -1
  57. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_header.js +59 -18
  58. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_header.js.map +1 -1
  59. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_input.js +72 -32
  60. data/vendor/assets/javascripts/tom-select-rails/js/plugins/dropdown_input.js.map +1 -1
  61. data/vendor/assets/javascripts/tom-select-rails/js/plugins/input_autogrow.js +5 -7
  62. data/vendor/assets/javascripts/tom-select-rails/js/plugins/input_autogrow.js.map +1 -1
  63. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_active_items.js +2 -1
  64. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_active_items.js.map +1 -1
  65. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_backspace_delete.js +2 -2
  66. data/vendor/assets/javascripts/tom-select-rails/js/plugins/no_backspace_delete.js.map +1 -1
  67. data/vendor/assets/javascripts/tom-select-rails/js/plugins/optgroup_columns.js +59 -22
  68. data/vendor/assets/javascripts/tom-select-rails/js/plugins/optgroup_columns.js.map +1 -1
  69. data/vendor/assets/javascripts/tom-select-rails/js/plugins/remove_button.js +68 -23
  70. data/vendor/assets/javascripts/tom-select-rails/js/plugins/remove_button.js.map +1 -1
  71. data/vendor/assets/javascripts/tom-select-rails/js/plugins/restore_on_backspace.js +2 -3
  72. data/vendor/assets/javascripts/tom-select-rails/js/plugins/restore_on_backspace.js.map +1 -1
  73. data/vendor/assets/javascripts/tom-select-rails/js/plugins/virtual_scroll.js +97 -57
  74. data/vendor/assets/javascripts/tom-select-rails/js/plugins/virtual_scroll.js.map +1 -1
  75. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.js +487 -723
  76. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.js.map +1 -1
  77. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.min.js +168 -160
  78. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.base.min.js.map +1 -1
  79. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.js +691 -859
  80. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.js.map +1 -1
  81. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.min.js +208 -190
  82. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.complete.min.js.map +1 -1
  83. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.js +512 -743
  84. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.js.map +1 -1
  85. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.min.js +180 -172
  86. data/vendor/assets/javascripts/tom-select-rails/js/tom-select.popular.min.js.map +1 -1
  87. data/vendor/assets/javascripts/tom-select-rails/types/contrib/microevent.d.ts +1 -1
  88. data/vendor/assets/javascripts/tom-select-rails/types/contrib/microplugin.d.ts +4 -4
  89. data/vendor/assets/javascripts/tom-select-rails/types/defaults.d.ts +1 -0
  90. data/vendor/assets/javascripts/tom-select-rails/types/getSettings.d.ts +2 -2
  91. data/vendor/assets/javascripts/tom-select-rails/types/plugins/checkbox_options/plugin.d.ts +3 -2
  92. data/vendor/assets/javascripts/tom-select-rails/types/plugins/checkbox_options/types.d.ts +14 -0
  93. data/vendor/assets/javascripts/tom-select-rails/types/plugins/clear_button/types.d.ts +1 -1
  94. data/vendor/assets/javascripts/tom-select-rails/types/plugins/dropdown_header/types.d.ts +1 -1
  95. data/vendor/assets/javascripts/tom-select-rails/types/plugins/remove_button/types.d.ts +1 -1
  96. data/vendor/assets/javascripts/tom-select-rails/types/plugins/restore_on_backspace/plugin.d.ts +1 -1
  97. data/vendor/assets/javascripts/tom-select-rails/types/tom-select.d.ts +12 -14
  98. data/vendor/assets/javascripts/tom-select-rails/types/types/core.d.ts +16 -12
  99. data/vendor/assets/javascripts/tom-select-rails/types/types/settings.d.ts +3 -2
  100. data/vendor/assets/javascripts/tom-select-rails/types/utils.d.ts +8 -1
  101. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.css +224 -216
  102. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.css.map +1 -1
  103. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.min.css +1 -1
  104. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap4.min.css.map +1 -1
  105. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.css +245 -252
  106. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.css.map +1 -1
  107. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.min.css +1 -1
  108. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.bootstrap5.min.css.map +1 -1
  109. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.css +213 -210
  110. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.css.map +1 -1
  111. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.css +223 -215
  112. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.css.map +1 -1
  113. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.min.css +1 -1
  114. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.default.min.css.map +1 -1
  115. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.min.css +1 -1
  116. data/vendor/assets/stylesheets/tom-select-rails/css/tom-select.min.css.map +1 -1
  117. data/vendor/assets/stylesheets/tom-select-rails/scss/_dropdown.scss +7 -10
  118. data/vendor/assets/stylesheets/tom-select-rails/scss/_items.scss +2 -5
  119. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/checkbox_options.scss +8 -2
  120. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/clear_button.scss +16 -14
  121. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/drag_drop.scss +6 -12
  122. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/dropdown_header.scss +3 -2
  123. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/dropdown_input.scss +7 -11
  124. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/input_autogrow.scss +0 -3
  125. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/optgroup_columns.scss +7 -5
  126. data/vendor/assets/stylesheets/tom-select-rails/scss/plugins/remove_button.scss +20 -20
  127. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.bootstrap4.scss +33 -39
  128. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.bootstrap5.scss +54 -80
  129. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.default.scss +16 -14
  130. data/vendor/assets/stylesheets/tom-select-rails/scss/tom-select.scss +52 -57
  131. metadata +8 -7
@@ -1,19 +1,68 @@
1
1
  /**
2
- * Tom Select v2.2.1
2
+ * Tom Select v2.3.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
6
6
  /*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
7
- const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}]'; // \u{2bc}
7
+ const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
8
8
  /** @type {TUnicodeMap} */
9
9
 
10
- const latin_convert = {
11
- 'æ': 'ae',
12
- 'ⱥ': 'a',
13
- 'ø': 'o',
14
- '': '/',
15
- '': '/'
10
+ const latin_convert = {};
11
+ /** @type {TUnicodeMap} */
12
+
13
+ const latin_condensed = {
14
+ '/': '⁄∕',
15
+ '0': '߀',
16
+ "a": "ⱥɐɑ",
17
+ "aa": "ꜳ",
18
+ "ae": "æǽǣ",
19
+ "ao": "ꜵ",
20
+ "au": "ꜷ",
21
+ "av": "ꜹꜻ",
22
+ "ay": "ꜽ",
23
+ "b": "ƀɓƃ",
24
+ "c": "ꜿƈȼↄ",
25
+ "d": "đɗɖᴅƌꮷԁɦ",
26
+ "e": "ɛǝᴇɇ",
27
+ "f": "ꝼƒ",
28
+ "g": "ǥɠꞡᵹꝿɢ",
29
+ "h": "ħⱨⱶɥ",
30
+ "i": "ɨı",
31
+ "j": "ɉȷ",
32
+ "k": "ƙⱪꝁꝃꝅꞣ",
33
+ "l": "łƚɫⱡꝉꝇꞁɭ",
34
+ "m": "ɱɯϻ",
35
+ "n": "ꞥƞɲꞑᴎлԉ",
36
+ "o": "øǿɔɵꝋꝍᴑ",
37
+ "oe": "œ",
38
+ "oi": "ƣ",
39
+ "oo": "ꝏ",
40
+ "ou": "ȣ",
41
+ "p": "ƥᵽꝑꝓꝕρ",
42
+ "q": "ꝗꝙɋ",
43
+ "r": "ɍɽꝛꞧꞃ",
44
+ "s": "ßȿꞩꞅʂ",
45
+ "t": "ŧƭʈⱦꞇ",
46
+ "th": "þ",
47
+ "tz": "ꜩ",
48
+ "u": "ʉ",
49
+ "v": "ʋꝟʌ",
50
+ "vy": "ꝡ",
51
+ "w": "ⱳ",
52
+ "y": "ƴɏỿ",
53
+ "z": "ƶȥɀⱬꝣ",
54
+ "hv": "ƕ"
16
55
  };
56
+
57
+ for (let latin in latin_condensed) {
58
+ let unicode = latin_condensed[latin] || '';
59
+
60
+ for (let i = 0; i < unicode.length; i++) {
61
+ let char = unicode.substring(i, i + 1);
62
+ latin_convert[char] = latin;
63
+ }
64
+ }
65
+
17
66
  new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
18
67
 
19
68
  /**
@@ -26,7 +75,6 @@ new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
26
75
  * ```
27
76
  *
28
77
  */
29
-
30
78
  const iterate = (object, callback) => {
31
79
  if (Array.isArray(object)) {
32
80
  object.forEach(callback);
@@ -43,7 +91,6 @@ const iterate = (object, callback) => {
43
91
  * Add css classes
44
92
  *
45
93
  */
46
-
47
94
  const addClasses = (elmts, ...classes) => {
48
95
  var norm_classes = classesArray(classes);
49
96
  elmts = castAsArray(elmts);
@@ -53,34 +100,32 @@ const addClasses = (elmts, ...classes) => {
53
100
  });
54
101
  });
55
102
  };
103
+
56
104
  /**
57
105
  * Return arguments
58
106
  *
59
107
  */
60
-
61
108
  const classesArray = args => {
62
109
  var classes = [];
63
110
  iterate(args, _classes => {
64
111
  if (typeof _classes === 'string') {
65
112
  _classes = _classes.trim().split(/[\11\12\14\15\40]/);
66
113
  }
67
-
68
114
  if (Array.isArray(_classes)) {
69
115
  classes = classes.concat(_classes);
70
116
  }
71
117
  });
72
118
  return classes.filter(Boolean);
73
119
  };
120
+
74
121
  /**
75
122
  * Create an array from arg if it's not already an array
76
123
  *
77
124
  */
78
-
79
125
  const castAsArray = arg => {
80
126
  if (!Array.isArray(arg)) {
81
127
  arg = [arg];
82
128
  }
83
-
84
129
  return arg;
85
130
  };
86
131
 
@@ -98,6 +143,7 @@ const castAsArray = arg => {
98
143
  * governing permissions and limitations under the License.
99
144
  *
100
145
  */
146
+
101
147
  function plugin () {
102
148
  const self = this;
103
149
  const orig_canLoad = self.canLoad;
@@ -108,128 +154,120 @@ function plugin () {
108
154
  var loading_more = false;
109
155
  var load_more_opt;
110
156
  var default_values = [];
111
-
112
157
  if (!self.settings.shouldLoadMore) {
113
158
  // return true if additional results should be loaded
114
159
  self.settings.shouldLoadMore = () => {
115
160
  const scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop);
116
-
117
161
  if (scroll_percent > 0.9) {
118
162
  return true;
119
163
  }
120
-
121
164
  if (self.activeOption) {
122
165
  var selectable = self.selectable();
123
166
  var index = Array.from(selectable).indexOf(self.activeOption);
124
-
125
167
  if (index >= selectable.length - 2) {
126
168
  return true;
127
169
  }
128
170
  }
129
-
130
171
  return false;
131
172
  };
132
173
  }
133
-
134
174
  if (!self.settings.firstUrl) {
135
175
  throw 'virtual_scroll plugin requires a firstUrl() method';
136
- } // in order for virtual scrolling to work,
137
- // options need to be ordered the same way they're returned from the remote data source
138
-
176
+ }
139
177
 
178
+ // in order for virtual scrolling to work,
179
+ // options need to be ordered the same way they're returned from the remote data source
140
180
  self.settings.sortField = [{
141
181
  field: '$order'
142
182
  }, {
143
183
  field: '$score'
144
- }]; // can we load more results for given query?
184
+ }];
145
185
 
186
+ // can we load more results for given query?
146
187
  const canLoadMore = query => {
147
188
  if (typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) {
148
189
  return false;
149
190
  }
150
-
151
191
  if (query in pagination && pagination[query]) {
152
192
  return true;
153
193
  }
154
-
155
194
  return false;
156
195
  };
157
-
158
196
  const clearFilter = (option, value) => {
159
197
  if (self.items.indexOf(value) >= 0 || default_values.indexOf(value) >= 0) {
160
198
  return true;
161
199
  }
162
-
163
200
  return false;
164
- }; // set the next url that will be
165
-
201
+ };
166
202
 
203
+ // set the next url that will be
167
204
  self.setNextUrl = (value, next_url) => {
168
205
  pagination[value] = next_url;
169
- }; // getUrl() to be used in settings.load()
170
-
206
+ };
171
207
 
208
+ // getUrl() to be used in settings.load()
172
209
  self.getUrl = query => {
173
210
  if (query in pagination) {
174
211
  const next_url = pagination[query];
175
212
  pagination[query] = false;
176
213
  return next_url;
177
- } // if the user goes back to a previous query
178
- // we need to load the first page again
179
-
214
+ }
180
215
 
181
- pagination = {};
216
+ // if the user goes back to a previous query
217
+ // we need to load the first page again
218
+ self.clearPagination();
182
219
  return self.settings.firstUrl.call(self, query);
183
- }; // don't clear the active option (and cause unwanted dropdown scroll)
184
- // while loading more results
220
+ };
185
221
 
222
+ // clear pagination
223
+ self.clearPagination = () => {
224
+ pagination = {};
225
+ };
186
226
 
227
+ // don't clear the active option (and cause unwanted dropdown scroll)
228
+ // while loading more results
187
229
  self.hook('instead', 'clearActiveOption', () => {
188
230
  if (loading_more) {
189
231
  return;
190
232
  }
191
-
192
233
  return orig_clearActiveOption.call(self);
193
- }); // override the canLoad method
234
+ });
194
235
 
236
+ // override the canLoad method
195
237
  self.hook('instead', 'canLoad', query => {
196
238
  // first time the query has been seen
197
239
  if (!(query in pagination)) {
198
240
  return orig_canLoad.call(self, query);
199
241
  }
200
-
201
242
  return canLoadMore(query);
202
- }); // wrap the load
243
+ });
203
244
 
245
+ // wrap the load
204
246
  self.hook('instead', 'loadCallback', (options, optgroups) => {
205
247
  if (!loading_more) {
206
248
  self.clearOptions(clearFilter);
207
249
  } else if (load_more_opt) {
208
250
  const first_option = options[0];
209
-
210
251
  if (first_option !== undefined) {
211
252
  load_more_opt.dataset.value = first_option[self.settings.valueField];
212
253
  }
213
254
  }
214
-
215
255
  orig_loadCallback.call(self, options, optgroups);
216
256
  loading_more = false;
217
- }); // add templates to dropdown
257
+ });
258
+
259
+ // add templates to dropdown
218
260
  // loading_more if we have another url in the queue
219
261
  // no_more_results if we don't have another url in the queue
220
-
221
262
  self.hook('after', 'refreshOptions', () => {
222
263
  const query = self.lastValue;
223
264
  var option;
224
-
225
265
  if (canLoadMore(query)) {
226
266
  option = self.render('loading_more', {
227
267
  query: query
228
268
  });
229
-
230
269
  if (option) {
231
270
  option.setAttribute('data-selectable', ''); // so that navigating dropdown with [down] keypresses can navigate to this node
232
-
233
271
  load_more_opt = option;
234
272
  }
235
273
  } else if (query in pagination && !dropdown_content.querySelector('.no-results')) {
@@ -237,17 +275,18 @@ function plugin () {
237
275
  query: query
238
276
  });
239
277
  }
240
-
241
278
  if (option) {
242
279
  addClasses(option, self.settings.optionClass);
243
280
  dropdown_content.append(option);
244
281
  }
245
- }); // add scroll listener and default templates
282
+ });
246
283
 
284
+ // add scroll listener and default templates
247
285
  self.on('initialize', () => {
248
286
  default_values = Object.keys(self.options);
249
- dropdown_content = self.dropdown_content; // default templates
287
+ dropdown_content = self.dropdown_content;
250
288
 
289
+ // default templates
251
290
  self.settings.render = Object.assign({}, {
252
291
  loading_more: () => {
253
292
  return `<div class="loading-more-results">Loading more results ... </div>`;
@@ -255,19 +294,20 @@ function plugin () {
255
294
  no_more_results: () => {
256
295
  return `<div class="no-more-results">No more results</div>`;
257
296
  }
258
- }, self.settings.render); // watch dropdown content scroll position
297
+ }, self.settings.render);
259
298
 
299
+ // watch dropdown content scroll position
260
300
  dropdown_content.addEventListener('scroll', () => {
261
301
  if (!self.settings.shouldLoadMore.call(self)) {
262
302
  return;
263
- } // !important: this will get checked again in load() but we still need to check here otherwise loading_more will be set to true
264
-
303
+ }
265
304
 
305
+ // !important: this will get checked again in load() but we still need to check here otherwise loading_more will be set to true
266
306
  if (!canLoadMore(self.lastValue)) {
267
307
  return;
268
- } // don't call load() too much
269
-
308
+ }
270
309
 
310
+ // don't call load() too much
271
311
  if (loading_more) return;
272
312
  loading_more = true;
273
313
  self.load.call(self, self.lastValue);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../../node_modules/@orchidjs/unicode-variants/dist/esm/index.js","../../../../node_modules/@orchidjs/sifter/lib/utils.ts","../../../../src/vanilla.ts","../../../../src/plugins/virtual_scroll/plugin.ts"],"sourcesContent":["/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\nimport { toArray, setToPattern, escape_regex, arrayToPattern, sequencePattern } from './regex.js';\nexport { escape_regex } from './regex.js';\nimport { allSubstrings } from './strings.js';\n\n/**\n * @typedef {{[key:string]:string}} TUnicodeMap\n * @typedef {{[key:string]:Set<string>}} TUnicodeSets\n * @typedef {[[number,number]]} TCodePoints\n * @typedef {{folded:string,composed:string,code_point:number}} TCodePointObj\n * @typedef {{start:number,end:number,length:number,substr:string}} TSequencePart\n */\n/** @type {TCodePoints} */\n\nconst code_points = [[0, 65535]];\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}]'; // \\u{2bc}\n\n/** @type {TUnicodeMap} */\n\nlet unicode_map;\n/** @type {RegExp} */\n\nlet multi_char_reg;\nconst max_char_length = 3;\n/** @type {TUnicodeMap} */\n\nconst latin_convert = {\n 'æ': 'ae',\n 'ⱥ': 'a',\n 'ø': 'o',\n '⁄': '/',\n '∕': '/'\n};\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');\n/**\n * Initialize the unicode_map from the give code point ranges\n *\n * @param {TCodePoints=} _code_points\n */\n\nconst initialize = _code_points => {\n if (unicode_map !== undefined) return;\n unicode_map = generateMap(_code_points || code_points);\n};\n/**\n * Helper method for normalize a string\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n * @param {string} str\n * @param {string} form\n */\n\nconst normalize = (str, form = 'NFKD') => str.normalize(form);\n/**\n * Compatibility Decomposition without reordering string\n * calling str.normalize('NFKD') on \\u{594}\\u{595}\\u{596} becomes \\u{596}\\u{594}\\u{595}\n * @param {string} str\n */\n\nconst decompose = str => {\n if (str.match(/[\\u0f71-\\u0f81]/)) {\n return toArray(str).reduce(\n /**\n * @param {string} result\n * @param {string} char\n */\n (result, char) => {\n return result + normalize(char);\n }, '');\n }\n\n return normalize(str);\n};\n/**\n * Remove accents\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n * @param {string} str\n * @return {string}\n */\n\nconst asciifold = str => {\n return decompose(str).toLowerCase().replace(convert_pat, (\n /** @type {string} */\n char) => {\n return latin_convert[char] || '';\n });\n};\n/**\n * Generate a list of unicode variants from the list of code points\n * @param {TCodePoints} code_points\n * @yield {TCodePointObj}\n */\n\nfunction* generator(code_points) {\n for (const [code_point_min, code_point_max] of code_points) {\n for (let i = code_point_min; i <= code_point_max; i++) {\n let composed = String.fromCharCode(i);\n let folded = asciifold(composed);\n\n if (folded == composed.toLowerCase()) {\n continue;\n } // skip when folded is a string longer than 3 characters long\n // bc the resulting regex patterns will be long\n // eg:\n // folded صلى الله عليه وسلم length 18 code point 65018\n // folded جل جلاله length 8 code point 65019\n\n\n if (folded.length > max_char_length) {\n continue;\n }\n\n if (folded.length == 0) {\n continue;\n }\n\n let decomposed = normalize(composed);\n let recomposed = normalize(decomposed, 'NFC');\n\n if (recomposed === composed && folded === decomposed) {\n continue;\n }\n\n yield {\n folded: folded,\n composed: composed,\n code_point: i\n };\n }\n }\n}\n/**\n * Generate a unicode map from the list of code points\n * @param {TCodePoints} code_points\n * @return {TUnicodeSets}\n */\n\nconst generateSets = code_points => {\n /** @type {{[key:string]:Set<string>}} */\n const unicode_sets = {};\n /**\n * @param {string} folded\n * @param {string} to_add\n */\n\n const addMatching = (folded, to_add) => {\n /** @type {Set<string>} */\n const folded_set = unicode_sets[folded] || new Set();\n const patt = new RegExp('^' + setToPattern(folded_set) + '$', 'iu');\n\n if (to_add.match(patt)) {\n return;\n }\n\n folded_set.add(escape_regex(to_add));\n unicode_sets[folded] = folded_set;\n };\n\n for (let value of generator(code_points)) {\n addMatching(value.folded, value.folded);\n addMatching(value.folded, value.composed);\n }\n\n return unicode_sets;\n};\n/**\n * Generate a unicode map from the list of code points\n * ae => (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n *\n * @param {TCodePoints} code_points\n * @return {TUnicodeMap}\n */\n\nconst generateMap = code_points => {\n /** @type {TUnicodeSets} */\n const unicode_sets = generateSets(code_points);\n /** @type {TUnicodeMap} */\n\n const unicode_map = {};\n /** @type {string[]} */\n\n let multi_char = [];\n\n for (let folded in unicode_sets) {\n let set = unicode_sets[folded];\n\n if (set) {\n unicode_map[folded] = setToPattern(set);\n }\n\n if (folded.length > 1) {\n multi_char.push(escape_regex(folded));\n }\n }\n\n multi_char.sort((a, b) => b.length - a.length);\n const multi_char_patt = arrayToPattern(multi_char);\n multi_char_reg = new RegExp('^' + multi_char_patt, 'u');\n return unicode_map;\n};\n/**\n * Map each element of an array from it's folded value to all possible unicode matches\n * @param {string[]} strings\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst mapSequence = (strings, min_replacement = 1) => {\n let chars_replaced = 0;\n strings = strings.map(str => {\n if (unicode_map[str]) {\n chars_replaced += str.length;\n }\n\n return unicode_map[str] || str;\n });\n\n if (chars_replaced >= min_replacement) {\n return sequencePattern(strings);\n }\n\n return '';\n};\n/**\n * Convert a short string and split it into all possible patterns\n * Keep a pattern only if min_replacement is met\n *\n * 'abc'\n * \t\t=> [['abc'],['ab','c'],['a','bc'],['a','b','c']]\n *\t\t=> ['abc-pattern','ab-c-pattern'...]\n *\n *\n * @param {string} str\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst substringsToPattern = (str, min_replacement = 1) => {\n min_replacement = Math.max(min_replacement, str.length - 1);\n return arrayToPattern(allSubstrings(str).map(sub_pat => {\n return mapSequence(sub_pat, min_replacement);\n }));\n};\n/**\n * Convert an array of sequences into a pattern\n * [{start:0,end:3,length:3,substr:'iii'}...] => (?:iii...)\n *\n * @param {Sequence[]} sequences\n * @param {boolean} all\n */\n\nconst sequencesToPattern = (sequences, all = true) => {\n let min_replacement = sequences.length > 1 ? 1 : 0;\n return arrayToPattern(sequences.map(sequence => {\n let seq = [];\n const len = all ? sequence.length() : sequence.length() - 1;\n\n for (let j = 0; j < len; j++) {\n seq.push(substringsToPattern(sequence.substrs[j] || '', min_replacement));\n }\n\n return sequencePattern(seq);\n }));\n};\n/**\n * Return true if the sequence is already in the sequences\n * @param {Sequence} needle_seq\n * @param {Sequence[]} sequences\n */\n\n\nconst inSequences = (needle_seq, sequences) => {\n for (const seq of sequences) {\n if (seq.start != needle_seq.start || seq.end != needle_seq.end) {\n continue;\n }\n\n if (seq.substrs.join('') !== needle_seq.substrs.join('')) {\n continue;\n }\n\n let needle_parts = needle_seq.parts;\n /**\n * @param {TSequencePart} part\n */\n\n const filter = part => {\n for (const needle_part of needle_parts) {\n if (needle_part.start === part.start && needle_part.substr === part.substr) {\n return false;\n }\n\n if (part.length == 1 || needle_part.length == 1) {\n continue;\n } // check for overlapping parts\n // a = ['::=','==']\n // b = ['::','===']\n // a = ['r','sm']\n // b = ['rs','m']\n\n\n if (part.start < needle_part.start && part.end > needle_part.start) {\n return true;\n }\n\n if (needle_part.start < part.start && needle_part.end > part.start) {\n return true;\n }\n }\n\n return false;\n };\n\n let filtered = seq.parts.filter(filter);\n\n if (filtered.length > 0) {\n continue;\n }\n\n return true;\n }\n\n return false;\n};\n\nclass Sequence {\n constructor() {\n /** @type {TSequencePart[]} */\n this.parts = [];\n /** @type {string[]} */\n\n this.substrs = [];\n this.start = 0;\n this.end = 0;\n }\n /**\n * @param {TSequencePart|undefined} part\n */\n\n\n add(part) {\n if (part) {\n this.parts.push(part);\n this.substrs.push(part.substr);\n this.start = Math.min(part.start, this.start);\n this.end = Math.max(part.end, this.end);\n }\n }\n\n last() {\n return this.parts[this.parts.length - 1];\n }\n\n length() {\n return this.parts.length;\n }\n /**\n * @param {number} position\n * @param {TSequencePart} last_piece\n */\n\n\n clone(position, last_piece) {\n let clone = new Sequence();\n let parts = JSON.parse(JSON.stringify(this.parts));\n let last_part = parts.pop();\n\n for (const part of parts) {\n clone.add(part);\n }\n\n let last_substr = last_piece.substr.substring(0, position - last_part.start);\n let clone_last_len = last_substr.length;\n clone.add({\n start: last_part.start,\n end: last_part.start + clone_last_len,\n length: clone_last_len,\n substr: last_substr\n });\n return clone;\n }\n\n}\n/**\n * Expand a regular expression pattern to include unicode variants\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n * Issue:\n * ﺊﺋ [ 'ﺊ = \\\\u{fe8a}', 'ﺋ = \\\\u{fe8b}' ]\n *\tbecomes:\tئئ [ 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}', 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}' ]\n *\n *\tİIJ = IIJ = ⅡJ\n *\n * \t1/2/4\n *\n * @param {string} str\n * @return {string|undefined}\n */\n\n\nconst getPattern = str => {\n initialize();\n str = asciifold(str);\n let pattern = '';\n let sequences = [new Sequence()];\n\n for (let i = 0; i < str.length; i++) {\n let substr = str.substring(i);\n let match = substr.match(multi_char_reg);\n const char = str.substring(i, i + 1);\n const match_str = match ? match[0] : null; // loop through sequences\n // add either the char or multi_match\n\n let overlapping = [];\n let added_types = new Set();\n\n for (const sequence of sequences) {\n const last_piece = sequence.last();\n\n if (!last_piece || last_piece.length == 1 || last_piece.end <= i) {\n // if we have a multi match\n if (match_str) {\n const len = match_str.length;\n sequence.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n added_types.add('1');\n } else {\n sequence.add({\n start: i,\n end: i + 1,\n length: 1,\n substr: char\n });\n added_types.add('2');\n }\n } else if (match_str) {\n let clone = sequence.clone(i, last_piece);\n const len = match_str.length;\n clone.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n overlapping.push(clone);\n } else {\n // don't add char\n // adding would create invalid patterns: 234 => [2,34,4]\n added_types.add('3');\n }\n } // if we have overlapping\n\n\n if (overlapping.length > 0) {\n // ['ii','iii'] before ['i','i','iii']\n overlapping = overlapping.sort((a, b) => {\n return a.length() - b.length();\n });\n\n for (let clone of overlapping) {\n // don't add if we already have an equivalent sequence\n if (inSequences(clone, sequences)) {\n continue;\n }\n\n sequences.push(clone);\n }\n\n continue;\n } // if we haven't done anything unique\n // clean up the patterns\n // helps keep patterns smaller\n // if str = 'r₨㎧aarss', pattern will be 446 instead of 655\n\n\n if (i > 0 && added_types.size == 1 && !added_types.has('3')) {\n pattern += sequencesToPattern(sequences, false);\n let new_seq = new Sequence();\n const old_seq = sequences[0];\n\n if (old_seq) {\n new_seq.add(old_seq.last());\n }\n\n sequences = [new_seq];\n }\n }\n\n pattern += sequencesToPattern(sequences, true);\n return pattern;\n};\n\nexport { asciifold, code_points, decompose, generateMap, generateSets, generator, getPattern, initialize, mapSequence, normalize, substringsToPattern, unicode_map };\n//# sourceMappingURL=index.js.map\n","\nimport { asciifold } from '@orchidjs/unicode-variants';\nimport * as T from './types';\n\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttr = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n return obj[name];\n};\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttrNesting = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n var part, names = name.split(\".\");\n\twhile( (part = names.shift()) && (obj = obj[part]));\n return obj;\n};\n\n/**\n * Calculates how close of a match the\n * given value is against a search token.\n *\n */\nexport const scoreValue = (value:string, token:T.Token, weight:number ):number => {\n\tvar score, pos;\n\n\tif (!value) return 0;\n\n\tvalue = value + '';\n\tif( token.regex == null ) return 0;\n\tpos = value.search(token.regex);\n\tif (pos === -1) return 0;\n\n\tscore = token.string.length / value.length;\n\tif (pos === 0) score += 0.5;\n\n\treturn score * weight;\n};\n\n\n/**\n * Cast object property to an array if it exists and has a value\n *\n */\nexport const propToArray = (obj:{[key:string]:any}, key:string) => {\n\tvar value = obj[key];\n\n\tif( typeof value == 'function' ) return value;\n\n\tif( value && !Array.isArray(value) ){\n\t\tobj[key] = [value];\n\t}\n}\n\n\n/**\n * Iterates over arrays and hashes.\n *\n * ```\n * iterate(this.items, function(item, id) {\n * // invoked for each item\n * });\n * ```\n *\n */\nexport const iterate = (object:[]|{[key:string]:any}, callback:(value:any,key:any)=>any) => {\n\n\tif ( Array.isArray(object)) {\n\t\tobject.forEach(callback);\n\n\t}else{\n\n\t\tfor (var key in object) {\n\t\t\tif (object.hasOwnProperty(key)) {\n\t\t\t\tcallback(object[key], key);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\n\nexport const cmp = (a:number|string, b:number|string) => {\n\tif (typeof a === 'number' && typeof b === 'number') {\n\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t}\n\ta = asciifold(a + '').toLowerCase();\n\tb = asciifold(b + '').toLowerCase();\n\tif (a > b) return 1;\n\tif (b > a) return -1;\n\treturn 0;\n};\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tvar tpl = document.createElement('template');\n\t\ttpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn tpl.content.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","/**\n * Plugin: \"restore_on_backspace\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport { TomOption } from '../../types/index';\nimport { addClasses } from '../../vanilla';\n\nexport default function(this:TomSelect) {\n\tconst self\t\t\t\t\t\t\t= this;\n\tconst orig_canLoad\t\t\t\t\t= self.canLoad;\n\tconst orig_clearActiveOption\t\t= self.clearActiveOption;\n\tconst orig_loadCallback\t\t\t\t= self.loadCallback;\n\n\tvar pagination:{[key:string]:any}\t= {};\n\tvar dropdown_content:HTMLElement;\n\tvar loading_more\t\t\t\t\t= false;\n\tvar load_more_opt:HTMLElement;\n\tvar default_values: string[]\t\t= [];\n\n\tif( !self.settings.shouldLoadMore ){\n\n\t\t// return true if additional results should be loaded\n\t\tself.settings.shouldLoadMore = ():boolean=>{\n\n\t\t\tconst scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop);\n\t\t\tif( scroll_percent > 0.9 ){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif( self.activeOption ){\n\t\t\t\tvar selectable\t= self.selectable();\n\t\t\t\tvar index\t\t= Array.from(selectable).indexOf(self.activeOption);\n\t\t\t\tif( index >= (selectable.length-2) ){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t}\n\n\n\tif( !self.settings.firstUrl ){\n\t\tthrow 'virtual_scroll plugin requires a firstUrl() method';\n\t}\n\n\n\t// in order for virtual scrolling to work,\n\t// options need to be ordered the same way they're returned from the remote data source\n\tself.settings.sortField\t\t\t= [{field:'$order'},{field:'$score'}];\n\n\n\t// can we load more results for given query?\n\tconst canLoadMore = (query:string):boolean => {\n\n\t\tif( typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions ){\n\t\t\treturn false;\n\t\t}\n\n\t\tif( (query in pagination) && pagination[query] ){\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t};\n\n\tconst clearFilter = (option:TomOption, value:string):boolean => {\n\t\tif( self.items.indexOf(value) >= 0 || default_values.indexOf(value) >= 0 ){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n\n\n\t// set the next url that will be\n\tself.setNextUrl = (value:string,next_url:any):void => {\n\t\tpagination[value] = next_url;\n\t};\n\n\t// getUrl() to be used in settings.load()\n\tself.getUrl = (query:string):any =>{\n\n\t\tif( query in pagination ){\n\t\t\tconst next_url = pagination[query];\n\t\t\tpagination[query] = false;\n\t\t\treturn next_url;\n\t\t}\n\n\t\t// if the user goes back to a previous query\n\t\t// we need to load the first page again\n\t\tpagination = {};\n\n\t\treturn self.settings.firstUrl.call(self,query);\n\t};\n\n\n\t// don't clear the active option (and cause unwanted dropdown scroll)\n\t// while loading more results\n\tself.hook('instead','clearActiveOption',()=>{\n\n\t\tif( loading_more ){\n\t\t\treturn;\n\t\t}\n\n\t\treturn orig_clearActiveOption.call(self);\n\t});\n\n\t// override the canLoad method\n\tself.hook('instead','canLoad',(query:string)=>{\n\n\t\t// first time the query has been seen\n\t\tif( !(query in pagination) ){\n\t\t\treturn orig_canLoad.call(self,query);\n\t\t}\n\n\t\treturn canLoadMore(query);\n\t});\n\n\n\t// wrap the load\n\tself.hook('instead','loadCallback',( options:TomOption[], optgroups:TomOption[])=>{\n\n\t\tif( !loading_more ){\n\t\t\tself.clearOptions(clearFilter);\n\t\t}else if( load_more_opt ){\n\t\t\tconst first_option = options[0];\n\t\t\tif( first_option !== undefined ){\n\t\t\t\tload_more_opt.dataset.value\t\t= first_option[self.settings.valueField];\n\t\t\t}\n\t\t}\n\n\t\torig_loadCallback.call( self, options, optgroups);\n\n\t\tloading_more = false;\n\t});\n\n\n\t// add templates to dropdown\n\t//\tloading_more if we have another url in the queue\n\t//\tno_more_results if we don't have another url in the queue\n\tself.hook('after','refreshOptions',()=>{\n\n\t\tconst query\t\t= self.lastValue;\n\t\tvar option;\n\n\t\tif( canLoadMore(query) ){\n\n\t\t\toption = self.render('loading_more',{query:query});\n\t\t\tif( option ){\n\t\t\t\toption.setAttribute('data-selectable',''); // so that navigating dropdown with [down] keypresses can navigate to this node\n\t\t\t\tload_more_opt = option;\n\t\t\t}\n\n\t\t}else if( (query in pagination) && !dropdown_content.querySelector('.no-results') ){\n\t\t\toption = self.render('no_more_results',{query:query});\n\t\t}\n\n\t\tif( option ){\n\t\t\taddClasses(option,self.settings.optionClass);\n\t\t\tdropdown_content.append( option );\n\t\t}\n\n\t});\n\n\n\t// add scroll listener and default templates\n\tself.on('initialize',()=>{\n\t\tdefault_values = Object.keys(self.options);\n\t\tdropdown_content = self.dropdown_content;\n\n\t\t// default templates\n\t\tself.settings.render = Object.assign({}, {\n\t\t\tloading_more:() => {\n\t\t\t\treturn `<div class=\"loading-more-results\">Loading more results ... </div>`;\n\t\t\t},\n\t\t\tno_more_results:() =>{\n\t\t\t\treturn `<div class=\"no-more-results\">No more results</div>`;\n\t\t\t}\n\t\t},self.settings.render);\n\n\n\t\t// watch dropdown content scroll position\n\t\tdropdown_content.addEventListener('scroll',()=>{\n\n\t\t\tif( !self.settings.shouldLoadMore.call(self) ){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// !important: this will get checked again in load() but we still need to check here otherwise loading_more will be set to true\n\t\t\tif( !canLoadMore(self.lastValue) ){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// don't call load() too much\n\t\t\tif( loading_more ) return;\n\n\n\t\t\tloading_more = true;\n\t\t\tself.load.call(self,self.lastValue);\n\t\t});\n\t});\n\n};\n"],"names":["iterate","object","callback","Array","isArray","forEach","key","hasOwnProperty","addClasses","elmts","classes","norm_classes","classesArray","castAsArray","map","el","cls","classList","add","args","_classes","trim","split","concat","filter","Boolean","arg","self","orig_canLoad","canLoad","orig_clearActiveOption","clearActiveOption","orig_loadCallback","loadCallback","pagination","dropdown_content","loading_more","load_more_opt","default_values","settings","shouldLoadMore","scroll_percent","clientHeight","scrollHeight","scrollTop","activeOption","selectable","index","from","indexOf","length","firstUrl","sortField","field","canLoadMore","query","maxOptions","children","clearFilter","option","value","items","setNextUrl","next_url","getUrl","call","hook","options","optgroups","clearOptions","first_option","undefined","dataset","valueField","lastValue","render","setAttribute","querySelector","optionClass","append","on","Object","keys","assign","no_more_results","addEventListener","load"],"mappings":";;;;;AAAA;AAeA,MAAM,UAAU,GAAG,8BAA8B,CAAC;AASlD;AACA;AACA,MAAM,aAAa,GAAG;AACtB,EAAE,GAAG,EAAE,IAAI;AACX,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,GAAG,EAAE,GAAG;AACV,EAAE,GAAG,EAAE,GAAG;AACV,CAAC,CAAC;AACkB,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,UAAU,EAAE,IAAI;;ACiC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMA,OAAO,GAAG,CAACC,MAAD,EAA+BC,QAA/B,KAAqE;AAE3F,EAAA,IAAKC,KAAK,CAACC,OAAN,CAAcH,MAAd,CAAL,EAA4B;AAC3BA,IAAAA,MAAM,CAACI,OAAP,CAAeH,QAAf,CAAA,CAAA;AAEA,GAHD,MAGK;AAEJ,IAAA,KAAK,IAAII,GAAT,IAAgBL,MAAhB,EAAwB;AACvB,MAAA,IAAIA,MAAM,CAACM,cAAP,CAAsBD,GAAtB,CAAJ,EAAgC;AAC/BJ,QAAAA,QAAQ,CAACD,MAAM,CAACK,GAAD,CAAP,EAAcA,GAAd,CAAR,CAAA;AACA,OAAA;AACD,KAAA;AACD,GAAA;AACD,CAbM;;AClBP;AACA;AACA;AACA;;AACO,MAAME,UAAU,GAAG,CAAEC,KAAF,EAAmC,GAAGC,OAAtC,KAAuE;AAEhG,EAAA,IAAIC,YAAY,GAAIC,YAAY,CAACF,OAAD,CAAhC,CAAA;AACAD,EAAAA,KAAK,GAAMI,WAAW,CAACJ,KAAD,CAAtB,CAAA;AAEAA,EAAAA,KAAK,CAACK,GAAN,CAAWC,EAAE,IAAI;AAChB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D,EAAL,CAAQ,YAAR,EAAqB,MAAI;AACxB1C,IAAAA,cAAc,GAAG2C,MAAM,CAACC,IAAP,CAAYvD,IAAI,CAACwC,OAAjB,CAAjB,CAAA;AACAhC,IAAAA,gBAAgB,GAAGR,IAAI,CAACQ,gBAAxB,CAFwB;;AAKxBR,IAAAA,IAAI,CAACY,QAAL,CAAcoC,MAAd,GAAuBM,MAAM,CAACE,MAAP,CAAc,EAAd,EAAkB;AACxC/C,MAAAA,YAAY,EAAC,MAAM;AAClB,QAAA,OAAQ,CAAR,iEAAA,CAAA,CAAA;AACA,OAHuC;AAIxCgD,MAAAA,eAAe,EAAC,MAAK;AACpB,QAAA,OAAQ,CAAR,kDAAA,CAAA,CAAA;AACA,OAAA;AANuC,KAAlB,EAOrBzD,IAAI,CAACY,QAAL,CAAcoC,MAPO,CAAvB,CALwB;;AAgBxBxC,IAAAA,gBAAgB,CAACkD,gBAAjB,CAAkC,QAAlC,EAA2C,MAAI;AAE9C,MAAI,IAAA,CAAC1D,IAAI,CAACY,QAAL,CAAcC,cAAd,CAA6ByB,IAA7B,CAAkCtC,IAAlC,CAAL,EAA8C;AAC7C,QAAA,OAAA;AACA,OAJ6C;;;AAO9C,MAAA,IAAI,CAAC2B,WAAW,CAAC3B,IAAI,CAAC+C,SAAN,CAAhB,EAAkC;AACjC,QAAA,OAAA;AACA,OAT6C;;;AAY9C,MAAA,IAAItC,YAAJ,EAAmB,OAAA;AAGnBA,MAAAA,YAAY,GAAG,IAAf,CAAA;AACAT,MAAAA,IAAI,CAAC2D,IAAL,CAAUrB,IAAV,CAAetC,IAAf,EAAoBA,IAAI,CAAC+C,SAAzB,CAAA,CAAA;AACA,KAjBD,CAAA,CAAA;AAkBA,GAlCD,CAAA,CAAA;AAoCA;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["../../../../node_modules/@orchidjs/unicode-variants/dist/esm/index.js","../../../../node_modules/@orchidjs/sifter/lib/utils.ts","../../../../src/vanilla.ts","../../../../src/plugins/virtual_scroll/plugin.ts"],"sourcesContent":["/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\nimport { toArray, setToPattern, escape_regex, arrayToPattern, sequencePattern } from './regex.js';\nexport { escape_regex } from './regex.js';\nimport { allSubstrings } from './strings.js';\n\n/**\n * @typedef {{[key:string]:string}} TUnicodeMap\n * @typedef {{[key:string]:Set<string>}} TUnicodeSets\n * @typedef {[[number,number]]} TCodePoints\n * @typedef {{folded:string,composed:string,code_point:number}} TCodePointObj\n * @typedef {{start:number,end:number,length:number,substr:string}} TSequencePart\n */\n/** @type {TCodePoints} */\n\nconst code_points = [[0, 65535]];\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}\\u{2bc}]';\n/** @type {TUnicodeMap} */\n\nlet unicode_map;\n/** @type {RegExp} */\n\nlet multi_char_reg;\nconst max_char_length = 3;\n/** @type {TUnicodeMap} */\n\nconst latin_convert = {};\n/** @type {TUnicodeMap} */\n\nconst latin_condensed = {\n '/': '⁄∕',\n '0': '߀',\n \"a\": \"ⱥɐɑ\",\n \"aa\": \"ꜳ\",\n \"ae\": \"æǽǣ\",\n \"ao\": \"ꜵ\",\n \"au\": \"ꜷ\",\n \"av\": \"ꜹꜻ\",\n \"ay\": \"ꜽ\",\n \"b\": \"ƀɓƃ\",\n \"c\": \"ꜿƈȼↄ\",\n \"d\": \"đɗɖᴅƌꮷԁɦ\",\n \"e\": \"ɛǝᴇɇ\",\n \"f\": \"ꝼƒ\",\n \"g\": \"ǥɠꞡᵹꝿɢ\",\n \"h\": \"ħⱨⱶɥ\",\n \"i\": \"ɨı\",\n \"j\": \"ɉȷ\",\n \"k\": \"ƙⱪꝁꝃꝅꞣ\",\n \"l\": \"łƚɫⱡꝉꝇꞁɭ\",\n \"m\": \"ɱɯϻ\",\n \"n\": \"ꞥƞɲꞑᴎлԉ\",\n \"o\": \"øǿɔɵꝋꝍᴑ\",\n \"oe\": \"œ\",\n \"oi\": \"ƣ\",\n \"oo\": \"ꝏ\",\n \"ou\": \"ȣ\",\n \"p\": \"ƥᵽꝑꝓꝕρ\",\n \"q\": \"ꝗꝙɋ\",\n \"r\": \"ɍɽꝛꞧꞃ\",\n \"s\": \"ßȿꞩꞅʂ\",\n \"t\": \"ŧƭʈⱦꞇ\",\n \"th\": \"þ\",\n \"tz\": \"ꜩ\",\n \"u\": \"ʉ\",\n \"v\": \"ʋꝟʌ\",\n \"vy\": \"ꝡ\",\n \"w\": \"ⱳ\",\n \"y\": \"ƴɏỿ\",\n \"z\": \"ƶȥɀⱬꝣ\",\n \"hv\": \"ƕ\"\n};\n\nfor (let latin in latin_condensed) {\n let unicode = latin_condensed[latin] || '';\n\n for (let i = 0; i < unicode.length; i++) {\n let char = unicode.substring(i, i + 1);\n latin_convert[char] = latin;\n }\n}\n\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');\n/**\n * Initialize the unicode_map from the give code point ranges\n *\n * @param {TCodePoints=} _code_points\n */\n\nconst initialize = _code_points => {\n if (unicode_map !== undefined) return;\n unicode_map = generateMap(_code_points || code_points);\n};\n/**\n * Helper method for normalize a string\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n * @param {string} str\n * @param {string} form\n */\n\nconst normalize = (str, form = 'NFKD') => str.normalize(form);\n/**\n * Remove accents without reordering string\n * calling str.normalize('NFKD') on \\u{594}\\u{595}\\u{596} becomes \\u{596}\\u{594}\\u{595}\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n * @param {string} str\n * @return {string}\n */\n\nconst asciifold = str => {\n return toArray(str).reduce(\n /**\n * @param {string} result\n * @param {string} char\n */\n (result, char) => {\n return result + _asciifold(char);\n }, '');\n};\n/**\n * @param {string} str\n * @return {string}\n */\n\nconst _asciifold = str => {\n str = normalize(str).toLowerCase().replace(convert_pat, (\n /** @type {string} */\n char) => {\n return latin_convert[char] || '';\n }); //return str;\n\n return normalize(str, 'NFC');\n};\n/**\n * Generate a list of unicode variants from the list of code points\n * @param {TCodePoints} code_points\n * @yield {TCodePointObj}\n */\n\nfunction* generator(code_points) {\n for (const [code_point_min, code_point_max] of code_points) {\n for (let i = code_point_min; i <= code_point_max; i++) {\n let composed = String.fromCharCode(i);\n let folded = asciifold(composed);\n\n if (folded == composed.toLowerCase()) {\n continue;\n } // skip when folded is a string longer than 3 characters long\n // bc the resulting regex patterns will be long\n // eg:\n // folded صلى الله عليه وسلم length 18 code point 65018\n // folded جل جلاله length 8 code point 65019\n\n\n if (folded.length > max_char_length) {\n continue;\n }\n\n if (folded.length == 0) {\n continue;\n }\n\n yield {\n folded: folded,\n composed: composed,\n code_point: i\n };\n }\n }\n}\n/**\n * Generate a unicode map from the list of code points\n * @param {TCodePoints} code_points\n * @return {TUnicodeSets}\n */\n\nconst generateSets = code_points => {\n /** @type {{[key:string]:Set<string>}} */\n const unicode_sets = {};\n /**\n * @param {string} folded\n * @param {string} to_add\n */\n\n const addMatching = (folded, to_add) => {\n /** @type {Set<string>} */\n const folded_set = unicode_sets[folded] || new Set();\n const patt = new RegExp('^' + setToPattern(folded_set) + '$', 'iu');\n\n if (to_add.match(patt)) {\n return;\n }\n\n folded_set.add(escape_regex(to_add));\n unicode_sets[folded] = folded_set;\n };\n\n for (let value of generator(code_points)) {\n addMatching(value.folded, value.folded);\n addMatching(value.folded, value.composed);\n }\n\n return unicode_sets;\n};\n/**\n * Generate a unicode map from the list of code points\n * ae => (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n *\n * @param {TCodePoints} code_points\n * @return {TUnicodeMap}\n */\n\nconst generateMap = code_points => {\n /** @type {TUnicodeSets} */\n const unicode_sets = generateSets(code_points);\n /** @type {TUnicodeMap} */\n\n const unicode_map = {};\n /** @type {string[]} */\n\n let multi_char = [];\n\n for (let folded in unicode_sets) {\n let set = unicode_sets[folded];\n\n if (set) {\n unicode_map[folded] = setToPattern(set);\n }\n\n if (folded.length > 1) {\n multi_char.push(escape_regex(folded));\n }\n }\n\n multi_char.sort((a, b) => b.length - a.length);\n const multi_char_patt = arrayToPattern(multi_char);\n multi_char_reg = new RegExp('^' + multi_char_patt, 'u');\n return unicode_map;\n};\n/**\n * Map each element of an array from it's folded value to all possible unicode matches\n * @param {string[]} strings\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst mapSequence = (strings, min_replacement = 1) => {\n let chars_replaced = 0;\n strings = strings.map(str => {\n if (unicode_map[str]) {\n chars_replaced += str.length;\n }\n\n return unicode_map[str] || str;\n });\n\n if (chars_replaced >= min_replacement) {\n return sequencePattern(strings);\n }\n\n return '';\n};\n/**\n * Convert a short string and split it into all possible patterns\n * Keep a pattern only if min_replacement is met\n *\n * 'abc'\n * \t\t=> [['abc'],['ab','c'],['a','bc'],['a','b','c']]\n *\t\t=> ['abc-pattern','ab-c-pattern'...]\n *\n *\n * @param {string} str\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst substringsToPattern = (str, min_replacement = 1) => {\n min_replacement = Math.max(min_replacement, str.length - 1);\n return arrayToPattern(allSubstrings(str).map(sub_pat => {\n return mapSequence(sub_pat, min_replacement);\n }));\n};\n/**\n * Convert an array of sequences into a pattern\n * [{start:0,end:3,length:3,substr:'iii'}...] => (?:iii...)\n *\n * @param {Sequence[]} sequences\n * @param {boolean} all\n */\n\nconst sequencesToPattern = (sequences, all = true) => {\n let min_replacement = sequences.length > 1 ? 1 : 0;\n return arrayToPattern(sequences.map(sequence => {\n let seq = [];\n const len = all ? sequence.length() : sequence.length() - 1;\n\n for (let j = 0; j < len; j++) {\n seq.push(substringsToPattern(sequence.substrs[j] || '', min_replacement));\n }\n\n return sequencePattern(seq);\n }));\n};\n/**\n * Return true if the sequence is already in the sequences\n * @param {Sequence} needle_seq\n * @param {Sequence[]} sequences\n */\n\n\nconst inSequences = (needle_seq, sequences) => {\n for (const seq of sequences) {\n if (seq.start != needle_seq.start || seq.end != needle_seq.end) {\n continue;\n }\n\n if (seq.substrs.join('') !== needle_seq.substrs.join('')) {\n continue;\n }\n\n let needle_parts = needle_seq.parts;\n /**\n * @param {TSequencePart} part\n */\n\n const filter = part => {\n for (const needle_part of needle_parts) {\n if (needle_part.start === part.start && needle_part.substr === part.substr) {\n return false;\n }\n\n if (part.length == 1 || needle_part.length == 1) {\n continue;\n } // check for overlapping parts\n // a = ['::=','==']\n // b = ['::','===']\n // a = ['r','sm']\n // b = ['rs','m']\n\n\n if (part.start < needle_part.start && part.end > needle_part.start) {\n return true;\n }\n\n if (needle_part.start < part.start && needle_part.end > part.start) {\n return true;\n }\n }\n\n return false;\n };\n\n let filtered = seq.parts.filter(filter);\n\n if (filtered.length > 0) {\n continue;\n }\n\n return true;\n }\n\n return false;\n};\n\nclass Sequence {\n constructor() {\n /** @type {TSequencePart[]} */\n this.parts = [];\n /** @type {string[]} */\n\n this.substrs = [];\n this.start = 0;\n this.end = 0;\n }\n /**\n * @param {TSequencePart|undefined} part\n */\n\n\n add(part) {\n if (part) {\n this.parts.push(part);\n this.substrs.push(part.substr);\n this.start = Math.min(part.start, this.start);\n this.end = Math.max(part.end, this.end);\n }\n }\n\n last() {\n return this.parts[this.parts.length - 1];\n }\n\n length() {\n return this.parts.length;\n }\n /**\n * @param {number} position\n * @param {TSequencePart} last_piece\n */\n\n\n clone(position, last_piece) {\n let clone = new Sequence();\n let parts = JSON.parse(JSON.stringify(this.parts));\n let last_part = parts.pop();\n\n for (const part of parts) {\n clone.add(part);\n }\n\n let last_substr = last_piece.substr.substring(0, position - last_part.start);\n let clone_last_len = last_substr.length;\n clone.add({\n start: last_part.start,\n end: last_part.start + clone_last_len,\n length: clone_last_len,\n substr: last_substr\n });\n return clone;\n }\n\n}\n/**\n * Expand a regular expression pattern to include unicode variants\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n * Issue:\n * ﺊﺋ [ 'ﺊ = \\\\u{fe8a}', 'ﺋ = \\\\u{fe8b}' ]\n *\tbecomes:\tئئ [ 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}', 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}' ]\n *\n *\tİIJ = IIJ = ⅡJ\n *\n * \t1/2/4\n *\n * @param {string} str\n * @return {string|undefined}\n */\n\n\nconst getPattern = str => {\n initialize();\n str = asciifold(str);\n let pattern = '';\n let sequences = [new Sequence()];\n\n for (let i = 0; i < str.length; i++) {\n let substr = str.substring(i);\n let match = substr.match(multi_char_reg);\n const char = str.substring(i, i + 1);\n const match_str = match ? match[0] : null; // loop through sequences\n // add either the char or multi_match\n\n let overlapping = [];\n let added_types = new Set();\n\n for (const sequence of sequences) {\n const last_piece = sequence.last();\n\n if (!last_piece || last_piece.length == 1 || last_piece.end <= i) {\n // if we have a multi match\n if (match_str) {\n const len = match_str.length;\n sequence.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n added_types.add('1');\n } else {\n sequence.add({\n start: i,\n end: i + 1,\n length: 1,\n substr: char\n });\n added_types.add('2');\n }\n } else if (match_str) {\n let clone = sequence.clone(i, last_piece);\n const len = match_str.length;\n clone.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n overlapping.push(clone);\n } else {\n // don't add char\n // adding would create invalid patterns: 234 => [2,34,4]\n added_types.add('3');\n }\n } // if we have overlapping\n\n\n if (overlapping.length > 0) {\n // ['ii','iii'] before ['i','i','iii']\n overlapping = overlapping.sort((a, b) => {\n return a.length() - b.length();\n });\n\n for (let clone of overlapping) {\n // don't add if we already have an equivalent sequence\n if (inSequences(clone, sequences)) {\n continue;\n }\n\n sequences.push(clone);\n }\n\n continue;\n } // if we haven't done anything unique\n // clean up the patterns\n // helps keep patterns smaller\n // if str = 'r₨㎧aarss', pattern will be 446 instead of 655\n\n\n if (i > 0 && added_types.size == 1 && !added_types.has('3')) {\n pattern += sequencesToPattern(sequences, false);\n let new_seq = new Sequence();\n const old_seq = sequences[0];\n\n if (old_seq) {\n new_seq.add(old_seq.last());\n }\n\n sequences = [new_seq];\n }\n }\n\n pattern += sequencesToPattern(sequences, true);\n return pattern;\n};\n\nexport { _asciifold, asciifold, code_points, generateMap, generateSets, generator, getPattern, initialize, mapSequence, normalize, substringsToPattern, unicode_map };\n//# sourceMappingURL=index.js.map\n","\nimport { asciifold } from '@orchidjs/unicode-variants';\nimport * as T from './types';\n\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttr = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n return obj[name];\n};\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttrNesting = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n var part, names = name.split(\".\");\n\twhile( (part = names.shift()) && (obj = obj[part]));\n return obj;\n};\n\n/**\n * Calculates how close of a match the\n * given value is against a search token.\n *\n */\nexport const scoreValue = (value:string, token:T.Token, weight:number ):number => {\n\tvar score, pos;\n\n\tif (!value) return 0;\n\n\tvalue = value + '';\n\tif( token.regex == null ) return 0;\n\tpos = value.search(token.regex);\n\tif (pos === -1) return 0;\n\n\tscore = token.string.length / value.length;\n\tif (pos === 0) score += 0.5;\n\n\treturn score * weight;\n};\n\n\n/**\n * Cast object property to an array if it exists and has a value\n *\n */\nexport const propToArray = (obj:{[key:string]:any}, key:string) => {\n\tvar value = obj[key];\n\n\tif( typeof value == 'function' ) return value;\n\n\tif( value && !Array.isArray(value) ){\n\t\tobj[key] = [value];\n\t}\n}\n\n\n/**\n * Iterates over arrays and hashes.\n *\n * ```\n * iterate(this.items, function(item, id) {\n * // invoked for each item\n * });\n * ```\n *\n */\nexport const iterate = (object:[]|{[key:string]:any}, callback:(value:any,key:any)=>any) => {\n\n\tif ( Array.isArray(object)) {\n\t\tobject.forEach(callback);\n\n\t}else{\n\n\t\tfor (var key in object) {\n\t\t\tif (object.hasOwnProperty(key)) {\n\t\t\t\tcallback(object[key], key);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\n\nexport const cmp = (a:number|string, b:number|string) => {\n\tif (typeof a === 'number' && typeof b === 'number') {\n\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t}\n\ta = asciifold(a + '').toLowerCase();\n\tb = asciifold(b + '').toLowerCase();\n\tif (a > b) return 1;\n\tif (b > a) return -1;\n\treturn 0;\n};\n","\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tvar tpl = document.createElement('template');\n\t\ttpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn tpl.content.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array<any> => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array<any>|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n","/**\n * Plugin: \"restore_on_backspace\" (Tom Select)\n * Copyright (c) contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n */\n\nimport TomSelect from '../../tom-select';\nimport { TomOption } from '../../types/index';\nimport { addClasses } from '../../vanilla';\n\nexport default function(this:TomSelect) {\n\tconst self\t\t\t\t\t\t\t= this;\n\tconst orig_canLoad\t\t\t\t\t= self.canLoad;\n\tconst orig_clearActiveOption\t\t= self.clearActiveOption;\n\tconst orig_loadCallback\t\t\t\t= self.loadCallback;\n\n\tvar pagination:{[key:string]:any}\t= {};\n\tvar dropdown_content:HTMLElement;\n\tvar loading_more\t\t\t\t\t= false;\n\tvar load_more_opt:HTMLElement;\n\tvar default_values: string[]\t\t= [];\n\n\tif( !self.settings.shouldLoadMore ){\n\n\t\t// return true if additional results should be loaded\n\t\tself.settings.shouldLoadMore = ():boolean=>{\n\n\t\t\tconst scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop);\n\t\t\tif( scroll_percent > 0.9 ){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif( self.activeOption ){\n\t\t\t\tvar selectable\t= self.selectable();\n\t\t\t\tvar index\t\t= Array.from(selectable).indexOf(self.activeOption);\n\t\t\t\tif( index >= (selectable.length-2) ){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t}\n\n\n\tif( !self.settings.firstUrl ){\n\t\tthrow 'virtual_scroll plugin requires a firstUrl() method';\n\t}\n\n\n\t// in order for virtual scrolling to work,\n\t// options need to be ordered the same way they're returned from the remote data source\n\tself.settings.sortField\t\t\t= [{field:'$order'},{field:'$score'}];\n\n\n\t// can we load more results for given query?\n\tconst canLoadMore = (query:string):boolean => {\n\n\t\tif( typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions ){\n\t\t\treturn false;\n\t\t}\n\n\t\tif( (query in pagination) && pagination[query] ){\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t};\n\n\tconst clearFilter = (option:TomOption, value:string):boolean => {\n\t\tif( self.items.indexOf(value) >= 0 || default_values.indexOf(value) >= 0 ){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n\n\n\t// set the next url that will be\n\tself.setNextUrl = (value:string,next_url:any):void => {\n\t\tpagination[value] = next_url;\n\t};\n\n\t// getUrl() to be used in settings.load()\n\tself.getUrl = (query:string):any =>{\n\n\t\tif( query in pagination ){\n\t\t\tconst next_url = pagination[query];\n\t\t\tpagination[query] = false;\n\t\t\treturn next_url;\n\t\t}\n\n\t\t// if the user goes back to a previous query\n\t\t// we need to load the first page again\n\t\tself.clearPagination();\n\n\t\treturn self.settings.firstUrl.call(self,query);\n\t};\n\n\t// clear pagination\n\tself.clearPagination = ():void =>{\n\t\tpagination = {};\n\t};\n\n\t// don't clear the active option (and cause unwanted dropdown scroll)\n\t// while loading more results\n\tself.hook('instead','clearActiveOption',()=>{\n\n\t\tif( loading_more ){\n\t\t\treturn;\n\t\t}\n\n\t\treturn orig_clearActiveOption.call(self);\n\t});\n\n\t// override the canLoad method\n\tself.hook('instead','canLoad',(query:string)=>{\n\n\t\t// first time the query has been seen\n\t\tif( !(query in pagination) ){\n\t\t\treturn orig_canLoad.call(self,query);\n\t\t}\n\n\t\treturn canLoadMore(query);\n\t});\n\n\n\t// wrap the load\n\tself.hook('instead','loadCallback',( options:TomOption[], optgroups:TomOption[])=>{\n\n\t\tif( !loading_more ){\n\t\t\tself.clearOptions(clearFilter);\n\t\t}else if( load_more_opt ){\n\t\t\tconst first_option = options[0];\n\t\t\tif( first_option !== undefined ){\n\t\t\t\tload_more_opt.dataset.value\t\t= first_option[self.settings.valueField];\n\t\t\t}\n\t\t}\n\n\t\torig_loadCallback.call( self, options, optgroups);\n\n\t\tloading_more = false;\n\t});\n\n\n\t// add templates to dropdown\n\t//\tloading_more if we have another url in the queue\n\t//\tno_more_results if we don't have another url in the queue\n\tself.hook('after','refreshOptions',()=>{\n\n\t\tconst query\t\t= self.lastValue;\n\t\tvar option;\n\n\t\tif( canLoadMore(query) ){\n\n\t\t\toption = self.render('loading_more',{query:query});\n\t\t\tif( option ){\n\t\t\t\toption.setAttribute('data-selectable',''); // so that navigating dropdown with [down] keypresses can navigate to this node\n\t\t\t\tload_more_opt = option;\n\t\t\t}\n\n\t\t}else if( (query in pagination) && !dropdown_content.querySelector('.no-results') ){\n\t\t\toption = self.render('no_more_results',{query:query});\n\t\t}\n\n\t\tif( option ){\n\t\t\taddClasses(option,self.settings.optionClass);\n\t\t\tdropdown_content.append( option );\n\t\t}\n\n\t});\n\n\n\t// add scroll listener and default templates\n\tself.on('initialize',()=>{\n\t\tdefault_values = Object.keys(self.options);\n\t\tdropdown_content = self.dropdown_content;\n\n\t\t// default templates\n\t\tself.settings.render = Object.assign({}, {\n\t\t\tloading_more:() => {\n\t\t\t\treturn `<div class=\"loading-more-results\">Loading more results ... </div>`;\n\t\t\t},\n\t\t\tno_more_results:() =>{\n\t\t\t\treturn `<div class=\"no-more-results\">No more results</div>`;\n\t\t\t}\n\t\t},self.settings.render);\n\n\n\t\t// watch dropdown content scroll position\n\t\tdropdown_content.addEventListener('scroll',()=>{\n\n\t\t\tif( !self.settings.shouldLoadMore.call(self) ){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// !important: this will get checked again in load() but we still need to check here otherwise loading_more will be set to true\n\t\t\tif( !canLoadMore(self.lastValue) ){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// don't call load() too much\n\t\t\tif( loading_more ) return;\n\n\n\t\t\tloading_more = true;\n\t\t\tself.load.call(self,self.lastValue);\n\t\t});\n\t});\n\n};\n"],"names":["iterate","object","callback","Array","isArray","forEach","key","hasOwnProperty","addClasses","elmts","classes","norm_classes","classesArray","castAsArray","map","el","cls","classList","add","args","_classes","trim","split","concat","filter","Boolean","arg","self","orig_canLoad","canLoad","orig_clearActiveOption","clearActiveOption","orig_loadCallback","loadCallback","pagination","dropdown_content","loading_more","load_more_opt","default_values","settings","shouldLoadMore","scroll_percent","clientHeight","scrollHeight","scrollTop","activeOption","selectable","index","from","indexOf","length","firstUrl","sortField","field","canLoadMore","query","maxOptions","children","clearFilter","option","value","items","setNextUrl","next_url","getUrl","clearPagination","call","hook","options","optgroups","clearOptions","first_option","undefined","dataset","valueField","lastValue","render","setAttribute","querySelector","optionClass","append","on","Object","keys","assign","no_more_results","addEventListener","load"],"mappings":";;;;;AAAA;AAeA,MAAM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