@searchcraft/javascript-sdk 0.4.1 → 0.4.2

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 (72) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/{package-38f7e2c7.js → package-2005293c.js} +2 -2
  4. package/dist/cjs/package-2005293c.js.map +1 -0
  5. package/dist/cjs/searchcraft-auto-search-form.cjs.entry.js +2 -2
  6. package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +1 -1
  7. package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +1 -1
  8. package/dist/cjs/searchcraft-error-message_3.cjs.entry.js +1 -1
  9. package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +1 -1
  10. package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +1 -1
  11. package/dist/cjs/searchcraft-results-info.cjs.entry.js +1 -1
  12. package/dist/cjs/{utils-0f309f6d.js → utils-a17279a2.js} +2 -2
  13. package/dist/cjs/{utils-0f309f6d.js.map → utils-a17279a2.js.map} +1 -1
  14. package/dist/collection/types/searchcraft-base-search-results.types.js.map +1 -1
  15. package/dist/collection/utils/utils.js +1 -1
  16. package/dist/collection/utils/utils.js.map +1 -1
  17. package/dist/components/index.js +1 -1
  18. package/dist/components/{p-4fad3388.js → p-0468a9eb.js} +2 -2
  19. package/dist/components/{p-4fad3388.js.map → p-0468a9eb.js.map} +1 -1
  20. package/dist/components/{p-08e421ca.js → p-3e8d3586.js} +2 -2
  21. package/dist/components/{p-08e421ca.js.map → p-3e8d3586.js.map} +1 -1
  22. package/dist/components/{p-4353a2b8.js → p-7bb734f3.js} +2 -2
  23. package/dist/components/{p-4353a2b8.js.map → p-7bb734f3.js.map} +1 -1
  24. package/dist/components/{p-4c89f065.js → p-c994d722.js} +2 -2
  25. package/dist/components/p-c994d722.js.map +1 -0
  26. package/dist/components/{p-9982883f.js → p-f308d05d.js} +2 -2
  27. package/dist/components/{p-9982883f.js.map → p-f308d05d.js.map} +1 -1
  28. package/dist/components/searchcraft-auto-search-form.js +3 -3
  29. package/dist/components/searchcraft-base-search-form.js +2 -2
  30. package/dist/components/searchcraft-base-search-results.js +1 -1
  31. package/dist/components/searchcraft-facet-list.js +1 -1
  32. package/dist/components/searchcraft-filter-panel.js +3 -3
  33. package/dist/components/searchcraft-input.js +1 -1
  34. package/dist/components/searchcraft-results-info.js +1 -1
  35. package/dist/components/searchcraft-slider.js +1 -1
  36. package/dist/esm/index.js +1 -1
  37. package/dist/esm/{package-e62ac63a.js → package-07f53086.js} +2 -2
  38. package/dist/esm/package-07f53086.js.map +1 -0
  39. package/dist/esm/searchcraft-auto-search-form.entry.js +2 -2
  40. package/dist/esm/searchcraft-base-search-form.entry.js +1 -1
  41. package/dist/esm/searchcraft-base-search-results.entry.js +1 -1
  42. package/dist/esm/searchcraft-error-message_3.entry.js +1 -1
  43. package/dist/esm/searchcraft-facet-list_3.entry.js +1 -1
  44. package/dist/esm/searchcraft-filter-panel.entry.js +1 -1
  45. package/dist/esm/searchcraft-results-info.entry.js +1 -1
  46. package/dist/esm/{utils-ee63b542.js → utils-c2ce411f.js} +2 -2
  47. package/dist/esm/{utils-ee63b542.js.map → utils-c2ce411f.js.map} +1 -1
  48. package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
  49. package/dist/searchcraft-javascript-sdk/{p-92d080a7.entry.js → p-1720b612.entry.js} +2 -2
  50. package/dist/searchcraft-javascript-sdk/{p-2816782c.entry.js → p-491ae071.entry.js} +2 -2
  51. package/dist/searchcraft-javascript-sdk/{p-15e0ce05.entry.js → p-676e2eef.entry.js} +2 -2
  52. package/dist/searchcraft-javascript-sdk/{p-9f29b018.entry.js → p-83a074b6.entry.js} +2 -2
  53. package/dist/searchcraft-javascript-sdk/{p-cc614ce6.entry.js → p-a56af0b0.entry.js} +2 -2
  54. package/dist/searchcraft-javascript-sdk/{p-4c89f065.js → p-c994d722.js} +2 -2
  55. package/dist/searchcraft-javascript-sdk/{p-a148febe.entry.js → p-d08d0b15.entry.js} +2 -2
  56. package/dist/searchcraft-javascript-sdk/{p-9982883f.js → p-f308d05d.js} +2 -2
  57. package/dist/searchcraft-javascript-sdk/{p-9982883f.js.map → p-f308d05d.js.map} +1 -1
  58. package/dist/searchcraft-javascript-sdk/{p-e108dd2e.entry.js → p-fb239507.entry.js} +2 -2
  59. package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
  60. package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/dist/cjs/package-38f7e2c7.js.map +0 -1
  63. package/dist/components/p-4c89f065.js.map +0 -1
  64. package/dist/esm/package-e62ac63a.js.map +0 -1
  65. /package/dist/searchcraft-javascript-sdk/{p-92d080a7.entry.js.map → p-1720b612.entry.js.map} +0 -0
  66. /package/dist/searchcraft-javascript-sdk/{p-2816782c.entry.js.map → p-491ae071.entry.js.map} +0 -0
  67. /package/dist/searchcraft-javascript-sdk/{p-15e0ce05.entry.js.map → p-676e2eef.entry.js.map} +0 -0
  68. /package/dist/searchcraft-javascript-sdk/{p-9f29b018.entry.js.map → p-83a074b6.entry.js.map} +0 -0
  69. /package/dist/searchcraft-javascript-sdk/{p-cc614ce6.entry.js.map → p-a56af0b0.entry.js.map} +0 -0
  70. /package/dist/searchcraft-javascript-sdk/{p-4c89f065.js.map → p-c994d722.js.map} +0 -0
  71. /package/dist/searchcraft-javascript-sdk/{p-a148febe.entry.js.map → p-d08d0b15.entry.js.map} +0 -0
  72. /package/dist/searchcraft-javascript-sdk/{p-e108dd2e.entry.js.map → p-fb239507.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  const name = "@searchcraft/javascript-sdk";
2
- const version = "0.4.1";
2
+ const version = "0.4.2";
3
3
  const description = "Searchcraft Javascript SDK";
4
4
  const author = "Searchcraft";
5
5
  const license = "Apache-2.0";
@@ -63,4 +63,4 @@ const packageJson = {
63
63
 
64
64
  export { packageJson as p };
65
65
 
66
- //# sourceMappingURL=p-4c89f065.js.map
66
+ //# sourceMappingURL=p-c994d722.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-c994d722.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -90,7 +90,7 @@ function getDocumentValueFromSearchResultMapping(document, mapping) {
90
90
  return valueFound;
91
91
  })
