@seekora-ai/ui-sdk-react 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts +15 -2
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.js +11 -3
- package/dist/components/suggestions-primitives/SuggestionList.d.ts +13 -2
- package/dist/components/suggestions-primitives/SuggestionList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionList.js +5 -3
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts +19 -0
- package/dist/components/suggestions-primitives/highlightMarkup.d.ts.map +1 -0
- package/dist/components/suggestions-primitives/highlightMarkup.js +32 -0
- package/dist/components/suggestions-primitives/index.d.ts +2 -0
- package/dist/components/suggestions-primitives/index.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/index.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +44 -5
- package/dist/src/index.esm.js +48 -7
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +48 -6
- package/dist/src/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@seekora-ai/search-sdk")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@seekora-ai/search-sdk"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SeekoraUI={},e.React,e.ReactDOM,e.SeekoraSDK)}(this,function(e,t,r,a){"use strict";var o;!function(e){e[e.VERBOSE=0]="VERBOSE",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT"}(o||(o={}));class n{constructor(e={}){this.level=e.level??this.getDefaultLevel(),this.prefix=e.prefix??"[Seekora UI SDK]",this.enableTimestamp=e.enableTimestamp??!1}getDefaultLevel(){switch(void 0){case"VERBOSE":return o.VERBOSE;case"INFO":return o.INFO;case"WARN":return o.WARN;case"ERROR":return o.ERROR;case"SILENT":return o.SILENT}return"undefined"!=typeof window&&window.__SEEKORA_DEBUG__?o.VERBOSE:o.INFO}formatMessage(e,...t){const r=[];return this.enableTimestamp&&r.push(`[${(new Date).toISOString()}]`),r.push(this.prefix,`[${e}]`),[...r,...t]}verbose(...e){this.level<=o.VERBOSE&&console.log(...this.formatMessage("VERBOSE",...e))}info(...e){this.level<=o.INFO&&console.info(...this.formatMessage("INFO",...e))}warn(...e){this.level<=o.WARN&&console.warn(...this.formatMessage("WARN",...e))}error(...e){this.level<=o.ERROR&&console.error(...this.formatMessage("ERROR",...e))}setLevel(e){this.level=e}getLevel(){return this.level}setPrefix(e){this.prefix=e}setTimestamp(e){this.enableTimestamp=e}}let s=null;function i(){return s||(s=function(e={}){return new n(e)}()),s}const l=(...e)=>i().verbose(...e),c=(...e)=>i().info(...e),d=(...e)=>i().warn(...e),u=(...e)=>i().error(...e);function p(e){const{attribute:t,hit:r,preTag:a="<mark>",postTag:o="</mark>",fallback:n}=e,s=r._highlightResult?.[t]?.value||r.highlight_result?.[t]?.value||r._highlight?.[t]||r.highlight?.[t];if(s)return s.replace(/<em>/g,a).replace(/<\/em>/g,o).replace(/<mark>/g,a).replace(/<\/mark>/g,o);const i=(l=r,t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,l));var l;return void 0!==i?String(i):n||""}function m(e,t="<mark>",r="</mark>"){const a=[];let o=e;for(;o.length>0;){const e=o.indexOf(t);if(-1===e){o.length>0&&a.push({value:o,isHighlighted:!1});break}e>0&&a.push({value:o.substring(0,e),isHighlighted:!1});const n=o.substring(e+t.length),s=n.indexOf(r);if(-1===s){a.push({value:o.substring(e),isHighlighted:!1});break}a.push({value:n.substring(0,s),isHighlighted:!0}),o=n.substring(s+r.length)}return a}function g(e,t,r=!1){if(!t||!e)return[{value:e,isHighlighted:!1}];const a=[],o=r?"g":"gi",n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(n,o);let i,l=0;for(;null!==(i=s.exec(e));)i.index>l&&a.push({value:e.substring(l,i.index),isHighlighted:!1}),a.push({value:i[0],isHighlighted:!0}),l=s.lastIndex;return l<e.length&&a.push({value:e.substring(l),isHighlighted:!1}),a.length>0?a:[{value:e,isHighlighted:!1}]}i();class f{constructor(e){this.listeners=[],this.debounceTimer=null,this.client=e.client,this.autoSearch=!1!==e.autoSearch,this.debounceMs=e.debounceMs||300,this.defaultSearchOptions=e.defaultSearchOptions||{widget_mode:!0},this.state={query:e.initialQuery||"",refinements:[],currentPage:1,itemsPerPage:e.itemsPerPage||10,sortBy:void 0,results:null,loading:!1,error:null},c("SearchStateManager: Initialized",{autoSearch:this.autoSearch,debounceMs:this.debounceMs})}getState(){return{...this.state}}getQuery(){return this.state.query}getRefinements(){return[...this.state.refinements]}getCurrentPage(){return this.state.currentPage}getResults(){return this.state.results}getLoading(){return this.state.loading}getError(){return this.state.error}setQuery(e,t=!0){if(this.state.query===e)return l("SearchStateManager: Query unchanged, skipping update",{query:e}),void(t&&this.autoSearch&&(l("SearchStateManager: Query unchanged but triggerSearch=true, triggering search"),this.debouncedSearch()));this.state.query=e,this.state.currentPage=1,l("SearchStateManager: Query updated",{query:e,triggerSearch:t,autoSearch:this.autoSearch}),this.notifyListeners(),this.autoSearch&&t?(l("SearchStateManager: Triggering debounced search"),this.debouncedSearch()):l("SearchStateManager: Search not triggered",{autoSearch:this.autoSearch,triggerSearch:t})}addRefinement(e,t,r=!0){const a=this.state.refinements.some(r=>r.field===e&&r.value===t);a||(this.state.refinements.push({field:e,value:t}),this.state.currentPage=1,l("SearchStateManager: Refinement added",{field:e,value:t}),this.notifyListeners(),this.autoSearch&&r&&this.debouncedSearch())}removeRefinement(e,t,r=!0){const a=this.state.refinements.findIndex(r=>r.field===e&&r.value===t);-1!==a&&(this.state.refinements.splice(a,1),this.state.currentPage=1,l("SearchStateManager: Refinement removed",{field:e,value:t}),this.notifyListeners(),this.autoSearch&&r&&this.debouncedSearch())}clearRefinements(e=!0){0!==this.state.refinements.length&&(this.state.refinements=[],this.state.currentPage=1,l("SearchStateManager: Refinements cleared"),this.notifyListeners(),this.autoSearch&&e&&this.debouncedSearch())}setPage(e,t=!0){this.state.currentPage!==e&&(this.state.currentPage=e,l("SearchStateManager: Page updated",{page:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}setSortBy(e,t=!0){this.state.sortBy!==e&&(this.state.sortBy=e,this.state.currentPage=1,l("SearchStateManager: Sort updated",{sortBy:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}setItemsPerPage(e,t=!0){this.state.itemsPerPage!==e&&(this.state.itemsPerPage=e,this.state.currentPage=1,l("SearchStateManager: Items per page updated",{itemsPerPage:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}async search(e){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.setState({loading:!0,error:null});try{const t=this.buildSearchOptions(e);l("SearchStateManager: Performing search",{query:this.state.query,refinementsCount:this.state.refinements.length,currentPage:this.state.currentPage,sortBy:this.state.sortBy,filter_by:t.filter_by});const r=await this.client.search(this.state.query,t);return this.setState({results:r,loading:!1,error:null}),c("SearchStateManager: Search completed",{query:this.state.query,resultsCount:r?.results?.length||0,totalResults:r?.totalResults||0}),r}catch(e){const t=e instanceof Error?e:new Error(String(e));return this.setState({results:null,loading:!1,error:t}),u("SearchStateManager: Search failed",{query:this.state.query,error:t.message}),null}}buildSearchOptions(e){const t={...this.defaultSearchOptions,page:this.state.currentPage,per_page:this.state.itemsPerPage,...e};if(this.state.sortBy&&"relevance"!==this.state.sortBy&&(t.sort_by=this.state.sortBy),this.state.refinements.length>0){const e={};this.state.refinements.forEach(t=>{e[t.field]||(e[t.field]=[]),e[t.field].push(t.value)});const r=[];Object.entries(e).forEach(([e,t])=>{t.forEach(t=>{r.push(`${e}:${t}`)})}),r.length>0&&(t.filter_by=r.join(" && "))}return t}debouncedSearch(){this.debounceTimer&&clearTimeout(this.debounceTimer),l("SearchStateManager: Scheduling debounced search",{debounceMs:this.debounceMs}),this.debounceTimer=setTimeout(()=>{l("SearchStateManager: Debounce timer fired, calling search()"),this.search()},this.debounceMs)}subscribe(e){return this.listeners.push(e),e(this.getState()),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}setState(e){this.state={...this.state,...e},this.notifyListeners()}notifyListeners(){const e=this.getState();this.listeners.forEach(t=>{try{t(e)}catch(e){const t=e instanceof Error?e:new Error(String(e));u("SearchStateManager: Error in listener",{error:t.message})}})}clear(){this.state={query:"",refinements:[],currentPage:1,itemsPerPage:this.state.itemsPerPage,sortBy:void 0,results:null,loading:!1,error:null},this.notifyListeners()}}function h(e,t=0){return function(e,t=0){const r=3&e.length,a=e.length-r;let o=t;const n=3432918353,s=461845907;let i,l=0;for(;l<a;)i=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,i=Math.imul(i,n),i=i<<15|i>>>17,i=Math.imul(i,s),o^=i,o=o<<13|o>>>19,o=Math.imul(o,5)+3864292196;switch(i=0,r){case 3:i^=(255&e.charCodeAt(l+2))<<16;case 2:i^=(255&e.charCodeAt(l+1))<<8;case 1:i^=255&e.charCodeAt(l),i=Math.imul(i,n),i=i<<15|i>>>17,i=Math.imul(i,s),o^=i}return o^=e.length,o^=o>>>16,o=Math.imul(o,2246822507),o^=o>>>13,o=Math.imul(o,3266489909),o^=o>>>16,o>>>0}(e,t).toString(16).padStart(8,"0")}const y={enableCanvas:!0,enableWebGL:!0,enableAudio:!0,enableFonts:!0,enableHardware:!0,timeout:5e3},b=["Arial","Arial Black","Calibri","Cambria","Comic Sans MS","Consolas","Courier New","Georgia","Impact","Lucida Console","Lucida Sans Unicode","Microsoft Sans Serif","Palatino Linotype","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana","American Typewriter","Andale Mono","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arial Hebrew","Avenir","Baskerville","Big Caslon","Brush Script MT","Chalkboard","Cochin","Copperplate","Didot","Futura","Geneva","Gill Sans","Helvetica","Helvetica Neue","Herculanum","Hoefler Text","Lucida Grande","Marker Felt","Menlo","Monaco","Noteworthy","Optima","Papyrus","Phosphate","Rockwell","San Francisco","Savoye LET","SignPainter","Skia","Snell Roundhand","Zapfino","Cantarell","DejaVu Sans","DejaVu Sans Mono","DejaVu Serif","Droid Sans","Droid Sans Mono","Droid Serif","FreeMono","FreeSans","FreeSerif","Liberation Mono","Liberation Sans","Liberation Serif","Noto Sans","Noto Serif","Open Sans","Roboto","Ubuntu","Ubuntu Mono","Lato","Montserrat","Oswald","Raleway","Source Sans Pro","PT Sans","Merriweather","Nunito","Playfair Display","Poppins"];class x{constructor(e){this.cachedResult=null,this.config={...y,...e}}async get(){if(this.cachedResult)return this.cachedResult;const e=await this.collectComponents(),t=this.calculateConfidence(e),r=this.generateVisitorId(e);return this.cachedResult={visitorId:r,confidence:t,components:e},this.cachedResult}clearCache(){this.cachedResult=null}async collectComponents(){const[e,t,r,a,o]=await Promise.all([this.config.enableCanvas?this.getCanvasFingerprint():{hash:""},this.config.enableWebGL?this.getWebGLFingerprint():{renderer:"",vendor:"",hash:""},this.config.enableAudio?this.getAudioFingerprint():{hash:""},this.detectAdBlocker(),this.detectIncognito()]);return{canvas:e,webgl:t,audio:r,fonts:this.config.enableFonts?this.detectFonts():[],hardware:this.config.enableHardware?this.getHardwareInfo():{concurrency:0,deviceMemory:0,maxTouchPoints:0,platform:""},screen:this.getScreenInfo(),browser:this.getBrowserInfo(),adBlockerDetected:a,incognitoDetected:o}}async getCanvasFingerprint(){try{const e=document.createElement("canvas");e.width=256,e.height=128;const t=e.getContext("2d");if(!t)return{hash:""};t.fillStyle="#f8f8f8",t.fillRect(0,0,e.width,e.height);const r=t.createLinearGradient(0,0,e.width,0);r.addColorStop(0,"#ff6b6b"),r.addColorStop(.5,"#4ecdc4"),r.addColorStop(1,"#45b7d1"),t.fillStyle=r,t.fillRect(10,10,100,50),t.font="18px Arial",t.fillStyle="#333",t.textBaseline="alphabetic",t.fillText("Seekora Fingerprint 🔐",20,90),t.font="bold 14px Georgia",t.fillStyle="rgba(102, 204, 153, 0.7)",t.fillText("Test String @#$%",130,40),t.beginPath(),t.arc(200,70,30,0,2*Math.PI),t.fillStyle="rgba(255, 165, 0, 0.5)",t.fill(),t.strokeStyle="#333",t.lineWidth=2,t.stroke(),t.beginPath(),t.moveTo(10,120),t.bezierCurveTo(50,80,100,120,140,100),t.strokeStyle="#9b59b6",t.lineWidth=3,t.stroke(),t.save(),t.translate(180,100),t.rotate(.5),t.fillStyle="rgba(52, 152, 219, 0.6)",t.fillRect(-20,-10,40,20),t.restore();const a=e.toDataURL("image/png");return{hash:h(a),data:a}}catch{return{hash:""}}}async getWebGLFingerprint(){try{const e=document.createElement("canvas");e.width=256,e.height=256;const t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return{renderer:"",vendor:"",hash:""};const r=t.getExtension("WEBGL_debug_renderer_info"),a=r&&t.getParameter(r.UNMASKED_RENDERER_WEBGL)||"",o=r&&t.getParameter(r.UNMASKED_VENDOR_WEBGL)||"",n=[],s=[t.ALIASED_LINE_WIDTH_RANGE,t.ALIASED_POINT_SIZE_RANGE,t.ALPHA_BITS,t.BLUE_BITS,t.DEPTH_BITS,t.GREEN_BITS,t.MAX_COMBINED_TEXTURE_IMAGE_UNITS,t.MAX_CUBE_MAP_TEXTURE_SIZE,t.MAX_FRAGMENT_UNIFORM_VECTORS,t.MAX_RENDERBUFFER_SIZE,t.MAX_TEXTURE_IMAGE_UNITS,t.MAX_TEXTURE_SIZE,t.MAX_VARYING_VECTORS,t.MAX_VERTEX_ATTRIBS,t.MAX_VERTEX_TEXTURE_IMAGE_UNITS,t.MAX_VERTEX_UNIFORM_VECTORS,t.MAX_VIEWPORT_DIMS,t.RED_BITS,t.RENDERER,t.SHADING_LANGUAGE_VERSION,t.STENCIL_BITS,t.VENDOR,t.VERSION];for(const e of s)try{const r=t.getParameter(e);null!=r&&(r instanceof Float32Array||r instanceof Int32Array?n.push(Array.from(r).join(",")):n.push(String(r)))}catch{}const i=t.getSupportedExtensions()||[];n.push(i.sort().join(","));try{const e="\n attribute vec2 position;\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n }\n ",r="\n precision mediump float;\n void main() {\n gl_FragColor = vec4(0.812, 0.373, 0.784, 1.0);\n }\n ",a=t.createShader(t.VERTEX_SHADER);t.shaderSource(a,e),t.compileShader(a);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,r),t.compileShader(o);const s=t.createProgram();t.attachShader(s,a),t.attachShader(s,o),t.linkProgram(s),t.useProgram(s);const i=new Float32Array([0,.5,-.5,-.5,.5,-.5]),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW);const c=t.getAttribLocation(s,"position");t.enableVertexAttribArray(c),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.clearColor(.1,.1,.1,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLES,0,3);const d=new Uint8Array(262144);t.readPixels(0,0,256,256,t.RGBA,t.UNSIGNED_BYTE,d);const u=[0,1e3,5e3,1e4,25e3,5e4,1e5,2e5];for(const e of u)e<d.length&&n.push(String(d[e]))}catch{}const l=`${a}|${o}|${n.join("|")}`;return{renderer:a,vendor:o,hash:h(l)}}catch{return{renderer:"",vendor:"",hash:""}}}async getAudioFingerprint(){try{const e=window.AudioContext||window.webkitAudioContext;if(!e)return{hash:""};const t=new e,r=t.createOscillator();r.type="triangle",r.frequency.setValueAtTime(1e4,t.currentTime);const a=t.createDynamicsCompressor();a.threshold.setValueAtTime(-50,t.currentTime),a.knee.setValueAtTime(40,t.currentTime),a.ratio.setValueAtTime(12,t.currentTime),a.attack.setValueAtTime(0,t.currentTime),a.release.setValueAtTime(.25,t.currentTime);const o=t.createAnalyser();return o.fftSize=2048,r.connect(a),a.connect(o),o.connect(t.destination),r.start(0),new Promise(e=>{const a=setTimeout(()=>{try{r.stop(),t.close()}catch{}e({hash:""})},this.config.timeout);setTimeout(()=>{try{const n=new Float32Array(o.frequencyBinCount);o.getFloatFrequencyData(n);let s=0,i=0;for(let e=0;e<n.length;e++)isFinite(n[e])&&0!==n[e]&&(s+=Math.abs(n[e]),i++);const l=i>0?s/i:0,c=Array.from(n.slice(0,100)).filter(e=>isFinite(e)).map(e=>e.toFixed(4)).join(",");clearTimeout(a),r.stop(),t.close();const d=h(c+String(l));e({hash:d,value:l})}catch{clearTimeout(a);try{r.stop(),t.close()}catch{}e({hash:""})}},200)})}catch{return{hash:""}}}detectFonts(){const e=[];try{const t=["monospace","sans-serif","serif"],r="mmmmmmmmmmlli",a="72px",o=document.createElement("canvas");o.width=500,o.height=100;const n=o.getContext("2d");if(!n)return e;const s={};for(const e of t)n.font=`${a} ${e}`,s[e]=n.measureText(r).width;for(const o of b){let i=!1;for(const e of t){n.font=`${a} "${o}", ${e}`;if(n.measureText(r).width!==s[e]){i=!0;break}}i&&e.push(o)}}catch{}return e}getHardwareInfo(){const e=navigator;return{concurrency:e.hardwareConcurrency||0,deviceMemory:e.deviceMemory||0,maxTouchPoints:e.maxTouchPoints||0,platform:e.platform||""}}getScreenInfo(){return{width:screen.width||0,height:screen.height||0,colorDepth:screen.colorDepth||0,pixelRatio:window.devicePixelRatio||1}}getBrowserInfo(){const e=navigator;return{language:e.language||"",languages:Array.from(e.languages||[]),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"",timezoneOffset:(new Date).getTimezoneOffset(),cookieEnabled:e.cookieEnabled??!1,doNotTrack:"1"===e.doNotTrack||"yes"===e.doNotTrack}}async detectAdBlocker(){try{const e=document.createElement("div");e.className="adsbox ad-banner ad_banner textAd text_ad text-ad",e.style.cssText="position: absolute; left: -9999px; width: 1px; height: 1px;",e.innerHTML=" ",document.body.appendChild(e),await new Promise(e=>setTimeout(e,100));const t=null===e.offsetParent||0===e.offsetHeight||0===e.offsetWidth||"none"===getComputedStyle(e).display||"hidden"===getComputedStyle(e).visibility;document.body.removeChild(e);try{await fetch("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js",{method:"HEAD",mode:"no-cors"});return t}catch{return!0}}catch{return!1}}async detectIncognito(){if("storage"in navigator&&"estimate"in navigator.storage)try{const e=await navigator.storage.estimate();if(e.quota&&e.quota<136314880)return!0}catch{}try{const e=indexedDB.open("test-private-mode");return new Promise(t=>{e.onerror=()=>t(!0),e.onsuccess=()=>{e.result.close(),indexedDB.deleteDatabase("test-private-mode"),t(!1)},setTimeout(()=>t(!1),500)})}catch{return!0}}generateHash(e){return h(e)}generateVisitorId(e){const t=JSON.stringify({canvas:e.canvas.hash,webgl:e.webgl.hash,audio:e.audio.hash,fonts:e.fonts.sort().join(","),hardware:e.hardware,screen:e.screen,browser:{...e.browser,languages:e.browser.languages.sort().join(",")}});return`${h(t,0)}${h(t,1)}${h(t,2)}${h(t,3)}`}calculateConfidence(e){let t=0,r=0;return r+=.2,e.canvas.hash&&(t+=.2),r+=.2,e.webgl.hash&&e.webgl.renderer?t+=.2:e.webgl.hash&&(t+=.1),r+=.15,e.audio.hash&&(t+=.15),r+=.15,e.fonts.length>10?t+=.15:e.fonts.length>5?t+=.1:e.fonts.length>0&&(t+=.05),r+=.1,e.hardware.concurrency>0&&e.hardware.platform?t+=.1:e.hardware.platform&&(t+=.05),r+=.1,e.screen.width>0&&e.screen.height>0&&(t+=.1),r+=.1,e.browser.timezone&&e.browser.language?t+=.1:e.browser.language&&(t+=.05),Math.min(1,t/1)}}const v={colors:{primary:"#007bff",secondary:"#6c757d",background:"#ffffff",surface:"#f8f9fa",text:"#212529",textSecondary:"#6c757d",border:"#dee2e6",hover:"#f8f9fa",focus:"#007bff",error:"#dc3545",success:"#28a745",warning:"#ffc107"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{small:"0.5rem",medium:"1rem",large:"1.5rem"},borderRadius:{none:"0",small:"0.25rem",medium:"0.375rem",large:"0.5rem",full:"9999px"},shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)",medium:"0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)",large:"0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23)"},transitions:{fast:"150ms ease-in-out",normal:"250ms ease-in-out",slow:"350ms ease-in-out"},breakpoints:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},zIndex:{dropdown:1e3,modal:2e3,tooltip:3e3}},k=e=>((e,t)=>({colors:{...t.colors,...e.colors},typography:{...t.typography,...e.typography,fontSize:{...t.typography.fontSize,...e.typography?.fontSize}},spacing:{...t.spacing,...e.spacing},borderRadius:e.borderRadius??t.borderRadius,shadows:{...t.shadows,...e.shadows},transitions:{...t.transitions,...e.transitions},breakpoints:{...t.breakpoints,...e.breakpoints},zIndex:{...t.zIndex,...e.zIndex}}))(e,v),E=t.createContext(null),S=()=>{const e=t.useContext(E);if(!e){const e=new Error("useSearchContext must be used within a SearchProvider");throw u("SearchProvider: Context not available",{error:e.message}),e}return e},w=()=>{const{stateManager:e}=S(),[r,a]=t.useState(e.getState());t.useEffect(()=>e.subscribe(e=>{a(e)}),[e]);const o=t.useCallback((t,r=!0)=>{e.setQuery(t,r)},[e]),n=t.useCallback((t,r,a=!0)=>{e.addRefinement(t,r,a)},[e]),s=t.useCallback((t,r,a=!0)=>{e.removeRefinement(t,r,a)},[e]),i=t.useCallback((t=!0)=>{e.clearRefinements(t)},[e]),l=t.useCallback((t,r=!0)=>{e.setPage(t,r)},[e]),c=t.useCallback((t,r=!0)=>{e.setSortBy(t,r)},[e]),d=t.useCallback(t=>e.search(t),[e]),u=t.useCallback(()=>{e.clear()},[e]);return{query:r.query,refinements:r.refinements,currentPage:r.currentPage,itemsPerPage:r.itemsPerPage,sortBy:r.sortBy,results:r.results,loading:r.loading,error:r.error,setQuery:o,addRefinement:n,removeRefinement:s,clearRefinements:i,setPage:l,setSortBy:c,search:d,clear:u}},C=({client:e,query:r,enabled:a=!0,debounceMs:o=300,maxSuggestions:n=10})=>{const[s,i]=t.useState([]),[l,c]=t.useState(!1),[d,p]=t.useState(null),m=t.useRef(null);return t.useEffect(()=>(m.current&&clearTimeout(m.current),a&&r.trim()?(c(!0),p(null),m.current=setTimeout(async()=>{try{const t=await(e.getSuggestions?.(r,n)),a=(Array.isArray(t)?t:[]).map(e=>{const t=e.query||e.text||e,r=void 0!==e.popularity?e.popularity:void 0!==e.count?e.count:void 0;return{query:"string"==typeof t?t:String(t),count:"number"==typeof r?r:void 0,metadata:e}});i(a)}catch(e){const t=e instanceof Error?e:new Error(String(e));u("Error in useQuerySuggestions:",t),p(t),i([])}finally{c(!1)}},o),()=>{m.current&&clearTimeout(m.current)}):(i([]),c(!1),void p(null))),[e,r,a,o,n]),{suggestions:s,loading:l,error:d}};function R(e){var t,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=R(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function I(){for(var e,t,r=0,a="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=R(e))&&(a&&(a+=" "),a+=t);return a}const N=({title:e,items:r,renderItem:a,onItemClick:o,className:n,style:s,theme:i,layout:l="horizontal",currencySymbol:c="$"})=>{const{theme:d}=S(),u=i||{},p=()=>{switch(l){case"horizontal":return{flexShrink:0,width:"150px",scrollSnapAlign:"start"};case"grid":default:return{};case"list":return{display:"flex",gap:d.spacing.medium,padding:d.spacing.small,borderBottom:`1px solid ${d.colors.border}`}}};return t.createElement("div",{className:I(u.root,n),style:s},e&&t.createElement("h3",{className:u.title,style:{margin:`0 0 ${d.spacing.medium} 0`,fontSize:d.typography.fontSize.large,fontWeight:d.typography.fontWeight?.semibold||600,color:d.colors.text}},e),t.createElement("div",{className:u.list,style:(()=>{switch(l){case"horizontal":return{display:"flex",gap:d.spacing.medium,overflowX:"auto",scrollSnapType:"x mandatory",paddingBottom:d.spacing.small};case"grid":return{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:d.spacing.medium};case"list":return{display:"flex",flexDirection:"column",gap:d.spacing.small};default:return{}}})()},r.map((e,r)=>t.createElement("div",{key:e.id||r,className:u.item,onClick:()=>o?.(e,r),style:{...p(),cursor:o?"pointer":"default"}},a?a(e,r):t.createElement(T,{item:e,theme:u,currencySymbol:c,layout:l})))))},T=({item:e,theme:r,currencySymbol:a,layout:o})=>{const{theme:n}=S(),s=e.image||e.imageUrl||"",i=e.title||e.name||"",l=e.price,c="list"===o?"60px":"100%";return t.createElement(t.Fragment,null,s&&t.createElement("img",{src:s,alt:i,className:r.image,style:{width:c,height:"list"===o?"60px":"120px",objectFit:"cover",borderRadius:"string"==typeof n.borderRadius?n.borderRadius:n.borderRadius.small}}),t.createElement("div",{className:r.content,style:{flex:"list"===o?1:void 0}},t.createElement("div",{className:r.name,style:{marginTop:"list"===o?0:n.spacing.small,fontSize:n.typography.fontSize.small,fontWeight:n.typography.fontWeight?.medium||500,color:n.colors.text,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},i),void 0!==l&&t.createElement("div",{className:r.price,style:{marginTop:n.spacing.small,fontSize:n.typography.fontSize.small,fontWeight:n.typography.fontWeight?.bold||700,color:n.colors.primary}},a,"number"==typeof l?l.toFixed(2):l)))};function A(e){return{padding:e.spacing.large,textAlign:"center",color:e.colors.textSecondary}}const z="seekora_recent_searches",M=10;function _(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,JSON.stringify(t))}catch(e){d("Failed to save recent searches to localStorage",{error:e})}}function L(e){const t=e.query||e.text||String(e),r=e._highlightResult?.query?.value;return{query:t,popularity:e.popularity,count:e.instant_search?.exact_nb_hits??e.popularity??e.count,objectID:e.objectID,highlightedQuery:r?P(r):void 0,categories:e.categories?.map(e=>({value:e.value||e.name,count:e.count,path:e.path})),facets:e.instant_search?.facets||e.facets,metadata:e}}function P(e){return e.replace(/__ais-highlight__/g,"<mark>").replace(/__\/ais-highlight__/g,"</mark>")}function B(e){const t=e.metadata||{};return{id:e.id||e.objectID,objectID:e.objectID||e.id,title:e.title||e.name||e.productName||t.name||t.productName||"",name:e.name||e.title||t.name||t.productName||"",image:e.image||e.imageUrl||t.image||t.image_url||t.images?.[0]||"",price:e.price??e.sellPrice??t.sellPrice??t.price,currency:e.currency||t.currency||"",url:e.url||e.productId||t.url||t.productId||"",clicks:e.clicks,conversions:e.conversions,revenue:e.revenue,trend_score:e.trend_score,metadata:e.metadata||e}}function D(e){return{id:e.id,label:e.label,filter:e.filter,products:e.products?.map(B)||[],nb_hits:e.nb_hits,processing_time_ms:e.processing_time_ms}}function $(e){const{client:r,query:a,enabled:o=!0,debounceMs:n=200,maxSuggestions:s=10,minQueryLength:i=1,includeDropdownRecommendations:c=!1,includeDropdownProductList:d=!0,includeFilteredTabs:p=!0,includeCategories:m=!0,includeFacets:g=!1,maxCategories:f=3,maxFacets:h=5,filteredTabs:y,minPopularity:b,timeRange:x,disableTypoTolerance:v,analyticsTags:k,enableRecentSearches:E=!0,maxRecentSearches:S=M,recentSearchesKey:w=z,onSuggestionsLoaded:C,onError:R}=e,[I,N]=t.useState([]),[T,A]=t.useState(!1),[P,$]=t.useState(null),[F,W]=t.useState(null),[q,H]=t.useState([]),[O,j]=t.useState(null),[V,Q]=t.useState(0),[U,G]=t.useState(0),[K,X]=t.useState(0),[Y,J]=t.useState(""),Z=t.useRef(null),ee=t.useRef(null),te=t.useRef(!0);t.useEffect(()=>{if(E){const e=function(e){if("undefined"==typeof window)return[];try{const t=localStorage.getItem(e);return t?JSON.parse(t):[]}catch{return[]}}(w);H(e.slice(0,S))}return()=>{te.current=!1}},[E,w,S]);const re=t.useCallback(async e=>{if(r){if(!e.trim()&&i>0)return N([]),void W(null);ee.current&&ee.current.abort(),ee.current=new AbortController,A(!0),$(null);try{const t=await(r.getSuggestions?.(e,{hitsPerPage:s,include_dropdown_recommendations:c||y&&y.length>0,include_dropdown_product_list:d,include_filtered_tabs:p,include_categories:m,include_facets:g,max_categories:f,max_facets:h,filtered_tabs:y,min_popularity:b,time_range:x,disable_typo_tolerance:v,analytics_tags:k,returnFullResponse:!0}));if(!te.current)return;const a=(t.suggestions||[]).map(L);N(a);const o=t.extensions||{},n=t.results,i=Array.isArray(n?.[1]?.hits)?n[1].hits:[],u=i.length>0?i.map(e=>B(e)):[],E={trending_searches:Array.isArray(o.trending_searches)?o.trending_searches:[],top_searches:Array.isArray(o.top_searches)?o.top_searches:[],related_searches:Array.isArray(o.related_searches)?o.related_searches:[],trending_products:Array.isArray(o.trending_products)?o.trending_products.map(B):[],item_recommendations:Array.isArray(o.item_recommendations)?o.item_recommendations.map(B):[],product_hits:u.length>0?u:void 0,popular_brands:Array.isArray(o.popular_brands)?o.popular_brands:[],filtered_tabs:Array.isArray(o.filtered_tabs)?o.filtered_tabs.map(D):[],processing_time_ms:"number"==typeof o.processing_time_ms?o.processing_time_ms:void 0,cached_at:"string"==typeof o.cached_at?o.cached_at:void 0};W(E);const S=t.raw,w=S?.results,R=w?.[0]??S??{},I=e=>"number"!=typeof e||Number.isNaN(e)?0:e,T=e=>"string"==typeof e?e:"";j("number"==typeof R.processingTimeMS?R.processingTimeMS:null),Q(I(R.nbHits)||a.length),G(I(R.page)||0),X(I(R.nbPages)||1),J(T(R.query)||e),C&&C({suggestions:a,nbHits:I(R.nbHits)||a.length,page:I(R.page)||0,nbPages:I(R.nbPages)||1,hitsPerPage:I(R.hitsPerPage)||s,processingTimeMS:"number"==typeof R.processingTimeMS?R.processingTimeMS:void 0,query:T(R.query)||e,dropdownRecommendations:E,results:Array.isArray(t.results)?t.results:void 0,extensions:o}),l("Query suggestions loaded",{query:e,suggestionsCount:a.length,hasRecommendations:Object.keys(E).some(e=>Array.isArray(E[e])&&E[e].length>0)})}catch(t){if(!te.current)return;const r=t instanceof Error?t:new Error(String(t));if("AbortError"===r.name)return;u("Failed to fetch query suggestions",{query:e,error:r.message}),$(r),N([]),W(null),R&&R(r)}finally{te.current&&A(!1)}}},[r,i,s,c,d,p,m,g,f,h,y,b,x,v,k,C,R]);t.useEffect(()=>(Z.current&&clearTimeout(Z.current),!o||a.length<i?(N([]),A(!1),void $(null)):(A(!0),Z.current=setTimeout(()=>{re(a)},n),()=>{Z.current&&clearTimeout(Z.current)})),[a,o,i,n,re]);const ae=t.useCallback((e,t)=>{E&&e.trim()&&H(r=>{const a=r.filter(t=>t.query.toLowerCase()!==e.toLowerCase()),o=[{query:e.trim(),timestamp:Date.now(),resultsCount:t},...a].slice(0,S);return _(w,o),o})},[E,S,w]),oe=t.useCallback(e=>{H(t=>{const r=t.filter(t=>t.query!==e);return _(w,r),r})},[w]),ne=t.useCallback(()=>{H([]),_(w,[])},[w]),se=t.useCallback(async()=>{a.length>=i&&await re(a)},[a,i,re]),ie=F?.trending_searches||[],le=F?.top_searches||[],ce=F?.related_searches||[],de=F?.popular_brands||[],ue=F?.filtered_tabs||[],pe=t.useMemo(()=>{const e=F?.trending_products;if(e&&e.length>0)return e;const t=F?.item_recommendations;if(t&&t.length>0)return t;const r=F?.filtered_tabs?.[0];return r?.products&&r.products.length>0?r.products:F?.product_hits??[]},[F?.trending_products,F?.item_recommendations,F?.filtered_tabs,F?.product_hits]),me=t.useMemo(()=>I.length>0||q.length>0||ie.length>0||le.length>0||ce.length>0||de.length>0||ue.length>0||pe.length>0,[I,q,ie,le,ce,de,ue,pe]),ge=t.useCallback(()=>{const e=[];let t=0;return 0===a.length&&q.length>0&&q.forEach(r=>{e.push({type:"recent",index:t++,data:r})}),I.forEach(r=>{e.push({type:"suggestion",index:t++,data:r})}),ie.forEach(r=>{e.push({type:"trending",index:t++,data:r})}),pe.forEach(r=>{e.push({type:"product",index:t++,data:r})}),de.forEach(r=>{e.push({type:"brand",index:t++,data:r})}),e},[a,q,I,ie,pe,de]);return{suggestions:I,loading:T,error:P,dropdownRecommendations:F,trendingSearches:ie,topSearches:le,relatedSearches:ce,popularBrands:de,filteredTabs:ue,trendingProducts:pe,recentSearches:q,processingTimeMs:O,totalHits:V,currentPage:U,totalPages:K,originalQuery:Y,addRecentSearch:ae,removeRecentSearch:oe,clearRecentSearches:ne,refetch:se,hasContent:me,getAllNavigableItems:ge}}const F={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius, 8px)",boxShadow:"var(--seekora-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",maxHeight:"400px",overflowY:"auto",overflowX:"hidden"},sectionTitle:{fontSize:"12px",fontWeight:600,color:"var(--seekora-text-secondary, #6b7280)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"8px 16px 4px",margin:0},suggestionItem:{display:"flex",alignItems:"center",padding:"10px 16px",cursor:"pointer",transition:"background-color 150ms ease",fontSize:"14px",color:"var(--seekora-text-primary, #111827)",gap:"12px"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},suggestionQuery:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},suggestionCount:{fontSize:"12px",color:"var(--seekora-text-secondary, #9ca3af)",marginLeft:"auto",flexShrink:0},highlight:{fontWeight:600,color:"var(--seekora-text-primary, #111827)",backgroundColor:"var(--seekora-highlight-bg, #fef3c7)",padding:"0 2px",borderRadius:"2px"},recentIcon:{width:"16px",height:"16px",color:"var(--seekora-text-secondary, #9ca3af)",flexShrink:0},removeButton:{padding:"4px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-secondary, #9ca3af)",opacity:0,transition:"opacity 150ms ease, color 150ms ease"},removeButtonVisible:{opacity:1},loadingState:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 16px",color:"var(--seekora-text-secondary, #6b7280)",fontSize:"14px",gap:"8px"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px 16px",color:"var(--seekora-text-secondary, #6b7280)",fontSize:"14px",textAlign:"center"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e5e7eb)",margin:"4px 0"},footer:{borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",padding:"8px 16px",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",justifyContent:"space-between"},keyboardHint:{display:"flex",alignItems:"center",gap:"8px",fontSize:"11px"},keyboardKey:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"18px",padding:"0 4px",borderRadius:"3px",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)",border:"1px solid var(--seekora-border-color, #e5e7eb)",fontSize:"10px",fontWeight:500}},W=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),q=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),H=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),O=({style:e})=>t.createElement("svg",{style:{animation:"spin 1s linear infinite",...e},viewBox:"0 0 24 24",width:"20",height:"20"},t.createElement("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",fill:"none",opacity:"0.25"}),t.createElement("path",{fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})),j=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,maxSuggestions:n=8,minQueryLength:s=1,debounceMs:i=200,showRecentSearches:l=!0,maxRecentSearches:c=5,showCounts:d=!0,showLoading:u=!0,showEmptyState:p=!0,highlight:m={enabled:!0,preTag:"<mark>",postTag:"</mark>"},keyboardNav:g={enabled:!0},animation:f={enabled:!0,duration:150,entrance:"fade"},classNames:h={},style:y,renderSuggestion:b,renderRecentSearch:x,renderLoading:v,renderEmpty:k,footer:E,position:w="absolute",width:C="100%",zIndex:R=1e3,closeOnClickOutside:N=!0,closeOnEscape:T=!0,ariaLabel:A="Search suggestions",onSuggestionSelect:z,onRecentSearchClick:M,onRecentSearchRemove:_,onOpen:L,onClose:P,onNavigate:B}=e,{client:D,theme:j}=S(),V=t.useRef(null),[Q,U]=t.useState(-1),[G,K]=t.useState(!1),{suggestions:X,loading:Y,error:J,recentSearches:Z,addRecentSearch:ee,removeRecentSearch:te,hasContent:re}=$({client:D,query:a,enabled:o&&a.length>=s,debounceMs:i,maxSuggestions:n,minQueryLength:s,enableRecentSearches:l,maxRecentSearches:c}),ae=t.useMemo(()=>{const e=[];return l&&0===a.length&&Z.length>0&&Z.slice(0,c).forEach(t=>{e.push({type:"recent",data:t})}),X.forEach(t=>{e.push({type:"suggestion",data:t})}),e},[X,Z,a,l,c]);t.useEffect(()=>{if(o&&(re||Y))K(!0),L?.();else{if(f.enabled){const e=setTimeout(()=>K(!1),f.duration);return()=>clearTimeout(e)}K(!1),P?.()}},[o,re,Y,f.enabled,f.duration,L,P]),t.useEffect(()=>{U(-1)},[ae.length]);const oe=t.useCallback(()=>{g.enabled&&U(e=>{const t=e<ae.length-1?e+1:0;return B?.("down",t),t})},[g.enabled,ae.length,B]),ne=t.useCallback(()=>{g.enabled&&U(e=>{const t=e>0?e-1:ae.length-1;return B?.("up",t),t})},[g.enabled,ae.length,B]),se=t.useCallback(()=>{if(Q<0||Q>=ae.length)return;const e=ae[Q];if("recent"===e.type){const t=e.data;M?.(t)}else{const t=e.data;z?.(t),ee(t.query,t.count)}},[Q,ae,M,z,ee]),ie=t.useCallback(()=>{U(-1)},[]);t.useImperativeHandle(r,()=>({selectActive:se,navigateNext:oe,navigatePrevious:ne,resetSelection:ie,getActiveIndex:()=>Q,getTotalItems:()=>ae.length}),[se,oe,ne,ie,Q,ae.length]),t.useEffect(()=>{if(!N||!o)return;const e=e=>{V.current&&!V.current.contains(e.target)&&P?.()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[N,o,P]);const le=t.useCallback((e,r)=>{if(!m.enabled||!r)return e;return e.split(new RegExp(`(${r})`,"gi")).map((e,a)=>e.toLowerCase()===r.toLowerCase()?t.createElement("mark",{key:a,className:h.suggestionItemHighlight,style:F.highlight},e):e)},[m.enabled,h.suggestionItemHighlight]),ce=t.useCallback(e=>e.highlightedQuery&&m.enabled?t.createElement("span",{dangerouslySetInnerHTML:{__html:e.highlightedQuery},style:{display:"inline"}}):le(e.query,a),[m.enabled,le,a]);if(!G&&!o)return null;const de=l&&0===a.length&&Z.length>0,ue=X.length>0,pe=p&&!Y&&!de&&!ue&&a.length>=s,me=f.enabled?{opacity:o?1:0,transform:o?"translateY(0)":"translateY(-8px)",transition:`opacity ${f.duration}ms ease, transform ${f.duration}ms ease`}:{};return t.createElement("div",{ref:V,role:"listbox","aria-label":A,"aria-expanded":o,className:I("seekora-suggestions-dropdown",h.root,h.container),style:{position:w,width:C,zIndex:R,...F.container,...me,...y}},Y&&u&&t.createElement("div",{className:h.loadingState,style:F.loadingState},v?v():t.createElement(t.Fragment,null,t.createElement(O,null),t.createElement("span",null,"Searching..."))),!Y&&de&&t.createElement("div",{className:I("seekora-suggestions-section",h.section,h.recentSearches)},t.createElement("div",{className:h.sectionTitle,style:F.sectionTitle},"Recent Searches"),Z.slice(0,c).map((e,r)=>{const a=Q===r;return t.createElement("div",{key:`recent-${e.query}-${r}`,role:"option","aria-selected":a,className:I(h.recentItem,a&&h.suggestionItemActive),onClick:()=>{M?.(e)},onMouseEnter:()=>U(r)},((e,r,a)=>x?x(e,r,a):t.createElement("div",{style:{...F.suggestionItem,...a?F.suggestionItemActive:{}}},t.createElement(q,{style:F.recentIcon}),t.createElement("span",{style:F.suggestionQuery},e.query),t.createElement("button",{type:"button",onClick:t=>{t.stopPropagation(),te(e.query),_?.(e)},style:{...F.removeButton,...a?F.removeButtonVisible:{}},"aria-label":`Remove ${e.query} from recent searches`},t.createElement(H,null))))(e,r,a))})),!Y&&de&&ue&&t.createElement("div",{style:F.divider}),!Y&&ue&&t.createElement("div",{className:I("seekora-suggestions-section",h.section,h.suggestionsList)},a.length>0&&t.createElement("div",{className:h.sectionTitle,style:F.sectionTitle},"Suggestions"),X.map((e,r)=>{const o=de?Z.length+r:r,n=Q===o;return t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,className:I(h.suggestionItem,n&&h.suggestionItemActive),onClick:()=>{z?.(e),ee(e.query,e.count)},onMouseEnter:()=>U(o)},((e,r,o)=>b?b(e,r,o,e=>le(e,a)):t.createElement("div",{style:{...F.suggestionItem,...o?F.suggestionItemActive:{}}},t.createElement(W,{style:F.recentIcon}),t.createElement("span",{style:F.suggestionQuery},ce(e)),d&&void 0!==e.count&&t.createElement("span",{style:F.suggestionCount},e.count.toLocaleString())))(e,r,n))})),pe&&t.createElement("div",{className:h.emptyState,style:F.emptyState},k?k():t.createElement(t.Fragment,null,t.createElement(W,{style:{width:24,height:24,marginBottom:8,opacity:.5}}),t.createElement("span",null,'No suggestions found for "',a,'"'))),E||g.enabled&&ae.length>0?t.createElement("div",{className:h.footer,style:F.footer},E||t.createElement("div",{style:F.keyboardHint},t.createElement("span",{style:F.keyboardKey},"↑"),t.createElement("span",{style:F.keyboardKey},"↓"),t.createElement("span",null,"to navigate"),t.createElement("span",{style:F.keyboardKey},"↵"),t.createElement("span",null,"to select"),t.createElement("span",{style:F.keyboardKey},"esc"),t.createElement("span",null,"to close"))):null,t.createElement("style",null,'\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n .seekora-suggestions-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fef3c7);\n font-weight: 600;\n padding: 0 2px;\n border-radius: 2px;\n }\n .seekora-suggestions-dropdown [role="option"]:hover button {\n opacity: 1;\n }\n '))}),V=[{id:"recent",title:"Recent Searches",maxItems:5,enabled:!0,order:1},{id:"suggestions",title:"Suggestions",maxItems:8,enabled:!0,order:2},{id:"trending",title:"Trending",maxItems:5,enabled:!0,order:3},{id:"categories",title:"Categories",maxItems:6,enabled:!1,order:4}],Q={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 12px)",boxShadow:"var(--seekora-shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04))",overflow:"hidden"},header:{padding:"12px 16px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)"},content:{overflowY:"auto",overflowX:"hidden"},sectionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px 4px"},sectionTitle:{fontSize:"11px",fontWeight:600,color:"var(--seekora-text-tertiary, #9ca3af)",textTransform:"uppercase",letterSpacing:"0.05em",margin:0},sectionAction:{fontSize:"12px",color:"var(--seekora-primary, #3b82f6)",cursor:"pointer",textDecoration:"none",fontWeight:500},item:{display:"flex",alignItems:"flex-start",padding:"10px 16px",cursor:"pointer",transition:"background-color 100ms ease",gap:"12px"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},itemIcon:{width:"18px",height:"18px",color:"var(--seekora-text-secondary, #6b7280)",flexShrink:0,marginTop:"2px"},itemContent:{flex:1,minWidth:0},itemQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #111827)",fontWeight:500,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},itemCount:{fontSize:"12px",color:"var(--seekora-text-tertiary, #9ca3af)",flexShrink:0},categoriesContainer:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"6px"},categoryPill:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 8px",fontSize:"11px",fontWeight:500,color:"var(--seekora-text-secondary, #6b7280)",backgroundColor:"var(--seekora-bg-tertiary, #f3f4f6)",borderRadius:"12px",cursor:"pointer",transition:"all 100ms ease"},categoryPillHover:{backgroundColor:"var(--seekora-primary-light, #dbeafe)",color:"var(--seekora-primary, #3b82f6)"},categoryCount:{color:"var(--seekora-text-tertiary, #9ca3af)"},trendingList:{display:"flex",flexWrap:"wrap",gap:"8px",padding:"8px 16px"},trendingChip:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #374151)",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"20px",cursor:"pointer",transition:"all 150ms ease"},trendingChipHover:{borderColor:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)"},trendingIcon:{width:"14px",height:"14px",color:"var(--seekora-success, #10b981)"},trendingRank:{width:"18px",height:"18px",borderRadius:"50%",backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white",fontSize:"10px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center"},removeButton:{padding:"4px",marginLeft:"auto",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-tertiary, #9ca3af)",opacity:0,transition:"opacity 100ms ease"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e5e7eb)",margin:"4px 16px"},footer:{padding:"12px 16px",borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)"},loadingOverlay:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)"},emptyState:{padding:"32px 16px",textAlign:"center",color:"var(--seekora-text-secondary, #6b7280)"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fef9c3)",fontWeight:600,borderRadius:"2px",padding:"0 1px"}},U=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:Q.itemIcon},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),G=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:Q.itemIcon},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),K=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:Q.trendingIcon},t.createElement("path",{fillRule:"evenodd",d:"M12 7a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0V8.414l-4.293 4.293a1 1 0 01-1.414 0L8 10.414l-4.293 4.293a1 1 0 01-1.414-1.414l5-5a1 1 0 011.414 0L11 10.586 14.586 7H12z",clipRule:"evenodd"})),X=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{width:14,height:14}},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),Y=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,sections:n=V,maxSuggestionsPerSection:s=8,minQueryLength:i=0,debounceMs:l=200,includeDropdownRecommendations:c=!0,includeDropdownProductList:d=!0,includeFilteredTabs:u=!0,includeCategories:p=!0,maxCategories:m=3,showCounts:g=!0,showCategoryCounts:f=!0,showSectionHeaders:h=!0,classNames:y={},style:b,renderSuggestion:x,renderCategory:v,renderTrendingItem:k,renderRecentItem:E,header:w,footer:C,width:R="100%",maxHeight:N="480px",zIndex:T=1e3,ariaLabel:A="Search suggestions",analyticsTags:z,onSuggestionSelect:M,onCategoryClick:_,onRecentSearchClick:L,onRecentSearchRemove:P,onViewAllClick:B,onOpen:D,onClose:F}=e,{client:W}=S(),q=t.useRef(null),[H,O]=t.useState(-1),[j,Y]=t.useState(null),{suggestions:J,loading:Z,trendingSearches:ee,topSearches:te,recentSearches:re,addRecentSearch:ae,removeRecentSearch:oe,hasContent:ne}=$({client:W,query:a,enabled:o,debounceMs:l,maxSuggestions:s,minQueryLength:i,includeDropdownRecommendations:c,includeDropdownProductList:d,includeFilteredTabs:u,includeCategories:p,maxCategories:m,analyticsTags:z,enableRecentSearches:!0}),se=t.useMemo(()=>n.filter(e=>!1!==e.enabled).sort((e,t)=>(e.order||0)-(t.order||0)),[n]),ie=e=>se.find(t=>t.id===e),le=t.useMemo(()=>{const e=[];return se.forEach((t,r)=>{switch(t.id){case"recent":0===a.length&&re.slice(0,t.maxItems||5).forEach(t=>{e.push({type:"recent",data:t,sectionIndex:r})});break;case"suggestions":J.slice(0,t.maxItems||s).forEach(t=>{e.push({type:"suggestion",data:t,sectionIndex:r})});break;case"trending":0===a.length&&(ee.length>0?ee:te).slice(0,t.maxItems||5).forEach(t=>{e.push({type:"trending",data:t,sectionIndex:r})})}}),e},[se,a,re,J,ee,te,s]),ce=t.useCallback(()=>{O(e=>e<le.length-1?e+1:0)},[le.length]),de=t.useCallback(()=>{O(e=>e>0?e-1:le.length-1)},[le.length]),ue=t.useCallback(()=>{if(H<0||H>=le.length)return;const e=le[H];switch(e.type){case"recent":L?.(e.data);break;case"suggestion":M?.(e.data),ae(e.data.query,e.data.count);break;case"trending":M?.({query:e.data.query,count:e.data.count}),ae(e.data.query)}},[H,le,L,M,ae]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>H,setActiveIndex:O,selectActive:ue,navigateNext:ce,navigatePrevious:de,getTotalItems:()=>le.length}),[H,ue,ce,de,le.length]);const pe=()=>{const e=ie("recent");return!e||a.length>0||0===re.length?null:t.createElement("div",{className:I("seekora-section","seekora-section-recent",y.section)},h&&t.createElement("div",{style:Q.sectionHeader},t.createElement("h3",{style:Q.sectionTitle},e.title||"Recent Searches"),re.length>(e.maxItems||5)&&t.createElement("button",{style:Q.sectionAction,onClick:()=>B?.("recent")},"View all")),re.slice(0,e.maxItems||5).map((e,r)=>{const a=((e,t)=>{let r=0;for(const a of le){if(se[a.sectionIndex].id===e)return r+t;a.sectionIndex<se.findIndex(t=>t.id===e)&&r++}return r+t})("recent",r),o=H===a;return t.createElement("div",{key:`recent-${e.query}`,role:"option","aria-selected":o,style:{...Q.item,...o?Q.itemActive:{}},onClick:()=>{L?.(e)},onMouseEnter:()=>O(a),className:I(y.recentItem,o&&y.suggestionItemActive)},E?E(e):t.createElement(t.Fragment,null,t.createElement(G,null),t.createElement("div",{style:Q.itemContent},t.createElement("p",{style:Q.itemQuery},e.query)),t.createElement("button",{style:Q.removeButton,onClick:t=>{t.stopPropagation(),oe(e.query),P?.(e)},"aria-label":"Remove"},t.createElement(X,null))))}))},me=()=>{const e=ie("suggestions");return e&&0!==J.length?t.createElement("div",{className:I("seekora-section","seekora-section-suggestions",y.section)},h&&a.length>0&&t.createElement("div",{style:Q.sectionHeader},t.createElement("h3",{style:Q.sectionTitle},e.title||"Suggestions")),J.slice(0,e.maxItems||s).map((e,r)=>{const o=le.findIndex((e,t)=>"suggestion"===e.type&&le.slice(0,t).filter(e=>"suggestion"===e.type).length===r),n=H===o;return t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,style:{...Q.item,...n?Q.itemActive:{}},onClick:()=>{M?.(e),ae(e.query,e.count)},onMouseEnter:()=>O(o),className:I(y.suggestionItem,n&&y.suggestionItemActive)},x?x(e,n):t.createElement(t.Fragment,null,t.createElement(U,null),t.createElement("div",{style:Q.itemContent},t.createElement("p",{style:Q.itemQuery},(s=e.query,a?s.split(new RegExp(`(${a})`,"gi")).map((e,r)=>e.toLowerCase()===a.toLowerCase()?t.createElement("span",{key:r,style:Q.highlight},e):e):s)),p&&e.categories&&e.categories.length>0&&t.createElement("div",{style:Q.categoriesContainer},e.categories.slice(0,m).map((e,r)=>v?v(e):t.createElement("span",{key:`cat-${r}`,style:{...Q.categoryPill,...j===e.value?Q.categoryPillHover:{}},onClick:t=>{t.stopPropagation(),_?.(e)},onMouseEnter:()=>Y(e.value),onMouseLeave:()=>Y(null)},e.value,f&&void 0!==e.count&&t.createElement("span",{style:Q.categoryCount},"(",e.count,")"))))),g&&void 0!==e.count&&t.createElement("span",{style:Q.itemCount},e.count.toLocaleString())));var s})):null};if(!o)return null;return ne||Z||0===a.length?t.createElement("div",{ref:q,role:"listbox","aria-label":A,className:I("seekora-rich-suggestions",y.root,y.container),style:{position:"absolute",width:R,zIndex:T,...Q.container,...b}},w&&t.createElement("div",{style:Q.header},w),t.createElement("div",{style:{...Q.content,maxHeight:N}},Z&&t.createElement("div",{style:Q.loadingOverlay},t.createElement("span",null,"Loading...")),se.map((e,r)=>{let o=null;switch(e.id){case"recent":o=pe();break;case"suggestions":o=me();break;case"trending":o=(()=>{const e=ie("trending"),r=ee.length>0?ee:te;return!e||a.length>0||0===r.length?null:t.createElement("div",{className:I("seekora-section","seekora-section-trending",y.section)},h&&t.createElement("div",{style:Q.sectionHeader},t.createElement("h3",{style:Q.sectionTitle},e.title||"Trending")),t.createElement("div",{style:Q.trendingList},r.slice(0,e.maxItems||5).map((e,r)=>{const a=le.findIndex((e,t)=>"trending"===e.type&&le.slice(0,t).filter(e=>"trending"===e.type).length===r),o=H===a;return k?k(e,r):t.createElement("button",{key:`trending-${e.query}`,style:{...Q.trendingChip,...o?Q.trendingChipHover:{}},onClick:()=>{M?.({query:e.query,count:e.count}),ae(e.query)},onMouseEnter:()=>O(a),className:I(y.trendingItem,o&&y.suggestionItemActive)},t.createElement("span",{style:Q.trendingRank},r+1),t.createElement("span",null,e.query),t.createElement(K,null))})))})()}return o?t.createElement(t.Fragment,{key:e.id},r>0&&t.createElement("div",{style:Q.divider}),o):null}),!Z&&a.length>0&&0===J.length&&t.createElement("div",{style:Q.emptyState},t.createElement("p",null,'No suggestions found for "',a,'"'))),C&&t.createElement("div",{style:Q.footer},C),t.createElement("style",null,'\n .seekora-rich-suggestions [role="option"]:hover button {\n opacity: 1;\n }\n .seekora-rich-suggestions mark {\n background-color: var(--seekora-highlight-bg, #fef9c3);\n font-weight: 600;\n border-radius: 2px;\n padding: 0 1px;\n }\n ')):null}),J={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 12px)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",overflow:"hidden"},header:{padding:"12px 20px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)"},content:{display:"flex",overflowY:"auto"},contentStacked:{flexDirection:"column"},suggestionsColumn:{borderRight:"1px solid var(--seekora-border-color, #e5e7eb)",overflowY:"auto"},productsColumn:{flex:1,overflowY:"auto",backgroundColor:"var(--seekora-bg-secondary, #fafafa)"},section:{padding:"12px 0"},sectionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 20px 8px"},sectionTitle:{fontSize:"11px",fontWeight:700,color:"var(--seekora-text-tertiary, #9ca3af)",textTransform:"uppercase",letterSpacing:"0.08em",margin:0},viewAllLink:{fontSize:"12px",color:"var(--seekora-primary, #3b82f6)",textDecoration:"none",fontWeight:600,cursor:"pointer"},suggestionItem:{display:"flex",alignItems:"center",padding:"10px 20px",cursor:"pointer",transition:"background-color 100ms ease",gap:"12px"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},suggestionIcon:{width:"16px",height:"16px",color:"var(--seekora-text-secondary, #6b7280)",flexShrink:0},suggestionText:{flex:1,fontSize:"14px",color:"var(--seekora-text-primary, #111827)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},suggestionArrow:{width:"16px",height:"16px",color:"var(--seekora-text-tertiary, #d1d5db)",opacity:0,transition:"opacity 100ms ease"},suggestionArrowVisible:{opacity:1},suggestionCount:{fontSize:"12px",color:"var(--seekora-text-tertiary, #9ca3af)"},tabsContainer:{display:"flex",gap:"4px",padding:"12px 20px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",overflowX:"auto"},tab:{display:"flex",alignItems:"center",gap:"6px",padding:"8px 16px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-secondary, #6b7280)",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:"20px",cursor:"pointer",whiteSpace:"nowrap",transition:"all 150ms ease"},tabActive:{color:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)",borderColor:"var(--seekora-primary, #3b82f6)"},tabCount:{fontSize:"11px",fontWeight:600,padding:"2px 6px",borderRadius:"10px",backgroundColor:"var(--seekora-bg-tertiary, #e5e7eb)"},tabCountActive:{backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white"},productsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(140px, 1fr))",gap:"16px",padding:"16px 20px"},productCard:{display:"flex",flexDirection:"column",backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRadius:"8px",overflow:"hidden",cursor:"pointer",transition:"transform 150ms ease, box-shadow 150ms ease",border:"1px solid var(--seekora-border-color, #e5e7eb)"},productCardHover:{transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)"},productImage:{width:"100%",aspectRatio:"1",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"},productInfo:{padding:"10px"},productTitle:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #111827)",margin:0,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",lineHeight:1.3},productPrice:{fontSize:"14px",fontWeight:700,color:"var(--seekora-primary, #3b82f6)",marginTop:"4px"},brandsGrid:{display:"flex",flexWrap:"wrap",gap:"8px",padding:"8px 20px 16px"},brandChip:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #374151)",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"8px",cursor:"pointer",transition:"all 150ms ease"},brandChipHover:{borderColor:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)"},brandLogo:{width:"20px",height:"20px",borderRadius:"4px",objectFit:"contain",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"},footer:{padding:"12px 20px",borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fef9c3)",fontWeight:600,padding:"0 2px",borderRadius:"2px"}},Z=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...J.suggestionIcon,...e}},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),ee=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...J.suggestionIcon,...e}},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),te=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...J.suggestionArrow,...e}},t.createElement("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})),re=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{width:"40%",height:"40%",color:"#d1d5db"}},t.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2",strokeWidth:"2"}),t.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5",strokeWidth:"2"}),t.createElement("polyline",{points:"21 15 16 10 5 21",strokeWidth:"2"})),ae=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,maxSuggestions:n=8,maxProducts:s=8,maxBrands:i=8,minQueryLength:l=0,debounceMs:c=200,filteredTabs:d,showProducts:u=!0,showBrands:p=!0,showFilteredTabs:m=!0,showRecentSearches:g=!0,layout:f="side-by-side",productsColumnWidth:h="60%",suggestionsColumnWidth:y="40%",showPrices:b=!0,currencySymbol:x="$",classNames:v={},style:k,renderProduct:E,renderSuggestion:w,renderBrand:C,renderTab:R,header:N,footer:T,viewAllProductsLink:A,width:z="800px",maxHeight:M="600px",zIndex:_=1e3,analyticsTags:L,includeFacets:P=!0,includeCategories:B=!0,includeDropdownRecommendations:D=!0,onSuggestionSelect:F,onProductClick:W,onBrandClick:q,onTabSelect:H,onRecentSearchClick:O,onRecentSearchRemove:j,onViewAllClick:V,onOpen:Q,onClose:U}=e,{client:G}=S(),K=t.useRef(null),[X,Y]=t.useState(-1),[ae,oe]=t.useState("all"),[ne,se]=t.useState(null),[ie,le]=t.useState(null),{suggestions:ce,loading:de,filteredTabs:ue,trendingProducts:pe,popularBrands:me,recentSearches:ge,addRecentSearch:fe,removeRecentSearch:he,hasContent:ye}=$({client:G,query:a,enabled:o,debounceMs:c,maxSuggestions:n,minQueryLength:l,includeDropdownRecommendations:D,includeCategories:B,includeFacets:P,filteredTabs:d,analyticsTags:L,enableRecentSearches:g}),be=t.useMemo(()=>{if("all"===ae){const e=[...pe];return ue.forEach(t=>{t.products&&t.products.forEach(t=>{e.find(e=>e.id===t.id)||e.push(t)})}),e.slice(0,s)}const e=ue.find(e=>e.id===ae);return e?.products?.slice(0,s)||[]},[ae,ue,pe,s]),xe=t.useMemo(()=>{const e=[];return 0===a.length&&g&&ge.slice(0,5).forEach(t=>{e.push({type:"recent",data:t})}),ce.forEach(t=>{e.push({type:"suggestion",data:t})}),e},[a,g,ge,ce]),ve=t.useCallback(()=>{Y(e=>e<xe.length-1?e+1:0)},[xe.length]),ke=t.useCallback(()=>{Y(e=>e>0?e-1:xe.length-1)},[xe.length]),Ee=t.useCallback(()=>{if(X<0||X>=xe.length)return;const e=xe[X];"recent"===e.type?O?.(e.data):"suggestion"===e.type&&(F?.(e.data),fe(e.data.query))},[X,xe,O,F,fe]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>X,setActiveIndex:Y,selectActive:Ee,navigateNext:ve,navigatePrevious:ke,getActiveTab:()=>ae,setActiveTab:oe}),[X,Ee,ve,ke,ae]);const Se=e=>{oe(e);const t=ue.find(t=>t.id===e);t&&H?.(t)};if(!o)return null;const we=m&&(ue.length>0||pe.length>0),Ce=u&&be.length>0,Re=p&&me.length>0,Ie=g&&0===a.length&&ge.length>0,Ne=ce.length>0,Te="stacked"===f||"full-width"===f;return t.createElement("div",{ref:K,role:"listbox","aria-label":"Search suggestions and products",className:I("seekora-federated-dropdown",v.root,v.container),style:{position:"absolute",width:z,zIndex:_,...J.container,...k}},N&&t.createElement("div",{style:J.header},N),we&&t.createElement("div",{style:J.tabsContainer,className:v.tabsList},t.createElement("button",{style:{...J.tab,..."all"===ae?J.tabActive:{}},onClick:()=>Se("all"),className:I(v.tabItem,"all"===ae&&v.tabActive)},"All Results",pe.length>0&&t.createElement("span",{style:{...J.tabCount,..."all"===ae?J.tabCountActive:{}}},pe.length,"+")),ue.map(e=>R?R(e,ae===e.id):t.createElement("button",{key:e.id,style:{...J.tab,...ae===e.id?J.tabActive:{}},onClick:()=>Se(e.id),className:I(v.tabItem,ae===e.id&&v.tabActive)},e.label,void 0!==e.nb_hits&&t.createElement("span",{style:{...J.tabCount,...ae===e.id?J.tabCountActive:{}}},e.nb_hits)))),t.createElement("div",{style:{...J.content,...Te?J.contentStacked:{},maxHeight:M}},t.createElement("div",{style:{...J.suggestionsColumn,width:Te?"100%":y,minWidth:Te?void 0:"280px",borderRight:Te?"none":J.suggestionsColumn.borderRight}},Ie&&t.createElement("div",{style:J.section,className:v.recentSearches},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},"Recent Searches")),ge.slice(0,5).map((e,r)=>{const a=X===r;return t.createElement("div",{key:`recent-${e.query}`,role:"option","aria-selected":a,style:{...J.suggestionItem,...a?J.suggestionItemActive:{}},onClick:()=>O?.(e),onMouseEnter:()=>Y(r),className:I(v.recentItem,a&&v.suggestionItemActive)},t.createElement(ee,null),t.createElement("span",{style:J.suggestionText},e.query),t.createElement(te,{style:a?J.suggestionArrowVisible:{}}))})),Ne&&t.createElement("div",{style:J.section,className:v.suggestionsList},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},a?"Suggestions":"Popular Searches")),ce.slice(0,n).map((e,r)=>{const o=Ie?ge.length+r:r,n=X===o;return w?w(e,r,n):t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,style:{...J.suggestionItem,...n?J.suggestionItemActive:{}},onClick:()=>{F?.(e),fe(e.query)},onMouseEnter:()=>Y(o),className:I(v.suggestionItem,n&&v.suggestionItemActive)},t.createElement(Z,null),t.createElement("span",{style:J.suggestionText},(s=e.query,a?s.split(new RegExp(`(${a})`,"gi")).map((e,r)=>e.toLowerCase()===a.toLowerCase()?t.createElement("span",{key:r,style:J.highlight},e):e):s)),void 0!==e.count&&t.createElement("span",{style:J.suggestionCount},e.count.toLocaleString()),t.createElement(te,{style:n?J.suggestionArrowVisible:{}}));var s})),Re&&t.createElement("div",{style:J.section,className:v.brandsList},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},"Popular Brands")),t.createElement("div",{style:J.brandsGrid},me.slice(0,i).map((e,r)=>C?C(e,r):t.createElement("button",{key:`brand-${e.name}`,style:{...J.brandChip,...ie===e.name?J.brandChipHover:{}},onClick:()=>q?.(e),onMouseEnter:()=>le(e.name),onMouseLeave:()=>le(null),className:v.brandItem},e.logo&&t.createElement("img",{src:e.logo,alt:e.name,style:J.brandLogo,onError:e=>{e.target.style.display="none"}}),t.createElement("span",null,e.name)))))),Ce&&!Te&&t.createElement("div",{style:{...J.productsColumn,width:h}},t.createElement("div",{style:J.section},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},"all"===ae?"Trending Products":`Products in ${ue.find(e=>e.id===ae)?.label||ae}`),A&&t.createElement("a",{href:A,style:J.viewAllLink,onClick:e=>{e.preventDefault(),V?.("products")}},"View all")),t.createElement("div",{style:J.productsGrid,className:v.productsList},be.map((e,r)=>{return E?E(e,r):t.createElement("div",{key:e.id||e.objectID,style:{...J.productCard,...ne===e.id?J.productCardHover:{}},onClick:()=>W?.(e),onMouseEnter:()=>se(e.id),onMouseLeave:()=>se(null),className:v.productItem},e.image?t.createElement("img",{src:e.image,alt:e.title||e.name||"",style:J.productImage,onError:e=>{e.target.style.display="none"}}):t.createElement("div",{style:{...J.productImage,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(re,null)),t.createElement("div",{style:J.productInfo},t.createElement("h4",{style:J.productTitle},e.title||e.name),b&&void 0!==e.price&&t.createElement("p",{style:J.productPrice},(a=e.price,o=e.currency,void 0===a?"":`${o||x}${a.toLocaleString()}`))));var a,o}))))),T?t.createElement("div",{style:J.footer},T):t.createElement("div",{style:J.footer},t.createElement("span",null,"Press ↵ to search, ↑↓ to navigate"),a&&t.createElement("button",{style:{...J.viewAllLink,background:"none",border:"none"},onClick:()=>V?.("suggestions")},'See all results for "',a,'"')),t.createElement("style",null,'\n .seekora-federated-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fef9c3);\n font-weight: 600;\n border-radius: 2px;\n padding: 0 2px;\n }\n .seekora-federated-dropdown [role="option"]:hover svg:last-child {\n opacity: 1;\n }\n '))}),oe="suggestions.click",ne="suggestions.impression",se="suggestions.product_click",ie="suggestions.category_click",le="suggestions.brand_click",ce="suggestions.tab_select",de="suggestions.recent_click",ue="suggestions.trending_click",pe="suggestions.search_submit",me="suggestions.dropdown_open",ge="suggestions.dropdown_close";function fe(e){const{client:r,enabled:a=!0,analyticsTags:o=[],impressionDebounce:n=500,trackImpressions:s=!0,trackClicks:i=!0,context:c}=e,u=t.useRef(null),p=t.useRef(null),m=t.useRef(null);t.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const g=t.useCallback(async(e,t,n)=>{if(!a||!r)return;const s=n??c;try{await(r.trackEvent?.({event_name:e,analytics_tags:o,metadata:{...t,timestamp:Date.now(),source:"suggestions_dropdown"}},s)),l(`Analytics: ${e}`,t)}catch(t){d(`Failed to track ${e}`,{error:t})}},[r,a,o,c]);return{trackSuggestionClick:t.useCallback(e=>{i&&g(oe,{suggestion_query:e.suggestion.query,suggestion_id:e.suggestion.objectID,suggestion_popularity:e.suggestion.popularity,position:e.position,section:e.section||"suggestions",original_query:e.query,total_suggestions:e.totalSuggestions})},[g,i]),trackProductClick:t.useCallback(e=>{if(!i)return;g(se,{product_id:e.product.id||e.product.objectID,product_title:e.product.title||e.product.name,product_price:e.product.price,position:e.position,section:e.section||"products",tab_id:e.tabId,original_query:e.query});const t=c;r?.trackClick&&Promise.resolve(r.trackClick(e.product.id||e.product.objectID||"",e.position+1,t)).catch(()=>{})},[r,c,g,i]),trackCategoryClick:t.useCallback((e,t)=>{i&&g(ie,{category_value:e.value,category_count:e.count,category_path:e.path,original_query:t})},[g,i]),trackBrandClick:t.useCallback((e,t)=>{i&&g(le,{brand_name:e.name,brand_count:e.count,original_query:t})},[g,i]),trackTabSelect:t.useCallback((e,t)=>{g(ce,{tab_id:e.id,tab_label:e.label,tab_filter:e.filter,products_count:e.products?.length||0,nb_hits:e.nb_hits,original_query:t})},[g]),trackRecentSearchClick:t.useCallback(e=>{i&&g(de,{query:e.query,original_timestamp:e.timestamp,results_count:e.resultsCount})},[g,i]),trackTrendingClick:t.useCallback((e,t)=>{i&&g(ue,{query:e.query,count:e.count,trend_score:e.trend_score,position:t})},[g,i]),trackImpression:t.useCallback(e=>{if(!s)return;const t=`${e.query}:${e.suggestions.length}:${e.products?.length||0}`;t!==p.current&&(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{p.current=t,g(ne,{query:e.query,suggestions_count:e.suggestions.length,suggestions:e.suggestions.slice(0,10).map((e,t)=>({query:e.query,position:t,popularity:e.popularity})),products_count:e.products?.length||0,categories_count:e.categories?.length||0,brands_count:e.brands?.length||0,impression_timestamp:e.timestamp})},n))},[g,s,n]),trackSearchSubmit:t.useCallback((e,t,r)=>{g(pe,{query:e,from_suggestion:t,suggestion_query:r?.query,suggestion_id:r?.objectID,suggestion_popularity:r?.popularity})},[g]),trackDropdownOpen:t.useCallback(e=>{m.current=Date.now(),g(me,{query:e,has_query:e.length>0})},[g]),trackDropdownClose:t.useCallback((e,t)=>{const r=m.current?Date.now()-m.current:null;g(ge,{query:e,selected_suggestion:t,had_selection:!!t,duration_ms:r}),m.current=null},[g])}}const he={wrapper:{position:"relative",width:"100%"},inputWrapper:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 8px)",overflow:"hidden",transition:"border-color 150ms ease, box-shadow 150ms ease"},inputWrapperFocused:{borderColor:"var(--seekora-primary, #3b82f6)",boxShadow:"0 0 0 3px var(--seekora-primary-light, rgba(59, 130, 246, 0.1))"},input:{flex:1,padding:"12px 16px",fontSize:"16px",border:"none",outline:"none",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",fontFamily:"inherit"},searchIcon:{width:"20px",height:"20px",color:"var(--seekora-text-secondary, #9ca3af)",marginLeft:"12px",flexShrink:0},clearButton:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",marginRight:"4px",padding:0,border:"none",backgroundColor:"transparent",color:"var(--seekora-text-secondary, #9ca3af)",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms ease, color 150ms ease"},searchButton:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"12px 20px",margin:"4px",border:"none",backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white",borderRadius:"var(--seekora-border-radius, 6px)",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"background-color 150ms ease"}},ye=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:he.searchIcon},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),be=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{width:16,height:16}},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),xe=t.forwardRef(function(e,r){const{variant:a="classic",placeholder:o="Search...",initialQuery:n="",value:s,onQueryChange:i,onSearch:l,onSuggestionSelect:c,onProductClick:d,showSearchButton:u=!1,searchButtonText:p="Search",showClearButton:m=!0,autoFocus:g=!1,minQueryLength:f=1,maxSuggestions:h=8,maxProducts:y=8,debounceMs:b=200,showRecentSearches:x=!0,showTrendingOnEmpty:v=!0,includeDropdownRecommendations:k=!1,filteredTabs:E,enableAnalytics:w=!0,analyticsTags:C,includeFacets:R,includeCategories:N,dropdownWidth:T,dropdownMaxHeight:A,classNames:z={},style:M,inputStyle:_,ariaLabel:L="Search"}=e,{client:P}=S(),B=t.useRef(null),D=t.useRef(null),[$,F]=t.useState(s??n),[W,q]=t.useState(!1),[H,O]=t.useState(!1),V=fe({client:P,enabled:w,analyticsTags:C});t.useEffect(()=>{void 0!==s&&s!==$&&F(s)},[s]);const Q=t.useCallback(e=>{const t=e.target.value;F(t),i?.(t),(t.length>=f||v&&0===t.length)&&O(!0)},[i,f,v]),U=t.useCallback(e=>{e?.preventDefault(),$.trim()&&(l?.($.trim()),V.trackSearchSubmit($.trim(),!1),O(!1))},[$,l,V]),G=t.useCallback(e=>{F(e.query),i?.(e.query),c?.(e),V.trackSuggestionClick({suggestion:e,position:0,query:$}),O(!1),l?.(e.query)},[$,i,c,l,V]),K=t.useCallback(e=>{d?.(e),V.trackProductClick({product:e,position:0,query:$}),O(!1)},[$,d,V]),X=t.useCallback(e=>{F(e.query),i?.(e.query),V.trackRecentSearchClick(e),O(!1),l?.(e.query)},[i,l,V]),J=t.useCallback(()=>{q(!0),O(!0),V.trackDropdownOpen($)},[$,V]),Z=t.useCallback(()=>{q(!1),setTimeout(()=>{O(!1),V.trackDropdownClose($)},200)},[$,V]),ee=t.useCallback(()=>{F(""),i?.(""),B.current?.focus()},[i]),te=t.useCallback(e=>{if(H)switch(e.key){case"ArrowDown":e.preventDefault(),D.current?.navigateNext?.();break;case"ArrowUp":e.preventDefault(),D.current?.navigatePrevious?.();break;case"Enter":e.preventDefault(),(D.current?.getActiveIndex?.()??-1)>=0?D.current?.selectActive?.():U();break;case"Escape":e.preventDefault(),O(!1),B.current?.blur()}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key||O(!0)},[H,U]);t.useImperativeHandle(r,()=>({focus:()=>B.current?.focus(),blur:()=>B.current?.blur(),clear:ee,getQuery:()=>$,setQuery:e=>{F(e),i?.(e)},openDropdown:()=>O(!0),closeDropdown:()=>O(!1),navigateNext:()=>D.current?.navigateNext?.(),navigatePrevious:()=>D.current?.navigatePrevious?.(),selectCurrent:()=>D.current?.selectActive?.()}),[$,ee,i]);return t.createElement("div",{className:I("seekora-search-bar-with-suggestions",z.wrapper),style:{...he.wrapper,...M}},t.createElement("form",{onSubmit:U},t.createElement("div",{style:{...he.inputWrapper,...W?he.inputWrapperFocused:{}}},t.createElement(ye,null),t.createElement("input",{ref:B,type:"text",value:$,onChange:Q,onFocus:J,onBlur:Z,onKeyDown:te,placeholder:o,autoFocus:g,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":L,"aria-expanded":H,"aria-haspopup":"listbox","aria-autocomplete":"list",role:"combobox",className:z.input,style:{...he.input,..._}}),m&&$&&t.createElement("button",{type:"button",onClick:ee,className:z.clearButton,style:he.clearButton,"aria-label":"Clear search"},t.createElement(be,null)),u&&t.createElement("button",{type:"submit",className:z.button,style:he.searchButton},p))),t.createElement("div",{className:z.dropdown},(()=>{const e={query:$,isOpen:H,maxSuggestions:h,minQueryLength:f,debounceMs:b,showRecentSearches:x,classNames:z,onSuggestionSelect:G,onRecentSearchClick:X,onClose:()=>O(!1),analyticsTags:C};switch(a){case"rich":return t.createElement(Y,{ref:D,...e,includeDropdownRecommendations:k,includeCategories:!0,width:T||"100%",maxHeight:A||"480px"});case"federated":return t.createElement(ae,{ref:D,...e,maxProducts:y,filteredTabs:E,showProducts:!0,showBrands:!0,showFilteredTabs:!!E,onProductClick:K,width:T||"800px",maxHeight:A||"600px",includeFacets:R,includeCategories:N,includeDropdownRecommendations:k});case"compact":return t.createElement(j,{ref:D,...e,maxSuggestions:5,showCounts:!1,width:T||"100%"});default:return t.createElement(j,{ref:D,...e,width:T||"100%"})}})()))}),ve=t.createContext(null);function ke(){const e=t.useContext(ve);if(!e){const e=new Error("useSuggestionsContext must be used within a SuggestionsProvider");throw u("SuggestionsContext: not available",{error:e.message}),e}return e}function Ee({children:e,minQueryLength:r=1,debounceMs:a=200,maxSuggestions:o=10,includeDropdownRecommendations:n=!0,filteredTabs:s,enableAnalytics:i=!0,analyticsTags:l,onSearch:c,onSuggestionSelect:d,onProductClick:u}){const{client:p}=S(),[m,g]=t.useState(""),[f,h]=t.useState(!1),[y,b]=t.useState(-1),[x,v]=t.useState(""),k=$({client:p,query:m,enabled:f,minQueryLength:r,debounceMs:a,maxSuggestions:o,includeDropdownRecommendations:n,filteredTabs:s,includeCategories:!0,enableRecentSearches:!0,maxRecentSearches:8,analyticsTags:l}),E=fe({client:p,enabled:i,analyticsTags:l,trackClicks:!0,trackImpressions:!0}),{suggestions:w,recentSearches:C,trendingSearches:R,trendingProducts:I,filteredTabs:N,loading:T,error:A,hasContent:z,getAllNavigableItems:M,addRecentSearch:_}=k,L=t.useRef(c),P=t.useRef(d),B=t.useRef(u);L.current=c,P.current=d,B.current=u;const D=t.useCallback(e=>{g(e),b(-1)},[]),F=t.useCallback(()=>{E.trackDropdownClose(m),h(!1),b(-1)},[E,m]),W=t.useCallback(e=>{e?(h(!0),E.trackDropdownOpen(m)):F()},[E,m,F]),q=t.useCallback((e,t)=>{E.trackSuggestionClick({suggestion:e,position:t,query:m,totalSuggestions:w.length}),D(e.query),P.current?.(e),E.trackSearchSubmit(e.query,!0,e),_(e.query),F(),L.current?.(e.query)},[E,m,w.length,_,F]),H=t.useCallback((e,t,r,a)=>{E.trackProductClick({product:e,position:t,section:r??"products",tabId:a,query:m}),F(),B.current?.(e)},[E,m,F]),O=t.useCallback(e=>{E.trackRecentSearchClick(e),D(e.query),F(),L.current?.(e.query),E.trackSearchSubmit(e.query,!1)},[E,F]),j=t.useCallback((e,t)=>{E.trackTrendingClick(e,t),D(e.query),F(),L.current?.(e.query),E.trackSearchSubmit(e.query,!1)},[E,F]),V=t.useCallback(e=>{v(e.id),E.trackTabSelect(e,m)},[E,m]),Q=t.useCallback((e,t,r)=>{const a=e.trim();a&&(E.trackSearchSubmit(a,!!t,r),_(a),F(),L.current?.(a))},[E,_,F]),U=t.useCallback(()=>{const e=M();0!==e.length&&b(t=>t<e.length-1?t+1:0)},[M]),G=t.useCallback(()=>{const e=M();0!==e.length&&b(t=>t<=0?e.length-1:t-1)},[M]),K=t.useCallback(()=>{const e=M();if(y<0||y>=e.length)return void Q(m);const t=e[y];switch(t.type){case"suggestion":q(t.data,t.index);break;case"product":H(t.data,t.index,"products");break;case"recent":O(t.data);break;case"trending":j(t.data,t.index);break;default:Q(m)}},[y,M,m,Q,q,H,O,j]);t.useEffect(()=>{f&&z&&m&&E.trackImpression({suggestions:w,products:I,query:m,timestamp:Date.now()})},[f,z,m,w,I,E]);const X=t.useMemo(()=>({query:m,setQuery:D,isOpen:f,setIsOpen:W,activeIndex:y,setActiveIndex:b,suggestions:w,recentSearches:C,trendingSearches:R,trendingProducts:I,filteredTabs:N,activeTabId:x,setActiveTabId:v,loading:T,error:A,hasContent:z,getAllNavigableItems:M,selectSuggestion:q,selectProduct:H,selectRecentSearch:O,selectTrendingSearch:j,setActiveTab:V,submitSearch:Q,close:F,navigateNext:U,navigatePrev:G,selectActive:K}),[m,D,f,W,y,b,w,C,R,I,N,x,v,T,A,z,M,q,H,O,j,V,Q,F,U,G,K]);return t.createElement(ve.Provider,{value:X},e)}const Se={position:"relative",width:"100%"},we={display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:"var(--seekora-bg-surface, #fff)",transition:"border-color 150ms ease, box-shadow 150ms ease"},Ce={flex:1,minWidth:0,padding:"8px 0",border:"none",outline:"none",backgroundColor:"transparent",fontSize:"inherit",color:"var(--seekora-text-primary, #111827)",fontFamily:"inherit"};function Re({placeholder:e="Search...",autoFocus:r=!1,showClearButton:a=!0,closeOnBlur:o=!0,leftIcon:n,className:s,style:i,inputClassName:l,inputStyle:c,ariaLabel:d="Search"}){const{query:u,setQuery:p,isOpen:m,setIsOpen:g,navigateNext:f,navigatePrev:h,selectActive:y,close:b}=ke(),x=t.useRef(null),v=t.useCallback(()=>{g(!0)},[g]),k=t.useCallback(()=>{o&&setTimeout(()=>b(),200)},[b,o]),E=t.useCallback(e=>{p(e.target.value)},[p]),S=t.useCallback(e=>"ArrowDown"===e.key?(e.preventDefault(),void f()):"ArrowUp"===e.key?(e.preventDefault(),void h()):"Enter"===e.key?(e.preventDefault(),void y()):"Escape"===e.key?(e.preventDefault(),b(),void x.current?.blur()):void 0,[f,h,y,b]),w=t.useCallback(()=>{p(""),x.current?.focus()},[p]);return t.createElement("div",{className:I("seekora-suggestions-search-input-wrapper",s),style:{...Se,...i}},t.createElement("div",{className:"seekora-suggestions-input-wrapper",style:we},n?t.createElement("span",{className:"seekora-suggestions-input-left-icon",style:{display:"flex",flexShrink:0,color:"var(--seekora-text-secondary, #6b7280)"}},n):null,t.createElement("input",{ref:x,type:"text",value:u,onChange:E,onFocus:v,onBlur:k,onKeyDown:S,placeholder:e,autoFocus:r,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":d,"aria-expanded":m,"aria-haspopup":"listbox","aria-autocomplete":"list",role:"combobox",className:I("seekora-suggestions-input",l),style:{...Ce,...c}}),a&&u?t.createElement("button",{type:"button",onClick:w,className:"seekora-suggestions-input-clear","aria-label":"Clear search",style:{padding:4,border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(Ie,null)):null))}function Ie(){return t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))}function Ne({children:e,position:r="absolute",top:a="100%",left:o=0,right:n,width:s="100%",maxHeight:i="80vh",zIndex:l=1e3,className:c,style:d,closeOnClickOutside:u=!0,closeOnEscape:p=!0}){const{isOpen:m,close:g}=ke(),f=t.useRef(null);t.useEffect(()=>{if(!p||!m)return;const e=e=>{"Escape"===e.key&&g()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,m,g]);const h=t.useCallback(e=>{if(!u||!f.current)return;const t=e.target;f.current.contains(t)||g()},[u,g]);if(t.useEffect(()=>{if(m)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m,h]),!m)return null;const y={position:r,top:a,left:o,right:n,width:s,maxHeight:i,zIndex:l,overflow:"auto",backgroundColor:"var(--seekora-bg-surface, #fff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius, 6px)",boxShadow:"var(--seekora-shadow-lg, 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05))",marginTop:4};return t.createElement("div",{ref:f,role:"listbox",className:I("seekora-suggestions-dropdown-panel",c),style:{...y,...d}},e)}const Te={padding:"10px 12px",cursor:"pointer",listStyle:"none",border:"none",width:"100%",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",transition:"background-color 120ms ease"};function Ae({suggestion:e,index:r,isActive:a,onSelect:o,className:n,style:s,renderHighlight:i}){const l=e.highlightedQuery??e.query,c=i?i(l):l;return t.createElement("li",{role:"option","aria-selected":a,id:`seekora-suggestion-${r}`,className:I("seekora-suggestions-item",a&&"seekora-suggestions-item--active",n),style:{...Te,...a?{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"}:{},...s},onMouseDown:e=>{e.preventDefault(),o()}},c,null!=e.count?t.createElement("span",{className:"seekora-suggestions-item-count",style:{marginLeft:8,color:"var(--seekora-text-secondary, #6b7280)",fontSize:"0.875em"}},e.count):null)}function ze({className:e,style:r,text:a="Loading..."}){const{loading:o}=ke();return o?t.createElement("div",{className:I("seekora-suggestions-loading",e),style:{padding:16,color:"var(--seekora-text-secondary, #6b7280)",fontSize:"0.875rem",...r}},a):null}const Me={margin:0,padding:"4px 0"};function _e({maxItems:e=10,className:r,style:a,listClassName:o,renderItem:n}){const{suggestions:s,activeIndex:i,loading:l,selectSuggestion:c,getAllNavigableItems:d}=ke(),u=s.slice(0,e),p=d().findIndex(e=>"suggestion"===e.type),m=p>=0&&i>=p&&i<p+u.length;return l?t.createElement(ze,{className:r,style:a}):0===u.length?null:t.createElement("div",{className:I("seekora-suggestions-list",r),style:a},t.createElement("ul",{className:I("seekora-suggestions-list-ul",o),style:Me,role:"listbox"},u.map((e,r)=>{const a=p>=0?p+r:r,o=m&&i===a,s=()=>c(e,a);return n?t.createElement("li",{key:e.objectID??e.query??r,role:"option"},n(e,a,o,s)):t.createElement(Ae,{key:e.objectID??e.query??r,suggestion:e,index:a,isActive:o,onSelect:s})})))}const Le={width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:4,backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"};function Pe({images:e,variant:r="single",alt:a="",className:o,style:n,carouselAutoplay:s=!1,carouselIntervalMs:i=4e3}){const[l,c]=t.useState(0),[d,u]=t.useState(!1),p=Array.isArray(e)?e.filter(Boolean):[],m=p[l]??p[0];if(0===p.length)return t.createElement("div",{className:I("seekora-img-display","seekora-img-placeholder",o),style:{...Le,...n},"aria-hidden":!0});if("single"===r)return t.createElement("img",{src:p[0],alt:a,className:I("seekora-img-display","seekora-img-single",o),style:{...Le,...n},loading:"lazy"});if("hover"===r){const e=p.length>1&&d?p[1]:p[0];return t.createElement("div",{className:I("seekora-img-display","seekora-img-hover",o),style:{position:"relative",...n},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1)},t.createElement("img",{src:e,alt:a,className:"seekora-img-hover-img",style:Le,loading:"lazy"}))}if("carousel"===r){const e=e=>{c(t=>{const r=t+e;return r<0?p.length-1:r>=p.length?0:r})};return t.createElement("div",{className:I("seekora-img-display","seekora-img-carousel",o),style:{position:"relative",...n}},t.createElement("img",{src:m,alt:a,className:"seekora-img-carousel-main",style:Le,loading:"lazy"}),p.length>1&&t.createElement(t.Fragment,null,t.createElement("button",{type:"button","aria-label":"Previous",className:"seekora-img-carousel-prev",style:Be(!0),onMouseDown:()=>e(-1)}),t.createElement("button",{type:"button","aria-label":"Next",className:"seekora-img-carousel-next",style:Be(!1),onMouseDown:()=>e(1)})))}return"thumbStrip"===r||"thumbList"===r?t.createElement("div",{className:I("seekora-img-display","seekora-img-thumbstrip",o),style:{display:"flex",flexDirection:"column",gap:8,...n}},t.createElement("img",{src:m,alt:a,className:"seekora-img-thumb-main",style:Le,loading:"lazy"}),t.createElement("div",{className:"seekora-img-thumbs",style:{display:"flex",gap:4,overflowX:"auto",paddingBottom:4}},p.map((e,r)=>t.createElement("button",{type:"button",key:r,className:I("seekora-img-thumb",r===l&&"seekora-img-thumb--active"),style:{flexShrink:0,width:48,height:48,padding:0,border:r===l?"2px solid var(--seekora-primary)":"1px solid transparent",borderRadius:4,overflow:"hidden",cursor:"pointer",background:"none"},onMouseDown:()=>c(r)},t.createElement("img",{src:e,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}))))):t.createElement("img",{src:m,alt:a,className:I("seekora-img-display",o),style:{...Le,...n},loading:"lazy"})}function Be(e){return{position:"absolute",top:"50%",[e?"left":"right"]:8,transform:"translateY(-50%)",width:32,height:32,borderRadius:"50%",border:"1px solid var(--seekora-border-color)",backgroundColor:"var(--seekora-bg-surface)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"}}const De={display:"flex",flexDirection:"column",gap:8,padding:8,cursor:"pointer",border:"none",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:"transparent",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",transition:"background-color 120ms ease"},$e={width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:4,backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"};function Fe({item:e,position:r,onSelect:a,className:o,style:n,asLink:s=!0,imageVariant:i="single"}){const l=e.images?.length?e.images:e.image??e.imageUrl?[String(e.image??e.imageUrl)]:[],c=e.title??e.primaryText??"",d=e.description??e.secondaryText,u=e.url,p=t.createElement(t.Fragment,null,l.length>0?t.createElement(Pe,{images:l,variant:i,alt:String(c),className:"seekora-item-card-image"}):t.createElement("div",{className:"seekora-item-card-placeholder",style:$e,"aria-hidden":!0}),t.createElement("span",{className:"seekora-item-card-title",style:{fontSize:"0.875rem",fontWeight:500}},String(c)),d?t.createElement("span",{className:"seekora-item-card-description",style:{fontSize:"0.8125rem",color:"var(--seekora-text-secondary, #6b7280)",lineHeight:1.3}},String(d)):null),m={className:I("seekora-item-card",o),style:{...De,...n},"data-position":r,onClick:a,onMouseDown:a?e=>{e.preventDefault(),a()}:void 0};return s&&u?t.createElement("a",{href:u,...m,"data-item-id":e.id},p):t.createElement("button",{type:"button",...m,"data-item-id":e.id},p)}const We={display:"grid",gridTemplateColumns:"repeat(var(--seekora-grid-cols, 4), minmax(0, 1fr))",gap:12,padding:12};function qe({items:e,onItemClick:r,getItemId:a=e=>e.id,getItemTitle:o=e=>e.title,getItemImage:n=e=>e.image,getItemDescription:s=e=>e.description,getItemUrl:i=e=>e.url,renderItem:l,maxItems:c=24,columns:d=4,className:u,style:p,gridClassName:m}){const g=e.slice(0,c);if(0===g.length)return null;const f={...We,gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`};return t.createElement("div",{className:I("seekora-item-grid",u),style:p},t.createElement("div",{className:I("seekora-item-grid-inner",m),style:f},g.map((e,c)=>{if(l)return t.createElement(t.Fragment,{key:a(e)},l(e,c));const d=function(e,t,r,a,o,n){return{id:t(e),title:r(e),image:a?.(e),description:o?.(e),url:n?.(e),..."object"==typeof e&&null!==e?e:{}}}(e,a,o,n,s,i);return t.createElement(Fe,{key:d.id,item:d,position:c,onSelect:r?()=>r(e,c):void 0})})))}const He={display:"flex",flexDirection:"column",gap:8,padding:8,cursor:"pointer",border:"none",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:"transparent",textAlign:"left",transition:"background-color 120ms ease"},Oe={width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:4,backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"};function je({product:e,position:r,section:a,tabId:o,onSelect:n,className:s,style:i,imageVariant:l="single"}){const c=e.images?.length?e.images:e.image??e.imageUrl?[String(e.image??e.imageUrl)]:[],d=e.title??e.name??"",u=null!=e.price?"number"==typeof e.price?e.price:Number(e.price):null;return t.createElement("button",{type:"button",className:I("seekora-suggestions-product-card",s),style:{...He,...i},onMouseDown:e=>{e.preventDefault(),n()},"data-position":r,"data-section":a,"data-tab-id":o},c.length>0?t.createElement(Pe,{images:c,variant:l,alt:d,className:"seekora-suggestions-product-card-image"}):t.createElement("div",{className:"seekora-suggestions-product-card-placeholder",style:Oe,"aria-hidden":!0}),t.createElement("span",{className:"seekora-suggestions-product-card-title",style:{fontSize:"0.875rem",fontWeight:500}},d),null==u||Number.isNaN(u)?null:t.createElement("span",{className:"seekora-suggestions-product-card-price",style:{fontSize:"0.875rem",color:"var(--seekora-text-secondary, #6b7280)"}},e.currency??"$",u.toFixed(2)))}function Ve({maxItems:e=8,source:r="trending",columns:a=4,className:o,style:n,gridClassName:s}){const{trendingProducts:i,filteredTabs:l,activeTabId:c,selectProduct:d,getAllNavigableItems:u}=ke(),p=t.useMemo(()=>{if("trending"===r)return i;const e=l.find(e=>e.id===("tab"===r?c:r));return e?.products??[]},[r,c,i,l]).slice(0,e),m=u().findIndex(e=>"product"===e.type);if(0===p.length)return null;const g={display:"grid",gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`,gap:12,padding:12};return t.createElement("div",{className:I("seekora-suggestions-product-grid",o),style:n},t.createElement("div",{className:I("seekora-suggestions-product-grid-inner",s),style:g},p.map((e,a)=>{const o=m>=0?m+a:a,n="trending"===r?"products":"filtered_tab",s="trending"!==r?"tab"===r?c:r:void 0;return t.createElement(je,{key:e.id??e.objectID??a,product:e,position:o,section:n,tabId:s,onSelect:()=>d(e,o,n,s)})})))}function Qe({className:e,style:r,tabClassName:a}){const{filteredTabs:o,activeTabId:n,setActiveTab:s}=ke();return 0===o.length?null:t.createElement("div",{className:I("seekora-suggestions-categories-tabs",e),style:{display:"flex",gap:4,padding:"8px 12px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",overflowX:"auto",...r},role:"tablist"},o.map(e=>{const r=n===e.id;return t.createElement("button",{key:e.id,type:"button",role:"tab","aria-selected":r,className:I("seekora-suggestions-tab",r&&"seekora-suggestions-tab--active",a),style:{padding:"8px 12px",border:"none",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:r?"var(--seekora-primary-light, rgba(59, 130, 246, 0.1))":"transparent",color:r?"var(--seekora-primary, #3b82f6)":"var(--seekora-text-primary, #111827)",cursor:"pointer",fontSize:"0.875rem",fontWeight:r?600:400,whiteSpace:"nowrap",transition:"background-color 120ms ease"},onClick:()=>s(e)},e.label)}))}const Ue={padding:"10px 12px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",transition:"background-color 120ms ease"};function Ge({title:e="Recent",maxItems:r=8,className:a,style:o,listClassName:n,renderItem:s}){const{recentSearches:i,query:l,selectRecentSearch:c}=ke(),d=i.slice(0,r);return 0===d.length?null:t.createElement("div",{className:I("seekora-suggestions-recent-list",a),style:o},e?t.createElement("div",{className:"seekora-suggestions-recent-title",style:{padding:"8px 12px",fontSize:"0.75rem",fontWeight:600,color:"var(--seekora-text-secondary, #6b7280)",textTransform:"uppercase"}},e):null,t.createElement("ul",{className:I("seekora-suggestions-recent-ul",n),style:{margin:0,padding:0,listStyle:"none"}},d.map((e,r)=>{const a=()=>c(e);return s?t.createElement("li",{key:`${e.query}-${e.timestamp}`},s(e,r,a)):t.createElement("li",{key:`${e.query}-${e.timestamp}`},t.createElement("button",{type:"button",className:"seekora-suggestions-recent-item",style:Ue,onMouseDown:e=>{e.preventDefault(),a()}},e.query))})))}const Ke={padding:"10px 12px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",transition:"background-color 120ms ease"};function Xe({title:e="Trending",maxItems:r=8,className:a,style:o,listClassName:n,renderItem:s}){const{trendingSearches:i,selectTrendingSearch:l}=ke(),c=i.slice(0,r);return 0===c.length?null:t.createElement("div",{className:I("seekora-suggestions-trending-list",a),style:o},e?t.createElement("div",{className:"seekora-suggestions-trending-title",style:{padding:"8px 12px",fontSize:"0.75rem",fontWeight:600,color:"var(--seekora-text-secondary, #6b7280)",textTransform:"uppercase"}},e):null,t.createElement("ul",{className:I("seekora-suggestions-trending-ul",n),style:{margin:0,padding:0,listStyle:"none"}},c.map((e,r)=>{const a=()=>l(e,r);return s?t.createElement("li",{key:`${e.query}-${r}`},s(e,r,a)):t.createElement("li",{key:`${e.query}-${r}`},t.createElement("button",{type:"button",className:"seekora-suggestions-trending-item",style:Ke,onMouseDown:e=>{e.preventDefault(),a()}},e.query,null!=e.count?t.createElement("span",{style:{marginLeft:8,color:"var(--seekora-text-secondary, #6b7280)",fontSize:"0.875em"}},e.count):null))})))}function Ye({className:e,style:r,render:a}){const{error:o}=ke();return o?a?t.createElement(t.Fragment,null,a(o)):t.createElement("div",{className:I("seekora-suggestions-error",e),style:{padding:16,color:"var(--seekora-error, #dc2626)",fontSize:"0.875rem",...r}},o.message):null}const Je=t.createContext(null);function Ze(){const e=t.useContext(Je);if(!e){const e=new Error("useSectionSearchContext must be used within a SectionSearchProvider");throw u("SectionSearchContext: not available",{error:e.message}),e}return e}function et({className:e,style:r,text:a="Loading..."}){const{loading:o}=Ze();return o?t.createElement("div",{className:e,style:{padding:16,color:"var(--seekora-text-secondary)",fontSize:"0.875rem",...r}},a):null}function tt({className:e,style:r,render:a}){const{error:o}=Ze();return o?a?t.createElement(t.Fragment,null,a(o)):t.createElement("div",{className:e,style:{padding:16,color:"var(--seekora-error,#dc2626)",fontSize:"0.875rem",...r}},o.message):null}const rt=(e,t)=>{if(e&&t)return t.split(".").reduce((e,t)=>{if(null!=e)return e[t]},e)},at=(e,t={query:"query"})=>({query:rt(e,t.query)??"",count:t.count?rt(e,t.count):void 0,id:t.id?rt(e,t.id):e?.objectID||e?.id,categories:t.categories?rt(e,t.categories):void 0,highlighted:t.highlighted?rt(e,t.highlighted):void 0,_raw:e}),ot=(e,t={id:"id",title:"title"})=>({id:rt(e,t.id)??e?.objectID??e?.id,title:rt(e,t.title)??"",image:t.image?rt(e,t.image):void 0,price:t.price?rt(e,t.price):void 0,comparePrice:t.comparePrice?rt(e,t.comparePrice):void 0,url:t.url?rt(e,t.url):void 0,brand:t.brand?rt(e,t.brand):void 0,category:t.category?rt(e,t.category):void 0,rating:t.rating?rt(e,t.rating):void 0,reviewCount:t.reviewCount?rt(e,t.reviewCount):void 0,discount:t.discount?rt(e,t.discount):void 0,inStock:t.inStock?rt(e,t.inStock):void 0,currency:t.currency?rt(e,t.currency):void 0,_raw:e}),nt=(e,t={id:"id",label:"label"})=>({id:rt(e,t.id)??e?.id,label:rt(e,t.label)??"",count:t.count?rt(e,t.count):void 0,icon:t.icon?rt(e,t.icon):void 0,image:t.image?rt(e,t.image):void 0,_raw:e}),st=(e,t={})=>{if(null==e)return"";const{currency:r="$",currencyPosition:a="before",priceDecimals:o=2}=t,n="string"==typeof e?parseFloat(e):e;if(isNaN(n))return String(e);const s=n.toLocaleString(void 0,{minimumFractionDigits:o,maximumFractionDigits:o});return"before"===a?`${r}${s}`:`${s}${r}`},it=e=>{const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,e=>t[e])},lt=(e,t,r={})=>{if(!t||!e)return it(e);const{tag:a="mark",className:o="",style:n}=r,s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=n?` style="${Object.entries(n).map(([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${t}`).join(";")}"`:"",l=o?` class="${o}"`:"";return it(e).replace(new RegExp(`(${it(s)})`,"gi"),`<${a}${l}${i}>$1</${a}>`)},ct=(e,t="seekora")=>{const r={};return e.primaryColor&&(r[`--${t}-primary`]=e.primaryColor),e.backgroundColor&&(r[`--${t}-bg-surface`]=e.backgroundColor),e.surfaceColor&&(r[`--${t}-bg-secondary`]=e.surfaceColor),e.textColor&&(r[`--${t}-text-primary`]=e.textColor),e.textSecondaryColor&&(r[`--${t}-text-secondary`]=e.textSecondaryColor),e.borderColor&&(r[`--${t}-border-color`]=e.borderColor),e.hoverColor&&(r[`--${t}-bg-hover`]=e.hoverColor),e.highlightColor&&(r[`--${t}-highlight-bg`]=e.highlightColor),e.successColor&&(r[`--${t}-success`]=e.successColor),e.errorColor&&(r[`--${t}-error`]=e.errorColor),e.fontFamily&&(r[`--${t}-font-family`]=e.fontFamily),e.fontSize&&(r[`--${t}-font-size`]="number"==typeof e.fontSize?`${e.fontSize}px`:e.fontSize),e.borderRadius&&(r[`--${t}-border-radius`]="number"==typeof e.borderRadius?`${e.borderRadius}px`:e.borderRadius),e.boxShadow&&(r[`--${t}-box-shadow`]=e.boxShadow),e.cssVariables&&Object.entries(e.cssVariables).forEach(([e,t])=>{r[e.startsWith("--")?e:`--${e}`]=t}),r},dt=(...e)=>e.filter(Boolean).join(" "),ut=(...e)=>Object.assign({},...e.filter(Boolean)),pt="seekora_recent_searches",mt=e=>{try{const t=e?`${pt}_${e}`:pt,r=localStorage.getItem(t);return r?JSON.parse(r):[]}catch{return[]}},gt=(e,t)=>{try{const r=t?`${pt}_${t}`:pt;let a=mt(t);return a=a.filter(t=>t!==e),a.unshift(e),a=a.slice(0,10),localStorage.setItem(r,JSON.stringify(a)),a}catch{return[]}},ft=(e,t)=>{try{const r=t?`${pt}_${t}`:pt;let a=mt(t);return a=a.filter(t=>t!==e),localStorage.setItem(r,JSON.stringify(a)),a}catch{return[]}},ht=(e,t)=>{const r=e.getBoundingClientRect(),a=t.getBoundingClientRect();r.top<a.top?e.scrollIntoView({block:"start",behavior:"smooth"}):r.bottom>a.bottom&&e.scrollIntoView({block:"end",behavior:"smooth"})};class yt{constructor(e={}){this.cache=new Map,this.maxSize=e.maxSize??100,this.defaultTtl=e.defaultTtlMs??3e4}generateKey(e,t){const r=e.toLowerCase().trim();if(!t)return r;const a=Object.keys(t).sort().filter(e=>void 0!==t[e]&&null!==t[e]).map(e=>`${e}:${JSON.stringify(t[e])}`).join("|");return a?`${r}::${a}`:r}get(e){const t=this.cache.get(e);if(!t)return null;return Date.now()-t.timestamp>t.ttl?(this.cache.delete(e),null):t.data}set(e,t,r){if(this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(e,{data:t,timestamp:Date.now(),ttl:r??this.defaultTtl})}has(e){return null!==this.get(e)}clear(){this.cache.clear()}cleanup(){const e=Date.now();for(const[t,r]of this.cache.entries())e-r.timestamp>r.ttl&&this.cache.delete(t)}getStats(){return{size:this.cache.size,maxSize:this.maxSize}}}let bt=null;const xt=e=>(bt||(bt=new yt(e)),bt),vt={xs:0,sm:480,md:768,lg:1024,xl:1280},kt={xs:`@media (max-width: ${vt.sm-1}px)`,sm:`@media (min-width: ${vt.sm}px) and (max-width: ${vt.md-1}px)`,md:`@media (min-width: ${vt.md}px) and (max-width: ${vt.lg-1}px)`,lg:`@media (min-width: ${vt.lg}px) and (max-width: ${vt.xl-1}px)`,xl:`@media (min-width: ${vt.xl}px)`,mobile:`@media (max-width: ${vt.md-1}px)`,tablet:`@media (min-width: ${vt.md}px) and (max-width: ${vt.lg-1}px)`,desktop:`@media (min-width: ${vt.lg}px)`,touch:"@media (hover: none) and (pointer: coarse)",mouse:"@media (hover: hover) and (pointer: fine)"},Et={minimum:44,comfortable:48,large:56},St=()=>{const[e,r]=t.useState({isMobile:!1,isTablet:!1,isDesktop:!0,isTouch:!1,width:"undefined"!=typeof window?window.innerWidth:1024,height:"undefined"!=typeof window?window.innerHeight:768,breakpoint:"lg"});return t.useEffect(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth,t=window.innerHeight,a=(e=>e<vt.sm?"xs":e<vt.md?"sm":e<vt.lg?"md":e<vt.xl?"lg":"xl")(e),o="ontouchstart"in window||navigator.maxTouchPoints>0;r({isMobile:e<vt.md,isTablet:e>=vt.md&&e<vt.lg,isDesktop:e>=vt.lg,isTouch:o,width:e,height:t,breakpoint:a})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e};let wt=!1;const Ct=()=>{if(wt)return;if("undefined"==typeof document)return;const e="seekora-dropdown-responsive-global";if(document.getElementById(e))return void(wt=!0);const t=document.createElement("style");t.id=e,t.textContent='\n/* ============================================\n SEEKORA DROPDOWN - RESPONSIVE STYLES\n ============================================ */\n\n/* CSS Variables for responsiveness */\n:root {\n --seekora-touch-target-min: 44px;\n --seekora-touch-target-comfortable: 48px;\n --seekora-mobile-padding: 16px;\n --seekora-desktop-padding: 20px;\n}\n\n/* Base responsive rules for all dropdowns */\n[class*="seekora-"][class*="-dropdown"] {\n box-sizing: border-box;\n}\n\n[class*="seekora-"][class*="-dropdown"] * {\n box-sizing: border-box;\n}\n\n/* ============================================\n MOBILE STYLES (< 768px)\n ============================================ */\n@media (max-width: 767px) {\n /* Full-width dropdowns on mobile */\n [class*="seekora-"][class*="-dropdown"]:not(.seekora-mobile-sheet):not(.seekora-spotlight-dropdown) {\n width: 100% !important;\n max-width: 100vw !important;\n left: 0 !important;\n right: 0 !important;\n border-radius: 0 !important;\n margin: 0 !important;\n }\n\n /* Touch-friendly item sizes */\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item],\n [class*="seekora-"][class*="-dropdown"] .suggestion-item,\n [class*="seekora-"][class*="-dropdown"] .product-card {\n min-height: var(--seekora-touch-target-min);\n }\n\n /* Larger padding on mobile */\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item] {\n padding: 14px var(--seekora-mobile-padding) !important;\n }\n\n /* Larger fonts on mobile for readability */\n [class*="seekora-"][class*="-dropdown"] {\n font-size: 16px !important;\n }\n\n /* Stack columns on mobile */\n [class*="seekora-"][class*="-dropdown"] .dropdown-content,\n [class*="seekora-"][class*="-dropdown"] [style*="display: flex"][style*="flex-direction"] {\n flex-direction: column !important;\n }\n\n /* Full-width columns on mobile */\n [class*="seekora-"][class*="-dropdown"] [style*="width: 40%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 45%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 50%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 55%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 60%"] {\n width: 100% !important;\n flex: none !important;\n }\n\n /* Product grid adjustments */\n [class*="seekora-"][class*="-dropdown"] .products-grid,\n [class*="seekora-"][class*="-dropdown"] [style*="grid-template-columns"] {\n grid-template-columns: repeat(2, 1fr) !important;\n gap: 12px !important;\n }\n\n /* Horizontal scroll for products on mobile */\n [class*="seekora-"][class*="-dropdown"] .products-scroll {\n display: flex !important;\n overflow-x: auto !important;\n scroll-snap-type: x mandatory !important;\n -webkit-overflow-scrolling: touch !important;\n padding-bottom: 8px !important;\n }\n\n [class*="seekora-"][class*="-dropdown"] .products-scroll > * {\n scroll-snap-align: start !important;\n flex-shrink: 0 !important;\n }\n\n /* Hide keyboard hints on mobile */\n [class*="seekora-"][class*="-dropdown"] .keyboard-hint,\n [class*="seekora-"][class*="-dropdown"] [class*="keyboard"],\n [class*="seekora-"][class*="-dropdown"] kbd,\n [class*="seekora-"][class*="-dropdown"] .kbd {\n display: none !important;\n }\n\n /* Safe area padding for notched devices */\n [class*="seekora-"][class*="-dropdown"] [style*="padding-bottom"] {\n padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;\n }\n}\n\n/* ============================================\n TOUCH DEVICE STYLES\n ============================================ */\n@media (hover: none) and (pointer: coarse) {\n /* Active state instead of hover for touch */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:active,\n [class*="seekora-"][class*="-dropdown"] [data-item]:active,\n [class*="seekora-"][class*="-dropdown"] button:active {\n background-color: var(--seekora-bg-hover, rgba(0,0,0,0.05)) !important;\n transform: scale(0.98);\n }\n\n /* Disable hover effects on touch */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:hover,\n [class*="seekora-"][class*="-dropdown"] [data-item]:hover {\n background-color: transparent;\n }\n\n /* Larger touch targets */\n [class*="seekora-"][class*="-dropdown"] button,\n [class*="seekora-"][class*="-dropdown"] [role="button"] {\n min-height: var(--seekora-touch-target-min);\n min-width: var(--seekora-touch-target-min);\n }\n\n /* No text selection on touch */\n [class*="seekora-"][class*="-dropdown"] {\n -webkit-user-select: none;\n user-select: none;\n }\n}\n\n/* ============================================\n TABLET STYLES (768px - 1023px)\n ============================================ */\n@media (min-width: 768px) and (max-width: 1023px) {\n [class*="seekora-"][class*="-dropdown"]:not(.seekora-mobile-sheet) {\n max-width: 90vw !important;\n margin-left: auto !important;\n margin-right: auto !important;\n }\n\n /* 3-column product grid on tablet */\n [class*="seekora-"][class*="-dropdown"] .products-grid {\n grid-template-columns: repeat(3, 1fr) !important;\n }\n}\n\n/* ============================================\n DESKTOP STYLES (>= 1024px)\n ============================================ */\n@media (min-width: 1024px) {\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item] {\n min-height: 40px;\n }\n\n /* Hover effects only on desktop */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:hover,\n [class*="seekora-"][class*="-dropdown"] [data-item]:hover {\n background-color: var(--seekora-bg-hover, rgba(0,0,0,0.04));\n }\n}\n\n/* ============================================\n ANIMATION & TRANSITIONS\n ============================================ */\n@keyframes seekora-dropdown-enter {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes seekora-dropdown-enter-mobile {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes seekora-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n[class*="seekora-"][class*="-dropdown"].entering {\n animation: seekora-dropdown-enter 200ms ease-out;\n}\n\n@media (max-width: 767px) {\n [class*="seekora-"][class*="-dropdown"].entering {\n animation: seekora-dropdown-enter-mobile 300ms ease-out;\n }\n}\n\n/* ============================================\n ACCESSIBILITY\n ============================================ */\n@media (prefers-reduced-motion: reduce) {\n [class*="seekora-"][class*="-dropdown"],\n [class*="seekora-"][class*="-dropdown"] * {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n\n/* Focus visible styles */\n[class*="seekora-"][class*="-dropdown"] [role="option"]:focus-visible,\n[class*="seekora-"][class*="-dropdown"] button:focus-visible {\n outline: 2px solid var(--seekora-primary, #007aff);\n outline-offset: -2px;\n}\n\n/* High contrast mode */\n@media (prefers-contrast: high) {\n [class*="seekora-"][class*="-dropdown"] {\n border: 2px solid currentColor !important;\n }\n\n [class*="seekora-"][class*="-dropdown"] [role="option"][aria-selected="true"] {\n outline: 2px solid currentColor;\n }\n}\n\n/* Dark mode adjustments */\n@media (prefers-color-scheme: dark) {\n [class*="seekora-"][class*="-dropdown"] {\n --seekora-bg-surface: #1c1c1e;\n --seekora-bg-secondary: #2c2c2e;\n --seekora-bg-hover: #3a3a3c;\n --seekora-text-primary: #ffffff;\n --seekora-text-secondary: #8e8e93;\n --seekora-border-color: #38383a;\n }\n}\n',document.head.appendChild(t),wt=!0},Rt=()=>{t.useEffect(()=>{Ct()},[])},It=(e={},t=!1)=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #0f1111)",borderRadius:t?"12px":"16px",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1), 0 10px 40px -5px rgba(0,0,0,0.15)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"14px",zIndex:1e3,...t&&{position:"fixed",top:"60px",bottom:0,left:"8px",right:"8px",margin:0,borderRadius:"16px 16px 0 0"}},content:{display:"flex",flexDirection:t?"column":"row",maxHeight:t?"calc(100vh - 140px)":"480px",overflowY:"auto"},leftColumn:{flex:t?"none":"0 0 55%",borderRight:t?"none":"1px solid var(--seekora-border-color, #e8e8e8)",borderBottom:t?"1px solid var(--seekora-border-color, #e8e8e8)":"none",overflowY:"auto",padding:"8px 0"},rightColumn:{flex:t?"none":"0 0 45%",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",overflowY:"auto",padding:"8px 0"},section:{padding:"4px 0"},sectionHeader:{padding:"8px 16px 6px",fontSize:"11px",fontWeight:600,color:"var(--seekora-text-secondary, #6b6b6b)",textTransform:"uppercase",letterSpacing:"0.05em"},suggestionItem:{display:"flex",alignItems:"center",padding:t?"12px 16px":"10px 16px",cursor:"pointer",transition:"all 150ms ease",gap:t?"12px":"10px",minHeight:t?`${Et.minimum}px`:"40px",borderRadius:"8px",margin:"2px 8px",color:"var(--seekora-text-primary, #0f1111)"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #0f1111)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #6b6b6b)",flexShrink:0},suggestionContent:{flex:1,minWidth:0},suggestionQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #0f1111)",fontWeight:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},suggestionContext:{fontSize:"12px",color:"var(--seekora-text-secondary, #565959)",marginTop:"2px"},suggestionDepartment:{color:"var(--seekora-primary-dark, #c45500)",fontStyle:"italic"},categoryScoped:{backgroundColor:"var(--seekora-primary-light, #fef8f0)",borderRadius:"3px",padding:"0 4px",marginLeft:"4px",fontSize:"11px",color:"var(--seekora-primary-dark, #c45500)"},productsHeader:{padding:"12px 16px 8px",display:"flex",alignItems:"center",justifyContent:"space-between"},productsTitle:{fontSize:"13px",fontWeight:700,color:"var(--seekora-text-primary, #0f1111)"},viewAll:{fontSize:"12px",color:"var(--seekora-link, #007185)",textDecoration:"none",cursor:"pointer","&:hover":{color:"var(--seekora-link-hover, #c45500)",textDecoration:"underline"}},productsGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"12px",padding:"12px 16px 16px"},productCard:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRadius:"12px",padding:"10px",cursor:"pointer",transition:"all 200ms ease",boxShadow:"0 1px 3px rgba(0,0,0,0.06)"},productCardHover:{boxShadow:"0 4px 12px rgba(0,0,0,0.12)",transform:"translateY(-2px)"},productImage:{width:"100%",aspectRatio:"1",objectFit:"contain",backgroundColor:"var(--seekora-bg-tertiary, #f8f8f8)",borderRadius:"8px",marginBottom:"10px"},productTitle:{fontSize:"12px",color:"var(--seekora-link, #007185)",lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",marginBottom:"4px"},productPrice:{fontSize:"14px",fontWeight:500,color:"var(--seekora-text-primary, #0f1111)"},productPriceSymbol:{fontSize:"11px",verticalAlign:"top"},productRating:{display:"flex",alignItems:"center",gap:"4px",marginTop:"4px"},stars:{color:"var(--seekora-rating, #de7921)",fontSize:"12px"},reviewCount:{fontSize:"11px",color:"var(--seekora-link, #007185)"},prime:{height:"16px",marginTop:"4px"},recentHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px"},clearRecent:{fontSize:"12px",color:"var(--seekora-link, #007185)",cursor:"pointer",background:"none",border:"none",padding:0},highlight:{fontWeight:700,color:"var(--seekora-text-primary, #0f1111)"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--seekora-text-secondary, #565959)",gap:"10px"},spinner:{width:"20px",height:"20px",border:"2px solid var(--seekora-border-color, #ddd)",borderTopColor:"var(--seekora-primary, #f90)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #565959)"},footer:{padding:"10px 16px",borderTop:"1px solid var(--seekora-border-color, #e7e7e7)",backgroundColor:"var(--seekora-bg-secondary, #f7f7f7)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"12px",color:"var(--seekora-text-tertiary, #767676)"},keyboard:{display:"flex",alignItems:"center",gap:"8px"},key:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"18px",padding:"0 4px",backgroundColor:"var(--seekora-bg-surface, #fff)",border:"1px solid var(--seekora-border-color, #ccc)",borderRadius:"3px",fontSize:"10px",fontFamily:"monospace"}}),Nt=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("circle",{cx:"11",cy:"11",r:"8"}),t.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),Tt=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"})),At=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),t.createElement("polyline",{points:"17 6 23 6 23 12"})),zt=({rating:e,count:r})=>{const a=Math.floor(e),o=e%1>=.5;return t.createElement("div",{style:It().productRating},t.createElement("div",{style:It().stars},"★".repeat(a),o&&"½","☆".repeat(5-a-(o?1:0))),void 0!==r&&t.createElement("span",{style:It().reviewCount},"(",r.toLocaleString(),")"))},Mt=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],recentSearches:c=[],trendingSearches:d=[],filteredTabs:u=[],activeTab:p="all",suggestionFields:m={query:"query"},productFields:g={id:"id",title:"title"},categoryFields:f={id:"id",label:"label"},productDisplay:h={},theme:y={},showDepartments:b=!0,currentDepartment:x,departments:v=[],showPrime:k=!1,width:E="700px",maxHeight:S="500px",zIndex:w=1e3,className:C,style:R,classNames:I={},onSuggestionSelect:N,onProductClick:T,onCategoryClick:A,onTabChange:z,onRecentClick:M,onRecentRemove:_,onRecentClearAll:L,onViewAll:P,onClose:B,header:D,footer:$,renderLoading:F,renderEmpty:W}=e;Rt();const q=St(),{isMobile:H,isTablet:O}=q,j=t.useMemo(()=>It(y,H),[y,H]),V=t.useRef(null),[Q,U]=t.useState(-1),[G,K]=t.useState(null),X=t.useMemo(()=>s.map(e=>at(e,m)),[s,m]),Y=t.useMemo(()=>{if("all"===p||0===u.length)return i;const e=u.find(e=>e.id===p);return e?.products||i},[p,u,i]),J=t.useMemo(()=>Y.map(e=>ot(e,g)),[Y,g]);t.useMemo(()=>l.map(e=>nt(e,f)),[l,f]);const Z=t.useMemo(()=>c.map(e=>"string"==typeof e?e:e.query),[c]),ee=t.useMemo(()=>{const e=[];let t=0;return 0===a.length&&Z.slice(0,5).forEach(r=>{e.push({type:"recent",data:r,index:t++})}),X.forEach(r=>{e.push({type:"suggestion",data:r,index:t++})}),e},[a,Z,X]),te=t.useCallback(()=>{U(e=>Math.min(e+1,ee.length-1))},[ee.length]),re=t.useCallback(()=>{U(e=>Math.max(e-1,-1))},[]),ae=t.useCallback(()=>{if(Q<0||Q>=ee.length)return;const e=ee[Q];"recent"===e.type?M?.(e.data):"suggestion"===e.type&&N?.(e.data._raw,e.index)},[Q,ee,M,N]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>Q,setActiveIndex:U,selectActive:ae,navigateNext:te,navigatePrevious:re,focus:()=>V.current?.focus(),close:()=>B?.()}),[Q,ae,te,re,B]),t.useEffect(()=>{if(Q>=0&&V.current){const e=V.current.querySelector(`[data-index="${Q}"]`);e&&ht(e,V.current)}},[Q]),!o)return null;const oe=ct(y),ne=0===a.length&&Z.length>0,se=0===a.length&&d.length>0,ie=J.length>0;return t.createElement("div",{ref:V,role:"listbox","aria-label":"Search suggestions",className:dt("seekora-amazon-dropdown",C,I.root),style:ut(j.root,{width:H?"100%":E,maxHeight:H?"100vh":S,zIndex:w},oe,R),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-amazon-dropdown mark {\n background: transparent;\n font-weight: 700;\n color: inherit;\n }\n "),D,n?F?F():t.createElement("div",{style:j.loading},t.createElement("div",{style:j.spinner}),t.createElement("span",null,"Searching...")):t.createElement(t.Fragment,null,u.length>0&&t.createElement("div",{style:{display:"flex",gap:"8px",padding:H?"12px":"12px 16px",overflowX:"auto",borderBottomWidth:"1px",borderBottomStyle:"solid",borderBottomColor:"var(--seekora-border-color, #e7e7e7)",background:"var(--seekora-bg-secondary, #f5f5f5)",WebkitOverflowScrolling:"touch"}},t.createElement("button",{onClick:()=>z?.("all"),style:{padding:"8px 16px",borderWidth:0,borderStyle:"none",background:"all"===p?"var(--seekora-text-primary, #232f3e)":"var(--seekora-bg-surface, #ffffff)",color:"all"===p?"var(--seekora-bg-surface, #ffffff)":"var(--seekora-text-primary, #0f1111)",borderRadius:"20px",fontSize:"13px",fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",minHeight:"36px",boxShadow:"all"===p?"none":"0 1px 3px rgba(0,0,0,0.1)",transition:"all 150ms ease"}},"All"),u.slice(0,6).map(e=>t.createElement("button",{key:e.id,onClick:()=>z?.(e.id),style:{padding:"8px 16px",borderWidth:0,borderStyle:"none",background:p===e.id?"var(--seekora-primary, #ff9900)":"var(--seekora-bg-surface, #ffffff)",color:p===e.id?"var(--seekora-text-on-primary, #0f1111)":"var(--seekora-text-primary, #0f1111)",borderRadius:"20px",fontSize:"13px",fontWeight:p===e.id?700:500,cursor:"pointer",whiteSpace:"nowrap",minHeight:"36px",boxShadow:p===e.id?"0 2px 4px rgba(255,153,0,0.3)":"0 1px 3px rgba(0,0,0,0.1)",transition:"all 150ms ease"}},e.label," ",e.nb_hits?`(${e.nb_hits})`:""))),t.createElement("div",{style:j.content},t.createElement("div",{style:j.leftColumn},ne&&t.createElement("div",{style:j.section},t.createElement("div",{style:j.recentHeader},t.createElement("span",{style:j.sectionHeader},"Recent Searches"),t.createElement("button",{style:j.clearRecent,onClick:L},"Clear all")),Z.slice(0,5).map((e,r)=>{const a=Q===r;return t.createElement("div",{key:`recent-${e}`,"data-index":r,role:"option","aria-selected":a,style:ut(j.suggestionItem,a?j.suggestionItemActive:void 0),onClick:()=>M?.(e),onMouseEnter:()=>U(r)},t.createElement(Tt,null),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery},e)))})),se&&t.createElement("div",{style:j.section},t.createElement("div",{style:j.sectionHeader},"Trending Searches"),d.slice(0,5).map((e,r)=>{const a="string"==typeof e?e:e.query,o=Z.length+r,n=Q===o;return t.createElement("div",{key:`trending-${a}`,"data-index":o,role:"option","aria-selected":n,style:ut(j.suggestionItem,n?j.suggestionItemActive:void 0),onClick:()=>N?.({query:a},r),onMouseEnter:()=>U(o)},t.createElement(At,null),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery},a)))})),X.length>0&&t.createElement("div",{style:j.section},a&&t.createElement("div",{style:j.sectionHeader},"Suggestions"),X.map((e,r)=>{const o=ne?Z.length+r:r,n=Q===o,s=(e.categories||[])[0];return t.createElement("div",{key:e.id||`suggestion-${r}`,"data-index":o,role:"option","aria-selected":n,style:ut(j.suggestionItem,n?j.suggestionItemActive:void 0),onClick:()=>N?.(e._raw,r),onMouseEnter:()=>U(o)},t.createElement("div",{style:j.suggestionIcon},t.createElement(Nt,null)),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery,dangerouslySetInnerHTML:{__html:lt(e.query,a,{className:"highlight"})}}),b&&s&&t.createElement("div",{style:j.suggestionContext},t.createElement("span",{style:j.suggestionDepartment},"in ","string"==typeof s?s:s.value||s.label))),e.count&&t.createElement("span",{style:j.categoryScoped},e.count.toLocaleString()))})),a&&0===X.length&&!n&&(W?W(a):t.createElement("div",{style:j.empty},'No suggestions found for "',a,'"'))),ie&&t.createElement("div",{style:j.rightColumn},t.createElement("div",{style:j.productsHeader},t.createElement("span",{style:j.productsTitle},"Suggested Products"),t.createElement("a",{style:j.viewAll,onClick:()=>P?.("products")},"View all")),t.createElement("div",{style:j.productsGrid},J.slice(0,4).map((e,r)=>t.createElement("div",{key:e.id,style:ut(j.productCard,G===e.id?j.productCardHover:void 0),onClick:()=>T?.(e._raw,r),onMouseEnter:()=>K(e.id),onMouseLeave:()=>K(null)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:j.productImage,loading:"lazy"}):t.createElement("div",{style:{...j.productImage,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement("span",{style:{color:"var(--seekora-text-tertiary, #999)",fontSize:"32px"}},"📷")),t.createElement("div",{style:j.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:j.productPrice},t.createElement("span",{style:j.productPriceSymbol},h.currency||"$"),st(e.price,{currency:"",priceDecimals:h.priceDecimals})),e.rating&&t.createElement(zt,{rating:parseFloat(String(e.rating)),count:e.reviewCount?parseInt(String(e.reviewCount)):void 0}))))))),void 0!==$?$:t.createElement("div",{style:j.footer},t.createElement("div",{style:j.keyboard},t.createElement("span",{style:j.key},"↑"),t.createElement("span",{style:j.key},"↓"),t.createElement("span",null,"to navigate"),t.createElement("span",{style:j.key},"↵"),t.createElement("span",null,"to select"),t.createElement("span",{style:j.key},"esc"),t.createElement("span",null,"to close")),X.length>0&&t.createElement("span",null,X.length," suggestions")))}),_t=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",fill:"currentColor"})),Lt=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M13 3a9 9 0 00-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.954 8.954 0 0013 21a9 9 0 000-18zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z",fill:"currentColor"})),Pt=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z",fill:"currentColor"})),Bt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",width:"20",height:"20"},t.createElement("path",{d:"M9 5l-4 4 4 4",stroke:"currentColor",strokeWidth:"2",fill:"none",transform:"rotate(-90 12 12)"})),Dt=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],recentSearches:i=[],trendingSearches:l=[],suggestionFields:c={query:"query"},theme:d={},showFeelingLucky:u=!0,feelingLuckyText:p="I'm Feeling Lucky",showRemoveRecent:m=!0,showVoiceSearch:g=!1,showTrendingIndicator:f=!0,width:h="100%",maxHeight:y="400px",zIndex:b=1e3,className:x,style:v,classNames:k={},onSuggestionSelect:E,onRecentClick:S,onRecentRemove:w,onVoiceSearch:C,onFeelingLucky:R,onClose:I,onSearchSubmit:N,header:T,footer:A,renderLoading:z,renderEmpty:M}=e;Rt();const _=St(),{isMobile:L}=_,P=t.useMemo(()=>((e=!1)=>({root:{position:e?"fixed":"absolute",top:e?0:"100%",left:0,right:0,bottom:e?0:"auto",marginTop:e?0:"4px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #202124)",borderRadius:e?"0":"24px",boxShadow:e?"none":"0 4px 20px rgba(0,0,0,0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:e?"17px":"15px",display:"flex",flexDirection:"column"},list:{listStyle:"none",margin:0,padding:"8px",flex:1,overflowY:"auto"},item:{display:"flex",alignItems:"center",padding:e?"12px 14px":"10px 14px",cursor:"pointer",transition:"all 100ms ease",gap:"12px",minHeight:"44px",borderRadius:"12px",margin:"2px 0",color:"var(--seekora-text-primary, #202124)"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #202124)"},itemIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #9aa0a6)",flexShrink:0},itemContent:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:0},itemText:{fontSize:"16px",color:"var(--seekora-text-primary, #202124)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemTextBold:{fontWeight:400},itemMatch:{fontWeight:700},itemAction:{fontSize:"14px",color:"var(--seekora-link, #1a73e8)",marginLeft:"16px",opacity:0,transition:"opacity 100ms",whiteSpace:"nowrap"},itemActionVisible:{opacity:1},removeBtn:{padding:"4px 8px",background:"none",border:"none",color:"var(--seekora-link, #1a73e8)",cursor:"pointer",fontSize:"13px",borderRadius:"4px",opacity:0,transition:"opacity 100ms, background 100ms"},removeBtnVisible:{opacity:1},removeBtnHover:{backgroundColor:"var(--seekora-bg-hover, #e8f0fe)",color:"var(--seekora-text-primary, #202124)"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e8eaed)",margin:"8px 0"},sectionTitle:{padding:"12px 16px 8px",fontSize:"12px",fontWeight:500,color:"var(--seekora-text-secondary, #5f6368)",textTransform:"uppercase",letterSpacing:"0.8px"},trending:{display:"flex",alignItems:"center",gap:"8px",color:"var(--seekora-success, #1e8e3e)",fontSize:"12px",marginLeft:"auto"},trendingIcon:{width:"12px",height:"12px"},footer:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px 16px",borderTop:"1px solid var(--seekora-border-color, #e8eaed)",gap:"24px",backgroundColor:"var(--seekora-bg-secondary, #f8f9fa)"},footerButton:{padding:"8px 16px",backgroundColor:"var(--seekora-bg-tertiary, #f1f3f4)",border:"1px solid var(--seekora-border-color, #f1f3f4)",borderRadius:"4px",fontSize:"14px",color:"var(--seekora-text-secondary, #3c4043)",cursor:"pointer",transition:"border-color 100ms, box-shadow 100ms"},footerButtonHover:{borderColor:"var(--seekora-border-color-dark, #dadce0)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},voiceBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",borderRadius:"50%",background:"none",border:"none",cursor:"pointer",color:"var(--seekora-primary, #4285f4)",transition:"background 100ms"},voiceBtnHover:{backgroundColor:"var(--seekora-bg-hover, #f1f3f4)",color:"var(--seekora-text-primary, #202124)"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",color:"var(--seekora-text-secondary, #5f6368)",gap:"12px"},spinner:{width:"24px",height:"24px",border:"3px solid var(--seekora-border-color, #e8eaed)",borderTopColor:"var(--seekora-primary, #4285f4)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"24px",textAlign:"center",color:"var(--seekora-text-secondary, #5f6368)",fontSize:"14px"}}))(L),[L]),B=t.useRef(null),[D,$]=t.useState(-1),[F,W]=t.useState(-1),[q,H]=t.useState(null),O=t.useMemo(()=>s.map(e=>at(e,c)),[s,c]),j=t.useMemo(()=>i.map(e=>"string"==typeof e?e:e.query).slice(0,5),[i]),V=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,5),[l]),Q=t.useMemo(()=>{const e=[];return 0===a.length?(j.forEach(t=>e.push({type:"recent",query:t})),V.forEach(t=>e.push({type:"trending",query:t}))):O.forEach(t=>e.push({type:"suggestion",query:t.query,data:t})),e},[a,j,V,O]),U=t.useCallback(()=>{$(e=>Math.min(e+1,Q.length-1))},[Q.length]),G=t.useCallback(()=>{$(e=>Math.max(e-1,-1))},[]),K=t.useCallback(()=>{if(D<0)return void(a&&N?.(a));const e=Q[D];"recent"===e.type||"trending"===e.type?S?.(e.query):E?.(e.data?._raw||{query:e.query},D)},[D,Q,a,N,S,E]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>D,setActiveIndex:$,selectActive:K,navigateNext:U,navigatePrevious:G,focus:()=>B.current?.focus(),close:()=>I?.()}),[D,K,U,G,I]),t.useEffect(()=>{$(-1)},[a]),t.useEffect(()=>{if(D>=0&&B.current){const e=B.current.querySelector(`[data-index="${D}"]`);e&&ht(e,B.current)}},[D]),!o)return null;const X=ct(d),Y=0===a.length&&j.length>0,J=0===a.length&&V.length>0,Z=(e,r,o)=>{const n=D===o,s=F===o,i=n||s;return t.createElement("li",{key:`${e.type}-${e.query}-${r}`,"data-index":o,role:"option","aria-selected":n,style:ut(P.item,n||s?P.itemActive:void 0),onClick:()=>{"recent"===e.type||"trending"===e.type?S?.(e.query):E?.(e.data?._raw||{query:e.query},r)},onMouseEnter:()=>{W(o),$(o)},onMouseLeave:()=>W(-1)},t.createElement("div",{style:P.itemIcon},"recent"===e.type?t.createElement(Lt,null):"trending"===e.type?t.createElement(Pt,null):t.createElement(_t,null)),t.createElement("div",{style:P.itemContent},t.createElement("span",{style:P.itemText,dangerouslySetInnerHTML:{__html:a?lt(e.query,a,{tag:"b"}):e.query}}),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},"trending"===e.type&&f&&t.createElement("span",{style:P.trending},t.createElement(Pt,null),"Trending"),"recent"===e.type&&m&&t.createElement("button",{style:ut(P.removeBtn,i?P.removeBtnVisible:void 0),onClick:t=>{t.stopPropagation(),w?.(e.query)},"aria-label":`Remove ${e.query}`},"Remove"),t.createElement("span",{style:ut(P.itemAction,i?P.itemActionVisible:void 0)},t.createElement(Bt,null)))))};let ee=0;return t.createElement("div",{ref:B,role:"listbox","aria-label":"Search suggestions",className:dt("seekora-google-dropdown",x,k.root),style:ut(P.root,{width:h,maxHeight:"none",zIndex:b},X,v),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),T,n?z?z():t.createElement("div",{style:P.loading},t.createElement("div",{style:P.spinner})):t.createElement(t.Fragment,null,t.createElement("ul",{style:P.list},Y&&t.createElement(t.Fragment,null,j.map((e,t)=>{const r=Z({type:"recent",query:e},t,ee);return ee++,r}),J&&t.createElement("div",{style:P.divider})),J&&t.createElement(t.Fragment,null,!Y&&t.createElement("div",{style:P.sectionTitle},"Trending searches"),V.map((e,t)=>{const r=Z({type:"trending",query:e},t,ee);return ee++,r})),a&&O.length>0&&O.map((e,t)=>{const r={type:"suggestion",query:e.query,data:e},a=Z(r,t,ee);return ee++,a}),a&&0===O.length&&!n&&(M?M(a):t.createElement("li",{style:P.empty},'No suggestions for "',a,'"'))),(u||g)&&t.createElement("div",{style:P.footer},u&&t.createElement(t.Fragment,null,t.createElement("button",{style:ut(P.footerButton,"search"===q?P.footerButtonHover:void 0),onMouseEnter:()=>H("search"),onMouseLeave:()=>H(null),onClick:()=>N?.(a||(D>=0?Q[D]?.query:""))},"Search"),t.createElement("button",{style:ut(P.footerButton,"lucky"===q?P.footerButtonHover:void 0),onMouseEnter:()=>H("lucky"),onMouseLeave:()=>H(null),onClick:()=>R?.(a||(D>=0?Q[D]?.query:""))},p)))),A)}),$t=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},t.createElement("path",{d:"M10 16c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m13.12 2.88l-4.26-4.26A9.842 9.842 0 0020 10c0-5.52-4.48-10-10-10S0 4.48 0 10s4.48 10 10 10c1.67 0 3.24-.41 4.62-1.14l4.26 4.26a3 3 0 004.24-4.24z"})),Ft=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18"},t.createElement("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})),Wt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18"},t.createElement("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"})),qt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"48",height:"48"},t.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.createElement("polyline",{points:"21 15 16 10 5 21"})),Ht=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},categoryFields:u={id:"id",label:"label"},productDisplay:p={},theme:m={},showSaveButton:g=!0,activeCategory:f,activeTab:h,showPriceOverlay:y=!0,gridColumns:b=4,width:x="800px",maxHeight:v="600px",zIndex:k=1e3,className:E,style:S,classNames:w={},onSuggestionSelect:C,onProductClick:R,onCategoryClick:I,onTabChange:N,onSaveProduct:T,onViewAll:A,onClose:z,header:M,footer:_,renderLoading:L,renderEmpty:P}=e;Rt();const B=St(),{isMobile:D}=B,$=t.useMemo(()=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #111111)",borderRadius:"20px",boxShadow:"0 4px 30px rgba(0,0,0,0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"15px"},header:{padding:"16px 20px 14px",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)"},searchInfo:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"14px"},searchQuery:{fontSize:"16px",fontWeight:600,color:"#111111"},searchCount:{fontSize:"13px",color:"#767676"},categoriesScroll:{display:"flex",gap:"8px",overflowX:"auto",paddingBottom:"4px",scrollbarWidth:"none",msOverflowStyle:"none"},categoryChip:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",backgroundColor:"var(--seekora-bg-secondary, #f0f0f0)",borderRadius:"20px",fontSize:"13px",fontWeight:500,color:"#111111",cursor:"pointer",transition:"all 150ms ease",whiteSpace:"nowrap",borderWidth:0,borderStyle:"none"},categoryChipActive:{backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-bg-surface, #ffffff)"},categoryChipHover:{backgroundColor:"var(--seekora-bg-hover, #e0e0e0)",color:"var(--seekora-text-primary, #111111)"},categoryIcon:{width:"16px",height:"16px",borderRadius:"4px",objectFit:"cover"},content:{padding:"16px",overflowY:"auto"},suggestionsRow:{display:"flex",gap:"8px",marginBottom:"16px",flexWrap:"wrap"},suggestionPill:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",borderRadius:"20px",fontSize:"13px",fontWeight:500,color:"#111111",cursor:"pointer",transition:"all 150ms ease",borderWidth:0,borderStyle:"none"},suggestionPillActive:{backgroundColor:"var(--seekora-text-primary, #111111)",color:"var(--seekora-bg-surface, #ffffff)"},suggestionPillHover:{backgroundColor:"var(--seekora-bg-hover, #e8e8e8)",color:"var(--seekora-text-primary, #111111)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"#767676",flexShrink:0},productsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"16px"},productCard:{position:"relative",borderRadius:"16px",overflow:"hidden",cursor:"pointer",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",transition:"transform 150ms, box-shadow 150ms"},productCardHover:{transform:"scale(1.02)",boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},productImageContainer:{position:"relative",paddingBottom:"133%",overflow:"hidden"},productImage:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover"},productImagePlaceholder:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--seekora-bg-tertiary, #e9e9e9)",color:"var(--seekora-text-tertiary, #aaa)"},productOverlay:{position:"absolute",bottom:0,left:0,right:0,padding:"40px 12px 12px",background:"linear-gradient(to top, rgba(0,0,0,0.7), transparent)",opacity:0,transition:"opacity 200ms"},productOverlayVisible:{opacity:1},productInfo:{padding:"12px"},productTitle:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #111)",lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",marginBottom:"4px"},productTitleOverlay:{color:"var(--seekora-text-inverse, #ffffff)",marginBottom:"4px"},productPrice:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #111)"},productPriceOverlay:{color:"var(--seekora-text-inverse, #ffffff)"},productSaveBtn:{position:"absolute",top:"12px",right:"12px",width:"36px",height:"36px",borderRadius:"50%",backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",opacity:0,transform:"scale(0.8)",transition:"all 150ms"},productSaveBtnVisible:{opacity:1,transform:"scale(1)"},sectionTitle:{fontSize:"18px",fontWeight:700,color:"var(--seekora-text-primary, #111)",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #767676)"},spinner:{width:"32px",height:"32px",border:"3px solid var(--seekora-border-color, #efefef)",borderTopColor:"var(--seekora-primary, #e60023)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #767676)"},emptyIcon:{width:"64px",height:"64px",margin:"0 auto 16px",color:"var(--seekora-text-tertiary, #8c8c8c)"},footer:{padding:"16px 20px",borderTop:"1px solid var(--seekora-border-color, #efefef)",display:"flex",alignItems:"center",justifyContent:"space-between"},viewAllBtn:{padding:"12px 20px",backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",borderRadius:"24px",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"background 150ms"},viewAllBtnHover:{backgroundColor:"var(--seekora-primary-dark, #ad081b)"}}),[]),F=t.useRef(null),[W,q]=t.useState(-1),[H,O]=t.useState(null),[j,V]=t.useState(null),[Q,U]=t.useState(-1),[G,K]=t.useState(f||null),[X,Y]=t.useState(!1);t.useEffect(()=>{const e=h??f;void 0!==e&&K("all"===e?null:e)},[h,f]);const J=t.useMemo(()=>s.map(e=>at(e,c)),[s,c]),Z=t.useMemo(()=>i.map(e=>ot(e,d)),[i,d]),ee=t.useMemo(()=>l.map(e=>nt(e,u)),[l,u]),te=t.useCallback(()=>{q(e=>Math.min(e+1,J.length-1))},[J.length]),re=t.useCallback(()=>{q(e=>Math.max(e-1,-1))},[]),ae=t.useCallback(()=>{W>=0&&J[W]&&C?.(J[W]._raw,W)},[W,J,C]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>W,setActiveIndex:q,selectActive:ae,navigateNext:te,navigatePrevious:re,focus:()=>F.current?.focus(),close:()=>z?.()}),[W,ae,te,re,z]),t.useEffect(()=>{if(W>=0&&F.current){const e=F.current.querySelector(`[data-index="${W}"]`);e&&ht(e,F.current)}},[W]),!o)return null;const oe=ct(m),ne=ee.length>0,se=Z;return t.createElement("div",{ref:F,role:"listbox","aria-label":"Search suggestions",className:dt("seekora-pinterest-dropdown",E,w.root),style:ut($.root,{width:x,zIndex:k},oe,S),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-pinterest-dropdown .categories-scroll::-webkit-scrollbar {\n display: none;\n }\n "),M||a&&t.createElement("div",{style:$.header},t.createElement("div",{style:$.searchInfo},t.createElement("span",{style:$.searchQuery},a?`"${a}"`:"Explore"),Z.length>0&&t.createElement("span",{style:$.searchCount},Z.length,"+ ideas")),ne&&t.createElement("div",{style:$.categoriesScroll,className:"categories-scroll"},t.createElement("button",{style:ut($.categoryChip,G?void 0:$.categoryChipActive,"all"===j&&G?$.categoryChipHover:void 0),onClick:()=>{K(null),N?.("all")},onMouseEnter:()=>V("all"),onMouseLeave:()=>V(null)},"All"),ee.map(e=>t.createElement("button",{key:e.id,style:ut($.categoryChip,G===e.id?$.categoryChipActive:void 0,j===e.id&&G!==e.id?$.categoryChipHover:void 0),onClick:()=>{K(e.id),N?.(e.id)},onMouseEnter:()=>V(e.id),onMouseLeave:()=>V(null)},e.icon&&t.createElement("img",{src:e.icon,alt:"",style:$.categoryIcon}),e.label,e.count&&t.createElement("span",null,"(",e.count,")"))))),t.createElement("div",{style:{...$.content,maxHeight:v}},n?L?L():t.createElement("div",{style:$.loading},t.createElement("div",{style:$.spinner})):t.createElement(t.Fragment,null,J.length>0&&t.createElement("div",{style:$.suggestionsRow},J.slice(0,8).map((e,r)=>t.createElement("button",{key:e.id||r,"data-index":r,style:ut($.suggestionPill,W===r?$.suggestionPillActive:void 0,Q===r&&W!==r?$.suggestionPillHover:void 0),onClick:()=>C?.(e._raw,r),onMouseEnter:()=>{U(r),q(r)},onMouseLeave:()=>U(-1)},t.createElement("span",{style:$.suggestionIcon,dangerouslySetInnerHTML:{__html:a?lt(e.query,a,{tag:"strong"}):e.query}})))),se.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:$.sectionTitle},t.createElement(Wt,null),"Ideas for you"),t.createElement("div",{style:{...$.productsGrid,gridTemplateColumns:`repeat(${b}, 1fr)`}},se.slice(0,12).map((e,r)=>t.createElement("div",{key:e.id,style:ut($.productCard,H===e.id?$.productCardHover:void 0),onClick:()=>R?.(e._raw,r),onMouseEnter:()=>O(e.id),onMouseLeave:()=>O(null)},t.createElement("div",{style:$.productImageContainer},e.image?t.createElement("img",{src:e.image,alt:e.title,style:$.productImage,loading:"lazy"}):t.createElement("div",{style:$.productImagePlaceholder},t.createElement(qt,null)),g&&t.createElement("button",{style:ut($.productSaveBtn,H===e.id?$.productSaveBtnVisible:void 0),onClick:t=>{t.stopPropagation(),T?.(e._raw)},"aria-label":"Save"},t.createElement(Ft,null)),y&&void 0!==e.price&&t.createElement("div",{style:ut($.productOverlay,H===e.id?$.productOverlayVisible:void 0)},t.createElement("div",{style:$.productTitleOverlay},e.title),t.createElement("div",{style:$.productPriceOverlay},st(e.price,{currency:p.currency||e.currency||"$"})))),!y&&t.createElement("div",{style:$.productInfo},t.createElement("div",{style:$.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:$.productPrice},st(e.price,{currency:p.currency||e.currency||"$"}))))))),!n&&0===se.length&&0===J.length&&(P?P(a):t.createElement("div",{style:$.empty},t.createElement("div",{style:$.emptyIcon},t.createElement($t,null)),t.createElement("p",null,'No ideas found for "',a,'"'),t.createElement("p",{style:{fontSize:"14px",marginTop:"8px"}},"Try searching for something else"))))),void 0!==_?_:se.length>0&&t.createElement("div",{style:$.footer},t.createElement("span",{style:{color:"var(--seekora-text-secondary, #767676)",fontSize:"14px"}},se.length,"+ more ideas"),t.createElement("button",{style:ut($.viewAllBtn,X?$.viewAllBtnHover:void 0),onClick:()=>A?.("products"),onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1)},"Explore all")))}),Ot=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),jt=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})),Vt=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{d:"M10 2a4 4 0 00-4 4v1H5a1 1 0 00-.994.89l-1 9A1 1 0 004 18h12a1 1 0 00.994-1.11l-1-9A1 1 0 0015 7h-1V6a4 4 0 00-4-4zm2 5V6a2 2 0 10-4 0v1h4zm-6 3a1 1 0 112 0 1 1 0 01-2 0zm7-1a1 1 0 100 2 1 1 0 000-2z"})),Qt=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),Ut=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},productDisplay:u={},theme:p={},showPreview:m=!0,asOverlay:g=!0,placeholder:f="Search...",showShortcuts:h=!0,actions:y=[],width:b="680px",maxHeight:x="500px",zIndex:v=9999,className:k,style:E,classNames:S={},inputRef:w,onSuggestionSelect:C,onProductClick:R,onRecentClick:I,onClose:N,onSearchSubmit:T,header:A,footer:z,renderLoading:M,renderEmpty:_}=e;Rt();const L=St(),{isMobile:P}=L,B=t.useMemo(()=>({overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",zIndex:9999},root:{backgroundColor:"var(--seekora-bg-surface, rgba(255, 255, 255, 0.95))",borderRadius:"var(--seekora-border-radius, 12px)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.1)",overflow:"hidden",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif)',fontSize:"var(--seekora-font-size, 14px)",backdropFilter:"blur(20px)"},searchContainer:{display:"flex",alignItems:"center",padding:"12px 16px",gap:"12px",borderBottom:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))"},searchIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #86868b)",flexShrink:0},searchInput:{flex:1,border:"none",background:"transparent",fontSize:"17px",fontWeight:300,color:"var(--seekora-text-primary, #1d1d1f)",outline:"none",fontFamily:"inherit"},shortcut:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:"var(--seekora-text-tertiary, #86868b)"},kbd:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"20px",padding:"0 4px",backgroundColor:"var(--seekora-bg-tertiary, rgba(0,0,0,0.05))",borderRadius:"4px",fontSize:"11px",fontFamily:"SF Mono, Monaco, monospace"},content:{display:"flex",maxHeight:"400px"},resultsColumn:{flex:1,overflowY:"auto",minWidth:"300px"},previewColumn:{width:"280px",borderLeft:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))",backgroundColor:"var(--seekora-bg-secondary, rgba(0,0,0,0.02))",display:"flex",flexDirection:"column"},section:{padding:"8px 0"},sectionTitle:{padding:"8px 16px 6px",fontSize:"11px",fontWeight:600,color:"var(--seekora-text-tertiary, #86868b)",textTransform:"uppercase",letterSpacing:"0.5px"},item:{display:"flex",alignItems:"center",padding:"8px 16px",gap:"12px",cursor:"pointer",transition:"background-color 50ms",margin:"0 8px",borderRadius:"6px"},itemActive:{backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)"},itemIcon:{width:"32px",height:"32px",borderRadius:"6px",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f7)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-secondary, #515154)",flexShrink:0},itemIconActive:{backgroundColor:"rgba(255,255,255,0.2)",color:"var(--seekora-text-inverse, #ffffff)"},itemIconImage:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"6px"},itemContent:{flex:1,minWidth:0},itemTitle:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #1d1d1f)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemTitleActive:{color:"var(--seekora-text-inverse, #ffffff)"},itemSubtitle:{fontSize:"11px",color:"var(--seekora-text-secondary, #86868b)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:"2px"},itemSubtitleActive:{color:"var(--seekora-text-inverse, #ffffff)",opacity:.9},itemAction:{fontSize:"11px",color:"var(--seekora-text-tertiary, #86868b)",opacity:0,transition:"opacity 100ms"},itemActionVisible:{opacity:1},itemActionActive:{color:"var(--seekora-text-inverse, #ffffff)",opacity:.8},previewContent:{flex:1,padding:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},previewImage:{width:"160px",height:"160px",objectFit:"contain",borderRadius:"8px",marginBottom:"16px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},previewTitle:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #1d1d1f)",textAlign:"center",marginBottom:"4px"},previewSubtitle:{fontSize:"12px",color:"var(--seekora-text-secondary, #86868b)",textAlign:"center",marginBottom:"8px"},previewPrice:{fontSize:"18px",fontWeight:700,color:"var(--seekora-primary, #007aff)"},previewActions:{display:"flex",gap:"8px",marginTop:"16px"},previewAction:{padding:"6px 12px",fontSize:"12px",fontWeight:500,borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 100ms"},previewActionPrimary:{backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)"},previewActionSecondary:{backgroundColor:"var(--seekora-bg-tertiary, #f5f5f7)",color:"var(--seekora-text-primary, #1d1d1f)"},footer:{padding:"8px 16px",borderTop:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"var(--seekora-bg-secondary, rgba(0,0,0,0.02))",fontSize:"11px",color:"var(--seekora-text-tertiary, #86868b)"},footerActions:{display:"flex",alignItems:"center",gap:"16px"},footerAction:{display:"flex",alignItems:"center",gap:"4px"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--seekora-text-secondary, #86868b)"},spinner:{width:"24px",height:"24px",border:"2px solid var(--seekora-border-color, #e5e5e5)",borderTopColor:"var(--seekora-primary, #007aff)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #86868b)"}}),[]),D=t.useRef(null),$=t.useRef(null),[F,W]=t.useState(-1),q=t.useMemo(()=>s.map(e=>at(e,c)),[s,c]),H=t.useMemo(()=>i.map(e=>ot(e,d)),[i,d]),O=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,3),[l]),j=t.useMemo(()=>{const e=[];return y.forEach(t=>{e.push({type:"action",id:t.id,title:t.label,icon:t.icon,data:t})}),!a&&O.length>0&&O.forEach((r,a)=>{e.push({type:"recent",id:`recent-${a}`,title:r,icon:t.createElement(Qt,null),data:r})}),q.forEach((r,a)=>{e.push({type:"suggestion",id:r.id||`suggestion-${a}`,title:r.query,icon:t.createElement(jt,null),data:r})}),H.forEach((r,a)=>{e.push({type:"product",id:r.id,title:r.title,subtitle:r.brand,icon:t.createElement(Vt,null),image:r.image,price:r.price,data:r})}),e},[y,a,O,q,H]),V=t.useCallback(()=>{W(e=>Math.min(e+1,j.length-1))},[j.length]),Q=t.useCallback(()=>{W(e=>Math.max(e-1,-1))},[]),U=t.useCallback(()=>{if(F<0)return void(a.trim()&&T?.(a.trim()));const e=j[F];if(e)switch(e.type){case"action":e.data.onAction?.();break;case"recent":I?.(e.data);break;case"suggestion":C?.(e.data._raw,F);break;case"product":R?.(e.data._raw,F)}},[F,j,a,T,I,C,R]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>F,setActiveIndex:W,selectActive:U,navigateNext:V,navigatePrevious:Q,focus:()=>w?.current?.focus(),close:()=>N?.()}),[F,U,V,Q,w,N]),t.useEffect(()=>{if($.current&&F>=0){const e=$.current.querySelector(`[data-index="${F}"]`);e&&ht(e,$.current)}},[F]),t.useEffect(()=>{W(-1)},[a]),!o)return null;const G=ct(p),K=j[F],X=t.createElement("div",{ref:D,className:dt("seekora-spotlight-dropdown",k,S.root),style:ut(B.root,{width:b,zIndex:g?void 0:v},G,E)},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),t.createElement("div",{style:B.searchContainer},t.createElement("div",{style:B.searchIcon},t.createElement(Ot,null)),t.createElement("input",{ref:w,type:"text",placeholder:f,defaultValue:a,style:B.searchInput,onChange:e=>T?.(e.target.value),onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),V()):"ArrowUp"===e.key?(e.preventDefault(),Q()):"Enter"===e.key?(e.preventDefault(),U()):"Escape"===e.key&&N?.()},autoFocus:!0}),h&&t.createElement("div",{style:B.shortcut},t.createElement("span",{style:B.kbd},"⌘"),t.createElement("span",{style:B.kbd},"K"))),A,t.createElement("div",{style:B.content},t.createElement("div",{ref:$,style:{...B.resultsColumn,maxHeight:x}},n?M?M():t.createElement("div",{style:B.loading},t.createElement("div",{style:B.spinner})):0===j.length?_?_(a):t.createElement("div",{style:B.empty},'No results for "',a,'"'):t.createElement(t.Fragment,null,y.length>0&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Actions"),j.filter(e=>"action"===e.type).map(e=>{const r=j.indexOf(e),a=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:ut(B.item,a?B.itemActive:void 0),onClick:()=>{W(r),U()},onMouseEnter:()=>W(r)},t.createElement("div",{style:ut(B.itemIcon,a?B.itemIconActive:void 0)},e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:ut(B.itemTitle,a?B.itemTitleActive:void 0)},e.title)))})),O.length>0&&!a&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Recent"),j.filter(e=>"recent"===e.type).map(e=>{const r=j.indexOf(e),a=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:ut(B.item,a?B.itemActive:void 0),onClick:()=>{W(r),I?.(e.data)},onMouseEnter:()=>W(r)},t.createElement("div",{style:ut(B.itemIcon,a?B.itemIconActive:void 0)},e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:ut(B.itemTitle,a?B.itemTitleActive:void 0)},e.title)))})),q.length>0&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Suggestions"),j.filter(e=>"suggestion"===e.type).map(e=>{const r=j.indexOf(e),o=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:ut(B.item,o?B.itemActive:void 0),onClick:()=>{W(r),C?.(e.data._raw,r)},onMouseEnter:()=>W(r)},t.createElement("div",{style:ut(B.itemIcon,o?B.itemIconActive:void 0)},e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:ut(B.itemTitle,o?B.itemTitleActive:void 0),dangerouslySetInnerHTML:{__html:lt(e.title,a,{tag:"strong"})}})))})),H.length>0&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Products"),j.filter(e=>"product"===e.type).map(e=>{const r=j.indexOf(e),a=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:ut(B.item,a?B.itemActive:void 0),onClick:()=>{W(r),R?.(e.data._raw,r)},onMouseEnter:()=>W(r)},t.createElement("div",{style:ut(B.itemIcon,a?B.itemIconActive:void 0)},e.image?t.createElement("img",{src:e.image,alt:"",style:B.itemIconImage}):e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:ut(B.itemTitle,a?B.itemTitleActive:void 0)},e.title),e.subtitle&&t.createElement("div",{style:ut(B.itemSubtitle,a?B.itemSubtitleActive:void 0)},e.subtitle)),void 0!==e.price&&t.createElement("span",{style:ut(B.itemAction,B.itemActionVisible,a?B.itemActionActive:void 0)},st(e.price,{currency:u.currency})))})))),m&&K&&"product"===K.type&&t.createElement("div",{style:B.previewColumn},t.createElement("div",{style:B.previewContent},K.image&&t.createElement("img",{src:K.image,alt:"",style:B.previewImage}),t.createElement("div",{style:B.previewTitle},K.title),K.subtitle&&t.createElement("div",{style:B.previewSubtitle},K.subtitle),void 0!==K.price&&t.createElement("div",{style:B.previewPrice},st(K.price,{currency:u.currency})),t.createElement("div",{style:B.previewActions},t.createElement("button",{style:{...B.previewAction,...B.previewActionPrimary},onClick:()=>R?.(K.data._raw,F)},"View Product"))))),void 0!==z?z:t.createElement("div",{style:B.footer},t.createElement("div",{style:B.footerActions},t.createElement("span",{style:B.footerAction},t.createElement("span",{style:B.kbd},"↑"),t.createElement("span",{style:B.kbd},"↓"),"navigate"),t.createElement("span",{style:B.footerAction},t.createElement("span",{style:B.kbd},"↵"),"select"),t.createElement("span",{style:B.footerAction},t.createElement("span",{style:B.kbd},"esc"),"close")),t.createElement("span",null,j.length," results")));return g?t.createElement("div",{style:{...B.overlay,zIndex:v},onClick:e=>{e.target===e.currentTarget&&N?.()}},X):X}),Gt=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},t.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z"})),Kt=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor"},t.createElement("path",{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"})),Xt=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},categoryFields:u={id:"id",label:"label"},productDisplay:p={},theme:m={},showHeroProduct:g=!0,showCollections:f=!0,showAddToCart:h=!0,addToCartText:y="Quick Add",showComparePrice:b=!0,width:x="100%",maxHeight:v="500px",zIndex:k=1e3,className:E,style:S,classNames:w={},onSuggestionSelect:C,onProductClick:R,onCategoryClick:I,onTabChange:N,onAddToCart:T,onViewAll:A,onClose:z,header:M,footer:_,renderLoading:L,renderEmpty:P}=e;Rt();const B=St(),{isMobile:D}=B,$=t.useMemo(()=>((e=!1)=>({root:{position:e?"fixed":"absolute",top:e?0:"100%",left:0,right:0,bottom:e?0:"auto",marginTop:e?0:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #121212)",borderRadius:e?0:"16px",boxShadow:e?"none":"0 4px 30px rgba(0, 0, 0, 0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:e?"16px":"14px",display:"flex",flexDirection:"column"},layout:{display:e?"flex":"grid",flexDirection:"column",gridTemplateColumns:e?"1fr":"1fr 1fr",minHeight:e?"auto":"400px",flex:1,overflowY:"auto"},leftPanel:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRight:e?"none":"1px solid var(--seekora-border-color, #e8e8e1)",borderBottom:e?"1px solid var(--seekora-border-color, #e8e8e1)":"none",display:"flex",flexDirection:"column"},rightPanel:{backgroundColor:"var(--seekora-bg-secondary, #fafafa)",padding:e?"16px":"24px",display:"flex",flexDirection:"column",overflow:"hidden"},section:{flex:1,overflowY:"auto"},sectionHeader:{padding:"16px 20px 12px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--seekora-border-color, #e8e8e1)"},sectionTitle:{fontSize:"11px",fontWeight:600,color:"var(--seekora-text-secondary, #666)",textTransform:"uppercase",letterSpacing:"0.1em"},viewAllLink:{fontSize:"12px",color:"var(--seekora-text-primary, #121212)",textDecoration:"underline",cursor:"pointer"},suggestionItem:{display:"flex",alignItems:"center",padding:e?"14px 16px":"12px 16px",gap:"12px",cursor:"pointer",transition:"all 150ms ease",minHeight:"48px",margin:"4px 8px",borderRadius:"10px",color:"var(--seekora-text-primary, #121212)"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #121212)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #999999)",flexShrink:0},suggestionContent:{flex:1,minWidth:0},suggestionQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #121212)",fontWeight:400},suggestionMeta:{fontSize:"12px",color:"var(--seekora-text-secondary, #666)",marginTop:"2px"},suggestionArrow:{width:"16px",height:"16px",color:"var(--seekora-text-tertiary, #ccc)",transform:"rotate(-45deg)",opacity:0,transition:"opacity 150ms"},suggestionArrowVisible:{opacity:1},collectionsGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"1px",backgroundColor:"var(--seekora-border-color, #e8e8e1)",borderTop:"1px solid var(--seekora-border-color, #e8e8e1)"},collectionItem:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #121212)",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms"},collectionItemHover:{backgroundColor:"var(--seekora-bg-hover, #f0f0f0)",color:"var(--seekora-text-primary, #121212)"},collectionName:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #121212)",marginBottom:"4px"},collectionCount:{fontSize:"11px",color:"var(--seekora-text-secondary, #666)"},heroProduct:{marginBottom:"24px"},heroImage:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:"2px",marginBottom:"16px",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f5)"},heroTitle:{fontSize:"16px",fontWeight:500,color:"var(--seekora-text-primary, #121212)",marginBottom:"8px",lineHeight:1.3},heroBrand:{fontSize:"12px",color:"var(--seekora-text-secondary, #666)",marginBottom:"12px",textTransform:"uppercase",letterSpacing:"0.05em"},heroPricing:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"16px"},heroPrice:{fontSize:"18px",fontWeight:500,color:"var(--seekora-text-primary, #121212)"},heroComparePrice:{fontSize:"14px",color:"var(--seekora-text-tertiary, #999)",textDecoration:"line-through"},heroDiscount:{fontSize:"12px",fontWeight:600,color:"var(--seekora-error, #d02e2e)",backgroundColor:"var(--seekora-error-light, #fdf2f2)",padding:"2px 8px",borderRadius:"2px"},heroButton:{width:"100%",padding:"14px 20px",backgroundColor:"var(--seekora-text-primary, #121212)",color:"var(--seekora-bg-surface, #ffffff)",border:"none",borderRadius:"2px",fontSize:"13px",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.1em",cursor:"pointer",transition:"background-color 150ms"},heroButtonHover:{backgroundColor:"var(--seekora-text-secondary, #666666)",color:"var(--seekora-bg-surface, #ffffff)"},productsScroll:{flex:1,overflowX:"auto",overflowY:"hidden",display:"flex",gap:"16px",paddingBottom:"8px",scrollbarWidth:"thin"},productCard:{flex:"0 0 140px",cursor:"pointer",transition:"opacity 150ms"},productCardHover:{opacity:.7},productImage:{width:"140px",height:"175px",objectFit:"cover",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f5)",marginBottom:"10px"},productTitle:{fontSize:"12px",color:"var(--seekora-text-primary, #121212)",marginBottom:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},productPrice:{fontSize:"12px",fontWeight:500,color:"var(--seekora-text-primary, #121212)"},footer:{padding:"12px 20px",borderTop:"1px solid var(--seekora-border-color, #e8e8e1)",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"11px",color:"var(--seekora-text-secondary, #666)"},footerLink:{color:"var(--seekora-text-primary, #121212)",textDecoration:"underline",cursor:"pointer"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #666)"},spinner:{width:"24px",height:"24px",border:"2px solid var(--seekora-border-color, #e8e8e1)",borderTopColor:"var(--seekora-text-primary, #121212)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)"},highlight:{fontWeight:600,textDecoration:"underline",textDecorationColor:"var(--seekora-text-primary, #121212)"}}))(D),[D]),F=t.useRef(null),[W,q]=t.useState(-1),[H,O]=t.useState(null),[j,V]=t.useState(null),[Q,U]=t.useState(!1),G=t.useMemo(()=>s.map(e=>at(e,c)),[s,c]),K=t.useMemo(()=>i.map(e=>ot(e,d)),[i,d]),X=t.useMemo(()=>l.map(e=>nt(e,u)),[l,u]),Y=K[0],J=K.slice(1,7),Z=t.useCallback(()=>{q(e=>Math.min(e+1,G.length-1))},[G.length]),ee=t.useCallback(()=>{q(e=>Math.max(e-1,-1))},[]),te=t.useCallback(()=>{W>=0&&G[W]&&C?.(G[W]._raw,W)},[W,G,C]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>W,setActiveIndex:q,selectActive:te,navigateNext:Z,navigatePrevious:ee,focus:()=>F.current?.focus(),close:()=>z?.()}),[W,te,Z,ee,z]),t.useEffect(()=>{if(W>=0&&F.current){const e=F.current.querySelector(`[data-index="${W}"]`);e&&ht(e,F.current)}},[W]),!o)return null;const re=ct(m),ae=Y?((e,t)=>{if(e&&t&&!(t<=e))return Math.round((t-e)/t*100)})(Y.price,Y.comparePrice):void 0;return t.createElement("div",{ref:F,role:"listbox","aria-label":"Search suggestions",className:dt("seekora-shopify-dropdown",E,w.root),style:ut($.root,{width:D?"100%":x,maxHeight:D?"100vh":v,zIndex:k},re,S),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-shopify-dropdown mark {\n background: transparent;\n text-decoration: underline;\n font-weight: 600;\n }\n "),M,n?L?L():t.createElement("div",{style:$.loading},t.createElement("div",{style:$.spinner})):t.createElement("div",{style:$.layout},t.createElement("div",{style:$.leftPanel},t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Suggestions"),G.length>5&&t.createElement("span",{style:$.viewAllLink,onClick:()=>A?.("suggestions")},"View all")),G.slice(0,5).map((e,r)=>{const o=W===r;return t.createElement("div",{key:e.id||r,"data-index":r,role:"option","aria-selected":o,style:ut($.suggestionItem,o?$.suggestionItemActive:void 0),onClick:()=>C?.(e._raw,r),onMouseEnter:()=>q(r)},t.createElement("div",{style:$.suggestionIcon},t.createElement(Gt,null)),t.createElement("div",{style:$.suggestionContent},t.createElement("div",{style:$.suggestionQuery,dangerouslySetInnerHTML:{__html:lt(e.query,a,{tag:"mark"})}}),e.count&&t.createElement("div",{style:$.suggestionMeta},e.count," results")),t.createElement("div",{style:ut($.suggestionArrow,o?$.suggestionArrowVisible:void 0)},t.createElement(Kt,null)))}),0===G.length&&a&&(P?P(a):t.createElement("div",{style:{padding:"20px",textAlign:"center",color:"#666"}},'No suggestions for "',a,'"'))),f&&X.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Collections")),t.createElement("div",{style:$.collectionsGrid},X.slice(0,4).map(e=>t.createElement("div",{key:e.id,style:ut($.collectionItem,j===e.id?$.collectionItemHover:void 0),onClick:()=>N?.(e.id),onMouseEnter:()=>V(e.id),onMouseLeave:()=>V(null)},t.createElement("div",{style:$.collectionName},e.label),e.count&&t.createElement("div",{style:$.collectionCount},e.count," products")))))),t.createElement("div",{style:$.rightPanel},g&&Y&&t.createElement("div",{style:$.heroProduct},Y.image&&t.createElement("img",{src:Y.image,alt:Y.title,style:$.heroImage,loading:"lazy"}),Y.brand&&t.createElement("div",{style:$.heroBrand},Y.brand),t.createElement("div",{style:$.heroTitle},Y.title),t.createElement("div",{style:$.heroPricing},t.createElement("span",{style:$.heroPrice},st(Y.price,{currency:p.currency||Y.currency||"$"})),b&&Y.comparePrice&&t.createElement("span",{style:$.heroComparePrice},st(Y.comparePrice,{currency:p.currency||Y.currency||"$"})),ae&&t.createElement("span",{style:$.heroDiscount},"-",ae,"%")),h&&t.createElement("button",{style:ut($.heroButton,Q?$.heroButtonHover:void 0),onClick:()=>T?.(Y._raw),onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1)},y)),J.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:{...$.sectionTitle,marginBottom:"12px"}},"More Products"),t.createElement("div",{style:$.productsScroll},J.map((e,r)=>t.createElement("div",{key:e.id,style:ut($.productCard,H===e.id?$.productCardHover:void 0),onClick:()=>R?.(e._raw,r+1),onMouseEnter:()=>O(e.id),onMouseLeave:()=>O(null)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:$.productImage,loading:"lazy"}):t.createElement("div",{style:$.productImage}),t.createElement("div",{style:$.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:$.productPrice},st(e.price,{currency:p.currency||e.currency||"$"})))))))),void 0!==_?_:t.createElement("div",{style:$.footer},t.createElement("span",null,"Press ",t.createElement("strong",null,"Enter")," to search, ",t.createElement("strong",null,"↑↓")," to navigate"),t.createElement("span",{style:$.footerLink,onClick:()=>A?.("products")},"View all results")))}),Yt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("circle",{cx:"11",cy:"11",r:"7"}),t.createElement("path",{d:"M21 21l-4.35-4.35"})),Jt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"})),Zt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),t.createElement("polyline",{points:"17 6 23 6 23 12"})),er=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"20",height:"20"},t.createElement("polyline",{points:"9 18 15 12 9 6"})),tr=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"20",height:"20"},t.createElement("path",{d:"M7 17l5-5-5-5M13 17l5-5-5-5"})),rr=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],trendingSearches:c=[],suggestionFields:d={query:"query"},productFields:u={id:"id",title:"title"},productDisplay:p={},theme:m={},showSearchInput:g=!0,showCancel:f=!0,cancelText:h="Cancel",showDragHandle:y=!0,swipeToDismiss:b=!0,footerButtonText:x="Search",showFooterButton:v=!0,width:k="100%",maxHeight:E="85vh",zIndex:S=9999,className:w,style:C,classNames:R={},inputRef:I,onSuggestionSelect:N,onProductClick:T,onRecentClick:A,onRecentClearAll:z,onSearchSubmit:M,onClose:_,header:L,footer:P,renderLoading:B,renderEmpty:D}=e;Rt();const $=t.useMemo(()=>({overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:9998,transition:"opacity 200ms ease"},root:{position:"fixed",left:0,right:0,bottom:0,backgroundColor:"var(--seekora-bg-surface, #fff)",borderRadius:"16px 16px 0 0",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.15)",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif)',fontSize:"var(--seekora-font-size, 16px)",zIndex:9999,transform:"translateY(0)",transition:"transform 300ms cubic-bezier(0.32, 0.72, 0, 1)",maxHeight:"90vh",display:"flex",flexDirection:"column"},rootHidden:{transform:"translateY(100%)"},dragHandle:{display:"flex",justifyContent:"center",padding:"12px",cursor:"grab"},dragBar:{width:"36px",height:"5px",backgroundColor:"var(--seekora-border-color, #e0e0e0)",borderRadius:"3px"},header:{padding:"0 16px 16px",borderBottom:"1px solid var(--seekora-border-color, #f0f0f0)"},searchContainer:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",borderRadius:"12px",padding:"12px 16px",gap:"12px"},searchIcon:{width:"20px",height:"20px",color:"var(--seekora-text-tertiary, #8e8e93)",flexShrink:0},searchInput:{flex:1,border:"none",background:"transparent",fontSize:"17px",color:"var(--seekora-text-primary, #000)",outline:"none"},cancelBtn:{padding:"8px",background:"none",border:"none",color:"var(--seekora-primary, #007aff)",fontSize:"17px",cursor:"pointer"},content:{flex:1,overflowY:"auto",overscrollBehavior:"contain",WebkitOverflowScrolling:"touch"},section:{padding:"8px 0"},sectionHeader:{padding:"16px 16px 8px",display:"flex",alignItems:"center",justifyContent:"space-between"},sectionTitle:{fontSize:"13px",fontWeight:600,color:"var(--seekora-text-secondary, #8e8e93)",textTransform:"uppercase",letterSpacing:"0.5px"},clearBtn:{fontSize:"15px",color:"var(--seekora-primary, #007aff)",background:"none",border:"none",cursor:"pointer"},item:{display:"flex",alignItems:"center",padding:"14px 16px",gap:"14px",cursor:"pointer",transition:"background-color 100ms",minHeight:"56px",color:"var(--seekora-text-primary, #000)"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f2f2f7)",color:"var(--seekora-text-primary, #000)"},itemIcon:{width:"24px",height:"24px",color:"var(--seekora-text-tertiary, #8e8e93)",flexShrink:0},itemImage:{width:"48px",height:"48px",borderRadius:"8px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",flexShrink:0},itemContent:{flex:1,minWidth:0},itemTitle:{fontSize:"17px",color:"var(--seekora-text-primary, #000)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemSubtitle:{fontSize:"15px",color:"var(--seekora-text-secondary, #8e8e93)",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemAction:{color:"var(--seekora-text-tertiary, #c7c7cc)",flexShrink:0},productsScroll:{display:"flex",gap:"12px",padding:"0 16px 16px",overflowX:"auto",scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch"},productCard:{flex:"0 0 140px",scrollSnapAlign:"start",cursor:"pointer"},productImage:{width:"140px",height:"140px",borderRadius:"12px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",marginBottom:"8px"},productTitle:{fontSize:"15px",color:"var(--seekora-text-primary, #000)",marginBottom:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},productPrice:{fontSize:"15px",fontWeight:600,color:"var(--seekora-text-primary, #000)"},footer:{padding:"12px 16px",paddingBottom:"calc(12px + env(safe-area-inset-bottom, 0px))",borderTop:"1px solid var(--seekora-border-color, #f0f0f0)",backgroundColor:"var(--seekora-bg-secondary, #f8f8f8)"},footerBtn:{width:"100%",padding:"16px",backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",borderRadius:"12px",fontSize:"17px",fontWeight:600,cursor:"pointer"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #8e8e93)"},spinner:{width:"28px",height:"28px",border:"3px solid var(--seekora-border-color, #e5e5ea)",borderTopColor:"var(--seekora-primary, #007aff)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #8e8e93)",fontSize:"17px"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 16px",color:"var(--seekora-text-tertiary, #c7c7cc)"}}),[]),F=t.useRef(null),[W,q]=t.useState(-1),[H,O]=t.useState(a),[j,V]=t.useState(0),[Q,U]=t.useState(!1),G=t.useRef(0),K=t.useMemo(()=>s.map(e=>at(e,d)),[s,d]),X=t.useMemo(()=>i.map(e=>ot(e,u)),[i,u]),Y=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,5),[l]),J=t.useMemo(()=>c.map(e=>"string"==typeof e?e:e.query).slice(0,5),[c]),Z=t.useMemo(()=>{const e=[];return Y.forEach(t=>e.push({type:"recent",data:t})),J.forEach(t=>e.push({type:"trending",data:t})),K.forEach(t=>e.push({type:"suggestion",data:t})),e},[Y,J,K]),ee=t.useCallback(()=>{q(e=>Math.min(e+1,Z.length-1))},[Z.length]),te=t.useCallback(()=>{q(e=>Math.max(e-1,-1))},[]),re=t.useCallback(()=>{if(W<0||W>=Z.length)return void(H.trim()&&M?.(H.trim()));const e=Z[W];"recent"===e.type||"trending"===e.type?A?.(e.data):"suggestion"===e.type&&N?.(e.data._raw,W)},[W,Z,H,M,A,N]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>W,setActiveIndex:q,selectActive:re,navigateNext:ee,navigatePrevious:te,focus:()=>I?.current?.focus(),close:()=>_?.()}),[W,re,ee,te,I,_]),t.useEffect(()=>{if(W>=0&&F.current){const e=F.current.querySelector(`[data-index="${W}"]`);e&&ht(e,F.current)}},[W]);if(t.useEffect(()=>{O(a)},[a]),!o)return null;const ae=ct(m),oe=!H&&Y.length>0,ne=!H&&J.length>0,se=X.length>0;return t.createElement(t.Fragment,null,t.createElement("div",{style:{...$.overlay,opacity:Q?1-j/300:1},onClick:_}),t.createElement("div",{ref:F,className:dt("seekora-mobile-sheet",w,R.root),style:ut($.root,{maxHeight:E,zIndex:S,transform:Q?`translateY(${j}px)`:"translateY(0)"},ae,C),onTouchStart:e=>{b&&(U(!0),G.current=e.touches[0].clientY)},onTouchMove:e=>{if(!Q)return;const t=e.touches[0].clientY-G.current;t>0&&V(t)},onTouchEnd:()=>{Q&&(U(!1),j>150&&_?.(),V(0))}},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),y&&t.createElement("div",{style:$.dragHandle},t.createElement("div",{style:$.dragBar})),(g||L)&&t.createElement("div",{style:$.header},L||t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},t.createElement("div",{style:$.searchContainer},t.createElement("div",{style:$.searchIcon},t.createElement(Yt,null)),t.createElement("input",{ref:I,type:"text",placeholder:"Search...",value:H,onChange:e=>O(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),W>=0?re():H.trim()&&M?.(H.trim())):"ArrowDown"===e.key?(e.preventDefault(),ee()):"ArrowUp"===e.key?(e.preventDefault(),te()):"Escape"===e.key&&_?.()},style:$.searchInput,autoFocus:!0})),f&&t.createElement("button",{style:$.cancelBtn,onClick:_},h))),t.createElement("div",{style:$.content},n?B?B():t.createElement("div",{style:$.loading},t.createElement("div",{style:$.spinner})):t.createElement(t.Fragment,null,oe&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Recent"),t.createElement("button",{style:$.clearBtn,onClick:z},"Clear")),Y.map((e,r)=>t.createElement("div",{key:`recent-${e}`,"data-index":r,style:ut($.item,W===r?$.itemActive:void 0),onClick:()=>{A?.(e),O(e)},onMouseEnter:()=>q(r)},t.createElement("div",{style:$.itemIcon},t.createElement(Jt,null)),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:$.itemTitle},e)),t.createElement("div",{style:$.itemAction},t.createElement(tr,null))))),ne&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Trending")),J.map((e,r)=>{const a=Y.length+r;return t.createElement("div",{key:`trending-${e}`,"data-index":a,style:ut($.item,W===a?$.itemActive:void 0),onClick:()=>{A?.(e),O(e)},onMouseEnter:()=>q(a)},t.createElement("div",{style:$.itemIcon},t.createElement(Zt,null)),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:$.itemTitle},e)),t.createElement("div",{style:$.itemAction},t.createElement(er,null)))})),H&&K.length>0&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Suggestions")),K.map((e,r)=>{const a=Y.length+J.length+r;return t.createElement("div",{key:e.id||r,"data-index":a,style:ut($.item,W===a?$.itemActive:void 0),onClick:()=>N?.(e._raw,r),onMouseEnter:()=>q(a)},t.createElement("div",{style:$.itemIcon},t.createElement(Yt,null)),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:$.itemTitle,dangerouslySetInnerHTML:{__html:lt(e.query,H,{tag:"strong"})}}),e.count&&t.createElement("div",{style:$.itemSubtitle},e.count," results")),t.createElement("div",{style:$.itemAction},t.createElement(er,null)))})),se&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Products")),t.createElement("div",{style:$.productsScroll},X.slice(0,8).map((e,r)=>t.createElement("div",{key:e.id,style:$.productCard,onClick:()=>T?.(e._raw,r)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:$.productImage,loading:"lazy"}):t.createElement("div",{style:$.productImage}),t.createElement("div",{style:$.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:$.productPrice},st(e.price,{currency:p.currency||e.currency||"$"})))))),H&&0===K.length&&!n&&(D?D(H):t.createElement("div",{style:$.empty},t.createElement("div",{style:$.emptyIcon},t.createElement(Yt,null)),t.createElement("p",null,'No results for "',H,'"'))))),void 0!==P?P:v&&H&&t.createElement("div",{style:$.footer},t.createElement("button",{style:$.footerBtn,onClick:()=>M?.(H)},x,' "',H,'"'))))}),ar=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},productDisplay:u={},theme:p={},showIndices:m=!1,showTypeLabels:g=!1,showSectionDividers:f=!0,width:h="100%",maxHeight:y="400px",zIndex:b=1e3,className:x,style:v,classNames:k={},onSuggestionSelect:E,onProductClick:S,onRecentClick:w,onClose:C,onSearchSubmit:R,header:I,footer:N,renderLoading:T,renderEmpty:A}=e;Rt();const z=St(),{isMobile:M}=z,_=t.useMemo(()=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e5e5)",fontFamily:'var(--seekora-font-family, "Inter", -apple-system, sans-serif)',fontSize:"var(--seekora-font-size, 15px)",letterSpacing:"-0.01em"},item:{display:"flex",alignItems:"center",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms ease, padding-left 150ms ease",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)",gap:"16px",color:"var(--seekora-text-primary, #111)"},itemLast:{borderBottom:"none"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #111)",paddingLeft:"24px"},itemIndex:{fontSize:"11px",fontWeight:500,color:"var(--seekora-text-tertiary, #999)",fontFamily:"monospace",minWidth:"20px"},itemContent:{flex:1,minWidth:0},itemQuery:{fontSize:"15px",fontWeight:500,color:"var(--seekora-text-primary, #111)"},itemMeta:{fontSize:"13px",color:"var(--seekora-text-secondary, #666)",marginTop:"4px",fontWeight:400},itemType:{fontSize:"10px",fontWeight:600,color:"var(--seekora-text-tertiary, #999)",textTransform:"uppercase",letterSpacing:"0.1em",padding:"4px 8px",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)"},productRow:{display:"flex",alignItems:"center",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms ease",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)",gap:"16px",color:"var(--seekora-text-primary, #111)"},productRowActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #111)"},productImage:{width:"56px",height:"56px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",flexShrink:0},productContent:{flex:1,minWidth:0},productTitle:{fontSize:"14px",fontWeight:500,color:"var(--seekora-text-primary, #111)",marginBottom:"4px"},productPrice:{fontSize:"14px",color:"var(--seekora-text-secondary, #666)"},divider:{padding:"12px 20px 8px",fontSize:"10px",fontWeight:600,color:"var(--seekora-text-tertiary, #999)",textTransform:"uppercase",letterSpacing:"0.15em",backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderBottom:"1px solid var(--seekora-border-color, #f0f0f0)"},footer:{padding:"12px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",fontSize:"12px",color:"var(--seekora-text-tertiary, #999)",borderTop:"1px solid var(--seekora-border-color, #e5e5e5)"},footerHint:{display:"flex",alignItems:"center",gap:"12px"},kbd:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"2px 6px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #ddd)",fontSize:"10px",fontFamily:"monospace"},loading:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)",fontSize:"14px"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)",fontSize:"14px"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fff3cd)",padding:"0 2px"}}),[]),L=t.useRef(null),P=t.useRef(null),[B,D]=t.useState(-1),$=t.useMemo(()=>s.map(e=>at(e,c)),[s,c]),F=t.useMemo(()=>i.map(e=>ot(e,d)),[i,d]),W=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,3),[l]),q=t.useMemo(()=>{const e=[];return!a&&W.length>0&&W.forEach(t=>e.push({type:"recent",data:t})),$.forEach(t=>e.push({type:"suggestion",data:t})),F.forEach(t=>e.push({type:"product",data:t})),e},[a,W,$,F]),H=t.useCallback(()=>{D(e=>Math.min(e+1,q.length-1))},[q.length]),O=t.useCallback(()=>{D(e=>Math.max(e-1,-1))},[]),j=t.useCallback(()=>{const e=q[B];if(e)switch(e.type){case"recent":w?.(e.data);break;case"suggestion":E?.(e.data._raw,B);break;case"product":S?.(e.data._raw,B)}else a&&R?.(a)},[B,q,a,R,w,E,S]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>B,setActiveIndex:D,selectActive:j,navigateNext:H,navigatePrevious:O,focus:()=>L.current?.focus(),close:()=>C?.()}),[B,j,H,O,C]),t.useEffect(()=>{if(P.current&&B>=0){const e=P.current.querySelector(`[data-index="${B}"]`);e&&ht(e,P.current)}},[B]),t.useEffect(()=>{D(-1)},[a]),!o)return null;const V=ct(p),Q=!a&&W.length>0;let U=0;return t.createElement("div",{ref:L,role:"listbox","aria-label":"Search suggestions",className:dt("seekora-minimal-dropdown",x,k.root),style:ut(_.root,{width:h,zIndex:b},V,v),tabIndex:-1},t.createElement("style",null,"\n .seekora-minimal-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fff3cd);\n padding: 0 2px;\n }\n "),I,t.createElement("div",{ref:P,style:{maxHeight:y,overflowY:"auto"}},n?T?T():t.createElement("div",{style:_.loading},"Loading..."):0===q.length?A?A(a):t.createElement("div",{style:_.empty},a?`No results for "${a}"`:"Start typing to search"):t.createElement(t.Fragment,null,Q&&t.createElement(t.Fragment,null,f&&t.createElement("div",{style:_.divider},"Recent"),W.map((e,r)=>{const a=U++,o=B===a,n=r===W.length-1&&!$.length&&!F.length;return t.createElement("div",{key:`recent-${e}`,"data-index":a,style:ut(_.item,o?_.itemActive:void 0,n?_.itemLast:void 0),onClick:()=>w?.(e),onMouseEnter:()=>D(a)},m&&t.createElement("span",{style:_.itemIndex},a+1),t.createElement("div",{style:_.itemContent},t.createElement("div",{style:_.itemQuery},e)),g&&t.createElement("span",{style:_.itemType},"Recent"))})),$.length>0&&t.createElement(t.Fragment,null,f&&(Q||!1)&&t.createElement("div",{style:_.divider},"Suggestions"),$.map((e,r)=>{const o=U++,n=B===o,s=r===$.length-1&&!F.length;return t.createElement("div",{key:e.id||`suggestion-${r}`,"data-index":o,style:ut(_.item,n?_.itemActive:void 0,s?_.itemLast:void 0),onClick:()=>E?.(e._raw,r),onMouseEnter:()=>D(o)},m&&t.createElement("span",{style:_.itemIndex},o+1),t.createElement("div",{style:_.itemContent},t.createElement("div",{style:_.itemQuery,dangerouslySetInnerHTML:{__html:lt(e.query,a,{tag:"mark"})}}),e.count&&t.createElement("div",{style:_.itemMeta},e.count.toLocaleString()," results")),g&&t.createElement("span",{style:_.itemType},"Search"))})),F.length>0&&t.createElement(t.Fragment,null,f&&t.createElement("div",{style:_.divider},"Products"),F.slice(0,4).map((e,r)=>{const a=U++,o=B===a;return t.createElement("div",{key:e.id,"data-index":a,style:ut(_.productRow,o?_.productRowActive:void 0),onClick:()=>S?.(e._raw,r),onMouseEnter:()=>D(a)},e.image&&t.createElement("img",{src:e.image,alt:e.title,style:_.productImage,loading:"lazy"}),t.createElement("div",{style:_.productContent},t.createElement("div",{style:_.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:_.productPrice},st(e.price,{currency:u.currency||e.currency||"$"}))),g&&t.createElement("span",{style:_.itemType},"Product"))})))),void 0!==N?N:t.createElement("div",{style:_.footer},t.createElement("div",{style:_.footerHint},t.createElement("span",null,t.createElement("span",{style:_.kbd},"↑")," ",t.createElement("span",{style:_.kbd},"↓")," navigate"),t.createElement("span",null,t.createElement("span",{style:_.kbd},"↵")," select"),t.createElement("span",null,t.createElement("span",{style:_.kbd},"esc")," close")),t.createElement("span",null,q.length," results")))});function or(e){if(!e)return;const t=e,r=t.colors??{};return{backgroundColor:t.backgroundColor??r.background,textColor:t.textColor??r.text,surfaceColor:t.surfaceColor??r.hover,borderColor:t.borderColor??r.border,hoverColor:t.hoverColor??r.hover,primaryColor:t.primaryColor??r.primary,textSecondaryColor:t.textSecondaryColor??r.text,fontFamily:t.fontFamily}}const nr={amazon:Mt,google:Dt,pinterest:Ht,spotlight:Ut,shopify:Xt,"mobile-sheet":rr,minimal:ar},sr=t.forwardRef(function(e,r){const{client:a,variant:o="amazon",autoMobileVariant:n=!0,placeholder:s="Search...",defaultQuery:i="",value:l,minQueryLength:c=1,maxSuggestions:d=8,debounceMs:u=200,includeDropdownRecommendations:p=!0,includeDropdownProductList:m=!0,includeFilteredTabs:g=!0,includeCategories:f=!0,filteredTabs:h,analyticsTags:y,enableRecentSearches:b=!0,maxRecentSearches:x=10,showProducts:v=!0,showTrendingOnEmpty:k=!0,enableAnalytics:E=!0,analyticsConfig:w,suggestionFields:C,productFields:R,theme:I,onSearch:N,onQueryChange:T,onSuggestionSelect:A,onProductClick:z,onCategoryClick:M,onTabChange:_,className:L,style:P,inputClassName:B,dropdownWidth:D,dropdownMaxHeight:$="500px",zIndex:F=1e3,enableCache:W=!0,cacheTtlMs:q=3e4,cacheMaxSize:H=100}=e,O=S(),j=I??O.theme,V=fe({client:a,enabled:E,analyticsTags:w?.tags??y,trackImpressions:w?.trackImpressions??!0,trackClicks:w?.trackSuggestionClicks??!0});Rt(),t.useEffect(()=>{const e=document.documentElement,t=function(e){if(!e)return{"--seekora-bg-surface":"#ffffff","--seekora-bg-secondary":"#f7f7f7","--seekora-bg-tertiary":"#f0f0f0","--seekora-bg-hover":"#f5f5f5","--seekora-text-primary":"#0f1111","--seekora-text-secondary":"#565959","--seekora-text-tertiary":"#767676","--seekora-border-color":"#e7e7e7","--seekora-primary":"#f90","--seekora-text-on-primary":"#0f1111","--seekora-text-inverse":"#ffffff","--seekora-link":"#007185","--seekora-font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'};const t=e,r=t.colors??{};return{"--seekora-bg-surface":t.backgroundColor??r.background??"#ffffff","--seekora-bg-secondary":t.surfaceColor??r.hover??"#f7f7f7","--seekora-bg-tertiary":t.hoverColor??r.hover??"#f0f0f0","--seekora-bg-hover":t.hoverColor??r.hover??"#f5f5f5","--seekora-text-primary":t.textColor??r.text??"#0f1111","--seekora-text-secondary":t.textSecondaryColor??r.text??"#565959","--seekora-text-tertiary":t.textSecondaryColor??"#767676","--seekora-border-color":t.borderColor??r.border??"#e7e7e7","--seekora-primary":t.primaryColor??r.primary??"#f90","--seekora-text-on-primary":t.textOnPrimaryColor??"#0f1111","--seekora-text-inverse":t.textInverseColor??"#ffffff","--seekora-link":t.primaryColor??r.primary??"#007185","--seekora-font-family":t.fontFamily??'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'}}(j);Object.entries(t).forEach(([t,r])=>{e.style.setProperty(t,r)})},[j]);const Q=St(),{isMobile:U}=Q,G=t.useMemo(()=>n&&U&&"mobile-sheet"!==o&&"spotlight"!==o?"mobile-sheet":o,[o,U,n]),[K,X]=t.useState(i),[Y,J]=t.useState(!1),[Z,ee]=t.useState(!1),[te,re]=t.useState(!1),[ae,oe]=t.useState([]),[ne,se]=t.useState([]),[ie,le]=t.useState([]),[ce,de]=t.useState([]),[ue,pe]=t.useState([]),[me,ge]=t.useState([]),[he,ye]=t.useState("all"),be=t.useRef(null),xe=t.useRef(null),ve=t.useRef(null),ke=t.useRef(null),Ee=t.useMemo(()=>W?xt({maxSize:H,defaultTtlMs:q}):null,[W,H,q]),Se=void 0!==l?l:K,we=t.useMemo(()=>(e=>({container:{position:"relative",width:"100%",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)'},inputWrapper:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #111827)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--seekora-border-color, #d1d5db)",borderRadius:e?"8px":"24px",overflow:"hidden",transition:"border-color 150ms, box-shadow 150ms",boxShadow:"0 1px 3px rgba(0,0,0,0.05)"},inputWrapperFocused:{borderColor:"var(--seekora-primary, #f90)",boxShadow:"0 0 0 3px rgba(255, 153, 0, 0.15), 0 2px 8px rgba(0,0,0,0.1)"},searchIcon:{padding:e?"0 10px 0 14px":"0 12px 0 18px",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",flexShrink:0},input:{flex:1,padding:e?"12px 8px 12px 0":"14px 12px 14px 0",fontSize:e?"16px":"15px",borderWidth:0,borderStyle:"none",outline:"none",backgroundColor:"transparent",color:"var(--seekora-text-primary, #0f1111)",fontFamily:"inherit",minWidth:0,WebkitAppearance:"none"},clearButton:{padding:"8px 14px",background:"none",borderWidth:0,borderStyle:"none",cursor:"pointer",color:"var(--seekora-text-tertiary, #9ca3af)",fontSize:"18px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"color 150ms"},loadingSpinner:{width:"18px",height:"18px",borderWidth:"2px",borderStyle:"solid",borderColor:"#e5e7eb",borderTopColor:"#f90",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite",marginRight:"12px",flexShrink:0}}))(U),[U]);t.useEffect(()=>{if(b){const e=mt();ge(e.slice(0,x))}},[b,x]);const Ce=t.useCallback(async e=>{if(!a)return;if(e.length>0&&e.length<c)return oe([]),se([]),void de([]);const t={maxSuggestions:d,includeDropdownRecommendations:p,includeDropdownProductList:m,includeFilteredTabs:g,includeCategories:f,filteredTabs:h?.map(e=>e.filter).join(",")},r=Ee?.generateKey(e,t);if(Ee&&r){const t=Ee.get(r);if(t)return console.log("Seekora: Cache hit for query:",e),void Re(t)}re(!0);try{const t=await(a.getSuggestions?.(e,{hitsPerPage:d,include_dropdown_recommendations:p,include_dropdown_product_list:m,include_filtered_tabs:g,include_categories:f,filtered_tabs:h,analytics_tags:y,returnFullResponse:!0}));if(Ee&&r&&t&&(Ee.set(r,t),console.log("Seekora: Cached response for query:",e)),Re(t),E&&t&&!Array.isArray(t)){const r=t;V.trackImpression({suggestions:(r.suggestions||[]).map(e=>({query:e.query||e.text||"",objectID:e.objectID||e.id,popularity:e.popularity})),products:r.extensions?.trending_products||r.extensions?.item_recommendations||[],categories:r.extensions?.popular_categories||[],brands:r.extensions?.popular_brands||[],query:e,timestamp:Date.now()})}}catch(e){console.error("Seekora: Failed to fetch suggestions",e),oe([]),se([]),de([])}finally{re(!1)}},[a,c,d,p,m,g,f,h,y,E,V,Ee]),Re=t.useCallback(e=>{let t=[],r={};if(console.log("Seekora: Raw response structure",{hasSuggestions:!!e?.suggestions,hasResults:!!e?.results,hasExtensions:!!e?.extensions,hasData:!!e?.data}),e?.suggestions&&e?.extensions)t=e.suggestions||[],r=e.extensions||{};else if(e?.results&&Array.isArray(e.results)){const a=e.results[0]||{},o=e.results[1]||{};t=a.hits||a.suggestions||[],r=a.extensions||o.extensions||{}}else e?.data?(t=e.data.hits||[],r=e.data.extensions||e.data.dropdown_recommendations||{}):e?.hits?(t=e.hits||[],r=e.extensions||e.dropdown_recommendations||{}):Array.isArray(e)&&(t=e);oe(t);const a=r.filtered_tabs||[];de(a),a.length>0&&a[0].products?se(a[0].products):se(r.trending_products||r.item_recommendations||[]),le(r.popular_categories||[]),pe(r.trending_searches||r.top_searches||[]),console.log("Seekora: Parsed response",{suggestions:t.length,tabs:a.length,products:a[0]?.products?.length||0,extensionKeys:Object.keys(r)})},[]),Ie=t.useCallback(e=>{const t=e.target.value;void 0===l&&X(t),T?.(t),ye("all"),ve.current&&clearTimeout(ve.current),t.length>=c?(J(!0),ve.current=setTimeout(()=>{Ce(t)},u)):0===t.length&&(b||k)?(J(!0),oe([])):J(!1)},[l,T,c,u,Ce,b,k]),Ne=t.useCallback(()=>{ee(!0),J(!0),E&&V.trackDropdownOpen(Se),Se.length>=c?0===ae.length&&Ce(Se):Ce("")},[Se,c,ae.length,Ce,E,V]),Te=t.useCallback(()=>{ee(!1),setTimeout(()=>{ke.current?.contains(document.activeElement)||J(!1)},150)},[]),Ae=t.useCallback(e=>{if("Escape"===e.key)J(!1),be.current?.blur();else if("Enter"===e.key){e.preventDefault();(xe.current?.getActiveIndex?.()??-1)>=0&&Y?xe.current?.selectActive?.():Se.trim()&&(N?.(Se.trim()),b&&(gt(Se.trim()),ge(mt().slice(0,x))),E&&V.trackSearchSubmit(Se.trim(),!1),J(!1))}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),!Y&&(ae.length>0||me.length>0)&&J(!0),"ArrowDown"===e.key?xe.current?.navigateNext?.():xe.current?.navigatePrevious?.())},[Se,N,b,x,Y,ae.length,me.length,E,V]),ze=t.useCallback((e,t)=>{const r=e.query||e.text||e.objectID||"";void 0===l&&X(r),T?.(r),A?.(e,t),b&&r&&(gt(r),ge(mt().slice(0,x))),E&&(V.trackSuggestionClick({suggestion:{query:r,objectID:e.objectID||e.id,popularity:e.popularity},position:t,section:"suggestions",query:Se,totalSuggestions:ae.length}),V.trackSearchSubmit(r,!0,e)),N?.(r),J(!1)},[l,T,A,b,x,E,N,V,Se,ae.length]),Me=t.useCallback((e,t)=>{z?.(e,t),E&&V.trackProductClick({product:{id:e.id||e.objectID,objectID:e.objectID||e.id,title:e.title||e.name,image:e.image,price:e.price},position:t,section:"all"!==he?"filtered_tab":"products",tabId:"all"!==he?he:void 0,query:Se})},[z,E,V,he,Se]),_e=t.useCallback((e,t)=>{M?.(e,t),E&&V.trackCategoryClick({value:e.label||e.value||e.id,count:e.count,path:e.path},Se)},[M,E,V,Se]),Le=t.useCallback(e=>{if(console.log("Seekora: Tab changed to",e),ye(e),_?.(e),E){const t=ce.find(t=>t.id===e);t&&V.trackTabSelect({id:t.id,label:t.label,filter:t.filter,products:t.products,nb_hits:t.nb_hits},Se)}},[_,E,V,ce,Se]),Pe=t.useCallback(e=>{void 0===l&&X(e),T?.(e),Ce(e),E&&V.trackRecentSearchClick({query:e,timestamp:Date.now()})},[l,T,Ce,E,V]),Be=t.useCallback(e=>{ft(e),ge(mt().slice(0,x))},[x]),De=t.useCallback(()=>{void 0===l&&X(""),T?.(""),oe([]),se([]),de([]),be.current?.focus()},[l,T]),$e=t.useCallback(()=>{J(!1),E&&V.trackDropdownClose(Se)},[E,V,Se]);t.useImperativeHandle(r,()=>({focus:()=>be.current?.focus(),blur:()=>be.current?.blur(),clear:De,getQuery:()=>Se,setQuery:e=>{void 0===l&&X(e),T?.(e)},openDropdown:()=>J(!0),closeDropdown:()=>J(!1),refresh:()=>Ce(Se),clearCache:()=>Ee?.clear(),getCacheStats:()=>Ee?.getStats()??null}),[Se,l,T,De,Ce,Ee]);const Fe=nr[G]||Mt,We=t.useMemo(()=>{if(console.log("Seekora: Computing products for tab",he,"from",ce.length,"tabs"),0===ce.length)return ne;if("all"===he){const e=ce[0]?.products||[];return e.length>0?e:ne}const e=ce.find(e=>e.id===he);return e?.products&&e.products.length>0?(console.log("Seekora: Found",e.products.length,"products for tab",he),e.products):ne},[he,ce,ne]);return t.createElement("div",{ref:ke,className:dt("seekora-suggestion-search",L),style:ut(we.container,P)},t.createElement("div",{style:ut(we.inputWrapper,Z?we.inputWrapperFocused:void 0)},t.createElement("div",{style:we.searchIcon},t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"}))),t.createElement("input",{ref:be,type:"text",value:Se,onChange:Ie,onFocus:Ne,onBlur:Te,onKeyDown:Ae,placeholder:s,className:B,style:we.input,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":"Search","aria-expanded":Y,"aria-haspopup":"listbox"}),te&&t.createElement("div",{style:we.loadingSpinner}),Se&&!te&&t.createElement("button",{type:"button",onClick:De,style:we.clearButton,"aria-label":"Clear search"},"×")),Y&&t.createElement(Fe,{query:Se,isOpen:Y,loading:te,suggestions:ae,products:We,categories:ce.map(e=>({id:e.id,label:e.label,count:e.nb_hits})),recentSearches:me.map(e=>"string"==typeof e?e:e.query),trendingSearches:ue,filteredTabs:ce,activeTab:he,suggestionFields:C,productFields:R,theme:or(j)??j,width:D||"100%",maxHeight:$,zIndex:F,analytics:{enabled:E,trackSuggestionClicks:w?.trackSuggestionClicks??!0,trackProductClicks:w?.trackProductClicks??!0,trackImpressions:w?.trackImpressions??!0,trackCategoryClicks:w?.trackCategoryClicks??!0,trackBrandClicks:w?.trackBrandClicks??!0,trackSearchSubmit:w?.trackSearchSubmit??!0,tags:w?.tags??y},onSuggestionSelect:ze,onProductClick:Me,onCategoryClick:_e,onTabChange:Le,onRecentClick:Pe,onRecentRemove:Be,onClose:$e}))}),ir={amazon:Mt,google:Dt,pinterest:Ht,spotlight:Ut,shopify:Xt,"mobile-sheet":rr,minimal:ar};function lr({isOpen:e,onClose:a,children:o}){const n=t.useRef(null),s=t.useRef(null);if(t.useEffect(()=>{const t=e=>{s.current&&!s.current.contains(e.target)&&a()};return e&&document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[e,a]),t.useEffect(()=>{if(e){const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e]),t.useEffect(()=>{if(!e||!s.current)return;const t=s.current,r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),a=r[0],o=r[r.length-1],n=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===a&&(e.preventDefault(),o?.focus()):document.activeElement===o&&(e.preventDefault(),a?.focus()))};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},[e]),!e||"undefined"==typeof document)return null;const i=t.createElement("div",{ref:n,className:"seekora-docsearch-overlay",role:"dialog","aria-modal":"true","aria-label":"Search documentation"},t.createElement("div",{ref:s,className:"seekora-docsearch-container"},o));return r.createPortal(i,document.body)}function cr({value:e,onChange:r,onKeyDown:a,placeholder:o="Search documentation...",isLoading:n=!1,onClear:s}){const i=t.useRef(null);t.useEffect(()=>{i.current&&i.current.focus()},[]);return t.createElement("div",{className:"seekora-docsearch-searchbox"},t.createElement("label",{className:"seekora-docsearch-searchbox-icon",htmlFor:"seekora-docsearch-input"},n?t.createElement("span",{className:"seekora-docsearch-spinner","aria-hidden":"true"},t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},t.createElement("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeDasharray:"40",strokeDashoffset:"10"},t.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 10 10",to:"360 10 10",dur:"0.8s",repeatCount:"indefinite"})))):t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},t.createElement("path",{d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",fill:"currentColor"}))),t.createElement("input",{ref:i,id:"seekora-docsearch-input",className:"seekora-docsearch-input",type:"text",value:e,onChange:e=>r(e.target.value),onKeyDown:a,placeholder:o,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-autocomplete":"list","aria-controls":"seekora-docsearch-results"}),e&&t.createElement("button",{type:"button",className:"seekora-docsearch-clear",onClick:()=>{r(""),s?.(),i.current?.focus()},"aria-label":"Clear search"},t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},t.createElement("path",{d:"M4.28 3.22a.75.75 0 00-1.06 1.06L6.94 8l-3.72 3.72a.75.75 0 101.06 1.06L8 9.06l3.72 3.72a.75.75 0 101.06-1.06L9.06 8l3.72-3.72a.75.75 0 00-1.06-1.06L8 6.94 4.28 3.22z",fill:"currentColor"}))))}function dr({value:e,highlightedValue:r}){return r?t.createElement("span",{className:"seekora-docsearch-highlight",dangerouslySetInnerHTML:{__html:(a=r,a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/<mark>/g,"<mark>").replace(/<\/mark>/g,"</mark>").replace(/<ais-highlight>/g,"<mark>").replace(/<\/ais-highlight>/g,"</mark>").replace(/<em>/g,"<mark>").replace(/<\/em>/g,"</mark>"))}}):t.createElement("span",null,e);var a}function ur({hit:e,isSelected:r,onClick:a,onMouseEnter:o,openInNewTab:n,isChild:s,isLastChild:i,hierarchyType:l}){const c="objectID"in e,d=e,u=l||d.type,p=d.parentTitle?`${d.category||""} › ${d.parentTitle}`.replace(/^› /,""):d.category||"",m=function(e,t){const r=e.hierarchy||{};if(!t)return e.title||r.lvl1||r.lvl0||"Untitled";const a=t.match(/^lvl(\d+)$/);if(a){const e=r[`lvl${parseInt(a[1],10)}`];if(e)return e}return e.title||r.lvl1||r.lvl0||"Untitled"}(e,u);let g=m,f=e.content||d.description||"";if(c){const t=e;t._highlightResult&&(g=t._highlightResult.title?.value||m,f=t._highlightResult.content?.value||e.content||"")}else d.highlight&&(g=d.highlight.title||m,f=d.highlight.content||e.content||d.description||"");const h=f?function(e,t=150){const r=e.indexOf("<mark>");if(-1===r||e.length<=t)return e.length<=t?e:e.slice(0,t)+"...";const a=Math.floor(t/2);let o=Math.max(0,r-a),n=Math.min(e.length,r+a);if(o>0){const t=e.indexOf(" ",o);-1!==t&&t<r&&(o=t+1)}if(n<e.length){const t=e.lastIndexOf(" ",n);-1!==t&&t>r&&(n=t)}let s=e.slice(o,n);return o>0&&(s="..."+s),n<e.length&&(s+="..."),s}(f,120):"",y=e.url||d.route||"#",b=["seekora-docsearch-hit"];return r&&b.push("seekora-docsearch-hit--selected"),s&&b.push("seekora-docsearch-hit--child"),i&&b.push("seekora-docsearch-hit--last-child"),t.createElement("a",{href:y,className:b.join(" "),onClick:e=>{e.preventDefault(),a()},onMouseEnter:o,role:"option","aria-selected":r,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0},s&&t.createElement("div",{className:"seekora-docsearch-hit-tree"},t.createElement(gr,{isLast:i})),t.createElement("div",{className:"seekora-docsearch-hit-icon"},t.createElement(mr,{type:pr(u)})),t.createElement("div",{className:"seekora-docsearch-hit-content"},!s&&p&&t.createElement("span",{className:"seekora-docsearch-hit-breadcrumb"},p),t.createElement("span",{className:"seekora-docsearch-hit-title"},t.createElement(dr,{value:m,highlightedValue:g})),h&&t.createElement("span",{className:"seekora-docsearch-hit-description"},t.createElement(dr,{value:e.content||"",highlightedValue:h}))),t.createElement("div",{className:"seekora-docsearch-hit-action"},n?t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M6 3H3v10h10v-3M9 3h4v4M14 2L7 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})):t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M6.75 3.25L11.5 8L6.75 12.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))))}function pr(e){if(!e)return"page";const t=e.match(/^lvl(\d+)$/);if(t){const e=parseInt(t[1],10);return 1===e?"page":e<=3?"section":"content"}return"page"}function mr({type:e}){switch(e){case"page":return t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M4.5 3.5h11a1 1 0 011 1v11a1 1 0 01-1 1h-11a1 1 0 01-1-1v-11a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),t.createElement("path",{d:"M7 7h6M7 10h6M7 13h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}));case"section":return t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M4 5.5h12M4 10h12M4 14.5h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}));case"content":return t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M4 6h12M4 10h8M4 14h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))}}function gr({isLast:e}){return t.createElement("svg",{width:"16",height:"20",viewBox:"0 0 16 20",fill:"none","aria-hidden":"true",className:"seekora-docsearch-hit-tree-icon"},e?t.createElement("path",{d:"M8 0V10H14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):t.createElement(t.Fragment,null,t.createElement("path",{d:"M8 0V20",stroke:"currentColor",strokeWidth:"1.5"}),t.createElement("path",{d:"M8 10H14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})))}function fr(e){if(!e)return 1;const t=e.match(/^lvl(\d+)$/);return t?parseInt(t[1],10):1}function hr(e){return fr(e)>=2}function yr(e){const t=e.hierarchy??{};return[t.lvl0??"",t.lvl1??"",t.lvl2??"",t.lvl3??"",t.lvl4??"",t.lvl5??""].join("\0")}function br(e){const t=e.hierarchy??{},r=[t.lvl0,t.lvl1,t.lvl2,t.lvl3,t.lvl4,t.lvl5].filter(e=>"string"==typeof e&&e.length>0),a=[];for(const e of r)a[a.length-1]!==e&&a.push(e);return a.join(" › ")}function xr(e,t){return"objectID"in e?e.objectID:`suggestion-${e.url}-${t}`}function vr({hits:e,groupedHits:r,selectedIndex:a,onSelect:o,onHover:n,scrollSelectionIntoViewRef:s,query:i,isLoading:l,error:c,translations:d={},sources:u=[]}){const p=t.useRef(null);if(t.useEffect(()=>{if(!p.current||0===e.length)return;if(s&&!s.current)return;const t=p.current.querySelectorAll(".seekora-docsearch-results-group");let r=0;for(const e of t){const t=e.querySelector(".seekora-docsearch-results-group-items");if(!t)continue;const o=t.children;for(let e=0;e<o.length;e++){if(r===a)return o[e].scrollIntoView({block:"nearest"}),void(s&&(s.current=!1));r++}}s&&(s.current=!1)},[a,e.length,s]),!i)return t.createElement("div",{className:"seekora-docsearch-empty"},t.createElement("p",{className:"seekora-docsearch-empty-text"},d.searchPlaceholder||"Type to start searching..."));if(l&&0===e.length)return t.createElement("div",{className:"seekora-docsearch-loading"},t.createElement("div",{className:"seekora-docsearch-loading-spinner"},t.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true"},t.createElement("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeDasharray:"50",strokeDashoffset:"15"},t.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"0.8s",repeatCount:"indefinite"})))),t.createElement("p",{className:"seekora-docsearch-loading-text"},d.loadingText||"Searching..."));if(c)return t.createElement("div",{className:"seekora-docsearch-error"},t.createElement("p",{className:"seekora-docsearch-error-text"},d.errorText||c));if(0===e.length&&i)return t.createElement("div",{className:"seekora-docsearch-no-results"},t.createElement("p",{className:"seekora-docsearch-no-results-text"},d.noResultsText||`No results found for "${i}"`));const m=r&&r.length>0?r.map(e=>({category:e.source.name,sourceId:e.source.id,openInNewTab:e.source.openInNewTab,hits:e.items})):function(e){const t=new Map;e.forEach((e,r)=>t.set(e,r));const r=new Map;for(const t of e){const e=yr(t);r.has(e)||r.set(e,[]),r.get(e).push(t)}const a=Array.from(r.entries());a.sort(([,e],[,r])=>Math.min(...e.map(e=>t.get(e)??0))-Math.min(...r.map(e=>t.get(e)??0)));const o=[];for(const[,e]of a){const t=[...e].sort((e,t)=>{const r=e.type,a=t.type;return fr(r)-fr(a)}),r=t.map((e,r)=>{const a=hr(e.type),o=t[r+1],n=a&&(!o||!hr(o.type));return{...e,isChild:a,isLastChild:n}}),a=br(e[0]);o.push({category:a||null,hits:r})}return o}(e).map(e=>({category:e.category,sourceId:"default",openInNewTab:!1,hits:e.hits}));return t.createElement("div",{className:"seekora-docsearch-results"},t.createElement("ul",{ref:p,id:"seekora-docsearch-results",className:"seekora-docsearch-results-list",role:"listbox"},m.map((e,r)=>t.createElement("li",{key:e.sourceId+"-"+r,className:"seekora-docsearch-results-group"},e.category&&t.createElement("div",{className:"seekora-docsearch-results-group-header"},e.category),t.createElement("ul",{className:"seekora-docsearch-results-group-items"},e.hits.map((s,i)=>{const l=function(e,t,r){let a=0;for(let r=0;r<t;r++)a+=e[r].hits.length;return a+r}(m,r,i),c=s;return t.createElement("li",{key:xr(s,i)},t.createElement(ur,{hit:s,isSelected:l===a,onClick:()=>o(s),onMouseEnter:()=>n(l),openInNewTab:e.openInNewTab,isChild:c.isChild,isLastChild:c.isLastChild,hierarchyType:s.type}))}))))))}function kr({translations:e={}}){return t.createElement("footer",{className:"seekora-docsearch-footer"},t.createElement("div",{className:"seekora-docsearch-footer-commands"},t.createElement("ul",{className:"seekora-docsearch-footer-commands-list"},t.createElement("li",null,t.createElement("span",{className:"seekora-docsearch-footer-command"},t.createElement("kbd",{className:"seekora-docsearch-key"},"↵"),t.createElement("span",null,"to select"))),t.createElement("li",null,t.createElement("span",{className:"seekora-docsearch-footer-command"},t.createElement("kbd",{className:"seekora-docsearch-key"},"↑"),t.createElement("kbd",{className:"seekora-docsearch-key"},"↓"),t.createElement("span",null,"to navigate"))),t.createElement("li",null,t.createElement("span",{className:"seekora-docsearch-footer-command"},t.createElement("kbd",{className:"seekora-docsearch-key"},"esc"),t.createElement("span",null,e.closeText||"to close"))))),t.createElement("div",{className:"seekora-docsearch-footer-logo"},t.createElement("span",{className:"seekora-docsearch-footer-logo-text"},e.searchByText||"Search by"),t.createElement("a",{href:"https://seekora.ai",target:"_blank",rel:"noopener noreferrer",className:"seekora-docsearch-footer-logo-link"},t.createElement("span",{className:"seekora-docsearch-logo",style:{fontFamily:"system-ui",fontSize:14,fontWeight:600}},"Seekora"))))}function Er(e){const{isOpen:r,onOpen:a,onClose:o,onSelectNext:n,onSelectPrev:s,onEnter:i,disableShortcut:l=!1,shortcutKey:c="k"}=e,d=t.useCallback(e=>{if(!l&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===c)return e.preventDefault(),void(r?o():a());if(!l&&"/"===e.key&&!r){const t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),a())}},[r,a,o,l,c]),u=t.useCallback(e=>{switch(e.key){case"Escape":e.preventDefault(),o();break;case"ArrowDown":e.preventDefault(),n();break;case"ArrowUp":e.preventDefault(),s();break;case"Enter":e.preventDefault(),i();break;case"Tab":e.shiftKey?s():n(),e.preventDefault()}},[o,n,s,i]);return t.useEffect(()=>(document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}),[d]),{handleModalKeyDown:u}}function Sr(e="K"){if("undefined"==typeof navigator)return`⌘${e}`;return navigator.platform.toLowerCase().includes("mac")?`⌘${e}`:`Ctrl+${e}`}function wr({onClick:e,placeholder:r="Search documentation..."}){const a=Sr("K");return t.createElement("button",{type:"button",className:"seekora-docsearch-button",onClick:e,"aria-label":"Search documentation"},t.createElement("span",{className:"seekora-docsearch-button-icon"},t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},t.createElement("path",{d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",fill:"currentColor"}))),t.createElement("span",{className:"seekora-docsearch-button-placeholder"},r),t.createElement("span",{className:"seekora-docsearch-button-keys"},t.createElement("kbd",{className:"seekora-docsearch-button-key"},a)))}const Cr={query:"",results:[],suggestions:[],groupedSuggestions:[],isLoading:!1,error:null,selectedIndex:0,mode:"suggestions"};function Rr(e,t){switch(t.type){case"SET_QUERY":return{...e,query:t.payload,selectedIndex:0};case"SET_RESULTS":return{...e,results:t.payload,mode:"results"};case"SET_SUGGESTIONS":return{...e,suggestions:t.payload,mode:"suggestions"};case"SET_GROUPED_SUGGESTIONS":{const r=t.payload.flatMap(e=>e.items.map(t=>({...t,_source:e.source.id})));return{...e,groupedSuggestions:t.payload,suggestions:r,mode:"suggestions"}}case"SET_LOADING":return{...e,isLoading:t.payload};case"SET_ERROR":return{...e,error:t.payload};case"SET_SELECTED_INDEX":return{...e,selectedIndex:t.payload};case"SELECT_NEXT":{const t=("results"===e.mode?e.results:e.suggestions).length-1;return{...e,selectedIndex:e.selectedIndex>=t?0:e.selectedIndex+1}}case"SELECT_PREV":{const t=("results"===e.mode?e.results:e.suggestions).length-1;return{...e,selectedIndex:e.selectedIndex<=0?t:e.selectedIndex-1}}case"SET_MODE":return{...e,mode:t.payload,selectedIndex:0};case"RESET":return Cr;default:return e}}function Ir(e){const{apiEndpoint:r,apiKey:a,sources:o,maxResults:n=10,debounceMs:s=200,processGroupedResults:i}=e,l=o||(r?[{id:"default",name:"Results",endpoint:r,apiKey:a,maxResults:n}]:[]),[c,d]=t.useReducer(Rr,Cr),u=t.useRef(new Map),p=t.useRef(null),m=t.useCallback((e,t)=>(e?.data?.results||[]).map(e=>{const r=e.document||e;return{url:r.url||r.route||"",title:(r.title||r.name||"").replace?.(/<\/?mark>/g,"")||"",content:(r.content||r.description||"").replace?.(/<\/?mark>/g,"")?.substring?.(0,100)||"",description:r.description||r.content?.substring?.(0,100)||"",category:r.category||r.hierarchy?.lvl0||"",hierarchy:r.hierarchy,route:r.route,parentTitle:r.parent_title||r.parentTitle,_source:t}}),[]),g=t.useCallback(async(e,t,r)=>{const a=e.minQueryLength??1;if(t.length<a)return[];try{if(e.storeId){const a=`${e.endpoint.replace(/\/$/,"")}/api/v1/search`,o={"Content-Type":"application/json","x-storeid":e.storeId,...e.storeSecret&&{"x-storesecret":e.storeSecret}},n=await fetch(a,{method:"POST",headers:o,body:JSON.stringify({q:t.trim()||"*",per_page:e.maxResults||8}),signal:r});if(!n.ok)return[];const s=await n.json();return e.transformResults?e.transformResults(s).map(t=>({...t,_source:e.id})):m(s,e.id)}const a=new URL(e.endpoint);a.searchParams.set("query",t),a.searchParams.set("limit",String(e.maxResults||8));const o={"Content-Type":"application/json"};e.apiKey&&(o["X-Docs-API-Key"]=e.apiKey);const n=await fetch(a.toString(),{method:"GET",headers:o,signal:r});if(!n.ok)return[];const s=await n.json();return e.transformResults?e.transformResults(s).map(t=>({...t,_source:e.id})):((e,t)=>(e.data?.suggestions||e.data?.results||e.suggestions||e.results||e.hits||[]).map(e=>({url:e.url||e.route||"",title:e.title?.replace?.(/<\/?mark>/g,"")||e.title||"",content:e.content?.replace?.(/<\/?mark>/g,"")?.substring?.(0,100)||e.description||"",description:e.description||e.content?.substring?.(0,100)||"",category:e.category||e.hierarchy?.lvl0||"",hierarchy:e.hierarchy,route:e.route,parentTitle:e.parent_title||e.parentTitle,_source:t})))(s,e.id)}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw e;return[]}},[m]),f=t.useCallback(async e=>{if(e.trim()){u.current.forEach(e=>e.abort()),u.current.clear(),d({type:"SET_LOADING",payload:!0}),d({type:"SET_ERROR",payload:null});try{const t=(await Promise.all(l.map(async t=>{const r=new AbortController;u.current.set(t.id,r);let a=await g(t,e,r.signal);return i&&(a=i(t.id,a)),{source:t,items:a}}))).filter(e=>e.items.length>0);d({type:"SET_GROUPED_SUGGESTIONS",payload:t})}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;d({type:"SET_ERROR",payload:e instanceof Error?e.message:"Search failed"})}finally{d({type:"SET_LOADING",payload:!1})}}else d({type:"SET_GROUPED_SUGGESTIONS",payload:[]})},[l,g,i]),h=t.useCallback(e=>f(e),[f]),y=t.useCallback(e=>{d({type:"SET_QUERY",payload:e}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(e),s)},[f,s]),b=t.useCallback(()=>d({type:"SELECT_NEXT"}),[]),x=t.useCallback(()=>d({type:"SELECT_PREV"}),[]),v=t.useCallback(e=>d({type:"SET_SELECTED_INDEX",payload:e}),[]),k=t.useCallback(()=>{u.current.forEach(e=>e.abort()),u.current.clear(),p.current&&clearTimeout(p.current),d({type:"RESET"})},[]),E=t.useCallback(()=>("results"===c.mode?c.results:c.suggestions)[c.selectedIndex]||null,[c.mode,c.results,c.suggestions,c.selectedIndex]);return t.useEffect(()=>()=>{u.current.forEach(e=>e.abort()),u.current.clear(),p.current&&clearTimeout(p.current)},[]),{...c,sources:l,setQuery:y,search:h,fetchSuggestions:f,selectNext:b,selectPrev:x,setSelectedIndex:v,reset:k,getSelectedItem:E}}function Nr(e){const{storeId:r,storeSecret:o,apiEndpoint:n,maxResults:s=20,debounceMs:i=200,analyticsTags:l=["docsearch"],groupField:c="hierarchy.lvl3",groupSize:d=10}=e,[u,p]=t.useState(""),[m,g]=t.useState([]),[f,h]=t.useState(!1),[y,b]=t.useState(null),[x,v]=t.useState(0),k=t.useRef(null),E=t.useRef(null),S=t.useRef(null),w=t.useRef(null);t.useEffect(()=>{if(!r)return;const e={storeId:r,readSecret:o,logLevel:"warn",enableContextCollection:!0};if(n)if(["local","stage","production"].includes(n))e.environment=n;else{const t=n.replace(/\/$/,"");e.baseUrl=t.endsWith("/api")?t:`${t}/api`}try{k.current=new a.SeekoraClient(e)}catch(e){console.error("Failed to initialize SeekoraClient:",e),b("Failed to initialize search client")}return()=>{k.current=null}},[r,o,n]);const C=t.useCallback(async e=>{if(k.current)if(e.trim()){w.current&&w.current.abort(),w.current=new AbortController,h(!0),b(null);try{const t=await k.current.search(e,{per_page:s,analytics_tags:l,return_fields:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url","title","anchor"],snippet_fields:["hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content"],snippet_prefix:"<mark>",snippet_suffix:"</mark>",include_snippets:!0,group_field:c,group_size:d});if(w.current?.signal.aborted)return;t?.context&&(E.current=t.context),g(function(e){const t=e=>"string"==typeof e?e.replace(/<\/?mark>/g,""):e?String(e):"";return e.map(e=>{const r=e?.document??e,a=function(e){const t={};return e?.hierarchy&&"object"==typeof e.hierarchy?(t.lvl0=e.hierarchy.lvl0,t.lvl1=e.hierarchy.lvl1,t.lvl2=e.hierarchy.lvl2,t.lvl3=e.hierarchy.lvl3,t.lvl4=e.hierarchy.lvl4,t.lvl5=e.hierarchy.lvl5):e&&"object"==typeof e&&(t.lvl0=e["hierarchy.lvl0"],t.lvl1=e["hierarchy.lvl1"],t.lvl2=e["hierarchy.lvl2"],t.lvl3=e["hierarchy.lvl3"],t.lvl4=e["hierarchy.lvl4"],t.lvl5=e["hierarchy.lvl5"]),t}(r),o=r.url||e.url||r.route||e.route||r.link||e.link||"",n=r.title||e.title||r.name||e.name||a?.lvl3||a?.lvl2||a?.lvl1||a?.lvl0||"",s=r.content??e.content??r.description??e.description??r.snippet??e.snippet??"",i=r.description??e.description??("string"==typeof s?s.substring(0,150):""),l=t(n)||t(a?.lvl3)||t(a?.lvl2)||t(a?.lvl1)||t(a?.lvl0)||"Untitled",c=t(s)?.substring(0,200)||s,d=e?.highlight??r?.highlight,u="string"==typeof d?.title?d.title:void 0,p="string"==typeof d?.content?d.content:void 0;return{url:o,title:l,content:c,description:t(i)||i,category:r.category??e.category??a?.lvl0??"",hierarchy:a,route:r.route??e.route,parentTitle:r.parent_title??r.parentTitle??e.parent_title??e.parentTitle,type:r.type??e.type??"",anchor:r.anchor??e.anchor??"",_source:"seekora",highlight:u??p?{title:u,content:p}:void 0}})}(t.results||[])),v(0)}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;console.error("Search failed:",e),b(e instanceof Error?e.message:"Search failed"),g([])}finally{h(!1)}}else g([]);else b("Search client not initialized")},[s,l,c,d]),R=t.useCallback(e=>{p(e),v(0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>C(e),i)},[C,i]),I=t.useCallback(()=>{v(e=>e>=m.length-1?0:e+1)},[m.length]),N=t.useCallback(()=>{v(e=>e<=0?m.length-1:e-1)},[m.length]),T=t.useCallback(()=>{w.current&&w.current.abort(),S.current&&clearTimeout(S.current),p(""),g([]),h(!1),b(null),v(0)},[]),A=t.useCallback(()=>m[x]||null,[m,x]),z=t.useCallback((e,t)=>{const r=k.current;if(!r?.trackEvent)return;const a=E.current??void 0,o=e.url||e.id||e.title||String(t);r.trackEvent({event_name:"doc_click",clicked_item_id:o,metadata:{position:t,result:e,source:"docsearch"}},a)},[]);return t.useEffect(()=>()=>{w.current&&w.current.abort(),S.current&&clearTimeout(S.current)},[]),{query:u,suggestions:m,isLoading:f,error:y,selectedIndex:x,setQuery:R,selectNext:I,selectPrev:N,setSelectedIndex:v,reset:T,getSelectedItem:A,trackDocClick:z}}function Tr(e,t,r=2){const a=e.toLowerCase().split(/\s+/),o=[];return a.forEach(a=>{a.length<3||t.forEach(t=>{const n=function(e,t){const r=[];for(let e=0;e<=t.length;e++)r[e]=[e];for(let t=0;t<=e.length;t++)r[0][t]=t;for(let a=1;a<=t.length;a++)for(let o=1;o<=e.length;o++)t.charAt(a-1)===e.charAt(o-1)?r[a][o]=r[a-1][o-1]:r[a][o]=Math.min(r[a-1][o-1]+1,r[a][o-1]+1,r[a-1][o]+1);return r[t.length][e.length]}(a,t.toLowerCase());if(n>0&&n<=r&&n<a.length/2){const r=e.replace(new RegExp(a,"gi"),t);o.includes(r)||o.push(r)}})}),o.slice(0,3)}const Ar={price:[{pattern:/under\s*\$?(\d+(?:\.\d{2})?)/i,operator:"<=",field:"price"},{pattern:/less than\s*\$?(\d+(?:\.\d{2})?)/i,operator:"<",field:"price"},{pattern:/over\s*\$?(\d+(?:\.\d{2})?)/i,operator:">=",field:"price"},{pattern:/more than\s*\$?(\d+(?:\.\d{2})?)/i,operator:">",field:"price"},{pattern:/\$(\d+(?:\.\d{2})?)\s*-\s*\$?(\d+(?:\.\d{2})?)/i,operator:"range",field:"price"},{pattern:/between\s*\$?(\d+(?:\.\d{2})?)\s*and\s*\$?(\d+(?:\.\d{2})?)/i,operator:"range",field:"price"},{pattern:/\$(\d+(?:\.\d{2})?)/i,operator:"<=",field:"price"}],colors:["red","blue","green","black","white","pink","purple","yellow","orange","brown","gray","grey","navy","beige","gold","silver"],sizes:{"extra small":"XS",xs:"XS",small:"S",s:"S",medium:"M",m:"M",large:"L",l:"L","extra large":"XL",xl:"XL",xxl:"XXL","2xl":"XXL",xxxl:"XXXL","3xl":"XXXL"},brandIndicators:["by","from","brand"],ratings:[{pattern:/(\d+)\s*\+?\s*stars?/i,field:"rating",operator:">="},{pattern:/rated\s*(\d+)/i,field:"rating",operator:">="},{pattern:/top\s*rated/i,field:"rating",value:"4",operator:">="}],availability:[{pattern:/in\s*stock/i,field:"inStock",value:"true"},{pattern:/available/i,field:"inStock",value:"true"},{pattern:/on\s*sale/i,field:"onSale",value:"true"}]};const zr={"--seekora-bg-surface":"#ffffff","--seekora-bg-secondary":"#f9fafb","--seekora-bg-tertiary":"#f3f4f6","--seekora-bg-hover":"#f3f4f6","--seekora-text-primary":"#111827","--seekora-text-secondary":"#6b7280","--seekora-text-tertiary":"#9ca3af","--seekora-border-color":"#e5e7eb","--seekora-primary":"#3b82f6","--seekora-primary-light":"#eff6ff","--seekora-primary-dark":"#1d4ed8","--seekora-highlight-bg":"#fef3c7","--seekora-success":"#10b981","--seekora-warning":"#f59e0b","--seekora-error":"#ef4444","--seekora-font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',"--seekora-font-size-xs":"11px","--seekora-font-size-sm":"12px","--seekora-font-size-base":"14px","--seekora-font-size-lg":"16px","--seekora-font-weight-normal":"400","--seekora-font-weight-medium":"500","--seekora-font-weight-semibold":"600","--seekora-font-weight-bold":"700","--seekora-line-height-tight":"1.25","--seekora-line-height-normal":"1.5","--seekora-line-height-relaxed":"1.75","--seekora-spacing-xs":"4px","--seekora-spacing-sm":"8px","--seekora-spacing-md":"12px","--seekora-spacing-lg":"16px","--seekora-spacing-xl":"24px","--seekora-border-radius-sm":"4px","--seekora-border-radius":"6px","--seekora-border-radius-lg":"8px","--seekora-border-radius-xl":"12px","--seekora-border-radius-full":"9999px","--seekora-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.05)","--seekora-shadow":"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)","--seekora-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)","--seekora-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)","--seekora-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","--seekora-transition-fast":"100ms ease","--seekora-transition-normal":"150ms ease","--seekora-transition-slow":"300ms ease","--seekora-z-dropdown":"1000","--seekora-z-modal":"1100","--seekora-z-tooltip":"1200"},Mr={...zr,"--seekora-bg-surface":"#1f2937","--seekora-bg-secondary":"#111827","--seekora-bg-tertiary":"#374151","--seekora-bg-hover":"#374151","--seekora-text-primary":"#f9fafb","--seekora-text-secondary":"#d1d5db","--seekora-text-tertiary":"#9ca3af","--seekora-border-color":"#4b5563","--seekora-primary":"#60a5fa","--seekora-primary-light":"#1e3a5f","--seekora-primary-dark":"#93c5fd","--seekora-highlight-bg":"#854d0e","--seekora-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.3)","--seekora-shadow":"0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3)","--seekora-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3)","--seekora-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3)","--seekora-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4)"},_r={...zr,"--seekora-border-color":"#f3f4f6","--seekora-shadow-sm":"none","--seekora-shadow":"0 1px 2px 0 rgba(0, 0, 0, 0.03)","--seekora-shadow-md":"0 2px 4px 0 rgba(0, 0, 0, 0.05)","--seekora-shadow-lg":"0 4px 8px 0 rgba(0, 0, 0, 0.08)","--seekora-shadow-xl":"0 8px 16px 0 rgba(0, 0, 0, 0.1)","--seekora-border-radius-sm":"2px","--seekora-border-radius":"4px","--seekora-border-radius-lg":"6px","--seekora-border-radius-xl":"8px"},Lr={blue:{"--seekora-primary":"#3b82f6","--seekora-primary-light":"#eff6ff","--seekora-primary-dark":"#1d4ed8"},green:{"--seekora-primary":"#10b981","--seekora-primary-light":"#ecfdf5","--seekora-primary-dark":"#059669"},purple:{"--seekora-primary":"#8b5cf6","--seekora-primary-light":"#f5f3ff","--seekora-primary-dark":"#7c3aed"},red:{"--seekora-primary":"#ef4444","--seekora-primary-light":"#fef2f2","--seekora-primary-dark":"#dc2626"},orange:{"--seekora-primary":"#f97316","--seekora-primary-light":"#fff7ed","--seekora-primary-dark":"#ea580c"},teal:{"--seekora-primary":"#14b8a6","--seekora-primary-light":"#f0fdfa","--seekora-primary-dark":"#0d9488"},pink:{"--seekora-primary":"#ec4899","--seekora-primary-light":"#fdf2f8","--seekora-primary-dark":"#db2777"}};function Pr(e=zr){return`\n /* Seekora Query Suggestions Styles */\n .seekora-suggestions {\n ${t=e,Object.entries(t).map(([e,t])=>`${e}: ${t};`).join("\n")}\n }\n\n /* Container */\n .seekora-suggestions-container {\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n box-shadow: var(--seekora-shadow-xl);\n font-family: var(--seekora-font-family);\n font-size: var(--seekora-font-size-base);\n color: var(--seekora-text-primary);\n overflow: hidden;\n }\n\n /* Section */\n .seekora-suggestions-section {\n padding: var(--seekora-spacing-sm) 0;\n }\n\n .seekora-suggestions-section-title {\n font-size: var(--seekora-font-size-xs);\n font-weight: var(--seekora-font-weight-bold);\n color: var(--seekora-text-tertiary);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-lg) var(--seekora-spacing-xs);\n margin: 0;\n }\n\n /* Item */\n .seekora-suggestions-item {\n display: flex;\n align-items: center;\n gap: var(--seekora-spacing-md);\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n cursor: pointer;\n transition: background-color var(--seekora-transition-fast);\n }\n\n .seekora-suggestions-item:hover,\n .seekora-suggestions-item--active {\n background-color: var(--seekora-bg-hover);\n }\n\n .seekora-suggestions-item-icon {\n width: 16px;\n height: 16px;\n color: var(--seekora-text-secondary);\n flex-shrink: 0;\n }\n\n .seekora-suggestions-item-text {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .seekora-suggestions-item-count {\n font-size: var(--seekora-font-size-sm);\n color: var(--seekora-text-tertiary);\n }\n\n /* Highlight */\n .seekora-suggestions mark,\n .seekora-suggestions-highlight {\n background-color: var(--seekora-highlight-bg);\n font-weight: var(--seekora-font-weight-semibold);\n padding: 0 2px;\n border-radius: 2px;\n }\n\n /* Product Card */\n .seekora-product-card {\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n overflow: hidden;\n cursor: pointer;\n transition: transform var(--seekora-transition-normal), box-shadow var(--seekora-transition-normal);\n }\n\n .seekora-product-card:hover {\n transform: translateY(-2px);\n box-shadow: var(--seekora-shadow-md);\n }\n\n .seekora-product-card-image {\n width: 100%;\n aspect-ratio: 1;\n object-fit: cover;\n background-color: var(--seekora-bg-secondary);\n }\n\n .seekora-product-card-info {\n padding: var(--seekora-spacing-md);\n }\n\n .seekora-product-card-title {\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-primary);\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .seekora-product-card-price {\n font-size: var(--seekora-font-size-base);\n font-weight: var(--seekora-font-weight-bold);\n color: var(--seekora-primary);\n margin-top: var(--seekora-spacing-xs);\n }\n\n /* Tabs */\n .seekora-suggestions-tabs {\n display: flex;\n gap: var(--seekora-spacing-xs);\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n border-bottom: 1px solid var(--seekora-border-color);\n overflow-x: auto;\n }\n\n .seekora-suggestions-tab {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-sm);\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-md);\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-secondary);\n background-color: transparent;\n border: 1px solid transparent;\n border-radius: var(--seekora-border-radius-full);\n cursor: pointer;\n white-space: nowrap;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-suggestions-tab:hover {\n background-color: var(--seekora-bg-hover);\n }\n\n .seekora-suggestions-tab--active {\n color: var(--seekora-primary);\n background-color: var(--seekora-primary-light);\n border-color: var(--seekora-primary);\n }\n\n /* Brand chip */\n .seekora-brand-chip {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-sm);\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-md);\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-primary);\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n cursor: pointer;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-brand-chip:hover {\n border-color: var(--seekora-primary);\n background-color: var(--seekora-primary-light);\n }\n\n /* Category pill */\n .seekora-category-pill {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-xs);\n padding: 3px var(--seekora-spacing-sm);\n font-size: var(--seekora-font-size-xs);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-secondary);\n background-color: var(--seekora-bg-tertiary);\n border-radius: var(--seekora-border-radius-full);\n cursor: pointer;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-category-pill:hover {\n background-color: var(--seekora-primary-light);\n color: var(--seekora-primary);\n }\n\n /* Loading */\n .seekora-suggestions-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--seekora-spacing-xl);\n color: var(--seekora-text-secondary);\n }\n\n /* Empty state */\n .seekora-suggestions-empty {\n padding: var(--seekora-spacing-xl);\n text-align: center;\n color: var(--seekora-text-secondary);\n }\n\n /* Footer */\n .seekora-suggestions-footer {\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n border-top: 1px solid var(--seekora-border-color);\n background-color: var(--seekora-bg-secondary);\n font-size: var(--seekora-font-size-sm);\n color: var(--seekora-text-secondary);\n }\n\n /* Keyboard hint */\n .seekora-keyboard-key {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 18px;\n padding: 0 4px;\n border-radius: 3px;\n background-color: var(--seekora-bg-secondary);\n border: 1px solid var(--seekora-border-color);\n font-size: 10px;\n font-weight: var(--seekora-font-weight-medium);\n }\n\n /* Animations */\n @keyframes seekora-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n @keyframes seekora-fade-in {\n from { opacity: 0; transform: translateY(-8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n @keyframes seekora-fade-out {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-8px); }\n }\n\n .seekora-suggestions--entering {\n animation: seekora-fade-in var(--seekora-transition-normal) ease-out;\n }\n\n .seekora-suggestions--exiting {\n animation: seekora-fade-out var(--seekora-transition-normal) ease-in;\n }\n `;var t}let Br=!1;function Dr(e=zr,t=!1){if("undefined"==typeof document)return;if(Br&&!t)return;const r="seekora-suggestions-styles";let a=document.getElementById(r);a||(a=document.createElement("style"),a.id=r,a.type="text/css",document.head.appendChild(a)),a.textContent=Pr(e),Br=!0}e.AmazonDropdown=Mt,e.Breadcrumb=({attributes:e,separator:r=" > ",rootLabel:a="Home",renderItem:o,renderSeparator:n,onNavigate:s,className:i,style:l,theme:c,items:d})=>{const{theme:u,stateManager:p}=S(),{refinements:m,removeRefinement:g,clearRefinements:f}=w(),h=c||{},y=t.useMemo(()=>{if(d)return d;const t=[];return e.forEach((e,a)=>{const o=m.find(t=>t.field===e);if(o){const e=o.value.split(r);e.forEach((a,o)=>{const n=e.slice(0,o+1).join(r);t.some(e=>e.value===n)||t.push({label:a,value:n})})}}),t},[e,m,r,d]),b=t.useCallback((t,r)=>{if(null===t)e.forEach(e=>{m.filter(t=>t.field===e).forEach(e=>g(e.field,e.value,!1))}),p.search();else{const r=y.findIndex(e=>e.value===t.value);e.forEach((e,a)=>{m.filter(t=>t.field===e).forEach(e=>{(a>r||a===r&&e.value!==t.value)&&g(e.field,e.value,!1)})}),p.search()}s&&s(t,r)},[e,m,g,p,y,s]);return 0===y.length?null:t.createElement("nav",{className:I(h.root,i),style:l,"aria-label":"Breadcrumb"},t.createElement("ol",{className:h.list,style:{display:"flex",flexWrap:"wrap",alignItems:"center",listStyle:"none",margin:0,padding:0,fontSize:u.typography.fontSize.small}},t.createElement("li",{className:h.item},t.createElement("button",{type:"button",onClick:()=>b(null,-1),className:h.link,style:{padding:0,background:"none",border:"none",cursor:"pointer",color:u.colors.primary,fontFamily:"inherit",fontSize:"inherit",textDecoration:"none"}},a)),y.map((e,r)=>{const a=r===y.length-1;return t.createElement(t.Fragment,{key:e.value},n?n():t.createElement("span",{className:h.separator,style:{margin:`0 ${u.spacing.small}`,color:u.colors.textSecondary},"aria-hidden":"true"},"›"),t.createElement("li",{className:I(h.item,a&&h.current)},o?o(e,r,a):a?t.createElement("span",{style:{color:u.colors.text,fontWeight:u.typography.fontWeight?.medium||500},"aria-current":"page"},e.label):t.createElement("button",{type:"button",onClick:()=>b(e,r),className:h.link,style:{padding:0,background:"none",border:"none",cursor:"pointer",color:u.colors.primary,fontFamily:"inherit",fontSize:"inherit",textDecoration:"none"}},e.label)))})))},e.CategoriesTabs=Qe,e.ClearRefinements=({clearsQuery:e=!1,resetLabel:r="Clear all filters",disabledLabel:a="No filters applied",includedFields:o,excludedFields:n=[],onClear:s,renderButton:i,className:l,style:c,theme:d,hideWhenEmpty:u=!1})=>{const{theme:p}=S(),{query:m,refinements:g,clearRefinements:f,setQuery:h,removeRefinement:y}=w(),b=d||{},x=t.useMemo(()=>g.filter(e=>!n.includes(e.field)&&!(o&&!o.includes(e.field))),[g,o,n]),v=x.length>0||e&&m.length>0,k=()=>{v&&(o||n.length>0?(x.forEach(e=>{y(e.field,e.value,!1)}),x.length>0&&f(!1)):f(!e),e&&m.length>0&&h("",!0),s&&s())};return u&&!v?null:i?t.createElement("div",{className:I(b.root,l),style:c},i({canClear:v,onClick:k,disabled:!v})):t.createElement("div",{className:I(b.root,l),style:c},t.createElement("button",{type:"button",onClick:k,disabled:!v,className:I(b.button,!v&&b.buttonDisabled),style:{padding:`${p.spacing.small} ${p.spacing.medium}`,fontSize:p.typography.fontSize.medium,fontWeight:p.typography.fontWeight?.medium||500,backgroundColor:v?p.colors.primary:p.colors.hover,color:v?"#ffffff":p.colors.textSecondary,border:"none",borderRadius:"string"==typeof p.borderRadius?p.borderRadius:p.borderRadius.medium,cursor:v?"pointer":"not-allowed",opacity:v?1:.6,transition:p.transitions?.fast||"150ms ease-in-out"},"aria-label":v?r:a},v?r:a))},e.CurrentRefinements=({refinements:e=[],onRefinementClear:r,onClearAll:a,renderRefinement:o,showClearAll:n=!0,className:s,style:i,theme:l})=>{const{theme:c}=S(),d=l||{},u=(e,a)=>t.createElement("div",{key:`${e.field}-${e.value}-${a}`,className:d.item,style:{display:"inline-flex",alignItems:"center",padding:`${c.spacing.small} ${c.spacing.medium}`,margin:`0 ${c.spacing.small} ${c.spacing.small} 0`,backgroundColor:c.colors.hover,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,fontSize:c.typography.fontSize.small}},t.createElement("span",{className:d.label,style:{marginRight:c.spacing.small,color:c.colors.text,fontWeight:"500"}},e.label||e.field,":"),t.createElement("span",{className:d.value,style:{marginRight:c.spacing.small,color:c.colors.text}},e.displayValue||e.value),t.createElement("button",{type:"button",onClick:()=>{return t=e.field,a=e.value,void(r&&r(t,a));var t,a},className:d.clearButton,style:{border:"none",backgroundColor:"transparent",color:c.colors.text,cursor:"pointer",fontSize:c.typography.fontSize.medium,padding:0,marginLeft:c.spacing.small,width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",transition:c.transitions?.fast||"150ms ease-in-out"},"aria-label":`Clear ${e.label||e.field}: ${e.value}`},"×"));return 0===e.length?null:t.createElement("div",{className:I(d.container,s),style:i},t.createElement("div",{className:d.list,style:{display:"flex",flexWrap:"wrap",alignItems:"center",marginBottom:n?c.spacing.medium:0}},e.map((e,t)=>o?o(e,t):u(e,t))),n&&e.length>1&&t.createElement("button",{type:"button",onClick:()=>{a&&a()},className:d.clearAllButton,style:{padding:`${c.spacing.small} ${c.spacing.medium}`,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,backgroundColor:c.colors.background,color:c.colors.text,cursor:"pointer",fontSize:c.typography.fontSize.small,textDecoration:"underline"}},"Clear all filters"))},e.DocSearch=function({storeId:e,storeSecret:r,seekoraApiEndpoint:a,apiEndpoint:o,apiKey:n,sources:s,placeholder:i="Search documentation...",maxResults:l=10,debounceMs:c=200,onSelect:d,onClose:u,translations:p={},renderButton:m=!0,buttonComponent:g=wr,initialOpen:f=!1,disableShortcut:h=!1,shortcutKey:y="k",processGroupedResults:b}){const[x,v]=t.useState(f),k=t.useRef(!1),E=!!e,S=Nr({storeId:e||"",storeSecret:r,apiEndpoint:a,maxResults:l,debounceMs:c,analyticsTags:["docsearch"]}),w=Ir({apiEndpoint:o,apiKey:n,sources:s,maxResults:l,debounceMs:c,processGroupedResults:b}),{query:C,suggestions:R,isLoading:I,error:N,selectedIndex:T,setQuery:A,selectNext:z,selectPrev:M,setSelectedIndex:_,reset:L,getSelectedItem:P}=E?S:w,B=E?void 0:w.groupedSuggestions,D=E?R:w.results,$=E?"suggestions":w.mode,F=E?[{id:"seekora",name:"Results",endpoint:""}]:w.sources,W=t.useCallback(()=>v(!0),[]),q=t.useCallback(()=>{v(!1),L(),u?.()},[L,u]),H=t.useCallback(e=>{E&&S.trackDocClick&&S.trackDocClick(e,T+1),d?d(e):window.location.href=e.url,q()},[d,q,E,S,T]),O=t.useCallback(()=>{const e=P();e&&H(e)},[P,H]),j=t.useCallback(()=>{k.current=!0,z()},[z]),V=t.useCallback(()=>{k.current=!0,M()},[M]),{handleModalKeyDown:Q}=Er({isOpen:x,onOpen:W,onClose:q,onSelectNext:j,onSelectPrev:V,onEnter:O,disableShortcut:h,shortcutKey:y}),U=t.useCallback(e=>Q(e),[Q]),G="results"===$?D:R;return t.createElement(t.Fragment,null,m&&t.createElement(g,{onClick:W,placeholder:p.buttonText||i}),t.createElement(lr,{isOpen:x,onClose:q},t.createElement("div",{className:"seekora-docsearch-modal",onKeyDown:U},t.createElement("header",{className:"seekora-docsearch-header"},t.createElement(cr,{value:C,onChange:A,onKeyDown:U,placeholder:i,isLoading:I,onClear:L}),t.createElement("button",{type:"button",className:"seekora-docsearch-close",onClick:q,"aria-label":"Close search"},t.createElement("span",{className:"seekora-docsearch-close-text"},"esc"))),t.createElement("div",{className:"seekora-docsearch-body"},t.createElement(vr,{hits:G,groupedHits:B,selectedIndex:T,onSelect:H,onHover:_,scrollSelectionIntoViewRef:k,query:C,isLoading:I,error:N,translations:p,sources:F})),t.createElement(kr,{translations:p}))))},e.DocSearchButton=wr,e.DropdownPanel=Ne,e.Facets=({results:e,facets:r,onFacetChange:a,renderFacet:o,renderFacetItem:n,maxItems:s=10,showMore:i=!0,className:c,style:d,theme:p})=>{const{theme:m}=S(),{results:g,refinements:f,addRefinement:h,removeRefinement:y}=w(),b=p||{},[x,v]=t.useState({}),k=e||g,E=(()=>{if(r)return r;const e=k?.data?.facets||k?.facets||k?.data?.data?.facets||null;if(l("Facets: Extracting facets",{hasResults:!!k,hasData:!!k?.data,rawFacets:e?Array.isArray(e)?e.length:"not array":null,resultsKeys:k?Object.keys(k):[],dataKeys:k?.data?Object.keys(k.data):[],sampleFacet:e&&Array.isArray(e)&&e.length>0?e[0]:null}),!e||!Array.isArray(e))return l("Facets: No facets found in response",{rawFacetsType:e?typeof e:"null",isArray:Array.isArray(e),resultsStructure:k?JSON.stringify(Object.keys(k)):"null",dataStructure:k?.data?JSON.stringify(Object.keys(k.data)):"null"}),[];const t=e.map(e=>{const t=e.field_name||e.field;return{field:t,label:e.label||t,items:Array.isArray(e.counts)?e.counts.map(e=>({value:e.value,count:e.count,selected:f.some(r=>r.field===t&&r.value===e.value)})):[]}});return l("Facets: Extracted facets",{count:t.length,facets:t.map(e=>({field:e.field,itemsCount:e.items.length}))}),t})(),C=(e,t,r)=>{const o=!r;if(l("Facets: Facet toggled",{field:e,value:t,selected:o}),o?h(e,t):y(e,t),a)try{a(e,t,o)}catch(r){const a=r instanceof Error?r:new Error(String(r));u("Facets: Error in onFacetChange callback",{field:e,value:t,selected:o,error:a.message})}},R=e=>{v(t=>({...t,[e]:!t[e]}))},N=(e,r)=>{const a=x[e.field]||!1,o=a?e.items:e.items.slice(0,s),l=e.items.length>s;return t.createElement("div",{key:e.field,className:b.facet,style:{marginBottom:m.spacing.large,padding:m.spacing.medium,backgroundColor:m.colors.background,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium}},t.createElement("h3",{className:b.facetTitle,style:{fontSize:m.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:m.spacing.medium,color:m.colors.text}},e.label||e.field),t.createElement("div",{className:b.facetList},o.map((r,a)=>{const o=a;return n?n(r,e,o):((e,r,a)=>!(x[r.field]||a<s)&&a>=s?null:t.createElement("div",{key:`${r.field}-${e.value}`,className:I(b.facetItem,(f.some(t=>t.field===r.field&&t.value===e.value)||e.selected)&&b.facetItemActive),onClick:()=>C(r.field,e.value,e.selected||!1),style:{display:"flex",alignItems:"center",padding:m.spacing.small,cursor:"pointer",borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,marginBottom:m.spacing.small,backgroundColor:f.some(t=>t.field===r.field&&t.value===e.value)||e.selected?m.colors.hover:"transparent",transition:"background-color 0.2s ease"}},t.createElement("input",{type:"checkbox",checked:f.some(t=>t.field===r.field&&t.value===e.value)||e.selected||!1,onChange:()=>C(r.field,e.value,e.selected||!1),className:b.checkbox,style:{marginRight:m.spacing.small,cursor:"pointer"},"aria-label":`Filter by ${e.value}`}),t.createElement("span",{className:b.facetItemLabel,style:{flex:1,fontSize:m.typography.fontSize.medium,color:m.colors.text}},e.value),t.createElement("span",{className:b.facetItemCount,style:{fontSize:m.typography.fontSize.small,color:m.colors.textSecondary||m.colors.text,opacity:.7,marginLeft:m.spacing.small}},"(",e.count,")")))(r,e,o)})),i&&l&&!a&&t.createElement("button",{type:"button",onClick:()=>R(e.field),style:{marginTop:m.spacing.small,padding:m.spacing.small,border:"none",backgroundColor:"transparent",color:m.colors.primary,cursor:"pointer",fontSize:m.typography.fontSize.small,textDecoration:"underline"}},"Show more (",e.items.length-s," more)"),a&&l&&t.createElement("button",{type:"button",onClick:()=>R(e.field),style:{marginTop:m.spacing.small,padding:m.spacing.small,border:"none",backgroundColor:"transparent",color:m.colors.primary,cursor:"pointer",fontSize:m.typography.fontSize.small,textDecoration:"underline"}},"Show less"))};return 0===E.length?(l("Facets: No facets to display",{hasResults:!!k,resultsType:k?typeof k:"null"}),null):t.createElement("div",{className:I(b.container,c),style:d},E.map((e,t)=>o?o(e,t):N(e)))},e.FederatedDropdown=ae,e.Fingerprint=x,e.FrequentlyBoughtTogether=({productId:e,items:r,loading:a=!1,title:o="Frequently Bought Together",maxItems:n=4,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u="horizontal",currencySymbol:p="$",showAddAllButton:m=!0,onAddAll:g})=>{const{theme:f}=S(),h=d||{},y=r?.slice(0,n)||[],b=a,x=t.useMemo(()=>y.reduce((e,t)=>{const r=t.price;return e+("number"==typeof r?r:parseFloat(String(r))||0)},0),[y]);return b?t.createElement("div",{className:I(h.root,l),style:c},t.createElement("div",{className:h.loading,style:A(f)},"Loading recommendations...")):0===y.length?null:t.createElement("div",{className:I(h.root,l),style:c},o&&t.createElement("h3",{className:h.title,style:{margin:`0 0 ${f.spacing.medium} 0`,fontSize:f.typography.fontSize.large,fontWeight:f.typography.fontWeight?.semibold||600,color:f.colors.text}},o),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:f.spacing.medium,flexWrap:"wrap"}},y.map((e,r)=>t.createElement(t.Fragment,{key:e.id||r},r>0&&t.createElement("span",{style:{fontSize:"1.5rem",color:f.colors.textSecondary}},"+"),t.createElement("div",{onClick:()=>i?.(e,r),style:{cursor:i?"pointer":"default",textAlign:"center"}},s?s(e,r):t.createElement(t.Fragment,null,t.createElement("img",{src:e.image||e.imageUrl||"",alt:e.title||e.name||"",style:{width:"80px",height:"80px",objectFit:"cover",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.small,border:`1px solid ${f.colors.border}`}}),t.createElement("div",{style:{marginTop:f.spacing.small,fontSize:f.typography.fontSize.small,color:f.colors.text}},p,"number"==typeof e.price?e.price.toFixed(2):e.price))))),m&&y.length>0&&t.createElement("div",{style:{marginLeft:"auto",textAlign:"center"}},t.createElement("div",{style:{fontSize:f.typography.fontSize.large,fontWeight:f.typography.fontWeight?.bold||700,color:f.colors.text,marginBottom:f.spacing.small}},"Total: ",p,x.toFixed(2)),t.createElement("button",{type:"button",onClick:()=>g?.(y),style:{padding:`${f.spacing.small} ${f.spacing.medium}`,fontSize:f.typography.fontSize.medium,fontWeight:f.typography.fontWeight?.medium||500,color:"#ffffff",backgroundColor:f.colors.primary,border:"none",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.medium,cursor:"pointer"}},"Add all to cart"))))},e.GoogleDropdown=Dt,e.HierarchicalMenu=({attributes:e,separator:r=" > ",limit:a=10,showMore:o=!0,showMoreLimit:n=20,renderItem:s,onSelect:i,className:l,style:c,theme:d,rootPath:u=null,sortBy:p="name",items:m})=>{const{theme:g,stateManager:f}=S(),{results:h,refinements:y,addRefinement:b,removeRefinement:x}=w(),v=d||{},[k,E]=t.useState({}),C=t.useCallback(()=>{if(m)return m;if(!h)return[];const t=h.facets||h.facet_counts||{},r=e[0],a=t[r]||{},o=[];return Object.entries(a).forEach(([e,t])=>{const a=y.some(t=>t.field===r&&t.value===e);o.push({label:e,value:e,count:t,isRefined:a,data:R(e,1)})}),o},[h,e,y,m]),R=t.useCallback((t,a)=>{if(a>=e.length)return[];if(!h)return[];const o=h.facets||h.facet_counts||{},n=e[a],s=o[n]||{},i=[];return Object.entries(s).forEach(([e,o])=>{if(e.startsWith(t+r)){const s=e.replace(t+r,"").split(r)[0],l=y.some(t=>t.field===n&&t.value===e);e.replace(t+r,"").includes(r)||i.push({label:s,value:e,count:o,isRefined:l,data:R(e,a+1)})}}),i},[h,e,r,y]),N=t.useMemo(()=>{let e=C();return e=[...e].sort((e,t)=>{if("count"===p)return(t.count||0)-(e.count||0);if("isRefined"===p){if(e.isRefined&&!t.isRefined)return-1;if(!e.isRefined&&t.isRefined)return 1}return e.label.localeCompare(t.label)}),e},[C,p]),T=t.useCallback((t,r)=>{const a=e[r]||e[0];t.isRefined?(e.slice(r).forEach(e=>{y.filter(r=>r.field===e&&r.value.startsWith(t.value)).forEach(e=>x(e.field,e.value,!1))}),f.search()):(y.filter(e=>e.field===a&&e.value!==t.value).forEach(e=>x(e.field,e.value,!1)),b(a,t.value,!0)),i&&i(t.value,r)},[e,y,b,x,f,i]),A=(e,r)=>{if(!e||0===e.length)return null;const i=k[r]||!1,l=i?n:a,c=e.slice(0,l),d=e.length>l;return t.createElement("ul",{className:v.list,style:{listStyle:"none",margin:0,padding:r>0?`0 0 0 ${g.spacing.medium}`:0}},c.map((e,a)=>t.createElement("li",{key:e.value,className:I(v.item,e.isRefined&&v.itemSelected,e.data&&e.data.length>0&&v.itemParent),style:{padding:`${g.spacing.small} 0`}},s?s(e,r):t.createElement(t.Fragment,null,t.createElement("button",{type:"button",onClick:()=>T(e,r),className:v.link,style:{display:"flex",alignItems:"center",gap:g.spacing.small,width:"100%",padding:0,background:"none",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"inherit",fontSize:g.typography.fontSize.small,color:e.isRefined?g.colors.primary:g.colors.text,fontWeight:e.isRefined?600:400}},t.createElement("span",{className:v.label,style:{flex:1}},e.label),void 0!==e.count&&t.createElement("span",{className:v.count,style:{color:g.colors.textSecondary,fontSize:g.typography.fontSize.small}},e.count)),e.isRefined&&e.data&&e.data.length>0&&A(e.data,r+1)))),o&&d&&t.createElement("li",null,t.createElement("button",{type:"button",onClick:()=>(e=>{E(t=>({...t,[e]:!t[e]}))})(r),className:v.showMore,style:{padding:`${g.spacing.small} 0`,background:"none",border:"none",cursor:"pointer",fontSize:g.typography.fontSize.small,color:g.colors.primary,textDecoration:"underline"}},i?"Show less":`Show ${e.length-l} more`)))};return 0===N.length?null:t.createElement("div",{className:I(v.root,l),style:c},A(N,0))},e.Highlight=({hit:e,attribute:r,className:a,style:o,theme:n,tagName:s="span",renderHighlighted:i,renderNonHighlighted:l,query:c})=>{const{theme:d}=S(),u=n||{},f=t.useMemo(()=>p({hit:e,attribute:r,preTag:"<mark>",postTag:"</mark>"}),[e,r]),h=t.useMemo(()=>{const t=m(f,"<mark>","</mark>");if(t.every(e=>!e.isHighlighted)&&c){const t=e[r]||f;return g(String(t),c)}return t},[f,c,e,r]),y={backgroundColor:d.colors.warning||"#fff59d",fontWeight:d.typography.fontWeight?.semibold||600,padding:"0 2px",borderRadius:"2px"},b=h.map((e,r)=>e.isHighlighted?i?t.createElement(t.Fragment,{key:r},i(e,r)):t.createElement("mark",{key:r,className:u.highlighted,style:y},e.value):l?t.createElement(t.Fragment,{key:r},l(e,r)):t.createElement("span",{key:r,className:u.nonHighlighted},e.value));return t.createElement(s,{className:a||u.root,style:o},b)},e.HitsPerPage=({items:e,onHitsPerPageChange:r,renderSelect:a,className:o,style:n,theme:s,label:i="Show",syncWithState:l=!0})=>{const{theme:c}=S(),{itemsPerPage:d,setPage:u}=w(),{stateManager:p}=S(),m=s||{},g=e.find(e=>e.default)||e[0],[f,h]=t.useState(g?.value||10);t.useEffect(()=>{l&&g&&d!==g.value&&p.setItemsPerPage(g.value,!1)},[]);const y=l?d:f,b=e=>{const t=parseInt(e.target.value,10);h(t),l&&(p.setItemsPerPage(t,!1),u(1,!0)),r&&r(t)};return a?t.createElement("div",{className:I(m.root,o),style:n},a({value:y,onChange:b,items:e})):t.createElement("div",{className:I(m.root,o),style:{display:"flex",alignItems:"center",gap:c.spacing.small,...n}},i&&t.createElement("label",{style:{fontSize:c.typography.fontSize.medium,color:c.colors.text}},i),t.createElement("select",{value:y,onChange:b,className:m.select,style:{padding:c.spacing.small,paddingRight:c.spacing.medium,fontSize:c.typography.fontSize.medium,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,backgroundColor:c.colors.background,color:c.colors.text,cursor:"pointer",outline:"none"},"aria-label":"Results per page"},e.map(e=>t.createElement("option",{key:e.value,value:e.value,className:m.option},e.label))))},e.ImageDisplay=Pe,e.InfiniteHits=({renderHit:e,renderEmpty:r,renderLoading:a,renderShowMore:o,showMoreButton:n=!0,useInfiniteScroll:s=!1,scrollThreshold:i=.1,fieldMapping:l,showMoreLabel:c="Show more",loadingLabel:d="Loading...",onHitClick:u,className:p,style:m,theme:g,syncWithState:f=!0})=>{const{theme:h,stateManager:y}=S(),{results:b,loading:x,currentPage:v,setPage:k}=w(),E=g||{},[C,R]=t.useState([]),[N,T]=t.useState(!1),A=t.useRef(null),z=t.useRef(v),M=t.useCallback(e=>e?e.results?e.results:e.hits?e.hits:Array.isArray(e)?e:[]:[],[]),_=t.useMemo(()=>M(b),[b,M]),L=b?.totalResults||b?.found||0,P=y.getState().itemsPerPage||10,B=Math.ceil(L/P),D=v>=B;t.useEffect(()=>{_.length&&(1===v?R(_):v>z.current&&R(e=>[...e,..._]),z.current=v,T(!1))},[_,v]),t.useEffect(()=>{1===v&&(R(_),z.current=1)},[b]);const $=t.useCallback(()=>{D||x||N||(T(!0),f&&k(v+1))},[D,x,N,f,k,v]);t.useEffect(()=>{if(!s||!A.current)return;const e=new IntersectionObserver(e=>{!e[0].isIntersecting||D||x||N||$()},{threshold:i});return e.observe(A.current),()=>e.disconnect()},[s,i,D,x,N,$]);const F=(e,t)=>{if(!l||!l[t])return e[t]||"";return e[l[t]]||""},W=()=>t.createElement("div",{className:E.loading,style:{padding:h.spacing.medium,textAlign:"center",color:h.colors.textSecondary}},d);return x&&0===C.length?t.createElement("div",{className:I(E.root,p),style:m},a?a():W()):x||0!==C.length?t.createElement("div",{className:I(E.root,p),style:m},t.createElement("div",{className:E.list},C.map((r,a)=>e?e(r,a):((e,r)=>{const a=F(e,"title")||e.title||"",o=F(e,"description")||e.description||"",n=F(e,"image")||e.image||e.imageUrl||"",s=F(e,"price")||e.price;return t.createElement("div",{key:e.id||r,className:E.item,style:{display:"flex",gap:h.spacing.medium,padding:h.spacing.medium,borderBottom:`1px solid ${h.colors.border}`,cursor:u?"pointer":"default",transition:h.transitions?.fast||"150ms ease-in-out"},onClick:()=>u?.(e,r),role:u?"button":void 0,tabIndex:u?0:void 0},n&&t.createElement("img",{src:n,alt:a,style:{width:"80px",height:"80px",objectFit:"cover",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.small}}),t.createElement("div",{style:{flex:1}},t.createElement("h3",{style:{margin:0,marginBottom:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.semibold||600,color:h.colors.text}},a),o&&t.createElement("p",{style:{margin:0,fontSize:h.typography.fontSize.small,color:h.colors.textSecondary,lineHeight:h.typography.lineHeight?.normal||1.5}},o),s&&t.createElement("span",{style:{display:"inline-block",marginTop:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.bold||700,color:h.colors.primary}},"$","number"==typeof s?s.toFixed(2):s)))})(r,a))),n&&!s&&!D&&(o?o({isLoading:N,isLastPage:D,onClick:$}):t.createElement("button",{type:"button",onClick:$,disabled:D||N,className:I(E.loadMore,(D||N)&&E.loadMoreDisabled),style:{display:"block",width:"100%",padding:h.spacing.medium,marginTop:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,backgroundColor:D||N?h.colors.hover:h.colors.primary,color:D||N?h.colors.textSecondary:"#ffffff",border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:D||N?"not-allowed":"pointer",transition:h.transitions?.fast||"150ms ease-in-out"}},N?d:D?"No more results":c)),N&&(a?a():W()),s&&!D&&t.createElement("div",{ref:A,className:E.sentinel,style:{height:"1px",visibility:"hidden"},"aria-hidden":"true"})):t.createElement("div",{className:I(E.root,p),style:m},r?r():t.createElement("div",{className:E.empty,style:{padding:h.spacing.large,textAlign:"center",color:h.colors.textSecondary}},"No results found"))},e.ItemCard=Fe,e.ItemGrid=qe,e.MinimalDropdown=ar,e.MobileFilters=({isOpen:e,onClose:r,onApply:a,title:o="Filters",applyButtonText:n="Apply",clearButtonText:s="Clear all",position:i="right",children:l,className:c,theme:d,showHeader:u=!0,showFooter:p=!0,showFilterCount:m=!0,closeOnBackdropClick:g=!0,closeOnEscape:f=!0})=>{const{theme:h}=S(),{refinements:y,clearRefinements:b}=w(),x=d||{},v=t.useRef(null);t.useEffect(()=>(document.body.style.overflow=e?"hidden":"",()=>{document.body.style.overflow=""}),[e]),t.useEffect(()=>{if(!f)return;const t=t=>{"Escape"===t.key&&e&&r()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e,r,f]),t.useEffect(()=>{if(e&&v.current){const e=v.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),t=e[0],r=e[e.length-1],a=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===t&&(e.preventDefault(),r?.focus()):document.activeElement===r&&(e.preventDefault(),t?.focus()))};return document.addEventListener("keydown",a),t?.focus(),()=>document.removeEventListener("keydown",a)}},[e]);const k=t.useCallback(()=>{g&&r()},[g,r]),E=t.useCallback(()=>{a&&a(),r()},[a,r]),C=t.useCallback(()=>{b(!0)},[b]),R=e=>{if(e)return"translate(0, 0)";switch(i){case"left":return"translateX(-100%)";case"right":default:return"translateX(100%)";case"bottom":return"translateY(100%)"}};return e?t.createElement(t.Fragment,null,t.createElement("div",{className:x.overlay,onClick:k,style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:h.zIndex?.modal||1050,opacity:e?1:0,transition:"opacity 300ms ease-in-out"},"aria-hidden":"true"}),t.createElement("div",{ref:v,className:I(x.drawer,c),style:(()=>{const t={position:"fixed",backgroundColor:h.colors.background,display:"flex",flexDirection:"column",transition:"transform 300ms ease-in-out",transform:R(e),zIndex:(h.zIndex?.modal||1050)+1};switch(i){case"left":return{...t,top:0,left:0,bottom:0,width:"80%",maxWidth:"320px"};case"right":return{...t,top:0,right:0,bottom:0,width:"80%",maxWidth:"320px"};case"bottom":return{...t,left:0,right:0,bottom:0,maxHeight:"80vh",borderTopLeftRadius:"16px",borderTopRightRadius:"16px"};default:return t}})(),role:"dialog","aria-modal":"true","aria-label":o},u&&t.createElement("div",{className:x.header,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:h.spacing.medium,borderBottom:`1px solid ${h.colors.border}`}},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:h.spacing.small}},t.createElement("h2",{className:x.title,style:{margin:0,fontSize:h.typography.fontSize.large,fontWeight:h.typography.fontWeight?.semibold||600,color:h.colors.text}},o),m&&y.length>0&&t.createElement("span",{className:x.filterCount,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"24px",height:"24px",padding:"0 6px",fontSize:h.typography.fontSize.small,fontWeight:h.typography.fontWeight?.bold||700,color:"#ffffff",backgroundColor:h.colors.primary,borderRadius:"12px"}},y.length)),t.createElement("button",{type:"button",onClick:r,className:x.closeButton,style:{padding:h.spacing.small,background:"none",border:"none",cursor:"pointer",fontSize:"1.5rem",color:h.colors.text},"aria-label":"Close filters"},"×")),t.createElement("div",{className:x.content,style:{flex:1,overflow:"auto",padding:h.spacing.medium}},l),p&&t.createElement("div",{className:x.footer,style:{display:"flex",gap:h.spacing.small,padding:h.spacing.medium,borderTop:`1px solid ${h.colors.border}`}},t.createElement("button",{type:"button",onClick:C,className:x.clearButton,style:{flex:1,padding:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:h.colors.text,backgroundColor:"transparent",border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer"}},s),t.createElement("button",{type:"button",onClick:E,className:x.applyButton,style:{flex:2,padding:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:"#ffffff",backgroundColor:h.colors.primary,border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer"}},n,m&&y.length>0&&` (${y.length})`)))):null},e.MobileFiltersButton=({onClick:e,text:r="Filters",showCount:a=!0,className:o,style:n})=>{const{theme:s}=S(),{refinements:i}=w();return t.createElement("button",{type:"button",onClick:e,className:o,style:{display:"inline-flex",alignItems:"center",gap:s.spacing.small,padding:`${s.spacing.small} ${s.spacing.medium}`,fontSize:s.typography.fontSize.medium,fontWeight:s.typography.fontWeight?.medium||500,color:s.colors.text,backgroundColor:s.colors.background,border:`1px solid ${s.colors.border}`,borderRadius:"string"==typeof s.borderRadius?s.borderRadius:s.borderRadius.medium,cursor:"pointer",...n}},t.createElement("span",null,"☰"),t.createElement("span",null,r),a&&i.length>0&&t.createElement("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"20px",padding:"0 4px",fontSize:s.typography.fontSize.small,fontWeight:s.typography.fontWeight?.bold||700,color:"#ffffff",backgroundColor:s.colors.primary,borderRadius:"10px"}},i.length))},e.MobileSheetDropdown=rr,e.Pagination=({results:e,currentPage:r,itemsPerPage:a,totalPages:o,onPageChange:n,maxPages:s=7,showFirstLast:i=!0,showPrevNext:l=!0,renderPageButton:c,className:d,style:u,theme:p})=>{const{theme:m}=S(),{results:g,currentPage:f,setPage:h}=w(),y=p||{},b=r||f,x=e||g,v=a||x?.perPage||x?.data?.per_page||x?.data?.data?.per_page||20,k=x?.totalResults||x?.data?.total_results||x?.data?.data?.total_results||0,E=o||x?.totalPages||x?.data?.total_pages||x?.data?.data?.total_pages||Math.ceil(k/v),C=e=>{e<1||e>E||e===b||(h(e),n&&n(e))};if(E<=1)return null;const R=(()=>{const e=[],t=Math.floor(s/2);let r=Math.max(1,b-t),a=Math.min(E,b+t);b<=t&&(a=Math.min(s,E)),b>=E-t&&(r=Math.max(1,E-s+1)),i&&r>1&&(e.push(1),r>2&&e.push("ellipsis"));for(let t=r;t<=a;t++)e.push(t);return i&&a<E&&(a<E-1&&e.push("ellipsis"),e.push(E)),e})();return t.createElement("nav",{className:I(y.container,d),style:u,"aria-label":"Pagination"},t.createElement("ul",{className:y.list,style:{listStyle:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,flexWrap:"wrap"}},l&&t.createElement("li",null,t.createElement("button",{type:"button",disabled:1===b,onClick:()=>C(b-1),className:I(y.item,1===b&&y.itemDisabled),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:m.colors.background,color:m.colors.text,cursor:1===b?"not-allowed":"pointer",opacity:1===b?.5:1,fontSize:m.typography.fontSize.medium},"aria-label":"Previous page"},"Previous")),R.map((e,r)=>{if("ellipsis"===e)return t.createElement("li",{key:`ellipsis-${r}`},t.createElement("span",{className:y.ellipsis,style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,color:m.colors.text,fontSize:m.typography.fontSize.medium}},"..."));const a=e===b,o=!1;return t.createElement("li",{key:e},c?c(e,a,o):((e,r,a)=>t.createElement("button",{type:"button",disabled:a,onClick:()=>C(e),className:I(y.item,r&&y.itemActive,a),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:r?m.colors.primary:m.colors.background,color:r?"#fff":m.colors.text,cursor:"pointer",opacity:1,fontSize:m.typography.fontSize.medium,minWidth:"40px",...r&&{fontWeight:"bold"}}},e))(e,a,o))}),l&&t.createElement("li",null,t.createElement("button",{type:"button",disabled:b===E,onClick:()=>C(b+1),className:I(y.item,b===E&&y.itemDisabled),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:m.colors.background,color:m.colors.text,cursor:b===E?"not-allowed":"pointer",opacity:b===E?.5:1,fontSize:m.typography.fontSize.medium},"aria-label":"Next page"},"Next"))))},e.PinterestDropdown=Ht,e.ProductCard=je,e.ProductGallery=function({images:e,variant:r="thumbStrip",alt:a="Product",className:o,style:n,carouselAutoplay:s,carouselIntervalMs:i}){return t.createElement("div",{className:I("seekora-product-gallery",o),style:n},t.createElement(Pe,{images:e,variant:r,alt:a,carouselAutoplay:s,carouselIntervalMs:i}))},e.ProductGrid=Ve,e.ProductInfo=function({title:e,description:r,price:a,currency:o="$",renderVariantSelector:n,renderCTA:s,className:i,style:l}){const c=null!=a?"number"==typeof a?a:parseFloat(String(a)):null;return t.createElement("div",{className:I("seekora-product-info",i),style:{display:"flex",flexDirection:"column",gap:12,...l}},t.createElement("h1",{className:"seekora-product-info-title",style:{fontSize:"1.25rem",fontWeight:600,margin:0}},e),null==c||Number.isNaN(c)?null:t.createElement("span",{className:"seekora-product-info-price",style:{fontSize:"1.125rem",fontWeight:600}},o,c.toFixed(2)),r?t.createElement("p",{className:"seekora-product-info-description",style:{fontSize:"0.875rem",color:"var(--seekora-text-secondary)",margin:0,lineHeight:1.5}},r):null,n?.(),s?.())},e.ProductRecommendations=function({title:e="You may also like",items:r,onItemClick:a,maxItems:o=6,columns:n=3,className:s,style:i,renderItem:l}){return r?.length?t.createElement("div",{className:I("seekora-product-recommendations",s),style:i},t.createElement("h2",{className:"seekora-product-recommendations-title",style:{fontSize:"1rem",fontWeight:600,marginBottom:12}},e),t.createElement(qe,{items:r,maxItems:o,columns:n,onItemClick:a,renderItem:l})):null},e.QuerySuggestions=({query:e="",maxSuggestions:r=10,debounceMs:a=300,minQueryLength:o=2,onSuggestionClick:n,renderSuggestion:s,renderLoading:i,renderEmpty:l,showTitle:c=!1,title:d="Suggestions",className:u,style:p,theme:m})=>{const{client:g,theme:f}=S(),[h,y]=t.useState(-1),{suggestions:b,loading:x,error:v}=C({client:g,query:e,enabled:e.length>=o,debounceMs:a,maxSuggestions:r}),k=b.slice(0,r),E=m||{};if(e.length<o)return null;if(x)return t.createElement("div",{className:I(E.container,u),style:p},c&&t.createElement("div",{className:E.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),i?i():t.createElement("div",{style:{padding:f.spacing.medium,textAlign:"center",color:f.colors.text}},"Loading suggestions..."));if(v||0===k.length)return t.createElement("div",{className:I(E.container,u),style:p},c&&t.createElement("div",{className:E.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),l?l():t.createElement("div",{style:{padding:f.spacing.medium,textAlign:"center",color:f.colors.text,opacity:.6}},"No suggestions available"));const w=s||((e,r)=>t.createElement("div",{key:r},t.createElement("span",null,e.query),void 0!==e.count&&t.createElement("span",{style:{opacity:.6,marginLeft:f.spacing.small}},"(",e.count,")")));return t.createElement("div",{className:I(E.container,u),style:p},c&&t.createElement("div",{className:E.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),t.createElement("div",{className:E.suggestionsList},k.map((e,r)=>{const a=r===h;return t.createElement("div",{key:r,className:I(E.suggestionItem,a&&E.suggestionItemActive),onClick:()=>(e=>{n&&n(e.query)})(e),onMouseEnter:()=>y(r),onMouseLeave:()=>y(-1),style:{padding:f.spacing.medium,cursor:"pointer",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.medium,transition:"background-color 0.2s ease",backgroundColor:a?f.colors.hover:"transparent",marginBottom:r<k.length-1?f.spacing.small:0}},w(e,r))})))},e.QuerySuggestionsDropdown=j,e.RangeInput=({field:e,label:r,min:a,max:o,currentMin:n,currentMax:s,step:i=1,onRangeChange:l,renderRangeInput:c,className:d,style:u,theme:p,showApplyButton:m=!0,placeholder:g={min:"Min",max:"Max"},syncWithState:f=!0})=>{const{theme:h}=S(),{refinements:y,addRefinement:b,removeRefinement:x}=w(),v=p||{},k=t.useMemo(()=>f?((e,t)=>{let r,a;return e.forEach(e=>{if(e.field===t){const t=e.value.match(/^>=(\d+(?:\.\d+)?)$/);t&&(r=parseFloat(t[1]));const o=e.value.match(/^<=(\d+(?:\.\d+)?)$/);o&&(a=parseFloat(o[1]))}}),{min:r,max:a}})(y,e):{min:void 0,max:void 0},[f,y,e]),[E,C]=t.useState(n??k.min),[R,N]=t.useState(s??k.max),[T,A]=t.useState(n??k.min),[z,M]=t.useState(s??k.max);t.useEffect(()=>{f&&(k.min===T&&k.max===z||(C(k.min),N(k.max),A(k.min),M(k.max)))},[f,k.min,k.max]);const _=void 0!==n?n:E,L=void 0!==s?s:R,P=t.useCallback((t,r)=>{f&&(y.forEach(t=>{t.field===e&&x(e,t.value,!1)}),void 0!==t&&b(e,`>=${t}`,!1),void 0!==r?b(e,`<=${r}`,!0):void 0!==t&&b(e,`>=${t}`,!0))},[f,e,y,b,x]),B=t.useCallback(e=>{const t=""===e.target.value?void 0:parseFloat(e.target.value);C(t),m||(P(t,L),l&&l(t,L))},[L,m,l,P]),D=t.useCallback(e=>{const t=""===e.target.value?void 0:parseFloat(e.target.value);N(t),m||(P(_,t),l&&l(_,t))},[_,m,l,P]),$=t.useCallback(()=>{A(E),M(R),P(E,R),l&&l(E,R)},[E,R,l,P]),F=t.useCallback(()=>{C(void 0),N(void 0),A(void 0),M(void 0),f&&y.forEach(t=>{t.field===e&&x(e,t.value,!0)}),l&&l(void 0,void 0)},[f,e,y,x,l]);return c?t.createElement("div",{className:I(v.container,d),style:u},c({min:_,max:L,onMinChange:e=>{C(e),!m&&l&&l(e,L)},onMaxChange:e=>{N(e),!m&&l&&l(_,e)},onApply:$})):t.createElement("div",{className:I(v.container,d),style:u},r&&t.createElement("label",{className:v.label,style:{display:"block",fontSize:h.typography.fontSize.medium,fontWeight:"bold",marginBottom:h.spacing.small,color:h.colors.text}},r),t.createElement("div",{className:v.inputGroup,style:{display:"flex",alignItems:"center",gap:h.spacing.small}},t.createElement("input",{type:"number",min:a,max:o,step:i,value:void 0!==_?_:"",onChange:B,placeholder:g.min,className:I(v.input),style:{flex:1,padding:h.spacing.small,fontSize:h.typography.fontSize.medium,backgroundColor:h.colors.background,color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,outline:"none"}}),t.createElement("span",{className:v.separator,style:{color:h.colors.text,opacity:.7}},"to"),t.createElement("input",{type:"number",min:a,max:o,step:i,value:void 0!==L?L:"",onChange:D,placeholder:g.max,className:I(v.input),style:{flex:1,padding:h.spacing.small,fontSize:h.typography.fontSize.medium,backgroundColor:h.colors.background,color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,outline:"none"}}),m&&t.createElement("button",{type:"button",onClick:$,className:v.button,style:{padding:`${h.spacing.small} ${h.spacing.medium}`,backgroundColor:h.colors.primary,color:"#fff",border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer",fontSize:h.typography.fontSize.small,fontWeight:"500"}},"Apply"),(void 0!==T||void 0!==z||void 0!==_||void 0!==L)&&t.createElement("button",{type:"button",onClick:F,style:{padding:`${h.spacing.small} ${h.spacing.medium}`,backgroundColor:"transparent",color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer",fontSize:h.typography.fontSize.small}},"Reset")))},e.RangeSlider=({field:e,label:r,min:a,max:o,step:n=1,currentMin:s,currentMax:i,onRangeChange:l,formatValue:c=e=>e.toString(),className:d,style:u,theme:p,showValues:m=!0,syncWithState:g=!0,debounceMs:f=300})=>{const{theme:h}=S(),{refinements:y,addRefinement:b,removeRefinement:x}=w(),v=p||{},k=t.useMemo(()=>{if(!g)return{min:void 0,max:void 0};let t,r;return y.forEach(a=>{if(a.field===e){const e=a.value.match(/^>=(\d+(?:\.\d+)?)$/);e&&(t=parseFloat(e[1]));const o=a.value.match(/^<=(\d+(?:\.\d+)?)$/);o&&(r=parseFloat(o[1]))}}),{min:t,max:r}},[g,y,e]),[E,C]=t.useState(s??k.min??a),[R,N]=t.useState(i??k.max??o),[T,A]=t.useState(!1),z=t.useRef(null);t.useEffect(()=>{g&&!T&&(void 0!==k.min?C(k.min):C(a),void 0!==k.max?N(k.max):N(o))},[g,k.min,k.max,T,a,o]);const M=t.useCallback((t,r)=>{g&&(y.forEach(t=>{t.field===e&&x(e,t.value,!1)}),t>a&&b(e,`>=${t}`,!1),r<o&&b(e,`<=${r}`,t<=a),t>a&&r>=o&&b(e,`>=${t}`,!0))},[g,e,y,b,x,a,o]),_=t.useCallback((e,t)=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{M(e,t),l&&l(e,t)},f)},[M,l,f]),L=()=>{A(!1)},P=(E-a)/(o-a)*100,B=(R-a)/(o-a)*100;return t.createElement("div",{className:I(v.root,d),style:{fontFamily:"inherit",...u}},r&&t.createElement("label",{className:v.label,style:{display:"block",marginBottom:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:h.colors.text}},r),t.createElement("div",{className:v.slider,style:{position:"relative",height:"40px",display:"flex",alignItems:"center"}},t.createElement("div",{className:v.track,style:{position:"absolute",width:"100%",height:"4px",backgroundColor:h.colors.border,borderRadius:"2px"}}),t.createElement("div",{className:v.trackFilled,style:{position:"absolute",left:`${P}%`,width:B-P+"%",height:"4px",backgroundColor:h.colors.primary,borderRadius:"2px"}}),t.createElement("input",{type:"range",min:a,max:o,step:n,value:E,onChange:e=>{const t=Math.min(Number(e.target.value),R-n);C(t),A(!0),_(t,R)},onMouseUp:L,onTouchEnd:L,className:v.thumb,style:{position:"absolute",width:"100%",height:"4px",background:"transparent",WebkitAppearance:"none",appearance:"none",cursor:"pointer",pointerEvents:"none"},"aria-label":`Minimum ${r||e}`}),t.createElement("input",{type:"range",min:a,max:o,step:n,value:R,onChange:e=>{const t=Math.max(Number(e.target.value),E+n);N(t),A(!0),_(E,t)},onMouseUp:L,onTouchEnd:L,className:v.thumb,style:{position:"absolute",width:"100%",height:"4px",background:"transparent",WebkitAppearance:"none",appearance:"none",cursor:"pointer",pointerEvents:"none"},"aria-label":`Maximum ${r||e}`})),m&&t.createElement("div",{className:v.values,style:{display:"flex",justifyContent:"space-between",marginTop:h.spacing.small,fontSize:h.typography.fontSize.small,color:h.colors.textSecondary}},t.createElement("span",{className:v.value},c(E)),t.createElement("span",{className:v.value},c(R))),t.createElement("style",null,`\n .${v.thumb||"seekora-range-slider__thumb"}::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: ${h.colors.primary};\n border-radius: 50%;\n cursor: pointer;\n pointer-events: all;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n .${v.thumb||"seekora-range-slider__thumb"}::-moz-range-thumb {\n width: 20px;\n height: 20px;\n background: ${h.colors.primary};\n border-radius: 50%;\n cursor: pointer;\n pointer-events: all;\n border: none;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n `))},e.RecentSearchesList=Ge,e.RecentlyViewed=({storageKey:e="seekora_recently_viewed",items:r,title:a="Recently Viewed",maxItems:o=6,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d="horizontal",currencySymbol:u="$"})=>{const[p,m]=t.useState([]);t.useEffect(()=>{if(!r)try{const t=localStorage.getItem(e);t&&m(JSON.parse(t))}catch(e){}},[e,r]);const g=(r||p).slice(0,o);return 0===g.length?null:t.createElement(N,{title:a,items:g,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d,currencySymbol:u})},e.RelatedProducts=({productId:e,items:r,loading:a=!1,title:o="Related Products",maxItems:n=6,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u="horizontal",currencySymbol:p="$"})=>{const{theme:m}=S(),g=d||{},f=r?.slice(0,n)||[];return a?t.createElement("div",{className:I(g.root,l),style:c},t.createElement("div",{className:g.loading,style:A(m)},"Loading related products...")):0===f.length?null:t.createElement(N,{title:o,items:f,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u,currencySymbol:p})},e.RichQuerySuggestions=Y,e.SearchBar=({placeholder:e="Search...",showSuggestions:r=!0,debounceMs:a=300,minQueryLength:o=2,maxSuggestions:n=10,onSearch:s,onQueryChange:i,onSuggestionSelect:d,onSearchStateChange:u,searchOptions:p,className:m,style:g,theme:f,renderSuggestion:h,renderLoading:y})=>{const{client:b,theme:x,enableAnalytics:v,autoTrackSearch:k}=S(),{query:E,setQuery:R,search:N,results:T,loading:A,error:z}=w(),[M,_]=t.useState(!1),[L,P]=t.useState(-1),B=t.useRef(null),D=t.useRef(null),$=t.useRef(!1),{suggestions:F,loading:W}=C({client:b,query:E,enabled:r&&E.length>=o,debounceMs:a,maxSuggestions:n}),q=F.slice(0,n);t.useEffect(()=>{u&&u({results:T,loading:A,error:z})},[T,A,z,u]),t.useEffect(()=>{T&&s&&s(E,T)},[T,E,s]),t.useEffect(()=>{i&&i(E)},[E,i]);const H=t.useCallback(async e=>{const t=e.trim();c("SearchBar: Triggering search",{query:t,originalQuery:e,isEmpty:!t}),$.current=!0,_(!1),P(-1),R(t,!1),c("SearchBar: Calling search() directly"),await N(),setTimeout(()=>{B.current?.blur(),setTimeout(()=>{$.current=!1},50)},100)},[R,N]),O=t.useCallback(e=>{l("SearchBar: Suggestion selected",{suggestion:e}),P(-1),_(!1),B.current?.blur(),d&&d(e),R(e)},[d,R]),j=t.useCallback(e=>{const t=e.target.value;R(t,!1),P(-1)},[R]),V=t.useCallback(e=>{switch(e.key){case"ArrowDown":r&&q.length>0&&(e.preventDefault(),P(e=>e<q.length-1?e+1:e));break;case"ArrowUp":r&&q.length>0&&(e.preventDefault(),P(e=>e>0?e-1:-1));break;case"Enter":if(e.preventDefault(),e.stopPropagation(),r&&q.length>0&&L>=0&&L<q.length)O(q[L].query);else{const e=B.current?.value||E;H(e)}break;case"Escape":_(!1),B.current?.blur()}},[q,L,E,r,H,O]),Q=t.useCallback(()=>{_(!0)},[]),U=t.useCallback(e=>{$.current||setTimeout(()=>{D.current?.contains(document.activeElement)||(_(!1),P(-1))},200)},[]),G=(e,r)=>t.createElement("div",{key:r},e),K=f||{},X=W||A,Y=q.length>0,J=M&&r&&E.length>=o&&(Y||X),Z=T,ee=Z?.processingTimeMS||Z?.data?.processingTimeMS||Z?.data?.data?.processingTimeMS;return t.createElement("div",{ref:D,className:I(K.container,m),style:{position:"relative",display:"flex",alignItems:"center",...g}},t.createElement("input",{ref:B,type:"text",value:E,onChange:j,onKeyDown:V,onFocus:Q,onBlur:U,placeholder:e,className:I(K.input,M&&K.inputFocused),style:{flex:1,padding:x.spacing.medium,fontSize:x.typography.fontSize.medium,fontFamily:x.typography.fontFamily,backgroundColor:x.colors.background,color:x.colors.text,borderWidth:"1px",borderStyle:"solid",borderColor:M?x.colors.focus:x.colors.border,borderRadius:"string"==typeof x.borderRadius?x.borderRadius:x.borderRadius.medium,outline:"none",...M&&{boxShadow:x.shadows.small}}}),void 0!==ee&&t.createElement("span",{style:{marginLeft:x.spacing.small,fontSize:x.typography.fontSize.small,color:x.colors.text,opacity:.7,whiteSpace:"nowrap"}},ee,"ms"),J&&t.createElement("div",{className:K.suggestionsContainer,style:{position:"absolute",top:"100%",left:0,right:0,marginTop:x.spacing.small,backgroundColor:x.colors.background,border:`1px solid ${x.colors.border}`,borderRadius:"string"==typeof x.borderRadius?x.borderRadius:x.borderRadius.medium,boxShadow:x.shadows.medium,maxHeight:"400px",overflowY:"auto",zIndex:1e3}},X&&(y?y():t.createElement("div",{style:{padding:x.spacing.medium,textAlign:"center"}},"Loading suggestions...")),!X&&q.length>0&&t.createElement(t.Fragment,null,q.map((e,r)=>{const a=r===L,o=h||G;return t.createElement("div",{key:r,className:I(K.suggestionItem,a&&K.suggestionItemActive),onClick:()=>O(e.query),onMouseEnter:()=>P(r),style:{padding:x.spacing.medium,cursor:"pointer",backgroundColor:a?x.colors.hover:"transparent",color:x.colors.text,transition:x.transitions?.fast||"150ms ease-in-out"}},o(e.query,r))})),!X&&0===q.length&&E.length>=o&&t.createElement("div",{style:{padding:x.spacing.medium,textAlign:"center",color:x.colors.textSecondary}},"No suggestions found")))},e.SearchBarWithSuggestions=xe,e.SearchInput=Re,e.SearchLayout=({sidebar:e,children:r,header:a,footer:o,sidebarWidth:n="300px",className:s,style:i,theme:l,showSidebarOnMobile:c=!1})=>{const{theme:d}=S(),u=l||{},[p,m]=t.useState(!1);return t.useEffect(()=>{const e=()=>{m(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t.createElement("div",{className:I(u.container,s),style:{display:"flex",flexDirection:"column",minHeight:"100vh",backgroundColor:d.colors.background,...i}},a&&t.createElement("header",{className:u.header,style:{padding:d.spacing.medium,borderBottom:`1px solid ${d.colors.border}`,backgroundColor:d.colors.background}},a),t.createElement("div",{style:{display:"flex",flex:1,gap:d.spacing.large,padding:d.spacing.medium,backgroundColor:d.colors.background,color:d.colors.text}},e&&(!p||c)&&t.createElement("aside",{className:u.sidebar,style:{width:n,minWidth:n}},e),t.createElement("main",{className:u.main,style:{flex:1,minWidth:0,backgroundColor:d.colors.background,color:d.colors.text}},r)),o&&t.createElement("footer",{className:u.footer,style:{padding:d.spacing.medium,borderTop:`1px solid ${d.colors.border}`,backgroundColor:d.colors.background}},o))},e.SearchProvider=({client:e,theme:r,enableAnalytics:a=!0,autoTrackSearch:o=!0,stateManager:n,children:s})=>{const i=t.useMemo(()=>r?k(r):v,[r]),l=t.useMemo(()=>new f({client:e,autoSearch:!0,debounceMs:300,itemsPerPage:10,defaultSearchOptions:{widget_mode:!0},...n}),[e,n]),c=t.useMemo(()=>({client:e,theme:i,enableAnalytics:a,autoTrackSearch:o,stateManager:l}),[e,i,a,o,l]);return t.createElement(E.Provider,{value:c},s)},e.SearchResults=({results:e,loading:r,error:a,onResultClick:o,renderResult:n,renderEmpty:s,renderLoading:i,renderError:c,className:p,style:m,theme:g,itemsPerPage:f=20,showPagination:h=!1,viewMode:y="list",fieldMapping:b,extractResults:x,enableKeyboardNavigation:v=!0,autoFocus:k=!1})=>{const{theme:E,client:C,enableAnalytics:R}=S(),{results:N,loading:T,error:A,currentPage:z,itemsPerPage:M}=w(),_=g||{},[L,P]=t.useState(-1),B=t.useRef(null),D=void 0!==e?e:N,$=void 0!==r?r:T,F=void 0!==a?a:A;t.useEffect(()=>{P(-1)},[D]),t.useEffect(()=>{if(L>=0&&B.current&&v){const e=B.current.querySelector(`[data-result-index="${L}"]`);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[L,v]);const W=t.useCallback(e=>{if(!v)return;const t=B.current?.querySelectorAll("[data-result-index]"),r=t?t.length-1:-1;switch(e.key){case"ArrowDown":e.preventDefault(),P(e=>Math.min(e+1,r));break;case"ArrowUp":e.preventDefault(),P(e=>Math.max(e-1,-1));break;case"Enter":if(e.preventDefault(),L>=0){const e=B.current?.querySelector(`[data-result-index="${L}"]`);e&&e.click()}break;case"Escape":P(-1),B.current?.blur();break;case"Home":e.preventDefault(),P(0);break;case"End":e.preventDefault(),P(r)}},[v,L]),q="card"===y||"grid"===y?(r,a,n=!1)=>{const s=r.primaryText||r.title,i=r.secondaryText||r.description,l=r.tertiaryText||r.price,c=r.imageUrl||r.image;return t.createElement("div",{key:r.id||a,"data-result-index":a,className:I(_.resultItem,n&&_.resultItemHover),onClick:async()=>{if(R&&r.id)try{const t=e||N,o={currentPage:z,itemsPerPage:M},n=(o.currentPage-1)*o.itemsPerPage+a+1,s=t?.context;C.trackClick?await C.trackClick(r.id,n,s):await(C.trackEvent?.({event_name:"product_click",clicked_item_id:r.id,metadata:{result:r,position:n}},s))}catch(e){const t=e instanceof Error?e:new Error(String(e));u("SearchResults: Error tracking click",{resultId:r.id,error:t.message})}o&&o(r,a)},onMouseEnter:()=>v&&P(a),style:{border:`1px solid ${n?E.colors.primary:E.colors.border}`,borderRadius:"string"==typeof E.borderRadius?E.borderRadius:E.borderRadius.medium,overflow:"hidden",cursor:o?"pointer":"default",transition:E.transitions?.normal||"250ms ease-in-out",backgroundColor:n?E.colors.hover:E.colors.background,display:"flex",flexDirection:"column",padding:E.spacing.medium,boxShadow:n?E.shadows.medium:E.shadows.small,outline:n?`2px solid ${E.colors.primary}`:"none",outlineOffset:"-2px"}},c&&t.createElement("div",{style:{width:"100%",aspectRatio:"16/9",overflow:"hidden",backgroundColor:E.colors.hover}},t.createElement("img",{src:c,alt:s,style:{width:"100%",height:"100%",objectFit:"cover"}})),t.createElement("div",{style:{padding:E.spacing.medium}},s&&t.createElement("h3",{className:_.resultTitle,style:{fontSize:E.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:E.spacing.small,color:E.colors.text}},s),i&&t.createElement("p",{className:_.resultDescription,style:{fontSize:E.typography.fontSize.medium,color:E.colors.text,margin:0,marginBottom:E.spacing.small,opacity:.8,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"}},i),l&&t.createElement("div",{className:_.resultPrice,style:{fontSize:E.typography.fontSize.medium,fontWeight:"bold",color:E.colors.primary,marginTop:"auto"}},l)))}:(r,a,n=!1)=>t.createElement("div",{key:r.id||a,"data-result-index":a,className:I(_.resultItem,n&&_.resultItemHover),onClick:async()=>{if(R&&r.id)try{const t=e||N,o={currentPage:z,itemsPerPage:M},n=(o.currentPage-1)*o.itemsPerPage+a+1,s=t?.context;C.trackClick?await C.trackClick(r.id,n,s):await(C.trackEvent?.({event_name:"product_click",clicked_item_id:r.id,metadata:{result:r,position:n}},s))}catch(e){const t=e instanceof Error?e:new Error(String(e));u("SearchResults: Error tracking click",{resultId:r.id,error:t.message})}o&&o(r,a)},onMouseEnter:()=>v&&P(a),style:{padding:E.spacing.medium,border:`1px solid ${E.colors.border}`,borderBottom:`1px solid ${E.colors.border}`,borderRadius:0,marginBottom:0,cursor:o?"pointer":"default",transition:E.transitions?.normal||"250ms ease-in-out",backgroundColor:n?E.colors.hover:E.colors.background,display:"flex",alignItems:"flex-start",gap:E.spacing.medium,outline:n?`2px solid ${E.colors.primary}`:"none",outlineOffset:"-2px"}},r.image&&t.createElement("img",{src:r.image,alt:r.title,className:_.resultImage,style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"string"==typeof E.borderRadius?E.borderRadius:E.borderRadius.medium,flexShrink:0}}),t.createElement("div",{style:{flex:1,minWidth:0}},t.createElement("h3",{className:_.resultTitle,style:{fontSize:E.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:E.spacing.small,color:E.colors.text}},r.title),r.description&&t.createElement("p",{className:_.resultDescription,style:{fontSize:E.typography.fontSize.medium,color:E.colors.text,margin:0,marginBottom:E.spacing.small,opacity:.8}},r.description),r.price&&t.createElement("div",{className:_.resultPrice,style:{fontSize:E.typography.fontSize.medium,fontWeight:"bold",color:E.colors.primary}},r.price)));let H=[];if(x)H=x(D)||[];else if(D){const e=D;Array.isArray(e.results)&&e.results.length>0?H=e.results:e.data&&Array.isArray(e.data.results)&&e.data.results.length>0?H=e.data.results:e.data?.data&&Array.isArray(e.data.data.results)&&e.data.data.results.length>0?H=e.data.data.results:Array.isArray(D)?H=D:Array.isArray(e.results)&&(H=e.results)}const O={title:"document.productName",description:"document.brandDesc",image:"document.image",price:"document.mrp",url:"document.url",id:"id",...b},j=(e,t)=>{if(t)return((e,t)=>{if(t)return t.split(".").reduce((e,t)=>e?.[t],e)})(e,t)},V=H.map((e,t)=>{try{const r=j(e,O.primaryText),a=j(e,O.secondaryText),o=j(e,O.tertiaryText),n=j(e,O.imageUrl),s=j(e,O.title)||r||"Untitled",i=j(e,O.description)||a,l=j(e,O.image)||n,c=j(e,O.price)||o,d=j(e,O.url),u=j(e,O.id)||String(t),p=void 0!==c?((e,t="₹")=>{if(null!=e){if("number"==typeof e)return`${t}${e}`;if("string"==typeof e){const r=parseFloat(e);return isNaN(r)?e:`${t}${r}`}return String(e)}})(c):void 0,m={};O.custom&&Object.entries(O.custom).forEach(([t,r])=>{m[t]=j(e,r)});return{id:u,title:s,description:i,url:d,image:l,price:p,metadata:e,...m,...r&&{primaryText:r},...a&&{secondaryText:a},...o&&{tertiaryText:o},...n&&{imageUrl:n},_raw:e}}catch(r){const a=r instanceof Error?r:new Error(String(r));return d("SearchResults: Error extracting result item",{index:t,error:a.message,item:e?.id||"unknown"}),{id:String(t),title:"Error loading result",metadata:e}}}),Q={...m},U={..."grid"===y&&{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:E.spacing.medium},..."card"===y&&{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:E.spacing.medium}};if(l("SearchResults: Extracted results",{rawResultsCount:H.length,resultItemsCount:V.length,viewMode:y,hasError:!!F,isLoading:$}),$)return l("SearchResults: Rendering loading state"),t.createElement("div",{className:I(_.container,p),style:m},i?i():t.createElement("div",{className:_.loadingState,style:{padding:E.spacing.large,textAlign:"center",color:E.colors.text}},"Loading results..."));if(F)return u("SearchResults: Rendering error state",{error:F.message,stack:F.stack}),t.createElement("div",{className:I(_.container,p),style:m},c?c(F):(G=F,t.createElement("div",{className:_.errorState,style:{padding:E.spacing.large,textAlign:"center",color:E.colors.error}},"Error: ",G.message)));var G;if(!D||0===V.length)return l("SearchResults: No results to display"),t.createElement("div",{className:I(_.container,p),style:m},s?s():t.createElement("div",{className:_.emptyState,style:{padding:E.spacing.large,textAlign:"center",color:E.colors.text}},"No results found"));const K=n||q;return t.createElement("div",{ref:B,className:I(_.container,p),style:Q,tabIndex:v?0:void 0,onKeyDown:W,role:"listbox","aria-label":"Search results","aria-activedescendant":L>=0?`result-${L}`:void 0},(void 0!==D?.totalResults||void 0!==D?.data?.total_results)&&V.length>0&&t.createElement("div",{className:_.header,style:{marginBottom:E.spacing.medium,fontSize:E.typography.fontSize.medium,color:E.colors.text}},"Found ",D?.totalResults||D?.data?.total_results||0," result",1!==(D?.totalResults||D?.data?.total_results||0)?"s":""),v&&V.length>0&&t.createElement("div",{style:{fontSize:"12px",color:E.colors.text,opacity:.6,marginBottom:E.spacing.small,display:"flex",gap:"8px",alignItems:"center"}},t.createElement("span",{style:{display:"inline-flex",gap:"4px",padding:"2px 6px",backgroundColor:E.colors.hover,borderRadius:"4px",fontSize:"11px"}},"↑↓ navigate"),t.createElement("span",{style:{display:"inline-flex",gap:"4px",padding:"2px 6px",backgroundColor:E.colors.hover,borderRadius:"4px",fontSize:"11px"}},"↵ select")),t.createElement("div",{className:_.resultsList,style:U},V.map((e,t)=>K(e,t,t===L))))},e.SectionError=tt,e.SectionItemGrid=function({columns:e=4,maxItems:r=12,className:a,style:o,getItemId:n=e=>e.id??String(e?.objectID??""),getItemTitle:s=e=>e.title??e?.title??"",getItemImage:i=e=>e.image??e?.image,getItemDescription:l=e=>e.description??e?.description,getItemUrl:c=e=>e.url??e?.url,renderItem:d}){const{items:u,loading:p,error:m,trackClick:g}=Ze();return p?t.createElement(et,{className:a,style:o}):m?t.createElement(tt,{className:a,style:o}):t.createElement(qe,{items:u,maxItems:r,columns:e,className:a,style:o,getItemId:n,getItemTitle:s,getItemImage:i,getItemDescription:l,getItemUrl:c,renderItem:d,onItemClick:(e,t)=>g(e,t)})},e.SectionLoading=et,e.SectionSearchProvider=function({children:e,query:r,refinements:a=[],maxItems:o=12,sortBy:n,enabled:s=!0,sectionId:i}){const{client:l}=S(),[c,d]=t.useState([]),[u,p]=t.useState(!0),[m,g]=t.useState(null),[f,h]=t.useState(0);t.useEffect(()=>{if(!s||!l?.search)return d([]),p(!1),g(null),void h(0);let e=!1;p(!0),g(null);const t={per_page:o,page:1};return n&&(t.sort_by=n),a.length>0&&(t.filter_by=a.map(e=>`${e.field}:${e.value}`).join(",")),l.search(r,t).then(t=>{e||(d(function(e){if(!e)return[];if(Array.isArray(e.results))return e.results;if(Array.isArray(e.hits))return e.hits;const t=e.data;return t&&Array.isArray(t.results)?t.results:t&&Array.isArray(t.data)?t.data:[]}(t)),h(function(e){if(!e)return 0;const t=e.totalResults??e.total??e.total_results;if("number"==typeof t)return t;const r=e.data;return null!=r?.total_results?Number(r.total_results):null!=r?.data?.total_results?Number(r.data.total_results):0}(t)),p(!1))}).catch(t=>{e||(g(t instanceof Error?t:new Error(String(t))),d([]),p(!1))}),()=>{e=!0}},[l,s,r,o,n,a]);const y=t.useCallback((e,t)=>{if(!l?.trackEvent)return;const r=e?.id??e?.objectID;l.trackEvent({event_name:"section_result_click",clicked_item_id:r,position:t,section:i,metadata:{section_id:i}},void 0)},[l,i]),b=t.useMemo(()=>({items:c,loading:u,error:m,totalCount:f,sectionId:i,trackClick:y}),[c,u,m,f,i,y]);return t.createElement(Je.Provider,{value:b},e)},e.ShopifyDropdown=Xt,e.Snippet=({hit:e,attribute:r,maxLength:a=100,ellipsis:o="...",className:n,style:s,theme:i,tagName:l="span",renderHighlighted:c,renderNonHighlighted:d,query:u})=>{const{theme:f}=S(),h=i||{},y=t.useMemo(()=>{const t=e._snippetResult?.[r]?.value||e.snippet_result?.[r]?.value||e._snippet?.[r]||e.snippet?.[r];if(t)return t.replace(/<em>/g,"<mark>").replace(/<\/em>/g,"</mark>");let n=p({hit:e,attribute:r,preTag:"<mark>",postTag:"</mark>"});if(n.replace(/<\/?mark>/g,"").length>a){const e=function(e,t){let r=0,a="",o=!1;for(let n=0;n<e.length;n++){const s=e[n];if("<"===s)o=!0,a+=s;else if(">"===s)o=!1,a+=s;else if(o)a+=s;else{if(r>=t)break;a+=s,r++}}const n=a.match(/<mark>/g)?.length||0,s=a.match(/<\/mark>/g)?.length||0;for(let e=0;e<n-s;e++)a+="</mark>";return a}(n,a);return e+o}return n},[e,r,a,o]),b=t.useMemo(()=>{const t=m(y,"<mark>","</mark>");if(t.every(e=>!e.isHighlighted)&&u){const t=e[r]||y;let n=String(t);return n.length>a&&(n=n.substring(0,a)+o),g(n,u)}return t},[y,u,e,r,a,o]),x={backgroundColor:f.colors.warning||"#fff59d",fontWeight:f.typography.fontWeight?.semibold||600,padding:"0 2px",borderRadius:"2px"},v=b.map((e,r)=>e.isHighlighted?c?t.createElement(t.Fragment,{key:r},c(e,r)):t.createElement("mark",{key:r,className:h.highlighted,style:x},e.value):d?t.createElement(t.Fragment,{key:r},d(e,r)):t.createElement("span",{key:r,className:h.nonHighlighted},e.value));return t.createElement(l,{className:n||h.root,style:s},v)},e.SortBy=({options:e,value:r,defaultValue:a,onSortChange:o,renderSelect:n,className:s,style:i,theme:l,placeholder:c="Sort by...",syncWithState:d=!0})=>{const{theme:u}=S(),{sortBy:p,setSortBy:m}=w(),g=l||{},[f,h]=t.useState(a||e[0]?.value||"");t.useEffect(()=>{d&&a&&!p&&m(a,!1)},[]);const y=void 0!==r?r:d&&p?p:f,b=e=>{const t=e.target.value;h(t),d&&m(t),o&&o(t)};return n?t.createElement("div",{className:I(g.container,s),style:i},n({value:y,onChange:b,options:e})):t.createElement("select",{value:y,onChange:b,className:I(g.select,s),style:{padding:u.spacing.small,paddingRight:u.spacing.medium,fontSize:u.typography.fontSize.medium,border:`1px solid ${u.colors.border}`,borderRadius:"string"==typeof u.borderRadius?u.borderRadius:u.borderRadius.medium,backgroundColor:u.colors.background,color:u.colors.text,cursor:"pointer",outline:"none",...i},"aria-label":"Sort results"},e.map(e=>t.createElement("option",{key:e.value,value:e.value,className:g.option},e.label)))},e.SpotlightDropdown=Ut,e.Stats=({results:e,renderStats:r,className:a,style:o,theme:n,showProcessingTime:s=!1,showQuery:i=!1,separator:l=" • "})=>{const{theme:c}=S(),d=n||{},u=e,p=u?.totalResults||u?.data?.total_results||u?.data?.data?.total_results||0,m=u?.processingTimeMS||u?.data?.processingTimeMS||u?.data?.data?.processingTimeMS,g=u?.query??"";return r?t.createElement("div",{className:I(d.container,a),style:o},r({totalResults:p,processingTime:m,query:g})):(()=>{const e=[];return p>0?e.push(`${p.toLocaleString()} result${1!==p?"s":""}`):e.push("No results"),s&&void 0!==m&&e.push(`${m}ms`),i&&g&&e.push(`for "${g}"`),t.createElement("div",{className:I(d.container,a),style:{fontSize:c.typography.fontSize.medium,color:c.colors.text,...o}},e.map((e,r)=>t.createElement("span",{key:r},r>0&&t.createElement("span",{className:d.separator,style:{margin:`0 ${c.spacing.small}`}},l),t.createElement("span",{className:d.text},e))))})()},e.SuggestionDropdownVariants=ir,e.SuggestionItem=Ae,e.SuggestionList=_e,e.SuggestionSearchBar=sr,e.SuggestionsDropdownComposition=function({showRecentSearches:e=!0,showTrending:r=!0,showTabs:a=!0,showProducts:o=!0,placeholder:n,...s}){return t.createElement(Ee,{...s},t.createElement("div",{className:"seekora-suggestions-dropdown-composition",style:{position:"relative",width:"100%"}},t.createElement(Re,{placeholder:n}),t.createElement(Ne,null,t.createElement(Ye,null),t.createElement(ze,null),e?t.createElement(Ge,null):null,t.createElement(_e,null),a?t.createElement(Qe,null):null,o?t.createElement(Ve,null):null,r?t.createElement(Xe,null):null)))},e.SuggestionsError=Ye,e.SuggestionsLoading=ze,e.SuggestionsProvider=Ee,e.TrendingItems=({items:e,loading:r=!1,title:a="Trending Now",maxItems:o=8,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d="horizontal",currencySymbol:u="$"})=>{const{theme:p}=S(),m=c||{},g=e?.slice(0,o)||[];return r?t.createElement("div",{className:I(m.root,i),style:l},t.createElement("div",{className:m.loading,style:A(p)},"Loading trending items...")):0===g.length?null:t.createElement(N,{title:a,items:g,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d,currencySymbol:u})},e.TrendingList=Xe,e.addRecentSearch=gt,e.addToRecentlyViewed=function(e,t="seekora_recently_viewed",r=20){if("undefined"!=typeof localStorage)try{const a=localStorage.getItem(t);let o=a?JSON.parse(a):[];o=o.filter(t=>t.id!==e.id),o.unshift(e),o=o.slice(0,r),localStorage.setItem(t,JSON.stringify(o))}catch(e){}},e.brandPresets=Lr,e.breakpoints=vt,e.clearRecentSearches=e=>{try{const t=e?`${pt}_${e}`:pt;localStorage.removeItem(t)}catch{}},e.clearSuggestionsCache=()=>{bt?.clear()},e.createSuggestionsCache=e=>new yt(e),e.createSuggestionsTheme=function(e="light",t={},r){return{...{light:zr,dark:Mr,minimal:_r}[e],...r?Lr[r]:{},...t}},e.createTheme=k,e.darkTheme={colors:{primary:"#0d6efd",secondary:"#6c757d",background:"#1a1a1a",text:"#ffffff",border:"#333333",hover:"#2a2a2a",focus:"#0d6efd",error:"#dc3545"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.25rem"}},spacing:{small:"0.5rem",medium:"1rem",large:"1.5rem"},borderRadius:"0.25rem",shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.7)",medium:"0 3px 6px rgba(0, 0, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.8)",large:"0 10px 20px rgba(0, 0, 0, 0.7), 0 6px 6px rgba(0, 0, 0, 0.9)"}},e.darkThemeVariables=Mr,e.defaultTheme=v,e.extractBrand=(e,t={name:"name"})=>({id:t.id?rt(e,t.id):e?.id,name:rt(e,t.name)??"",logo:t.logo?rt(e,t.logo):void 0,count:t.count?rt(e,t.count):void 0,_raw:e}),e.extractCategory=nt,e.extractProduct=ot,e.extractSuggestion=at,e.formatParsedFilters=function(e){return e.map(e=>`${e.field}: ${e.value}`).join(", ")},e.formatSuggestionPrice=st,e.generateSuggestionsStylesheet=Pr,e.getFingerprint=async function(e){return new x(e).get()},e.getRecentSearches=mt,e.getShortcutText=Sr,e.getSuggestionsCache=xt,e.highlightText=lt,e.injectGlobalResponsiveStyles=Ct,e.injectSuggestionsStyles=Dr,e.lightThemeVariables=zr,e.mediaQueries=kt,e.mergeThemes=(e,...t)=>t.reduce((e,t)=>({colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography,fontSize:{...e.typography?.fontSize,...t.typography?.fontSize}},spacing:{...e.spacing,...t.spacing},borderRadius:t.borderRadius??e.borderRadius,shadows:{...e.shadows,...t.shadows},transitions:{...e.transitions,...t.transitions},breakpoints:{...e.breakpoints,...t.breakpoints},zIndex:{...e.zIndex,...t.zIndex}}),e),e.minimalTheme={colors:{primary:"#000000",secondary:"#666666",background:"#ffffff",text:"#000000",border:"#e0e0e0",hover:"#f5f5f5",focus:"#000000",error:"#cc0000"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.125rem"}},spacing:{small:"0.5rem",medium:"0.75rem",large:"1rem"},borderRadius:"0",shadows:{small:"none",medium:"none",large:"none"}},e.minimalThemeVariables=_r,e.removeRecentSearch=ft,e.touchTargets=Et,e.updateSuggestionsStyles=function(e){Dr(e,!0)},e.useAnalytics=({client:e,enabled:r=!0})=>{const a=t.useCallback(async(t,a,o)=>{if(r)try{const r={event_name:t,...a};await(e.trackEvent?.(r,o))}catch(e){u("Failed to track event:",e)}},[e,r]),o=t.useCallback(async(t,o,n,s)=>{if(!r)return;const i=s??0;e.trackClick?await e.trackClick(t,i,n):await a("product_click",{clicked_item_id:t,metadata:{result:o,...void 0!==s&&{position:i}}},n)},[e,a,r]),n=t.useCallback(async(e,t,o,n,s)=>{r&&await a("conversion",{clicked_item_id:e,value:o,currency:n,metadata:{result:t}},s)},[a,r]),s=t.useCallback(async(t,a)=>{if(r&&0!==t.length)try{await(e.trackEvents?.(t,a))}catch(e){u("Failed to track batch events:",e)}},[e,r]);return{trackEvent:a,trackClick:o,trackConversion:n,trackBatch:s}},e.useDocSearch=Ir,e.useDocSearchSeekoraSearch=Nr,e.useInjectResponsiveStyles=Rt,e.useKeyboard=Er,e.useNaturalLanguageFilters=function(e={}){const{fieldMappings:r={},valueMappings:a={},autoApply:o=!1,currencySymbol:n="$"}=e,{addRefinement:s,removeRefinement:i,clearRefinements:l,setQuery:c}=w(),d=t.useMemo(()=>({...Ar,colors:[...Ar.colors,...a.color?Object.keys(a.color):[]],sizes:{...Ar.sizes,...a.size||{}}}),[a]),u=t.useCallback(e=>{const t=[];let o=e;for(const a of d.price){const n=e.match(a.pattern);if(n){"range"===a.operator&&n[2]?(t.push({field:r.price||"price",value:`>=${n[1]}`,operator:">=",confidence:.95,matchedText:n[0]}),t.push({field:r.price||"price",value:`<=${n[2]}`,operator:"<=",confidence:.95,matchedText:n[0]})):n[1]&&t.push({field:r.price||"price",value:`${a.operator}${n[1]}`,operator:a.operator,confidence:.95,matchedText:n[0]}),o=o.replace(n[0]," ");break}}const n=new RegExp(`\\b(${d.colors.join("|")})\\b`,"gi"),s=e.match(n);s&&s.forEach(e=>{const n=a.color?.[e.toLowerCase()]||e.toLowerCase();t.push({field:r.color||"color",value:n,operator:"=",confidence:.9,matchedText:e}),o=o.replace(new RegExp(`\\b${e}\\b`,"gi")," ")});const i=Object.entries(d.sizes);for(const[a,n]of i){const s=new RegExp(`\\b${a}\\b`,"gi");if(s.test(e)){t.push({field:r.size||"size",value:n,operator:"=",confidence:.85,matchedText:a}),o=o.replace(s," ");break}}for(const a of d.ratings)if("value"in a)a.pattern.test(e)&&(t.push({field:r.rating||a.field,value:`${a.operator}${a.value}`,operator:a.operator,confidence:.8,matchedText:e.match(a.pattern)?.[0]||""}),o=o.replace(a.pattern," "));else{const n=e.match(a.pattern);n&&n[1]&&(t.push({field:r.rating||a.field,value:`${a.operator}${n[1]}`,operator:a.operator,confidence:.85,matchedText:n[0]}),o=o.replace(n[0]," "))}for(const a of d.availability)a.pattern.test(e)&&(t.push({field:r[a.field]||a.field,value:a.value,operator:"=",confidence:.9,matchedText:e.match(a.pattern)?.[0]||""}),o=o.replace(a.pattern," "));return o=o.replace(/\s+/g," ").trim(),{cleanedQuery:o,filters:t,originalQuery:e,hasFilters:t.length>0}},[d,r,a]),p=t.useCallback(e=>{e.forEach(e=>{s(e.field,e.value,!1)}),e.length},[s]),m=t.useCallback(e=>{const t=u(e);return t.hasFilters&&(p(t.filters),t.cleanedQuery!==e&&c(t.cleanedQuery,!0)),t},[u,p,c]);return{parse:u,applyFilters:p,parseAndApply:m}},e.useQuerySuggestions=C,e.useQuerySuggestionsEnhanced=$,e.useResponsive=St,e.useSearchContext=S,e.useSearchState=w,e.useSectionSearchContext=Ze,e.useSeekoraSearch=({client:e,autoTrack:r=!0})=>{const[a,o]=t.useState(null),[n,s]=t.useState(!1),[i,d]=t.useState(null),[p,m]=t.useState(null),g=t.useCallback(async t=>{s(!0),d(null);const r=t.q||"";l("useSeekoraSearch: Starting search",{query:r,options:t});try{const{q:r,...a}=t,n="string"==typeof r?r:"",s=await e.search(n,a);return c("useSeekoraSearch: Search completed",{query:n,resultsCount:Array.isArray(s?.results)?s.results.length:0,hasContext:!!s?.context}),o(s),null!=s.context&&m(s.context),s}catch(e){const t=e instanceof Error?e:new Error(String(e));return u("useSeekoraSearch: Search failed",{query:r,error:t.message,stack:t.stack}),d(t),o(null),m(null),null}finally{s(!1)}},[e]);return{search:g,results:a,loading:n,error:i,context:p,clearResults:t.useCallback(()=>{o(null),d(null),m(null)},[])}},e.useSmartSuggestions=function(e,r={}){const{minQueryLength:a=1,maxSuggestions:o=10,debounceMs:n=200,enableSpellCorrection:s=!0,enableQueryExpansion:i=!0,enableIntentDetection:l=!0,includeTrending:c=!0,userContext:d}=r,{stateManager:u}=S(),[p,m]=t.useState([]),[g,f]=t.useState(!1),[h,y]=t.useState(null),[b,x]=t.useState(null),[v,k]=t.useState([]),[E,w]=t.useState([]),C=t.useRef(null),R=t.useMemo(()=>["phone","laptop","computer","tablet","headphones","camera","television","speaker","watch","keyboard","mouse","monitor","shirt","pants","shoes","jacket","dress","skirt","sweater","electronics","clothing","accessories","furniture","appliances"],[]),I=t.useCallback(async e=>{const t=[];if(l){const t=function(e){const t=[{pattern:/^(buy|purchase|order|get)\s+/i,intent:"purchase"},{pattern:/^(find|search|looking for|where)\s+/i,intent:"search"},{pattern:/^(compare|vs|versus)\s+/i,intent:"compare"},{pattern:/^(how (to|do)|what is|why)\s+/i,intent:"informational"},{pattern:/under\s*\$?\d+|less than\s*\$?\d+|cheap|affordable/i,intent:"price_sensitive"},{pattern:/best|top|recommended|popular/i,intent:"recommendation"},{pattern:/\d+\s*(gb|tb|inch|cm|mm|kg|lb)/i,intent:"specification"},{pattern:/(red|blue|green|black|white|pink|purple|yellow)\s+/i,intent:"color_preference"},{pattern:/(size|small|medium|large|xl|xxl)\s+/i,intent:"size_preference"}];for(const{pattern:r,intent:a}of t)if(r.test(e))return{intent:a,confidence:.8};return null}(e);x(t?t.intent:null)}if(s&&e.length>=3){const r=Tr(e,R);k(r),r.forEach(r=>{t.push({text:r,type:"correction",confidence:.9,metadata:{correctedFrom:e}})})}if(i){const r=function(e){const t=e.toLowerCase(),r=[];return Object.entries({phone:["smartphone","mobile","cellphone"],laptop:["notebook","computer","pc"],tv:["television","smart tv","monitor"],headphones:["earbuds","earphones","headset"],shoes:["footwear","sneakers","boots"],shirt:["top","blouse","tee"],pants:["trousers","jeans","bottoms"],cheap:["affordable","budget","inexpensive"],best:["top-rated","popular","recommended"]}).forEach(([a,o])=>{t.includes(a)&&o.forEach(t=>{const o=e.replace(new RegExp(a,"gi"),t);r.includes(o)||r.push(o)})}),r.slice(0,3)}(e);w(r),r.forEach(e=>{t.push({text:e,type:"expansion",confidence:.7,metadata:{expandedTo:[e]}})})}return t.unshift({text:e,type:"query",confidence:1}),d?.recentSearches&&d.recentSearches.filter(t=>t.toLowerCase().includes(e.toLowerCase())&&t!==e).slice(0,2).forEach(e=>{t.push({text:e,type:"related",confidence:.6})}),t.slice(0,o)},[R,l,s,i,o,d]),N=t.useCallback(async e=>e.length<a?[]:I(e),[a,I]);return t.useEffect(()=>(C.current&&clearTimeout(C.current),e.length<a?(m([]),k([]),w([]),void x(null)):(f(!0),C.current=setTimeout(async()=>{try{const t=await I(e);m(t),y(null)}catch(e){y(e instanceof Error?e:new Error(String(e))),m([])}finally{f(!1)}},n),()=>{C.current&&clearTimeout(C.current)})),[e,a,n,I]),{suggestions:p,loading:g,error:h,detectedIntent:b,corrections:v,expansions:E,getSuggestions:N,clear:t.useCallback(()=>{m([]),k([]),w([]),x(null),y(null)},[])}},e.useSuggestionsAnalytics=fe,e.useSuggestionsContext=ke});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@seekora-ai/search-sdk")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@seekora-ai/search-sdk"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SeekoraUI={},e.React,e.ReactDOM,e.SeekoraSDK)}(this,function(e,t,r,a){"use strict";var o;!function(e){e[e.VERBOSE=0]="VERBOSE",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT"}(o||(o={}));class n{constructor(e={}){this.level=e.level??this.getDefaultLevel(),this.prefix=e.prefix??"[Seekora UI SDK]",this.enableTimestamp=e.enableTimestamp??!1}getDefaultLevel(){switch(void 0){case"VERBOSE":return o.VERBOSE;case"INFO":return o.INFO;case"WARN":return o.WARN;case"ERROR":return o.ERROR;case"SILENT":return o.SILENT}return"undefined"!=typeof window&&window.__SEEKORA_DEBUG__?o.VERBOSE:o.INFO}formatMessage(e,...t){const r=[];return this.enableTimestamp&&r.push(`[${(new Date).toISOString()}]`),r.push(this.prefix,`[${e}]`),[...r,...t]}verbose(...e){this.level<=o.VERBOSE&&console.log(...this.formatMessage("VERBOSE",...e))}info(...e){this.level<=o.INFO&&console.info(...this.formatMessage("INFO",...e))}warn(...e){this.level<=o.WARN&&console.warn(...this.formatMessage("WARN",...e))}error(...e){this.level<=o.ERROR&&console.error(...this.formatMessage("ERROR",...e))}setLevel(e){this.level=e}getLevel(){return this.level}setPrefix(e){this.prefix=e}setTimestamp(e){this.enableTimestamp=e}}let s=null;function i(){return s||(s=function(e={}){return new n(e)}()),s}const l=(...e)=>i().verbose(...e),c=(...e)=>i().info(...e),d=(...e)=>i().warn(...e),u=(...e)=>i().error(...e);function p(e){const{attribute:t,hit:r,preTag:a="<mark>",postTag:o="</mark>",fallback:n}=e,s=r._highlightResult?.[t]?.value||r.highlight_result?.[t]?.value||r._highlight?.[t]||r.highlight?.[t];if(s)return s.replace(/<em>/g,a).replace(/<\/em>/g,o).replace(/<mark>/g,a).replace(/<\/mark>/g,o);const i=(l=r,t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,l));var l;return void 0!==i?String(i):n||""}function m(e,t="<mark>",r="</mark>"){const a=[];let o=e;for(;o.length>0;){const e=o.indexOf(t);if(-1===e){o.length>0&&a.push({value:o,isHighlighted:!1});break}e>0&&a.push({value:o.substring(0,e),isHighlighted:!1});const n=o.substring(e+t.length),s=n.indexOf(r);if(-1===s){a.push({value:o.substring(e),isHighlighted:!1});break}a.push({value:n.substring(0,s),isHighlighted:!0}),o=n.substring(s+r.length)}return a}function g(e,t,r=!1){if(!t||!e)return[{value:e,isHighlighted:!1}];const a=[],o=r?"g":"gi",n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(n,o);let i,l=0;for(;null!==(i=s.exec(e));)i.index>l&&a.push({value:e.substring(l,i.index),isHighlighted:!1}),a.push({value:i[0],isHighlighted:!0}),l=s.lastIndex;return l<e.length&&a.push({value:e.substring(l),isHighlighted:!1}),a.length>0?a:[{value:e,isHighlighted:!1}]}i();class f{constructor(e){this.listeners=[],this.debounceTimer=null,this.client=e.client,this.autoSearch=!1!==e.autoSearch,this.debounceMs=e.debounceMs||300,this.defaultSearchOptions=e.defaultSearchOptions||{widget_mode:!0},this.state={query:e.initialQuery||"",refinements:[],currentPage:1,itemsPerPage:e.itemsPerPage||10,sortBy:void 0,results:null,loading:!1,error:null},c("SearchStateManager: Initialized",{autoSearch:this.autoSearch,debounceMs:this.debounceMs})}getState(){return{...this.state}}getQuery(){return this.state.query}getRefinements(){return[...this.state.refinements]}getCurrentPage(){return this.state.currentPage}getResults(){return this.state.results}getLoading(){return this.state.loading}getError(){return this.state.error}setQuery(e,t=!0){if(this.state.query===e)return l("SearchStateManager: Query unchanged, skipping update",{query:e}),void(t&&this.autoSearch&&(l("SearchStateManager: Query unchanged but triggerSearch=true, triggering search"),this.debouncedSearch()));this.state.query=e,this.state.currentPage=1,l("SearchStateManager: Query updated",{query:e,triggerSearch:t,autoSearch:this.autoSearch}),this.notifyListeners(),this.autoSearch&&t?(l("SearchStateManager: Triggering debounced search"),this.debouncedSearch()):l("SearchStateManager: Search not triggered",{autoSearch:this.autoSearch,triggerSearch:t})}addRefinement(e,t,r=!0){const a=this.state.refinements.some(r=>r.field===e&&r.value===t);a||(this.state.refinements.push({field:e,value:t}),this.state.currentPage=1,l("SearchStateManager: Refinement added",{field:e,value:t}),this.notifyListeners(),this.autoSearch&&r&&this.debouncedSearch())}removeRefinement(e,t,r=!0){const a=this.state.refinements.findIndex(r=>r.field===e&&r.value===t);-1!==a&&(this.state.refinements.splice(a,1),this.state.currentPage=1,l("SearchStateManager: Refinement removed",{field:e,value:t}),this.notifyListeners(),this.autoSearch&&r&&this.debouncedSearch())}clearRefinements(e=!0){0!==this.state.refinements.length&&(this.state.refinements=[],this.state.currentPage=1,l("SearchStateManager: Refinements cleared"),this.notifyListeners(),this.autoSearch&&e&&this.debouncedSearch())}setPage(e,t=!0){this.state.currentPage!==e&&(this.state.currentPage=e,l("SearchStateManager: Page updated",{page:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}setSortBy(e,t=!0){this.state.sortBy!==e&&(this.state.sortBy=e,this.state.currentPage=1,l("SearchStateManager: Sort updated",{sortBy:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}setItemsPerPage(e,t=!0){this.state.itemsPerPage!==e&&(this.state.itemsPerPage=e,this.state.currentPage=1,l("SearchStateManager: Items per page updated",{itemsPerPage:e}),this.notifyListeners(),this.autoSearch&&t&&this.debouncedSearch())}async search(e){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.setState({loading:!0,error:null});try{const t=this.buildSearchOptions(e);l("SearchStateManager: Performing search",{query:this.state.query,refinementsCount:this.state.refinements.length,currentPage:this.state.currentPage,sortBy:this.state.sortBy,filter_by:t.filter_by});const r=await this.client.search(this.state.query,t);return this.setState({results:r,loading:!1,error:null}),c("SearchStateManager: Search completed",{query:this.state.query,resultsCount:r?.results?.length||0,totalResults:r?.totalResults||0}),r}catch(e){const t=e instanceof Error?e:new Error(String(e));return this.setState({results:null,loading:!1,error:t}),u("SearchStateManager: Search failed",{query:this.state.query,error:t.message}),null}}buildSearchOptions(e){const t={...this.defaultSearchOptions,page:this.state.currentPage,per_page:this.state.itemsPerPage,...e};if(this.state.sortBy&&"relevance"!==this.state.sortBy&&(t.sort_by=this.state.sortBy),this.state.refinements.length>0){const e={};this.state.refinements.forEach(t=>{e[t.field]||(e[t.field]=[]),e[t.field].push(t.value)});const r=[];Object.entries(e).forEach(([e,t])=>{t.forEach(t=>{r.push(`${e}:${t}`)})}),r.length>0&&(t.filter_by=r.join(" && "))}return t}debouncedSearch(){this.debounceTimer&&clearTimeout(this.debounceTimer),l("SearchStateManager: Scheduling debounced search",{debounceMs:this.debounceMs}),this.debounceTimer=setTimeout(()=>{l("SearchStateManager: Debounce timer fired, calling search()"),this.search()},this.debounceMs)}subscribe(e){return this.listeners.push(e),e(this.getState()),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}setState(e){this.state={...this.state,...e},this.notifyListeners()}notifyListeners(){const e=this.getState();this.listeners.forEach(t=>{try{t(e)}catch(e){const t=e instanceof Error?e:new Error(String(e));u("SearchStateManager: Error in listener",{error:t.message})}})}clear(){this.state={query:"",refinements:[],currentPage:1,itemsPerPage:this.state.itemsPerPage,sortBy:void 0,results:null,loading:!1,error:null},this.notifyListeners()}}function h(e,t=0){return function(e,t=0){const r=3&e.length,a=e.length-r;let o=t;const n=3432918353,s=461845907;let i,l=0;for(;l<a;)i=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,i=Math.imul(i,n),i=i<<15|i>>>17,i=Math.imul(i,s),o^=i,o=o<<13|o>>>19,o=Math.imul(o,5)+3864292196;switch(i=0,r){case 3:i^=(255&e.charCodeAt(l+2))<<16;case 2:i^=(255&e.charCodeAt(l+1))<<8;case 1:i^=255&e.charCodeAt(l),i=Math.imul(i,n),i=i<<15|i>>>17,i=Math.imul(i,s),o^=i}return o^=e.length,o^=o>>>16,o=Math.imul(o,2246822507),o^=o>>>13,o=Math.imul(o,3266489909),o^=o>>>16,o>>>0}(e,t).toString(16).padStart(8,"0")}const y={enableCanvas:!0,enableWebGL:!0,enableAudio:!0,enableFonts:!0,enableHardware:!0,timeout:5e3},b=["Arial","Arial Black","Calibri","Cambria","Comic Sans MS","Consolas","Courier New","Georgia","Impact","Lucida Console","Lucida Sans Unicode","Microsoft Sans Serif","Palatino Linotype","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana","American Typewriter","Andale Mono","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arial Hebrew","Avenir","Baskerville","Big Caslon","Brush Script MT","Chalkboard","Cochin","Copperplate","Didot","Futura","Geneva","Gill Sans","Helvetica","Helvetica Neue","Herculanum","Hoefler Text","Lucida Grande","Marker Felt","Menlo","Monaco","Noteworthy","Optima","Papyrus","Phosphate","Rockwell","San Francisco","Savoye LET","SignPainter","Skia","Snell Roundhand","Zapfino","Cantarell","DejaVu Sans","DejaVu Sans Mono","DejaVu Serif","Droid Sans","Droid Sans Mono","Droid Serif","FreeMono","FreeSans","FreeSerif","Liberation Mono","Liberation Sans","Liberation Serif","Noto Sans","Noto Serif","Open Sans","Roboto","Ubuntu","Ubuntu Mono","Lato","Montserrat","Oswald","Raleway","Source Sans Pro","PT Sans","Merriweather","Nunito","Playfair Display","Poppins"];class x{constructor(e){this.cachedResult=null,this.config={...y,...e}}async get(){if(this.cachedResult)return this.cachedResult;const e=await this.collectComponents(),t=this.calculateConfidence(e),r=this.generateVisitorId(e);return this.cachedResult={visitorId:r,confidence:t,components:e},this.cachedResult}clearCache(){this.cachedResult=null}async collectComponents(){const[e,t,r,a,o]=await Promise.all([this.config.enableCanvas?this.getCanvasFingerprint():{hash:""},this.config.enableWebGL?this.getWebGLFingerprint():{renderer:"",vendor:"",hash:""},this.config.enableAudio?this.getAudioFingerprint():{hash:""},this.detectAdBlocker(),this.detectIncognito()]);return{canvas:e,webgl:t,audio:r,fonts:this.config.enableFonts?this.detectFonts():[],hardware:this.config.enableHardware?this.getHardwareInfo():{concurrency:0,deviceMemory:0,maxTouchPoints:0,platform:""},screen:this.getScreenInfo(),browser:this.getBrowserInfo(),adBlockerDetected:a,incognitoDetected:o}}async getCanvasFingerprint(){try{const e=document.createElement("canvas");e.width=256,e.height=128;const t=e.getContext("2d");if(!t)return{hash:""};t.fillStyle="#f8f8f8",t.fillRect(0,0,e.width,e.height);const r=t.createLinearGradient(0,0,e.width,0);r.addColorStop(0,"#ff6b6b"),r.addColorStop(.5,"#4ecdc4"),r.addColorStop(1,"#45b7d1"),t.fillStyle=r,t.fillRect(10,10,100,50),t.font="18px Arial",t.fillStyle="#333",t.textBaseline="alphabetic",t.fillText("Seekora Fingerprint 🔐",20,90),t.font="bold 14px Georgia",t.fillStyle="rgba(102, 204, 153, 0.7)",t.fillText("Test String @#$%",130,40),t.beginPath(),t.arc(200,70,30,0,2*Math.PI),t.fillStyle="rgba(255, 165, 0, 0.5)",t.fill(),t.strokeStyle="#333",t.lineWidth=2,t.stroke(),t.beginPath(),t.moveTo(10,120),t.bezierCurveTo(50,80,100,120,140,100),t.strokeStyle="#9b59b6",t.lineWidth=3,t.stroke(),t.save(),t.translate(180,100),t.rotate(.5),t.fillStyle="rgba(52, 152, 219, 0.6)",t.fillRect(-20,-10,40,20),t.restore();const a=e.toDataURL("image/png");return{hash:h(a),data:a}}catch{return{hash:""}}}async getWebGLFingerprint(){try{const e=document.createElement("canvas");e.width=256,e.height=256;const t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return{renderer:"",vendor:"",hash:""};const r=t.getExtension("WEBGL_debug_renderer_info"),a=r&&t.getParameter(r.UNMASKED_RENDERER_WEBGL)||"",o=r&&t.getParameter(r.UNMASKED_VENDOR_WEBGL)||"",n=[],s=[t.ALIASED_LINE_WIDTH_RANGE,t.ALIASED_POINT_SIZE_RANGE,t.ALPHA_BITS,t.BLUE_BITS,t.DEPTH_BITS,t.GREEN_BITS,t.MAX_COMBINED_TEXTURE_IMAGE_UNITS,t.MAX_CUBE_MAP_TEXTURE_SIZE,t.MAX_FRAGMENT_UNIFORM_VECTORS,t.MAX_RENDERBUFFER_SIZE,t.MAX_TEXTURE_IMAGE_UNITS,t.MAX_TEXTURE_SIZE,t.MAX_VARYING_VECTORS,t.MAX_VERTEX_ATTRIBS,t.MAX_VERTEX_TEXTURE_IMAGE_UNITS,t.MAX_VERTEX_UNIFORM_VECTORS,t.MAX_VIEWPORT_DIMS,t.RED_BITS,t.RENDERER,t.SHADING_LANGUAGE_VERSION,t.STENCIL_BITS,t.VENDOR,t.VERSION];for(const e of s)try{const r=t.getParameter(e);null!=r&&(r instanceof Float32Array||r instanceof Int32Array?n.push(Array.from(r).join(",")):n.push(String(r)))}catch{}const i=t.getSupportedExtensions()||[];n.push(i.sort().join(","));try{const e="\n attribute vec2 position;\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n }\n ",r="\n precision mediump float;\n void main() {\n gl_FragColor = vec4(0.812, 0.373, 0.784, 1.0);\n }\n ",a=t.createShader(t.VERTEX_SHADER);t.shaderSource(a,e),t.compileShader(a);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,r),t.compileShader(o);const s=t.createProgram();t.attachShader(s,a),t.attachShader(s,o),t.linkProgram(s),t.useProgram(s);const i=new Float32Array([0,.5,-.5,-.5,.5,-.5]),l=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW);const c=t.getAttribLocation(s,"position");t.enableVertexAttribArray(c),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.clearColor(.1,.1,.1,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLES,0,3);const d=new Uint8Array(262144);t.readPixels(0,0,256,256,t.RGBA,t.UNSIGNED_BYTE,d);const u=[0,1e3,5e3,1e4,25e3,5e4,1e5,2e5];for(const e of u)e<d.length&&n.push(String(d[e]))}catch{}const l=`${a}|${o}|${n.join("|")}`;return{renderer:a,vendor:o,hash:h(l)}}catch{return{renderer:"",vendor:"",hash:""}}}async getAudioFingerprint(){try{const e=window.AudioContext||window.webkitAudioContext;if(!e)return{hash:""};const t=new e,r=t.createOscillator();r.type="triangle",r.frequency.setValueAtTime(1e4,t.currentTime);const a=t.createDynamicsCompressor();a.threshold.setValueAtTime(-50,t.currentTime),a.knee.setValueAtTime(40,t.currentTime),a.ratio.setValueAtTime(12,t.currentTime),a.attack.setValueAtTime(0,t.currentTime),a.release.setValueAtTime(.25,t.currentTime);const o=t.createAnalyser();return o.fftSize=2048,r.connect(a),a.connect(o),o.connect(t.destination),r.start(0),new Promise(e=>{const a=setTimeout(()=>{try{r.stop(),t.close()}catch{}e({hash:""})},this.config.timeout);setTimeout(()=>{try{const n=new Float32Array(o.frequencyBinCount);o.getFloatFrequencyData(n);let s=0,i=0;for(let e=0;e<n.length;e++)isFinite(n[e])&&0!==n[e]&&(s+=Math.abs(n[e]),i++);const l=i>0?s/i:0,c=Array.from(n.slice(0,100)).filter(e=>isFinite(e)).map(e=>e.toFixed(4)).join(",");clearTimeout(a),r.stop(),t.close();const d=h(c+String(l));e({hash:d,value:l})}catch{clearTimeout(a);try{r.stop(),t.close()}catch{}e({hash:""})}},200)})}catch{return{hash:""}}}detectFonts(){const e=[];try{const t=["monospace","sans-serif","serif"],r="mmmmmmmmmmlli",a="72px",o=document.createElement("canvas");o.width=500,o.height=100;const n=o.getContext("2d");if(!n)return e;const s={};for(const e of t)n.font=`${a} ${e}`,s[e]=n.measureText(r).width;for(const o of b){let i=!1;for(const e of t){n.font=`${a} "${o}", ${e}`;if(n.measureText(r).width!==s[e]){i=!0;break}}i&&e.push(o)}}catch{}return e}getHardwareInfo(){const e=navigator;return{concurrency:e.hardwareConcurrency||0,deviceMemory:e.deviceMemory||0,maxTouchPoints:e.maxTouchPoints||0,platform:e.platform||""}}getScreenInfo(){return{width:screen.width||0,height:screen.height||0,colorDepth:screen.colorDepth||0,pixelRatio:window.devicePixelRatio||1}}getBrowserInfo(){const e=navigator;return{language:e.language||"",languages:Array.from(e.languages||[]),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"",timezoneOffset:(new Date).getTimezoneOffset(),cookieEnabled:e.cookieEnabled??!1,doNotTrack:"1"===e.doNotTrack||"yes"===e.doNotTrack}}async detectAdBlocker(){try{const e=document.createElement("div");e.className="adsbox ad-banner ad_banner textAd text_ad text-ad",e.style.cssText="position: absolute; left: -9999px; width: 1px; height: 1px;",e.innerHTML=" ",document.body.appendChild(e),await new Promise(e=>setTimeout(e,100));const t=null===e.offsetParent||0===e.offsetHeight||0===e.offsetWidth||"none"===getComputedStyle(e).display||"hidden"===getComputedStyle(e).visibility;document.body.removeChild(e);try{await fetch("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js",{method:"HEAD",mode:"no-cors"});return t}catch{return!0}}catch{return!1}}async detectIncognito(){if("storage"in navigator&&"estimate"in navigator.storage)try{const e=await navigator.storage.estimate();if(e.quota&&e.quota<136314880)return!0}catch{}try{const e=indexedDB.open("test-private-mode");return new Promise(t=>{e.onerror=()=>t(!0),e.onsuccess=()=>{e.result.close(),indexedDB.deleteDatabase("test-private-mode"),t(!1)},setTimeout(()=>t(!1),500)})}catch{return!0}}generateHash(e){return h(e)}generateVisitorId(e){const t=JSON.stringify({canvas:e.canvas.hash,webgl:e.webgl.hash,audio:e.audio.hash,fonts:e.fonts.sort().join(","),hardware:e.hardware,screen:e.screen,browser:{...e.browser,languages:e.browser.languages.sort().join(",")}});return`${h(t,0)}${h(t,1)}${h(t,2)}${h(t,3)}`}calculateConfidence(e){let t=0,r=0;return r+=.2,e.canvas.hash&&(t+=.2),r+=.2,e.webgl.hash&&e.webgl.renderer?t+=.2:e.webgl.hash&&(t+=.1),r+=.15,e.audio.hash&&(t+=.15),r+=.15,e.fonts.length>10?t+=.15:e.fonts.length>5?t+=.1:e.fonts.length>0&&(t+=.05),r+=.1,e.hardware.concurrency>0&&e.hardware.platform?t+=.1:e.hardware.platform&&(t+=.05),r+=.1,e.screen.width>0&&e.screen.height>0&&(t+=.1),r+=.1,e.browser.timezone&&e.browser.language?t+=.1:e.browser.language&&(t+=.05),Math.min(1,t/1)}}const v={colors:{primary:"#007bff",secondary:"#6c757d",background:"#ffffff",surface:"#f8f9fa",text:"#212529",textSecondary:"#6c757d",border:"#dee2e6",hover:"#f8f9fa",focus:"#007bff",error:"#dc3545",success:"#28a745",warning:"#ffc107"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{small:"0.5rem",medium:"1rem",large:"1.5rem"},borderRadius:{none:"0",small:"0.25rem",medium:"0.375rem",large:"0.5rem",full:"9999px"},shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)",medium:"0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23)",large:"0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23)"},transitions:{fast:"150ms ease-in-out",normal:"250ms ease-in-out",slow:"350ms ease-in-out"},breakpoints:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},zIndex:{dropdown:1e3,modal:2e3,tooltip:3e3}},k=e=>((e,t)=>({colors:{...t.colors,...e.colors},typography:{...t.typography,...e.typography,fontSize:{...t.typography.fontSize,...e.typography?.fontSize}},spacing:{...t.spacing,...e.spacing},borderRadius:e.borderRadius??t.borderRadius,shadows:{...t.shadows,...e.shadows},transitions:{...t.transitions,...e.transitions},breakpoints:{...t.breakpoints,...e.breakpoints},zIndex:{...t.zIndex,...e.zIndex}}))(e,v),E=t.createContext(null),S=()=>{const e=t.useContext(E);if(!e){const e=new Error("useSearchContext must be used within a SearchProvider");throw u("SearchProvider: Context not available",{error:e.message}),e}return e},w=()=>{const{stateManager:e}=S(),[r,a]=t.useState(e.getState());t.useEffect(()=>e.subscribe(e=>{a(e)}),[e]);const o=t.useCallback((t,r=!0)=>{e.setQuery(t,r)},[e]),n=t.useCallback((t,r,a=!0)=>{e.addRefinement(t,r,a)},[e]),s=t.useCallback((t,r,a=!0)=>{e.removeRefinement(t,r,a)},[e]),i=t.useCallback((t=!0)=>{e.clearRefinements(t)},[e]),l=t.useCallback((t,r=!0)=>{e.setPage(t,r)},[e]),c=t.useCallback((t,r=!0)=>{e.setSortBy(t,r)},[e]),d=t.useCallback(t=>e.search(t),[e]),u=t.useCallback(()=>{e.clear()},[e]);return{query:r.query,refinements:r.refinements,currentPage:r.currentPage,itemsPerPage:r.itemsPerPage,sortBy:r.sortBy,results:r.results,loading:r.loading,error:r.error,setQuery:o,addRefinement:n,removeRefinement:s,clearRefinements:i,setPage:l,setSortBy:c,search:d,clear:u}},C=({client:e,query:r,enabled:a=!0,debounceMs:o=300,maxSuggestions:n=10})=>{const[s,i]=t.useState([]),[l,c]=t.useState(!1),[d,p]=t.useState(null),m=t.useRef(null);return t.useEffect(()=>(m.current&&clearTimeout(m.current),a&&r.trim()?(c(!0),p(null),m.current=setTimeout(async()=>{try{const t=await(e.getSuggestions?.(r,n)),a=(Array.isArray(t)?t:[]).map(e=>{const t=e.query||e.text||e,r=void 0!==e.popularity?e.popularity:void 0!==e.count?e.count:void 0;return{query:"string"==typeof t?t:String(t),count:"number"==typeof r?r:void 0,metadata:e}});i(a)}catch(e){const t=e instanceof Error?e:new Error(String(e));u("Error in useQuerySuggestions:",t),p(t),i([])}finally{c(!1)}},o),()=>{m.current&&clearTimeout(m.current)}):(i([]),c(!1),void p(null))),[e,r,a,o,n]),{suggestions:s,loading:l,error:d}};function R(e){var t,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=R(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function I(){for(var e,t,r=0,a="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=R(e))&&(a&&(a+=" "),a+=t);return a}const N=({title:e,items:r,renderItem:a,onItemClick:o,className:n,style:s,theme:i,layout:l="horizontal",currencySymbol:c="$"})=>{const{theme:d}=S(),u=i||{},p=()=>{switch(l){case"horizontal":return{flexShrink:0,width:"150px",scrollSnapAlign:"start"};case"grid":default:return{};case"list":return{display:"flex",gap:d.spacing.medium,padding:d.spacing.small,borderBottom:`1px solid ${d.colors.border}`}}};return t.createElement("div",{className:I(u.root,n),style:s},e&&t.createElement("h3",{className:u.title,style:{margin:`0 0 ${d.spacing.medium} 0`,fontSize:d.typography.fontSize.large,fontWeight:d.typography.fontWeight?.semibold||600,color:d.colors.text}},e),t.createElement("div",{className:u.list,style:(()=>{switch(l){case"horizontal":return{display:"flex",gap:d.spacing.medium,overflowX:"auto",scrollSnapType:"x mandatory",paddingBottom:d.spacing.small};case"grid":return{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:d.spacing.medium};case"list":return{display:"flex",flexDirection:"column",gap:d.spacing.small};default:return{}}})()},r.map((e,r)=>t.createElement("div",{key:e.id||r,className:u.item,onClick:()=>o?.(e,r),style:{...p(),cursor:o?"pointer":"default"}},a?a(e,r):t.createElement(T,{item:e,theme:u,currencySymbol:c,layout:l})))))},T=({item:e,theme:r,currencySymbol:a,layout:o})=>{const{theme:n}=S(),s=e.image||e.imageUrl||"",i=e.title||e.name||"",l=e.price,c="list"===o?"60px":"100%";return t.createElement(t.Fragment,null,s&&t.createElement("img",{src:s,alt:i,className:r.image,style:{width:c,height:"list"===o?"60px":"120px",objectFit:"cover",borderRadius:"string"==typeof n.borderRadius?n.borderRadius:n.borderRadius.small}}),t.createElement("div",{className:r.content,style:{flex:"list"===o?1:void 0}},t.createElement("div",{className:r.name,style:{marginTop:"list"===o?0:n.spacing.small,fontSize:n.typography.fontSize.small,fontWeight:n.typography.fontWeight?.medium||500,color:n.colors.text,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},i),void 0!==l&&t.createElement("div",{className:r.price,style:{marginTop:n.spacing.small,fontSize:n.typography.fontSize.small,fontWeight:n.typography.fontWeight?.bold||700,color:n.colors.primary}},a,"number"==typeof l?l.toFixed(2):l)))};function A(e){return{padding:e.spacing.large,textAlign:"center",color:e.colors.textSecondary}}const z="seekora_recent_searches",M=10;function _(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,JSON.stringify(t))}catch(e){d("Failed to save recent searches to localStorage",{error:e})}}function L(e){const t=e.query||e.text||String(e),r=e._highlightResult?.query?.value;return{query:t,popularity:e.popularity,count:e.instant_search?.exact_nb_hits??e.popularity??e.count,objectID:e.objectID,highlightedQuery:r?P(r):void 0,categories:e.categories?.map(e=>({value:e.value||e.name,count:e.count,path:e.path})),facets:e.instant_search?.facets||e.facets,metadata:e}}function P(e){return e.replace(/__ais-highlight__/g,"<mark>").replace(/__\/ais-highlight__/g,"</mark>")}function B(e){const t=e.metadata||{};return{id:e.id||e.objectID,objectID:e.objectID||e.id,title:e.title||e.name||e.productName||t.name||t.productName||"",name:e.name||e.title||t.name||t.productName||"",image:e.image||e.imageUrl||t.image||t.image_url||t.images?.[0]||"",price:e.price??e.sellPrice??t.sellPrice??t.price,currency:e.currency||t.currency||"",url:e.url||e.productId||t.url||t.productId||"",clicks:e.clicks,conversions:e.conversions,revenue:e.revenue,trend_score:e.trend_score,metadata:e.metadata||e}}function D(e){return{id:e.id,label:e.label,filter:e.filter,products:e.products?.map(B)||[],nb_hits:e.nb_hits,processing_time_ms:e.processing_time_ms}}function $(e){const{client:r,query:a,enabled:o=!0,debounceMs:n=200,maxSuggestions:s=10,minQueryLength:i=1,includeDropdownRecommendations:c=!1,includeDropdownProductList:d=!0,includeFilteredTabs:p=!0,includeCategories:m=!0,includeFacets:g=!1,maxCategories:f=3,maxFacets:h=5,filteredTabs:y,minPopularity:b,timeRange:x,disableTypoTolerance:v,analyticsTags:k,enableRecentSearches:E=!0,maxRecentSearches:S=M,recentSearchesKey:w=z,onSuggestionsLoaded:C,onError:R}=e,[I,N]=t.useState([]),[T,A]=t.useState(!1),[P,$]=t.useState(null),[F,W]=t.useState(null),[q,H]=t.useState([]),[O,j]=t.useState(null),[V,Q]=t.useState(0),[U,G]=t.useState(0),[K,X]=t.useState(0),[Y,J]=t.useState(""),Z=t.useRef(null),ee=t.useRef(null),te=t.useRef(!0);t.useEffect(()=>{if(E){const e=function(e){if("undefined"==typeof window)return[];try{const t=localStorage.getItem(e);return t?JSON.parse(t):[]}catch{return[]}}(w);H(e.slice(0,S))}return()=>{te.current=!1}},[E,w,S]);const re=t.useCallback(async e=>{if(r){if(!e.trim()&&i>0)return N([]),void W(null);ee.current&&ee.current.abort(),ee.current=new AbortController,A(!0),$(null);try{const t=await(r.getSuggestions?.(e,{hitsPerPage:s,include_dropdown_recommendations:c||y&&y.length>0,include_dropdown_product_list:d,include_filtered_tabs:p,include_categories:m,include_facets:g,max_categories:f,max_facets:h,filtered_tabs:y,min_popularity:b,time_range:x,disable_typo_tolerance:v,analytics_tags:k,returnFullResponse:!0}));if(!te.current)return;const a=(t.suggestions||[]).map(L);N(a);const o=t.extensions||{},n=t.results,i=Array.isArray(n?.[1]?.hits)?n[1].hits:[],u=i.length>0?i.map(e=>B(e)):[],E={trending_searches:Array.isArray(o.trending_searches)?o.trending_searches:[],top_searches:Array.isArray(o.top_searches)?o.top_searches:[],related_searches:Array.isArray(o.related_searches)?o.related_searches:[],trending_products:Array.isArray(o.trending_products)?o.trending_products.map(B):[],item_recommendations:Array.isArray(o.item_recommendations)?o.item_recommendations.map(B):[],product_hits:u.length>0?u:void 0,popular_brands:Array.isArray(o.popular_brands)?o.popular_brands:[],filtered_tabs:Array.isArray(o.filtered_tabs)?o.filtered_tabs.map(D):[],processing_time_ms:"number"==typeof o.processing_time_ms?o.processing_time_ms:void 0,cached_at:"string"==typeof o.cached_at?o.cached_at:void 0};W(E);const S=t.raw,w=S?.results,R=w?.[0]??S??{},I=e=>"number"!=typeof e||Number.isNaN(e)?0:e,T=e=>"string"==typeof e?e:"";j("number"==typeof R.processingTimeMS?R.processingTimeMS:null),Q(I(R.nbHits)||a.length),G(I(R.page)||0),X(I(R.nbPages)||1),J(T(R.query)||e),C&&C({suggestions:a,nbHits:I(R.nbHits)||a.length,page:I(R.page)||0,nbPages:I(R.nbPages)||1,hitsPerPage:I(R.hitsPerPage)||s,processingTimeMS:"number"==typeof R.processingTimeMS?R.processingTimeMS:void 0,query:T(R.query)||e,dropdownRecommendations:E,results:Array.isArray(t.results)?t.results:void 0,extensions:o}),l("Query suggestions loaded",{query:e,suggestionsCount:a.length,hasRecommendations:Object.keys(E).some(e=>Array.isArray(E[e])&&E[e].length>0)})}catch(t){if(!te.current)return;const r=t instanceof Error?t:new Error(String(t));if("AbortError"===r.name)return;u("Failed to fetch query suggestions",{query:e,error:r.message}),$(r),N([]),W(null),R&&R(r)}finally{te.current&&A(!1)}}},[r,i,s,c,d,p,m,g,f,h,y,b,x,v,k,C,R]);t.useEffect(()=>(Z.current&&clearTimeout(Z.current),!o||a.length<i?(N([]),A(!1),void $(null)):(A(!0),Z.current=setTimeout(()=>{re(a)},n),()=>{Z.current&&clearTimeout(Z.current)})),[a,o,i,n,re]);const ae=t.useCallback((e,t)=>{E&&e.trim()&&H(r=>{const a=r.filter(t=>t.query.toLowerCase()!==e.toLowerCase()),o=[{query:e.trim(),timestamp:Date.now(),resultsCount:t},...a].slice(0,S);return _(w,o),o})},[E,S,w]),oe=t.useCallback(e=>{H(t=>{const r=t.filter(t=>t.query!==e);return _(w,r),r})},[w]),ne=t.useCallback(()=>{H([]),_(w,[])},[w]),se=t.useCallback(async()=>{a.length>=i&&await re(a)},[a,i,re]),ie=F?.trending_searches||[],le=F?.top_searches||[],ce=F?.related_searches||[],de=F?.popular_brands||[],ue=F?.filtered_tabs||[],pe=t.useMemo(()=>{const e=F?.trending_products;if(e&&e.length>0)return e;const t=F?.item_recommendations;if(t&&t.length>0)return t;const r=F?.filtered_tabs?.[0];return r?.products&&r.products.length>0?r.products:F?.product_hits??[]},[F?.trending_products,F?.item_recommendations,F?.filtered_tabs,F?.product_hits]),me=t.useMemo(()=>I.length>0||q.length>0||ie.length>0||le.length>0||ce.length>0||de.length>0||ue.length>0||pe.length>0,[I,q,ie,le,ce,de,ue,pe]),ge=t.useCallback(()=>{const e=[];let t=0;return 0===a.length&&q.length>0&&q.forEach(r=>{e.push({type:"recent",index:t++,data:r})}),I.forEach(r=>{e.push({type:"suggestion",index:t++,data:r})}),ie.forEach(r=>{e.push({type:"trending",index:t++,data:r})}),pe.forEach(r=>{e.push({type:"product",index:t++,data:r})}),de.forEach(r=>{e.push({type:"brand",index:t++,data:r})}),e},[a,q,I,ie,pe,de]);return{suggestions:I,loading:T,error:P,dropdownRecommendations:F,trendingSearches:ie,topSearches:le,relatedSearches:ce,popularBrands:de,filteredTabs:ue,trendingProducts:pe,recentSearches:q,processingTimeMs:O,totalHits:V,currentPage:U,totalPages:K,originalQuery:Y,addRecentSearch:ae,removeRecentSearch:oe,clearRecentSearches:ne,refetch:se,hasContent:me,getAllNavigableItems:ge}}const F={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius, 8px)",boxShadow:"var(--seekora-shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))",maxHeight:"400px",overflowY:"auto",overflowX:"hidden"},sectionTitle:{fontSize:"12px",fontWeight:600,color:"var(--seekora-text-secondary, #6b7280)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"8px 16px 4px",margin:0},suggestionItem:{display:"flex",alignItems:"center",padding:"10px 16px",cursor:"pointer",transition:"background-color 150ms ease",fontSize:"14px",color:"var(--seekora-text-primary, #111827)",gap:"12px"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},suggestionQuery:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},suggestionCount:{fontSize:"12px",color:"var(--seekora-text-secondary, #9ca3af)",marginLeft:"auto",flexShrink:0},highlight:{fontWeight:600,color:"var(--seekora-text-primary, #111827)",backgroundColor:"var(--seekora-highlight-bg, #fef3c7)",padding:"0 2px",borderRadius:"2px"},recentIcon:{width:"16px",height:"16px",color:"var(--seekora-text-secondary, #9ca3af)",flexShrink:0},removeButton:{padding:"4px",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-secondary, #9ca3af)",opacity:0,transition:"opacity 150ms ease, color 150ms ease"},removeButtonVisible:{opacity:1},loadingState:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px 16px",color:"var(--seekora-text-secondary, #6b7280)",fontSize:"14px",gap:"8px"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px 16px",color:"var(--seekora-text-secondary, #6b7280)",fontSize:"14px",textAlign:"center"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e5e7eb)",margin:"4px 0"},footer:{borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",padding:"8px 16px",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",justifyContent:"space-between"},keyboardHint:{display:"flex",alignItems:"center",gap:"8px",fontSize:"11px"},keyboardKey:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"18px",padding:"0 4px",borderRadius:"3px",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)",border:"1px solid var(--seekora-border-color, #e5e7eb)",fontSize:"10px",fontWeight:500}},W=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),q=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),H=({className:e,style:r})=>t.createElement("svg",{className:e,style:r,viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),O=({style:e})=>t.createElement("svg",{style:{animation:"spin 1s linear infinite",...e},viewBox:"0 0 24 24",width:"20",height:"20"},t.createElement("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",fill:"none",opacity:"0.25"}),t.createElement("path",{fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})),j=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,maxSuggestions:n=8,minQueryLength:s=1,debounceMs:i=200,showRecentSearches:l=!0,maxRecentSearches:c=5,showCounts:d=!0,showLoading:u=!0,showEmptyState:p=!0,highlight:m={enabled:!0,preTag:"<mark>",postTag:"</mark>"},keyboardNav:g={enabled:!0},animation:f={enabled:!0,duration:150,entrance:"fade"},classNames:h={},style:y,renderSuggestion:b,renderRecentSearch:x,renderLoading:v,renderEmpty:k,footer:E,position:w="absolute",width:C="100%",zIndex:R=1e3,closeOnClickOutside:N=!0,closeOnEscape:T=!0,ariaLabel:A="Search suggestions",onSuggestionSelect:z,onRecentSearchClick:M,onRecentSearchRemove:_,onOpen:L,onClose:P,onNavigate:B}=e,{client:D,theme:j}=S(),V=t.useRef(null),[Q,U]=t.useState(-1),[G,K]=t.useState(!1),{suggestions:X,loading:Y,error:J,recentSearches:Z,addRecentSearch:ee,removeRecentSearch:te,hasContent:re}=$({client:D,query:a,enabled:o&&a.length>=s,debounceMs:i,maxSuggestions:n,minQueryLength:s,enableRecentSearches:l,maxRecentSearches:c}),ae=t.useMemo(()=>{const e=[];return l&&0===a.length&&Z.length>0&&Z.slice(0,c).forEach(t=>{e.push({type:"recent",data:t})}),X.forEach(t=>{e.push({type:"suggestion",data:t})}),e},[X,Z,a,l,c]);t.useEffect(()=>{if(o&&(re||Y))K(!0),L?.();else{if(f.enabled){const e=setTimeout(()=>K(!1),f.duration);return()=>clearTimeout(e)}K(!1),P?.()}},[o,re,Y,f.enabled,f.duration,L,P]),t.useEffect(()=>{U(-1)},[ae.length]);const oe=t.useCallback(()=>{g.enabled&&U(e=>{const t=e<ae.length-1?e+1:0;return B?.("down",t),t})},[g.enabled,ae.length,B]),ne=t.useCallback(()=>{g.enabled&&U(e=>{const t=e>0?e-1:ae.length-1;return B?.("up",t),t})},[g.enabled,ae.length,B]),se=t.useCallback(()=>{if(Q<0||Q>=ae.length)return;const e=ae[Q];if("recent"===e.type){const t=e.data;M?.(t)}else{const t=e.data;z?.(t),ee(t.query,t.count)}},[Q,ae,M,z,ee]),ie=t.useCallback(()=>{U(-1)},[]);t.useImperativeHandle(r,()=>({selectActive:se,navigateNext:oe,navigatePrevious:ne,resetSelection:ie,getActiveIndex:()=>Q,getTotalItems:()=>ae.length}),[se,oe,ne,ie,Q,ae.length]),t.useEffect(()=>{if(!N||!o)return;const e=e=>{V.current&&!V.current.contains(e.target)&&P?.()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[N,o,P]);const le=t.useCallback((e,r)=>{if(!m.enabled||!r)return e;return e.split(new RegExp(`(${r})`,"gi")).map((e,a)=>e.toLowerCase()===r.toLowerCase()?t.createElement("mark",{key:a,className:h.suggestionItemHighlight,style:F.highlight},e):e)},[m.enabled,h.suggestionItemHighlight]),ce=t.useCallback(e=>e.highlightedQuery&&m.enabled?t.createElement("span",{dangerouslySetInnerHTML:{__html:e.highlightedQuery},style:{display:"inline"}}):le(e.query,a),[m.enabled,le,a]);if(!G&&!o)return null;const de=l&&0===a.length&&Z.length>0,ue=X.length>0,pe=p&&!Y&&!de&&!ue&&a.length>=s,me=f.enabled?{opacity:o?1:0,transform:o?"translateY(0)":"translateY(-8px)",transition:`opacity ${f.duration}ms ease, transform ${f.duration}ms ease`}:{};return t.createElement("div",{ref:V,role:"listbox","aria-label":A,"aria-expanded":o,className:I("seekora-suggestions-dropdown",h.root,h.container),style:{position:w,width:C,zIndex:R,...F.container,...me,...y}},Y&&u&&t.createElement("div",{className:h.loadingState,style:F.loadingState},v?v():t.createElement(t.Fragment,null,t.createElement(O,null),t.createElement("span",null,"Searching..."))),!Y&&de&&t.createElement("div",{className:I("seekora-suggestions-section",h.section,h.recentSearches)},t.createElement("div",{className:h.sectionTitle,style:F.sectionTitle},"Recent Searches"),Z.slice(0,c).map((e,r)=>{const a=Q===r;return t.createElement("div",{key:`recent-${e.query}-${r}`,role:"option","aria-selected":a,className:I(h.recentItem,a&&h.suggestionItemActive),onClick:()=>{M?.(e)},onMouseEnter:()=>U(r)},((e,r,a)=>x?x(e,r,a):t.createElement("div",{style:{...F.suggestionItem,...a?F.suggestionItemActive:{}}},t.createElement(q,{style:F.recentIcon}),t.createElement("span",{style:F.suggestionQuery},e.query),t.createElement("button",{type:"button",onClick:t=>{t.stopPropagation(),te(e.query),_?.(e)},style:{...F.removeButton,...a?F.removeButtonVisible:{}},"aria-label":`Remove ${e.query} from recent searches`},t.createElement(H,null))))(e,r,a))})),!Y&&de&&ue&&t.createElement("div",{style:F.divider}),!Y&&ue&&t.createElement("div",{className:I("seekora-suggestions-section",h.section,h.suggestionsList)},a.length>0&&t.createElement("div",{className:h.sectionTitle,style:F.sectionTitle},"Suggestions"),X.map((e,r)=>{const o=de?Z.length+r:r,n=Q===o;return t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,className:I(h.suggestionItem,n&&h.suggestionItemActive),onClick:()=>{z?.(e),ee(e.query,e.count)},onMouseEnter:()=>U(o)},((e,r,o)=>b?b(e,r,o,e=>le(e,a)):t.createElement("div",{style:{...F.suggestionItem,...o?F.suggestionItemActive:{}}},t.createElement(W,{style:F.recentIcon}),t.createElement("span",{style:F.suggestionQuery},ce(e)),d&&void 0!==e.count&&t.createElement("span",{style:F.suggestionCount},e.count.toLocaleString())))(e,r,n))})),pe&&t.createElement("div",{className:h.emptyState,style:F.emptyState},k?k():t.createElement(t.Fragment,null,t.createElement(W,{style:{width:24,height:24,marginBottom:8,opacity:.5}}),t.createElement("span",null,'No suggestions found for "',a,'"'))),E||g.enabled&&ae.length>0?t.createElement("div",{className:h.footer,style:F.footer},E||t.createElement("div",{style:F.keyboardHint},t.createElement("span",{style:F.keyboardKey},"↑"),t.createElement("span",{style:F.keyboardKey},"↓"),t.createElement("span",null,"to navigate"),t.createElement("span",{style:F.keyboardKey},"↵"),t.createElement("span",null,"to select"),t.createElement("span",{style:F.keyboardKey},"esc"),t.createElement("span",null,"to close"))):null,t.createElement("style",null,'\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n .seekora-suggestions-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fef3c7);\n font-weight: 600;\n padding: 0 2px;\n border-radius: 2px;\n }\n .seekora-suggestions-dropdown [role="option"]:hover button {\n opacity: 1;\n }\n '))}),V=[{id:"recent",title:"Recent Searches",maxItems:5,enabled:!0,order:1},{id:"suggestions",title:"Suggestions",maxItems:8,enabled:!0,order:2},{id:"trending",title:"Trending",maxItems:5,enabled:!0,order:3},{id:"categories",title:"Categories",maxItems:6,enabled:!1,order:4}],Q={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 12px)",boxShadow:"var(--seekora-shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04))",overflow:"hidden"},header:{padding:"12px 16px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)"},content:{overflowY:"auto",overflowX:"hidden"},sectionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px 4px"},sectionTitle:{fontSize:"11px",fontWeight:600,color:"var(--seekora-text-tertiary, #9ca3af)",textTransform:"uppercase",letterSpacing:"0.05em",margin:0},sectionAction:{fontSize:"12px",color:"var(--seekora-primary, #3b82f6)",cursor:"pointer",textDecoration:"none",fontWeight:500},item:{display:"flex",alignItems:"flex-start",padding:"10px 16px",cursor:"pointer",transition:"background-color 100ms ease",gap:"12px"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},itemIcon:{width:"18px",height:"18px",color:"var(--seekora-text-secondary, #6b7280)",flexShrink:0,marginTop:"2px"},itemContent:{flex:1,minWidth:0},itemQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #111827)",fontWeight:500,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},itemCount:{fontSize:"12px",color:"var(--seekora-text-tertiary, #9ca3af)",flexShrink:0},categoriesContainer:{display:"flex",flexWrap:"wrap",gap:"6px",marginTop:"6px"},categoryPill:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 8px",fontSize:"11px",fontWeight:500,color:"var(--seekora-text-secondary, #6b7280)",backgroundColor:"var(--seekora-bg-tertiary, #f3f4f6)",borderRadius:"12px",cursor:"pointer",transition:"all 100ms ease"},categoryPillHover:{backgroundColor:"var(--seekora-primary-light, #dbeafe)",color:"var(--seekora-primary, #3b82f6)"},categoryCount:{color:"var(--seekora-text-tertiary, #9ca3af)"},trendingList:{display:"flex",flexWrap:"wrap",gap:"8px",padding:"8px 16px"},trendingChip:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #374151)",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"20px",cursor:"pointer",transition:"all 150ms ease"},trendingChipHover:{borderColor:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)"},trendingIcon:{width:"14px",height:"14px",color:"var(--seekora-success, #10b981)"},trendingRank:{width:"18px",height:"18px",borderRadius:"50%",backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white",fontSize:"10px",fontWeight:600,display:"flex",alignItems:"center",justifyContent:"center"},removeButton:{padding:"4px",marginLeft:"auto",borderRadius:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-tertiary, #9ca3af)",opacity:0,transition:"opacity 100ms ease"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e5e7eb)",margin:"4px 16px"},footer:{padding:"12px 16px",borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)"},loadingOverlay:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.8)"},emptyState:{padding:"32px 16px",textAlign:"center",color:"var(--seekora-text-secondary, #6b7280)"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fef9c3)",fontWeight:600,borderRadius:"2px",padding:"0 1px"}},U=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:Q.itemIcon},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),G=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:Q.itemIcon},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),K=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:Q.trendingIcon},t.createElement("path",{fillRule:"evenodd",d:"M12 7a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0V8.414l-4.293 4.293a1 1 0 01-1.414 0L8 10.414l-4.293 4.293a1 1 0 01-1.414-1.414l5-5a1 1 0 011.414 0L11 10.586 14.586 7H12z",clipRule:"evenodd"})),X=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{width:14,height:14}},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),Y=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,sections:n=V,maxSuggestionsPerSection:s=8,minQueryLength:i=0,debounceMs:l=200,includeDropdownRecommendations:c=!0,includeDropdownProductList:d=!0,includeFilteredTabs:u=!0,includeCategories:p=!0,maxCategories:m=3,showCounts:g=!0,showCategoryCounts:f=!0,showSectionHeaders:h=!0,classNames:y={},style:b,renderSuggestion:x,renderCategory:v,renderTrendingItem:k,renderRecentItem:E,header:w,footer:C,width:R="100%",maxHeight:N="480px",zIndex:T=1e3,ariaLabel:A="Search suggestions",analyticsTags:z,onSuggestionSelect:M,onCategoryClick:_,onRecentSearchClick:L,onRecentSearchRemove:P,onViewAllClick:B,onOpen:D,onClose:F}=e,{client:W}=S(),q=t.useRef(null),[H,O]=t.useState(-1),[j,Y]=t.useState(null),{suggestions:J,loading:Z,trendingSearches:ee,topSearches:te,recentSearches:re,addRecentSearch:ae,removeRecentSearch:oe,hasContent:ne}=$({client:W,query:a,enabled:o,debounceMs:l,maxSuggestions:s,minQueryLength:i,includeDropdownRecommendations:c,includeDropdownProductList:d,includeFilteredTabs:u,includeCategories:p,maxCategories:m,analyticsTags:z,enableRecentSearches:!0}),se=t.useMemo(()=>n.filter(e=>!1!==e.enabled).sort((e,t)=>(e.order||0)-(t.order||0)),[n]),ie=e=>se.find(t=>t.id===e),le=t.useMemo(()=>{const e=[];return se.forEach((t,r)=>{switch(t.id){case"recent":0===a.length&&re.slice(0,t.maxItems||5).forEach(t=>{e.push({type:"recent",data:t,sectionIndex:r})});break;case"suggestions":J.slice(0,t.maxItems||s).forEach(t=>{e.push({type:"suggestion",data:t,sectionIndex:r})});break;case"trending":0===a.length&&(ee.length>0?ee:te).slice(0,t.maxItems||5).forEach(t=>{e.push({type:"trending",data:t,sectionIndex:r})})}}),e},[se,a,re,J,ee,te,s]),ce=t.useCallback(()=>{O(e=>e<le.length-1?e+1:0)},[le.length]),de=t.useCallback(()=>{O(e=>e>0?e-1:le.length-1)},[le.length]),ue=t.useCallback(()=>{if(H<0||H>=le.length)return;const e=le[H];switch(e.type){case"recent":L?.(e.data);break;case"suggestion":M?.(e.data),ae(e.data.query,e.data.count);break;case"trending":M?.({query:e.data.query,count:e.data.count}),ae(e.data.query)}},[H,le,L,M,ae]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>H,setActiveIndex:O,selectActive:ue,navigateNext:ce,navigatePrevious:de,getTotalItems:()=>le.length}),[H,ue,ce,de,le.length]);const pe=()=>{const e=ie("recent");return!e||a.length>0||0===re.length?null:t.createElement("div",{className:I("seekora-section","seekora-section-recent",y.section)},h&&t.createElement("div",{style:Q.sectionHeader},t.createElement("h3",{style:Q.sectionTitle},e.title||"Recent Searches"),re.length>(e.maxItems||5)&&t.createElement("button",{style:Q.sectionAction,onClick:()=>B?.("recent")},"View all")),re.slice(0,e.maxItems||5).map((e,r)=>{const a=((e,t)=>{let r=0;for(const a of le){if(se[a.sectionIndex].id===e)return r+t;a.sectionIndex<se.findIndex(t=>t.id===e)&&r++}return r+t})("recent",r),o=H===a;return t.createElement("div",{key:`recent-${e.query}`,role:"option","aria-selected":o,style:{...Q.item,...o?Q.itemActive:{}},onClick:()=>{L?.(e)},onMouseEnter:()=>O(a),className:I(y.recentItem,o&&y.suggestionItemActive)},E?E(e):t.createElement(t.Fragment,null,t.createElement(G,null),t.createElement("div",{style:Q.itemContent},t.createElement("p",{style:Q.itemQuery},e.query)),t.createElement("button",{style:Q.removeButton,onClick:t=>{t.stopPropagation(),oe(e.query),P?.(e)},"aria-label":"Remove"},t.createElement(X,null))))}))},me=()=>{const e=ie("suggestions");return e&&0!==J.length?t.createElement("div",{className:I("seekora-section","seekora-section-suggestions",y.section)},h&&a.length>0&&t.createElement("div",{style:Q.sectionHeader},t.createElement("h3",{style:Q.sectionTitle},e.title||"Suggestions")),J.slice(0,e.maxItems||s).map((e,r)=>{const o=le.findIndex((e,t)=>"suggestion"===e.type&&le.slice(0,t).filter(e=>"suggestion"===e.type).length===r),n=H===o;return t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,style:{...Q.item,...n?Q.itemActive:{}},onClick:()=>{M?.(e),ae(e.query,e.count)},onMouseEnter:()=>O(o),className:I(y.suggestionItem,n&&y.suggestionItemActive)},x?x(e,n):t.createElement(t.Fragment,null,t.createElement(U,null),t.createElement("div",{style:Q.itemContent},t.createElement("p",{style:Q.itemQuery},(s=e.query,a?s.split(new RegExp(`(${a})`,"gi")).map((e,r)=>e.toLowerCase()===a.toLowerCase()?t.createElement("span",{key:r,style:Q.highlight},e):e):s)),p&&e.categories&&e.categories.length>0&&t.createElement("div",{style:Q.categoriesContainer},e.categories.slice(0,m).map((e,r)=>v?v(e):t.createElement("span",{key:`cat-${r}`,style:{...Q.categoryPill,...j===e.value?Q.categoryPillHover:{}},onClick:t=>{t.stopPropagation(),_?.(e)},onMouseEnter:()=>Y(e.value),onMouseLeave:()=>Y(null)},e.value,f&&void 0!==e.count&&t.createElement("span",{style:Q.categoryCount},"(",e.count,")"))))),g&&void 0!==e.count&&t.createElement("span",{style:Q.itemCount},e.count.toLocaleString())));var s})):null};if(!o)return null;return ne||Z||0===a.length?t.createElement("div",{ref:q,role:"listbox","aria-label":A,className:I("seekora-rich-suggestions",y.root,y.container),style:{position:"absolute",width:R,zIndex:T,...Q.container,...b}},w&&t.createElement("div",{style:Q.header},w),t.createElement("div",{style:{...Q.content,maxHeight:N}},Z&&t.createElement("div",{style:Q.loadingOverlay},t.createElement("span",null,"Loading...")),se.map((e,r)=>{let o=null;switch(e.id){case"recent":o=pe();break;case"suggestions":o=me();break;case"trending":o=(()=>{const e=ie("trending"),r=ee.length>0?ee:te;return!e||a.length>0||0===r.length?null:t.createElement("div",{className:I("seekora-section","seekora-section-trending",y.section)},h&&t.createElement("div",{style:Q.sectionHeader},t.createElement("h3",{style:Q.sectionTitle},e.title||"Trending")),t.createElement("div",{style:Q.trendingList},r.slice(0,e.maxItems||5).map((e,r)=>{const a=le.findIndex((e,t)=>"trending"===e.type&&le.slice(0,t).filter(e=>"trending"===e.type).length===r),o=H===a;return k?k(e,r):t.createElement("button",{key:`trending-${e.query}`,style:{...Q.trendingChip,...o?Q.trendingChipHover:{}},onClick:()=>{M?.({query:e.query,count:e.count}),ae(e.query)},onMouseEnter:()=>O(a),className:I(y.trendingItem,o&&y.suggestionItemActive)},t.createElement("span",{style:Q.trendingRank},r+1),t.createElement("span",null,e.query),t.createElement(K,null))})))})()}return o?t.createElement(t.Fragment,{key:e.id},r>0&&t.createElement("div",{style:Q.divider}),o):null}),!Z&&a.length>0&&0===J.length&&t.createElement("div",{style:Q.emptyState},t.createElement("p",null,'No suggestions found for "',a,'"'))),C&&t.createElement("div",{style:Q.footer},C),t.createElement("style",null,'\n .seekora-rich-suggestions [role="option"]:hover button {\n opacity: 1;\n }\n .seekora-rich-suggestions mark {\n background-color: var(--seekora-highlight-bg, #fef9c3);\n font-weight: 600;\n border-radius: 2px;\n padding: 0 1px;\n }\n ')):null}),J={container:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 12px)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",overflow:"hidden"},header:{padding:"12px 20px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)"},content:{display:"flex",overflowY:"auto"},contentStacked:{flexDirection:"column"},suggestionsColumn:{borderRight:"1px solid var(--seekora-border-color, #e5e7eb)",overflowY:"auto"},productsColumn:{flex:1,overflowY:"auto",backgroundColor:"var(--seekora-bg-secondary, #fafafa)"},section:{padding:"12px 0"},sectionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 20px 8px"},sectionTitle:{fontSize:"11px",fontWeight:700,color:"var(--seekora-text-tertiary, #9ca3af)",textTransform:"uppercase",letterSpacing:"0.08em",margin:0},viewAllLink:{fontSize:"12px",color:"var(--seekora-primary, #3b82f6)",textDecoration:"none",fontWeight:600,cursor:"pointer"},suggestionItem:{display:"flex",alignItems:"center",padding:"10px 20px",cursor:"pointer",transition:"background-color 100ms ease",gap:"12px"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"},suggestionIcon:{width:"16px",height:"16px",color:"var(--seekora-text-secondary, #6b7280)",flexShrink:0},suggestionText:{flex:1,fontSize:"14px",color:"var(--seekora-text-primary, #111827)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},suggestionArrow:{width:"16px",height:"16px",color:"var(--seekora-text-tertiary, #d1d5db)",opacity:0,transition:"opacity 100ms ease"},suggestionArrowVisible:{opacity:1},suggestionCount:{fontSize:"12px",color:"var(--seekora-text-tertiary, #9ca3af)"},tabsContainer:{display:"flex",gap:"4px",padding:"12px 20px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",overflowX:"auto"},tab:{display:"flex",alignItems:"center",gap:"6px",padding:"8px 16px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-secondary, #6b7280)",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:"20px",cursor:"pointer",whiteSpace:"nowrap",transition:"all 150ms ease"},tabActive:{color:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)",borderColor:"var(--seekora-primary, #3b82f6)"},tabCount:{fontSize:"11px",fontWeight:600,padding:"2px 6px",borderRadius:"10px",backgroundColor:"var(--seekora-bg-tertiary, #e5e7eb)"},tabCountActive:{backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white"},productsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(140px, 1fr))",gap:"16px",padding:"16px 20px"},productCard:{display:"flex",flexDirection:"column",backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRadius:"8px",overflow:"hidden",cursor:"pointer",transition:"transform 150ms ease, box-shadow 150ms ease",border:"1px solid var(--seekora-border-color, #e5e7eb)"},productCardHover:{transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)"},productImage:{width:"100%",aspectRatio:"1",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"},productInfo:{padding:"10px"},productTitle:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #111827)",margin:0,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",lineHeight:1.3},productPrice:{fontSize:"14px",fontWeight:700,color:"var(--seekora-primary, #3b82f6)",marginTop:"4px"},brandsGrid:{display:"flex",flexWrap:"wrap",gap:"8px",padding:"8px 20px 16px"},brandChip:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 14px",fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #374151)",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"8px",cursor:"pointer",transition:"all 150ms ease"},brandChipHover:{borderColor:"var(--seekora-primary, #3b82f6)",backgroundColor:"var(--seekora-primary-light, #eff6ff)"},brandLogo:{width:"20px",height:"20px",borderRadius:"4px",objectFit:"contain",backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"},footer:{padding:"12px 20px",borderTop:"1px solid var(--seekora-border-color, #e5e7eb)",backgroundColor:"var(--seekora-bg-secondary, #f9fafb)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"12px",color:"var(--seekora-text-secondary, #6b7280)"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fef9c3)",fontWeight:600,padding:"0 2px",borderRadius:"2px"}},Z=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...J.suggestionIcon,...e}},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),ee=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...J.suggestionIcon,...e}},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),te=({style:e})=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{...J.suggestionArrow,...e}},t.createElement("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})),re=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{width:"40%",height:"40%",color:"#d1d5db"}},t.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2",strokeWidth:"2"}),t.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5",strokeWidth:"2"}),t.createElement("polyline",{points:"21 15 16 10 5 21",strokeWidth:"2"})),ae=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,maxSuggestions:n=8,maxProducts:s=8,maxBrands:i=8,minQueryLength:l=0,debounceMs:c=200,filteredTabs:d,showProducts:u=!0,showBrands:p=!0,showFilteredTabs:m=!0,showRecentSearches:g=!0,layout:f="side-by-side",productsColumnWidth:h="60%",suggestionsColumnWidth:y="40%",showPrices:b=!0,currencySymbol:x="$",classNames:v={},style:k,renderProduct:E,renderSuggestion:w,renderBrand:C,renderTab:R,header:N,footer:T,viewAllProductsLink:A,width:z="800px",maxHeight:M="600px",zIndex:_=1e3,analyticsTags:L,includeFacets:P=!0,includeCategories:B=!0,includeDropdownRecommendations:D=!0,onSuggestionSelect:F,onProductClick:W,onBrandClick:q,onTabSelect:H,onRecentSearchClick:O,onRecentSearchRemove:j,onViewAllClick:V,onOpen:Q,onClose:U}=e,{client:G}=S(),K=t.useRef(null),[X,Y]=t.useState(-1),[ae,oe]=t.useState("all"),[ne,se]=t.useState(null),[ie,le]=t.useState(null),{suggestions:ce,loading:de,filteredTabs:ue,trendingProducts:pe,popularBrands:me,recentSearches:ge,addRecentSearch:fe,removeRecentSearch:he,hasContent:ye}=$({client:G,query:a,enabled:o,debounceMs:c,maxSuggestions:n,minQueryLength:l,includeDropdownRecommendations:D,includeCategories:B,includeFacets:P,filteredTabs:d,analyticsTags:L,enableRecentSearches:g}),be=t.useMemo(()=>{if("all"===ae){const e=[...pe];return ue.forEach(t=>{t.products&&t.products.forEach(t=>{e.find(e=>e.id===t.id)||e.push(t)})}),e.slice(0,s)}const e=ue.find(e=>e.id===ae);return e?.products?.slice(0,s)||[]},[ae,ue,pe,s]),xe=t.useMemo(()=>{const e=[];return 0===a.length&&g&&ge.slice(0,5).forEach(t=>{e.push({type:"recent",data:t})}),ce.forEach(t=>{e.push({type:"suggestion",data:t})}),e},[a,g,ge,ce]),ve=t.useCallback(()=>{Y(e=>e<xe.length-1?e+1:0)},[xe.length]),ke=t.useCallback(()=>{Y(e=>e>0?e-1:xe.length-1)},[xe.length]),Ee=t.useCallback(()=>{if(X<0||X>=xe.length)return;const e=xe[X];"recent"===e.type?O?.(e.data):"suggestion"===e.type&&(F?.(e.data),fe(e.data.query))},[X,xe,O,F,fe]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>X,setActiveIndex:Y,selectActive:Ee,navigateNext:ve,navigatePrevious:ke,getActiveTab:()=>ae,setActiveTab:oe}),[X,Ee,ve,ke,ae]);const Se=e=>{oe(e);const t=ue.find(t=>t.id===e);t&&H?.(t)};if(!o)return null;const we=m&&(ue.length>0||pe.length>0),Ce=u&&be.length>0,Re=p&&me.length>0,Ie=g&&0===a.length&&ge.length>0,Ne=ce.length>0,Te="stacked"===f||"full-width"===f;return t.createElement("div",{ref:K,role:"listbox","aria-label":"Search suggestions and products",className:I("seekora-federated-dropdown",v.root,v.container),style:{position:"absolute",width:z,zIndex:_,...J.container,...k}},N&&t.createElement("div",{style:J.header},N),we&&t.createElement("div",{style:J.tabsContainer,className:v.tabsList},t.createElement("button",{style:{...J.tab,..."all"===ae?J.tabActive:{}},onClick:()=>Se("all"),className:I(v.tabItem,"all"===ae&&v.tabActive)},"All Results",pe.length>0&&t.createElement("span",{style:{...J.tabCount,..."all"===ae?J.tabCountActive:{}}},pe.length,"+")),ue.map(e=>R?R(e,ae===e.id):t.createElement("button",{key:e.id,style:{...J.tab,...ae===e.id?J.tabActive:{}},onClick:()=>Se(e.id),className:I(v.tabItem,ae===e.id&&v.tabActive)},e.label,void 0!==e.nb_hits&&t.createElement("span",{style:{...J.tabCount,...ae===e.id?J.tabCountActive:{}}},e.nb_hits)))),t.createElement("div",{style:{...J.content,...Te?J.contentStacked:{},maxHeight:M}},t.createElement("div",{style:{...J.suggestionsColumn,width:Te?"100%":y,minWidth:Te?void 0:"280px",borderRight:Te?"none":J.suggestionsColumn.borderRight}},Ie&&t.createElement("div",{style:J.section,className:v.recentSearches},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},"Recent Searches")),ge.slice(0,5).map((e,r)=>{const a=X===r;return t.createElement("div",{key:`recent-${e.query}`,role:"option","aria-selected":a,style:{...J.suggestionItem,...a?J.suggestionItemActive:{}},onClick:()=>O?.(e),onMouseEnter:()=>Y(r),className:I(v.recentItem,a&&v.suggestionItemActive)},t.createElement(ee,null),t.createElement("span",{style:J.suggestionText},e.query),t.createElement(te,{style:a?J.suggestionArrowVisible:{}}))})),Ne&&t.createElement("div",{style:J.section,className:v.suggestionsList},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},a?"Suggestions":"Popular Searches")),ce.slice(0,n).map((e,r)=>{const o=Ie?ge.length+r:r,n=X===o;return w?w(e,r,n):t.createElement("div",{key:e.objectID||`suggestion-${r}`,role:"option","aria-selected":n,style:{...J.suggestionItem,...n?J.suggestionItemActive:{}},onClick:()=>{F?.(e),fe(e.query)},onMouseEnter:()=>Y(o),className:I(v.suggestionItem,n&&v.suggestionItemActive)},t.createElement(Z,null),t.createElement("span",{style:J.suggestionText},(s=e.query,a?s.split(new RegExp(`(${a})`,"gi")).map((e,r)=>e.toLowerCase()===a.toLowerCase()?t.createElement("span",{key:r,style:J.highlight},e):e):s)),void 0!==e.count&&t.createElement("span",{style:J.suggestionCount},e.count.toLocaleString()),t.createElement(te,{style:n?J.suggestionArrowVisible:{}}));var s})),Re&&t.createElement("div",{style:J.section,className:v.brandsList},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},"Popular Brands")),t.createElement("div",{style:J.brandsGrid},me.slice(0,i).map((e,r)=>C?C(e,r):t.createElement("button",{key:`brand-${e.name}`,style:{...J.brandChip,...ie===e.name?J.brandChipHover:{}},onClick:()=>q?.(e),onMouseEnter:()=>le(e.name),onMouseLeave:()=>le(null),className:v.brandItem},e.logo&&t.createElement("img",{src:e.logo,alt:e.name,style:J.brandLogo,onError:e=>{e.target.style.display="none"}}),t.createElement("span",null,e.name)))))),Ce&&!Te&&t.createElement("div",{style:{...J.productsColumn,width:h}},t.createElement("div",{style:J.section},t.createElement("div",{style:J.sectionHeader},t.createElement("h3",{style:J.sectionTitle},"all"===ae?"Trending Products":`Products in ${ue.find(e=>e.id===ae)?.label||ae}`),A&&t.createElement("a",{href:A,style:J.viewAllLink,onClick:e=>{e.preventDefault(),V?.("products")}},"View all")),t.createElement("div",{style:J.productsGrid,className:v.productsList},be.map((e,r)=>{return E?E(e,r):t.createElement("div",{key:e.id||e.objectID,style:{...J.productCard,...ne===e.id?J.productCardHover:{}},onClick:()=>W?.(e),onMouseEnter:()=>se(e.id),onMouseLeave:()=>se(null),className:v.productItem},e.image?t.createElement("img",{src:e.image,alt:e.title||e.name||"",style:J.productImage,onError:e=>{e.target.style.display="none"}}):t.createElement("div",{style:{...J.productImage,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(re,null)),t.createElement("div",{style:J.productInfo},t.createElement("h4",{style:J.productTitle},e.title||e.name),b&&void 0!==e.price&&t.createElement("p",{style:J.productPrice},(a=e.price,o=e.currency,void 0===a?"":`${o||x}${a.toLocaleString()}`))));var a,o}))))),T?t.createElement("div",{style:J.footer},T):t.createElement("div",{style:J.footer},t.createElement("span",null,"Press ↵ to search, ↑↓ to navigate"),a&&t.createElement("button",{style:{...J.viewAllLink,background:"none",border:"none"},onClick:()=>V?.("suggestions")},'See all results for "',a,'"')),t.createElement("style",null,'\n .seekora-federated-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fef9c3);\n font-weight: 600;\n border-radius: 2px;\n padding: 0 2px;\n }\n .seekora-federated-dropdown [role="option"]:hover svg:last-child {\n opacity: 1;\n }\n '))}),oe="suggestions.click",ne="suggestions.impression",se="suggestions.product_click",ie="suggestions.category_click",le="suggestions.brand_click",ce="suggestions.tab_select",de="suggestions.recent_click",ue="suggestions.trending_click",pe="suggestions.search_submit",me="suggestions.dropdown_open",ge="suggestions.dropdown_close";function fe(e){const{client:r,enabled:a=!0,analyticsTags:o=[],impressionDebounce:n=500,trackImpressions:s=!0,trackClicks:i=!0,context:c}=e,u=t.useRef(null),p=t.useRef(null),m=t.useRef(null);t.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const g=t.useCallback(async(e,t,n)=>{if(!a||!r)return;const s=n??c;try{await(r.trackEvent?.({event_name:e,analytics_tags:o,metadata:{...t,timestamp:Date.now(),source:"suggestions_dropdown"}},s)),l(`Analytics: ${e}`,t)}catch(t){d(`Failed to track ${e}`,{error:t})}},[r,a,o,c]);return{trackSuggestionClick:t.useCallback(e=>{i&&g(oe,{suggestion_query:e.suggestion.query,suggestion_id:e.suggestion.objectID,suggestion_popularity:e.suggestion.popularity,position:e.position,section:e.section||"suggestions",original_query:e.query,total_suggestions:e.totalSuggestions})},[g,i]),trackProductClick:t.useCallback(e=>{if(!i)return;g(se,{product_id:e.product.id||e.product.objectID,product_title:e.product.title||e.product.name,product_price:e.product.price,position:e.position,section:e.section||"products",tab_id:e.tabId,original_query:e.query});const t=c;r?.trackClick&&Promise.resolve(r.trackClick(e.product.id||e.product.objectID||"",e.position+1,t)).catch(()=>{})},[r,c,g,i]),trackCategoryClick:t.useCallback((e,t)=>{i&&g(ie,{category_value:e.value,category_count:e.count,category_path:e.path,original_query:t})},[g,i]),trackBrandClick:t.useCallback((e,t)=>{i&&g(le,{brand_name:e.name,brand_count:e.count,original_query:t})},[g,i]),trackTabSelect:t.useCallback((e,t)=>{g(ce,{tab_id:e.id,tab_label:e.label,tab_filter:e.filter,products_count:e.products?.length||0,nb_hits:e.nb_hits,original_query:t})},[g]),trackRecentSearchClick:t.useCallback(e=>{i&&g(de,{query:e.query,original_timestamp:e.timestamp,results_count:e.resultsCount})},[g,i]),trackTrendingClick:t.useCallback((e,t)=>{i&&g(ue,{query:e.query,count:e.count,trend_score:e.trend_score,position:t})},[g,i]),trackImpression:t.useCallback(e=>{if(!s)return;const t=`${e.query}:${e.suggestions.length}:${e.products?.length||0}`;t!==p.current&&(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{p.current=t,g(ne,{query:e.query,suggestions_count:e.suggestions.length,suggestions:e.suggestions.slice(0,10).map((e,t)=>({query:e.query,position:t,popularity:e.popularity})),products_count:e.products?.length||0,categories_count:e.categories?.length||0,brands_count:e.brands?.length||0,impression_timestamp:e.timestamp})},n))},[g,s,n]),trackSearchSubmit:t.useCallback((e,t,r)=>{g(pe,{query:e,from_suggestion:t,suggestion_query:r?.query,suggestion_id:r?.objectID,suggestion_popularity:r?.popularity})},[g]),trackDropdownOpen:t.useCallback(e=>{m.current=Date.now(),g(me,{query:e,has_query:e.length>0})},[g]),trackDropdownClose:t.useCallback((e,t)=>{const r=m.current?Date.now()-m.current:null;g(ge,{query:e,selected_suggestion:t,had_selection:!!t,duration_ms:r}),m.current=null},[g])}}const he={wrapper:{position:"relative",width:"100%"},inputWrapper:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius-lg, 8px)",overflow:"hidden",transition:"border-color 150ms ease, box-shadow 150ms ease"},inputWrapperFocused:{borderColor:"var(--seekora-primary, #3b82f6)",boxShadow:"0 0 0 3px var(--seekora-primary-light, rgba(59, 130, 246, 0.1))"},input:{flex:1,padding:"12px 16px",fontSize:"16px",border:"none",outline:"none",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",fontFamily:"inherit"},searchIcon:{width:"20px",height:"20px",color:"var(--seekora-text-secondary, #9ca3af)",marginLeft:"12px",flexShrink:0},clearButton:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",marginRight:"4px",padding:0,border:"none",backgroundColor:"transparent",color:"var(--seekora-text-secondary, #9ca3af)",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms ease, color 150ms ease"},searchButton:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"12px 20px",margin:"4px",border:"none",backgroundColor:"var(--seekora-primary, #3b82f6)",color:"white",borderRadius:"var(--seekora-border-radius, 6px)",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"background-color 150ms ease"}},ye=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:he.searchIcon},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),be=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",style:{width:16,height:16}},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})),xe=t.forwardRef(function(e,r){const{variant:a="classic",placeholder:o="Search...",initialQuery:n="",value:s,onQueryChange:i,onSearch:l,onSuggestionSelect:c,onProductClick:d,showSearchButton:u=!1,searchButtonText:p="Search",showClearButton:m=!0,autoFocus:g=!1,minQueryLength:f=1,maxSuggestions:h=8,maxProducts:y=8,debounceMs:b=200,showRecentSearches:x=!0,showTrendingOnEmpty:v=!0,includeDropdownRecommendations:k=!1,filteredTabs:E,enableAnalytics:w=!0,analyticsTags:C,includeFacets:R,includeCategories:N,dropdownWidth:T,dropdownMaxHeight:A,classNames:z={},style:M,inputStyle:_,ariaLabel:L="Search"}=e,{client:P}=S(),B=t.useRef(null),D=t.useRef(null),[$,F]=t.useState(s??n),[W,q]=t.useState(!1),[H,O]=t.useState(!1),V=fe({client:P,enabled:w,analyticsTags:C});t.useEffect(()=>{void 0!==s&&s!==$&&F(s)},[s]);const Q=t.useCallback(e=>{const t=e.target.value;F(t),i?.(t),(t.length>=f||v&&0===t.length)&&O(!0)},[i,f,v]),U=t.useCallback(e=>{e?.preventDefault(),$.trim()&&(l?.($.trim()),V.trackSearchSubmit($.trim(),!1),O(!1))},[$,l,V]),G=t.useCallback(e=>{F(e.query),i?.(e.query),c?.(e),V.trackSuggestionClick({suggestion:e,position:0,query:$}),O(!1),l?.(e.query)},[$,i,c,l,V]),K=t.useCallback(e=>{d?.(e),V.trackProductClick({product:e,position:0,query:$}),O(!1)},[$,d,V]),X=t.useCallback(e=>{F(e.query),i?.(e.query),V.trackRecentSearchClick(e),O(!1),l?.(e.query)},[i,l,V]),J=t.useCallback(()=>{q(!0),O(!0),V.trackDropdownOpen($)},[$,V]),Z=t.useCallback(()=>{q(!1),setTimeout(()=>{O(!1),V.trackDropdownClose($)},200)},[$,V]),ee=t.useCallback(()=>{F(""),i?.(""),B.current?.focus()},[i]),te=t.useCallback(e=>{if(H)switch(e.key){case"ArrowDown":e.preventDefault(),D.current?.navigateNext?.();break;case"ArrowUp":e.preventDefault(),D.current?.navigatePrevious?.();break;case"Enter":e.preventDefault(),(D.current?.getActiveIndex?.()??-1)>=0?D.current?.selectActive?.():U();break;case"Escape":e.preventDefault(),O(!1),B.current?.blur()}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key||O(!0)},[H,U]);t.useImperativeHandle(r,()=>({focus:()=>B.current?.focus(),blur:()=>B.current?.blur(),clear:ee,getQuery:()=>$,setQuery:e=>{F(e),i?.(e)},openDropdown:()=>O(!0),closeDropdown:()=>O(!1),navigateNext:()=>D.current?.navigateNext?.(),navigatePrevious:()=>D.current?.navigatePrevious?.(),selectCurrent:()=>D.current?.selectActive?.()}),[$,ee,i]);return t.createElement("div",{className:I("seekora-search-bar-with-suggestions",z.wrapper),style:{...he.wrapper,...M}},t.createElement("form",{onSubmit:U},t.createElement("div",{style:{...he.inputWrapper,...W?he.inputWrapperFocused:{}}},t.createElement(ye,null),t.createElement("input",{ref:B,type:"text",value:$,onChange:Q,onFocus:J,onBlur:Z,onKeyDown:te,placeholder:o,autoFocus:g,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":L,"aria-expanded":H,"aria-haspopup":"listbox","aria-autocomplete":"list",role:"combobox",className:z.input,style:{...he.input,..._}}),m&&$&&t.createElement("button",{type:"button",onClick:ee,className:z.clearButton,style:he.clearButton,"aria-label":"Clear search"},t.createElement(be,null)),u&&t.createElement("button",{type:"submit",className:z.button,style:he.searchButton},p))),t.createElement("div",{className:z.dropdown},(()=>{const e={query:$,isOpen:H,maxSuggestions:h,minQueryLength:f,debounceMs:b,showRecentSearches:x,classNames:z,onSuggestionSelect:G,onRecentSearchClick:X,onClose:()=>O(!1),analyticsTags:C};switch(a){case"rich":return t.createElement(Y,{ref:D,...e,includeDropdownRecommendations:k,includeCategories:!0,width:T||"100%",maxHeight:A||"480px"});case"federated":return t.createElement(ae,{ref:D,...e,maxProducts:y,filteredTabs:E,showProducts:!0,showBrands:!0,showFilteredTabs:!!E,onProductClick:K,width:T||"800px",maxHeight:A||"600px",includeFacets:R,includeCategories:N,includeDropdownRecommendations:k});case"compact":return t.createElement(j,{ref:D,...e,maxSuggestions:5,showCounts:!1,width:T||"100%"});default:return t.createElement(j,{ref:D,...e,width:T||"100%"})}})()))}),ve=t.createContext(null);function ke(){const e=t.useContext(ve);if(!e){const e=new Error("useSuggestionsContext must be used within a SuggestionsProvider");throw u("SuggestionsContext: not available",{error:e.message}),e}return e}function Ee({children:e,minQueryLength:r=1,debounceMs:a=200,maxSuggestions:o=10,includeDropdownRecommendations:n=!0,filteredTabs:s,enableAnalytics:i=!0,analyticsTags:l,onSearch:c,onSuggestionSelect:d,onProductClick:u}){const{client:p}=S(),[m,g]=t.useState(""),[f,h]=t.useState(!1),[y,b]=t.useState(-1),[x,v]=t.useState(""),k=$({client:p,query:m,enabled:f,minQueryLength:r,debounceMs:a,maxSuggestions:o,includeDropdownRecommendations:n,filteredTabs:s,includeCategories:!0,enableRecentSearches:!0,maxRecentSearches:8,analyticsTags:l}),E=fe({client:p,enabled:i,analyticsTags:l,trackClicks:!0,trackImpressions:!0}),{suggestions:w,recentSearches:C,trendingSearches:R,trendingProducts:I,filteredTabs:N,loading:T,error:A,hasContent:z,getAllNavigableItems:M,addRecentSearch:_}=k,L=t.useRef(c),P=t.useRef(d),B=t.useRef(u);L.current=c,P.current=d,B.current=u;const D=t.useCallback(e=>{g(e),b(-1)},[]),F=t.useCallback(()=>{E.trackDropdownClose(m),h(!1),b(-1)},[E,m]),W=t.useCallback(e=>{e?(h(!0),E.trackDropdownOpen(m)):F()},[E,m,F]),q=t.useCallback((e,t)=>{E.trackSuggestionClick({suggestion:e,position:t,query:m,totalSuggestions:w.length}),D(e.query),P.current?.(e),E.trackSearchSubmit(e.query,!0,e),_(e.query),F(),L.current?.(e.query)},[E,m,w.length,_,F]),H=t.useCallback((e,t,r,a)=>{E.trackProductClick({product:e,position:t,section:r??"products",tabId:a,query:m}),F(),B.current?.(e)},[E,m,F]),O=t.useCallback(e=>{E.trackRecentSearchClick(e),D(e.query),F(),L.current?.(e.query),E.trackSearchSubmit(e.query,!1)},[E,F]),j=t.useCallback((e,t)=>{E.trackTrendingClick(e,t),D(e.query),F(),L.current?.(e.query),E.trackSearchSubmit(e.query,!1)},[E,F]),V=t.useCallback(e=>{v(e.id),E.trackTabSelect(e,m)},[E,m]),Q=t.useCallback((e,t,r)=>{const a=e.trim();a&&(E.trackSearchSubmit(a,!!t,r),_(a),F(),L.current?.(a))},[E,_,F]),U=t.useCallback(()=>{const e=M();0!==e.length&&b(t=>t<e.length-1?t+1:0)},[M]),G=t.useCallback(()=>{const e=M();0!==e.length&&b(t=>t<=0?e.length-1:t-1)},[M]),K=t.useCallback(()=>{const e=M();if(y<0||y>=e.length)return void Q(m);const t=e[y];switch(t.type){case"suggestion":q(t.data,t.index);break;case"product":H(t.data,t.index,"products");break;case"recent":O(t.data);break;case"trending":j(t.data,t.index);break;default:Q(m)}},[y,M,m,Q,q,H,O,j]);t.useEffect(()=>{f&&z&&m&&E.trackImpression({suggestions:w,products:I,query:m,timestamp:Date.now()})},[f,z,m,w,I,E]);const X=t.useMemo(()=>({query:m,setQuery:D,isOpen:f,setIsOpen:W,activeIndex:y,setActiveIndex:b,suggestions:w,recentSearches:C,trendingSearches:R,trendingProducts:I,filteredTabs:N,activeTabId:x,setActiveTabId:v,loading:T,error:A,hasContent:z,getAllNavigableItems:M,selectSuggestion:q,selectProduct:H,selectRecentSearch:O,selectTrendingSearch:j,setActiveTab:V,submitSearch:Q,close:F,navigateNext:U,navigatePrev:G,selectActive:K}),[m,D,f,W,y,b,w,C,R,I,N,x,v,T,A,z,M,q,H,O,j,V,Q,F,U,G,K]);return t.createElement(ve.Provider,{value:X},e)}const Se={position:"relative",width:"100%"},we={display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:"var(--seekora-bg-surface, #fff)",transition:"border-color 150ms ease, box-shadow 150ms ease"},Ce={flex:1,minWidth:0,padding:"8px 0",border:"none",outline:"none",backgroundColor:"transparent",fontSize:"inherit",color:"var(--seekora-text-primary, #111827)",fontFamily:"inherit"};function Re({placeholder:e="Search...",autoFocus:r=!1,showClearButton:a=!0,closeOnBlur:o=!0,leftIcon:n,className:s,style:i,inputClassName:l,inputStyle:c,ariaLabel:d="Search"}){const{query:u,setQuery:p,isOpen:m,setIsOpen:g,navigateNext:f,navigatePrev:h,selectActive:y,close:b}=ke(),x=t.useRef(null),v=t.useCallback(()=>{g(!0)},[g]),k=t.useCallback(()=>{o&&setTimeout(()=>b(),200)},[b,o]),E=t.useCallback(e=>{p(e.target.value)},[p]),S=t.useCallback(e=>"ArrowDown"===e.key?(e.preventDefault(),void f()):"ArrowUp"===e.key?(e.preventDefault(),void h()):"Enter"===e.key?(e.preventDefault(),void y()):"Escape"===e.key?(e.preventDefault(),b(),void x.current?.blur()):void 0,[f,h,y,b]),w=t.useCallback(()=>{p(""),x.current?.focus()},[p]);return t.createElement("div",{className:I("seekora-suggestions-search-input-wrapper",s),style:{...Se,...i}},t.createElement("div",{className:"seekora-suggestions-input-wrapper",style:we},n?t.createElement("span",{className:"seekora-suggestions-input-left-icon",style:{display:"flex",flexShrink:0,color:"var(--seekora-text-secondary, #6b7280)"}},n):null,t.createElement("input",{ref:x,type:"text",value:u,onChange:E,onFocus:v,onBlur:k,onKeyDown:S,placeholder:e,autoFocus:r,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":d,"aria-expanded":m,"aria-haspopup":"listbox","aria-autocomplete":"list",role:"combobox",className:I("seekora-suggestions-input",l),style:{...Ce,...c}}),a&&u?t.createElement("button",{type:"button",onClick:w,className:"seekora-suggestions-input-clear","aria-label":"Clear search",style:{padding:4,border:"none",background:"transparent",cursor:"pointer",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement(Ie,null)):null))}function Ie(){return t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))}function Ne({children:e,position:r="absolute",top:a="100%",left:o=0,right:n,width:s="100%",maxHeight:i="80vh",zIndex:l=1e3,className:c,style:d,closeOnClickOutside:u=!0,closeOnEscape:p=!0}){const{isOpen:m,close:g}=ke(),f=t.useRef(null);t.useEffect(()=>{if(!p||!m)return;const e=e=>{"Escape"===e.key&&g()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,m,g]);const h=t.useCallback(e=>{if(!u||!f.current)return;const t=e.target;f.current.contains(t)||g()},[u,g]);if(t.useEffect(()=>{if(m)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m,h]),!m)return null;const y={position:r,top:a,left:o,right:n,width:s,maxHeight:i,zIndex:l,overflow:"auto",backgroundColor:"var(--seekora-bg-surface, #fff)",border:"1px solid var(--seekora-border-color, #e5e7eb)",borderRadius:"var(--seekora-border-radius, 6px)",boxShadow:"var(--seekora-shadow-lg, 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05))",marginTop:4};return t.createElement("div",{ref:f,role:"listbox",className:I("seekora-suggestions-dropdown-panel",c),style:{...y,...d}},e)}const Te={backgroundColor:"var(--seekora-highlight-bg, rgba(251, 191, 36, 0.4))",fontWeight:500,borderRadius:"2px",padding:"0 2px"};function Ae(e,r={}){if(null==e||"string"!=typeof e)return e;const a=e.split(/(<mark>[\s\S]*?<\/mark>)/g);if(a.length<=1)return e;const{markClassName:o,markStyle:n}=r;return t.createElement(t.Fragment,null,a.map((e,r)=>{const a=e.match(/^<mark>([\s\S]*)<\/mark>$/);return a?t.createElement("mark",{key:r,className:o,style:{...Te,...n}},a[1]):e}))}const ze={padding:"10px 12px",cursor:"pointer",listStyle:"none",border:"none",width:"100%",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",transition:"background-color 120ms ease"};function Me({suggestion:e,index:r,isActive:a,onSelect:o,className:n,style:s,enableHighlightMarkup:i=!0,highlightMarkupOptions:l,renderHighlight:c}){const d=e.highlightedQuery??e.query,u=null!=c?c(d):i?Ae(d??"",l):e.query??d??"";return t.createElement("li",{role:"option","aria-selected":a,id:`seekora-suggestion-${r}`,className:I("seekora-suggestions-item",a&&"seekora-suggestions-item--active",n),style:{...ze,...a?{backgroundColor:"var(--seekora-bg-hover, #f3f4f6)"}:{},...s},onMouseDown:e=>{e.preventDefault(),o()}},u,null!=e.count?t.createElement("span",{className:"seekora-suggestions-item-count",style:{marginLeft:8,color:"var(--seekora-text-secondary, #6b7280)",fontSize:"0.875em"}},e.count):null)}function _e({className:e,style:r,text:a="Loading..."}){const{loading:o}=ke();return o?t.createElement("div",{className:I("seekora-suggestions-loading",e),style:{padding:16,color:"var(--seekora-text-secondary, #6b7280)",fontSize:"0.875rem",...r}},a):null}const Le={margin:0,padding:"4px 0"};function Pe({maxItems:e=10,className:r,style:a,listClassName:o,enableHighlightMarkup:n=!0,highlightMarkupOptions:s,renderItem:i}){const{suggestions:l,activeIndex:c,loading:d,selectSuggestion:u,getAllNavigableItems:p}=ke(),m=l.slice(0,e),g=p().findIndex(e=>"suggestion"===e.type),f=g>=0&&c>=g&&c<g+m.length;return d?t.createElement(_e,{className:r,style:a}):0===m.length?null:t.createElement("div",{className:I("seekora-suggestions-list",r),style:a},t.createElement("ul",{className:I("seekora-suggestions-list-ul",o),style:Le,role:"listbox"},m.map((e,r)=>{const a=g>=0?g+r:r,o=f&&c===a,l=()=>u(e,a);return i?t.createElement("li",{key:e.objectID??e.query??r,role:"option"},i(e,a,o,l)):t.createElement(Me,{key:e.objectID??e.query??r,suggestion:e,index:a,isActive:o,onSelect:l,enableHighlightMarkup:n,highlightMarkupOptions:s})})))}const Be={width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:4,backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"};function De({images:e,variant:r="single",alt:a="",className:o,style:n,carouselAutoplay:s=!1,carouselIntervalMs:i=4e3}){const[l,c]=t.useState(0),[d,u]=t.useState(!1),p=Array.isArray(e)?e.filter(Boolean):[],m=p[l]??p[0];if(0===p.length)return t.createElement("div",{className:I("seekora-img-display","seekora-img-placeholder",o),style:{...Be,...n},"aria-hidden":!0});if("single"===r)return t.createElement("img",{src:p[0],alt:a,className:I("seekora-img-display","seekora-img-single",o),style:{...Be,...n},loading:"lazy"});if("hover"===r){const e=p.length>1&&d?p[1]:p[0];return t.createElement("div",{className:I("seekora-img-display","seekora-img-hover",o),style:{position:"relative",...n},onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1)},t.createElement("img",{src:e,alt:a,className:"seekora-img-hover-img",style:Be,loading:"lazy"}))}if("carousel"===r){const e=e=>{c(t=>{const r=t+e;return r<0?p.length-1:r>=p.length?0:r})};return t.createElement("div",{className:I("seekora-img-display","seekora-img-carousel",o),style:{position:"relative",...n}},t.createElement("img",{src:m,alt:a,className:"seekora-img-carousel-main",style:Be,loading:"lazy"}),p.length>1&&t.createElement(t.Fragment,null,t.createElement("button",{type:"button","aria-label":"Previous",className:"seekora-img-carousel-prev",style:$e(!0),onMouseDown:()=>e(-1)}),t.createElement("button",{type:"button","aria-label":"Next",className:"seekora-img-carousel-next",style:$e(!1),onMouseDown:()=>e(1)})))}return"thumbStrip"===r||"thumbList"===r?t.createElement("div",{className:I("seekora-img-display","seekora-img-thumbstrip",o),style:{display:"flex",flexDirection:"column",gap:8,...n}},t.createElement("img",{src:m,alt:a,className:"seekora-img-thumb-main",style:Be,loading:"lazy"}),t.createElement("div",{className:"seekora-img-thumbs",style:{display:"flex",gap:4,overflowX:"auto",paddingBottom:4}},p.map((e,r)=>t.createElement("button",{type:"button",key:r,className:I("seekora-img-thumb",r===l&&"seekora-img-thumb--active"),style:{flexShrink:0,width:48,height:48,padding:0,border:r===l?"2px solid var(--seekora-primary)":"1px solid transparent",borderRadius:4,overflow:"hidden",cursor:"pointer",background:"none"},onMouseDown:()=>c(r)},t.createElement("img",{src:e,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}))))):t.createElement("img",{src:m,alt:a,className:I("seekora-img-display",o),style:{...Be,...n},loading:"lazy"})}function $e(e){return{position:"absolute",top:"50%",[e?"left":"right"]:8,transform:"translateY(-50%)",width:32,height:32,borderRadius:"50%",border:"1px solid var(--seekora-border-color)",backgroundColor:"var(--seekora-bg-surface)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"}}const Fe={display:"flex",flexDirection:"column",gap:8,padding:8,cursor:"pointer",border:"none",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:"transparent",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",transition:"background-color 120ms ease"},We={width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:4,backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"};function qe({item:e,position:r,onSelect:a,className:o,style:n,asLink:s=!0,imageVariant:i="single"}){const l=e.images?.length?e.images:e.image??e.imageUrl?[String(e.image??e.imageUrl)]:[],c=e.title??e.primaryText??"",d=e.description??e.secondaryText,u=e.url,p=t.createElement(t.Fragment,null,l.length>0?t.createElement(De,{images:l,variant:i,alt:String(c),className:"seekora-item-card-image"}):t.createElement("div",{className:"seekora-item-card-placeholder",style:We,"aria-hidden":!0}),t.createElement("span",{className:"seekora-item-card-title",style:{fontSize:"0.875rem",fontWeight:500}},String(c)),d?t.createElement("span",{className:"seekora-item-card-description",style:{fontSize:"0.8125rem",color:"var(--seekora-text-secondary, #6b7280)",lineHeight:1.3}},String(d)):null),m={className:I("seekora-item-card",o),style:{...Fe,...n},"data-position":r,onClick:a,onMouseDown:a?e=>{e.preventDefault(),a()}:void 0};return s&&u?t.createElement("a",{href:u,...m,"data-item-id":e.id},p):t.createElement("button",{type:"button",...m,"data-item-id":e.id},p)}const He={display:"grid",gridTemplateColumns:"repeat(var(--seekora-grid-cols, 4), minmax(0, 1fr))",gap:12,padding:12};function Oe({items:e,onItemClick:r,getItemId:a=e=>e.id,getItemTitle:o=e=>e.title,getItemImage:n=e=>e.image,getItemDescription:s=e=>e.description,getItemUrl:i=e=>e.url,renderItem:l,maxItems:c=24,columns:d=4,className:u,style:p,gridClassName:m}){const g=e.slice(0,c);if(0===g.length)return null;const f={...He,gridTemplateColumns:`repeat(${d}, minmax(0, 1fr))`};return t.createElement("div",{className:I("seekora-item-grid",u),style:p},t.createElement("div",{className:I("seekora-item-grid-inner",m),style:f},g.map((e,c)=>{if(l)return t.createElement(t.Fragment,{key:a(e)},l(e,c));const d=function(e,t,r,a,o,n){return{id:t(e),title:r(e),image:a?.(e),description:o?.(e),url:n?.(e),..."object"==typeof e&&null!==e?e:{}}}(e,a,o,n,s,i);return t.createElement(qe,{key:d.id,item:d,position:c,onSelect:r?()=>r(e,c):void 0})})))}const je={display:"flex",flexDirection:"column",gap:8,padding:8,cursor:"pointer",border:"none",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:"transparent",textAlign:"left",transition:"background-color 120ms ease"},Ve={width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:4,backgroundColor:"var(--seekora-bg-secondary, #f3f4f6)"};function Qe({product:e,position:r,section:a,tabId:o,onSelect:n,className:s,style:i,imageVariant:l="single"}){const c=e.images?.length?e.images:e.image??e.imageUrl?[String(e.image??e.imageUrl)]:[],d=e.title??e.name??"",u=null!=e.price?"number"==typeof e.price?e.price:Number(e.price):null;return t.createElement("button",{type:"button",className:I("seekora-suggestions-product-card",s),style:{...je,...i},onMouseDown:e=>{e.preventDefault(),n()},"data-position":r,"data-section":a,"data-tab-id":o},c.length>0?t.createElement(De,{images:c,variant:l,alt:d,className:"seekora-suggestions-product-card-image"}):t.createElement("div",{className:"seekora-suggestions-product-card-placeholder",style:Ve,"aria-hidden":!0}),t.createElement("span",{className:"seekora-suggestions-product-card-title",style:{fontSize:"0.875rem",fontWeight:500}},d),null==u||Number.isNaN(u)?null:t.createElement("span",{className:"seekora-suggestions-product-card-price",style:{fontSize:"0.875rem",color:"var(--seekora-text-secondary, #6b7280)"}},e.currency??"$",u.toFixed(2)))}function Ue({maxItems:e=8,source:r="trending",columns:a=4,className:o,style:n,gridClassName:s}){const{trendingProducts:i,filteredTabs:l,activeTabId:c,selectProduct:d,getAllNavigableItems:u}=ke(),p=t.useMemo(()=>{if("trending"===r)return i;const e=l.find(e=>e.id===("tab"===r?c:r));return e?.products??[]},[r,c,i,l]).slice(0,e),m=u().findIndex(e=>"product"===e.type);if(0===p.length)return null;const g={display:"grid",gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`,gap:12,padding:12};return t.createElement("div",{className:I("seekora-suggestions-product-grid",o),style:n},t.createElement("div",{className:I("seekora-suggestions-product-grid-inner",s),style:g},p.map((e,a)=>{const o=m>=0?m+a:a,n="trending"===r?"products":"filtered_tab",s="trending"!==r?"tab"===r?c:r:void 0;return t.createElement(Qe,{key:e.id??e.objectID??a,product:e,position:o,section:n,tabId:s,onSelect:()=>d(e,o,n,s)})})))}function Ge({className:e,style:r,tabClassName:a}){const{filteredTabs:o,activeTabId:n,setActiveTab:s}=ke();return 0===o.length?null:t.createElement("div",{className:I("seekora-suggestions-categories-tabs",e),style:{display:"flex",gap:4,padding:"8px 12px",borderBottom:"1px solid var(--seekora-border-color, #e5e7eb)",overflowX:"auto",...r},role:"tablist"},o.map(e=>{const r=n===e.id;return t.createElement("button",{key:e.id,type:"button",role:"tab","aria-selected":r,className:I("seekora-suggestions-tab",r&&"seekora-suggestions-tab--active",a),style:{padding:"8px 12px",border:"none",borderRadius:"var(--seekora-border-radius, 6px)",backgroundColor:r?"var(--seekora-primary-light, rgba(59, 130, 246, 0.1))":"transparent",color:r?"var(--seekora-primary, #3b82f6)":"var(--seekora-text-primary, #111827)",cursor:"pointer",fontSize:"0.875rem",fontWeight:r?600:400,whiteSpace:"nowrap",transition:"background-color 120ms ease"},onClick:()=>s(e)},e.label)}))}const Ke={padding:"10px 12px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",transition:"background-color 120ms ease"};function Xe({title:e="Recent",maxItems:r=8,className:a,style:o,listClassName:n,renderItem:s}){const{recentSearches:i,query:l,selectRecentSearch:c}=ke(),d=i.slice(0,r);return 0===d.length?null:t.createElement("div",{className:I("seekora-suggestions-recent-list",a),style:o},e?t.createElement("div",{className:"seekora-suggestions-recent-title",style:{padding:"8px 12px",fontSize:"0.75rem",fontWeight:600,color:"var(--seekora-text-secondary, #6b7280)",textTransform:"uppercase"}},e):null,t.createElement("ul",{className:I("seekora-suggestions-recent-ul",n),style:{margin:0,padding:0,listStyle:"none"}},d.map((e,r)=>{const a=()=>c(e);return s?t.createElement("li",{key:`${e.query}-${e.timestamp}`},s(e,r,a)):t.createElement("li",{key:`${e.query}-${e.timestamp}`},t.createElement("button",{type:"button",className:"seekora-suggestions-recent-item",style:Ke,onMouseDown:e=>{e.preventDefault(),a()}},e.query))})))}const Ye={padding:"10px 12px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",fontSize:"inherit",fontFamily:"inherit",backgroundColor:"transparent",color:"var(--seekora-text-primary, #111827)",transition:"background-color 120ms ease"};function Je({title:e="Trending",maxItems:r=8,className:a,style:o,listClassName:n,renderItem:s}){const{trendingSearches:i,selectTrendingSearch:l}=ke(),c=i.slice(0,r);return 0===c.length?null:t.createElement("div",{className:I("seekora-suggestions-trending-list",a),style:o},e?t.createElement("div",{className:"seekora-suggestions-trending-title",style:{padding:"8px 12px",fontSize:"0.75rem",fontWeight:600,color:"var(--seekora-text-secondary, #6b7280)",textTransform:"uppercase"}},e):null,t.createElement("ul",{className:I("seekora-suggestions-trending-ul",n),style:{margin:0,padding:0,listStyle:"none"}},c.map((e,r)=>{const a=()=>l(e,r);return s?t.createElement("li",{key:`${e.query}-${r}`},s(e,r,a)):t.createElement("li",{key:`${e.query}-${r}`},t.createElement("button",{type:"button",className:"seekora-suggestions-trending-item",style:Ye,onMouseDown:e=>{e.preventDefault(),a()}},e.query,null!=e.count?t.createElement("span",{style:{marginLeft:8,color:"var(--seekora-text-secondary, #6b7280)",fontSize:"0.875em"}},e.count):null))})))}function Ze({className:e,style:r,render:a}){const{error:o}=ke();return o?a?t.createElement(t.Fragment,null,a(o)):t.createElement("div",{className:I("seekora-suggestions-error",e),style:{padding:16,color:"var(--seekora-error, #dc2626)",fontSize:"0.875rem",...r}},o.message):null}const et=t.createContext(null);function tt(){const e=t.useContext(et);if(!e){const e=new Error("useSectionSearchContext must be used within a SectionSearchProvider");throw u("SectionSearchContext: not available",{error:e.message}),e}return e}function rt({className:e,style:r,text:a="Loading..."}){const{loading:o}=tt();return o?t.createElement("div",{className:e,style:{padding:16,color:"var(--seekora-text-secondary)",fontSize:"0.875rem",...r}},a):null}function at({className:e,style:r,render:a}){const{error:o}=tt();return o?a?t.createElement(t.Fragment,null,a(o)):t.createElement("div",{className:e,style:{padding:16,color:"var(--seekora-error,#dc2626)",fontSize:"0.875rem",...r}},o.message):null}const ot=(e,t)=>{if(e&&t)return t.split(".").reduce((e,t)=>{if(null!=e)return e[t]},e)},nt=(e,t={query:"query"})=>({query:ot(e,t.query)??"",count:t.count?ot(e,t.count):void 0,id:t.id?ot(e,t.id):e?.objectID||e?.id,categories:t.categories?ot(e,t.categories):void 0,highlighted:t.highlighted?ot(e,t.highlighted):void 0,_raw:e}),st=(e,t={id:"id",title:"title"})=>({id:ot(e,t.id)??e?.objectID??e?.id,title:ot(e,t.title)??"",image:t.image?ot(e,t.image):void 0,price:t.price?ot(e,t.price):void 0,comparePrice:t.comparePrice?ot(e,t.comparePrice):void 0,url:t.url?ot(e,t.url):void 0,brand:t.brand?ot(e,t.brand):void 0,category:t.category?ot(e,t.category):void 0,rating:t.rating?ot(e,t.rating):void 0,reviewCount:t.reviewCount?ot(e,t.reviewCount):void 0,discount:t.discount?ot(e,t.discount):void 0,inStock:t.inStock?ot(e,t.inStock):void 0,currency:t.currency?ot(e,t.currency):void 0,_raw:e}),it=(e,t={id:"id",label:"label"})=>({id:ot(e,t.id)??e?.id,label:ot(e,t.label)??"",count:t.count?ot(e,t.count):void 0,icon:t.icon?ot(e,t.icon):void 0,image:t.image?ot(e,t.image):void 0,_raw:e}),lt=(e,t={})=>{if(null==e)return"";const{currency:r="$",currencyPosition:a="before",priceDecimals:o=2}=t,n="string"==typeof e?parseFloat(e):e;if(isNaN(n))return String(e);const s=n.toLocaleString(void 0,{minimumFractionDigits:o,maximumFractionDigits:o});return"before"===a?`${r}${s}`:`${s}${r}`},ct=e=>{const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,e=>t[e])},dt=(e,t,r={})=>{if(!t||!e)return ct(e);const{tag:a="mark",className:o="",style:n}=r,s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=n?` style="${Object.entries(n).map(([e,t])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${t}`).join(";")}"`:"",l=o?` class="${o}"`:"";return ct(e).replace(new RegExp(`(${ct(s)})`,"gi"),`<${a}${l}${i}>$1</${a}>`)},ut=(e,t="seekora")=>{const r={};return e.primaryColor&&(r[`--${t}-primary`]=e.primaryColor),e.backgroundColor&&(r[`--${t}-bg-surface`]=e.backgroundColor),e.surfaceColor&&(r[`--${t}-bg-secondary`]=e.surfaceColor),e.textColor&&(r[`--${t}-text-primary`]=e.textColor),e.textSecondaryColor&&(r[`--${t}-text-secondary`]=e.textSecondaryColor),e.borderColor&&(r[`--${t}-border-color`]=e.borderColor),e.hoverColor&&(r[`--${t}-bg-hover`]=e.hoverColor),e.highlightColor&&(r[`--${t}-highlight-bg`]=e.highlightColor),e.successColor&&(r[`--${t}-success`]=e.successColor),e.errorColor&&(r[`--${t}-error`]=e.errorColor),e.fontFamily&&(r[`--${t}-font-family`]=e.fontFamily),e.fontSize&&(r[`--${t}-font-size`]="number"==typeof e.fontSize?`${e.fontSize}px`:e.fontSize),e.borderRadius&&(r[`--${t}-border-radius`]="number"==typeof e.borderRadius?`${e.borderRadius}px`:e.borderRadius),e.boxShadow&&(r[`--${t}-box-shadow`]=e.boxShadow),e.cssVariables&&Object.entries(e.cssVariables).forEach(([e,t])=>{r[e.startsWith("--")?e:`--${e}`]=t}),r},pt=(...e)=>e.filter(Boolean).join(" "),mt=(...e)=>Object.assign({},...e.filter(Boolean)),gt="seekora_recent_searches",ft=e=>{try{const t=e?`${gt}_${e}`:gt,r=localStorage.getItem(t);return r?JSON.parse(r):[]}catch{return[]}},ht=(e,t)=>{try{const r=t?`${gt}_${t}`:gt;let a=ft(t);return a=a.filter(t=>t!==e),a.unshift(e),a=a.slice(0,10),localStorage.setItem(r,JSON.stringify(a)),a}catch{return[]}},yt=(e,t)=>{try{const r=t?`${gt}_${t}`:gt;let a=ft(t);return a=a.filter(t=>t!==e),localStorage.setItem(r,JSON.stringify(a)),a}catch{return[]}},bt=(e,t)=>{const r=e.getBoundingClientRect(),a=t.getBoundingClientRect();r.top<a.top?e.scrollIntoView({block:"start",behavior:"smooth"}):r.bottom>a.bottom&&e.scrollIntoView({block:"end",behavior:"smooth"})};class xt{constructor(e={}){this.cache=new Map,this.maxSize=e.maxSize??100,this.defaultTtl=e.defaultTtlMs??3e4}generateKey(e,t){const r=e.toLowerCase().trim();if(!t)return r;const a=Object.keys(t).sort().filter(e=>void 0!==t[e]&&null!==t[e]).map(e=>`${e}:${JSON.stringify(t[e])}`).join("|");return a?`${r}::${a}`:r}get(e){const t=this.cache.get(e);if(!t)return null;return Date.now()-t.timestamp>t.ttl?(this.cache.delete(e),null):t.data}set(e,t,r){if(this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(e,{data:t,timestamp:Date.now(),ttl:r??this.defaultTtl})}has(e){return null!==this.get(e)}clear(){this.cache.clear()}cleanup(){const e=Date.now();for(const[t,r]of this.cache.entries())e-r.timestamp>r.ttl&&this.cache.delete(t)}getStats(){return{size:this.cache.size,maxSize:this.maxSize}}}let vt=null;const kt=e=>(vt||(vt=new xt(e)),vt),Et={xs:0,sm:480,md:768,lg:1024,xl:1280},St={xs:`@media (max-width: ${Et.sm-1}px)`,sm:`@media (min-width: ${Et.sm}px) and (max-width: ${Et.md-1}px)`,md:`@media (min-width: ${Et.md}px) and (max-width: ${Et.lg-1}px)`,lg:`@media (min-width: ${Et.lg}px) and (max-width: ${Et.xl-1}px)`,xl:`@media (min-width: ${Et.xl}px)`,mobile:`@media (max-width: ${Et.md-1}px)`,tablet:`@media (min-width: ${Et.md}px) and (max-width: ${Et.lg-1}px)`,desktop:`@media (min-width: ${Et.lg}px)`,touch:"@media (hover: none) and (pointer: coarse)",mouse:"@media (hover: hover) and (pointer: fine)"},wt={minimum:44,comfortable:48,large:56},Ct=()=>{const[e,r]=t.useState({isMobile:!1,isTablet:!1,isDesktop:!0,isTouch:!1,width:"undefined"!=typeof window?window.innerWidth:1024,height:"undefined"!=typeof window?window.innerHeight:768,breakpoint:"lg"});return t.useEffect(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth,t=window.innerHeight,a=(e=>e<Et.sm?"xs":e<Et.md?"sm":e<Et.lg?"md":e<Et.xl?"lg":"xl")(e),o="ontouchstart"in window||navigator.maxTouchPoints>0;r({isMobile:e<Et.md,isTablet:e>=Et.md&&e<Et.lg,isDesktop:e>=Et.lg,isTouch:o,width:e,height:t,breakpoint:a})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e};let Rt=!1;const It=()=>{if(Rt)return;if("undefined"==typeof document)return;const e="seekora-dropdown-responsive-global";if(document.getElementById(e))return void(Rt=!0);const t=document.createElement("style");t.id=e,t.textContent='\n/* ============================================\n SEEKORA DROPDOWN - RESPONSIVE STYLES\n ============================================ */\n\n/* CSS Variables for responsiveness */\n:root {\n --seekora-touch-target-min: 44px;\n --seekora-touch-target-comfortable: 48px;\n --seekora-mobile-padding: 16px;\n --seekora-desktop-padding: 20px;\n}\n\n/* Base responsive rules for all dropdowns */\n[class*="seekora-"][class*="-dropdown"] {\n box-sizing: border-box;\n}\n\n[class*="seekora-"][class*="-dropdown"] * {\n box-sizing: border-box;\n}\n\n/* ============================================\n MOBILE STYLES (< 768px)\n ============================================ */\n@media (max-width: 767px) {\n /* Full-width dropdowns on mobile */\n [class*="seekora-"][class*="-dropdown"]:not(.seekora-mobile-sheet):not(.seekora-spotlight-dropdown) {\n width: 100% !important;\n max-width: 100vw !important;\n left: 0 !important;\n right: 0 !important;\n border-radius: 0 !important;\n margin: 0 !important;\n }\n\n /* Touch-friendly item sizes */\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item],\n [class*="seekora-"][class*="-dropdown"] .suggestion-item,\n [class*="seekora-"][class*="-dropdown"] .product-card {\n min-height: var(--seekora-touch-target-min);\n }\n\n /* Larger padding on mobile */\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item] {\n padding: 14px var(--seekora-mobile-padding) !important;\n }\n\n /* Larger fonts on mobile for readability */\n [class*="seekora-"][class*="-dropdown"] {\n font-size: 16px !important;\n }\n\n /* Stack columns on mobile */\n [class*="seekora-"][class*="-dropdown"] .dropdown-content,\n [class*="seekora-"][class*="-dropdown"] [style*="display: flex"][style*="flex-direction"] {\n flex-direction: column !important;\n }\n\n /* Full-width columns on mobile */\n [class*="seekora-"][class*="-dropdown"] [style*="width: 40%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 45%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 50%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 55%"],\n [class*="seekora-"][class*="-dropdown"] [style*="width: 60%"] {\n width: 100% !important;\n flex: none !important;\n }\n\n /* Product grid adjustments */\n [class*="seekora-"][class*="-dropdown"] .products-grid,\n [class*="seekora-"][class*="-dropdown"] [style*="grid-template-columns"] {\n grid-template-columns: repeat(2, 1fr) !important;\n gap: 12px !important;\n }\n\n /* Horizontal scroll for products on mobile */\n [class*="seekora-"][class*="-dropdown"] .products-scroll {\n display: flex !important;\n overflow-x: auto !important;\n scroll-snap-type: x mandatory !important;\n -webkit-overflow-scrolling: touch !important;\n padding-bottom: 8px !important;\n }\n\n [class*="seekora-"][class*="-dropdown"] .products-scroll > * {\n scroll-snap-align: start !important;\n flex-shrink: 0 !important;\n }\n\n /* Hide keyboard hints on mobile */\n [class*="seekora-"][class*="-dropdown"] .keyboard-hint,\n [class*="seekora-"][class*="-dropdown"] [class*="keyboard"],\n [class*="seekora-"][class*="-dropdown"] kbd,\n [class*="seekora-"][class*="-dropdown"] .kbd {\n display: none !important;\n }\n\n /* Safe area padding for notched devices */\n [class*="seekora-"][class*="-dropdown"] [style*="padding-bottom"] {\n padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;\n }\n}\n\n/* ============================================\n TOUCH DEVICE STYLES\n ============================================ */\n@media (hover: none) and (pointer: coarse) {\n /* Active state instead of hover for touch */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:active,\n [class*="seekora-"][class*="-dropdown"] [data-item]:active,\n [class*="seekora-"][class*="-dropdown"] button:active {\n background-color: var(--seekora-bg-hover, rgba(0,0,0,0.05)) !important;\n transform: scale(0.98);\n }\n\n /* Disable hover effects on touch */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:hover,\n [class*="seekora-"][class*="-dropdown"] [data-item]:hover {\n background-color: transparent;\n }\n\n /* Larger touch targets */\n [class*="seekora-"][class*="-dropdown"] button,\n [class*="seekora-"][class*="-dropdown"] [role="button"] {\n min-height: var(--seekora-touch-target-min);\n min-width: var(--seekora-touch-target-min);\n }\n\n /* No text selection on touch */\n [class*="seekora-"][class*="-dropdown"] {\n -webkit-user-select: none;\n user-select: none;\n }\n}\n\n/* ============================================\n TABLET STYLES (768px - 1023px)\n ============================================ */\n@media (min-width: 768px) and (max-width: 1023px) {\n [class*="seekora-"][class*="-dropdown"]:not(.seekora-mobile-sheet) {\n max-width: 90vw !important;\n margin-left: auto !important;\n margin-right: auto !important;\n }\n\n /* 3-column product grid on tablet */\n [class*="seekora-"][class*="-dropdown"] .products-grid {\n grid-template-columns: repeat(3, 1fr) !important;\n }\n}\n\n/* ============================================\n DESKTOP STYLES (>= 1024px)\n ============================================ */\n@media (min-width: 1024px) {\n [class*="seekora-"][class*="-dropdown"] [role="option"],\n [class*="seekora-"][class*="-dropdown"] [data-item] {\n min-height: 40px;\n }\n\n /* Hover effects only on desktop */\n [class*="seekora-"][class*="-dropdown"] [role="option"]:hover,\n [class*="seekora-"][class*="-dropdown"] [data-item]:hover {\n background-color: var(--seekora-bg-hover, rgba(0,0,0,0.04));\n }\n}\n\n/* ============================================\n ANIMATION & TRANSITIONS\n ============================================ */\n@keyframes seekora-dropdown-enter {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes seekora-dropdown-enter-mobile {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes seekora-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n[class*="seekora-"][class*="-dropdown"].entering {\n animation: seekora-dropdown-enter 200ms ease-out;\n}\n\n@media (max-width: 767px) {\n [class*="seekora-"][class*="-dropdown"].entering {\n animation: seekora-dropdown-enter-mobile 300ms ease-out;\n }\n}\n\n/* ============================================\n ACCESSIBILITY\n ============================================ */\n@media (prefers-reduced-motion: reduce) {\n [class*="seekora-"][class*="-dropdown"],\n [class*="seekora-"][class*="-dropdown"] * {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n\n/* Focus visible styles */\n[class*="seekora-"][class*="-dropdown"] [role="option"]:focus-visible,\n[class*="seekora-"][class*="-dropdown"] button:focus-visible {\n outline: 2px solid var(--seekora-primary, #007aff);\n outline-offset: -2px;\n}\n\n/* High contrast mode */\n@media (prefers-contrast: high) {\n [class*="seekora-"][class*="-dropdown"] {\n border: 2px solid currentColor !important;\n }\n\n [class*="seekora-"][class*="-dropdown"] [role="option"][aria-selected="true"] {\n outline: 2px solid currentColor;\n }\n}\n\n/* Dark mode adjustments */\n@media (prefers-color-scheme: dark) {\n [class*="seekora-"][class*="-dropdown"] {\n --seekora-bg-surface: #1c1c1e;\n --seekora-bg-secondary: #2c2c2e;\n --seekora-bg-hover: #3a3a3c;\n --seekora-text-primary: #ffffff;\n --seekora-text-secondary: #8e8e93;\n --seekora-border-color: #38383a;\n }\n}\n',document.head.appendChild(t),Rt=!0},Nt=()=>{t.useEffect(()=>{It()},[])},Tt=(e={},t=!1)=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #0f1111)",borderRadius:t?"12px":"16px",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1), 0 10px 40px -5px rgba(0,0,0,0.15)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"14px",zIndex:1e3,...t&&{position:"fixed",top:"60px",bottom:0,left:"8px",right:"8px",margin:0,borderRadius:"16px 16px 0 0"}},content:{display:"flex",flexDirection:t?"column":"row",maxHeight:t?"calc(100vh - 140px)":"480px",overflowY:"auto"},leftColumn:{flex:t?"none":"0 0 55%",borderRight:t?"none":"1px solid var(--seekora-border-color, #e8e8e8)",borderBottom:t?"1px solid var(--seekora-border-color, #e8e8e8)":"none",overflowY:"auto",padding:"8px 0"},rightColumn:{flex:t?"none":"0 0 45%",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",overflowY:"auto",padding:"8px 0"},section:{padding:"4px 0"},sectionHeader:{padding:"8px 16px 6px",fontSize:"11px",fontWeight:600,color:"var(--seekora-text-secondary, #6b6b6b)",textTransform:"uppercase",letterSpacing:"0.05em"},suggestionItem:{display:"flex",alignItems:"center",padding:t?"12px 16px":"10px 16px",cursor:"pointer",transition:"all 150ms ease",gap:t?"12px":"10px",minHeight:t?`${wt.minimum}px`:"40px",borderRadius:"8px",margin:"2px 8px",color:"var(--seekora-text-primary, #0f1111)"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #0f1111)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #6b6b6b)",flexShrink:0},suggestionContent:{flex:1,minWidth:0},suggestionQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #0f1111)",fontWeight:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},suggestionContext:{fontSize:"12px",color:"var(--seekora-text-secondary, #565959)",marginTop:"2px"},suggestionDepartment:{color:"var(--seekora-primary-dark, #c45500)",fontStyle:"italic"},categoryScoped:{backgroundColor:"var(--seekora-primary-light, #fef8f0)",borderRadius:"3px",padding:"0 4px",marginLeft:"4px",fontSize:"11px",color:"var(--seekora-primary-dark, #c45500)"},productsHeader:{padding:"12px 16px 8px",display:"flex",alignItems:"center",justifyContent:"space-between"},productsTitle:{fontSize:"13px",fontWeight:700,color:"var(--seekora-text-primary, #0f1111)"},viewAll:{fontSize:"12px",color:"var(--seekora-link, #007185)",textDecoration:"none",cursor:"pointer","&:hover":{color:"var(--seekora-link-hover, #c45500)",textDecoration:"underline"}},productsGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"12px",padding:"12px 16px 16px"},productCard:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRadius:"12px",padding:"10px",cursor:"pointer",transition:"all 200ms ease",boxShadow:"0 1px 3px rgba(0,0,0,0.06)"},productCardHover:{boxShadow:"0 4px 12px rgba(0,0,0,0.12)",transform:"translateY(-2px)"},productImage:{width:"100%",aspectRatio:"1",objectFit:"contain",backgroundColor:"var(--seekora-bg-tertiary, #f8f8f8)",borderRadius:"8px",marginBottom:"10px"},productTitle:{fontSize:"12px",color:"var(--seekora-link, #007185)",lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",marginBottom:"4px"},productPrice:{fontSize:"14px",fontWeight:500,color:"var(--seekora-text-primary, #0f1111)"},productPriceSymbol:{fontSize:"11px",verticalAlign:"top"},productRating:{display:"flex",alignItems:"center",gap:"4px",marginTop:"4px"},stars:{color:"var(--seekora-rating, #de7921)",fontSize:"12px"},reviewCount:{fontSize:"11px",color:"var(--seekora-link, #007185)"},prime:{height:"16px",marginTop:"4px"},recentHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px"},clearRecent:{fontSize:"12px",color:"var(--seekora-link, #007185)",cursor:"pointer",background:"none",border:"none",padding:0},highlight:{fontWeight:700,color:"var(--seekora-text-primary, #0f1111)"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--seekora-text-secondary, #565959)",gap:"10px"},spinner:{width:"20px",height:"20px",border:"2px solid var(--seekora-border-color, #ddd)",borderTopColor:"var(--seekora-primary, #f90)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #565959)"},footer:{padding:"10px 16px",borderTop:"1px solid var(--seekora-border-color, #e7e7e7)",backgroundColor:"var(--seekora-bg-secondary, #f7f7f7)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"12px",color:"var(--seekora-text-tertiary, #767676)"},keyboard:{display:"flex",alignItems:"center",gap:"8px"},key:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"18px",padding:"0 4px",backgroundColor:"var(--seekora-bg-surface, #fff)",border:"1px solid var(--seekora-border-color, #ccc)",borderRadius:"3px",fontSize:"10px",fontFamily:"monospace"}}),At=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("circle",{cx:"11",cy:"11",r:"8"}),t.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),zt=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"})),Mt=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),t.createElement("polyline",{points:"17 6 23 6 23 12"})),_t=({rating:e,count:r})=>{const a=Math.floor(e),o=e%1>=.5;return t.createElement("div",{style:Tt().productRating},t.createElement("div",{style:Tt().stars},"★".repeat(a),o&&"½","☆".repeat(5-a-(o?1:0))),void 0!==r&&t.createElement("span",{style:Tt().reviewCount},"(",r.toLocaleString(),")"))},Lt=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],recentSearches:c=[],trendingSearches:d=[],filteredTabs:u=[],activeTab:p="all",suggestionFields:m={query:"query"},productFields:g={id:"id",title:"title"},categoryFields:f={id:"id",label:"label"},productDisplay:h={},theme:y={},showDepartments:b=!0,currentDepartment:x,departments:v=[],showPrime:k=!1,width:E="700px",maxHeight:S="500px",zIndex:w=1e3,className:C,style:R,classNames:I={},onSuggestionSelect:N,onProductClick:T,onCategoryClick:A,onTabChange:z,onRecentClick:M,onRecentRemove:_,onRecentClearAll:L,onViewAll:P,onClose:B,header:D,footer:$,renderLoading:F,renderEmpty:W}=e;Nt();const q=Ct(),{isMobile:H,isTablet:O}=q,j=t.useMemo(()=>Tt(y,H),[y,H]),V=t.useRef(null),[Q,U]=t.useState(-1),[G,K]=t.useState(null),X=t.useMemo(()=>s.map(e=>nt(e,m)),[s,m]),Y=t.useMemo(()=>{if("all"===p||0===u.length)return i;const e=u.find(e=>e.id===p);return e?.products||i},[p,u,i]),J=t.useMemo(()=>Y.map(e=>st(e,g)),[Y,g]);t.useMemo(()=>l.map(e=>it(e,f)),[l,f]);const Z=t.useMemo(()=>c.map(e=>"string"==typeof e?e:e.query),[c]),ee=t.useMemo(()=>{const e=[];let t=0;return 0===a.length&&Z.slice(0,5).forEach(r=>{e.push({type:"recent",data:r,index:t++})}),X.forEach(r=>{e.push({type:"suggestion",data:r,index:t++})}),e},[a,Z,X]),te=t.useCallback(()=>{U(e=>Math.min(e+1,ee.length-1))},[ee.length]),re=t.useCallback(()=>{U(e=>Math.max(e-1,-1))},[]),ae=t.useCallback(()=>{if(Q<0||Q>=ee.length)return;const e=ee[Q];"recent"===e.type?M?.(e.data):"suggestion"===e.type&&N?.(e.data._raw,e.index)},[Q,ee,M,N]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>Q,setActiveIndex:U,selectActive:ae,navigateNext:te,navigatePrevious:re,focus:()=>V.current?.focus(),close:()=>B?.()}),[Q,ae,te,re,B]),t.useEffect(()=>{if(Q>=0&&V.current){const e=V.current.querySelector(`[data-index="${Q}"]`);e&&bt(e,V.current)}},[Q]),!o)return null;const oe=ut(y),ne=0===a.length&&Z.length>0,se=0===a.length&&d.length>0,ie=J.length>0;return t.createElement("div",{ref:V,role:"listbox","aria-label":"Search suggestions",className:pt("seekora-amazon-dropdown",C,I.root),style:mt(j.root,{width:H?"100%":E,maxHeight:H?"100vh":S,zIndex:w},oe,R),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-amazon-dropdown mark {\n background: transparent;\n font-weight: 700;\n color: inherit;\n }\n "),D,n?F?F():t.createElement("div",{style:j.loading},t.createElement("div",{style:j.spinner}),t.createElement("span",null,"Searching...")):t.createElement(t.Fragment,null,u.length>0&&t.createElement("div",{style:{display:"flex",gap:"8px",padding:H?"12px":"12px 16px",overflowX:"auto",borderBottomWidth:"1px",borderBottomStyle:"solid",borderBottomColor:"var(--seekora-border-color, #e7e7e7)",background:"var(--seekora-bg-secondary, #f5f5f5)",WebkitOverflowScrolling:"touch"}},t.createElement("button",{onClick:()=>z?.("all"),style:{padding:"8px 16px",borderWidth:0,borderStyle:"none",background:"all"===p?"var(--seekora-text-primary, #232f3e)":"var(--seekora-bg-surface, #ffffff)",color:"all"===p?"var(--seekora-bg-surface, #ffffff)":"var(--seekora-text-primary, #0f1111)",borderRadius:"20px",fontSize:"13px",fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",minHeight:"36px",boxShadow:"all"===p?"none":"0 1px 3px rgba(0,0,0,0.1)",transition:"all 150ms ease"}},"All"),u.slice(0,6).map(e=>t.createElement("button",{key:e.id,onClick:()=>z?.(e.id),style:{padding:"8px 16px",borderWidth:0,borderStyle:"none",background:p===e.id?"var(--seekora-primary, #ff9900)":"var(--seekora-bg-surface, #ffffff)",color:p===e.id?"var(--seekora-text-on-primary, #0f1111)":"var(--seekora-text-primary, #0f1111)",borderRadius:"20px",fontSize:"13px",fontWeight:p===e.id?700:500,cursor:"pointer",whiteSpace:"nowrap",minHeight:"36px",boxShadow:p===e.id?"0 2px 4px rgba(255,153,0,0.3)":"0 1px 3px rgba(0,0,0,0.1)",transition:"all 150ms ease"}},e.label," ",e.nb_hits?`(${e.nb_hits})`:""))),t.createElement("div",{style:j.content},t.createElement("div",{style:j.leftColumn},ne&&t.createElement("div",{style:j.section},t.createElement("div",{style:j.recentHeader},t.createElement("span",{style:j.sectionHeader},"Recent Searches"),t.createElement("button",{style:j.clearRecent,onClick:L},"Clear all")),Z.slice(0,5).map((e,r)=>{const a=Q===r;return t.createElement("div",{key:`recent-${e}`,"data-index":r,role:"option","aria-selected":a,style:mt(j.suggestionItem,a?j.suggestionItemActive:void 0),onClick:()=>M?.(e),onMouseEnter:()=>U(r)},t.createElement(zt,null),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery},e)))})),se&&t.createElement("div",{style:j.section},t.createElement("div",{style:j.sectionHeader},"Trending Searches"),d.slice(0,5).map((e,r)=>{const a="string"==typeof e?e:e.query,o=Z.length+r,n=Q===o;return t.createElement("div",{key:`trending-${a}`,"data-index":o,role:"option","aria-selected":n,style:mt(j.suggestionItem,n?j.suggestionItemActive:void 0),onClick:()=>N?.({query:a},r),onMouseEnter:()=>U(o)},t.createElement(Mt,null),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery},a)))})),X.length>0&&t.createElement("div",{style:j.section},a&&t.createElement("div",{style:j.sectionHeader},"Suggestions"),X.map((e,r)=>{const o=ne?Z.length+r:r,n=Q===o,s=(e.categories||[])[0];return t.createElement("div",{key:e.id||`suggestion-${r}`,"data-index":o,role:"option","aria-selected":n,style:mt(j.suggestionItem,n?j.suggestionItemActive:void 0),onClick:()=>N?.(e._raw,r),onMouseEnter:()=>U(o)},t.createElement("div",{style:j.suggestionIcon},t.createElement(At,null)),t.createElement("div",{style:j.suggestionContent},t.createElement("div",{style:j.suggestionQuery,dangerouslySetInnerHTML:{__html:dt(e.query,a,{className:"highlight"})}}),b&&s&&t.createElement("div",{style:j.suggestionContext},t.createElement("span",{style:j.suggestionDepartment},"in ","string"==typeof s?s:s.value||s.label))),e.count&&t.createElement("span",{style:j.categoryScoped},e.count.toLocaleString()))})),a&&0===X.length&&!n&&(W?W(a):t.createElement("div",{style:j.empty},'No suggestions found for "',a,'"'))),ie&&t.createElement("div",{style:j.rightColumn},t.createElement("div",{style:j.productsHeader},t.createElement("span",{style:j.productsTitle},"Suggested Products"),t.createElement("a",{style:j.viewAll,onClick:()=>P?.("products")},"View all")),t.createElement("div",{style:j.productsGrid},J.slice(0,4).map((e,r)=>t.createElement("div",{key:e.id,style:mt(j.productCard,G===e.id?j.productCardHover:void 0),onClick:()=>T?.(e._raw,r),onMouseEnter:()=>K(e.id),onMouseLeave:()=>K(null)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:j.productImage,loading:"lazy"}):t.createElement("div",{style:{...j.productImage,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement("span",{style:{color:"var(--seekora-text-tertiary, #999)",fontSize:"32px"}},"📷")),t.createElement("div",{style:j.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:j.productPrice},t.createElement("span",{style:j.productPriceSymbol},h.currency||"$"),lt(e.price,{currency:"",priceDecimals:h.priceDecimals})),e.rating&&t.createElement(_t,{rating:parseFloat(String(e.rating)),count:e.reviewCount?parseInt(String(e.reviewCount)):void 0}))))))),void 0!==$?$:t.createElement("div",{style:j.footer},t.createElement("div",{style:j.keyboard},t.createElement("span",{style:j.key},"↑"),t.createElement("span",{style:j.key},"↓"),t.createElement("span",null,"to navigate"),t.createElement("span",{style:j.key},"↵"),t.createElement("span",null,"to select"),t.createElement("span",{style:j.key},"esc"),t.createElement("span",null,"to close")),X.length>0&&t.createElement("span",null,X.length," suggestions")))}),Pt=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",fill:"currentColor"})),Bt=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M13 3a9 9 0 00-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.954 8.954 0 0013 21a9 9 0 000-18zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z",fill:"currentColor"})),Dt=()=>t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},t.createElement("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z",fill:"currentColor"})),$t=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",width:"20",height:"20"},t.createElement("path",{d:"M9 5l-4 4 4 4",stroke:"currentColor",strokeWidth:"2",fill:"none",transform:"rotate(-90 12 12)"})),Ft=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],recentSearches:i=[],trendingSearches:l=[],suggestionFields:c={query:"query"},theme:d={},showFeelingLucky:u=!0,feelingLuckyText:p="I'm Feeling Lucky",showRemoveRecent:m=!0,showVoiceSearch:g=!1,showTrendingIndicator:f=!0,width:h="100%",maxHeight:y="400px",zIndex:b=1e3,className:x,style:v,classNames:k={},onSuggestionSelect:E,onRecentClick:S,onRecentRemove:w,onVoiceSearch:C,onFeelingLucky:R,onClose:I,onSearchSubmit:N,header:T,footer:A,renderLoading:z,renderEmpty:M}=e;Nt();const _=Ct(),{isMobile:L}=_,P=t.useMemo(()=>((e=!1)=>({root:{position:e?"fixed":"absolute",top:e?0:"100%",left:0,right:0,bottom:e?0:"auto",marginTop:e?0:"4px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #202124)",borderRadius:e?"0":"24px",boxShadow:e?"none":"0 4px 20px rgba(0,0,0,0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:e?"17px":"15px",display:"flex",flexDirection:"column"},list:{listStyle:"none",margin:0,padding:"8px",flex:1,overflowY:"auto"},item:{display:"flex",alignItems:"center",padding:e?"12px 14px":"10px 14px",cursor:"pointer",transition:"all 100ms ease",gap:"12px",minHeight:"44px",borderRadius:"12px",margin:"2px 0",color:"var(--seekora-text-primary, #202124)"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #202124)"},itemIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #9aa0a6)",flexShrink:0},itemContent:{flex:1,display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:0},itemText:{fontSize:"16px",color:"var(--seekora-text-primary, #202124)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemTextBold:{fontWeight:400},itemMatch:{fontWeight:700},itemAction:{fontSize:"14px",color:"var(--seekora-link, #1a73e8)",marginLeft:"16px",opacity:0,transition:"opacity 100ms",whiteSpace:"nowrap"},itemActionVisible:{opacity:1},removeBtn:{padding:"4px 8px",background:"none",border:"none",color:"var(--seekora-link, #1a73e8)",cursor:"pointer",fontSize:"13px",borderRadius:"4px",opacity:0,transition:"opacity 100ms, background 100ms"},removeBtnVisible:{opacity:1},removeBtnHover:{backgroundColor:"var(--seekora-bg-hover, #e8f0fe)",color:"var(--seekora-text-primary, #202124)"},divider:{height:"1px",backgroundColor:"var(--seekora-border-color, #e8eaed)",margin:"8px 0"},sectionTitle:{padding:"12px 16px 8px",fontSize:"12px",fontWeight:500,color:"var(--seekora-text-secondary, #5f6368)",textTransform:"uppercase",letterSpacing:"0.8px"},trending:{display:"flex",alignItems:"center",gap:"8px",color:"var(--seekora-success, #1e8e3e)",fontSize:"12px",marginLeft:"auto"},trendingIcon:{width:"12px",height:"12px"},footer:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px 16px",borderTop:"1px solid var(--seekora-border-color, #e8eaed)",gap:"24px",backgroundColor:"var(--seekora-bg-secondary, #f8f9fa)"},footerButton:{padding:"8px 16px",backgroundColor:"var(--seekora-bg-tertiary, #f1f3f4)",border:"1px solid var(--seekora-border-color, #f1f3f4)",borderRadius:"4px",fontSize:"14px",color:"var(--seekora-text-secondary, #3c4043)",cursor:"pointer",transition:"border-color 100ms, box-shadow 100ms"},footerButtonHover:{borderColor:"var(--seekora-border-color-dark, #dadce0)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},voiceBtn:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",borderRadius:"50%",background:"none",border:"none",cursor:"pointer",color:"var(--seekora-primary, #4285f4)",transition:"background 100ms"},voiceBtnHover:{backgroundColor:"var(--seekora-bg-hover, #f1f3f4)",color:"var(--seekora-text-primary, #202124)"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",color:"var(--seekora-text-secondary, #5f6368)",gap:"12px"},spinner:{width:"24px",height:"24px",border:"3px solid var(--seekora-border-color, #e8eaed)",borderTopColor:"var(--seekora-primary, #4285f4)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"24px",textAlign:"center",color:"var(--seekora-text-secondary, #5f6368)",fontSize:"14px"}}))(L),[L]),B=t.useRef(null),[D,$]=t.useState(-1),[F,W]=t.useState(-1),[q,H]=t.useState(null),O=t.useMemo(()=>s.map(e=>nt(e,c)),[s,c]),j=t.useMemo(()=>i.map(e=>"string"==typeof e?e:e.query).slice(0,5),[i]),V=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,5),[l]),Q=t.useMemo(()=>{const e=[];return 0===a.length?(j.forEach(t=>e.push({type:"recent",query:t})),V.forEach(t=>e.push({type:"trending",query:t}))):O.forEach(t=>e.push({type:"suggestion",query:t.query,data:t})),e},[a,j,V,O]),U=t.useCallback(()=>{$(e=>Math.min(e+1,Q.length-1))},[Q.length]),G=t.useCallback(()=>{$(e=>Math.max(e-1,-1))},[]),K=t.useCallback(()=>{if(D<0)return void(a&&N?.(a));const e=Q[D];"recent"===e.type||"trending"===e.type?S?.(e.query):E?.(e.data?._raw||{query:e.query},D)},[D,Q,a,N,S,E]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>D,setActiveIndex:$,selectActive:K,navigateNext:U,navigatePrevious:G,focus:()=>B.current?.focus(),close:()=>I?.()}),[D,K,U,G,I]),t.useEffect(()=>{$(-1)},[a]),t.useEffect(()=>{if(D>=0&&B.current){const e=B.current.querySelector(`[data-index="${D}"]`);e&&bt(e,B.current)}},[D]),!o)return null;const X=ut(d),Y=0===a.length&&j.length>0,J=0===a.length&&V.length>0,Z=(e,r,o)=>{const n=D===o,s=F===o,i=n||s;return t.createElement("li",{key:`${e.type}-${e.query}-${r}`,"data-index":o,role:"option","aria-selected":n,style:mt(P.item,n||s?P.itemActive:void 0),onClick:()=>{"recent"===e.type||"trending"===e.type?S?.(e.query):E?.(e.data?._raw||{query:e.query},r)},onMouseEnter:()=>{W(o),$(o)},onMouseLeave:()=>W(-1)},t.createElement("div",{style:P.itemIcon},"recent"===e.type?t.createElement(Bt,null):"trending"===e.type?t.createElement(Dt,null):t.createElement(Pt,null)),t.createElement("div",{style:P.itemContent},t.createElement("span",{style:P.itemText,dangerouslySetInnerHTML:{__html:a?dt(e.query,a,{tag:"b"}):e.query}}),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},"trending"===e.type&&f&&t.createElement("span",{style:P.trending},t.createElement(Dt,null),"Trending"),"recent"===e.type&&m&&t.createElement("button",{style:mt(P.removeBtn,i?P.removeBtnVisible:void 0),onClick:t=>{t.stopPropagation(),w?.(e.query)},"aria-label":`Remove ${e.query}`},"Remove"),t.createElement("span",{style:mt(P.itemAction,i?P.itemActionVisible:void 0)},t.createElement($t,null)))))};let ee=0;return t.createElement("div",{ref:B,role:"listbox","aria-label":"Search suggestions",className:pt("seekora-google-dropdown",x,k.root),style:mt(P.root,{width:h,maxHeight:"none",zIndex:b},X,v),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),T,n?z?z():t.createElement("div",{style:P.loading},t.createElement("div",{style:P.spinner})):t.createElement(t.Fragment,null,t.createElement("ul",{style:P.list},Y&&t.createElement(t.Fragment,null,j.map((e,t)=>{const r=Z({type:"recent",query:e},t,ee);return ee++,r}),J&&t.createElement("div",{style:P.divider})),J&&t.createElement(t.Fragment,null,!Y&&t.createElement("div",{style:P.sectionTitle},"Trending searches"),V.map((e,t)=>{const r=Z({type:"trending",query:e},t,ee);return ee++,r})),a&&O.length>0&&O.map((e,t)=>{const r={type:"suggestion",query:e.query,data:e},a=Z(r,t,ee);return ee++,a}),a&&0===O.length&&!n&&(M?M(a):t.createElement("li",{style:P.empty},'No suggestions for "',a,'"'))),(u||g)&&t.createElement("div",{style:P.footer},u&&t.createElement(t.Fragment,null,t.createElement("button",{style:mt(P.footerButton,"search"===q?P.footerButtonHover:void 0),onMouseEnter:()=>H("search"),onMouseLeave:()=>H(null),onClick:()=>N?.(a||(D>=0?Q[D]?.query:""))},"Search"),t.createElement("button",{style:mt(P.footerButton,"lucky"===q?P.footerButtonHover:void 0),onMouseEnter:()=>H("lucky"),onMouseLeave:()=>H(null),onClick:()=>R?.(a||(D>=0?Q[D]?.query:""))},p)))),A)}),Wt=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},t.createElement("path",{d:"M10 16c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m13.12 2.88l-4.26-4.26A9.842 9.842 0 0020 10c0-5.52-4.48-10-10-10S0 4.48 0 10s4.48 10 10 10c1.67 0 3.24-.41 4.62-1.14l4.26 4.26a3 3 0 004.24-4.24z"})),qt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18"},t.createElement("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})),Ht=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:"18",height:"18"},t.createElement("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"})),Ot=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"48",height:"48"},t.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),t.createElement("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),t.createElement("polyline",{points:"21 15 16 10 5 21"})),jt=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},categoryFields:u={id:"id",label:"label"},productDisplay:p={},theme:m={},showSaveButton:g=!0,activeCategory:f,activeTab:h,showPriceOverlay:y=!0,gridColumns:b=4,width:x="800px",maxHeight:v="600px",zIndex:k=1e3,className:E,style:S,classNames:w={},onSuggestionSelect:C,onProductClick:R,onCategoryClick:I,onTabChange:N,onSaveProduct:T,onViewAll:A,onClose:z,header:M,footer:_,renderLoading:L,renderEmpty:P}=e;Nt();const B=Ct(),{isMobile:D}=B,$=t.useMemo(()=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #111111)",borderRadius:"20px",boxShadow:"0 4px 30px rgba(0,0,0,0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"15px"},header:{padding:"16px 20px 14px",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)"},searchInfo:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"14px"},searchQuery:{fontSize:"16px",fontWeight:600,color:"#111111"},searchCount:{fontSize:"13px",color:"#767676"},categoriesScroll:{display:"flex",gap:"8px",overflowX:"auto",paddingBottom:"4px",scrollbarWidth:"none",msOverflowStyle:"none"},categoryChip:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",backgroundColor:"var(--seekora-bg-secondary, #f0f0f0)",borderRadius:"20px",fontSize:"13px",fontWeight:500,color:"#111111",cursor:"pointer",transition:"all 150ms ease",whiteSpace:"nowrap",borderWidth:0,borderStyle:"none"},categoryChipActive:{backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-bg-surface, #ffffff)"},categoryChipHover:{backgroundColor:"var(--seekora-bg-hover, #e0e0e0)",color:"var(--seekora-text-primary, #111111)"},categoryIcon:{width:"16px",height:"16px",borderRadius:"4px",objectFit:"cover"},content:{padding:"16px",overflowY:"auto"},suggestionsRow:{display:"flex",gap:"8px",marginBottom:"16px",flexWrap:"wrap"},suggestionPill:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",borderRadius:"20px",fontSize:"13px",fontWeight:500,color:"#111111",cursor:"pointer",transition:"all 150ms ease",borderWidth:0,borderStyle:"none"},suggestionPillActive:{backgroundColor:"var(--seekora-text-primary, #111111)",color:"var(--seekora-bg-surface, #ffffff)"},suggestionPillHover:{backgroundColor:"var(--seekora-bg-hover, #e8e8e8)",color:"var(--seekora-text-primary, #111111)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"#767676",flexShrink:0},productsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"16px"},productCard:{position:"relative",borderRadius:"16px",overflow:"hidden",cursor:"pointer",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",transition:"transform 150ms, box-shadow 150ms"},productCardHover:{transform:"scale(1.02)",boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},productImageContainer:{position:"relative",paddingBottom:"133%",overflow:"hidden"},productImage:{position:"absolute",top:0,left:0,width:"100%",height:"100%",objectFit:"cover"},productImagePlaceholder:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--seekora-bg-tertiary, #e9e9e9)",color:"var(--seekora-text-tertiary, #aaa)"},productOverlay:{position:"absolute",bottom:0,left:0,right:0,padding:"40px 12px 12px",background:"linear-gradient(to top, rgba(0,0,0,0.7), transparent)",opacity:0,transition:"opacity 200ms"},productOverlayVisible:{opacity:1},productInfo:{padding:"12px"},productTitle:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #111)",lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",marginBottom:"4px"},productTitleOverlay:{color:"var(--seekora-text-inverse, #ffffff)",marginBottom:"4px"},productPrice:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #111)"},productPriceOverlay:{color:"var(--seekora-text-inverse, #ffffff)"},productSaveBtn:{position:"absolute",top:"12px",right:"12px",width:"36px",height:"36px",borderRadius:"50%",backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",opacity:0,transform:"scale(0.8)",transition:"all 150ms"},productSaveBtnVisible:{opacity:1,transform:"scale(1)"},sectionTitle:{fontSize:"18px",fontWeight:700,color:"var(--seekora-text-primary, #111)",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #767676)"},spinner:{width:"32px",height:"32px",border:"3px solid var(--seekora-border-color, #efefef)",borderTopColor:"var(--seekora-primary, #e60023)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #767676)"},emptyIcon:{width:"64px",height:"64px",margin:"0 auto 16px",color:"var(--seekora-text-tertiary, #8c8c8c)"},footer:{padding:"16px 20px",borderTop:"1px solid var(--seekora-border-color, #efefef)",display:"flex",alignItems:"center",justifyContent:"space-between"},viewAllBtn:{padding:"12px 20px",backgroundColor:"var(--seekora-primary, #e60023)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",borderRadius:"24px",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"background 150ms"},viewAllBtnHover:{backgroundColor:"var(--seekora-primary-dark, #ad081b)"}}),[]),F=t.useRef(null),[W,q]=t.useState(-1),[H,O]=t.useState(null),[j,V]=t.useState(null),[Q,U]=t.useState(-1),[G,K]=t.useState(f||null),[X,Y]=t.useState(!1);t.useEffect(()=>{const e=h??f;void 0!==e&&K("all"===e?null:e)},[h,f]);const J=t.useMemo(()=>s.map(e=>nt(e,c)),[s,c]),Z=t.useMemo(()=>i.map(e=>st(e,d)),[i,d]),ee=t.useMemo(()=>l.map(e=>it(e,u)),[l,u]),te=t.useCallback(()=>{q(e=>Math.min(e+1,J.length-1))},[J.length]),re=t.useCallback(()=>{q(e=>Math.max(e-1,-1))},[]),ae=t.useCallback(()=>{W>=0&&J[W]&&C?.(J[W]._raw,W)},[W,J,C]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>W,setActiveIndex:q,selectActive:ae,navigateNext:te,navigatePrevious:re,focus:()=>F.current?.focus(),close:()=>z?.()}),[W,ae,te,re,z]),t.useEffect(()=>{if(W>=0&&F.current){const e=F.current.querySelector(`[data-index="${W}"]`);e&&bt(e,F.current)}},[W]),!o)return null;const oe=ut(m),ne=ee.length>0,se=Z;return t.createElement("div",{ref:F,role:"listbox","aria-label":"Search suggestions",className:pt("seekora-pinterest-dropdown",E,w.root),style:mt($.root,{width:x,zIndex:k},oe,S),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-pinterest-dropdown .categories-scroll::-webkit-scrollbar {\n display: none;\n }\n "),M||a&&t.createElement("div",{style:$.header},t.createElement("div",{style:$.searchInfo},t.createElement("span",{style:$.searchQuery},a?`"${a}"`:"Explore"),Z.length>0&&t.createElement("span",{style:$.searchCount},Z.length,"+ ideas")),ne&&t.createElement("div",{style:$.categoriesScroll,className:"categories-scroll"},t.createElement("button",{style:mt($.categoryChip,G?void 0:$.categoryChipActive,"all"===j&&G?$.categoryChipHover:void 0),onClick:()=>{K(null),N?.("all")},onMouseEnter:()=>V("all"),onMouseLeave:()=>V(null)},"All"),ee.map(e=>t.createElement("button",{key:e.id,style:mt($.categoryChip,G===e.id?$.categoryChipActive:void 0,j===e.id&&G!==e.id?$.categoryChipHover:void 0),onClick:()=>{K(e.id),N?.(e.id)},onMouseEnter:()=>V(e.id),onMouseLeave:()=>V(null)},e.icon&&t.createElement("img",{src:e.icon,alt:"",style:$.categoryIcon}),e.label,e.count&&t.createElement("span",null,"(",e.count,")"))))),t.createElement("div",{style:{...$.content,maxHeight:v}},n?L?L():t.createElement("div",{style:$.loading},t.createElement("div",{style:$.spinner})):t.createElement(t.Fragment,null,J.length>0&&t.createElement("div",{style:$.suggestionsRow},J.slice(0,8).map((e,r)=>t.createElement("button",{key:e.id||r,"data-index":r,style:mt($.suggestionPill,W===r?$.suggestionPillActive:void 0,Q===r&&W!==r?$.suggestionPillHover:void 0),onClick:()=>C?.(e._raw,r),onMouseEnter:()=>{U(r),q(r)},onMouseLeave:()=>U(-1)},t.createElement("span",{style:$.suggestionIcon,dangerouslySetInnerHTML:{__html:a?dt(e.query,a,{tag:"strong"}):e.query}})))),se.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:$.sectionTitle},t.createElement(Ht,null),"Ideas for you"),t.createElement("div",{style:{...$.productsGrid,gridTemplateColumns:`repeat(${b}, 1fr)`}},se.slice(0,12).map((e,r)=>t.createElement("div",{key:e.id,style:mt($.productCard,H===e.id?$.productCardHover:void 0),onClick:()=>R?.(e._raw,r),onMouseEnter:()=>O(e.id),onMouseLeave:()=>O(null)},t.createElement("div",{style:$.productImageContainer},e.image?t.createElement("img",{src:e.image,alt:e.title,style:$.productImage,loading:"lazy"}):t.createElement("div",{style:$.productImagePlaceholder},t.createElement(Ot,null)),g&&t.createElement("button",{style:mt($.productSaveBtn,H===e.id?$.productSaveBtnVisible:void 0),onClick:t=>{t.stopPropagation(),T?.(e._raw)},"aria-label":"Save"},t.createElement(qt,null)),y&&void 0!==e.price&&t.createElement("div",{style:mt($.productOverlay,H===e.id?$.productOverlayVisible:void 0)},t.createElement("div",{style:$.productTitleOverlay},e.title),t.createElement("div",{style:$.productPriceOverlay},lt(e.price,{currency:p.currency||e.currency||"$"})))),!y&&t.createElement("div",{style:$.productInfo},t.createElement("div",{style:$.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:$.productPrice},lt(e.price,{currency:p.currency||e.currency||"$"}))))))),!n&&0===se.length&&0===J.length&&(P?P(a):t.createElement("div",{style:$.empty},t.createElement("div",{style:$.emptyIcon},t.createElement(Wt,null)),t.createElement("p",null,'No ideas found for "',a,'"'),t.createElement("p",{style:{fontSize:"14px",marginTop:"8px"}},"Try searching for something else"))))),void 0!==_?_:se.length>0&&t.createElement("div",{style:$.footer},t.createElement("span",{style:{color:"var(--seekora-text-secondary, #767676)",fontSize:"14px"}},se.length,"+ more ideas"),t.createElement("button",{style:mt($.viewAllBtn,X?$.viewAllBtnHover:void 0),onClick:()=>A?.("products"),onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1)},"Explore all")))}),Vt=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"})),Qt=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",clipRule:"evenodd"})),Ut=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{d:"M10 2a4 4 0 00-4 4v1H5a1 1 0 00-.994.89l-1 9A1 1 0 004 18h12a1 1 0 00.994-1.11l-1-9A1 1 0 0015 7h-1V6a4 4 0 00-4-4zm2 5V6a2 2 0 10-4 0v1h4zm-6 3a1 1 0 112 0 1 1 0 01-2 0zm7-1a1 1 0 100 2 1 1 0 000-2z"})),Gt=()=>t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"16",height:"16"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z",clipRule:"evenodd"})),Kt=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},productDisplay:u={},theme:p={},showPreview:m=!0,asOverlay:g=!0,placeholder:f="Search...",showShortcuts:h=!0,actions:y=[],width:b="680px",maxHeight:x="500px",zIndex:v=9999,className:k,style:E,classNames:S={},inputRef:w,onSuggestionSelect:C,onProductClick:R,onRecentClick:I,onClose:N,onSearchSubmit:T,header:A,footer:z,renderLoading:M,renderEmpty:_}=e;Nt();const L=Ct(),{isMobile:P}=L,B=t.useMemo(()=>({overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",zIndex:9999},root:{backgroundColor:"var(--seekora-bg-surface, rgba(255, 255, 255, 0.95))",borderRadius:"var(--seekora-border-radius, 12px)",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.1)",overflow:"hidden",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif)',fontSize:"var(--seekora-font-size, 14px)",backdropFilter:"blur(20px)"},searchContainer:{display:"flex",alignItems:"center",padding:"12px 16px",gap:"12px",borderBottom:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))"},searchIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #86868b)",flexShrink:0},searchInput:{flex:1,border:"none",background:"transparent",fontSize:"17px",fontWeight:300,color:"var(--seekora-text-primary, #1d1d1f)",outline:"none",fontFamily:"inherit"},shortcut:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:"var(--seekora-text-tertiary, #86868b)"},kbd:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"20px",padding:"0 4px",backgroundColor:"var(--seekora-bg-tertiary, rgba(0,0,0,0.05))",borderRadius:"4px",fontSize:"11px",fontFamily:"SF Mono, Monaco, monospace"},content:{display:"flex",maxHeight:"400px"},resultsColumn:{flex:1,overflowY:"auto",minWidth:"300px"},previewColumn:{width:"280px",borderLeft:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))",backgroundColor:"var(--seekora-bg-secondary, rgba(0,0,0,0.02))",display:"flex",flexDirection:"column"},section:{padding:"8px 0"},sectionTitle:{padding:"8px 16px 6px",fontSize:"11px",fontWeight:600,color:"var(--seekora-text-tertiary, #86868b)",textTransform:"uppercase",letterSpacing:"0.5px"},item:{display:"flex",alignItems:"center",padding:"8px 16px",gap:"12px",cursor:"pointer",transition:"background-color 50ms",margin:"0 8px",borderRadius:"6px"},itemActive:{backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)"},itemIcon:{width:"32px",height:"32px",borderRadius:"6px",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f7)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-secondary, #515154)",flexShrink:0},itemIconActive:{backgroundColor:"rgba(255,255,255,0.2)",color:"var(--seekora-text-inverse, #ffffff)"},itemIconImage:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"6px"},itemContent:{flex:1,minWidth:0},itemTitle:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #1d1d1f)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemTitleActive:{color:"var(--seekora-text-inverse, #ffffff)"},itemSubtitle:{fontSize:"11px",color:"var(--seekora-text-secondary, #86868b)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:"2px"},itemSubtitleActive:{color:"var(--seekora-text-inverse, #ffffff)",opacity:.9},itemAction:{fontSize:"11px",color:"var(--seekora-text-tertiary, #86868b)",opacity:0,transition:"opacity 100ms"},itemActionVisible:{opacity:1},itemActionActive:{color:"var(--seekora-text-inverse, #ffffff)",opacity:.8},previewContent:{flex:1,padding:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},previewImage:{width:"160px",height:"160px",objectFit:"contain",borderRadius:"8px",marginBottom:"16px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},previewTitle:{fontSize:"14px",fontWeight:600,color:"var(--seekora-text-primary, #1d1d1f)",textAlign:"center",marginBottom:"4px"},previewSubtitle:{fontSize:"12px",color:"var(--seekora-text-secondary, #86868b)",textAlign:"center",marginBottom:"8px"},previewPrice:{fontSize:"18px",fontWeight:700,color:"var(--seekora-primary, #007aff)"},previewActions:{display:"flex",gap:"8px",marginTop:"16px"},previewAction:{padding:"6px 12px",fontSize:"12px",fontWeight:500,borderRadius:"6px",border:"none",cursor:"pointer",transition:"all 100ms"},previewActionPrimary:{backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)"},previewActionSecondary:{backgroundColor:"var(--seekora-bg-tertiary, #f5f5f7)",color:"var(--seekora-text-primary, #1d1d1f)"},footer:{padding:"8px 16px",borderTop:"1px solid var(--seekora-border-color, rgba(0,0,0,0.1))",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"var(--seekora-bg-secondary, rgba(0,0,0,0.02))",fontSize:"11px",color:"var(--seekora-text-tertiary, #86868b)"},footerActions:{display:"flex",alignItems:"center",gap:"16px"},footerAction:{display:"flex",alignItems:"center",gap:"4px"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"40px",color:"var(--seekora-text-secondary, #86868b)"},spinner:{width:"24px",height:"24px",border:"2px solid var(--seekora-border-color, #e5e5e5)",borderTopColor:"var(--seekora-primary, #007aff)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #86868b)"}}),[]),D=t.useRef(null),$=t.useRef(null),[F,W]=t.useState(-1),q=t.useMemo(()=>s.map(e=>nt(e,c)),[s,c]),H=t.useMemo(()=>i.map(e=>st(e,d)),[i,d]),O=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,3),[l]),j=t.useMemo(()=>{const e=[];return y.forEach(t=>{e.push({type:"action",id:t.id,title:t.label,icon:t.icon,data:t})}),!a&&O.length>0&&O.forEach((r,a)=>{e.push({type:"recent",id:`recent-${a}`,title:r,icon:t.createElement(Gt,null),data:r})}),q.forEach((r,a)=>{e.push({type:"suggestion",id:r.id||`suggestion-${a}`,title:r.query,icon:t.createElement(Qt,null),data:r})}),H.forEach((r,a)=>{e.push({type:"product",id:r.id,title:r.title,subtitle:r.brand,icon:t.createElement(Ut,null),image:r.image,price:r.price,data:r})}),e},[y,a,O,q,H]),V=t.useCallback(()=>{W(e=>Math.min(e+1,j.length-1))},[j.length]),Q=t.useCallback(()=>{W(e=>Math.max(e-1,-1))},[]),U=t.useCallback(()=>{if(F<0)return void(a.trim()&&T?.(a.trim()));const e=j[F];if(e)switch(e.type){case"action":e.data.onAction?.();break;case"recent":I?.(e.data);break;case"suggestion":C?.(e.data._raw,F);break;case"product":R?.(e.data._raw,F)}},[F,j,a,T,I,C,R]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>F,setActiveIndex:W,selectActive:U,navigateNext:V,navigatePrevious:Q,focus:()=>w?.current?.focus(),close:()=>N?.()}),[F,U,V,Q,w,N]),t.useEffect(()=>{if($.current&&F>=0){const e=$.current.querySelector(`[data-index="${F}"]`);e&&bt(e,$.current)}},[F]),t.useEffect(()=>{W(-1)},[a]),!o)return null;const G=ut(p),K=j[F],X=t.createElement("div",{ref:D,className:pt("seekora-spotlight-dropdown",k,S.root),style:mt(B.root,{width:b,zIndex:g?void 0:v},G,E)},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),t.createElement("div",{style:B.searchContainer},t.createElement("div",{style:B.searchIcon},t.createElement(Vt,null)),t.createElement("input",{ref:w,type:"text",placeholder:f,defaultValue:a,style:B.searchInput,onChange:e=>T?.(e.target.value),onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),V()):"ArrowUp"===e.key?(e.preventDefault(),Q()):"Enter"===e.key?(e.preventDefault(),U()):"Escape"===e.key&&N?.()},autoFocus:!0}),h&&t.createElement("div",{style:B.shortcut},t.createElement("span",{style:B.kbd},"⌘"),t.createElement("span",{style:B.kbd},"K"))),A,t.createElement("div",{style:B.content},t.createElement("div",{ref:$,style:{...B.resultsColumn,maxHeight:x}},n?M?M():t.createElement("div",{style:B.loading},t.createElement("div",{style:B.spinner})):0===j.length?_?_(a):t.createElement("div",{style:B.empty},'No results for "',a,'"'):t.createElement(t.Fragment,null,y.length>0&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Actions"),j.filter(e=>"action"===e.type).map(e=>{const r=j.indexOf(e),a=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:mt(B.item,a?B.itemActive:void 0),onClick:()=>{W(r),U()},onMouseEnter:()=>W(r)},t.createElement("div",{style:mt(B.itemIcon,a?B.itemIconActive:void 0)},e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:mt(B.itemTitle,a?B.itemTitleActive:void 0)},e.title)))})),O.length>0&&!a&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Recent"),j.filter(e=>"recent"===e.type).map(e=>{const r=j.indexOf(e),a=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:mt(B.item,a?B.itemActive:void 0),onClick:()=>{W(r),I?.(e.data)},onMouseEnter:()=>W(r)},t.createElement("div",{style:mt(B.itemIcon,a?B.itemIconActive:void 0)},e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:mt(B.itemTitle,a?B.itemTitleActive:void 0)},e.title)))})),q.length>0&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Suggestions"),j.filter(e=>"suggestion"===e.type).map(e=>{const r=j.indexOf(e),o=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:mt(B.item,o?B.itemActive:void 0),onClick:()=>{W(r),C?.(e.data._raw,r)},onMouseEnter:()=>W(r)},t.createElement("div",{style:mt(B.itemIcon,o?B.itemIconActive:void 0)},e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:mt(B.itemTitle,o?B.itemTitleActive:void 0),dangerouslySetInnerHTML:{__html:dt(e.title,a,{tag:"strong"})}})))})),H.length>0&&t.createElement("div",{style:B.section},t.createElement("div",{style:B.sectionTitle},"Products"),j.filter(e=>"product"===e.type).map(e=>{const r=j.indexOf(e),a=F===r;return t.createElement("div",{key:e.id,"data-index":r,style:mt(B.item,a?B.itemActive:void 0),onClick:()=>{W(r),R?.(e.data._raw,r)},onMouseEnter:()=>W(r)},t.createElement("div",{style:mt(B.itemIcon,a?B.itemIconActive:void 0)},e.image?t.createElement("img",{src:e.image,alt:"",style:B.itemIconImage}):e.icon),t.createElement("div",{style:B.itemContent},t.createElement("div",{style:mt(B.itemTitle,a?B.itemTitleActive:void 0)},e.title),e.subtitle&&t.createElement("div",{style:mt(B.itemSubtitle,a?B.itemSubtitleActive:void 0)},e.subtitle)),void 0!==e.price&&t.createElement("span",{style:mt(B.itemAction,B.itemActionVisible,a?B.itemActionActive:void 0)},lt(e.price,{currency:u.currency})))})))),m&&K&&"product"===K.type&&t.createElement("div",{style:B.previewColumn},t.createElement("div",{style:B.previewContent},K.image&&t.createElement("img",{src:K.image,alt:"",style:B.previewImage}),t.createElement("div",{style:B.previewTitle},K.title),K.subtitle&&t.createElement("div",{style:B.previewSubtitle},K.subtitle),void 0!==K.price&&t.createElement("div",{style:B.previewPrice},lt(K.price,{currency:u.currency})),t.createElement("div",{style:B.previewActions},t.createElement("button",{style:{...B.previewAction,...B.previewActionPrimary},onClick:()=>R?.(K.data._raw,F)},"View Product"))))),void 0!==z?z:t.createElement("div",{style:B.footer},t.createElement("div",{style:B.footerActions},t.createElement("span",{style:B.footerAction},t.createElement("span",{style:B.kbd},"↑"),t.createElement("span",{style:B.kbd},"↓"),"navigate"),t.createElement("span",{style:B.footerAction},t.createElement("span",{style:B.kbd},"↵"),"select"),t.createElement("span",{style:B.footerAction},t.createElement("span",{style:B.kbd},"esc"),"close")),t.createElement("span",null,j.length," results")));return g?t.createElement("div",{style:{...B.overlay,zIndex:v},onClick:e=>{e.target===e.currentTarget&&N?.()}},X):X}),Xt=()=>t.createElement("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},t.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z"})),Yt=()=>t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"currentColor"},t.createElement("path",{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"})),Jt=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],categories:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},categoryFields:u={id:"id",label:"label"},productDisplay:p={},theme:m={},showHeroProduct:g=!0,showCollections:f=!0,showAddToCart:h=!0,addToCartText:y="Quick Add",showComparePrice:b=!0,width:x="100%",maxHeight:v="500px",zIndex:k=1e3,className:E,style:S,classNames:w={},onSuggestionSelect:C,onProductClick:R,onCategoryClick:I,onTabChange:N,onAddToCart:T,onViewAll:A,onClose:z,header:M,footer:_,renderLoading:L,renderEmpty:P}=e;Nt();const B=Ct(),{isMobile:D}=B,$=t.useMemo(()=>((e=!1)=>({root:{position:e?"fixed":"absolute",top:e?0:"100%",left:0,right:0,bottom:e?0:"auto",marginTop:e?0:"8px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #121212)",borderRadius:e?0:"16px",boxShadow:e?"none":"0 4px 30px rgba(0, 0, 0, 0.12)",overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:e?"16px":"14px",display:"flex",flexDirection:"column"},layout:{display:e?"flex":"grid",flexDirection:"column",gridTemplateColumns:e?"1fr":"1fr 1fr",minHeight:e?"auto":"400px",flex:1,overflowY:"auto"},leftPanel:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderRight:e?"none":"1px solid var(--seekora-border-color, #e8e8e1)",borderBottom:e?"1px solid var(--seekora-border-color, #e8e8e1)":"none",display:"flex",flexDirection:"column"},rightPanel:{backgroundColor:"var(--seekora-bg-secondary, #fafafa)",padding:e?"16px":"24px",display:"flex",flexDirection:"column",overflow:"hidden"},section:{flex:1,overflowY:"auto"},sectionHeader:{padding:"16px 20px 12px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--seekora-border-color, #e8e8e1)"},sectionTitle:{fontSize:"11px",fontWeight:600,color:"var(--seekora-text-secondary, #666)",textTransform:"uppercase",letterSpacing:"0.1em"},viewAllLink:{fontSize:"12px",color:"var(--seekora-text-primary, #121212)",textDecoration:"underline",cursor:"pointer"},suggestionItem:{display:"flex",alignItems:"center",padding:e?"14px 16px":"12px 16px",gap:"12px",cursor:"pointer",transition:"all 150ms ease",minHeight:"48px",margin:"4px 8px",borderRadius:"10px",color:"var(--seekora-text-primary, #121212)"},suggestionItemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #121212)"},suggestionIcon:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--seekora-text-tertiary, #999999)",flexShrink:0},suggestionContent:{flex:1,minWidth:0},suggestionQuery:{fontSize:"14px",color:"var(--seekora-text-primary, #121212)",fontWeight:400},suggestionMeta:{fontSize:"12px",color:"var(--seekora-text-secondary, #666)",marginTop:"2px"},suggestionArrow:{width:"16px",height:"16px",color:"var(--seekora-text-tertiary, #ccc)",transform:"rotate(-45deg)",opacity:0,transition:"opacity 150ms"},suggestionArrowVisible:{opacity:1},collectionsGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"1px",backgroundColor:"var(--seekora-border-color, #e8e8e1)",borderTop:"1px solid var(--seekora-border-color, #e8e8e1)"},collectionItem:{backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #121212)",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms"},collectionItemHover:{backgroundColor:"var(--seekora-bg-hover, #f0f0f0)",color:"var(--seekora-text-primary, #121212)"},collectionName:{fontSize:"13px",fontWeight:500,color:"var(--seekora-text-primary, #121212)",marginBottom:"4px"},collectionCount:{fontSize:"11px",color:"var(--seekora-text-secondary, #666)"},heroProduct:{marginBottom:"24px"},heroImage:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:"2px",marginBottom:"16px",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f5)"},heroTitle:{fontSize:"16px",fontWeight:500,color:"var(--seekora-text-primary, #121212)",marginBottom:"8px",lineHeight:1.3},heroBrand:{fontSize:"12px",color:"var(--seekora-text-secondary, #666)",marginBottom:"12px",textTransform:"uppercase",letterSpacing:"0.05em"},heroPricing:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"16px"},heroPrice:{fontSize:"18px",fontWeight:500,color:"var(--seekora-text-primary, #121212)"},heroComparePrice:{fontSize:"14px",color:"var(--seekora-text-tertiary, #999)",textDecoration:"line-through"},heroDiscount:{fontSize:"12px",fontWeight:600,color:"var(--seekora-error, #d02e2e)",backgroundColor:"var(--seekora-error-light, #fdf2f2)",padding:"2px 8px",borderRadius:"2px"},heroButton:{width:"100%",padding:"14px 20px",backgroundColor:"var(--seekora-text-primary, #121212)",color:"var(--seekora-bg-surface, #ffffff)",border:"none",borderRadius:"2px",fontSize:"13px",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.1em",cursor:"pointer",transition:"background-color 150ms"},heroButtonHover:{backgroundColor:"var(--seekora-text-secondary, #666666)",color:"var(--seekora-bg-surface, #ffffff)"},productsScroll:{flex:1,overflowX:"auto",overflowY:"hidden",display:"flex",gap:"16px",paddingBottom:"8px",scrollbarWidth:"thin"},productCard:{flex:"0 0 140px",cursor:"pointer",transition:"opacity 150ms"},productCardHover:{opacity:.7},productImage:{width:"140px",height:"175px",objectFit:"cover",backgroundColor:"var(--seekora-bg-tertiary, #f5f5f5)",marginBottom:"10px"},productTitle:{fontSize:"12px",color:"var(--seekora-text-primary, #121212)",marginBottom:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},productPrice:{fontSize:"12px",fontWeight:500,color:"var(--seekora-text-primary, #121212)"},footer:{padding:"12px 20px",borderTop:"1px solid var(--seekora-border-color, #e8e8e1)",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"11px",color:"var(--seekora-text-secondary, #666)"},footerLink:{color:"var(--seekora-text-primary, #121212)",textDecoration:"underline",cursor:"pointer"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #666)"},spinner:{width:"24px",height:"24px",border:"2px solid var(--seekora-border-color, #e8e8e1)",borderTopColor:"var(--seekora-text-primary, #121212)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)"},highlight:{fontWeight:600,textDecoration:"underline",textDecorationColor:"var(--seekora-text-primary, #121212)"}}))(D),[D]),F=t.useRef(null),[W,q]=t.useState(-1),[H,O]=t.useState(null),[j,V]=t.useState(null),[Q,U]=t.useState(!1),G=t.useMemo(()=>s.map(e=>nt(e,c)),[s,c]),K=t.useMemo(()=>i.map(e=>st(e,d)),[i,d]),X=t.useMemo(()=>l.map(e=>it(e,u)),[l,u]),Y=K[0],J=K.slice(1,7),Z=t.useCallback(()=>{q(e=>Math.min(e+1,G.length-1))},[G.length]),ee=t.useCallback(()=>{q(e=>Math.max(e-1,-1))},[]),te=t.useCallback(()=>{W>=0&&G[W]&&C?.(G[W]._raw,W)},[W,G,C]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>W,setActiveIndex:q,selectActive:te,navigateNext:Z,navigatePrevious:ee,focus:()=>F.current?.focus(),close:()=>z?.()}),[W,te,Z,ee,z]),t.useEffect(()=>{if(W>=0&&F.current){const e=F.current.querySelector(`[data-index="${W}"]`);e&&bt(e,F.current)}},[W]),!o)return null;const re=ut(m),ae=Y?((e,t)=>{if(e&&t&&!(t<=e))return Math.round((t-e)/t*100)})(Y.price,Y.comparePrice):void 0;return t.createElement("div",{ref:F,role:"listbox","aria-label":"Search suggestions",className:pt("seekora-shopify-dropdown",E,w.root),style:mt($.root,{width:D?"100%":x,maxHeight:D?"100vh":v,zIndex:k},re,S),tabIndex:-1},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n .seekora-shopify-dropdown mark {\n background: transparent;\n text-decoration: underline;\n font-weight: 600;\n }\n "),M,n?L?L():t.createElement("div",{style:$.loading},t.createElement("div",{style:$.spinner})):t.createElement("div",{style:$.layout},t.createElement("div",{style:$.leftPanel},t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Suggestions"),G.length>5&&t.createElement("span",{style:$.viewAllLink,onClick:()=>A?.("suggestions")},"View all")),G.slice(0,5).map((e,r)=>{const o=W===r;return t.createElement("div",{key:e.id||r,"data-index":r,role:"option","aria-selected":o,style:mt($.suggestionItem,o?$.suggestionItemActive:void 0),onClick:()=>C?.(e._raw,r),onMouseEnter:()=>q(r)},t.createElement("div",{style:$.suggestionIcon},t.createElement(Xt,null)),t.createElement("div",{style:$.suggestionContent},t.createElement("div",{style:$.suggestionQuery,dangerouslySetInnerHTML:{__html:dt(e.query,a,{tag:"mark"})}}),e.count&&t.createElement("div",{style:$.suggestionMeta},e.count," results")),t.createElement("div",{style:mt($.suggestionArrow,o?$.suggestionArrowVisible:void 0)},t.createElement(Yt,null)))}),0===G.length&&a&&(P?P(a):t.createElement("div",{style:{padding:"20px",textAlign:"center",color:"#666"}},'No suggestions for "',a,'"'))),f&&X.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Collections")),t.createElement("div",{style:$.collectionsGrid},X.slice(0,4).map(e=>t.createElement("div",{key:e.id,style:mt($.collectionItem,j===e.id?$.collectionItemHover:void 0),onClick:()=>N?.(e.id),onMouseEnter:()=>V(e.id),onMouseLeave:()=>V(null)},t.createElement("div",{style:$.collectionName},e.label),e.count&&t.createElement("div",{style:$.collectionCount},e.count," products")))))),t.createElement("div",{style:$.rightPanel},g&&Y&&t.createElement("div",{style:$.heroProduct},Y.image&&t.createElement("img",{src:Y.image,alt:Y.title,style:$.heroImage,loading:"lazy"}),Y.brand&&t.createElement("div",{style:$.heroBrand},Y.brand),t.createElement("div",{style:$.heroTitle},Y.title),t.createElement("div",{style:$.heroPricing},t.createElement("span",{style:$.heroPrice},lt(Y.price,{currency:p.currency||Y.currency||"$"})),b&&Y.comparePrice&&t.createElement("span",{style:$.heroComparePrice},lt(Y.comparePrice,{currency:p.currency||Y.currency||"$"})),ae&&t.createElement("span",{style:$.heroDiscount},"-",ae,"%")),h&&t.createElement("button",{style:mt($.heroButton,Q?$.heroButtonHover:void 0),onClick:()=>T?.(Y._raw),onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1)},y)),J.length>0&&t.createElement(t.Fragment,null,t.createElement("div",{style:{...$.sectionTitle,marginBottom:"12px"}},"More Products"),t.createElement("div",{style:$.productsScroll},J.map((e,r)=>t.createElement("div",{key:e.id,style:mt($.productCard,H===e.id?$.productCardHover:void 0),onClick:()=>R?.(e._raw,r+1),onMouseEnter:()=>O(e.id),onMouseLeave:()=>O(null)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:$.productImage,loading:"lazy"}):t.createElement("div",{style:$.productImage}),t.createElement("div",{style:$.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:$.productPrice},lt(e.price,{currency:p.currency||e.currency||"$"})))))))),void 0!==_?_:t.createElement("div",{style:$.footer},t.createElement("span",null,"Press ",t.createElement("strong",null,"Enter")," to search, ",t.createElement("strong",null,"↑↓")," to navigate"),t.createElement("span",{style:$.footerLink,onClick:()=>A?.("products")},"View all results")))}),Zt=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("circle",{cx:"11",cy:"11",r:"7"}),t.createElement("path",{d:"M21 21l-4.35-4.35"})),er=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("polyline",{points:"12 6 12 12 16 14"})),tr=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},t.createElement("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),t.createElement("polyline",{points:"17 6 23 6 23 12"})),rr=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"20",height:"20"},t.createElement("polyline",{points:"9 18 15 12 9 6"})),ar=()=>t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",width:"20",height:"20"},t.createElement("path",{d:"M7 17l5-5-5-5M13 17l5-5-5-5"})),or=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],trendingSearches:c=[],suggestionFields:d={query:"query"},productFields:u={id:"id",title:"title"},productDisplay:p={},theme:m={},showSearchInput:g=!0,showCancel:f=!0,cancelText:h="Cancel",showDragHandle:y=!0,swipeToDismiss:b=!0,footerButtonText:x="Search",showFooterButton:v=!0,width:k="100%",maxHeight:E="85vh",zIndex:S=9999,className:w,style:C,classNames:R={},inputRef:I,onSuggestionSelect:N,onProductClick:T,onRecentClick:A,onRecentClearAll:z,onSearchSubmit:M,onClose:_,header:L,footer:P,renderLoading:B,renderEmpty:D}=e;Nt();const $=t.useMemo(()=>({overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:9998,transition:"opacity 200ms ease"},root:{position:"fixed",left:0,right:0,bottom:0,backgroundColor:"var(--seekora-bg-surface, #fff)",borderRadius:"16px 16px 0 0",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.15)",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif)',fontSize:"var(--seekora-font-size, 16px)",zIndex:9999,transform:"translateY(0)",transition:"transform 300ms cubic-bezier(0.32, 0.72, 0, 1)",maxHeight:"90vh",display:"flex",flexDirection:"column"},rootHidden:{transform:"translateY(100%)"},dragHandle:{display:"flex",justifyContent:"center",padding:"12px",cursor:"grab"},dragBar:{width:"36px",height:"5px",backgroundColor:"var(--seekora-border-color, #e0e0e0)",borderRadius:"3px"},header:{padding:"0 16px 16px",borderBottom:"1px solid var(--seekora-border-color, #f0f0f0)"},searchContainer:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",borderRadius:"12px",padding:"12px 16px",gap:"12px"},searchIcon:{width:"20px",height:"20px",color:"var(--seekora-text-tertiary, #8e8e93)",flexShrink:0},searchInput:{flex:1,border:"none",background:"transparent",fontSize:"17px",color:"var(--seekora-text-primary, #000)",outline:"none"},cancelBtn:{padding:"8px",background:"none",border:"none",color:"var(--seekora-primary, #007aff)",fontSize:"17px",cursor:"pointer"},content:{flex:1,overflowY:"auto",overscrollBehavior:"contain",WebkitOverflowScrolling:"touch"},section:{padding:"8px 0"},sectionHeader:{padding:"16px 16px 8px",display:"flex",alignItems:"center",justifyContent:"space-between"},sectionTitle:{fontSize:"13px",fontWeight:600,color:"var(--seekora-text-secondary, #8e8e93)",textTransform:"uppercase",letterSpacing:"0.5px"},clearBtn:{fontSize:"15px",color:"var(--seekora-primary, #007aff)",background:"none",border:"none",cursor:"pointer"},item:{display:"flex",alignItems:"center",padding:"14px 16px",gap:"14px",cursor:"pointer",transition:"background-color 100ms",minHeight:"56px",color:"var(--seekora-text-primary, #000)"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f2f2f7)",color:"var(--seekora-text-primary, #000)"},itemIcon:{width:"24px",height:"24px",color:"var(--seekora-text-tertiary, #8e8e93)",flexShrink:0},itemImage:{width:"48px",height:"48px",borderRadius:"8px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",flexShrink:0},itemContent:{flex:1,minWidth:0},itemTitle:{fontSize:"17px",color:"var(--seekora-text-primary, #000)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemSubtitle:{fontSize:"15px",color:"var(--seekora-text-secondary, #8e8e93)",marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},itemAction:{color:"var(--seekora-text-tertiary, #c7c7cc)",flexShrink:0},productsScroll:{display:"flex",gap:"12px",padding:"0 16px 16px",overflowX:"auto",scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch"},productCard:{flex:"0 0 140px",scrollSnapAlign:"start",cursor:"pointer"},productImage:{width:"140px",height:"140px",borderRadius:"12px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",marginBottom:"8px"},productTitle:{fontSize:"15px",color:"var(--seekora-text-primary, #000)",marginBottom:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},productPrice:{fontSize:"15px",fontWeight:600,color:"var(--seekora-text-primary, #000)"},footer:{padding:"12px 16px",paddingBottom:"calc(12px + env(safe-area-inset-bottom, 0px))",borderTop:"1px solid var(--seekora-border-color, #f0f0f0)",backgroundColor:"var(--seekora-bg-secondary, #f8f8f8)"},footerBtn:{width:"100%",padding:"16px",backgroundColor:"var(--seekora-primary, #007aff)",color:"var(--seekora-text-inverse, #ffffff)",border:"none",borderRadius:"12px",fontSize:"17px",fontWeight:600,cursor:"pointer"},loading:{display:"flex",alignItems:"center",justifyContent:"center",padding:"60px",color:"var(--seekora-text-secondary, #8e8e93)"},spinner:{width:"28px",height:"28px",border:"3px solid var(--seekora-border-color, #e5e5ea)",borderTopColor:"var(--seekora-primary, #007aff)",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #8e8e93)",fontSize:"17px"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 16px",color:"var(--seekora-text-tertiary, #c7c7cc)"}}),[]),F=t.useRef(null),[W,q]=t.useState(-1),[H,O]=t.useState(a),[j,V]=t.useState(0),[Q,U]=t.useState(!1),G=t.useRef(0),K=t.useMemo(()=>s.map(e=>nt(e,d)),[s,d]),X=t.useMemo(()=>i.map(e=>st(e,u)),[i,u]),Y=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,5),[l]),J=t.useMemo(()=>c.map(e=>"string"==typeof e?e:e.query).slice(0,5),[c]),Z=t.useMemo(()=>{const e=[];return Y.forEach(t=>e.push({type:"recent",data:t})),J.forEach(t=>e.push({type:"trending",data:t})),K.forEach(t=>e.push({type:"suggestion",data:t})),e},[Y,J,K]),ee=t.useCallback(()=>{q(e=>Math.min(e+1,Z.length-1))},[Z.length]),te=t.useCallback(()=>{q(e=>Math.max(e-1,-1))},[]),re=t.useCallback(()=>{if(W<0||W>=Z.length)return void(H.trim()&&M?.(H.trim()));const e=Z[W];"recent"===e.type||"trending"===e.type?A?.(e.data):"suggestion"===e.type&&N?.(e.data._raw,W)},[W,Z,H,M,A,N]);t.useImperativeHandle(r,()=>({getActiveIndex:()=>W,setActiveIndex:q,selectActive:re,navigateNext:ee,navigatePrevious:te,focus:()=>I?.current?.focus(),close:()=>_?.()}),[W,re,ee,te,I,_]),t.useEffect(()=>{if(W>=0&&F.current){const e=F.current.querySelector(`[data-index="${W}"]`);e&&bt(e,F.current)}},[W]);if(t.useEffect(()=>{O(a)},[a]),!o)return null;const ae=ut(m),oe=!H&&Y.length>0,ne=!H&&J.length>0,se=X.length>0;return t.createElement(t.Fragment,null,t.createElement("div",{style:{...$.overlay,opacity:Q?1-j/300:1},onClick:_}),t.createElement("div",{ref:F,className:pt("seekora-mobile-sheet",w,R.root),style:mt($.root,{maxHeight:E,zIndex:S,transform:Q?`translateY(${j}px)`:"translateY(0)"},ae,C),onTouchStart:e=>{b&&(U(!0),G.current=e.touches[0].clientY)},onTouchMove:e=>{if(!Q)return;const t=e.touches[0].clientY-G.current;t>0&&V(t)},onTouchEnd:()=>{Q&&(U(!1),j>150&&_?.(),V(0))}},t.createElement("style",null,"\n @keyframes seekora-spin {\n to { transform: rotate(360deg); }\n }\n "),y&&t.createElement("div",{style:$.dragHandle},t.createElement("div",{style:$.dragBar})),(g||L)&&t.createElement("div",{style:$.header},L||t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},t.createElement("div",{style:$.searchContainer},t.createElement("div",{style:$.searchIcon},t.createElement(Zt,null)),t.createElement("input",{ref:I,type:"text",placeholder:"Search...",value:H,onChange:e=>O(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),W>=0?re():H.trim()&&M?.(H.trim())):"ArrowDown"===e.key?(e.preventDefault(),ee()):"ArrowUp"===e.key?(e.preventDefault(),te()):"Escape"===e.key&&_?.()},style:$.searchInput,autoFocus:!0})),f&&t.createElement("button",{style:$.cancelBtn,onClick:_},h))),t.createElement("div",{style:$.content},n?B?B():t.createElement("div",{style:$.loading},t.createElement("div",{style:$.spinner})):t.createElement(t.Fragment,null,oe&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Recent"),t.createElement("button",{style:$.clearBtn,onClick:z},"Clear")),Y.map((e,r)=>t.createElement("div",{key:`recent-${e}`,"data-index":r,style:mt($.item,W===r?$.itemActive:void 0),onClick:()=>{A?.(e),O(e)},onMouseEnter:()=>q(r)},t.createElement("div",{style:$.itemIcon},t.createElement(er,null)),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:$.itemTitle},e)),t.createElement("div",{style:$.itemAction},t.createElement(ar,null))))),ne&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Trending")),J.map((e,r)=>{const a=Y.length+r;return t.createElement("div",{key:`trending-${e}`,"data-index":a,style:mt($.item,W===a?$.itemActive:void 0),onClick:()=>{A?.(e),O(e)},onMouseEnter:()=>q(a)},t.createElement("div",{style:$.itemIcon},t.createElement(tr,null)),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:$.itemTitle},e)),t.createElement("div",{style:$.itemAction},t.createElement(rr,null)))})),H&&K.length>0&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Suggestions")),K.map((e,r)=>{const a=Y.length+J.length+r;return t.createElement("div",{key:e.id||r,"data-index":a,style:mt($.item,W===a?$.itemActive:void 0),onClick:()=>N?.(e._raw,r),onMouseEnter:()=>q(a)},t.createElement("div",{style:$.itemIcon},t.createElement(Zt,null)),t.createElement("div",{style:$.itemContent},t.createElement("div",{style:$.itemTitle,dangerouslySetInnerHTML:{__html:dt(e.query,H,{tag:"strong"})}}),e.count&&t.createElement("div",{style:$.itemSubtitle},e.count," results")),t.createElement("div",{style:$.itemAction},t.createElement(rr,null)))})),se&&t.createElement("div",{style:$.section},t.createElement("div",{style:$.sectionHeader},t.createElement("span",{style:$.sectionTitle},"Products")),t.createElement("div",{style:$.productsScroll},X.slice(0,8).map((e,r)=>t.createElement("div",{key:e.id,style:$.productCard,onClick:()=>T?.(e._raw,r)},e.image?t.createElement("img",{src:e.image,alt:e.title,style:$.productImage,loading:"lazy"}):t.createElement("div",{style:$.productImage}),t.createElement("div",{style:$.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:$.productPrice},lt(e.price,{currency:p.currency||e.currency||"$"})))))),H&&0===K.length&&!n&&(D?D(H):t.createElement("div",{style:$.empty},t.createElement("div",{style:$.emptyIcon},t.createElement(Zt,null)),t.createElement("p",null,'No results for "',H,'"'))))),void 0!==P?P:v&&H&&t.createElement("div",{style:$.footer},t.createElement("button",{style:$.footerBtn,onClick:()=>M?.(H)},x,' "',H,'"'))))}),nr=t.forwardRef(function(e,r){const{query:a,isOpen:o=!0,loading:n=!1,suggestions:s=[],products:i=[],recentSearches:l=[],suggestionFields:c={query:"query"},productFields:d={id:"id",title:"title"},productDisplay:u={},theme:p={},showIndices:m=!1,showTypeLabels:g=!1,showSectionDividers:f=!0,width:h="100%",maxHeight:y="400px",zIndex:b=1e3,className:x,style:v,classNames:k={},onSuggestionSelect:E,onProductClick:S,onRecentClick:w,onClose:C,onSearchSubmit:R,header:I,footer:N,renderLoading:T,renderEmpty:A}=e;Nt();const z=Ct(),{isMobile:M}=z,_=t.useMemo(()=>({root:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #e5e5e5)",fontFamily:'var(--seekora-font-family, "Inter", -apple-system, sans-serif)',fontSize:"var(--seekora-font-size, 15px)",letterSpacing:"-0.01em"},item:{display:"flex",alignItems:"center",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms ease, padding-left 150ms ease",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)",gap:"16px",color:"var(--seekora-text-primary, #111)"},itemLast:{borderBottom:"none"},itemActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #111)",paddingLeft:"24px"},itemIndex:{fontSize:"11px",fontWeight:500,color:"var(--seekora-text-tertiary, #999)",fontFamily:"monospace",minWidth:"20px"},itemContent:{flex:1,minWidth:0},itemQuery:{fontSize:"15px",fontWeight:500,color:"var(--seekora-text-primary, #111)"},itemMeta:{fontSize:"13px",color:"var(--seekora-text-secondary, #666)",marginTop:"4px",fontWeight:400},itemType:{fontSize:"10px",fontWeight:600,color:"var(--seekora-text-tertiary, #999)",textTransform:"uppercase",letterSpacing:"0.1em",padding:"4px 8px",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)"},productRow:{display:"flex",alignItems:"center",padding:"16px 20px",cursor:"pointer",transition:"background-color 150ms ease",borderBottom:"1px solid var(--seekora-border-color, #e8e8e8)",gap:"16px",color:"var(--seekora-text-primary, #111)"},productRowActive:{backgroundColor:"var(--seekora-bg-hover, #f5f5f5)",color:"var(--seekora-text-primary, #111)"},productImage:{width:"56px",height:"56px",objectFit:"cover",backgroundColor:"var(--seekora-bg-secondary, #f5f5f5)",flexShrink:0},productContent:{flex:1,minWidth:0},productTitle:{fontSize:"14px",fontWeight:500,color:"var(--seekora-text-primary, #111)",marginBottom:"4px"},productPrice:{fontSize:"14px",color:"var(--seekora-text-secondary, #666)"},divider:{padding:"12px 20px 8px",fontSize:"10px",fontWeight:600,color:"var(--seekora-text-tertiary, #999)",textTransform:"uppercase",letterSpacing:"0.15em",backgroundColor:"var(--seekora-bg-surface, #ffffff)",borderBottom:"1px solid var(--seekora-border-color, #f0f0f0)"},footer:{padding:"12px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"var(--seekora-bg-secondary, #fafafa)",fontSize:"12px",color:"var(--seekora-text-tertiary, #999)",borderTop:"1px solid var(--seekora-border-color, #e5e5e5)"},footerHint:{display:"flex",alignItems:"center",gap:"12px"},kbd:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"2px 6px",backgroundColor:"var(--seekora-bg-surface, #ffffff)",border:"1px solid var(--seekora-border-color, #ddd)",fontSize:"10px",fontFamily:"monospace"},loading:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)",fontSize:"14px"},empty:{padding:"40px 20px",textAlign:"center",color:"var(--seekora-text-secondary, #666)",fontSize:"14px"},highlight:{backgroundColor:"var(--seekora-highlight-bg, #fff3cd)",padding:"0 2px"}}),[]),L=t.useRef(null),P=t.useRef(null),[B,D]=t.useState(-1),$=t.useMemo(()=>s.map(e=>nt(e,c)),[s,c]),F=t.useMemo(()=>i.map(e=>st(e,d)),[i,d]),W=t.useMemo(()=>l.map(e=>"string"==typeof e?e:e.query).slice(0,3),[l]),q=t.useMemo(()=>{const e=[];return!a&&W.length>0&&W.forEach(t=>e.push({type:"recent",data:t})),$.forEach(t=>e.push({type:"suggestion",data:t})),F.forEach(t=>e.push({type:"product",data:t})),e},[a,W,$,F]),H=t.useCallback(()=>{D(e=>Math.min(e+1,q.length-1))},[q.length]),O=t.useCallback(()=>{D(e=>Math.max(e-1,-1))},[]),j=t.useCallback(()=>{const e=q[B];if(e)switch(e.type){case"recent":w?.(e.data);break;case"suggestion":E?.(e.data._raw,B);break;case"product":S?.(e.data._raw,B)}else a&&R?.(a)},[B,q,a,R,w,E,S]);if(t.useImperativeHandle(r,()=>({getActiveIndex:()=>B,setActiveIndex:D,selectActive:j,navigateNext:H,navigatePrevious:O,focus:()=>L.current?.focus(),close:()=>C?.()}),[B,j,H,O,C]),t.useEffect(()=>{if(P.current&&B>=0){const e=P.current.querySelector(`[data-index="${B}"]`);e&&bt(e,P.current)}},[B]),t.useEffect(()=>{D(-1)},[a]),!o)return null;const V=ut(p),Q=!a&&W.length>0;let U=0;return t.createElement("div",{ref:L,role:"listbox","aria-label":"Search suggestions",className:pt("seekora-minimal-dropdown",x,k.root),style:mt(_.root,{width:h,zIndex:b},V,v),tabIndex:-1},t.createElement("style",null,"\n .seekora-minimal-dropdown mark {\n background-color: var(--seekora-highlight-bg, #fff3cd);\n padding: 0 2px;\n }\n "),I,t.createElement("div",{ref:P,style:{maxHeight:y,overflowY:"auto"}},n?T?T():t.createElement("div",{style:_.loading},"Loading..."):0===q.length?A?A(a):t.createElement("div",{style:_.empty},a?`No results for "${a}"`:"Start typing to search"):t.createElement(t.Fragment,null,Q&&t.createElement(t.Fragment,null,f&&t.createElement("div",{style:_.divider},"Recent"),W.map((e,r)=>{const a=U++,o=B===a,n=r===W.length-1&&!$.length&&!F.length;return t.createElement("div",{key:`recent-${e}`,"data-index":a,style:mt(_.item,o?_.itemActive:void 0,n?_.itemLast:void 0),onClick:()=>w?.(e),onMouseEnter:()=>D(a)},m&&t.createElement("span",{style:_.itemIndex},a+1),t.createElement("div",{style:_.itemContent},t.createElement("div",{style:_.itemQuery},e)),g&&t.createElement("span",{style:_.itemType},"Recent"))})),$.length>0&&t.createElement(t.Fragment,null,f&&(Q||!1)&&t.createElement("div",{style:_.divider},"Suggestions"),$.map((e,r)=>{const o=U++,n=B===o,s=r===$.length-1&&!F.length;return t.createElement("div",{key:e.id||`suggestion-${r}`,"data-index":o,style:mt(_.item,n?_.itemActive:void 0,s?_.itemLast:void 0),onClick:()=>E?.(e._raw,r),onMouseEnter:()=>D(o)},m&&t.createElement("span",{style:_.itemIndex},o+1),t.createElement("div",{style:_.itemContent},t.createElement("div",{style:_.itemQuery,dangerouslySetInnerHTML:{__html:dt(e.query,a,{tag:"mark"})}}),e.count&&t.createElement("div",{style:_.itemMeta},e.count.toLocaleString()," results")),g&&t.createElement("span",{style:_.itemType},"Search"))})),F.length>0&&t.createElement(t.Fragment,null,f&&t.createElement("div",{style:_.divider},"Products"),F.slice(0,4).map((e,r)=>{const a=U++,o=B===a;return t.createElement("div",{key:e.id,"data-index":a,style:mt(_.productRow,o?_.productRowActive:void 0),onClick:()=>S?.(e._raw,r),onMouseEnter:()=>D(a)},e.image&&t.createElement("img",{src:e.image,alt:e.title,style:_.productImage,loading:"lazy"}),t.createElement("div",{style:_.productContent},t.createElement("div",{style:_.productTitle},e.title),void 0!==e.price&&t.createElement("div",{style:_.productPrice},lt(e.price,{currency:u.currency||e.currency||"$"}))),g&&t.createElement("span",{style:_.itemType},"Product"))})))),void 0!==N?N:t.createElement("div",{style:_.footer},t.createElement("div",{style:_.footerHint},t.createElement("span",null,t.createElement("span",{style:_.kbd},"↑")," ",t.createElement("span",{style:_.kbd},"↓")," navigate"),t.createElement("span",null,t.createElement("span",{style:_.kbd},"↵")," select"),t.createElement("span",null,t.createElement("span",{style:_.kbd},"esc")," close")),t.createElement("span",null,q.length," results")))});function sr(e){if(!e)return;const t=e,r=t.colors??{};return{backgroundColor:t.backgroundColor??r.background,textColor:t.textColor??r.text,surfaceColor:t.surfaceColor??r.hover,borderColor:t.borderColor??r.border,hoverColor:t.hoverColor??r.hover,primaryColor:t.primaryColor??r.primary,textSecondaryColor:t.textSecondaryColor??r.text,fontFamily:t.fontFamily}}const ir={amazon:Lt,google:Ft,pinterest:jt,spotlight:Kt,shopify:Jt,"mobile-sheet":or,minimal:nr},lr=t.forwardRef(function(e,r){const{client:a,variant:o="amazon",autoMobileVariant:n=!0,placeholder:s="Search...",defaultQuery:i="",value:l,minQueryLength:c=1,maxSuggestions:d=8,debounceMs:u=200,includeDropdownRecommendations:p=!0,includeDropdownProductList:m=!0,includeFilteredTabs:g=!0,includeCategories:f=!0,filteredTabs:h,analyticsTags:y,enableRecentSearches:b=!0,maxRecentSearches:x=10,showProducts:v=!0,showTrendingOnEmpty:k=!0,enableAnalytics:E=!0,analyticsConfig:w,suggestionFields:C,productFields:R,theme:I,onSearch:N,onQueryChange:T,onSuggestionSelect:A,onProductClick:z,onCategoryClick:M,onTabChange:_,className:L,style:P,inputClassName:B,dropdownWidth:D,dropdownMaxHeight:$="500px",zIndex:F=1e3,enableCache:W=!0,cacheTtlMs:q=3e4,cacheMaxSize:H=100}=e,O=S(),j=I??O.theme,V=fe({client:a,enabled:E,analyticsTags:w?.tags??y,trackImpressions:w?.trackImpressions??!0,trackClicks:w?.trackSuggestionClicks??!0});Nt(),t.useEffect(()=>{const e=document.documentElement,t=function(e){if(!e)return{"--seekora-bg-surface":"#ffffff","--seekora-bg-secondary":"#f7f7f7","--seekora-bg-tertiary":"#f0f0f0","--seekora-bg-hover":"#f5f5f5","--seekora-text-primary":"#0f1111","--seekora-text-secondary":"#565959","--seekora-text-tertiary":"#767676","--seekora-border-color":"#e7e7e7","--seekora-primary":"#f90","--seekora-text-on-primary":"#0f1111","--seekora-text-inverse":"#ffffff","--seekora-link":"#007185","--seekora-font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'};const t=e,r=t.colors??{};return{"--seekora-bg-surface":t.backgroundColor??r.background??"#ffffff","--seekora-bg-secondary":t.surfaceColor??r.hover??"#f7f7f7","--seekora-bg-tertiary":t.hoverColor??r.hover??"#f0f0f0","--seekora-bg-hover":t.hoverColor??r.hover??"#f5f5f5","--seekora-text-primary":t.textColor??r.text??"#0f1111","--seekora-text-secondary":t.textSecondaryColor??r.text??"#565959","--seekora-text-tertiary":t.textSecondaryColor??"#767676","--seekora-border-color":t.borderColor??r.border??"#e7e7e7","--seekora-primary":t.primaryColor??r.primary??"#f90","--seekora-text-on-primary":t.textOnPrimaryColor??"#0f1111","--seekora-text-inverse":t.textInverseColor??"#ffffff","--seekora-link":t.primaryColor??r.primary??"#007185","--seekora-font-family":t.fontFamily??'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'}}(j);Object.entries(t).forEach(([t,r])=>{e.style.setProperty(t,r)})},[j]);const Q=Ct(),{isMobile:U}=Q,G=t.useMemo(()=>n&&U&&"mobile-sheet"!==o&&"spotlight"!==o?"mobile-sheet":o,[o,U,n]),[K,X]=t.useState(i),[Y,J]=t.useState(!1),[Z,ee]=t.useState(!1),[te,re]=t.useState(!1),[ae,oe]=t.useState([]),[ne,se]=t.useState([]),[ie,le]=t.useState([]),[ce,de]=t.useState([]),[ue,pe]=t.useState([]),[me,ge]=t.useState([]),[he,ye]=t.useState("all"),be=t.useRef(null),xe=t.useRef(null),ve=t.useRef(null),ke=t.useRef(null),Ee=t.useMemo(()=>W?kt({maxSize:H,defaultTtlMs:q}):null,[W,H,q]),Se=void 0!==l?l:K,we=t.useMemo(()=>(e=>({container:{position:"relative",width:"100%",fontFamily:'var(--seekora-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)'},inputWrapper:{display:"flex",alignItems:"center",backgroundColor:"var(--seekora-bg-surface, #ffffff)",color:"var(--seekora-text-primary, #111827)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--seekora-border-color, #d1d5db)",borderRadius:e?"8px":"24px",overflow:"hidden",transition:"border-color 150ms, box-shadow 150ms",boxShadow:"0 1px 3px rgba(0,0,0,0.05)"},inputWrapperFocused:{borderColor:"var(--seekora-primary, #f90)",boxShadow:"0 0 0 3px rgba(255, 153, 0, 0.15), 0 2px 8px rgba(0,0,0,0.1)"},searchIcon:{padding:e?"0 10px 0 14px":"0 12px 0 18px",color:"var(--seekora-text-secondary, #6b7280)",display:"flex",alignItems:"center",flexShrink:0},input:{flex:1,padding:e?"12px 8px 12px 0":"14px 12px 14px 0",fontSize:e?"16px":"15px",borderWidth:0,borderStyle:"none",outline:"none",backgroundColor:"transparent",color:"var(--seekora-text-primary, #0f1111)",fontFamily:"inherit",minWidth:0,WebkitAppearance:"none"},clearButton:{padding:"8px 14px",background:"none",borderWidth:0,borderStyle:"none",cursor:"pointer",color:"var(--seekora-text-tertiary, #9ca3af)",fontSize:"18px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"color 150ms"},loadingSpinner:{width:"18px",height:"18px",borderWidth:"2px",borderStyle:"solid",borderColor:"#e5e7eb",borderTopColor:"#f90",borderRadius:"50%",animation:"seekora-spin 0.8s linear infinite",marginRight:"12px",flexShrink:0}}))(U),[U]);t.useEffect(()=>{if(b){const e=ft();ge(e.slice(0,x))}},[b,x]);const Ce=t.useCallback(async e=>{if(!a)return;if(e.length>0&&e.length<c)return oe([]),se([]),void de([]);const t={maxSuggestions:d,includeDropdownRecommendations:p,includeDropdownProductList:m,includeFilteredTabs:g,includeCategories:f,filteredTabs:h?.map(e=>e.filter).join(",")},r=Ee?.generateKey(e,t);if(Ee&&r){const t=Ee.get(r);if(t)return console.log("Seekora: Cache hit for query:",e),void Re(t)}re(!0);try{const t=await(a.getSuggestions?.(e,{hitsPerPage:d,include_dropdown_recommendations:p,include_dropdown_product_list:m,include_filtered_tabs:g,include_categories:f,filtered_tabs:h,analytics_tags:y,returnFullResponse:!0}));if(Ee&&r&&t&&(Ee.set(r,t),console.log("Seekora: Cached response for query:",e)),Re(t),E&&t&&!Array.isArray(t)){const r=t;V.trackImpression({suggestions:(r.suggestions||[]).map(e=>({query:e.query||e.text||"",objectID:e.objectID||e.id,popularity:e.popularity})),products:r.extensions?.trending_products||r.extensions?.item_recommendations||[],categories:r.extensions?.popular_categories||[],brands:r.extensions?.popular_brands||[],query:e,timestamp:Date.now()})}}catch(e){console.error("Seekora: Failed to fetch suggestions",e),oe([]),se([]),de([])}finally{re(!1)}},[a,c,d,p,m,g,f,h,y,E,V,Ee]),Re=t.useCallback(e=>{let t=[],r={};if(console.log("Seekora: Raw response structure",{hasSuggestions:!!e?.suggestions,hasResults:!!e?.results,hasExtensions:!!e?.extensions,hasData:!!e?.data}),e?.suggestions&&e?.extensions)t=e.suggestions||[],r=e.extensions||{};else if(e?.results&&Array.isArray(e.results)){const a=e.results[0]||{},o=e.results[1]||{};t=a.hits||a.suggestions||[],r=a.extensions||o.extensions||{}}else e?.data?(t=e.data.hits||[],r=e.data.extensions||e.data.dropdown_recommendations||{}):e?.hits?(t=e.hits||[],r=e.extensions||e.dropdown_recommendations||{}):Array.isArray(e)&&(t=e);oe(t);const a=r.filtered_tabs||[];de(a),a.length>0&&a[0].products?se(a[0].products):se(r.trending_products||r.item_recommendations||[]),le(r.popular_categories||[]),pe(r.trending_searches||r.top_searches||[]),console.log("Seekora: Parsed response",{suggestions:t.length,tabs:a.length,products:a[0]?.products?.length||0,extensionKeys:Object.keys(r)})},[]),Ie=t.useCallback(e=>{const t=e.target.value;void 0===l&&X(t),T?.(t),ye("all"),ve.current&&clearTimeout(ve.current),t.length>=c?(J(!0),ve.current=setTimeout(()=>{Ce(t)},u)):0===t.length&&(b||k)?(J(!0),oe([])):J(!1)},[l,T,c,u,Ce,b,k]),Ne=t.useCallback(()=>{ee(!0),J(!0),E&&V.trackDropdownOpen(Se),Se.length>=c?0===ae.length&&Ce(Se):Ce("")},[Se,c,ae.length,Ce,E,V]),Te=t.useCallback(()=>{ee(!1),setTimeout(()=>{ke.current?.contains(document.activeElement)||J(!1)},150)},[]),Ae=t.useCallback(e=>{if("Escape"===e.key)J(!1),be.current?.blur();else if("Enter"===e.key){e.preventDefault();(xe.current?.getActiveIndex?.()??-1)>=0&&Y?xe.current?.selectActive?.():Se.trim()&&(N?.(Se.trim()),b&&(ht(Se.trim()),ge(ft().slice(0,x))),E&&V.trackSearchSubmit(Se.trim(),!1),J(!1))}else"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),!Y&&(ae.length>0||me.length>0)&&J(!0),"ArrowDown"===e.key?xe.current?.navigateNext?.():xe.current?.navigatePrevious?.())},[Se,N,b,x,Y,ae.length,me.length,E,V]),ze=t.useCallback((e,t)=>{const r=e.query||e.text||e.objectID||"";void 0===l&&X(r),T?.(r),A?.(e,t),b&&r&&(ht(r),ge(ft().slice(0,x))),E&&(V.trackSuggestionClick({suggestion:{query:r,objectID:e.objectID||e.id,popularity:e.popularity},position:t,section:"suggestions",query:Se,totalSuggestions:ae.length}),V.trackSearchSubmit(r,!0,e)),N?.(r),J(!1)},[l,T,A,b,x,E,N,V,Se,ae.length]),Me=t.useCallback((e,t)=>{z?.(e,t),E&&V.trackProductClick({product:{id:e.id||e.objectID,objectID:e.objectID||e.id,title:e.title||e.name,image:e.image,price:e.price},position:t,section:"all"!==he?"filtered_tab":"products",tabId:"all"!==he?he:void 0,query:Se})},[z,E,V,he,Se]),_e=t.useCallback((e,t)=>{M?.(e,t),E&&V.trackCategoryClick({value:e.label||e.value||e.id,count:e.count,path:e.path},Se)},[M,E,V,Se]),Le=t.useCallback(e=>{if(console.log("Seekora: Tab changed to",e),ye(e),_?.(e),E){const t=ce.find(t=>t.id===e);t&&V.trackTabSelect({id:t.id,label:t.label,filter:t.filter,products:t.products,nb_hits:t.nb_hits},Se)}},[_,E,V,ce,Se]),Pe=t.useCallback(e=>{void 0===l&&X(e),T?.(e),Ce(e),E&&V.trackRecentSearchClick({query:e,timestamp:Date.now()})},[l,T,Ce,E,V]),Be=t.useCallback(e=>{yt(e),ge(ft().slice(0,x))},[x]),De=t.useCallback(()=>{void 0===l&&X(""),T?.(""),oe([]),se([]),de([]),be.current?.focus()},[l,T]),$e=t.useCallback(()=>{J(!1),E&&V.trackDropdownClose(Se)},[E,V,Se]);t.useImperativeHandle(r,()=>({focus:()=>be.current?.focus(),blur:()=>be.current?.blur(),clear:De,getQuery:()=>Se,setQuery:e=>{void 0===l&&X(e),T?.(e)},openDropdown:()=>J(!0),closeDropdown:()=>J(!1),refresh:()=>Ce(Se),clearCache:()=>Ee?.clear(),getCacheStats:()=>Ee?.getStats()??null}),[Se,l,T,De,Ce,Ee]);const Fe=ir[G]||Lt,We=t.useMemo(()=>{if(console.log("Seekora: Computing products for tab",he,"from",ce.length,"tabs"),0===ce.length)return ne;if("all"===he){const e=ce[0]?.products||[];return e.length>0?e:ne}const e=ce.find(e=>e.id===he);return e?.products&&e.products.length>0?(console.log("Seekora: Found",e.products.length,"products for tab",he),e.products):ne},[he,ce,ne]);return t.createElement("div",{ref:ke,className:pt("seekora-suggestion-search",L),style:mt(we.container,P)},t.createElement("div",{style:mt(we.inputWrapper,Z?we.inputWrapperFocused:void 0)},t.createElement("div",{style:we.searchIcon},t.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20"},t.createElement("path",{fillRule:"evenodd",d:"M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",clipRule:"evenodd"}))),t.createElement("input",{ref:be,type:"text",value:Se,onChange:Ie,onFocus:Ne,onBlur:Te,onKeyDown:Ae,placeholder:s,className:B,style:we.input,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":"Search","aria-expanded":Y,"aria-haspopup":"listbox"}),te&&t.createElement("div",{style:we.loadingSpinner}),Se&&!te&&t.createElement("button",{type:"button",onClick:De,style:we.clearButton,"aria-label":"Clear search"},"×")),Y&&t.createElement(Fe,{query:Se,isOpen:Y,loading:te,suggestions:ae,products:We,categories:ce.map(e=>({id:e.id,label:e.label,count:e.nb_hits})),recentSearches:me.map(e=>"string"==typeof e?e:e.query),trendingSearches:ue,filteredTabs:ce,activeTab:he,suggestionFields:C,productFields:R,theme:sr(j)??j,width:D||"100%",maxHeight:$,zIndex:F,analytics:{enabled:E,trackSuggestionClicks:w?.trackSuggestionClicks??!0,trackProductClicks:w?.trackProductClicks??!0,trackImpressions:w?.trackImpressions??!0,trackCategoryClicks:w?.trackCategoryClicks??!0,trackBrandClicks:w?.trackBrandClicks??!0,trackSearchSubmit:w?.trackSearchSubmit??!0,tags:w?.tags??y},onSuggestionSelect:ze,onProductClick:Me,onCategoryClick:_e,onTabChange:Le,onRecentClick:Pe,onRecentRemove:Be,onClose:$e}))}),cr={amazon:Lt,google:Ft,pinterest:jt,spotlight:Kt,shopify:Jt,"mobile-sheet":or,minimal:nr};function dr({isOpen:e,onClose:a,children:o}){const n=t.useRef(null),s=t.useRef(null);if(t.useEffect(()=>{const t=e=>{s.current&&!s.current.contains(e.target)&&a()};return e&&document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[e,a]),t.useEffect(()=>{if(e){const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e]),t.useEffect(()=>{if(!e||!s.current)return;const t=s.current,r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),a=r[0],o=r[r.length-1],n=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===a&&(e.preventDefault(),o?.focus()):document.activeElement===o&&(e.preventDefault(),a?.focus()))};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},[e]),!e||"undefined"==typeof document)return null;const i=t.createElement("div",{ref:n,className:"seekora-docsearch-overlay",role:"dialog","aria-modal":"true","aria-label":"Search documentation"},t.createElement("div",{ref:s,className:"seekora-docsearch-container"},o));return r.createPortal(i,document.body)}function ur({value:e,onChange:r,onKeyDown:a,placeholder:o="Search documentation...",isLoading:n=!1,onClear:s}){const i=t.useRef(null);t.useEffect(()=>{i.current&&i.current.focus()},[]);return t.createElement("div",{className:"seekora-docsearch-searchbox"},t.createElement("label",{className:"seekora-docsearch-searchbox-icon",htmlFor:"seekora-docsearch-input"},n?t.createElement("span",{className:"seekora-docsearch-spinner","aria-hidden":"true"},t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20"},t.createElement("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeDasharray:"40",strokeDashoffset:"10"},t.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 10 10",to:"360 10 10",dur:"0.8s",repeatCount:"indefinite"})))):t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},t.createElement("path",{d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",fill:"currentColor"}))),t.createElement("input",{ref:i,id:"seekora-docsearch-input",className:"seekora-docsearch-input",type:"text",value:e,onChange:e=>r(e.target.value),onKeyDown:a,placeholder:o,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-autocomplete":"list","aria-controls":"seekora-docsearch-results"}),e&&t.createElement("button",{type:"button",className:"seekora-docsearch-clear",onClick:()=>{r(""),s?.(),i.current?.focus()},"aria-label":"Clear search"},t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},t.createElement("path",{d:"M4.28 3.22a.75.75 0 00-1.06 1.06L6.94 8l-3.72 3.72a.75.75 0 101.06 1.06L8 9.06l3.72 3.72a.75.75 0 101.06-1.06L9.06 8l3.72-3.72a.75.75 0 00-1.06-1.06L8 6.94 4.28 3.22z",fill:"currentColor"}))))}function pr({value:e,highlightedValue:r}){return r?t.createElement("span",{className:"seekora-docsearch-highlight",dangerouslySetInnerHTML:{__html:(a=r,a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/<mark>/g,"<mark>").replace(/<\/mark>/g,"</mark>").replace(/<ais-highlight>/g,"<mark>").replace(/<\/ais-highlight>/g,"</mark>").replace(/<em>/g,"<mark>").replace(/<\/em>/g,"</mark>"))}}):t.createElement("span",null,e);var a}function mr({hit:e,isSelected:r,onClick:a,onMouseEnter:o,openInNewTab:n,isChild:s,isLastChild:i,hierarchyType:l}){const c="objectID"in e,d=e,u=l||d.type,p=d.parentTitle?`${d.category||""} › ${d.parentTitle}`.replace(/^› /,""):d.category||"",m=function(e,t){const r=e.hierarchy||{};if(!t)return e.title||r.lvl1||r.lvl0||"Untitled";const a=t.match(/^lvl(\d+)$/);if(a){const e=r[`lvl${parseInt(a[1],10)}`];if(e)return e}return e.title||r.lvl1||r.lvl0||"Untitled"}(e,u);let g=m,f=e.content||d.description||"";if(c){const t=e;t._highlightResult&&(g=t._highlightResult.title?.value||m,f=t._highlightResult.content?.value||e.content||"")}else d.highlight&&(g=d.highlight.title||m,f=d.highlight.content||e.content||d.description||"");const h=f?function(e,t=150){const r=e.indexOf("<mark>");if(-1===r||e.length<=t)return e.length<=t?e:e.slice(0,t)+"...";const a=Math.floor(t/2);let o=Math.max(0,r-a),n=Math.min(e.length,r+a);if(o>0){const t=e.indexOf(" ",o);-1!==t&&t<r&&(o=t+1)}if(n<e.length){const t=e.lastIndexOf(" ",n);-1!==t&&t>r&&(n=t)}let s=e.slice(o,n);return o>0&&(s="..."+s),n<e.length&&(s+="..."),s}(f,120):"",y=e.url||d.route||"#",b=["seekora-docsearch-hit"];return r&&b.push("seekora-docsearch-hit--selected"),s&&b.push("seekora-docsearch-hit--child"),i&&b.push("seekora-docsearch-hit--last-child"),t.createElement("a",{href:y,className:b.join(" "),onClick:e=>{e.preventDefault(),a()},onMouseEnter:o,role:"option","aria-selected":r,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0},s&&t.createElement("div",{className:"seekora-docsearch-hit-tree"},t.createElement(hr,{isLast:i})),t.createElement("div",{className:"seekora-docsearch-hit-icon"},t.createElement(fr,{type:gr(u)})),t.createElement("div",{className:"seekora-docsearch-hit-content"},!s&&p&&t.createElement("span",{className:"seekora-docsearch-hit-breadcrumb"},p),t.createElement("span",{className:"seekora-docsearch-hit-title"},t.createElement(pr,{value:m,highlightedValue:g})),h&&t.createElement("span",{className:"seekora-docsearch-hit-description"},t.createElement(pr,{value:e.content||"",highlightedValue:h}))),t.createElement("div",{className:"seekora-docsearch-hit-action"},n?t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M6 3H3v10h10v-3M9 3h4v4M14 2L7 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})):t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M6.75 3.25L11.5 8L6.75 12.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))))}function gr(e){if(!e)return"page";const t=e.match(/^lvl(\d+)$/);if(t){const e=parseInt(t[1],10);return 1===e?"page":e<=3?"section":"content"}return"page"}function fr({type:e}){switch(e){case"page":return t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M4.5 3.5h11a1 1 0 011 1v11a1 1 0 01-1 1h-11a1 1 0 01-1-1v-11a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),t.createElement("path",{d:"M7 7h6M7 10h6M7 13h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}));case"section":return t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M4 5.5h12M4 10h12M4 14.5h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}));case"content":return t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true"},t.createElement("path",{d:"M4 6h12M4 10h8M4 14h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))}}function hr({isLast:e}){return t.createElement("svg",{width:"16",height:"20",viewBox:"0 0 16 20",fill:"none","aria-hidden":"true",className:"seekora-docsearch-hit-tree-icon"},e?t.createElement("path",{d:"M8 0V10H14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):t.createElement(t.Fragment,null,t.createElement("path",{d:"M8 0V20",stroke:"currentColor",strokeWidth:"1.5"}),t.createElement("path",{d:"M8 10H14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})))}function yr(e){if(!e)return 1;const t=e.match(/^lvl(\d+)$/);return t?parseInt(t[1],10):1}function br(e){return yr(e)>=2}function xr(e){const t=e.hierarchy??{};return[t.lvl0??"",t.lvl1??"",t.lvl2??"",t.lvl3??"",t.lvl4??"",t.lvl5??""].join("\0")}function vr(e){const t=e.hierarchy??{},r=[t.lvl0,t.lvl1,t.lvl2,t.lvl3,t.lvl4,t.lvl5].filter(e=>"string"==typeof e&&e.length>0),a=[];for(const e of r)a[a.length-1]!==e&&a.push(e);return a.join(" › ")}function kr(e,t){return"objectID"in e?e.objectID:`suggestion-${e.url}-${t}`}function Er({hits:e,groupedHits:r,selectedIndex:a,onSelect:o,onHover:n,scrollSelectionIntoViewRef:s,query:i,isLoading:l,error:c,translations:d={},sources:u=[]}){const p=t.useRef(null);if(t.useEffect(()=>{if(!p.current||0===e.length)return;if(s&&!s.current)return;const t=p.current.querySelectorAll(".seekora-docsearch-results-group");let r=0;for(const e of t){const t=e.querySelector(".seekora-docsearch-results-group-items");if(!t)continue;const o=t.children;for(let e=0;e<o.length;e++){if(r===a)return o[e].scrollIntoView({block:"nearest"}),void(s&&(s.current=!1));r++}}s&&(s.current=!1)},[a,e.length,s]),!i)return t.createElement("div",{className:"seekora-docsearch-empty"},t.createElement("p",{className:"seekora-docsearch-empty-text"},d.searchPlaceholder||"Type to start searching..."));if(l&&0===e.length)return t.createElement("div",{className:"seekora-docsearch-loading"},t.createElement("div",{className:"seekora-docsearch-loading-spinner"},t.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true"},t.createElement("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeDasharray:"50",strokeDashoffset:"15"},t.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"0.8s",repeatCount:"indefinite"})))),t.createElement("p",{className:"seekora-docsearch-loading-text"},d.loadingText||"Searching..."));if(c)return t.createElement("div",{className:"seekora-docsearch-error"},t.createElement("p",{className:"seekora-docsearch-error-text"},d.errorText||c));if(0===e.length&&i)return t.createElement("div",{className:"seekora-docsearch-no-results"},t.createElement("p",{className:"seekora-docsearch-no-results-text"},d.noResultsText||`No results found for "${i}"`));const m=r&&r.length>0?r.map(e=>({category:e.source.name,sourceId:e.source.id,openInNewTab:e.source.openInNewTab,hits:e.items})):function(e){const t=new Map;e.forEach((e,r)=>t.set(e,r));const r=new Map;for(const t of e){const e=xr(t);r.has(e)||r.set(e,[]),r.get(e).push(t)}const a=Array.from(r.entries());a.sort(([,e],[,r])=>Math.min(...e.map(e=>t.get(e)??0))-Math.min(...r.map(e=>t.get(e)??0)));const o=[];for(const[,e]of a){const t=[...e].sort((e,t)=>{const r=e.type,a=t.type;return yr(r)-yr(a)}),r=t.map((e,r)=>{const a=br(e.type),o=t[r+1],n=a&&(!o||!br(o.type));return{...e,isChild:a,isLastChild:n}}),a=vr(e[0]);o.push({category:a||null,hits:r})}return o}(e).map(e=>({category:e.category,sourceId:"default",openInNewTab:!1,hits:e.hits}));return t.createElement("div",{className:"seekora-docsearch-results"},t.createElement("ul",{ref:p,id:"seekora-docsearch-results",className:"seekora-docsearch-results-list",role:"listbox"},m.map((e,r)=>t.createElement("li",{key:e.sourceId+"-"+r,className:"seekora-docsearch-results-group"},e.category&&t.createElement("div",{className:"seekora-docsearch-results-group-header"},e.category),t.createElement("ul",{className:"seekora-docsearch-results-group-items"},e.hits.map((s,i)=>{const l=function(e,t,r){let a=0;for(let r=0;r<t;r++)a+=e[r].hits.length;return a+r}(m,r,i),c=s;return t.createElement("li",{key:kr(s,i)},t.createElement(mr,{hit:s,isSelected:l===a,onClick:()=>o(s),onMouseEnter:()=>n(l),openInNewTab:e.openInNewTab,isChild:c.isChild,isLastChild:c.isLastChild,hierarchyType:s.type}))}))))))}function Sr({translations:e={}}){return t.createElement("footer",{className:"seekora-docsearch-footer"},t.createElement("div",{className:"seekora-docsearch-footer-commands"},t.createElement("ul",{className:"seekora-docsearch-footer-commands-list"},t.createElement("li",null,t.createElement("span",{className:"seekora-docsearch-footer-command"},t.createElement("kbd",{className:"seekora-docsearch-key"},"↵"),t.createElement("span",null,"to select"))),t.createElement("li",null,t.createElement("span",{className:"seekora-docsearch-footer-command"},t.createElement("kbd",{className:"seekora-docsearch-key"},"↑"),t.createElement("kbd",{className:"seekora-docsearch-key"},"↓"),t.createElement("span",null,"to navigate"))),t.createElement("li",null,t.createElement("span",{className:"seekora-docsearch-footer-command"},t.createElement("kbd",{className:"seekora-docsearch-key"},"esc"),t.createElement("span",null,e.closeText||"to close"))))),t.createElement("div",{className:"seekora-docsearch-footer-logo"},t.createElement("span",{className:"seekora-docsearch-footer-logo-text"},e.searchByText||"Search by"),t.createElement("a",{href:"https://seekora.ai",target:"_blank",rel:"noopener noreferrer",className:"seekora-docsearch-footer-logo-link"},t.createElement("span",{className:"seekora-docsearch-logo",style:{fontFamily:"system-ui",fontSize:14,fontWeight:600}},"Seekora"))))}function wr(e){const{isOpen:r,onOpen:a,onClose:o,onSelectNext:n,onSelectPrev:s,onEnter:i,disableShortcut:l=!1,shortcutKey:c="k"}=e,d=t.useCallback(e=>{if(!l&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===c)return e.preventDefault(),void(r?o():a());if(!l&&"/"===e.key&&!r){const t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),a())}},[r,a,o,l,c]),u=t.useCallback(e=>{switch(e.key){case"Escape":e.preventDefault(),o();break;case"ArrowDown":e.preventDefault(),n();break;case"ArrowUp":e.preventDefault(),s();break;case"Enter":e.preventDefault(),i();break;case"Tab":e.shiftKey?s():n(),e.preventDefault()}},[o,n,s,i]);return t.useEffect(()=>(document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}),[d]),{handleModalKeyDown:u}}function Cr(e="K"){if("undefined"==typeof navigator)return`⌘${e}`;return navigator.platform.toLowerCase().includes("mac")?`⌘${e}`:`Ctrl+${e}`}function Rr({onClick:e,placeholder:r="Search documentation..."}){const a=Cr("K");return t.createElement("button",{type:"button",className:"seekora-docsearch-button",onClick:e,"aria-label":"Search documentation"},t.createElement("span",{className:"seekora-docsearch-button-icon"},t.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},t.createElement("path",{d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",fill:"currentColor"}))),t.createElement("span",{className:"seekora-docsearch-button-placeholder"},r),t.createElement("span",{className:"seekora-docsearch-button-keys"},t.createElement("kbd",{className:"seekora-docsearch-button-key"},a)))}const Ir={query:"",results:[],suggestions:[],groupedSuggestions:[],isLoading:!1,error:null,selectedIndex:0,mode:"suggestions"};function Nr(e,t){switch(t.type){case"SET_QUERY":return{...e,query:t.payload,selectedIndex:0};case"SET_RESULTS":return{...e,results:t.payload,mode:"results"};case"SET_SUGGESTIONS":return{...e,suggestions:t.payload,mode:"suggestions"};case"SET_GROUPED_SUGGESTIONS":{const r=t.payload.flatMap(e=>e.items.map(t=>({...t,_source:e.source.id})));return{...e,groupedSuggestions:t.payload,suggestions:r,mode:"suggestions"}}case"SET_LOADING":return{...e,isLoading:t.payload};case"SET_ERROR":return{...e,error:t.payload};case"SET_SELECTED_INDEX":return{...e,selectedIndex:t.payload};case"SELECT_NEXT":{const t=("results"===e.mode?e.results:e.suggestions).length-1;return{...e,selectedIndex:e.selectedIndex>=t?0:e.selectedIndex+1}}case"SELECT_PREV":{const t=("results"===e.mode?e.results:e.suggestions).length-1;return{...e,selectedIndex:e.selectedIndex<=0?t:e.selectedIndex-1}}case"SET_MODE":return{...e,mode:t.payload,selectedIndex:0};case"RESET":return Ir;default:return e}}function Tr(e){const{apiEndpoint:r,apiKey:a,sources:o,maxResults:n=10,debounceMs:s=200,processGroupedResults:i}=e,l=o||(r?[{id:"default",name:"Results",endpoint:r,apiKey:a,maxResults:n}]:[]),[c,d]=t.useReducer(Nr,Ir),u=t.useRef(new Map),p=t.useRef(null),m=t.useCallback((e,t)=>(e?.data?.results||[]).map(e=>{const r=e.document||e;return{url:r.url||r.route||"",title:(r.title||r.name||"").replace?.(/<\/?mark>/g,"")||"",content:(r.content||r.description||"").replace?.(/<\/?mark>/g,"")?.substring?.(0,100)||"",description:r.description||r.content?.substring?.(0,100)||"",category:r.category||r.hierarchy?.lvl0||"",hierarchy:r.hierarchy,route:r.route,parentTitle:r.parent_title||r.parentTitle,_source:t}}),[]),g=t.useCallback(async(e,t,r)=>{const a=e.minQueryLength??1;if(t.length<a)return[];try{if(e.storeId){const a=`${e.endpoint.replace(/\/$/,"")}/api/v1/search`,o={"Content-Type":"application/json","x-storeid":e.storeId,...e.storeSecret&&{"x-storesecret":e.storeSecret}},n=await fetch(a,{method:"POST",headers:o,body:JSON.stringify({q:t.trim()||"*",per_page:e.maxResults||8}),signal:r});if(!n.ok)return[];const s=await n.json();return e.transformResults?e.transformResults(s).map(t=>({...t,_source:e.id})):m(s,e.id)}const a=new URL(e.endpoint);a.searchParams.set("query",t),a.searchParams.set("limit",String(e.maxResults||8));const o={"Content-Type":"application/json"};e.apiKey&&(o["X-Docs-API-Key"]=e.apiKey);const n=await fetch(a.toString(),{method:"GET",headers:o,signal:r});if(!n.ok)return[];const s=await n.json();return e.transformResults?e.transformResults(s).map(t=>({...t,_source:e.id})):((e,t)=>(e.data?.suggestions||e.data?.results||e.suggestions||e.results||e.hits||[]).map(e=>({url:e.url||e.route||"",title:e.title?.replace?.(/<\/?mark>/g,"")||e.title||"",content:e.content?.replace?.(/<\/?mark>/g,"")?.substring?.(0,100)||e.description||"",description:e.description||e.content?.substring?.(0,100)||"",category:e.category||e.hierarchy?.lvl0||"",hierarchy:e.hierarchy,route:e.route,parentTitle:e.parent_title||e.parentTitle,_source:t})))(s,e.id)}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw e;return[]}},[m]),f=t.useCallback(async e=>{if(e.trim()){u.current.forEach(e=>e.abort()),u.current.clear(),d({type:"SET_LOADING",payload:!0}),d({type:"SET_ERROR",payload:null});try{const t=(await Promise.all(l.map(async t=>{const r=new AbortController;u.current.set(t.id,r);let a=await g(t,e,r.signal);return i&&(a=i(t.id,a)),{source:t,items:a}}))).filter(e=>e.items.length>0);d({type:"SET_GROUPED_SUGGESTIONS",payload:t})}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;d({type:"SET_ERROR",payload:e instanceof Error?e.message:"Search failed"})}finally{d({type:"SET_LOADING",payload:!1})}}else d({type:"SET_GROUPED_SUGGESTIONS",payload:[]})},[l,g,i]),h=t.useCallback(e=>f(e),[f]),y=t.useCallback(e=>{d({type:"SET_QUERY",payload:e}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(e),s)},[f,s]),b=t.useCallback(()=>d({type:"SELECT_NEXT"}),[]),x=t.useCallback(()=>d({type:"SELECT_PREV"}),[]),v=t.useCallback(e=>d({type:"SET_SELECTED_INDEX",payload:e}),[]),k=t.useCallback(()=>{u.current.forEach(e=>e.abort()),u.current.clear(),p.current&&clearTimeout(p.current),d({type:"RESET"})},[]),E=t.useCallback(()=>("results"===c.mode?c.results:c.suggestions)[c.selectedIndex]||null,[c.mode,c.results,c.suggestions,c.selectedIndex]);return t.useEffect(()=>()=>{u.current.forEach(e=>e.abort()),u.current.clear(),p.current&&clearTimeout(p.current)},[]),{...c,sources:l,setQuery:y,search:h,fetchSuggestions:f,selectNext:b,selectPrev:x,setSelectedIndex:v,reset:k,getSelectedItem:E}}function Ar(e){const{storeId:r,storeSecret:o,apiEndpoint:n,maxResults:s=20,debounceMs:i=200,analyticsTags:l=["docsearch"],groupField:c="hierarchy.lvl3",groupSize:d=10}=e,[u,p]=t.useState(""),[m,g]=t.useState([]),[f,h]=t.useState(!1),[y,b]=t.useState(null),[x,v]=t.useState(0),k=t.useRef(null),E=t.useRef(null),S=t.useRef(null),w=t.useRef(null);t.useEffect(()=>{if(!r)return;const e={storeId:r,readSecret:o,logLevel:"warn",enableContextCollection:!0};if(n)if(["local","stage","production"].includes(n))e.environment=n;else{const t=n.replace(/\/$/,"");e.baseUrl=t.endsWith("/api")?t:`${t}/api`}try{k.current=new a.SeekoraClient(e)}catch(e){console.error("Failed to initialize SeekoraClient:",e),b("Failed to initialize search client")}return()=>{k.current=null}},[r,o,n]);const C=t.useCallback(async e=>{if(k.current)if(e.trim()){w.current&&w.current.abort(),w.current=new AbortController,h(!0),b(null);try{const t=await k.current.search(e,{per_page:s,analytics_tags:l,return_fields:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url","title","anchor"],snippet_fields:["hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content"],snippet_prefix:"<mark>",snippet_suffix:"</mark>",include_snippets:!0,group_field:c,group_size:d});if(w.current?.signal.aborted)return;t?.context&&(E.current=t.context),g(function(e){const t=e=>"string"==typeof e?e.replace(/<\/?mark>/g,""):e?String(e):"";return e.map(e=>{const r=e?.document??e,a=function(e){const t={};return e?.hierarchy&&"object"==typeof e.hierarchy?(t.lvl0=e.hierarchy.lvl0,t.lvl1=e.hierarchy.lvl1,t.lvl2=e.hierarchy.lvl2,t.lvl3=e.hierarchy.lvl3,t.lvl4=e.hierarchy.lvl4,t.lvl5=e.hierarchy.lvl5):e&&"object"==typeof e&&(t.lvl0=e["hierarchy.lvl0"],t.lvl1=e["hierarchy.lvl1"],t.lvl2=e["hierarchy.lvl2"],t.lvl3=e["hierarchy.lvl3"],t.lvl4=e["hierarchy.lvl4"],t.lvl5=e["hierarchy.lvl5"]),t}(r),o=r.url||e.url||r.route||e.route||r.link||e.link||"",n=r.title||e.title||r.name||e.name||a?.lvl3||a?.lvl2||a?.lvl1||a?.lvl0||"",s=r.content??e.content??r.description??e.description??r.snippet??e.snippet??"",i=r.description??e.description??("string"==typeof s?s.substring(0,150):""),l=t(n)||t(a?.lvl3)||t(a?.lvl2)||t(a?.lvl1)||t(a?.lvl0)||"Untitled",c=t(s)?.substring(0,200)||s,d=e?.highlight??r?.highlight,u="string"==typeof d?.title?d.title:void 0,p="string"==typeof d?.content?d.content:void 0;return{url:o,title:l,content:c,description:t(i)||i,category:r.category??e.category??a?.lvl0??"",hierarchy:a,route:r.route??e.route,parentTitle:r.parent_title??r.parentTitle??e.parent_title??e.parentTitle,type:r.type??e.type??"",anchor:r.anchor??e.anchor??"",_source:"seekora",highlight:u??p?{title:u,content:p}:void 0}})}(t.results||[])),v(0)}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;console.error("Search failed:",e),b(e instanceof Error?e.message:"Search failed"),g([])}finally{h(!1)}}else g([]);else b("Search client not initialized")},[s,l,c,d]),R=t.useCallback(e=>{p(e),v(0),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>C(e),i)},[C,i]),I=t.useCallback(()=>{v(e=>e>=m.length-1?0:e+1)},[m.length]),N=t.useCallback(()=>{v(e=>e<=0?m.length-1:e-1)},[m.length]),T=t.useCallback(()=>{w.current&&w.current.abort(),S.current&&clearTimeout(S.current),p(""),g([]),h(!1),b(null),v(0)},[]),A=t.useCallback(()=>m[x]||null,[m,x]),z=t.useCallback((e,t)=>{const r=k.current;if(!r?.trackEvent)return;const a=E.current??void 0,o=e.url||e.id||e.title||String(t);r.trackEvent({event_name:"doc_click",clicked_item_id:o,metadata:{position:t,result:e,source:"docsearch"}},a)},[]);return t.useEffect(()=>()=>{w.current&&w.current.abort(),S.current&&clearTimeout(S.current)},[]),{query:u,suggestions:m,isLoading:f,error:y,selectedIndex:x,setQuery:R,selectNext:I,selectPrev:N,setSelectedIndex:v,reset:T,getSelectedItem:A,trackDocClick:z}}function zr(e,t,r=2){const a=e.toLowerCase().split(/\s+/),o=[];return a.forEach(a=>{a.length<3||t.forEach(t=>{const n=function(e,t){const r=[];for(let e=0;e<=t.length;e++)r[e]=[e];for(let t=0;t<=e.length;t++)r[0][t]=t;for(let a=1;a<=t.length;a++)for(let o=1;o<=e.length;o++)t.charAt(a-1)===e.charAt(o-1)?r[a][o]=r[a-1][o-1]:r[a][o]=Math.min(r[a-1][o-1]+1,r[a][o-1]+1,r[a-1][o]+1);return r[t.length][e.length]}(a,t.toLowerCase());if(n>0&&n<=r&&n<a.length/2){const r=e.replace(new RegExp(a,"gi"),t);o.includes(r)||o.push(r)}})}),o.slice(0,3)}const Mr={price:[{pattern:/under\s*\$?(\d+(?:\.\d{2})?)/i,operator:"<=",field:"price"},{pattern:/less than\s*\$?(\d+(?:\.\d{2})?)/i,operator:"<",field:"price"},{pattern:/over\s*\$?(\d+(?:\.\d{2})?)/i,operator:">=",field:"price"},{pattern:/more than\s*\$?(\d+(?:\.\d{2})?)/i,operator:">",field:"price"},{pattern:/\$(\d+(?:\.\d{2})?)\s*-\s*\$?(\d+(?:\.\d{2})?)/i,operator:"range",field:"price"},{pattern:/between\s*\$?(\d+(?:\.\d{2})?)\s*and\s*\$?(\d+(?:\.\d{2})?)/i,operator:"range",field:"price"},{pattern:/\$(\d+(?:\.\d{2})?)/i,operator:"<=",field:"price"}],colors:["red","blue","green","black","white","pink","purple","yellow","orange","brown","gray","grey","navy","beige","gold","silver"],sizes:{"extra small":"XS",xs:"XS",small:"S",s:"S",medium:"M",m:"M",large:"L",l:"L","extra large":"XL",xl:"XL",xxl:"XXL","2xl":"XXL",xxxl:"XXXL","3xl":"XXXL"},brandIndicators:["by","from","brand"],ratings:[{pattern:/(\d+)\s*\+?\s*stars?/i,field:"rating",operator:">="},{pattern:/rated\s*(\d+)/i,field:"rating",operator:">="},{pattern:/top\s*rated/i,field:"rating",value:"4",operator:">="}],availability:[{pattern:/in\s*stock/i,field:"inStock",value:"true"},{pattern:/available/i,field:"inStock",value:"true"},{pattern:/on\s*sale/i,field:"onSale",value:"true"}]};const _r={"--seekora-bg-surface":"#ffffff","--seekora-bg-secondary":"#f9fafb","--seekora-bg-tertiary":"#f3f4f6","--seekora-bg-hover":"#f3f4f6","--seekora-text-primary":"#111827","--seekora-text-secondary":"#6b7280","--seekora-text-tertiary":"#9ca3af","--seekora-border-color":"#e5e7eb","--seekora-primary":"#3b82f6","--seekora-primary-light":"#eff6ff","--seekora-primary-dark":"#1d4ed8","--seekora-highlight-bg":"#fef3c7","--seekora-success":"#10b981","--seekora-warning":"#f59e0b","--seekora-error":"#ef4444","--seekora-font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',"--seekora-font-size-xs":"11px","--seekora-font-size-sm":"12px","--seekora-font-size-base":"14px","--seekora-font-size-lg":"16px","--seekora-font-weight-normal":"400","--seekora-font-weight-medium":"500","--seekora-font-weight-semibold":"600","--seekora-font-weight-bold":"700","--seekora-line-height-tight":"1.25","--seekora-line-height-normal":"1.5","--seekora-line-height-relaxed":"1.75","--seekora-spacing-xs":"4px","--seekora-spacing-sm":"8px","--seekora-spacing-md":"12px","--seekora-spacing-lg":"16px","--seekora-spacing-xl":"24px","--seekora-border-radius-sm":"4px","--seekora-border-radius":"6px","--seekora-border-radius-lg":"8px","--seekora-border-radius-xl":"12px","--seekora-border-radius-full":"9999px","--seekora-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.05)","--seekora-shadow":"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)","--seekora-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)","--seekora-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)","--seekora-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","--seekora-transition-fast":"100ms ease","--seekora-transition-normal":"150ms ease","--seekora-transition-slow":"300ms ease","--seekora-z-dropdown":"1000","--seekora-z-modal":"1100","--seekora-z-tooltip":"1200"},Lr={..._r,"--seekora-bg-surface":"#1f2937","--seekora-bg-secondary":"#111827","--seekora-bg-tertiary":"#374151","--seekora-bg-hover":"#374151","--seekora-text-primary":"#f9fafb","--seekora-text-secondary":"#d1d5db","--seekora-text-tertiary":"#9ca3af","--seekora-border-color":"#4b5563","--seekora-primary":"#60a5fa","--seekora-primary-light":"#1e3a5f","--seekora-primary-dark":"#93c5fd","--seekora-highlight-bg":"#854d0e","--seekora-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.3)","--seekora-shadow":"0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3)","--seekora-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3)","--seekora-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3)","--seekora-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4)"},Pr={..._r,"--seekora-border-color":"#f3f4f6","--seekora-shadow-sm":"none","--seekora-shadow":"0 1px 2px 0 rgba(0, 0, 0, 0.03)","--seekora-shadow-md":"0 2px 4px 0 rgba(0, 0, 0, 0.05)","--seekora-shadow-lg":"0 4px 8px 0 rgba(0, 0, 0, 0.08)","--seekora-shadow-xl":"0 8px 16px 0 rgba(0, 0, 0, 0.1)","--seekora-border-radius-sm":"2px","--seekora-border-radius":"4px","--seekora-border-radius-lg":"6px","--seekora-border-radius-xl":"8px"},Br={blue:{"--seekora-primary":"#3b82f6","--seekora-primary-light":"#eff6ff","--seekora-primary-dark":"#1d4ed8"},green:{"--seekora-primary":"#10b981","--seekora-primary-light":"#ecfdf5","--seekora-primary-dark":"#059669"},purple:{"--seekora-primary":"#8b5cf6","--seekora-primary-light":"#f5f3ff","--seekora-primary-dark":"#7c3aed"},red:{"--seekora-primary":"#ef4444","--seekora-primary-light":"#fef2f2","--seekora-primary-dark":"#dc2626"},orange:{"--seekora-primary":"#f97316","--seekora-primary-light":"#fff7ed","--seekora-primary-dark":"#ea580c"},teal:{"--seekora-primary":"#14b8a6","--seekora-primary-light":"#f0fdfa","--seekora-primary-dark":"#0d9488"},pink:{"--seekora-primary":"#ec4899","--seekora-primary-light":"#fdf2f8","--seekora-primary-dark":"#db2777"}};function Dr(e=_r){return`\n /* Seekora Query Suggestions Styles */\n .seekora-suggestions {\n ${t=e,Object.entries(t).map(([e,t])=>`${e}: ${t};`).join("\n")}\n }\n\n /* Container */\n .seekora-suggestions-container {\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n box-shadow: var(--seekora-shadow-xl);\n font-family: var(--seekora-font-family);\n font-size: var(--seekora-font-size-base);\n color: var(--seekora-text-primary);\n overflow: hidden;\n }\n\n /* Section */\n .seekora-suggestions-section {\n padding: var(--seekora-spacing-sm) 0;\n }\n\n .seekora-suggestions-section-title {\n font-size: var(--seekora-font-size-xs);\n font-weight: var(--seekora-font-weight-bold);\n color: var(--seekora-text-tertiary);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-lg) var(--seekora-spacing-xs);\n margin: 0;\n }\n\n /* Item */\n .seekora-suggestions-item {\n display: flex;\n align-items: center;\n gap: var(--seekora-spacing-md);\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n cursor: pointer;\n transition: background-color var(--seekora-transition-fast);\n }\n\n .seekora-suggestions-item:hover,\n .seekora-suggestions-item--active {\n background-color: var(--seekora-bg-hover);\n }\n\n .seekora-suggestions-item-icon {\n width: 16px;\n height: 16px;\n color: var(--seekora-text-secondary);\n flex-shrink: 0;\n }\n\n .seekora-suggestions-item-text {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .seekora-suggestions-item-count {\n font-size: var(--seekora-font-size-sm);\n color: var(--seekora-text-tertiary);\n }\n\n /* Highlight */\n .seekora-suggestions mark,\n .seekora-suggestions-highlight {\n background-color: var(--seekora-highlight-bg);\n font-weight: var(--seekora-font-weight-semibold);\n padding: 0 2px;\n border-radius: 2px;\n }\n\n /* Product Card */\n .seekora-product-card {\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n overflow: hidden;\n cursor: pointer;\n transition: transform var(--seekora-transition-normal), box-shadow var(--seekora-transition-normal);\n }\n\n .seekora-product-card:hover {\n transform: translateY(-2px);\n box-shadow: var(--seekora-shadow-md);\n }\n\n .seekora-product-card-image {\n width: 100%;\n aspect-ratio: 1;\n object-fit: cover;\n background-color: var(--seekora-bg-secondary);\n }\n\n .seekora-product-card-info {\n padding: var(--seekora-spacing-md);\n }\n\n .seekora-product-card-title {\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-primary);\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .seekora-product-card-price {\n font-size: var(--seekora-font-size-base);\n font-weight: var(--seekora-font-weight-bold);\n color: var(--seekora-primary);\n margin-top: var(--seekora-spacing-xs);\n }\n\n /* Tabs */\n .seekora-suggestions-tabs {\n display: flex;\n gap: var(--seekora-spacing-xs);\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n border-bottom: 1px solid var(--seekora-border-color);\n overflow-x: auto;\n }\n\n .seekora-suggestions-tab {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-sm);\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-md);\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-secondary);\n background-color: transparent;\n border: 1px solid transparent;\n border-radius: var(--seekora-border-radius-full);\n cursor: pointer;\n white-space: nowrap;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-suggestions-tab:hover {\n background-color: var(--seekora-bg-hover);\n }\n\n .seekora-suggestions-tab--active {\n color: var(--seekora-primary);\n background-color: var(--seekora-primary-light);\n border-color: var(--seekora-primary);\n }\n\n /* Brand chip */\n .seekora-brand-chip {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-sm);\n padding: var(--seekora-spacing-sm) var(--seekora-spacing-md);\n font-size: var(--seekora-font-size-sm);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-primary);\n background-color: var(--seekora-bg-surface);\n border: 1px solid var(--seekora-border-color);\n border-radius: var(--seekora-border-radius-lg);\n cursor: pointer;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-brand-chip:hover {\n border-color: var(--seekora-primary);\n background-color: var(--seekora-primary-light);\n }\n\n /* Category pill */\n .seekora-category-pill {\n display: inline-flex;\n align-items: center;\n gap: var(--seekora-spacing-xs);\n padding: 3px var(--seekora-spacing-sm);\n font-size: var(--seekora-font-size-xs);\n font-weight: var(--seekora-font-weight-medium);\n color: var(--seekora-text-secondary);\n background-color: var(--seekora-bg-tertiary);\n border-radius: var(--seekora-border-radius-full);\n cursor: pointer;\n transition: all var(--seekora-transition-fast);\n }\n\n .seekora-category-pill:hover {\n background-color: var(--seekora-primary-light);\n color: var(--seekora-primary);\n }\n\n /* Loading */\n .seekora-suggestions-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--seekora-spacing-xl);\n color: var(--seekora-text-secondary);\n }\n\n /* Empty state */\n .seekora-suggestions-empty {\n padding: var(--seekora-spacing-xl);\n text-align: center;\n color: var(--seekora-text-secondary);\n }\n\n /* Footer */\n .seekora-suggestions-footer {\n padding: var(--seekora-spacing-md) var(--seekora-spacing-lg);\n border-top: 1px solid var(--seekora-border-color);\n background-color: var(--seekora-bg-secondary);\n font-size: var(--seekora-font-size-sm);\n color: var(--seekora-text-secondary);\n }\n\n /* Keyboard hint */\n .seekora-keyboard-key {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 18px;\n padding: 0 4px;\n border-radius: 3px;\n background-color: var(--seekora-bg-secondary);\n border: 1px solid var(--seekora-border-color);\n font-size: 10px;\n font-weight: var(--seekora-font-weight-medium);\n }\n\n /* Animations */\n @keyframes seekora-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n @keyframes seekora-fade-in {\n from { opacity: 0; transform: translateY(-8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n @keyframes seekora-fade-out {\n from { opacity: 1; transform: translateY(0); }\n to { opacity: 0; transform: translateY(-8px); }\n }\n\n .seekora-suggestions--entering {\n animation: seekora-fade-in var(--seekora-transition-normal) ease-out;\n }\n\n .seekora-suggestions--exiting {\n animation: seekora-fade-out var(--seekora-transition-normal) ease-in;\n }\n `;var t}let $r=!1;function Fr(e=_r,t=!1){if("undefined"==typeof document)return;if($r&&!t)return;const r="seekora-suggestions-styles";let a=document.getElementById(r);a||(a=document.createElement("style"),a.id=r,a.type="text/css",document.head.appendChild(a)),a.textContent=Dr(e),$r=!0}e.AmazonDropdown=Lt,e.Breadcrumb=({attributes:e,separator:r=" > ",rootLabel:a="Home",renderItem:o,renderSeparator:n,onNavigate:s,className:i,style:l,theme:c,items:d})=>{const{theme:u,stateManager:p}=S(),{refinements:m,removeRefinement:g,clearRefinements:f}=w(),h=c||{},y=t.useMemo(()=>{if(d)return d;const t=[];return e.forEach((e,a)=>{const o=m.find(t=>t.field===e);if(o){const e=o.value.split(r);e.forEach((a,o)=>{const n=e.slice(0,o+1).join(r);t.some(e=>e.value===n)||t.push({label:a,value:n})})}}),t},[e,m,r,d]),b=t.useCallback((t,r)=>{if(null===t)e.forEach(e=>{m.filter(t=>t.field===e).forEach(e=>g(e.field,e.value,!1))}),p.search();else{const r=y.findIndex(e=>e.value===t.value);e.forEach((e,a)=>{m.filter(t=>t.field===e).forEach(e=>{(a>r||a===r&&e.value!==t.value)&&g(e.field,e.value,!1)})}),p.search()}s&&s(t,r)},[e,m,g,p,y,s]);return 0===y.length?null:t.createElement("nav",{className:I(h.root,i),style:l,"aria-label":"Breadcrumb"},t.createElement("ol",{className:h.list,style:{display:"flex",flexWrap:"wrap",alignItems:"center",listStyle:"none",margin:0,padding:0,fontSize:u.typography.fontSize.small}},t.createElement("li",{className:h.item},t.createElement("button",{type:"button",onClick:()=>b(null,-1),className:h.link,style:{padding:0,background:"none",border:"none",cursor:"pointer",color:u.colors.primary,fontFamily:"inherit",fontSize:"inherit",textDecoration:"none"}},a)),y.map((e,r)=>{const a=r===y.length-1;return t.createElement(t.Fragment,{key:e.value},n?n():t.createElement("span",{className:h.separator,style:{margin:`0 ${u.spacing.small}`,color:u.colors.textSecondary},"aria-hidden":"true"},"›"),t.createElement("li",{className:I(h.item,a&&h.current)},o?o(e,r,a):a?t.createElement("span",{style:{color:u.colors.text,fontWeight:u.typography.fontWeight?.medium||500},"aria-current":"page"},e.label):t.createElement("button",{type:"button",onClick:()=>b(e,r),className:h.link,style:{padding:0,background:"none",border:"none",cursor:"pointer",color:u.colors.primary,fontFamily:"inherit",fontSize:"inherit",textDecoration:"none"}},e.label)))})))},e.CategoriesTabs=Ge,e.ClearRefinements=({clearsQuery:e=!1,resetLabel:r="Clear all filters",disabledLabel:a="No filters applied",includedFields:o,excludedFields:n=[],onClear:s,renderButton:i,className:l,style:c,theme:d,hideWhenEmpty:u=!1})=>{const{theme:p}=S(),{query:m,refinements:g,clearRefinements:f,setQuery:h,removeRefinement:y}=w(),b=d||{},x=t.useMemo(()=>g.filter(e=>!n.includes(e.field)&&!(o&&!o.includes(e.field))),[g,o,n]),v=x.length>0||e&&m.length>0,k=()=>{v&&(o||n.length>0?(x.forEach(e=>{y(e.field,e.value,!1)}),x.length>0&&f(!1)):f(!e),e&&m.length>0&&h("",!0),s&&s())};return u&&!v?null:i?t.createElement("div",{className:I(b.root,l),style:c},i({canClear:v,onClick:k,disabled:!v})):t.createElement("div",{className:I(b.root,l),style:c},t.createElement("button",{type:"button",onClick:k,disabled:!v,className:I(b.button,!v&&b.buttonDisabled),style:{padding:`${p.spacing.small} ${p.spacing.medium}`,fontSize:p.typography.fontSize.medium,fontWeight:p.typography.fontWeight?.medium||500,backgroundColor:v?p.colors.primary:p.colors.hover,color:v?"#ffffff":p.colors.textSecondary,border:"none",borderRadius:"string"==typeof p.borderRadius?p.borderRadius:p.borderRadius.medium,cursor:v?"pointer":"not-allowed",opacity:v?1:.6,transition:p.transitions?.fast||"150ms ease-in-out"},"aria-label":v?r:a},v?r:a))},e.CurrentRefinements=({refinements:e=[],onRefinementClear:r,onClearAll:a,renderRefinement:o,showClearAll:n=!0,className:s,style:i,theme:l})=>{const{theme:c}=S(),d=l||{},u=(e,a)=>t.createElement("div",{key:`${e.field}-${e.value}-${a}`,className:d.item,style:{display:"inline-flex",alignItems:"center",padding:`${c.spacing.small} ${c.spacing.medium}`,margin:`0 ${c.spacing.small} ${c.spacing.small} 0`,backgroundColor:c.colors.hover,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,fontSize:c.typography.fontSize.small}},t.createElement("span",{className:d.label,style:{marginRight:c.spacing.small,color:c.colors.text,fontWeight:"500"}},e.label||e.field,":"),t.createElement("span",{className:d.value,style:{marginRight:c.spacing.small,color:c.colors.text}},e.displayValue||e.value),t.createElement("button",{type:"button",onClick:()=>{return t=e.field,a=e.value,void(r&&r(t,a));var t,a},className:d.clearButton,style:{border:"none",backgroundColor:"transparent",color:c.colors.text,cursor:"pointer",fontSize:c.typography.fontSize.medium,padding:0,marginLeft:c.spacing.small,width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",transition:c.transitions?.fast||"150ms ease-in-out"},"aria-label":`Clear ${e.label||e.field}: ${e.value}`},"×"));return 0===e.length?null:t.createElement("div",{className:I(d.container,s),style:i},t.createElement("div",{className:d.list,style:{display:"flex",flexWrap:"wrap",alignItems:"center",marginBottom:n?c.spacing.medium:0}},e.map((e,t)=>o?o(e,t):u(e,t))),n&&e.length>1&&t.createElement("button",{type:"button",onClick:()=>{a&&a()},className:d.clearAllButton,style:{padding:`${c.spacing.small} ${c.spacing.medium}`,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,backgroundColor:c.colors.background,color:c.colors.text,cursor:"pointer",fontSize:c.typography.fontSize.small,textDecoration:"underline"}},"Clear all filters"))},e.DocSearch=function({storeId:e,storeSecret:r,seekoraApiEndpoint:a,apiEndpoint:o,apiKey:n,sources:s,placeholder:i="Search documentation...",maxResults:l=10,debounceMs:c=200,onSelect:d,onClose:u,translations:p={},renderButton:m=!0,buttonComponent:g=Rr,initialOpen:f=!1,disableShortcut:h=!1,shortcutKey:y="k",processGroupedResults:b}){const[x,v]=t.useState(f),k=t.useRef(!1),E=!!e,S=Ar({storeId:e||"",storeSecret:r,apiEndpoint:a,maxResults:l,debounceMs:c,analyticsTags:["docsearch"]}),w=Tr({apiEndpoint:o,apiKey:n,sources:s,maxResults:l,debounceMs:c,processGroupedResults:b}),{query:C,suggestions:R,isLoading:I,error:N,selectedIndex:T,setQuery:A,selectNext:z,selectPrev:M,setSelectedIndex:_,reset:L,getSelectedItem:P}=E?S:w,B=E?void 0:w.groupedSuggestions,D=E?R:w.results,$=E?"suggestions":w.mode,F=E?[{id:"seekora",name:"Results",endpoint:""}]:w.sources,W=t.useCallback(()=>v(!0),[]),q=t.useCallback(()=>{v(!1),L(),u?.()},[L,u]),H=t.useCallback(e=>{E&&S.trackDocClick&&S.trackDocClick(e,T+1),d?d(e):window.location.href=e.url,q()},[d,q,E,S,T]),O=t.useCallback(()=>{const e=P();e&&H(e)},[P,H]),j=t.useCallback(()=>{k.current=!0,z()},[z]),V=t.useCallback(()=>{k.current=!0,M()},[M]),{handleModalKeyDown:Q}=wr({isOpen:x,onOpen:W,onClose:q,onSelectNext:j,onSelectPrev:V,onEnter:O,disableShortcut:h,shortcutKey:y}),U=t.useCallback(e=>Q(e),[Q]),G="results"===$?D:R;return t.createElement(t.Fragment,null,m&&t.createElement(g,{onClick:W,placeholder:p.buttonText||i}),t.createElement(dr,{isOpen:x,onClose:q},t.createElement("div",{className:"seekora-docsearch-modal",onKeyDown:U},t.createElement("header",{className:"seekora-docsearch-header"},t.createElement(ur,{value:C,onChange:A,onKeyDown:U,placeholder:i,isLoading:I,onClear:L}),t.createElement("button",{type:"button",className:"seekora-docsearch-close",onClick:q,"aria-label":"Close search"},t.createElement("span",{className:"seekora-docsearch-close-text"},"esc"))),t.createElement("div",{className:"seekora-docsearch-body"},t.createElement(Er,{hits:G,groupedHits:B,selectedIndex:T,onSelect:H,onHover:_,scrollSelectionIntoViewRef:k,query:C,isLoading:I,error:N,translations:p,sources:F})),t.createElement(Sr,{translations:p}))))},e.DocSearchButton=Rr,e.DropdownPanel=Ne,e.Facets=({results:e,facets:r,onFacetChange:a,renderFacet:o,renderFacetItem:n,maxItems:s=10,showMore:i=!0,className:c,style:d,theme:p})=>{const{theme:m}=S(),{results:g,refinements:f,addRefinement:h,removeRefinement:y}=w(),b=p||{},[x,v]=t.useState({}),k=e||g,E=(()=>{if(r)return r;const e=k?.data?.facets||k?.facets||k?.data?.data?.facets||null;if(l("Facets: Extracting facets",{hasResults:!!k,hasData:!!k?.data,rawFacets:e?Array.isArray(e)?e.length:"not array":null,resultsKeys:k?Object.keys(k):[],dataKeys:k?.data?Object.keys(k.data):[],sampleFacet:e&&Array.isArray(e)&&e.length>0?e[0]:null}),!e||!Array.isArray(e))return l("Facets: No facets found in response",{rawFacetsType:e?typeof e:"null",isArray:Array.isArray(e),resultsStructure:k?JSON.stringify(Object.keys(k)):"null",dataStructure:k?.data?JSON.stringify(Object.keys(k.data)):"null"}),[];const t=e.map(e=>{const t=e.field_name||e.field;return{field:t,label:e.label||t,items:Array.isArray(e.counts)?e.counts.map(e=>({value:e.value,count:e.count,selected:f.some(r=>r.field===t&&r.value===e.value)})):[]}});return l("Facets: Extracted facets",{count:t.length,facets:t.map(e=>({field:e.field,itemsCount:e.items.length}))}),t})(),C=(e,t,r)=>{const o=!r;if(l("Facets: Facet toggled",{field:e,value:t,selected:o}),o?h(e,t):y(e,t),a)try{a(e,t,o)}catch(r){const a=r instanceof Error?r:new Error(String(r));u("Facets: Error in onFacetChange callback",{field:e,value:t,selected:o,error:a.message})}},R=e=>{v(t=>({...t,[e]:!t[e]}))},N=(e,r)=>{const a=x[e.field]||!1,o=a?e.items:e.items.slice(0,s),l=e.items.length>s;return t.createElement("div",{key:e.field,className:b.facet,style:{marginBottom:m.spacing.large,padding:m.spacing.medium,backgroundColor:m.colors.background,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium}},t.createElement("h3",{className:b.facetTitle,style:{fontSize:m.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:m.spacing.medium,color:m.colors.text}},e.label||e.field),t.createElement("div",{className:b.facetList},o.map((r,a)=>{const o=a;return n?n(r,e,o):((e,r,a)=>!(x[r.field]||a<s)&&a>=s?null:t.createElement("div",{key:`${r.field}-${e.value}`,className:I(b.facetItem,(f.some(t=>t.field===r.field&&t.value===e.value)||e.selected)&&b.facetItemActive),onClick:()=>C(r.field,e.value,e.selected||!1),style:{display:"flex",alignItems:"center",padding:m.spacing.small,cursor:"pointer",borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,marginBottom:m.spacing.small,backgroundColor:f.some(t=>t.field===r.field&&t.value===e.value)||e.selected?m.colors.hover:"transparent",transition:"background-color 0.2s ease"}},t.createElement("input",{type:"checkbox",checked:f.some(t=>t.field===r.field&&t.value===e.value)||e.selected||!1,onChange:()=>C(r.field,e.value,e.selected||!1),className:b.checkbox,style:{marginRight:m.spacing.small,cursor:"pointer"},"aria-label":`Filter by ${e.value}`}),t.createElement("span",{className:b.facetItemLabel,style:{flex:1,fontSize:m.typography.fontSize.medium,color:m.colors.text}},e.value),t.createElement("span",{className:b.facetItemCount,style:{fontSize:m.typography.fontSize.small,color:m.colors.textSecondary||m.colors.text,opacity:.7,marginLeft:m.spacing.small}},"(",e.count,")")))(r,e,o)})),i&&l&&!a&&t.createElement("button",{type:"button",onClick:()=>R(e.field),style:{marginTop:m.spacing.small,padding:m.spacing.small,border:"none",backgroundColor:"transparent",color:m.colors.primary,cursor:"pointer",fontSize:m.typography.fontSize.small,textDecoration:"underline"}},"Show more (",e.items.length-s," more)"),a&&l&&t.createElement("button",{type:"button",onClick:()=>R(e.field),style:{marginTop:m.spacing.small,padding:m.spacing.small,border:"none",backgroundColor:"transparent",color:m.colors.primary,cursor:"pointer",fontSize:m.typography.fontSize.small,textDecoration:"underline"}},"Show less"))};return 0===E.length?(l("Facets: No facets to display",{hasResults:!!k,resultsType:k?typeof k:"null"}),null):t.createElement("div",{className:I(b.container,c),style:d},E.map((e,t)=>o?o(e,t):N(e)))},e.FederatedDropdown=ae,e.Fingerprint=x,e.FrequentlyBoughtTogether=({productId:e,items:r,loading:a=!1,title:o="Frequently Bought Together",maxItems:n=4,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u="horizontal",currencySymbol:p="$",showAddAllButton:m=!0,onAddAll:g})=>{const{theme:f}=S(),h=d||{},y=r?.slice(0,n)||[],b=a,x=t.useMemo(()=>y.reduce((e,t)=>{const r=t.price;return e+("number"==typeof r?r:parseFloat(String(r))||0)},0),[y]);return b?t.createElement("div",{className:I(h.root,l),style:c},t.createElement("div",{className:h.loading,style:A(f)},"Loading recommendations...")):0===y.length?null:t.createElement("div",{className:I(h.root,l),style:c},o&&t.createElement("h3",{className:h.title,style:{margin:`0 0 ${f.spacing.medium} 0`,fontSize:f.typography.fontSize.large,fontWeight:f.typography.fontWeight?.semibold||600,color:f.colors.text}},o),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:f.spacing.medium,flexWrap:"wrap"}},y.map((e,r)=>t.createElement(t.Fragment,{key:e.id||r},r>0&&t.createElement("span",{style:{fontSize:"1.5rem",color:f.colors.textSecondary}},"+"),t.createElement("div",{onClick:()=>i?.(e,r),style:{cursor:i?"pointer":"default",textAlign:"center"}},s?s(e,r):t.createElement(t.Fragment,null,t.createElement("img",{src:e.image||e.imageUrl||"",alt:e.title||e.name||"",style:{width:"80px",height:"80px",objectFit:"cover",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.small,border:`1px solid ${f.colors.border}`}}),t.createElement("div",{style:{marginTop:f.spacing.small,fontSize:f.typography.fontSize.small,color:f.colors.text}},p,"number"==typeof e.price?e.price.toFixed(2):e.price))))),m&&y.length>0&&t.createElement("div",{style:{marginLeft:"auto",textAlign:"center"}},t.createElement("div",{style:{fontSize:f.typography.fontSize.large,fontWeight:f.typography.fontWeight?.bold||700,color:f.colors.text,marginBottom:f.spacing.small}},"Total: ",p,x.toFixed(2)),t.createElement("button",{type:"button",onClick:()=>g?.(y),style:{padding:`${f.spacing.small} ${f.spacing.medium}`,fontSize:f.typography.fontSize.medium,fontWeight:f.typography.fontWeight?.medium||500,color:"#ffffff",backgroundColor:f.colors.primary,border:"none",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.medium,cursor:"pointer"}},"Add all to cart"))))},e.GoogleDropdown=Ft,e.HierarchicalMenu=({attributes:e,separator:r=" > ",limit:a=10,showMore:o=!0,showMoreLimit:n=20,renderItem:s,onSelect:i,className:l,style:c,theme:d,rootPath:u=null,sortBy:p="name",items:m})=>{const{theme:g,stateManager:f}=S(),{results:h,refinements:y,addRefinement:b,removeRefinement:x}=w(),v=d||{},[k,E]=t.useState({}),C=t.useCallback(()=>{if(m)return m;if(!h)return[];const t=h.facets||h.facet_counts||{},r=e[0],a=t[r]||{},o=[];return Object.entries(a).forEach(([e,t])=>{const a=y.some(t=>t.field===r&&t.value===e);o.push({label:e,value:e,count:t,isRefined:a,data:R(e,1)})}),o},[h,e,y,m]),R=t.useCallback((t,a)=>{if(a>=e.length)return[];if(!h)return[];const o=h.facets||h.facet_counts||{},n=e[a],s=o[n]||{},i=[];return Object.entries(s).forEach(([e,o])=>{if(e.startsWith(t+r)){const s=e.replace(t+r,"").split(r)[0],l=y.some(t=>t.field===n&&t.value===e);e.replace(t+r,"").includes(r)||i.push({label:s,value:e,count:o,isRefined:l,data:R(e,a+1)})}}),i},[h,e,r,y]),N=t.useMemo(()=>{let e=C();return e=[...e].sort((e,t)=>{if("count"===p)return(t.count||0)-(e.count||0);if("isRefined"===p){if(e.isRefined&&!t.isRefined)return-1;if(!e.isRefined&&t.isRefined)return 1}return e.label.localeCompare(t.label)}),e},[C,p]),T=t.useCallback((t,r)=>{const a=e[r]||e[0];t.isRefined?(e.slice(r).forEach(e=>{y.filter(r=>r.field===e&&r.value.startsWith(t.value)).forEach(e=>x(e.field,e.value,!1))}),f.search()):(y.filter(e=>e.field===a&&e.value!==t.value).forEach(e=>x(e.field,e.value,!1)),b(a,t.value,!0)),i&&i(t.value,r)},[e,y,b,x,f,i]),A=(e,r)=>{if(!e||0===e.length)return null;const i=k[r]||!1,l=i?n:a,c=e.slice(0,l),d=e.length>l;return t.createElement("ul",{className:v.list,style:{listStyle:"none",margin:0,padding:r>0?`0 0 0 ${g.spacing.medium}`:0}},c.map((e,a)=>t.createElement("li",{key:e.value,className:I(v.item,e.isRefined&&v.itemSelected,e.data&&e.data.length>0&&v.itemParent),style:{padding:`${g.spacing.small} 0`}},s?s(e,r):t.createElement(t.Fragment,null,t.createElement("button",{type:"button",onClick:()=>T(e,r),className:v.link,style:{display:"flex",alignItems:"center",gap:g.spacing.small,width:"100%",padding:0,background:"none",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"inherit",fontSize:g.typography.fontSize.small,color:e.isRefined?g.colors.primary:g.colors.text,fontWeight:e.isRefined?600:400}},t.createElement("span",{className:v.label,style:{flex:1}},e.label),void 0!==e.count&&t.createElement("span",{className:v.count,style:{color:g.colors.textSecondary,fontSize:g.typography.fontSize.small}},e.count)),e.isRefined&&e.data&&e.data.length>0&&A(e.data,r+1)))),o&&d&&t.createElement("li",null,t.createElement("button",{type:"button",onClick:()=>(e=>{E(t=>({...t,[e]:!t[e]}))})(r),className:v.showMore,style:{padding:`${g.spacing.small} 0`,background:"none",border:"none",cursor:"pointer",fontSize:g.typography.fontSize.small,color:g.colors.primary,textDecoration:"underline"}},i?"Show less":`Show ${e.length-l} more`)))};return 0===N.length?null:t.createElement("div",{className:I(v.root,l),style:c},A(N,0))},e.Highlight=({hit:e,attribute:r,className:a,style:o,theme:n,tagName:s="span",renderHighlighted:i,renderNonHighlighted:l,query:c})=>{const{theme:d}=S(),u=n||{},f=t.useMemo(()=>p({hit:e,attribute:r,preTag:"<mark>",postTag:"</mark>"}),[e,r]),h=t.useMemo(()=>{const t=m(f,"<mark>","</mark>");if(t.every(e=>!e.isHighlighted)&&c){const t=e[r]||f;return g(String(t),c)}return t},[f,c,e,r]),y={backgroundColor:d.colors.warning||"#fff59d",fontWeight:d.typography.fontWeight?.semibold||600,padding:"0 2px",borderRadius:"2px"},b=h.map((e,r)=>e.isHighlighted?i?t.createElement(t.Fragment,{key:r},i(e,r)):t.createElement("mark",{key:r,className:u.highlighted,style:y},e.value):l?t.createElement(t.Fragment,{key:r},l(e,r)):t.createElement("span",{key:r,className:u.nonHighlighted},e.value));return t.createElement(s,{className:a||u.root,style:o},b)},e.HitsPerPage=({items:e,onHitsPerPageChange:r,renderSelect:a,className:o,style:n,theme:s,label:i="Show",syncWithState:l=!0})=>{const{theme:c}=S(),{itemsPerPage:d,setPage:u}=w(),{stateManager:p}=S(),m=s||{},g=e.find(e=>e.default)||e[0],[f,h]=t.useState(g?.value||10);t.useEffect(()=>{l&&g&&d!==g.value&&p.setItemsPerPage(g.value,!1)},[]);const y=l?d:f,b=e=>{const t=parseInt(e.target.value,10);h(t),l&&(p.setItemsPerPage(t,!1),u(1,!0)),r&&r(t)};return a?t.createElement("div",{className:I(m.root,o),style:n},a({value:y,onChange:b,items:e})):t.createElement("div",{className:I(m.root,o),style:{display:"flex",alignItems:"center",gap:c.spacing.small,...n}},i&&t.createElement("label",{style:{fontSize:c.typography.fontSize.medium,color:c.colors.text}},i),t.createElement("select",{value:y,onChange:b,className:m.select,style:{padding:c.spacing.small,paddingRight:c.spacing.medium,fontSize:c.typography.fontSize.medium,border:`1px solid ${c.colors.border}`,borderRadius:"string"==typeof c.borderRadius?c.borderRadius:c.borderRadius.medium,backgroundColor:c.colors.background,color:c.colors.text,cursor:"pointer",outline:"none"},"aria-label":"Results per page"},e.map(e=>t.createElement("option",{key:e.value,value:e.value,className:m.option},e.label))))},e.ImageDisplay=De,e.InfiniteHits=({renderHit:e,renderEmpty:r,renderLoading:a,renderShowMore:o,showMoreButton:n=!0,useInfiniteScroll:s=!1,scrollThreshold:i=.1,fieldMapping:l,showMoreLabel:c="Show more",loadingLabel:d="Loading...",onHitClick:u,className:p,style:m,theme:g,syncWithState:f=!0})=>{const{theme:h,stateManager:y}=S(),{results:b,loading:x,currentPage:v,setPage:k}=w(),E=g||{},[C,R]=t.useState([]),[N,T]=t.useState(!1),A=t.useRef(null),z=t.useRef(v),M=t.useCallback(e=>e?e.results?e.results:e.hits?e.hits:Array.isArray(e)?e:[]:[],[]),_=t.useMemo(()=>M(b),[b,M]),L=b?.totalResults||b?.found||0,P=y.getState().itemsPerPage||10,B=Math.ceil(L/P),D=v>=B;t.useEffect(()=>{_.length&&(1===v?R(_):v>z.current&&R(e=>[...e,..._]),z.current=v,T(!1))},[_,v]),t.useEffect(()=>{1===v&&(R(_),z.current=1)},[b]);const $=t.useCallback(()=>{D||x||N||(T(!0),f&&k(v+1))},[D,x,N,f,k,v]);t.useEffect(()=>{if(!s||!A.current)return;const e=new IntersectionObserver(e=>{!e[0].isIntersecting||D||x||N||$()},{threshold:i});return e.observe(A.current),()=>e.disconnect()},[s,i,D,x,N,$]);const F=(e,t)=>{if(!l||!l[t])return e[t]||"";return e[l[t]]||""},W=()=>t.createElement("div",{className:E.loading,style:{padding:h.spacing.medium,textAlign:"center",color:h.colors.textSecondary}},d);return x&&0===C.length?t.createElement("div",{className:I(E.root,p),style:m},a?a():W()):x||0!==C.length?t.createElement("div",{className:I(E.root,p),style:m},t.createElement("div",{className:E.list},C.map((r,a)=>e?e(r,a):((e,r)=>{const a=F(e,"title")||e.title||"",o=F(e,"description")||e.description||"",n=F(e,"image")||e.image||e.imageUrl||"",s=F(e,"price")||e.price;return t.createElement("div",{key:e.id||r,className:E.item,style:{display:"flex",gap:h.spacing.medium,padding:h.spacing.medium,borderBottom:`1px solid ${h.colors.border}`,cursor:u?"pointer":"default",transition:h.transitions?.fast||"150ms ease-in-out"},onClick:()=>u?.(e,r),role:u?"button":void 0,tabIndex:u?0:void 0},n&&t.createElement("img",{src:n,alt:a,style:{width:"80px",height:"80px",objectFit:"cover",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.small}}),t.createElement("div",{style:{flex:1}},t.createElement("h3",{style:{margin:0,marginBottom:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.semibold||600,color:h.colors.text}},a),o&&t.createElement("p",{style:{margin:0,fontSize:h.typography.fontSize.small,color:h.colors.textSecondary,lineHeight:h.typography.lineHeight?.normal||1.5}},o),s&&t.createElement("span",{style:{display:"inline-block",marginTop:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.bold||700,color:h.colors.primary}},"$","number"==typeof s?s.toFixed(2):s)))})(r,a))),n&&!s&&!D&&(o?o({isLoading:N,isLastPage:D,onClick:$}):t.createElement("button",{type:"button",onClick:$,disabled:D||N,className:I(E.loadMore,(D||N)&&E.loadMoreDisabled),style:{display:"block",width:"100%",padding:h.spacing.medium,marginTop:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,backgroundColor:D||N?h.colors.hover:h.colors.primary,color:D||N?h.colors.textSecondary:"#ffffff",border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:D||N?"not-allowed":"pointer",transition:h.transitions?.fast||"150ms ease-in-out"}},N?d:D?"No more results":c)),N&&(a?a():W()),s&&!D&&t.createElement("div",{ref:A,className:E.sentinel,style:{height:"1px",visibility:"hidden"},"aria-hidden":"true"})):t.createElement("div",{className:I(E.root,p),style:m},r?r():t.createElement("div",{className:E.empty,style:{padding:h.spacing.large,textAlign:"center",color:h.colors.textSecondary}},"No results found"))},e.ItemCard=qe,e.ItemGrid=Oe,e.MinimalDropdown=nr,e.MobileFilters=({isOpen:e,onClose:r,onApply:a,title:o="Filters",applyButtonText:n="Apply",clearButtonText:s="Clear all",position:i="right",children:l,className:c,theme:d,showHeader:u=!0,showFooter:p=!0,showFilterCount:m=!0,closeOnBackdropClick:g=!0,closeOnEscape:f=!0})=>{const{theme:h}=S(),{refinements:y,clearRefinements:b}=w(),x=d||{},v=t.useRef(null);t.useEffect(()=>(document.body.style.overflow=e?"hidden":"",()=>{document.body.style.overflow=""}),[e]),t.useEffect(()=>{if(!f)return;const t=t=>{"Escape"===t.key&&e&&r()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e,r,f]),t.useEffect(()=>{if(e&&v.current){const e=v.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),t=e[0],r=e[e.length-1],a=e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===t&&(e.preventDefault(),r?.focus()):document.activeElement===r&&(e.preventDefault(),t?.focus()))};return document.addEventListener("keydown",a),t?.focus(),()=>document.removeEventListener("keydown",a)}},[e]);const k=t.useCallback(()=>{g&&r()},[g,r]),E=t.useCallback(()=>{a&&a(),r()},[a,r]),C=t.useCallback(()=>{b(!0)},[b]),R=e=>{if(e)return"translate(0, 0)";switch(i){case"left":return"translateX(-100%)";case"right":default:return"translateX(100%)";case"bottom":return"translateY(100%)"}};return e?t.createElement(t.Fragment,null,t.createElement("div",{className:x.overlay,onClick:k,style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:h.zIndex?.modal||1050,opacity:e?1:0,transition:"opacity 300ms ease-in-out"},"aria-hidden":"true"}),t.createElement("div",{ref:v,className:I(x.drawer,c),style:(()=>{const t={position:"fixed",backgroundColor:h.colors.background,display:"flex",flexDirection:"column",transition:"transform 300ms ease-in-out",transform:R(e),zIndex:(h.zIndex?.modal||1050)+1};switch(i){case"left":return{...t,top:0,left:0,bottom:0,width:"80%",maxWidth:"320px"};case"right":return{...t,top:0,right:0,bottom:0,width:"80%",maxWidth:"320px"};case"bottom":return{...t,left:0,right:0,bottom:0,maxHeight:"80vh",borderTopLeftRadius:"16px",borderTopRightRadius:"16px"};default:return t}})(),role:"dialog","aria-modal":"true","aria-label":o},u&&t.createElement("div",{className:x.header,style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:h.spacing.medium,borderBottom:`1px solid ${h.colors.border}`}},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:h.spacing.small}},t.createElement("h2",{className:x.title,style:{margin:0,fontSize:h.typography.fontSize.large,fontWeight:h.typography.fontWeight?.semibold||600,color:h.colors.text}},o),m&&y.length>0&&t.createElement("span",{className:x.filterCount,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"24px",height:"24px",padding:"0 6px",fontSize:h.typography.fontSize.small,fontWeight:h.typography.fontWeight?.bold||700,color:"#ffffff",backgroundColor:h.colors.primary,borderRadius:"12px"}},y.length)),t.createElement("button",{type:"button",onClick:r,className:x.closeButton,style:{padding:h.spacing.small,background:"none",border:"none",cursor:"pointer",fontSize:"1.5rem",color:h.colors.text},"aria-label":"Close filters"},"×")),t.createElement("div",{className:x.content,style:{flex:1,overflow:"auto",padding:h.spacing.medium}},l),p&&t.createElement("div",{className:x.footer,style:{display:"flex",gap:h.spacing.small,padding:h.spacing.medium,borderTop:`1px solid ${h.colors.border}`}},t.createElement("button",{type:"button",onClick:C,className:x.clearButton,style:{flex:1,padding:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:h.colors.text,backgroundColor:"transparent",border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer"}},s),t.createElement("button",{type:"button",onClick:E,className:x.applyButton,style:{flex:2,padding:h.spacing.medium,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:"#ffffff",backgroundColor:h.colors.primary,border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer"}},n,m&&y.length>0&&` (${y.length})`)))):null},e.MobileFiltersButton=({onClick:e,text:r="Filters",showCount:a=!0,className:o,style:n})=>{const{theme:s}=S(),{refinements:i}=w();return t.createElement("button",{type:"button",onClick:e,className:o,style:{display:"inline-flex",alignItems:"center",gap:s.spacing.small,padding:`${s.spacing.small} ${s.spacing.medium}`,fontSize:s.typography.fontSize.medium,fontWeight:s.typography.fontWeight?.medium||500,color:s.colors.text,backgroundColor:s.colors.background,border:`1px solid ${s.colors.border}`,borderRadius:"string"==typeof s.borderRadius?s.borderRadius:s.borderRadius.medium,cursor:"pointer",...n}},t.createElement("span",null,"☰"),t.createElement("span",null,r),a&&i.length>0&&t.createElement("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:"20px",height:"20px",padding:"0 4px",fontSize:s.typography.fontSize.small,fontWeight:s.typography.fontWeight?.bold||700,color:"#ffffff",backgroundColor:s.colors.primary,borderRadius:"10px"}},i.length))},e.MobileSheetDropdown=or,e.Pagination=({results:e,currentPage:r,itemsPerPage:a,totalPages:o,onPageChange:n,maxPages:s=7,showFirstLast:i=!0,showPrevNext:l=!0,renderPageButton:c,className:d,style:u,theme:p})=>{const{theme:m}=S(),{results:g,currentPage:f,setPage:h}=w(),y=p||{},b=r||f,x=e||g,v=a||x?.perPage||x?.data?.per_page||x?.data?.data?.per_page||20,k=x?.totalResults||x?.data?.total_results||x?.data?.data?.total_results||0,E=o||x?.totalPages||x?.data?.total_pages||x?.data?.data?.total_pages||Math.ceil(k/v),C=e=>{e<1||e>E||e===b||(h(e),n&&n(e))};if(E<=1)return null;const R=(()=>{const e=[],t=Math.floor(s/2);let r=Math.max(1,b-t),a=Math.min(E,b+t);b<=t&&(a=Math.min(s,E)),b>=E-t&&(r=Math.max(1,E-s+1)),i&&r>1&&(e.push(1),r>2&&e.push("ellipsis"));for(let t=r;t<=a;t++)e.push(t);return i&&a<E&&(a<E-1&&e.push("ellipsis"),e.push(E)),e})();return t.createElement("nav",{className:I(y.container,d),style:u,"aria-label":"Pagination"},t.createElement("ul",{className:y.list,style:{listStyle:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0,flexWrap:"wrap"}},l&&t.createElement("li",null,t.createElement("button",{type:"button",disabled:1===b,onClick:()=>C(b-1),className:I(y.item,1===b&&y.itemDisabled),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:m.colors.background,color:m.colors.text,cursor:1===b?"not-allowed":"pointer",opacity:1===b?.5:1,fontSize:m.typography.fontSize.medium},"aria-label":"Previous page"},"Previous")),R.map((e,r)=>{if("ellipsis"===e)return t.createElement("li",{key:`ellipsis-${r}`},t.createElement("span",{className:y.ellipsis,style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,color:m.colors.text,fontSize:m.typography.fontSize.medium}},"..."));const a=e===b,o=!1;return t.createElement("li",{key:e},c?c(e,a,o):((e,r,a)=>t.createElement("button",{type:"button",disabled:a,onClick:()=>C(e),className:I(y.item,r&&y.itemActive,a),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:r?m.colors.primary:m.colors.background,color:r?"#fff":m.colors.text,cursor:"pointer",opacity:1,fontSize:m.typography.fontSize.medium,minWidth:"40px",...r&&{fontWeight:"bold"}}},e))(e,a,o))}),l&&t.createElement("li",null,t.createElement("button",{type:"button",disabled:b===E,onClick:()=>C(b+1),className:I(y.item,b===E&&y.itemDisabled),style:{padding:m.spacing.small,margin:`0 ${m.spacing.small}`,border:`1px solid ${m.colors.border}`,borderRadius:"string"==typeof m.borderRadius?m.borderRadius:m.borderRadius.medium,backgroundColor:m.colors.background,color:m.colors.text,cursor:b===E?"not-allowed":"pointer",opacity:b===E?.5:1,fontSize:m.typography.fontSize.medium},"aria-label":"Next page"},"Next"))))},e.PinterestDropdown=jt,e.ProductCard=Qe,e.ProductGallery=function({images:e,variant:r="thumbStrip",alt:a="Product",className:o,style:n,carouselAutoplay:s,carouselIntervalMs:i}){return t.createElement("div",{className:I("seekora-product-gallery",o),style:n},t.createElement(De,{images:e,variant:r,alt:a,carouselAutoplay:s,carouselIntervalMs:i}))},e.ProductGrid=Ue,e.ProductInfo=function({title:e,description:r,price:a,currency:o="$",renderVariantSelector:n,renderCTA:s,className:i,style:l}){const c=null!=a?"number"==typeof a?a:parseFloat(String(a)):null;return t.createElement("div",{className:I("seekora-product-info",i),style:{display:"flex",flexDirection:"column",gap:12,...l}},t.createElement("h1",{className:"seekora-product-info-title",style:{fontSize:"1.25rem",fontWeight:600,margin:0}},e),null==c||Number.isNaN(c)?null:t.createElement("span",{className:"seekora-product-info-price",style:{fontSize:"1.125rem",fontWeight:600}},o,c.toFixed(2)),r?t.createElement("p",{className:"seekora-product-info-description",style:{fontSize:"0.875rem",color:"var(--seekora-text-secondary)",margin:0,lineHeight:1.5}},r):null,n?.(),s?.())},e.ProductRecommendations=function({title:e="You may also like",items:r,onItemClick:a,maxItems:o=6,columns:n=3,className:s,style:i,renderItem:l}){return r?.length?t.createElement("div",{className:I("seekora-product-recommendations",s),style:i},t.createElement("h2",{className:"seekora-product-recommendations-title",style:{fontSize:"1rem",fontWeight:600,marginBottom:12}},e),t.createElement(Oe,{items:r,maxItems:o,columns:n,onItemClick:a,renderItem:l})):null},e.QuerySuggestions=({query:e="",maxSuggestions:r=10,debounceMs:a=300,minQueryLength:o=2,onSuggestionClick:n,renderSuggestion:s,renderLoading:i,renderEmpty:l,showTitle:c=!1,title:d="Suggestions",className:u,style:p,theme:m})=>{const{client:g,theme:f}=S(),[h,y]=t.useState(-1),{suggestions:b,loading:x,error:v}=C({client:g,query:e,enabled:e.length>=o,debounceMs:a,maxSuggestions:r}),k=b.slice(0,r),E=m||{};if(e.length<o)return null;if(x)return t.createElement("div",{className:I(E.container,u),style:p},c&&t.createElement("div",{className:E.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),i?i():t.createElement("div",{style:{padding:f.spacing.medium,textAlign:"center",color:f.colors.text}},"Loading suggestions..."));if(v||0===k.length)return t.createElement("div",{className:I(E.container,u),style:p},c&&t.createElement("div",{className:E.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),l?l():t.createElement("div",{style:{padding:f.spacing.medium,textAlign:"center",color:f.colors.text,opacity:.6}},"No suggestions available"));const w=s||((e,r)=>t.createElement("div",{key:r},t.createElement("span",null,e.query),void 0!==e.count&&t.createElement("span",{style:{opacity:.6,marginLeft:f.spacing.small}},"(",e.count,")")));return t.createElement("div",{className:I(E.container,u),style:p},c&&t.createElement("div",{className:E.title,style:{fontSize:f.typography.fontSize.large,fontWeight:"bold",marginBottom:f.spacing.medium,color:f.colors.text}},d),t.createElement("div",{className:E.suggestionsList},k.map((e,r)=>{const a=r===h;return t.createElement("div",{key:r,className:I(E.suggestionItem,a&&E.suggestionItemActive),onClick:()=>(e=>{n&&n(e.query)})(e),onMouseEnter:()=>y(r),onMouseLeave:()=>y(-1),style:{padding:f.spacing.medium,cursor:"pointer",borderRadius:"string"==typeof f.borderRadius?f.borderRadius:f.borderRadius.medium,transition:"background-color 0.2s ease",backgroundColor:a?f.colors.hover:"transparent",marginBottom:r<k.length-1?f.spacing.small:0}},w(e,r))})))},e.QuerySuggestionsDropdown=j,e.RangeInput=({field:e,label:r,min:a,max:o,currentMin:n,currentMax:s,step:i=1,onRangeChange:l,renderRangeInput:c,className:d,style:u,theme:p,showApplyButton:m=!0,placeholder:g={min:"Min",max:"Max"},syncWithState:f=!0})=>{const{theme:h}=S(),{refinements:y,addRefinement:b,removeRefinement:x}=w(),v=p||{},k=t.useMemo(()=>f?((e,t)=>{let r,a;return e.forEach(e=>{if(e.field===t){const t=e.value.match(/^>=(\d+(?:\.\d+)?)$/);t&&(r=parseFloat(t[1]));const o=e.value.match(/^<=(\d+(?:\.\d+)?)$/);o&&(a=parseFloat(o[1]))}}),{min:r,max:a}})(y,e):{min:void 0,max:void 0},[f,y,e]),[E,C]=t.useState(n??k.min),[R,N]=t.useState(s??k.max),[T,A]=t.useState(n??k.min),[z,M]=t.useState(s??k.max);t.useEffect(()=>{f&&(k.min===T&&k.max===z||(C(k.min),N(k.max),A(k.min),M(k.max)))},[f,k.min,k.max]);const _=void 0!==n?n:E,L=void 0!==s?s:R,P=t.useCallback((t,r)=>{f&&(y.forEach(t=>{t.field===e&&x(e,t.value,!1)}),void 0!==t&&b(e,`>=${t}`,!1),void 0!==r?b(e,`<=${r}`,!0):void 0!==t&&b(e,`>=${t}`,!0))},[f,e,y,b,x]),B=t.useCallback(e=>{const t=""===e.target.value?void 0:parseFloat(e.target.value);C(t),m||(P(t,L),l&&l(t,L))},[L,m,l,P]),D=t.useCallback(e=>{const t=""===e.target.value?void 0:parseFloat(e.target.value);N(t),m||(P(_,t),l&&l(_,t))},[_,m,l,P]),$=t.useCallback(()=>{A(E),M(R),P(E,R),l&&l(E,R)},[E,R,l,P]),F=t.useCallback(()=>{C(void 0),N(void 0),A(void 0),M(void 0),f&&y.forEach(t=>{t.field===e&&x(e,t.value,!0)}),l&&l(void 0,void 0)},[f,e,y,x,l]);return c?t.createElement("div",{className:I(v.container,d),style:u},c({min:_,max:L,onMinChange:e=>{C(e),!m&&l&&l(e,L)},onMaxChange:e=>{N(e),!m&&l&&l(_,e)},onApply:$})):t.createElement("div",{className:I(v.container,d),style:u},r&&t.createElement("label",{className:v.label,style:{display:"block",fontSize:h.typography.fontSize.medium,fontWeight:"bold",marginBottom:h.spacing.small,color:h.colors.text}},r),t.createElement("div",{className:v.inputGroup,style:{display:"flex",alignItems:"center",gap:h.spacing.small}},t.createElement("input",{type:"number",min:a,max:o,step:i,value:void 0!==_?_:"",onChange:B,placeholder:g.min,className:I(v.input),style:{flex:1,padding:h.spacing.small,fontSize:h.typography.fontSize.medium,backgroundColor:h.colors.background,color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,outline:"none"}}),t.createElement("span",{className:v.separator,style:{color:h.colors.text,opacity:.7}},"to"),t.createElement("input",{type:"number",min:a,max:o,step:i,value:void 0!==L?L:"",onChange:D,placeholder:g.max,className:I(v.input),style:{flex:1,padding:h.spacing.small,fontSize:h.typography.fontSize.medium,backgroundColor:h.colors.background,color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,outline:"none"}}),m&&t.createElement("button",{type:"button",onClick:$,className:v.button,style:{padding:`${h.spacing.small} ${h.spacing.medium}`,backgroundColor:h.colors.primary,color:"#fff",border:"none",borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer",fontSize:h.typography.fontSize.small,fontWeight:"500"}},"Apply"),(void 0!==T||void 0!==z||void 0!==_||void 0!==L)&&t.createElement("button",{type:"button",onClick:F,style:{padding:`${h.spacing.small} ${h.spacing.medium}`,backgroundColor:"transparent",color:h.colors.text,border:`1px solid ${h.colors.border}`,borderRadius:"string"==typeof h.borderRadius?h.borderRadius:h.borderRadius.medium,cursor:"pointer",fontSize:h.typography.fontSize.small}},"Reset")))},e.RangeSlider=({field:e,label:r,min:a,max:o,step:n=1,currentMin:s,currentMax:i,onRangeChange:l,formatValue:c=e=>e.toString(),className:d,style:u,theme:p,showValues:m=!0,syncWithState:g=!0,debounceMs:f=300})=>{const{theme:h}=S(),{refinements:y,addRefinement:b,removeRefinement:x}=w(),v=p||{},k=t.useMemo(()=>{if(!g)return{min:void 0,max:void 0};let t,r;return y.forEach(a=>{if(a.field===e){const e=a.value.match(/^>=(\d+(?:\.\d+)?)$/);e&&(t=parseFloat(e[1]));const o=a.value.match(/^<=(\d+(?:\.\d+)?)$/);o&&(r=parseFloat(o[1]))}}),{min:t,max:r}},[g,y,e]),[E,C]=t.useState(s??k.min??a),[R,N]=t.useState(i??k.max??o),[T,A]=t.useState(!1),z=t.useRef(null);t.useEffect(()=>{g&&!T&&(void 0!==k.min?C(k.min):C(a),void 0!==k.max?N(k.max):N(o))},[g,k.min,k.max,T,a,o]);const M=t.useCallback((t,r)=>{g&&(y.forEach(t=>{t.field===e&&x(e,t.value,!1)}),t>a&&b(e,`>=${t}`,!1),r<o&&b(e,`<=${r}`,t<=a),t>a&&r>=o&&b(e,`>=${t}`,!0))},[g,e,y,b,x,a,o]),_=t.useCallback((e,t)=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{M(e,t),l&&l(e,t)},f)},[M,l,f]),L=()=>{A(!1)},P=(E-a)/(o-a)*100,B=(R-a)/(o-a)*100;return t.createElement("div",{className:I(v.root,d),style:{fontFamily:"inherit",...u}},r&&t.createElement("label",{className:v.label,style:{display:"block",marginBottom:h.spacing.small,fontSize:h.typography.fontSize.medium,fontWeight:h.typography.fontWeight?.medium||500,color:h.colors.text}},r),t.createElement("div",{className:v.slider,style:{position:"relative",height:"40px",display:"flex",alignItems:"center"}},t.createElement("div",{className:v.track,style:{position:"absolute",width:"100%",height:"4px",backgroundColor:h.colors.border,borderRadius:"2px"}}),t.createElement("div",{className:v.trackFilled,style:{position:"absolute",left:`${P}%`,width:B-P+"%",height:"4px",backgroundColor:h.colors.primary,borderRadius:"2px"}}),t.createElement("input",{type:"range",min:a,max:o,step:n,value:E,onChange:e=>{const t=Math.min(Number(e.target.value),R-n);C(t),A(!0),_(t,R)},onMouseUp:L,onTouchEnd:L,className:v.thumb,style:{position:"absolute",width:"100%",height:"4px",background:"transparent",WebkitAppearance:"none",appearance:"none",cursor:"pointer",pointerEvents:"none"},"aria-label":`Minimum ${r||e}`}),t.createElement("input",{type:"range",min:a,max:o,step:n,value:R,onChange:e=>{const t=Math.max(Number(e.target.value),E+n);N(t),A(!0),_(E,t)},onMouseUp:L,onTouchEnd:L,className:v.thumb,style:{position:"absolute",width:"100%",height:"4px",background:"transparent",WebkitAppearance:"none",appearance:"none",cursor:"pointer",pointerEvents:"none"},"aria-label":`Maximum ${r||e}`})),m&&t.createElement("div",{className:v.values,style:{display:"flex",justifyContent:"space-between",marginTop:h.spacing.small,fontSize:h.typography.fontSize.small,color:h.colors.textSecondary}},t.createElement("span",{className:v.value},c(E)),t.createElement("span",{className:v.value},c(R))),t.createElement("style",null,`\n .${v.thumb||"seekora-range-slider__thumb"}::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: ${h.colors.primary};\n border-radius: 50%;\n cursor: pointer;\n pointer-events: all;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n .${v.thumb||"seekora-range-slider__thumb"}::-moz-range-thumb {\n width: 20px;\n height: 20px;\n background: ${h.colors.primary};\n border-radius: 50%;\n cursor: pointer;\n pointer-events: all;\n border: none;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n `))},e.RecentSearchesList=Xe,e.RecentlyViewed=({storageKey:e="seekora_recently_viewed",items:r,title:a="Recently Viewed",maxItems:o=6,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d="horizontal",currencySymbol:u="$"})=>{const[p,m]=t.useState([]);t.useEffect(()=>{if(!r)try{const t=localStorage.getItem(e);t&&m(JSON.parse(t))}catch(e){}},[e,r]);const g=(r||p).slice(0,o);return 0===g.length?null:t.createElement(N,{title:a,items:g,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d,currencySymbol:u})},e.RelatedProducts=({productId:e,items:r,loading:a=!1,title:o="Related Products",maxItems:n=6,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u="horizontal",currencySymbol:p="$"})=>{const{theme:m}=S(),g=d||{},f=r?.slice(0,n)||[];return a?t.createElement("div",{className:I(g.root,l),style:c},t.createElement("div",{className:g.loading,style:A(m)},"Loading related products...")):0===f.length?null:t.createElement(N,{title:o,items:f,renderItem:s,onItemClick:i,className:l,style:c,theme:d,layout:u,currencySymbol:p})},e.RichQuerySuggestions=Y,e.SearchBar=({placeholder:e="Search...",showSuggestions:r=!0,debounceMs:a=300,minQueryLength:o=2,maxSuggestions:n=10,onSearch:s,onQueryChange:i,onSuggestionSelect:d,onSearchStateChange:u,searchOptions:p,className:m,style:g,theme:f,renderSuggestion:h,renderLoading:y})=>{const{client:b,theme:x,enableAnalytics:v,autoTrackSearch:k}=S(),{query:E,setQuery:R,search:N,results:T,loading:A,error:z}=w(),[M,_]=t.useState(!1),[L,P]=t.useState(-1),B=t.useRef(null),D=t.useRef(null),$=t.useRef(!1),{suggestions:F,loading:W}=C({client:b,query:E,enabled:r&&E.length>=o,debounceMs:a,maxSuggestions:n}),q=F.slice(0,n);t.useEffect(()=>{u&&u({results:T,loading:A,error:z})},[T,A,z,u]),t.useEffect(()=>{T&&s&&s(E,T)},[T,E,s]),t.useEffect(()=>{i&&i(E)},[E,i]);const H=t.useCallback(async e=>{const t=e.trim();c("SearchBar: Triggering search",{query:t,originalQuery:e,isEmpty:!t}),$.current=!0,_(!1),P(-1),R(t,!1),c("SearchBar: Calling search() directly"),await N(),setTimeout(()=>{B.current?.blur(),setTimeout(()=>{$.current=!1},50)},100)},[R,N]),O=t.useCallback(e=>{l("SearchBar: Suggestion selected",{suggestion:e}),P(-1),_(!1),B.current?.blur(),d&&d(e),R(e)},[d,R]),j=t.useCallback(e=>{const t=e.target.value;R(t,!1),P(-1)},[R]),V=t.useCallback(e=>{switch(e.key){case"ArrowDown":r&&q.length>0&&(e.preventDefault(),P(e=>e<q.length-1?e+1:e));break;case"ArrowUp":r&&q.length>0&&(e.preventDefault(),P(e=>e>0?e-1:-1));break;case"Enter":if(e.preventDefault(),e.stopPropagation(),r&&q.length>0&&L>=0&&L<q.length)O(q[L].query);else{const e=B.current?.value||E;H(e)}break;case"Escape":_(!1),B.current?.blur()}},[q,L,E,r,H,O]),Q=t.useCallback(()=>{_(!0)},[]),U=t.useCallback(e=>{$.current||setTimeout(()=>{D.current?.contains(document.activeElement)||(_(!1),P(-1))},200)},[]),G=(e,r)=>t.createElement("div",{key:r},e),K=f||{},X=W||A,Y=q.length>0,J=M&&r&&E.length>=o&&(Y||X),Z=T,ee=Z?.processingTimeMS||Z?.data?.processingTimeMS||Z?.data?.data?.processingTimeMS;return t.createElement("div",{ref:D,className:I(K.container,m),style:{position:"relative",display:"flex",alignItems:"center",...g}},t.createElement("input",{ref:B,type:"text",value:E,onChange:j,onKeyDown:V,onFocus:Q,onBlur:U,placeholder:e,className:I(K.input,M&&K.inputFocused),style:{flex:1,padding:x.spacing.medium,fontSize:x.typography.fontSize.medium,fontFamily:x.typography.fontFamily,backgroundColor:x.colors.background,color:x.colors.text,borderWidth:"1px",borderStyle:"solid",borderColor:M?x.colors.focus:x.colors.border,borderRadius:"string"==typeof x.borderRadius?x.borderRadius:x.borderRadius.medium,outline:"none",...M&&{boxShadow:x.shadows.small}}}),void 0!==ee&&t.createElement("span",{style:{marginLeft:x.spacing.small,fontSize:x.typography.fontSize.small,color:x.colors.text,opacity:.7,whiteSpace:"nowrap"}},ee,"ms"),J&&t.createElement("div",{className:K.suggestionsContainer,style:{position:"absolute",top:"100%",left:0,right:0,marginTop:x.spacing.small,backgroundColor:x.colors.background,border:`1px solid ${x.colors.border}`,borderRadius:"string"==typeof x.borderRadius?x.borderRadius:x.borderRadius.medium,boxShadow:x.shadows.medium,maxHeight:"400px",overflowY:"auto",zIndex:1e3}},X&&(y?y():t.createElement("div",{style:{padding:x.spacing.medium,textAlign:"center"}},"Loading suggestions...")),!X&&q.length>0&&t.createElement(t.Fragment,null,q.map((e,r)=>{const a=r===L,o=h||G;return t.createElement("div",{key:r,className:I(K.suggestionItem,a&&K.suggestionItemActive),onClick:()=>O(e.query),onMouseEnter:()=>P(r),style:{padding:x.spacing.medium,cursor:"pointer",backgroundColor:a?x.colors.hover:"transparent",color:x.colors.text,transition:x.transitions?.fast||"150ms ease-in-out"}},o(e.query,r))})),!X&&0===q.length&&E.length>=o&&t.createElement("div",{style:{padding:x.spacing.medium,textAlign:"center",color:x.colors.textSecondary}},"No suggestions found")))},e.SearchBarWithSuggestions=xe,e.SearchInput=Re,e.SearchLayout=({sidebar:e,children:r,header:a,footer:o,sidebarWidth:n="300px",className:s,style:i,theme:l,showSidebarOnMobile:c=!1})=>{const{theme:d}=S(),u=l||{},[p,m]=t.useState(!1);return t.useEffect(()=>{const e=()=>{m(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t.createElement("div",{className:I(u.container,s),style:{display:"flex",flexDirection:"column",minHeight:"100vh",backgroundColor:d.colors.background,...i}},a&&t.createElement("header",{className:u.header,style:{padding:d.spacing.medium,borderBottom:`1px solid ${d.colors.border}`,backgroundColor:d.colors.background}},a),t.createElement("div",{style:{display:"flex",flex:1,gap:d.spacing.large,padding:d.spacing.medium,backgroundColor:d.colors.background,color:d.colors.text}},e&&(!p||c)&&t.createElement("aside",{className:u.sidebar,style:{width:n,minWidth:n}},e),t.createElement("main",{className:u.main,style:{flex:1,minWidth:0,backgroundColor:d.colors.background,color:d.colors.text}},r)),o&&t.createElement("footer",{className:u.footer,style:{padding:d.spacing.medium,borderTop:`1px solid ${d.colors.border}`,backgroundColor:d.colors.background}},o))},e.SearchProvider=({client:e,theme:r,enableAnalytics:a=!0,autoTrackSearch:o=!0,stateManager:n,children:s})=>{const i=t.useMemo(()=>r?k(r):v,[r]),l=t.useMemo(()=>new f({client:e,autoSearch:!0,debounceMs:300,itemsPerPage:10,defaultSearchOptions:{widget_mode:!0},...n}),[e,n]),c=t.useMemo(()=>({client:e,theme:i,enableAnalytics:a,autoTrackSearch:o,stateManager:l}),[e,i,a,o,l]);return t.createElement(E.Provider,{value:c},s)},e.SearchResults=({results:e,loading:r,error:a,onResultClick:o,renderResult:n,renderEmpty:s,renderLoading:i,renderError:c,className:p,style:m,theme:g,itemsPerPage:f=20,showPagination:h=!1,viewMode:y="list",fieldMapping:b,extractResults:x,enableKeyboardNavigation:v=!0,autoFocus:k=!1})=>{const{theme:E,client:C,enableAnalytics:R}=S(),{results:N,loading:T,error:A,currentPage:z,itemsPerPage:M}=w(),_=g||{},[L,P]=t.useState(-1),B=t.useRef(null),D=void 0!==e?e:N,$=void 0!==r?r:T,F=void 0!==a?a:A;t.useEffect(()=>{P(-1)},[D]),t.useEffect(()=>{if(L>=0&&B.current&&v){const e=B.current.querySelector(`[data-result-index="${L}"]`);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[L,v]);const W=t.useCallback(e=>{if(!v)return;const t=B.current?.querySelectorAll("[data-result-index]"),r=t?t.length-1:-1;switch(e.key){case"ArrowDown":e.preventDefault(),P(e=>Math.min(e+1,r));break;case"ArrowUp":e.preventDefault(),P(e=>Math.max(e-1,-1));break;case"Enter":if(e.preventDefault(),L>=0){const e=B.current?.querySelector(`[data-result-index="${L}"]`);e&&e.click()}break;case"Escape":P(-1),B.current?.blur();break;case"Home":e.preventDefault(),P(0);break;case"End":e.preventDefault(),P(r)}},[v,L]),q="card"===y||"grid"===y?(r,a,n=!1)=>{const s=r.primaryText||r.title,i=r.secondaryText||r.description,l=r.tertiaryText||r.price,c=r.imageUrl||r.image;return t.createElement("div",{key:r.id||a,"data-result-index":a,className:I(_.resultItem,n&&_.resultItemHover),onClick:async()=>{if(R&&r.id)try{const t=e||N,o={currentPage:z,itemsPerPage:M},n=(o.currentPage-1)*o.itemsPerPage+a+1,s=t?.context;C.trackClick?await C.trackClick(r.id,n,s):await(C.trackEvent?.({event_name:"product_click",clicked_item_id:r.id,metadata:{result:r,position:n}},s))}catch(e){const t=e instanceof Error?e:new Error(String(e));u("SearchResults: Error tracking click",{resultId:r.id,error:t.message})}o&&o(r,a)},onMouseEnter:()=>v&&P(a),style:{border:`1px solid ${n?E.colors.primary:E.colors.border}`,borderRadius:"string"==typeof E.borderRadius?E.borderRadius:E.borderRadius.medium,overflow:"hidden",cursor:o?"pointer":"default",transition:E.transitions?.normal||"250ms ease-in-out",backgroundColor:n?E.colors.hover:E.colors.background,display:"flex",flexDirection:"column",padding:E.spacing.medium,boxShadow:n?E.shadows.medium:E.shadows.small,outline:n?`2px solid ${E.colors.primary}`:"none",outlineOffset:"-2px"}},c&&t.createElement("div",{style:{width:"100%",aspectRatio:"16/9",overflow:"hidden",backgroundColor:E.colors.hover}},t.createElement("img",{src:c,alt:s,style:{width:"100%",height:"100%",objectFit:"cover"}})),t.createElement("div",{style:{padding:E.spacing.medium}},s&&t.createElement("h3",{className:_.resultTitle,style:{fontSize:E.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:E.spacing.small,color:E.colors.text}},s),i&&t.createElement("p",{className:_.resultDescription,style:{fontSize:E.typography.fontSize.medium,color:E.colors.text,margin:0,marginBottom:E.spacing.small,opacity:.8,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"}},i),l&&t.createElement("div",{className:_.resultPrice,style:{fontSize:E.typography.fontSize.medium,fontWeight:"bold",color:E.colors.primary,marginTop:"auto"}},l)))}:(r,a,n=!1)=>t.createElement("div",{key:r.id||a,"data-result-index":a,className:I(_.resultItem,n&&_.resultItemHover),onClick:async()=>{if(R&&r.id)try{const t=e||N,o={currentPage:z,itemsPerPage:M},n=(o.currentPage-1)*o.itemsPerPage+a+1,s=t?.context;C.trackClick?await C.trackClick(r.id,n,s):await(C.trackEvent?.({event_name:"product_click",clicked_item_id:r.id,metadata:{result:r,position:n}},s))}catch(e){const t=e instanceof Error?e:new Error(String(e));u("SearchResults: Error tracking click",{resultId:r.id,error:t.message})}o&&o(r,a)},onMouseEnter:()=>v&&P(a),style:{padding:E.spacing.medium,border:`1px solid ${E.colors.border}`,borderBottom:`1px solid ${E.colors.border}`,borderRadius:0,marginBottom:0,cursor:o?"pointer":"default",transition:E.transitions?.normal||"250ms ease-in-out",backgroundColor:n?E.colors.hover:E.colors.background,display:"flex",alignItems:"flex-start",gap:E.spacing.medium,outline:n?`2px solid ${E.colors.primary}`:"none",outlineOffset:"-2px"}},r.image&&t.createElement("img",{src:r.image,alt:r.title,className:_.resultImage,style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"string"==typeof E.borderRadius?E.borderRadius:E.borderRadius.medium,flexShrink:0}}),t.createElement("div",{style:{flex:1,minWidth:0}},t.createElement("h3",{className:_.resultTitle,style:{fontSize:E.typography.fontSize.large,fontWeight:"bold",margin:0,marginBottom:E.spacing.small,color:E.colors.text}},r.title),r.description&&t.createElement("p",{className:_.resultDescription,style:{fontSize:E.typography.fontSize.medium,color:E.colors.text,margin:0,marginBottom:E.spacing.small,opacity:.8}},r.description),r.price&&t.createElement("div",{className:_.resultPrice,style:{fontSize:E.typography.fontSize.medium,fontWeight:"bold",color:E.colors.primary}},r.price)));let H=[];if(x)H=x(D)||[];else if(D){const e=D;Array.isArray(e.results)&&e.results.length>0?H=e.results:e.data&&Array.isArray(e.data.results)&&e.data.results.length>0?H=e.data.results:e.data?.data&&Array.isArray(e.data.data.results)&&e.data.data.results.length>0?H=e.data.data.results:Array.isArray(D)?H=D:Array.isArray(e.results)&&(H=e.results)}const O={title:"document.productName",description:"document.brandDesc",image:"document.image",price:"document.mrp",url:"document.url",id:"id",...b},j=(e,t)=>{if(t)return((e,t)=>{if(t)return t.split(".").reduce((e,t)=>e?.[t],e)})(e,t)},V=H.map((e,t)=>{try{const r=j(e,O.primaryText),a=j(e,O.secondaryText),o=j(e,O.tertiaryText),n=j(e,O.imageUrl),s=j(e,O.title)||r||"Untitled",i=j(e,O.description)||a,l=j(e,O.image)||n,c=j(e,O.price)||o,d=j(e,O.url),u=j(e,O.id)||String(t),p=void 0!==c?((e,t="₹")=>{if(null!=e){if("number"==typeof e)return`${t}${e}`;if("string"==typeof e){const r=parseFloat(e);return isNaN(r)?e:`${t}${r}`}return String(e)}})(c):void 0,m={};O.custom&&Object.entries(O.custom).forEach(([t,r])=>{m[t]=j(e,r)});return{id:u,title:s,description:i,url:d,image:l,price:p,metadata:e,...m,...r&&{primaryText:r},...a&&{secondaryText:a},...o&&{tertiaryText:o},...n&&{imageUrl:n},_raw:e}}catch(r){const a=r instanceof Error?r:new Error(String(r));return d("SearchResults: Error extracting result item",{index:t,error:a.message,item:e?.id||"unknown"}),{id:String(t),title:"Error loading result",metadata:e}}}),Q={...m},U={..."grid"===y&&{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:E.spacing.medium},..."card"===y&&{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:E.spacing.medium}};if(l("SearchResults: Extracted results",{rawResultsCount:H.length,resultItemsCount:V.length,viewMode:y,hasError:!!F,isLoading:$}),$)return l("SearchResults: Rendering loading state"),t.createElement("div",{className:I(_.container,p),style:m},i?i():t.createElement("div",{className:_.loadingState,style:{padding:E.spacing.large,textAlign:"center",color:E.colors.text}},"Loading results..."));if(F)return u("SearchResults: Rendering error state",{error:F.message,stack:F.stack}),t.createElement("div",{className:I(_.container,p),style:m},c?c(F):(G=F,t.createElement("div",{className:_.errorState,style:{padding:E.spacing.large,textAlign:"center",color:E.colors.error}},"Error: ",G.message)));var G;if(!D||0===V.length)return l("SearchResults: No results to display"),t.createElement("div",{className:I(_.container,p),style:m},s?s():t.createElement("div",{className:_.emptyState,style:{padding:E.spacing.large,textAlign:"center",color:E.colors.text}},"No results found"));const K=n||q;return t.createElement("div",{ref:B,className:I(_.container,p),style:Q,tabIndex:v?0:void 0,onKeyDown:W,role:"listbox","aria-label":"Search results","aria-activedescendant":L>=0?`result-${L}`:void 0},(void 0!==D?.totalResults||void 0!==D?.data?.total_results)&&V.length>0&&t.createElement("div",{className:_.header,style:{marginBottom:E.spacing.medium,fontSize:E.typography.fontSize.medium,color:E.colors.text}},"Found ",D?.totalResults||D?.data?.total_results||0," result",1!==(D?.totalResults||D?.data?.total_results||0)?"s":""),v&&V.length>0&&t.createElement("div",{style:{fontSize:"12px",color:E.colors.text,opacity:.6,marginBottom:E.spacing.small,display:"flex",gap:"8px",alignItems:"center"}},t.createElement("span",{style:{display:"inline-flex",gap:"4px",padding:"2px 6px",backgroundColor:E.colors.hover,borderRadius:"4px",fontSize:"11px"}},"↑↓ navigate"),t.createElement("span",{style:{display:"inline-flex",gap:"4px",padding:"2px 6px",backgroundColor:E.colors.hover,borderRadius:"4px",fontSize:"11px"}},"↵ select")),t.createElement("div",{className:_.resultsList,style:U},V.map((e,t)=>K(e,t,t===L))))},e.SectionError=at,e.SectionItemGrid=function({columns:e=4,maxItems:r=12,className:a,style:o,getItemId:n=e=>e.id??String(e?.objectID??""),getItemTitle:s=e=>e.title??e?.title??"",getItemImage:i=e=>e.image??e?.image,getItemDescription:l=e=>e.description??e?.description,getItemUrl:c=e=>e.url??e?.url,renderItem:d}){const{items:u,loading:p,error:m,trackClick:g}=tt();return p?t.createElement(rt,{className:a,style:o}):m?t.createElement(at,{className:a,style:o}):t.createElement(Oe,{items:u,maxItems:r,columns:e,className:a,style:o,getItemId:n,getItemTitle:s,getItemImage:i,getItemDescription:l,getItemUrl:c,renderItem:d,onItemClick:(e,t)=>g(e,t)})},e.SectionLoading=rt,e.SectionSearchProvider=function({children:e,query:r,refinements:a=[],maxItems:o=12,sortBy:n,enabled:s=!0,sectionId:i}){const{client:l}=S(),[c,d]=t.useState([]),[u,p]=t.useState(!0),[m,g]=t.useState(null),[f,h]=t.useState(0);t.useEffect(()=>{if(!s||!l?.search)return d([]),p(!1),g(null),void h(0);let e=!1;p(!0),g(null);const t={per_page:o,page:1};return n&&(t.sort_by=n),a.length>0&&(t.filter_by=a.map(e=>`${e.field}:${e.value}`).join(",")),l.search(r,t).then(t=>{e||(d(function(e){if(!e)return[];if(Array.isArray(e.results))return e.results;if(Array.isArray(e.hits))return e.hits;const t=e.data;return t&&Array.isArray(t.results)?t.results:t&&Array.isArray(t.data)?t.data:[]}(t)),h(function(e){if(!e)return 0;const t=e.totalResults??e.total??e.total_results;if("number"==typeof t)return t;const r=e.data;return null!=r?.total_results?Number(r.total_results):null!=r?.data?.total_results?Number(r.data.total_results):0}(t)),p(!1))}).catch(t=>{e||(g(t instanceof Error?t:new Error(String(t))),d([]),p(!1))}),()=>{e=!0}},[l,s,r,o,n,a]);const y=t.useCallback((e,t)=>{if(!l?.trackEvent)return;const r=e?.id??e?.objectID;l.trackEvent({event_name:"section_result_click",clicked_item_id:r,position:t,section:i,metadata:{section_id:i}},void 0)},[l,i]),b=t.useMemo(()=>({items:c,loading:u,error:m,totalCount:f,sectionId:i,trackClick:y}),[c,u,m,f,i,y]);return t.createElement(et.Provider,{value:b},e)},e.ShopifyDropdown=Jt,e.Snippet=({hit:e,attribute:r,maxLength:a=100,ellipsis:o="...",className:n,style:s,theme:i,tagName:l="span",renderHighlighted:c,renderNonHighlighted:d,query:u})=>{const{theme:f}=S(),h=i||{},y=t.useMemo(()=>{const t=e._snippetResult?.[r]?.value||e.snippet_result?.[r]?.value||e._snippet?.[r]||e.snippet?.[r];if(t)return t.replace(/<em>/g,"<mark>").replace(/<\/em>/g,"</mark>");let n=p({hit:e,attribute:r,preTag:"<mark>",postTag:"</mark>"});if(n.replace(/<\/?mark>/g,"").length>a){const e=function(e,t){let r=0,a="",o=!1;for(let n=0;n<e.length;n++){const s=e[n];if("<"===s)o=!0,a+=s;else if(">"===s)o=!1,a+=s;else if(o)a+=s;else{if(r>=t)break;a+=s,r++}}const n=a.match(/<mark>/g)?.length||0,s=a.match(/<\/mark>/g)?.length||0;for(let e=0;e<n-s;e++)a+="</mark>";return a}(n,a);return e+o}return n},[e,r,a,o]),b=t.useMemo(()=>{const t=m(y,"<mark>","</mark>");if(t.every(e=>!e.isHighlighted)&&u){const t=e[r]||y;let n=String(t);return n.length>a&&(n=n.substring(0,a)+o),g(n,u)}return t},[y,u,e,r,a,o]),x={backgroundColor:f.colors.warning||"#fff59d",fontWeight:f.typography.fontWeight?.semibold||600,padding:"0 2px",borderRadius:"2px"},v=b.map((e,r)=>e.isHighlighted?c?t.createElement(t.Fragment,{key:r},c(e,r)):t.createElement("mark",{key:r,className:h.highlighted,style:x},e.value):d?t.createElement(t.Fragment,{key:r},d(e,r)):t.createElement("span",{key:r,className:h.nonHighlighted},e.value));return t.createElement(l,{className:n||h.root,style:s},v)},e.SortBy=({options:e,value:r,defaultValue:a,onSortChange:o,renderSelect:n,className:s,style:i,theme:l,placeholder:c="Sort by...",syncWithState:d=!0})=>{const{theme:u}=S(),{sortBy:p,setSortBy:m}=w(),g=l||{},[f,h]=t.useState(a||e[0]?.value||"");t.useEffect(()=>{d&&a&&!p&&m(a,!1)},[]);const y=void 0!==r?r:d&&p?p:f,b=e=>{const t=e.target.value;h(t),d&&m(t),o&&o(t)};return n?t.createElement("div",{className:I(g.container,s),style:i},n({value:y,onChange:b,options:e})):t.createElement("select",{value:y,onChange:b,className:I(g.select,s),style:{padding:u.spacing.small,paddingRight:u.spacing.medium,fontSize:u.typography.fontSize.medium,border:`1px solid ${u.colors.border}`,borderRadius:"string"==typeof u.borderRadius?u.borderRadius:u.borderRadius.medium,backgroundColor:u.colors.background,color:u.colors.text,cursor:"pointer",outline:"none",...i},"aria-label":"Sort results"},e.map(e=>t.createElement("option",{key:e.value,value:e.value,className:g.option},e.label)))},e.SpotlightDropdown=Kt,e.Stats=({results:e,renderStats:r,className:a,style:o,theme:n,showProcessingTime:s=!1,showQuery:i=!1,separator:l=" • "})=>{const{theme:c}=S(),d=n||{},u=e,p=u?.totalResults||u?.data?.total_results||u?.data?.data?.total_results||0,m=u?.processingTimeMS||u?.data?.processingTimeMS||u?.data?.data?.processingTimeMS,g=u?.query??"";return r?t.createElement("div",{className:I(d.container,a),style:o},r({totalResults:p,processingTime:m,query:g})):(()=>{const e=[];return p>0?e.push(`${p.toLocaleString()} result${1!==p?"s":""}`):e.push("No results"),s&&void 0!==m&&e.push(`${m}ms`),i&&g&&e.push(`for "${g}"`),t.createElement("div",{className:I(d.container,a),style:{fontSize:c.typography.fontSize.medium,color:c.colors.text,...o}},e.map((e,r)=>t.createElement("span",{key:r},r>0&&t.createElement("span",{className:d.separator,style:{margin:`0 ${c.spacing.small}`}},l),t.createElement("span",{className:d.text},e))))})()},e.SuggestionDropdownVariants=cr,e.SuggestionItem=Me,e.SuggestionList=Pe,e.SuggestionSearchBar=lr,e.SuggestionsDropdownComposition=function({showRecentSearches:e=!0,showTrending:r=!0,showTabs:a=!0,showProducts:o=!0,placeholder:n,...s}){return t.createElement(Ee,{...s},t.createElement("div",{className:"seekora-suggestions-dropdown-composition",style:{position:"relative",width:"100%"}},t.createElement(Re,{placeholder:n}),t.createElement(Ne,null,t.createElement(Ze,null),t.createElement(_e,null),e?t.createElement(Xe,null):null,t.createElement(Pe,null),a?t.createElement(Ge,null):null,o?t.createElement(Ue,null):null,r?t.createElement(Je,null):null)))},e.SuggestionsError=Ze,e.SuggestionsLoading=_e,e.SuggestionsProvider=Ee,e.TrendingItems=({items:e,loading:r=!1,title:a="Trending Now",maxItems:o=8,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d="horizontal",currencySymbol:u="$"})=>{const{theme:p}=S(),m=c||{},g=e?.slice(0,o)||[];return r?t.createElement("div",{className:I(m.root,i),style:l},t.createElement("div",{className:m.loading,style:A(p)},"Loading trending items...")):0===g.length?null:t.createElement(N,{title:a,items:g,renderItem:n,onItemClick:s,className:i,style:l,theme:c,layout:d,currencySymbol:u})},e.TrendingList=Je,e.addRecentSearch=ht,e.addToRecentlyViewed=function(e,t="seekora_recently_viewed",r=20){if("undefined"!=typeof localStorage)try{const a=localStorage.getItem(t);let o=a?JSON.parse(a):[];o=o.filter(t=>t.id!==e.id),o.unshift(e),o=o.slice(0,r),localStorage.setItem(t,JSON.stringify(o))}catch(e){}},e.brandPresets=Br,e.breakpoints=Et,e.clearRecentSearches=e=>{try{const t=e?`${gt}_${e}`:gt;localStorage.removeItem(t)}catch{}},e.clearSuggestionsCache=()=>{vt?.clear()},e.createSuggestionsCache=e=>new xt(e),e.createSuggestionsTheme=function(e="light",t={},r){return{...{light:_r,dark:Lr,minimal:Pr}[e],...r?Br[r]:{},...t}},e.createTheme=k,e.darkTheme={colors:{primary:"#0d6efd",secondary:"#6c757d",background:"#1a1a1a",text:"#ffffff",border:"#333333",hover:"#2a2a2a",focus:"#0d6efd",error:"#dc3545"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.25rem"}},spacing:{small:"0.5rem",medium:"1rem",large:"1.5rem"},borderRadius:"0.25rem",shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.7)",medium:"0 3px 6px rgba(0, 0, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.8)",large:"0 10px 20px rgba(0, 0, 0, 0.7), 0 6px 6px rgba(0, 0, 0, 0.9)"}},e.darkThemeVariables=Lr,e.defaultTheme=v,e.extractBrand=(e,t={name:"name"})=>({id:t.id?ot(e,t.id):e?.id,name:ot(e,t.name)??"",logo:t.logo?ot(e,t.logo):void 0,count:t.count?ot(e,t.count):void 0,_raw:e}),e.extractCategory=it,e.extractProduct=st,e.extractSuggestion=nt,e.formatParsedFilters=function(e){return e.map(e=>`${e.field}: ${e.value}`).join(", ")},e.formatSuggestionPrice=lt,e.generateSuggestionsStylesheet=Dr,e.getFingerprint=async function(e){return new x(e).get()},e.getRecentSearches=ft,e.getShortcutText=Cr,e.getSuggestionsCache=kt,e.highlightText=dt,e.injectGlobalResponsiveStyles=It,e.injectSuggestionsStyles=Fr,e.lightThemeVariables=_r,e.mediaQueries=St,e.mergeThemes=(e,...t)=>t.reduce((e,t)=>({colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography,fontSize:{...e.typography?.fontSize,...t.typography?.fontSize}},spacing:{...e.spacing,...t.spacing},borderRadius:t.borderRadius??e.borderRadius,shadows:{...e.shadows,...t.shadows},transitions:{...e.transitions,...t.transitions},breakpoints:{...e.breakpoints,...t.breakpoints},zIndex:{...e.zIndex,...t.zIndex}}),e),e.minimalTheme={colors:{primary:"#000000",secondary:"#666666",background:"#ffffff",text:"#000000",border:"#e0e0e0",hover:"#f5f5f5",focus:"#000000",error:"#cc0000"},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontSize:{small:"0.875rem",medium:"1rem",large:"1.125rem"}},spacing:{small:"0.5rem",medium:"0.75rem",large:"1rem"},borderRadius:"0",shadows:{small:"none",medium:"none",large:"none"}},e.minimalThemeVariables=Pr,e.parseHighlightMarkup=Ae,e.removeRecentSearch=yt,e.touchTargets=wt,e.updateSuggestionsStyles=function(e){Fr(e,!0)},e.useAnalytics=({client:e,enabled:r=!0})=>{const a=t.useCallback(async(t,a,o)=>{if(r)try{const r={event_name:t,...a};await(e.trackEvent?.(r,o))}catch(e){u("Failed to track event:",e)}},[e,r]),o=t.useCallback(async(t,o,n,s)=>{if(!r)return;const i=s??0;e.trackClick?await e.trackClick(t,i,n):await a("product_click",{clicked_item_id:t,metadata:{result:o,...void 0!==s&&{position:i}}},n)},[e,a,r]),n=t.useCallback(async(e,t,o,n,s)=>{r&&await a("conversion",{clicked_item_id:e,value:o,currency:n,metadata:{result:t}},s)},[a,r]),s=t.useCallback(async(t,a)=>{if(r&&0!==t.length)try{await(e.trackEvents?.(t,a))}catch(e){u("Failed to track batch events:",e)}},[e,r]);return{trackEvent:a,trackClick:o,trackConversion:n,trackBatch:s}},e.useDocSearch=Tr,e.useDocSearchSeekoraSearch=Ar,e.useInjectResponsiveStyles=Nt,e.useKeyboard=wr,e.useNaturalLanguageFilters=function(e={}){const{fieldMappings:r={},valueMappings:a={},autoApply:o=!1,currencySymbol:n="$"}=e,{addRefinement:s,removeRefinement:i,clearRefinements:l,setQuery:c}=w(),d=t.useMemo(()=>({...Mr,colors:[...Mr.colors,...a.color?Object.keys(a.color):[]],sizes:{...Mr.sizes,...a.size||{}}}),[a]),u=t.useCallback(e=>{const t=[];let o=e;for(const a of d.price){const n=e.match(a.pattern);if(n){"range"===a.operator&&n[2]?(t.push({field:r.price||"price",value:`>=${n[1]}`,operator:">=",confidence:.95,matchedText:n[0]}),t.push({field:r.price||"price",value:`<=${n[2]}`,operator:"<=",confidence:.95,matchedText:n[0]})):n[1]&&t.push({field:r.price||"price",value:`${a.operator}${n[1]}`,operator:a.operator,confidence:.95,matchedText:n[0]}),o=o.replace(n[0]," ");break}}const n=new RegExp(`\\b(${d.colors.join("|")})\\b`,"gi"),s=e.match(n);s&&s.forEach(e=>{const n=a.color?.[e.toLowerCase()]||e.toLowerCase();t.push({field:r.color||"color",value:n,operator:"=",confidence:.9,matchedText:e}),o=o.replace(new RegExp(`\\b${e}\\b`,"gi")," ")});const i=Object.entries(d.sizes);for(const[a,n]of i){const s=new RegExp(`\\b${a}\\b`,"gi");if(s.test(e)){t.push({field:r.size||"size",value:n,operator:"=",confidence:.85,matchedText:a}),o=o.replace(s," ");break}}for(const a of d.ratings)if("value"in a)a.pattern.test(e)&&(t.push({field:r.rating||a.field,value:`${a.operator}${a.value}`,operator:a.operator,confidence:.8,matchedText:e.match(a.pattern)?.[0]||""}),o=o.replace(a.pattern," "));else{const n=e.match(a.pattern);n&&n[1]&&(t.push({field:r.rating||a.field,value:`${a.operator}${n[1]}`,operator:a.operator,confidence:.85,matchedText:n[0]}),o=o.replace(n[0]," "))}for(const a of d.availability)a.pattern.test(e)&&(t.push({field:r[a.field]||a.field,value:a.value,operator:"=",confidence:.9,matchedText:e.match(a.pattern)?.[0]||""}),o=o.replace(a.pattern," "));return o=o.replace(/\s+/g," ").trim(),{cleanedQuery:o,filters:t,originalQuery:e,hasFilters:t.length>0}},[d,r,a]),p=t.useCallback(e=>{e.forEach(e=>{s(e.field,e.value,!1)}),e.length},[s]),m=t.useCallback(e=>{const t=u(e);return t.hasFilters&&(p(t.filters),t.cleanedQuery!==e&&c(t.cleanedQuery,!0)),t},[u,p,c]);return{parse:u,applyFilters:p,parseAndApply:m}},e.useQuerySuggestions=C,e.useQuerySuggestionsEnhanced=$,e.useResponsive=Ct,e.useSearchContext=S,e.useSearchState=w,e.useSectionSearchContext=tt,e.useSeekoraSearch=({client:e,autoTrack:r=!0})=>{const[a,o]=t.useState(null),[n,s]=t.useState(!1),[i,d]=t.useState(null),[p,m]=t.useState(null),g=t.useCallback(async t=>{s(!0),d(null);const r=t.q||"";l("useSeekoraSearch: Starting search",{query:r,options:t});try{const{q:r,...a}=t,n="string"==typeof r?r:"",s=await e.search(n,a);return c("useSeekoraSearch: Search completed",{query:n,resultsCount:Array.isArray(s?.results)?s.results.length:0,hasContext:!!s?.context}),o(s),null!=s.context&&m(s.context),s}catch(e){const t=e instanceof Error?e:new Error(String(e));return u("useSeekoraSearch: Search failed",{query:r,error:t.message,stack:t.stack}),d(t),o(null),m(null),null}finally{s(!1)}},[e]);return{search:g,results:a,loading:n,error:i,context:p,clearResults:t.useCallback(()=>{o(null),d(null),m(null)},[])}},e.useSmartSuggestions=function(e,r={}){const{minQueryLength:a=1,maxSuggestions:o=10,debounceMs:n=200,enableSpellCorrection:s=!0,enableQueryExpansion:i=!0,enableIntentDetection:l=!0,includeTrending:c=!0,userContext:d}=r,{stateManager:u}=S(),[p,m]=t.useState([]),[g,f]=t.useState(!1),[h,y]=t.useState(null),[b,x]=t.useState(null),[v,k]=t.useState([]),[E,w]=t.useState([]),C=t.useRef(null),R=t.useMemo(()=>["phone","laptop","computer","tablet","headphones","camera","television","speaker","watch","keyboard","mouse","monitor","shirt","pants","shoes","jacket","dress","skirt","sweater","electronics","clothing","accessories","furniture","appliances"],[]),I=t.useCallback(async e=>{const t=[];if(l){const t=function(e){const t=[{pattern:/^(buy|purchase|order|get)\s+/i,intent:"purchase"},{pattern:/^(find|search|looking for|where)\s+/i,intent:"search"},{pattern:/^(compare|vs|versus)\s+/i,intent:"compare"},{pattern:/^(how (to|do)|what is|why)\s+/i,intent:"informational"},{pattern:/under\s*\$?\d+|less than\s*\$?\d+|cheap|affordable/i,intent:"price_sensitive"},{pattern:/best|top|recommended|popular/i,intent:"recommendation"},{pattern:/\d+\s*(gb|tb|inch|cm|mm|kg|lb)/i,intent:"specification"},{pattern:/(red|blue|green|black|white|pink|purple|yellow)\s+/i,intent:"color_preference"},{pattern:/(size|small|medium|large|xl|xxl)\s+/i,intent:"size_preference"}];for(const{pattern:r,intent:a}of t)if(r.test(e))return{intent:a,confidence:.8};return null}(e);x(t?t.intent:null)}if(s&&e.length>=3){const r=zr(e,R);k(r),r.forEach(r=>{t.push({text:r,type:"correction",confidence:.9,metadata:{correctedFrom:e}})})}if(i){const r=function(e){const t=e.toLowerCase(),r=[];return Object.entries({phone:["smartphone","mobile","cellphone"],laptop:["notebook","computer","pc"],tv:["television","smart tv","monitor"],headphones:["earbuds","earphones","headset"],shoes:["footwear","sneakers","boots"],shirt:["top","blouse","tee"],pants:["trousers","jeans","bottoms"],cheap:["affordable","budget","inexpensive"],best:["top-rated","popular","recommended"]}).forEach(([a,o])=>{t.includes(a)&&o.forEach(t=>{const o=e.replace(new RegExp(a,"gi"),t);r.includes(o)||r.push(o)})}),r.slice(0,3)}(e);w(r),r.forEach(e=>{t.push({text:e,type:"expansion",confidence:.7,metadata:{expandedTo:[e]}})})}return t.unshift({text:e,type:"query",confidence:1}),d?.recentSearches&&d.recentSearches.filter(t=>t.toLowerCase().includes(e.toLowerCase())&&t!==e).slice(0,2).forEach(e=>{t.push({text:e,type:"related",confidence:.6})}),t.slice(0,o)},[R,l,s,i,o,d]),N=t.useCallback(async e=>e.length<a?[]:I(e),[a,I]);return t.useEffect(()=>(C.current&&clearTimeout(C.current),e.length<a?(m([]),k([]),w([]),void x(null)):(f(!0),C.current=setTimeout(async()=>{try{const t=await I(e);m(t),y(null)}catch(e){y(e instanceof Error?e:new Error(String(e))),m([])}finally{f(!1)}},n),()=>{C.current&&clearTimeout(C.current)})),[e,a,n,I]),{suggestions:p,loading:g,error:h,detectedIntent:b,corrections:v,expansions:E,getSuggestions:N,clear:t.useCallback(()=>{m([]),k([]),w([]),x(null),y(null)},[])}},e.useSuggestionsAnalytics=fe,e.useSuggestionsContext=ke});
|