@drecchia/tom-select 2.5.2-virtual-scroll.0 → 2.5.2-virtual-scroll.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/dist/cjs/constants.js +16 -0
  2. package/dist/cjs/constants.js.map +1 -0
  3. package/dist/cjs/contrib/highlight.js +69 -0
  4. package/dist/cjs/contrib/highlight.js.map +1 -0
  5. package/dist/cjs/contrib/microevent.js +64 -0
  6. package/dist/cjs/contrib/microevent.js.map +1 -0
  7. package/dist/cjs/contrib/microplugin.js +112 -0
  8. package/dist/cjs/contrib/microplugin.js.map +1 -0
  9. package/dist/cjs/defaults.js +85 -0
  10. package/dist/cjs/defaults.js.map +1 -0
  11. package/dist/cjs/getSettings.js +146 -0
  12. package/dist/cjs/getSettings.js.map +1 -0
  13. package/dist/cjs/package.json +1 -0
  14. package/dist/cjs/plugins/caret_position/plugin.js +66 -0
  15. package/dist/cjs/plugins/caret_position/plugin.js.map +1 -0
  16. package/dist/cjs/plugins/change_listener/plugin.js +25 -0
  17. package/dist/cjs/plugins/change_listener/plugin.js.map +1 -0
  18. package/dist/cjs/plugins/checkbox_options/plugin.js +108 -0
  19. package/dist/cjs/plugins/checkbox_options/plugin.js.map +1 -0
  20. package/dist/cjs/plugins/checkbox_options/types.js +3 -0
  21. package/dist/cjs/plugins/checkbox_options/types.js.map +1 -0
  22. package/dist/cjs/plugins/clear_button/plugin.js +47 -0
  23. package/dist/cjs/plugins/clear_button/plugin.js.map +1 -0
  24. package/dist/cjs/plugins/clear_button/types.js +3 -0
  25. package/dist/cjs/plugins/clear_button/types.js.map +1 -0
  26. package/dist/cjs/plugins/drag_drop/plugin.js +117 -0
  27. package/dist/cjs/plugins/drag_drop/plugin.js.map +1 -0
  28. package/dist/cjs/plugins/dropdown_header/plugin.js +50 -0
  29. package/dist/cjs/plugins/dropdown_header/plugin.js.map +1 -0
  30. package/dist/cjs/plugins/dropdown_header/types.js +3 -0
  31. package/dist/cjs/plugins/dropdown_header/types.js.map +1 -0
  32. package/dist/cjs/plugins/dropdown_input/plugin.js +88 -0
  33. package/dist/cjs/plugins/dropdown_input/plugin.js.map +1 -0
  34. package/dist/cjs/plugins/input_autogrow/plugin.js +47 -0
  35. package/dist/cjs/plugins/input_autogrow/plugin.js.map +1 -0
  36. package/dist/cjs/plugins/local_virtual_scroll/plugin.js +293 -0
  37. package/dist/cjs/plugins/local_virtual_scroll/plugin.js.map +1 -0
  38. package/dist/cjs/plugins/local_virtual_scroll/types.js +3 -0
  39. package/dist/cjs/plugins/local_virtual_scroll/types.js.map +1 -0
  40. package/dist/cjs/plugins/no_active_items/plugin.js +22 -0
  41. package/dist/cjs/plugins/no_active_items/plugin.js.map +1 -0
  42. package/dist/cjs/plugins/no_backspace_delete/plugin.js +28 -0
  43. package/dist/cjs/plugins/no_backspace_delete/plugin.js.map +1 -0
  44. package/dist/cjs/plugins/optgroup_columns/plugin.js +51 -0
  45. package/dist/cjs/plugins/optgroup_columns/plugin.js.map +1 -0
  46. package/dist/cjs/plugins/remove_button/plugin.js +61 -0
  47. package/dist/cjs/plugins/remove_button/plugin.js.map +1 -0
  48. package/dist/cjs/plugins/remove_button/types.js +3 -0
  49. package/dist/cjs/plugins/remove_button/types.js.map +1 -0
  50. package/dist/cjs/plugins/restore_on_backspace/plugin.js +24 -0
  51. package/dist/cjs/plugins/restore_on_backspace/plugin.js.map +1 -0
  52. package/dist/cjs/plugins/virtual_scroll/plugin.js +170 -0
  53. package/dist/cjs/plugins/virtual_scroll/plugin.js.map +1 -0
  54. package/dist/cjs/tom-select.complete.js +35 -0
  55. package/dist/cjs/tom-select.complete.js.map +1 -0
  56. package/dist/cjs/tom-select.js +2303 -0
  57. package/dist/cjs/tom-select.js.map +1 -0
  58. package/dist/cjs/tom-select.popular.js +15 -0
  59. package/dist/cjs/tom-select.popular.js.map +1 -0
  60. package/dist/cjs/types/core.js +3 -0
  61. package/dist/cjs/types/core.js.map +1 -0
  62. package/dist/cjs/types/index.js +19 -0
  63. package/dist/cjs/types/index.js.map +1 -0
  64. package/dist/cjs/types/settings.js +3 -0
  65. package/dist/cjs/types/settings.js.map +1 -0
  66. package/dist/cjs/utils.js +212 -0
  67. package/dist/cjs/utils.js.map +1 -0
  68. package/dist/cjs/vanilla.js +190 -0
  69. package/dist/cjs/vanilla.js.map +1 -0
  70. package/dist/css/tom-select.bootstrap4.css +16 -4
  71. package/dist/css/tom-select.bootstrap4.css.map +1 -0
  72. package/dist/css/tom-select.bootstrap4.min.css +2 -0
  73. package/dist/css/tom-select.bootstrap4.min.css.map +1 -0
  74. package/dist/css/tom-select.bootstrap5.css +16 -4
  75. package/dist/css/tom-select.bootstrap5.css.map +1 -0
  76. package/dist/css/tom-select.bootstrap5.min.css +2 -0
  77. package/dist/css/tom-select.bootstrap5.min.css.map +1 -0
  78. package/dist/css/tom-select.css +12 -4
  79. package/dist/css/tom-select.css.map +1 -0
  80. package/dist/css/tom-select.default.css +11 -5
  81. package/dist/css/tom-select.default.css.map +1 -1
  82. package/dist/css/tom-select.default.min.css +2 -0
  83. package/dist/css/tom-select.default.min.css.map +1 -0
  84. package/dist/css/tom-select.min.css +2 -0
  85. package/dist/css/tom-select.min.css.map +1 -0
  86. package/dist/esm/constants.d.ts +12 -0
  87. package/dist/esm/constants.js +13 -0
  88. package/dist/esm/constants.js.map +1 -0
  89. package/dist/esm/contrib/highlight.d.ts +13 -0
  90. package/dist/esm/contrib/highlight.js +64 -0
  91. package/dist/esm/contrib/highlight.js.map +1 -0
  92. package/dist/esm/contrib/microevent.d.ts +20 -0
  93. package/dist/esm/contrib/microevent.js +61 -0
  94. package/dist/esm/contrib/microevent.js.map +1 -0
  95. package/dist/esm/contrib/microplugin.d.ts +71 -0
  96. package/dist/esm/contrib/microplugin.js +109 -0
  97. package/dist/esm/contrib/microplugin.js.map +1 -0
  98. package/dist/esm/defaults.d.ts +53 -0
  99. package/dist/esm/defaults.js +83 -0
  100. package/dist/esm/defaults.js.map +1 -0
  101. package/dist/esm/getSettings.d.ts +3 -0
  102. package/dist/esm/getSettings.js +143 -0
  103. package/dist/esm/getSettings.js.map +1 -0
  104. package/dist/esm/plugins/caret_position/plugin.d.ts +16 -0
  105. package/dist/esm/plugins/caret_position/plugin.js +1 -1
  106. package/dist/esm/plugins/change_listener/plugin.d.ts +16 -0
  107. package/dist/esm/plugins/change_listener/plugin.js +1 -1
  108. package/dist/esm/plugins/checkbox_options/plugin.d.ts +17 -0
  109. package/dist/esm/plugins/checkbox_options/plugin.js +1 -1
  110. package/dist/esm/plugins/checkbox_options/types.d.ts +14 -0
  111. package/dist/esm/plugins/checkbox_options/types.js +2 -0
  112. package/dist/esm/plugins/checkbox_options/types.js.map +1 -0
  113. package/dist/esm/plugins/clear_button/plugin.d.ts +17 -0
  114. package/dist/esm/plugins/clear_button/plugin.js +1 -1
  115. package/dist/esm/plugins/clear_button/types.d.ts +7 -0
  116. package/dist/esm/plugins/clear_button/types.js +2 -0
  117. package/dist/esm/plugins/clear_button/types.js.map +1 -0
  118. package/dist/esm/plugins/drag_drop/plugin.d.ts +16 -0
  119. package/dist/esm/plugins/drag_drop/plugin.js +1 -1
  120. package/dist/esm/plugins/dropdown_header/plugin.d.ts +17 -0
  121. package/dist/esm/plugins/dropdown_header/plugin.js +1 -1
  122. package/dist/esm/plugins/dropdown_header/types.d.ts +8 -0
  123. package/dist/esm/plugins/dropdown_header/types.js +2 -0
  124. package/dist/esm/plugins/dropdown_header/types.js.map +1 -0
  125. package/dist/esm/plugins/dropdown_input/plugin.d.ts +16 -0
  126. package/dist/esm/plugins/dropdown_input/plugin.js +1 -1
  127. package/dist/esm/plugins/input_autogrow/plugin.d.ts +15 -0
  128. package/dist/esm/plugins/input_autogrow/plugin.js +1 -1
  129. package/dist/esm/plugins/local_virtual_scroll/plugin.d.ts +19 -0
  130. package/dist/esm/plugins/local_virtual_scroll/plugin.js +92 -1
  131. package/dist/esm/plugins/local_virtual_scroll/plugin.js.map +1 -1
  132. package/dist/esm/plugins/local_virtual_scroll/types.d.ts +14 -0
  133. package/dist/esm/plugins/local_virtual_scroll/types.js +2 -0
  134. package/dist/esm/plugins/local_virtual_scroll/types.js.map +1 -0
  135. package/dist/esm/plugins/no_active_items/plugin.d.ts +15 -0
  136. package/dist/esm/plugins/no_active_items/plugin.js +1 -1
  137. package/dist/esm/plugins/no_backspace_delete/plugin.d.ts +15 -0
  138. package/dist/esm/plugins/no_backspace_delete/plugin.js +1 -1
  139. package/dist/esm/plugins/optgroup_columns/plugin.d.ts +16 -0
  140. package/dist/esm/plugins/optgroup_columns/plugin.js +1 -1
  141. package/dist/esm/plugins/remove_button/plugin.d.ts +17 -0
  142. package/dist/esm/plugins/remove_button/plugin.js +1 -1
  143. package/dist/esm/plugins/remove_button/types.d.ts +6 -0
  144. package/dist/esm/plugins/remove_button/types.js +2 -0
  145. package/dist/esm/plugins/remove_button/types.js.map +1 -0
  146. package/dist/esm/plugins/restore_on_backspace/plugin.d.ts +21 -0
  147. package/dist/esm/plugins/restore_on_backspace/plugin.js +1 -1
  148. package/dist/esm/plugins/virtual_scroll/plugin.d.ts +16 -0
  149. package/dist/esm/plugins/virtual_scroll/plugin.js +1 -1
  150. package/dist/esm/tom-select.complete.d.ts +2 -0
  151. package/dist/esm/tom-select.complete.js +33 -0
  152. package/dist/esm/tom-select.complete.js.map +1 -0
  153. package/dist/esm/tom-select.d.ts +594 -0
  154. package/dist/esm/tom-select.js +2300 -0
  155. package/dist/esm/tom-select.js.map +1 -0
  156. package/dist/esm/tom-select.popular.d.ts +2 -0
  157. package/dist/esm/tom-select.popular.js +13 -0
  158. package/dist/esm/tom-select.popular.js.map +1 -0
  159. package/dist/esm/types/core.d.ts +50 -0
  160. package/dist/esm/types/core.js +2 -0
  161. package/dist/esm/types/core.js.map +1 -0
  162. package/dist/esm/types/index.d.ts +2 -0
  163. package/dist/esm/types/index.js +3 -0
  164. package/dist/esm/types/index.js.map +1 -0
  165. package/dist/esm/types/settings.d.ts +81 -0
  166. package/dist/esm/types/settings.js +2 -0
  167. package/dist/esm/types/settings.js.map +1 -0
  168. package/dist/esm/utils.d.ts +95 -0
  169. package/dist/esm/utils.js +195 -0
  170. package/dist/esm/utils.js.map +1 -0
  171. package/dist/esm/vanilla.d.ts +76 -0
  172. package/dist/esm/vanilla.js +172 -0
  173. package/dist/esm/vanilla.js.map +1 -0
  174. package/dist/js/package.json +1 -0
  175. package/dist/js/plugins/caret_position.js +1 -1
  176. package/dist/js/plugins/change_listener.js +1 -1
  177. package/dist/js/plugins/checkbox_options.js +1 -1
  178. package/dist/js/plugins/clear_button.js +1 -1
  179. package/dist/js/plugins/drag_drop.js +1 -1
  180. package/dist/js/plugins/dropdown_header.js +1 -1
  181. package/dist/js/plugins/dropdown_input.js +1 -1
  182. package/dist/js/plugins/input_autogrow.js +1 -1
  183. package/dist/js/plugins/local_virtual_scroll.js +92 -1
  184. package/dist/js/plugins/local_virtual_scroll.js.map +1 -1
  185. package/dist/js/plugins/no_active_items.js +1 -1
  186. package/dist/js/plugins/no_backspace_delete.js +1 -1
  187. package/dist/js/plugins/optgroup_columns.js +1 -1
  188. package/dist/js/plugins/remove_button.js +1 -1
  189. package/dist/js/plugins/restore_on_backspace.js +1 -1
  190. package/dist/js/plugins/virtual_scroll.js +1 -1
  191. package/dist/js/tom-select.base.js +1 -1
  192. package/dist/js/tom-select.base.min.js +1 -1
  193. package/dist/js/tom-select.complete.js +19 -1
  194. package/dist/js/tom-select.complete.js.map +1 -1
  195. package/dist/js/tom-select.complete.min.js +51 -45
  196. package/dist/js/tom-select.complete.min.js.map +1 -1
  197. package/dist/js/tom-select.popular.js +1 -1
  198. package/dist/js/tom-select.popular.min.js +1 -1
  199. package/dist/scss/_dropdown.scss +99 -0
  200. package/dist/scss/_items.scss +114 -0
  201. package/dist/scss/plugins/checkbox_options.scss +11 -0
  202. package/dist/scss/plugins/clear_button.scss +33 -0
  203. package/dist/scss/plugins/drag_drop.scss +10 -0
  204. package/dist/scss/plugins/dropdown_header.scss +24 -0
  205. package/dist/scss/plugins/dropdown_input.scss +43 -0
  206. package/dist/scss/plugins/input_autogrow.scss +15 -0
  207. package/dist/scss/plugins/optgroup_columns.scss +25 -0
  208. package/dist/scss/plugins/remove_button.scss +70 -0
  209. package/dist/scss/tom-select.bootstrap4.scss +218 -0
  210. package/dist/scss/tom-select.bootstrap5.scss +270 -0
  211. package/dist/scss/tom-select.default.scss +89 -0
  212. package/dist/scss/tom-select.scss +179 -0
  213. package/package.json +2 -2
  214. package/src/plugins/local_virtual_scroll/plugin.ts +19 -0
  215. /package/dist/{types → cjs}/constants.d.ts +0 -0
  216. /package/dist/{types → cjs}/contrib/highlight.d.ts +0 -0
  217. /package/dist/{types → cjs}/contrib/microevent.d.ts +0 -0
  218. /package/dist/{types → cjs}/contrib/microplugin.d.ts +0 -0
  219. /package/dist/{types → cjs}/defaults.d.ts +0 -0
  220. /package/dist/{types → cjs}/getSettings.d.ts +0 -0
  221. /package/dist/{types → cjs}/plugins/caret_position/plugin.d.ts +0 -0
  222. /package/dist/{types → cjs}/plugins/change_listener/plugin.d.ts +0 -0
  223. /package/dist/{types → cjs}/plugins/checkbox_options/plugin.d.ts +0 -0
  224. /package/dist/{types → cjs}/plugins/checkbox_options/types.d.ts +0 -0
  225. /package/dist/{types → cjs}/plugins/clear_button/plugin.d.ts +0 -0
  226. /package/dist/{types → cjs}/plugins/clear_button/types.d.ts +0 -0
  227. /package/dist/{types → cjs}/plugins/drag_drop/plugin.d.ts +0 -0
  228. /package/dist/{types → cjs}/plugins/dropdown_header/plugin.d.ts +0 -0
  229. /package/dist/{types → cjs}/plugins/dropdown_header/types.d.ts +0 -0
  230. /package/dist/{types → cjs}/plugins/dropdown_input/plugin.d.ts +0 -0
  231. /package/dist/{types → cjs}/plugins/input_autogrow/plugin.d.ts +0 -0
  232. /package/dist/{types → cjs}/plugins/local_virtual_scroll/plugin.d.ts +0 -0
  233. /package/dist/{types → cjs}/plugins/local_virtual_scroll/types.d.ts +0 -0
  234. /package/dist/{types → cjs}/plugins/no_active_items/plugin.d.ts +0 -0
  235. /package/dist/{types → cjs}/plugins/no_backspace_delete/plugin.d.ts +0 -0
  236. /package/dist/{types → cjs}/plugins/optgroup_columns/plugin.d.ts +0 -0
  237. /package/dist/{types → cjs}/plugins/remove_button/plugin.d.ts +0 -0
  238. /package/dist/{types → cjs}/plugins/remove_button/types.d.ts +0 -0
  239. /package/dist/{types → cjs}/plugins/restore_on_backspace/plugin.d.ts +0 -0
  240. /package/dist/{types → cjs}/plugins/virtual_scroll/plugin.d.ts +0 -0
  241. /package/dist/{types → cjs}/tom-select.complete.d.ts +0 -0
  242. /package/dist/{types → cjs}/tom-select.d.ts +0 -0
  243. /package/dist/{types → cjs}/tom-select.popular.d.ts +0 -0
  244. /package/dist/{types → cjs}/types/core.d.ts +0 -0
  245. /package/dist/{types → cjs}/types/index.d.ts +0 -0
  246. /package/dist/{types → cjs}/types/settings.d.ts +0 -0
  247. /package/dist/{types → cjs}/utils.d.ts +0 -0
  248. /package/dist/{types → cjs}/vanilla.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../../src/plugins/local_virtual_scroll/plugin.ts"],"sourcesContent":["/**\n * Plugin: \"local_virtual_scroll\" (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 * Virtual scroll for locally-loaded (non-AJAX) datasets.\n * Maintains a sliding DOM window of pageSize * 3 items maximum.\n * Supports optGroups via a flat list with interleaved headers.\n *\n * When the search query matches an optGroup label, all children of that\n * group are included in the results — even if the individual options don't\n * match the query text.\n */\n\nimport type TomSelect from '../../tom-select.ts';\nimport type { LVSOptions, FlatItem } from './types.ts';\n\nexport default function (this: TomSelect, userOptions: LVSOptions) {\n\tconst self = this;\n\tconst page_size = userOptions?.pageSize ?? 50;\n\tconst max_dom = userOptions?.maxDomItems ?? page_size * 3;\n\tconst threshold = userOptions?.scrollThreshold ?? 0.9;\n\n\tlet dropdown_content: HTMLElement;\n\tlet flat_list: FlatItem[] = [];\n\tlet visible_start = 0;\n\tlet visible_end = 0;\n\tlet is_loading = false;\n\tlet sentinel: HTMLElement | null = null;\n\n\t// RAF handle + flag to skip the scroll event caused by our own scrollTop writes\n\tlet raf_id: number | null = null;\n\tlet skip_programmatic = false;\n\n\t// Plugin controls maxOptions (first page only; we manage the rest)\n\tself.settings.maxOptions = page_size;\n\n\t// ─── Build flat list: Sifter results + optgroup headers interleaved ───\n\t//\n\t// When the query matches an optGroup label, ALL options from that group\n\t// are included regardless of whether the individual option text matches.\n\n\tconst buildFlatList = (): FlatItem[] => {\n\t\tconst flat: FlatItem[] = [];\n\t\tconst results = self.search(self.lastValue);\n\t\tconst og_field = self.settings.optgroupField;\n\t\tconst og_label_field =\n\t\t\t(self.settings as any).optgroupLabelField || 'label';\n\t\tconst query = (self.lastValue || '').trim().toLowerCase();\n\n\t\t// Helper: extract first optgroup value from an option\n\t\tconst getOg = (option: any): string => {\n\t\t\tlet og = option[og_field] || '';\n\t\t\tif (Array.isArray(og)) og = og[0] ?? '';\n\t\t\treturn String(og);\n\t\t};\n\n\t\t// Find optgroups whose label matches the query\n\t\tconst matching_og_labels = new Set<string>();\n\t\tif (query) {\n\t\t\tfor (const key of Object.keys(self.optgroups)) {\n\t\t\t\tconst label = String(\n\t\t\t\t\t(self.optgroups[key] as any)[og_label_field] || '',\n\t\t\t\t).toLowerCase();\n\t\t\t\tif (label.includes(query)) matching_og_labels.add(key);\n\t\t\t}\n\t\t}\n\n\t\t// Build ordered groups + their item sets from Sifter results\n\t\tconst group_order: string[] = [];\n\t\tconst group_items = new Map<string, Set<string>>();\n\n\t\tfor (const item of results.items) {\n\t\t\tconst option = self.options[item.id];\n\t\t\tif (!option) continue;\n\t\t\tconst og = getOg(option);\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t\tgroup_items.get(og)!.add(String(item.id));\n\t\t}\n\n\t\t// Ensure matching optgroups appear in group_order (even with no Sifter hits)\n\t\tfor (const og of matching_og_labels) {\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t}\n\n\t\t// Expand matching optgroups: add ALL their options (Set deduplicates)\n\t\tif (matching_og_labels.size > 0) {\n\t\t\tfor (const id of Object.keys(self.options)) {\n\t\t\t\tconst option = self.options[id];\n\t\t\t\tconst og = getOg(option);\n\t\t\t\tif (matching_og_labels.has(og)) {\n\t\t\t\t\tgroup_items.get(og)!.add(id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Emit flat list in group order\n\t\tfor (const og of group_order) {\n\t\t\tconst ids = group_items.get(og)!;\n\t\t\tif (ids.size === 0) continue;\n\t\t\tif (og && self.optgroups[og]) {\n\t\t\t\tflat.push({ type: 'header', optgroup: og });\n\t\t\t}\n\t\t\tfor (const id of ids) {\n\t\t\t\tflat.push({ type: 'option', id, optgroup: og });\n\t\t\t}\n\t\t}\n\n\t\treturn flat;\n\t};\n\n\t// ─── Render a single flat item to its DOM element ─────────────────────\n\n\tconst renderFlatItem = (item: FlatItem): HTMLElement | null => {\n\t\tif (item.type === 'header') {\n\t\t\tif (!item.el) {\n\t\t\t\titem.el = self.render(\n\t\t\t\t\t'optgroup_header',\n\t\t\t\t\tself.optgroups[item.optgroup],\n\t\t\t\t) as HTMLElement;\n\t\t\t}\n\t\t\treturn item.el ?? null;\n\t\t}\n\t\treturn self.getOption(item.id, true) as HTMLElement;\n\t};\n\n\t// ─── Helpers ─────────────────────────────────────────────────────────\n\n\tconst measureHeight = (elements: HTMLElement[]): number =>\n\t\telements.reduce((h, el) => h + (el.offsetHeight ?? 0), 0);\n\n\tconst updateSentinel = () => {\n\t\t// dropdown_content is set only after 'initialize' fires;\n\t\t// refreshOptions runs during construction before that — skip silently.\n\t\tif (!dropdown_content) return;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\t\tif (visible_end < flat_list.length) {\n\t\t\tsentinel = self.render('loading_more', {}) as HTMLElement;\n\t\t\tif (sentinel) dropdown_content.append(sentinel);\n\t\t}\n\t};\n\n\tconst renderRange = (from: number, to: number): HTMLElement[] => {\n\t\tconst els: HTMLElement[] = [];\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tconst item = flat_list[i];\n\t\t\tif (!item) continue;\n\t\t\tconst el = renderFlatItem(item);\n\t\t\tif (el) els.push(el);\n\t\t}\n\t\treturn els;\n\t};\n\n\t/** Write scrollTop without triggering our own scroll handler logic */\n\tconst setScrollTop = (value: number) => {\n\t\tskip_programmatic = true;\n\t\tdropdown_content.scrollTop = value;\n\t};\n\n\t// ─── Load N pages forward (scroll down) ──────────────────────────────\n\n\tconst loadNext = (pages: number) => {\n\t\tif (is_loading || visible_end >= flat_list.length) return;\n\t\tis_loading = true;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\n\t\tconst from = visible_end;\n\t\tconst to = Math.min(flat_list.length, visible_end + page_size * pages);\n\t\tconst new_els = renderRange(from, to);\n\t\tfor (const el of new_els) dropdown_content.append(el);\n\t\tvisible_end = to;\n\n\t\t// Recycle items from top to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_start, visible_start + n);\n\t\t\tconst removed_h = measureHeight(remove_els);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_start += n;\n\t\t\tsetScrollTop(dropdown_content.scrollTop + removed_h);\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Load N pages backward (scroll up) ───────────────────────────────\n\n\tconst loadPrev = (pages: number) => {\n\t\tif (is_loading || visible_start <= 0) return;\n\t\tis_loading = true;\n\n\t\tconst from = Math.max(0, visible_start - page_size * pages);\n\t\tconst to = visible_start;\n\t\tconst new_els = renderRange(from, to);\n\n\t\t// Prepend before current first child\n\t\tconst first_child = dropdown_content.firstChild;\n\t\tfor (const el of new_els)\n\t\t\tdropdown_content.insertBefore(el, first_child);\n\n\t\t// Compensate scrollTop so existing content stays in place\n\t\tsetScrollTop(dropdown_content.scrollTop + measureHeight(new_els));\n\t\tvisible_start = from;\n\n\t\t// Recycle items from bottom to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_end - n, visible_end);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_end -= n;\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Scroll handler with RAF debounce ─────────────────────────────────\n\n\tconst handleScroll = () => {\n\t\tconst { scrollTop, scrollHeight, clientHeight } = dropdown_content;\n\t\tconst pct_bottom = (scrollTop + clientHeight) / scrollHeight;\n\t\tconst pct_top = scrollTop / scrollHeight;\n\n\t\t// Always load exactly 1 page per RAF frame.\n\t\t// The RAF debounce already coalesces rapid scroll events, so there is no\n\t\t// need to load multiple pages at once — that only causes long DOM operations.\n\t\tif (pct_bottom >= threshold) {\n\t\t\tloadNext(1);\n\t\t} else if (pct_top <= 1 - threshold) {\n\t\t\tloadPrev(1);\n\t\t}\n\t};\n\n\t// ─── Reset virtual state on each refreshOptions ───────────────────────\n\n\tself.hook('before', 'refreshOptions', () => {\n\t\tself.settings.maxOptions = page_size;\n\t});\n\n\tself.hook('after', 'refreshOptions', () => {\n\t\tflat_list = buildFlatList();\n\t\tvisible_start = 0;\n\t\tvisible_end = Math.min(flat_list.length, page_size);\n\t\tis_loading = false;\n\t\tif (raf_id !== null) {\n\t\t\tcancelAnimationFrame(raf_id);\n\t\t\traf_id = null;\n\t\t}\n\n\t\t// Re-render first page from flat_list to keep DOM in sync.\n\t\t// refreshOptions may render items in optgroup wrappers or a different\n\t\t// order than our flat list; clearing and re-rendering ensures consistency.\n\t\tif (dropdown_content && flat_list.length > 0) {\n\t\t\tdropdown_content.innerHTML = '';\n\t\t\tconst first_page = renderRange(0, visible_end);\n\t\t\tfor (const el of first_page) dropdown_content.append(el);\n\t\t}\n\n\t\tupdateSentinel();\n\t});\n\n\t// ─── Initialize: set templates and attach scroll listener ────────────\n\n\tself.on('initialize', () => {\n\t\tdropdown_content = self.dropdown_content;\n\t\t// Disable overflow-anchor so the browser doesn't auto-compensate scrollTop\n\t\t// when we insert/remove items — we handle the compensation manually.\n\t\t(dropdown_content.style as any)['overflow-anchor'] = 'none';\n\n\t\tself.settings.render = Object.assign(\n\t\t\t{},\n\t\t\t{\n\t\t\t\tloading_more: () =>\n\t\t\t\t\t'<div class=\"loading-more-results\">Carregando mais resultados...</div>',\n\t\t\t},\n\t\t\tself.settings.render,\n\t\t);\n\n\t\tdropdown_content.addEventListener('scroll', () => {\n\t\t\tif (skip_programmatic) {\n\t\t\t\tskip_programmatic = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (raf_id !== null) cancelAnimationFrame(raf_id);\n\t\t\traf_id = requestAnimationFrame(() => {\n\t\t\t\traf_id = null;\n\t\t\t\thandleScroll();\n\t\t\t});\n\t\t});\n\t});\n}\n"],"names":["userOptions","_userOptions$pageSize","_userOptions$maxDomIt","_userOptions$scrollTh","self","page_size","pageSize","max_dom","maxDomItems","threshold","scrollThreshold","dropdown_content","flat_list","visible_start","visible_end","is_loading","sentinel","raf_id","skip_programmatic","settings","maxOptions","buildFlatList","flat","results","search","lastValue","og_field","optgroupField","og_label_field","optgroupLabelField","query","trim","toLowerCase","getOg","option","_og$","og","Array","isArray","String","matching_og_labels","Set","key","Object","keys","optgroups","label","includes","add","group_order","group_items","Map","item","items","options","id","has","set","push","get","size","ids","type","optgroup","renderFlatItem","_item$el","el","render","getOption","measureHeight","elements","reduce","h","_el$offsetHeight","offsetHeight","updateSentinel","remove","length","append","renderRange","from","to","els","i","setScrollTop","value","scrollTop","loadNext","pages","Math","min","new_els","dom_count","n","remove_els","removed_h","loadPrev","max","first_child","firstChild","insertBefore","handleScroll","scrollHeight","clientHeight","pct_bottom","pct_top","hook","cancelAnimationFrame","innerHTML","first_page","on","style","assign","loading_more","addEventListener","requestAnimationFrame"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKe,eAAA,EAA2BA,WAAuB,EAAE;AAAA,EAAA,IAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;EAClE,MAAMC,IAAI,GAAG,IAAI;AACjB,EAAA,MAAMC,SAAS,GAAA,CAAAJ,qBAAA,GAAGD,WAAW,IAAA,IAAA,GAAA,MAAA,GAAXA,WAAW,CAAEM,QAAQ,KAAA,IAAA,GAAAL,qBAAA,GAAI,EAAE;AAC7C,EAAA,MAAMM,OAAO,GAAA,CAAAL,qBAAA,GAAGF,WAAW,IAAA,IAAA,GAAA,MAAA,GAAXA,WAAW,CAAEQ,WAAW,KAAA,IAAA,GAAAN,qBAAA,GAAIG,SAAS,GAAG,CAAC;AACzD,EAAA,MAAMI,SAAS,GAAA,CAAAN,qBAAA,GAAGH,WAAW,IAAA,IAAA,GAAA,MAAA,GAAXA,WAAW,CAAEU,eAAe,KAAA,IAAA,GAAAP,qBAAA,GAAI,GAAG;AAErD,EAAA,IAAIQ,gBAA6B;EACjC,IAAIC,SAAqB,GAAG,EAAE;EAC9B,IAAIC,aAAa,GAAG,CAAC;EACrB,IAAIC,WAAW,GAAG,CAAC;EACnB,IAAIC,UAAU,GAAG,KAAK;EACtB,IAAIC,QAA4B,GAAG,IAAI;;AAEvC;EACA,IAAIC,MAAqB,GAAG,IAAI;EAChC,IAAIC,iBAAiB,GAAG,KAAK;;AAE7B;AACAd,EAAAA,IAAI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C,UAAU,EAAElG,gBAAgB,CAACmE,MAAM,CAACZ,EAAE,CAAC;AACzD,IAAA;AAEAS,IAAAA,cAAc,EAAE;AACjB,EAAA,CAAC,CAAC;;AAEF;;AAEAvE,EAAAA,IAAI,CAAC0G,EAAE,CAAC,YAAY,EAAE,MAAM;IAC3BnG,gBAAgB,GAAGP,IAAI,CAACO,gBAAgB;AACxC;AACA;AACCA,IAAAA,gBAAgB,CAACoG,KAAK,CAAS,iBAAiB,CAAC,GAAG,MAAM;IAE3D3G,IAAI,CAACe,QAAQ,CAACgD,MAAM,GAAGxB,MAAM,CAACqE,MAAM,CACnC,EAAE,EACF;MACCC,YAAY,EAAEA,MACb;AACF,KAAC,EACD7G,IAAI,CAACe,QAAQ,CAACgD,MACf,CAAC;AAEDxD,IAAAA,gBAAgB,CAACuG,gBAAgB,CAAC,QAAQ,EAAE,MAAM;AACjD,MAAA,IAAIhG,iBAAiB,EAAE;AACtBA,QAAAA,iBAAiB,GAAG,KAAK;AACzB,QAAA;AACD,MAAA;AACA,MAAA,IAAID,MAAM,KAAK,IAAI,EAAE0F,oBAAoB,CAAC1F,MAAM,CAAC;MACjDA,MAAM,GAAGkG,qBAAqB,CAAC,MAAM;AACpClG,QAAAA,MAAM,GAAG,IAAI;AACboF,QAAAA,YAAY,EAAE;AACf,MAAA,CAAC,CAAC;AACH,IAAA,CAAC,CAAC;AACH,EAAA,CAAC,CAAC;AACH;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["../../../../src/vanilla.ts","../../../../src/contrib/highlight.ts","../../../../src/plugins/local_virtual_scroll/plugin.ts"],"sourcesContent":["\nimport { iterate } from './utils.ts';\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(/[\\t\\n\\f\\r\\s]/);\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 * highlight v3 | MIT license | Johann Burkard <jb@eaio.com>\n * Highlights arbitrary terms in a node.\n *\n * - Modified by Marshal <beatgates@gmail.com> 2011-6-24 (added regex)\n * - Modified by Brian Reavis <brian@thirdroute.com> 2012-8-27 (cleanup)\n */\n\nimport {replaceNode} from '../vanilla.ts';\n\n\nexport const highlight = (element:HTMLElement, regex:string|RegExp) => {\n\n\tif( regex === null ) return;\n\n\t// convet string to regex\n\tif( typeof regex === 'string' ){\n\n\t\tif( !regex.length ) return;\n\t\tregex = new RegExp(regex, 'i');\n\t}\n\n\n\t// Wrap matching part of text node with highlighting <span>, e.g.\n\t// Soccer -> <span class=\"highlight\">Soc</span>cer for regex = /soc/i\n\tconst highlightText = ( node:Text ):number => {\n\n\t\tvar match = node.data.match(regex);\n\t\tif( match && node.data.length > 0 ){\n\t\t\tvar spannode\t\t= document.createElement('span');\n\t\t\tspannode.className\t= 'highlight';\n\t\t\tvar middlebit\t\t= node.splitText(match.index as number);\n\n\t\t\tmiddlebit.splitText(match[0]!.length);\n\t\t\tvar middleclone\t\t= middlebit.cloneNode(true);\n\n\t\t\tspannode.appendChild(middleclone);\n\t\t\treplaceNode(middlebit, spannode);\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\n\t// Recurse element node, looking for child text nodes to highlight, unless element\n\t// is childless, <script>, <style>, or already highlighted: <span class=\"hightlight\">\n\tconst highlightChildren = ( node:Element ):void => {\n\t\tif( node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName) && ( node.className !== 'highlight' || node.tagName !== 'SPAN' ) ){\n\t\t\tArray.from(node.childNodes).forEach(element => {\n\t\t\t\thighlightRecursive(element);\n\t\t\t});\n\t\t}\n\t};\n\n\n\tconst highlightRecursive = ( node:Node|Element ):number => {\n\n\t\tif( node.nodeType === 3 ){\n\t\t\treturn highlightText(node as Text);\n\t\t}\n\n\t\thighlightChildren(node as Element);\n\n\t\treturn 0;\n\t};\n\n\thighlightRecursive( element );\n};\n\n/**\n * removeHighlight fn copied from highlight v5 and\n * edited to remove with(), pass js strict mode, and use without jquery\n */\nexport const removeHighlight = (el:HTMLElement) => {\n\tvar elements = el.querySelectorAll(\"span.highlight\");\n\tArray.prototype.forEach.call(elements, function(el:HTMLElement){\n\t\tvar parent = el.parentNode as Node;\n\t\tparent.replaceChild(el.firstChild as Node, el);\n\t\tparent.normalize();\n\t});\n};\n","/**\n * Plugin: \"local_virtual_scroll\" (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 * Virtual scroll for locally-loaded (non-AJAX) datasets.\n * Maintains a sliding DOM window of pageSize * 3 items maximum.\n * Supports optGroups via a flat list with interleaved headers.\n *\n * When the search query matches an optGroup label, all children of that\n * group are included in the results — even if the individual options don't\n * match the query text.\n */\n\nimport type TomSelect from '../../tom-select.ts';\nimport type { LVSOptions, FlatItem } from './types.ts';\nimport { highlight, removeHighlight } from '../../contrib/highlight.ts';\n\nexport default function (this: TomSelect, userOptions: LVSOptions) {\n\tconst self = this;\n\tconst page_size = userOptions?.pageSize ?? 50;\n\tconst max_dom = userOptions?.maxDomItems ?? page_size * 3;\n\tconst threshold = userOptions?.scrollThreshold ?? 0.9;\n\n\tlet dropdown_content: HTMLElement;\n\tlet flat_list: FlatItem[] = [];\n\tlet visible_start = 0;\n\tlet visible_end = 0;\n\tlet is_loading = false;\n\tlet sentinel: HTMLElement | null = null;\n\n\t// RAF handle + flag to skip the scroll event caused by our own scrollTop writes\n\tlet raf_id: number | null = null;\n\tlet skip_programmatic = false;\n\n\t// Plugin controls maxOptions (first page only; we manage the rest)\n\tself.settings.maxOptions = page_size;\n\n\t// ─── Build flat list: Sifter results + optgroup headers interleaved ───\n\t//\n\t// When the query matches an optGroup label, ALL options from that group\n\t// are included regardless of whether the individual option text matches.\n\n\tconst buildFlatList = (): FlatItem[] => {\n\t\tconst flat: FlatItem[] = [];\n\t\tconst results = self.search(self.lastValue);\n\t\tconst og_field = self.settings.optgroupField;\n\t\tconst og_label_field =\n\t\t\t(self.settings as any).optgroupLabelField || 'label';\n\t\tconst query = (self.lastValue || '').trim().toLowerCase();\n\n\t\t// Helper: extract first optgroup value from an option\n\t\tconst getOg = (option: any): string => {\n\t\t\tlet og = option[og_field] || '';\n\t\t\tif (Array.isArray(og)) og = og[0] ?? '';\n\t\t\treturn String(og);\n\t\t};\n\n\t\t// Find optgroups whose label matches the query\n\t\tconst matching_og_labels = new Set<string>();\n\t\tif (query) {\n\t\t\tfor (const key of Object.keys(self.optgroups)) {\n\t\t\t\tconst label = String(\n\t\t\t\t\t(self.optgroups[key] as any)[og_label_field] || '',\n\t\t\t\t).toLowerCase();\n\t\t\t\tif (label.includes(query)) matching_og_labels.add(key);\n\t\t\t}\n\t\t}\n\n\t\t// Build ordered groups + their item sets from Sifter results\n\t\tconst group_order: string[] = [];\n\t\tconst group_items = new Map<string, Set<string>>();\n\n\t\tfor (const item of results.items) {\n\t\t\tconst option = self.options[item.id];\n\t\t\tif (!option) continue;\n\t\t\tconst og = getOg(option);\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t\tgroup_items.get(og)!.add(String(item.id));\n\t\t}\n\n\t\t// Ensure matching optgroups appear in group_order (even with no Sifter hits)\n\t\tfor (const og of matching_og_labels) {\n\t\t\tif (!group_items.has(og)) {\n\t\t\t\tgroup_items.set(og, new Set());\n\t\t\t\tgroup_order.push(og);\n\t\t\t}\n\t\t}\n\n\t\t// Expand matching optgroups: add ALL their options (Set deduplicates)\n\t\tif (matching_og_labels.size > 0) {\n\t\t\tfor (const id of Object.keys(self.options)) {\n\t\t\t\tconst option = self.options[id];\n\t\t\t\tconst og = getOg(option);\n\t\t\t\tif (matching_og_labels.has(og)) {\n\t\t\t\t\tgroup_items.get(og)!.add(id);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Emit flat list in group order\n\t\tfor (const og of group_order) {\n\t\t\tconst ids = group_items.get(og)!;\n\t\t\tif (ids.size === 0) continue;\n\t\t\tif (og && self.optgroups[og]) {\n\t\t\t\tflat.push({ type: 'header', optgroup: og });\n\t\t\t}\n\t\t\tfor (const id of ids) {\n\t\t\t\tflat.push({ type: 'option', id, optgroup: og });\n\t\t\t}\n\t\t}\n\n\t\treturn flat;\n\t};\n\n\t// ─── Render a single flat item to its DOM element ─────────────────────\n\n\tconst renderFlatItem = (item: FlatItem): HTMLElement | null => {\n\t\tif (item.type === 'header') {\n\t\t\tif (!item.el) {\n\t\t\t\titem.el = self.render(\n\t\t\t\t\t'optgroup_header',\n\t\t\t\t\tself.optgroups[item.optgroup],\n\t\t\t\t) as HTMLElement;\n\t\t\t}\n\t\t\treturn item.el ?? null;\n\t\t}\n\t\treturn self.getOption(item.id, true) as HTMLElement;\n\t};\n\n\t// ─── Re-apply search highlights to an element ─────────────────────────\n\n\tconst applyHighlights = (el: HTMLElement) => {\n\t\tif (!self.settings.highlight) return;\n\t\tremoveHighlight(el);\n\t\tconst results = self.currentResults;\n\t\tif (results && results.query.length && results.tokens.length) {\n\t\t\tfor (const tok of results.tokens) {\n\t\t\t\tif (tok.regex) highlight(el, tok.regex);\n\t\t\t}\n\t\t}\n\t};\n\n\t// ─── Helpers ─────────────────────────────────────────────────────────\n\n\tconst measureHeight = (elements: HTMLElement[]): number =>\n\t\telements.reduce((h, el) => h + (el.offsetHeight ?? 0), 0);\n\n\tconst updateSentinel = () => {\n\t\t// dropdown_content is set only after 'initialize' fires;\n\t\t// refreshOptions runs during construction before that — skip silently.\n\t\tif (!dropdown_content) return;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\t\tif (visible_end < flat_list.length) {\n\t\t\tsentinel = self.render('loading_more', {}) as HTMLElement;\n\t\t\tif (sentinel) dropdown_content.append(sentinel);\n\t\t}\n\t};\n\n\tconst renderRange = (from: number, to: number): HTMLElement[] => {\n\t\tconst els: HTMLElement[] = [];\n\t\tfor (let i = from; i < to; i++) {\n\t\t\tconst item = flat_list[i];\n\t\t\tif (!item) continue;\n\t\t\tconst el = renderFlatItem(item);\n\t\t\tif (el) els.push(el);\n\t\t}\n\t\treturn els;\n\t};\n\n\t/** Write scrollTop without triggering our own scroll handler logic */\n\tconst setScrollTop = (value: number) => {\n\t\tskip_programmatic = true;\n\t\tdropdown_content.scrollTop = value;\n\t};\n\n\t// ─── Load N pages forward (scroll down) ──────────────────────────────\n\n\tconst loadNext = (pages: number) => {\n\t\tif (is_loading || visible_end >= flat_list.length) return;\n\t\tis_loading = true;\n\t\tif (sentinel) {\n\t\t\tsentinel.remove();\n\t\t\tsentinel = null;\n\t\t}\n\n\t\tconst from = visible_end;\n\t\tconst to = Math.min(flat_list.length, visible_end + page_size * pages);\n\t\tconst new_els = renderRange(from, to);\n\t\tfor (const el of new_els) dropdown_content.append(el);\n\t\tfor (const el of new_els) applyHighlights(el);\n\t\tvisible_end = to;\n\n\t\t// Recycle items from top to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_start, visible_start + n);\n\t\t\tconst removed_h = measureHeight(remove_els);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_start += n;\n\t\t\tsetScrollTop(dropdown_content.scrollTop + removed_h);\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Load N pages backward (scroll up) ───────────────────────────────\n\n\tconst loadPrev = (pages: number) => {\n\t\tif (is_loading || visible_start <= 0) return;\n\t\tis_loading = true;\n\n\t\tconst from = Math.max(0, visible_start - page_size * pages);\n\t\tconst to = visible_start;\n\t\tconst new_els = renderRange(from, to);\n\n\t\t// Prepend before current first child\n\t\tconst first_child = dropdown_content.firstChild;\n\t\tfor (const el of new_els)\n\t\t\tdropdown_content.insertBefore(el, first_child);\n\t\tfor (const el of new_els) applyHighlights(el);\n\n\t\t// Compensate scrollTop so existing content stays in place\n\t\tsetScrollTop(dropdown_content.scrollTop + measureHeight(new_els));\n\t\tvisible_start = from;\n\n\t\t// Recycle items from bottom to stay within max_dom\n\t\tconst dom_count = visible_end - visible_start;\n\t\tif (dom_count > max_dom) {\n\t\t\tconst n = dom_count - max_dom;\n\t\t\tconst remove_els = renderRange(visible_end - n, visible_end);\n\t\t\tfor (const el of remove_els) el.remove();\n\t\t\tvisible_end -= n;\n\t\t}\n\n\t\tis_loading = false;\n\t\tupdateSentinel();\n\t};\n\n\t// ─── Scroll handler with RAF debounce ─────────────────────────────────\n\n\tconst handleScroll = () => {\n\t\tconst { scrollTop, scrollHeight, clientHeight } = dropdown_content;\n\t\tconst pct_bottom = (scrollTop + clientHeight) / scrollHeight;\n\t\tconst pct_top = scrollTop / scrollHeight;\n\n\t\t// Always load exactly 1 page per RAF frame.\n\t\t// The RAF debounce already coalesces rapid scroll events, so there is no\n\t\t// need to load multiple pages at once — that only causes long DOM operations.\n\t\tif (pct_bottom >= threshold) {\n\t\t\tloadNext(1);\n\t\t} else if (pct_top <= 1 - threshold) {\n\t\t\tloadPrev(1);\n\t\t}\n\t};\n\n\t// ─── Reset virtual state on each refreshOptions ───────────────────────\n\n\tself.hook('before', 'refreshOptions', () => {\n\t\tself.settings.maxOptions = page_size;\n\t});\n\n\tself.hook('after', 'refreshOptions', () => {\n\t\tflat_list = buildFlatList();\n\t\tvisible_start = 0;\n\t\tvisible_end = Math.min(flat_list.length, page_size);\n\t\tis_loading = false;\n\t\tif (raf_id !== null) {\n\t\t\tcancelAnimationFrame(raf_id);\n\t\t\traf_id = null;\n\t\t}\n\n\t\t// Re-render first page from flat_list to keep DOM in sync.\n\t\t// refreshOptions may render items in optgroup wrappers or a different\n\t\t// order than our flat list; clearing and re-rendering ensures consistency.\n\t\tif (dropdown_content && flat_list.length > 0) {\n\t\t\tdropdown_content.innerHTML = '';\n\t\t\tconst first_page = renderRange(0, visible_end);\n\t\t\tfor (const el of first_page) dropdown_content.append(el);\n\t\t\t// Re-apply highlights: the core applied them before we cleared the DOM,\n\t\t\t// and items from optgroup expansion never went through the core highlight pass.\n\t\t\tapplyHighlights(dropdown_content);\n\t\t}\n\n\t\tupdateSentinel();\n\t});\n\n\t// ─── Initialize: set templates and attach scroll listener ────────────\n\n\tself.on('initialize', () => {\n\t\tdropdown_content = self.dropdown_content;\n\t\t// Disable overflow-anchor so the browser doesn't auto-compensate scrollTop\n\t\t// when we insert/remove items — we handle the compensation manually.\n\t\t(dropdown_content.style as any)['overflow-anchor'] = 'none';\n\n\t\tself.settings.render = Object.assign(\n\t\t\t{},\n\t\t\t{\n\t\t\t\tloading_more: () =>\n\t\t\t\t\t'<div class=\"loading-more-results\">Carregando mais resultados...</div>',\n\t\t\t},\n\t\t\tself.settings.render,\n\t\t);\n\n\t\tdropdown_content.addEventListener('scroll', () => {\n\t\t\tif (skip_programmatic) {\n\t\t\t\tskip_programmatic = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (raf_id !== null) cancelAnimationFrame(raf_id);\n\t\t\traf_id = requestAnimationFrame(() => {\n\t\t\t\traf_id = null;\n\t\t\t\thandleScroll();\n\t\t\t});\n\t\t});\n\t});\n}\n"],"names":["replaceNode","existing","replacement","parentNode","replaceChild","highlight","element","regex","length","RegExp","highlightText","node","match","data","spannode","document","createElement","className","middlebit","splitText","index","middleclone","cloneNode","appendChild","highlightChildren","nodeType","childNodes","test","tagName","Array","from","forEach","highlightRecursive","removeHighlight","el","elements","querySelectorAll","prototype","call","parent","firstChild","normalize","userOptions","_userOptions$pageSize","_userOptions$maxDomIt","_userOptions$scrollTh","self","page_size","pageSize","max_dom","maxDomItems","threshold","scrollThreshold","dropdown_content","flat_list","visible_start","visible_end","is_loading","sentinel","raf_id","skip_programmatic","settings","maxOptions","buildFlatList","flat","results","search","lastValue","og_field","optgroupField","og_label_field","optgroupLabelField","query","trim","toLowerCase","getOg","option","_og$","og","isArray","String","matching_og_labels","Set","key","Object","keys","optgroups","label","includes","add","group_order","group_items","Map","item","items","options","id","has","set","push","get","size","ids","type","optgroup","renderFlatItem","_item$el","render","getOption","applyHighlights","currentResults","tokens","tok","measureHeight","reduce","h","_el$offsetHeight","offsetHeight","updateSentinel","remove","append","renderRange","to","els","i","setScrollTop","value","scrollTop","loadNext","pages","Math","min","new_els","dom_count","n","remove_els","removed_h","loadPrev","max","first_child","insertBefore","handleScroll","scrollHeight","clientHeight","pct_bottom","pct_top","hook","cancelAnimationFrame","innerHTML","first_page","on","style","assign","loading_more","addEventListener","requestAnimationFrame"],"mappings":";;;;;AA4MA;AACA;AACA;AACO,MAAMA,WAAW,GAAGA,CAAEC,QAAa,EAAEC,WAAgB,KAAM;AACjE,EAAA,IAAID,QAAQ,CAACE,UAAU,EAAGF,QAAQ,CAACE,UAAU,CAACC,YAAY,CAACF,WAAW,EAAED,QAAQ,CAAC;AAClF,CAAC;;ACjND;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,MAAMI,SAAS,GAAGA,CAACC,OAAmB,EAAEC,KAAmB,KAAK;EAEtE,IAAIA,KAAK,KAAK,IAAI,EAAG;;AAErB;AACA,EAAA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAE9B,IAAA,IAAI,CAACA,KAAK,CAACC,MAAM,EAAG;AACpBD,IAAAA,KAAK,GAAG,IAAIE,MAAM,CAACF,KAAK,EAAE,GAAG,CAAC;AAC/B,EAAA;;AAGA;AACA;EACA,MAAMG,aAAa,GAAKC,IAAS,IAAa;IAE7C,IAAIC,KAAK,GAAGD,IAAI,CAACE,IAAI,CAACD,KAAK,CAACL,KAAK,CAAC;IAClC,IAAIK,KAAK,IAAID,IAAI,CAACE,IAAI,CAACL,MAAM,GAAG,CAAC,EAAE;AAClC,MAAA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AGvB,MAAM,CAACoE,MAAM,CACnC,EAAE,EACF;MACCC,YAAY,EAAEA,MACb;AACF,KAAC,EACD3G,IAAI,CAACe,QAAQ,CAAC8C,MACf,CAAC;AAEDtD,IAAAA,gBAAgB,CAACqG,gBAAgB,CAAC,QAAQ,EAAE,MAAM;AACjD,MAAA,IAAI9F,iBAAiB,EAAE;AACtBA,QAAAA,iBAAiB,GAAG,KAAK;AACzB,QAAA;AACD,MAAA;AACA,MAAA,IAAID,MAAM,KAAK,IAAI,EAAEwF,oBAAoB,CAACxF,MAAM,CAAC;MACjDA,MAAM,GAAGgG,qBAAqB,CAAC,MAAM;AACpChG,QAAAA,MAAM,GAAG,IAAI;AACbkF,QAAAA,YAAY,EAAE;AACf,MAAA,CAAC,CAAC;AACH,IAAA,CAAC,CAAC;AACH,EAAA,CAAC,CAAC;AACH;;;;"}
@@ -0,0 +1,14 @@
1
+ export type LVSOptions = {
2
+ pageSize?: number;
3
+ maxDomItems?: number;
4
+ scrollThreshold?: number;
5
+ };
6
+ export type FlatItem = {
7
+ type: 'header';
8
+ optgroup: string;
9
+ el?: HTMLElement;
10
+ } | {
11
+ type: 'option';
12
+ id: string;
13
+ optgroup: string;
14
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/local_virtual_scroll/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Plugin: "no_active_items" (Tom Select)
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5
+ * file except in compliance with the License. You may obtain a copy of the License at:
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software distributed under
9
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
10
+ * ANY KIND, either express or implied. See the License for the specific language
11
+ * governing permissions and limitations under the License.
12
+ *
13
+ */
14
+ import type TomSelect from '../../tom-select.ts';
15
+ export default function (this: TomSelect): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tom Select v2.5.2
2
+ * Tom Select v2.5.2-virtual-scroll.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Plugin: "input_autogrow" (Tom Select)
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5
+ * file except in compliance with the License. You may obtain a copy of the License at:
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software distributed under
9
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
10
+ * ANY KIND, either express or implied. See the License for the specific language
11
+ * governing permissions and limitations under the License.
12
+ *
13
+ */
14
+ import type TomSelect from '../../tom-select.ts';
15
+ export default function (this: TomSelect): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tom Select v2.5.2
2
+ * Tom Select v2.5.2-virtual-scroll.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Plugin: "optgroup_columns" (Tom Select.js)
3
+ * Copyright (c) contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ */
15
+ import type TomSelect from '../../tom-select.ts';
16
+ export default function (this: TomSelect): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tom Select v2.5.2
2
+ * Tom Select v2.5.2-virtual-scroll.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Plugin: "remove_button" (Tom Select)
3
+ * Copyright (c) contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ */
15
+ import type TomSelect from '../../tom-select.ts';
16
+ import { RBOptions } from './types.ts';
17
+ export default function (this: TomSelect, userOptions: RBOptions): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tom Select v2.5.2
2
+ * Tom Select v2.5.2-virtual-scroll.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
@@ -0,0 +1,6 @@
1
+ export type RBOptions = {
2
+ label?: string;
3
+ title?: string;
4
+ className?: string;
5
+ append?: boolean;
6
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/remove_button/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Plugin: "restore_on_backspace" (Tom Select)
3
+ * Copyright (c) contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ */
15
+ import type TomSelect from '../../tom-select.ts';
16
+ import { TomOption } from '../../types/index.ts';
17
+ type TPluginOptions = {
18
+ text?: (option: TomOption) => string;
19
+ };
20
+ export default function (this: TomSelect, userOptions: TPluginOptions): void;
21
+ export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tom Select v2.5.2
2
+ * Tom Select v2.5.2-virtual-scroll.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Plugin: "restore_on_backspace" (Tom Select)
3
+ * Copyright (c) contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ */
15
+ import type TomSelect from '../../tom-select.ts';
16
+ export default function (this: TomSelect): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tom Select v2.5.2
2
+ * Tom Select v2.5.2-virtual-scroll.1
3
3
  * Licensed under the Apache License, Version 2.0 (the "License");
4
4
  */
5
5
 
@@ -0,0 +1,2 @@
1
+ import TomSelect from './tom-select.ts';
2
+ export default TomSelect;
@@ -0,0 +1,33 @@
1
+ import TomSelect from "./tom-select.js";
2
+ import change_listener from "./plugins/change_listener/plugin.js";
3
+ import checkbox_options from "./plugins/checkbox_options/plugin.js";
4
+ import clear_button from "./plugins/clear_button/plugin.js";
5
+ import drag_drop from "./plugins/drag_drop/plugin.js";
6
+ import dropdown_header from "./plugins/dropdown_header/plugin.js";
7
+ import caret_position from "./plugins/caret_position/plugin.js";
8
+ import dropdown_input from "./plugins/dropdown_input/plugin.js";
9
+ import input_autogrow from "./plugins/input_autogrow/plugin.js";
10
+ import no_backspace_delete from "./plugins/no_backspace_delete/plugin.js";
11
+ import no_active_items from "./plugins/no_active_items/plugin.js";
12
+ import optgroup_columns from "./plugins/optgroup_columns/plugin.js";
13
+ import remove_button from "./plugins/remove_button/plugin.js";
14
+ import restore_on_backspace from "./plugins/restore_on_backspace/plugin.js";
15
+ import virtual_scroll from "./plugins/virtual_scroll/plugin.js";
16
+ import local_virtual_scroll from "./plugins/local_virtual_scroll/plugin.js";
17
+ TomSelect.define('change_listener', change_listener);
18
+ TomSelect.define('checkbox_options', checkbox_options);
19
+ TomSelect.define('clear_button', clear_button);
20
+ TomSelect.define('drag_drop', drag_drop);
21
+ TomSelect.define('dropdown_header', dropdown_header);
22
+ TomSelect.define('caret_position', caret_position);
23
+ TomSelect.define('dropdown_input', dropdown_input);
24
+ TomSelect.define('input_autogrow', input_autogrow);
25
+ TomSelect.define('no_backspace_delete', no_backspace_delete);
26
+ TomSelect.define('no_active_items', no_active_items);
27
+ TomSelect.define('optgroup_columns', optgroup_columns);
28
+ TomSelect.define('remove_button', remove_button);
29
+ TomSelect.define('restore_on_backspace', restore_on_backspace);
30
+ TomSelect.define('virtual_scroll', virtual_scroll);
31
+ TomSelect.define('local_virtual_scroll', local_virtual_scroll);
32
+ export default TomSelect;
33
+ //# sourceMappingURL=tom-select.complete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tom-select.complete.js","sourceRoot":"","sources":["../../src/tom-select.complete.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAC5D,OAAO,SAAS,MAAM,+BAA+B,CAAC;AACtD,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,cAAc,MAAM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