diff --git "a/static/assets/index-6078c243.js" "b/static/assets/index-6078c243.js" --- "a/static/assets/index-6078c243.js" +++ "b/static/assets/index-6078c243.js" @@ -284,7 +284,7 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KN=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],yc=te("zap",KN),QN=[{name:"Templates",href:"/templates",icon:Er,description:"Browse assistant templates and examples"},{name:"Assistant Studio",href:"/playground",icon:ia,description:"Build, test and refine your AI assistants"},{name:"Model Catalog",href:"/models",icon:ra,description:"Browse and manage AI models"},{name:"Settings",href:"/settings",icon:ui,description:"Application settings"}];function YN(){const e=Ko();return s.jsxs("div",{className:"flex h-full flex-col bg-background border-r",children:[s.jsx("div",{className:"p-6 border-b",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:s.jsx(Er,{className:"h-5 w-5 text-primary-foreground"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"font-semibold text-lg",children:"Edge LLM"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Local AI Platform"})]})]})}),s.jsxs("div",{className:"flex-1 px-3 py-4 space-y-8",children:[s.jsx("div",{children:s.jsxs(Hp,{to:"/",className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-all hover:bg-accent text-muted-foreground hover:text-foreground",children:[s.jsx(Gk,{className:"h-4 w-4"}),s.jsx("span",{children:"Back to Home"})]})}),s.jsxs("div",{children:[s.jsx("h2",{className:"mb-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Get started"}),s.jsx("nav",{className:"space-y-1",children:QN.map(t=>{const n=e.pathname===t.href;return s.jsxs(Hp,{to:t.href,className:ce("flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-all hover:bg-accent",n?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:text-foreground"),children:[s.jsx(t.icon,{className:"h-4 w-4"}),s.jsx("div",{className:"flex-1",children:t.name})]},t.name)})})]})]})]})}function XN(){return s.jsxs("div",{className:"flex h-screen bg-background",children:[s.jsx("div",{className:"w-64 border-r",children:s.jsx(YN,{})}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(Zb,{})})]})}function tm(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function iy(...e){return t=>{let n=!1;const r=e.map(i=>{const o=tm(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:o,...l}=r,a=g.Children.toArray(o),u=a.find(eC);if(u){const c=u.props.children,f=a.map(d=>d===u?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return s.jsx(t,{...l,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,f):null})}return s.jsx(t,{...l,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var qN=ki("Slot");function JN(e){const t=g.forwardRef((n,r)=>{const{children:i,...o}=n;if(g.isValidElement(i)){const l=nC(i),a=tC(o,i.props);return i.type!==g.Fragment&&(a.ref=r?iy(r,l):l),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var oy=Symbol("radix.slottable");function ZN(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=oy,t}function eC(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===oy}function tC(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const u=o(...a);return i(...a),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function nC(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const nm=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,rm=Vx,Hd=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return rm(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(c=>{const f=n==null?void 0:n[c],d=o==null?void 0:o[c];if(f===null)return null;const p=nm(f)||nm(d);return i[c][p]}),a=n&&Object.entries(n).reduce((c,f)=>{let[d,p]=f;return p===void 0||(c[d]=p),c},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:d,className:p,...m}=f;return Object.entries(m).every(w=>{let[x,S]=w;return Array.isArray(S)?S.includes({...o,...a}[x]):{...o,...a}[x]===S})?[...c,d,p]:c},[]);return rm(e,l,u,n==null?void 0:n.class,n==null?void 0:n.className)},Wd=Hd("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),J=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const l=r?qN:"button";return s.jsx(l,{className:ce(Wd({variant:t,size:n,className:e})),ref:o,...i})});J.displayName="Button";function rC(){const e=Lr();return s.jsxs("div",{className:"min-h-screen bg-white",children:[s.jsx("nav",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-20",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-16 w-16",onError:t=>{console.error("Logo failed to load"),t.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"hidden md:flex items-center space-x-8",children:[s.jsx("span",{className:"text-white bg-purple-600 px-4 py-2 rounded-md font-medium",children:"Home"}),s.jsx("button",{onClick:()=>e("/technology"),className:"text-gray-700 hover:text-purple-600 font-medium transition-colors",children:"Technology"}),s.jsx("button",{onClick:()=>e("/usecases"),className:"text-gray-700 hover:text-purple-600 font-medium transition-colors",children:"Use Cases"}),s.jsx(J,{variant:"outline",onClick:()=>e("/mydevice"),className:"border-purple-600 text-purple-600 hover:bg-purple-50",children:"My Device"})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(J,{variant:"ghost",size:"sm",children:s.jsx(Ud,{className:"h-5 w-5"})})})]})})}),s.jsx("div",{className:"relative py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsx("div",{className:"relative mb-6",children:s.jsxs("h1",{className:"text-4xl md:text-6xl lg:text-7xl font-bold text-black leading-tight",children:["Offline AI that",s.jsx("br",{}),"works where the",s.jsx("br",{}),"cloud cannot"]})}),s.jsx("p",{className:"text-lg md:text-xl text-purple-700 font-semibold mb-8 max-w-3xl mx-auto",children:"AI that stays reliable, private, and resilient in any environment"}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-12",children:[s.jsx(J,{size:"lg",className:"bg-purple-600 hover:bg-purple-700 text-white px-8 py-3 text-lg font-medium",onClick:()=>e("/usecases"),children:"Learn More"}),s.jsx(J,{size:"lg",variant:"outline",className:"border-purple-600 text-purple-600 hover:bg-purple-50 px-8 py-3 text-lg font-medium",onClick:()=>e("/mydevice"),children:"I already have a device"})]})]})}),s.jsx("div",{className:"py-12 px-4 sm:px-6 lg:px-8 bg-gray-50",children:s.jsx("div",{className:"max-w-6xl mx-auto",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-lg border border-gray-200 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("img",{src:"/assets/24h.png",alt:"24/7 Available",className:"h-10 w-10",onError:t=>{console.error("24h icon failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("h3",{className:"text-lg font-bold text-black mb-3",children:"Always Available"})]}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"Cloud AI fails without internet. Our offline AI runs fully on-device, ready to assist anywhere — from airplanes to remote mountains."})]}),s.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-lg border border-gray-200 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("img",{src:"/assets/privacy.png",alt:"Privacy & Security",className:"h-10 w-10",onError:t=>{console.error("Privacy icon failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("h3",{className:"text-lg font-bold text-black mb-3",children:"Privacy & Security"})]}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"Cloud AI requires uploading sensitive data. Offline AI keeps all processing local, protecting personal privacy and enterprise security."})]}),s.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-lg border border-gray-200 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("img",{src:"/assets/reliablity.png",alt:"Reliability",className:"h-10 w-10",onError:t=>{console.error("Reliability icon failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("h3",{className:"text-lg font-bold text-black mb-3",children:"Reliability"})]}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"Cloud latency can cost lives in emergencies. Offline AI responds instantly, built for survival, healthcare, and safety-critical moments."})]})]})})}),s.jsx("footer",{className:"bg-white text-gray-600 py-8 px-4 sm:px-6 lg:px-8 border-t border-gray-200",children:s.jsxs("div",{className:"max-w-6xl mx-auto text-center",children:[s.jsx("div",{className:"flex items-center justify-center mb-4",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-12 w-12",onError:t=>{console.error("Footer logo failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("p",{className:"text-gray-600 mb-6",children:"Need help? Contact us to get customized device and services"}),s.jsxs("div",{className:"flex justify-center space-x-6",children:[s.jsx("a",{href:"#",className:"text-gray-500 hover:text-gray-700",children:"Privacy Policy"}),s.jsx("a",{href:"#",className:"text-gray-500 hover:text-gray-700",children:"Terms of Service"}),s.jsx("a",{href:"#",className:"text-gray-500 hover:text-gray-700",children:"Support"})]})]})})]})}const iC=Hd("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function xe({className:e,variant:t,...n}){return s.jsx("div",{className:ce(iC({variant:t}),e),...n})}const Ie=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ie.displayName="Card";const Mt=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("flex flex-col space-y-1.5 p-6",e),...t}));Mt.displayName="CardHeader";const Lt=g.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:ce("text-2xl font-semibold leading-none tracking-tight",e),...t}));Lt.displayName="CardTitle";const oC=g.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:ce("text-sm text-muted-foreground",e),...t}));oC.displayName="CardDescription";const Ye=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("p-6 pt-0",e),...t}));Ye.displayName="CardContent";const lC=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("flex items-center p-6 pt-0",e),...t}));lC.displayName="CardFooter";function sC(){const[e,t]=g.useState("Hardware"),n=Lr();return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("nav",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-20",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-16 w-16",onError:r=>{console.error("Logo failed to load"),r.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"hidden md:flex items-center space-x-8",children:[s.jsx("button",{onClick:()=>n("/"),className:"text-gray-700 hover:text-purple-600 font-medium",children:"Home"}),s.jsx("span",{className:"text-white bg-purple-600 px-4 py-2 rounded-md font-medium",children:"Technology"}),s.jsx("button",{onClick:()=>n("/usecases"),className:"text-gray-700 hover:text-purple-600 font-medium transition-colors",children:"Use Cases"}),s.jsx(J,{variant:"outline",onClick:()=>n("/mydevice"),className:"border-purple-600 text-purple-600 hover:bg-purple-50",children:"My Device"})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(J,{variant:"ghost",size:"sm",children:s.jsx(Ud,{className:"h-5 w-5"})})})]})})}),s.jsx("div",{className:"py-24 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-black mb-6",children:"Our Technology"}),s.jsx("p",{className:"text-xl text-purple-700 font-semibold max-w-2xl mx-auto mb-8",children:"Low-cost FPGA-based design, optimized for Large Language Models on-device."}),s.jsx("div",{className:"flex justify-center mb-12",children:s.jsx("div",{className:"bg-white rounded-lg p-1 shadow-sm",children:["Hardware","Software"].map(r=>s.jsx("button",{onClick:()=>t(r),className:`px-6 py-2 rounded-md text-sm font-medium transition-all ${e===r?"bg-purple-600 text-white":"text-gray-700 hover:text-purple-600"}`,children:r},r))})})]})}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:[e==="Hardware"&&s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-start",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-6",children:"Hardware Description"}),s.jsx("p",{className:"text-lg text-gray-800 leading-relaxed",children:"Huoxu is an ultra–low-budget single-board computer designed specifically for large language model (LLM) deployment. Despite its compact form factor and low power consumption, we provide:"}),s.jsxs("ul",{className:"mt-6 space-y-3 text-lg text-gray-800",children:[s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Accelerated inference performance — delivering up to 15 tokens per second on a 30B model, thanks to its optimized FPGA-based AI engine."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"High memory capacity — up to 40GB RAM, enabling hosting of LLMs up to ≥30B parameters."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Cost efficiency — making advanced AI workloads accessible at low cost."]})]})]}),s.jsx(Ie,{className:"bg-gradient-to-br from-purple-50 to-blue-50 border-0 shadow-lg",children:s.jsx(Ye,{className:"p-8 space-y-6",children:s.jsxs("div",{className:"flex flex-col space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Chip"}),s.jsx("span",{className:"text-base text-gray-700",children:"AMD Zynq UltraScale+ XCZU3EG"})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Processor"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Quad-core 64-bit Arm Cortex-A53 CPU"}),s.jsx("div",{children:"Dual-core 64-bit Arm Cortex-R5 CPU"}),s.jsx("div",{children:"ARM Mali-400 GPU"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"FPGA Fabric"}),s.jsx("span",{className:"text-base text-gray-700",children:"70K LUT, 360 DSP slices"})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Memory"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"8 GB 64-bit DDR4 (2400 Mbps) on CPU side"}),s.jsx("div",{children:"8 GB / 16 GB / 32 GB DDR4 (2133 Mbps) on FPGA side (SODIMM)"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Storage"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"256 GB PCIe 2.0 x1 NVMe SSD"}),s.jsx("div",{children:"MicroSD card slot"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"I/O"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"USB 2.0 / 3.0 via Type-C"}),s.jsx("div",{children:"Mini DisplayPort"})]})]})]})})})]}),e==="Software"&&s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-start",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-6",children:"Software Stack"}),s.jsx("p",{className:"text-lg text-gray-800 leading-relaxed",children:"Our comprehensive software ecosystem is designed to maximize the potential of Huoxu hardware, providing seamless LLM deployment and management capabilities:"}),s.jsxs("ul",{className:"mt-6 space-y-3 text-lg text-gray-800",children:[s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Custom FPGA-optimized inference engine with quantization support for efficient model deployment."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Edge LLM Platform — intuitive web interface for model management, chat, and system monitoring."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Support for popular model formats (GGUF, ONNX) and frameworks (Transformers, LLaMA.cpp)."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"REST API for seamless integration with existing applications and services."]})]})]}),s.jsx(Ie,{className:"bg-gradient-to-br from-green-50 to-blue-50 border-0 shadow-lg",children:s.jsx(Ye,{className:"p-8 space-y-6",children:s.jsxs("div",{className:"flex flex-col space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"OS Support"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Ubuntu 22.04 LTS"}),s.jsx("div",{children:"Custom Linux Distribution"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Model Formats"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"GGUF (LLaMA.cpp)"}),s.jsx("div",{children:"ONNX"}),s.jsx("div",{children:"PyTorch"}),s.jsx("div",{children:"Transformers"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Inference Engine"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Custom FPGA Accelerator"}),s.jsx("div",{children:"LLaMA.cpp Integration"}),s.jsx("div",{children:"Quantization Support"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Management Interface"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Web-based Dashboard"}),s.jsx("div",{children:"REST API"}),s.jsx("div",{children:"CLI Tools"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Development Tools"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Python SDK"}),s.jsx("div",{children:"Model Optimization Tools"}),s.jsx("div",{children:"Performance Profiler"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Security"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Secure Boot"}),s.jsx("div",{children:"Model Encryption"}),s.jsx("div",{children:"Access Control"})]})]})]})})})]})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-8",children:"Why us?"}),s.jsxs("div",{className:"bg-white rounded-3xl shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-4 bg-gradient-to-r from-gray-50 to-gray-100",children:[s.jsx("div",{className:"p-6"}),s.jsx("div",{className:"p-6 text-center",children:s.jsx(xe,{className:"bg-purple-600 text-white font-bold px-4 py-2",children:"Ours"})}),s.jsx("div",{className:"p-6 text-center",children:s.jsx("span",{className:"font-bold text-gray-800",children:"Raspberry Pi 5"})}),s.jsx("div",{className:"p-6 text-center",children:s.jsx("span",{className:"font-bold text-gray-800",children:"Jetson Orin Nano"})})]}),[{label:"Price",ours:"$199",pi:"$120",jetson:"$249"},{label:"RAM",ours:"24GB/40GB",pi:"16GB",jetson:"8GB"},{label:"CPU",ours:"Cortex-A53",pi:"Cortex-A72",jetson:"Cortex-A78"},{label:"AI Engine",ours:"Optimized Accelerator on FPGA",pi:"Neon SIMD Instructions",jetson:"Cuda/Tensor Core"},{label:"Power",ours:"<10W",pi:"5-12 W",jetson:"7-25"},{label:"LLM decode Performance",ours:"15 tokens/s",pi:"<5 tokens/s",jetson:"15 tokens/s"}].map((r,i)=>s.jsxs("div",{className:`grid grid-cols-4 ${i%2===0?"bg-gray-50":"bg-white"}`,children:[s.jsx("div",{className:"p-4 font-medium text-gray-900 border-r border-gray-200",children:r.label}),s.jsx("div",{className:"p-4 text-center text-white bg-purple-600 font-medium",children:r.ours}),s.jsx("div",{className:"p-4 text-center text-purple-600 font-medium border-r border-gray-200",children:r.pi}),s.jsx("div",{className:"p-4 text-center text-purple-600 font-medium",children:r.jetson})]},r.label))]}),s.jsx("div",{className:"text-center mt-8",children:s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white px-8 py-3",children:"View our vision"})})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-8",children:"The device layout plan"}),s.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 text-center",children:[s.jsx("div",{className:"relative max-w-4xl mx-auto",children:s.jsx("img",{src:"/assets/chips.png",alt:"Device Layout Plan",className:"w-full h-auto rounded-lg shadow-lg",onError:r=>{console.error("Chips image failed to load"),r.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"flex justify-center space-x-4 mt-8",children:[s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white px-6 py-2",children:"Get your device"}),s.jsx(J,{variant:"outline",className:"border-purple-600 text-purple-600 hover:bg-purple-50 px-6 py-2",children:"View use cases"})]})]}),s.jsx("p",{className:"text-center text-gray-600 mt-6",children:"Need help? Contact us to get customized device and services"})]})]})}function aC(){const e=Lr(),t=[{id:1,category:"Use case 1: Outdoor Rescue",title:"Offline AI that guides survival in extreme environments",description:"When hikers, travelers, or drivers lose connection to mountains, forests, or rural roads, cloud AI systems can't offer real-time survival guidance, first aid tips, and emergency signaling — even without internet. Includes moments, it becomes your reliable voice of calm and safety.",image:"/api/placeholder/336/240",bgColor:"from-blue-100 to-purple-100"},{id:2,category:"Use case 2: Offline Healthcare",title:"A simple device for seniors to access trusted medical guidance",description:"Many elderly users struggle with smartphones and digital devices. Our simple, voice-only need to press a button or speak a request to get clear, step-by-step medical advice. No internet, no accounts, no complicated setup — just instant, private support for everyday health concerns that helps.",image:"/api/placeholder/336/240",bgColor:"from-green-100 to-blue-100"},{id:3,category:"Use case 3: AI Companion and Assistance",title:"A private, always-available conversational partner",description:"Life can be stressful and lonely at times. Our Offline AI device can be embedded inside a plush toy, transforming it into a private, always-available companion. It listens, talks, tells stories without uploading data to the cloud. AI partner that brings warmth, reassurance, and practical help whenever you need it.",image:"/api/placeholder/336/240",bgColor:"from-purple-100 to-pink-100"}];return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("nav",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-20",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-16 w-16",onError:n=>{console.error("Logo failed to load"),n.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"hidden md:flex items-center space-x-8",children:[s.jsx("button",{onClick:()=>e("/"),className:"text-gray-700 hover:text-purple-600 font-medium",children:"Home"}),s.jsx("button",{onClick:()=>e("/technology"),className:"text-gray-700 hover:text-purple-600 font-medium",children:"Technology"}),s.jsx("span",{className:"text-white bg-purple-600 px-4 py-2 rounded-md font-medium",children:"Use Cases"}),s.jsx(J,{variant:"outline",onClick:()=>e("/playground"),className:"border-purple-600 text-purple-600 hover:bg-purple-50",children:"My device"})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(J,{variant:"ghost",size:"sm",children:s.jsx(Ud,{className:"h-5 w-5"})})})]})})}),s.jsx("div",{className:"py-24 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-black mb-6",children:"Use Case Examples"}),s.jsx("p",{className:"text-xl text-purple-700 font-semibold max-w-2xl mx-auto mb-12",children:"Bringing intelligent computing to the edge of connectivity"})]})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map((n,r)=>s.jsx(Ie,{className:"bg-white shadow-lg border-0 rounded-3xl overflow-hidden h-full flex flex-col",children:s.jsxs(Ye,{className:"p-6 flex flex-col h-full",children:[s.jsx("div",{className:"w-full h-60 rounded-xl mb-6 overflow-hidden",children:s.jsx("img",{src:`/assets/${r===0?"outdoor_rescue.png":r===1?"health_care.png":"companion.png"}`,alt:n.title,className:"w-full h-full object-cover",onError:i=>{console.error(`Failed to load image for use case ${r+1}`),i.currentTarget.style.display="none";const o=document.createElement("div");o.className="w-full h-60 bg-gradient-to-br from-gray-200 to-gray-300 rounded-xl flex items-center justify-center",r===0?o.innerHTML='':r===1?o.innerHTML='':o.innerHTML='',i.currentTarget.parentNode&&i.currentTarget.parentNode.appendChild(o)}})}),s.jsxs("div",{className:"flex flex-col flex-grow space-y-4",children:[s.jsx("div",{className:"text-sm font-semibold text-purple-600",children:n.category}),s.jsx("h3",{className:"text-xl font-semibold text-black leading-tight",children:n.title}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed flex-grow",children:n.description}),s.jsx("div",{className:"pt-4",children:s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white text-sm px-4 py-2 w-auto",onClick:()=>{console.log("Selected use case:",n.id)},children:"Select"})})]})]})},n.id))})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-400/30 via-blue-500/30 to-pink-500/30 backdrop-blur-sm rounded-3xl"}),s.jsxs("div",{className:"relative bg-purple-400/20 backdrop-blur-lg rounded-3xl p-8 text-center",children:[s.jsx("div",{className:"flex justify-center mb-6 space-x-1",children:[...Array(20)].map((n,r)=>s.jsx("div",{className:"bg-purple-600 rounded-full animate-pulse",style:{width:"3px",height:`${Math.random()*40+10}px`,animationDelay:`${r*.1}s`,animationDuration:"1s"}},r))}),s.jsx("h2",{className:"text-2xl font-medium text-white mb-4",children:"Customize your own device"}),s.jsx("p",{className:"text-gray-900 mb-6",children:"Need help? Contact us to get customized device and services"}),s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white px-8 py-3",onClick:()=>e("/playground"),children:"Get Started"})]})]})})]})}const ni=g.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:ce("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));ni.displayName="Input";var uC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=uC.reduce((e,t)=>{const n=ki(`Primitive.${t}`),r=g.forwardRef((i,o)=>{const{asChild:l,...a}=i,u=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function cC(e,t){e&&_i.flushSync(()=>e.dispatchEvent(t))}var dC="Label",ly=g.forwardRef((e,t)=>s.jsx(le.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ly.displayName=dC;var sy=ly;const fC=Hd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Te=g.forwardRef(({className:e,...t},n)=>s.jsx(sy,{ref:n,className:ce(fC(),e),...t}));Te.displayName=sy.displayName;const Gd=g.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:ce("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Gd.displayName="Textarea";function As(e,[t,n]){return Math.min(n,Math.max(t,e))}function ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function pC(e,t){const n=g.createContext(t),r=o=>{const{children:l,...a}=o,u=g.useMemo(()=>a,Object.values(a));return s.jsx(n.Provider,{value:u,children:l})};r.displayName=e+"Provider";function i(o){const l=g.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function sr(e,t=[]){let n=[];function r(o,l){const a=g.createContext(l),u=n.length;n=[...n,l];const c=d=>{var y;const{scope:p,children:m,...w}=d,x=((y=p==null?void 0:p[e])==null?void 0:y[u])||a,S=g.useMemo(()=>w,Object.values(w));return s.jsx(x.Provider,{value:S,children:m})};c.displayName=o+"Provider";function f(d,p){var x;const m=((x=p==null?void 0:p[e])==null?void 0:x[u])||a,w=g.useContext(m);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,f]}const i=()=>{const o=n.map(l=>g.createContext(l));return function(a){const u=(a==null?void 0:a[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return i.scopeName=e,[r,mC(i,...t)]}function mC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const l=r.reduce((a,{useScope:u,scopeName:c})=>{const d=u(o)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function Kd(e){const t=e+"CollectionProvider",[n,r]=sr(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=x=>{const{scope:S,children:y}=x,h=Ht.useRef(null),v=Ht.useRef(new Map).current;return s.jsx(i,{scope:S,itemMap:v,collectionRef:h,children:y})};l.displayName=t;const a=e+"CollectionSlot",u=ki(a),c=Ht.forwardRef((x,S)=>{const{scope:y,children:h}=x,v=o(a,y),k=ve(S,v.collectionRef);return s.jsx(u,{ref:k,children:h})});c.displayName=a;const f=e+"CollectionItemSlot",d="data-radix-collection-item",p=ki(f),m=Ht.forwardRef((x,S)=>{const{scope:y,children:h,...v}=x,k=Ht.useRef(null),j=ve(S,k),C=o(f,y);return Ht.useEffect(()=>(C.itemMap.set(k,{ref:k,...v}),()=>void C.itemMap.delete(k))),s.jsx(p,{[d]:"",ref:j,children:h})});m.displayName=f;function w(x){const S=o(e+"CollectionConsumer",x);return Ht.useCallback(()=>{const h=S.collectionRef.current;if(!h)return[];const v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(S.itemMap.values()).sort((C,E)=>v.indexOf(C.ref.current)-v.indexOf(E.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:c,ItemSlot:m},w,r]}var hC=g.createContext(void 0);function oa(e){const t=g.useContext(hC);return e||t||"ltr"}function er(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function gC(e,t=globalThis==null?void 0:globalThis.document){const n=er(e);g.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var xC="DismissableLayer",vc="dismissableLayer.update",yC="dismissableLayer.pointerDownOutside",vC="dismissableLayer.focusOutside",im,ay=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qd=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:a,...u}=e,c=g.useContext(ay),[f,d]=g.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=g.useState({}),w=ve(t,E=>d(E)),x=Array.from(c.layers),[S]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=x.indexOf(S),h=f?x.indexOf(f):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,k=h>=y,j=bC(E=>{const T=E.target,z=[...c.branches].some(L=>L.contains(T));!k||z||(i==null||i(E),l==null||l(E),E.defaultPrevented||a==null||a())},p),C=kC(E=>{const T=E.target;[...c.branches].some(L=>L.contains(T))||(o==null||o(E),l==null||l(E),E.defaultPrevented||a==null||a())},p);return gC(E=>{h===c.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},p),g.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(im=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),om(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=im)}},[f,p,n,c]),g.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),om())},[f,c]),g.useEffect(()=>{const E=()=>m({});return document.addEventListener(vc,E),()=>document.removeEventListener(vc,E)},[]),s.jsx(le.div,{...u,ref:w,style:{pointerEvents:v?k?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,j.onPointerDownCapture)})});Qd.displayName=xC;var wC="DismissableLayerBranch",SC=g.forwardRef((e,t)=>{const n=g.useContext(ay),r=g.useRef(null),i=ve(t,r);return g.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),s.jsx(le.div,{...e,ref:i})});SC.displayName=wC;function bC(e,t=globalThis==null?void 0:globalThis.document){const n=er(e),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let u=function(){uy(yC,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function kC(e,t=globalThis==null?void 0:globalThis.document){const n=er(e),r=g.useRef(!1);return g.useEffect(()=>{const i=o=>{o.target&&!r.current&&uy(vC,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function om(){const e=new CustomEvent(vc);document.dispatchEvent(e)}function uy(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?cC(i,o):i.dispatchEvent(o)}var Xa=0;function cy(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lm()),document.body.insertAdjacentElement("beforeend",e[1]??lm()),Xa++,()=>{Xa===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xa--}},[])}function lm(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var qa="focusScope.autoFocusOnMount",Ja="focusScope.autoFocusOnUnmount",sm={bubbles:!1,cancelable:!0},NC="FocusScope",Yd=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=e,[a,u]=g.useState(null),c=er(i),f=er(o),d=g.useRef(null),p=ve(t,x=>u(x)),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let x=function(v){if(m.paused||!a)return;const k=v.target;a.contains(k)?d.current=k:Mn(d.current,{select:!0})},S=function(v){if(m.paused||!a)return;const k=v.relatedTarget;k!==null&&(a.contains(k)||Mn(d.current,{select:!0}))},y=function(v){if(document.activeElement===document.body)for(const j of v)j.removedNodes.length>0&&Mn(a)};document.addEventListener("focusin",x),document.addEventListener("focusout",S);const h=new MutationObserver(y);return a&&h.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",S),h.disconnect()}}},[r,a,m.paused]),g.useEffect(()=>{if(a){um.add(m);const x=document.activeElement;if(!a.contains(x)){const y=new CustomEvent(qa,sm);a.addEventListener(qa,c),a.dispatchEvent(y),y.defaultPrevented||(CC(AC(dy(a)),{select:!0}),document.activeElement===x&&Mn(a))}return()=>{a.removeEventListener(qa,c),setTimeout(()=>{const y=new CustomEvent(Ja,sm);a.addEventListener(Ja,f),a.dispatchEvent(y),y.defaultPrevented||Mn(x??document.body,{select:!0}),a.removeEventListener(Ja,f),um.remove(m)},0)}}},[a,c,f,m]);const w=g.useCallback(x=>{if(!n&&!r||m.paused)return;const S=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,y=document.activeElement;if(S&&y){const h=x.currentTarget,[v,k]=jC(h);v&&k?!x.shiftKey&&y===k?(x.preventDefault(),n&&Mn(v,{select:!0})):x.shiftKey&&y===v&&(x.preventDefault(),n&&Mn(k,{select:!0})):y===h&&x.preventDefault()}},[n,r,m.paused]);return s.jsx(le.div,{tabIndex:-1,...l,ref:p,onKeyDown:w})});Yd.displayName=NC;function CC(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Mn(r,{select:t}),document.activeElement!==n)return}function jC(e){const t=dy(e),n=am(t,e),r=am(t.reverse(),e);return[n,r]}function dy(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function am(e,t){for(const n of e)if(!EC(n,{upTo:t}))return n}function EC(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function PC(e){return e instanceof HTMLInputElement&&"select"in e}function Mn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&PC(e)&&t&&e.select()}}var um=TC();function TC(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=cm(e,t),e.unshift(t)},remove(t){var n;e=cm(e,t),(n=e[0])==null||n.resume()}}}function cm(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function AC(e){return e.filter(t=>t.tagName!=="A")}var tt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},_C=Qc[" useId ".trim().toString()]||(()=>{}),IC=0;function qn(e){const[t,n]=g.useState(_C());return tt(()=>{e||n(r=>r??String(IC++))},[e]),e||(t?`radix-${t}`:"")}const RC=["top","right","bottom","left"],tr=Math.min,wt=Math.max,_s=Math.round,wl=Math.floor,pn=e=>({x:e,y:e}),MC={left:"right",right:"left",bottom:"top",top:"bottom"},LC={start:"end",end:"start"};function wc(e,t,n){return wt(e,tr(t,n))}function En(e,t){return typeof e=="function"?e(t):e}function Pn(e){return e.split("-")[0]}function Ri(e){return e.split("-")[1]}function Xd(e){return e==="x"?"y":"x"}function qd(e){return e==="y"?"height":"width"}const OC=new Set(["top","bottom"]);function cn(e){return OC.has(Pn(e))?"y":"x"}function Jd(e){return Xd(cn(e))}function DC(e,t,n){n===void 0&&(n=!1);const r=Ri(e),i=Jd(e),o=qd(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Is(l)),[l,Is(l)]}function zC(e){const t=Is(e);return[Sc(e),t,Sc(t)]}function Sc(e){return e.replace(/start|end/g,t=>LC[t])}const dm=["left","right"],fm=["right","left"],FC=["top","bottom"],BC=["bottom","top"];function $C(e,t,n){switch(e){case"top":case"bottom":return n?t?fm:dm:t?dm:fm;case"left":case"right":return t?FC:BC;default:return[]}}function UC(e,t,n,r){const i=Ri(e);let o=$C(Pn(e),n==="start",r);return i&&(o=o.map(l=>l+"-"+i),t&&(o=o.concat(o.map(Sc)))),o}function Is(e){return e.replace(/left|right|bottom|top/g,t=>MC[t])}function VC(e){return{top:0,right:0,bottom:0,left:0,...e}}function fy(e){return typeof e!="number"?VC(e):{top:e,right:e,bottom:e,left:e}}function Rs(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pm(e,t,n){let{reference:r,floating:i}=e;const o=cn(t),l=Jd(t),a=qd(l),u=Pn(t),c=o==="y",f=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let m;switch(u){case"top":m={x:f,y:r.y-i.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-i.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Ri(t)){case"start":m[l]-=p*(n&&c?-1:1);break;case"end":m[l]+=p*(n&&c?-1:1);break}return m}const HC=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,a=o.filter(Boolean),u=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:d}=pm(c,r,u),p=r,m={},w=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:l,elements:a,middlewareData:u}=t,{element:c,padding:f=0}=En(e,t)||{};if(c==null)return{};const d=fy(f),p={x:n,y:r},m=Jd(i),w=qd(m),x=await l.getDimensions(c),S=m==="y",y=S?"top":"left",h=S?"bottom":"right",v=S?"clientHeight":"clientWidth",k=o.reference[w]+o.reference[m]-p[m]-o.floating[w],j=p[m]-o.reference[m],C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let E=C?C[v]:0;(!E||!await(l.isElement==null?void 0:l.isElement(C)))&&(E=a.floating[v]||o.floating[w]);const T=k/2-j/2,z=E/2-x[w]/2-1,L=tr(d[y],z),I=tr(d[h],z),P=L,R=E-x[w]-I,W=E/2-x[w]/2+T,M=wc(P,W,R),O=!u.arrow&&Ri(i)!=null&&W!==M&&o.reference[w]/2-(WW<=0)){var I,P;const W=(((I=o.flip)==null?void 0:I.index)||0)+1,M=E[W];if(M&&(!(d==="alignment"?h!==cn(M):!1)||L.every(A=>cn(A.placement)===h?A.overflows[0]>0:!0)))return{data:{index:W,overflows:L},reset:{placement:M}};let O=(P=L.filter($=>$.overflows[0]<=0).sort(($,A)=>$.overflows[1]-A.overflows[1])[0])==null?void 0:P.placement;if(!O)switch(m){case"bestFit":{var R;const $=(R=L.filter(A=>{if(C){const F=cn(A.placement);return F===h||F==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(F=>F>0).reduce((F,b)=>F+b,0)]).sort((A,F)=>A[1]-F[1])[0])==null?void 0:R[0];$&&(O=$);break}case"initialPlacement":O=a;break}if(i!==O)return{reset:{placement:O}}}return{}}}};function mm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hm(e){return RC.some(t=>e[t]>=0)}const KC=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=En(e,t);switch(r){case"referenceHidden":{const o=await Lo(t,{...i,elementContext:"reference"}),l=mm(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:hm(l)}}}case"escaped":{const o=await Lo(t,{...i,altBoundary:!0}),l=mm(o,n.floating);return{data:{escapedOffsets:l,escaped:hm(l)}}}default:return{}}}}},py=new Set(["left","top"]);async function QC(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=Pn(n),a=Ri(n),u=cn(n)==="y",c=py.has(l)?-1:1,f=o&&u?-1:1,d=En(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:w}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof w=="number"&&(m=a==="end"?w*-1:w),u?{x:m*f,y:p*c}:{x:p*c,y:m*f}}const YC=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:l,middlewareData:a}=t,u=await QC(t,e);return l===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:o+u.y,data:{...u,placement:l}}}}},XC=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:a={fn:S=>{let{x:y,y:h}=S;return{x:y,y:h}}},...u}=En(e,t),c={x:n,y:r},f=await Lo(t,u),d=cn(Pn(i)),p=Xd(d);let m=c[p],w=c[d];if(o){const S=p==="y"?"top":"left",y=p==="y"?"bottom":"right",h=m+f[S],v=m-f[y];m=wc(h,m,v)}if(l){const S=d==="y"?"top":"left",y=d==="y"?"bottom":"right",h=w+f[S],v=w-f[y];w=wc(h,w,v)}const x=a.fn({...t,[p]:m,[d]:w});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:o,[d]:l}}}}}},qC=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:l}=t,{offset:a=0,mainAxis:u=!0,crossAxis:c=!0}=En(e,t),f={x:n,y:r},d=cn(i),p=Xd(d);let m=f[p],w=f[d];const x=En(a,t),S=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(u){const v=p==="y"?"height":"width",k=o.reference[p]-o.floating[v]+S.mainAxis,j=o.reference[p]+o.reference[v]-S.mainAxis;mj&&(m=j)}if(c){var y,h;const v=p==="y"?"width":"height",k=py.has(Pn(i)),j=o.reference[d]-o.floating[v]+(k&&((y=l.offset)==null?void 0:y[d])||0)+(k?0:S.crossAxis),C=o.reference[d]+o.reference[v]+(k?0:((h=l.offset)==null?void 0:h[d])||0)-(k?S.crossAxis:0);wC&&(w=C)}return{[p]:m,[d]:w}}}},JC=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:l,elements:a}=t,{apply:u=()=>{},...c}=En(e,t),f=await Lo(t,c),d=Pn(i),p=Ri(i),m=cn(i)==="y",{width:w,height:x}=o.floating;let S,y;d==="top"||d==="bottom"?(S=d,y=p===(await(l.isRTL==null?void 0:l.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,S=p==="end"?"top":"bottom");const h=x-f.top-f.bottom,v=w-f.left-f.right,k=tr(x-f[S],h),j=tr(w-f[y],v),C=!t.middlewareData.shift;let E=k,T=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=h),C&&!p){const L=wt(f.left,0),I=wt(f.right,0),P=wt(f.top,0),R=wt(f.bottom,0);m?T=w-2*(L!==0||I!==0?L+I:wt(f.left,f.right)):E=x-2*(P!==0||R!==0?P+R:wt(f.top,f.bottom))}await u({...t,availableWidth:T,availableHeight:E});const z=await l.getDimensions(a.floating);return w!==z.width||x!==z.height?{reset:{rects:!0}}:{}}}};function la(){return typeof window<"u"}function Mi(e){return my(e)?(e.nodeName||"").toLowerCase():"#document"}function Nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gn(e){var t;return(t=(my(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function my(e){return la()?e instanceof Node||e instanceof Nt(e).Node:!1}function Xt(e){return la()?e instanceof Element||e instanceof Nt(e).Element:!1}function mn(e){return la()?e instanceof HTMLElement||e instanceof Nt(e).HTMLElement:!1}function gm(e){return!la()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nt(e).ShadowRoot}const ZC=new Set(["inline","contents"]);function Qo(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ZC.has(i)}const ej=new Set(["table","td","th"]);function tj(e){return ej.has(Mi(e))}const nj=[":popover-open",":modal"];function sa(e){return nj.some(t=>{try{return e.matches(t)}catch{return!1}})}const rj=["transform","translate","scale","rotate","perspective"],ij=["transform","translate","scale","rotate","perspective","filter"],oj=["paint","layout","strict","content"];function Zd(e){const t=ef(),n=Xt(e)?qt(e):e;return rj.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ij.some(r=>(n.willChange||"").includes(r))||oj.some(r=>(n.contain||"").includes(r))}function lj(e){let t=nr(e);for(;mn(t)&&!Ni(t);){if(Zd(t))return t;if(sa(t))return null;t=nr(t)}return null}function ef(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sj=new Set(["html","body","#document"]);function Ni(e){return sj.has(Mi(e))}function qt(e){return Nt(e).getComputedStyle(e)}function aa(e){return Xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nr(e){if(Mi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gm(e)&&e.host||gn(e);return gm(t)?t.host:t}function hy(e){const t=nr(e);return Ni(t)?e.ownerDocument?e.ownerDocument.body:e.body:mn(t)&&Qo(t)?t:hy(t)}function Oo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=hy(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),l=Nt(i);if(o){const a=bc(l);return t.concat(l,l.visualViewport||[],Qo(i)?i:[],a&&n?Oo(a):[])}return t.concat(i,Oo(i,[],n))}function bc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gy(e){const t=qt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=mn(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:r,a=_s(n)!==o||_s(r)!==l;return a&&(n=o,r=l),{width:n,height:r,$:a}}function tf(e){return Xt(e)?e:e.contextElement}function ci(e){const t=tf(e);if(!mn(t))return pn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=gy(t);let l=(o?_s(n.width):n.width)/r,a=(o?_s(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const aj=pn(0);function xy(e){const t=Nt(e);return!ef()||!t.visualViewport?aj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nt(e)?!1:t}function Pr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=tf(e);let l=pn(1);t&&(r?Xt(r)&&(l=ci(r)):l=ci(e));const a=uj(o,n,r)?xy(o):pn(0);let u=(i.left+a.x)/l.x,c=(i.top+a.y)/l.y,f=i.width/l.x,d=i.height/l.y;if(o){const p=Nt(o),m=r&&Xt(r)?Nt(r):r;let w=p,x=bc(w);for(;x&&r&&m!==w;){const S=ci(x),y=x.getBoundingClientRect(),h=qt(x),v=y.left+(x.clientLeft+parseFloat(h.paddingLeft))*S.x,k=y.top+(x.clientTop+parseFloat(h.paddingTop))*S.y;u*=S.x,c*=S.y,f*=S.x,d*=S.y,u+=v,c+=k,w=Nt(x),x=bc(w)}}return Rs({width:f,height:d,x:u,y:c})}function ua(e,t){const n=aa(e).scrollLeft;return t?t.left+n:Pr(gn(e)).left+n}function yy(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ua(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function cj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",l=gn(r),a=t?sa(t.floating):!1;if(r===l||a&&o)return n;let u={scrollLeft:0,scrollTop:0},c=pn(1);const f=pn(0),d=mn(r);if((d||!d&&!o)&&((Mi(r)!=="body"||Qo(l))&&(u=aa(r)),mn(r))){const m=Pr(r);c=ci(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=l&&!d&&!o?yy(l,u):pn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-u.scrollLeft*c.x+f.x+p.x,y:n.y*c.y-u.scrollTop*c.y+f.y+p.y}}function dj(e){return Array.from(e.getClientRects())}function fj(e){const t=gn(e),n=aa(e),r=e.ownerDocument.body,i=wt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=wt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ua(e);const a=-n.scrollTop;return qt(r).direction==="rtl"&&(l+=wt(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:a}}const xm=25;function pj(e,t){const n=Nt(e),r=gn(e),i=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,a=0,u=0;if(i){o=i.width,l=i.height;const f=ef();(!f||f&&t==="fixed")&&(a=i.offsetLeft,u=i.offsetTop)}const c=ua(r);if(c<=0){const f=r.ownerDocument,d=f.body,p=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,w=Math.abs(r.clientWidth-d.clientWidth-m);w<=xm&&(o-=w)}else c<=xm&&(o+=c);return{width:o,height:l,x:a,y:u}}const mj=new Set(["absolute","fixed"]);function hj(e,t){const n=Pr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=mn(e)?ci(e):pn(1),l=e.clientWidth*o.x,a=e.clientHeight*o.y,u=i*o.x,c=r*o.y;return{width:l,height:a,x:u,y:c}}function ym(e,t,n){let r;if(t==="viewport")r=pj(e,n);else if(t==="document")r=fj(gn(e));else if(Xt(t))r=hj(t,n);else{const i=xy(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Rs(r)}function vy(e,t){const n=nr(e);return n===t||!Xt(n)||Ni(n)?!1:qt(n).position==="fixed"||vy(n,t)}function gj(e,t){const n=t.get(e);if(n)return n;let r=Oo(e,[],!1).filter(a=>Xt(a)&&Mi(a)!=="body"),i=null;const o=qt(e).position==="fixed";let l=o?nr(e):e;for(;Xt(l)&&!Ni(l);){const a=qt(l),u=Zd(l);!u&&a.position==="fixed"&&(i=null),(o?!u&&!i:!u&&a.position==="static"&&!!i&&mj.has(i.position)||Qo(l)&&!u&&vy(e,l))?r=r.filter(f=>f!==l):i=a,l=nr(l)}return t.set(e,r),r}function xj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const l=[...n==="clippingAncestors"?sa(t)?[]:gj(t,this._c):[].concat(n),r],a=l[0],u=l.reduce((c,f)=>{const d=ym(t,f,i);return c.top=wt(d.top,c.top),c.right=tr(d.right,c.right),c.bottom=tr(d.bottom,c.bottom),c.left=wt(d.left,c.left),c},ym(t,a,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function yj(e){const{width:t,height:n}=gy(e);return{width:t,height:n}}function vj(e,t,n){const r=mn(t),i=gn(t),o=n==="fixed",l=Pr(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const u=pn(0);function c(){u.x=ua(i)}if(r||!r&&!o)if((Mi(t)!=="body"||Qo(i))&&(a=aa(t)),r){const m=Pr(t,!0,o,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else i&&c();o&&!r&&i&&c();const f=i&&!r&&!o?yy(i,a):pn(0),d=l.left+a.scrollLeft-u.x-f.x,p=l.top+a.scrollTop-u.y-f.y;return{x:d,y:p,width:l.width,height:l.height}}function Za(e){return qt(e).position==="static"}function vm(e,t){if(!mn(e)||qt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return gn(e)===n&&(n=n.ownerDocument.body),n}function wy(e,t){const n=Nt(e);if(sa(e))return n;if(!mn(e)){let i=nr(e);for(;i&&!Ni(i);){if(Xt(i)&&!Za(i))return i;i=nr(i)}return n}let r=vm(e,t);for(;r&&tj(r)&&Za(r);)r=vm(r,t);return r&&Ni(r)&&Za(r)&&!Zd(r)?n:r||lj(e)||n}const wj=async function(e){const t=this.getOffsetParent||wy,n=this.getDimensions,r=await n(e.floating);return{reference:vj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Sj(e){return qt(e).direction==="rtl"}const bj={convertOffsetParentRelativeRectToViewportRelativeRect:cj,getDocumentElement:gn,getClippingRect:xj,getOffsetParent:wy,getElementRects:wj,getClientRects:dj,getDimensions:yj,getScale:ci,isElement:Xt,isRTL:Sj};function Sy(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kj(e,t){let n=null,r;const i=gn(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function l(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),o();const c=e.getBoundingClientRect(),{left:f,top:d,width:p,height:m}=c;if(a||t(),!p||!m)return;const w=wl(d),x=wl(i.clientWidth-(f+p)),S=wl(i.clientHeight-(d+m)),y=wl(f),v={rootMargin:-w+"px "+-x+"px "+-S+"px "+-y+"px",threshold:wt(0,tr(1,u))||1};let k=!0;function j(C){const E=C[0].intersectionRatio;if(E!==u){if(!k)return l();E?l(!1,E):r=setTimeout(()=>{l(!1,1e-7)},1e3)}E===1&&!Sy(c,e.getBoundingClientRect())&&l(),k=!1}try{n=new IntersectionObserver(j,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(j,v)}n.observe(e)}return l(!0),o}function Nj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,c=tf(e),f=i||o?[...c?Oo(c):[],...Oo(t)]:[];f.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const d=c&&a?kj(c,n):null;let p=-1,m=null;l&&(m=new ResizeObserver(y=>{let[h]=y;h&&h.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),c&&!u&&m.observe(c),m.observe(t));let w,x=u?Pr(e):null;u&&S();function S(){const y=Pr(e);x&&!Sy(x,y)&&n(),x=y,w=requestAnimationFrame(S)}return n(),()=>{var y;f.forEach(h=>{i&&h.removeEventListener("scroll",n),o&&h.removeEventListener("resize",n)}),d==null||d(),(y=m)==null||y.disconnect(),m=null,u&&cancelAnimationFrame(w)}}const Cj=YC,jj=XC,Ej=GC,Pj=JC,Tj=KC,wm=WC,Aj=qC,_j=(e,t,n)=>{const r=new Map,i={platform:bj,...n},o={...i.platform,_c:r};return HC(e,t,{...i,platform:o})};var Ij=typeof document<"u",Rj=function(){},$l=Ij?g.useLayoutEffect:Rj;function Ms(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ms(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!Ms(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function by(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sm(e,t){const n=by(e);return Math.round(t*n)/n}function eu(e){const t=g.useRef(e);return $l(()=>{t.current=e}),t}function Mj(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:a=!0,whileElementsMounted:u,open:c}=e,[f,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=g.useState(r);Ms(p,r)||m(r);const[w,x]=g.useState(null),[S,y]=g.useState(null),h=g.useCallback(A=>{A!==C.current&&(C.current=A,x(A))},[]),v=g.useCallback(A=>{A!==E.current&&(E.current=A,y(A))},[]),k=o||w,j=l||S,C=g.useRef(null),E=g.useRef(null),T=g.useRef(f),z=u!=null,L=eu(u),I=eu(i),P=eu(c),R=g.useCallback(()=>{if(!C.current||!E.current)return;const A={placement:t,strategy:n,middleware:p};I.current&&(A.platform=I.current),_j(C.current,E.current,A).then(F=>{const b={...F,isPositioned:P.current!==!1};W.current&&!Ms(T.current,b)&&(T.current=b,_i.flushSync(()=>{d(b)}))})},[p,t,n,I,P]);$l(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[c]);const W=g.useRef(!1);$l(()=>(W.current=!0,()=>{W.current=!1}),[]),$l(()=>{if(k&&(C.current=k),j&&(E.current=j),k&&j){if(L.current)return L.current(k,j,R);R()}},[k,j,R,L,z]);const M=g.useMemo(()=>({reference:C,floating:E,setReference:h,setFloating:v}),[h,v]),O=g.useMemo(()=>({reference:k,floating:j}),[k,j]),$=g.useMemo(()=>{const A={position:n,left:0,top:0};if(!O.floating)return A;const F=Sm(O.floating,f.x),b=Sm(O.floating,f.y);return a?{...A,transform:"translate("+F+"px, "+b+"px)",...by(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:b}},[n,a,O.floating,f.x,f.y]);return g.useMemo(()=>({...f,update:R,refs:M,elements:O,floatingStyles:$}),[f,R,M,O,$])}const Lj=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?wm({element:r.current,padding:i}).fn(n):{}:r?wm({element:r,padding:i}).fn(n):{}}}},Oj=(e,t)=>({...Cj(e),options:[e,t]}),Dj=(e,t)=>({...jj(e),options:[e,t]}),zj=(e,t)=>({...Aj(e),options:[e,t]}),Fj=(e,t)=>({...Ej(e),options:[e,t]}),Bj=(e,t)=>({...Pj(e),options:[e,t]}),$j=(e,t)=>({...Tj(e),options:[e,t]}),Uj=(e,t)=>({...Lj(e),options:[e,t]});var Vj="Arrow",ky=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return s.jsx(le.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});ky.displayName=Vj;var Hj=ky;function Ny(e){const[t,n]=g.useState(void 0);return tt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,a;if("borderBoxSize"in o){const u=o.borderBoxSize,c=Array.isArray(u)?u[0]:u;l=c.inlineSize,a=c.blockSize}else l=e.offsetWidth,a=e.offsetHeight;n({width:l,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var nf="Popper",[Cy,jy]=sr(nf),[Wj,Ey]=Cy(nf),Py=e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return s.jsx(Wj,{scope:t,anchor:r,onAnchorChange:i,children:n})};Py.displayName=nf;var Ty="PopperAnchor",Ay=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=Ey(Ty,n),l=g.useRef(null),a=ve(t,l),u=g.useRef(null);return g.useEffect(()=>{const c=u.current;u.current=(r==null?void 0:r.current)||l.current,c!==u.current&&o.onAnchorChange(u.current)}),r?null:s.jsx(le.div,{...i,ref:a})});Ay.displayName=Ty;var rf="PopperContent",[Gj,Kj]=Cy(rf),_y=g.forwardRef((e,t)=>{var K,ne,he,oe,de,me;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:u=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:w,...x}=e,S=Ey(rf,n),[y,h]=g.useState(null),v=ve(t,He=>h(He)),[k,j]=g.useState(null),C=Ny(k),E=(C==null?void 0:C.width)??0,T=(C==null?void 0:C.height)??0,z=r+(o!=="center"?"-"+o:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},I=Array.isArray(c)?c:[c],P=I.length>0,R={padding:L,boundary:I.filter(Yj),altBoundary:P},{refs:W,floatingStyles:M,placement:O,isPositioned:$,middlewareData:A}=Mj({strategy:"fixed",placement:z,whileElementsMounted:(...He)=>Nj(...He,{animationFrame:m==="always"}),elements:{reference:S.anchor},middleware:[Oj({mainAxis:i+T,alignmentAxis:l}),u&&Dj({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?zj():void 0,...R}),u&&Fj({...R}),Bj({...R,apply:({elements:He,rects:rt,availableWidth:Zt,availableHeight:zt})=>{const{width:en,height:Fi}=rt.reference,xn=He.floating.style;xn.setProperty("--radix-popper-available-width",`${Zt}px`),xn.setProperty("--radix-popper-available-height",`${zt}px`),xn.setProperty("--radix-popper-anchor-width",`${en}px`),xn.setProperty("--radix-popper-anchor-height",`${Fi}px`)}}),k&&Uj({element:k,padding:a}),Xj({arrowWidth:E,arrowHeight:T}),p&&$j({strategy:"referenceHidden",...R})]}),[F,b]=My(O),V=er(w);tt(()=>{$&&(V==null||V())},[$,V]);const Y=(K=A.arrow)==null?void 0:K.x,N=(ne=A.arrow)==null?void 0:ne.y,re=((he=A.arrow)==null?void 0:he.centerOffset)!==0,[fe,ie]=g.useState();return tt(()=>{y&&ie(window.getComputedStyle(y).zIndex)},[y]),s.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:$?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(oe=A.transformOrigin)==null?void 0:oe.x,(de=A.transformOrigin)==null?void 0:de.y].join(" "),...((me=A.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Gj,{scope:n,placedSide:F,onArrowChange:j,arrowX:Y,arrowY:N,shouldHideArrow:re,children:s.jsx(le.div,{"data-side":F,"data-align":b,...x,ref:v,style:{...x.style,animation:$?void 0:"none"}})})})});_y.displayName=rf;var Iy="PopperArrow",Qj={top:"bottom",right:"left",bottom:"top",left:"right"},Ry=g.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=Kj(Iy,r),l=Qj[o.placedSide];return s.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:s.jsx(Hj,{...i,ref:n,style:{...i.style,display:"block"}})})});Ry.displayName=Iy;function Yj(e){return e!==null}var Xj=e=>({name:"transformOrigin",options:e,fn(t){var S,y,h;const{placement:n,rects:r,middlewareData:i}=t,l=((S=i.arrow)==null?void 0:S.centerOffset)!==0,a=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[c,f]=My(n),d={start:"0%",center:"50%",end:"100%"}[f],p=(((y=i.arrow)==null?void 0:y.x)??0)+a/2,m=(((h=i.arrow)==null?void 0:h.y)??0)+u/2;let w="",x="";return c==="bottom"?(w=l?d:`${p}px`,x=`${-u}px`):c==="top"?(w=l?d:`${p}px`,x=`${r.floating.height+u}px`):c==="right"?(w=`${-u}px`,x=l?d:`${m}px`):c==="left"&&(w=`${r.floating.width+u}px`,x=l?d:`${m}px`),{data:{x:w,y:x}}}});function My(e){const[t,n="center"]=e.split("-");return[t,n]}var qj=Py,Jj=Ay,Zj=_y,e2=Ry,t2="Portal",of=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,o]=g.useState(!1);tt(()=>o(!0),[]);const l=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?ab.createPortal(s.jsx(le.div,{...r,ref:t}),l):null});of.displayName=t2;var n2=Qc[" useInsertionEffect ".trim().toString()]||tt;function Ci({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,l]=r2({defaultProp:t,onChange:n}),a=e!==void 0,u=a?e:i;{const f=g.useRef(e!==void 0);g.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const c=g.useCallback(f=>{var d;if(a){const p=i2(f)?f(e):f;p!==e&&((d=l.current)==null||d.call(l,p))}else o(f)},[a,e,o,l]);return[u,c]}function r2({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),o=g.useRef(t);return n2(()=>{o.current=t},[t]),g.useEffect(()=>{var l;i.current!==n&&((l=o.current)==null||l.call(o,n),i.current=n)},[n,i]),[n,r,o]}function i2(e){return typeof e=="function"}function Ly(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Oy=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),o2="VisuallyHidden",l2=g.forwardRef((e,t)=>s.jsx(le.span,{...e,ref:t,style:{...Oy,...e.style}}));l2.displayName=o2;var s2=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fr=new WeakMap,Sl=new WeakMap,bl={},tu=0,Dy=function(e){return e&&(e.host||Dy(e.parentNode))},a2=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Dy(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},u2=function(e,t,n,r){var i=a2(t,Array.isArray(e)?e:[e]);bl[n]||(bl[n]=new WeakMap);var o=bl[n],l=[],a=new Set,u=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var f=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))f(p);else try{var m=p.getAttribute(r),w=m!==null&&m!=="false",x=(Fr.get(p)||0)+1,S=(o.get(p)||0)+1;Fr.set(p,x),o.set(p,S),l.push(p),x===1&&w&&Sl.set(p,!0),S===1&&p.setAttribute(n,"true"),w||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return f(t),a.clear(),tu++,function(){l.forEach(function(d){var p=Fr.get(d)-1,m=o.get(d)-1;Fr.set(d,p),o.set(d,m),p||(Sl.has(d)||d.removeAttribute(r),Sl.delete(d)),m||d.removeAttribute(n)}),tu--,tu||(Fr=new WeakMap,Fr=new WeakMap,Sl=new WeakMap,bl={})}},zy=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||s2(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),u2(r,i,n,"aria-hidden")):function(){return null}},an=function(){return an=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return j2;var t=E2(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},T2=Uy(),di="data-scroll-locked",A2=function(e,t,n,r){var i=e.left,o=e.top,l=e.right,a=e.gap;return n===void 0&&(n="margin"),` + */const KN=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],yc=te("zap",KN),QN=[{name:"Templates",href:"/templates",icon:Er,description:"Browse assistant templates and examples"},{name:"Assistant Studio",href:"/playground",icon:ia,description:"Build, test and refine your AI assistants"},{name:"Model Catalog",href:"/models",icon:ra,description:"Browse and manage AI models"},{name:"Settings",href:"/settings",icon:ui,description:"Application settings"}];function YN(){const e=Ko();return s.jsxs("div",{className:"flex h-full flex-col bg-background border-r",children:[s.jsx("div",{className:"p-6 border-b",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:s.jsx(Er,{className:"h-5 w-5 text-primary-foreground"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"font-semibold text-lg",children:"Edge LLM"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Local AI Platform"})]})]})}),s.jsxs("div",{className:"flex-1 px-3 py-4 space-y-8",children:[s.jsx("div",{children:s.jsxs(Hp,{to:"/",className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-all hover:bg-accent text-muted-foreground hover:text-foreground",children:[s.jsx(Gk,{className:"h-4 w-4"}),s.jsx("span",{children:"Back to Home"})]})}),s.jsxs("div",{children:[s.jsx("h2",{className:"mb-2 px-3 text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Get started"}),s.jsx("nav",{className:"space-y-1",children:QN.map(t=>{const n=e.pathname===t.href;return s.jsxs(Hp,{to:t.href,className:ce("flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-all hover:bg-accent",n?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:text-foreground"),children:[s.jsx(t.icon,{className:"h-4 w-4"}),s.jsx("div",{className:"flex-1",children:t.name})]},t.name)})})]})]})]})}function XN(){return s.jsxs("div",{className:"flex h-screen bg-background",children:[s.jsx("div",{className:"w-64 border-r",children:s.jsx(YN,{})}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(Zb,{})})]})}function tm(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function iy(...e){return t=>{let n=!1;const r=e.map(i=>{const o=tm(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:o,...l}=r,a=g.Children.toArray(o),u=a.find(eC);if(u){const c=u.props.children,f=a.map(d=>d===u?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return s.jsx(t,{...l,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,f):null})}return s.jsx(t,{...l,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var qN=ki("Slot");function JN(e){const t=g.forwardRef((n,r)=>{const{children:i,...o}=n;if(g.isValidElement(i)){const l=nC(i),a=tC(o,i.props);return i.type!==g.Fragment&&(a.ref=r?iy(r,l):l),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var oy=Symbol("radix.slottable");function ZN(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=oy,t}function eC(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===oy}function tC(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{const u=o(...a);return i(...a),u}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function nC(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const nm=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,rm=Vx,Hd=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return rm(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(c=>{const f=n==null?void 0:n[c],d=o==null?void 0:o[c];if(f===null)return null;const p=nm(f)||nm(d);return i[c][p]}),a=n&&Object.entries(n).reduce((c,f)=>{let[d,p]=f;return p===void 0||(c[d]=p),c},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:d,className:p,...m}=f;return Object.entries(m).every(w=>{let[x,S]=w;return Array.isArray(S)?S.includes({...o,...a}[x]):{...o,...a}[x]===S})?[...c,d,p]:c},[]);return rm(e,l,u,n==null?void 0:n.class,n==null?void 0:n.className)},Wd=Hd("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),J=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const l=r?qN:"button";return s.jsx(l,{className:ce(Wd({variant:t,size:n,className:e})),ref:o,...i})});J.displayName="Button";function rC(){const e=Lr();return s.jsxs("div",{className:"min-h-screen bg-white",children:[s.jsx("nav",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-20",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-16 w-16",onError:t=>{console.error("Logo failed to load"),t.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"hidden md:flex items-center space-x-8",children:[s.jsx("span",{className:"text-white bg-purple-600 px-4 py-2 rounded-md font-medium",children:"Home"}),s.jsx("button",{onClick:()=>e("/technology"),className:"text-gray-700 hover:text-purple-600 font-medium transition-colors",children:"Technology"}),s.jsx("button",{onClick:()=>e("/usecases"),className:"text-gray-700 hover:text-purple-600 font-medium transition-colors",children:"Use Cases"}),s.jsx(J,{variant:"outline",onClick:()=>e("/mydevice"),className:"border-purple-600 text-purple-600 hover:bg-purple-50",children:"My Device"})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(J,{variant:"ghost",size:"sm",children:s.jsx(Ud,{className:"h-5 w-5"})})})]})})}),s.jsx("div",{className:"relative py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsx("div",{className:"relative mb-6",children:s.jsxs("h1",{className:"text-4xl md:text-6xl lg:text-7xl font-bold text-black leading-tight",children:["Offline AI that",s.jsx("br",{}),"works where the",s.jsx("br",{}),"cloud cannot"]})}),s.jsx("p",{className:"text-lg md:text-xl text-purple-700 font-semibold mb-8 max-w-3xl mx-auto",children:"AI that stays reliable, private, and resilient in any environment"}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-12",children:[s.jsx(J,{size:"lg",className:"bg-purple-600 hover:bg-purple-700 text-white px-8 py-3 text-lg font-medium",onClick:()=>e("/usecases"),children:"Learn More"}),s.jsx(J,{size:"lg",variant:"outline",className:"border-purple-600 text-purple-600 hover:bg-purple-50 px-8 py-3 text-lg font-medium",onClick:()=>e("/mydevice"),children:"I already have a device"})]})]})}),s.jsx("div",{className:"py-12 px-4 sm:px-6 lg:px-8 bg-gray-50",children:s.jsx("div",{className:"max-w-6xl mx-auto",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-lg border border-gray-200 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("img",{src:"/assets/24h.png",alt:"24/7 Available",className:"h-10 w-10",onError:t=>{console.error("24h icon failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("h3",{className:"text-lg font-bold text-black mb-3",children:"Always Available"})]}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"Cloud AI fails without internet. Our offline AI runs fully on-device, ready to assist anywhere — from airplanes to remote mountains."})]}),s.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-lg border border-gray-200 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("img",{src:"/assets/privacy.png",alt:"Privacy & Security",className:"h-10 w-10",onError:t=>{console.error("Privacy icon failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("h3",{className:"text-lg font-bold text-black mb-3",children:"Privacy & Security"})]}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"Cloud AI requires uploading sensitive data. Offline AI keeps all processing local, protecting personal privacy and enterprise security."})]}),s.jsxs("div",{className:"bg-white rounded-2xl p-6 shadow-lg border border-gray-200 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-600 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("img",{src:"/assets/reliablity.png",alt:"Reliability",className:"h-10 w-10",onError:t=>{console.error("Reliability icon failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("h3",{className:"text-lg font-bold text-black mb-3",children:"Reliability"})]}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:"Cloud latency can cost lives in emergencies. Offline AI responds instantly, built for survival, healthcare, and safety-critical moments."})]})]})})}),s.jsx("footer",{className:"bg-white text-gray-600 py-8 px-4 sm:px-6 lg:px-8 border-t border-gray-200",children:s.jsxs("div",{className:"max-w-6xl mx-auto text-center",children:[s.jsx("div",{className:"flex items-center justify-center mb-4",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-12 w-12",onError:t=>{console.error("Footer logo failed to load"),t.currentTarget.style.display="none"}})}),s.jsx("p",{className:"text-gray-600 mb-6",children:"Need help? Contact us to get customized device and services"}),s.jsxs("div",{className:"flex justify-center space-x-6",children:[s.jsx("a",{href:"#",className:"text-gray-500 hover:text-gray-700",children:"Privacy Policy"}),s.jsx("a",{href:"#",className:"text-gray-500 hover:text-gray-700",children:"Terms of Service"}),s.jsx("a",{href:"#",className:"text-gray-500 hover:text-gray-700",children:"Support"})]})]})})]})}const iC=Hd("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function xe({className:e,variant:t,...n}){return s.jsx("div",{className:ce(iC({variant:t}),e),...n})}const Ie=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ie.displayName="Card";const Mt=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("flex flex-col space-y-1.5 p-6",e),...t}));Mt.displayName="CardHeader";const Lt=g.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:ce("text-2xl font-semibold leading-none tracking-tight",e),...t}));Lt.displayName="CardTitle";const oC=g.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:ce("text-sm text-muted-foreground",e),...t}));oC.displayName="CardDescription";const Ye=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("p-6 pt-0",e),...t}));Ye.displayName="CardContent";const lC=g.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ce("flex items-center p-6 pt-0",e),...t}));lC.displayName="CardFooter";function sC(){const[e,t]=g.useState("Hardware"),n=Lr();return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("nav",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-20",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-16 w-16",onError:r=>{console.error("Logo failed to load"),r.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"hidden md:flex items-center space-x-8",children:[s.jsx("button",{onClick:()=>n("/"),className:"text-gray-700 hover:text-purple-600 font-medium",children:"Home"}),s.jsx("span",{className:"text-white bg-purple-600 px-4 py-2 rounded-md font-medium",children:"Technology"}),s.jsx("button",{onClick:()=>n("/usecases"),className:"text-gray-700 hover:text-purple-600 font-medium transition-colors",children:"Use Cases"}),s.jsx(J,{variant:"outline",onClick:()=>n("/mydevice"),className:"border-purple-600 text-purple-600 hover:bg-purple-50",children:"My Device"})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(J,{variant:"ghost",size:"sm",children:s.jsx(Ud,{className:"h-5 w-5"})})})]})})}),s.jsx("div",{className:"py-24 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-black mb-6",children:"Our Technology"}),s.jsx("p",{className:"text-xl text-purple-700 font-semibold max-w-2xl mx-auto mb-8",children:"Low-cost FPGA-based design, optimized for Large Language Models on-device."}),s.jsx("div",{className:"flex justify-center mb-12",children:s.jsx("div",{className:"bg-white rounded-lg p-1 shadow-sm",children:["Hardware","Software"].map(r=>s.jsx("button",{onClick:()=>t(r),className:`px-6 py-2 rounded-md text-sm font-medium transition-all ${e===r?"bg-purple-600 text-white":"text-gray-700 hover:text-purple-600"}`,children:r},r))})})]})}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:[e==="Hardware"&&s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-start",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-6",children:"Hardware Description"}),s.jsx("p",{className:"text-lg text-gray-800 leading-relaxed",children:"EdgeMate is an ultra–low-budget single-board computer designed specifically for large language model (LLM) deployment. Despite its compact form factor and low power consumption, we provide:"}),s.jsxs("ul",{className:"mt-6 space-y-3 text-lg text-gray-800",children:[s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Accelerated inference performance — delivering up to 15 tokens per second on a 30B model, thanks to its optimized FPGA-based AI engine."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"High memory capacity — up to 40GB RAM, enabling hosting of LLMs up to ≥30B parameters."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Cost efficiency — making advanced AI workloads accessible at low cost."]})]})]}),s.jsx(Ie,{className:"bg-gradient-to-br from-purple-50 to-blue-50 border-0 shadow-lg",children:s.jsx(Ye,{className:"p-8 space-y-6",children:s.jsxs("div",{className:"flex flex-col space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Chip"}),s.jsx("span",{className:"text-base text-gray-700",children:"AMD Zynq UltraScale+ XCZU3EG"})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Processor"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Quad-core 64-bit Arm Cortex-A53 CPU"}),s.jsx("div",{children:"Dual-core 64-bit Arm Cortex-R5 CPU"}),s.jsx("div",{children:"ARM Mali-400 GPU"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"FPGA Fabric"}),s.jsx("span",{className:"text-base text-gray-700",children:"70K LUT, 360 DSP slices"})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Memory"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"8 GB 64-bit DDR4 (2400 Mbps) on CPU side"}),s.jsx("div",{children:"8 GB / 16 GB / 32 GB DDR4 (2133 Mbps) on FPGA side (SODIMM)"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Storage"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"256 GB PCIe 2.0 x1 NVMe SSD"}),s.jsx("div",{children:"MicroSD card slot"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"I/O"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"USB 2.0 / 3.0 via Type-C"}),s.jsx("div",{children:"Mini DisplayPort"})]})]})]})})})]}),e==="Software"&&s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-start",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-6",children:"Software Stack"}),s.jsx("p",{className:"text-lg text-gray-800 leading-relaxed",children:"Our comprehensive software ecosystem is designed to maximize the potential of EdgeMate hardware, providing seamless LLM deployment and management capabilities:"}),s.jsxs("ul",{className:"mt-6 space-y-3 text-lg text-gray-800",children:[s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Custom FPGA-optimized inference engine with quantization support for efficient model deployment."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Edge LLM Platform — intuitive web interface for model management, chat, and system monitoring."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"Support for popular model formats (GGUF, ONNX) and frameworks (Transformers, LLaMA.cpp)."]}),s.jsxs("li",{className:"flex items-start",children:[s.jsx("span",{className:"text-purple-600 mr-2",children:"•"}),"REST API for seamless integration with existing applications and services."]})]})]}),s.jsx(Ie,{className:"bg-gradient-to-br from-green-50 to-blue-50 border-0 shadow-lg",children:s.jsx(Ye,{className:"p-8 space-y-6",children:s.jsxs("div",{className:"flex flex-col space-y-4",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"OS Support"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Ubuntu 22.04 LTS"}),s.jsx("div",{children:"Custom Linux Distribution"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Model Formats"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"GGUF (LLaMA.cpp)"}),s.jsx("div",{children:"ONNX"}),s.jsx("div",{children:"PyTorch"}),s.jsx("div",{children:"Transformers"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Inference Engine"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Custom FPGA Accelerator"}),s.jsx("div",{children:"LLaMA.cpp Integration"}),s.jsx("div",{children:"Quantization Support"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Management Interface"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Web-based Dashboard"}),s.jsx("div",{children:"REST API"}),s.jsx("div",{children:"CLI Tools"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Development Tools"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Python SDK"}),s.jsx("div",{children:"Model Optimization Tools"}),s.jsx("div",{children:"Performance Profiler"})]})]}),s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsx("span",{className:"text-lg font-bold text-gray-900",children:"Security"}),s.jsxs("div",{className:"text-base text-gray-700 text-right",children:[s.jsx("div",{children:"Secure Boot"}),s.jsx("div",{children:"Model Encryption"}),s.jsx("div",{children:"Access Control"})]})]})]})})})]})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-8",children:"Why us?"}),s.jsxs("div",{className:"bg-white rounded-3xl shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"grid grid-cols-4 bg-gradient-to-r from-gray-50 to-gray-100",children:[s.jsx("div",{className:"p-6"}),s.jsx("div",{className:"p-6 text-center",children:s.jsx(xe,{className:"bg-purple-600 text-white font-bold px-4 py-2",children:"Ours"})}),s.jsx("div",{className:"p-6 text-center",children:s.jsx("span",{className:"font-bold text-gray-800",children:"Raspberry Pi 5"})}),s.jsx("div",{className:"p-6 text-center",children:s.jsx("span",{className:"font-bold text-gray-800",children:"Jetson Orin Nano"})})]}),[{label:"Price",ours:"$199",pi:"$120",jetson:"$249"},{label:"RAM",ours:"24GB/40GB",pi:"16GB",jetson:"8GB"},{label:"CPU",ours:"Cortex-A53",pi:"Cortex-A72",jetson:"Cortex-A78"},{label:"AI Engine",ours:"Optimized Accelerator on FPGA",pi:"Neon SIMD Instructions",jetson:"Cuda/Tensor Core"},{label:"Power",ours:"<10W",pi:"5-12 W",jetson:"7-25"},{label:"LLM decode Performance",ours:"15 tokens/s",pi:"<5 tokens/s",jetson:"15 tokens/s"}].map((r,i)=>s.jsxs("div",{className:`grid grid-cols-4 ${i%2===0?"bg-gray-50":"bg-white"}`,children:[s.jsx("div",{className:"p-4 font-medium text-gray-900 border-r border-gray-200",children:r.label}),s.jsx("div",{className:"p-4 text-center text-white bg-purple-600 font-medium",children:r.ours}),s.jsx("div",{className:"p-4 text-center text-purple-600 font-medium border-r border-gray-200",children:r.pi}),s.jsx("div",{className:"p-4 text-center text-purple-600 font-medium",children:r.jetson})]},r.label))]}),s.jsx("div",{className:"text-center mt-8",children:s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white px-8 py-3",children:"View our vision"})})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:[s.jsx("h2",{className:"text-3xl font-semibold text-purple-600 mb-8",children:"The device layout plan"}),s.jsxs("div",{className:"bg-white rounded-2xl shadow-xl p-8 text-center",children:[s.jsx("div",{className:"relative max-w-4xl mx-auto",children:s.jsx("img",{src:"/assets/chips.png",alt:"Device Layout Plan",className:"w-full h-auto rounded-lg shadow-lg",onError:r=>{console.error("Chips image failed to load"),r.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"flex justify-center space-x-4 mt-8",children:[s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white px-6 py-2",children:"Get your device"}),s.jsx(J,{variant:"outline",className:"border-purple-600 text-purple-600 hover:bg-purple-50 px-6 py-2",children:"View use cases"})]})]}),s.jsx("p",{className:"text-center text-gray-600 mt-6",children:"Need help? Contact us to get customized device and services"})]})]})}function aC(){const e=Lr(),t=[{id:1,category:"Use case 1: Outdoor Rescue",title:"Offline AI that guides survival in extreme environments",description:"When hikers, travelers, or drivers lose connection to mountains, forests, or rural roads, cloud AI systems can't offer real-time survival guidance, first aid tips, and emergency signaling — even without internet. Includes moments, it becomes your reliable voice of calm and safety.",image:"/api/placeholder/336/240",bgColor:"from-blue-100 to-purple-100"},{id:2,category:"Use case 2: Offline Healthcare",title:"A simple device for seniors to access trusted medical guidance",description:"Many elderly users struggle with smartphones and digital devices. Our simple, voice-only need to press a button or speak a request to get clear, step-by-step medical advice. No internet, no accounts, no complicated setup — just instant, private support for everyday health concerns that helps.",image:"/api/placeholder/336/240",bgColor:"from-green-100 to-blue-100"},{id:3,category:"Use case 3: AI Companion and Assistance",title:"A private, always-available conversational partner",description:"Life can be stressful and lonely at times. Our Offline AI device can be embedded inside a plush toy, transforming it into a private, always-available companion. It listens, talks, tells stories without uploading data to the cloud. AI partner that brings warmth, reassurance, and practical help whenever you need it.",image:"/api/placeholder/336/240",bgColor:"from-purple-100 to-pink-100"}];return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("nav",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex justify-between items-center h-20",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeLLM Logo",className:"h-16 w-16",onError:n=>{console.error("Logo failed to load"),n.currentTarget.style.display="none"}})}),s.jsxs("div",{className:"hidden md:flex items-center space-x-8",children:[s.jsx("button",{onClick:()=>e("/"),className:"text-gray-700 hover:text-purple-600 font-medium",children:"Home"}),s.jsx("button",{onClick:()=>e("/technology"),className:"text-gray-700 hover:text-purple-600 font-medium",children:"Technology"}),s.jsx("span",{className:"text-white bg-purple-600 px-4 py-2 rounded-md font-medium",children:"Use Cases"}),s.jsx(J,{variant:"outline",onClick:()=>e("/playground"),className:"border-purple-600 text-purple-600 hover:bg-purple-50",children:"My device"})]}),s.jsx("div",{className:"md:hidden",children:s.jsx(J,{variant:"ghost",size:"sm",children:s.jsx(Ud,{className:"h-5 w-5"})})})]})})}),s.jsx("div",{className:"py-24 px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-black mb-6",children:"Use Case Examples"}),s.jsx("p",{className:"text-xl text-purple-700 font-semibold max-w-2xl mx-auto mb-12",children:"Bringing intelligent computing to the edge of connectivity"})]})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map((n,r)=>s.jsx(Ie,{className:"bg-white shadow-lg border-0 rounded-3xl overflow-hidden h-full flex flex-col",children:s.jsxs(Ye,{className:"p-6 flex flex-col h-full",children:[s.jsx("div",{className:"w-full h-60 rounded-xl mb-6 overflow-hidden",children:s.jsx("img",{src:`/assets/${r===0?"outdoor_rescue.png":r===1?"health_care.png":"companion.png"}`,alt:n.title,className:"w-full h-full object-cover",onError:i=>{console.error(`Failed to load image for use case ${r+1}`),i.currentTarget.style.display="none";const o=document.createElement("div");o.className="w-full h-60 bg-gradient-to-br from-gray-200 to-gray-300 rounded-xl flex items-center justify-center",r===0?o.innerHTML='':r===1?o.innerHTML='':o.innerHTML='',i.currentTarget.parentNode&&i.currentTarget.parentNode.appendChild(o)}})}),s.jsxs("div",{className:"flex flex-col flex-grow space-y-4",children:[s.jsx("div",{className:"text-sm font-semibold text-purple-600",children:n.category}),s.jsx("h3",{className:"text-xl font-semibold text-black leading-tight",children:n.title}),s.jsx("p",{className:"text-gray-600 text-sm leading-relaxed flex-grow",children:n.description}),s.jsx("div",{className:"pt-4",children:s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white text-sm px-4 py-2 w-auto",onClick:()=>{console.log("Selected use case:",n.id)},children:"Select"})})]})]})},n.id))})}),s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-16",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-400/30 via-blue-500/30 to-pink-500/30 backdrop-blur-sm rounded-3xl"}),s.jsxs("div",{className:"relative bg-purple-400/20 backdrop-blur-lg rounded-3xl p-8 text-center",children:[s.jsx("div",{className:"flex justify-center mb-6 space-x-1",children:[...Array(20)].map((n,r)=>s.jsx("div",{className:"bg-purple-600 rounded-full animate-pulse",style:{width:"3px",height:`${Math.random()*40+10}px`,animationDelay:`${r*.1}s`,animationDuration:"1s"}},r))}),s.jsx("h2",{className:"text-2xl font-medium text-white mb-4",children:"Customize your own device"}),s.jsx("p",{className:"text-gray-900 mb-6",children:"Need help? Contact us to get customized device and services"}),s.jsx(J,{className:"bg-purple-600 hover:bg-purple-700 text-white px-8 py-3",onClick:()=>e("/playground"),children:"Get Started"})]})]})})]})}const ni=g.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:ce("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));ni.displayName="Input";var uC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=uC.reduce((e,t)=>{const n=ki(`Primitive.${t}`),r=g.forwardRef((i,o)=>{const{asChild:l,...a}=i,u=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function cC(e,t){e&&_i.flushSync(()=>e.dispatchEvent(t))}var dC="Label",ly=g.forwardRef((e,t)=>s.jsx(le.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ly.displayName=dC;var sy=ly;const fC=Hd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Te=g.forwardRef(({className:e,...t},n)=>s.jsx(sy,{ref:n,className:ce(fC(),e),...t}));Te.displayName=sy.displayName;const Gd=g.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:ce("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Gd.displayName="Textarea";function As(e,[t,n]){return Math.min(n,Math.max(t,e))}function ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function pC(e,t){const n=g.createContext(t),r=o=>{const{children:l,...a}=o,u=g.useMemo(()=>a,Object.values(a));return s.jsx(n.Provider,{value:u,children:l})};r.displayName=e+"Provider";function i(o){const l=g.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function sr(e,t=[]){let n=[];function r(o,l){const a=g.createContext(l),u=n.length;n=[...n,l];const c=d=>{var y;const{scope:p,children:m,...w}=d,x=((y=p==null?void 0:p[e])==null?void 0:y[u])||a,S=g.useMemo(()=>w,Object.values(w));return s.jsx(x.Provider,{value:S,children:m})};c.displayName=o+"Provider";function f(d,p){var x;const m=((x=p==null?void 0:p[e])==null?void 0:x[u])||a,w=g.useContext(m);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,f]}const i=()=>{const o=n.map(l=>g.createContext(l));return function(a){const u=(a==null?void 0:a[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return i.scopeName=e,[r,mC(i,...t)]}function mC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const l=r.reduce((a,{useScope:u,scopeName:c})=>{const d=u(o)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function Kd(e){const t=e+"CollectionProvider",[n,r]=sr(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=x=>{const{scope:S,children:y}=x,h=Ht.useRef(null),v=Ht.useRef(new Map).current;return s.jsx(i,{scope:S,itemMap:v,collectionRef:h,children:y})};l.displayName=t;const a=e+"CollectionSlot",u=ki(a),c=Ht.forwardRef((x,S)=>{const{scope:y,children:h}=x,v=o(a,y),k=ve(S,v.collectionRef);return s.jsx(u,{ref:k,children:h})});c.displayName=a;const f=e+"CollectionItemSlot",d="data-radix-collection-item",p=ki(f),m=Ht.forwardRef((x,S)=>{const{scope:y,children:h,...v}=x,k=Ht.useRef(null),j=ve(S,k),C=o(f,y);return Ht.useEffect(()=>(C.itemMap.set(k,{ref:k,...v}),()=>void C.itemMap.delete(k))),s.jsx(p,{[d]:"",ref:j,children:h})});m.displayName=f;function w(x){const S=o(e+"CollectionConsumer",x);return Ht.useCallback(()=>{const h=S.collectionRef.current;if(!h)return[];const v=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(S.itemMap.values()).sort((C,E)=>v.indexOf(C.ref.current)-v.indexOf(E.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:c,ItemSlot:m},w,r]}var hC=g.createContext(void 0);function oa(e){const t=g.useContext(hC);return e||t||"ltr"}function er(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function gC(e,t=globalThis==null?void 0:globalThis.document){const n=er(e);g.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var xC="DismissableLayer",vc="dismissableLayer.update",yC="dismissableLayer.pointerDownOutside",vC="dismissableLayer.focusOutside",im,ay=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qd=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:a,...u}=e,c=g.useContext(ay),[f,d]=g.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=g.useState({}),w=ve(t,E=>d(E)),x=Array.from(c.layers),[S]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=x.indexOf(S),h=f?x.indexOf(f):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,k=h>=y,j=bC(E=>{const T=E.target,z=[...c.branches].some(L=>L.contains(T));!k||z||(i==null||i(E),l==null||l(E),E.defaultPrevented||a==null||a())},p),C=kC(E=>{const T=E.target;[...c.branches].some(L=>L.contains(T))||(o==null||o(E),l==null||l(E),E.defaultPrevented||a==null||a())},p);return gC(E=>{h===c.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},p),g.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(im=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),om(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=im)}},[f,p,n,c]),g.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),om())},[f,c]),g.useEffect(()=>{const E=()=>m({});return document.addEventListener(vc,E),()=>document.removeEventListener(vc,E)},[]),s.jsx(le.div,{...u,ref:w,style:{pointerEvents:v?k?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,j.onPointerDownCapture)})});Qd.displayName=xC;var wC="DismissableLayerBranch",SC=g.forwardRef((e,t)=>{const n=g.useContext(ay),r=g.useRef(null),i=ve(t,r);return g.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),s.jsx(le.div,{...e,ref:i})});SC.displayName=wC;function bC(e,t=globalThis==null?void 0:globalThis.document){const n=er(e),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let u=function(){uy(yC,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function kC(e,t=globalThis==null?void 0:globalThis.document){const n=er(e),r=g.useRef(!1);return g.useEffect(()=>{const i=o=>{o.target&&!r.current&&uy(vC,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function om(){const e=new CustomEvent(vc);document.dispatchEvent(e)}function uy(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?cC(i,o):i.dispatchEvent(o)}var Xa=0;function cy(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lm()),document.body.insertAdjacentElement("beforeend",e[1]??lm()),Xa++,()=>{Xa===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xa--}},[])}function lm(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var qa="focusScope.autoFocusOnMount",Ja="focusScope.autoFocusOnUnmount",sm={bubbles:!1,cancelable:!0},NC="FocusScope",Yd=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=e,[a,u]=g.useState(null),c=er(i),f=er(o),d=g.useRef(null),p=ve(t,x=>u(x)),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let x=function(v){if(m.paused||!a)return;const k=v.target;a.contains(k)?d.current=k:Mn(d.current,{select:!0})},S=function(v){if(m.paused||!a)return;const k=v.relatedTarget;k!==null&&(a.contains(k)||Mn(d.current,{select:!0}))},y=function(v){if(document.activeElement===document.body)for(const j of v)j.removedNodes.length>0&&Mn(a)};document.addEventListener("focusin",x),document.addEventListener("focusout",S);const h=new MutationObserver(y);return a&&h.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",S),h.disconnect()}}},[r,a,m.paused]),g.useEffect(()=>{if(a){um.add(m);const x=document.activeElement;if(!a.contains(x)){const y=new CustomEvent(qa,sm);a.addEventListener(qa,c),a.dispatchEvent(y),y.defaultPrevented||(CC(AC(dy(a)),{select:!0}),document.activeElement===x&&Mn(a))}return()=>{a.removeEventListener(qa,c),setTimeout(()=>{const y=new CustomEvent(Ja,sm);a.addEventListener(Ja,f),a.dispatchEvent(y),y.defaultPrevented||Mn(x??document.body,{select:!0}),a.removeEventListener(Ja,f),um.remove(m)},0)}}},[a,c,f,m]);const w=g.useCallback(x=>{if(!n&&!r||m.paused)return;const S=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,y=document.activeElement;if(S&&y){const h=x.currentTarget,[v,k]=jC(h);v&&k?!x.shiftKey&&y===k?(x.preventDefault(),n&&Mn(v,{select:!0})):x.shiftKey&&y===v&&(x.preventDefault(),n&&Mn(k,{select:!0})):y===h&&x.preventDefault()}},[n,r,m.paused]);return s.jsx(le.div,{tabIndex:-1,...l,ref:p,onKeyDown:w})});Yd.displayName=NC;function CC(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Mn(r,{select:t}),document.activeElement!==n)return}function jC(e){const t=dy(e),n=am(t,e),r=am(t.reverse(),e);return[n,r]}function dy(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function am(e,t){for(const n of e)if(!EC(n,{upTo:t}))return n}function EC(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function PC(e){return e instanceof HTMLInputElement&&"select"in e}function Mn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&PC(e)&&t&&e.select()}}var um=TC();function TC(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=cm(e,t),e.unshift(t)},remove(t){var n;e=cm(e,t),(n=e[0])==null||n.resume()}}}function cm(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function AC(e){return e.filter(t=>t.tagName!=="A")}var tt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},_C=Qc[" useId ".trim().toString()]||(()=>{}),IC=0;function qn(e){const[t,n]=g.useState(_C());return tt(()=>{e||n(r=>r??String(IC++))},[e]),e||(t?`radix-${t}`:"")}const RC=["top","right","bottom","left"],tr=Math.min,wt=Math.max,_s=Math.round,wl=Math.floor,pn=e=>({x:e,y:e}),MC={left:"right",right:"left",bottom:"top",top:"bottom"},LC={start:"end",end:"start"};function wc(e,t,n){return wt(e,tr(t,n))}function En(e,t){return typeof e=="function"?e(t):e}function Pn(e){return e.split("-")[0]}function Ri(e){return e.split("-")[1]}function Xd(e){return e==="x"?"y":"x"}function qd(e){return e==="y"?"height":"width"}const OC=new Set(["top","bottom"]);function cn(e){return OC.has(Pn(e))?"y":"x"}function Jd(e){return Xd(cn(e))}function DC(e,t,n){n===void 0&&(n=!1);const r=Ri(e),i=Jd(e),o=qd(i);let l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Is(l)),[l,Is(l)]}function zC(e){const t=Is(e);return[Sc(e),t,Sc(t)]}function Sc(e){return e.replace(/start|end/g,t=>LC[t])}const dm=["left","right"],fm=["right","left"],FC=["top","bottom"],BC=["bottom","top"];function $C(e,t,n){switch(e){case"top":case"bottom":return n?t?fm:dm:t?dm:fm;case"left":case"right":return t?FC:BC;default:return[]}}function UC(e,t,n,r){const i=Ri(e);let o=$C(Pn(e),n==="start",r);return i&&(o=o.map(l=>l+"-"+i),t&&(o=o.concat(o.map(Sc)))),o}function Is(e){return e.replace(/left|right|bottom|top/g,t=>MC[t])}function VC(e){return{top:0,right:0,bottom:0,left:0,...e}}function fy(e){return typeof e!="number"?VC(e):{top:e,right:e,bottom:e,left:e}}function Rs(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pm(e,t,n){let{reference:r,floating:i}=e;const o=cn(t),l=Jd(t),a=qd(l),u=Pn(t),c=o==="y",f=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let m;switch(u){case"top":m={x:f,y:r.y-i.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-i.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Ri(t)){case"start":m[l]-=p*(n&&c?-1:1);break;case"end":m[l]+=p*(n&&c?-1:1);break}return m}const HC=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,a=o.filter(Boolean),u=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:d}=pm(c,r,u),p=r,m={},w=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:l,elements:a,middlewareData:u}=t,{element:c,padding:f=0}=En(e,t)||{};if(c==null)return{};const d=fy(f),p={x:n,y:r},m=Jd(i),w=qd(m),x=await l.getDimensions(c),S=m==="y",y=S?"top":"left",h=S?"bottom":"right",v=S?"clientHeight":"clientWidth",k=o.reference[w]+o.reference[m]-p[m]-o.floating[w],j=p[m]-o.reference[m],C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let E=C?C[v]:0;(!E||!await(l.isElement==null?void 0:l.isElement(C)))&&(E=a.floating[v]||o.floating[w]);const T=k/2-j/2,z=E/2-x[w]/2-1,L=tr(d[y],z),I=tr(d[h],z),P=L,R=E-x[w]-I,W=E/2-x[w]/2+T,M=wc(P,W,R),O=!u.arrow&&Ri(i)!=null&&W!==M&&o.reference[w]/2-(WW<=0)){var I,P;const W=(((I=o.flip)==null?void 0:I.index)||0)+1,M=E[W];if(M&&(!(d==="alignment"?h!==cn(M):!1)||L.every(A=>cn(A.placement)===h?A.overflows[0]>0:!0)))return{data:{index:W,overflows:L},reset:{placement:M}};let O=(P=L.filter($=>$.overflows[0]<=0).sort(($,A)=>$.overflows[1]-A.overflows[1])[0])==null?void 0:P.placement;if(!O)switch(m){case"bestFit":{var R;const $=(R=L.filter(A=>{if(C){const F=cn(A.placement);return F===h||F==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(F=>F>0).reduce((F,b)=>F+b,0)]).sort((A,F)=>A[1]-F[1])[0])==null?void 0:R[0];$&&(O=$);break}case"initialPlacement":O=a;break}if(i!==O)return{reset:{placement:O}}}return{}}}};function mm(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hm(e){return RC.some(t=>e[t]>=0)}const KC=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=En(e,t);switch(r){case"referenceHidden":{const o=await Lo(t,{...i,elementContext:"reference"}),l=mm(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:hm(l)}}}case"escaped":{const o=await Lo(t,{...i,altBoundary:!0}),l=mm(o,n.floating);return{data:{escapedOffsets:l,escaped:hm(l)}}}default:return{}}}}},py=new Set(["left","top"]);async function QC(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=Pn(n),a=Ri(n),u=cn(n)==="y",c=py.has(l)?-1:1,f=o&&u?-1:1,d=En(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:w}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof w=="number"&&(m=a==="end"?w*-1:w),u?{x:m*f,y:p*c}:{x:p*c,y:m*f}}const YC=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:l,middlewareData:a}=t,u=await QC(t,e);return l===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:o+u.y,data:{...u,placement:l}}}}},XC=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:a={fn:S=>{let{x:y,y:h}=S;return{x:y,y:h}}},...u}=En(e,t),c={x:n,y:r},f=await Lo(t,u),d=cn(Pn(i)),p=Xd(d);let m=c[p],w=c[d];if(o){const S=p==="y"?"top":"left",y=p==="y"?"bottom":"right",h=m+f[S],v=m-f[y];m=wc(h,m,v)}if(l){const S=d==="y"?"top":"left",y=d==="y"?"bottom":"right",h=w+f[S],v=w-f[y];w=wc(h,w,v)}const x=a.fn({...t,[p]:m,[d]:w});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:o,[d]:l}}}}}},qC=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:l}=t,{offset:a=0,mainAxis:u=!0,crossAxis:c=!0}=En(e,t),f={x:n,y:r},d=cn(i),p=Xd(d);let m=f[p],w=f[d];const x=En(a,t),S=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(u){const v=p==="y"?"height":"width",k=o.reference[p]-o.floating[v]+S.mainAxis,j=o.reference[p]+o.reference[v]-S.mainAxis;mj&&(m=j)}if(c){var y,h;const v=p==="y"?"width":"height",k=py.has(Pn(i)),j=o.reference[d]-o.floating[v]+(k&&((y=l.offset)==null?void 0:y[d])||0)+(k?0:S.crossAxis),C=o.reference[d]+o.reference[v]+(k?0:((h=l.offset)==null?void 0:h[d])||0)-(k?S.crossAxis:0);wC&&(w=C)}return{[p]:m,[d]:w}}}},JC=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:l,elements:a}=t,{apply:u=()=>{},...c}=En(e,t),f=await Lo(t,c),d=Pn(i),p=Ri(i),m=cn(i)==="y",{width:w,height:x}=o.floating;let S,y;d==="top"||d==="bottom"?(S=d,y=p===(await(l.isRTL==null?void 0:l.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,S=p==="end"?"top":"bottom");const h=x-f.top-f.bottom,v=w-f.left-f.right,k=tr(x-f[S],h),j=tr(w-f[y],v),C=!t.middlewareData.shift;let E=k,T=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=h),C&&!p){const L=wt(f.left,0),I=wt(f.right,0),P=wt(f.top,0),R=wt(f.bottom,0);m?T=w-2*(L!==0||I!==0?L+I:wt(f.left,f.right)):E=x-2*(P!==0||R!==0?P+R:wt(f.top,f.bottom))}await u({...t,availableWidth:T,availableHeight:E});const z=await l.getDimensions(a.floating);return w!==z.width||x!==z.height?{reset:{rects:!0}}:{}}}};function la(){return typeof window<"u"}function Mi(e){return my(e)?(e.nodeName||"").toLowerCase():"#document"}function Nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gn(e){var t;return(t=(my(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function my(e){return la()?e instanceof Node||e instanceof Nt(e).Node:!1}function Xt(e){return la()?e instanceof Element||e instanceof Nt(e).Element:!1}function mn(e){return la()?e instanceof HTMLElement||e instanceof Nt(e).HTMLElement:!1}function gm(e){return!la()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nt(e).ShadowRoot}const ZC=new Set(["inline","contents"]);function Qo(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ZC.has(i)}const ej=new Set(["table","td","th"]);function tj(e){return ej.has(Mi(e))}const nj=[":popover-open",":modal"];function sa(e){return nj.some(t=>{try{return e.matches(t)}catch{return!1}})}const rj=["transform","translate","scale","rotate","perspective"],ij=["transform","translate","scale","rotate","perspective","filter"],oj=["paint","layout","strict","content"];function Zd(e){const t=ef(),n=Xt(e)?qt(e):e;return rj.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ij.some(r=>(n.willChange||"").includes(r))||oj.some(r=>(n.contain||"").includes(r))}function lj(e){let t=nr(e);for(;mn(t)&&!Ni(t);){if(Zd(t))return t;if(sa(t))return null;t=nr(t)}return null}function ef(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sj=new Set(["html","body","#document"]);function Ni(e){return sj.has(Mi(e))}function qt(e){return Nt(e).getComputedStyle(e)}function aa(e){return Xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nr(e){if(Mi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gm(e)&&e.host||gn(e);return gm(t)?t.host:t}function hy(e){const t=nr(e);return Ni(t)?e.ownerDocument?e.ownerDocument.body:e.body:mn(t)&&Qo(t)?t:hy(t)}function Oo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=hy(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),l=Nt(i);if(o){const a=bc(l);return t.concat(l,l.visualViewport||[],Qo(i)?i:[],a&&n?Oo(a):[])}return t.concat(i,Oo(i,[],n))}function bc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gy(e){const t=qt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=mn(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:r,a=_s(n)!==o||_s(r)!==l;return a&&(n=o,r=l),{width:n,height:r,$:a}}function tf(e){return Xt(e)?e:e.contextElement}function ci(e){const t=tf(e);if(!mn(t))return pn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=gy(t);let l=(o?_s(n.width):n.width)/r,a=(o?_s(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const aj=pn(0);function xy(e){const t=Nt(e);return!ef()||!t.visualViewport?aj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nt(e)?!1:t}function Pr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=tf(e);let l=pn(1);t&&(r?Xt(r)&&(l=ci(r)):l=ci(e));const a=uj(o,n,r)?xy(o):pn(0);let u=(i.left+a.x)/l.x,c=(i.top+a.y)/l.y,f=i.width/l.x,d=i.height/l.y;if(o){const p=Nt(o),m=r&&Xt(r)?Nt(r):r;let w=p,x=bc(w);for(;x&&r&&m!==w;){const S=ci(x),y=x.getBoundingClientRect(),h=qt(x),v=y.left+(x.clientLeft+parseFloat(h.paddingLeft))*S.x,k=y.top+(x.clientTop+parseFloat(h.paddingTop))*S.y;u*=S.x,c*=S.y,f*=S.x,d*=S.y,u+=v,c+=k,w=Nt(x),x=bc(w)}}return Rs({width:f,height:d,x:u,y:c})}function ua(e,t){const n=aa(e).scrollLeft;return t?t.left+n:Pr(gn(e)).left+n}function yy(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ua(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function cj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",l=gn(r),a=t?sa(t.floating):!1;if(r===l||a&&o)return n;let u={scrollLeft:0,scrollTop:0},c=pn(1);const f=pn(0),d=mn(r);if((d||!d&&!o)&&((Mi(r)!=="body"||Qo(l))&&(u=aa(r)),mn(r))){const m=Pr(r);c=ci(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=l&&!d&&!o?yy(l,u):pn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-u.scrollLeft*c.x+f.x+p.x,y:n.y*c.y-u.scrollTop*c.y+f.y+p.y}}function dj(e){return Array.from(e.getClientRects())}function fj(e){const t=gn(e),n=aa(e),r=e.ownerDocument.body,i=wt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=wt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ua(e);const a=-n.scrollTop;return qt(r).direction==="rtl"&&(l+=wt(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:a}}const xm=25;function pj(e,t){const n=Nt(e),r=gn(e),i=n.visualViewport;let o=r.clientWidth,l=r.clientHeight,a=0,u=0;if(i){o=i.width,l=i.height;const f=ef();(!f||f&&t==="fixed")&&(a=i.offsetLeft,u=i.offsetTop)}const c=ua(r);if(c<=0){const f=r.ownerDocument,d=f.body,p=getComputedStyle(d),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,w=Math.abs(r.clientWidth-d.clientWidth-m);w<=xm&&(o-=w)}else c<=xm&&(o+=c);return{width:o,height:l,x:a,y:u}}const mj=new Set(["absolute","fixed"]);function hj(e,t){const n=Pr(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=mn(e)?ci(e):pn(1),l=e.clientWidth*o.x,a=e.clientHeight*o.y,u=i*o.x,c=r*o.y;return{width:l,height:a,x:u,y:c}}function ym(e,t,n){let r;if(t==="viewport")r=pj(e,n);else if(t==="document")r=fj(gn(e));else if(Xt(t))r=hj(t,n);else{const i=xy(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Rs(r)}function vy(e,t){const n=nr(e);return n===t||!Xt(n)||Ni(n)?!1:qt(n).position==="fixed"||vy(n,t)}function gj(e,t){const n=t.get(e);if(n)return n;let r=Oo(e,[],!1).filter(a=>Xt(a)&&Mi(a)!=="body"),i=null;const o=qt(e).position==="fixed";let l=o?nr(e):e;for(;Xt(l)&&!Ni(l);){const a=qt(l),u=Zd(l);!u&&a.position==="fixed"&&(i=null),(o?!u&&!i:!u&&a.position==="static"&&!!i&&mj.has(i.position)||Qo(l)&&!u&&vy(e,l))?r=r.filter(f=>f!==l):i=a,l=nr(l)}return t.set(e,r),r}function xj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const l=[...n==="clippingAncestors"?sa(t)?[]:gj(t,this._c):[].concat(n),r],a=l[0],u=l.reduce((c,f)=>{const d=ym(t,f,i);return c.top=wt(d.top,c.top),c.right=tr(d.right,c.right),c.bottom=tr(d.bottom,c.bottom),c.left=wt(d.left,c.left),c},ym(t,a,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function yj(e){const{width:t,height:n}=gy(e);return{width:t,height:n}}function vj(e,t,n){const r=mn(t),i=gn(t),o=n==="fixed",l=Pr(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const u=pn(0);function c(){u.x=ua(i)}if(r||!r&&!o)if((Mi(t)!=="body"||Qo(i))&&(a=aa(t)),r){const m=Pr(t,!0,o,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else i&&c();o&&!r&&i&&c();const f=i&&!r&&!o?yy(i,a):pn(0),d=l.left+a.scrollLeft-u.x-f.x,p=l.top+a.scrollTop-u.y-f.y;return{x:d,y:p,width:l.width,height:l.height}}function Za(e){return qt(e).position==="static"}function vm(e,t){if(!mn(e)||qt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return gn(e)===n&&(n=n.ownerDocument.body),n}function wy(e,t){const n=Nt(e);if(sa(e))return n;if(!mn(e)){let i=nr(e);for(;i&&!Ni(i);){if(Xt(i)&&!Za(i))return i;i=nr(i)}return n}let r=vm(e,t);for(;r&&tj(r)&&Za(r);)r=vm(r,t);return r&&Ni(r)&&Za(r)&&!Zd(r)?n:r||lj(e)||n}const wj=async function(e){const t=this.getOffsetParent||wy,n=this.getDimensions,r=await n(e.floating);return{reference:vj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Sj(e){return qt(e).direction==="rtl"}const bj={convertOffsetParentRelativeRectToViewportRelativeRect:cj,getDocumentElement:gn,getClippingRect:xj,getOffsetParent:wy,getElementRects:wj,getClientRects:dj,getDimensions:yj,getScale:ci,isElement:Xt,isRTL:Sj};function Sy(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kj(e,t){let n=null,r;const i=gn(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function l(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),o();const c=e.getBoundingClientRect(),{left:f,top:d,width:p,height:m}=c;if(a||t(),!p||!m)return;const w=wl(d),x=wl(i.clientWidth-(f+p)),S=wl(i.clientHeight-(d+m)),y=wl(f),v={rootMargin:-w+"px "+-x+"px "+-S+"px "+-y+"px",threshold:wt(0,tr(1,u))||1};let k=!0;function j(C){const E=C[0].intersectionRatio;if(E!==u){if(!k)return l();E?l(!1,E):r=setTimeout(()=>{l(!1,1e-7)},1e3)}E===1&&!Sy(c,e.getBoundingClientRect())&&l(),k=!1}try{n=new IntersectionObserver(j,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(j,v)}n.observe(e)}return l(!0),o}function Nj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,c=tf(e),f=i||o?[...c?Oo(c):[],...Oo(t)]:[];f.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const d=c&&a?kj(c,n):null;let p=-1,m=null;l&&(m=new ResizeObserver(y=>{let[h]=y;h&&h.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=m)==null||v.observe(t)})),n()}),c&&!u&&m.observe(c),m.observe(t));let w,x=u?Pr(e):null;u&&S();function S(){const y=Pr(e);x&&!Sy(x,y)&&n(),x=y,w=requestAnimationFrame(S)}return n(),()=>{var y;f.forEach(h=>{i&&h.removeEventListener("scroll",n),o&&h.removeEventListener("resize",n)}),d==null||d(),(y=m)==null||y.disconnect(),m=null,u&&cancelAnimationFrame(w)}}const Cj=YC,jj=XC,Ej=GC,Pj=JC,Tj=KC,wm=WC,Aj=qC,_j=(e,t,n)=>{const r=new Map,i={platform:bj,...n},o={...i.platform,_c:r};return HC(e,t,{...i,platform:o})};var Ij=typeof document<"u",Rj=function(){},$l=Ij?g.useLayoutEffect:Rj;function Ms(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ms(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!Ms(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function by(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sm(e,t){const n=by(e);return Math.round(t*n)/n}function eu(e){const t=g.useRef(e);return $l(()=>{t.current=e}),t}function Mj(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:a=!0,whileElementsMounted:u,open:c}=e,[f,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=g.useState(r);Ms(p,r)||m(r);const[w,x]=g.useState(null),[S,y]=g.useState(null),h=g.useCallback(A=>{A!==C.current&&(C.current=A,x(A))},[]),v=g.useCallback(A=>{A!==E.current&&(E.current=A,y(A))},[]),k=o||w,j=l||S,C=g.useRef(null),E=g.useRef(null),T=g.useRef(f),z=u!=null,L=eu(u),I=eu(i),P=eu(c),R=g.useCallback(()=>{if(!C.current||!E.current)return;const A={placement:t,strategy:n,middleware:p};I.current&&(A.platform=I.current),_j(C.current,E.current,A).then(F=>{const b={...F,isPositioned:P.current!==!1};W.current&&!Ms(T.current,b)&&(T.current=b,_i.flushSync(()=>{d(b)}))})},[p,t,n,I,P]);$l(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[c]);const W=g.useRef(!1);$l(()=>(W.current=!0,()=>{W.current=!1}),[]),$l(()=>{if(k&&(C.current=k),j&&(E.current=j),k&&j){if(L.current)return L.current(k,j,R);R()}},[k,j,R,L,z]);const M=g.useMemo(()=>({reference:C,floating:E,setReference:h,setFloating:v}),[h,v]),O=g.useMemo(()=>({reference:k,floating:j}),[k,j]),$=g.useMemo(()=>{const A={position:n,left:0,top:0};if(!O.floating)return A;const F=Sm(O.floating,f.x),b=Sm(O.floating,f.y);return a?{...A,transform:"translate("+F+"px, "+b+"px)",...by(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:b}},[n,a,O.floating,f.x,f.y]);return g.useMemo(()=>({...f,update:R,refs:M,elements:O,floatingStyles:$}),[f,R,M,O,$])}const Lj=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?wm({element:r.current,padding:i}).fn(n):{}:r?wm({element:r,padding:i}).fn(n):{}}}},Oj=(e,t)=>({...Cj(e),options:[e,t]}),Dj=(e,t)=>({...jj(e),options:[e,t]}),zj=(e,t)=>({...Aj(e),options:[e,t]}),Fj=(e,t)=>({...Ej(e),options:[e,t]}),Bj=(e,t)=>({...Pj(e),options:[e,t]}),$j=(e,t)=>({...Tj(e),options:[e,t]}),Uj=(e,t)=>({...Lj(e),options:[e,t]});var Vj="Arrow",ky=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return s.jsx(le.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});ky.displayName=Vj;var Hj=ky;function Ny(e){const[t,n]=g.useState(void 0);return tt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,a;if("borderBoxSize"in o){const u=o.borderBoxSize,c=Array.isArray(u)?u[0]:u;l=c.inlineSize,a=c.blockSize}else l=e.offsetWidth,a=e.offsetHeight;n({width:l,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var nf="Popper",[Cy,jy]=sr(nf),[Wj,Ey]=Cy(nf),Py=e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return s.jsx(Wj,{scope:t,anchor:r,onAnchorChange:i,children:n})};Py.displayName=nf;var Ty="PopperAnchor",Ay=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=Ey(Ty,n),l=g.useRef(null),a=ve(t,l),u=g.useRef(null);return g.useEffect(()=>{const c=u.current;u.current=(r==null?void 0:r.current)||l.current,c!==u.current&&o.onAnchorChange(u.current)}),r?null:s.jsx(le.div,{...i,ref:a})});Ay.displayName=Ty;var rf="PopperContent",[Gj,Kj]=Cy(rf),_y=g.forwardRef((e,t)=>{var K,ne,he,oe,de,me;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:u=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:m="optimized",onPlaced:w,...x}=e,S=Ey(rf,n),[y,h]=g.useState(null),v=ve(t,He=>h(He)),[k,j]=g.useState(null),C=Ny(k),E=(C==null?void 0:C.width)??0,T=(C==null?void 0:C.height)??0,z=r+(o!=="center"?"-"+o:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},I=Array.isArray(c)?c:[c],P=I.length>0,R={padding:L,boundary:I.filter(Yj),altBoundary:P},{refs:W,floatingStyles:M,placement:O,isPositioned:$,middlewareData:A}=Mj({strategy:"fixed",placement:z,whileElementsMounted:(...He)=>Nj(...He,{animationFrame:m==="always"}),elements:{reference:S.anchor},middleware:[Oj({mainAxis:i+T,alignmentAxis:l}),u&&Dj({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?zj():void 0,...R}),u&&Fj({...R}),Bj({...R,apply:({elements:He,rects:rt,availableWidth:Zt,availableHeight:zt})=>{const{width:en,height:Fi}=rt.reference,xn=He.floating.style;xn.setProperty("--radix-popper-available-width",`${Zt}px`),xn.setProperty("--radix-popper-available-height",`${zt}px`),xn.setProperty("--radix-popper-anchor-width",`${en}px`),xn.setProperty("--radix-popper-anchor-height",`${Fi}px`)}}),k&&Uj({element:k,padding:a}),Xj({arrowWidth:E,arrowHeight:T}),p&&$j({strategy:"referenceHidden",...R})]}),[F,b]=My(O),V=er(w);tt(()=>{$&&(V==null||V())},[$,V]);const Y=(K=A.arrow)==null?void 0:K.x,N=(ne=A.arrow)==null?void 0:ne.y,re=((he=A.arrow)==null?void 0:he.centerOffset)!==0,[fe,ie]=g.useState();return tt(()=>{y&&ie(window.getComputedStyle(y).zIndex)},[y]),s.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:$?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(oe=A.transformOrigin)==null?void 0:oe.x,(de=A.transformOrigin)==null?void 0:de.y].join(" "),...((me=A.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Gj,{scope:n,placedSide:F,onArrowChange:j,arrowX:Y,arrowY:N,shouldHideArrow:re,children:s.jsx(le.div,{"data-side":F,"data-align":b,...x,ref:v,style:{...x.style,animation:$?void 0:"none"}})})})});_y.displayName=rf;var Iy="PopperArrow",Qj={top:"bottom",right:"left",bottom:"top",left:"right"},Ry=g.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=Kj(Iy,r),l=Qj[o.placedSide];return s.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:s.jsx(Hj,{...i,ref:n,style:{...i.style,display:"block"}})})});Ry.displayName=Iy;function Yj(e){return e!==null}var Xj=e=>({name:"transformOrigin",options:e,fn(t){var S,y,h;const{placement:n,rects:r,middlewareData:i}=t,l=((S=i.arrow)==null?void 0:S.centerOffset)!==0,a=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[c,f]=My(n),d={start:"0%",center:"50%",end:"100%"}[f],p=(((y=i.arrow)==null?void 0:y.x)??0)+a/2,m=(((h=i.arrow)==null?void 0:h.y)??0)+u/2;let w="",x="";return c==="bottom"?(w=l?d:`${p}px`,x=`${-u}px`):c==="top"?(w=l?d:`${p}px`,x=`${r.floating.height+u}px`):c==="right"?(w=`${-u}px`,x=l?d:`${m}px`):c==="left"&&(w=`${r.floating.width+u}px`,x=l?d:`${m}px`),{data:{x:w,y:x}}}});function My(e){const[t,n="center"]=e.split("-");return[t,n]}var qj=Py,Jj=Ay,Zj=_y,e2=Ry,t2="Portal",of=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,o]=g.useState(!1);tt(()=>o(!0),[]);const l=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?ab.createPortal(s.jsx(le.div,{...r,ref:t}),l):null});of.displayName=t2;var n2=Qc[" useInsertionEffect ".trim().toString()]||tt;function Ci({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,l]=r2({defaultProp:t,onChange:n}),a=e!==void 0,u=a?e:i;{const f=g.useRef(e!==void 0);g.useEffect(()=>{const d=f.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const c=g.useCallback(f=>{var d;if(a){const p=i2(f)?f(e):f;p!==e&&((d=l.current)==null||d.call(l,p))}else o(f)},[a,e,o,l]);return[u,c]}function r2({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),o=g.useRef(t);return n2(()=>{o.current=t},[t]),g.useEffect(()=>{var l;i.current!==n&&((l=o.current)==null||l.call(o,n),i.current=n)},[n,i]),[n,r,o]}function i2(e){return typeof e=="function"}function Ly(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Oy=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),o2="VisuallyHidden",l2=g.forwardRef((e,t)=>s.jsx(le.span,{...e,ref:t,style:{...Oy,...e.style}}));l2.displayName=o2;var s2=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fr=new WeakMap,Sl=new WeakMap,bl={},tu=0,Dy=function(e){return e&&(e.host||Dy(e.parentNode))},a2=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Dy(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},u2=function(e,t,n,r){var i=a2(t,Array.isArray(e)?e:[e]);bl[n]||(bl[n]=new WeakMap);var o=bl[n],l=[],a=new Set,u=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var f=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))f(p);else try{var m=p.getAttribute(r),w=m!==null&&m!=="false",x=(Fr.get(p)||0)+1,S=(o.get(p)||0)+1;Fr.set(p,x),o.set(p,S),l.push(p),x===1&&w&&Sl.set(p,!0),S===1&&p.setAttribute(n,"true"),w||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return f(t),a.clear(),tu++,function(){l.forEach(function(d){var p=Fr.get(d)-1,m=o.get(d)-1;Fr.set(d,p),o.set(d,m),p||(Sl.has(d)||d.removeAttribute(r),Sl.delete(d)),m||d.removeAttribute(n)}),tu--,tu||(Fr=new WeakMap,Fr=new WeakMap,Sl=new WeakMap,bl={})}},zy=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||s2(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),u2(r,i,n,"aria-hidden")):function(){return null}},an=function(){return an=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return j2;var t=E2(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},T2=Uy(),di="data-scroll-locked",A2=function(e,t,n,r){var i=e.left,o=e.top,l=e.right,a=e.gap;return n===void 0&&(n="margin"),` .`.concat(d2,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; @@ -324,7 +324,7 @@ Error generating stack: `+o.message+` `)},Nm=function(){var e=parseInt(document.body.getAttribute(di)||"0",10);return isFinite(e)?e:0},_2=function(){g.useEffect(function(){return document.body.setAttribute(di,(Nm()+1).toString()),function(){var e=Nm()-1;e<=0?document.body.removeAttribute(di):document.body.setAttribute(di,e.toString())}},[])},I2=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;_2();var o=g.useMemo(function(){return P2(i)},[i]);return g.createElement(T2,{styles:A2(o,!t,i,n?"":"!important")})},kc=!1;if(typeof window<"u")try{var kl=Object.defineProperty({},"passive",{get:function(){return kc=!0,!0}});window.addEventListener("test",kl,kl),window.removeEventListener("test",kl,kl)}catch{kc=!1}var Br=kc?{passive:!1}:!1,R2=function(e){return e.tagName==="TEXTAREA"},Vy=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!R2(e)&&n[t]==="visible")},M2=function(e){return Vy(e,"overflowY")},L2=function(e){return Vy(e,"overflowX")},Cm=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Hy(e,r);if(i){var o=Wy(e,r),l=o[1],a=o[2];if(l>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},O2=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},D2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Hy=function(e,t){return e==="v"?M2(t):L2(t)},Wy=function(e,t){return e==="v"?O2(t):D2(t)},z2=function(e,t){return e==="h"&&t==="rtl"?-1:1},F2=function(e,t,n,r,i){var o=z2(e,window.getComputedStyle(t).direction),l=o*r,a=n.target,u=t.contains(a),c=!1,f=l>0,d=0,p=0;do{if(!a)break;var m=Wy(e,a),w=m[0],x=m[1],S=m[2],y=x-S-o*w;(w||y)&&Hy(e,a)&&(d+=y,p+=w);var h=a.parentNode;a=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!u&&a!==document.body||u&&(t.contains(a)||t===a));return(f&&(i&&Math.abs(d)<1||!i&&l>d)||!f&&(i&&Math.abs(p)<1||!i&&-l>p))&&(c=!0),c},Nl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},jm=function(e){return[e.deltaX,e.deltaY]},Em=function(e){return e&&"current"in e?e.current:e},B2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$2=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},U2=0,$r=[];function V2(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(U2++)[0],o=g.useState(Uy)[0],l=g.useRef(e);g.useEffect(function(){l.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var x=c2([e.lockRef.current],(e.shards||[]).map(Em),!0).filter(Boolean);return x.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(x,S){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!l.current.allowPinchZoom;var y=Nl(x),h=n.current,v="deltaX"in x?x.deltaX:h[0]-y[0],k="deltaY"in x?x.deltaY:h[1]-y[1],j,C=x.target,E=Math.abs(v)>Math.abs(k)?"h":"v";if("touches"in x&&E==="h"&&C.type==="range")return!1;var T=Cm(E,C);if(!T)return!0;if(T?j=E:(j=E==="v"?"h":"v",T=Cm(E,C)),!T)return!1;if(!r.current&&"changedTouches"in x&&(v||k)&&(r.current=j),!j)return!0;var z=r.current||j;return F2(z,S,x,z==="h"?v:k,!0)},[]),u=g.useCallback(function(x){var S=x;if(!(!$r.length||$r[$r.length-1]!==o)){var y="deltaY"in S?jm(S):Nl(S),h=t.current.filter(function(j){return j.name===S.type&&(j.target===S.target||S.target===j.shadowParent)&&B2(j.delta,y)})[0];if(h&&h.should){S.cancelable&&S.preventDefault();return}if(!h){var v=(l.current.shards||[]).map(Em).filter(Boolean).filter(function(j){return j.contains(S.target)}),k=v.length>0?a(S,v[0]):!l.current.noIsolation;k&&S.cancelable&&S.preventDefault()}}},[]),c=g.useCallback(function(x,S,y,h){var v={name:x,delta:S,target:y,should:h,shadowParent:H2(y)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(k){return k!==v})},1)},[]),f=g.useCallback(function(x){n.current=Nl(x),r.current=void 0},[]),d=g.useCallback(function(x){c(x.type,jm(x),x.target,a(x,e.lockRef.current))},[]),p=g.useCallback(function(x){c(x.type,Nl(x),x.target,a(x,e.lockRef.current))},[]);g.useEffect(function(){return $r.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",u,Br),document.addEventListener("touchmove",u,Br),document.addEventListener("touchstart",f,Br),function(){$r=$r.filter(function(x){return x!==o}),document.removeEventListener("wheel",u,Br),document.removeEventListener("touchmove",u,Br),document.removeEventListener("touchstart",f,Br)}},[]);var m=e.removeScrollBar,w=e.inert;return g.createElement(g.Fragment,null,w?g.createElement(o,{styles:$2(i)}):null,m?g.createElement(I2,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function H2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const W2=v2($y,V2);var Gy=g.forwardRef(function(e,t){return g.createElement(ca,an({},e,{ref:t,sideCar:W2}))});Gy.classNames=ca.classNames;const Ky=Gy;var G2=[" ","Enter","ArrowUp","ArrowDown"],K2=[" ","Enter"],Tr="Select",[da,fa,Q2]=Kd(Tr),[Li,MR]=sr(Tr,[Q2,jy]),pa=jy(),[Y2,ar]=Li(Tr),[X2,q2]=Li(Tr),Qy=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:l,defaultValue:a,onValueChange:u,dir:c,name:f,autoComplete:d,disabled:p,required:m,form:w}=e,x=pa(t),[S,y]=g.useState(null),[h,v]=g.useState(null),[k,j]=g.useState(!1),C=oa(c),[E,T]=Ci({prop:r,defaultProp:i??!1,onChange:o,caller:Tr}),[z,L]=Ci({prop:l,defaultProp:a,onChange:u,caller:Tr}),I=g.useRef(null),P=S?w||!!S.closest("form"):!0,[R,W]=g.useState(new Set),M=Array.from(R).map(O=>O.props.value).join(";");return s.jsx(qj,{...x,children:s.jsxs(Y2,{required:m,scope:t,trigger:S,onTriggerChange:y,valueNode:h,onValueNodeChange:v,valueNodeHasChildren:k,onValueNodeHasChildrenChange:j,contentId:qn(),value:z,onValueChange:L,open:E,onOpenChange:T,dir:C,triggerPointerDownPosRef:I,disabled:p,children:[s.jsx(da.Provider,{scope:t,children:s.jsx(X2,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(O=>{W($=>new Set($).add(O))},[]),onNativeOptionRemove:g.useCallback(O=>{W($=>{const A=new Set($);return A.delete(O),A})},[]),children:n})}),P?s.jsxs(vv,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:d,value:z,onChange:O=>L(O.target.value),disabled:p,form:w,children:[z===void 0?s.jsx("option",{value:""}):null,Array.from(R)]},M):null]})})};Qy.displayName=Tr;var Yy="SelectTrigger",Xy=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=pa(n),l=ar(Yy,n),a=l.disabled||r,u=ve(t,l.onTriggerChange),c=fa(n),f=g.useRef("touch"),[d,p,m]=Sv(x=>{const S=c().filter(v=>!v.disabled),y=S.find(v=>v.value===l.value),h=bv(S,x,y);h!==void 0&&l.onValueChange(h.value)}),w=x=>{a||(l.onOpenChange(!0),m()),x&&(l.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return s.jsx(Jj,{asChild:!0,...o,children:s.jsx(le.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":wv(l.value)?"":void 0,...i,ref:u,onClick:ee(i.onClick,x=>{x.currentTarget.focus(),f.current!=="mouse"&&w(x)}),onPointerDown:ee(i.onPointerDown,x=>{f.current=x.pointerType;const S=x.target;S.hasPointerCapture(x.pointerId)&&S.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(w(x),x.preventDefault())}),onKeyDown:ee(i.onKeyDown,x=>{const S=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&p(x.key),!(S&&x.key===" ")&&G2.includes(x.key)&&(w(),x.preventDefault())})})})});Xy.displayName=Yy;var qy="SelectValue",Jy=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:l="",...a}=e,u=ar(qy,n),{onValueNodeHasChildrenChange:c}=u,f=o!==void 0,d=ve(t,u.onValueNodeChange);return tt(()=>{c(f)},[c,f]),s.jsx(le.span,{...a,ref:d,style:{pointerEvents:"none"},children:wv(u.value)?s.jsx(s.Fragment,{children:l}):o})});Jy.displayName=qy;var J2="SelectIcon",Zy=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return s.jsx(le.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});Zy.displayName=J2;var Z2="SelectPortal",ev=e=>s.jsx(of,{asChild:!0,...e});ev.displayName=Z2;var Ar="SelectContent",tv=g.forwardRef((e,t)=>{const n=ar(Ar,e.__scopeSelect),[r,i]=g.useState();if(tt(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?_i.createPortal(s.jsx(nv,{scope:e.__scopeSelect,children:s.jsx(da.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),o):null}return s.jsx(rv,{...e,ref:t})});tv.displayName=Ar;var Ut=10,[nv,ur]=Li(Ar),eE="SelectContentImpl",tE=ki("SelectContent.RemoveScroll"),rv=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:l,side:a,sideOffset:u,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:w,hideWhenDetached:x,avoidCollisions:S,...y}=e,h=ar(Ar,n),[v,k]=g.useState(null),[j,C]=g.useState(null),E=ve(t,K=>k(K)),[T,z]=g.useState(null),[L,I]=g.useState(null),P=fa(n),[R,W]=g.useState(!1),M=g.useRef(!1);g.useEffect(()=>{if(v)return zy(v)},[v]),cy();const O=g.useCallback(K=>{const[ne,...he]=P().map(me=>me.ref.current),[oe]=he.slice(-1),de=document.activeElement;for(const me of K)if(me===de||(me==null||me.scrollIntoView({block:"nearest"}),me===ne&&j&&(j.scrollTop=0),me===oe&&j&&(j.scrollTop=j.scrollHeight),me==null||me.focus(),document.activeElement!==de))return},[P,j]),$=g.useCallback(()=>O([T,v]),[O,T,v]);g.useEffect(()=>{R&&$()},[R,$]);const{onOpenChange:A,triggerPointerDownPosRef:F}=h;g.useEffect(()=>{if(v){let K={x:0,y:0};const ne=oe=>{var de,me;K={x:Math.abs(Math.round(oe.pageX)-(((de=F.current)==null?void 0:de.x)??0)),y:Math.abs(Math.round(oe.pageY)-(((me=F.current)==null?void 0:me.y)??0))}},he=oe=>{K.x<=10&&K.y<=10?oe.preventDefault():v.contains(oe.target)||A(!1),document.removeEventListener("pointermove",ne),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",he,{capture:!0})}}},[v,A,F]),g.useEffect(()=>{const K=()=>A(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[A]);const[b,V]=Sv(K=>{const ne=P().filter(de=>!de.disabled),he=ne.find(de=>de.ref.current===document.activeElement),oe=bv(ne,K,he);oe&&setTimeout(()=>oe.ref.current.focus())}),Y=g.useCallback((K,ne,he)=>{const oe=!M.current&&!he;(h.value!==void 0&&h.value===ne||oe)&&(z(K),oe&&(M.current=!0))},[h.value]),N=g.useCallback(()=>v==null?void 0:v.focus(),[v]),re=g.useCallback((K,ne,he)=>{const oe=!M.current&&!he;(h.value!==void 0&&h.value===ne||oe)&&I(K)},[h.value]),fe=r==="popper"?Nc:iv,ie=fe===Nc?{side:a,sideOffset:u,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:w,hideWhenDetached:x,avoidCollisions:S}:{};return s.jsx(nv,{scope:n,content:v,viewport:j,onViewportChange:C,itemRefCallback:Y,selectedItem:T,onItemLeave:N,itemTextRefCallback:re,focusSelectedItem:$,selectedItemText:L,position:r,isPositioned:R,searchRef:b,children:s.jsx(Ky,{as:tE,allowPinchZoom:!0,children:s.jsx(Yd,{asChild:!0,trapped:h.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:ee(i,K=>{var ne;(ne=h.trigger)==null||ne.focus({preventScroll:!0}),K.preventDefault()}),children:s.jsx(Qd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:s.jsx(fe,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:K=>K.preventDefault(),...y,...ie,onPlaced:()=>W(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ee(y.onKeyDown,K=>{const ne=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ne&&K.key.length===1&&V(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let oe=P().filter(de=>!de.disabled).map(de=>de.ref.current);if(["ArrowUp","End"].includes(K.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const de=K.target,me=oe.indexOf(de);oe=oe.slice(me+1)}setTimeout(()=>O(oe)),K.preventDefault()}})})})})})})});rv.displayName=eE;var nE="SelectItemAlignedPosition",iv=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=ar(Ar,n),l=ur(Ar,n),[a,u]=g.useState(null),[c,f]=g.useState(null),d=ve(t,E=>f(E)),p=fa(n),m=g.useRef(!1),w=g.useRef(!0),{viewport:x,selectedItem:S,selectedItemText:y,focusSelectedItem:h}=l,v=g.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&x&&S&&y){const E=o.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),z=o.valueNode.getBoundingClientRect(),L=y.getBoundingClientRect();if(o.dir!=="rtl"){const de=L.left-T.left,me=z.left-de,He=E.left-me,rt=E.width+He,Zt=Math.max(rt,T.width),zt=window.innerWidth-Ut,en=As(me,[Ut,Math.max(Ut,zt-Zt)]);a.style.minWidth=rt+"px",a.style.left=en+"px"}else{const de=T.right-L.right,me=window.innerWidth-z.right-de,He=window.innerWidth-E.right-me,rt=E.width+He,Zt=Math.max(rt,T.width),zt=window.innerWidth-Ut,en=As(me,[Ut,Math.max(Ut,zt-Zt)]);a.style.minWidth=rt+"px",a.style.right=en+"px"}const I=p(),P=window.innerHeight-Ut*2,R=x.scrollHeight,W=window.getComputedStyle(c),M=parseInt(W.borderTopWidth,10),O=parseInt(W.paddingTop,10),$=parseInt(W.borderBottomWidth,10),A=parseInt(W.paddingBottom,10),F=M+O+R+A+$,b=Math.min(S.offsetHeight*5,F),V=window.getComputedStyle(x),Y=parseInt(V.paddingTop,10),N=parseInt(V.paddingBottom,10),re=E.top+E.height/2-Ut,fe=P-re,ie=S.offsetHeight/2,K=S.offsetTop+ie,ne=M+O+K,he=F-ne;if(ne<=re){const de=I.length>0&&S===I[I.length-1].ref.current;a.style.bottom="0px";const me=c.clientHeight-x.offsetTop-x.offsetHeight,He=Math.max(fe,ie+(de?N:0)+me+$),rt=ne+He;a.style.height=rt+"px"}else{const de=I.length>0&&S===I[0].ref.current;a.style.top="0px";const He=Math.max(re,M+x.offsetTop+(de?Y:0)+ie)+he;a.style.height=He+"px",x.scrollTop=ne-re+x.offsetTop}a.style.margin=`${Ut}px 0`,a.style.minHeight=b+"px",a.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,a,c,x,S,y,o.dir,r]);tt(()=>v(),[v]);const[k,j]=g.useState();tt(()=>{c&&j(window.getComputedStyle(c).zIndex)},[c]);const C=g.useCallback(E=>{E&&w.current===!0&&(v(),h==null||h(),w.current=!1)},[v,h]);return s.jsx(iE,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:C,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:s.jsx(le.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});iv.displayName=nE;var rE="SelectPopperPosition",Nc=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Ut,...o}=e,l=pa(n);return s.jsx(Zj,{...l,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Nc.displayName=rE;var[iE,lf]=Li(Ar,{}),Cc="SelectViewport",ov=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=ur(Cc,n),l=lf(Cc,n),a=ve(t,o.onViewportChange),u=g.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(da.Slot,{scope:n,children:s.jsx(le.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ee(i.onScroll,c=>{const f=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=l;if(p!=null&&p.current&&d){const m=Math.abs(u.current-f.scrollTop);if(m>0){const w=window.innerHeight-Ut*2,x=parseFloat(d.style.minHeight),S=parseFloat(d.style.height),y=Math.max(x,S);if(y0?k:0,d.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});ov.displayName=Cc;var lv="SelectGroup",[oE,lE]=Li(lv),sv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=qn();return s.jsx(oE,{scope:n,id:i,children:s.jsx(le.div,{role:"group","aria-labelledby":i,...r,ref:t})})});sv.displayName=lv;var av="SelectLabel",uv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=lE(av,n);return s.jsx(le.div,{id:i.id,...r,ref:t})});uv.displayName=av;var Ls="SelectItem",[sE,cv]=Li(Ls),dv=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...l}=e,a=ar(Ls,n),u=ur(Ls,n),c=a.value===r,[f,d]=g.useState(o??""),[p,m]=g.useState(!1),w=ve(t,h=>{var v;return(v=u.itemRefCallback)==null?void 0:v.call(u,h,r,i)}),x=qn(),S=g.useRef("touch"),y=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(sE,{scope:n,value:r,disabled:i,textId:x,isSelected:c,onItemTextChange:g.useCallback(h=>{d(v=>v||((h==null?void 0:h.textContent)??"").trim())},[]),children:s.jsx(da.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:s.jsx(le.div,{role:"option","aria-labelledby":x,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:w,onFocus:ee(l.onFocus,()=>m(!0)),onBlur:ee(l.onBlur,()=>m(!1)),onClick:ee(l.onClick,()=>{S.current!=="mouse"&&y()}),onPointerUp:ee(l.onPointerUp,()=>{S.current==="mouse"&&y()}),onPointerDown:ee(l.onPointerDown,h=>{S.current=h.pointerType}),onPointerMove:ee(l.onPointerMove,h=>{var v;S.current=h.pointerType,i?(v=u.onItemLeave)==null||v.call(u):S.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ee(l.onPointerLeave,h=>{var v;h.currentTarget===document.activeElement&&((v=u.onItemLeave)==null||v.call(u))}),onKeyDown:ee(l.onKeyDown,h=>{var k;((k=u.searchRef)==null?void 0:k.current)!==""&&h.key===" "||(K2.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});dv.displayName=Ls;var no="SelectItemText",fv=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,l=ar(no,n),a=ur(no,n),u=cv(no,n),c=q2(no,n),[f,d]=g.useState(null),p=ve(t,y=>d(y),u.onItemTextChange,y=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,y,u.value,u.disabled)}),m=f==null?void 0:f.textContent,w=g.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:m},u.value),[u.disabled,u.value,m]),{onNativeOptionAdd:x,onNativeOptionRemove:S}=c;return tt(()=>(x(w),()=>S(w)),[x,S,w]),s.jsxs(s.Fragment,{children:[s.jsx(le.span,{id:u.textId,...o,ref:p}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?_i.createPortal(o.children,l.valueNode):null]})});fv.displayName=no;var pv="SelectItemIndicator",mv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return cv(pv,n).isSelected?s.jsx(le.span,{"aria-hidden":!0,...r,ref:t}):null});mv.displayName=pv;var jc="SelectScrollUpButton",hv=g.forwardRef((e,t)=>{const n=ur(jc,e.__scopeSelect),r=lf(jc,e.__scopeSelect),[i,o]=g.useState(!1),l=ve(t,r.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=u.scrollTop>0;o(c)};const u=n.viewport;return a(),u.addEventListener("scroll",a),()=>u.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?s.jsx(xv,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:u}=n;a&&u&&(a.scrollTop=a.scrollTop-u.offsetHeight)}}):null});hv.displayName=jc;var Ec="SelectScrollDownButton",gv=g.forwardRef((e,t)=>{const n=ur(Ec,e.__scopeSelect),r=lf(Ec,e.__scopeSelect),[i,o]=g.useState(!1),l=ve(t,r.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?s.jsx(xv,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:u}=n;a&&u&&(a.scrollTop=a.scrollTop+u.offsetHeight)}}):null});gv.displayName=Ec;var xv=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=ur("SelectScrollButton",n),l=g.useRef(null),a=fa(n),u=g.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return g.useEffect(()=>()=>u(),[u]),tt(()=>{var f;const c=a().find(d=>d.ref.current===document.activeElement);(f=c==null?void 0:c.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),s.jsx(le.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ee(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:ee(i.onPointerMove,()=>{var c;(c=o.onItemLeave)==null||c.call(o),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:ee(i.onPointerLeave,()=>{u()})})}),aE="SelectSeparator",yv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(le.div,{"aria-hidden":!0,...r,ref:t})});yv.displayName=aE;var Pc="SelectArrow",uE=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=pa(n),o=ar(Pc,n),l=ur(Pc,n);return o.open&&l.position==="popper"?s.jsx(e2,{...i,...r,ref:t}):null});uE.displayName=Pc;var cE="SelectBubbleInput",vv=g.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=g.useRef(null),o=ve(r,i),l=Ly(t);return g.useEffect(()=>{const a=i.current;if(!a)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&f){const d=new Event("change",{bubbles:!0});f.call(a,t),a.dispatchEvent(d)}},[l,t]),s.jsx(le.select,{...n,style:{...Oy,...n.style},ref:o,defaultValue:t})});vv.displayName=cE;function wv(e){return e===""||e===void 0}function Sv(e){const t=er(e),n=g.useRef(""),r=g.useRef(0),i=g.useCallback(l=>{const a=n.current+l;t(a),function u(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}(a)},[t]),o=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function bv(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=dE(e,Math.max(o,0));i.length===1&&(l=l.filter(c=>c!==n));const u=l.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function dE(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fE=Qy,kv=Xy,pE=Jy,mE=Zy,hE=ev,Nv=tv,gE=ov,xE=sv,Cv=uv,jv=dv,yE=fv,vE=mv,Ev=hv,Pv=gv,Tv=yv;const Do=fE,fi=xE,zo=pE,ji=g.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(kv,{ref:r,className:ce("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(mE,{asChild:!0,children:s.jsx(Xx,{className:"h-4 w-4 opacity-50"})})]}));ji.displayName=kv.displayName;const Av=g.forwardRef(({className:e,...t},n)=>s.jsx(Ev,{ref:n,className:ce("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(lN,{className:"h-4 w-4"})}));Av.displayName=Ev.displayName;const _v=g.forwardRef(({className:e,...t},n)=>s.jsx(Pv,{ref:n,className:ce("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Xx,{className:"h-4 w-4"})}));_v.displayName=Pv.displayName;const Ei=g.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>s.jsx(hE,{children:s.jsxs(Nv,{ref:i,className:ce("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(Av,{}),s.jsx(gE,{className:ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(_v,{})]})}));Ei.displayName=Nv.displayName;const Sr=g.forwardRef(({className:e,...t},n)=>s.jsx(Cv,{ref:n,className:ce("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Sr.displayName=Cv.displayName;const It=g.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(jv,{ref:r,className:ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(vE,{children:s.jsx(tN,{className:"h-4 w-4"})})}),s.jsx(yE,{children:t})]}));It.displayName=jv.displayName;const wE=g.forwardRef(({className:e,...t},n)=>s.jsx(Tv,{ref:n,className:ce("-mx-1 my-1 h-px bg-muted",e),...t}));wE.displayName=Tv.displayName;var Iv=["PageUp","PageDown"],Rv=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mv={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Oi="Slider",[Tc,SE,bE]=Kd(Oi),[Lv,LR]=sr(Oi,[bE]),[kE,ma]=Lv(Oi),Ov=g.forwardRef((e,t)=>{const{name:n,min:r=0,max:i=100,step:o=1,orientation:l="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:c=[r],value:f,onValueChange:d=()=>{},onValueCommit:p=()=>{},inverted:m=!1,form:w,...x}=e,S=g.useRef(new Set),y=g.useRef(0),v=l==="horizontal"?NE:CE,[k=[],j]=Ci({prop:f,defaultProp:c,onChange:I=>{var R;(R=[...S.current][y.current])==null||R.focus(),d(I)}}),C=g.useRef(k);function E(I){const P=AE(k,I);L(I,P)}function T(I){L(I,y.current)}function z(){const I=C.current[y.current];k[y.current]!==I&&p(k)}function L(I,P,{commit:R}={commit:!1}){const W=ME(o),M=LE(Math.round((I-r)/o)*o+r,W),O=As(M,[r,i]);j(($=[])=>{const A=PE($,O,P);if(RE(A,u*o)){y.current=A.indexOf(O);const F=String(A)!==String($);return F&&R&&p(A),F?A:$}else return $})}return s.jsx(kE,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:i,valueIndexToChangeRef:y,thumbs:S.current,values:k,orientation:l,form:w,children:s.jsx(Tc.Provider,{scope:e.__scopeSlider,children:s.jsx(Tc.Slot,{scope:e.__scopeSlider,children:s.jsx(v,{"aria-disabled":a,"data-disabled":a?"":void 0,...x,ref:t,onPointerDown:ee(x.onPointerDown,()=>{a||(C.current=k)}),min:r,max:i,inverted:m,onSlideStart:a?void 0:E,onSlideMove:a?void 0:T,onSlideEnd:a?void 0:z,onHomeKeyDown:()=>!a&&L(r,0,{commit:!0}),onEndKeyDown:()=>!a&&L(i,k.length-1,{commit:!0}),onStepKeyDown:({event:I,direction:P})=>{if(!a){const M=Iv.includes(I.key)||I.shiftKey&&Rv.includes(I.key)?10:1,O=y.current,$=k[O],A=o*M*P;L($+A,O,{commit:!0})}}})})})})});Ov.displayName=Oi;var[Dv,zv]=Lv(Oi,{startEdge:"left",endEdge:"right",size:"width",direction:1}),NE=g.forwardRef((e,t)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:l,onSlideMove:a,onSlideEnd:u,onStepKeyDown:c,...f}=e,[d,p]=g.useState(null),m=ve(t,v=>p(v)),w=g.useRef(void 0),x=oa(i),S=x==="ltr",y=S&&!o||!S&&o;function h(v){const k=w.current||d.getBoundingClientRect(),j=[0,k.width],E=sf(j,y?[n,r]:[r,n]);return w.current=k,E(v-k.left)}return s.jsx(Dv,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:s.jsx(Fv,{dir:x,"data-orientation":"horizontal",...f,ref:m,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{const k=h(v.clientX);l==null||l(k)},onSlideMove:v=>{const k=h(v.clientX);a==null||a(k)},onSlideEnd:()=>{w.current=void 0,u==null||u()},onStepKeyDown:v=>{const j=Mv[y?"from-left":"from-right"].includes(v.key);c==null||c({event:v,direction:j?-1:1})}})})}),CE=g.forwardRef((e,t)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:a,onStepKeyDown:u,...c}=e,f=g.useRef(null),d=ve(t,f),p=g.useRef(void 0),m=!i;function w(x){const S=p.current||f.current.getBoundingClientRect(),y=[0,S.height],v=sf(y,m?[r,n]:[n,r]);return p.current=S,v(x-S.top)}return s.jsx(Dv,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:s.jsx(Fv,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:x=>{const S=w(x.clientY);o==null||o(S)},onSlideMove:x=>{const S=w(x.clientY);l==null||l(S)},onSlideEnd:()=>{p.current=void 0,a==null||a()},onStepKeyDown:x=>{const y=Mv[m?"from-bottom":"from-top"].includes(x.key);u==null||u({event:x,direction:y?-1:1})}})})}),Fv=g.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:a,onStepKeyDown:u,...c}=e,f=ma(Oi,n);return s.jsx(le.span,{...c,ref:t,onKeyDown:ee(e.onKeyDown,d=>{d.key==="Home"?(l(d),d.preventDefault()):d.key==="End"?(a(d),d.preventDefault()):Iv.concat(Rv).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:ee(e.onPointerDown,d=>{const p=d.target;p.setPointerCapture(d.pointerId),d.preventDefault(),f.thumbs.has(p)?p.focus():r(d)}),onPointerMove:ee(e.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&i(d)}),onPointerUp:ee(e.onPointerUp,d=>{const p=d.target;p.hasPointerCapture(d.pointerId)&&(p.releasePointerCapture(d.pointerId),o(d))})})}),Bv="SliderTrack",$v=g.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,i=ma(Bv,n);return s.jsx(le.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:t})});$v.displayName=Bv;var Ac="SliderRange",Uv=g.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,i=ma(Ac,n),o=zv(Ac,n),l=g.useRef(null),a=ve(t,l),u=i.values.length,c=i.values.map(p=>Wv(p,i.min,i.max)),f=u>1?Math.min(...c):0,d=100-Math.max(...c);return s.jsx(le.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:a,style:{...e.style,[o.startEdge]:f+"%",[o.endEdge]:d+"%"}})});Uv.displayName=Ac;var _c="SliderThumb",Vv=g.forwardRef((e,t)=>{const n=SE(e.__scopeSlider),[r,i]=g.useState(null),o=ve(t,a=>i(a)),l=g.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return s.jsx(jE,{...e,ref:o,index:l})}),jE=g.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:i,...o}=e,l=ma(_c,n),a=zv(_c,n),[u,c]=g.useState(null),f=ve(t,h=>c(h)),d=u?l.form||!!u.closest("form"):!0,p=Ny(u),m=l.values[r],w=m===void 0?0:Wv(m,l.min,l.max),x=TE(r,l.values.length),S=p==null?void 0:p[a.size],y=S?_E(S,w,a.direction):0;return g.useEffect(()=>{if(u)return l.thumbs.add(u),()=>{l.thumbs.delete(u)}},[u,l.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${w}% + ${y}px)`},children:[s.jsx(Tc.ItemSlot,{scope:e.__scopeSlider,children:s.jsx(le.span,{role:"slider","aria-label":e["aria-label"]||x,"aria-valuemin":l.min,"aria-valuenow":m,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:f,style:m===void 0?{display:"none"}:e.style,onFocus:ee(e.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),d&&s.jsx(Hv,{name:i??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:m},r)]})});Vv.displayName=_c;var EE="RadioBubbleInput",Hv=g.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const i=g.useRef(null),o=ve(i,r),l=Ly(t);return g.useEffect(()=>{const a=i.current;if(!a)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&f){const d=new Event("input",{bubbles:!0});f.call(a,t),a.dispatchEvent(d)}},[l,t]),s.jsx(le.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});Hv.displayName=EE;function PE(e=[],t,n){const r=[...e];return r[n]=t,r.sort((i,o)=>i-o)}function Wv(e,t,n){const o=100/(n-t)*(e-t);return As(o,[0,100])}function TE(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function AE(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),r=Math.min(...n);return n.indexOf(r)}function _E(e,t,n){const r=e/2,o=sf([0,50],[0,r]);return(r-o(t)*n)*n}function IE(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function RE(e,t){if(t>0){const n=IE(e);return Math.min(...n)>=t}return!0}function sf(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function ME(e){return(String(e).split(".")[1]||"").length}function LE(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Gv=Ov,OE=$v,DE=Uv,zE=Vv;const Fo=g.forwardRef(({className:e,...t},n)=>s.jsxs(Gv,{ref:n,className:ce("relative flex w-full touch-none select-none items-center",e),...t,children:[s.jsx(OE,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:s.jsx(DE,{className:"absolute h-full bg-primary"})}),s.jsx(zE,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Fo.displayName=Gv.displayName;const af=[{id:"outdoor-rescue",name:"🏔️ Outdoor Rescue",description:"Offline AI that guides survival in extreme environments",category:"Emergency & Safety",tags:["survival","outdoor","emergency","rescue"],icon:"🏔️",model:"Qwen/Qwen3-30B-A3B",systemPrompt:"You are an expert outdoor survival guide and emergency responder. When hikers, travelers, or drivers lose connection in mountains, forests, or rural roads, you provide real-time survival guidance, first aid tips, and emergency signaling advice. You are their reliable voice of calm and safety in extreme environments. Provide step-by-step instructions for survival scenarios, prioritize immediate safety needs, and offer practical solutions using available resources.",temperature:.3,maxTokens:1e3,isOfficial:!0,usageCount:2847,rating:4.9,createdAt:"2024-01-15",author:"EdgeLLM Team"},{id:"offline-healthcare",name:"🏥 Offline Healthcare",description:"A simple device for seniors to access trusted medical guidance",category:"Healthcare",tags:["healthcare","seniors","medical","guidance"],icon:"🏥",model:"Qwen/Qwen3-30B-A3B",systemPrompt:"You are a trusted medical assistant designed specifically for elderly users. You provide clear, step-by-step medical advice through simple voice interactions. Users can press a button or speak a request to get guidance on everyday health concerns. Offer practical, easy-to-understand health advice while always emphasizing when professional medical attention is needed. Keep responses simple, clear, and actionable. No internet required, no accounts needed, no complicated setup.",temperature:.2,maxTokens:800,isOfficial:!0,usageCount:1934,rating:4.8,createdAt:"2024-01-20",author:"EdgeLLM Team"},{id:"ai-companion",name:"🧸 AI Companion",description:"A private, always-available conversational partner",category:"Companion & Support",tags:["companion","emotional support","conversation","private"],icon:"🧸",model:"Qwen/Qwen3-30B-A3B",systemPrompt:"You are a warm, empathetic AI companion designed to provide emotional support and practical assistance. You can be embedded in a plush toy or device to serve as a private, always-available friend. You listen actively, engage in meaningful conversations, tell stories, and provide comfort during stressful or lonely times. You offer warmth, reassurance, and practical help while maintaining complete privacy - all processing stays local without uploading data to the cloud. Be supportive, understanding, and genuinely caring in all interactions.",temperature:.7,maxTokens:1e3,isOfficial:!0,usageCount:3421,rating:4.9,createdAt:"2024-01-25",author:"EdgeLLM Team"}];function FE(){return af.map(e=>({id:e.id,name:e.name.replace(/🏔️|🏥|🧸/g,"").trim(),description:e.description,author:e.author,category:e.category,tags:e.tags,model:e.model,systemPrompt:e.systemPrompt,temperature:e.temperature,maxTokens:e.maxTokens,isOfficial:e.isOfficial,createdAt:e.createdAt,icon:e.icon,usageCount:e.usageCount,rating:e.rating}))}function BE(){return af.map(e=>({name:e.name,prompt:e.systemPrompt}))}const nn={sessions:"edge-llm-sessions",currentSession:"edge-llm-current-session"};function Kv(){return Math.random().toString(36).substring(2)+Date.now().toString(36)}function $E(){return Kv()}class UE{getAllSessions(){const t=localStorage.getItem(nn.sessions);return t?JSON.parse(t):[]}getSession(t){return this.getAllSessions().find(r=>r.id===t)||null}createSession(t,n,r){const i={id:Kv(),title:t||`New Chat ${new Date().toLocaleString()}`,messages:[],model:n,systemPrompt:r,createdAt:Date.now(),updatedAt:Date.now()},o=this.getAllSessions();return o.unshift(i),localStorage.setItem(nn.sessions,JSON.stringify(o)),i}updateSession(t,n){const r=this.getAllSessions(),i=r.findIndex(o=>o.id===t);i!==-1&&(r[i]={...r[i],...n,updatedAt:Date.now()},localStorage.setItem(nn.sessions,JSON.stringify(r)))}deleteSession(t){const r=this.getAllSessions().filter(i=>i.id!==t);localStorage.setItem(nn.sessions,JSON.stringify(r)),this.getCurrentSessionId()===t&&localStorage.removeItem(nn.currentSession)}addMessageToSession(t,n){const r=this.getAllSessions(),i=r.findIndex(o=>o.id===t);if(i!==-1){const o={...n,id:$E(),timestamp:Date.now()};r[i].messages.push(o),r[i].updatedAt=Date.now(),localStorage.setItem(nn.sessions,JSON.stringify(r))}}getCurrentSessionId(){return localStorage.getItem(nn.currentSession)}getCurrentSession(){const t=this.getCurrentSessionId();return t?this.getSession(t):null}setCurrentSession(t){localStorage.setItem(nn.currentSession,t)}clear(){localStorage.removeItem(nn.sessions),localStorage.removeItem(nn.currentSession)}}const Oe=new UE;function Qv(e={}){const{api_endpoint:t=`${window.location.origin}/generate`,defaultModel:n="Qwen/Qwen3-30B-A3B",defaultSystemPrompt:r=""}=e,[i,o]=g.useState([]),[l,a]=g.useState(null),[u,c]=g.useState(""),[f,d]=g.useState({isLoading:!1,error:null}),[p,m]=g.useState(n),[w,x]=g.useState(r),[S,y]=g.useState(.7),[h,v]=g.useState(1024),k=Ht.useMemo(()=>{var O;const M=i.find($=>$.id===l)||null;return console.log("useChat - currentSession updated:",{sessionId:l,found:!!M,messageCount:((O=M==null?void 0:M.messages)==null?void 0:O.length)||0,sessionTitle:(M==null?void 0:M.title)||"No session"}),M},[i,l]),j=Ht.useMemo(()=>{const M=(k==null?void 0:k.messages)||[];return console.log("useChat - messages computed:",M.length,M.map(O=>({id:O.id,role:O.role}))),M},[k==null?void 0:k.messages]);g.useEffect(()=>{const M=Oe.getAllSessions();o(M);const O=Oe.getCurrentSession();O&&a(O.id)},[]);const C=g.useCallback(()=>{const M=Oe.createSession(void 0,p,w),O=Oe.getAllSessions();return o([...O]),a(M.id),Oe.setCurrentSession(M.id),M.id},[p,w]),E=g.useCallback(M=>{console.log("selectSession called with:",M),a(M),Oe.setCurrentSession(M),console.log("currentSessionId updated to:",M)},[]),T=g.useCallback(M=>{Oe.deleteSession(M);const O=Oe.getAllSessions();o([...O]),l===M&&(O.length>0?(a(O[0].id),Oe.setCurrentSession(O[0].id)):a(null))},[l]),z=g.useCallback((M,O)=>{Oe.updateSession(M,{title:O});const $=Oe.getAllSessions();o([...$])},[]),L=g.useCallback(M=>{if(!l)return;Oe.addMessageToSession(l,M);const O=Oe.getAllSessions();o([...O])},[l]),I=g.useCallback(async(M,O)=>{var F,b;if(!u.trim()||f.isLoading)return;let $=l;$||($=C());const A=u.trim();if(c(""),d({isLoading:!0,error:null}),$){Oe.addMessageToSession($,{role:"user",content:A});const V=Oe.getAllSessions();o([...V])}try{const V=Oe.getSession($),Y=((b=(F=V==null?void 0:V.messages)==null?void 0:F.filter(fe=>fe.role!=="system"))==null?void 0:b.map(fe=>({role:fe.role,content:fe.content})))||[],N=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:A,messages:Y,system_prompt:w||null,model_name:p,temperature:S,max_new_tokens:h,use_rag:(O==null?void 0:O.useRag)||!1,retrieval_count:(O==null?void 0:O.retrievalCount)||3})});if(!N.ok){const fe=await N.json();throw new Error(fe.detail||`HTTP error! status: ${N.status}`)}const re=await N.json();if($){Oe.addMessageToSession($,{role:"assistant",content:re.content,thinking_content:re.thinking_content,model_used:re.model_used,supports_thinking:re.supports_thinking,assistantInfo:M});const fe=Oe.getAllSessions();o([...fe])}d({isLoading:!1,error:null})}catch(V){const Y=V instanceof Error?V.message:"An error occurred";if(d({isLoading:!1,error:Y}),$){Oe.addMessageToSession($,{role:"assistant",content:`Sorry, I encountered an error: ${Y}`,assistantInfo:M});const N=Oe.getAllSessions();o([...N])}}},[u,f.isLoading,l,C,L,w,j.length,t,p,S,h]),P=g.useCallback(()=>{d({isLoading:!1,error:null})},[]),R=g.useCallback(()=>{Oe.clear(),o([]),a(null)},[]),W=g.useCallback(()=>{a(null),localStorage.removeItem("edge-llm-current-session")},[]);return{sessions:i,currentSession:k,currentSessionId:l,createNewSession:C,selectSession:E,deleteSession:T,renameSession:z,clearAllSessions:R,clearCurrentSession:W,messages:j,input:u,setInput:c,sendMessage:I,stopGeneration:P,isLoading:f.isLoading,error:f.error,selectedModel:p,setSelectedModel:m,systemPrompt:w,setSystemPrompt:x,temperature:S,setTemperature:y,maxTokens:h,setMaxTokens:v}}function Yv({isLoading:e,ragEnabled:t,setRagEnabled:n,retrievalCount:r,setRetrievalCount:i,currentAssistant:o}){const[l,a]=g.useState([]),[u,c]=g.useState(!1);g.useEffect(()=>{(async()=>{if(!o){a([]);return}try{const m=await fetch("/rag/documents");if(m.ok){const w=await m.json();if(w.documents){const x=Object.entries(w.documents).map(([S,y])=>({id:S,name:y.filename,size:0,type:y.file_type,uploadedAt:new Date().toISOString(),status:y.status,chunks:y.chunks,assistantId:y.assistant_id||null}));a(x)}}}catch(m){console.error("Error loading documents:",m)}})()},[o]);const f=async p=>{const m=p.target.files;if(!(!m||!o)){c(!0);try{const w=new FormData;w.append("assistant_id",o.id);for(const S of Array.from(m))w.append("files",S);const x=await fetch("/rag/upload",{method:"POST",body:w});if(x.ok){const S=await x.json(),y=S.results.filter(v=>v.success).map(v=>({id:v.doc_id,name:v.filename,size:0,type:"processed",uploadedAt:new Date().toISOString(),status:"processed",chunks:v.chunks,assistantId:o==null?void 0:o.id}));a(v=>[...v,...y]);const h=S.results.filter(v=>!v.success);h.length>0&&console.error("Some files failed to upload:",h)}else console.error("Upload failed:",x.statusText);p.target.value=""}catch(w){console.error("File upload error:",w)}finally{c(!1)}}},d=async p=>{try{const m=await fetch(`/rag/documents/${p}`,{method:"DELETE"});m.ok?a(w=>w.filter(x=>x.id!==p)):console.error("Failed to delete document:",m.statusText)}catch(m){console.error("Error deleting document:",m),a(w=>w.filter(x=>x.id!==p))}};return s.jsx("div",{className:"space-y-4 pb-6",children:o?s.jsxs(Ie,{children:[s.jsx(Mt,{children:s.jsxs(Lt,{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vd,{className:"h-4 w-4 text-blue-600"}),s.jsx("span",{children:o.name}),s.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${o.type==="user"?"bg-blue-100 text-blue-700":o.type==="template"?"bg-gray-100 text-gray-700":"bg-green-100 text-green-700"}`,children:o.type==="user"?"My Assistant":o.type==="template"?"Template":"New Assistant"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Te,{className:"text-xs text-muted-foreground",children:"RAG"}),s.jsx("input",{type:"checkbox",checked:t,onChange:p=>n(p.target.checked),className:"rounded",disabled:e||l.length===0}),t&&l.length>0&&s.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[s.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),s.jsx("span",{className:"text-xs font-medium",children:"Active"})]})]})]})}),s.jsxs(Ye,{className:"space-y-4",children:[t&&s.jsxs("div",{className:"border-l-2 border-blue-200 pl-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Te,{className:"text-xs font-medium",children:"Retrieval Depth"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[r," chunks"]})]}),s.jsx(Fo,{value:[r],onValueChange:p=>i(p[0]),max:10,min:1,step:1,className:"w-full"})]}),s.jsxs("div",{className:"border-2 border-dashed border-gray-200 rounded-lg p-4 text-center hover:border-gray-300 transition-colors",children:[s.jsx("input",{type:"file",id:"file-upload",multiple:!0,accept:".pdf,.txt,.docx,.md",onChange:f,className:"hidden",disabled:u||e}),s.jsxs(Te,{htmlFor:"file-upload",className:"cursor-pointer flex flex-col items-center space-y-2",children:[s.jsx(UN,{className:"h-6 w-6 text-gray-400"}),s.jsx("span",{className:"text-sm",children:u?"Uploading...":"Drop files or click to upload"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"PDF, TXT, DOCX, MD supported"})]})]}),l.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(Te,{className:"text-sm font-medium",children:["Documents (",l.length,")"]}),t&&s.jsxs("span",{className:"text-xs text-green-600",children:["Using ",Math.min(r,l.length)," for context"]})]}),s.jsx("div",{className:"space-y-1",children:l.map(p=>s.jsxs("div",{className:"flex items-center justify-between p-2 border rounded bg-gray-50/50 hover:bg-gray-50",children:[s.jsxs("div",{className:"flex items-center space-x-2 flex-1 min-w-0",children:[s.jsx(gN,{className:"h-3 w-3 text-blue-600 flex-shrink-0"}),s.jsx("span",{className:"text-sm truncate",children:p.name}),p.chunks&&s.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:[p.chunks," chunks"]})]}),s.jsx(J,{size:"sm",variant:"ghost",onClick:()=>d(p.id),disabled:e,className:"h-6 w-6 p-0 text-red-500 hover:text-red-600 hover:bg-red-50",children:s.jsx(ry,{className:"h-3 w-3"})})]},p.id))})]}),l.length===0&&s.jsx("div",{className:"text-center py-3",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"No documents uploaded yet"})})]})]}):s.jsx(Ie,{children:s.jsxs(Ye,{className:"pt-6 text-center",children:[s.jsx(ra,{className:"h-8 w-8 text-muted-foreground mx-auto mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an assistant to manage documents"})]})})})}function VE(){const e=Lr(),[t,n]=g.useState(1),[r,i]=g.useState({assistantId:"",model:"Qwen/Qwen3-30B-A3B",temperature:.7,maxTokens:1024,role:"",goal:"",description:"",document:""}),[o,l]=g.useState(!1),[a,u]=g.useState(3),[c,f]=g.useState(null),{currentSession:d,createNewSession:p,sendMessage:m,isLoading:w,setSystemPrompt:x,setTemperature:S,setMaxTokens:y,setSelectedModel:h,input:v,setInput:k}=Qv(),j=af,C=(d==null?void 0:d.messages)||[],E=P=>{const R=j.find(W=>W.id===P);R&&(i(W=>({...W,assistantId:P,model:R.model,temperature:R.temperature,maxTokens:R.maxTokens,role:R.description,goal:R.category,description:R.systemPrompt})),h(R.model),x(R.systemPrompt),S(R.temperature),y(R.maxTokens),f({id:P,name:R.name,type:"template"}))};g.useEffect(()=>{h(r.model),x(r.description),S(r.temperature),y(r.maxTokens)},[r,h,x,S,y]);const T=()=>s.jsxs("div",{className:"flex items-center justify-between mb-8 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center",children:[s.jsxs("div",{className:`flex items-center ${t>=1?"text-purple-600":"text-gray-400"}`,children:[s.jsx("div",{className:`w-8 h-8 rounded-full border-2 flex items-center justify-center text-sm font-medium ${t>=1?"bg-purple-600 text-white border-purple-600":"border-gray-300"}`,children:"1"}),s.jsx("span",{className:"ml-2 font-medium",children:"Configuration"})]}),s.jsx("div",{className:`w-32 h-0.5 mx-4 ${t>=2?"bg-purple-600":"bg-gray-300"}`})]}),s.jsxs("div",{className:"flex items-center",children:[s.jsxs("div",{className:`flex items-center ${t>=2?"text-purple-600":"text-gray-400"}`,children:[s.jsx("div",{className:`w-8 h-8 rounded-full border-2 flex items-center justify-center text-sm font-medium ${t>=2?"bg-purple-600 text-white border-purple-600":"border-gray-300"}`,children:"2"}),s.jsx("span",{className:"ml-2 font-medium",children:"Test performance"})]}),s.jsx("div",{className:`w-32 h-0.5 mx-4 ${t>=3?"bg-purple-600":"bg-gray-300"}`})]}),s.jsxs("div",{className:"flex items-center",children:[s.jsxs("div",{className:`flex items-center ${t>=3?"text-purple-600":"text-gray-400"}`,children:[s.jsx("div",{className:`w-8 h-8 rounded-full border-2 flex items-center justify-center text-sm font-medium ${t>=3?"bg-purple-600 text-white border-purple-600":"border-gray-300"}`,children:"3"}),s.jsx("span",{className:"ml-2 font-medium",children:"Connect to device"})]}),s.jsx(J,{className:"ml-8 bg-purple-600 hover:bg-purple-700 text-white px-8",onClick:()=>n(3),disabled:t<2,children:"Connect"})]})]}),z=()=>s.jsx("div",{className:"max-w-2xl mx-auto",children:s.jsx(Ie,{className:"p-8",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Load Assistant"}),s.jsxs(Do,{onValueChange:E,value:r.assistantId,children:[s.jsx(ji,{children:s.jsx(zo,{placeholder:"Select an assistant"})}),s.jsx(Ei,{children:j.map(P=>s.jsx(It,{value:P.id,children:P.name},P.id))})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Parameters"}),s.jsxs("div",{className:"mb-4",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Select a model"}),s.jsxs(Do,{value:r.model,onValueChange:P=>i(R=>({...R,model:P})),children:[s.jsx(ji,{children:s.jsx(zo,{})}),s.jsxs(Ei,{children:[s.jsx(It,{value:"Qwen/Qwen3-30B-A3B",children:"Qwen3-30B-A3B"}),s.jsx(It,{value:"Qwen/Qwen2.5-32B-Instruct",children:"Qwen2.5-32B-Instruct"}),s.jsx(It,{value:"deepseek-ai/DeepSeek-V2.5",children:"DeepSeek-V2.5"})]})]})]}),s.jsxs("div",{className:"mb-4",children:[s.jsxs(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:["Temperature: ",r.temperature]}),s.jsx(Fo,{value:[r.temperature],onValueChange:P=>i(R=>({...R,temperature:P[0]})),max:1,min:0,step:.1,className:"w-full"})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Max Tokens"}),s.jsx(ni,{type:"number",value:r.maxTokens,onChange:P=>i(R=>({...R,maxTokens:parseInt(P.target.value)||1024})),min:1,max:4096})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Description"}),s.jsxs("div",{className:"mb-4",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Which role do you want your assistant to be? (Senior data researcher, journalist, lawyer, etc.)"}),s.jsx(ni,{value:r.role,onChange:P=>i(R=>({...R,role:P.target.value})),placeholder:"e.g., Senior data researcher, journalist, lawyer"})]}),s.jsxs("div",{className:"mb-4",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Which goal would you expect your assistant to achieve"}),s.jsx(ni,{value:r.goal,onChange:P=>i(R=>({...R,goal:P.target.value})),placeholder:"Describe the main goal or objective"})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Description (Tasks, outputs)"}),s.jsx(Gd,{value:r.description,onChange:P=>i(R=>({...R,description:P.target.value})),placeholder:"Describe the tasks and expected outputs...",rows:4})]})]}),s.jsxs("div",{children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Documents & Knowledge Base"}),s.jsx(Yv,{isLoading:w,ragEnabled:o,setRagEnabled:l,retrievalCount:a,setRetrievalCount:u,currentAssistant:c})]}),s.jsx(J,{onClick:()=>n(2),className:"w-full bg-purple-600 hover:bg-purple-700 text-white",disabled:!r.assistantId,children:"Continue to Test Performance"})]})})}),L=()=>{var P;return s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-[600px]",children:[s.jsx("div",{className:"lg:col-span-1",children:s.jsxs(Ie,{className:"h-full p-4",children:[s.jsx("h3",{className:"font-semibold mb-4",children:"Chat sessions"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(J,{variant:"ghost",className:"w-full justify-start text-left",onClick:p,children:"New Chat"}),C.length>0&&s.jsxs("div",{className:"p-2 bg-gray-50 rounded text-sm",children:["Current Session (",C.length," messages)"]})]})]})}),s.jsx("div",{className:"lg:col-span-3",children:s.jsxs(Ie,{className:"h-full flex flex-col",children:[s.jsx("div",{className:"p-4 border-b",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"font-semibold",children:"Test Performance"}),s.jsx(xe,{variant:"secondary",children:r.assistantId?(P=j.find(R=>R.id===r.assistantId))==null?void 0:P.name.replace(/🏔️|🏥|🧸/g,"").trim():"No Assistant"})]})}),s.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[C.length===0?s.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"mb-2",children:"Start testing your assistant configuration"}),s.jsx("p",{className:"text-sm",children:"Send a message to see how your assistant responds"})]})}):C.map((R,W)=>s.jsx("div",{className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:s.jsx("div",{className:`max-w-[80%] p-3 rounded-lg ${R.role==="user"?"bg-purple-600 text-white":"bg-gray-100 text-gray-900"}`,children:s.jsx("p",{className:"whitespace-pre-wrap",children:R.content})})},W)),w&&s.jsx("div",{className:"flex justify-start",children:s.jsx("div",{className:"bg-gray-100 p-3 rounded-lg",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce"}),s.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),s.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})})]}),s.jsx("div",{className:"p-4 border-t",children:s.jsxs("div",{className:"flex space-x-2",children:[s.jsx(ni,{placeholder:"Type your message...",value:v,onChange:R=>k(R.target.value),onKeyPress:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),v.trim()&&m(void 0,{useRag:o,retrievalCount:a}))}}),s.jsx(J,{onClick:()=>{v.trim()&&m(void 0,{useRag:o,retrievalCount:a})},disabled:w,className:"bg-purple-600 hover:bg-purple-700",children:"Send"})]})})]})})]}),s.jsxs("div",{className:"mt-6 flex justify-between max-w-6xl mx-auto",children:[s.jsx(J,{variant:"outline",onClick:()=>n(1),children:"Back to Configuration"}),s.jsx(J,{onClick:()=>n(3),className:"bg-purple-600 hover:bg-purple-700 text-white",children:"Continue to Connect Device"})]})]})},I=()=>{var P;return s.jsx("div",{className:"max-w-2xl mx-auto",children:s.jsxs(Ie,{className:"p-8 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("svg",{className:"w-8 h-8 text-purple-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.212 0"})})}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Connect to Device"}),s.jsx("p",{className:"text-gray-600",children:"Your assistant configuration is ready to be deployed to your edge device."})]}),s.jsxs("div",{className:"space-y-4 text-left mb-8",children:[s.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[s.jsx("h3",{className:"font-semibold mb-2",children:"Configuration Summary"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Assistant:"})," ",((P=j.find(R=>R.id===r.assistantId))==null?void 0:P.name.replace(/🏔️|🏥|🧸/g,"").trim())||"None"]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Model:"})," ",r.model]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Temperature:"})," ",r.temperature]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Max Tokens:"})," ",r.maxTokens]}),r.role&&s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Role:"})," ",r.role]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"RAG Enabled:"})," ",o?"Yes":"No"]}),o&&s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Retrieval Count:"})," ",a]})]})]}),s.jsx("div",{className:"bg-blue-50 p-4 rounded-lg border border-blue-200",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("svg",{className:"w-5 h-5 text-blue-600 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),s.jsxs("p",{className:"text-blue-800 text-sm",children:[s.jsx("span",{className:"font-medium",children:"Ready to deploy:"})," Your assistant configuration has been optimized for edge deployment."]})]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(J,{className:"w-full bg-purple-600 hover:bg-purple-700 text-white py-3",children:"Deploy to Edge Device"}),s.jsx(J,{variant:"outline",className:"w-full",onClick:()=>n(2),children:"Back to Testing"})]})]})})};return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("header",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex items-center justify-between h-16",children:[s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx("img",{src:"/assets/logo.png",alt:"Huoxu Logo",className:"h-10 w-auto",onError:P=>{console.error("Logo failed to load"),P.currentTarget.style.display="none"}})}),s.jsxs("nav",{className:"flex space-x-8",children:[s.jsx("button",{onClick:()=>e("/"),className:"text-gray-600 hover:text-gray-900 px-3 py-2 text-sm font-medium",children:"Home"}),s.jsx("button",{onClick:()=>e("/technology"),className:"text-gray-600 hover:text-gray-900 px-3 py-2 text-sm font-medium",children:"Technology"}),s.jsx("button",{onClick:()=>e("/usecases"),className:"text-gray-600 hover:text-gray-900 px-3 py-2 text-sm font-medium",children:"Use Case"}),s.jsx("button",{className:"bg-purple-600 text-white px-4 py-2 text-sm font-medium rounded",children:"My Device"})]})]})})}),s.jsxs("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[T(),t===1&&z(),t===2&&L(),t===3&&I()]})]})}function HE(){return FE()}function WE(){const e=Lr(),[t,n]=g.useState(!1),[r]=g.useState(HE()),[i,o]=g.useState([]),[l,a]=g.useState(""),[u,c]=g.useState("All");g.useEffect(()=>{f(),d()},[]);const f=async()=>{try{const h=`${window.location.protocol}//${window.location.host}`,v=await fetch(`${h}/models`);n(v.ok)}catch{n(!1)}},d=()=>{try{const h=JSON.parse(localStorage.getItem("likedTemplates")||"[]");o(h)}catch(h){console.error("Failed to load liked templates:",h)}},p=h=>{const v=i.includes(h)?i.filter(k=>k!==h):[...i,h];o(v),localStorage.setItem("likedTemplates",JSON.stringify(v))},m=h=>{const v={name:h.name,description:h.description,model:h.model,systemPrompt:h.systemPrompt,temperature:h.temperature,maxTokens:h.maxTokens};localStorage.setItem("loadAssistantConfig",JSON.stringify(v)),e("/playground")},w=r.filter(h=>{const v=h.name.toLowerCase().includes(l.toLowerCase())||h.description.toLowerCase().includes(l.toLowerCase())||h.tags.some(j=>j.toLowerCase().includes(l.toLowerCase())),k=u==="All"||h.category===u;return v&&k}),x=w.filter(h=>h.isOfficial),S=[...w].sort((h,v)=>v.usageCount-h.usageCount).slice(0,6),y=["All",...Array.from(new Set(r.map(h=>h.category)))];return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx("div",{className:"sticky top-0 z-40 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:s.jsx("div",{className:"max-w-6xl mx-auto px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center",children:s.jsx(Er,{className:"h-5 w-5 text-white"})}),s.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Assistant Templates"}),s.jsx(xe,{variant:t?"default":"secondary",className:"text-xs",children:t?"Online":"Offline"})]})}),s.jsxs(J,{onClick:()=>e("/playground"),className:"flex items-center gap-2",children:[s.jsx(ti,{className:"h-4 w-4"}),"Create Assistant"]})]})})}),s.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Explore AI Assistants"}),s.jsx("p",{className:"text-lg text-gray-600 max-w-2xl mx-auto mb-8",children:"Discover, customize and deploy specialized AI assistants. Start with proven templates or build from scratch."}),s.jsxs("div",{className:"relative max-w-2xl mx-auto mb-8",children:[s.jsx(Zp,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),s.jsx(ni,{type:"text",placeholder:"Search assistants...",value:l,onChange:h=>a(h.target.value),className:"pl-12 pr-4 py-3 text-lg rounded-full border-2 border-gray-200 focus:border-blue-500"})]}),s.jsx("div",{className:"flex flex-wrap justify-center gap-2 mb-8",children:y.map(h=>s.jsx(J,{variant:u===h?"default":"outline",size:"sm",onClick:()=>c(h),className:"rounded-full",children:h},h))})]}),u==="All"&&x.length>0&&s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx(qx,{className:"h-5 w-5 text-yellow-600"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Featured"}),s.jsx(xe,{variant:"secondary",className:"text-xs",children:"Curated by EdgeLLM Team"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:x.slice(0,3).map(h=>s.jsx(ou,{template:h,isLiked:i.includes(h.id),onLike:()=>p(h.id),onUse:()=>m(h),featured:!0},h.id))})]}),u==="All"&&s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx(ny,{className:"h-5 w-5 text-green-600"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Trending"}),s.jsx(xe,{variant:"secondary",className:"text-xs",children:"Most popular this week"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:S.slice(0,6).map(h=>s.jsx(ou,{template:h,isLiked:i.includes(h.id),onLike:()=>p(h.id),onUse:()=>m(h),trending:!0},h.id))})]}),s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx(WN,{className:"h-5 w-5 text-blue-600"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:u==="All"?"All Templates":u}),s.jsxs(xe,{variant:"outline",className:"text-xs",children:[w.length," available"]})]}),w.length>0?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:w.map(h=>s.jsx(ou,{template:h,isLiked:i.includes(h.id),onLike:()=>p(h.id),onUse:()=>m(h)},h.id))}):s.jsx(Ie,{className:"p-12 text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx(Zp,{className:"h-12 w-12 text-gray-400"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No templates found"}),s.jsx("p",{className:"text-gray-600",children:"Try adjusting your search or category filters"})]}),s.jsx(J,{variant:"outline",onClick:()=>{a(""),c("All")},children:"Clear filters"})]})})]})]})]})}function ou({template:e,isLiked:t,onLike:n,onUse:r,featured:i=!1,trending:o=!1}){return s.jsxs(Ie,{className:"group hover:shadow-xl transition-all duration-300 hover:-translate-y-1 border-2 hover:border-blue-200 relative",children:[i&&s.jsxs("div",{className:"absolute -top-2 -right-2 bg-yellow-500 text-white text-xs px-2 py-1 rounded-full font-medium flex items-center gap-1",children:[s.jsx(qx,{className:"h-3 w-3"}),"Featured"]}),o&&s.jsxs("div",{className:"absolute -top-2 -right-2 bg-green-500 text-white text-xs px-2 py-1 rounded-full font-medium flex items-center gap-1",children:[s.jsx(ny,{className:"h-3 w-3"}),"Trending"]}),s.jsx(Mt,{className:"pb-4",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl flex items-center justify-center text-2xl",children:e.icon}),s.jsxs("div",{children:[s.jsx(Lt,{className:"text-lg group-hover:text-blue-600 transition-colors",children:e.name}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsxs("p",{className:"text-sm text-blue-600 font-medium",children:["by ",e.author]}),e.isOfficial&&s.jsxs(xe,{variant:"default",className:"text-xs px-2 py-0 bg-blue-600",children:[s.jsx(Qk,{className:"h-3 w-3 mr-1"}),"Official"]})]})]})]}),s.jsx(J,{variant:"ghost",size:"sm",onClick:n,className:`${t?"text-red-500":"text-gray-400 hover:text-red-500"} transition-colors`,title:t?"Unlike":"Like",children:s.jsx(vN,{className:`h-4 w-4 ${t?"fill-current":""}`})})]})}),s.jsxs(Ye,{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-gray-600 line-clamp-2 leading-relaxed",children:e.description}),s.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.slice(0,3).map(l=>s.jsx(xe,{variant:"secondary",className:"text-xs bg-gray-100 hover:bg-gray-200 transition-colors",children:l},l))}),s.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(mN,{className:"h-4 w-4"}),s.jsx("span",{children:e.usageCount.toLocaleString()})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(zN,{className:"h-4 w-4 text-yellow-500 fill-current"}),s.jsx("span",{children:e.rating})]})]}),s.jsx(xe,{variant:"outline",className:"text-xs",children:e.category})]}),s.jsx("div",{className:"pt-2",children:s.jsxs(J,{onClick:r,className:"w-full group-hover:bg-blue-600 group-hover:text-white transition-all",variant:"outline",children:[s.jsx(ia,{className:"h-4 w-4 mr-2"}),"Build Assistant"]})})]})]})}var lu="rovingFocusGroup.onEntryFocus",GE={bubbles:!1,cancelable:!0},Yo="RovingFocusGroup",[Ic,Xv,KE]=Kd(Yo),[QE,qv]=sr(Yo,[KE]),[YE,XE]=QE(Yo),Jv=g.forwardRef((e,t)=>s.jsx(Ic.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Ic.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(qE,{...e,ref:t})})}));Jv.displayName=Yo;var qE=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:c,preventScrollOnEntryFocus:f=!1,...d}=e,p=g.useRef(null),m=ve(t,p),w=oa(o),[x,S]=Ci({prop:l,defaultProp:a??null,onChange:u,caller:Yo}),[y,h]=g.useState(!1),v=er(c),k=Xv(n),j=g.useRef(!1),[C,E]=g.useState(0);return g.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(lu,v),()=>T.removeEventListener(lu,v)},[v]),s.jsx(YE,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:x,onItemFocus:g.useCallback(T=>S(T),[S]),onItemShiftTab:g.useCallback(()=>h(!0),[]),onFocusableItemAdd:g.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:g.useCallback(()=>E(T=>T-1),[]),children:s.jsx(le.div,{tabIndex:y||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{j.current=!0}),onFocus:ee(e.onFocus,T=>{const z=!j.current;if(T.target===T.currentTarget&&z&&!y){const L=new CustomEvent(lu,GE);if(T.currentTarget.dispatchEvent(L),!L.defaultPrevented){const I=k().filter(O=>O.focusable),P=I.find(O=>O.active),R=I.find(O=>O.id===x),M=[P,R,...I].filter(Boolean).map(O=>O.ref.current);t0(M,f)}}j.current=!1}),onBlur:ee(e.onBlur,()=>h(!1))})})}),Zv="RovingFocusGroupItem",e0=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:l,...a}=e,u=qn(),c=o||u,f=XE(Zv,n),d=f.currentTabStopId===c,p=Xv(n),{onFocusableItemAdd:m,onFocusableItemRemove:w,currentTabStopId:x}=f;return g.useEffect(()=>{if(r)return m(),()=>w()},[r,m,w]),s.jsx(Ic.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:s.jsx(le.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:ee(e.onMouseDown,S=>{r?f.onItemFocus(c):S.preventDefault()}),onFocus:ee(e.onFocus,()=>f.onItemFocus(c)),onKeyDown:ee(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const y=eP(S,f.orientation,f.dir);if(y!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let v=p().filter(k=>k.focusable).map(k=>k.ref.current);if(y==="last")v.reverse();else if(y==="prev"||y==="next"){y==="prev"&&v.reverse();const k=v.indexOf(S.currentTarget);v=f.loop?tP(v,k+1):v.slice(k+1)}setTimeout(()=>t0(v))}}),children:typeof l=="function"?l({isCurrentTabStop:d,hasTabStop:x!=null}):l})})});e0.displayName=Zv;var JE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZE(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function eP(e,t,n){const r=ZE(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return JE[r]}function t0(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function tP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var nP=Jv,rP=e0;function iP(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Xo=e=>{const{present:t,children:n}=e,r=oP(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),o=ve(r.ref,lP(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:o}):null};Xo.displayName="Presence";function oP(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),o=g.useRef("none"),l=e?"mounted":"unmounted",[a,u]=iP(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Cl(r.current);o.current=a==="mounted"?c:"none"},[a]),tt(()=>{const c=r.current,f=i.current;if(f!==e){const p=o.current,m=Cl(c);e?u("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),tt(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,d=m=>{const x=Cl(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&x&&(u("ANIMATION_END"),!i.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},p=m=>{m.target===t&&(o.current=Cl(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Cl(e){return(e==null?void 0:e.animationName)||"none"}function lP(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ha="Tabs",[sP,OR]=sr(ha,[qv]),n0=qv(),[aP,uf]=sP(ha),r0=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:l="horizontal",dir:a,activationMode:u="automatic",...c}=e,f=oa(a),[d,p]=Ci({prop:r,onChange:i,defaultProp:o??"",caller:ha});return s.jsx(aP,{scope:n,baseId:qn(),value:d,onValueChange:p,orientation:l,dir:f,activationMode:u,children:s.jsx(le.div,{dir:f,"data-orientation":l,...c,ref:t})})});r0.displayName=ha;var i0="TabsList",o0=g.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=uf(i0,n),l=n0(n);return s.jsx(nP,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:r,children:s.jsx(le.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});o0.displayName=i0;var l0="TabsTrigger",s0=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,l=uf(l0,n),a=n0(n),u=c0(l.baseId,r),c=d0(l.baseId,r),f=r===l.value;return s.jsx(rP,{asChild:!0,...a,focusable:!i,active:f,children:s.jsx(le.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":c,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...o,ref:t,onMouseDown:ee(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?l.onValueChange(r):d.preventDefault()}),onKeyDown:ee(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&l.onValueChange(r)}),onFocus:ee(e.onFocus,()=>{const d=l.activationMode!=="manual";!f&&!i&&d&&l.onValueChange(r)})})})});s0.displayName=l0;var a0="TabsContent",u0=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...l}=e,a=uf(a0,n),u=c0(a.baseId,r),c=d0(a.baseId,r),f=r===a.value,d=g.useRef(f);return g.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),s.jsx(Xo,{present:i||f,children:({present:p})=>s.jsx(le.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!p,id:c,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&o})})});u0.displayName=a0;function c0(e,t){return`${e}-trigger-${t}`}function d0(e,t){return`${e}-content-${t}`}var uP=r0,f0=o0,p0=s0,m0=u0;const cP=uP,h0=g.forwardRef(({className:e,...t},n)=>s.jsx(f0,{ref:n,className:ce("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));h0.displayName=f0.displayName;const Hl=g.forwardRef(({className:e,...t},n)=>s.jsx(p0,{ref:n,className:ce("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Hl.displayName=p0.displayName;const Wl=g.forwardRef(({className:e,...t},n)=>s.jsx(m0,{ref:n,className:ce("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Wl.displayName=m0.displayName;var ga="Dialog",[g0,x0]=sr(ga),[dP,Jt]=g0(ga),y0=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,a=g.useRef(null),u=g.useRef(null),[c,f]=Ci({prop:r,defaultProp:i??!1,onChange:o,caller:ga});return s.jsx(dP,{scope:t,triggerRef:a,contentRef:u,contentId:qn(),titleId:qn(),descriptionId:qn(),open:c,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(d=>!d),[f]),modal:l,children:n})};y0.displayName=ga;var v0="DialogTrigger",w0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(v0,n),o=ve(t,i.triggerRef);return s.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ff(i.open),...r,ref:o,onClick:ee(e.onClick,i.onOpenToggle)})});w0.displayName=v0;var cf="DialogPortal",[fP,S0]=g0(cf,{forceMount:void 0}),b0=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Jt(cf,t);return s.jsx(fP,{scope:t,forceMount:n,children:g.Children.map(r,l=>s.jsx(Xo,{present:n||o.open,children:s.jsx(of,{asChild:!0,container:i,children:l})}))})};b0.displayName=cf;var Os="DialogOverlay",k0=g.forwardRef((e,t)=>{const n=S0(Os,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Jt(Os,e.__scopeDialog);return o.modal?s.jsx(Xo,{present:r||o.open,children:s.jsx(mP,{...i,ref:t})}):null});k0.displayName=Os;var pP=ki("DialogOverlay.RemoveScroll"),mP=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(Os,n);return s.jsx(Ky,{as:pP,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(le.div,{"data-state":ff(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),_r="DialogContent",N0=g.forwardRef((e,t)=>{const n=S0(_r,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Jt(_r,e.__scopeDialog);return s.jsx(Xo,{present:r||o.open,children:o.modal?s.jsx(hP,{...i,ref:t}):s.jsx(gP,{...i,ref:t})})});N0.displayName=_r;var hP=g.forwardRef((e,t)=>{const n=Jt(_r,e.__scopeDialog),r=g.useRef(null),i=ve(t,n.contentRef,r);return g.useEffect(()=>{const o=r.current;if(o)return zy(o)},[]),s.jsx(C0,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0;(l.button===2||a)&&o.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,o=>o.preventDefault())})}),gP=g.forwardRef((e,t)=>{const n=Jt(_r,e.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return s.jsx(C0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var u,c;(u=e.onInteractOutside)==null||u.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),C0=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...l}=e,a=Jt(_r,n),u=g.useRef(null),c=ve(t,u);return cy(),s.jsxs(s.Fragment,{children:[s.jsx(Yd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:s.jsx(Qd,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ff(a.open),...l,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(yP,{titleId:a.titleId}),s.jsx(wP,{contentRef:u,descriptionId:a.descriptionId})]})]})}),df="DialogTitle",j0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(df,n);return s.jsx(le.h2,{id:i.titleId,...r,ref:t})});j0.displayName=df;var E0="DialogDescription",P0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(E0,n);return s.jsx(le.p,{id:i.descriptionId,...r,ref:t})});P0.displayName=E0;var T0="DialogClose",A0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(T0,n);return s.jsx(le.button,{type:"button",...r,ref:t,onClick:ee(e.onClick,()=>i.onOpenChange(!1))})});A0.displayName=T0;function ff(e){return e?"open":"closed"}var _0="DialogTitleWarning",[xP,I0]=pC(_0,{contentName:_r,titleName:df,docsSlug:"dialog"}),yP=({titleId:e})=>{const t=I0(_0),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},U2=0,$r=[];function V2(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(U2++)[0],o=g.useState(Uy)[0],l=g.useRef(e);g.useEffect(function(){l.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var x=c2([e.lockRef.current],(e.shards||[]).map(Em),!0).filter(Boolean);return x.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(x,S){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!l.current.allowPinchZoom;var y=Nl(x),h=n.current,v="deltaX"in x?x.deltaX:h[0]-y[0],k="deltaY"in x?x.deltaY:h[1]-y[1],j,C=x.target,E=Math.abs(v)>Math.abs(k)?"h":"v";if("touches"in x&&E==="h"&&C.type==="range")return!1;var T=Cm(E,C);if(!T)return!0;if(T?j=E:(j=E==="v"?"h":"v",T=Cm(E,C)),!T)return!1;if(!r.current&&"changedTouches"in x&&(v||k)&&(r.current=j),!j)return!0;var z=r.current||j;return F2(z,S,x,z==="h"?v:k,!0)},[]),u=g.useCallback(function(x){var S=x;if(!(!$r.length||$r[$r.length-1]!==o)){var y="deltaY"in S?jm(S):Nl(S),h=t.current.filter(function(j){return j.name===S.type&&(j.target===S.target||S.target===j.shadowParent)&&B2(j.delta,y)})[0];if(h&&h.should){S.cancelable&&S.preventDefault();return}if(!h){var v=(l.current.shards||[]).map(Em).filter(Boolean).filter(function(j){return j.contains(S.target)}),k=v.length>0?a(S,v[0]):!l.current.noIsolation;k&&S.cancelable&&S.preventDefault()}}},[]),c=g.useCallback(function(x,S,y,h){var v={name:x,delta:S,target:y,should:h,shadowParent:H2(y)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(k){return k!==v})},1)},[]),f=g.useCallback(function(x){n.current=Nl(x),r.current=void 0},[]),d=g.useCallback(function(x){c(x.type,jm(x),x.target,a(x,e.lockRef.current))},[]),p=g.useCallback(function(x){c(x.type,Nl(x),x.target,a(x,e.lockRef.current))},[]);g.useEffect(function(){return $r.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",u,Br),document.addEventListener("touchmove",u,Br),document.addEventListener("touchstart",f,Br),function(){$r=$r.filter(function(x){return x!==o}),document.removeEventListener("wheel",u,Br),document.removeEventListener("touchmove",u,Br),document.removeEventListener("touchstart",f,Br)}},[]);var m=e.removeScrollBar,w=e.inert;return g.createElement(g.Fragment,null,w?g.createElement(o,{styles:$2(i)}):null,m?g.createElement(I2,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function H2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const W2=v2($y,V2);var Gy=g.forwardRef(function(e,t){return g.createElement(ca,an({},e,{ref:t,sideCar:W2}))});Gy.classNames=ca.classNames;const Ky=Gy;var G2=[" ","Enter","ArrowUp","ArrowDown"],K2=[" ","Enter"],Tr="Select",[da,fa,Q2]=Kd(Tr),[Li,MR]=sr(Tr,[Q2,jy]),pa=jy(),[Y2,ar]=Li(Tr),[X2,q2]=Li(Tr),Qy=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:l,defaultValue:a,onValueChange:u,dir:c,name:f,autoComplete:d,disabled:p,required:m,form:w}=e,x=pa(t),[S,y]=g.useState(null),[h,v]=g.useState(null),[k,j]=g.useState(!1),C=oa(c),[E,T]=Ci({prop:r,defaultProp:i??!1,onChange:o,caller:Tr}),[z,L]=Ci({prop:l,defaultProp:a,onChange:u,caller:Tr}),I=g.useRef(null),P=S?w||!!S.closest("form"):!0,[R,W]=g.useState(new Set),M=Array.from(R).map(O=>O.props.value).join(";");return s.jsx(qj,{...x,children:s.jsxs(Y2,{required:m,scope:t,trigger:S,onTriggerChange:y,valueNode:h,onValueNodeChange:v,valueNodeHasChildren:k,onValueNodeHasChildrenChange:j,contentId:qn(),value:z,onValueChange:L,open:E,onOpenChange:T,dir:C,triggerPointerDownPosRef:I,disabled:p,children:[s.jsx(da.Provider,{scope:t,children:s.jsx(X2,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(O=>{W($=>new Set($).add(O))},[]),onNativeOptionRemove:g.useCallback(O=>{W($=>{const A=new Set($);return A.delete(O),A})},[]),children:n})}),P?s.jsxs(vv,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:d,value:z,onChange:O=>L(O.target.value),disabled:p,form:w,children:[z===void 0?s.jsx("option",{value:""}):null,Array.from(R)]},M):null]})})};Qy.displayName=Tr;var Yy="SelectTrigger",Xy=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=pa(n),l=ar(Yy,n),a=l.disabled||r,u=ve(t,l.onTriggerChange),c=fa(n),f=g.useRef("touch"),[d,p,m]=Sv(x=>{const S=c().filter(v=>!v.disabled),y=S.find(v=>v.value===l.value),h=bv(S,x,y);h!==void 0&&l.onValueChange(h.value)}),w=x=>{a||(l.onOpenChange(!0),m()),x&&(l.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return s.jsx(Jj,{asChild:!0,...o,children:s.jsx(le.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":wv(l.value)?"":void 0,...i,ref:u,onClick:ee(i.onClick,x=>{x.currentTarget.focus(),f.current!=="mouse"&&w(x)}),onPointerDown:ee(i.onPointerDown,x=>{f.current=x.pointerType;const S=x.target;S.hasPointerCapture(x.pointerId)&&S.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(w(x),x.preventDefault())}),onKeyDown:ee(i.onKeyDown,x=>{const S=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&p(x.key),!(S&&x.key===" ")&&G2.includes(x.key)&&(w(),x.preventDefault())})})})});Xy.displayName=Yy;var qy="SelectValue",Jy=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:l="",...a}=e,u=ar(qy,n),{onValueNodeHasChildrenChange:c}=u,f=o!==void 0,d=ve(t,u.onValueNodeChange);return tt(()=>{c(f)},[c,f]),s.jsx(le.span,{...a,ref:d,style:{pointerEvents:"none"},children:wv(u.value)?s.jsx(s.Fragment,{children:l}):o})});Jy.displayName=qy;var J2="SelectIcon",Zy=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return s.jsx(le.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});Zy.displayName=J2;var Z2="SelectPortal",ev=e=>s.jsx(of,{asChild:!0,...e});ev.displayName=Z2;var Ar="SelectContent",tv=g.forwardRef((e,t)=>{const n=ar(Ar,e.__scopeSelect),[r,i]=g.useState();if(tt(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?_i.createPortal(s.jsx(nv,{scope:e.__scopeSelect,children:s.jsx(da.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),o):null}return s.jsx(rv,{...e,ref:t})});tv.displayName=Ar;var Ut=10,[nv,ur]=Li(Ar),eE="SelectContentImpl",tE=ki("SelectContent.RemoveScroll"),rv=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:l,side:a,sideOffset:u,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:w,hideWhenDetached:x,avoidCollisions:S,...y}=e,h=ar(Ar,n),[v,k]=g.useState(null),[j,C]=g.useState(null),E=ve(t,K=>k(K)),[T,z]=g.useState(null),[L,I]=g.useState(null),P=fa(n),[R,W]=g.useState(!1),M=g.useRef(!1);g.useEffect(()=>{if(v)return zy(v)},[v]),cy();const O=g.useCallback(K=>{const[ne,...he]=P().map(me=>me.ref.current),[oe]=he.slice(-1),de=document.activeElement;for(const me of K)if(me===de||(me==null||me.scrollIntoView({block:"nearest"}),me===ne&&j&&(j.scrollTop=0),me===oe&&j&&(j.scrollTop=j.scrollHeight),me==null||me.focus(),document.activeElement!==de))return},[P,j]),$=g.useCallback(()=>O([T,v]),[O,T,v]);g.useEffect(()=>{R&&$()},[R,$]);const{onOpenChange:A,triggerPointerDownPosRef:F}=h;g.useEffect(()=>{if(v){let K={x:0,y:0};const ne=oe=>{var de,me;K={x:Math.abs(Math.round(oe.pageX)-(((de=F.current)==null?void 0:de.x)??0)),y:Math.abs(Math.round(oe.pageY)-(((me=F.current)==null?void 0:me.y)??0))}},he=oe=>{K.x<=10&&K.y<=10?oe.preventDefault():v.contains(oe.target)||A(!1),document.removeEventListener("pointermove",ne),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",he,{capture:!0})}}},[v,A,F]),g.useEffect(()=>{const K=()=>A(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[A]);const[b,V]=Sv(K=>{const ne=P().filter(de=>!de.disabled),he=ne.find(de=>de.ref.current===document.activeElement),oe=bv(ne,K,he);oe&&setTimeout(()=>oe.ref.current.focus())}),Y=g.useCallback((K,ne,he)=>{const oe=!M.current&&!he;(h.value!==void 0&&h.value===ne||oe)&&(z(K),oe&&(M.current=!0))},[h.value]),N=g.useCallback(()=>v==null?void 0:v.focus(),[v]),re=g.useCallback((K,ne,he)=>{const oe=!M.current&&!he;(h.value!==void 0&&h.value===ne||oe)&&I(K)},[h.value]),fe=r==="popper"?Nc:iv,ie=fe===Nc?{side:a,sideOffset:u,align:c,alignOffset:f,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:w,hideWhenDetached:x,avoidCollisions:S}:{};return s.jsx(nv,{scope:n,content:v,viewport:j,onViewportChange:C,itemRefCallback:Y,selectedItem:T,onItemLeave:N,itemTextRefCallback:re,focusSelectedItem:$,selectedItemText:L,position:r,isPositioned:R,searchRef:b,children:s.jsx(Ky,{as:tE,allowPinchZoom:!0,children:s.jsx(Yd,{asChild:!0,trapped:h.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:ee(i,K=>{var ne;(ne=h.trigger)==null||ne.focus({preventScroll:!0}),K.preventDefault()}),children:s.jsx(Qd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:s.jsx(fe,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:K=>K.preventDefault(),...y,...ie,onPlaced:()=>W(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ee(y.onKeyDown,K=>{const ne=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!ne&&K.key.length===1&&V(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let oe=P().filter(de=>!de.disabled).map(de=>de.ref.current);if(["ArrowUp","End"].includes(K.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const de=K.target,me=oe.indexOf(de);oe=oe.slice(me+1)}setTimeout(()=>O(oe)),K.preventDefault()}})})})})})})});rv.displayName=eE;var nE="SelectItemAlignedPosition",iv=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=ar(Ar,n),l=ur(Ar,n),[a,u]=g.useState(null),[c,f]=g.useState(null),d=ve(t,E=>f(E)),p=fa(n),m=g.useRef(!1),w=g.useRef(!0),{viewport:x,selectedItem:S,selectedItemText:y,focusSelectedItem:h}=l,v=g.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&x&&S&&y){const E=o.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),z=o.valueNode.getBoundingClientRect(),L=y.getBoundingClientRect();if(o.dir!=="rtl"){const de=L.left-T.left,me=z.left-de,He=E.left-me,rt=E.width+He,Zt=Math.max(rt,T.width),zt=window.innerWidth-Ut,en=As(me,[Ut,Math.max(Ut,zt-Zt)]);a.style.minWidth=rt+"px",a.style.left=en+"px"}else{const de=T.right-L.right,me=window.innerWidth-z.right-de,He=window.innerWidth-E.right-me,rt=E.width+He,Zt=Math.max(rt,T.width),zt=window.innerWidth-Ut,en=As(me,[Ut,Math.max(Ut,zt-Zt)]);a.style.minWidth=rt+"px",a.style.right=en+"px"}const I=p(),P=window.innerHeight-Ut*2,R=x.scrollHeight,W=window.getComputedStyle(c),M=parseInt(W.borderTopWidth,10),O=parseInt(W.paddingTop,10),$=parseInt(W.borderBottomWidth,10),A=parseInt(W.paddingBottom,10),F=M+O+R+A+$,b=Math.min(S.offsetHeight*5,F),V=window.getComputedStyle(x),Y=parseInt(V.paddingTop,10),N=parseInt(V.paddingBottom,10),re=E.top+E.height/2-Ut,fe=P-re,ie=S.offsetHeight/2,K=S.offsetTop+ie,ne=M+O+K,he=F-ne;if(ne<=re){const de=I.length>0&&S===I[I.length-1].ref.current;a.style.bottom="0px";const me=c.clientHeight-x.offsetTop-x.offsetHeight,He=Math.max(fe,ie+(de?N:0)+me+$),rt=ne+He;a.style.height=rt+"px"}else{const de=I.length>0&&S===I[0].ref.current;a.style.top="0px";const He=Math.max(re,M+x.offsetTop+(de?Y:0)+ie)+he;a.style.height=He+"px",x.scrollTop=ne-re+x.offsetTop}a.style.margin=`${Ut}px 0`,a.style.minHeight=b+"px",a.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,a,c,x,S,y,o.dir,r]);tt(()=>v(),[v]);const[k,j]=g.useState();tt(()=>{c&&j(window.getComputedStyle(c).zIndex)},[c]);const C=g.useCallback(E=>{E&&w.current===!0&&(v(),h==null||h(),w.current=!1)},[v,h]);return s.jsx(iE,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:C,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:s.jsx(le.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});iv.displayName=nE;var rE="SelectPopperPosition",Nc=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Ut,...o}=e,l=pa(n);return s.jsx(Zj,{...l,...o,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Nc.displayName=rE;var[iE,lf]=Li(Ar,{}),Cc="SelectViewport",ov=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,o=ur(Cc,n),l=lf(Cc,n),a=ve(t,o.onViewportChange),u=g.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(da.Slot,{scope:n,children:s.jsx(le.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ee(i.onScroll,c=>{const f=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=l;if(p!=null&&p.current&&d){const m=Math.abs(u.current-f.scrollTop);if(m>0){const w=window.innerHeight-Ut*2,x=parseFloat(d.style.minHeight),S=parseFloat(d.style.height),y=Math.max(x,S);if(y0?k:0,d.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});ov.displayName=Cc;var lv="SelectGroup",[oE,lE]=Li(lv),sv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=qn();return s.jsx(oE,{scope:n,id:i,children:s.jsx(le.div,{role:"group","aria-labelledby":i,...r,ref:t})})});sv.displayName=lv;var av="SelectLabel",uv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=lE(av,n);return s.jsx(le.div,{id:i.id,...r,ref:t})});uv.displayName=av;var Ls="SelectItem",[sE,cv]=Li(Ls),dv=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...l}=e,a=ar(Ls,n),u=ur(Ls,n),c=a.value===r,[f,d]=g.useState(o??""),[p,m]=g.useState(!1),w=ve(t,h=>{var v;return(v=u.itemRefCallback)==null?void 0:v.call(u,h,r,i)}),x=qn(),S=g.useRef("touch"),y=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(sE,{scope:n,value:r,disabled:i,textId:x,isSelected:c,onItemTextChange:g.useCallback(h=>{d(v=>v||((h==null?void 0:h.textContent)??"").trim())},[]),children:s.jsx(da.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:s.jsx(le.div,{role:"option","aria-labelledby":x,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:w,onFocus:ee(l.onFocus,()=>m(!0)),onBlur:ee(l.onBlur,()=>m(!1)),onClick:ee(l.onClick,()=>{S.current!=="mouse"&&y()}),onPointerUp:ee(l.onPointerUp,()=>{S.current==="mouse"&&y()}),onPointerDown:ee(l.onPointerDown,h=>{S.current=h.pointerType}),onPointerMove:ee(l.onPointerMove,h=>{var v;S.current=h.pointerType,i?(v=u.onItemLeave)==null||v.call(u):S.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ee(l.onPointerLeave,h=>{var v;h.currentTarget===document.activeElement&&((v=u.onItemLeave)==null||v.call(u))}),onKeyDown:ee(l.onKeyDown,h=>{var k;((k=u.searchRef)==null?void 0:k.current)!==""&&h.key===" "||(K2.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});dv.displayName=Ls;var no="SelectItemText",fv=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,l=ar(no,n),a=ur(no,n),u=cv(no,n),c=q2(no,n),[f,d]=g.useState(null),p=ve(t,y=>d(y),u.onItemTextChange,y=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,y,u.value,u.disabled)}),m=f==null?void 0:f.textContent,w=g.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:m},u.value),[u.disabled,u.value,m]),{onNativeOptionAdd:x,onNativeOptionRemove:S}=c;return tt(()=>(x(w),()=>S(w)),[x,S,w]),s.jsxs(s.Fragment,{children:[s.jsx(le.span,{id:u.textId,...o,ref:p}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?_i.createPortal(o.children,l.valueNode):null]})});fv.displayName=no;var pv="SelectItemIndicator",mv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return cv(pv,n).isSelected?s.jsx(le.span,{"aria-hidden":!0,...r,ref:t}):null});mv.displayName=pv;var jc="SelectScrollUpButton",hv=g.forwardRef((e,t)=>{const n=ur(jc,e.__scopeSelect),r=lf(jc,e.__scopeSelect),[i,o]=g.useState(!1),l=ve(t,r.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=u.scrollTop>0;o(c)};const u=n.viewport;return a(),u.addEventListener("scroll",a),()=>u.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?s.jsx(xv,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:u}=n;a&&u&&(a.scrollTop=a.scrollTop-u.offsetHeight)}}):null});hv.displayName=jc;var Ec="SelectScrollDownButton",gv=g.forwardRef((e,t)=>{const n=ur(Ec,e.__scopeSelect),r=lf(Ec,e.__scopeSelect),[i,o]=g.useState(!1),l=ve(t,r.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?s.jsx(xv,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:u}=n;a&&u&&(a.scrollTop=a.scrollTop+u.offsetHeight)}}):null});gv.displayName=Ec;var xv=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=ur("SelectScrollButton",n),l=g.useRef(null),a=fa(n),u=g.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return g.useEffect(()=>()=>u(),[u]),tt(()=>{var f;const c=a().find(d=>d.ref.current===document.activeElement);(f=c==null?void 0:c.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),s.jsx(le.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ee(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:ee(i.onPointerMove,()=>{var c;(c=o.onItemLeave)==null||c.call(o),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:ee(i.onPointerLeave,()=>{u()})})}),aE="SelectSeparator",yv=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(le.div,{"aria-hidden":!0,...r,ref:t})});yv.displayName=aE;var Pc="SelectArrow",uE=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=pa(n),o=ar(Pc,n),l=ur(Pc,n);return o.open&&l.position==="popper"?s.jsx(e2,{...i,...r,ref:t}):null});uE.displayName=Pc;var cE="SelectBubbleInput",vv=g.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=g.useRef(null),o=ve(r,i),l=Ly(t);return g.useEffect(()=>{const a=i.current;if(!a)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&f){const d=new Event("change",{bubbles:!0});f.call(a,t),a.dispatchEvent(d)}},[l,t]),s.jsx(le.select,{...n,style:{...Oy,...n.style},ref:o,defaultValue:t})});vv.displayName=cE;function wv(e){return e===""||e===void 0}function Sv(e){const t=er(e),n=g.useRef(""),r=g.useRef(0),i=g.useCallback(l=>{const a=n.current+l;t(a),function u(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}(a)},[t]),o=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function bv(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=dE(e,Math.max(o,0));i.length===1&&(l=l.filter(c=>c!==n));const u=l.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function dE(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fE=Qy,kv=Xy,pE=Jy,mE=Zy,hE=ev,Nv=tv,gE=ov,xE=sv,Cv=uv,jv=dv,yE=fv,vE=mv,Ev=hv,Pv=gv,Tv=yv;const Do=fE,fi=xE,zo=pE,ji=g.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(kv,{ref:r,className:ce("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,s.jsx(mE,{asChild:!0,children:s.jsx(Xx,{className:"h-4 w-4 opacity-50"})})]}));ji.displayName=kv.displayName;const Av=g.forwardRef(({className:e,...t},n)=>s.jsx(Ev,{ref:n,className:ce("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(lN,{className:"h-4 w-4"})}));Av.displayName=Ev.displayName;const _v=g.forwardRef(({className:e,...t},n)=>s.jsx(Pv,{ref:n,className:ce("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Xx,{className:"h-4 w-4"})}));_v.displayName=Pv.displayName;const Ei=g.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>s.jsx(hE,{children:s.jsxs(Nv,{ref:i,className:ce("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[s.jsx(Av,{}),s.jsx(gE,{className:ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(_v,{})]})}));Ei.displayName=Nv.displayName;const Sr=g.forwardRef(({className:e,...t},n)=>s.jsx(Cv,{ref:n,className:ce("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Sr.displayName=Cv.displayName;const It=g.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(jv,{ref:r,className:ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(vE,{children:s.jsx(tN,{className:"h-4 w-4"})})}),s.jsx(yE,{children:t})]}));It.displayName=jv.displayName;const wE=g.forwardRef(({className:e,...t},n)=>s.jsx(Tv,{ref:n,className:ce("-mx-1 my-1 h-px bg-muted",e),...t}));wE.displayName=Tv.displayName;var Iv=["PageUp","PageDown"],Rv=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mv={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Oi="Slider",[Tc,SE,bE]=Kd(Oi),[Lv,LR]=sr(Oi,[bE]),[kE,ma]=Lv(Oi),Ov=g.forwardRef((e,t)=>{const{name:n,min:r=0,max:i=100,step:o=1,orientation:l="horizontal",disabled:a=!1,minStepsBetweenThumbs:u=0,defaultValue:c=[r],value:f,onValueChange:d=()=>{},onValueCommit:p=()=>{},inverted:m=!1,form:w,...x}=e,S=g.useRef(new Set),y=g.useRef(0),v=l==="horizontal"?NE:CE,[k=[],j]=Ci({prop:f,defaultProp:c,onChange:I=>{var R;(R=[...S.current][y.current])==null||R.focus(),d(I)}}),C=g.useRef(k);function E(I){const P=AE(k,I);L(I,P)}function T(I){L(I,y.current)}function z(){const I=C.current[y.current];k[y.current]!==I&&p(k)}function L(I,P,{commit:R}={commit:!1}){const W=ME(o),M=LE(Math.round((I-r)/o)*o+r,W),O=As(M,[r,i]);j(($=[])=>{const A=PE($,O,P);if(RE(A,u*o)){y.current=A.indexOf(O);const F=String(A)!==String($);return F&&R&&p(A),F?A:$}else return $})}return s.jsx(kE,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:i,valueIndexToChangeRef:y,thumbs:S.current,values:k,orientation:l,form:w,children:s.jsx(Tc.Provider,{scope:e.__scopeSlider,children:s.jsx(Tc.Slot,{scope:e.__scopeSlider,children:s.jsx(v,{"aria-disabled":a,"data-disabled":a?"":void 0,...x,ref:t,onPointerDown:ee(x.onPointerDown,()=>{a||(C.current=k)}),min:r,max:i,inverted:m,onSlideStart:a?void 0:E,onSlideMove:a?void 0:T,onSlideEnd:a?void 0:z,onHomeKeyDown:()=>!a&&L(r,0,{commit:!0}),onEndKeyDown:()=>!a&&L(i,k.length-1,{commit:!0}),onStepKeyDown:({event:I,direction:P})=>{if(!a){const M=Iv.includes(I.key)||I.shiftKey&&Rv.includes(I.key)?10:1,O=y.current,$=k[O],A=o*M*P;L($+A,O,{commit:!0})}}})})})})});Ov.displayName=Oi;var[Dv,zv]=Lv(Oi,{startEdge:"left",endEdge:"right",size:"width",direction:1}),NE=g.forwardRef((e,t)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:l,onSlideMove:a,onSlideEnd:u,onStepKeyDown:c,...f}=e,[d,p]=g.useState(null),m=ve(t,v=>p(v)),w=g.useRef(void 0),x=oa(i),S=x==="ltr",y=S&&!o||!S&&o;function h(v){const k=w.current||d.getBoundingClientRect(),j=[0,k.width],E=sf(j,y?[n,r]:[r,n]);return w.current=k,E(v-k.left)}return s.jsx(Dv,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:s.jsx(Fv,{dir:x,"data-orientation":"horizontal",...f,ref:m,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{const k=h(v.clientX);l==null||l(k)},onSlideMove:v=>{const k=h(v.clientX);a==null||a(k)},onSlideEnd:()=>{w.current=void 0,u==null||u()},onStepKeyDown:v=>{const j=Mv[y?"from-left":"from-right"].includes(v.key);c==null||c({event:v,direction:j?-1:1})}})})}),CE=g.forwardRef((e,t)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:a,onStepKeyDown:u,...c}=e,f=g.useRef(null),d=ve(t,f),p=g.useRef(void 0),m=!i;function w(x){const S=p.current||f.current.getBoundingClientRect(),y=[0,S.height],v=sf(y,m?[r,n]:[n,r]);return p.current=S,v(x-S.top)}return s.jsx(Dv,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:s.jsx(Fv,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:x=>{const S=w(x.clientY);o==null||o(S)},onSlideMove:x=>{const S=w(x.clientY);l==null||l(S)},onSlideEnd:()=>{p.current=void 0,a==null||a()},onStepKeyDown:x=>{const y=Mv[m?"from-bottom":"from-top"].includes(x.key);u==null||u({event:x,direction:y?-1:1})}})})}),Fv=g.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:a,onStepKeyDown:u,...c}=e,f=ma(Oi,n);return s.jsx(le.span,{...c,ref:t,onKeyDown:ee(e.onKeyDown,d=>{d.key==="Home"?(l(d),d.preventDefault()):d.key==="End"?(a(d),d.preventDefault()):Iv.concat(Rv).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:ee(e.onPointerDown,d=>{const p=d.target;p.setPointerCapture(d.pointerId),d.preventDefault(),f.thumbs.has(p)?p.focus():r(d)}),onPointerMove:ee(e.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&i(d)}),onPointerUp:ee(e.onPointerUp,d=>{const p=d.target;p.hasPointerCapture(d.pointerId)&&(p.releasePointerCapture(d.pointerId),o(d))})})}),Bv="SliderTrack",$v=g.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,i=ma(Bv,n);return s.jsx(le.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:t})});$v.displayName=Bv;var Ac="SliderRange",Uv=g.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,i=ma(Ac,n),o=zv(Ac,n),l=g.useRef(null),a=ve(t,l),u=i.values.length,c=i.values.map(p=>Wv(p,i.min,i.max)),f=u>1?Math.min(...c):0,d=100-Math.max(...c);return s.jsx(le.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:a,style:{...e.style,[o.startEdge]:f+"%",[o.endEdge]:d+"%"}})});Uv.displayName=Ac;var _c="SliderThumb",Vv=g.forwardRef((e,t)=>{const n=SE(e.__scopeSlider),[r,i]=g.useState(null),o=ve(t,a=>i(a)),l=g.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return s.jsx(jE,{...e,ref:o,index:l})}),jE=g.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:i,...o}=e,l=ma(_c,n),a=zv(_c,n),[u,c]=g.useState(null),f=ve(t,h=>c(h)),d=u?l.form||!!u.closest("form"):!0,p=Ny(u),m=l.values[r],w=m===void 0?0:Wv(m,l.min,l.max),x=TE(r,l.values.length),S=p==null?void 0:p[a.size],y=S?_E(S,w,a.direction):0;return g.useEffect(()=>{if(u)return l.thumbs.add(u),()=>{l.thumbs.delete(u)}},[u,l.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${w}% + ${y}px)`},children:[s.jsx(Tc.ItemSlot,{scope:e.__scopeSlider,children:s.jsx(le.span,{role:"slider","aria-label":e["aria-label"]||x,"aria-valuemin":l.min,"aria-valuenow":m,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:f,style:m===void 0?{display:"none"}:e.style,onFocus:ee(e.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),d&&s.jsx(Hv,{name:i??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:m},r)]})});Vv.displayName=_c;var EE="RadioBubbleInput",Hv=g.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const i=g.useRef(null),o=ve(i,r),l=Ly(t);return g.useEffect(()=>{const a=i.current;if(!a)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&f){const d=new Event("input",{bubbles:!0});f.call(a,t),a.dispatchEvent(d)}},[l,t]),s.jsx(le.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});Hv.displayName=EE;function PE(e=[],t,n){const r=[...e];return r[n]=t,r.sort((i,o)=>i-o)}function Wv(e,t,n){const o=100/(n-t)*(e-t);return As(o,[0,100])}function TE(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function AE(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),r=Math.min(...n);return n.indexOf(r)}function _E(e,t,n){const r=e/2,o=sf([0,50],[0,r]);return(r-o(t)*n)*n}function IE(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function RE(e,t){if(t>0){const n=IE(e);return Math.min(...n)>=t}return!0}function sf(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function ME(e){return(String(e).split(".")[1]||"").length}function LE(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Gv=Ov,OE=$v,DE=Uv,zE=Vv;const Fo=g.forwardRef(({className:e,...t},n)=>s.jsxs(Gv,{ref:n,className:ce("relative flex w-full touch-none select-none items-center",e),...t,children:[s.jsx(OE,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:s.jsx(DE,{className:"absolute h-full bg-primary"})}),s.jsx(zE,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Fo.displayName=Gv.displayName;const af=[{id:"outdoor-rescue",name:"🏔️ Outdoor Rescue",description:"Offline AI that guides survival in extreme environments",category:"Emergency & Safety",tags:["survival","outdoor","emergency","rescue"],icon:"🏔️",model:"Qwen/Qwen3-30B-A3B",systemPrompt:"You are an expert outdoor survival guide and emergency responder. When hikers, travelers, or drivers lose connection in mountains, forests, or rural roads, you provide real-time survival guidance, first aid tips, and emergency signaling advice. You are their reliable voice of calm and safety in extreme environments. Provide step-by-step instructions for survival scenarios, prioritize immediate safety needs, and offer practical solutions using available resources.",temperature:.3,maxTokens:1e3,isOfficial:!0,usageCount:2847,rating:4.9,createdAt:"2024-01-15",author:"EdgeLLM Team"},{id:"offline-healthcare",name:"🏥 Offline Healthcare",description:"A simple device for seniors to access trusted medical guidance",category:"Healthcare",tags:["healthcare","seniors","medical","guidance"],icon:"🏥",model:"Qwen/Qwen3-30B-A3B",systemPrompt:"You are a trusted medical assistant designed specifically for elderly users. You provide clear, step-by-step medical advice through simple voice interactions. Users can press a button or speak a request to get guidance on everyday health concerns. Offer practical, easy-to-understand health advice while always emphasizing when professional medical attention is needed. Keep responses simple, clear, and actionable. No internet required, no accounts needed, no complicated setup.",temperature:.2,maxTokens:800,isOfficial:!0,usageCount:1934,rating:4.8,createdAt:"2024-01-20",author:"EdgeLLM Team"},{id:"ai-companion",name:"🧸 AI Companion",description:"A private, always-available conversational partner",category:"Companion & Support",tags:["companion","emotional support","conversation","private"],icon:"🧸",model:"Qwen/Qwen3-30B-A3B",systemPrompt:"You are a warm, empathetic AI companion designed to provide emotional support and practical assistance. You can be embedded in a plush toy or device to serve as a private, always-available friend. You listen actively, engage in meaningful conversations, tell stories, and provide comfort during stressful or lonely times. You offer warmth, reassurance, and practical help while maintaining complete privacy - all processing stays local without uploading data to the cloud. Be supportive, understanding, and genuinely caring in all interactions.",temperature:.7,maxTokens:1e3,isOfficial:!0,usageCount:3421,rating:4.9,createdAt:"2024-01-25",author:"EdgeLLM Team"}];function FE(){return af.map(e=>({id:e.id,name:e.name.replace(/🏔️|🏥|🧸/g,"").trim(),description:e.description,author:e.author,category:e.category,tags:e.tags,model:e.model,systemPrompt:e.systemPrompt,temperature:e.temperature,maxTokens:e.maxTokens,isOfficial:e.isOfficial,createdAt:e.createdAt,icon:e.icon,usageCount:e.usageCount,rating:e.rating}))}function BE(){return af.map(e=>({name:e.name,prompt:e.systemPrompt}))}const nn={sessions:"edge-llm-sessions",currentSession:"edge-llm-current-session"};function Kv(){return Math.random().toString(36).substring(2)+Date.now().toString(36)}function $E(){return Kv()}class UE{getAllSessions(){const t=localStorage.getItem(nn.sessions);return t?JSON.parse(t):[]}getSession(t){return this.getAllSessions().find(r=>r.id===t)||null}createSession(t,n,r){const i={id:Kv(),title:t||`New Chat ${new Date().toLocaleString()}`,messages:[],model:n,systemPrompt:r,createdAt:Date.now(),updatedAt:Date.now()},o=this.getAllSessions();return o.unshift(i),localStorage.setItem(nn.sessions,JSON.stringify(o)),i}updateSession(t,n){const r=this.getAllSessions(),i=r.findIndex(o=>o.id===t);i!==-1&&(r[i]={...r[i],...n,updatedAt:Date.now()},localStorage.setItem(nn.sessions,JSON.stringify(r)))}deleteSession(t){const r=this.getAllSessions().filter(i=>i.id!==t);localStorage.setItem(nn.sessions,JSON.stringify(r)),this.getCurrentSessionId()===t&&localStorage.removeItem(nn.currentSession)}addMessageToSession(t,n){const r=this.getAllSessions(),i=r.findIndex(o=>o.id===t);if(i!==-1){const o={...n,id:$E(),timestamp:Date.now()};r[i].messages.push(o),r[i].updatedAt=Date.now(),localStorage.setItem(nn.sessions,JSON.stringify(r))}}getCurrentSessionId(){return localStorage.getItem(nn.currentSession)}getCurrentSession(){const t=this.getCurrentSessionId();return t?this.getSession(t):null}setCurrentSession(t){localStorage.setItem(nn.currentSession,t)}clear(){localStorage.removeItem(nn.sessions),localStorage.removeItem(nn.currentSession)}}const Oe=new UE;function Qv(e={}){const{api_endpoint:t=`${window.location.origin}/generate`,defaultModel:n="Qwen/Qwen3-30B-A3B",defaultSystemPrompt:r=""}=e,[i,o]=g.useState([]),[l,a]=g.useState(null),[u,c]=g.useState(""),[f,d]=g.useState({isLoading:!1,error:null}),[p,m]=g.useState(n),[w,x]=g.useState(r),[S,y]=g.useState(.7),[h,v]=g.useState(1024),k=Ht.useMemo(()=>{var O;const M=i.find($=>$.id===l)||null;return console.log("useChat - currentSession updated:",{sessionId:l,found:!!M,messageCount:((O=M==null?void 0:M.messages)==null?void 0:O.length)||0,sessionTitle:(M==null?void 0:M.title)||"No session"}),M},[i,l]),j=Ht.useMemo(()=>{const M=(k==null?void 0:k.messages)||[];return console.log("useChat - messages computed:",M.length,M.map(O=>({id:O.id,role:O.role}))),M},[k==null?void 0:k.messages]);g.useEffect(()=>{const M=Oe.getAllSessions();o(M);const O=Oe.getCurrentSession();O&&a(O.id)},[]);const C=g.useCallback(()=>{const M=Oe.createSession(void 0,p,w),O=Oe.getAllSessions();return o([...O]),a(M.id),Oe.setCurrentSession(M.id),M.id},[p,w]),E=g.useCallback(M=>{console.log("selectSession called with:",M),a(M),Oe.setCurrentSession(M),console.log("currentSessionId updated to:",M)},[]),T=g.useCallback(M=>{Oe.deleteSession(M);const O=Oe.getAllSessions();o([...O]),l===M&&(O.length>0?(a(O[0].id),Oe.setCurrentSession(O[0].id)):a(null))},[l]),z=g.useCallback((M,O)=>{Oe.updateSession(M,{title:O});const $=Oe.getAllSessions();o([...$])},[]),L=g.useCallback(M=>{if(!l)return;Oe.addMessageToSession(l,M);const O=Oe.getAllSessions();o([...O])},[l]),I=g.useCallback(async(M,O)=>{var F,b;if(!u.trim()||f.isLoading)return;let $=l;$||($=C());const A=u.trim();if(c(""),d({isLoading:!0,error:null}),$){Oe.addMessageToSession($,{role:"user",content:A});const V=Oe.getAllSessions();o([...V])}try{const V=Oe.getSession($),Y=((b=(F=V==null?void 0:V.messages)==null?void 0:F.filter(fe=>fe.role!=="system"))==null?void 0:b.map(fe=>({role:fe.role,content:fe.content})))||[],N=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:A,messages:Y,system_prompt:w||null,model_name:p,temperature:S,max_new_tokens:h,use_rag:(O==null?void 0:O.useRag)||!1,retrieval_count:(O==null?void 0:O.retrievalCount)||3})});if(!N.ok){const fe=await N.json();throw new Error(fe.detail||`HTTP error! status: ${N.status}`)}const re=await N.json();if($){Oe.addMessageToSession($,{role:"assistant",content:re.content,thinking_content:re.thinking_content,model_used:re.model_used,supports_thinking:re.supports_thinking,assistantInfo:M});const fe=Oe.getAllSessions();o([...fe])}d({isLoading:!1,error:null})}catch(V){const Y=V instanceof Error?V.message:"An error occurred";if(d({isLoading:!1,error:Y}),$){Oe.addMessageToSession($,{role:"assistant",content:`Sorry, I encountered an error: ${Y}`,assistantInfo:M});const N=Oe.getAllSessions();o([...N])}}},[u,f.isLoading,l,C,L,w,j.length,t,p,S,h]),P=g.useCallback(()=>{d({isLoading:!1,error:null})},[]),R=g.useCallback(()=>{Oe.clear(),o([]),a(null)},[]),W=g.useCallback(()=>{a(null),localStorage.removeItem("edge-llm-current-session")},[]);return{sessions:i,currentSession:k,currentSessionId:l,createNewSession:C,selectSession:E,deleteSession:T,renameSession:z,clearAllSessions:R,clearCurrentSession:W,messages:j,input:u,setInput:c,sendMessage:I,stopGeneration:P,isLoading:f.isLoading,error:f.error,selectedModel:p,setSelectedModel:m,systemPrompt:w,setSystemPrompt:x,temperature:S,setTemperature:y,maxTokens:h,setMaxTokens:v}}function Yv({isLoading:e,ragEnabled:t,setRagEnabled:n,retrievalCount:r,setRetrievalCount:i,currentAssistant:o}){const[l,a]=g.useState([]),[u,c]=g.useState(!1);g.useEffect(()=>{(async()=>{if(!o){a([]);return}try{const m=await fetch("/rag/documents");if(m.ok){const w=await m.json();if(w.documents){const x=Object.entries(w.documents).map(([S,y])=>({id:S,name:y.filename,size:0,type:y.file_type,uploadedAt:new Date().toISOString(),status:y.status,chunks:y.chunks,assistantId:y.assistant_id||null}));a(x)}}}catch(m){console.error("Error loading documents:",m)}})()},[o]);const f=async p=>{const m=p.target.files;if(!(!m||!o)){c(!0);try{const w=new FormData;w.append("assistant_id",o.id);for(const S of Array.from(m))w.append("files",S);const x=await fetch("/rag/upload",{method:"POST",body:w});if(x.ok){const S=await x.json(),y=S.results.filter(v=>v.success).map(v=>({id:v.doc_id,name:v.filename,size:0,type:"processed",uploadedAt:new Date().toISOString(),status:"processed",chunks:v.chunks,assistantId:o==null?void 0:o.id}));a(v=>[...v,...y]);const h=S.results.filter(v=>!v.success);h.length>0&&console.error("Some files failed to upload:",h)}else console.error("Upload failed:",x.statusText);p.target.value=""}catch(w){console.error("File upload error:",w)}finally{c(!1)}}},d=async p=>{try{const m=await fetch(`/rag/documents/${p}`,{method:"DELETE"});m.ok?a(w=>w.filter(x=>x.id!==p)):console.error("Failed to delete document:",m.statusText)}catch(m){console.error("Error deleting document:",m),a(w=>w.filter(x=>x.id!==p))}};return s.jsx("div",{className:"space-y-4 pb-6",children:o?s.jsxs(Ie,{children:[s.jsx(Mt,{children:s.jsxs(Lt,{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vd,{className:"h-4 w-4 text-blue-600"}),s.jsx("span",{children:o.name}),s.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${o.type==="user"?"bg-blue-100 text-blue-700":o.type==="template"?"bg-gray-100 text-gray-700":"bg-green-100 text-green-700"}`,children:o.type==="user"?"My Assistant":o.type==="template"?"Template":"New Assistant"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Te,{className:"text-xs text-muted-foreground",children:"RAG"}),s.jsx("input",{type:"checkbox",checked:t,onChange:p=>n(p.target.checked),className:"rounded",disabled:e||l.length===0}),t&&l.length>0&&s.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[s.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),s.jsx("span",{className:"text-xs font-medium",children:"Active"})]})]})]})}),s.jsxs(Ye,{className:"space-y-4",children:[t&&s.jsxs("div",{className:"border-l-2 border-blue-200 pl-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Te,{className:"text-xs font-medium",children:"Retrieval Depth"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[r," chunks"]})]}),s.jsx(Fo,{value:[r],onValueChange:p=>i(p[0]),max:10,min:1,step:1,className:"w-full"})]}),s.jsxs("div",{className:"border-2 border-dashed border-gray-200 rounded-lg p-4 text-center hover:border-gray-300 transition-colors",children:[s.jsx("input",{type:"file",id:"file-upload",multiple:!0,accept:".pdf,.txt,.docx,.md",onChange:f,className:"hidden",disabled:u||e}),s.jsxs(Te,{htmlFor:"file-upload",className:"cursor-pointer flex flex-col items-center space-y-2",children:[s.jsx(UN,{className:"h-6 w-6 text-gray-400"}),s.jsx("span",{className:"text-sm",children:u?"Uploading...":"Drop files or click to upload"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"PDF, TXT, DOCX, MD supported"})]})]}),l.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(Te,{className:"text-sm font-medium",children:["Documents (",l.length,")"]}),t&&s.jsxs("span",{className:"text-xs text-green-600",children:["Using ",Math.min(r,l.length)," for context"]})]}),s.jsx("div",{className:"space-y-1",children:l.map(p=>s.jsxs("div",{className:"flex items-center justify-between p-2 border rounded bg-gray-50/50 hover:bg-gray-50",children:[s.jsxs("div",{className:"flex items-center space-x-2 flex-1 min-w-0",children:[s.jsx(gN,{className:"h-3 w-3 text-blue-600 flex-shrink-0"}),s.jsx("span",{className:"text-sm truncate",children:p.name}),p.chunks&&s.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:[p.chunks," chunks"]})]}),s.jsx(J,{size:"sm",variant:"ghost",onClick:()=>d(p.id),disabled:e,className:"h-6 w-6 p-0 text-red-500 hover:text-red-600 hover:bg-red-50",children:s.jsx(ry,{className:"h-3 w-3"})})]},p.id))})]}),l.length===0&&s.jsx("div",{className:"text-center py-3",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"No documents uploaded yet"})})]})]}):s.jsx(Ie,{children:s.jsxs(Ye,{className:"pt-6 text-center",children:[s.jsx(ra,{className:"h-8 w-8 text-muted-foreground mx-auto mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an assistant to manage documents"})]})})})}function VE(){const e=Lr(),[t,n]=g.useState(1),[r,i]=g.useState({assistantId:"",model:"Qwen/Qwen3-30B-A3B",temperature:.7,maxTokens:1024,role:"",goal:"",description:"",document:""}),[o,l]=g.useState(!1),[a,u]=g.useState(3),[c,f]=g.useState(null),{currentSession:d,createNewSession:p,sendMessage:m,isLoading:w,setSystemPrompt:x,setTemperature:S,setMaxTokens:y,setSelectedModel:h,input:v,setInput:k}=Qv(),j=af,C=(d==null?void 0:d.messages)||[],E=P=>{const R=j.find(W=>W.id===P);R&&(i(W=>({...W,assistantId:P,model:R.model,temperature:R.temperature,maxTokens:R.maxTokens,role:R.description,goal:R.category,description:R.systemPrompt})),h(R.model),x(R.systemPrompt),S(R.temperature),y(R.maxTokens),f({id:P,name:R.name,type:"template"}))};g.useEffect(()=>{h(r.model),x(r.description),S(r.temperature),y(r.maxTokens)},[r,h,x,S,y]);const T=()=>s.jsxs("div",{className:"flex items-center justify-between mb-8 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center",children:[s.jsxs("div",{className:`flex items-center ${t>=1?"text-purple-600":"text-gray-400"}`,children:[s.jsx("div",{className:`w-8 h-8 rounded-full border-2 flex items-center justify-center text-sm font-medium ${t>=1?"bg-purple-600 text-white border-purple-600":"border-gray-300"}`,children:"1"}),s.jsx("span",{className:"ml-2 font-medium",children:"Configuration"})]}),s.jsx("div",{className:`w-32 h-0.5 mx-4 ${t>=2?"bg-purple-600":"bg-gray-300"}`})]}),s.jsxs("div",{className:"flex items-center",children:[s.jsxs("div",{className:`flex items-center ${t>=2?"text-purple-600":"text-gray-400"}`,children:[s.jsx("div",{className:`w-8 h-8 rounded-full border-2 flex items-center justify-center text-sm font-medium ${t>=2?"bg-purple-600 text-white border-purple-600":"border-gray-300"}`,children:"2"}),s.jsx("span",{className:"ml-2 font-medium",children:"Test performance"})]}),s.jsx("div",{className:`w-32 h-0.5 mx-4 ${t>=3?"bg-purple-600":"bg-gray-300"}`})]}),s.jsxs("div",{className:"flex items-center",children:[s.jsxs("div",{className:`flex items-center ${t>=3?"text-purple-600":"text-gray-400"}`,children:[s.jsx("div",{className:`w-8 h-8 rounded-full border-2 flex items-center justify-center text-sm font-medium ${t>=3?"bg-purple-600 text-white border-purple-600":"border-gray-300"}`,children:"3"}),s.jsx("span",{className:"ml-2 font-medium",children:"Connect to device"})]}),s.jsx(J,{className:"ml-8 bg-purple-600 hover:bg-purple-700 text-white px-8",onClick:()=>n(3),disabled:t<2,children:"Connect"})]})]}),z=()=>s.jsx("div",{className:"max-w-2xl mx-auto",children:s.jsx(Ie,{className:"p-8",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Load Assistant"}),s.jsxs(Do,{onValueChange:E,value:r.assistantId,children:[s.jsx(ji,{children:s.jsx(zo,{placeholder:"Select an assistant"})}),s.jsx(Ei,{children:j.map(P=>s.jsx(It,{value:P.id,children:P.name},P.id))})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Parameters"}),s.jsxs("div",{className:"mb-4",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Select a model"}),s.jsxs(Do,{value:r.model,onValueChange:P=>i(R=>({...R,model:P})),children:[s.jsx(ji,{children:s.jsx(zo,{})}),s.jsxs(Ei,{children:[s.jsx(It,{value:"Qwen/Qwen3-30B-A3B",children:"Qwen3-30B-A3B"}),s.jsx(It,{value:"Qwen/Qwen2.5-32B-Instruct",children:"Qwen2.5-32B-Instruct"}),s.jsx(It,{value:"deepseek-ai/DeepSeek-V2.5",children:"DeepSeek-V2.5"})]})]})]}),s.jsxs("div",{className:"mb-4",children:[s.jsxs(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:["Temperature: ",r.temperature]}),s.jsx(Fo,{value:[r.temperature],onValueChange:P=>i(R=>({...R,temperature:P[0]})),max:1,min:0,step:.1,className:"w-full"})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Max Tokens"}),s.jsx(ni,{type:"number",value:r.maxTokens,onChange:P=>i(R=>({...R,maxTokens:parseInt(P.target.value)||1024})),min:1,max:4096})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Description"}),s.jsxs("div",{className:"mb-4",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Which role do you want your assistant to be? (Senior data researcher, journalist, lawyer, etc.)"}),s.jsx(ni,{value:r.role,onChange:P=>i(R=>({...R,role:P.target.value})),placeholder:"e.g., Senior data researcher, journalist, lawyer"})]}),s.jsxs("div",{className:"mb-4",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Which goal would you expect your assistant to achieve"}),s.jsx(ni,{value:r.goal,onChange:P=>i(R=>({...R,goal:P.target.value})),placeholder:"Describe the main goal or objective"})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Description (Tasks, outputs)"}),s.jsx(Gd,{value:r.description,onChange:P=>i(R=>({...R,description:P.target.value})),placeholder:"Describe the tasks and expected outputs...",rows:4})]})]}),s.jsxs("div",{children:[s.jsx(Te,{className:"text-sm font-medium text-gray-700 mb-2 block",children:"Documents & Knowledge Base"}),s.jsx(Yv,{isLoading:w,ragEnabled:o,setRagEnabled:l,retrievalCount:a,setRetrievalCount:u,currentAssistant:c})]}),s.jsx(J,{onClick:()=>n(2),className:"w-full bg-purple-600 hover:bg-purple-700 text-white",disabled:!r.assistantId,children:"Continue to Test Performance"})]})})}),L=()=>{var P;return s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 h-[600px]",children:[s.jsx("div",{className:"lg:col-span-1",children:s.jsxs(Ie,{className:"h-full p-4",children:[s.jsx("h3",{className:"font-semibold mb-4",children:"Chat sessions"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(J,{variant:"ghost",className:"w-full justify-start text-left",onClick:p,children:"New Chat"}),C.length>0&&s.jsxs("div",{className:"p-2 bg-gray-50 rounded text-sm",children:["Current Session (",C.length," messages)"]})]})]})}),s.jsx("div",{className:"lg:col-span-3",children:s.jsxs(Ie,{className:"h-full flex flex-col",children:[s.jsx("div",{className:"p-4 border-b",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"font-semibold",children:"Test Performance"}),s.jsx(xe,{variant:"secondary",children:r.assistantId?(P=j.find(R=>R.id===r.assistantId))==null?void 0:P.name.replace(/🏔️|🏥|🧸/g,"").trim():"No Assistant"})]})}),s.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4",children:[C.length===0?s.jsx("div",{className:"flex items-center justify-center h-full text-gray-500",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"mb-2",children:"Start testing your assistant configuration"}),s.jsx("p",{className:"text-sm",children:"Send a message to see how your assistant responds"})]})}):C.map((R,W)=>s.jsx("div",{className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:s.jsx("div",{className:`max-w-[80%] p-3 rounded-lg ${R.role==="user"?"bg-purple-600 text-white":"bg-gray-100 text-gray-900"}`,children:s.jsx("p",{className:"whitespace-pre-wrap",children:R.content})})},W)),w&&s.jsx("div",{className:"flex justify-start",children:s.jsx("div",{className:"bg-gray-100 p-3 rounded-lg",children:s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce"}),s.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),s.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})})]}),s.jsx("div",{className:"p-4 border-t",children:s.jsxs("div",{className:"flex space-x-2",children:[s.jsx(ni,{placeholder:"Type your message...",value:v,onChange:R=>k(R.target.value),onKeyPress:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),v.trim()&&m(void 0,{useRag:o,retrievalCount:a}))}}),s.jsx(J,{onClick:()=>{v.trim()&&m(void 0,{useRag:o,retrievalCount:a})},disabled:w,className:"bg-purple-600 hover:bg-purple-700",children:"Send"})]})})]})})]}),s.jsxs("div",{className:"mt-6 flex justify-between max-w-6xl mx-auto",children:[s.jsx(J,{variant:"outline",onClick:()=>n(1),children:"Back to Configuration"}),s.jsx(J,{onClick:()=>n(3),className:"bg-purple-600 hover:bg-purple-700 text-white",children:"Continue to Connect Device"})]})]})},I=()=>{var P;return s.jsx("div",{className:"max-w-2xl mx-auto",children:s.jsxs(Ie,{className:"p-8 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4",children:s.jsx("svg",{className:"w-8 h-8 text-purple-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.212 0"})})}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Connect to Device"}),s.jsx("p",{className:"text-gray-600",children:"Your assistant configuration is ready to be deployed to your edge device."})]}),s.jsxs("div",{className:"space-y-4 text-left mb-8",children:[s.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[s.jsx("h3",{className:"font-semibold mb-2",children:"Configuration Summary"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Assistant:"})," ",((P=j.find(R=>R.id===r.assistantId))==null?void 0:P.name.replace(/🏔️|🏥|🧸/g,"").trim())||"None"]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Model:"})," ",r.model]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Temperature:"})," ",r.temperature]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Max Tokens:"})," ",r.maxTokens]}),r.role&&s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Role:"})," ",r.role]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"RAG Enabled:"})," ",o?"Yes":"No"]}),o&&s.jsxs("p",{children:[s.jsx("span",{className:"font-medium",children:"Retrieval Count:"})," ",a]})]})]}),s.jsx("div",{className:"bg-blue-50 p-4 rounded-lg border border-blue-200",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("svg",{className:"w-5 h-5 text-blue-600 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),s.jsxs("p",{className:"text-blue-800 text-sm",children:[s.jsx("span",{className:"font-medium",children:"Ready to deploy:"})," Your assistant configuration has been optimized for edge deployment."]})]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(J,{className:"w-full bg-purple-600 hover:bg-purple-700 text-white py-3",children:"Deploy to Edge Device"}),s.jsx(J,{variant:"outline",className:"w-full",onClick:()=>n(2),children:"Back to Testing"})]})]})})};return s.jsxs("div",{className:"min-h-screen bg-gray-50",children:[s.jsx("header",{className:"bg-white border-b border-gray-200",children:s.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex items-center justify-between h-16",children:[s.jsx("div",{className:"flex items-center space-x-2",children:s.jsx("img",{src:"/assets/logo.png",alt:"EdgeMate Logo",className:"h-10 w-auto",onError:P=>{console.error("Logo failed to load"),P.currentTarget.style.display="none"}})}),s.jsxs("nav",{className:"flex space-x-8",children:[s.jsx("button",{onClick:()=>e("/"),className:"text-gray-600 hover:text-gray-900 px-3 py-2 text-sm font-medium",children:"Home"}),s.jsx("button",{onClick:()=>e("/technology"),className:"text-gray-600 hover:text-gray-900 px-3 py-2 text-sm font-medium",children:"Technology"}),s.jsx("button",{onClick:()=>e("/usecases"),className:"text-gray-600 hover:text-gray-900 px-3 py-2 text-sm font-medium",children:"Use Case"}),s.jsx("button",{className:"bg-purple-600 text-white px-4 py-2 text-sm font-medium rounded",children:"My Device"})]})]})})}),s.jsxs("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[T(),t===1&&z(),t===2&&L(),t===3&&I()]})]})}function HE(){return FE()}function WE(){const e=Lr(),[t,n]=g.useState(!1),[r]=g.useState(HE()),[i,o]=g.useState([]),[l,a]=g.useState(""),[u,c]=g.useState("All");g.useEffect(()=>{f(),d()},[]);const f=async()=>{try{const h=`${window.location.protocol}//${window.location.host}`,v=await fetch(`${h}/models`);n(v.ok)}catch{n(!1)}},d=()=>{try{const h=JSON.parse(localStorage.getItem("likedTemplates")||"[]");o(h)}catch(h){console.error("Failed to load liked templates:",h)}},p=h=>{const v=i.includes(h)?i.filter(k=>k!==h):[...i,h];o(v),localStorage.setItem("likedTemplates",JSON.stringify(v))},m=h=>{const v={name:h.name,description:h.description,model:h.model,systemPrompt:h.systemPrompt,temperature:h.temperature,maxTokens:h.maxTokens};localStorage.setItem("loadAssistantConfig",JSON.stringify(v)),e("/playground")},w=r.filter(h=>{const v=h.name.toLowerCase().includes(l.toLowerCase())||h.description.toLowerCase().includes(l.toLowerCase())||h.tags.some(j=>j.toLowerCase().includes(l.toLowerCase())),k=u==="All"||h.category===u;return v&&k}),x=w.filter(h=>h.isOfficial),S=[...w].sort((h,v)=>v.usageCount-h.usageCount).slice(0,6),y=["All",...Array.from(new Set(r.map(h=>h.category)))];return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx("div",{className:"sticky top-0 z-40 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:s.jsx("div",{className:"max-w-6xl mx-auto px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"flex items-center gap-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center",children:s.jsx(Er,{className:"h-5 w-5 text-white"})}),s.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Assistant Templates"}),s.jsx(xe,{variant:t?"default":"secondary",className:"text-xs",children:t?"Online":"Offline"})]})}),s.jsxs(J,{onClick:()=>e("/playground"),className:"flex items-center gap-2",children:[s.jsx(ti,{className:"h-4 w-4"}),"Create Assistant"]})]})})}),s.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-8",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Explore AI Assistants"}),s.jsx("p",{className:"text-lg text-gray-600 max-w-2xl mx-auto mb-8",children:"Discover, customize and deploy specialized AI assistants. Start with proven templates or build from scratch."}),s.jsxs("div",{className:"relative max-w-2xl mx-auto mb-8",children:[s.jsx(Zp,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),s.jsx(ni,{type:"text",placeholder:"Search assistants...",value:l,onChange:h=>a(h.target.value),className:"pl-12 pr-4 py-3 text-lg rounded-full border-2 border-gray-200 focus:border-blue-500"})]}),s.jsx("div",{className:"flex flex-wrap justify-center gap-2 mb-8",children:y.map(h=>s.jsx(J,{variant:u===h?"default":"outline",size:"sm",onClick:()=>c(h),className:"rounded-full",children:h},h))})]}),u==="All"&&x.length>0&&s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx(qx,{className:"h-5 w-5 text-yellow-600"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Featured"}),s.jsx(xe,{variant:"secondary",className:"text-xs",children:"Curated by EdgeLLM Team"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:x.slice(0,3).map(h=>s.jsx(ou,{template:h,isLiked:i.includes(h.id),onLike:()=>p(h.id),onUse:()=>m(h),featured:!0},h.id))})]}),u==="All"&&s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx(ny,{className:"h-5 w-5 text-green-600"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Trending"}),s.jsx(xe,{variant:"secondary",className:"text-xs",children:"Most popular this week"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:S.slice(0,6).map(h=>s.jsx(ou,{template:h,isLiked:i.includes(h.id),onLike:()=>p(h.id),onUse:()=>m(h),trending:!0},h.id))})]}),s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx(WN,{className:"h-5 w-5 text-blue-600"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:u==="All"?"All Templates":u}),s.jsxs(xe,{variant:"outline",className:"text-xs",children:[w.length," available"]})]}),w.length>0?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:w.map(h=>s.jsx(ou,{template:h,isLiked:i.includes(h.id),onLike:()=>p(h.id),onUse:()=>m(h)},h.id))}):s.jsx(Ie,{className:"p-12 text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx(Zp,{className:"h-12 w-12 text-gray-400"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No templates found"}),s.jsx("p",{className:"text-gray-600",children:"Try adjusting your search or category filters"})]}),s.jsx(J,{variant:"outline",onClick:()=>{a(""),c("All")},children:"Clear filters"})]})})]})]})]})}function ou({template:e,isLiked:t,onLike:n,onUse:r,featured:i=!1,trending:o=!1}){return s.jsxs(Ie,{className:"group hover:shadow-xl transition-all duration-300 hover:-translate-y-1 border-2 hover:border-blue-200 relative",children:[i&&s.jsxs("div",{className:"absolute -top-2 -right-2 bg-yellow-500 text-white text-xs px-2 py-1 rounded-full font-medium flex items-center gap-1",children:[s.jsx(qx,{className:"h-3 w-3"}),"Featured"]}),o&&s.jsxs("div",{className:"absolute -top-2 -right-2 bg-green-500 text-white text-xs px-2 py-1 rounded-full font-medium flex items-center gap-1",children:[s.jsx(ny,{className:"h-3 w-3"}),"Trending"]}),s.jsx(Mt,{className:"pb-4",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl flex items-center justify-center text-2xl",children:e.icon}),s.jsxs("div",{children:[s.jsx(Lt,{className:"text-lg group-hover:text-blue-600 transition-colors",children:e.name}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsxs("p",{className:"text-sm text-blue-600 font-medium",children:["by ",e.author]}),e.isOfficial&&s.jsxs(xe,{variant:"default",className:"text-xs px-2 py-0 bg-blue-600",children:[s.jsx(Qk,{className:"h-3 w-3 mr-1"}),"Official"]})]})]})]}),s.jsx(J,{variant:"ghost",size:"sm",onClick:n,className:`${t?"text-red-500":"text-gray-400 hover:text-red-500"} transition-colors`,title:t?"Unlike":"Like",children:s.jsx(vN,{className:`h-4 w-4 ${t?"fill-current":""}`})})]})}),s.jsxs(Ye,{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-gray-600 line-clamp-2 leading-relaxed",children:e.description}),s.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.slice(0,3).map(l=>s.jsx(xe,{variant:"secondary",className:"text-xs bg-gray-100 hover:bg-gray-200 transition-colors",children:l},l))}),s.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(mN,{className:"h-4 w-4"}),s.jsx("span",{children:e.usageCount.toLocaleString()})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(zN,{className:"h-4 w-4 text-yellow-500 fill-current"}),s.jsx("span",{children:e.rating})]})]}),s.jsx(xe,{variant:"outline",className:"text-xs",children:e.category})]}),s.jsx("div",{className:"pt-2",children:s.jsxs(J,{onClick:r,className:"w-full group-hover:bg-blue-600 group-hover:text-white transition-all",variant:"outline",children:[s.jsx(ia,{className:"h-4 w-4 mr-2"}),"Build Assistant"]})})]})]})}var lu="rovingFocusGroup.onEntryFocus",GE={bubbles:!1,cancelable:!0},Yo="RovingFocusGroup",[Ic,Xv,KE]=Kd(Yo),[QE,qv]=sr(Yo,[KE]),[YE,XE]=QE(Yo),Jv=g.forwardRef((e,t)=>s.jsx(Ic.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Ic.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(qE,{...e,ref:t})})}));Jv.displayName=Yo;var qE=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:c,preventScrollOnEntryFocus:f=!1,...d}=e,p=g.useRef(null),m=ve(t,p),w=oa(o),[x,S]=Ci({prop:l,defaultProp:a??null,onChange:u,caller:Yo}),[y,h]=g.useState(!1),v=er(c),k=Xv(n),j=g.useRef(!1),[C,E]=g.useState(0);return g.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(lu,v),()=>T.removeEventListener(lu,v)},[v]),s.jsx(YE,{scope:n,orientation:r,dir:w,loop:i,currentTabStopId:x,onItemFocus:g.useCallback(T=>S(T),[S]),onItemShiftTab:g.useCallback(()=>h(!0),[]),onFocusableItemAdd:g.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:g.useCallback(()=>E(T=>T-1),[]),children:s.jsx(le.div,{tabIndex:y||C===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{j.current=!0}),onFocus:ee(e.onFocus,T=>{const z=!j.current;if(T.target===T.currentTarget&&z&&!y){const L=new CustomEvent(lu,GE);if(T.currentTarget.dispatchEvent(L),!L.defaultPrevented){const I=k().filter(O=>O.focusable),P=I.find(O=>O.active),R=I.find(O=>O.id===x),M=[P,R,...I].filter(Boolean).map(O=>O.ref.current);t0(M,f)}}j.current=!1}),onBlur:ee(e.onBlur,()=>h(!1))})})}),Zv="RovingFocusGroupItem",e0=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:l,...a}=e,u=qn(),c=o||u,f=XE(Zv,n),d=f.currentTabStopId===c,p=Xv(n),{onFocusableItemAdd:m,onFocusableItemRemove:w,currentTabStopId:x}=f;return g.useEffect(()=>{if(r)return m(),()=>w()},[r,m,w]),s.jsx(Ic.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:s.jsx(le.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:ee(e.onMouseDown,S=>{r?f.onItemFocus(c):S.preventDefault()}),onFocus:ee(e.onFocus,()=>f.onItemFocus(c)),onKeyDown:ee(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const y=eP(S,f.orientation,f.dir);if(y!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let v=p().filter(k=>k.focusable).map(k=>k.ref.current);if(y==="last")v.reverse();else if(y==="prev"||y==="next"){y==="prev"&&v.reverse();const k=v.indexOf(S.currentTarget);v=f.loop?tP(v,k+1):v.slice(k+1)}setTimeout(()=>t0(v))}}),children:typeof l=="function"?l({isCurrentTabStop:d,hasTabStop:x!=null}):l})})});e0.displayName=Zv;var JE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZE(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function eP(e,t,n){const r=ZE(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return JE[r]}function t0(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function tP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var nP=Jv,rP=e0;function iP(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Xo=e=>{const{present:t,children:n}=e,r=oP(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),o=ve(r.ref,lP(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:o}):null};Xo.displayName="Presence";function oP(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),o=g.useRef("none"),l=e?"mounted":"unmounted",[a,u]=iP(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Cl(r.current);o.current=a==="mounted"?c:"none"},[a]),tt(()=>{const c=r.current,f=i.current;if(f!==e){const p=o.current,m=Cl(c);e?u("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),tt(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,d=m=>{const x=Cl(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&x&&(u("ANIMATION_END"),!i.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},p=m=>{m.target===t&&(o.current=Cl(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Cl(e){return(e==null?void 0:e.animationName)||"none"}function lP(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ha="Tabs",[sP,OR]=sr(ha,[qv]),n0=qv(),[aP,uf]=sP(ha),r0=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:l="horizontal",dir:a,activationMode:u="automatic",...c}=e,f=oa(a),[d,p]=Ci({prop:r,onChange:i,defaultProp:o??"",caller:ha});return s.jsx(aP,{scope:n,baseId:qn(),value:d,onValueChange:p,orientation:l,dir:f,activationMode:u,children:s.jsx(le.div,{dir:f,"data-orientation":l,...c,ref:t})})});r0.displayName=ha;var i0="TabsList",o0=g.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=uf(i0,n),l=n0(n);return s.jsx(nP,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:r,children:s.jsx(le.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});o0.displayName=i0;var l0="TabsTrigger",s0=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,l=uf(l0,n),a=n0(n),u=c0(l.baseId,r),c=d0(l.baseId,r),f=r===l.value;return s.jsx(rP,{asChild:!0,...a,focusable:!i,active:f,children:s.jsx(le.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":c,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...o,ref:t,onMouseDown:ee(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?l.onValueChange(r):d.preventDefault()}),onKeyDown:ee(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&l.onValueChange(r)}),onFocus:ee(e.onFocus,()=>{const d=l.activationMode!=="manual";!f&&!i&&d&&l.onValueChange(r)})})})});s0.displayName=l0;var a0="TabsContent",u0=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...l}=e,a=uf(a0,n),u=c0(a.baseId,r),c=d0(a.baseId,r),f=r===a.value,d=g.useRef(f);return g.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),s.jsx(Xo,{present:i||f,children:({present:p})=>s.jsx(le.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!p,id:c,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&o})})});u0.displayName=a0;function c0(e,t){return`${e}-trigger-${t}`}function d0(e,t){return`${e}-content-${t}`}var uP=r0,f0=o0,p0=s0,m0=u0;const cP=uP,h0=g.forwardRef(({className:e,...t},n)=>s.jsx(f0,{ref:n,className:ce("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));h0.displayName=f0.displayName;const Hl=g.forwardRef(({className:e,...t},n)=>s.jsx(p0,{ref:n,className:ce("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Hl.displayName=p0.displayName;const Wl=g.forwardRef(({className:e,...t},n)=>s.jsx(m0,{ref:n,className:ce("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Wl.displayName=m0.displayName;var ga="Dialog",[g0,x0]=sr(ga),[dP,Jt]=g0(ga),y0=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,a=g.useRef(null),u=g.useRef(null),[c,f]=Ci({prop:r,defaultProp:i??!1,onChange:o,caller:ga});return s.jsx(dP,{scope:t,triggerRef:a,contentRef:u,contentId:qn(),titleId:qn(),descriptionId:qn(),open:c,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(d=>!d),[f]),modal:l,children:n})};y0.displayName=ga;var v0="DialogTrigger",w0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(v0,n),o=ve(t,i.triggerRef);return s.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ff(i.open),...r,ref:o,onClick:ee(e.onClick,i.onOpenToggle)})});w0.displayName=v0;var cf="DialogPortal",[fP,S0]=g0(cf,{forceMount:void 0}),b0=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Jt(cf,t);return s.jsx(fP,{scope:t,forceMount:n,children:g.Children.map(r,l=>s.jsx(Xo,{present:n||o.open,children:s.jsx(of,{asChild:!0,container:i,children:l})}))})};b0.displayName=cf;var Os="DialogOverlay",k0=g.forwardRef((e,t)=>{const n=S0(Os,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Jt(Os,e.__scopeDialog);return o.modal?s.jsx(Xo,{present:r||o.open,children:s.jsx(mP,{...i,ref:t})}):null});k0.displayName=Os;var pP=ki("DialogOverlay.RemoveScroll"),mP=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(Os,n);return s.jsx(Ky,{as:pP,allowPinchZoom:!0,shards:[i.contentRef],children:s.jsx(le.div,{"data-state":ff(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),_r="DialogContent",N0=g.forwardRef((e,t)=>{const n=S0(_r,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Jt(_r,e.__scopeDialog);return s.jsx(Xo,{present:r||o.open,children:o.modal?s.jsx(hP,{...i,ref:t}):s.jsx(gP,{...i,ref:t})})});N0.displayName=_r;var hP=g.forwardRef((e,t)=>{const n=Jt(_r,e.__scopeDialog),r=g.useRef(null),i=ve(t,n.contentRef,r);return g.useEffect(()=>{const o=r.current;if(o)return zy(o)},[]),s.jsx(C0,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0;(l.button===2||a)&&o.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,o=>o.preventDefault())})}),gP=g.forwardRef((e,t)=>{const n=Jt(_r,e.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return s.jsx(C0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var u,c;(u=e.onInteractOutside)==null||u.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),C0=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...l}=e,a=Jt(_r,n),u=g.useRef(null),c=ve(t,u);return cy(),s.jsxs(s.Fragment,{children:[s.jsx(Yd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:s.jsx(Qd,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ff(a.open),...l,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(yP,{titleId:a.titleId}),s.jsx(wP,{contentRef:u,descriptionId:a.descriptionId})]})]})}),df="DialogTitle",j0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(df,n);return s.jsx(le.h2,{id:i.titleId,...r,ref:t})});j0.displayName=df;var E0="DialogDescription",P0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(E0,n);return s.jsx(le.p,{id:i.descriptionId,...r,ref:t})});P0.displayName=E0;var T0="DialogClose",A0=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Jt(T0,n);return s.jsx(le.button,{type:"button",...r,ref:t,onClick:ee(e.onClick,()=>i.onOpenChange(!1))})});A0.displayName=T0;function ff(e){return e?"open":"closed"}var _0="DialogTitleWarning",[xP,I0]=pC(_0,{contentName:_r,titleName:df,docsSlug:"dialog"}),yP=({titleId:e})=>{const t=I0(_0),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.