92
92
  .filter((value) => !!value)
93
- .join(mapping.delimeter || ' ');
93
+ .join(mapping.delimiter || ' ');
94
94
  }
95
95
  }
96
96
  function deepMergeWithSpread(obj1, obj2) {
@@ -215,4 +215,4 @@ function mergeFacetRoots(fieldName, currentRoot, incomingRoot) {
215
215
 
216
216
  export { getMillis as a, formatNumberWithCommas as f, getDocumentValueFromSearchResultMapping as g, mergeFacetRoots as m, parseCustomStyles as p, removeSubstringMatches as r, serializeStyles as s };
217
217
 
218
- //# sourceMappingURL=p-9982883f.js.map
218
+ //# sourceMappingURL=p-f308d05d.js.map
@@ -1 +1 @@
1
- {"file":"p-9982883f.js","mappings":"SAOgB,iBAAiB,CAC/B,MAAuC;IAEvC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC3B;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO,EAAE,CAAC;SACX;KACF;IACD,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC;SAEe,eAAe,CAC7B,MAA8C;IAE9C,IAAI;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;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sBAAsB,CACvB,CAAC;;;IAIF,MAAM,qBAAqB,GAAG,yBAAyB,CACrD,aAAa,EACb,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAuC,mBAAmB,CAC1E,qBAAqB,EACrB,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAqB,cAAc,CAAC,YAAY,CAAC,CAAC;;IAGpE,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IAErD,OAAO;QACL,CAAC,SAAS,GAAG,gBAAgB,CAAC,QAAQ;KACvC,CAAC;AACJ;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\nimport type { SearchResultMapping } from 'types';\n\nexport function parseCustomStyles(\n styles: string | Record<string, string>,\n): Record<string, string> {\n if (typeof styles === 'string') {\n try {\n return JSON.parse(styles);\n } catch (error) {\n console.error('Invalid customStyles format:', styles);\n return {};\n }\n }\n return styles || {};\n}\n\nexport function serializeStyles(\n styles: Record<string, Record<string, string>>,\n): string {\n try {\n return JSON.stringify(styles);\n } catch (error) {\n console.error('Error serializing styles:', error);\n return '{}';\n }\n}\n\n/**\n * Given a timestamp value, returns a formatted time string for the time\n * since now.\n *\n * @param timestamp\n * @returns {string} Formatted string value\n */\nexport function getFormattedTimeFromNow(timestamp: string): string {\n const now = new Date();\n const inputTime = new Date(timestamp);\n const diffInSeconds = Math.floor(\n (now.getTime() - inputTime.getTime()) / 1000,\n );\n\n const minutes = Math.floor(diffInSeconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const years = Math.floor(days / 365);\n\n if (minutes < 60) {\n return `${minutes}m ago`;\n }\n if (hours < 24) {\n return `${hours}h ago`;\n }\n if (days < 365) {\n return `${days}d ago`;\n }\n return `${years}y ago`;\n}\n\nexport function filterPaths(paths) {\n return paths.filter((path) => {\n const parts = path.split('/').filter(Boolean);\n\n if (parts.length > 1) {\n return true;\n }\n\n return !paths.some(\n (otherPath) => otherPath.startsWith(`${path}/`) && otherPath !== path,\n );\n });\n}\n\nexport function formatNumberWithCommas(number) {\n return number.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n}\n\nexport function getMillis(unit: 'year' | 'month' | 'day' | 'hour'): number {\n const millisInHour = 60 * 60 * 1000;\n const millisInDay = 24 * millisInHour;\n const millisInMonth = 30 * millisInDay;\n const millisInYear = 365 * millisInDay;\n\n switch (unit) {\n case 'hour':\n return millisInHour;\n case 'day':\n return millisInDay;\n case 'month':\n return millisInMonth;\n case 'year':\n return millisInYear;\n default:\n return 3600000;\n }\n}\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\n/**\n * Given a document and a SearchResultMapping, return a mapped value from the document.\n *\n * @param document\n * @param {SearchResultMapping} mapping\n * @returns {string | undefined}\n */\nexport function getDocumentValueFromSearchResultMapping(\n document: Record<string, unknown> | undefined,\n mapping: SearchResultMapping | undefined,\n): string | undefined {\n if (document && mapping) {\n return mapping.fieldNames\n .map((fieldNameDetails) => {\n let valueFound = document[fieldNameDetails.fieldName];\n\n if (valueFound && fieldNameDetails.dataType === 'date') {\n valueFound = getFormattedTimeFromNow(valueFound as string);\n }\n\n return valueFound;\n })\n .filter((value) => !!value)\n .join(mapping.delimeter || ' ');\n }\n}\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n };\n}\n"],"version":3}
1
+ {"file":"p-f308d05d.js","mappings":"SAOgB,iBAAiB,CAC/B,MAAuC;IAEvC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC3B;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO,EAAE,CAAC;SACX;KACF;IACD,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC;SAEe,eAAe,CAC7B,MAA8C;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Ae;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,aAAa;KACxB,CAAC;;IAGF,MAAM,aAAa,GAAuC,aAAa,CACrE,qBAAqB,CACtB,CAAC;IAEF,MAAM,cAAc,GAAuC,aAAa,CACtE,sBAAsB,CACvB,CAAC;;;IAIF,MAAM,qBAAqB,GAAG,yBAAyB,CACrD,aAAa,EACb,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAuC,mBAAmB,CAC1E,qBAAqB,EACrB,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAqB,cAAc,CAAC,YAAY,CAAC,CAAC;;IAGpE,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IAErD,OAAO;QACL,CAAC,SAAS,GAAG,gBAAgB,CAAC,QAAQ;KACvC,CAAC;AACJ;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\nimport type { SearchResultMapping } from 'types';\n\nexport function parseCustomStyles(\n styles: string | Record<string, string>,\n): Record<string, string> {\n if (typeof styles === 'string') {\n try {\n return JSON.parse(styles);\n } catch (error) {\n console.error('Invalid customStyles format:', styles);\n return {};\n }\n }\n return styles || {};\n}\n\nexport function serializeStyles(\n styles: Record<string, Record<string, string>>,\n): string {\n try {\n return JSON.stringify(styles);\n } catch (error) {\n console.error('Error serializing styles:', error);\n return '{}';\n }\n}\n\n/**\n * Given a timestamp value, returns a formatted time string for the time\n * since now.\n *\n * @param timestamp\n * @returns {string} Formatted string value\n */\nexport function getFormattedTimeFromNow(timestamp: string): string {\n const now = new Date();\n const inputTime = new Date(timestamp);\n const diffInSeconds = Math.floor(\n (now.getTime() - inputTime.getTime()) / 1000,\n );\n\n const minutes = Math.floor(diffInSeconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const years = Math.floor(days / 365);\n\n if (minutes < 60) {\n return `${minutes}m ago`;\n }\n if (hours < 24) {\n return `${hours}h ago`;\n }\n if (days < 365) {\n return `${days}d ago`;\n }\n return `${years}y ago`;\n}\n\nexport function filterPaths(paths) {\n return paths.filter((path) => {\n const parts = path.split('/').filter(Boolean);\n\n if (parts.length > 1) {\n return true;\n }\n\n return !paths.some(\n (otherPath) => otherPath.startsWith(`${path}/`) && otherPath !== path,\n );\n });\n}\n\nexport function formatNumberWithCommas(number) {\n return number.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n}\n\nexport function getMillis(unit: 'year' | 'month' | 'day' | 'hour'): number {\n const millisInHour = 60 * 60 * 1000;\n const millisInDay = 24 * millisInHour;\n const millisInMonth = 30 * millisInDay;\n const millisInYear = 365 * millisInDay;\n\n switch (unit) {\n case 'hour':\n return millisInHour;\n case 'day':\n return millisInDay;\n case 'month':\n return millisInMonth;\n case 'year':\n return millisInYear;\n default:\n return 3600000;\n }\n}\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\n/**\n * Given a document and a SearchResultMapping, return a mapped value from the document.\n *\n * @param document\n * @param {SearchResultMapping} mapping\n * @returns {string | undefined}\n */\nexport function getDocumentValueFromSearchResultMapping(\n document: Record<string, unknown> | undefined,\n mapping: SearchResultMapping | undefined,\n): string | undefined {\n if (document && mapping) {\n return mapping.fieldNames\n .map((fieldNameDetails) => {\n let valueFound = document[fieldNameDetails.fieldName];\n\n if (valueFound && fieldNameDetails.dataType === 'date') {\n valueFound = getFormattedTimeFromNow(valueFound as string);\n }\n\n return valueFound;\n })\n .filter((value) => !!value)\n .join(mapping.delimiter || ' ');\n }\n}\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n };\n}\n"],"version":3}
@@ -1,9 +1,9 @@
1
1
  import { p as proxyCustomElement, H, c as createEvent, h } from './p-5639be85.js';
