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a,KACbsB,EAAAA,cAAC0J,GAA4B,CAC5BC,MAAOmrB,EACPlrB,OAAQorB,EACRnrB,UAAWqrB,EACXprB,oBAAqBA,EACrBE,OAAQA,GAERhK,EAAAA,cAACyG,EAAwB,CAACvB,kBAAmBA,GAC5ClF,EAAAA,cAAC0wB,GAAoB,CACpBC,WAAY6E,EACZxR,oBAAqBA,EACrByD,iBAAkBA,EAClB7F,qBAAsBA,EACtB0J,oBAAqBA,EACrBC,WAAYA,EACZC,WAAYA,QAMjBxrB,EAAAA,cAAC4vB,EAAe,CAACzrB,YAAY,wBAIjC,gBGtwBO,SAAS0xB,EAAuB10B,GACtC,GAAIA,QACH,OAAO,KAGR,IACC,OAAO+0B,KAAKC,MAAMh1B,EACnB,CAAE,MAAAyG,GACD,OAAO,IACR,CACD","sources":["webpack://@logos/commerceweb-frontend/./Scripts/site/components/error-boundary/index.jsx","webpack://@logos/commerceweb-frontend/./Scripts/site/hooks/use-author.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/shared/books-by-author/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/hooks/use-publisher.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/category-content.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/user-search-filter-context.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/accordion/accordion.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/search-resources.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/algolia-search-context.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/util.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/filters.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/refinements.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/skeleton/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/shared/enhanced-for-logos-label/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/shared/enhanced-for-logos-with-tooltip/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/use-product-card.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-image.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/discount-badge.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-title.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-authors.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-pricing.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/algolia-grid-card.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/product-overview.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/product-card/algolia-list-card.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/products.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/sort-by-accordion.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/use-view-mode.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/routing.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/hooks/use-search-impressions.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/components/search/hooks/use-search-analytics.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/util/safe-json-parse.ts"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nclass ErrorBoundary extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\thasError: false,\n\t\t\terror: null,\n\t\t\terrorInfo: null,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromError(error) {\n\t\t// Update state so the next render will show the fallback UI\n\t\treturn { hasError: true };\n\t}\n\n\tcomponentDidCatch(error, errorInfo) {\n\t\t// Store error details in state\n\t\tthis.setState({\n\t\t\terror,\n\t\t\terrorInfo,\n\t\t});\n\n\t\t// Notify parent component about the error\n\t\tif (this.props.onError) {\n\t\t\tthis.props.onError(error, errorInfo);\n\t\t}\n\n\t\t// Log error to console or external service\n\t\tconsole.error('ErrorBoundary caught an error:', error, errorInfo);\n\t}\n\n\tresetErrorBoundary = () => {\n\t\tthis.setState({\n\t\t\thasError: false,\n\t\t\terror: null,\n\t\t\terrorInfo: null,\n\t\t});\n\n\t\t// Notify parent that error was reset\n\t\tif (this.props.onReset) {\n\t\t\tthis.props.onReset();\n\t\t}\n\t};\n\n\trender() {\n\t\tif (this.state.hasError) {\n\t\t\t// If custom error template is provided, use it\n\t\t\tif (this.props.fallback) {\n\t\t\t\tif (typeof this.props.fallback !== 'function') {\n\t\t\t\t\treturn this.fallback;\n\t\t\t\t}\n\n\t\t\t\t// Pass error details and reset function to custom template\n\t\t\t\treturn this.props.fallback({\n\t\t\t\t\terror: this.state.error,\n\t\t\t\t\terrorInfo: this.state.errorInfo,\n\t\t\t\t\tresetErrorBoundary: this.resetErrorBoundary,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// If fallbackComponent is provided as a React component\n\t\t\tif (this.props.fallbackComponent) {\n\t\t\t\tconst FallbackComponent = this.props.fallbackComponent;\n\t\t\t\treturn (\n\t\t\t\t\t<FallbackComponent\n\t\t\t\t\t\terror={this.state.error}\n\t\t\t\t\t\terrorInfo={this.state.errorInfo}\n\t\t\t\t\t\tresetErrorBoundary={this.resetErrorBoundary}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this.props.children;\n\t}\n}\n\nErrorBoundary.propTypes = {\n\tchildren: PropTypes.node.isRequired,\n\tfallback: PropTypes.func,\n\tfallbackComponent: PropTypes.elementType,\n\tonError: PropTypes.func,\n\tonReset: PropTypes.func,\n\tshowError: PropTypes.bool,\n};\n\nErrorBoundary.defaultProps = {\n\tshowError: false,\n};\n\nexport default ErrorBoundary;\n","import { createBatchContext } from './use-batch';\n\ninterface AuthorInfo {\n\tid: string;\n\tdisplayName: string;\n\timageUrlLarge?: string;\n\tlongDescription?: string;\n}\n\nexport const AuthorBatch = createBatchContext<string, AuthorInfo>(\n\tasync ids => {\n\t\tconst response = await fetch(`/api/authors?ids=${ids.join(',')}`);\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`HTTP error! status: ${response.status}`);\n\t\t}\n\n\t\treturn (await response.json()) as AuthorInfo[];\n\t},\n\t(id, data) => data.find(d => d.id === id)\n);\n\nexport function useAuthor(id: string) {\n\treturn AuthorBatch.useData(id);\n}\n","import React, { useState } from 'react';\nimport { IconButton, Typography } from '@faithlife/commerce-components';\nimport { ChevronDown, ChevronUp } from 'lucide-react';\nimport { useRefinementList } from 'react-instantsearch';\nimport { AuthorBio } from '../author-bio';\nimport { useAuthor } from '../../../hooks/use-author';\n\nconst useGetRefinedValues = (attribute: string) =>\n\tuseRefinementList({ attribute })\n\t\t.items.filter(item => item.isRefined)\n\t\t.map(item => item.value) ?? [];\n\ninterface BooksByAuthorProps {\n\tresources: {\n\t\tbooksBy: string;\n\t\tshowMore: string;\n\t\tshowLess: string;\n\t};\n}\n\nexport const BooksByAuthor = ({ resources }: BooksByAuthorProps) => {\n\tconst refinedAuthorIds = useGetRefinedValues('authorIds');\n\tconst authorId = refinedAuthorIds?.length === 1 ? refinedAuthorIds[0] : '';\n\tconst { data: author, isLoading } = useAuthor(authorId);\n\n\tconst [isCollapsed, setIsCollapsed] = useState(false);\n\n\tif (isLoading || !authorId || !author || !author.displayName || !author.longDescription) {\n\t\treturn <></>;\n\t}\n\n\treturn (\n\t\t<div className=\"bg-[#f2f2f2] border-t border-b border-[#b1b1b1] px-3 py-4 md:p-6\">\n\t\t\t<div className=\"flex justify-between\">\n\t\t\t\t<Typography variant=\"headingH6\">\n\t\t\t\t\t{resources.booksBy} {author?.displayName}\n\t\t\t\t</Typography>\n\t\t\t\t<IconButton aria-label=\"Toggle collapse\" scale=\"sm\" onClick={() => setIsCollapsed(!isCollapsed)}>\n\t\t\t\t\t{isCollapsed ? <ChevronDown /> : <ChevronUp />}\n\t\t\t\t</IconButton>\n\t\t\t</div>\n\t\t\t{!isCollapsed && (\n\t\t\t\t<AuthorBio\n\t\t\t\t\tclassName=\"mt-4 rounded-[3px] border border-[#d8d8d8] bg-white p-4 md:p-8\"\n\t\t\t\t\tresources={resources}\n\t\t\t\t\tdisplayName={author?.displayName}\n\t\t\t\t\timageUrl={author?.imageUrlLarge}\n\t\t\t\t\tbio={author?.longDescription}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n","import { createBatchContext } from './use-batch';\n\nexport interface PublisherInfo {\n\tid: string;\n\tdisplayName: string;\n}\n\nexport const PublisherBatch = createBatchContext<string, PublisherInfo>(\n\tasync ids => {\n\t\tconst response = await fetch(`/api/publisher?ids=${ids.join(',')}`);\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`HTTP error! status: ${response.status}`);\n\t\t}\n\n\t\treturn (await response.json()) as PublisherInfo[];\n\t},\n\t(id, data) => data.find(d => d.id === id)\n);\n\nexport function usePublisher(id: string) {\n\treturn PublisherBatch.useData(id);\n}\n","import React, { useState, useCallback } from 'react';\n\nimport ReadMoreReadLess from '../read-more-read-less';\nimport { SectionContent } from '../content';\nimport ErrorBoundary from '../error-boundary';\nimport { SectionKind } from '../../builder';\n\ninterface Props {\n\tsectionKind: SectionKind;\n}\n\ninterface ContentChangeEvent {\n\thasContent: boolean;\n\tcontentKey: string;\n}\n\nconst CategoryContent = ({ sectionKind }: Props) => {\n\t// Merged into one state object so both values update in a single render,\n\t// avoiding separate re-renders that can cause SectionContent to remount.\n\tconst [{ hasContent, contentKey }, setContentState] = useState({ hasContent: false, contentKey: '' });\n\n\tconst handleContentChange = useCallback((event: ContentChangeEvent) => {\n\t\tsetContentState(prev =>\n\t\t\tprev.hasContent === event.hasContent && prev.contentKey === event.contentKey\n\t\t\t\t? prev\n\t\t\t\t: { hasContent: event.hasContent, contentKey: event.contentKey }\n\t\t);\n\t}, []);\n\n\t// SectionContent always stays in the same tree position (inside ReadMoreReadLess).\n\t// Changing the parent conditionally would cause SectionContent to unmount/remount\n\t// and re-fire the sections AJAX on every hasContent or contentKey state change.\n\treturn (\n\t\t<ErrorBoundary>\n\t\t\t<div className={hasContent ? 'w-full' : 'hidden'}>\n\t\t\t\t<ReadMoreReadLess contentKey={contentKey}>\n\t\t\t\t\t<SectionContent sectionKind={sectionKind} onContentChange={handleContentChange} />\n\t\t\t\t</ReadMoreReadLess>\n\t\t\t</div>\n\t\t</ErrorBoundary>\n\t);\n};\n\nexport default CategoryContent;\n","import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';\n\nimport { useLocation } from '../../location';\n\nexport interface UserSearchFilterOption {\n\tdisplayName: string;\n\tisDefault?: boolean;\n\talgoliaValue: string;\n\ttoken: string;\n}\n\nexport interface UserSearchFilter {\n\ttitle: string;\n\toptions: UserSearchFilterOption[];\n\ttoken: string;\n}\n\nexport interface UserSearchFilters {\n\tfilters: UserSearchFilter[];\n}\n\ninterface UserSearchFilterContextValue {\n\tselectedFilterOptions: Record<string, string>;\n\tsetSelectedFilterOption: (filterToken: string, optionToken: string) => void;\n\tuserSearchFilters: UserSearchFilter[];\n}\n\nconst UserSearchFilterContext = createContext<UserSearchFilterContextValue | null>(null);\n\nfunction getDefaultSelectedFilterOptions(userSearchFilters: UserSearchFilter[]) {\n\treturn userSearchFilters.reduce<Record<string, string>>((selectedOptions, filter) => {\n\t\tconst options = Array.isArray(filter?.options) ? filter.options : [];\n\t\tconst selectedOption = options.find(option => option?.isDefault) ?? options[0];\n\n\t\tif (selectedOption?.token) {\n\t\t\tselectedOptions[filter.token] = selectedOption.token;\n\t\t}\n\n\t\treturn selectedOptions;\n\t}, {});\n}\n\nfunction readUserFilterSelectionsFromUrl(\n\tuserSearchFilters: UserSearchFilter[],\n\tsearchParams: URLSearchParams\n): Record<string, string> {\n\tconst defaults = getDefaultSelectedFilterOptions(userSearchFilters);\n\n\treturn userSearchFilters.reduce<Record<string, string>>((selectedOptions, filter) => {\n\t\tconst options = Array.isArray(filter?.options) ? filter.options : [];\n\t\tconst urlValue = searchParams.get(filter.token);\n\t\tconst matchingOption = urlValue ? options.find(option => option?.token === urlValue) : undefined;\n\n\t\tconst resolved = matchingOption?.token ?? defaults[filter.token];\n\t\tif (resolved) {\n\t\t\tselectedOptions[filter.token] = resolved;\n\t\t}\n\n\t\treturn selectedOptions;\n\t}, {});\n}\n\nfunction writeUserFilterSelectionsToUrl(\n\tselectedFilterOptions: Record<string, string>,\n\tuserSearchFilters: UserSearchFilter[],\n\tsearch: string,\n\tpathname: string,\n\treplaceUrl: (url: string) => void\n) {\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(`https://placeholder${pathname}${search}`);\n\t} catch {\n\t\t// Malformed pathname/search — skip URL update rather than crash.\n\t\treturn;\n\t}\n\n\tfor (const filter of userSearchFilters) {\n\t\tconst selectedToken = selectedFilterOptions[filter.token];\n\n\t\tif (selectedToken) {\n\t\t\turl.searchParams.set(filter.token, selectedToken);\n\t\t} else {\n\t\t\turl.searchParams.delete(filter.token);\n\t\t}\n\t}\n\n\ttry {\n\t\treplaceUrl(`${url.pathname}${url.search}`);\n\t} catch {\n\t\t// History replacement can fail in some browsers / iframes.\n\t}\n}\n\nexport function useUserSearchFilterContext() {\n\tconst context = useContext(UserSearchFilterContext);\n\tif (!context) {\n\t\tthrow new Error('useUserSearchFilterContext must be used within UserSearchFilterProvider');\n\t}\n\treturn context;\n}\n\nexport function UserSearchFilterProvider({\n\tuserSearchFilters,\n\tsetSelectedFilterOptionsOverride,\n\tchildren,\n}: {\n\tuserSearchFilters: UserSearchFilter[];\n\tsetSelectedFilterOptionsOverride?: () => Record<string, string>;\n\tchildren: React.ReactNode;\n}) {\n\tconst { search, pathname, replaceUrl } = useLocation();\n\tconst searchParams = useMemo(() => new URLSearchParams(search), [search]);\n\n\tconst [selectedFilterOptions, setSelectedFilterOptions] = useState<Record<string, string>>(() =>\n\t\treadUserFilterSelectionsFromUrl(userSearchFilters, searchParams)\n\t);\n\n\tuseEffect(() => {\n\t\tsetSelectedFilterOptions(prev => {\n\t\t\tif (setSelectedFilterOptionsOverride) {\n\t\t\t\treturn setSelectedFilterOptionsOverride();\n\t\t\t}\n\n\t\t\tconst urlSelections = readUserFilterSelectionsFromUrl(userSearchFilters, searchParams);\n\n\t\t\t// Only reset if userSearchFilters changed (not a URL-driven update).\n\t\t\t// Preserve current selection if the option is still valid for the new filter set.\n\t\t\treturn userSearchFilters.reduce<Record<string, string>>((next, filter) => {\n\t\t\t\tconst currentSelection = prev[filter.token];\n\t\t\t\tconst isStillValid = filter.options.some(option => option.token === currentSelection);\n\n\t\t\t\tnext[filter.token] = isStillValid ? currentSelection : urlSelections[filter.token];\n\n\t\t\t\treturn next;\n\t\t\t}, {});\n\t\t});\n\t}, [setSelectedFilterOptionsOverride, userSearchFilters, searchParams]);\n\n\tuseEffect(() => {\n\t\twriteUserFilterSelectionsToUrl(selectedFilterOptions, userSearchFilters, search, pathname, replaceUrl);\n\t}, [selectedFilterOptions, userSearchFilters, search, pathname, replaceUrl]);\n\n\tconst handleSetSelectedFilterOption = (filterToken: string, optionToken: string) => {\n\t\tsetSelectedFilterOptions(prev => ({\n\t\t\t...prev,\n\t\t\t[filterToken]: optionToken,\n\t\t}));\n\t};\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\tselectedFilterOptions,\n\t\t\tsetSelectedFilterOption: handleSetSelectedFilterOption,\n\t\t\tuserSearchFilters,\n\t\t}),\n\t\t[selectedFilterOptions, userSearchFilters]\n\t);\n\n\treturn <UserSearchFilterContext.Provider value={contextValue}>{children}</UserSearchFilterContext.Provider>;\n}\n","import * as React from 'react';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { ChevronDown } from 'lucide-react';\n\nimport { cn } from '../../util/cn';\n\nconst Accordion = AccordionPrimitive.Root;\n\nconst AccordionItem = React.forwardRef<\n\tReact.ComponentRef<typeof AccordionPrimitive.Item>,\n\tReact.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => <AccordionPrimitive.Item className={cn('', className)} ref={ref} {...props} />);\n\nAccordionItem.displayName = AccordionPrimitive.Item.displayName;\n\nconst AccordionTrigger = React.forwardRef<\n\tReact.ComponentRef<typeof AccordionPrimitive.Trigger>,\n\tReact.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Header className=\"flex\">\n\t\t<AccordionPrimitive.Trigger\n\t\t\tclassName={cn(\n\t\t\t\t'flex flex-1 items-center justify-between py-[9.5px] text-lg font-bold outline-hidden transition-all hover:text-secondary focus-visible:text-secondary [&[data-state=open]>svg]:rotate-180',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t{/* TODO: For the sake of moving fast we are leaving this in, but in the future we need to figure out how enable custom icons */}\n\t\t\t<ChevronDown className=\"h-6 w-6 shrink-0 transition-transform duration-200\" />\n\t\t</AccordionPrimitive.Trigger>\n\t</AccordionPrimitive.Header>\n));\n\nAccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;\n\nconst AccordionContent = React.forwardRef<\n\tReact.ComponentRef<typeof AccordionPrimitive.Content>,\n\tReact.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Content\n\t\tclassName={cn(\n\t\t\t'data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down mb-4 overflow-hidden transition-all',\n\t\t\tclassName\n\t\t)}\n\t\tref={ref}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</AccordionPrimitive.Content>\n));\n\nAccordionContent.displayName = AccordionPrimitive.Content.displayName;\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n","import { createContext, useContext } from 'react';\n\nexport const SearchResourcesContext = createContext<Record<string, string>>({});\n\nexport function useSearchResources(): Record<string, string> {\n\treturn useContext(SearchResourcesContext);\n}\n","import React, { createContext, useContext, useEffect, useMemo } from 'react';\nimport { algoliasearch } from 'algoliasearch';\nimport insightsClient from 'search-insights';\n\n// ---------------------------------------------------------------------------\n// Algolia search context — provides the configured Algolia client\n// ---------------------------------------------------------------------------\n\ninterface AlgoliaSearchContextValue {\n\tclient: ReturnType<typeof algoliasearch>;\n\tindexName: string;\n\tstorefrontShortname: string;\n\tuserId: string | null;\n}\n\nconst AlgoliaSearchContext = createContext<AlgoliaSearchContextValue | null>(null);\n\ninterface AlgoliaSearchContextProviderProps {\n\tappId: string;\n\tappKey: string;\n\tindexName: string;\n\tstorefrontShortname: string;\n\tuserId?: string | null;\n\tchildren: React.ReactNode;\n}\n\nexport function AlgoliaSearchContextProvider({\n\tappId,\n\tappKey,\n\tindexName,\n\tstorefrontShortname,\n\tuserId = null,\n\tchildren,\n}: AlgoliaSearchContextProviderProps) {\n\tconst client = useMemo(() => algoliasearch(appId, appKey), [appId, appKey]);\n\n\tuseEffect(() => {\n\t\tinsightsClient('init', { appId, apiKey: appKey });\n\t\tif (userId) {\n\t\t\tinsightsClient('setAuthenticatedUserToken', userId);\n\t\t}\n\t}, [appId, appKey, userId]);\n\n\tconst value = useMemo(\n\t\t() => ({ client, indexName, storefrontShortname, userId }),\n\t\t[client, indexName, storefrontShortname, userId]\n\t);\n\n\treturn <AlgoliaSearchContext.Provider value={value}>{children}</AlgoliaSearchContext.Provider>;\n}\n\nexport function useAlgoliaSearch(): AlgoliaSearchContextValue {\n\tconst context = useContext(AlgoliaSearchContext);\n\n\tif (!context) {\n\t\tthrow new Error('useAlgoliaSearch must be used within an AlgoliaSearchContextProvider');\n\t}\n\n\treturn context;\n}\n","import type { ProductPriceAmount } from '../per-user-data/per-user-data-context';\n\ninterface SavingsPrices {\n\tsalePrice?: Pick<ProductPriceAmount, 'amount'> | null;\n\tanchorPrice?: Pick<ProductPriceAmount, 'amount'> | null;\n}\n\n/**\n * Transliterates Unicode characters to their closest ASCII equivalents.\n * Approximates the behavior of the .NET Unidecode library used by SlugHelper on the server.\n */\nfunction unidecode(text: string): string {\n\t// Handle characters that don't decompose via NFD but have ASCII equivalents.\n\t// Order matters: apply multi-char replacements before NFD strips combining marks.\n\tconst result = text\n\t\t.replace(/ß/g, 'ss')\n\t\t.replace(/[æÆ]/g, 'ae')\n\t\t.replace(/[œŒ]/g, 'oe')\n\t\t.replace(/[øØ]/g, 'o')\n\t\t.replace(/[ðÐ]/g, 'd')\n\t\t.replace(/[þÞ]/g, 'th')\n\t\t.replace(/[łŁ]/g, 'l');\n\n\t// Strip combining diacritical marks from remaining Latin characters via NFD normalization.\n\treturn result.normalize('NFD').replace(/\\p{Mn}/gu, '');\n}\n\n/**\n * Converts a string to a URL-friendly slug.\n * Matches the server-side SlugHelper.Slugify method used to generate product URL slugs.\n */\nexport function slugify(value: string | undefined): string {\n\tif (!value) {\n\t\treturn '';\n\t}\n\n\t// Remove trademark/registered symbols\n\tlet input = value.replace(/®/g, '').replace(/™/g, '');\n\n\t// Transliterate Unicode → ASCII, then lowercase (matches .Unidecode().ToLowerInvariant())\n\tinput = unidecode(input).toLowerCase();\n\n\t// Remove trailing parenthetical and bracket blocks, e.g. \"Title (Subtitle) [Edition]\"\n\t// Matches s_parenBlocks = new Regex(\"(\\\\(.*\\\\))?(\\\\s*\\\\[.*\\\\])*$\")\n\tinput = input.replace(/(\\(.*\\))?(\\s*\\[.*\\])*$/g, '');\n\n\t// Strip HTML tags — matches s_htmlTags = new Regex(\"</?[^>]+>\")\n\tinput = input.replace(/<\\/?[^>]+>/g, '');\n\n\t// Expand ampersand\n\tinput = input.replace(/ & /g, ' and ');\n\n\t// Convert separating punctuation to spaces — matches s_punctuationForSpace = new Regex(\"[/\\\\-:_]\")\n\tinput = input.replace(/[/\\-:_]/g, ' ');\n\n\t// Remove all remaining non-alphanumeric, non-space characters — matches s_punctuationAndNonAlpha = new Regex(\"[^a-z0-9 ]\")\n\tinput = input.replace(/[^a-z0-9 ]/g, '');\n\n\t// Collapse whitespace runs to hyphens — matches s_excessWhitespace = new Regex(\"\\\\s+\")\n\treturn input.trim().replace(/\\s+/g, '-');\n}\n\nexport function getSavingsPercent(prices: SavingsPrices | null | undefined): number {\n\tconst anchor = prices?.anchorPrice?.amount;\n\tconst sale = prices?.salePrice?.amount;\n\tif (!anchor || !sale) {\n\t\treturn 0;\n\t}\n\tif (anchor <= 0) {\n\t\treturn 0;\n\t}\n\treturn ((anchor - sale) / anchor) * 100;\n}\n\n/**\n * Splits an author/publisher facet value of the form \"id:displayName\" into its parts.\n * Uses the first colon as the separator so display names that themselves contain colons\n * are preserved. When no colon is present, the whole value is treated as both id and name.\n */\nexport function parseFacetValue(value: string): { id: string; displayName: string } {\n\tconst separatorIndex = value.indexOf(':');\n\tif (separatorIndex === -1) {\n\t\treturn { id: value, displayName: value };\n\t}\n\treturn {\n\t\tid: value.substring(0, separatorIndex),\n\t\tdisplayName: value.substring(separatorIndex + 1),\n\t};\n}\n\nexport function safeUrl(input: string, base?: string): URL | null {\n\ttry {\n\t\treturn new URL(input, base);\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import React, { useEffect, useRef, useState } from 'react';\nimport insightsClient from 'search-insights';\nimport { LinkButton, Typography } from '@faithlife/commerce-components';\nimport {\n\tRefinementListItem,\n\tRefinementListRenderState,\n} from 'instantsearch.js/es/connectors/refinement-list/connectRefinementList';\nimport { useRefinementList } from 'react-instantsearch';\nimport { cn } from '../../util/cn';\n\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '../accordion';\nimport { useSearchResources } from './search-resources';\nimport { UserSearchFilter, UserSearchFilterOption, useUserSearchFilterContext } from './user-search-filter-context';\nimport { useAlgoliaSearch } from './algolia-search-context';\nimport { parseFacetValue } from './util';\n\nfunction Check({ className, checked }: { className?: string; checked: boolean }) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={cn('inline', className)}\n\t\t\tfill=\"none\"\n\t\t\theight=\"14\"\n\t\t\tviewBox=\"0 0 13 14\"\n\t\t\twidth=\"13\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<rect\n\t\t\t\tfill={checked ? '#1E6AFE' : 'white'}\n\t\t\t\theight=\"13\"\n\t\t\t\trx=\"1\"\n\t\t\t\tstroke={checked ? undefined : '#C7C7C7'}\n\t\t\t\twidth=\"13\"\n\t\t\t\ty=\"0.5\"\n\t\t\t/>\n\t\t\t<path d=\"M3.28223 7.73706L5.2634 9.71824L9.71857 5.26308\" stroke=\"white\" strokeLinecap=\"round\" />\n\t\t</svg>\n\t);\n}\n\nconst c_statusLabelKeys: Record<string, string> = {\n\t'status > live': 'liveStatusText',\n\t'status > prepub': 'prepubStatusText',\n\t'status > prepub > gatheringinterest': 'gatheringInterestStatusText',\n\t'status > prepub > undercontract': 'underContractStatusText',\n\t'status > prepub > gatheringinterest > almostfunded': 'almostFundedStatusText',\n\t'status > prepub > undercontract > shippingsoon': 'shippingSoonStatusText',\n};\n\nfunction ShowMoreToggle({\n\tshowMore,\n\tattribute,\n\tsetShowMore,\n}: {\n\tshowMore: string | undefined;\n\tattribute: string;\n\tsetShowMore: (showMore: string | undefined) => void;\n}) {\n\tconst resources = useSearchResources();\n\tconst isShowingMore = showMore === attribute;\n\n\treturn (\n\t\t<LinkButton as=\"button\" onClick={() => setShowMore(isShowingMore ? undefined : attribute)} scale=\"sm\">\n\t\t\t{isShowingMore ? resources['showLess'] : resources['showMore']}\n\t\t</LinkButton>\n\t);\n}\n\nfunction countDepth(value: string) {\n\tlet index = value.indexOf('>');\n\tlet depth = 0;\n\n\twhile (index !== -1) {\n\t\tindex = value.indexOf('>', index + 1);\n\t\tdepth += 1;\n\t}\n\n\treturn depth;\n}\n\nexport interface RefinementItem {\n\trefinement: RefinementListRenderState;\n\titem: RefinementListItem;\n}\n\nfunction hasChildren(items: RefinementItem[], { item: parent }: RefinementItem) {\n\treturn items.some(({ item }) => parent !== item && item.value.startsWith(parent.value));\n}\n\nfunction getChildren(items: RefinementItem[], parent: RefinementItem) {\n\tconst depth = countDepth(parent.item.value);\n\n\treturn items.filter(({ item }) => countDepth(item.value) === depth + 1 && item.value.startsWith(parent.item.value));\n}\n\nexport function getAccordions(category: string, items: RefinementItem[]) {\n\tconst root = {\n\t\tkey: category,\n\t\tlabel: category,\n\t\titems: items.filter(({ item }) => countDepth(item.value) === 0),\n\t};\n\n\tconst subCategories = items\n\t\t.filter(({ item }) => item.isRefined)\n\t\t.filter(parent => hasChildren(items, parent))\n\t\t.map(c => ({\n\t\t\tkey: c.item.value,\n\t\t\tlabel: c.item.label.replace(/^((.*) > )*/, ''),\n\t\t\titems: getChildren(items, c),\n\t\t}));\n\n\treturn [root, ...subCategories];\n}\n\nfunction useRefinementLists(category: string, levels?: number) {\n\t// not neccessary, but let's avoid shooting ourselves in the foot, shall we?\n\tconst levelsRef = useRef(levels);\n\tconst items: RefinementItem[] = [];\n\n\tif (levelsRef.current !== undefined) {\n\t\tfor (let level = 0; level <= levelsRef.current; level += 1) {\n\t\t\tconst attribute = `${category}.lvl${level}`;\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tconst refinement = useRefinementList({ attribute, limit: 100 }, { skipSuspense: level < levelsRef.current - 1 });\n\n\t\t\titems.push(...refinement.items.map(item => ({ item, refinement })));\n\t\t}\n\t} else {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst refinement = useRefinementList({ attribute: category });\n\n\t\titems.push(...refinement.items.map(item => ({ item, refinement })));\n\t}\n\n\treturn items;\n}\n\nfunction Category({\n\tcategory,\n\tsetExpandedFacets,\n\tsetShowMore,\n\tshowMore,\n\tmaxLevel,\n}: {\n\tcategory: string;\n\tsetExpandedFacets: (setState: (expandedFacets: string[]) => string[]) => void;\n\tsetShowMore: (showMore: string | undefined) => void;\n\tshowMore: string | undefined;\n\tmaxLevel?: number;\n}) {\n\tconst resources = useSearchResources();\n\tconst { indexName } = useAlgoliaSearch();\n\tconst items = useRefinementLists(category, maxLevel);\n\n\tif (!items?.length) {\n\t\treturn null;\n\t}\n\n\tconst accordions = getAccordions(category, items);\n\n\treturn accordions.map(accordion => (\n\t\t<AccordionItem key={accordion.key} value={accordion.key}>\n\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t{resources[accordion.label] ?? accordion.label}\n\t\t\t\t</Typography>\n\t\t\t</AccordionTrigger>\n\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t{(showMore === accordion.key ? accordion.items : accordion.items.slice(0, 7)).map(({ item, refinement }) => (\n\t\t\t\t\t\t<div key={item.value}>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !item.isRefined,\n\t\t\t\t\t\t\t\t\t\t'text-primary': item.isRefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\trefinement.refine(item.value);\n\n\t\t\t\t\t\t\t\t\tinsightsClient('clickedFilters', {\n\t\t\t\t\t\t\t\t\t\tindex: indexName,\n\t\t\t\t\t\t\t\t\t\teventName: 'Clicked filter',\n\t\t\t\t\t\t\t\t\t\tfilters: [`${category}:${item.value}`],\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tif (!item.isRefined) {\n\t\t\t\t\t\t\t\t\t\tsetExpandedFacets(old => [...old, item.value]);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\titems\n\t\t\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t\t\t({ item: child }) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\tchild.isRefined && child.value !== item.value && child.value.startsWith(item.value)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t.forEach(({ item: child, refinement: childRefinement }) => {\n\t\t\t\t\t\t\t\t\t\t\t\tchildRefinement.refine(child.value);\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tsetExpandedFacets(old => old.filter(v => !v.startsWith(item.value)));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Check checked={item.isRefined} className=\"mr-3\" />\n\t\t\t\t\t\t\t\t{item.label.lastIndexOf('>') === -1\n\t\t\t\t\t\t\t\t\t? item.label\n\t\t\t\t\t\t\t\t\t: item.label.substring(item.label.lastIndexOf('>') + 2)}{' '}\n\t\t\t\t\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t\t\t\t\t{'('}\n\t\t\t\t\t\t\t\t\t{item.count}\n\t\t\t\t\t\t\t\t\t{')'}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t\t{accordion.items.length > 7 && (\n\t\t\t\t\t\t<ShowMoreToggle attribute={accordion.key} setShowMore={setShowMore} showMore={showMore} />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</AccordionContent>\n\t\t</AccordionItem>\n\t));\n}\n\nfunction AuthorFacetItem({\n\tid,\n\tdisplayName,\n\tcount,\n\tisRefined,\n\tonRefine,\n}: {\n\tid: string;\n\tdisplayName: string;\n\tcount: number;\n\tisRefined: boolean;\n\tonRefine: (id: string) => void;\n}) {\n\treturn (\n\t\t<div>\n\t\t\t<button\n\t\t\t\tclassName={cn(\n\t\t\t\t\t{\n\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !isRefined,\n\t\t\t\t\t\t'text-primary': isRefined,\n\t\t\t\t\t},\n\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t)}\n\t\t\t\tonClick={() => onRefine(id)}\n\t\t\t>\n\t\t\t\t{displayName}{' '}\n\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t{'('}\n\t\t\t\t\t{count}\n\t\t\t\t\t{')'}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n\nfunction PublisherFacetItem({\n\tid,\n\tdisplayName,\n\tcount,\n\tisRefined,\n\tonRefine,\n}: {\n\tid: string;\n\tdisplayName: string;\n\tcount: number;\n\tisRefined: boolean;\n\tonRefine: (id: string) => void;\n}) {\n\treturn (\n\t\t<div>\n\t\t\t<button\n\t\t\t\tclassName={cn(\n\t\t\t\t\t{\n\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !isRefined,\n\t\t\t\t\t\t'text-primary': isRefined,\n\t\t\t\t\t},\n\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t)}\n\t\t\t\tonClick={() => onRefine(id)}\n\t\t\t>\n\t\t\t\t{displayName}{' '}\n\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t{'('}\n\t\t\t\t\t{count}\n\t\t\t\t\t{')'}\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n\nfunction AuthorsOrPublishers({\n\tattribute,\n\tnameAttribute,\n\tsetShowMore,\n\tshowMore,\n}: {\n\tattribute: 'authorIds' | 'publisherIds';\n\tnameAttribute: 'authorFacets' | 'publisherFacets';\n\tshowMore: string | undefined;\n\tsetShowMore: (showMore: string | undefined) => void;\n}) {\n\tconst resources = useSearchResources();\n\tconst { indexName } = useAlgoliaSearch();\n\n\tconst { isShowingMore, items, canToggleShowMore, toggleShowMore } = useRefinementList({\n\t\tattribute: nameAttribute,\n\t\tlimit: 7,\n\t\tshowMore: true,\n\t});\n\tconst { items: idItems, refine } = useRefinementList({\n\t\tattribute,\n\t});\n\n\tuseEffect(() => {\n\t\tif ((showMore === attribute) !== isShowingMore) {\n\t\t\ttoggleShowMore();\n\t\t}\n\t}, [attribute, isShowingMore, showMore, toggleShowMore]);\n\n\tconst FacetItem = attribute === 'authorIds' ? AuthorFacetItem : PublisherFacetItem;\n\n\tconst facetItems = items.map(item => {\n\t\tconst { id, displayName } = parseFacetValue(item.value);\n\t\treturn {\n\t\t\tid,\n\t\t\tdisplayName,\n\t\t\tcount: item.count,\n\t\t\tisRefined: idItems.some(idItem => idItem.value === id && idItem.isRefined),\n\t\t};\n\t});\n\n\tfacetItems.sort((a, b) => {\n\t\tif (a.isRefined && !b.isRefined) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif (!a.isRefined && b.isRefined) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn b.count - a.count;\n\t});\n\n\treturn (\n\t\t<AccordionItem value={attribute}>\n\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t{resources[attribute] ?? attribute}\n\t\t\t\t</Typography>\n\t\t\t</AccordionTrigger>\n\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t{facetItems.map(i => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<FacetItem\n\t\t\t\t\t\t\t\tkey={i.id}\n\t\t\t\t\t\t\t\t{...i}\n\t\t\t\t\t\t\t\tonRefine={id => {\n\t\t\t\t\t\t\t\t\trefine(id);\n\t\t\t\t\t\t\t\t\tinsightsClient('clickedFilters', {\n\t\t\t\t\t\t\t\t\t\tindex: indexName,\n\t\t\t\t\t\t\t\t\t\teventName: 'Clicked filter',\n\t\t\t\t\t\t\t\t\t\tfilters: [`${attribute}:${id}`],\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t\t{canToggleShowMore && <ShowMoreToggle attribute={attribute} setShowMore={setShowMore} showMore={showMore} />}\n\t\t\t\t</div>\n\t\t\t</AccordionContent>\n\t\t</AccordionItem>\n\t);\n}\n\nfunction Statuses({\n\tsetExpandedFacets,\n}: {\n\tsetExpandedFacets: (setState: (expandedFacets: string[]) => string[]) => void;\n}) {\n\tconst resources = useSearchResources();\n\tconst { indexName } = useAlgoliaSearch();\n\tconst level1 = useRefinementList({ attribute: 'categories.lvl1', limit: 100 }, { skipSuspense: true });\n\tconst level2 = useRefinementList({ attribute: 'categories.lvl2', limit: 1000 }, { skipSuspense: true });\n\tconst level3 = useRefinementList({ attribute: 'categories.lvl3', limit: 1000 }, { skipSuspense: true });\n\tconst level4 = useRefinementList({ attribute: 'categories.lvl4', limit: 1000 }, { skipSuspense: true });\n\n\tconst sections: {\n\t\tvalue: string;\n\t\trefinement: RefinementListRenderState;\n\t\titems: RefinementListItem[];\n\t}[] = [\n\t\t{\n\t\t\tvalue: 'status',\n\t\t\trefinement: level1,\n\t\t\titems: level1.items.filter(i => i.value.startsWith('status')),\n\t\t},\n\t\t...level1.items\n\t\t\t.filter(i => i.isRefined && i.value.startsWith('status'))\n\t\t\t.map(status => ({\n\t\t\t\tvalue: status.value,\n\t\t\t\trefinement: level2,\n\t\t\t\titems: level2.items.filter(i => i.value.startsWith(status.value)),\n\t\t\t})),\n\t\t...level2.items\n\t\t\t.filter(i => i.isRefined && i.value.startsWith('status'))\n\t\t\t.map(status => ({\n\t\t\t\tvalue: status.value,\n\t\t\t\trefinement: level3,\n\t\t\t\titems: level3.items.filter(i => i.value.startsWith(status.value)),\n\t\t\t})),\n\t\t...level3.items\n\t\t\t.filter(i => i.isRefined && i.value.startsWith('status'))\n\t\t\t.map(status => ({\n\t\t\t\tvalue: status.value,\n\t\t\t\trefinement: level4,\n\t\t\t\titems: level4.items.filter(i => i.value.startsWith(status.value)),\n\t\t\t})),\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{sections.map(({ value, refinement, items }) =>\n\t\t\t\titems.length ? (\n\t\t\t\t\t<AccordionItem key={value} value={value}>\n\t\t\t\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t\t\t\t{resources[c_statusLabelKeys[value] ?? value] ?? value}\n\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t</AccordionTrigger>\n\t\t\t\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t\t\t<div key={item.value}>\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'text-black-200 hover:text-secondary-200': !item.isRefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'text-primary': item.isRefined,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t'bodySm w-full text-left capitalize'\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\t\trefinement.refine(item.value);\n\n\t\t\t\t\t\t\t\t\t\t\t\tinsightsClient('clickedFilters', {\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex: indexName,\n\t\t\t\t\t\t\t\t\t\t\t\t\teventName: 'Clicked filter',\n\t\t\t\t\t\t\t\t\t\t\t\t\tfilters: [`categories:${item.value}`],\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\t\t\tif (!item.isRefined) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetExpandedFacets(old => [...old, item.value]);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{resources[c_statusLabelKeys[item.value] ?? item.value] ?? item.value}{' '}\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-black-100\">\n\t\t\t\t\t\t\t\t\t\t\t\t{'('}\n\t\t\t\t\t\t\t\t\t\t\t\t{item.count}\n\t\t\t\t\t\t\t\t\t\t\t\t{')'}\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</AccordionContent>\n\t\t\t\t\t</AccordionItem>\n\t\t\t\t) : null\n\t\t\t)}\n\t\t</>\n\t);\n}\n\nexport function UserSearchFilterAccordionItem({ filter }: { filter: UserSearchFilter }) {\n\tconst { selectedFilterOptions, setSelectedFilterOption } = useUserSearchFilterContext();\n\tconst selectedFilterOption = selectedFilterOptions[filter.token];\n\tconst title = filter.title;\n\tconst options = (Array.isArray(filter.options) ? filter.options : []).filter(\n\t\t(option: { displayName: string }) => option && option.displayName !== ''\n\t);\n\n\tif (!title || options.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<AccordionItem value={`user-filter-${title}`}>\n\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\" tag=\"div\">\n\t\t\t\t\t{title}\n\t\t\t\t</Typography>\n\t\t\t</AccordionTrigger>\n\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t{options.map((option: UserSearchFilterOption) => {\n\t\t\t\t\t\tconst label = option.displayName;\n\t\t\t\t\t\tconst isSelected = selectedFilterOption === option.token;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\t\tvariant=\"bodySmall\"\n\t\t\t\t\t\t\t\tclassName=\"flex cursor-pointer items-center text-black-200\"\n\t\t\t\t\t\t\t\tkey={label}\n\t\t\t\t\t\t\t\ttag=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\tchecked={isSelected}\n\t\t\t\t\t\t\t\t\tclassName=\"mr-3 h-[13px] w-[13px] border-grey-100 text-primary\"\n\t\t\t\t\t\t\t\t\tonChange={() => setSelectedFilterOption(filter.token, option.token)}\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tvalue={option.token}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span className={cn(isSelected ? 'text-primary' : 'text-black-200 hover:text-secondary-200')}>\n\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t</AccordionContent>\n\t\t</AccordionItem>\n\t);\n}\n\nexport function Categories() {\n\tconst [expandedFacets, setExpandedFacets] = useState<string[]>([]);\n\tconst [showMore, setShowMore] = useState<string>();\n\tconst { userSearchFilters } = useUserSearchFilterContext();\n\n\treturn (\n\t\t<Accordion onValueChange={setExpandedFacets} type=\"multiple\" value={expandedFacets}>\n\t\t\t{userSearchFilters?.map((filter, index) => {\n\t\t\t\tconst key = `${filter.title}-${index}`;\n\n\t\t\t\treturn <UserSearchFilterAccordionItem filter={filter} key={key} />;\n\t\t\t})}\n\t\t\t<Category\n\t\t\t\tcategory=\"topic\"\n\t\t\t\tmaxLevel={3}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"resourceType\"\n\t\t\t\tmaxLevel={1}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<AuthorsOrPublishers\n\t\t\t\tattribute=\"authorIds\"\n\t\t\t\tnameAttribute=\"authorFacets\"\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Statuses setExpandedFacets={setExpandedFacets} />\n\t\t\t<Category\n\t\t\t\tcategory=\"specials\"\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"language\"\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"seriesSets\"\n\t\t\t\tmaxLevel={1}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<AuthorsOrPublishers\n\t\t\t\tattribute=\"publisherIds\"\n\t\t\t\tnameAttribute=\"publisherFacets\"\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"bibleAndApocrypha\"\n\t\t\t\tmaxLevel={3}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"containment\"\n\t\t\t\tmaxLevel={1}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category category=\"format\" setExpandedFacets={setExpandedFacets} setShowMore={setShowMore} showMore={showMore} />\n\t\t\t<Category\n\t\t\t\tcategory=\"genre\"\n\t\t\t\tmaxLevel={2}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t\t<Category\n\t\t\t\tcategory=\"religiousGroup\"\n\t\t\t\tmaxLevel={0}\n\t\t\t\tsetExpandedFacets={setExpandedFacets}\n\t\t\t\tsetShowMore={setShowMore}\n\t\t\t\tshowMore={showMore}\n\t\t\t/>\n\t\t</Accordion>\n\t);\n}\n","import React, { useEffect } from 'react';\nimport {\n\tCurrentRefinementsConnectorParamsItem,\n\tCurrentRefinementsConnectorParamsRefinement,\n} from 'instantsearch.js/es/connectors/current-refinements/connectCurrentRefinements';\nimport { X } from 'lucide-react';\nimport { useCurrentRefinements, useRefinementList, useSearchBox } from 'react-instantsearch';\n\nimport { useLocation } from '../../location';\nimport { useAuthor } from '../../hooks/use-author';\nimport { usePublisher } from '../../hooks/use-publisher';\nimport { parseFacetValue } from './util';\n\n// ---------------------------------------------------------------------------\n// CurrentRefinements — chips for active facet refinements\n// ---------------------------------------------------------------------------\n\nfunction RefinementLabel({ attribute, value }: { attribute: string; value: string }) {\n\tconst stringValue = typeof value === 'string' ? value : String(value ?? '');\n\n\tif (attribute === 'authorIds') {\n\t\treturn <AuthorLabel value={stringValue} />;\n\t}\n\n\tif (attribute === 'publisherIds') {\n\t\treturn <PublisherLabel value={stringValue} />;\n\t}\n\n\treturn <span>{stringValue.replace(/^((.*) > )*/, '')}</span>;\n}\n\nfunction AuthorLabel({ value }: { value: string }) {\n\tconst { items } = useRefinementList({ attribute: 'authorFacets' });\n\n\tif (!items.length) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tconst item = items.find(i => i.value.startsWith(`${value}:`));\n\n\tif (item) {\n\t\tconst { displayName } = parseFacetValue(item.label);\n\t\treturn <span>{displayName}</span>;\n\t}\n\n\treturn <AuthorApiLabel value={value} />;\n}\n\nfunction AuthorApiLabel({ value }: { value: string }) {\n\tconst { data, isLoading } = useAuthor(value);\n\n\tif (isLoading) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tif (!data) {\n\t\treturn null;\n\t}\n\n\treturn <span>{data.displayName}</span>;\n}\n\nfunction PublisherLabel({ value }: { value: string }) {\n\tconst { items } = useRefinementList({ attribute: 'publisherFacets' });\n\n\tif (!items.length) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tconst item = items.find(i => i.value.startsWith(`${value}:`));\n\n\tif (item) {\n\t\tconst { displayName } = parseFacetValue(item.label);\n\t\treturn <span>{displayName}</span>;\n\t}\n\n\treturn <PublisherApiLabel value={value} />;\n}\n\nfunction PublisherApiLabel({ value }: { value: string }) {\n\tconst { data, isLoading } = usePublisher(value);\n\n\tif (isLoading) {\n\t\treturn <span>{'…'}</span>;\n\t}\n\n\tif (!data) {\n\t\treturn null;\n\t}\n\n\treturn <span>{data.displayName}</span>;\n}\n\nexport function CurrentRefinements() {\n\tconst currentRefinements = useCurrentRefinements();\n\tconst itemsByAttribute: Record<string, CurrentRefinementsConnectorParamsItem> = {};\n\tconst refinementList: CurrentRefinementsConnectorParamsRefinement[] = [];\n\n\tfor (const item of currentRefinements?.items ?? []) {\n\t\titemsByAttribute[item.attribute] = item;\n\n\t\tfor (const refinement of item.refinements ?? []) {\n\t\t\trefinementList.push(refinement);\n\t\t}\n\t}\n\n\treturn refinementList.map(item => {\n\t\tconst itemValue = item.value;\n\t\tconst itemAndChildren =\n\t\t\ttypeof itemValue === 'string'\n\t\t\t\t? refinementList.filter(r => typeof r.value === 'string' && r.value.startsWith(itemValue))\n\t\t\t\t: [item];\n\n\t\treturn (\n\t\t\t<RefinementChip\n\t\t\t\tattribute={item.attribute}\n\t\t\t\titemAndChildren={itemAndChildren}\n\t\t\t\titemsByAttribute={itemsByAttribute}\n\t\t\t\tkey={`${item.attribute}:${String(itemValue)}`}\n\t\t\t\tlabel={item.label}\n\t\t\t\tvalue={String(itemValue)}\n\t\t\t/>\n\t\t);\n\t});\n}\n\nfunction RefinementChip({\n\tattribute,\n\tvalue,\n\tlabel,\n\titemAndChildren,\n\titemsByAttribute,\n}: {\n\tattribute: string;\n\tvalue: string;\n\tlabel: string;\n\titemAndChildren: CurrentRefinementsConnectorParamsRefinement[];\n\titemsByAttribute: Record<string, CurrentRefinementsConnectorParamsItem>;\n}) {\n\treturn (\n\t\t<button\n\t\t\taria-label={`Remove ${label} from filters`}\n\t\t\tclassName=\"flex items-center gap-x-1 bg-grey-200 py-[6px] pl-3 pr-2 text-xs capitalize text-black-100\"\n\t\t\tonClick={() => itemAndChildren.forEach(i => itemsByAttribute[attribute]?.refine(i))}\n\t\t>\n\t\t\t<RefinementLabel attribute={attribute} value={value} />\n\t\t\t<X aria-hidden=\"true\" height={14} width={14} />\n\t\t</button>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// CurrentQueryRefinement — chip for the active search query\n// ---------------------------------------------------------------------------\n\nexport default function CurrentQueryRefinement() {\n\tconst { searchParams } = useLocation();\n\tconst urlQuery = searchParams.get('query') ?? '';\n\n\tconst { query, refine, clear } = useSearchBox();\n\n\tuseEffect(() => {\n\t\tif (urlQuery) {\n\t\t\trefine(urlQuery);\n\t\t}\n\t}, [urlQuery, refine]);\n\n\tconst removeQuery = () => {\n\t\tclear();\n\t};\n\n\treturn query ? (\n\t\t<button\n\t\t\taria-label=\"remove search term from filters\"\n\t\t\tclassName=\"flex items-center gap-x-1 bg-grey-200 py-[6px] pl-3 pr-2 text-xs capitalize text-black-100\"\n\t\t\tonClick={removeQuery}\n\t\t>\n\t\t\t<span>\n\t\t\t\t{'\"'}\n\t\t\t\t{query}\n\t\t\t\t{'\"'}\n\t\t\t</span>\n\t\t\t<X aria-hidden=\"true\" height={14} width={14} />\n\t\t</button>\n\t) : null;\n}\n","import React, { ReactNode } from 'react';\nimport { cn } from '../../util/cn';\n\nfunction SkeletonRoot({\n\tclassName,\n\tchildren,\n\tpending = false,\n\thideOverflow = false,\n}: {\n\tclassName?: string;\n\tchildren?: React.ReactNode;\n\tpending?: boolean;\n\thideOverflow?: boolean;\n}) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('@container', hideOverflow && 'overflow-hidden', className)}\n\t\t\tdata-pending={pending ? '' : undefined}\n\t\t\trole={pending ? 'status' : undefined}\n\t\t>\n\t\t\t{children}\n\t\t\t{pending && <span className=\"sr-only\">{'Loading...'}</span>}\n\t\t</div>\n\t);\n}\n\nfunction SkeletonBox({ className }: { className?: string }) {\n\treturn <div className={cn('rounded-lg bg-gray-300', className)} />;\n}\n\nfunction SkeletonText({ characterCount = 10, className }: { characterCount?: number | 'full'; className?: string }) {\n\treturn (\n\t\t<div className={cn('flex h-[1lh] items-center', className)}>\n\t\t\t<div\n\t\t\t\tclassName={cn(`h-[1ex] max-w-full rounded-[inherit] bg-gray-300`)}\n\t\t\t\tstyle={{ width: characterCount === 'full' ? '100%' : `${characterCount}ch` }}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction SkeletonIcon({ className, icon }: { className?: string; icon: ReactNode }) {\n\treturn <div className={cn('text-gray-300 opacity-25', className)}>{icon}</div>;\n}\n\nexport { SkeletonIcon as Icon, SkeletonRoot as Root, SkeletonBox as Box, SkeletonText as Text };\n","import React from 'react';\n\nimport { CommandSentence } from '@faithlife/command-sentence-control';\nimport { useLocalization } from '../../../localization';\nimport { useBrandName } from '../../../util/brand-name-context';\n\nexport default function EnhancedForLogosLabel() {\n\tconst resources = useLocalization('CommerceWeb.Resources.Search.DisplayTemplates.ProductSearchResultViewModel');\n\tconst logosOrVerbum = useBrandName();\n\tconst isVerbum = logosOrVerbum?.toLowerCase() === 'verbum';\n\treturn (\n\t\t<CommandSentence className=\"text-xs text-primary\" template={resources.EnhancedForLogos}>\n\t\t\t<CommandSentence.Field name=\"ICON\">\n\t\t\t\t<img\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tisVerbum\n\t\t\t\t\t\t\t? 'inline-block w-[17px] h-[12px] [vertical-align:-1.5px]'\n\t\t\t\t\t\t\t: 'inline-block w-[14px] h-[14px] [vertical-align:-2px] mx-px'\n\t\t\t\t\t}\n\t\t\t\t\talt={logosOrVerbum}\n\t\t\t\t\tsrc={\n\t\t\t\t\t\tisVerbum\n\t\t\t\t\t\t\t? 'https://files.logoscdn.com/v1/files/70496318/assets/14995970/content.svg?signature=SsnOeyt3lPzdfqreDLuA7km2gRs'\n\t\t\t\t\t\t\t: 'https://files.logoscdn.com/v1/files/71036773/assets/14991834/content.svg?signature=NlgSyNjXKmP7caOrWgZiZv5hSEE'\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</CommandSentence.Field>\n\t\t</CommandSentence>\n\t);\n}\n","import React from 'react';\nimport { CommandSentence } from '@faithlife/command-sentence-control';\n\nimport EnhancedForLogosLabel from '../enhanced-for-logos-label';\nimport Tooltip from '../tooltip';\nimport { InfoIconSvgUrl } from '../svgs';\n\nimport { useLocalization } from '../../../localization';\nimport { useBrandName } from '../../../util/brand-name-context';\n\nexport interface EnhancedForLogosWithTooltipProps {\n\tclassName?: string;\n}\n\nconst EnhancedForLogosWithTooltip = ({ className }: EnhancedForLogosWithTooltipProps) => {\n\tconst resources = useLocalization('CommerceWeb.Resources.Search.DisplayTemplates.ProductSearchResultViewModel');\n\n\tconst logosOrVerbum = useBrandName();\n\n\treturn (\n\t\t<Tooltip placement=\"bottom\" className={className} link={<EnhancedForLogosLabel />}>\n\t\t\t<div className={'w-[250px] text-start flex items-start gap-sp8'}>\n\t\t\t\t<div>\n\t\t\t\t\t<img className=\"max-w-none w-[20px] h-[20px]\" src={InfoIconSvgUrl} alt=\"\" />\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<CommandSentence className=\"text-xs\" template={resources.EnhancedForLogosTooltipContent}>\n\t\t\t\t\t\t<CommandSentence.Field name=\"LOGOSORVERBUM\">{logosOrVerbum}</CommandSentence.Field>\n\t\t\t\t\t</CommandSentence>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Tooltip>\n\t);\n};\n\nexport default EnhancedForLogosWithTooltip;\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport insightsClient from 'search-insights';\n\nimport { useCurrentUser, usePricing } from '../../per-user-data/per-user-data-context';\nimport type { ProductPrices } from '../../per-user-data/per-user-data-context';\nimport { detectIsAmberOptimizedUrl } from '../../shared/enhanced-image-tag/image';\nimport { getSavingsPercent, slugify } from '../util';\nimport { ProductHitResult } from '../types';\nimport { useSearchResources } from '../search-resources';\nimport { useAlgoliaSearch } from '../algolia-search-context';\n\nconst usdFormat = new Intl.NumberFormat('en-US', {\n\tstyle: 'currency',\n\tcurrency: 'USD',\n\tminimumFractionDigits: 2,\n\tmaximumFractionDigits: 2,\n});\n\nconst placeholderImage = 'https://files.logoscdn.com/v1/assets/15953102/optimized';\n\ninterface UseProductCardProps {\n\thit: ProductHitResult;\n\tqueryId?: string | null;\n\tposition?: number;\n}\n\nexport function useProductCard({ hit, queryId = null, position }: UseProductCardProps) {\n\tconst { data: pricingData } = usePricing(hit.productId);\n\tconst { preferredCurrency } = useCurrentUser();\n\tconst { indexName } = useAlgoliaSearch();\n\tconst hasGeoRestriction = pricingData?.isGeographicallyRestricted;\n\tconst [isAddingToCart, setIsAddingToCart] = useState(false);\n\tconst resources = useSearchResources();\n\tconst productId = hit?.productId;\n\tconst requestIdRef = useRef<string | null>(null);\n\n\t// Use API pricing when available, fall back to Algolia pricing\n\tconst prices: ProductPrices = pricingData?.primarySku?.prices ?? {\n\t\tsalePrice: {\n\t\t\tamount: hit.salePrice ?? 0,\n\t\t\tdisplayAmount: usdFormat.format(hit.salePrice ?? 0),\n\t\t\tdisplayAmountCurrencyCode: null,\n\t\t\tlocalizedDisplayAmount: null,\n\t\t\tcurrencyCode: 'USD',\n\t\t\tdisplayAmountByCurrency: null,\n\t\t},\n\t\tanchorPrice:\n\t\t\thit.salePrice !== hit.anchorPrice\n\t\t\t\t? {\n\t\t\t\t\t\tamount: hit.anchorPrice ?? 0,\n\t\t\t\t\t\tdisplayAmount: usdFormat.format(hit.anchorPrice ?? 0),\n\t\t\t\t\t\tdisplayAmountCurrencyCode: 'USD',\n\t\t\t\t\t\tlocalizedDisplayAmount: null,\n\t\t\t\t\t\tcurrencyCode: 'USD',\n\t\t\t\t\t\tdisplayAmountByCurrency: null,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\tdiscountSavings: null,\n\t};\n\n\tconst accessKind = pricingData?.accessKind;\n\tconst hasPreorder = pricingData?.hasPreorder;\n\tconst isPrepubProduct = pricingData?.isPrepubProduct;\n\tconst prepubProductStatusSummary = pricingData?.prepubProductStatusSummary;\n\tconst skuId = pricingData?.primarySku?.skuId;\n\tconst isSellable = pricingData?.primarySku?.isSellable ?? undefined;\n\n\tuseEffect(() => {\n\t\tconst handleCartUpdated = (e: CustomEvent) => {\n\t\t\tif (e.detail.requestId === requestIdRef.current) {\n\t\t\t\tsetIsAddingToCart(false);\n\t\t\t}\n\t\t};\n\n\t\tconst handleCartUpdateError = (e: CustomEvent) => {\n\t\t\tif (e.detail.requestId === requestIdRef.current) {\n\t\t\t\tsetIsAddingToCart(false);\n\t\t\t}\n\t\t};\n\n\t\tdocument.addEventListener('faithlife.sites.cart.updated', handleCartUpdated as EventListener);\n\t\tdocument.addEventListener('faithlife.sites.cart.updateError', handleCartUpdateError as EventListener);\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('faithlife.sites.cart.updated', handleCartUpdated as EventListener);\n\t\t\tdocument.removeEventListener('faithlife.sites.cart.updateError', handleCartUpdateError as EventListener);\n\t\t};\n\t}, []);\n\n\tconst slug = slugify(hit.title);\n\tconst productPath = slug ? `/product/${productId}/${slug}` : `/product/${productId}`;\n\tconst productUrl = queryId ? `${productPath}?queryId=${encodeURIComponent(queryId)}` : productPath;\n\tconst productName = hit.title ?? '';\n\tconst regularPrice = prices?.anchorPrice?.displayAmount;\n\tconst salePrice = prices?.salePrice?.displayAmount;\n\tconst salePriceCurrency = preferredCurrency !== 'USD' ? 'USD' : undefined;\n\tconst localizedSalePrice = prices?.salePrice?.localizedDisplayAmount ?? undefined;\n\tconst discountPercentage = getSavingsPercent(prices);\n\tconst isDiscounted = !!pricingData?.primarySku?.prices?.discountSavings;\n\tconst productImageSrc = hit.primaryImageUri;\n\tconst imageSrc = detectIsAmberOptimizedUrl(productImageSrc ?? '') ? productImageSrc : placeholderImage;\n\tconst isLogosEdition = hit.isLogosEdition ?? false;\n\n\tconst handleProductClick = useCallback(() => {\n\t\tif (!productId) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (queryId && position) {\n\t\t\tinsightsClient('clickedObjectIDsAfterSearch', {\n\t\t\t\tindex: indexName,\n\t\t\t\teventName: `Clicked result on ${window.location.pathname}`.substring(0, 64),\n\t\t\t\tqueryID: queryId,\n\t\t\t\tobjectIDs: [productId],\n\t\t\t\tpositions: [position],\n\t\t\t});\n\t\t} else {\n\t\t\tinsightsClient('clickedObjectIDs', {\n\t\t\t\tindex: indexName,\n\t\t\t\teventName: `Clicked result on ${window.location.pathname}`.substring(0, 64),\n\t\t\t\tobjectIDs: [productId],\n\t\t\t});\n\t\t}\n\t}, [productId, queryId, position, indexName]);\n\n\tconst handleAddToCart = (e: React.MouseEvent<HTMLButtonElement>) => {\n\t\tif (!skuId || isAddingToCart) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Track add-to-cart with Algolia insights\n\t\tif (productId) {\n\t\t\tconst eventType = queryId ? 'addedToCartObjectIDsAfterSearch' : 'addedToCartObjectIDs';\n\t\t\tconst eventData: Record<string, any> = {\n\t\t\t\tindex: indexName,\n\t\t\t\teventName: `Added product to cart on ${window.location.pathname}`.substring(0, 64),\n\t\t\t\tobjectIDs: [productId],\n\t\t\t};\n\t\t\tif (queryId) {\n\t\t\t\teventData.queryID = queryId;\n\t\t\t}\n\t\t\tinsightsClient(eventType as any, eventData);\n\t\t}\n\n\t\tconst requestId = (requestIdRef.current = `${Date.now()}-${Math.random()}`);\n\n\t\tconst eventDetail: Record<string, any> = {\n\t\t\taddToCartUrl: pricingData?.primarySku?.routes?.AddToCartUrl,\n\t\t\tskuIds: [skuId],\n\t\t\tquantity: 1,\n\t\t\tpayInFull: true,\n\t\t\trequestId,\n\t\t};\n\n\t\t// Include searchData for Algolia purchase attribution\n\t\tif (queryId && productId) {\n\t\t\teventDetail.searchData = {\n\t\t\t\tqueryId,\n\t\t\t\tproductIds: [productId],\n\t\t\t};\n\t\t}\n\n\t\te.currentTarget.dispatchEvent(\n\t\t\tnew CustomEvent('faithlife.sites.addToCartButton.click', {\n\t\t\t\tbubbles: true,\n\t\t\t\tdetail: eventDetail,\n\t\t\t})\n\t\t);\n\n\t\tsetIsAddingToCart(true);\n\t};\n\n\treturn {\n\t\tresources,\n\t\tproductUrl,\n\t\tproductName,\n\t\timageSrc,\n\t\tisLogosEdition,\n\t\tregularPrice,\n\t\tsalePrice,\n\t\tsalePriceCurrency,\n\t\tlocalizedSalePrice,\n\t\tdiscountPercentage,\n\t\tisDiscounted,\n\t\taccessKind,\n\t\thasGeoRestriction,\n\t\tisSellable,\n\t\thasPreorder,\n\t\tisPrepubProduct,\n\t\tprepubProductStatusSummary,\n\t\tskuId,\n\t\tisAddingToCart,\n\t\thandleProductClick,\n\t\thandleAddToCart,\n\t\thit,\n\t};\n}\n\nexport type ProductCardData = ReturnType<typeof useProductCard>;\n","import React from 'react';\n\nimport { Image } from '../../shared/enhanced-image-tag/image';\n\ninterface ProductImageProps {\n\tproductName: string;\n\timageSrc: string;\n\tproductUrl: string;\n\tpriority?: boolean;\n\thandleProductClick: () => void;\n}\n\nexport function ProductImage({ productName, imageSrc, productUrl, priority, handleProductClick }: ProductImageProps) {\n\treturn (\n\t\t<a\n\t\t\tclassName=\"flex aspect-[100/122] w-auto justify-center lg:aspect-[129/158]\"\n\t\t\thref={productUrl}\n\t\t\tonClick={handleProductClick}\n\t\t\tonAuxClick={handleProductClick}\n\t\t>\n\t\t\t<Image\n\t\t\t\talt={productName}\n\t\t\t\tbelowTheFold={!priority}\n\t\t\t\tclassName=\"w-[100px] h-[122px] object-contain lg:h-[158px] lg:w-[129px]\"\n\t\t\t\tsizes={{ mobile: '100vw', tablet: '50vw', desktop: 129 }}\n\t\t\t\tsrc={imageSrc}\n\t\t\t\ttargetAspectRatio={[129, 158]}\n\t\t\t/>\n\t\t</a>\n\t);\n}\n","import React from 'react';\nimport { LegacyTypography } from '@faithlife/commerce-components';\n\nimport { useSearchResources } from '../search-resources';\n\ninterface DiscountBadgeProps {\n\tdiscountPercentage: number;\n\tclassName?: string;\n}\n\nexport function DiscountBadge({ discountPercentage, className }: DiscountBadgeProps) {\n\tconst resources = useSearchResources();\n\n\tif (discountPercentage <= 1) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<LegacyTypography className={`rounded-full bg-red-300 px-2 py-[2px] text-white ${className ?? ''}`} variant=\"decSm\">\n\t\t\t{resources['discountFormat']?.replace('%DISCOUNT_PERCENTAGE%', discountPercentage.toFixed())}\n\t\t</LegacyTypography>\n\t);\n}\n","import React from 'react';\nimport { Typography } from '@faithlife/commerce-components';\n\nimport { cn } from '../../../util/cn';\n\ninterface ProductTitleProps {\n\tproductName: string;\n\tproductUrl: string;\n\thandleProductClick: () => void;\n\tclassName?: string;\n}\n\nexport function ProductTitle({ productName, productUrl, handleProductClick, className }: ProductTitleProps) {\n\treturn (\n\t\t<a href={productUrl} onAuxClick={handleProductClick} onClick={handleProductClick} title={productName}>\n\t\t\t<Typography\n\t\t\t\tclassName={cn('line-clamp-2 hover:underline focus-visible:underline', className)}\n\t\t\t\ttag=\"h3\"\n\t\t\t\tvariant=\"bodySmall\"\n\t\t\t>\n\t\t\t\t{productName}\n\t\t\t</Typography>\n\t\t</a>\n\t);\n}\n","import React from 'react';\nimport { Typography } from '@faithlife/commerce-components';\n\ninterface ProductAuthorsProps {\n\tauthors?: string[];\n}\n\nexport function ProductAuthors({ authors }: ProductAuthorsProps) {\n\treturn (\n\t\t<Typography className=\"bodyMd line-clamp-1 text-black\" variant=\"finePrint\">\n\t\t\t{authors?.join(', ')}\n\t\t</Typography>\n\t);\n}\n","import React from 'react';\nimport { Button, PriceLabel, Typography } from '@faithlife/commerce-components';\nimport type { buttonScaleOptions } from '@faithlife/commerce-components';\n\nimport { cn } from '../../../util/cn';\nimport * as Skeleton from '../../skeleton';\nimport { useSearchResources } from '../search-resources';\nimport { ProductCardData } from './use-product-card';\n\ntype ButtonScale = (typeof buttonScaleOptions)[number];\n\nconst ctaButtonScale: ButtonScale = 'medium';\nconst skeletonHeightByButtonScale = {\n\tsmall: 'h-8',\n\tmedium: 'h-12',\n\tlarge: 'h-[60px]',\n} satisfies Record<ButtonScale, string>;\n\ninterface ProductPricingProps {\n\tcardData: ProductCardData;\n\tbuttonLayoutClassName: string;\n}\n\nfunction getOwnershipLabel(\n\tresources: ReturnType<typeof useSearchResources>,\n\thasGeoRestriction: boolean | undefined,\n\taccessKind: string | undefined,\n\thasPreorder: boolean | undefined\n): string | null {\n\tif (hasGeoRestriction) {\n\t\treturn resources['geoRestrictionMessage'];\n\t}\n\tif (accessKind === 'Permanent') {\n\t\treturn resources['permanentOwnMessage'];\n\t}\n\tif (accessKind === 'Temporary') {\n\t\treturn resources['temporaryOwnMessage'];\n\t}\n\tif (hasPreorder) {\n\t\treturn resources['hasPreorderMessage'];\n\t}\n\treturn null;\n}\n\nexport function ProductPricing({ cardData, buttonLayoutClassName }: ProductPricingProps) {\n\treturn (\n\t\t<>\n\t\t\t<ProductPrice cardData={cardData} className=\"items-end\" />\n\t\t\t<ProductCta\n\t\t\t\tbuttonLayoutClassName={buttonLayoutClassName}\n\t\t\t\tcardData={cardData}\n\t\t\t\townershipLabelClassName=\"text-right\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n\ninterface ProductPriceProps {\n\tcardData: ProductCardData;\n\tclassName?: string;\n}\n\nexport function ProductPrice({ cardData, className }: ProductPriceProps) {\n\tconst { salePrice, salePriceCurrency, regularPrice, localizedSalePrice, isDiscounted } = cardData;\n\n\treturn (\n\t\t<PriceLabel\n\t\t\tvariant={isDiscounted ? 'sale' : 'value'}\n\t\t\tlayout=\"vertical\"\n\t\t\tsalePrice={salePrice ?? ''}\n\t\t\tsalePriceCurrency={salePriceCurrency ?? undefined}\n\t\t\tanchorPrice={regularPrice}\n\t\t\tlocalizedSalePrice={localizedSalePrice ?? undefined}\n\t\t\tclassName={cn(className)}\n\t\t/>\n\t);\n}\n\ninterface ProductCtaProps {\n\tcardData: ProductCardData;\n\tbuttonLayoutClassName: string;\n\townershipLabelClassName?: string;\n}\n\nexport function ProductCta({ cardData, buttonLayoutClassName, ownershipLabelClassName }: ProductCtaProps) {\n\tconst resources = useSearchResources();\n\tconst {\n\t\tisSellable,\n\t\thasGeoRestriction,\n\t\taccessKind,\n\t\thasPreorder,\n\t\tskuId,\n\t\tisAddingToCart,\n\t\tisPrepubProduct,\n\t\thandleAddToCart,\n\t} = cardData;\n\n\tlet purchaseStatusMessage = getOwnershipLabel(resources, hasGeoRestriction, accessKind, hasPreorder);\n\n\tif (isSellable !== undefined && !isSellable && !purchaseStatusMessage) {\n\t\tpurchaseStatusMessage = resources['UnavailableToPurchase'];\n\t}\n\n\tif (purchaseStatusMessage) {\n\t\treturn (\n\t\t\t<Typography\n\t\t\t\tvariant=\"bodyRegular\"\n\t\t\t\tclassName={cn('text-primary-500', ownershipLabelClassName ?? cn('text-center', !hasPreorder && 'md:pt-sp16'))}\n\t\t\t>\n\t\t\t\t{purchaseStatusMessage}\n\t\t\t</Typography>\n\t\t);\n\t}\n\n\tif (skuId) {\n\t\treturn (\n\t\t\t<div className={cn('inline-flex gap-2 lg:gap-3', buttonLayoutClassName)}>\n\t\t\t\t<Button\n\t\t\t\t\tdisabled={isAddingToCart}\n\t\t\t\t\tonClick={handleAddToCart}\n\t\t\t\t\tscale={ctaButtonScale}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t>\n\t\t\t\t\t{isAddingToCart\n\t\t\t\t\t\t? resources['addingToCart']\n\t\t\t\t\t\t: isPrepubProduct\n\t\t\t\t\t\t\t? resources['preorder']\n\t\t\t\t\t\t\t: resources['addToCart']}\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Skeleton.Root className={cn('animate-pulse inline-flex gap-2 lg:gap-3', buttonLayoutClassName)}>\n\t\t\t<Skeleton.Box className={cn('w-full', skeletonHeightByButtonScale[ctaButtonScale])} />\n\t\t</Skeleton.Root>\n\t);\n}\n","import React from 'react';\nimport { StarRating } from '@faithlife/commerce-components';\n\nimport { ProductHitResult } from '../types';\nimport { useProductInWishList } from '../../add-to-wish-list/hooks';\nimport { AddToWishListWithForm } from '../../add-to-wish-list';\nimport EnhancedForLogosWithTooltip from '../../shared/enhanced-for-logos-with-tooltip';\nimport { hasValidReviewData } from '../../shared/ratings/review-data';\nimport { PrepubProductStatusSummary } from '../../product/product-details-page/right-column/prepub-product-status-summary';\nimport { useProductCard } from './use-product-card';\nimport { ProductImage } from './product-image';\nimport { DiscountBadge } from './discount-badge';\nimport { ProductTitle } from './product-title';\nimport { ProductAuthors } from './product-authors';\nimport { ProductPrice, ProductCta } from './product-pricing';\n\ninterface AlgoliaGridCardProps {\n\thit: ProductHitResult;\n\tpriority?: boolean;\n\tqueryId?: string | null;\n\tposition?: number;\n}\n\nexport function AlgoliaGridCard({ hit, priority, queryId = null, position }: AlgoliaGridCardProps) {\n\tconst cardData = useProductCard({ hit, queryId, position });\n\tconst {\n\t\tproductUrl,\n\t\tproductName,\n\t\timageSrc,\n\t\tdiscountPercentage,\n\t\thandleProductClick,\n\t\tskuId,\n\t\taccessKind,\n\t\tisLogosEdition,\n\t\tprepubProductStatusSummary,\n\t} = cardData;\n\tconst productInWishlist = useProductInWishList(\n\t\thit.productId,\n\t\tskuId,\n\t\t!(accessKind === 'Permanent' || accessKind === 'Temporary')\n\t);\n\tconst averageRating = hit.averageRating ?? 0;\n\tconst reviewCount = hit.reviewCount ?? 0;\n\tconst hasReviewData = hasValidReviewData(averageRating, reviewCount);\n\n\treturn (\n\t\t<div className=\"grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1\">\n\t\t\t{/* Row 1: Image — fixed aspect ratio, never grows */}\n\t\t\t<div className=\"relative flex flex-col items-center justify-start gap-sp12 pt-3 lg:pt-4\">\n\t\t\t\t<div className=\"flex h-43.5 w-full items-end justify-center\">\n\t\t\t\t\t<ProductImage\n\t\t\t\t\t\thandleProductClick={handleProductClick}\n\t\t\t\t\t\timageSrc={imageSrc}\n\t\t\t\t\t\tpriority={priority}\n\t\t\t\t\t\tproductName={productName}\n\t\t\t\t\t\tproductUrl={productUrl}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"h-4 text-center\">{isLogosEdition && <EnhancedForLogosWithTooltip />}</div>\n\n\t\t\t\t<DiscountBadge className=\"absolute top-2 left-2\" discountPercentage={discountPercentage} />\n\t\t\t\t<AddToWishListWithForm {...productInWishlist} variant=\"icon\" />\n\t\t\t</div>\n\n\t\t\t{/* Row 2: Info — grows to absorb variable space */}\n\t\t\t<div className=\"px-2 pt-sp12 pb-1 lg:px-4 lg:pb-2\">\n\t\t\t\t<ProductTitle\n\t\t\t\t\tclassName=\"line-clamp-2\"\n\t\t\t\t\thandleProductClick={handleProductClick}\n\t\t\t\t\tproductName={productName}\n\t\t\t\t\tproductUrl={productUrl}\n\t\t\t\t/>\n\n\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t<ProductAuthors authors={hit.authors} />\n\t\t\t\t</div>\n\n\t\t\t\t{hasReviewData && (\n\t\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t\t<StarRating rating={averageRating} reviewCount={reviewCount} />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{/* Row 3: Prepub summary — empty when not present */}\n\t\t\t<div className=\"px-2 lg:px-4\">\n\t\t\t\t{prepubProductStatusSummary && (\n\t\t\t\t\t<PrepubProductStatusSummary {...prepubProductStatusSummary} variant=\"search-grid\" />\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{/* Row 4: Price — always aligned across cards */}\n\t\t\t<div className=\"flex items-end px-2 md:pb-1 lg:px-4\">\n\t\t\t\t<ProductPrice cardData={cardData} />\n\t\t\t</div>\n\n\t\t\t{/* Row 5: CTA — always aligned across cards */}\n\t\t\t<div className=\"flex items-end justify-center px-2 pb-2 pt-2 lg:px-4 lg:pb-4\">\n\t\t\t\t<ProductCta buttonLayoutClassName=\"w-full flex-col xs:flex-row lg:flex-col xlg:flex-row\" cardData={cardData} />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import React, { useEffect, useRef, useState } from 'react';\nimport { LinkButton } from '@faithlife/commerce-components';\n\nimport { cn } from '../../../util/cn';\nimport { useSearchResources } from '../search-resources';\n\ninterface ProductOverviewProps {\n\toverview?: string;\n}\n\nexport function ProductOverview({ overview }: ProductOverviewProps) {\n\tconst [isExpanded, setIsExpanded] = useState(false);\n\tconst [showButton, setShowButton] = useState(false);\n\tconst overviewRef = useRef<HTMLDivElement>(null);\n\tconst resources = useSearchResources();\n\n\tuseEffect(() => {\n\t\tconst element = overviewRef.current;\n\n\t\tif (element) {\n\t\t\ttry {\n\t\t\t\tconst height = element.scrollHeight;\n\t\t\t\tconst computedLineHeight = getComputedStyle(element).lineHeight;\n\t\t\t\tconst parsedLineHeight = parseInt(computedLineHeight, 10);\n\t\t\t\tconst lineHeight = Number.isFinite(parsedLineHeight) && parsedLineHeight > 0 ? parsedLineHeight : 20;\n\t\t\t\tconst maxHeight = lineHeight * 4;\n\t\t\t\tconst maxHeightMobile = lineHeight * 2;\n\n\t\t\t\tif (height > maxHeight || height > maxHeightMobile) {\n\t\t\t\t\tsetShowButton(true);\n\t\t\t\t} else {\n\t\t\t\t\tsetShowButton(false);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tsetShowButton(false);\n\t\t\t}\n\t\t}\n\t}, [overview]);\n\n\tconst toggleExpand = () => {\n\t\tsetIsExpanded(!isExpanded);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'hidden text-black [&>*:first-child]:mt-0',\n\t\t\t\t\t!isExpanded && 'md:line-clamp-2',\n\t\t\t\t\tisExpanded && 'md:line-clamp-none'\n\t\t\t\t)}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: overview ?? '' }}\n\t\t\t\tref={overviewRef}\n\t\t\t/>\n\t\t\t{showButton && (\n\t\t\t\t<LinkButton\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\tclassName=\"hidden md:inline-flex bodyMd !font-normal\"\n\t\t\t\t\tintent=\"none\"\n\t\t\t\t\tonClick={toggleExpand}\n\t\t\t\t\tscale=\"sm\"\n\t\t\t\t>\n\t\t\t\t\t{isExpanded ? resources['readLess'] : resources['readMore']}\n\t\t\t\t</LinkButton>\n\t\t\t)}\n\t\t</>\n\t);\n}\n","import React from 'react';\nimport { StarRating } from '@faithlife/commerce-components';\n\nimport { ProductHitResult } from '../types';\nimport { AddToWishListWithForm } from '../../add-to-wish-list';\nimport { useProductInWishList } from '../../add-to-wish-list/hooks';\nimport EnhancedForLogosWithTooltip from '../../shared/enhanced-for-logos-with-tooltip';\nimport { hasValidReviewData } from '../../shared/ratings/review-data';\nimport { PrepubProductStatusSummary } from '../../product/product-details-page/right-column/prepub-product-status-summary';\nimport { useProductCard } from './use-product-card';\nimport { DiscountBadge } from './discount-badge';\nimport { ProductTitle } from './product-title';\nimport { ProductAuthors } from './product-authors';\nimport { ProductOverview } from './product-overview';\nimport { ProductPricing } from './product-pricing';\nimport { ProductImage } from './product-image';\n\ninterface AlgoliaListCardProps {\n\thit: ProductHitResult;\n\tpriority?: boolean;\n\tqueryId?: string | null;\n\tposition?: number;\n}\n\nexport function AlgoliaListCard({ hit, priority, queryId = null, position }: AlgoliaListCardProps) {\n\tconst cardData = useProductCard({ hit, queryId, position });\n\tconst {\n\t\tproductUrl,\n\t\tproductName,\n\t\timageSrc,\n\t\tdiscountPercentage,\n\t\thandleProductClick,\n\t\tskuId,\n\t\taccessKind,\n\t\tisLogosEdition,\n\t\tprepubProductStatusSummary,\n\t} = cardData;\n\tconst productInWishlist = useProductInWishList(\n\t\thit.productId,\n\t\tskuId,\n\t\t!(accessKind === 'Permanent' || accessKind === 'Temporary')\n\t);\n\tconst averageRating = hit.averageRating ?? 0;\n\tconst reviewCount = hit.reviewCount ?? 0;\n\tconst hasReviewData = hasValidReviewData(averageRating, reviewCount);\n\n\treturn (\n\t\t<div className=\"grid grid-cols-[139px_auto] md:grid-cols-[190px_auto]\">\n\t\t\t<div className=\"relative col-span-1 flex w-full items-start justify-center\">\n\t\t\t\t<div className=\"flex w-auto flex-col gap-sp8 pt-2 pb-[43px] lg:pt-3 md:pb-9\">\n\t\t\t\t\t<div className=\"relative\">\n\t\t\t\t\t\t<ProductImage\n\t\t\t\t\t\t\thandleProductClick={handleProductClick}\n\t\t\t\t\t\t\timageSrc={imageSrc}\n\t\t\t\t\t\t\tpriority={priority}\n\t\t\t\t\t\t\tproductName={productName}\n\t\t\t\t\t\t\tproductUrl={productUrl}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<DiscountBadge\n\t\t\t\t\t\t\tclassName=\"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none\"\n\t\t\t\t\t\t\tdiscountPercentage={discountPercentage}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{isLogosEdition && (\n\t\t\t\t\t\t<div className=\"text-center\">\n\t\t\t\t\t\t\t<EnhancedForLogosWithTooltip />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div className=\"grid p-2 pb-8 md:grid-cols-[auto_168px] md:gap-8 md:pb-2 lg:p-3\">\n\t\t\t\t<div className=\"flex-1\">\n\t\t\t\t\t<ProductTitle handleProductClick={handleProductClick} productName={productName} productUrl={productUrl} />\n\n\t\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t\t<ProductAuthors authors={hit.authors} />\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{hasReviewData && (\n\t\t\t\t\t\t<div className=\"mt-sp8\">\n\t\t\t\t\t\t\t<StarRating rating={averageRating} reviewCount={reviewCount} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<div className=\"mt-sp12\">\n\t\t\t\t\t\t<ProductOverview overview={hit.overview} />\n\t\t\t\t\t</div>\n\t\t\t\t\t{prepubProductStatusSummary && (\n\t\t\t\t\t\t<PrepubProductStatusSummary {...prepubProductStatusSummary} variant=\"search-list\" />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex grow-0 flex-col gap-2 lg:gap-3 items-end\">\n\t\t\t\t\t<ProductPricing\n\t\t\t\t\t\tbuttonLayoutClassName=\"w-full flex-col xmd:flex-row md:flex-col max-w-[145px]\"\n\t\t\t\t\t\tcardData={cardData}\n\t\t\t\t\t/>\n\t\t\t\t\t<AddToWishListWithForm {...productInWishlist} variant=\"link\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import React, { useCallback } from 'react';\nimport { Hit } from 'instantsearch.js';\nimport { Hits, useInstantSearch } from 'react-instantsearch';\n\nimport { cn } from '../../util/cn';\nimport * as Skeleton from '../skeleton';\nimport { WishListProductBatchProvider } from '../add-to-wish-list/hooks';\nimport { ProductHitResult } from './types';\nimport { AlgoliaGridCard } from './product-card/algolia-grid-card';\nimport { AlgoliaListCard } from './product-card/algolia-list-card';\n\n// ---------------------------------------------------------------------------\n// ProductHits — grid/list of search result cards\n// ---------------------------------------------------------------------------\n\ninterface ProductHitsProps {\n\tlayoutType: 'grid' | 'list';\n\twishListsProductsUrl: string;\n\tcurrentHitsPerPage: number;\n}\n\nfunction SkeletonBlock({ className, rootClassName }: { className: string; rootClassName?: string }) {\n\treturn <Skeleton.Box className={cn(className, rootClassName)} />;\n}\n\nfunction SkeletonButton({ className }: { className: string }) {\n\treturn <Skeleton.Box className={cn('h-12 inline-flex gap-2 lg:gap-3', className)} />;\n}\n\nfunction ProductSkeleton({ layoutType }: { layoutType: 'grid' | 'list' }) {\n\tif (layoutType === 'list') {\n\t\treturn (\n\t\t\t<Skeleton.Root className=\"animate-pulse\">\n\t\t\t\t<div className=\"grid grid-cols-[139px_auto] md:grid-cols-[190px_auto]\">\n\t\t\t\t\t<div className=\"relative col-span-1 flex w-full items-start justify-center\">\n\t\t\t\t\t\t<div className=\"flex w-auto flex-col gap-sp8 pt-2 pb-[43px] lg:pt-3 md:pb-9\">\n\t\t\t\t\t\t\t<div className=\"relative\">\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-[122px] w-[122px] lg:h-[158px] lg:w-[158px]\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"text-center\">\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-20\" rootClassName=\"mx-auto h-4 w-20\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"grid gap-sp8 p-2 pb-8 md:grid-cols-[auto_168px] md:gap-8 md:pb-2 lg:p-3\">\n\t\t\t\t\t\t<div className=\"flex-1\">\n\t\t\t\t\t\t\t<SkeletonBlock className=\"h-12 w-full\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-4 w-3/5\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-5 w-2/5\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"mt-sp12 h-16 w-full\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"flex flex-col items-end gap-2 lg:gap-3\">\n\t\t\t\t\t\t\t<div className=\"flex flex-col items-end gap-sp4\">\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-20\" />\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-7 w-24\" />\n\t\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-16\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<SkeletonButton className=\"w-full max-w-[145px]\" />\n\t\t\t\t\t\t\t<SkeletonBlock className=\"h-4 w-24\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</Skeleton.Root>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Skeleton.Root className=\"animate-pulse grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1\">\n\t\t\t<div className=\"relative flex flex-col items-center justify-start gap-sp12 pt-3 lg:pt-4\">\n\t\t\t\t<div className=\"flex h-43.5 w-full items-end justify-center\">\n\t\t\t\t\t<SkeletonBlock\n\t\t\t\t\t\tclassName=\"h-[122px] w-[100px] lg:h-[158px] lg:w-[129px]\"\n\t\t\t\t\t\trootClassName=\"h-[122px] w-[100px] lg:h-[158px] lg:w-[129px]\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<SkeletonBlock className=\"h-4 w-20\" rootClassName=\"mx-auto h-4 w-20\" />\n\t\t\t</div>\n\t\t\t<div className=\"px-2 pt-sp12 pb-1 lg:px-4 lg:pb-2\">\n\t\t\t\t<SkeletonBlock className=\"h-12 w-full\" />\n\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-4 w-3/5\" />\n\t\t\t\t<SkeletonBlock className=\"mt-sp8 h-5 w-2/5\" />\n\t\t\t</div>\n\t\t\t<div className=\"px-2 lg:px-4\" />\n\t\t\t<div className=\"flex items-end px-2 md:pb-1 lg:px-4\">\n\t\t\t\t<div className=\"flex w-full flex-col gap-sp4\">\n\t\t\t\t\t<SkeletonBlock className=\"h-4 w-3/5\" rootClassName=\"h-4 w-3/5\" />\n\t\t\t\t\t<SkeletonBlock className=\"h-7 w-4/5\" rootClassName=\"h-7 w-4/5\" />\n\t\t\t\t\t<SkeletonBlock className=\"h-4 w-2/5\" rootClassName=\"h-4 w-2/5\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"flex items-end justify-center px-2 pb-2 pt-2 lg:px-4 lg:pb-4\">\n\t\t\t\t<SkeletonButton className=\"w-full\" />\n\t\t\t</div>\n\t\t</Skeleton.Root>\n\t);\n}\n\nfunction ProductSkeletons({\n\tlayoutType,\n\tcurrentHitsPerPage,\n}: {\n\tlayoutType: 'grid' | 'list';\n\tcurrentHitsPerPage: number;\n}) {\n\treturn (\n\t\t<ol\n\t\t\taria-label=\"Loading search results\"\n\t\t\tclassName={cn(\n\t\t\t\t'grid grid-cols-1',\n\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t'auto-rows-[max-content_auto_max-content_max-content_max-content] grid-cols-2 gap-sp8 lg:grid-cols-3 lg:gap-sp16',\n\t\t\t\tlayoutType === 'list' && 'gap-6 md:gap-8'\n\t\t\t)}\n\t\t>\n\t\t\t{Array.from({ length: currentHitsPerPage }, (_, index) => (\n\t\t\t\t<li\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t\t\t'grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1 outline outline-1 outline-grey',\n\t\t\t\t\t\tlayoutType === 'list' && 'first:border-t border-b border-grey-200 first:pt-6 first:md:pt-8'\n\t\t\t\t\t)}\n\t\t\t\t\tkey={index}\n\t\t\t\t>\n\t\t\t\t\t<ProductSkeleton layoutType={layoutType} />\n\t\t\t\t</li>\n\t\t\t))}\n\t\t</ol>\n\t);\n}\n\nfunction toProductHitResult(hit: Hit<ProductHitResult>): ProductHitResult {\n\treturn {\n\t\t...hit,\n\t\tproductId: hit.productId !== null && hit.productId !== undefined ? hit.productId.toString() : undefined,\n\t};\n}\n\nexport function ProductHits({ layoutType, wishListsProductsUrl, currentHitsPerPage }: ProductHitsProps) {\n\tconst Card = layoutType === 'list' ? AlgoliaListCard : AlgoliaGridCard;\n\tconst { status } = useInstantSearch();\n\tconst HitComponent = useCallback(\n\t\t({ hit }: { hit: Hit<ProductHitResult> }) => (\n\t\t\t<Card\n\t\t\t\thit={toProductHitResult(hit)}\n\t\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\t\tpriority={typeof hit.__position === 'number' && hit.__position <= 6}\n\t\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\t\tqueryId={(hit as any).__queryID ?? null}\n\t\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\t\tposition={hit.__position}\n\t\t\t/>\n\t\t),\n\t\t[Card]\n\t);\n\n\treturn (\n\t\t<WishListProductBatchProvider wishListsProductsUrl={wishListsProductsUrl}>\n\t\t\t<section aria-label=\"Search results\">\n\t\t\t\t{status === 'stalled' && (\n\t\t\t\t\t<div className=\"pt-4 pb-6 lg:px-4 lg:py-8\">\n\t\t\t\t\t\t<ProductSkeletons layoutType={layoutType} currentHitsPerPage={currentHitsPerPage} />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<Hits\n\t\t\t\t\tclassNames={{\n\t\t\t\t\t\troot: cn('pt-4 pb-6 lg:px-4 lg:py-8', status === 'stalled' && 'hidden'),\n\t\t\t\t\t\tlist: cn(\n\t\t\t\t\t\t\t'grid grid-cols-1',\n\t\t\t\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t\t\t\t'auto-rows-[max-content_auto_max-content_max-content_max-content] grid-cols-2 gap-sp8 lg:grid-cols-3 lg:gap-sp16',\n\t\t\t\t\t\t\tlayoutType === 'list' && 'gap-6 md:gap-8'\n\t\t\t\t\t\t),\n\t\t\t\t\t\titem: cn(\n\t\t\t\t\t\t\t/* the grid definition must match AlgoliaGridCard to pass subgrid tracks to it correctly */\n\t\t\t\t\t\t\tlayoutType === 'grid' &&\n\t\t\t\t\t\t\t\t'grid gap-y-0 grid-rows-subgrid row-span-5 grid-cols-1 outline outline-1 outline-grey',\n\t\t\t\t\t\t\t/* first:pt matches the gap-6/md:gap-8 list gutter so item 1's top spacing matches the gap preceding every other item */\n\t\t\t\t\t\t\tlayoutType === 'list' && 'first:border-t border-b border-grey-200 first:pt-6 first:md:pt-8'\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\thitComponent={HitComponent}\n\t\t\t\t/>\n\t\t\t</section>\n\t\t</WishListProductBatchProvider>\n\t);\n}\n\nexport default ProductHits;\n","import React from 'react';\nimport { Typography } from '@faithlife/commerce-components';\nimport { useSortBy } from 'react-instantsearch';\n\nimport { cn } from '../../util/cn';\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '../accordion';\nimport { useSearchResources } from './search-resources';\n\ninterface SortByItem {\n\tlabel: string;\n\tvalue: string;\n}\n\ninterface SortByAccordionProps {\n\titems: SortByItem[];\n}\n\nexport default function SortByAccordion({ items }: SortByAccordionProps) {\n\tconst resources = useSearchResources();\n\tconst { currentRefinement, refine } = useSortBy({ items });\n\tconst currentItem = items.find(item => item.value === currentRefinement);\n\n\treturn (\n\t\t<Accordion collapsible type=\"single\">\n\t\t\t<AccordionItem value=\"sort-by\">\n\t\t\t\t<AccordionTrigger className=\"border-t border-primary-100 p-4 lg:border-t-0 [&>svg]:text-primary\">\n\t\t\t\t\t<Typography className=\"text-primary-400\" variant=\"bodyRegular\">\n\t\t\t\t\t\t{resources['sortBy']} {}\n\t\t\t\t\t\t{currentItem && <span className=\"font-semibold\">{currentItem.label}</span>}\n\t\t\t\t\t</Typography>\n\t\t\t\t</AccordionTrigger>\n\t\t\t\t<AccordionContent className=\"m-0 bg-grey-200 p-4\">\n\t\t\t\t\t<div className=\"flex flex-col gap-y-4\">\n\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t<label className=\"bodySm flex cursor-pointer items-center text-black-200\" key={item.value}>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\tchecked={currentRefinement === item.value}\n\t\t\t\t\t\t\t\t\tclassName=\"mr-3 h-3.25 w-3.25 border-grey-100 text-primary\"\n\t\t\t\t\t\t\t\t\tonChange={() => refine(item.value)}\n\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\tvalue={item.value}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\tcurrentRefinement === item.value ? 'text-primary' : 'text-black-200 hover:text-secondary-200'\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</AccordionContent>\n\t\t\t</AccordionItem>\n\t\t</Accordion>\n\t);\n}\n","import React, { createContext, useContext, useEffect, useState } from 'react';\nimport Cookies from 'js-cookie';\nimport { safeUrl } from './util';\n\nexport enum ViewMode {\n\tgrid = 'grid',\n\tlist = 'list',\n}\n\ninterface ViewModeContextType {\n\tviewMode: ViewMode;\n\tsetViewMode: (mode: ViewMode) => void;\n}\n\nconst ViewModeContext = createContext<ViewModeContextType | null>(null);\n\nexport const viewModeKey = 'viewMode';\nconst viewModeValues = Object.values(ViewMode);\n\nconst getInitialViewMode = (): ViewMode => {\n\tconst url = typeof window !== 'undefined' ? safeUrl(window.location.href) : null;\n\n\tconst urlViewMode = url?.searchParams.get(viewModeKey);\n\tif (viewModeValues.includes(urlViewMode as ViewMode)) {\n\t\treturn urlViewMode as ViewMode;\n\t}\n\n\tconst cookieViewMode = Cookies.get(viewModeKey);\n\tif (viewModeValues.includes(cookieViewMode as ViewMode)) {\n\t\treturn cookieViewMode as ViewMode;\n\t}\n\n\treturn ViewMode.grid;\n};\n\nexport const ViewModeProvider = ({ children }: { children: React.ReactNode }) => {\n\tconst [viewMode, setViewMode] = useState<ViewMode>(() => getInitialViewMode());\n\n\tuseEffect(() => {\n\t\tconst url = typeof window !== 'undefined' ? safeUrl(window.location.href) : null;\n\t\tif (url) {\n\t\t\turl?.searchParams.set(viewModeKey, viewMode);\n\t\t\twindow.history.replaceState({}, '', url);\n\t\t}\n\t\tCookies.set(viewModeKey, viewMode);\n\t}, [viewMode]);\n\n\treturn <ViewModeContext.Provider value={{ viewMode, setViewMode }}>{children}</ViewModeContext.Provider>;\n};\n\nexport const useViewMode = () => {\n\tconst context = useContext(ViewModeContext);\n\n\tif (!context) {\n\t\tthrow new Error('useViewMode must be used within ViewModeProvider');\n\t}\n\n\treturn context;\n};\n","import { StateMapping, UiState } from 'instantsearch.js';\nimport history from 'instantsearch.js/es/lib/routers/history';\n\nimport { SearchCategory } from './types';\nimport { UserSearchFilter } from './user-search-filter-context';\nimport { safeUrl } from './util';\nimport { viewModeKey } from './use-view-mode';\n\n// ---------------------------------------------------------------------------\n// Facet configuration\n// ---------------------------------------------------------------------------\n\nexport interface SimpleFacetConfiguration {\n\ttype: 'simple';\n\talgoliaAttribute: string;\n\trouteKey: string;\n}\n\nexport interface HierarchicalFacetConfiguration {\n\ttype: 'hierarchical';\n\talgoliaAttributeBase: string;\n\trouteKeyPrefix: string;\n\tminLevel: number;\n\tmaxLevel: number;\n\tcategoryToken?: string;\n}\n\nexport type FacetConfiguration = SimpleFacetConfiguration | HierarchicalFacetConfiguration;\n\n// ---------------------------------------------------------------------------\n// Route state types and helpers\n// ---------------------------------------------------------------------------\n\ntype RouteStateFacets = Record<string, string[]>;\ntype RouteStateFilters = Record<string, string>;\n\nfunction getAllFacetingKeys(facetConfigurations: FacetConfiguration[]): string[] {\n\treturn [\n\t\t...facetConfigurations\n\t\t\t.filter((config): config is SimpleFacetConfiguration => config.type === 'simple')\n\t\t\t.map(config => config.routeKey),\n\t\t...facetConfigurations\n\t\t\t.filter((config): config is HierarchicalFacetConfiguration => config.type === 'hierarchical')\n\t\t\t.flatMap(config => {\n\t\t\t\tconst keys: string[] = [];\n\n\t\t\t\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\t\t\t\tkeys.push(`${config.routeKeyPrefix}${level}`);\n\t\t\t\t}\n\n\t\t\t\treturn keys;\n\t\t\t}),\n\t];\n}\n\nfunction getConfiguredAlgoliaAttributes(facetConfigurations: FacetConfiguration[]): Set<string> {\n\tconst attributes = new Set<string>();\n\n\tfor (const config of facetConfigurations) {\n\t\tif (config.type === 'simple') {\n\t\t\tattributes.add(config.algoliaAttribute);\n\t\t} else if (config.type === 'hierarchical') {\n\t\t\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\t\t\tattributes.add(`${config.algoliaAttributeBase}.lvl${level}`);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn attributes;\n}\n\nfunction getUnconfiguredFacetValues(\n\tfacets: RouteStateFacets | Record<string, string[]> | undefined,\n\tconfiguredKeys: Set<string>\n): RouteStateFacets {\n\treturn Object.fromEntries(\n\t\tObject.entries(facets ?? {}).filter(([key, values]) => !configuredKeys.has(key) && values.length > 0)\n\t);\n}\n\nfunction getQueryParamNameByTopLevelTokenMap(facetConfigurations: FacetConfiguration[]): Record<string, string> {\n\tconst map: Record<string, string> = {};\n\n\tfor (const config of facetConfigurations) {\n\t\tif (config.type === 'hierarchical' && config.categoryToken) {\n\t\t\tmap[config.categoryToken] = `${config.routeKeyPrefix}${config.minLevel}`;\n\t\t}\n\t}\n\n\treturn map;\n}\n\nexport interface RouteState {\n\tquery?: string;\n\n\tfacets?: RouteStateFacets;\n\tfilters?: RouteStateFilters;\n\n\tsortBy?: string;\n\tlimit?: number;\n\tpage?: number;\n}\n\nconst delimiter = '+';\nconst nonFacetQueryParamNames = new Set([viewModeKey, 'ownership', 'geographicAvailability']);\n\nfunction arrayToQueryParam(array: string[] | undefined): string | undefined {\n\treturn array?.length ? array.join(delimiter) : undefined;\n}\n\nfunction emptyIfUndefined<T>(array: T[] | undefined): T[] {\n\treturn array && array.length > 0 ? array : [];\n}\n\nfunction getTrimmedOrUndefinedIfStringEmpty(value: string): string | undefined {\n\tconst trimmed = value.trim();\n\n\treturn trimmed.length > 0 ? trimmed : undefined;\n}\n\ninterface CategoryPageFacetConfiguration {\n\tqueryParamName: string;\n\tvalue: string;\n}\n\ninterface CategoryPageConfiguration {\n\tfacets: CategoryPageFacetConfiguration[];\n\tcategoryPageUrl: string;\n\tpageTitle: string;\n}\n\nfunction getMatchingCategoryPageFromRouteState(\n\trouteState: RouteState,\n\tcategoryPageConfigurations: CategoryPageConfiguration[],\n\tallFacetingKeys: string[]\n): CategoryPageConfiguration | null {\n\tconst facetKeys = new Set([...allFacetingKeys, ...Object.keys(routeState.facets ?? {})]);\n\tconst facets = [...facetKeys].map(key => ({\n\t\tkey,\n\t\tvalue: routeState.facets?.[key],\n\t}));\n\n\tfor (const categoryPageConfiguration of categoryPageConfigurations) {\n\t\tconst matches = checkCategoryPageConfigurationMatches(categoryPageConfiguration, facets);\n\n\t\tif (matches) {\n\t\t\treturn categoryPageConfiguration;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction preserveCustomQueryParams(sourceUrl: URL, targetUrl: URL, preserveKeys: Set<string>) {\n\tfor (const [key, value] of sourceUrl.searchParams.entries()) {\n\t\tif (preserveKeys.has(key)) {\n\t\t\ttargetUrl.searchParams.set(key, value);\n\t\t}\n\t}\n}\n\nfunction writeFacetsSearchParams(url: URL, facets?: RouteStateFacets, excludedKeys?: Set<string>) {\n\tif (!facets) {\n\t\treturn;\n\t}\n\n\tfor (const [key, value] of Object.entries(facets)) {\n\t\tif (excludedKeys?.has(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst candidateQueryParamValue = arrayToQueryParam(value);\n\n\t\tif (candidateQueryParamValue !== undefined) {\n\t\t\turl.searchParams.set(key, candidateQueryParamValue);\n\t\t}\n\t}\n}\n\nfunction writeUserFilterSearchParams(targetUrl: URL, userSearchFilters: UserSearchFilter[], sourceUrl: URL) {\n\tfor (const filter of userSearchFilters) {\n\t\tconst value = sourceUrl.searchParams.get(filter.token);\n\n\t\tif (value) {\n\t\t\ttargetUrl.searchParams.set(filter.token, value);\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// State mapping — Algolia UI state ↔ route state\n// ---------------------------------------------------------------------------\n\nexport function makeStateMapping(\n\tindex: string,\n\tfacetConfigurations: FacetConfiguration[]\n): StateMapping<UiState, RouteState> {\n\tconst sortByPrefix = `${index}_virtual_`;\n\tconst configuredAlgoliaAttributes = getConfiguredAlgoliaAttributes(facetConfigurations);\n\tconst configuredRouteKeys = new Set(getAllFacetingKeys(facetConfigurations));\n\n\treturn {\n\t\tstateToRoute: (uiState: UiState) => {\n\t\t\tconst indexUiState = uiState[index];\n\n\t\t\tif (!indexUiState) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst facets: RouteStateFacets = {};\n\n\t\t\tfor (const config of facetConfigurations) {\n\t\t\t\tif (config.type === 'simple') {\n\t\t\t\t\tconst facetValues = indexUiState.refinementList?.[config.algoliaAttribute];\n\n\t\t\t\t\tif (facetValues) {\n\t\t\t\t\t\tfacets[config.routeKey] = facetValues;\n\t\t\t\t\t}\n\t\t\t\t} else if (config.type === 'hierarchical') {\n\t\t\t\t\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\t\t\t\t\tconst routeKey = `${config.routeKeyPrefix}${level}`;\n\t\t\t\t\t\tconst algoliaAttribute = `${config.algoliaAttributeBase}.lvl${level}`;\n\n\t\t\t\t\t\tconst facetValues = indexUiState.refinementList?.[algoliaAttribute];\n\n\t\t\t\t\t\tif (facetValues) {\n\t\t\t\t\t\t\tfacets[routeKey] = facetValues;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [algoliaAttribute, facetValues] of Object.entries(indexUiState.refinementList ?? {})) {\n\t\t\t\tif (!configuredAlgoliaAttributes.has(algoliaAttribute) && facetValues.length > 0) {\n\t\t\t\t\tfacets[algoliaAttribute] = facetValues;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [algoliaAttribute, facetValues] of Object.entries(\n\t\t\t\tgetUnconfiguredFacetValues(indexUiState.configure?.disjunctiveFacetsRefinements, configuredAlgoliaAttributes)\n\t\t\t)) {\n\t\t\t\tfacets[algoliaAttribute] ??= facetValues;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tquery: indexUiState.query,\n\t\t\t\tfacets,\n\t\t\t\tsortBy: indexUiState.sortBy?.replace(sortByPrefix, ''),\n\t\t\t\tlimit: indexUiState.hitsPerPage,\n\t\t\t\tpage: indexUiState.page,\n\t\t\t} satisfies RouteState;\n\t\t},\n\t\trouteToState: (routeState: RouteState) => {\n\t\t\tconst refinementList: Record<string, string[]> = {};\n\n\t\t\tfor (const config of facetConfigurations) {\n\t\t\t\tif (config.type === 'simple') {\n\t\t\t\t\trefinementList[config.algoliaAttribute] = emptyIfUndefined(routeState.facets?.[config.routeKey]);\n\t\t\t\t} else if (config.type === 'hierarchical') {\n\t\t\t\t\tfor (let level = config.minLevel; level <= config.maxLevel; level += 1) {\n\t\t\t\t\t\tconst routeKey = `${config.routeKeyPrefix}${level}`;\n\n\t\t\t\t\t\tconst algoliaAttribute = `${config.algoliaAttributeBase}.lvl${level}`;\n\n\t\t\t\t\t\trefinementList[algoliaAttribute] = emptyIfUndefined(routeState.facets?.[routeKey]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst passthroughFacets = getUnconfiguredFacetValues(routeState.facets, configuredRouteKeys);\n\t\t\tfor (const [routeKey, facetValues] of Object.entries(passthroughFacets)) {\n\t\t\t\trefinementList[routeKey] = facetValues;\n\t\t\t}\n\n\t\t\tconst indexUiState: UiState[string] = {\n\t\t\t\tquery: routeState.query,\n\t\t\t\tsortBy: routeState.sortBy && `${sortByPrefix}${routeState.sortBy}`,\n\t\t\t\thitsPerPage: routeState.limit,\n\t\t\t\trefinementList,\n\t\t\t\tpage: routeState.page,\n\t\t\t};\n\n\t\t\tconst passthroughFacetAttributes = Object.keys(passthroughFacets);\n\t\t\tif (passthroughFacetAttributes.length > 0) {\n\t\t\t\tindexUiState.configure = {\n\t\t\t\t\tdisjunctiveFacets: passthroughFacetAttributes,\n\t\t\t\t\tdisjunctiveFacetsRefinements: passthroughFacets,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn { [index]: indexUiState };\n\t\t},\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Category page configuration\n// ---------------------------------------------------------------------------\n\nfunction checkFacetValueConfigurationMatches(\n\tfacetValueConfiguration: string,\n\trouteStateFacetValue: string[] | undefined\n): boolean {\n\tif (routeStateFacetValue === undefined) {\n\t\treturn false;\n\t}\n\n\tif (routeStateFacetValue.length !== 1) {\n\t\treturn false;\n\t}\n\n\treturn facetValueConfiguration === routeStateFacetValue[0];\n}\n\nfunction checkCategoryPageConfigurationMatches(\n\tcategoryPageConfiguration: CategoryPageConfiguration,\n\trouteStateFacets: {\n\t\tkey: string;\n\t\tvalue: string[] | undefined;\n\t}[]\n): boolean {\n\tconst { facets: facetsConfiguration } = categoryPageConfiguration;\n\n\tlet matches = true;\n\n\tfor (const routeStateFacet of routeStateFacets) {\n\t\tconst facetConfiguration = facetsConfiguration.find(f => f.queryParamName === routeStateFacet.key);\n\n\t\tif (facetConfiguration) {\n\t\t\tif (!checkFacetValueConfigurationMatches(facetConfiguration.value, routeStateFacet.value)) {\n\t\t\t\tmatches = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else if (routeStateFacet.value !== undefined && routeStateFacet.value.length > 0) {\n\t\t\tmatches = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn matches;\n}\n\nfunction writeCommonSearchParams(url: URL, routeState: RouteState) {\n\tif (routeState.query) {\n\t\turl.searchParams.set('query', routeState.query);\n\t}\n\n\tif (routeState.sortBy) {\n\t\turl.searchParams.set('sortBy', routeState.sortBy);\n\t}\n\n\tif (routeState.limit !== undefined) {\n\t\turl.searchParams.set('limit', String(routeState.limit));\n\t}\n\n\tif (routeState.page !== undefined) {\n\t\turl.searchParams.set('page', String(routeState.page));\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Router — URL creation and parsing\n// ---------------------------------------------------------------------------\n\nexport function makeRouter(\n\tcategoryPageConfigurations: CategoryPageConfiguration[],\n\tfacetConfigurations: FacetConfiguration[],\n\tuserSearchFilters: UserSearchFilter[] = []\n) {\n\tconst allFacetingKeys = getAllFacetingKeys(facetConfigurations);\n\tconst allFacetingKeysSet = new Set<string>(allFacetingKeys);\n\tconst userFilterKeysSet = new Set<string>(userSearchFilters.map(f => f.token));\n\tconst categoryPagesByCategoryPageUrl: Map<string, CategoryPageConfiguration> = new Map<\n\t\tstring,\n\t\tCategoryPageConfiguration\n\t>();\n\n\tfor (const configuration of categoryPageConfigurations) {\n\t\tcategoryPagesByCategoryPageUrl.set(configuration.categoryPageUrl, configuration);\n\t}\n\n\treturn history({\n\t\tcleanUrlOnDispose: false,\n\n\t\tcreateURL({ location, routeState }: { location: { href: string }; routeState: RouteState }) {\n\t\t\ttry {\n\t\t\t\tconst preserveCustomKeysSet = new Set<string>([viewModeKey, 'ownership', 'geographicAvailability']);\n\t\t\t\t// detect if we match a category page\n\t\t\t\tconst matchingCategoryPage = getMatchingCategoryPageFromRouteState(\n\t\t\t\t\trouteState,\n\t\t\t\t\tcategoryPageConfigurations,\n\t\t\t\t\tallFacetingKeys\n\t\t\t\t);\n\n\t\t\t\tconst currentUrl = safeUrl(location.href);\n\t\t\t\tif (!currentUrl) {\n\t\t\t\t\treturn location.href;\n\t\t\t\t}\n\n\t\t\t\tif (matchingCategoryPage) {\n\t\t\t\t\tconst categoryPageUrl = safeUrl(matchingCategoryPage.categoryPageUrl, location.href);\n\t\t\t\t\tif (categoryPageUrl) {\n\t\t\t\t\t\twriteCommonSearchParams(categoryPageUrl, routeState);\n\t\t\t\t\t\tconst categoryFacetKeys = new Set(\n\t\t\t\t\t\t\tmatchingCategoryPage.facets.map(facetConfiguration => facetConfiguration.queryParamName)\n\t\t\t\t\t\t);\n\t\t\t\t\t\twriteFacetsSearchParams(categoryPageUrl, routeState.facets, categoryFacetKeys);\n\t\t\t\t\t\twriteUserFilterSearchParams(categoryPageUrl, userSearchFilters, currentUrl);\n\t\t\t\t\t\tpreserveCustomQueryParams(currentUrl, categoryPageUrl, preserveCustomKeysSet);\n\n\t\t\t\t\t\treturn categoryPageUrl.href;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst url = safeUrl('/search', location.href);\n\t\t\t\tif (!url) {\n\t\t\t\t\treturn location.href;\n\t\t\t\t}\n\n\t\t\t\twriteCommonSearchParams(url, routeState);\n\t\t\t\twriteFacetsSearchParams(url, routeState.facets);\n\t\t\t\twriteUserFilterSearchParams(url, userSearchFilters, currentUrl);\n\t\t\t\tpreserveCustomQueryParams(currentUrl, url, preserveCustomKeysSet);\n\n\t\t\t\treturn url.href;\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[search] router.createURL failed', err);\n\t\t\t\treturn location.href;\n\t\t\t}\n\t\t},\n\n\t\tparseURL({ location }: { location: { href: string } }) {\n\t\t\ttry {\n\t\t\t\tconst locationUrl = safeUrl(location.href);\n\t\t\t\tif (!locationUrl) {\n\t\t\t\t\treturn {};\n\t\t\t\t}\n\t\t\t\tconst locationPathname = locationUrl.pathname;\n\n\t\t\t\tconst matchingCategoryPage = categoryPagesByCategoryPageUrl.get(locationPathname);\n\n\t\t\t\tconst routeState: RouteState = {};\n\n\t\t\t\tconst addRouteStateFacetValues = (key: string, values: string[]) => {\n\t\t\t\t\tif (values.length === 0) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trouteState.facets ??= {};\n\t\t\t\t\trouteState.facets[key] ??= [];\n\n\t\t\t\t\tfor (const value of values) {\n\t\t\t\t\t\trouteState.facets[key].push(value);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tif (matchingCategoryPage) {\n\t\t\t\t\tfor (const facetConfiguration of matchingCategoryPage.facets) {\n\t\t\t\t\t\taddRouteStateFacetValues(facetConfiguration.queryParamName, [facetConfiguration.value]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst queryParams = locationUrl.searchParams;\n\n\t\t\t\tfor (const [paramName, paramValue] of queryParams.entries()) {\n\t\t\t\t\tif (allFacetingKeysSet.has(paramName)) {\n\t\t\t\t\t\tif (matchingCategoryPage?.facets.some(facet => facet.queryParamName === paramName)) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taddRouteStateFacetValues(\n\t\t\t\t\t\t\tparamName,\n\t\t\t\t\t\t\tparamValue\n\t\t\t\t\t\t\t\t.split(delimiter)\n\t\t\t\t\t\t\t\t.map(v => getTrimmedOrUndefinedIfStringEmpty(v))\n\t\t\t\t\t\t\t\t.filter((v): v is string => v !== undefined)\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (userFilterKeysSet.has(paramName)) {\n\t\t\t\t\t\trouteState.filters ??= {};\n\t\t\t\t\t\trouteState.filters[paramName] = paramValue;\n\t\t\t\t\t} else if (paramName === 'query') {\n\t\t\t\t\t\trouteState.query = getTrimmedOrUndefinedIfStringEmpty(paramValue);\n\t\t\t\t\t} else if (paramName === 'sortBy') {\n\t\t\t\t\t\trouteState.sortBy = paramValue;\n\t\t\t\t\t} else if (paramName === 'limit') {\n\t\t\t\t\t\tconst limit = parseInt(paramValue, 10);\n\n\t\t\t\t\t\tif (Number.isFinite(limit) && limit > 0) {\n\t\t\t\t\t\t\trouteState.limit = limit;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (paramName === 'page') {\n\t\t\t\t\t\tconst page = parseInt(paramValue, 10);\n\n\t\t\t\t\t\tif (Number.isFinite(page) && page >= 1) {\n\t\t\t\t\t\t\trouteState.page = page;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (nonFacetQueryParamNames.has(paramName)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\taddRouteStateFacetValues(\n\t\t\t\t\t\t\tparamName,\n\t\t\t\t\t\t\tparamValue\n\t\t\t\t\t\t\t\t.split(delimiter)\n\t\t\t\t\t\t\t\t.map(v => getTrimmedOrUndefinedIfStringEmpty(v))\n\t\t\t\t\t\t\t\t.filter((v): v is string => v !== undefined)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn routeState;\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[search] router.parseURL failed', err);\n\t\t\t\treturn {};\n\t\t\t}\n\t\t},\n\n\t\twindowTitle(routeState: RouteState) {\n\t\t\ttry {\n\t\t\t\tconst matchingCategoryPage = getMatchingCategoryPageFromRouteState(\n\t\t\t\t\trouteState,\n\t\t\t\t\tcategoryPageConfigurations,\n\t\t\t\t\tallFacetingKeys\n\t\t\t\t);\n\n\t\t\t\tif (matchingCategoryPage) {\n\t\t\t\t\treturn matchingCategoryPage.pageTitle;\n\t\t\t\t}\n\n\t\t\t\treturn 'Search';\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('[search] router.windowTitle failed', err);\n\t\t\t\treturn 'Search';\n\t\t\t}\n\t\t},\n\t});\n}\n\n// ---------------------------------------------------------------------------\n// Convert search categories to category page configurations\n// ---------------------------------------------------------------------------\n\nexport function convertSearchCategoriesToCategoryPageConfiguration(\n\tcategories: SearchCategory[],\n\tfacetConfigurations: FacetConfiguration[]\n): CategoryPageConfiguration[] {\n\tconst queryParamNameByTopLevelTokenMap = getQueryParamNameByTopLevelTokenMap(facetConfigurations);\n\n\treturn (categories ?? [])\n\t\t.map(category => {\n\t\t\tif (!category) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { token } = category;\n\t\t\tif (!token || typeof token !== 'string') {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst [topLevelToken, secondLevelToken] = token.split('-');\n\n\t\t\tif (topLevelToken === undefined || secondLevelToken === undefined) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst categoryPageUrl = category.categoryPageUrl;\n\t\t\tif (!categoryPageUrl) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst queryParamName = queryParamNameByTopLevelTokenMap[topLevelToken];\n\n\t\t\tif (!queryParamName) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcategoryPageUrl,\n\t\t\t\tfacets: [\n\t\t\t\t\t{\n\t\t\t\t\t\tqueryParamName,\n\t\t\t\t\t\tvalue: category.displayName,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tpageTitle: category.pageTitle,\n\t\t\t} satisfies CategoryPageConfiguration;\n\t\t})\n\t\t.filter((x): x is CategoryPageConfiguration => x !== null);\n}\n","import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { CommandSentence } from '@faithlife/command-sentence-control';\nimport { Button, Typography, LegacyTypography } from '@faithlife/commerce-components';\nimport { ChevronDown } from 'lucide-react';\nimport { UiState } from 'instantsearch.js';\nimport { Configure, ConfigureProps, InstantSearch, InstantSearchProps } from 'react-instantsearch';\nimport {\n\tPagination,\n\tuseHitsPerPage,\n\tuseInstantSearch,\n\tusePagination,\n\tuseSearchBox,\n\tuseSortBy,\n} from 'react-instantsearch';\nimport Drawer from '../shared/drawer';\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuTrigger,\n} from '../shared/dropdown-menu';\nimport useScreensize from '../../util/hooks/use-screensize';\n\nimport { cn } from '../../util/cn';\nimport { PerUserDataContextProvider, useCurrentUser } from '../per-user-data/per-user-data-context';\n\nimport { safeJsonParse } from '../../util/safe-json-parse';\nimport { useLocalization } from '../../localization';\nimport ErrorBoundary from '../error-boundary';\nimport { BooksByAuthor } from '../shared/books-by-author';\nimport { AuthorBatch } from '../../hooks/use-author';\nimport { PublisherBatch } from '../../hooks/use-publisher';\nimport CategoryContent from './category-content';\nimport {\n\tUserSearchFilter,\n\tUserSearchFilters,\n\tUserSearchFilterProvider,\n\tuseUserSearchFilterContext,\n} from './user-search-filter-context';\nimport { Categories } from './filters';\nimport CurrentQueryRefinement, { CurrentRefinements } from './refinements';\nimport ProductHits from './products';\nimport SortByAccordion from './sort-by-accordion';\nimport { SearchCategory } from './types';\nimport { makeStateMapping, makeRouter, convertSearchCategoriesToCategoryPageConfiguration } from './routing';\nimport type { FacetConfiguration, RouteState } from './routing';\nexport { SearchResourcesContext, useSearchResources } from './search-resources';\nimport { SearchResourcesContext, useSearchResources } from './search-resources';\nimport { useSearchImpressions } from './hooks/use-search-impressions';\nimport { useSearchAnalytics } from './hooks/use-search-analytics';\nexport { AlgoliaSearchContextProvider, useAlgoliaSearch } from './algolia-search-context';\nimport { AlgoliaSearchContextProvider, useAlgoliaSearch } from './algolia-search-context';\nimport { useViewMode, ViewMode, ViewModeProvider } from './use-view-mode';\n\n// ---------------------------------------------------------------------------\n// AlgoliaSSRProvider / AlgoliaProvider — InstantSearch + Configure wrappers\n// ---------------------------------------------------------------------------\n\ntype AlgoliaSearchParameters = Record<string, any>;\n\ntype ConfigurableConfigureProps = Pick<\n\tConfigureProps,\n\t'attributesToHighlight' | 'attributesToRetrieve' | 'queryType' | 'restrictSearchableAttributes'\n> & { searchParameters?: AlgoliaSearchParameters; userSearchFilters?: UserSearchFilter[] };\n\ntype AlgoliaProviderProps<TUiState extends UiState, TRouteState> = Pick<\n\tInstantSearchProps<TUiState, TRouteState>,\n\t'routing' | 'searchClient'\n> &\n\tConfigurableConfigureProps;\n\nfunction AlgoliaSSRProvider<TUiState extends UiState = UiState, TRouteState = TUiState>(\n\tprops: React.PropsWithChildren<AlgoliaProviderProps<TUiState, TRouteState>>\n) {\n\treturn <AlgoliaProvider {...props} />;\n}\n\nfunction AlgoliaProvider<TUiState extends UiState = UiState, TRouteState = TUiState>({\n\tattributesToHighlight,\n\tattributesToRetrieve,\n\tqueryType,\n\trestrictSearchableAttributes,\n\trouting,\n\tsearchClient,\n\tsearchParameters,\n\tchildren,\n}: React.PropsWithChildren<AlgoliaProviderProps<TUiState, TRouteState>>) {\n\tconst { indexName } = useAlgoliaSearch();\n\n\treturn (\n\t\t<ViewModeProvider>\n\t\t\t<InstantSearch\n\t\t\t\tfuture={{\n\t\t\t\t\tpreserveSharedStateOnUnmount: true,\n\t\t\t\t}}\n\t\t\t\tindexName={indexName}\n\t\t\t\tinsights\n\t\t\t\trouting={routing}\n\t\t\t\tsearchClient={searchClient}\n\t\t\t>\n\t\t\t\t<ConfigureCore\n\t\t\t\t\tattributesToHighlight={attributesToHighlight}\n\t\t\t\t\tattributesToRetrieve={attributesToRetrieve}\n\t\t\t\t\tqueryType={queryType}\n\t\t\t\t\trestrictSearchableAttributes={restrictSearchableAttributes}\n\t\t\t\t\tsearchParameters={searchParameters}\n\t\t\t\t/>\n\t\t\t\t{children}\n\t\t\t</InstantSearch>\n\t\t</ViewModeProvider>\n\t);\n}\n\nconst ParameterBlacklist = new Set(['facets']);\n\nfunction ConfigureCore({\n\tattributesToHighlight,\n\tattributesToRetrieve,\n\tqueryType,\n\trestrictSearchableAttributes,\n\tsearchParameters,\n}: ConfigurableConfigureProps) {\n\tconst { selectedFilterOptions, userSearchFilters } = useUserSearchFilterContext();\n\n\tconst props = useMemo(() => {\n\t\tconst mergedParams = { ...(searchParameters ?? {}) };\n\t\tconst userFilters = Array.isArray(userSearchFilters) ? userSearchFilters : [];\n\n\t\tconst selectedOptions = userFilters\n\t\t\t.map(uf => {\n\t\t\t\tconst selectedOptionToken = selectedFilterOptions[uf.token];\n\t\t\t\tif (!selectedOptionToken) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst selectedOption = uf.options?.find(o => o.token === selectedOptionToken);\n\t\t\t\tif (!selectedOption?.algoliaValue) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn selectedOption.algoliaValue;\n\t\t\t})\n\t\t\t.filter((o): o is string => typeof o === 'string' && o.length > 0);\n\n\t\tconst filterParts = [mergedParams.filters, ...selectedOptions].filter(\n\t\t\t(f): f is string => typeof f === 'string' && f.length > 0\n\t\t);\n\t\tif (filterParts.length > 0) {\n\t\t\tmergedParams.filters = filterParts.join(' AND ');\n\t\t} else {\n\t\t\tdelete mergedParams.filters;\n\t\t}\n\n\t\treturn Object.fromEntries(Object.entries(mergedParams).filter(([key]) => !ParameterBlacklist.has(key)));\n\t}, [searchParameters, userSearchFilters, selectedFilterOptions]);\n\n\treturn (\n\t\t<Configure\n\t\t\tattributesToHighlight={attributesToHighlight}\n\t\t\tattributesToRetrieve={attributesToRetrieve}\n\t\t\tdistinct\n\t\t\tqueryType={queryType}\n\t\t\trestrictSearchableAttributes={restrictSearchableAttributes}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// Icons\n// ---------------------------------------------------------------------------\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction CloseIcon({ className, fillColor: _fillColor, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<path d=\"M12.5 3.5L3.5 12.5M3.5 3.5l9 9\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.5\" />\n\t\t</svg>\n\t);\n}\n\nfunction FilterIcon({ className, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<path d=\"M2 4h12M4 8h8M6 12h4\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.5\" />\n\t\t</svg>\n\t);\n}\n\nfunction LayoutGridIcon({ className, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"1.5\" y=\"1.5\" />\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"9.5\" y=\"1.5\" />\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"1.5\" y=\"9.5\" />\n\t\t\t<rect height=\"5\" rx=\"1\" stroke=\"currentColor\" width=\"5\" x=\"9.5\" y=\"9.5\" />\n\t\t</svg>\n\t);\n}\n\nfunction LayoutListIcon({ className, ...rest }: any) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={className}\n\t\t\tfill=\"none\"\n\t\t\theight=\"16\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\twidth=\"16\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t{...rest}\n\t\t>\n\t\t\t<rect height=\"3\" rx=\"1\" stroke=\"currentColor\" width=\"14\" x=\"1\" y=\"1.5\" />\n\t\t\t<rect height=\"3\" rx=\"1\" stroke=\"currentColor\" width=\"14\" x=\"1\" y=\"6.5\" />\n\t\t\t<rect height=\"3\" rx=\"1\" stroke=\"currentColor\" width=\"14\" x=\"1\" y=\"11.5\" />\n\t\t</svg>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// Layout buttons — grid/list toggle\n// ---------------------------------------------------------------------------\n\nfunction LayoutButtons({\n\tcurrentLayoutType,\n\tsetLayoutType,\n}: {\n\tcurrentLayoutType: ViewMode;\n\tsetLayoutType: (mode: ViewMode) => void;\n}) {\n\tconst isLayoutGrid = currentLayoutType === ViewMode.grid;\n\n\tconst btnClassName =\n\t\t'cursor-pointer inline-flex items-center gap-sp8 rounded-[4px] border border-primary-500 md:border-0 px-sp16 py-sp16 text-primary-500 focus:outline-0 focus:ring-0';\n\n\treturn (\n\t\t<div className={cn('flex gap-[6px]', 'order-2 ml-auto md:order-none md:ml-0')}>\n\t\t\t<button\n\t\t\t\taria-label=\"Grid Layout\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\tbtnClassName,\n\t\t\t\t\t'md:p-[6px]',\n\t\t\t\t\tisLayoutGrid && 'text-primary-400',\n\t\t\t\t\t!isLayoutGrid && 'text-black-100'\n\t\t\t\t)}\n\t\t\t\tonClick={() => setLayoutType(ViewMode.grid)}\n\t\t\t>\n\t\t\t\t<LayoutGridIcon />\n\t\t\t</button>\n\t\t\t<button\n\t\t\t\taria-label=\"List Layout\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\tbtnClassName,\n\t\t\t\t\t'md:px-[3px] md:py-[6px]',\n\t\t\t\t\t!isLayoutGrid && 'text-primary-400',\n\t\t\t\t\tisLayoutGrid && 'text-black-100'\n\t\t\t\t)}\n\t\t\t\tonClick={() => setLayoutType(ViewMode.list)}\n\t\t\t>\n\t\t\t\t<LayoutListIcon />\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// ScrollToTopOnPaginationChange\n// ---------------------------------------------------------------------------\n\nfunction DesktopSearchControl({\n\tprefixText,\n\tvalue,\n\titems,\n\tonChange,\n\ttestId,\n\tcontentClassName,\n}: {\n\tprefixText: string;\n\tvalue: string | number;\n\titems: { label: string; value: string | number }[];\n\tonChange: (value: string | number) => void;\n\ttestId: string;\n\tcontentClassName?: string;\n}) {\n\tconst selectedItem = useMemo(() => {\n\t\treturn items.find(item => item.value === value) ?? items[0];\n\t}, [items, value]);\n\n\tconst selectedLabel = selectedItem?.label ?? value.toString();\n\n\tconst handleValueChange = useCallback(\n\t\t(newValue: string) => {\n\t\t\tconst matchedItem = items.find(item => item.value.toString() === newValue);\n\t\t\tif (matchedItem) {\n\t\t\t\tonChange(matchedItem.value);\n\t\t\t}\n\t\t},\n\t\t[items, onChange]\n\t);\n\n\treturn (\n\t\t<DropdownMenu>\n\t\t\t<DropdownMenuTrigger\n\t\t\t\tclassName=\"inline-flex cursor-pointer items-center border-0 bg-transparent p-0 text-black [&[data-state=open]>svg]:rotate-180\"\n\t\t\t\tdata-testid={testId}\n\t\t\t>\n\t\t\t\t<span className=\"mr-[3px] font-normal\">{prefixText}</span>\n\t\t\t\t<span className=\"font-semibold\">{selectedLabel}</span>\n\t\t\t\t<ChevronDown className=\"ml-[2px] h-4 w-4 transition-transform\" />\n\t\t\t</DropdownMenuTrigger>\n\t\t\t<DropdownMenuContent className={contentClassName}>\n\t\t\t\t<DropdownMenuRadioGroup onValueChange={handleValueChange} value={value.toString()}>\n\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\tclassName=\"w-full data-[state=checked]:bg-primary-100 active:bg-secondary-100 focus-visible:ring-2 focus-visible:ring-primary\"\n\t\t\t\t\t\t\tkey={item.value.toString()}\n\t\t\t\t\t\t\tvalue={item.value.toString()}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t))}\n\t\t\t\t</DropdownMenuRadioGroup>\n\t\t\t</DropdownMenuContent>\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction ScrollToTopOnPaginationChange() {\n\tconst { currentRefinement } = usePagination();\n\n\tuseEffect(() => {\n\t\twindow.scrollTo({ top: 0, behavior: 'smooth' });\n\t}, [currentRefinement]);\n\n\treturn null;\n}\n\nfunction NoResultsState({ query }: { query: string }) {\n\tconst resources = useSearchResources();\n\tconst normalizedQuery = query.trim();\n\tconst noResultsMessageTemplate = resources['noResults'];\n\tconst searchTips = [resources['checkSpelling'], resources['differentKeywords'], resources['lessSpecific']];\n\n\treturn (\n\t\t<section className=\"my-sp60 mx-auto flex w-full max-w-[640px] flex-col items-start gap-sp48 rounded-md border border-grey-200 bg-grey-50 p-sp60 text-left shadow-sm\">\n\t\t\t<Typography className=\"break-words text-left font-semibold text-black\" tag=\"p\" variant=\"bodyLarge\">\n\t\t\t\t{normalizedQuery && (\n\t\t\t\t\t<CommandSentence Container={React.Fragment} template={noResultsMessageTemplate}>\n\t\t\t\t\t\t<CommandSentence.Field name=\"QUERY\">{normalizedQuery}</CommandSentence.Field>\n\t\t\t\t\t</CommandSentence>\n\t\t\t\t)}\n\t\t\t</Typography>\n\t\t\t<div className=\"flex flex-col items-start gap-sp8 text-left text-black\">\n\t\t\t\t<Typography className=\"font-semibold text-black\" tag=\"p\" variant=\"bodyRegular\">\n\t\t\t\t\t{resources['searchTips']}\n\t\t\t\t</Typography>\n\t\t\t\t<ul className=\"list-disc pl-5\">\n\t\t\t\t\t{searchTips.map(tip => (\n\t\t\t\t\t\t<li className=\"bodyMd\" key={tip}>\n\t\t\t\t\t\t\t{tip}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t))}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t<Button onClick={() => window.location.assign('/search')} type=\"button\" variant=\"primary\">\n\t\t\t\t{resources['seeAllProducts']}\n\t\t\t</Button>\n\t\t</section>\n\t);\n}\n// ---------------------------------------------------------------------------\n// FilterSortLayout — main search page layout\n// ---------------------------------------------------------------------------\n\nconst FilterSortLayout = ({\n\twishListsProductsUrl,\n\tenableAuthorBioView,\n\tpageLimits,\n\tsortOrders,\n}: {\n\twishListsProductsUrl: string;\n\tenableAuthorBioView: boolean;\n\tpageLimits: number[];\n\tsortOrders: { label: string; value: string | null }[];\n}) => {\n\tconst resources = useSearchResources();\n\tconst authorBioResources = useLocalization('CommerceWeb.Resources.Search.AuthorBio');\n\n\tconst { indexName } = useAlgoliaSearch();\n\tconst [isMobileFilterOpen, setIsMobileFilterOpen] = useState(false);\n\n\tconst { viewMode, setViewMode } = useViewMode();\n\tconst { isMobile, isDesktop } = useScreensize();\n\n\tuseSearchImpressions();\n\tuseSearchAnalytics();\n\tconst { results } = useInstantSearch();\n\tconst { query } = useSearchBox();\n\tconst hasNoSearchResults = !results.__isArtificial && results.nbHits === 0;\n\tconst shouldShowResultsRoute = !hasNoSearchResults;\n\n\tconst sortItems = useMemo(\n\t\t() =>\n\t\t\tsortOrders.map(sortOrder => ({\n\t\t\t\tlabel: resources[sortOrder.label] ?? sortOrder.label,\n\t\t\t\tvalue: sortOrder.value ? `${indexName}_virtual_${sortOrder.value}` : indexName,\n\t\t\t})),\n\t\t[resources, indexName, sortOrders]\n\t);\n\tconst { currentRefinement: currentSortBy, refine: refineSortBy } = useSortBy({ items: sortItems });\n\n\tconst hitsPerPageItems = useMemo(\n\t\t() => pageLimits.map((pageLimit, index) => ({ default: index === 0, label: String(pageLimit), value: pageLimit })),\n\t\t[pageLimits]\n\t);\n\tconst { items: showItems, refine: refineHitsPerPage } = useHitsPerPage({\n\t\titems: hitsPerPageItems,\n\t});\n\tconst currentHitsPerPage = showItems.find(item => item.isRefined)?.value ?? hitsPerPageItems[0].value;\n\n\tconst closeFilter = useCallback(() => setIsMobileFilterOpen(false), []);\n\tconst toggleFilter = useCallback(() => setIsMobileFilterOpen(prev => !prev), []);\n\n\t// Close when resized to desktop\n\tuseEffect(() => {\n\t\tif (isDesktop) {\n\t\t\tcloseFilter();\n\t\t}\n\t}, [isDesktop, closeFilter]);\n\n\tuseEffect(() => {\n\t\tif (hasNoSearchResults) {\n\t\t\tcloseFilter();\n\t\t}\n\t}, [hasNoSearchResults, closeFilter]);\n\n\t// Shared filter panel content used in both mobile fullscreen and tablet drawer\n\tconst filterPanelContent = (\n\t\t<div className=\"isolate flex h-full flex-col\">\n\t\t\t{/* Sticky header — title + close button always visible */}\n\t\t\t<div className=\"sticky top-0 z-10 flex items-center justify-between bg-white py-4 pl-4 pr-5 shadow-sm\">\n\t\t\t\t<LegacyTypography className=\"!font-medium text-primary-400\" variant=\"xlargeBody\">\n\t\t\t\t\t{resources['filterAndSort']}\n\t\t\t\t</LegacyTypography>\n\t\t\t\t<button\n\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\tclassName=\"w-auto border-0 bg-transparent p-0 hover:bg-transparent\"\n\t\t\t\t\tonClick={closeFilter}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t>\n\t\t\t\t\t<CloseIcon className=\"h-4 w-4\" fillColor=\"fill-primary-400\" />\n\t\t\t\t</button>\n\t\t\t</div>\n\n\t\t\t{/* Scrollable body — active refinements, \"All filters\" label, sort, filter accordions, see results */}\n\t\t\t<div className=\"flex-1 overflow-y-auto\">\n\t\t\t\t<div className=\"px-4 pt-4\">\n\t\t\t\t\t<Typography className=\"mb-2 text-black\" variant=\"bodySmall\">\n\t\t\t\t\t\t{resources['allFilters']}\n\t\t\t\t\t</Typography>\n\t\t\t\t\t<div className=\"mb-4 flex flex-wrap gap-1\">\n\t\t\t\t\t\t<CurrentQueryRefinement />\n\t\t\t\t\t\t<CurrentRefinements />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<SortByAccordion items={sortItems} />\n\t\t\t\t<Categories />\n\t\t\t\t<div className=\"border-t border-grey-200 p-4\">\n\t\t\t\t\t<Button className=\"w-full\" onClick={closeFilter} type=\"button\" variant=\"primary\">\n\t\t\t\t\t\t{resources['seeResults']}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{/* Tablet & Mobile: left-side slide-in drawer with scrim via react-modern-drawer, full screen on mobile*/}\n\t\t\t{!isDesktop && shouldShowResultsRoute && (\n\t\t\t\t<Drawer\n\t\t\t\t\tid=\"search-filter-drawer\"\n\t\t\t\t\tisOpen={isMobileFilterOpen}\n\t\t\t\t\tonClose={closeFilter}\n\t\t\t\t\tplacement=\"left\"\n\t\t\t\t\tsize={isMobile ? '100vw' : '320px' /* isTablet */}\n\t\t\t\t\tzIndex={5000}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"h-full bg-white\">{filterPanelContent}</div>\n\t\t\t\t</Drawer>\n\t\t\t)}\n\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'relative grid gap-8 px-4 md:px-6 lg:mx-auto lg:max-w-[1323px] xxlg:px-4',\n\t\t\t\t\tshouldShowResultsRoute ? 'lg:grid-cols-[300px_auto] xl:grid-cols-[375px_auto]' : 'lg:grid-cols-1'\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<ScrollToTopOnPaginationChange />\n\n\t\t\t\t{/* Desktop: static sidebar (always visible in grid flow) */}\n\t\t\t\t{shouldShowResultsRoute && (\n\t\t\t\t\t<div className=\"mt-sp20 hidden self-start border-b border-primary-100 lg:block\">\n\t\t\t\t\t\t<LegacyTypography className=\"mb-8 text-black\" variant=\"xlargeBody\">\n\t\t\t\t\t\t\t{resources['allFilters']}\n\t\t\t\t\t\t</LegacyTypography>\n\t\t\t\t\t\t<Categories />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div>\n\t\t\t\t\t<div className=\"flex flex-col gap-8\">\n\t\t\t\t\t\t<CategoryContent sectionKind=\"searchResultsAbove\" />\n\t\t\t\t\t\t{enableAuthorBioView && <BooksByAuthor resources={authorBioResources} />}\n\t\t\t\t\t\t{hasNoSearchResults ? (\n\t\t\t\t\t\t\t<NoResultsState query={query} />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div className=\"mt-sp20 -mx-4 flex flex-col-reverse justify-between px-4 md:-mx-6 md:px-6 lg:mx-0 lg:flex-row lg:items-start lg:px-0\">\n\t\t\t\t\t\t\t\t<div className=\"mt-4 flex flex-wrap items-center gap-1 lg:mt-0\">\n\t\t\t\t\t\t\t\t\t<CurrentQueryRefinement />\n\t\t\t\t\t\t\t\t\t<CurrentRefinements />\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<div className=\"flex gap-8\">\n\t\t\t\t\t\t\t\t\t<LayoutButtons currentLayoutType={viewMode} setLayoutType={setViewMode} />\n\t\t\t\t\t\t\t\t\t<div className=\"bodyMd hidden items-center text-black lg:flex\">\n\t\t\t\t\t\t\t\t\t\t<DesktopSearchControl\n\t\t\t\t\t\t\t\t\t\t\tonChange={newSortBy => refineSortBy(newSortBy.toString())}\n\t\t\t\t\t\t\t\t\t\t\titems={sortItems}\n\t\t\t\t\t\t\t\t\t\t\tprefixText={resources['sortBy']}\n\t\t\t\t\t\t\t\t\t\t\ttestId=\"sort-by-menu-button\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={currentSortBy ?? sortItems[0].value}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"bodyMd hidden md:flex items-center text-black\">\n\t\t\t\t\t\t\t\t\t\t<DesktopSearchControl\n\t\t\t\t\t\t\t\t\t\t\tcontentClassName=\"w-(--radix-popper-anchor-width) min-w-0\"\n\t\t\t\t\t\t\t\t\t\t\tonChange={newHitsPerPage => refineHitsPerPage(Number(newHitsPerPage))}\n\t\t\t\t\t\t\t\t\t\t\titems={showItems.map(item => ({\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: item.label,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: item.value,\n\t\t\t\t\t\t\t\t\t\t\t}))}\n\t\t\t\t\t\t\t\t\t\t\tprefixText={resources['show']}\n\t\t\t\t\t\t\t\t\t\t\ttestId=\"hits-per-page-menu-button\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={currentHitsPerPage ?? hitsPerPageItems[0].value}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"ml-0 -mr-3 block md:ml-auto lg:hidden\">\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"inline-flex cursor-pointer items-center gap-sp8 rounded-[4px] border border-primary-500 px-sp16 py-sp16 text-primary-500 focus:outline-0 focus:ring-0\"\n\t\t\t\t\t\t\t\t\t\t\tdata-testid=\"filter-and-sort-button\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={toggleFilter}\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<FilterIcon />\n\t\t\t\t\t\t\t\t\t\t\t<Typography className=\"text-primary-500 font-medium leading-[100%]\" variant=\"bodySmall\">\n\t\t\t\t\t\t\t\t\t\t\t\t{resources['filterAndSort']}\n\t\t\t\t\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t{shouldShowResultsRoute && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ProductHits\n\t\t\t\t\t\t\t\tlayoutType={viewMode}\n\t\t\t\t\t\t\t\twishListsProductsUrl={wishListsProductsUrl}\n\t\t\t\t\t\t\t\tcurrentHitsPerPage={currentHitsPerPage}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Pagination\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'[&>ul>li.previous-page-item>.ais-Pagination-link]:bodyLg',\n\t\t\t\t\t\t\t\t\t'[&>ul>li.next-page-item>.ais-Pagination-link]:bodyLg'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tclassNames={{\n\t\t\t\t\t\t\t\t\troot: 'py-4 lg:px-4 lg:py-8',\n\t\t\t\t\t\t\t\t\tnoRefinementRoot: 'hidden',\n\t\t\t\t\t\t\t\t\tlist: 'flex gap-[2px] items-center justify-center',\n\t\t\t\t\t\t\t\t\titem: 'bodySm text-black h-6 w-[23px]',\n\t\t\t\t\t\t\t\t\tpreviousPageItem: 'previous-page-item text-primary',\n\t\t\t\t\t\t\t\t\tpageItem: 'pageItem',\n\t\t\t\t\t\t\t\t\tselectedItem: 'bg-primary-100 text-primary',\n\t\t\t\t\t\t\t\t\tdisabledItem: 'opacity-25',\n\t\t\t\t\t\t\t\t\tnextPageItem: 'next-page-item text-primary',\n\t\t\t\t\t\t\t\t\tlink: 'flex items-center justify-center px-2 py-1 h-full w-full',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowFirst={false}\n\t\t\t\t\t\t\t\tshowLast={false}\n\t\t\t\t\t\t\t\tshowNext\n\t\t\t\t\t\t\t\tshowPrevious\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n};\n\n// ---------------------------------------------------------------------------\n// InstantSearchWrapper — wires up Algolia routing + providers\n// ---------------------------------------------------------------------------\n\nconst InstantSearchWrapper = ({\n\tcategories,\n\tfacetConfigurations,\n\tsearchParameters,\n\twishListsProductsUrl,\n\tenableAuthorBioView,\n\tpageLimits,\n\tsortOrders,\n}: {\n\tcategories: SearchCategory[];\n\tfacetConfigurations: FacetConfiguration[];\n\tsearchParameters: AlgoliaSearchParameters;\n\twishListsProductsUrl: string;\n\tenableAuthorBioView: boolean;\n\tpageLimits: number[];\n\tsortOrders: { label: string; value: string | null }[];\n}) => {\n\tconst { client: searchClient, indexName } = useAlgoliaSearch();\n\tconst { userSearchFilters } = useUserSearchFilterContext();\n\tconst stateMapping = useMemo(\n\t\t() => makeStateMapping(indexName, facetConfigurations),\n\t\t[indexName, facetConfigurations]\n\t);\n\tconst categoryPageConfigurations = useMemo(\n\t\t() => convertSearchCategoriesToCategoryPageConfiguration(categories, facetConfigurations),\n\t\t[categories, facetConfigurations]\n\t);\n\tconst router = useMemo(\n\t\t() => makeRouter(categoryPageConfigurations, facetConfigurations, userSearchFilters),\n\t\t[categoryPageConfigurations, facetConfigurations, userSearchFilters]\n\t);\n\tconst routing = useMemo(() => ({ router, stateMapping }), [router, stateMapping]);\n\treturn (\n\t\t<AlgoliaSSRProvider<UiState, RouteState>\n\t\t\tattributesToRetrieve={[\n\t\t\t\t'title',\n\t\t\t\t'productId',\n\t\t\t\t'overview',\n\t\t\t\t'authors',\n\t\t\t\t'region',\n\t\t\t\t'primaryImageUri',\n\t\t\t\t'anchorPrice',\n\t\t\t\t'salePrice',\n\t\t\t\t'averageRating',\n\t\t\t\t'reviewCount',\n\t\t\t\t'isLogosEdition',\n\t\t\t]}\n\t\t\tqueryType=\"prefixNone\"\n\t\t\trouting={routing}\n\t\t\tsearchClient={searchClient}\n\t\t\tsearchParameters={searchParameters}\n\t\t>\n\t\t\t<AuthorBatch.Provider>\n\t\t\t\t<PublisherBatch.Provider>\n\t\t\t\t\t<FilterSortLayout\n\t\t\t\t\t\tpageLimits={pageLimits}\n\t\t\t\t\t\tsortOrders={sortOrders}\n\t\t\t\t\t\twishListsProductsUrl={wishListsProductsUrl}\n\t\t\t\t\t\tenableAuthorBioView={enableAuthorBioView}\n\t\t\t\t\t/>\n\t\t\t\t</PublisherBatch.Provider>\n\t\t\t</AuthorBatch.Provider>\n\t\t</AlgoliaSSRProvider>\n\t);\n};\n\n// ---------------------------------------------------------------------------\n// Search — top-level entry component (default export)\n// ---------------------------------------------------------------------------\n\ninterface SearchProps {\n\talgoliaAppId?: string;\n\talgoliaAppKey?: string;\n\talgoliaIndexName?: string;\n\tstorefrontShortname?: string;\n\talgoliaSearchParametersJson?: string;\n\tuserSearchFiltersJson?: string;\n\tfacetConfigurations?: FacetConfiguration[];\n\tsearchCategories?: SearchCategory[];\n\twishListsProductsUrl?: string;\n\tenableAuthorBioView?: boolean;\n\tpageLimits: number[];\n\tsortOrders: { label: string; value: string | null }[];\n}\n\nexport default function Search({\n\talgoliaAppId = '',\n\talgoliaAppKey = '',\n\talgoliaIndexName = '',\n\tstorefrontShortname = '',\n\talgoliaSearchParametersJson,\n\tuserSearchFiltersJson,\n\tfacetConfigurations = [],\n\tsearchCategories = [],\n\twishListsProductsUrl = '',\n\tenableAuthorBioView = false,\n\tpageLimits,\n\tsortOrders,\n}: SearchProps) {\n\tconst localizedResources = useLocalization('CommerceWeb.Resources.Search.Search');\n\tconst { userId } = useCurrentUser();\n\tconst searchParameters = useMemo(\n\t\t() => safeJsonParse(algoliaSearchParametersJson) ?? {},\n\t\t[algoliaSearchParametersJson]\n\t);\n\tconst userSearchFilters = useMemo((): UserSearchFilter[] => {\n\t\tconst parsedFilters = safeJsonParse<UserSearchFilters>(userSearchFiltersJson);\n\t\treturn (\n\t\t\tparsedFilters?.filters?.map(filter => ({\n\t\t\t\t...filter,\n\t\t\t\toptions: filter.options.map(option => ({ ...option, isSelected: option.isDefault })),\n\t\t\t})) ?? []\n\t\t);\n\t}, [userSearchFiltersJson]);\n\n\treturn (\n\t\t<div className=\"tw-preflight\">\n\t\t\t<PerUserDataContextProvider>\n\t\t\t\t<SearchResourcesContext.Provider value={localizedResources}>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<AlgoliaSearchContextProvider\n\t\t\t\t\t\t\tappId={algoliaAppId}\n\t\t\t\t\t\t\tappKey={algoliaAppKey}\n\t\t\t\t\t\t\tindexName={algoliaIndexName}\n\t\t\t\t\t\t\tstorefrontShortname={storefrontShortname}\n\t\t\t\t\t\t\tuserId={userId}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UserSearchFilterProvider userSearchFilters={userSearchFilters}>\n\t\t\t\t\t\t\t\t<InstantSearchWrapper\n\t\t\t\t\t\t\t\t\tcategories={searchCategories}\n\t\t\t\t\t\t\t\t\tfacetConfigurations={facetConfigurations}\n\t\t\t\t\t\t\t\t\tsearchParameters={searchParameters}\n\t\t\t\t\t\t\t\t\twishListsProductsUrl={wishListsProductsUrl}\n\t\t\t\t\t\t\t\t\tenableAuthorBioView={enableAuthorBioView}\n\t\t\t\t\t\t\t\t\tpageLimits={pageLimits}\n\t\t\t\t\t\t\t\t\tsortOrders={sortOrders}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</UserSearchFilterProvider>\n\t\t\t\t\t\t</AlgoliaSearchContextProvider>\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t</SearchResourcesContext.Provider>\n\t\t\t\t<CategoryContent sectionKind=\"searchResultsBelow\" />\n\t\t\t</PerUserDataContextProvider>\n\t\t</div>\n\t);\n}\n","import { useEffect, useRef } from 'react';\nimport { useHits } from 'react-instantsearch';\n\nimport { ProductHit } from '../types';\n\n/**\n * Pushes UA Enhanced Ecommerce impression data to the dataLayer when search results change.\n * Matches the Skeletor pattern of `dataLayer.push({ ecommerce: { impressions: [...] } })`.\n */\nexport function useSearchImpressions() {\n\tconst { results } = useHits<ProductHit>();\n\tconst lastPushedQueryRef = useRef<string | null>(null);\n\n\tuseEffect(() => {\n\t\tif (!results?.hits?.length) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Deduplicate pushes by using the Algolia query ID (or query string + page as fallback)\n\t\tconst queryKey = (results as any).queryID ?? `${results.query ?? ''}_${results.page ?? 0}`;\n\t\tif (queryKey === lastPushedQueryRef.current) {\n\t\t\treturn;\n\t\t}\n\t\tlastPushedQueryRef.current = queryKey;\n\n\t\tconst impressions = results.hits.map((hit, index) => ({\n\t\t\tid: String(hit.productId),\n\t\t\tname: hit.title ?? '',\n\t\t\tprice: String(hit.salePrice ?? 0),\n\t\t\tlist: 'Search Results',\n\t\t\tposition: String(index),\n\t\t}));\n\n\t\t(window as any).dataLayer = (window as any).dataLayer || [];\n\t\t(window as any).dataLayer.push({\n\t\t\tecommerce: {\n\t\t\t\timpressions,\n\t\t\t},\n\t\t});\n\t}, [results]);\n}\n","import { useEffect, useRef } from 'react';\nimport { useInstantSearch } from 'react-instantsearch';\n\n/**\n * Pushes GTM dataLayer events when users interact with search facets, sort options,\n * and hits-per-page controls. Matches the Skeletor `facet_search` and `results_search` events.\n */\nexport function useSearchAnalytics() {\n\tconst { indexUiState } = useInstantSearch();\n\tconst previousStateRef = useRef<typeof indexUiState | null>(null);\n\n\tuseEffect(() => {\n\t\tconst prevState = previousStateRef.current;\n\t\tpreviousStateRef.current = indexUiState;\n\n\t\t// Skip the initial render — only track user-initiated changes\n\t\tif (!prevState) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst dataLayer = ((window as any).dataLayer = (window as any).dataLayer || []);\n\n\t\t// Track sort changes\n\t\tif (indexUiState.sortBy !== prevState.sortBy) {\n\t\t\tdataLayer.push({\n\t\t\t\tevent: 'results_search',\n\t\t\t\tselection: {\n\t\t\t\t\tgroup: 'Sort By',\n\t\t\t\t\toption: indexUiState.sortBy ?? 'default',\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Track hits-per-page changes\n\t\tif (indexUiState.hitsPerPage !== prevState.hitsPerPage) {\n\t\t\tdataLayer.push({\n\t\t\t\tevent: 'results_search',\n\t\t\t\tselection: {\n\t\t\t\t\tgroup: 'Show',\n\t\t\t\t\toption: String(indexUiState.hitsPerPage ?? 15),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Track refinement list (facet) changes\n\t\tconst currentRefinements = indexUiState.refinementList ?? {};\n\t\tconst previousRefinements = prevState.refinementList ?? {};\n\n\t\tconst allFacetKeys = new Set([...Object.keys(currentRefinements), ...Object.keys(previousRefinements)]);\n\n\t\tfor (const facetKey of allFacetKeys) {\n\t\t\tconst currentValues = new Set(currentRefinements[facetKey] ?? []);\n\t\t\tconst previousValues = new Set(previousRefinements[facetKey] ?? []);\n\n\t\t\t// Find newly selected facets\n\t\t\tfor (const value of currentValues) {\n\t\t\t\tif (!previousValues.has(value)) {\n\t\t\t\t\tdataLayer.push({\n\t\t\t\t\t\tevent: 'facet_search',\n\t\t\t\t\t\tselection: {\n\t\t\t\t\t\t\tfacetGroup: facetKey,\n\t\t\t\t\t\t\tfacet: value,\n\t\t\t\t\t\t\tchecked: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Find deselected facets\n\t\t\tfor (const value of previousValues) {\n\t\t\t\tif (!currentValues.has(value)) {\n\t\t\t\t\tdataLayer.push({\n\t\t\t\t\t\tevent: 'facet_search',\n\t\t\t\t\t\tselection: {\n\t\t\t\t\t\t\tfacetGroup: facetKey,\n\t\t\t\t\t\t\tfacet: value,\n\t\t\t\t\t\t\tchecked: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Track page changes\n\t\tif (indexUiState.page !== prevState.page) {\n\t\t\tdataLayer.push({\n\t\t\t\tevent: 'results_search',\n\t\t\t\tselection: {\n\t\t\t\t\tgroup: 'Page',\n\t\t\t\t\toption: String(indexUiState.page ?? 1),\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}, [indexUiState]);\n}\n","export function safeJsonParse<T = any>(json: string | null | undefined): T | null {\n\tif (json === null || json === undefined) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\treturn JSON.parse(json) as T;\n\t} catch {\n\t\treturn null;\n\t}\n}\n"],"names":["ErrorBoundary","Component","constructor","props","super","_defineProperty","this","setState","hasError","error","errorInfo","onReset","state","getDerivedStateFromError","componentDidCatch","onError","console","render","fallback","resetErrorBoundary","fallbackComponent","FallbackComponent","React","children","propTypes","PropTypes","isRequired","showError","defaultProps","__WEBPACK_DEFAULT_EXPORT__","AuthorBatch","createBatchContext","async","response","fetch","concat","ids","join","ok","Error","status","json","id","data","find","d","useAuthor","useData","BooksByAuthor","_ref","resources","refinedAuthorIds","_useRefinementList$it","useRefinementList","attribute","items","filter","item","isRefined","map","value","authorId","length","_useAuthor","author","isLoading","_useState","useState","_useState2","_slicedToArray","isCollapsed","setIsCollapsed","displayName","longDescription","className","Typography","variant","booksBy","IconButton","scale","onClick","ChevronDown","ChevronUp","AuthorBio","imageUrl","imageUrlLarge","bio","PublisherBatch","category_content","sectionKind","hasContent","contentKey","_useState2$","setContentState","handleContentChange","useCallback","event","prev","ReadMoreReadLess","SectionContent","onContentChange","UserSearchFilterContext","createContext","readUserFilterSelectionsFromUrl","userSearchFilters","searchParams","defaults","reduce","selectedOptions","_options$find","options","Array","isArray","selectedOption","option","isDefault","token","getDefaultSelectedFilterOptions","_matchingOption$token","urlValue","get","matchingOption","undefined","resolved","useUserSearchFilterContext","context","useContext","UserSearchFilterProvider","setSelectedFilterOptionsOverride","_useLocation","useLocation","search","pathname","replaceUrl","useMemo","URLSearchParams","selectedFilterOptions","setSelectedFilterOptions","useEffect","urlSelections","next","currentSelection","isStillValid","some","url","URL","_unused","selectedToken","set","delete","_unused2","writeUserFilterSelectionsToUrl","handleSetSelectedFilterOption","filterToken","optionToken","_objectSpread","contextValue","setSelectedFilterOption","Provider","Accordion","AccordionPrimitive","AccordionItem","ref","_objectWithoutProperties","_excluded","_extends","cn","AccordionTrigger","_ref2","_excluded2","AccordionContent","_ref3","_excluded3","SearchResourcesContext","useSearchResources","AlgoliaSearchContext","AlgoliaSearchContextProvider","appId","appKey","indexName","storefrontShortname","_ref$userId","userId","client","algoliasearch","insightsClient","apiKey","useAlgoliaSearch","parseFacetValue","separatorIndex","indexOf","substring","safeUrl","input","base","Check","checked","fill","height","viewBox","width","xmlns","rx","stroke","y","strokeLinecap","c_statusLabelKeys","ShowMoreToggle","showMore","setShowMore","isShowingMore","LinkButton","as","countDepth","index","depth","getChildren","parent","_ref5","startsWith","Category","_ref8","category","setExpandedFacets","maxLevel","levels","levelsRef","useRef","current","level","refinement","limit","skipSuspense","push","useRefinementLists","accordions","root","key","label","_ref6","subCategories","_ref7","_ref4","hasChildren","c","replace","getAccordions","accordion","_resources$accordion$","tag","slice","_ref9","refine","eventName","filters","_ref0","child","forEach","_ref1","old","v","lastIndexOf","count","AuthorFacetItem","_ref10","onRefine","PublisherFacetItem","_ref11","AuthorsOrPublishers","_ref12","_resources$attribute","nameAttribute","_useRefinementList","canToggleShowMore","toggleShowMore","_useRefinementList2","idItems","FacetItem","facetItems","_parseFacetValue","idItem","sort","a","b","i","Statuses","_ref13","level1","level2","level3","level4","sections","_ref14","_resources","_c_statusLabelKeys$va","_resources2","_c_statusLabelKeys$it","UserSearchFilterAccordionItem","_ref15","_useUserSearchFilterC","selectedFilterOption","title","isSelected","onChange","type","Categories","expandedFacets","_useState3","_useState4","onValueChange","RefinementLabel","stringValue","String","AuthorLabel","PublisherLabel","AuthorApiLabel","PublisherApiLabel","_usePublisher","CurrentRefinements","currentRefinements","useCurrentRefinements","itemsByAttribute","refinementList","_currentRefinements$i","_item$refinements","refinements","itemValue","itemAndChildren","r","RefinementChip","_itemsByAttribute$att","X","CurrentQueryRefinement","_searchParams$get","urlQuery","_useSearchBox","useSearchBox","query","clear","removeQuery","SkeletonRoot","_ref$pending","pending","_ref$hideOverflow","hideOverflow","role","SkeletonBox","EnhancedForLogosLabel","useLocalization","logosOrVerbum","useBrandName","isVerbum","toLowerCase","CommandSentence","template","EnhancedForLogos","Field","name","alt","src","enhanced_for_logos_with_tooltip","Tooltip","placement","link","InfoIconSvgUrl","EnhancedForLogosTooltipContent","usdFormat","Intl","NumberFormat","style","currency","minimumFractionDigits","maximumFractionDigits","useProductCard","_pricingData$primaryS","_pricingData$primaryS2","_hit$salePrice","_hit$salePrice2","_hit$anchorPrice","_hit$anchorPrice2","_pricingData$primaryS3","_pricingData$primaryS4","_pricingData$primaryS5","_hit$title","_prices$anchorPrice","_prices$salePrice","_prices$salePrice$loc","_prices$salePrice2","_pricingData$primaryS6","_hit$isLogosEdition","hit","_ref$queryId","queryId","position","pricingData","usePricing","productId","preferredCurrency","useCurrentUser","hasGeoRestriction","isGeographicallyRestricted","isAddingToCart","setIsAddingToCart","requestIdRef","prices","primarySku","salePrice","amount","displayAmount","format","displayAmountCurrencyCode","localizedDisplayAmount","currencyCode","displayAmountByCurrency","anchorPrice","discountSavings","accessKind","hasPreorder","isPrepubProduct","prepubProductStatusSummary","skuId","isSellable","handleCartUpdated","e","detail","requestId","handleCartUpdateError","document","addEventListener","removeEventListener","slug","text","normalize","trim","slugify","productPath","productUrl","encodeURIComponent","productName","regularPrice","salePriceCurrency","localizedSalePrice","discountPercentage","anchor","sale","getSavingsPercent","isDiscounted","productImageSrc","primaryImageUri","imageSrc","detectIsAmberOptimizedUrl","isLogosEdition","handleProductClick","window","location","queryID","objectIDs","positions","handleAddToCart","_pricingData$primaryS7","eventType","eventData","Date","now","Math","random","eventDetail","addToCartUrl","routes","AddToCartUrl","skuIds","quantity","payInFull","searchData","productIds","currentTarget","dispatchEvent","CustomEvent","bubbles","ProductImage","priority","href","onAuxClick","Image","belowTheFold","sizes","mobile","tablet","desktop","targetAspectRatio","DiscountBadge","_resources$discountFo","LegacyTypography","toFixed","ProductTitle","ProductAuthors","authors","ctaButtonScale","skeletonHeightByButtonScale","small","medium","large","ProductPricing","cardData","buttonLayoutClassName","ProductPrice","ProductCta","ownershipLabelClassName","PriceLabel","layout","purchaseStatusMessage","getOwnershipLabel","Button","disabled","Skeleton","AlgoliaGridCard","_hit$averageRating","_hit$reviewCount","productInWishlist","useProductInWishList","averageRating","reviewCount","hasReviewData","hasValidReviewData","EnhancedForLogosWithTooltip","AddToWishListWithForm","StarRating","rating","PrepubProductStatusSummary","ProductOverview","overview","isExpanded","setIsExpanded","showButton","setShowButton","overviewRef","element","scrollHeight","computedLineHeight","getComputedStyle","lineHeight","parsedLineHeight","parseInt","Number","isFinite","dangerouslySetInnerHTML","__html","intent","toggleExpand","AlgoliaListCard","SkeletonBlock","rootClassName","SkeletonButton","ProductSkeleton","layoutType","ProductSkeletons","currentHitsPerPage","from","_","toProductHitResult","toString","products","wishListsProductsUrl","Card","useInstantSearch","HitComponent","_queryID","__position","__queryID","WishListProductBatchProvider","Hits","classNames","list","hitComponent","SortByAccordion","_useSortBy","useSortBy","currentRefinement","currentItem","collapsible","ViewMode","ViewModeContext","viewModeKey","viewModeValues","Object","values","ViewModeProvider","getInitialViewMode","urlViewMode","includes","cookieViewMode","Cookies","grid","viewMode","setViewMode","history","replaceState","getAllFacetingKeys","facetConfigurations","config","routeKey","flatMap","keys","minLevel","routeKeyPrefix","getUnconfiguredFacetValues","facets","configuredKeys","fromEntries","entries","has","nonFacetQueryParamNames","Set","arrayToQueryParam","array","emptyIfUndefined","getTrimmedOrUndefinedIfStringEmpty","trimmed","getMatchingCategoryPageFromRouteState","routeState","categoryPageConfigurations","allFacetingKeys","_routeState$facets","_routeState$facets2","categoryPageConfiguration","checkCategoryPageConfigurationMatches","preserveCustomQueryParams","sourceUrl","targetUrl","preserveKeys","writeFacetsSearchParams","excludedKeys","candidateQueryParamValue","writeUserFilterSearchParams","checkFacetValueConfigurationMatches","facetValueConfiguration","routeStateFacetValue","routeStateFacets","facetsConfiguration","matches","routeStateFacet","facetConfiguration","f","queryParamName","writeCommonSearchParams","sortBy","page","AlgoliaSSRProvider","AlgoliaProvider","attributesToHighlight","attributesToRetrieve","queryType","restrictSearchableAttributes","routing","searchClient","searchParameters","InstantSearch","future","preserveSharedStateOnUnmount","insights","ConfigureCore","ParameterBlacklist","mergedParams","uf","_uf$options","selectedOptionToken","o","algoliaValue","filterParts","Configure","distinct","CloseIcon","rest","fillColor","strokeWidth","FilterIcon","LayoutGridIcon","x","LayoutListIcon","_excluded4","LayoutButtons","currentLayoutType","setLayoutType","isLayoutGrid","btnClassName","DesktopSearchControl","_selectedItem$label","prefixText","testId","contentClassName","selectedItem","_items$find","selectedLabel","handleValueChange","newValue","matchedItem","DropdownMenu","DropdownMenuTrigger","DropdownMenuContent","DropdownMenuRadioGroup","DropdownMenuRadioItem","ScrollToTopOnPaginationChange","usePagination","scrollTo","top","behavior","NoResultsState","normalizedQuery","noResultsMessageTemplate","searchTips","Container","tip","assign","FilterSortLayout","_showItems$find$value","_showItems$find","enableAuthorBioView","pageLimits","sortOrders","authorBioResources","isMobileFilterOpen","setIsMobileFilterOpen","_useViewMode","useViewMode","_useScreensize","useScreensize","isMobile","isDesktop","results","useHits","lastPushedQueryRef","_results$hits","_results$query","_results$page","hits","queryKey","impressions","price","dataLayer","ecommerce","useSearchImpressions","indexUiState","previousStateRef","_indexUiState$refinem","_prevState$refinement","prevState","_indexUiState$sortBy","_indexUiState$hitsPer","selection","group","hitsPerPage","previousRefinements","allFacetKeys","facetKey","_currentRefinements$f","_previousRefinements$","currentValues","previousValues","facetGroup","facet","_indexUiState$page","useSearchAnalytics","hasNoSearchResults","__isArtificial","nbHits","shouldShowResultsRoute","sortItems","sortOrder","_resources$sortOrder$","currentSortBy","refineSortBy","hitsPerPageItems","pageLimit","default","_useHitsPerPage","useHitsPerPage","showItems","refineHitsPerPage","closeFilter","toggleFilter","filterPanelContent","Drawer","isOpen","onClose","size","zIndex","CategoryContent","newSortBy","newHitsPerPage","ProductHits","Pagination","noRefinementRoot","previousPageItem","pageItem","disabledItem","nextPageItem","showFirst","showLast","showNext","showPrevious","InstantSearchWrapper","categories","_useAlgoliaSearch3","stateMapping","sortByPrefix","configuredAlgoliaAttributes","attributes","add","algoliaAttribute","algoliaAttributeBase","getConfiguredAlgoliaAttributes","configuredRouteKeys","stateToRoute","uiState","facetValues","_indexUiState$refinem2","_indexUiState$refinem3","_indexUiState$configu","configure","disjunctiveFacetsRefinements","_facets$algoliaAttrib","routeToState","_routeState$facets3","_routeState$facets4","passthroughFacets","passthroughFacetAttributes","disjunctiveFacets","makeStateMapping","queryParamNameByTopLevelTokenMap","categoryToken","getQueryParamNameByTopLevelTokenMap","_token$split","split","_token$split2","topLevelToken","secondLevelToken","categoryPageUrl","pageTitle","convertSearchCategoriesToCategoryPageConfiguration","router","arguments","allFacetingKeysSet","userFilterKeysSet","categoryPagesByCategoryPageUrl","Map","configuration","cleanUrlOnDispose","createURL","preserveCustomKeysSet","matchingCategoryPage","currentUrl","categoryFacetKeys","err","parseURL","locationUrl","locationPathname","addRouteStateFacetValues","_routeState$facets5","_routeState$facets6","_routeState$facets6$k","queryParams","paramName","paramValue","_routeState$filters","windowTitle","makeRouter","Search","_ref12$algoliaAppId","algoliaAppId","_ref12$algoliaAppKey","algoliaAppKey","_ref12$algoliaIndexNa","algoliaIndexName","_ref12$storefrontShor","algoliaSearchParametersJson","userSearchFiltersJson","_ref12$facetConfigura","_ref12$searchCategori","searchCategories","_ref12$wishListsProdu","_ref12$enableAuthorBi","localizedResources","_safeJsonParse","safeJsonParse","_parsedFilters$filter","_parsedFilters$filter2","parsedFilters","PerUserDataContextProvider","JSON","parse"],"sourceRoot":""}