@choice-ui/react 1.7.6 → 1.7.7

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 (308) hide show
  1. package/dist/components/colors/dist/index.d.ts +878 -0
  2. package/dist/components/colors/scripts/build-worker.d.ts +1 -0
  3. package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.d.ts +14 -0
  4. package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.js +403 -0
  5. package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.d.ts +12 -0
  6. package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.js +285 -0
  7. package/dist/components/colors/src/check-color-contrast/index.d.ts +2 -0
  8. package/dist/components/colors/src/color-area/color-area.d.ts +24 -0
  9. package/dist/components/colors/src/color-area/color-area.js +228 -0
  10. package/dist/components/colors/src/color-area/index.d.ts +1 -0
  11. package/dist/components/colors/src/color-area/tv.d.ts +34 -0
  12. package/dist/components/colors/src/color-area/tv.js +22 -0
  13. package/dist/components/colors/src/color-channel-field/color-channel-field.d.ts +22 -0
  14. package/dist/components/colors/src/color-channel-field/color-channel-field.js +110 -0
  15. package/dist/components/colors/src/color-channel-field/color-channel-input.d.ts +20 -0
  16. package/dist/components/colors/src/color-channel-field/color-channel-input.js +261 -0
  17. package/dist/components/colors/src/color-channel-field/index.d.ts +1 -0
  18. package/dist/components/colors/src/color-channel-field/tv.d.ts +101 -0
  19. package/dist/components/colors/src/color-channel-field/tv.js +85 -0
  20. package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.d.ts +16 -0
  21. package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.js +54 -0
  22. package/dist/components/colors/src/color-gradients-paint/color-gradient-control.d.ts +18 -0
  23. package/dist/components/colors/src/color-gradients-paint/color-gradient-control.js +149 -0
  24. package/dist/components/colors/src/color-gradients-paint/color-gradient-list.d.ts +20 -0
  25. package/dist/components/colors/src/color-gradients-paint/color-gradient-list.js +111 -0
  26. package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.d.ts +18 -0
  27. package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.js +281 -0
  28. package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.d.ts +17 -0
  29. package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.js +162 -0
  30. package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.d.ts +10 -0
  31. package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.js +62 -0
  32. package/dist/components/colors/src/color-gradients-paint/index.d.ts +3 -0
  33. package/dist/components/colors/src/color-image-paint/color-image-paint.d.ts +13 -0
  34. package/dist/components/colors/src/color-image-paint/color-image-paint.js +236 -0
  35. package/dist/components/colors/src/color-image-paint/color-image-toolbar.d.ts +9 -0
  36. package/dist/components/colors/src/color-image-paint/color-image-toolbar.js +52 -0
  37. package/dist/components/colors/src/color-image-paint/index.d.ts +1 -0
  38. package/dist/components/colors/src/color-image-paint/tv.d.ts +89 -0
  39. package/dist/components/colors/src/color-image-paint/tv.js +45 -0
  40. package/dist/components/colors/src/color-picker-content/color-picker-content.d.ts +18 -0
  41. package/dist/components/colors/src/color-picker-content/color-picker-content.js +58 -0
  42. package/dist/components/colors/src/color-picker-content/color-picker-custom-content.d.ts +16 -0
  43. package/dist/components/colors/src/color-picker-content/color-picker-custom-content.js +75 -0
  44. package/dist/components/colors/src/color-picker-content/index.d.ts +1 -0
  45. package/dist/components/colors/src/color-picker-content/paint-type-selector.d.ts +13 -0
  46. package/dist/components/colors/src/color-picker-content/paint-type-selector.js +50 -0
  47. package/dist/components/colors/src/color-picker-content/tv.d.ts +31 -0
  48. package/dist/components/colors/src/color-picker-content/tv.js +13 -0
  49. package/dist/components/colors/src/color-picker-popover/color-paints-type.d.ts +15 -0
  50. package/dist/components/colors/src/color-picker-popover/color-paints-type.js +56 -0
  51. package/dist/components/colors/src/color-picker-popover/color-picker-popover.d.ts +26 -0
  52. package/dist/components/colors/src/color-picker-popover/color-picker-popover.js +116 -0
  53. package/dist/components/colors/src/color-picker-popover/color-picker-tabs.d.ts +14 -0
  54. package/dist/components/colors/src/color-picker-popover/color-picker-tabs.js +47 -0
  55. package/dist/components/colors/src/color-picker-popover/color-picker-title.d.ts +14 -0
  56. package/dist/components/colors/src/color-picker-popover/color-picker-title.js +30 -0
  57. package/dist/components/colors/src/color-picker-popover/index.d.ts +3 -0
  58. package/dist/components/colors/src/color-picker-popover/tv.d.ts +37 -0
  59. package/dist/components/colors/src/color-slider/color-slider.d.ts +19 -0
  60. package/dist/components/colors/src/color-slider/color-slider.js +185 -0
  61. package/dist/components/colors/src/color-slider/index.d.ts +1 -0
  62. package/dist/components/colors/src/color-slider/tv.d.ts +31 -0
  63. package/dist/components/colors/src/color-slider/tv.js +21 -0
  64. package/dist/components/colors/src/color-solid-paint/color-native-picker.d.ts +8 -0
  65. package/dist/components/colors/src/color-solid-paint/color-native-picker.js +63 -0
  66. package/dist/components/colors/src/color-solid-paint/color-solid-paint.d.ts +25 -0
  67. package/dist/components/colors/src/color-solid-paint/color-solid-paint.js +295 -0
  68. package/dist/components/colors/src/color-solid-paint/index.d.ts +3 -0
  69. package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.d.ts +10 -0
  70. package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.js +20 -0
  71. package/dist/components/colors/src/color-solid-paint/solid-paint-area.d.ts +17 -0
  72. package/dist/components/colors/src/color-solid-paint/solid-paint-area.js +131 -0
  73. package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.d.ts +20 -0
  74. package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.js +147 -0
  75. package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.d.ts +14 -0
  76. package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.js +46 -0
  77. package/dist/components/colors/src/color-solid-paint/solid-paint-library-item.d.ts +8 -0
  78. package/dist/components/colors/src/color-solid-paint/tv.d.ts +79 -0
  79. package/dist/components/colors/src/color-solid-paint/tv.js +39 -0
  80. package/dist/components/colors/src/color-swatch/color-swatch.d.ts +15 -0
  81. package/dist/components/colors/src/color-swatch/color-swatch.js +111 -0
  82. package/dist/components/colors/src/color-swatch/index.d.ts +1 -0
  83. package/dist/components/colors/src/contents/color-space.d.ts +19 -0
  84. package/dist/components/colors/src/contents/color-space.js +16 -0
  85. package/dist/components/colors/src/contents/colors.d.ts +42 -0
  86. package/dist/components/colors/src/contents/colors.js +24 -0
  87. package/dist/components/colors/src/contents/index.d.ts +3 -0
  88. package/dist/components/colors/src/contents/translation.d.ts +100 -0
  89. package/dist/components/colors/src/contents/translation.js +94 -0
  90. package/dist/components/colors/src/context/colots-context.d.ts +24 -0
  91. package/dist/components/colors/src/context/colots-context.js +62 -0
  92. package/dist/components/colors/src/context/index.d.ts +1 -0
  93. package/dist/components/colors/src/fill-input/alpha-input.d.ts +12 -0
  94. package/dist/components/colors/src/fill-input/alpha-input.js +48 -0
  95. package/dist/components/colors/src/fill-input/color-input.d.ts +31 -0
  96. package/dist/components/colors/src/fill-input/color-input.js +115 -0
  97. package/dist/components/colors/src/fill-input/gradient-item.d.ts +25 -0
  98. package/dist/components/colors/src/fill-input/gradient-item.js +103 -0
  99. package/dist/components/colors/src/fill-input/image-item.d.ts +25 -0
  100. package/dist/components/colors/src/fill-input/image-item.js +89 -0
  101. package/dist/components/colors/src/fill-input/index.d.ts +5 -0
  102. package/dist/components/colors/src/fill-input/tv.d.ts +221 -0
  103. package/dist/components/colors/src/fill-input/tv.js +205 -0
  104. package/dist/components/colors/src/fill-input/variable-item.d.ts +22 -0
  105. package/dist/components/colors/src/fill-input/variable-item.js +105 -0
  106. package/dist/components/colors/src/hex-input/hex-input.d.ts +10 -0
  107. package/dist/components/colors/src/hex-input/hex-input.js +182 -0
  108. package/dist/components/colors/src/hex-input/index.d.ts +1 -0
  109. package/dist/components/colors/src/hex-input/tv.d.ts +1 -0
  110. package/dist/components/colors/src/hex-input/tv.js +12 -0
  111. package/dist/components/colors/src/hooks/index.d.ts +10 -0
  112. package/dist/components/colors/src/hooks/use-color-contrast-recommendation.d.ts +36 -0
  113. package/dist/components/colors/src/hooks/use-color-contrast-recommendation.js +502 -0
  114. package/dist/components/colors/src/hooks/use-color-parser.d.ts +10 -0
  115. package/dist/components/colors/src/hooks/use-color-parser.js +146 -0
  116. package/dist/components/colors/src/hooks/use-color-picker.d.ts +45 -0
  117. package/dist/components/colors/src/hooks/use-color-picker.js +117 -0
  118. package/dist/components/colors/src/hooks/use-color-profile.d.ts +2 -0
  119. package/dist/components/colors/src/hooks/use-color-profile.js +27 -0
  120. package/dist/components/colors/src/hooks/use-cursor.d.ts +1 -0
  121. package/dist/components/colors/src/hooks/use-cursor.js +25 -0
  122. package/dist/components/colors/src/hooks/use-features.d.ts +21 -0
  123. package/dist/components/colors/src/hooks/use-features.js +73 -0
  124. package/dist/components/colors/src/hooks/use-image-filter-style.d.ts +9 -0
  125. package/dist/components/colors/src/hooks/use-image-filter-style.js +25 -0
  126. package/dist/components/colors/src/hooks/use-image-processor.d.ts +10 -0
  127. package/dist/components/colors/src/hooks/use-image-processor.js +121 -0
  128. package/dist/components/colors/src/hooks/use-paint-state.d.ts +16 -0
  129. package/dist/components/colors/src/hooks/use-paint-state.js +37 -0
  130. package/dist/components/colors/src/hooks/use-rgb-color-handler.d.ts +21 -0
  131. package/dist/components/colors/src/hooks/use-rgb-color-handler.js +58 -0
  132. package/dist/components/colors/src/index.d.ts +38 -0
  133. package/dist/components/colors/src/libraries/components/virtualized-grid-row.d.ts +36 -0
  134. package/dist/components/colors/src/libraries/components/virtualized-grid-row.js +53 -0
  135. package/dist/components/colors/src/libraries/components/virtualized-header.d.ts +9 -0
  136. package/dist/components/colors/src/libraries/components/virtualized-header.js +30 -0
  137. package/dist/components/colors/src/libraries/hooks/index.d.ts +2 -0
  138. package/dist/components/colors/src/libraries/hooks/use-category-options.d.ts +11 -0
  139. package/dist/components/colors/src/libraries/hooks/use-category-options.js +27 -0
  140. package/dist/components/colors/src/libraries/hooks/use-palette-color.d.ts +19 -0
  141. package/dist/components/colors/src/libraries/hooks/use-palette-color.js +41 -0
  142. package/dist/components/colors/src/libraries/index.d.ts +8 -0
  143. package/dist/components/colors/src/libraries/libraries-content.d.ts +8 -0
  144. package/dist/components/colors/src/libraries/libraries-empty-content.d.ts +5 -0
  145. package/dist/components/colors/src/libraries/libraries-header.d.ts +18 -0
  146. package/dist/components/colors/src/libraries/libraries-header.js +111 -0
  147. package/dist/components/colors/src/libraries/libraries-search-empty-content.d.ts +1 -0
  148. package/dist/components/colors/src/libraries/libraries-search-input.d.ts +6 -0
  149. package/dist/components/colors/src/libraries/libraries.d.ts +42 -0
  150. package/dist/components/colors/src/libraries/libraries.js +461 -0
  151. package/dist/components/colors/src/libraries/library-color-swatch.d.ts +21 -0
  152. package/dist/components/colors/src/libraries/library-item/index.d.ts +4 -0
  153. package/dist/components/colors/src/libraries/library-item/library-item.d.ts +21 -0
  154. package/dist/components/colors/src/libraries/library-item/library-item.js +151 -0
  155. package/dist/components/colors/src/libraries/library-item/library-list-item.d.ts +6 -0
  156. package/dist/components/colors/src/libraries/library-item/style-items.d.ts +17 -0
  157. package/dist/components/colors/src/libraries/library-item/style-items.js +63 -0
  158. package/dist/components/colors/src/libraries/library-item/variable-items.d.ts +19 -0
  159. package/dist/components/colors/src/libraries/library-item/variable-items.js +47 -0
  160. package/dist/components/colors/src/libraries/tv.d.ts +198 -0
  161. package/dist/components/colors/src/libraries/tv.js +141 -0
  162. package/dist/components/colors/src/simple-color-picker/index.d.ts +1 -0
  163. package/dist/components/colors/src/simple-color-picker/simple-color-picker.d.ts +17 -0
  164. package/dist/components/colors/src/simple-color-picker/simple-color-picker.js +153 -0
  165. package/dist/components/colors/src/types/base.d.ts +5 -0
  166. package/dist/components/colors/src/types/colors.d.ts +139 -0
  167. package/dist/components/colors/src/types/effect.d.ts +18 -0
  168. package/dist/components/colors/src/types/fill.d.ts +15 -0
  169. package/dist/components/colors/src/types/fonts.d.ts +38 -0
  170. package/dist/components/colors/src/types/index.d.ts +7 -0
  171. package/dist/components/colors/src/types/libraries.d.ts +7 -0
  172. package/dist/components/colors/src/types/paint.d.ts +139 -0
  173. package/dist/components/colors/src/types/style.d.ts +51 -0
  174. package/dist/components/colors/src/types/testing-library.d.ts +0 -0
  175. package/dist/components/colors/src/types/util.d.ts +26 -0
  176. package/dist/components/colors/src/types/variable.d.ts +27 -0
  177. package/dist/components/colors/src/utils/background.d.ts +12 -0
  178. package/dist/components/colors/src/utils/background.js +216 -0
  179. package/dist/components/colors/src/utils/color-profile-storage.d.ts +29 -0
  180. package/dist/components/colors/src/utils/color.d.ts +20 -0
  181. package/dist/components/colors/src/utils/color.js +45 -0
  182. package/dist/components/colors/src/utils/colors-convert.d.ts +18 -0
  183. package/dist/components/colors/src/utils/colors-convert.js +138 -0
  184. package/dist/components/colors/src/utils/contrast-utils.d.ts +27 -0
  185. package/dist/components/colors/src/utils/contrast-utils.js +25 -0
  186. package/dist/components/colors/src/utils/cursor.d.ts +1 -0
  187. package/dist/components/colors/src/utils/index.d.ts +7 -0
  188. package/dist/components/colors/src/utils/math.d.ts +9 -0
  189. package/dist/components/colors/src/utils/position.d.ts +33 -0
  190. package/dist/components/colors/src/utils/position.js +60 -0
  191. package/dist/components/colors/src/utils/validate.d.ts +10 -0
  192. package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.d.ts +2 -0
  193. package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.js +36 -0
  194. package/dist/components/colors/src/workers/boundary-calculator.worker.d.ts +1 -0
  195. package/dist/components/colors/src/workers/index.d.ts +1 -0
  196. package/dist/components/colors/tsup.config.d.ts +2 -0
  197. package/dist/components/index.d.ts +1 -0
  198. package/dist/components/textarea/src/tv.d.ts +9 -3
  199. package/dist/components/textarea/src/tv.js +3 -1
  200. package/dist/components/toggle-button/dist/index.js +602 -0
  201. package/dist/index.js +69 -0
  202. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/index.js +119 -0
  203. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/Color.js +42 -0
  204. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/chroma.js +9 -0
  205. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/colorbrewer.js +57 -0
  206. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/w3cx11.js +159 -0
  207. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/average.js +82 -0
  208. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/bezier.js +68 -0
  209. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/blend.js +43 -0
  210. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/cubehelix.js +81 -0
  211. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/mix.js +20 -0
  212. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/random.js +13 -0
  213. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/scale.js +325 -0
  214. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/_hsx.js +54 -0
  215. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hcg.js +10 -0
  216. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsi.js +10 -0
  217. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsl.js +10 -0
  218. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsv.js +10 -0
  219. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/index.js +4 -0
  220. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lab.js +17 -0
  221. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lch.js +11 -0
  222. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lrgb.js +17 -0
  223. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/num.js +12 -0
  224. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklab.js +17 -0
  225. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklch.js +10 -0
  226. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/rgb.js +16 -0
  227. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js +20 -0
  228. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/index.js +25 -0
  229. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js +18 -0
  230. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/css2rgb.js +169 -0
  231. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/hsl2css.js +20 -0
  232. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/index.js +23 -0
  233. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lab2css.js +19 -0
  234. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lch2css.js +19 -0
  235. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklab2css.js +17 -0
  236. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklch2css.js +17 -0
  237. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/rgb2css.js +53 -0
  238. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/gl/index.js +21 -0
  239. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/hcg2rgb.js +48 -0
  240. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/index.js +25 -0
  241. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/rgb2hcg.js +24 -0
  242. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/hex2rgb.js +37 -0
  243. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/index.js +23 -0
  244. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/rgb2hex.js +31 -0
  245. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/hsi2rgb.js +36 -0
  246. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/index.js +25 -0
  247. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/rgb2hsi.js +28 -0
  248. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/hsl2rgb.js +35 -0
  249. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/index.js +25 -0
  250. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/rgb2hsl.js +29 -0
  251. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/hsv2rgb.js +46 -0
  252. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/index.js +25 -0
  253. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/rgb2hsv.js +27 -0
  254. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/input.js +7 -0
  255. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/index.js +28 -0
  256. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab-constants.js +106 -0
  257. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab2rgb.js +59 -0
  258. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/rgb2lab.js +51 -0
  259. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/hcl2rgb.js +10 -0
  260. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/index.js +35 -0
  261. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lab2lch.js +13 -0
  262. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2lab.js +12 -0
  263. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2rgb.js +14 -0
  264. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/rgb2lch.js +13 -0
  265. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/named/index.js +26 -0
  266. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/index.js +23 -0
  267. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/num2rgb.js +13 -0
  268. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/rgb2num.js +9 -0
  269. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/index.js +25 -0
  270. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/oklab2rgb.js +31 -0
  271. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/rgb2oklab.js +30 -0
  272. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/index.js +25 -0
  273. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/oklch2rgb.js +14 -0
  274. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/rgb2oklch.js +13 -0
  275. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/rgb/index.js +34 -0
  276. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/index.js +16 -0
  277. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/rgb2temperature.js +25 -0
  278. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/temperature2rgb.js +18 -0
  279. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/alpha.js +12 -0
  280. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/clipped.js +4 -0
  281. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/darken.js +14 -0
  282. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/get.js +12 -0
  283. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/luminance.js +38 -0
  284. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/mix.js +5 -0
  285. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/premultiply.js +11 -0
  286. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/saturate.js +13 -0
  287. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/set.js +42 -0
  288. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/shade.js +9 -0
  289. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/analyze.js +161 -0
  290. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/clip_rgb.js +17 -0
  291. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrast.js +12 -0
  292. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrastAPCA.js +43 -0
  293. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/delta-e.js +48 -0
  294. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/distance.js +16 -0
  295. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/index.js +24 -0
  296. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/last.js +10 -0
  297. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/limit.js +7 -0
  298. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/multiply-matrices.js +29 -0
  299. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/scales.js +16 -0
  300. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/type.js +20 -0
  301. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/unpack.js +11 -0
  302. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/valid.js +12 -0
  303. package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/version.js +4 -0
  304. package/dist/node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.js +1317 -0
  305. package/dist/styles/components.css +40 -0
  306. package/dist/tailwind.css +1 -0
  307. package/package.json +32 -20
  308. package/dist/components/virtual-select/dist/index.d.ts +0 -48