2
2
  import { u as useSearchcraftStore, i as ie } from './p-3c181808.js';
3
- import { p as parseCustomStyles } from './p-9982883f.js';
4
- import { p as packageJson } from './p-4c89f065.js';
3
+ import { p as parseCustomStyles } from './p-f308d05d.js';
4
+ import { p as packageJson } from './p-c994d722.js';
5
5
  import { d as defineCustomElement$4 } from './p-ace4e6a0.js';
6
- import { d as defineCustomElement$3 } from './p-4fad3388.js';
6
+ import { d as defineCustomElement$3 } from './p-0468a9eb.js';
7
7
  import { d as defineCustomElement$2 } from './p-c8bc1e4f.js';
8
8
 
9
9
  const searchcraftAutoSearchFormModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-auto-search-form{display:flex;flex-direction:column;gap:4px}";
@@ -1,9 +1,9 @@
1
1
  import { p as proxyCustomElement, H, c as createEvent, h } from './p-5639be85.js';
2
2
  import { u as useSearchcraftStore, a as useThemeStore, i as ie } from './p-3c181808.js';
3
- import { p as packageJson } from './p-4c89f065.js';
3
+ import { p as packageJson } from './p-c994d722.js';
4
4
  import { d as defineCustomElement$6 } from './p-37f54c0b.js';
5
5
  import { d as defineCustomElement$5 } from './p-ace4e6a0.js';
6
- import { d as defineCustomElement$4 } from './p-4fad3388.js';
6
+ import { d as defineCustomElement$4 } from './p-0468a9eb.js';
7
7
  import { d as defineCustomElement$3 } from './p-c8bc1e4f.js';
8
8
  import { d as defineCustomElement$2 } from './p-9f2b8375.js';
9
9
 
@@ -1,6 +1,6 @@
1
1
  import { p as proxyCustomElement, H, c as createEvent, h } from './p-5639be85.js';
2
2
  import { u as useSearchcraftStore } from './p-3c181808.js';
3
- import { g as getDocumentValueFromSearchResultMapping, s as serializeStyles } from './p-9982883f.js';
3
+ import { g as getDocumentValueFromSearchResultMapping, s as serializeStyles } from './p-f308d05d.js';
4
4
  import { d as defineCustomElement$3 } from './p-415f7b11.js';
5
5
  import { d as defineCustomElement$2 } from './p-ace4e6a0.js';
6
6
 
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftFiltersList, d as defineCustomElement$1 } from './p-4353a2b8.js';
1
+ import { S as SearchcraftFiltersList, d as defineCustomElement$1 } from './p-7bb734f3.js';
2
2
 
3
3
  const SearchcraftFacetList = SearchcraftFiltersList;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,10 +1,10 @@
1
1
  import { p as proxyCustomElement, H, h } from './p-5639be85.js';
2
2
  import { u as useSearchcraftStore } from './p-3c181808.js';
3
- import { a as getMillis } from './p-9982883f.js';
3
+ import { a as getMillis } from './p-f308d05d.js';
4
4
  import { d as defineCustomElement$6 } from './p-04d13314.js';
5
5
  import { d as defineCustomElement$5 } from './p-de50441f.js';
6
- import { d as defineCustomElement$4 } from './p-4353a2b8.js';
7
- import { d as defineCustomElement$3 } from './p-08e421ca.js';
6
+ import { d as defineCustomElement$4 } from './p-7bb734f3.js';
7
+ import { d as defineCustomElement$3 } from './p-3e8d3586.js';
8
8
  import { d as defineCustomElement$2 } from './p-9b9df0ca.js';
9
9
 
10
10
  const searchcraftFilterPanelModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height)}";
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftInput$1, d as defineCustomElement$1 } from './p-4fad3388.js';
1
+ import { S as SearchcraftInput$1, d as defineCustomElement$1 } from './p-0468a9eb.js';
2
2
 
3
3
  const SearchcraftInput = SearchcraftInput$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,6 +1,6 @@
1
1
  import { p as proxyCustomElement, H, h } from './p-5639be85.js';
