@searchcraft/javascript-sdk 0.2.8 → 0.3.0

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 (263) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +7 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
  3. package/dist/cjs/index-5b0b9d4c.js +84 -0
  4. package/dist/cjs/index-5b0b9d4c.js.map +1 -0
  5. package/dist/cjs/index-6c5282a0.js +1279 -0
  6. package/dist/cjs/index-6c5282a0.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +16 -0
  8. package/dist/cjs/index.cjs.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +17 -0
  10. package/dist/cjs/loader.cjs.js.map +1 -0
  11. package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js +861 -0
  12. package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js.map +1 -0
  13. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +64 -0
  14. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +1 -0
  15. package/dist/cjs/searchcraft-button-icon.cjs.entry.js +18 -0
  16. package/dist/cjs/searchcraft-button-icon.cjs.entry.js.map +1 -0
  17. package/dist/cjs/searchcraft-button.cjs.entry.js +37 -0
  18. package/dist/cjs/searchcraft-button.cjs.entry.js.map +1 -0
  19. package/dist/cjs/searchcraft-javascript-sdk.cjs.js +27 -0
  20. package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -0
  21. package/dist/cjs/store-f3bec622.js +406 -0
  22. package/dist/cjs/store-f3bec622.js.map +1 -0
  23. package/dist/collection/assets/searchcraft-button-icons.js +9 -0
  24. package/dist/collection/assets/searchcraft-button-icons.js.map +1 -0
  25. package/dist/{searchcraft-javascript-sdk/searchcraft-check-icon.entry.js → collection/assets/searchcraft-check-icon.js} +6 -11
  26. package/dist/collection/assets/searchcraft-check-icon.js.map +1 -0
  27. package/dist/collection/assets/searchcraft-clear-icon-set.js +45 -0
  28. package/dist/collection/assets/searchcraft-clear-icon-set.js.map +1 -0
  29. package/dist/{searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js → collection/assets/searchcraft-dash-icon.js} +6 -11
  30. package/dist/collection/assets/searchcraft-dash-icon.js.map +1 -0
  31. package/dist/collection/assets/searchcraft-search-icon-set.js +84 -0
  32. package/dist/collection/assets/searchcraft-search-icon-set.js.map +1 -0
  33. package/dist/collection/collection-manifest.json +33 -0
  34. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +379 -0
  35. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -0
  36. package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +15 -0
  37. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +168 -0
  38. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -0
  39. package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +18 -0
  40. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +329 -0
  41. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -0
  42. package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +224 -0
  43. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +268 -0
  44. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js.map → collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map} +1 -1
  45. package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +47 -0
  46. package/dist/collection/components/searchcraft-button/searchcraft-button.js +137 -0
  47. package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -0
  48. package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +82 -0
  49. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +95 -0
  50. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +1 -0
  51. package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +33 -0
  52. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +64 -0
  53. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -0
  54. package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +21 -0
  55. package/dist/{searchcraft-javascript-sdk/searchcraft-filters-list.entry.js → collection/components/searchcraft-filters-list/searchcraft-filters-list.js} +72 -20
  56. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -0
  57. package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +110 -0
  58. package/dist/collection/components/searchcraft-input/searchcraft-input.js +356 -0
  59. package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -0
  60. package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +249 -0
  61. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +122 -0
  62. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +1 -0
  63. package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +79 -0
  64. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +109 -0
  65. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +1 -0
  66. package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +17 -0
  67. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +76 -0
  68. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -0
  69. package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +21 -0
  70. package/dist/{searchcraft-javascript-sdk/searchcraft-results-info.entry.js → collection/components/searchcraft-results-info/searchcraft-results-info.js} +26 -16
  71. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -0
  72. package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +15 -0
  73. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +128 -0
  74. package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -0
  75. package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +68 -0
  76. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +19 -0
  77. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +1 -0
  78. package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +35 -0
  79. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +19 -0
  80. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +1 -0
  81. package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +26 -0
  82. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +107 -0
  83. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -0
  84. package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +31 -0
  85. package/dist/collection/index.js +12 -0
  86. package/dist/collection/index.js.map +1 -0
  87. package/dist/collection/provider/store.js +98 -0
  88. package/dist/collection/provider/store.js.map +1 -0
  89. package/dist/collection/utils/utils.js +85 -0
  90. package/dist/collection/utils/utils.js.map +1 -0
  91. package/dist/components/index.js +62 -0
  92. package/dist/components/index.js.map +1 -0
  93. package/dist/components/p-07edaa9b.js +67 -0
  94. package/dist/components/p-07edaa9b.js.map +1 -0
  95. package/dist/components/p-27a6ca57.js +149 -0
  96. package/dist/components/p-27a6ca57.js.map +1 -0
  97. package/dist/components/p-4468fba3.js +61 -0
  98. package/dist/components/p-4468fba3.js.map +1 -0
  99. package/dist/components/p-498c7ef9.js +40 -0
  100. package/dist/components/p-498c7ef9.js.map +1 -0
  101. package/dist/{searchcraft-javascript-sdk/index-d6567b9c.js → components/p-5cdc6210.js} +2 -10
  102. package/dist/components/p-5cdc6210.js.map +1 -0
  103. package/dist/{searchcraft-javascript-sdk/searchcraft-input-caption.entry.js → components/p-6237f03e.js} +31 -10
  104. package/dist/components/p-6237f03e.js.map +1 -0
  105. package/dist/{searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js → components/p-70722ab2.js} +24 -7
  106. package/dist/components/p-70722ab2.js.map +1 -0
  107. package/dist/components/p-7498e493.js +1113 -0
  108. package/dist/components/p-7498e493.js.map +1 -0
  109. package/dist/{searchcraft-javascript-sdk/utils-9f198636.js → components/p-7d1bcd2d.js} +2 -2
  110. package/dist/components/p-7d1bcd2d.js.map +1 -0
  111. package/dist/components/p-8c38185e.js +53 -0
  112. package/dist/components/p-8c38185e.js.map +1 -0
  113. package/dist/{searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js → components/p-a3bd1bc8.js} +26 -7
  114. package/dist/components/p-a3bd1bc8.js.map +1 -0
  115. package/dist/components/p-ae84b899.js +48 -0
  116. package/dist/components/p-ae84b899.js.map +1 -0
  117. package/dist/components/p-bc3f9025.js +33 -0
  118. package/dist/components/p-bc3f9025.js.map +1 -0
  119. package/dist/components/p-bfb22305.js +33 -0
  120. package/dist/components/p-bfb22305.js.map +1 -0
  121. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js → components/p-c31274dd.js} +37 -8
  122. package/dist/components/p-c31274dd.js.map +1 -0
  123. package/dist/components/p-d3187f5a.js +29 -0
  124. package/dist/components/p-d3187f5a.js.map +1 -0
  125. package/dist/components/p-e5471fcf.js +29 -0
  126. package/dist/components/p-e5471fcf.js.map +1 -0
  127. package/dist/components/p-ff049f0a.js +313 -0
  128. package/dist/components/p-ff049f0a.js.map +1 -0
  129. package/dist/components/searchcraft-auto-search-form.js +221 -0
  130. package/dist/components/searchcraft-auto-search-form.js.map +1 -0
  131. package/dist/components/searchcraft-base-search-form.js +152 -0
  132. package/dist/components/searchcraft-base-search-form.js.map +1 -0
  133. package/dist/components/searchcraft-base-search-result.js +8 -0
  134. package/dist/components/searchcraft-base-search-result.js.map +1 -0
  135. package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js → components/searchcraft-base-search-results.js} +53 -11
  136. package/dist/components/searchcraft-base-search-results.js.map +1 -0
  137. package/dist/components/searchcraft-button-icon.js +32 -0
  138. package/dist/components/searchcraft-button-icon.js.map +1 -0
  139. package/dist/components/searchcraft-button.js +8 -0
  140. package/dist/components/searchcraft-button.js.map +1 -0
  141. package/dist/components/searchcraft-check-icon.js +8 -0
  142. package/dist/components/searchcraft-check-icon.js.map +1 -0
  143. package/dist/components/searchcraft-clear-icon-set.js +8 -0
  144. package/dist/components/searchcraft-clear-icon-set.js.map +1 -0
  145. package/dist/components/searchcraft-clear-input-button.js +8 -0
  146. package/dist/components/searchcraft-clear-input-button.js.map +1 -0
  147. package/dist/components/searchcraft-dash-icon.js +8 -0
  148. package/dist/components/searchcraft-dash-icon.js.map +1 -0
  149. package/dist/components/searchcraft-error-message.js +8 -0
  150. package/dist/components/searchcraft-error-message.js.map +1 -0
  151. package/dist/components/searchcraft-filters-list.js +155 -0
  152. package/dist/components/searchcraft-filters-list.js.map +1 -0
  153. package/dist/components/searchcraft-input-caption.js +8 -0
  154. package/dist/components/searchcraft-input-caption.js.map +1 -0
  155. package/dist/components/searchcraft-input-icon.js +8 -0
  156. package/dist/components/searchcraft-input-icon.js.map +1 -0
  157. package/dist/components/searchcraft-input-label.js +8 -0
  158. package/dist/components/searchcraft-input-label.js.map +1 -0
  159. package/dist/components/searchcraft-input.js +8 -0
  160. package/dist/components/searchcraft-input.js.map +1 -0
  161. package/dist/components/searchcraft-results-info.js +63 -0
  162. package/dist/components/searchcraft-results-info.js.map +1 -0
  163. package/dist/components/searchcraft-search-icon-set.js +8 -0
  164. package/dist/components/searchcraft-search-icon-set.js.map +1 -0
  165. package/dist/{searchcraft-javascript-sdk/searchcraft-slider.entry.js → components/searchcraft-slider.js} +37 -12
  166. package/dist/components/searchcraft-slider.js.map +1 -0
  167. package/dist/components/searchcraft-spinner-dark.js +8 -0
  168. package/dist/components/searchcraft-spinner-dark.js.map +1 -0
  169. package/dist/components/searchcraft-spinner-light.js +8 -0
  170. package/dist/components/searchcraft-spinner-light.js.map +1 -0
  171. package/dist/{searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js → components/searchcraft-toggle-button.js} +48 -11
  172. package/dist/components/searchcraft-toggle-button.js.map +1 -0
  173. package/dist/esm/index-0ac5bb53.js +1251 -0
  174. package/dist/esm/index-0ac5bb53.js.map +1 -0
  175. package/dist/esm/index-72ac5051.js +82 -0
  176. package/dist/esm/index-72ac5051.js.map +1 -0
  177. package/dist/esm/index.js +3 -0
  178. package/dist/esm/index.js.map +1 -0
  179. package/dist/esm/loader.js +13 -0
  180. package/dist/esm/loader.js.map +1 -0
  181. package/dist/esm/searchcraft-auto-search-form_19.entry.js +839 -0
  182. package/dist/esm/searchcraft-auto-search-form_19.entry.js.map +1 -0
  183. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-base-search-form.entry.js +4 -5
  184. package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -0
  185. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button-icon.entry.js +1 -1
  186. package/dist/esm/searchcraft-button-icon.entry.js.map +1 -0
  187. package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button.entry.js +4 -4
  188. package/dist/esm/searchcraft-button.entry.js.map +1 -0
  189. package/dist/esm/searchcraft-javascript-sdk.js +22 -0
  190. package/dist/esm/searchcraft-javascript-sdk.js.map +1 -0
  191. package/dist/esm/store-6af9ea01.js +396 -0
  192. package/dist/esm/store-6af9ea01.js.map +1 -0
  193. package/dist/index.cjs.js +1 -0
  194. package/dist/index.js +1 -0
  195. package/dist/loader/cdn.js +1 -0
  196. package/dist/loader/index.cjs.js +1 -0
  197. package/dist/loader/index.d.ts +24 -0
  198. package/dist/loader/index.es2017.js +1 -0
  199. package/dist/loader/index.js +2 -0
  200. package/dist/loader/package.json +11 -0
  201. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -14
  202. package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
  203. package/dist/searchcraft-javascript-sdk/p-05416a3e.entry.js +2 -0
  204. package/dist/searchcraft-javascript-sdk/p-05416a3e.entry.js.map +1 -0
  205. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +3 -0
  206. package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +1 -0
  207. package/dist/searchcraft-javascript-sdk/p-1ab836bf.js +11 -0
  208. package/dist/searchcraft-javascript-sdk/p-1ab836bf.js.map +1 -0
  209. package/dist/searchcraft-javascript-sdk/p-3cb77ee1.entry.js +2 -0
  210. package/dist/searchcraft-javascript-sdk/p-3cb77ee1.entry.js.map +1 -0
  211. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +7 -0
  212. package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +1 -0
  213. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js +2 -0
  214. package/dist/searchcraft-javascript-sdk/p-5ec960bd.entry.js.map +1 -0
  215. package/dist/searchcraft-javascript-sdk/p-72382d90.entry.js +2 -0
  216. package/dist/searchcraft-javascript-sdk/p-72382d90.entry.js.map +1 -0
  217. package/dist/searchcraft-javascript-sdk/p-e1255160.js +2 -0
  218. package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +1 -0
  219. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -48
  220. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
  221. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +3 -1
  222. package/package.json +1 -1
  223. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +0 -34
  224. package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +0 -1
  225. package/dist/searchcraft-javascript-sdk/index-8211f330.js +0 -3043
  226. package/dist/searchcraft-javascript-sdk/index-8211f330.js.map +0 -1
  227. package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +0 -1
  228. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +0 -127
  229. package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +0 -1
  230. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +0 -1
  231. package/dist/searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map +0 -1
  232. package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +0 -1
  233. package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +0 -1
  234. package/dist/searchcraft-javascript-sdk/searchcraft-check-icon.entry.js.map +0 -1
  235. package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +0 -1
  236. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +0 -30
  237. package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +0 -1
  238. package/dist/searchcraft-javascript-sdk/searchcraft-dash-icon.entry.js.map +0 -1
  239. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +0 -22
  240. package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +0 -1
  241. package/dist/searchcraft-javascript-sdk/searchcraft-filters-list.entry.js.map +0 -1
  242. package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +0 -1
  243. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +0 -25
  244. package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +0 -1
  245. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +0 -29
  246. package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +0 -1
  247. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js +0 -74
  248. package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +0 -1
  249. package/dist/searchcraft-javascript-sdk/searchcraft-results-info.entry.js.map +0 -1
  250. package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +0 -1
  251. package/dist/searchcraft-javascript-sdk/searchcraft-slider.entry.js.map +0 -1
  252. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +0 -17
  253. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +0 -1
  254. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +0 -17
  255. package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +0 -1
  256. package/dist/searchcraft-javascript-sdk/searchcraft-toggle-button.entry.js.map +0 -1
  257. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +0 -334
  258. package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +0 -1
  259. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js +0 -3073
  260. package/dist/searchcraft-javascript-sdk/store-08ee97f6.js.map +0 -1
  261. package/dist/searchcraft-javascript-sdk/utils-9f198636.js.map +0 -1
  262. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js +0 -0
  263. /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js.map +0 -0