@@ -0,0 +1,1317 @@
1
+ function isArray(value) {
2
+ return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value);
3
+ }
4
+ function baseToString(value) {
5
+ if (typeof value == "string") {
6
+ return value;
7
+ }
8
+ let result = value + "";
9
+ return result == "0" && 1 / value == -Infinity ? "-0" : result;
10
+ }
11
+ function toString(value) {
12
+ return value == null ? "" : baseToString(value);
13
+ }
14
+ function isString(value) {
15
+ return typeof value === "string";
16
+ }
17
+ function isNumber(value) {
18
+ return typeof value === "number";
19
+ }
20
+ function isBoolean(value) {
21
+ return value === true || value === false || isObjectLike(value) && getTag(value) == "[object Boolean]";
22
+ }
23
+ function isObject(value) {
24
+ return typeof value === "object";
25
+ }
26
+ function isObjectLike(value) {
27
+ return isObject(value) && value !== null;
28
+ }
29
+ function isDefined(value) {
30
+ return value !== void 0 && value !== null;
31
+ }
32
+ function isBlank(value) {
33
+ return !value.trim().length;
34
+ }
35
+ function getTag(value) {
36
+ return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
37
+ }
38
+ const INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
39
+ const LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) => `Invalid value for key ${key}`;
40
+ const PATTERN_LENGTH_TOO_LARGE = (max) => `Pattern length exceeds max of ${max}.`;
41
+ const MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;
42
+ const INVALID_KEY_WEIGHT_VALUE = (key) => `Property 'weight' in key '${key}' must be a positive integer`;
43
+ const hasOwn = Object.prototype.hasOwnProperty;
44
+ class KeyStore {
45
+ constructor(keys) {
46
+ this._keys = [];
47
+ this._keyMap = {};
48
+ let totalWeight = 0;
49
+ keys.forEach((key) => {
50
+ let obj = createKey(key);
51
+ this._keys.push(obj);
52
+ this._keyMap[obj.id] = obj;
53
+ totalWeight += obj.weight;
54
+ });
55
+ this._keys.forEach((key) => {
56
+ key.weight /= totalWeight;
57
+ });
58
+ }
59
+ get(keyId) {
60
+ return this._keyMap[keyId];
61
+ }
62
+ keys() {
63
+ return this._keys;
64
+ }
65
+ toJSON() {
66
+ return JSON.stringify(this._keys);
67
+ }
68
+ }
69
+ function createKey(key) {
70
+ let path = null;
71
+ let id = null;
72
+ let src = null;
73
+ let weight = 1;
74
+ let getFn = null;
75
+ if (isString(key) || isArray(key)) {
76
+ src = key;
77
+ path = createKeyPath(key);
78
+ id = createKeyId(key);
79
+ } else {
80
+ if (!hasOwn.call(key, "name")) {
81
+ throw new Error(MISSING_KEY_PROPERTY("name"));
82
+ }
83
+ const name = key.name;
84
+ src = name;
85
+ if (hasOwn.call(key, "weight")) {
86
+ weight = key.weight;
87
+ if (weight <= 0) {
88
+ throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
89
+ }
90
+ }
91
+ path = createKeyPath(name);
92
+ id = createKeyId(name);
93
+ getFn = key.getFn;
94
+ }
95
+ return { path, id, weight, src, getFn };
96
+ }
97
+ function createKeyPath(key) {
98
+ return isArray(key) ? key : key.split(".");
99
+ }
100
+ function createKeyId(key) {
101
+ return isArray(key) ? key.join(".") : key;
102
+ }
103
+ function get(obj, path) {
104
+ let list = [];
105
+ let arr = false;
106
+ const deepGet = (obj2, path2, index) => {
107
+ if (!isDefined(obj2)) {
108
+ return;
109
+ }
110
+ if (!path2[index]) {
111
+ list.push(obj2);
112
+ } else {
113
+ let key = path2[index];
114
+ const value = obj2[key];
115
+ if (!isDefined(value)) {
116
+ return;
117
+ }
118
+ if (index === path2.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {
119
+ list.push(toString(value));
120
+ } else if (isArray(value)) {
121
+ arr = true;
122
+ for (let i = 0, len = value.length; i < len; i += 1) {
123
+ deepGet(value[i], path2, index + 1);
124
+ }
125
+ } else if (path2.length) {
126
+ deepGet(value, path2, index + 1);
127
+ }
128
+ }
129
+ };
130
+ deepGet(obj, isString(path) ? path.split(".") : path, 0);
131
+ return arr ? list : list[0];
132
+ }
133
+ const MatchOptions = {
134
+ // Whether the matches should be included in the result set. When `true`, each record in the result
135
+ // set will include the indices of the matched characters.
136
+ // These can consequently be used for highlighting purposes.
137
+ includeMatches: false,
138
+ // When `true`, the matching function will continue to the end of a search pattern even if
139
+ // a perfect match has already been located in the string.
140
+ findAllMatches: false,
141
+ // Minimum number of characters that must be matched before a result is considered a match
142
+ minMatchCharLength: 1
143
+ };
144
+ const BasicOptions = {
145
+ // When `true`, the algorithm continues searching to the end of the input even if a perfect
146
+ // match is found before the end of the same input.
147
+ isCaseSensitive: false,
148
+ // When `true`, the algorithm will ignore diacritics (accents) in comparisons
149
+ ignoreDiacritics: false,
150
+ // When true, the matching function will continue to the end of a search pattern even if
151
+ includeScore: false,
152
+ // List of properties that will be searched. This also supports nested properties.
153
+ keys: [],
154
+ // Whether to sort the result list, by score
155
+ shouldSort: true,
156
+ // Default sort function: sort by ascending score, ascending index
157
+ sortFn: (a, b) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1
158
+ };
159
+ const FuzzyOptions = {
160
+ // Approximately where in the text is the pattern expected to be found?
161
+ location: 0,
162
+ // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
163
+ // (of both letters and location), a threshold of '1.0' would match anything.
164
+ threshold: 0.6,
165
+ // Determines how close the match must be to the fuzzy location (specified above).
166
+ // An exact letter match which is 'distance' characters away from the fuzzy location
167
+ // would score as a complete mismatch. A distance of '0' requires the match be at
168
+ // the exact location specified, a threshold of '1000' would require a perfect match
169
+ // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
170
+ distance: 100
171
+ };
172
+ const AdvancedOptions = {
173
+ // When `true`, it enables the use of unix-like search commands
174
+ useExtendedSearch: false,
175
+ // The get function to use when fetching an object's properties.
176
+ // The default will search nested paths *ie foo.bar.baz*
177
+ getFn: get,
178
+ // When `true`, search will ignore `location` and `distance`, so it won't matter
179
+ // where in the string the pattern appears.
180
+ // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
181
+ ignoreLocation: false,
182
+ // When `true`, the calculation for the relevance score (used for sorting) will
183
+ // ignore the field-length norm.
184
+ // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
185
+ ignoreFieldNorm: false,
186
+ // The weight to determine how much field length norm effects scoring.
187
+ fieldNormWeight: 1
188
+ };
189
+ var Config = {
190
+ ...BasicOptions,
191
+ ...MatchOptions,
192
+ ...FuzzyOptions,
193
+ ...AdvancedOptions
194
+ };
195
+ const SPACE = /[^ ]+/g;
196
+ function norm(weight = 1, mantissa = 3) {
197
+ const cache = /* @__PURE__ */ new Map();
198
+ const m = Math.pow(10, mantissa);
199
+ return {
200
+ get(value) {
201
+ const numTokens = value.match(SPACE).length;
202
+ if (cache.has(numTokens)) {
203
+ return cache.get(numTokens);
204
+ }
205
+ const norm2 = 1 / Math.pow(numTokens, 0.5 * weight);
206
+ const n = parseFloat(Math.round(norm2 * m) / m);
207
+ cache.set(numTokens, n);
208
+ return n;
209
+ },
210
+ clear() {
211
+ cache.clear();
212
+ }
213
+ };
214
+ }
215
+ class FuseIndex {
216
+ constructor({
217
+ getFn = Config.getFn,
218
+ fieldNormWeight = Config.fieldNormWeight
219
+ } = {}) {
220
+ this.norm = norm(fieldNormWeight, 3);
221
+ this.getFn = getFn;
222
+ this.isCreated = false;
223
+ this.setIndexRecords();
224
+ }
225
+ setSources(docs = []) {
226
+ this.docs = docs;
227
+ }
228
+ setIndexRecords(records = []) {
229
+ this.records = records;
230
+ }
231
+ setKeys(keys = []) {
232
+ this.keys = keys;
233
+ this._keysMap = {};
234
+ keys.forEach((key, idx) => {
235
+ this._keysMap[key.id] = idx;
236
+ });
237
+ }
238
+ create() {
239
+ if (this.isCreated || !this.docs.length) {
240
+ return;
241
+ }
242
+ this.isCreated = true;
243
+ if (isString(this.docs[0])) {
244
+ this.docs.forEach((doc, docIndex) => {
245
+ this._addString(doc, docIndex);
246
+ });
247
+ } else {
248
+ this.docs.forEach((doc, docIndex) => {
249
+ this._addObject(doc, docIndex);
250
+ });
251
+ }
252
+ this.norm.clear();
253
+ }
254
+ // Adds a doc to the end of the index
255
+ add(doc) {
256
+ const idx = this.size();
257
+ if (isString(doc)) {
258
+ this._addString(doc, idx);
259
+ } else {
260
+ this._addObject(doc, idx);
261
+ }
262
+ }
263
+ // Removes the doc at the specified index of the index
264
+ removeAt(idx) {
265
+ this.records.splice(idx, 1);
266
+ for (let i = idx, len = this.size(); i < len; i += 1) {
267
+ this.records[i].i -= 1;
268
+ }
269
+ }
270
+ getValueForItemAtKeyId(item, keyId) {
271
+ return item[this._keysMap[keyId]];
272
+ }
273
+ size() {
274
+ return this.records.length;
275
+ }
276
+ _addString(doc, docIndex) {
277
+ if (!isDefined(doc) || isBlank(doc)) {
278
+ return;
279
+ }
280
+ let record = {
281
+ v: doc,
282
+ i: docIndex,
283
+ n: this.norm.get(doc)
284
+ };
285
+ this.records.push(record);
286
+ }
287
+ _addObject(doc, docIndex) {
288
+ let record = { i: docIndex, $: {} };
289
+ this.keys.forEach((key, keyIndex) => {
290
+ let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);
291
+ if (!isDefined(value)) {
292
+ return;
293
+ }
294
+ if (isArray(value)) {
295
+ let subRecords = [];
296
+ const stack = [{ nestedArrIndex: -1, value }];
297
+ while (stack.length) {
298
+ const { nestedArrIndex, value: value2 } = stack.pop();
299
+ if (!isDefined(value2)) {
300
+ continue;
301
+ }
302
+ if (isString(value2) && !isBlank(value2)) {
303
+ let subRecord = {
304
+ v: value2,
305
+ i: nestedArrIndex,
306
+ n: this.norm.get(value2)
307
+ };
308
+ subRecords.push(subRecord);
309
+ } else if (isArray(value2)) {
310
+ value2.forEach((item, k) => {
311
+ stack.push({
312
+ nestedArrIndex: k,
313
+ value: item
314
+ });
315
+ });
316
+ } else ;
317
+ }
318
+ record.$[keyIndex] = subRecords;
319
+ } else if (isString(value) && !isBlank(value)) {
320
+ let subRecord = {
321
+ v: value,
322
+ n: this.norm.get(value)
323
+ };
324
+ record.$[keyIndex] = subRecord;
325
+ }
326
+ });
327
+ this.records.push(record);
328
+ }
329
+ toJSON() {
330
+ return {
331
+ keys: this.keys,
332
+ records: this.records
333
+ };
334
+ }
335
+ }
336
+ function createIndex(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
337
+ const myIndex = new FuseIndex({ getFn, fieldNormWeight });
338
+ myIndex.setKeys(keys.map(createKey));
339
+ myIndex.setSources(docs);
340
+ myIndex.create();
341
+ return myIndex;
342
+ }
343
+ function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
344
+ const { keys, records } = data;
345
+ const myIndex = new FuseIndex({ getFn, fieldNormWeight });
346
+ myIndex.setKeys(keys);
347
+ myIndex.setIndexRecords(records);
348
+ return myIndex;
349
+ }
350
+ function computeScore$1(pattern, {
351
+ errors = 0,
352
+ currentLocation = 0,
353
+ expectedLocation = 0,
354
+ distance = Config.distance,
355
+ ignoreLocation = Config.ignoreLocation
356
+ } = {}) {
357
+ const accuracy = errors / pattern.length;
358
+ if (ignoreLocation) {
359
+ return accuracy;
360
+ }
361
+ const proximity = Math.abs(expectedLocation - currentLocation);
362
+ if (!distance) {
363
+ return proximity ? 1 : accuracy;
364
+ }
365
+ return accuracy + proximity / distance;
366
+ }
367
+ function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) {
368
+ let indices = [];
369
+ let start = -1;
370
+ let end = -1;
371
+ let i = 0;
372
+ for (let len = matchmask.length; i < len; i += 1) {
373
+ let match = matchmask[i];
374
+ if (match && start === -1) {
375
+ start = i;
376
+ } else if (!match && start !== -1) {
377
+ end = i - 1;
378
+ if (end - start + 1 >= minMatchCharLength) {
379
+ indices.push([start, end]);
380
+ }
381
+ start = -1;
382
+ }
383
+ }
384
+ if (matchmask[i - 1] && i - start >= minMatchCharLength) {
385
+ indices.push([start, i - 1]);
386
+ }
387
+ return indices;
388
+ }
389
+ const MAX_BITS = 32;
390
+ function search(text, pattern, patternAlphabet, {
391
+ location = Config.location,
392
+ distance = Config.distance,
393
+ threshold = Config.threshold,
394
+ findAllMatches = Config.findAllMatches,
395
+ minMatchCharLength = Config.minMatchCharLength,
396
+ includeMatches = Config.includeMatches,
397
+ ignoreLocation = Config.ignoreLocation
398
+ } = {}) {
399
+ if (pattern.length > MAX_BITS) {
400
+ throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));
401
+ }
402
+ const patternLen = pattern.length;
403
+ const textLen = text.length;
404
+ const expectedLocation = Math.max(0, Math.min(location, textLen));
405
+ let currentThreshold = threshold;
406
+ let bestLocation = expectedLocation;
407
+ const computeMatches = minMatchCharLength > 1 || includeMatches;
408
+ const matchMask = computeMatches ? Array(textLen) : [];
409
+ let index;
410
+ while ((index = text.indexOf(pattern, bestLocation)) > -1) {
411
+ let score = computeScore$1(pattern, {
412
+ currentLocation: index,
413
+ expectedLocation,
414
+ distance,
415
+ ignoreLocation
416
+ });
417
+ currentThreshold = Math.min(score, currentThreshold);
418
+ bestLocation = index + patternLen;
419
+ if (computeMatches) {
420
+ let i = 0;
421
+ while (i < patternLen) {
422
+ matchMask[index + i] = 1;
423
+ i += 1;
424
+ }
425
+ }
426
+ }
427
+ bestLocation = -1;
428
+ let lastBitArr = [];
429
+ let finalScore = 1;
430
+ let binMax = patternLen + textLen;
431
+ const mask = 1 << patternLen - 1;
432
+ for (let i = 0; i < patternLen; i += 1) {
433
+ let binMin = 0;
434
+ let binMid = binMax;
435
+ while (binMin < binMid) {
436
+ const score2 = computeScore$1(pattern, {
437
+ errors: i,
438
+ currentLocation: expectedLocation + binMid,
439
+ expectedLocation,
440
+ distance,
441
+ ignoreLocation
442
+ });
443
+ if (score2 <= currentThreshold) {
444
+ binMin = binMid;
445
+ } else {
446
+ binMax = binMid;
447
+ }
448
+ binMid = Math.floor((binMax - binMin) / 2 + binMin);
449
+ }
450
+ binMax = binMid;
451
+ let start = Math.max(1, expectedLocation - binMid + 1);
452
+ let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;
453
+ let bitArr = Array(finish + 2);
454
+ bitArr[finish + 1] = (1 << i) - 1;
455
+ for (let j = finish; j >= start; j -= 1) {
456
+ let currentLocation = j - 1;
457
+ let charMatch = patternAlphabet[text.charAt(currentLocation)];
458
+ if (computeMatches) {
459
+ matchMask[currentLocation] = +!!charMatch;
460
+ }
461
+ bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;
462
+ if (i) {
463
+ bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
464
+ }
465
+ if (bitArr[j] & mask) {
466
+ finalScore = computeScore$1(pattern, {
467
+ errors: i,
468
+ currentLocation,
469
+ expectedLocation,
470
+ distance,
471
+ ignoreLocation
472
+ });
473
+ if (finalScore <= currentThreshold) {
474
+ currentThreshold = finalScore;
475
+ bestLocation = currentLocation;
476
+ if (bestLocation <= expectedLocation) {
477
+ break;
478
+ }
479
+ start = Math.max(1, 2 * expectedLocation - bestLocation);
480
+ }
481
+ }
482
+ }
483
+ const score = computeScore$1(pattern, {
484
+ errors: i + 1,
485
+ currentLocation: expectedLocation,
486
+ expectedLocation,
487
+ distance,
488
+ ignoreLocation
489
+ });
490
+ if (score > currentThreshold) {
491
+ break;
492
+ }
493
+ lastBitArr = bitArr;
494
+ }
495
+ const result = {
496
+ isMatch: bestLocation >= 0,
497
+ // Count exact matches (those with a score of 0) to be "almost" exact
498
+ score: Math.max(1e-3, finalScore)
499
+ };
500
+ if (computeMatches) {
501
+ const indices = convertMaskToIndices(matchMask, minMatchCharLength);
502
+ if (!indices.length) {
503
+ result.isMatch = false;
504
+ } else if (includeMatches) {
505
+ result.indices = indices;
506
+ }
507
+ }
508
+ return result;
509
+ }
510
+ function createPatternAlphabet(pattern) {
511
+ let mask = {};
512
+ for (let i = 0, len = pattern.length; i < len; i += 1) {
513
+ const char = pattern.charAt(i);
514
+ mask[char] = (mask[char] || 0) | 1 << len - i - 1;
515
+ }
516
+ return mask;
517
+ }
518
+ const stripDiacritics = String.prototype.normalize ? (str) => str.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "") : (str) => str;
519
+ class BitapSearch {
520
+ constructor(pattern, {
521
+ location = Config.location,
522
+ threshold = Config.threshold,
523
+ distance = Config.distance,
524
+ includeMatches = Config.includeMatches,
525
+ findAllMatches = Config.findAllMatches,
526
+ minMatchCharLength = Config.minMatchCharLength,
527
+ isCaseSensitive = Config.isCaseSensitive,
528
+ ignoreDiacritics = Config.ignoreDiacritics,
529
+ ignoreLocation = Config.ignoreLocation
530
+ } = {}) {
531
+ this.options = {
532
+ location,
533
+ threshold,
534
+ distance,
535
+ includeMatches,
536
+ findAllMatches,
537
+ minMatchCharLength,
538
+ isCaseSensitive,
539
+ ignoreDiacritics,
540
+ ignoreLocation
541
+ };
542
+ pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
543
+ pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
544
+ this.pattern = pattern;
545
+ this.chunks = [];
546
+ if (!this.pattern.length) {
547
+ return;
548
+ }
549
+ const addChunk = (pattern2, startIndex) => {
550
+ this.chunks.push({
551
+ pattern: pattern2,
552
+ alphabet: createPatternAlphabet(pattern2),
553
+ startIndex
554
+ });
555
+ };
556
+ const len = this.pattern.length;
557
+ if (len > MAX_BITS) {
558
+ let i = 0;
559
+ const remainder = len % MAX_BITS;
560
+ const end = len - remainder;
561
+ while (i < end) {
562
+ addChunk(this.pattern.substr(i, MAX_BITS), i);
563
+ i += MAX_BITS;
564
+ }
565
+ if (remainder) {
566
+ const startIndex = len - MAX_BITS;
567
+ addChunk(this.pattern.substr(startIndex), startIndex);
568
+ }
569
+ } else {
570
+ addChunk(this.pattern, 0);
571
+ }
572
+ }
573
+ searchIn(text) {
574
+ const { isCaseSensitive, ignoreDiacritics, includeMatches } = this.options;
575
+ text = isCaseSensitive ? text : text.toLowerCase();
576
+ text = ignoreDiacritics ? stripDiacritics(text) : text;
577
+ if (this.pattern === text) {
578
+ let result2 = {
579
+ isMatch: true,
580
+ score: 0
581
+ };
582
+ if (includeMatches) {
583
+ result2.indices = [[0, text.length - 1]];
584
+ }
585
+ return result2;
586
+ }
587
+ const {
588
+ location,
589
+ distance,
590
+ threshold,
591
+ findAllMatches,
592
+ minMatchCharLength,
593
+ ignoreLocation
594
+ } = this.options;
595
+ let allIndices = [];
596
+ let totalScore = 0;
597
+ let hasMatches = false;
598
+ this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
599
+ const { isMatch, score, indices } = search(text, pattern, alphabet, {
600
+ location: location + startIndex,
601
+ distance,
602
+ threshold,
603
+ findAllMatches,
604
+ minMatchCharLength,
605
+ includeMatches,
606
+ ignoreLocation
607
+ });
608
+ if (isMatch) {
609
+ hasMatches = true;
610
+ }
611
+ totalScore += score;
612
+ if (isMatch && indices) {
613
+ allIndices = [...allIndices, ...indices];
614
+ }
615
+ });
616
+ let result = {
617
+ isMatch: hasMatches,
618
+ score: hasMatches ? totalScore / this.chunks.length : 1
619
+ };
620
+ if (hasMatches && includeMatches) {
621
+ result.indices = allIndices;
622
+ }
623
+ return result;
624
+ }
625
+ }
626
+ class BaseMatch {
627
+ constructor(pattern) {
628
+ this.pattern = pattern;
629
+ }
630
+ static isMultiMatch(pattern) {
631
+ return getMatch(pattern, this.multiRegex);
632
+ }
633
+ static isSingleMatch(pattern) {
634
+ return getMatch(pattern, this.singleRegex);
635
+ }
636
+ search() {
637
+ }
638
+ }
639
+ function getMatch(pattern, exp) {
640
+ const matches = pattern.match(exp);
641
+ return matches ? matches[1] : null;
642
+ }
643
+ class ExactMatch extends BaseMatch {
644
+ constructor(pattern) {
645
+ super(pattern);
646
+ }
647
+ static get type() {
648
+ return "exact";
649
+ }
650
+ static get multiRegex() {
651
+ return /^="(.*)"$/;
652
+ }
653
+ static get singleRegex() {
654
+ return /^=(.*)$/;
655
+ }
656
+ search(text) {
657
+ const isMatch = text === this.pattern;
658
+ return {
659
+ isMatch,
660
+ score: isMatch ? 0 : 1,
661
+ indices: [0, this.pattern.length - 1]
662
+ };
663
+ }
664
+ }
665
+ class InverseExactMatch extends BaseMatch {
666
+ constructor(pattern) {
667
+ super(pattern);
668
+ }
669
+ static get type() {
670
+ return "inverse-exact";
671
+ }
672
+ static get multiRegex() {
673
+ return /^!"(.*)"$/;
674
+ }
675
+ static get singleRegex() {
676
+ return /^!(.*)$/;
677
+ }
678
+ search(text) {
679
+ const index = text.indexOf(this.pattern);
680
+ const isMatch = index === -1;
681
+ return {
682
+ isMatch,
683
+ score: isMatch ? 0 : 1,
684
+ indices: [0, text.length - 1]
685
+ };
686
+ }
687
+ }
688
+ class PrefixExactMatch extends BaseMatch {
689
+ constructor(pattern) {
690
+ super(pattern);
691
+ }
692
+ static get type() {
693
+ return "prefix-exact";
694
+ }
695
+ static get multiRegex() {
696
+ return /^\^"(.*)"$/;
697
+ }
698
+ static get singleRegex() {
699
+ return /^\^(.*)$/;
700
+ }
701
+ search(text) {
702
+ const isMatch = text.startsWith(this.pattern);
703
+ return {
704
+ isMatch,
705
+ score: isMatch ? 0 : 1,
706
+ indices: [0, this.pattern.length - 1]
707
+ };
708
+ }
709
+ }
710
+ class InversePrefixExactMatch extends BaseMatch {
711
+ constructor(pattern) {
712
+ super(pattern);
713
+ }
714
+ static get type() {
715
+ return "inverse-prefix-exact";
716
+ }
717
+ static get multiRegex() {
718
+ return /^!\^"(.*)"$/;
719
+ }
720
+ static get singleRegex() {
721
+ return /^!\^(.*)$/;
722
+ }
723
+ search(text) {
724
+ const isMatch = !text.startsWith(this.pattern);
725
+ return {
726
+ isMatch,
727
+ score: isMatch ? 0 : 1,
728
+ indices: [0, text.length - 1]
729
+ };
730
+ }
731
+ }
732
+ class SuffixExactMatch extends BaseMatch {
733
+ constructor(pattern) {
734
+ super(pattern);
735
+ }
736
+ static get type() {
737
+ return "suffix-exact";
738
+ }
739
+ static get multiRegex() {
740
+ return /^"(.*)"\$$/;
741
+ }
742
+ static get singleRegex() {
743
+ return /^(.*)\$$/;
744
+ }
745
+ search(text) {
746
+ const isMatch = text.endsWith(this.pattern);
747
+ return {
748
+ isMatch,
749
+ score: isMatch ? 0 : 1,
750
+ indices: [text.length - this.pattern.length, text.length - 1]
751
+ };
752
+ }
753
+ }
754
+ class InverseSuffixExactMatch extends BaseMatch {
755
+ constructor(pattern) {
756
+ super(pattern);
757
+ }
758
+ static get type() {
759
+ return "inverse-suffix-exact";
760
+ }
761
+ static get multiRegex() {
762
+ return /^!"(.*)"\$$/;
763
+ }
764
+ static get singleRegex() {
765
+ return /^!(.*)\$$/;
766
+ }
767
+ search(text) {
768
+ const isMatch = !text.endsWith(this.pattern);
769
+ return {
770
+ isMatch,
771
+ score: isMatch ? 0 : 1,
772
+ indices: [0, text.length - 1]
773
+ };
774
+ }
775
+ }
776
+ class FuzzyMatch extends BaseMatch {
777
+ constructor(pattern, {
778
+ location = Config.location,
779
+ threshold = Config.threshold,
780
+ distance = Config.distance,
781
+ includeMatches = Config.includeMatches,
782
+ findAllMatches = Config.findAllMatches,
783
+ minMatchCharLength = Config.minMatchCharLength,
784
+ isCaseSensitive = Config.isCaseSensitive,
785
+ ignoreDiacritics = Config.ignoreDiacritics,
786
+ ignoreLocation = Config.ignoreLocation
787
+ } = {}) {
788
+ super(pattern);
789
+ this._bitapSearch = new BitapSearch(pattern, {
790
+ location,
791
+ threshold,
792
+ distance,
793
+ includeMatches,
794
+ findAllMatches,
795
+ minMatchCharLength,
796
+ isCaseSensitive,
797
+ ignoreDiacritics,
798
+ ignoreLocation
799
+ });
800
+ }
801
+ static get type() {
802
+ return "fuzzy";
803
+ }
804
+ static get multiRegex() {
805
+ return /^"(.*)"$/;
806
+ }
807
+ static get singleRegex() {
808
+ return /^(.*)$/;
809
+ }
810
+ search(text) {
811
+ return this._bitapSearch.searchIn(text);
812
+ }
813
+ }
814
+ class IncludeMatch extends BaseMatch {
815
+ constructor(pattern) {
816
+ super(pattern);
817
+ }
818
+ static get type() {
819
+ return "include";
820
+ }
821
+ static get multiRegex() {
822
+ return /^'"(.*)"$/;
823
+ }
824
+ static get singleRegex() {
825
+ return /^'(.*)$/;
826
+ }
827
+ search(text) {
828
+ let location = 0;
829
+ let index;
830
+ const indices = [];
831
+ const patternLen = this.pattern.length;
832
+ while ((index = text.indexOf(this.pattern, location)) > -1) {
833
+ location = index + patternLen;
834
+ indices.push([index, location - 1]);
835
+ }
836
+ const isMatch = !!indices.length;
837
+ return {
838
+ isMatch,
839
+ score: isMatch ? 0 : 1,
840
+ indices
841
+ };
842
+ }
843
+ }
844
+ const searchers = [
845
+ ExactMatch,
846
+ IncludeMatch,
847
+ PrefixExactMatch,
848
+ InversePrefixExactMatch,
849
+ InverseSuffixExactMatch,
850
+ SuffixExactMatch,
851
+ InverseExactMatch,
852
+ FuzzyMatch
853
+ ];
854
+ const searchersLen = searchers.length;
855
+ const SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;
856
+ const OR_TOKEN = "|";
857
+ function parseQuery(pattern, options = {}) {
858
+ return pattern.split(OR_TOKEN).map((item) => {
859
+ let query = item.trim().split(SPACE_RE).filter((item2) => item2 && !!item2.trim());
860
+ let results = [];
861
+ for (let i = 0, len = query.length; i < len; i += 1) {
862
+ const queryItem = query[i];
863
+ let found = false;
864
+ let idx = -1;
865
+ while (!found && ++idx < searchersLen) {
866
+ const searcher = searchers[idx];
867
+ let token = searcher.isMultiMatch(queryItem);
868
+ if (token) {
869
+ results.push(new searcher(token, options));
870
+ found = true;
871
+ }
872
+ }
873
+ if (found) {
874
+ continue;
875
+ }
876
+ idx = -1;
877
+ while (++idx < searchersLen) {
878
+ const searcher = searchers[idx];
879
+ let token = searcher.isSingleMatch(queryItem);
880
+ if (token) {
881
+ results.push(new searcher(token, options));
882
+ break;
883
+ }
884
+ }
885
+ }
886
+ return results;
887
+ });
888
+ }
889
+ const MultiMatchSet = /* @__PURE__ */ new Set([FuzzyMatch.type, IncludeMatch.type]);
890
+ class ExtendedSearch {
891
+ constructor(pattern, {
892
+ isCaseSensitive = Config.isCaseSensitive,
893
+ ignoreDiacritics = Config.ignoreDiacritics,
894
+ includeMatches = Config.includeMatches,
895
+ minMatchCharLength = Config.minMatchCharLength,
896
+ ignoreLocation = Config.ignoreLocation,
897
+ findAllMatches = Config.findAllMatches,
898
+ location = Config.location,
899
+ threshold = Config.threshold,
900
+ distance = Config.distance
901
+ } = {}) {
902
+ this.query = null;
903
+ this.options = {
904
+ isCaseSensitive,
905
+ ignoreDiacritics,
906
+ includeMatches,
907
+ minMatchCharLength,
908
+ findAllMatches,
909
+ ignoreLocation,
910
+ location,
911
+ threshold,
912
+ distance
913
+ };
914
+ pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
915
+ pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
916
+ this.pattern = pattern;
917
+ this.query = parseQuery(this.pattern, this.options);
918
+ }
919
+ static condition(_, options) {
920
+ return options.useExtendedSearch;
921
+ }
922
+ searchIn(text) {
923
+ const query = this.query;
924
+ if (!query) {
925
+ return {
926
+ isMatch: false,
927
+ score: 1
928
+ };
929
+ }
930
+ const { includeMatches, isCaseSensitive, ignoreDiacritics } = this.options;
931
+ text = isCaseSensitive ? text : text.toLowerCase();
932
+ text = ignoreDiacritics ? stripDiacritics(text) : text;
933
+ let numMatches = 0;
934
+ let allIndices = [];
935
+ let totalScore = 0;
936
+ for (let i = 0, qLen = query.length; i < qLen; i += 1) {
937
+ const searchers2 = query[i];
938
+ allIndices.length = 0;
939
+ numMatches = 0;
940
+ for (let j = 0, pLen = searchers2.length; j < pLen; j += 1) {
941
+ const searcher = searchers2[j];
942
+ const { isMatch, indices, score } = searcher.search(text);
943
+ if (isMatch) {
944
+ numMatches += 1;
945
+ totalScore += score;
946
+ if (includeMatches) {
947
+ const type = searcher.constructor.type;
948
+ if (MultiMatchSet.has(type)) {
949
+ allIndices = [...allIndices, ...indices];
950
+ } else {
951
+ allIndices.push(indices);
952
+ }
953
+ }
954
+ } else {
955
+ totalScore = 0;
956
+ numMatches = 0;
957
+ allIndices.length = 0;
958
+ break;
959
+ }
960
+ }
961
+ if (numMatches) {
962
+ let result = {
963
+ isMatch: true,
964
+ score: totalScore / numMatches
965
+ };
966
+ if (includeMatches) {
967
+ result.indices = allIndices;
968
+ }
969
+ return result;
970
+ }
971
+ }
972
+ return {
973
+ isMatch: false,
974
+ score: 1
975
+ };
976
+ }
977
+ }
978
+ const registeredSearchers = [];
979
+ function register(...args) {
980
+ registeredSearchers.push(...args);
981
+ }
982
+ function createSearcher(pattern, options) {
983
+ for (let i = 0, len = registeredSearchers.length; i < len; i += 1) {
984
+ let searcherClass = registeredSearchers[i];
985
+ if (searcherClass.condition(pattern, options)) {
986
+ return new searcherClass(pattern, options);
987
+ }
988
+ }
989
+ return new BitapSearch(pattern, options);
990
+ }
991
+ const LogicalOperator = {
992
+ AND: "$and",
993
+ OR: "$or"
994
+ };
995
+ const KeyType = {
996
+ PATH: "$path",
997
+ PATTERN: "$val"
998
+ };
999
+ const isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);
1000
+ const isPath = (query) => !!query[KeyType.PATH];
1001
+ const isLeaf = (query) => !isArray(query) && isObject(query) && !isExpression(query);
1002
+ const convertToExplicit = (query) => ({
1003
+ [LogicalOperator.AND]: Object.keys(query).map((key) => ({
1004
+ [key]: query[key]
1005
+ }))
1006
+ });
1007
+ function parse(query, options, { auto = true } = {}) {
1008
+ const next = (query2) => {
1009
+ let keys = Object.keys(query2);
1010
+ const isQueryPath = isPath(query2);
1011
+ if (!isQueryPath && keys.length > 1 && !isExpression(query2)) {
1012
+ return next(convertToExplicit(query2));
1013
+ }
1014
+ if (isLeaf(query2)) {
1015
+ const key = isQueryPath ? query2[KeyType.PATH] : keys[0];
1016
+ const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key];
1017
+ if (!isString(pattern)) {
1018
+ throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
1019
+ }
1020
+ const obj = {
1021
+ keyId: createKeyId(key),
1022
+ pattern
1023
+ };
1024
+ if (auto) {
1025
+ obj.searcher = createSearcher(pattern, options);
1026
+ }
1027
+ return obj;
1028
+ }
1029
+ let node = {
1030
+ children: [],
1031
+ operator: keys[0]
1032
+ };
1033
+ keys.forEach((key) => {
1034
+ const value = query2[key];
1035
+ if (isArray(value)) {
1036
+ value.forEach((item) => {
1037
+ node.children.push(next(item));
1038
+ });
1039
+ }
1040
+ });
1041
+ return node;
1042
+ };
1043
+ if (!isExpression(query)) {
1044
+ query = convertToExplicit(query);
1045
+ }
1046
+ return next(query);
1047
+ }
1048
+ function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
1049
+ results.forEach((result) => {
1050
+ let totalScore = 1;
1051
+ result.matches.forEach(({ key, norm: norm2, score }) => {
1052
+ const weight = key ? key.weight : null;
1053
+ totalScore *= Math.pow(
1054
+ score === 0 && weight ? Number.EPSILON : score,
1055
+ (weight || 1) * (ignoreFieldNorm ? 1 : norm2)
1056
+ );
1057
+ });
1058
+ result.score = totalScore;
1059
+ });
1060
+ }
1061
+ function transformMatches(result, data) {
1062
+ const matches = result.matches;
1063
+ data.matches = [];
1064
+ if (!isDefined(matches)) {
1065
+ return;
1066
+ }
1067
+ matches.forEach((match) => {
1068
+ if (!isDefined(match.indices) || !match.indices.length) {
1069
+ return;
1070
+ }
1071
+ const { indices, value } = match;
1072
+ let obj = {
1073
+ indices,
1074
+ value
1075
+ };
1076
+ if (match.key) {
1077
+ obj.key = match.key.src;
1078
+ }
1079
+ if (match.idx > -1) {
1080
+ obj.refIndex = match.idx;
1081
+ }
1082
+ data.matches.push(obj);
1083
+ });
1084
+ }
1085
+ function transformScore(result, data) {
1086
+ data.score = result.score;
1087
+ }
1088
+ function format(results, docs, {
1089
+ includeMatches = Config.includeMatches,
1090
+ includeScore = Config.includeScore
1091
+ } = {}) {
1092
+ const transformers = [];
1093
+ if (includeMatches) transformers.push(transformMatches);
1094
+ if (includeScore) transformers.push(transformScore);
1095
+ return results.map((result) => {
1096
+ const { idx } = result;
1097
+ const data = {
1098
+ item: docs[idx],
1099
+ refIndex: idx
1100
+ };
1101
+ if (transformers.length) {
1102
+ transformers.forEach((transformer) => {
1103
+ transformer(result, data);
1104
+ });
1105
+ }
1106
+ return data;
1107
+ });
1108
+ }
1109
+ class Fuse {
1110
+ constructor(docs, options = {}, index) {
1111
+ this.options = { ...Config, ...options };
1112
+ if (this.options.useExtendedSearch && false) ;
1113
+ this._keyStore = new KeyStore(this.options.keys);
1114
+ this.setCollection(docs, index);
1115
+ }
1116
+ setCollection(docs, index) {
1117
+ this._docs = docs;
1118
+ if (index && !(index instanceof FuseIndex)) {
1119
+ throw new Error(INCORRECT_INDEX_TYPE);
1120
+ }
1121
+ this._myIndex = index || createIndex(this.options.keys, this._docs, {
1122
+ getFn: this.options.getFn,
1123
+ fieldNormWeight: this.options.fieldNormWeight
1124
+ });
1125
+ }
1126
+ add(doc) {
1127
+ if (!isDefined(doc)) {
1128
+ return;
1129
+ }
1130
+ this._docs.push(doc);
1131
+ this._myIndex.add(doc);
1132
+ }
1133
+ remove(predicate = () => false) {
1134
+ const results = [];
1135
+ for (let i = 0, len = this._docs.length; i < len; i += 1) {
1136
+ const doc = this._docs[i];
1137
+ if (predicate(doc, i)) {
1138
+ this.removeAt(i);
1139
+ i -= 1;
1140
+ len -= 1;
1141
+ results.push(doc);
1142
+ }
1143
+ }
1144
+ return results;
1145
+ }
1146
+ removeAt(idx) {
1147
+ this._docs.splice(idx, 1);
1148
+ this._myIndex.removeAt(idx);
1149
+ }
1150
+ getIndex() {
1151
+ return this._myIndex;
1152
+ }
1153
+ search(query, { limit = -1 } = {}) {
1154
+ const {
1155
+ includeMatches,
1156
+ includeScore,
1157
+ shouldSort,
1158
+ sortFn,
1159
+ ignoreFieldNorm
1160
+ } = this.options;
1161
+ let results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);
1162
+ computeScore(results, { ignoreFieldNorm });
1163
+ if (shouldSort) {
1164
+ results.sort(sortFn);
1165
+ }
1166
+ if (isNumber(limit) && limit > -1) {
1167
+ results = results.slice(0, limit);
1168
+ }
1169
+ return format(results, this._docs, {
1170
+ includeMatches,
1171
+ includeScore
1172
+ });
1173
+ }
1174
+ _searchStringList(query) {
1175
+ const searcher = createSearcher(query, this.options);
1176
+ const { records } = this._myIndex;
1177
+ const results = [];
1178
+ records.forEach(({ v: text, i: idx, n: norm2 }) => {
1179
+ if (!isDefined(text)) {
1180
+ return;
1181
+ }
1182
+ const { isMatch, score, indices } = searcher.searchIn(text);
1183
+ if (isMatch) {
1184
+ results.push({
1185
+ item: text,
1186
+ idx,
1187
+ matches: [{ score, value: text, norm: norm2, indices }]
1188
+ });
1189
+ }
1190
+ });
1191
+ return results;
1192
+ }
1193
+ _searchLogical(query) {
1194
+ const expression = parse(query, this.options);
1195
+ const evaluate = (node, item, idx) => {
1196
+ if (!node.children) {
1197
+ const { keyId, searcher } = node;
1198
+ const matches = this._findMatches({
1199
+ key: this._keyStore.get(keyId),
1200
+ value: this._myIndex.getValueForItemAtKeyId(item, keyId),
1201
+ searcher
1202
+ });
1203
+ if (matches && matches.length) {
1204
+ return [
1205
+ {
1206
+ idx,
1207
+ item,
1208
+ matches
1209
+ }
1210
+ ];
1211
+ }
1212
+ return [];
1213
+ }
1214
+ const res = [];
1215
+ for (let i = 0, len = node.children.length; i < len; i += 1) {
1216
+ const child = node.children[i];
1217
+ const result = evaluate(child, item, idx);
1218
+ if (result.length) {
1219
+ res.push(...result);
1220
+ } else if (node.operator === LogicalOperator.AND) {
1221
+ return [];
1222
+ }
1223
+ }
1224
+ return res;
1225
+ };
1226
+ const records = this._myIndex.records;
1227
+ const resultMap = {};
1228
+ const results = [];
1229
+ records.forEach(({ $: item, i: idx }) => {
1230
+ if (isDefined(item)) {
1231
+ let expResults = evaluate(expression, item, idx);
1232
+ if (expResults.length) {
1233
+ if (!resultMap[idx]) {
1234
+ resultMap[idx] = { idx, item, matches: [] };
1235
+ results.push(resultMap[idx]);
1236
+ }
1237
+ expResults.forEach(({ matches }) => {
1238
+ resultMap[idx].matches.push(...matches);
1239
+ });
1240
+ }
1241
+ }
1242
+ });
1243
+ return results;
1244
+ }
1245
+ _searchObjectList(query) {
1246
+ const searcher = createSearcher(query, this.options);
1247
+ const { keys, records } = this._myIndex;
1248
+ const results = [];
1249
+ records.forEach(({ $: item, i: idx }) => {
1250
+ if (!isDefined(item)) {
1251
+ return;
1252
+ }
1253
+ let matches = [];
1254
+ keys.forEach((key, keyIndex) => {
1255
+ matches.push(
1256
+ ...this._findMatches({
1257
+ key,
1258
+ value: item[keyIndex],
1259
+ searcher
1260
+ })
1261
+ );
1262
+ });
1263
+ if (matches.length) {
1264
+ results.push({
1265
+ idx,
1266
+ item,
1267
+ matches
1268
+ });
1269
+ }
1270
+ });
1271
+ return results;
1272
+ }
1273
+ _findMatches({ key, value, searcher }) {
1274
+ if (!isDefined(value)) {
1275
+ return [];
1276
+ }
1277
+ let matches = [];
1278
+ if (isArray(value)) {
1279
+ value.forEach(({ v: text, i: idx, n: norm2 }) => {
1280
+ if (!isDefined(text)) {
1281
+ return;
1282
+ }
1283
+ const { isMatch, score, indices } = searcher.searchIn(text);
1284
+ if (isMatch) {
1285
+ matches.push({
1286
+ score,
1287
+ key,
1288
+ value: text,
1289
+ idx,
1290
+ norm: norm2,
1291
+ indices
1292
+ });
1293
+ }
1294
+ });
1295
+ } else {
1296
+ const { v: text, n: norm2 } = value;
1297
+ const { isMatch, score, indices } = searcher.searchIn(text);
1298
+ if (isMatch) {
1299
+ matches.push({ score, key, value: text, norm: norm2, indices });
1300
+ }
1301
+ }
1302
+ return matches;
1303
+ }
1304
+ }
1305
+ Fuse.version = "7.1.0";
1306
+ Fuse.createIndex = createIndex;
1307
+ Fuse.parseIndex = parseIndex;
1308
+ Fuse.config = Config;
1309
+ {
1310
+ Fuse.parseQuery = parse;
1311
+ }
1312
+ {
1313
+ register(ExtendedSearch);
1314
+ }
1315
+ export {
1316
+ Fuse as default
1317
+ };