2
2
  import { u as useSearchcraftStore } from './p-3c181808.js';
3
- import { f as formatNumberWithCommas } from './p-9982883f.js';
3
+ import { f as formatNumberWithCommas } from './p-f308d05d.js';
4
4
 
5
5
  const searchcraftResultsInfoModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-results-info-container{border-bottom:1px solid var(--sc-surface-disabled);display:flex;justify-content:flex-start}.searchcraft-results-info-content{color:var(--sc-content-primary);font-family:var(--sc-font-family);font-size:18px;font-weight:600;line-height:20px;margin:0px 0 8px}@media (max-width: 900px){.searchcraft-results-info-content{margin:0;margin-bottom:8px}}";
6
6
  const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
@@ -1,4 +1,4 @@
1
- import { S as SearchcraftSlider$1, d as defineCustomElement$1 } from './p-08e421ca.js';
1
+ import { S as SearchcraftSlider$1, d as defineCustomElement$1 } from './p-3e8d3586.js';
2
2
 
3
3
  const SearchcraftSlider = SearchcraftSlider$1;
4
4
  const defineCustomElement = defineCustomElement$1;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { p as parseCustomStyles, s as serializeStyles } from './utils-ee63b542.js';
1
+ export { p as parseCustomStyles, s as serializeStyles } from './utils-c2ce411f.js';
2
2
  export { u as useSearchcraftStore, a as useThemeStore } from './store-8d82e948.js';
3
3
 
4
4
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  const name = "@searchcraft/javascript-sdk";
2
- const version = "0.4.1";
2
+ const version = "0.4.2";
3
3
  const description = "Searchcraft Javascript SDK";
4
4
  const author = "Searchcraft";
5
5
  const license = "Apache-2.0";
@@ -63,4 +63,4 @@ const packageJson = {
63
63
 
64
64
  export { packageJson as p };
65
65
 
66
- //# sourceMappingURL=package-e62ac63a.js.map
66
+ //# sourceMappingURL=package-07f53086.js.map
@@ -0,0 +1 @@
1
+ {"file":"package-07f53086.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-921fe029.js';
2
2
  import { u as useSearchcraftStore, i as ie } from './store-8d82e948.js';
3
- import { p as parseCustomStyles } from './utils-ee63b542.js';
4
- import { p as packageJson } from './package-e62ac63a.js';
3
+ import { p as parseCustomStyles } from './utils-c2ce411f.js';
4
+ import { p as packageJson } from './package-07f53086.js';
5
5
 
6
6
  const searchcraftAutoSearchFormModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-auto-search-form{display:flex;flex-direction:column;gap:4px}";
7
7
  const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-921fe029.js';
2
2
  import { u as useSearchcraftStore, a as useThemeStore, i as ie } from './store-8d82e948.js';
3
- import { p as packageJson } from './package-e62ac63a.js';
3
+ import { p as packageJson } from './package-07f53086.js';
4
4
 
5
5
  const searchcraftBaseSearchFormModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-base-search-form-input-container{align-items:center;display:flex;gap:8px}";
6
6
  const SearchcraftBaseSearchFormStyle0 = searchcraftBaseSearchFormModuleCss;
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-921fe029.js';
2
2
  import { u as useSearchcraftStore } from './store-8d82e948.js';
3
- import { g as getDocumentValueFromSearchResultMapping, s as serializeStyles } from './utils-ee63b542.js';
3
+ import { g as getDocumentValueFromSearchResultMapping, s as serializeStyles } from './utils-c2ce411f.js';
4
4
 
5
5
  const searchcraftBaseSearchResultsModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-search-results-container{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-ad-section{align-items:center;background-color:#F1F1F1;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;min-height:176px;text-align:center}.searchcraft-ad-section p{margin:0;color:var(--sc-content-disabled)}.searchcraft-search-results-empty-state-container{text-align:center}.searchcraft-search-results-error-message-container{text-align:center}";
6
6
  const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h, c as createEvent } from './index-921fe029.js';
2
2
  import { c as classNames } from './index-72ac5051.js';
3
- import { p as parseCustomStyles } from './utils-ee63b542.js';
3
+ import { p as parseCustomStyles } from './utils-c2ce411f.js';
4
4
 
5
5
  const searchcraftErrorMessageModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-error-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-danger)}";
6
6
  const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-921fe029.js';
2
2
  import { c as classNames } from './index-72ac5051.js';
3
3
  import { u as useSearchcraftStore } from './store-8d82e948.js';
4
- import { m as mergeFacetRoots, r as removeSubstringMatches, a as getMillis } from './utils-ee63b542.js';
4
+ import { m as mergeFacetRoots, r as removeSubstringMatches, a as getMillis } from './utils-c2ce411f.js';
5
5
 
6
6
  const searchcraftFacetListModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.filtersListContainer{width:100%}.filterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.filterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.filterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.filterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.filterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.filterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.childFilterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:12px;margin-left:24px;position:relative}.childFilterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childFilterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.childFilterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.childFilterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childFilterCheckboxLabel 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}.searchcraft-facet-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-disabled);text-align:center}";
7
7
  const SearchcraftFacetListStyle0 = searchcraftFacetListModuleCss;
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h } from './index-921fe029.js';
2
2
  import { u as useSearchcraftStore } from './store-8d82e948.js';
3
- import { a as getMillis } from './utils-ee63b542.js';
3
+ import { a as getMillis } from './utils-c2ce411f.js';
4
4
 
5
5
  const searchcraftFilterPanelModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height)}";
6
6
  const SearchcraftFilterPanelStyle0 = searchcraftFilterPanelModuleCss;
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h } from './index-921fe029.js';
2
2
  import { u as useSearchcraftStore } from './store-8d82e948.js';
3
- import { f as formatNumberWithCommas } from './utils-ee63b542.js';
3
+ import { f as formatNumberWithCommas } from './utils-c2ce411f.js';
4
4
 
5
5
  const searchcraftResultsInfoModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-results-info-container{border-bottom:1px solid var(--sc-surface-disabled);display:flex;justify-content:flex-start}.searchcraft-results-info-content{color:var(--sc-content-primary);font-family:var(--sc-font-family);font-size:18px;font-weight:600;line-height:20px;margin:0px 0 8px}@media (max-width: 900px){.searchcraft-results-info-content{margin:0;margin-bottom:8px}}";
6
6
  const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
@@ -90,7 +90,7 @@ function getDocumentValueFromSearchResultMapping(document, mapping) {
90
90
  return valueFound;
91
91
  })
92
92
  .filter((value) => !!value)
93
- .join(mapping.delimeter || ' ');
93
+ .join(mapping.delimiter || ' ');
94
94
  }