@@ -0,0 +1,839 @@
1
+ import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-0ac5bb53.js';
2
+ import { u as useSearchcraftStore, g, p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles, e as extractDynamicProperties, c as getFormattedTimeFromNow, f as flattenFacets } from './store-6af9ea01.js';
3
+ import { c as classNames } from './index-72ac5051.js';
4
+
5
+ const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{font-family:var(--font-stack);text-align:left;width:100%}.formRTL{font-family:var(--font-stack);text-align:right;width:100%}";
6
+ const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
7
+
8
+ const SearchcraftAutoSearchForm = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.inputClearedOrNoResults = createEvent(this, "inputClearedOrNoResults", 7);
12
+ this.querySubmit = createEvent(this, "querySubmit", 7);
13
+ this.debounceTimeout = null;
14
+ this.debounceDelay = 0;
15
+ this.searchStore = useSearchcraftStore.getState();
16
+ this.handleInputChange = (event) => {
17
+ this.query = event.detail;
18
+ this.searchStore.setQuery(this.query);
19
+ if (this.query.trim() === '') {
20
+ this.searchResults = null;
21
+ this.searchStore.setSearchResults(null);
22
+ }
23
+ };
24
+ this.handleInputKeyUp = (event) => {
25
+ const target = event.detail;
26
+ if (target === this.query) {
27
+ return;
28
+ }
29
+ this.query = target;
30
+ if (this.debounceTimeout) {
31
+ clearTimeout(this.debounceTimeout);
32
+ }
33
+ this.debounceTimeout = setTimeout(() => {
34
+ if (this.query.trim() === '') {
35
+ this.searchResults = null;
36
+ this.searchStore.setSearchResults(null);
37
+ }
38
+ else {
39
+ this.searchStore.setQuery(this.query);
40
+ this.querySubmit.emit(this.query);
41
+ this.runSearch();
42
+ }
43
+ }, this.debounceDelay);
44
+ };
45
+ this.handleClearInput = () => {
46
+ if (this.query === '' && !this.searchResults) {
47
+ return;
48
+ }
49
+ this.query = '';
50
+ this.searchResults = null;
51
+ this.searchStore.setQuery('');
52
+ this.searchStore.setSearchResults(null);
53
+ if (typeof this.clearInput === 'function') {
54
+ this.clearInput();
55
+ }
56
+ if (this.debounceTimeout) {
57
+ clearTimeout(this.debounceTimeout);
58
+ }
59
+ this.error = false;
60
+ this.inputClearedOrNoResults.emit();
61
+ };
62
+ this.runSearch = async () => {
63
+ if (this.query.trim() === '') {
64
+ this.error = true;
65
+ this.inputClearedOrNoResults.emit();
66
+ }
67
+ else {
68
+ this.error = false;
69
+ this.searchStore.setQuery(this.query);
70
+ this.searchStore.setSelectedFilters([]);
71
+ try {
72
+ await this.searchStore.search();
73
+ }
74
+ catch (error) {
75
+ this.error = true;
76
+ this.inputClearedOrNoResults.emit();
77
+ }
78
+ }
79
+ };
80
+ this.handleFormSubmit = async (event) => {
81
+ event.preventDefault();
82
+ await this.runSearch();
83
+ };
84
+ this.autoSearchFormClass = '';
85
+ this.clearInput = () => { };
86
+ this.config = {
87
+ apiKey: '',
88
+ endpointURL: '',
89
+ index: [],
90
+ };
91
+ this.customStylesForInput = {};
92
+ this.inputCaptionValue = '';
93
+ this.inputIconHeight = 20;
94
+ this.inputIconWidth = 20;
95
+ this.labelForInput = '';
96
+ this.placeholderValue = 'Search here';
97
+ this.rightToLeftOrientation = false;
98
+ this.searchContainerClass = '';
99
+ this.error = false;
100
+ this.isRequesting = false;
101
+ this.query = '';
102
+ this.searchResults = null;
103
+ }
104
+ componentDidLoad() {
105
+ const searchcraft = new g(this.config);
106
+ this.searchStore.initialize(searchcraft, true);
107
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
108
+ this.isRequesting = state.isRequesting;
109
+ this.searchResults = Object.assign({}, state.searchResults);
110
+ });
111
+ }
112
+ disconnectedCallback() {
113
+ if (this.unsubscribe) {
114
+ this.unsubscribe();
115
+ }
116
+ }
117
+ render() {
118
+ const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
119
+ const parsedCustomStyles = parseCustomStyles(this.customStylesForInput);
120
+ return (h("form", { key: '6f59f4b7d525c62fce6b21712519e3880c6756a2', class: `${formClass}`, onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: 'cbaa772a365131dbfcffec9e2a28438f1c978efe', label: this.labelForInput }), h("searchcraft-input", { key: '70a4933978df3878720e1189a15481123e12eba5', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (h("searchcraft-error-message", { key: 'd665a04dcc8999a09afa47f1a20156f12db6600c', errorMessage: 'Please enter a search query.' }))));
121
+ }
122
+ };
123
+ SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
124
+
125
+ const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#FAFAFA}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;position:relative;background-color:#2E2E2E}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{display:inline-block;position:absolute;right:5px;top:-2px}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0;position:relative;-webkit-font-smoothing:antialiased;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;-webkit-font-smoothing:antialiased;color:#E6E6E6}";
126
+ const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
127
+
128
+ const SearchcraftBaseSearchResult = class {
129
+ constructor(hostRef) {
130
+ registerInstance(this, hostRef);
131
+ this.buttonCallback = createEvent(this, "buttonCallback", 7);
132
+ this.keyDownCallback = createEvent(this, "keyDownCallback", 7);
133
+ this.resultCallback = createEvent(this, "resultCallback", 7);
134
+ this.buttonCallback = () => { }; // Callback for button click
135
+ this.keyDownCallback = () => { }; // Callback for key down event
136
+ this.resultCallback = () => { }; // Callback for result container click
137
+ this.handleButtonClick = () => {
138
+ this.buttonCallback();
139
+ };
140
+ this.handleContainerClick = () => {
141
+ if (this.isInteractive) {
142
+ this.resultCallback();
143
+ }
144
+ };
145
+ this.buttonText = '';
146
+ this.customStyles = '{}';
147
+ this.headingText = '';
148
+ this.imageDescription = '';
149
+ this.imageSource = '';
150
+ this.isInteractive = false;
151
+ this.primaryContent = '';
152
+ this.secondaryContent = '';
153
+ this.subheadingText = '';
154
+ this.tertiaryContent = '';
155
+ this.themeMode = 'light';
156
+ this.placeImageRight = false;
157
+ }
158
+ parseStyles() {
159
+ try {
160
+ return JSON.parse(this.customStyles);
161
+ }
162
+ catch (error) {
163
+ console.error('Error parsing custom styles:', error);
164
+ return {};
165
+ }
166
+ }
167
+ render() {
168
+ const isLightTheme = this.themeMode === 'light';
169
+ const styles = this.parseStyles();
170
+ const imageContainer = this.imageSource && (h("div", { key: '5446a636265cf330a7e67f7539dad7e25077ecda', class: 'imageContainer' }, h("img", { key: '59529cce35008eb171f4ee634ed94ff96e716dad', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
171
+ const contentContainer = (h("div", { key: 'fd052ef1e3dedcf5b1467b6b0760d0be349c1faf', class: 'contentContainer' }, h("h2", { key: '1d1eca475651641b34d477ea7e2ea2f3eb7a2c49', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), h("h3", { key: '9fcf054f634d088b72b67a2675b67a89f651285b', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), h("p", { key: '477078081008771a462abb042232b84f1e72ddd5', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), h("div", { key: '716ea0fe1efbd18f0b6313baac80834fbab53001', class: 'secondaryContentContainer' }, h("p", { key: '340dad3f568e5cc2b0a1b412b92a335b9afb7a0f', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), h("p", { key: 'b0c940aab4b48d4e560aabe7551b3c1a0a4ef3ae', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (h("button", { key: 'd9a08ff62c8bc7d2b13bb42872e2391290de0712', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
172
+ return (h("div", { key: '310676a0e48c3a3d76559b3e3012db1681a55499', class: this.isInteractive
173
+ ? isLightTheme
174
+ ? 'interactiveResultContainerLight'
175
+ : 'interactiveResultContainerDark'
176
+ : 'resultContainer', onKeyDown: this.keyDownCallback, onClick: this.handleContainerClick, style: styles.container || {}, tabindex: '0' }, this.placeImageRight ? (h(Fragment, null, contentContainer, imageContainer)) : (h(Fragment, null, imageContainer, contentContainer))));
177
+ }
178
+ };
179
+ SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
180
+
181
+ const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:16px 0}.resultsContainer>p{align-self:center}.resultsContainer>div{margin-bottom:20px}.resultsContainer>div img{height:300px;width:200px}.adSection{align-items:center;background-color:#F1F1F1;border:1px solid #DCDDDE;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;margin:auto;min-height:150px;text-align:center;width:100%}.adSection p{margin-top:5px}.emptyState{text-align:center;width:100%}.errorMessageContainer{text-align:center}";
182
+ const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
183
+
184
+ const SearchcraftBaseSearchResults = class {
185
+ constructor(hostRef) {
186
+ registerInstance(this, hostRef);
187
+ this.adInterval = 4;
188
+ this.customStylesForResults = {};
189
+ this.documentAttributesForDisplay = '';
190
+ this.fallbackElement = null;
191
+ this.formatTime = true;
192
+ this.placeAdAtEnd = false;
193
+ this.placeAdAtStart = true;
194
+ this.placeResultImageRight = false;
195
+ this.hasSearched = false;
196
+ this.query = '';
197
+ this.searchResults = null;
198
+ }
199
+ componentDidLoad() {
200
+ if (!this.documentAttributesForDisplay ||
201
+ this.documentAttributesForDisplay.length === 0) {
202
+ console.warn('No document attributes provided; using empty keys array.');
203
+ this.documentAttributesForDisplay = '';
204
+ }
205
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
206
+ if (state.query.length > 0) {
207
+ this.hasSearched = true;
208
+ }
209
+ else {
210
+ this.hasSearched = false;
211
+ }
212
+ this.searchResults = Object.assign({}, state.searchResults);
213
+ this.query = state.query;
214
+ });
215
+ const { searchResults, query } = useSearchcraftStore.getState();
216
+ this.searchResults = searchResults;
217
+ this.query = query;
218
+ }
219
+ disconnectedCallback() {
220
+ if (this.unsubscribe) {
221
+ this.unsubscribe();
222
+ }
223
+ }
224
+ render() {
225
+ var _a, _b, _c, _d, _e, _f, _g;
226
+ if (!this.hasSearched) {
227
+ return (h("div", { class: 'emptyState' }, h("slot", { name: 'empty-search' })));
228
+ }
229
+ if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
230
+ return;
231
+ }
232
+ const parsedSearchKeys = parseSearchKeys(this.documentAttributesForDisplay);
233
+ const serializedStyles = typeof this.customStylesForResults === 'string'
234
+ ? this.customStylesForResults
235
+ : serializeStyles(this.customStylesForResults);
236
+ const resultsComponents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((document, index) => {
237
+ const { doc: result } = document;
238
+ const dynamicProperties = extractDynamicProperties(result, parsedSearchKeys);
239
+ if (this.formatTime) {
240
+ for (const key of parsedSearchKeys) {
241
+ if (dynamicProperties[key]) {
242
+ const value = dynamicProperties[key];
243
+ if (typeof value === 'string' &&
244
+ !Number.isNaN(Date.parse(value))) {
245
+ dynamicProperties[key] = getFormattedTimeFromNow(value);
246
+ }
247
+ }
248
+ }
249
+ }
250
+ return (h("searchcraft-base-search-result", { "button-callback": () => console.log('button callback'), "custom-styles": serializedStyles, "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "is-interactive": true, key: `${document.document_id}-${index}`, "keydown-callback": () => console.log('keydown'), "heading-text": dynamicProperties[parsedSearchKeys[0]], "place-image-right": this.placeResultImageRight, "primary-content": dynamicProperties[parsedSearchKeys[2]], "result-callback": () => console.log('interactive element'), "secondary-content": dynamicProperties[parsedSearchKeys[3]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]] }));
251
+ });
252
+ const finalComponents = [];
253
+ if (this.placeAdAtStart) {
254
+ finalComponents.push(h("div", { key: 'ad-section-start', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
255
+ }
256
+ if (this.adInterval > 0) {
257
+ resultsComponents.forEach((component, index) => {
258
+ finalComponents.push(component);
259
+ if ((index + 1) % this.adInterval === 0) {
260
+ finalComponents.push(h("div", { key: `ad-section-${index + 1}`, class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
261
+ }
262
+ });
263
+ }
264
+ else {
265
+ finalComponents.push(...resultsComponents);
266
+ }
267
+ if (this.placeAdAtEnd) {
268
+ finalComponents.push(h("div", { key: 'ad-section-end', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
269
+ }
270
+ return (h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
271
+ ((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0 && (h("div", { class: 'errorMessageContainer' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
272
+ }
273
+ };
274
+ SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
275
+
276
+ const SearchcraftCheckIcon = class {
277
+ constructor(hostRef) {
278
+ registerInstance(this, hostRef);
279
+ }
280
+ render() {
281
+ return (h("svg", { key: '3db200942b79612a38293544a029c6854dfa4beb', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none' }, h("title", { key: 'b7b6af8651edb5cc0e054ed775b9029c6c93535e' }, "Checkbox Check"), h("path", { key: '7c74edc45f007245e4c6e4fd5d37dbc6dad20de0', d: 'M13.9999 2L5.74988 10L1.99988 6.36364', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
282
+ }
283
+ };
284
+
285
+ const SearchcraftClearIconSet = class {
286
+ constructor(hostRef) {
287
+ registerInstance(this, hostRef);
288
+ this.type = 'clear-light';
289
+ }
290
+ render() {
291
+ switch (this.type) {
292
+ case 'clear-light':
293
+ return (h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'black', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
294
+ case 'clear-dark':
295
+ return (h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Dark"), h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'white', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
296
+ case 'arrow-light':
297
+ return (h("svg", { width: '20', height: '21', viewBox: '0 0 20 21', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Light"), h("path", { d: 'M7.5 15.0444L12.5 10.0444L7.5 5.04443', stroke: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
298
+ case 'arrow-dark':
299
+ return (h("svg", { width: '8', height: '12', viewBox: '0 0 8 12', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Dark"), h("path", { d: 'M1.5 11L6.5 6L1.5 1', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
300
+ default:
301
+ return null;
302
+ }
303
+ }
304
+ };
305
+
306
+ const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:0;top:50%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:0px;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:20px}";
307
+ const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
308
+
309
+ const SearchcraftClearInputButton = class {
310
+ constructor(hostRef) {
311
+ registerInstance(this, hostRef);
312
+ this.clearInput = createEvent(this, "clearInput", 7);
313
+ this.handleClearClick = (event) => {
314
+ event.preventDefault();
315
+ this.clearInput.emit();
316
+ };
317
+ this.isRequesting = false;
318
+ this.rightToLeftOrientation = false;
319
+ this.theme = 'light';
320
+ }
321
+ isLightTheme() {
322
+ return this.theme === 'light';
323
+ }
324
+ render() {
325
+ return this.rightToLeftOrientation ? (h("button", { class: classNames('inputClearButtonRTL', '.sc-clear-input-button-rtl'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (h("searchcraft-spinner-light", null)) : (h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (h("searchcraft-clear-icon-set", { type: 'clear-dark' })))) : (h("button", { class: classNames('inputClearButtonLTR', '.sc-clear-input-button-ltr'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (h("searchcraft-spinner-light", null)) : (h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (h("searchcraft-clear-icon-set", { type: 'clear-dark' }))));
326
+ }
327
+ };
328
+ SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
329
+
330
+ const SearchcraftDashIcon = class {
331
+ constructor(hostRef) {
332
+ registerInstance(this, hostRef);
333
+ }
334
+ render() {
335
+ return (h("svg", { key: '4d0c3ab69a973ec8b1d89f52082e4b98ce17e39d', width: '14', height: '3', viewBox: '0 0 14 3', fill: 'none' }, h("title", { key: '99a099dcd6a163ba5b8c1f5b80f9ebfde2152778' }, "Checkbox Dash"), h("line", { key: '49f030f69ff1d37139f868ffb94b5f24442dce37', x1: '1.5', y1: '1.5', x2: '12.5', y2: '1.5', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round' })));
336
+ }
337
+ };
338
+
339
+ const searchcraftErrorMessageModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.errorMessageLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.errorMessageDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}";
340
+ const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
341
+
342
+ const SearchcraftErrorMessage = class {
343
+ constructor(hostRef) {
344
+ registerInstance(this, hostRef);
345
+ this.errorMessage = undefined;
346
+ this.theme = 'light';
347
+ }
348
+ render() {
349
+ const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
350
+ return (h("p", { key: '7c26f9a1b2589d57a81f7909c456e712d9b7fe79', class: classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
351
+ }
352
+ };
353
+ SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
354
+
355
+ const searchcraftFiltersListModuleCss = ".filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.checkboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.checkboxLabel input[type=checkbox]:focus{outline:2px solid #007DB3}.checkboxLabel input[type=checkbox]:checked{background-color:#007DB3;position:relative}.checkboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.checkboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.remainingFilterListCheckbox{margin-left:16px}.childCheckboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:12px;position:relative}.childCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childCheckboxLabel input[type=checkbox]:focus{outline:2px solid #007DB3}.childCheckboxLabel input[type=checkbox]:checked{background-color:#007DB3;position:relative}.childCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}";
356
+ const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
357
+
358
+ const SearchcraftFiltersList = class {
359
+ constructor(hostRef) {
360
+ registerInstance(this, hostRef);
361
+ this.filtersUpdated = createEvent(this, "filtersUpdated", 7);
362
+ this.searchStore = useSearchcraftStore.getState();
363
+ this.autoSearchFormElement = null;
364
+ this.handleSearchRequest = () => {
365
+ this.selectedFilters = [];
366
+ this.searchStore.setSelectedFilters([]);
367
+ this.emitFiltersUpdate();
368
+ };
369
+ this.filters = [];
370
+ this.dynamicFilters = [];
371
+ this.selectedFilters = [];
372
+ this.query = '';
373
+ this.isRequesting = false;
374
+ this.resultsCount = 0;
375
+ }
376
+ connectedCallback() {
377
+ var _a;
378
+ const state = this.searchStore;
379
+ const facets = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets;
380
+ if (facets) {
381
+ this.populateFiltersFromFacets(facets);
382
+ }
383
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
384
+ var _a, _b, _c, _d, _e;
385
+ const query = (_a = state.query) === null || _a === void 0 ? void 0 : _a.trim();
386
+ const facets = (_b = state.searchResults) === null || _b === void 0 ? void 0 : _b.data.facets;
387
+ this.query = query || '';
388
+ this.isRequesting = state.isRequesting;
389
+ this.resultsCount = ((_e = (_d = (_c = state.searchResults) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.hits) === null || _e === void 0 ? void 0 : _e.length) || 0;
390
+ if (facets && this.selectedFilters.length === 0) {
391
+ this.populateFiltersFromFacets(facets);
392
+ }
393
+ });
394
+ this.autoSearchFormElement = document.querySelector('searchcraft-auto-search-form');
395
+ if (this.autoSearchFormElement) {
396
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
397
+ }
398
+ }
399
+ disconnectedCallback() {
400
+ if (this.unsubscribe) {
401
+ this.unsubscribe();
402
+ }
403
+ if (this.autoSearchFormElement) {
404
+ this.autoSearchFormElement.removeEventListener('querySubmit', this.handleSearchRequest);
405
+ }
406
+ }
407
+ populateFiltersFromFacets(facets) {
408
+ var _a;
409
+ const flattened = flattenFacets(((_a = facets[0]) === null || _a === void 0 ? void 0 : _a.section) || []);
410
+ this.dynamicFilters = flattened.map((filter) => ({
411
+ label: filter.label,
412
+ value: filter.value,
413
+ count: filter.count,
414
+ children: filter.children || [],
415
+ }));
416
+ }
417
+ handleCheckboxChange(value, isChecked, isParent = false) {
418
+ var _a;
419
+ if (isParent) {
420
+ const parentFilter = this.dynamicFilters.find((filter) => filter.value === value);
421
+ const childValues = ((_a = parentFilter === null || parentFilter === void 0 ? void 0 : parentFilter.children) === null || _a === void 0 ? void 0 : _a.map((child) => child.value)) || [];
422
+ if (!isChecked) {
423
+ // Remove children from selectedFilters when parent is unchecked
424
+ this.selectedFilters = this.selectedFilters.filter((filter) => filter !== value && !childValues.includes(filter));
425
+ }
426
+ else {
427
+ this.selectedFilters = [...this.selectedFilters, value];
428
+ }
429
+ }
430
+ else {
431
+ this.selectedFilters = isChecked
432
+ ? [...this.selectedFilters, value]
433
+ : this.selectedFilters.filter((filter) => filter !== value);
434
+ }
435
+ this.emitFiltersUpdate();
436
+ }
437
+ emitFiltersUpdate() {
438
+ this.filtersUpdated.emit(this.selectedFilters);
439
+ this.searchStore.setSelectedFilters(this.selectedFilters);
440
+ this.searchStore.search();
441
+ }
442
+ formatLabel(label, count) {
443
+ return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
444
+ }
445
+ render() {
446
+ if (!this.query || this.resultsCount === 0) {
447
+ return null;
448
+ }
449
+ return (h("div", { class: 'filtersList' }, this.dynamicFilters.map((filter) => {
450
+ const isChildSelected = filter.children
451
+ ? filter.children.some((child) => this.selectedFilters.includes(child.value))
452
+ : false;
453
+ return (h("div", { key: filter.value, class: 'filterItem' }, h("label", { class: 'checkboxLabel' }, h("input", { checked: this.selectedFilters.includes(filter.value), onChange: (event) => this.handleCheckboxChange(filter.value, event.target.checked, true), type: 'checkbox' }), isChildSelected ? (h("div", { class: 'dashContainer' }, h("searchcraft-dash-icon", null))) : (h("div", { class: 'checkContainer' }, h("searchcraft-check-icon", null))), this.formatLabel(filter.label, filter.count)), filter.children && filter.children.length > 0 && (h("div", { class: 'childrenContainer' }, filter.children.map((child) => (h("label", { key: child.value, class: 'childCheckboxLabel', style: {
454
+ marginLeft: '20px',
455
+ display: this.selectedFilters.includes(filter.value)
456
+ ? 'flex'
457
+ : 'none',
458
+ } }, h("input", { type: 'checkbox', checked: this.selectedFilters.includes(child.value), onChange: (event) => this.handleCheckboxChange(child.value, event.target.checked) }), h("div", { class: 'checkContainer' }, h("searchcraft-check-icon", null)), this.formatLabel(child.label.includes('/')
459
+ ? child.label.split('/').pop() || child.label
460
+ : child.label, child.count))))))));
461
+ })));
462
+ }
463
+ };
464
+ SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
465
+
466
+ const searchcraftInputModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputContainerLTR{position:relative;width:100%}.inputContainerRTL{position:relative;width:100%;margin-left:8px}.inputLightLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-right:8px;padding-left:36px;padding-right:16px}.inputLightLTR::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-right:8px;padding-left:36px;padding-right:16px}.inputDarkLTR::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorLightLTR::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputErrorLightLTR::placeholder{color:#737373}.inputErrorLightLTR:focus{outline:2px solid #000}.inputErrorLightLTR:focus-visible{outline:2px solid #c00}.inputErrorDarkLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorDarkLTR::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputErrorDarkLTR::placeholder{color:#BFBFBF}.inputErrorDarkLTR:focus{outline:2px solid #FFF}.inputErrorDarkLTR:focus-visible{outline:2px solid #FFB3B3}.inputLightRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputLightRTL::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputDarkRTL::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorLightRTL::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputErrorLightRTL::placeholder{color:#737373}.inputErrorLightRTL:focus{outline:2px solid #000}.inputErrorLightRTL:focus-visible{outline:2px solid #c00}.inputErrorDarkRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorDarkRTL::placeholder{font-family:\"Brygada 1918\";font-size:16px;font-weight:600}.inputErrorDarkRTL::placeholder{color:#BFBFBF}.inputErrorDarkRTL:focus{outline:2px solid #FFF}.inputErrorDarkRTL:focus-visible{outline:2px solid #FFB3B3}.inputWrapper{align-items:center;display:flex;position:relative;width:100%}";
467
+ const SearchcraftInputStyle0 = searchcraftInputModuleCss;
468
+
469
+ const SearchcraftInput = class {
470
+ constructor(hostRef) {
471
+ registerInstance(this, hostRef);
472
+ this.clearInput = createEvent(this, "clearInput", 7);
473
+ this.searchInputChange = createEvent(this, "searchInputChange", 7);
474
+ this.inputKeyUp = createEvent(this, "inputKeyUp", 7);
475
+ this.customStyles = {};
476
+ this.error = false;
477
+ this.formClassName = '';
478
+ this.inputCaptionClassName = '';
479
+ this.inputCaptionValue = '';
480
+ this.inputClassName = '';
481
+ this.inputIconHeight = 20;
482
+ this.inputIconWidth = 20;
483
+ this.isRequesting = false;
484
+ this.placeholderValue = 'Enter Search';
485
+ this.rightToLeftOrientation = false;
486
+ this.query = '';
487
+ this.theme = 'light';
488
+ }
489
+ get isLightTheme() {
490
+ return this.theme === 'light';
491
+ }
492
+ handleInputChange(event) {
493
+ const input = event.target;
494
+ this.searchInputChange.emit(input.value);
495
+ }
496
+ handleInputKeyUp(event) {
497
+ const input = event.target;
498
+ this.inputKeyUp.emit(input.value);
499
+ }
500
+ handleClearInput() {
501
+ if (this.query === '') {
502
+ return;
503
+ }
504
+ this.query = '';
505
+ if (this.clearInput) {
506
+ this.clearInput.emit();
507
+ }
508
+ }
509
+ render() {
510
+ const containerClassName = this.rightToLeftOrientation
511
+ ? 'inputContainerRTL'
512
+ : 'inputContainerLTR';
513
+ const inputClassName = classNames(this.error
514
+ ? this.isLightTheme
515
+ ? 'inputErrorLightRTL'
516
+ : 'inputErrorDarkRTL'
517
+ : this.isLightTheme
518
+ ? 'inputLightLTR'
519
+ : 'inputDarkLTR', 'searchcraft-input');
520
+ const validatedCustomStyles = parseCustomStyles(this.customStyles);
521
+ const placeholderStyle = {
522
+ fontSize: validatedCustomStyles.placeholderFontSize || '16px',
523
+ };
524
+ return (h("div", { key: '7047cbe1692a4c8f11232d7f65e00824703d8b50', class: classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (h(Fragment, null, h("input", { autoComplete: 'off', class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
525
+ #searchcraft-input-id::placeholder {
526
+ font-size: ${placeholderStyle.fontSize};
527
+ }
528
+ `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h(Fragment, null, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { autoComplete: 'off', class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
529
+ #searchcraft-input-id::placeholder {
530
+ font-size: ${placeholderStyle.fontSize};
531
+ }
532
+ `), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation }))))));
533
+ }
534
+ };
535
+ SearchcraftInput.style = SearchcraftInputStyle0;
536
+
537
+ const searchcraftInputCaptionModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputCaptionLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040}.inputCaptionDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6}.inputCaptionErrorLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.inputCaptionErrorDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}.inputCaptionLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040;text-align:right}.inputCaptionDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6;text-align:right}.inputCaptionErrorLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000;text-align:right}.inputCaptionErrorDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3;text-align:right}";
538
+ const SearchcraftInputCaptionStyle0 = searchcraftInputCaptionModuleCss;
539
+
540
+ const SearchcraftInputCaption = class {
541
+ constructor(hostRef) {
542
+ registerInstance(this, hostRef);
543
+ this.error = undefined;
544
+ this.inputCaptionClassName = '';
545
+ this.inputCaptionValue = 'Enter Search';
546
+ this.rightToLeftOrientation = false;
547
+ this.theme = 'light';
548
+ }
549
+ isLightTheme() {
550
+ return this.theme === 'light';
551
+ }
552
+ render() {
553
+ return this.rightToLeftOrientation ? (h("p", { class: classNames(this.error
554
+ ? this.isLightTheme
555
+ ? 'inputCaptionErrorLightRTL'
556
+ : 'inputCaptionErrorDarkRTL'
557
+ : this.isLightTheme
558
+ ? 'inputCaptionLightRTL'
559
+ : 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (h("p", { class: classNames(this.error
560
+ ? this.isLightTheme
561
+ ? 'inputCaptionErrorLightLTR'
562
+ : 'inputCaptionErrorDarkLTR'
563
+ : this.isLightTheme
564
+ ? 'inputCaptionLightLTR'
565
+ : 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
566
+ }
567
+ };
568
+ SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
569
+
570
+ const searchcraftInputIconModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputIconLTR{left:15px;position:absolute;top:50%;transform:translateY(-50%)}.inputIconRTL{position:absolute;right:15px;top:50%;transform:translateY(-50%)}";
571
+ const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
572
+
573
+ const SearchcraftInputIcon = class {
574
+ constructor(hostRef) {
575
+ registerInstance(this, hostRef);
576
+ this.error = undefined;
577
+ this.height = 20;
578
+ this.rightToLeftOrientation = false;
579
+ this.width = 20;
580
+ this.theme = 'light';
581
+ }
582
+ isLightTheme() {
583
+ return this.theme === 'light';
584
+ }
585
+ render() {
586
+ return this.error ? (h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (h("searchcraft-search-icon-set", { height: this.height, type: 'error-light', width: this.width })) : (h("searchcraft-search-icon-set", { height: this.height, type: 'error-dark', width: this.width })))) : (h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (h("searchcraft-search-icon-set", { height: this.height, type: 'search-light', width: this.width })) : (h("searchcraft-search-icon-set", { height: this.height, type: 'search-dark', width: this.width }))));
587
+ }
588
+ };
589
+ SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
590
+
591
+ const searchcraftInputLabelModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.labelLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#292929}.labelDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFF}";
592
+ const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
593
+
594
+ const SearchcraftInputLabel = class {
595
+ constructor(hostRef) {
596
+ registerInstance(this, hostRef);
597
+ this.inputLabelClassName = '';
598
+ this.label = undefined;
599
+ this.theme = 'light';
600
+ }
601
+ isLightTheme() {
602
+ return this.theme === 'light';
603
+ }
604
+ render() {
605
+ if (!this.label) {
606
+ return null;
607
+ }
608
+ const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
609
+ return (h("label", { class: classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
610
+ }
611
+ };
612
+ SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
613
+
614
+ const searchcraftResultsInfoModuleCss = ".container{border-bottom:1px solid #D9D9D9;display:flex;justify-content:flex-start;width:100%}.resultsInfo{color:#292929;font-size:18px;font-weight:600;line-height:20px;margin:0;margin-bottom:8px}";
615
+ const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
616
+
617
+ const SearchcraftResultsInfo = class {
618
+ constructor(hostRef) {
619
+ registerInstance(this, hostRef);
620
+ this.isRequesting = false;
621
+ this.resultsCount = 0;
622
+ this.responseTime = '';
623
+ this.query = '';
624
+ }
625
+ connectedCallback() {
626
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
627
+ var _a, _b, _c, _d;
628
+ this.isRequesting = state.isRequesting;
629
+ this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
630
+ this.responseTime = ((((_d = (_c = state.searchResults) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.time_taken) || 0) * 1000).toFixed(2);
631
+ this.query = state.query || ''; // Update query from store
632
+ });
633
+ }
634
+ disconnectedCallback() {
635
+ if (this.unsubscribe) {
636
+ this.unsubscribe();
637
+ }
638
+ }
639
+ render() {
640
+ if (!this.query || this.resultsCount === 0) {
641
+ return null;
642
+ }
643
+ return (h("div", { class: 'container' }, h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
644
+ }
645
+ };
646
+ SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
647
+
648
+ const SearchcraftSearchIconSet = class {
649
+ constructor(hostRef) {
650
+ registerInstance(this, hostRef);
651
+ this.type = 'search-dark';
652
+ this.width = 20;
653
+ this.height = 20;
654
+ }
655
+ render() {
656
+ const { width, height } = this;
657
+ switch (this.type) {
658
+ case 'search-light':
659
+ return (h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), h("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: '#404040', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
660
+ case 'search-dark':
661
+ return (h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Dark"), h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#E6E6E6', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
662
+ case 'error-light':
663
+ return (h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Light"), h("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
664
+ case 'error-dark':
665
+ return (h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Dark"), h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
666
+ default:
667
+ return null;
668
+ }
669
+ }
670
+ };
671
+
672
+ const searchcraftSliderModuleCss = ".sliderContainer{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center;width:100%}.rangeContainer{display:flex;position:relative;width:100%;align-items:center}.rangeContainer .activeRange{background:#007DB3;border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.rangeContainer .rangeSlider{width:100%;height:4px;background:transparent;border-radius:2px;outline:none;-webkit-appearance:none;appearance:none;position:absolute;margin:0}.rangeContainer .rangeSlider::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.rangeContainer .rangeSlider::-moz-range-thumb{width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.yearLabels{display:flex;justify-content:space-between;width:100%;margin-top:10px;font-size:15px;font-weight:600;font-family:\"Source Sans Pro\", sans-serif;color:#666}.yearLabel{min-width:30px;text-align:center}";
673
+ const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
674
+
675
+ const SearchcraftSlider = class {
676
+ constructor(hostRef) {
677
+ registerInstance(this, hostRef);
678
+ this.searchStore = useSearchcraftStore.getState();
679
+ this.updateYears = async () => {
680
+ this.searchStore.setYearsRange([this.startYear, this.endYear]);
681
+ try {
682
+ if (typeof this.query === 'string' && this.query.trim() !== '') {
683
+ await this.searchStore.search();
684
+ }
685
+ else {
686
+ console.warn('Query is missing or empty, skipping search request.');
687
+ }
688
+ }
689
+ catch (error) {
690
+ console.error('Search failed:', error);
691
+ }
692
+ };
693
+ this.handleStartYearChange = (event) => {
694
+ const value = Number.parseInt(event.target.value, 10);
695
+ this.startYear = Math.min(value, this.endYear);
696
+ this.updateYears();
697
+ };
698
+ this.handleEndYearChange = (event) => {
699
+ const value = Number.parseInt(event.target.value, 10);
700
+ this.endYear = Math.max(value, this.startYear);
701
+ this.updateYears();
702
+ };
703
+ this.maxYear = new Date().getFullYear();
704
+ this.minYear = 2014;
705
+ this.endYear = this.maxYear;
706
+ this.hasSearched = false;
707
+ this.query = '';
708
+ this.resultsCount = 0;
709
+ this.startYear = this.minYear;
710
+ }
711
+ componentDidLoad() {
712
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
713
+ var _a, _b, _c;
714
+ if (state.query.length > 0) {
715
+ this.hasSearched = true;
716
+ this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
717
+ }
718
+ this.query = state.query;
719
+ });
720
+ }
721
+ disconnectedCallback() {
722
+ if (this.unsubscribe) {
723
+ this.unsubscribe();
724
+ }
725
+ }
726
+ render() {
727
+ if (!this.query || this.resultsCount === 0) {
728
+ return null;
729
+ }
730
+ const rangeMin = this.minYear;
731
+ const rangeMax = this.maxYear;
732
+ const startPercent = ((this.startYear - rangeMin) / (rangeMax - rangeMin)) * 100;
733
+ const endPercent = ((this.endYear - rangeMin) / (rangeMax - rangeMin)) * 100;
734
+ return (h("div", { class: 'sliderContainer' }, h("div", { class: 'rangeContainer' }, h("div", { class: 'activeRange', style: {
735
+ left: `${startPercent}%`,
736
+ width: `${endPercent - startPercent}%`,
737
+ } }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), h("input", { class: 'rangeSlider', max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), h("div", { class: 'yearLabels' }, h("span", { class: 'yearLabel' }, this.startYear), h("span", { class: 'yearLabel' }, this.endYear))));
738
+ }
739
+ };
740
+ SearchcraftSlider.style = SearchcraftSliderStyle0;
741
+
742
+ const searchcraftSpinnerDarkModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerDark{animation:spinning 1s linear infinite;background:conic-gradient(#000 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
743
+ const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
744
+
745
+ const SearchcraftSpinnerDark = class {
746
+ constructor(hostRef) {
747
+ registerInstance(this, hostRef);
748
+ }
749
+ render() {
750
+ return (h("div", { key: 'be34b9a3ecec05fdc169145a5db5a4f37bbd404b', class: 'spinnerContainer' }, h("div", { key: 'b59ffd2fe8dd3ac990003bff3085cb571c08730e', class: 'spinnerDark' })));
751
+ }
752
+ };
753
+ SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
754
+
755
+ const searchcraftSpinnerLightModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerLight{animation:spinning 1s linear infinite;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);height:100%;mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);width:100%}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
756
+ const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
757
+
758
+ const SearchcraftSpinnerLight = class {
759
+ constructor(hostRef) {
760
+ registerInstance(this, hostRef);
761
+ }
762
+ render() {
763
+ return (h("div", { key: 'a4f73eee03d4d7253c04c47995315bd121e8ded3', class: 'spinnerContainer' }, h("div", { key: '53e3486ef7a2fa6029a6107bae2c0655b1608a12', class: 'spinnerLight' })));
764
+ }
765
+ };
766
+ SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
767
+
768
+ const searchcraftToggleButtonModuleCss = ".toggle-wrapper{background:#ddd;border:none;border-radius:16px;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);cursor:pointer;height:26px;margin-left:10px;position:relative;width:44px}.toggle-wrapper.active{background:#007DB3;box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.toggle-wrapper .toggle-switch{background:#fff;border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.toggle-wrapper .toggle-switch.active{transform:translateX(16px)}";
769
+ const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
770
+
771
+ const SearchcraftToggleButton = class {
772
+ constructor(hostRef) {
773
+ registerInstance(this, hostRef);
774
+ this.autoSearchFormElement = null;
775
+ this.searchStore = useSearchcraftStore.getState();
776
+ this.handleSearchRequest = () => {
777
+ this.isActive = false;
778
+ this.searchStore.setSearchParams({
779
+ mode: 'fuzzy',
780
+ sort: 'asc',
781
+ });
782
+ };
783
+ this.handleToggle = async () => {
784
+ this.isActive = !this.isActive;
785
+ if (this.type === 'mode') {
786
+ const mode = this.isActive ? 'normal' : 'fuzzy';
787
+ this.searchStore.setSearchParams({
788
+ mode,
789
+ });
790
+ }
791
+ else if (this.type === 'sort') {
792
+ const sort = this.isActive ? 'desc' : 'asc';
793
+ this.searchStore.setSearchParams({
794
+ sort,
795
+ });
796
+ }
797
+ try {
798
+ await this.searchStore.search();
799
+ }
800
+ catch (error) {
801
+ console.error('Search failed:', error);
802
+ }
803
+ };
804
+ this.type = 'mode';
805
+ this.isActive = false;
806
+ this.query = '';
807
+ this.resultsCount = 0;
808
+ }
809
+ componentDidLoad() {
810
+ this.unsubscribe = useSearchcraftStore.subscribe((state) => {
811
+ var _a, _b, _c;
812
+ this.query = state.query || '';
813
+ this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
814
+ });
815
+ this.autoSearchFormElement = document.querySelector('searchcraft-auto-search-form');
816
+ if (this.autoSearchFormElement) {
817
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
818
+ }
819
+ }
820
+ disconnectedCallback() {
821
+ if (this.unsubscribe) {
822
+ this.unsubscribe();
823
+ }
824
+ if (this.autoSearchFormElement) {
825
+ this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
826
+ }
827
+ }
828
+ render() {
829
+ if (!this.query || this.resultsCount === 0) {
830
+ return null;
831
+ }
832
+ return (h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
833
+ }
834
+ };
835
+ SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
836
+
837
+ export { SearchcraftAutoSearchForm as searchcraft_auto_search_form, SearchcraftBaseSearchResult as searchcraft_base_search_result, SearchcraftBaseSearchResults as searchcraft_base_search_results, SearchcraftCheckIcon as searchcraft_check_icon, SearchcraftClearIconSet as searchcraft_clear_icon_set, SearchcraftClearInputButton as searchcraft_clear_input_button, SearchcraftDashIcon as searchcraft_dash_icon, SearchcraftErrorMessage as searchcraft_error_message, SearchcraftFiltersList as searchcraft_filters_list, SearchcraftInput as searchcraft_input, SearchcraftInputCaption as searchcraft_input_caption, SearchcraftInputIcon as searchcraft_input_icon, SearchcraftInputLabel as searchcraft_input_label, SearchcraftResultsInfo as searchcraft_results_info, SearchcraftSearchIconSet as searchcraft_search_icon_set, SearchcraftSlider as searchcraft_slider, SearchcraftSpinnerDark as searchcraft_spinner_dark, SearchcraftSpinnerLight as searchcraft_spinner_light, SearchcraftToggleButton as searchcraft_toggle_button };
838
+
839
+ //# sourceMappingURL=searchcraft-auto-search-form_19.entry.js.map