95
95
  }
96
96
  function deepMergeWithSpread(obj1, obj2) {
@@ -215,4 +215,4 @@ function mergeFacetRoots(fieldName, currentRoot, incomingRoot) {
215
215
 
216
216
  export { getMillis as a, formatNumberWithCommas as f, getDocumentValueFromSearchResultMapping as g, mergeFacetRoots as m, parseCustomStyles as p, removeSubstringMatches as r, serializeStyles as s };
217
217
 
218
- //# sourceMappingURL=utils-ee63b542.js.map
218
+ //# sourceMappingURL=utils-c2ce411f.js.map
@@ -1 +1 @@
1
- {"file":"utils-ee63b542.js","mappings":"SAOgB,iBAAiB,CAC/B,MAAuC;IAEvC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC3B;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO,EAAE,CAAC;SACX;KACF;IACD,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC;SAEe,eAAe,CAC7B,MAA8C;IAE9C,IAAI;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED;;;;;;;SAOgB,uBAAuB,CAAC,SAAiB;IACvD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAC9B,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,IAAI,CAC7C,CAAC;IAEF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,IAAI,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,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CACrE;SACA,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CACxC,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC;SAEe,eAAe,CAC7B,SAAiB,EACjB,WAAsB,EACtB,YAAuB;IAEvB,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,aAAa,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE9C,MAAM,qBAAqB,GAAe;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,YAAY;KACvB,CAAC;IAEF,MAAM,sBAAsB,GAAe;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,aAAa;KACxB,CAAC;;IAGF,MAAM,aAAa,GAAuC,aAAa,CACrE,qBAAqB,CACtB,CAAC;IAEF,MAAM,cAAc,GAAuC,aAAa,CACtE,sBAAsB,CACvB,CAAC;;;IAIF,MAAM,qBAAqB,GAAG,yBAAyB,CACrD,aAAa,EACb,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAuC,mBAAmB,CAC1E,qBAAqB,EACrB,cAAc,CACf,CAAC;;IAGF,MAAM,YAAY,GAAqB,cAAc,CAAC,YAAY,CAAC,CAAC;;IAGpE,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IAErD,OAAO;QACL,CAAC,SAAS,GAAG,gBAAgB,CAAC,QAAQ;KACvC,CAAC;AACJ;;;;","names":[],"sources":["src/utils/utils.ts"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\nimport type { SearchResultMapping } from 'types';\n\nexport function parseCustomStyles(\n styles: string | Record<string, string>,\n): Record<string, string> {\n if (typeof styles === 'string') {\n try {\n return JSON.parse(styles);\n } catch (error) {\n console.error('Invalid customStyles format:', styles);\n return {};\n }\n }\n return styles || {};\n}\n\nexport function serializeStyles(\n styles: Record<string, Record<string, string>>,\n): string {\n try {\n return JSON.stringify(styles);\n } catch (error) {\n console.error('Error serializing styles:', error);\n return '{}';\n }\n}\n\n/**\n * Given a timestamp value, returns a formatted time string for the time\n * since now.\n *\n * @param timestamp\n * @returns {string} Formatted string value\n */\nexport function getFormattedTimeFromNow(timestamp: string): string {\n const now = new Date();\n const inputTime = new Date(timestamp);\n const diffInSeconds = Math.floor(\n (now.getTime() - inputTime.getTime()) / 1000,\n );\n\n const minutes = Math.floor(diffInSeconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const years = Math.floor(days / 365);\n\n if (minutes < 60) {\n return `${minutes}m ago`;\n }\n if (hours < 24) {\n return `${hours}h ago`;\n }\n if (days < 365) {\n return `${days}d ago`;\n }\n return `${years}y ago`;\n}\n\nexport function filterPaths(paths) {\n return paths.filter((path) => {\n const parts = path.split('/').filter(Boolean);\n\n if (parts.length > 1) {\n return true;\n }\n\n return !paths.some(\n (otherPath) => otherPath.startsWith(`${path}/`) && otherPath !== path,\n );\n });\n}\n\nexport function formatNumberWithCommas(number) {\n return number.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n}\n\nexport function getMillis(unit: 'year' | 'month' | 'day' | 'hour'): number {\n const millisInHour = 60 * 60 * 1000;\n const millisInDay = 24 * millisInHour;\n const millisInMonth = 30 * millisInDay;\n const millisInYear = 365 * millisInDay;\n\n switch (unit) {\n case 'hour':\n return millisInHour;\n case 'day':\n return millisInDay;\n case 'month':\n return millisInMonth;\n case 'year':\n return millisInYear;\n default:\n return 3600000;\n }\n}\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\n/**\n * Given a document and a SearchResultMapping, return a mapped value from the document.\n *\n * @param document\n * @param {SearchResultMapping} mapping\n * @returns {string | undefined}\n */\nexport function getDocumentValueFromSearchResultMapping(\n document: Record<string, unknown> | undefined,\n mapping: SearchResultMapping | undefined,\n): string | undefined {\n if (document && mapping) {\n return mapping.fieldNames\n .map((fieldNameDetails) => {\n let valueFound = document[fieldNameDetails.fieldName];\n\n if (valueFound && fieldNameDetails.dataType === 'date') {\n valueFound = getFormattedTimeFromNow(valueFound as string);\n }\n\n return valueFound;\n })\n .filter((value) => !!value)\n .join(mapping.delimeter || ' ');\n }\n}\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n };\n}\n"],"version":3}
1
+ {"file":"utils-c2ce411f.js","mappings":"SAOgB,iBAAiB,CAC/B,MAAuC;IAEvC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC3B;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO,EAAE,CAAC;SACX;KACF;IACD,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC;SAEe,eAAe,CAC7B,MAA8C;IAE9C,IAAI;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED;;;;;;;SAOgB,uBAAuB,CAAC,SAAiB;IACvD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAC9B,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,IAAI,CAC7C,CAAC;IAEF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC,CAAC;IA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ts"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\nimport type { SearchResultMapping } from 'types';\n\nexport function parseCustomStyles(\n styles: string | Record<string, string>,\n): Record<string, string> {\n if (typeof styles === 'string') {\n try {\n return JSON.parse(styles);\n } catch (error) {\n console.error('Invalid customStyles format:', styles);\n return {};\n }\n }\n return styles || {};\n}\n\nexport function serializeStyles(\n styles: Record<string, Record<string, string>>,\n): string {\n try {\n return JSON.stringify(styles);\n } catch (error) {\n console.error('Error serializing styles:', error);\n return '{}';\n }\n}\n\n/**\n * Given a timestamp value, returns a formatted time string for the time\n * since now.\n *\n * @param timestamp\n * @returns {string} Formatted string value\n */\nexport function getFormattedTimeFromNow(timestamp: string): string {\n const now = new Date();\n const inputTime = new Date(timestamp);\n const diffInSeconds = Math.floor(\n (now.getTime() - inputTime.getTime()) / 1000,\n );\n\n const minutes = Math.floor(diffInSeconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const years = Math.floor(days / 365);\n\n if (minutes < 60) {\n return `${minutes}m ago`;\n }\n if (hours < 24) {\n return `${hours}h ago`;\n }\n if (days < 365) {\n return `${days}d ago`;\n }\n return `${years}y ago`;\n}\n\nexport function filterPaths(paths) {\n return paths.filter((path) => {\n const parts = path.split('/').filter(Boolean);\n\n if (parts.length > 1) {\n return true;\n }\n\n return !paths.some(\n (otherPath) => otherPath.startsWith(`${path}/`) && otherPath !== path,\n );\n });\n}\n\nexport function formatNumberWithCommas(number) {\n return number.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n}\n\nexport function getMillis(unit: 'year' | 'month' | 'day' | 'hour'): number {\n const millisInHour = 60 * 60 * 1000;\n const millisInDay = 24 * millisInHour;\n const millisInMonth = 30 * millisInDay;\n const millisInYear = 365 * millisInDay;\n\n switch (unit) {\n case 'hour':\n return millisInHour;\n case 'day':\n return millisInDay;\n case 'month':\n return millisInMonth;\n case 'year':\n return millisInYear;\n default:\n return 3600000;\n }\n}\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\n/**\n * Given a document and a SearchResultMapping, return a mapped value from the document.\n *\n * @param document\n * @param {SearchResultMapping} mapping\n * @returns {string | undefined}\n */\nexport function getDocumentValueFromSearchResultMapping(\n document: Record<string, unknown> | undefined,\n mapping: SearchResultMapping | undefined,\n): string | undefined {\n if (document && mapping) {\n return mapping.fieldNames\n .map((fieldNameDetails) => {\n let valueFound = document[fieldNameDetails.fieldName];\n\n if (valueFound && fieldNameDetails.dataType === 'date') {\n valueFound = getFormattedTimeFromNow(valueFound as string);\n }\n\n return valueFound;\n })\n .filter((value) => !!value)\n .join(mapping.delimiter || ' ');\n }\n}\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n };\n}\n"],"version":3}
@@ -1,2 +1,2 @@
1
- export{p as parseCustomStyles,s as serializeStyles}from"./p-9982883f.js";export{u as useSearchcraftStore,a as useThemeStore}from"./p-a2801518.js";
1
+ export{p as parseCustomStyles,s as serializeStyles}from"./p-f308d05d.js";export{u as useSearchcraftStore,a as useThemeStore}from"./p-a2801518.js";
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,h as s,c}from"./p-80e3f29f.js";import{c as r}from"./p-5cdc6210.js";import{p as a}from"./p-9982883f.js";const n=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-error-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-danger)}";const t=n;const i=class{constructor(s){e(this,s);this.errorMessage=undefined}render(){return s("p",{key:"07a5a9e83a30988018aa9d3d3ece9d0894923399",class:"searchcraft-error-message"},this.errorMessage||"Search term is required.")}};i.style=t;const o=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}searchcraft-input{display:flex;flex:1}.searchcraft-input-wrapper{display:inline-block;position:relative;cursor:text}.searchcraft-input-wrapper-flex{display:flex;flex:1}.searchcraft-input-flex{flex:1}.searchcraft-input{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);background-color:var(--sc-surface-neutral-secondary);border:none;border-radius:var(--sc-input-border-radius);color:var(--sc-content-neutral-primary);outline:none;padding-left:var(--sc-input-padding-left);padding-right:var(--sc-input-padding-right);padding-top:12px;padding-bottom:12px}.searchcraft-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input:focus::placeholder{opacity:0}.searchcraft-input.error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input.error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-search-icon-wrapper{align-items:center;justify-content:center;display:flex;position:absolute;pointer-events:none;bottom:0;left:0;top:0;width:var(--sc-input-padding-left)}.searchcraft-input-search-icon{pointer-events:none;width:var(--sc-input-search-icon-size);height:var(--sc-input-search-icon-size)}.searchcraft-input-clear-button{all:unset;align-items:center;justify-content:center;cursor:pointer;display:flex;position:absolute;border:none;outline:none;bottom:0;right:0;top:0;width:var(--sc-input-padding-right)}.searchcraft-input-clear-icon{width:var(--sc-input-clear-icon-size);height:var(--sc-input-clear-icon-size)}";const d=o;const h=class{constructor(s){e(this,s);this.clearInput=c(this,"clearInput",7);this.inputChange=c(this,"inputChange",7);this.handleOnInput=e=>{const s=e.target;this.inputValue=s.value;this.inputChange.emit(s.value)};this.handleClearInput=()=>{this.inputValue="";if(this.clearInput){this.clearInput.emit()}if(this.inputValue===""){return}};this.customStyles={};this.error=false;this.inputCaptionClassName="";this.inputCaptionValue="";this.inputClassName="";this.isRequesting=false;this.placeholderValue="Enter Search";this.query="";this.flex=true;this.inputValue=this.query}render(){const e=a(this.customStyles);const c=r("searchcraft-input-wrapper",{"searchcraft-input-wrapper-flex":this.flex});const n=r("searchcraft-input",{"searchcraft-input-flex":this.flex,error:this.error});const t=this.inputValue.length>0;return s("div",{key:"ccc37209c67ce2d5faa3ad435f0c303bf23b9355",class:c},s("input",{key:"d368f669c9e5ab7716502100d27325140a7d4c4e",autoComplete:"off",class:n,onInput:e=>{this.handleOnInput(e)},placeholder:this.placeholderValue,style:e,type:"text",value:this.inputValue}),s("div",{key:"b26c20cf29469f80a072635a4dc23ca8123d2b0b",class:"searchcraft-input-search-icon-wrapper"},s("svg",{key:"0865511d00e078982fe873e2b6fce30df290cdbd",class:"searchcraft-input-search-icon",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"searchcraft-title"},s("title",{key:"09e89005bc7972729888ed787f579ad18b6886b4",id:"searchcraft-title"},"Searchcraft Search Icon Light"),s("path",{key:"fc37d213842b87f26d9d9f89c0708392a197648c",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"}))),t&&s("button",{key:"779b81efc2ae5e985415edf4f9c02618852c7185",type:"button",class:"searchcraft-input-clear-button",onClick:this.handleClearInput},s("svg",{key:"511dd4755fd75ab0a75ecd21ad18eb8726f84c94",class:"searchcraft-input-clear-icon",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"icon-title"},s("title",{key:"97304d272345567dd59ef1c1985663074bd0ed0e",id:"icon-title"},"Searchcraft Clear Input Icon Light"),s("path",{key:"147f88e2f51d855fbc097e81d32f24c27217f443",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"}))))}};h.style=d;const f=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-input-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height);color:var(--sc-content-neutral-primary);margin-top:4px;margin-bottom:4px}";const u=f;const l=class{constructor(s){e(this,s);this.inputLabelClassName="";this.label=undefined}render(){if(!this.label){return null}return s("label",{class:"searchcraft-input-label",htmlFor:"searchcraft-input-id"},this.label)}};l.style=u;export{i as searchcraft_error_message,h as searchcraft_input,l as searchcraft_input_label};
2
- //# sourceMappingURL=p-92d080a7.entry.js.map
1
+ import{r as e,h as s,c}from"./p-80e3f29f.js";import{c as r}from"./p-5cdc6210.js";import{p as a}from"./p-f308d05d.js";const n=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-error-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-danger)}";const t=n;const i=class{constructor(s){e(this,s);this.errorMessage=undefined}render(){return s("p",{key:"07a5a9e83a30988018aa9d3d3ece9d0894923399",class:"searchcraft-error-message"},this.errorMessage||"Search term is required.")}};i.style=t;const o=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}searchcraft-input{display:flex;flex:1}.searchcraft-input-wrapper{display:inline-block;position:relative;cursor:text}.searchcraft-input-wrapper-flex{display:flex;flex:1}.searchcraft-input-flex{flex:1}.searchcraft-input{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);background-color:var(--sc-surface-neutral-secondary);border:none;border-radius:var(--sc-input-border-radius);color:var(--sc-content-neutral-primary);outline:none;padding-left:var(--sc-input-padding-left);padding-right:var(--sc-input-padding-right);padding-top:12px;padding-bottom:12px}.searchcraft-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input:focus::placeholder{opacity:0}.searchcraft-input.error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input.error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-search-icon-wrapper{align-items:center;justify-content:center;display:flex;position:absolute;pointer-events:none;bottom:0;left:0;top:0;width:var(--sc-input-padding-left)}.searchcraft-input-search-icon{pointer-events:none;width:var(--sc-input-search-icon-size);height:var(--sc-input-search-icon-size)}.searchcraft-input-clear-button{all:unset;align-items:center;justify-content:center;cursor:pointer;display:flex;position:absolute;border:none;outline:none;bottom:0;right:0;top:0;width:var(--sc-input-padding-right)}.searchcraft-input-clear-icon{width:var(--sc-input-clear-icon-size);height:var(--sc-input-clear-icon-size)}";const d=o;const h=class{constructor(s){e(this,s);this.clearInput=c(this,"clearInput",7);this.inputChange=c(this,"inputChange",7);this.handleOnInput=e=>{const s=e.target;this.inputValue=s.value;this.inputChange.emit(s.value)};this.handleClearInput=()=>{this.inputValue="";if(this.clearInput){this.clearInput.emit()}if(this.inputValue===""){return}};this.customStyles={};this.error=false;this.inputCaptionClassName="";this.inputCaptionValue="";this.inputClassName="";this.isRequesting=false;this.placeholderValue="Enter Search";this.query="";this.flex=true;this.inputValue=this.query}render(){const e=a(this.customStyles);const c=r("searchcraft-input-wrapper",{"searchcraft-input-wrapper-flex":this.flex});const n=r("searchcraft-input",{"searchcraft-input-flex":this.flex,error:this.error});const t=this.inputValue.length>0;return s("div",{key:"ccc37209c67ce2d5faa3ad435f0c303bf23b9355",class:c},s("input",{key:"d368f669c9e5ab7716502100d27325140a7d4c4e",autoComplete:"off",class:n,onInput:e=>{this.handleOnInput(e)},placeholder:this.placeholderValue,style:e,type:"text",value:this.inputValue}),s("div",{key:"b26c20cf29469f80a072635a4dc23ca8123d2b0b",class:"searchcraft-input-search-icon-wrapper"},s("svg",{key:"0865511d00e078982fe873e2b6fce30df290cdbd",class:"searchcraft-input-search-icon",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"searchcraft-title"},s("title",{key:"09e89005bc7972729888ed787f579ad18b6886b4",id:"searchcraft-title"},"Searchcraft Search Icon Light"),s("path",{key:"fc37d213842b87f26d9d9f89c0708392a197648c",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"}))),t&&s("button",{key:"779b81efc2ae5e985415edf4f9c02618852c7185",type:"button",class:"searchcraft-input-clear-button",onClick:this.handleClearInput},s("svg",{key:"511dd4755fd75ab0a75ecd21ad18eb8726f84c94",class:"searchcraft-input-clear-icon",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"icon-title"},s("title",{key:"97304d272345567dd59ef1c1985663074bd0ed0e",id:"icon-title"},"Searchcraft Clear Input Icon Light"),s("path",{key:"147f88e2f51d855fbc097e81d32f24c27217f443",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"}))))}};h.style=d;const f=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-input-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height);color:var(--sc-content-neutral-primary);margin-top:4px;margin-bottom:4px}";const u=f;const l=class{constructor(s){e(this,s);this.inputLabelClassName="";this.label=undefined}render(){if(!this.label){return null}return s("label",{class:"searchcraft-input-label",htmlFor:"searchcraft-input-id"},this.label)}};l.style=u;export{i as searchcraft_error_message,h as searchcraft_input,l as searchcraft_input_label};
2
+ //# sourceMappingURL=p-1720b612.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as s,c as e,h as t,g as i}from"./p-80e3f29f.js";import{u as c,i as a}from"./p-a2801518.js";import{p as r}from"./p-9982883f.js";import{p as n}from"./p-4c89f065.js";const h=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-auto-search-form{display:flex;flex-direction:column;gap:4px}";const o=h;const d=class{constructor(t){s(this,t);this.inputClearedOrNoResults=e(this,"inputClearedOrNoResults",7);this.querySubmit=e(this,"querySubmit",7);this.debounceTimeout=null;this.debounceDelay=0;this.searchStore=c.getState();this.handleInputChange=s=>{const e=s.detail;if(e===this.query){return}this.query=e;const t=()=>{if(this.query.trim()===""){this.searchStore.setQuery("");this.searchResults=null;this.searchStore.setSearchResults(null);this.inputClearedOrNoResults.emit()}else{this.searchStore.setQuery(this.query);this.querySubmit.emit();this.runSearch()}};if(this.debounceDelay>0){if(this.debounceTimeout){clearTimeout(this.debounceTimeout)}this.debounceTimeout=setTimeout(t,this.debounceDelay)}else{t()}};this.handleClearInput=()=>{if(this.query===""&&!this.searchResults){return}this.query="";this.searchResults=null;this.searchStore.setQuery("");this.searchStore.setSearchResults(null);if(typeof this.clearInput==="function"){this.clearInput()}if(this.debounceTimeout){clearTimeout(this.debounceTimeout)}this.error=false;this.inputClearedOrNoResults.emit()};this.runSearch=async()=>{if(this.query.trim()===""){this.error=true;this.inputClearedOrNoResults.emit()}else{this.error=false;this.searchStore.setQuery(this.query);try{await this.searchStore.search()}catch(s){this.error=true;this.inputClearedOrNoResults.emit()}}};this.handleFormSubmit=async s=>{s.preventDefault();await this.runSearch()};this.autoSearchFormClass="";this.clearInput=()=>{};this.config=undefined;this.customStylesForInput={};this.inputCaptionValue="";this.labelForInput="";this.placeholderValue="Search here";this.searchContainerClass="";this.error=false;this.isRequesting=false;this.query="";this.searchResults=null}init(){var s;if(this.config){const e=new a(this.config,{sdkName:n.name,sdkVersion:n.version});this.searchStore.initialize(e,true);(s=this.unsubscribe)===null||s===void 0?void 0:s.call(this);this.unsubscribe=c.subscribe((s=>{this.isRequesting=s.isRequesting;this.searchResults=Object.assign({},s.searchResults)}))}}componentDidLoad(){this.init()}onConfigChange(){this.init()}connectedCallback(){}disconnectedCallback(){if(this.unsubscribe){this.unsubscribe()}}render(){const s=r(this.customStylesForInput);return t("form",{key:"3c1069cbaf543e9b06616d7440eb784010a7b601",class:"searchcraft-auto-search-form",onSubmit:this.handleFormSubmit},t("searchcraft-input-label",{key:"7ba138f9335b59ee2205a22ef3a8af306db102d1",label:this.labelForInput}),t("searchcraft-input",{key:"a7400629e259ea15cd58d5f2c87f1659c8d6addb",customStyles:s,"input-caption-value":this.inputCaptionValue,"is-requesting":this.isRequesting,onClearInput:this.handleClearInput,onInputChange:this.handleInputChange.bind(this),"placeholder-value":this.placeholderValue,query:this.query}),this.error&&t("searchcraft-error-message",{key:"f304152c611d3e8849a9d24b07a9db3d5d71197f",errorMessage:"Please enter a search query."}))}get element(){return i(this)}static get watchers(){return{config:["onConfigChange"]}}};d.style=o;export{d as searchcraft_auto_search_form};
2
- //# sourceMappingURL=p-2816782c.entry.js.map
1
+ import{r as s,c as e,h as t,g as i}from"./p-80e3f29f.js";import{u as c,i as a}from"./p-a2801518.js";import{p as r}from"./p-f308d05d.js";import{p as n}from"./p-c994d722.js";const h=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-auto-search-form{display:flex;flex-direction:column;gap:4px}";const o=h;const d=class{constructor(t){s(this,t);this.inputClearedOrNoResults=e(this,"inputClearedOrNoResults",7);this.querySubmit=e(this,"querySubmit",7);this.debounceTimeout=null;this.debounceDelay=0;this.searchStore=c.getState();this.handleInputChange=s=>{const e=s.detail;if(e===this.query){return}this.query=e;const t=()=>{if(this.query.trim()===""){this.searchStore.setQuery("");this.searchResults=null;this.searchStore.setSearchResults(null);this.inputClearedOrNoResults.emit()}else{this.searchStore.setQuery(this.query);this.querySubmit.emit();this.runSearch()}};if(this.debounceDelay>0){if(this.debounceTimeout){clearTimeout(this.debounceTimeout)}this.debounceTimeout=setTimeout(t,this.debounceDelay)}else{t()}};this.handleClearInput=()=>{if(this.query===""&&!this.searchResults){return}this.query="";this.searchResults=null;this.searchStore.setQuery("");this.searchStore.setSearchResults(null);if(typeof this.clearInput==="function"){this.clearInput()}if(this.debounceTimeout){clearTimeout(this.debounceTimeout)}this.error=false;this.inputClearedOrNoResults.emit()};this.runSearch=async()=>{if(this.query.trim()===""){this.error=true;this.inputClearedOrNoResults.emit()}else{this.error=false;this.searchStore.setQuery(this.query);try{await this.searchStore.search()}catch(s){this.error=true;this.inputClearedOrNoResults.emit()}}};this.handleFormSubmit=async s=>{s.preventDefault();await this.runSearch()};this.autoSearchFormClass="";this.clearInput=()=>{};this.config=undefined;this.customStylesForInput={};this.inputCaptionValue="";this.labelForInput="";this.placeholderValue="Search here";this.searchContainerClass="";this.error=false;this.isRequesting=false;this.query="";this.searchResults=null}init(){var s;if(this.config){const e=new a(this.config,{sdkName:n.name,sdkVersion:n.version});this.searchStore.initialize(e,true);(s=this.unsubscribe)===null||s===void 0?void 0:s.call(this);this.unsubscribe=c.subscribe((s=>{this.isRequesting=s.isRequesting;this.searchResults=Object.assign({},s.searchResults)}))}}componentDidLoad(){this.init()}onConfigChange(){this.init()}connectedCallback(){}disconnectedCallback(){if(this.unsubscribe){this.unsubscribe()}}render(){const s=r(this.customStylesForInput);return t("form",{key:"3c1069cbaf543e9b06616d7440eb784010a7b601",class:"searchcraft-auto-search-form",onSubmit:this.handleFormSubmit},t("searchcraft-input-label",{key:"7ba138f9335b59ee2205a22ef3a8af306db102d1",label:this.labelForInput}),t("searchcraft-input",{key:"a7400629e259ea15cd58d5f2c87f1659c8d6addb",customStyles:s,"input-caption-value":this.inputCaptionValue,"is-requesting":this.isRequesting,onClearInput:this.handleClearInput,onInputChange:this.handleInputChange.bind(this),"placeholder-value":this.placeholderValue,query:this.query}),this.error&&t("searchcraft-error-message",{key:"f304152c611d3e8849a9d24b07a9db3d5d71197f",errorMessage:"Please enter a search query."}))}get element(){return i(this)}static get watchers(){return{config:["onConfigChange"]}}};d.style=o;export{d as searchcraft_auto_search_form};
2
+ //# sourceMappingURL=p-491ae071.entry.js.map