@brainfish-ai/components 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("lucide-react"),r=require("framer-motion"),a=require("react-markdown"),o=require("remark-gfm"),n=require("react/jsx-runtime"),i=require("class-variance-authority"),s=require("clsx"),l=require("tailwind-merge"),c=require("@radix-ui/react-dropdown-menu"),d=require("@radix-ui/react-icons");function m(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var p=m(e),u=m(c);function g(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function h(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function f(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function w(...e){return t=>{let r=!1;const a=e.map((e=>{const a=f(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():f(e[t],null)}}}}!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.\\!container{margin-left:auto!important;margin-right:auto!important;padding-left:2rem!important;padding-right:2rem!important;width:100%!important}.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.\\!container{max-width:1400px!important}.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-12{left:3rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\\/2{top:50%}.top-3{top:.75rem}.z-10{z-index:10}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-4{margin-top:1rem}.mb-4,.my-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-3{margin-top:.75rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-none{max-width:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-x-1{--tw-translate-x:-0.25rem}.-translate-x-1,.-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%}.rotate-180{--tw-rotate:180deg}.rotate-180,.rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate:45deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-400{--tw-border-opacity:1;border-color:rgb(156 163 175/var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.pb-1{padding-bottom:.25rem}.pb-24{padding-bottom:6rem}.pl-2{padding-left:.5rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var b=p.forwardRef(((e,t)=>{const{children:r,...a}=e,o=p.Children.toArray(r),i=o.find(x);if(i){const e=i.props.children,r=o.map((t=>t===i?p.Children.count(e)>1?p.Children.only(null):p.isValidElement(e)?e.props.children:null:t));return n.jsx(y,{...a,ref:t,children:p.isValidElement(e)?p.cloneElement(e,void 0,r):null})}return n.jsx(y,{...a,ref:t,children:r})}));b.displayName="Slot";var y=p.forwardRef(((e,t)=>{const{children:r,...a}=e;if(p.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r);return p.cloneElement(r,{...k(a,r.props),ref:t?w(t,e):e})}return p.Children.count(r)>1?p.Children.only(null):null}));y.displayName="SlotClone";var v=({children:e})=>n.jsx(n.Fragment,{children:e});function x(e){return p.isValidElement(e)&&e.type===v}function k(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function E(...e){return l.twMerge(s.clsx(e))}const N=i.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),C=p.forwardRef(((e,t)=>{var{className:r,variant:a,size:o,asChild:n=!1}=e,i=g(e,["className","variant","size","asChild"]);const s=n?b:"button";return p.createElement(s,Object.assign({className:E(N({variant:a,size:o,className:r})),ref:t},i))}));function j({answer:r,question:n,theme:i,searchResults:s,followUpQuestions:l,onFollowUpClick:c}){const[d,m]=e.useState(null),[p,u]=e.useState(!1),g=({className:t,children:r,theme:a})=>!/language-(\w+)/.exec(t||"")?e.createElement("code",{className:`${t} rounded px-1`,style:{backgroundColor:`${a.border}20`}},r):e.createElement("pre",{className:"rounded-md p-4",style:{backgroundColor:`${a.border}20`}},e.createElement("code",{className:t},r));return e.createElement("div",{className:"space-y-6"},e.createElement("div",{className:"rounded-xl",style:{borderColor:i.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"p-6 space-y-4"},e.createElement("div",{className:"flex items-start justify-between"},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.Sparkles,{className:"h-5 w-5",style:{color:i.primary}}),e.createElement("h2",{className:"text-xl",style:{color:i.text}},n)),r&&e.createElement(C,{variant:"ghost",size:"icon",className:"hover:opacity-90 transition-colors duration-200",style:{color:i.text},onClick:()=>{navigator.clipboard.writeText(`${n}\n\n${r}`)}},e.createElement(t.Copy,{className:"h-5 w-4"}))),r&&e.createElement("div",{className:"prose prose-sm max-w-none",style:{color:i.text}},e.createElement(a,{remarkPlugins:[o],components:{img:t=>e.createElement("img",Object.assign({},t,{className:"rounded-lg shadow-md my-4",alt:t.alt||""})),code:({className:t,children:r})=>e.createElement(g,{className:t,theme:i},r)}},r)),r&&e.createElement("div",{className:"mt-6 flex justify-end gap-2"},e.createElement(C,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!1===d?i.primary:`${i.text}60`},onClick:()=>m(!1)},e.createElement(t.ThumbsDown,{className:"h-4 w-4"})),e.createElement(C,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!0===d?i.primary:`${i.text}60`},onClick:()=>m(!0)},e.createElement(t.ThumbsUp,{className:"h-4 w-4"}))),r&&l&&l.length>0&&e.createElement("div",{className:"mt-6 space-y-3"},e.createElement("div",{className:"text-sm font-medium",style:{color:i.text}},"Follow-up Questions"),e.createElement("div",{className:"flex flex-wrap gap-2"},l.map(((t,r)=>e.createElement("button",{key:r,onClick:()=>null==c?void 0:c(t),className:"px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:opacity-90",style:{backgroundColor:`${i.accent}30`,color:i.text,border:`1px solid ${i.border}`}},t))))),s&&s.length>0&&e.createElement("div",{className:"space-y-3 mt-6"},e.createElement("button",{onClick:()=>u(!p),className:"w-full flex items-center justify-between p-3 rounded-lg hover:opacity-90 transition-all duration-200",style:{backgroundColor:`${i.accent}30`,color:i.text}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.FileText,{className:"h-4 w-4",style:{color:i.primary}}),e.createElement("span",{className:"font-medium"},"Related Articles (",s.length,")")),e.createElement(t.ChevronDown,{className:"h-4 w-4 transition-transform duration-200 "+(p?"rotate-180":""),style:{color:i.text}})),e.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:p?48*s.length+"px":"0",opacity:p?1:0,transform:`translateY(${p?"0":"-10px"})`}},e.createElement("div",{className:"space-y-2 pl-2"},s.map((r=>e.createElement("a",{key:r.id,href:r.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-lg hover:opacity-90 transition-colors duration-200",style:{backgroundColor:`${i.accent}20`,color:i.text}},e.createElement(t.FileText,{className:"h-4 w-4",style:{color:i.primary}}),e.createElement("span",{className:"flex-grow"},r.title),e.createElement(t.ExternalLink,{className:"h-4 w-4",style:{color:`${i.text}60`}}))))))),!r&&e.createElement("div",{className:"animate-pulse space-y-4"},e.createElement("div",{className:"h-4 rounded w-full",style:{backgroundColor:`${i.border}40`}}),e.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${i.border}40`}})))))}function z({theme:t,loadingText:r="Analyzing..."}){return e.createElement("div",{className:"w-full space-y-6 rounded-xl p-6",style:{borderColor:t.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement("div",{className:"w-5 h-5 rounded-full animate-pulse",style:{backgroundColor:`${t.primary}30`}}),e.createElement("div",{className:"text-sm",style:{color:t.text}},r)),e.createElement("div",{className:"space-y-4 animate-pulse"},Array.from({length:4}).map(((r,a)=>e.createElement("div",{key:a,className:"h-4 rounded w-full",style:{backgroundColor:`${t.border}40`}}))),e.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${t.border}40`}})),e.createElement("div",{className:"rounded-lg p-4",style:{backgroundColor:`${t.accent}50`}},e.createElement("div",{className:"flex items-center justify-between"},e.createElement("div",{className:"h-4 rounded w-48",style:{backgroundColor:`${t.border}80`}}),e.createElement("div",{className:"flex gap-2"},e.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${t.border}80`}}),e.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${t.border}80`}})))))}function S({onClick:r,theme:a}){return e.createElement(C,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:a.background,borderColor:a.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:r},e.createElement(t.ArrowDown,{className:"h-5 w-5",style:{color:a.text}}))}function O({questions:t,currentIndex:a,activeIndex:o,onNavigate:n,theme:i,offset:s}){return e.createElement(r.motion.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},className:"fixed left-4 top-1/2 -translate-y-1/2 z-50 flex flex-col gap-2",style:{left:`${s}px`}},t.map(((t,r)=>e.createElement("div",{key:r,className:"relative group"},e.createElement("button",{onClick:()=>n(r),className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 "+(r<=a?"hover:opacity-90":""),style:{backgroundColor:r===o?i.primary:i.border,color:r===o?i.background:i.text,opacity:r>a?.5:1,cursor:"pointer"}},r+1),e.createElement("div",{className:"absolute left-12 top-0 px-3 py-2 rounded-lg whitespace-normal opacity-0 group-hover:opacity-100 w-48 text-sm transition-opacity duration-200",style:{backgroundColor:i.background,color:i.text,borderColor:i.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},t,e.createElement("div",{className:"absolute left-0 top-3 -translate-x-1 w-2 h-2 rotate-45",style:{backgroundColor:i.background,borderLeft:`1px solid ${i.border}`,borderBottom:`1px solid ${i.border}`}}))))))}function R({questions:t,onQuestionClick:r,borderColor:a}){return t&&0!==t.length?e.createElement("div",{className:"w-full"},e.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},"Suggested questions"),e.createElement("div",{className:"flex flex-wrap gap-2"},t.map(((t,o)=>e.createElement("button",{key:o,onClick:()=>r(t),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm",style:{borderColor:a}},t))))):null}C.displayName="Button";const I=u.Root,L=u.Trigger;p.forwardRef(((e,t)=>{var{className:r,inset:a,children:o}=e,n=g(e,["className","inset","children"]);return p.createElement(u.SubTrigger,Object.assign({ref:t,className:E("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",r)},n),o,p.createElement(d.ChevronRightIcon,{className:"ml-auto"}))})).displayName=u.SubTrigger.displayName;p.forwardRef(((e,t)=>{var{className:r}=e,a=g(e,["className"]);return p.createElement(u.SubContent,Object.assign({ref:t,className:E("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",r)},a))})).displayName=u.SubContent.displayName;const q=p.forwardRef(((e,t)=>{var{className:r,sideOffset:a=4}=e,o=g(e,["className","sideOffset"]);return p.createElement(u.Portal,null,p.createElement(u.Content,Object.assign({ref:t,sideOffset:a,className:E("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",r)},o)))}));q.displayName=u.Content.displayName;const $=p.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=g(e,["className","inset"]);return p.createElement(u.Item,Object.assign({ref:t,className:E("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",a&&"pl-8",r)},o))}));$.displayName=u.Item.displayName;p.forwardRef(((e,t)=>{var{className:r,children:a,checked:o}=e,n=g(e,["className","children","checked"]);return p.createElement(u.CheckboxItem,Object.assign({ref:t,className:E("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:o},n),p.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},p.createElement(u.ItemIndicator,null,p.createElement(d.CheckIcon,{className:"h-4 w-4"}))),a)})).displayName=u.CheckboxItem.displayName;p.forwardRef(((e,t)=>{var{className:r,children:a}=e,o=g(e,["className","children"]);return p.createElement(u.RadioItem,Object.assign({ref:t,className:E("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r)},o),p.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},p.createElement(u.ItemIndicator,null,p.createElement(d.DotFilledIcon,{className:"h-2 w-2 fill-current"}))),a)})).displayName=u.RadioItem.displayName;p.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=g(e,["className","inset"]);return p.createElement(u.Label,Object.assign({ref:t,className:E("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",r)},o))})).displayName=u.Label.displayName;function T(e,t,r){return h(this,void 0,void 0,(function*(){try{const a=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({query:t,limit:5},r&&{collectionId:r}))});if(!a.ok)throw new Error("Failed to fetch search results");const o=yield a.json();return{results:o.results,searchQueryId:o.searchQueryId}}catch(e){throw console.error("Error searching:",e),e}}))}function A(e,t){return h(this,void 0,void 0,(function*(){try{const r=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({searchQueryId:t})});if(!r.ok)throw new Error("Failed to fetch answer");return r}catch(e){throw console.error("Error fetching answer:",e),e}}))}p.forwardRef(((e,t)=>{var{className:r}=e,a=g(e,["className"]);return p.createElement(u.Separator,Object.assign({ref:t,className:E("-mx-1 my-1 h-px bg-muted",r)},a))})).displayName=u.Separator.displayName;const U={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717"};exports.ChatSearch=function({suggestedQuestions:a,theme:o={},collections:n=[],selectedCollectionId:i,onCollectionChange:s,searchEndpoint:l,answerEndpoint:c,followUpQuestionsEndpoint:d,disableFollowUpQuestions:m=!1,siblingNode:p,offset:u=0}){var g;const f=Object.assign(Object.assign({},U),o),[w,b]=e.useState(""),[y,v]=e.useState(""),[x,k]=e.useState(!1),[E,N]=e.useState(!1),[P,Q]=e.useState([]),[D,F]=e.useState(!1),[W,X]=e.useState(0),[Y,_]=e.useState([]),[B,M]=e.useState(i),V=e.useRef(null),H=e.useRef(null),K=e.useRef([]),J=e.useRef(null),G=e.useRef(null);e.useEffect((()=>{M(i)}),[i]);const Z=e=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`},ee=()=>{setTimeout((()=>{var e;K.current[K.current.length-1]&&(null===(e=K.current[K.current.length-1])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),J.current&&J.current.scrollBy(0,-80))}),100)},te=(e,t,r)=>h(this,void 0,void 0,(function*(){if(!e.body)throw new Error("No response body");const a=e.body.getReader(),o=new TextDecoder;let n="";const i=m?Promise.resolve([]):function(e,t,r){return h(this,void 0,void 0,(function*(){try{const a=new AbortController,o=setTimeout((()=>a.abort()),5e3),n=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:t,answer:r||"Generating answer..."}),signal:a.signal});if(clearTimeout(o),!n.ok)throw new Error("Failed to fetch follow-up questions");return(yield n.json()).questions.slice(0,3)}catch(e){return e instanceof Error&&console.error("Error fetching follow-up questions:",e.message),[]}}))}(d,t,"");let s=!0;for(;s;){const{done:e,value:l}=yield a.read();if(e){if(s=!1,!m)try{const e=yield i;Q((t=>{const r=[...t];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{followUpQuestions:e}),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}continue}const c=o.decode(l);n+=c,Q((e=>{const a=[...e];return a[a.length-1]={question:t,answer:n,isLoading:!1,searchResults:r},a}))}})),re=()=>h(this,void 0,void 0,(function*(){if(w.trim()){k(!0),N(!0),Q((e=>[...e,{question:w,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const e=yield T(l,w,B),t=e.results,r=e.searchQueryId;Q((e=>{const r=[...e];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{searchResults:t,isSearchLoading:!1}),r}));const a=yield A(c,r);yield te(a,w,t)}catch(e){console.error("Error generating answer:",e),Q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{k(!1),ee()}}})),ae=()=>h(this,void 0,void 0,(function*(){if(y.trim()){const e=y;b(e),v(""),k(!0),Q((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const t=yield T(l,e),r=t.results,a=t.searchQueryId;Q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const o=yield A(c,a);yield te(o,e,r)}catch(e){console.error("Error generating answer:",e),Q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{k(!1),ee()}}}));return e.useEffect((()=>{const e=J.current;if(!e)return;const t=()=>{const{scrollTop:t,scrollHeight:r,clientHeight:a}=e;F(!(r-t-a<100))};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}),[]),e.useEffect((()=>()=>{Y.forEach((e=>URL.revokeObjectURL(e.preview)))}),[Y]),e.createElement("div",{className:"relative min-h-screen"},e.createElement("div",{ref:J,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20 h-screen overflow-y-auto"},e.createElement(r.AnimatePresence,null,E?e.createElement(r.motion.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-8 pb-24"},P.map(((t,a)=>e.createElement(r.motion.div,{key:a,ref:e=>K.current[a]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*a}},t.isLoading?e.createElement(z,{theme:f,loadingText:t.isSearchLoading?"Looking for relevant content...":"Analyzing..."}):e.createElement(j,{answer:t.answer,question:t.question,theme:f,searchResults:t.searchResults,followUpQuestions:m?void 0:t.followUpQuestions,onFollowUpClick:m?void 0:e=>{v(e),ae()}}))))):e.createElement(r.motion.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},e.createElement("div",{className:"w-full text-center space-y-4"},e.createElement(r.motion.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:f.text}},"How can we help you today?")),e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},e.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:f.background,borderColor:f.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"p-3 flex items-center"},e.createElement(t.Search,{className:"h-5 w-5 text-gray-400 mr-2"}),e.createElement("textarea",{ref:V,placeholder:"Ask a question or type a search term here ...",value:w,onChange:e=>{b(e.target.value),Z(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),re())},className:"w-full resize-none outline-none text-lg font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:f.text},rows:1})),Y.length>0&&e.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},Y.map(((r,a)=>e.createElement("div",{key:a,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},e.createElement("img",{src:r.preview,alt:`Attached ${a+1}`,className:"w-full h-full object-cover"}),e.createElement("button",{onClick:()=>(e=>{_((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(a),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},e.createElement(t.X,{className:"h-3 w-3 text-white"})))))),e.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},e.createElement("div",{className:"flex gap-2"},n.length>0&&e.createElement(I,null,e.createElement(L,{asChild:!0},e.createElement(C,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},e.createElement("div",{className:"w-5 h-5 rounded-full border-2 border-gray-400 border-dashed flex items-center justify-center"}),(null===(g=n.find((e=>e.id===B)))||void 0===g?void 0:g.name)||"All documents",e.createElement(t.ChevronDown,{className:"h-4 w-4 opacity-50"}))),e.createElement(q,null,n.map((t=>e.createElement($,{key:t.id,onClick:()=>{return e=t.id,M(e),void(null==s||s(e));var e},className:t.id===B?"bg-gray-100":""},t.name))))),e.createElement("input",{type:"file",ref:G,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));_((t=>[...t,...e]))}G.current&&(G.current.value="")}}),e.createElement(C,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.click()}},e.createElement(t.Image,{className:"h-4 w-4 mr-1.5"}),"Attach image")),e.createElement("div",{className:"flex items-center"},e.createElement(C,{size:"sm",disabled:!w||x,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{re()}},x?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):e.createElement(t.ArrowRight,{className:"h-4 w-4 text-gray-700"})))))),e.createElement(R,{questions:a,onQuestionClick:e=>{N(!0),k(!0),Q((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}])),(()=>{h(this,void 0,void 0,(function*(){try{const t=yield T(l,e),r=t.results;Q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const a=yield A(c,t.searchQueryId);yield te(a,e,r)}catch(e){console.error("Error generating answer:",e),Q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{k(!1),ee()}}))})()},borderColor:f.border}),p)),E&&P.length>0&&e.createElement(O,{questions:P.map((e=>e.question)),currentIndex:x?P.length-1:W,activeIndex:W,onNavigate:e=>{X(e),(e=>{setTimeout((()=>{var t;K.current[e]&&(null===(t=K.current[e])||void 0===t||t.scrollIntoView({behavior:"smooth",block:"start"}),J.current&&J.current.scrollBy(0,-80))}),100)})(e)},theme:f,offset:u}),E&&e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${u}px`}},e.createElement("div",{className:"rounded-full px-4 py-2 flex items-center justify-between",style:{backgroundColor:f.background,borderColor:f.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},e.createElement("div",{className:"flex items-center gap-2 flex-grow overflow-hidden"},e.createElement(t.Plus,{className:"h-4 w-4 flex-shrink-0",style:{color:f.primary}}),e.createElement("textarea",{ref:H,placeholder:"Ask follow-up",value:y,onChange:e=>{v(e.target.value),Z(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ae())},disabled:x,className:"w-full bg-transparent outline-none text-sm resize-none overflow-hidden disabled:opacity-50 border-none",style:{color:f.text},rows:1})),e.createElement("div",{className:"flex items-center gap-3 ml-2 flex-shrink-0"},e.createElement(C,{size:"icon",variant:"ghost",disabled:x||!y.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 flex items-center justify-center",style:{color:f.text,backgroundColor:"transparent"},onClick:()=>{ae()}},x?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2",style:{borderColor:`${f.text}40`,borderTopColor:f.text}}):e.createElement(t.ArrowUp,{className:"h-4 w-4"}))))),D&&E&&e.createElement(S,{onClick:ee,theme:f})))};
1
+ "use strict";var e=require("react"),t=require("lucide-react"),r=require("framer-motion"),a=require("rehype-raw"),o=require("remark-gfm"),n=require("react-syntax-highlighter"),i=require("react-syntax-highlighter/dist/cjs/styles/prism"),s=require("react/jsx-runtime"),l=require("class-variance-authority"),c=require("clsx"),d=require("tailwind-merge"),m=require("react-markdown"),p=require("@radix-ui/react-dropdown-menu"),u=require("@radix-ui/react-icons");function g(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var h=g(e),b=g(p);function w(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function f(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function y(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function v(...e){return t=>{let r=!1;const a=e.map((e=>{const a=y(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():y(e[t],null)}}}}!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.\\!container{margin-left:auto!important;margin-right:auto!important;padding-left:2rem!important;padding-right:2rem!important;width:100%!important}.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.\\!container{max-width:1400px!important}.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-12{left:3rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\\/2{top:50%}.top-3{top:.75rem}.z-10{z-index:10}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-top:.5rem}.mb-2,.my-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-3{margin-top:.75rem}.mt-6{margin-top:1.5rem}.block{display:block}.\\!inline{display:inline!important}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1{--tw-translate-x:-0.25rem}.-translate-x-1,.-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%}.rotate-180{--tw-rotate:180deg}.rotate-180,.rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate:45deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-outside{list-style-position:outside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-lg{border-bottom-left-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-400{--tw-border-opacity:1;border-color:rgb(156 163 175/var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-zinc-800\\/80{background-color:rgba(39,39,42,.8)}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.pb-1{padding-bottom:.25rem}.pb-24{padding-bottom:6rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:bg-zinc-700\\/50:hover{background-color:rgba(63,63,70,.5)}.hover\\:bg-opacity-50:hover{--tw-bg-opacity:0.5}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.hover\\:text-zinc-100:hover{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}:is([data-mode=dark] .dark\\:border-white){--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var x=h.forwardRef(((e,t)=>{const{children:r,...a}=e,o=h.Children.toArray(r),n=o.find(N);if(n){const e=n.props.children,r=o.map((t=>t===n?h.Children.count(e)>1?h.Children.only(null):h.isValidElement(e)?e.props.children:null:t));return s.jsx(k,{...a,ref:t,children:h.isValidElement(e)?h.cloneElement(e,void 0,r):null})}return s.jsx(k,{...a,ref:t,children:r})}));x.displayName="Slot";var k=h.forwardRef(((e,t)=>{const{children:r,...a}=e;if(h.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r);return h.cloneElement(r,{...j(a,r.props),ref:t?v(t,e):e})}return h.Children.count(r)>1?h.Children.only(null):null}));k.displayName="SlotClone";var E=({children:e})=>s.jsx(s.Fragment,{children:e});function N(e){return h.isValidElement(e)&&e.type===E}function j(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function C(...e){return d.twMerge(c.clsx(e))}const z=l.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),O=h.forwardRef(((e,t)=>{var{className:r,variant:a,size:o,asChild:n=!1}=e,i=w(e,["className","variant","size","asChild"]);const s=n?x:"button";return h.createElement(s,Object.assign({className:C(z({variant:a,size:o,className:r})),ref:t},i))}));O.displayName="Button";const S={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},R=n.Prism,$=e.memo((({language:r,value:a})=>{const[o,n]=e.useState(!1);return e.createElement("div",{className:"relative font-sans text-sm mt-1"},e.createElement("div",{className:"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur"},e.createElement("div",{className:"flex h-8 items-center justify-between px-3"},e.createElement("span",{className:"text-xs font-medium text-zinc-400"},r),e.createElement("div",{className:"flex gap-1"},e.createElement(O,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{f(void 0,void 0,void 0,(function*(){if(navigator.clipboard&&navigator.clipboard.writeText)try{yield navigator.clipboard.writeText(a),n(!0),setTimeout((()=>{n(!1)}),2e3)}catch(e){console.error("Failed to copy:",e)}}))}},o?e.createElement(t.CheckCircle,{size:18}):e.createElement(t.Clipboard,{size:18})),e.createElement(O,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{const e=S[r]||".file",t=`file-${((e,t=!1)=>{const r="ABCDEFGHJKLMNPQRSTUVWXY3456789";let a="";for(let t=0;t<e;t+=1)a+=r.charAt(Math.floor(30*Math.random()));return t?a.toLowerCase():a})(3,!0)}${e}`,o=new Blob([a],{type:"text/plain"}),n=URL.createObjectURL(o),i=document.createElement("a");i.download=t,i.href=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}},e.createElement(t.Download,{size:18}))))),e.createElement("div",{className:"rounded-b-lg"},e.createElement(R,{language:r,style:i.a11yDark,PreTag:"div",wrapLongLines:!0,customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0}},a)))}));$.displayName="CodeBlock";const I=h.forwardRef((({src:e,border:t,width:r="100%",height:a="400px",title:o},n)=>{const[i,s]=h.useState(!1);return h.useEffect((()=>{let e=!0;return setTimeout((()=>{e&&s(!0)}),0),()=>{e=!1}}),[]),h.createElement("div",{className:"overflow-hidden rounded-lg "+(t?"border":""),style:{width:r,height:a}},i&&h.createElement(h.Fragment,null,h.createElement("iframe",{ref:n,src:e,sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads",width:r,height:a,frameBorder:"0",title:"embed",loading:"lazy",allowFullScreen:!0,className:"block rounded-lg"}),o&&h.createElement("span",{className:"block text-center text-sm font-medium"},o)))}));function A(e){const t=e.attrs.href.replace("share","embed");return h.createElement(I,Object.assign({},e,{src:t,title:"Loom Embed"}))}function L(e){return h.createElement(I,Object.assign({},e,{src:e.attrs.href,title:"Supademo Embed"}))}function q(e){return h.createElement(I,Object.assign({},e,{src:e.attrs.href,title:"Typeform Embed"}))}function T(e){const t=e.attrs.href.match(/(http|https)?:\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:\/|\?)?([\d\w]+)?/);if(!t)return null;const r=t[4],a=t[5],o=`https://player.vimeo.com/video/${r}?byline=0${a?`&h=${a}`:""}`;return h.createElement(I,Object.assign({},e,{src:o,title:`Vimeo Embed (${r})`,height:"412px",border:!1}))}function F(e){const t=(e=>{const t=[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/];for(const r of t){const t=e.match(r);if(t)return t}return null})(e.attrs.href);if(!t)return null;const r=t[1],a=t[2]||t[1],o=r?`https://${r}.wistia.com/embed/iframe/${a}?seo=true&videoFoam=false`:`https://fast.wistia.com/embed/iframe/${a}`;return h.createElement(I,Object.assign({},e,{src:o,border:!0,title:`Wistia Embed (${a})`}))}function U(e){const t=(e=>{const t=e.match(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([a-zA-Z0-9_-]{11})$/i);return t?t[1]:null})(e.attrs.href);return t?h.createElement(I,Object.assign({},e,{src:`https://www.youtube.com/embed/${t}?modestbranding=1`,title:`YouTube Embed (${t})`})):null}A.isMatch=e=>/^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/.test(e),L.isMatch=e=>/^https:\/\/app\.supademo\.com\/embed\/(.*)$/.test(e),q.isMatch=e=>/^https:\/\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\.typeform\.com\/to\/(.*)$/.test(e),T.isMatch=e=>/^(https?):\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)?(\d+)(\/)?(?:\?.*|#.*)?$/i.test(e),F.isMatch=e=>[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i].some((t=>t.test(e))),U.isMatch=e=>/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\/|[?&].*)?$/i.test(e);const _=[A,L,q,U,F,T],P=t=>{const{href:r}=t.attrs,[a,o]=e.useState(null);if(e.useEffect((()=>{let e=!0;return f(void 0,void 0,void 0,(function*(){try{const a=_.find((e=>e.isMatch(r)));if(a&&e)return void o({Component:a,props:t});const n=(yield Promise.all(asyncEmbedComponents.map((e=>e.isMatch(r).catch((()=>!1)))))).findIndex((e=>e));if(-1!==n){const e=asyncEmbedComponents[n];e&&o({Component:e,props:t})}}catch(e){console.error("Error finding embed match:",e)}})),()=>{e=!1}}),[r,t]),a){const{Component:e,props:t}=a;return h.createElement(e,Object.assign({},t))}return null},Q=e.memo(m,((e,t)=>e.children===t.children)),M=e.memo((({message:t})=>(t.content=t.content.replace(/^\n+|(\n+|\\)+$/g,""),e.createElement(Q,{className:"dark:prose-invert prose flex-1",remarkPlugins:[o],rehypePlugins:[a],components:{code(t){var{inline:r,className:a,children:o}=t,n=w(t,["inline","className","children"]);const i=/language-(\w+)/.exec(a||""),s=i&&i[1];return!r&&s?e.createElement($,Object.assign({key:Math.random(),language:s,value:String(o).replace(/\n$/,"")},n)):e.createElement("code",Object.assign({className:`text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${a}`.trim()},n),o)},marker:({children:t})=>e.createElement("div",{className:"my-2"},e.createElement("span",{className:"highlight"},t)),table:({children:t})=>e.createElement("table",{className:"border-collapse border border-black px-3 py-1 dark:border-white"},t),th:({children:t})=>e.createElement("th",{className:"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white"},t),td:({children:t})=>e.createElement("td",{className:"break-words border border-black px-3 py-1 dark:border-white"},t),a(t){var{children:r}=t,a=w(t,["children"]);if(a.href){const t=P({attrs:{href:a.href}});if(e.isValidElement(t))return t}return e.createElement("a",Object.assign({className:"link",target:"_blank",rel:"noopener noreferrer"},a),r)},pre:({children:t})=>e.createElement(e.Fragment,null,t),img({src:t,alt:r}){const a=P({attrs:{href:null!=t?t:""}});return e.isValidElement(a)?a:e.createElement("img",{src:t,alt:r,className:"w-full"})},li:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("li",Object.assign({className:"py-1"},a),r)},ul:({children:t})=>e.createElement("ul",{className:"ml-4 list-outside list-disc"},t),ol:({children:t})=>e.createElement("ol",{className:"ml-4 list-outside list-decimal"},t),strong:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("span",Object.assign({className:"font-semibold"},a),r)},h1:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("h1",Object.assign({className:"mb-2 mt-6 text-3xl font-semibold"},a),r)},h2:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("h2",Object.assign({className:"mb-2 mt-6 text-2xl font-semibold"},a),r)},h3:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("h3",Object.assign({className:"mb-2 mt-6 text-xl font-semibold"},a),r)},h4:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("h4",Object.assign({className:"mb-2 mt-6 text-lg font-semibold"},a),r)},h5:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("h5",Object.assign({className:"mb-2 mt-6 text-base font-semibold"},a),r)},h6:t=>{var{children:r}=t,a=w(t,["children"]);return e.createElement("h6",Object.assign({className:"mb-2 mt-6 text-sm font-semibold"},a),r)}}},t.content))));function B({answer:r,question:a,theme:o,searchResults:n,followUpQuestions:i,onFollowUpClick:s}){const[l,c]=e.useState(null),[d,m]=e.useState(!1),[p,u]=e.useState(!1),g=()=>f(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(r),u(!0),setTimeout((()=>u(!1)),2e3)}catch(e){console.error("Failed to copy text:",e)}}));return e.createElement("div",{className:"space-y-6"},e.createElement("div",{className:"rounded-xl",style:{borderColor:o.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"p-6 space-y-4"},e.createElement("div",{className:"flex items-start justify-between"},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.Sparkles,{className:"h-5 w-5",style:{color:o.primary}}),e.createElement("h2",{className:"text-xl",style:{color:o.text}},a)),e.createElement("button",{onClick:()=>{g()},className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 transition-colors duration-200"},p?e.createElement(e.Fragment,null,e.createElement(t.Check,{className:"h-4 w-4 text-green-500"}),e.createElement("span",{className:"text-green-500"},"Copied!")):e.createElement(e.Fragment,null,e.createElement(t.Copy,{className:"h-4 w-4"}),e.createElement("span",null,"Copy")))),r&&e.createElement("div",{className:"prose prose-sm max-w-none",style:{color:o.text}},e.createElement(M,{message:{content:r}})),r&&e.createElement("div",{className:"mt-6 flex justify-end gap-2"},e.createElement(O,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!1===l?o.primary:`${o.text}60`},onClick:()=>c(!1)},e.createElement(t.ThumbsDown,{className:"h-4 w-4"})),e.createElement(O,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!0===l?o.primary:`${o.text}60`},onClick:()=>c(!0)},e.createElement(t.ThumbsUp,{className:"h-4 w-4"}))),r&&i&&i.length>0&&e.createElement("div",{className:"mt-6 space-y-3"},e.createElement("div",{className:"text-sm font-medium",style:{color:o.text}},"Follow-up Questions"),e.createElement("div",{className:"flex flex-wrap gap-2"},i.map(((t,r)=>e.createElement("button",{key:r,onClick:()=>null==s?void 0:s(t),className:"px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:opacity-90",style:{backgroundColor:`${o.accent}30`,color:o.text,border:`1px solid ${o.border}`}},t))))),n&&n.length>0&&e.createElement("div",{className:"mt-6 rounded-lg overflow-hidden",style:{backgroundColor:o.surface,borderWidth:"1px",borderStyle:"solid",borderColor:o.surfaceBorder}},e.createElement("button",{onClick:()=>m(!d),className:"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50",style:{color:o.text,borderBottom:d?`1px solid ${o.surfaceBorder}`:"none"}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement(t.FileText,{className:"h-4 w-4",style:{color:o.primary}}),e.createElement("span",{className:"font-medium"},"Related Articles (",n.length,")")),e.createElement(t.ChevronDown,{className:"h-4 w-4 transition-transform duration-200 "+(d?"rotate-180":""),style:{color:o.text}})),e.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:d?48*n.length+"px":"0",opacity:d?1:0,transform:`translateY(${d?"0":"-10px"})`}},e.createElement("div",{className:"divide-y divide-gray-200"},n.map((r=>e.createElement("a",{key:r.id,href:r.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50",style:{color:o.text,backgroundColor:o.surface}},e.createElement(t.FileText,{className:"h-4 w-4",style:{color:o.primary}}),e.createElement("span",{className:"flex-grow"},r.title),e.createElement(t.ExternalLink,{className:"h-4 w-4",style:{color:`${o.text}60`}}))))))),!r&&e.createElement("div",{className:"animate-pulse space-y-4"},e.createElement("div",{className:"h-4 rounded w-full",style:{backgroundColor:`${o.border}40`}}),e.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${o.border}40`}})))))}function Z({theme:t,loadingText:r="Analyzing..."}){return e.createElement("div",{className:"w-full space-y-6 rounded-xl p-6",style:{borderColor:t.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"flex items-center gap-2"},e.createElement("div",{className:"w-5 h-5 rounded-full animate-pulse",style:{backgroundColor:`${t.primary}30`}}),e.createElement("div",{className:"text-sm",style:{color:t.text}},r)),e.createElement("div",{className:"space-y-4 animate-pulse"},Array.from({length:4}).map(((r,a)=>e.createElement("div",{key:a,className:"h-4 rounded w-full",style:{backgroundColor:`${t.border}40`}}))),e.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${t.border}40`}})),e.createElement("div",{className:"rounded-lg p-4",style:{backgroundColor:`${t.accent}50`}},e.createElement("div",{className:"flex items-center justify-between"},e.createElement("div",{className:"h-4 rounded w-48",style:{backgroundColor:`${t.border}80`}}),e.createElement("div",{className:"flex gap-2"},e.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${t.border}80`}}),e.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${t.border}80`}})))))}function D({onClick:r,theme:a}){return e.createElement(O,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:a.background,borderColor:a.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:r},e.createElement(t.ArrowDown,{className:"h-5 w-5",style:{color:a.text}}))}function W({questions:t,currentIndex:a,activeIndex:o,onNavigate:n,theme:i,offset:s}){return e.createElement(r.motion.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},className:"fixed left-4 top-1/2 -translate-y-1/2 z-50 flex flex-col gap-2",style:Object.assign({},s?{left:`${s}px`}:{})},t.map(((t,r)=>e.createElement("div",{key:r,className:"relative group"},e.createElement("button",{onClick:()=>n(r),className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 "+(r<=a?"hover:opacity-90":""),style:{backgroundColor:r===o?i.primary:"#ccc",color:r===o?i.background:"#333",opacity:r>a?.5:1,cursor:"pointer"}},r+1),e.createElement("div",{className:"absolute left-12 top-0 px-3 py-2 rounded-lg whitespace-normal opacity-0 group-hover:opacity-100 w-48 text-sm transition-opacity duration-200",style:{backgroundColor:i.background,color:i.text,borderColor:i.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},t,e.createElement("div",{className:"absolute left-0 top-3 -translate-x-1 w-2 h-2 rotate-45",style:{backgroundColor:i.background,borderLeft:`1px solid ${i.border}`,borderBottom:`1px solid ${i.border}`}}))))))}function V({questions:t,onQuestionClick:r,borderColor:a}){return t&&0!==t.length?e.createElement("div",{className:"w-full"},e.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},"Suggested questions"),e.createElement("div",{className:"flex flex-wrap gap-2"},t.map(((t,o)=>e.createElement("button",{key:o,onClick:()=>r(t),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm",style:{borderColor:a}},t))))):null}const Y=b.Root,X=b.Trigger;h.forwardRef(((e,t)=>{var{className:r,inset:a,children:o}=e,n=w(e,["className","inset","children"]);return h.createElement(b.SubTrigger,Object.assign({ref:t,className:C("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",r)},n),o,h.createElement(u.ChevronRightIcon,{className:"ml-auto"}))})).displayName=b.SubTrigger.displayName;h.forwardRef(((e,t)=>{var{className:r}=e,a=w(e,["className"]);return h.createElement(b.SubContent,Object.assign({ref:t,className:C("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",r)},a))})).displayName=b.SubContent.displayName;const H=h.forwardRef(((e,t)=>{var{className:r,sideOffset:a=4}=e,o=w(e,["className","sideOffset"]);return h.createElement(b.Portal,null,h.createElement(b.Content,Object.assign({ref:t,sideOffset:a,className:C("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",r)},o)))}));H.displayName=b.Content.displayName;const K=h.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=w(e,["className","inset"]);return h.createElement(b.Item,Object.assign({ref:t,className:C("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",a&&"pl-8",r)},o))}));K.displayName=b.Item.displayName;h.forwardRef(((e,t)=>{var{className:r,children:a,checked:o}=e,n=w(e,["className","children","checked"]);return h.createElement(b.CheckboxItem,Object.assign({ref:t,className:C("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:o},n),h.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},h.createElement(b.ItemIndicator,null,h.createElement(u.CheckIcon,{className:"h-4 w-4"}))),a)})).displayName=b.CheckboxItem.displayName;h.forwardRef(((e,t)=>{var{className:r,children:a}=e,o=w(e,["className","children"]);return h.createElement(b.RadioItem,Object.assign({ref:t,className:C("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r)},o),h.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},h.createElement(b.ItemIndicator,null,h.createElement(u.DotFilledIcon,{className:"h-2 w-2 fill-current"}))),a)})).displayName=b.RadioItem.displayName;h.forwardRef(((e,t)=>{var{className:r,inset:a}=e,o=w(e,["className","inset"]);return h.createElement(b.Label,Object.assign({ref:t,className:C("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",r)},o))})).displayName=b.Label.displayName;function J({endpoint:e,query:t,collectionId:r,headers:a}){var o;return f(this,void 0,void 0,(function*(){try{const n=yield fetch(e,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},a),body:JSON.stringify(Object.assign({query:t,limit:5},r&&"all"!==r&&{collectionId:r}))});if(!n.ok)throw new Error("Failed to fetch search results");const i=yield n.json();return{results:null==i?void 0:i.data,searchQueryId:null===(o=null==i?void 0:i.searchQuery)||void 0===o?void 0:o.id}}catch(e){throw console.error("Error searching:",e),e}}))}function G({endpoint:e,searchQueryId:t,headers:r}){return f(this,void 0,void 0,(function*(){try{const a=yield fetch(e,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},r),body:JSON.stringify({searchQueryId:t})});if(!a.ok)throw new Error("Failed to fetch answer");return a}catch(e){throw console.error("Error fetching answer:",e),e}}))}h.forwardRef(((e,t)=>{var{className:r}=e,a=w(e,["className"]);return h.createElement(b.Separator,Object.assign({ref:t,className:C("-mx-1 my-1 h-px bg-muted",r)},a))})).displayName=b.Separator.displayName;const ee={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717",surface:"#F9FAFB",surfaceBorder:"#E5E7EB",surfaceHover:"#F3F4F6"};exports.ChatSearch=function({suggestedQuestions:a,theme:o={},collections:n=[],selectedCollectionId:i,onCollectionChange:s,searchEndpoint:l,answerEndpoint:c,followUpQuestionsEndpoint:d,disableFollowUpQuestions:m=!1,siblingNode:p,offset:u=0,headers:g}){var h;const b=Object.assign(Object.assign({},ee),o),[w,y]=e.useState(""),[v,x]=e.useState(""),[k,E]=e.useState(!1),[N,j]=e.useState(!1),[C,z]=e.useState([]),[S,R]=e.useState(!1),[$,I]=e.useState(0),[A,L]=e.useState([]),[q,T]=e.useState(i),F=e.useRef(null),U=e.useRef(null),_=e.useRef([]),P=e.useRef(null),Q=e.useRef(null);e.useEffect((()=>{T(i)}),[i]);const M=e=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`},te=()=>{setTimeout((()=>{var e;_.current[_.current.length-1]&&(null===(e=_.current[_.current.length-1])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),P.current&&P.current.scrollBy(0,-80))}),100)},re=(e,t,r)=>f(this,void 0,void 0,(function*(){if(!e.body)throw new Error("No response body");const a=e.body.getReader(),o=new TextDecoder;let n="";const i=m?Promise.resolve([]):function(e,t,r){return f(this,void 0,void 0,(function*(){try{const a=new AbortController,o=setTimeout((()=>a.abort()),5e3),n=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:t,answer:r||"Generating answer..."}),signal:a.signal});if(clearTimeout(o),!n.ok)throw new Error("Failed to fetch follow-up questions");return(yield n.json()).questions.slice(0,3)}catch(e){return e instanceof Error&&console.error("Error fetching follow-up questions:",e.message),[]}}))}(d,t,"");let s=!0;for(;s;){const{done:e,value:l}=yield a.read();if(e){if(s=!1,!m)try{const e=yield i;z((t=>{const r=[...t];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{followUpQuestions:e}),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}continue}const c=o.decode(l);n+=c,z((e=>{const a=[...e];return a[a.length-1]={question:t,answer:n,isLoading:!1,searchResults:r},a}))}})),ae=()=>f(this,void 0,void 0,(function*(){if(w.trim()){E(!0),j(!0),z((e=>[...e,{question:w,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const e=yield J(Object.assign({endpoint:l,query:w,collectionId:q},g?{headers:g}:{})),t=e.results,r=e.searchQueryId;z((e=>{const r=[...e];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{searchResults:t,isSearchLoading:!1}),r}));const a=yield G(Object.assign({endpoint:c,searchQueryId:r},g?{headers:g}:{}));yield re(a,w,t)}catch(e){console.error("Error generating answer:",e),z((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{E(!1),te()}}})),oe=()=>f(this,void 0,void 0,(function*(){if(v.trim()){const e=v;y(e),x(""),E(!0),z((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const t=yield J(Object.assign({endpoint:l,query:e,collectionId:q},g?{headers:g}:{})),r=t.results,a=t.searchQueryId;z((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const o=yield G(Object.assign({endpoint:c,searchQueryId:a},g?{headers:g}:{}));yield re(o,e,r)}catch(e){console.error("Error generating answer:",e),z((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{E(!1),te()}}}));return e.useEffect((()=>{const e=P.current;if(!e)return;const t=()=>{const{scrollTop:t,scrollHeight:r,clientHeight:a}=e;R(!(r-t-a<100))};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}),[]),e.useEffect((()=>()=>{A.forEach((e=>URL.revokeObjectURL(e.preview)))}),[A]),e.createElement("div",{className:"relative min-h-screen"},e.createElement("div",{ref:P,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20 h-screen overflow-y-auto"},e.createElement(r.AnimatePresence,null,N?e.createElement(r.motion.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-8 pb-24"},C.map(((t,a)=>e.createElement(r.motion.div,{key:a,ref:e=>_.current[a]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*a}},t.isLoading?e.createElement(Z,{theme:b,loadingText:t.isSearchLoading?"Looking for relevant content...":"Analyzing..."}):e.createElement(B,{answer:t.answer,question:t.question,theme:b,searchResults:t.searchResults,followUpQuestions:m?void 0:t.followUpQuestions,onFollowUpClick:m?void 0:e=>{x(e),oe()}}))))):e.createElement(r.motion.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},e.createElement("div",{className:"w-full text-center space-y-4"},e.createElement(r.motion.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:b.text}},"How can we help you today?")),e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},e.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:b.background,borderColor:b.border,borderWidth:"1px",borderStyle:"solid"}},e.createElement("div",{className:"p-3 flex items-center"},e.createElement(t.Search,{className:"h-5 w-5 text-gray-400 mr-2"}),e.createElement("textarea",{ref:F,placeholder:"Ask a question or type a search term here ...",value:w,onChange:e=>{y(e.target.value),M(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ae())},className:"w-full resize-none outline-none text-lg font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:b.text},rows:1})),A.length>0&&e.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},A.map(((r,a)=>e.createElement("div",{key:a,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},e.createElement("img",{src:r.preview,alt:`Attached ${a+1}`,className:"w-full h-full object-cover"}),e.createElement("button",{onClick:()=>(e=>{L((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(a),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},e.createElement(t.X,{className:"h-3 w-3 text-white"})))))),e.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},e.createElement("div",{className:"flex gap-2"},n.length>0&&e.createElement(Y,null,e.createElement(X,{asChild:!0},e.createElement(O,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},e.createElement("div",{className:"w-5 h-5 rounded-full border-2 border-gray-400 border-dashed flex items-center justify-center"}),(null===(h=n.find((e=>e.id===q)))||void 0===h?void 0:h.name)||"All documents",e.createElement(t.ChevronDown,{className:"h-4 w-4 opacity-50"}))),e.createElement(H,null,n.map((t=>e.createElement(K,{key:t.id,onClick:()=>{return e=t.id,T(e),void(null==s||s(e));var e},className:t.id===q?"bg-gray-100":""},t.name))))),e.createElement("input",{type:"file",ref:Q,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));L((t=>[...t,...e]))}Q.current&&(Q.current.value="")}}),e.createElement(O,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.click()}},e.createElement(t.Image,{className:"h-4 w-4 mr-1.5"}),"Attach image")),e.createElement("div",{className:"flex items-center"},e.createElement(O,{size:"sm",disabled:!w||k,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{ae()}},k?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):e.createElement(t.ArrowRight,{className:"h-4 w-4 text-gray-700"})))))),e.createElement(V,{questions:a,onQuestionClick:e=>{j(!0),E(!0),z((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}])),(()=>{f(this,void 0,void 0,(function*(){try{const t=yield J(Object.assign({endpoint:l,query:e,collectionId:q},g?{headers:g}:{})),r=t.results;z((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const a=yield G(Object.assign({endpoint:c,searchQueryId:t.searchQueryId},g?{headers:g}:{}));yield re(a,e,r)}catch(e){console.error("Error generating answer:",e),z((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{E(!1),te()}}))})()},borderColor:b.border}),p)),N&&C.length>0&&e.createElement(W,{questions:C.map((e=>e.question)),currentIndex:k?C.length-1:$,activeIndex:$,onNavigate:e=>{I(e),(e=>{setTimeout((()=>{var t;_.current[e]&&(null===(t=_.current[e])||void 0===t||t.scrollIntoView({behavior:"smooth",block:"start"}),P.current&&P.current.scrollBy(0,-80))}),100)})(e)},theme:b,offset:u}),N&&e.createElement(r.motion.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${u}px`}},e.createElement("div",{className:"rounded-full px-4 py-2 flex items-center justify-between",style:{backgroundColor:b.background,borderColor:b.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},e.createElement("div",{className:"flex items-center gap-2 flex-grow overflow-hidden"},e.createElement(t.Plus,{className:"h-4 w-4 flex-shrink-0",style:{color:b.primary}}),e.createElement("textarea",{ref:U,placeholder:"Ask follow-up",value:v,onChange:e=>{x(e.target.value),M(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),oe())},disabled:k,className:"w-full bg-transparent outline-none text-sm resize-none overflow-hidden disabled:opacity-50 border-none",style:{color:b.text},rows:1})),e.createElement("div",{className:"flex items-center gap-3 ml-2 flex-shrink-0"},e.createElement(O,{size:"icon",variant:"ghost",disabled:k||!v.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 flex items-center justify-center",style:{color:b.text,backgroundColor:"transparent"},onClick:()=>{oe()}},k?e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2",style:{borderColor:`${b.text}40`,borderTopColor:b.text}}):e.createElement(t.ArrowUp,{className:"h-4 w-4"}))))),S&&N&&e.createElement(D,{onClick:te,theme:b})))};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import*as e from"react";import t,{useState as r,useRef as a,useEffect as o}from"react";import{Sparkles as n,Copy as i,ThumbsDown as s,ThumbsUp as l,FileText as c,ChevronDown as d,ExternalLink as m,ArrowDown as p,Search as u,X as g,Image as h,ArrowRight as f,Plus as w,ArrowUp as b}from"lucide-react";import{motion as y,AnimatePresence as v}from"framer-motion";import x from"react-markdown";import k from"remark-gfm";import{jsx as N,Fragment as E}from"react/jsx-runtime";import{cva as C}from"class-variance-authority";import{clsx as z}from"clsx";import{twMerge as j}from"tailwind-merge";import*as O from"@radix-ui/react-dropdown-menu";import{ChevronRightIcon as S,CheckIcon as R,DotFilledIcon as L}from"@radix-ui/react-icons";function I(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function $(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function T(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function q(...e){return t=>{let r=!1;const a=e.map((e=>{const a=T(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():T(e[t],null)}}}}!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.\\!container{margin-left:auto!important;margin-right:auto!important;padding-left:2rem!important;padding-right:2rem!important;width:100%!important}.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.\\!container{max-width:1400px!important}.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-12{left:3rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\\/2{top:50%}.top-3{top:.75rem}.z-10{z-index:10}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-4{margin-top:1rem}.mb-4,.my-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-3{margin-top:.75rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-none{max-width:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-x-1{--tw-translate-x:-0.25rem}.-translate-x-1,.-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%}.rotate-180{--tw-rotate:180deg}.rotate-180,.rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate:45deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-400{--tw-border-opacity:1;border-color:rgb(156 163 175/var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.pb-1{padding-bottom:.25rem}.pb-24{padding-bottom:6rem}.pl-2{padding-left:.5rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var A=e.forwardRef(((t,r)=>{const{children:a,...o}=t,n=e.Children.toArray(a),i=n.find(P);if(i){const t=i.props.children,a=n.map((r=>r===i?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r));return N(U,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,a):null})}return N(U,{...o,ref:r,children:a})}));A.displayName="Slot";var U=e.forwardRef(((t,r)=>{const{children:a,...o}=t;if(e.isValidElement(a)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(a);return e.cloneElement(a,{...W(o,a.props),ref:r?q(r,t):t})}return e.Children.count(a)>1?e.Children.only(null):null}));U.displayName="SlotClone";var Q=({children:e})=>N(E,{children:e});function P(t){return e.isValidElement(t)&&t.type===Q}function W(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function F(...e){return j(z(e))}const Y=C("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=e.forwardRef(((t,r)=>{var{className:a,variant:o,size:n,asChild:i=!1}=t,s=I(t,["className","variant","size","asChild"]);const l=i?A:"button";return e.createElement(l,Object.assign({className:F(Y({variant:o,size:n,className:a})),ref:r},s))}));function B({answer:e,question:a,theme:o,searchResults:p,followUpQuestions:u,onFollowUpClick:g}){const[h,f]=r(null),[w,b]=r(!1),y=({className:e,children:r,theme:a})=>!/language-(\w+)/.exec(e||"")?t.createElement("code",{className:`${e} rounded px-1`,style:{backgroundColor:`${a.border}20`}},r):t.createElement("pre",{className:"rounded-md p-4",style:{backgroundColor:`${a.border}20`}},t.createElement("code",{className:e},r));return t.createElement("div",{className:"space-y-6"},t.createElement("div",{className:"rounded-xl",style:{borderColor:o.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"p-6 space-y-4"},t.createElement("div",{className:"flex items-start justify-between"},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(n,{className:"h-5 w-5",style:{color:o.primary}}),t.createElement("h2",{className:"text-xl",style:{color:o.text}},a)),e&&t.createElement(_,{variant:"ghost",size:"icon",className:"hover:opacity-90 transition-colors duration-200",style:{color:o.text},onClick:()=>{navigator.clipboard.writeText(`${a}\n\n${e}`)}},t.createElement(i,{className:"h-5 w-4"}))),e&&t.createElement("div",{className:"prose prose-sm max-w-none",style:{color:o.text}},t.createElement(x,{remarkPlugins:[k],components:{img:e=>t.createElement("img",Object.assign({},e,{className:"rounded-lg shadow-md my-4",alt:e.alt||""})),code:({className:e,children:r})=>t.createElement(y,{className:e,theme:o},r)}},e)),e&&t.createElement("div",{className:"mt-6 flex justify-end gap-2"},t.createElement(_,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!1===h?o.primary:`${o.text}60`},onClick:()=>f(!1)},t.createElement(s,{className:"h-4 w-4"})),t.createElement(_,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!0===h?o.primary:`${o.text}60`},onClick:()=>f(!0)},t.createElement(l,{className:"h-4 w-4"}))),e&&u&&u.length>0&&t.createElement("div",{className:"mt-6 space-y-3"},t.createElement("div",{className:"text-sm font-medium",style:{color:o.text}},"Follow-up Questions"),t.createElement("div",{className:"flex flex-wrap gap-2"},u.map(((e,r)=>t.createElement("button",{key:r,onClick:()=>null==g?void 0:g(e),className:"px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:opacity-90",style:{backgroundColor:`${o.accent}30`,color:o.text,border:`1px solid ${o.border}`}},e))))),p&&p.length>0&&t.createElement("div",{className:"space-y-3 mt-6"},t.createElement("button",{onClick:()=>b(!w),className:"w-full flex items-center justify-between p-3 rounded-lg hover:opacity-90 transition-all duration-200",style:{backgroundColor:`${o.accent}30`,color:o.text}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(c,{className:"h-4 w-4",style:{color:o.primary}}),t.createElement("span",{className:"font-medium"},"Related Articles (",p.length,")")),t.createElement(d,{className:"h-4 w-4 transition-transform duration-200 "+(w?"rotate-180":""),style:{color:o.text}})),t.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:w?48*p.length+"px":"0",opacity:w?1:0,transform:`translateY(${w?"0":"-10px"})`}},t.createElement("div",{className:"space-y-2 pl-2"},p.map((e=>t.createElement("a",{key:e.id,href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-lg hover:opacity-90 transition-colors duration-200",style:{backgroundColor:`${o.accent}20`,color:o.text}},t.createElement(c,{className:"h-4 w-4",style:{color:o.primary}}),t.createElement("span",{className:"flex-grow"},e.title),t.createElement(m,{className:"h-4 w-4",style:{color:`${o.text}60`}}))))))),!e&&t.createElement("div",{className:"animate-pulse space-y-4"},t.createElement("div",{className:"h-4 rounded w-full",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${o.border}40`}})))))}function X({theme:e,loadingText:r="Analyzing..."}){return t.createElement("div",{className:"w-full space-y-6 rounded-xl p-6",style:{borderColor:e.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement("div",{className:"w-5 h-5 rounded-full animate-pulse",style:{backgroundColor:`${e.primary}30`}}),t.createElement("div",{className:"text-sm",style:{color:e.text}},r)),t.createElement("div",{className:"space-y-4 animate-pulse"},Array.from({length:4}).map(((r,a)=>t.createElement("div",{key:a,className:"h-4 rounded w-full",style:{backgroundColor:`${e.border}40`}}))),t.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${e.border}40`}})),t.createElement("div",{className:"rounded-lg p-4",style:{backgroundColor:`${e.accent}50`}},t.createElement("div",{className:"flex items-center justify-between"},t.createElement("div",{className:"h-4 rounded w-48",style:{backgroundColor:`${e.border}80`}}),t.createElement("div",{className:"flex gap-2"},t.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${e.border}80`}}),t.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${e.border}80`}})))))}function D({onClick:e,theme:r}){return t.createElement(_,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:r.background,borderColor:r.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:e},t.createElement(p,{className:"h-5 w-5",style:{color:r.text}}))}function V({questions:e,currentIndex:r,activeIndex:a,onNavigate:o,theme:n,offset:i}){return t.createElement(y.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},className:"fixed left-4 top-1/2 -translate-y-1/2 z-50 flex flex-col gap-2",style:{left:`${i}px`}},e.map(((e,i)=>t.createElement("div",{key:i,className:"relative group"},t.createElement("button",{onClick:()=>o(i),className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 "+(i<=r?"hover:opacity-90":""),style:{backgroundColor:i===a?n.primary:n.border,color:i===a?n.background:n.text,opacity:i>r?.5:1,cursor:"pointer"}},i+1),t.createElement("div",{className:"absolute left-12 top-0 px-3 py-2 rounded-lg whitespace-normal opacity-0 group-hover:opacity-100 w-48 text-sm transition-opacity duration-200",style:{backgroundColor:n.background,color:n.text,borderColor:n.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},e,t.createElement("div",{className:"absolute left-0 top-3 -translate-x-1 w-2 h-2 rotate-45",style:{backgroundColor:n.background,borderLeft:`1px solid ${n.border}`,borderBottom:`1px solid ${n.border}`}}))))))}function H({questions:e,onQuestionClick:r,borderColor:a}){return e&&0!==e.length?t.createElement("div",{className:"w-full"},t.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},"Suggested questions"),t.createElement("div",{className:"flex flex-wrap gap-2"},e.map(((e,o)=>t.createElement("button",{key:o,onClick:()=>r(e),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm",style:{borderColor:a}},e))))):null}_.displayName="Button";const M=O.Root,K=O.Trigger;e.forwardRef(((t,r)=>{var{className:a,inset:o,children:n}=t,i=I(t,["className","inset","children"]);return e.createElement(O.SubTrigger,Object.assign({ref:r,className:F("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",o&&"pl-8",a)},i),n,e.createElement(S,{className:"ml-auto"}))})).displayName=O.SubTrigger.displayName;e.forwardRef(((t,r)=>{var{className:a}=t,o=I(t,["className"]);return e.createElement(O.SubContent,Object.assign({ref:r,className:F("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",a)},o))})).displayName=O.SubContent.displayName;const J=e.forwardRef(((t,r)=>{var{className:a,sideOffset:o=4}=t,n=I(t,["className","sideOffset"]);return e.createElement(O.Portal,null,e.createElement(O.Content,Object.assign({ref:r,sideOffset:o,className:F("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",a)},n)))}));J.displayName=O.Content.displayName;const G=e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=I(t,["className","inset"]);return e.createElement(O.Item,Object.assign({ref:r,className:F("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",o&&"pl-8",a)},n))}));G.displayName=O.Item.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o,checked:n}=t,i=I(t,["className","children","checked"]);return e.createElement(O.CheckboxItem,Object.assign({ref:r,className:F("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:n},i),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(O.ItemIndicator,null,e.createElement(R,{className:"h-4 w-4"}))),o)})).displayName=O.CheckboxItem.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o}=t,n=I(t,["className","children"]);return e.createElement(O.RadioItem,Object.assign({ref:r,className:F("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a)},n),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(O.ItemIndicator,null,e.createElement(L,{className:"h-2 w-2 fill-current"}))),o)})).displayName=O.RadioItem.displayName;e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=I(t,["className","inset"]);return e.createElement(O.Label,Object.assign({ref:r,className:F("px-2 py-1.5 text-sm font-semibold",o&&"pl-8",a)},n))})).displayName=O.Label.displayName;function Z(e,t,r){return $(this,void 0,void 0,(function*(){try{const a=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({query:t,limit:5},r&&{collectionId:r}))});if(!a.ok)throw new Error("Failed to fetch search results");const o=yield a.json();return{results:o.results,searchQueryId:o.searchQueryId}}catch(e){throw console.error("Error searching:",e),e}}))}function ee(e,t){return $(this,void 0,void 0,(function*(){try{const r=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({searchQueryId:t})});if(!r.ok)throw new Error("Failed to fetch answer");return r}catch(e){throw console.error("Error fetching answer:",e),e}}))}e.forwardRef(((t,r)=>{var{className:a}=t,o=I(t,["className"]);return e.createElement(O.Separator,Object.assign({ref:r,className:F("-mx-1 my-1 h-px bg-muted",a)},o))})).displayName=O.Separator.displayName;const te={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717"};function re({suggestedQuestions:e,theme:n={},collections:i=[],selectedCollectionId:s,onCollectionChange:l,searchEndpoint:c,answerEndpoint:m,followUpQuestionsEndpoint:p,disableFollowUpQuestions:x=!1,siblingNode:k,offset:N=0}){var E;const C=Object.assign(Object.assign({},te),n),[z,j]=r(""),[O,S]=r(""),[R,L]=r(!1),[I,T]=r(!1),[q,A]=r([]),[U,Q]=r(!1),[P,W]=r(0),[F,Y]=r([]),[re,ae]=r(s),oe=a(null),ne=a(null),ie=a([]),se=a(null),le=a(null);o((()=>{ae(s)}),[s]);const ce=e=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`},de=()=>{setTimeout((()=>{var e;ie.current[ie.current.length-1]&&(null===(e=ie.current[ie.current.length-1])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),se.current&&se.current.scrollBy(0,-80))}),100)},me=(e,t,r)=>$(this,void 0,void 0,(function*(){if(!e.body)throw new Error("No response body");const a=e.body.getReader(),o=new TextDecoder;let n="";const i=x?Promise.resolve([]):function(e,t,r){return $(this,void 0,void 0,(function*(){try{const a=new AbortController,o=setTimeout((()=>a.abort()),5e3),n=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:t,answer:r||"Generating answer..."}),signal:a.signal});if(clearTimeout(o),!n.ok)throw new Error("Failed to fetch follow-up questions");return(yield n.json()).questions.slice(0,3)}catch(e){return e instanceof Error&&console.error("Error fetching follow-up questions:",e.message),[]}}))}(p,t,"");let s=!0;for(;s;){const{done:e,value:l}=yield a.read();if(e){if(s=!1,!x)try{const e=yield i;A((t=>{const r=[...t];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{followUpQuestions:e}),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}continue}const c=o.decode(l);n+=c,A((e=>{const a=[...e];return a[a.length-1]={question:t,answer:n,isLoading:!1,searchResults:r},a}))}})),pe=()=>$(this,void 0,void 0,(function*(){if(z.trim()){L(!0),T(!0),A((e=>[...e,{question:z,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const e=yield Z(c,z,re),t=e.results,r=e.searchQueryId;A((e=>{const r=[...e];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{searchResults:t,isSearchLoading:!1}),r}));const a=yield ee(m,r);yield me(a,z,t)}catch(e){console.error("Error generating answer:",e),A((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{L(!1),de()}}})),ue=()=>$(this,void 0,void 0,(function*(){if(O.trim()){const e=O;j(e),S(""),L(!0),A((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const t=yield Z(c,e),r=t.results,a=t.searchQueryId;A((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const o=yield ee(m,a);yield me(o,e,r)}catch(e){console.error("Error generating answer:",e),A((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{L(!1),de()}}}));o((()=>{const e=se.current;if(!e)return;const t=()=>{const{scrollTop:t,scrollHeight:r,clientHeight:a}=e;Q(!(r-t-a<100))};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}),[]),o((()=>()=>{F.forEach((e=>URL.revokeObjectURL(e.preview)))}),[F]);return t.createElement("div",{className:"relative min-h-screen"},t.createElement("div",{ref:se,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20 h-screen overflow-y-auto"},t.createElement(v,null,I?t.createElement(y.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-8 pb-24"},q.map(((e,r)=>t.createElement(y.div,{key:r,ref:e=>ie.current[r]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*r}},e.isLoading?t.createElement(X,{theme:C,loadingText:e.isSearchLoading?"Looking for relevant content...":"Analyzing..."}):t.createElement(B,{answer:e.answer,question:e.question,theme:C,searchResults:e.searchResults,followUpQuestions:x?void 0:e.followUpQuestions,onFollowUpClick:x?void 0:e=>{S(e),ue()}}))))):t.createElement(y.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},t.createElement("div",{className:"w-full text-center space-y-4"},t.createElement(y.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:C.text}},"How can we help you today?")),t.createElement(y.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},t.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:C.background,borderColor:C.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"p-3 flex items-center"},t.createElement(u,{className:"h-5 w-5 text-gray-400 mr-2"}),t.createElement("textarea",{ref:oe,placeholder:"Ask a question or type a search term here ...",value:z,onChange:e=>{j(e.target.value),ce(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),pe())},className:"w-full resize-none outline-none text-lg font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:C.text},rows:1})),F.length>0&&t.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},F.map(((e,r)=>t.createElement("div",{key:r,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},t.createElement("img",{src:e.preview,alt:`Attached ${r+1}`,className:"w-full h-full object-cover"}),t.createElement("button",{onClick:()=>(e=>{Y((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(r),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},t.createElement(g,{className:"h-3 w-3 text-white"})))))),t.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},t.createElement("div",{className:"flex gap-2"},i.length>0&&t.createElement(M,null,t.createElement(K,{asChild:!0},t.createElement(_,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},t.createElement("div",{className:"w-5 h-5 rounded-full border-2 border-gray-400 border-dashed flex items-center justify-center"}),(null===(E=i.find((e=>e.id===re)))||void 0===E?void 0:E.name)||"All documents",t.createElement(d,{className:"h-4 w-4 opacity-50"}))),t.createElement(J,null,i.map((e=>t.createElement(G,{key:e.id,onClick:()=>{return t=e.id,ae(t),void(null==l||l(t));var t},className:e.id===re?"bg-gray-100":""},e.name))))),t.createElement("input",{type:"file",ref:le,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));Y((t=>[...t,...e]))}le.current&&(le.current.value="")}}),t.createElement(_,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=le.current)||void 0===e?void 0:e.click()}},t.createElement(h,{className:"h-4 w-4 mr-1.5"}),"Attach image")),t.createElement("div",{className:"flex items-center"},t.createElement(_,{size:"sm",disabled:!z||R,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{pe()}},R?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):t.createElement(f,{className:"h-4 w-4 text-gray-700"})))))),t.createElement(H,{questions:e,onQuestionClick:e=>{T(!0),L(!0),A((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}])),(()=>{$(this,void 0,void 0,(function*(){try{const t=yield Z(c,e),r=t.results;A((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const a=yield ee(m,t.searchQueryId);yield me(a,e,r)}catch(e){console.error("Error generating answer:",e),A((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{L(!1),de()}}))})()},borderColor:C.border}),k)),I&&q.length>0&&t.createElement(V,{questions:q.map((e=>e.question)),currentIndex:R?q.length-1:P,activeIndex:P,onNavigate:e=>{W(e),(e=>{setTimeout((()=>{var t;ie.current[e]&&(null===(t=ie.current[e])||void 0===t||t.scrollIntoView({behavior:"smooth",block:"start"}),se.current&&se.current.scrollBy(0,-80))}),100)})(e)},theme:C,offset:N}),I&&t.createElement(y.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${N}px`}},t.createElement("div",{className:"rounded-full px-4 py-2 flex items-center justify-between",style:{backgroundColor:C.background,borderColor:C.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},t.createElement("div",{className:"flex items-center gap-2 flex-grow overflow-hidden"},t.createElement(w,{className:"h-4 w-4 flex-shrink-0",style:{color:C.primary}}),t.createElement("textarea",{ref:ne,placeholder:"Ask follow-up",value:O,onChange:e=>{S(e.target.value),ce(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ue())},disabled:R,className:"w-full bg-transparent outline-none text-sm resize-none overflow-hidden disabled:opacity-50 border-none",style:{color:C.text},rows:1})),t.createElement("div",{className:"flex items-center gap-3 ml-2 flex-shrink-0"},t.createElement(_,{size:"icon",variant:"ghost",disabled:R||!O.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 flex items-center justify-center",style:{color:C.text,backgroundColor:"transparent"},onClick:()=>{ue()}},R?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2",style:{borderColor:`${C.text}40`,borderTopColor:C.text}}):t.createElement(b,{className:"h-4 w-4"}))))),U&&I&&t.createElement(D,{onClick:de,theme:C})))}export{re as ChatSearch};
1
+ import*as e from"react";import t,{memo as r,useState as a,useEffect as o,useRef as n}from"react";import{CheckCircle as i,Clipboard as s,Download as l,Sparkles as c,Check as d,Copy as m,ThumbsDown as p,ThumbsUp as u,FileText as g,ChevronDown as h,ExternalLink as b,ArrowDown as f,Search as w,X as y,Image as v,ArrowRight as x,Plus as k,ArrowUp as E}from"lucide-react";import{motion as N,AnimatePresence as z}from"framer-motion";import j from"rehype-raw";import C from"remark-gfm";import{Prism as O}from"react-syntax-highlighter";import{a11yDark as S}from"react-syntax-highlighter/dist/cjs/styles/prism";import{jsx as $,Fragment as R}from"react/jsx-runtime";import{cva as L}from"class-variance-authority";import{clsx as I}from"clsx";import{twMerge as A}from"tailwind-merge";import T from"react-markdown";import*as q from"@radix-ui/react-dropdown-menu";import{ChevronRightIcon as F,CheckIcon as U,DotFilledIcon as _}from"@radix-ui/react-icons";function Q(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]])}return r}function B(e,t,r,a){return new(r||(r=Promise))((function(o,n){function i(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}l((a=a.apply(e,t||[])).next())}))}function M(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Z(...e){return t=>{let r=!1;const a=e.map((e=>{const a=M(e,t);return r||"function"!=typeof a||(r=!0),a}));if(r)return()=>{for(let t=0;t<a.length;t++){const r=a[t];"function"==typeof r?r():M(e[t],null)}}}}!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('/*! tailwindcss v3.3.5 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:0.5rem}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.\\!container{margin-left:auto!important;margin-right:auto!important;padding-left:2rem!important;padding-right:2rem!important;width:100%!important}.container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.\\!container{max-width:1400px!important}.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-20{bottom:5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-12{left:3rem}.left-2{left:.5rem}.left-4{left:1rem}.right-1{right:.25rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\\/2{top:50%}.top-3{top:.75rem}.z-10{z-index:10}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-top:.5rem}.mb-2,.my-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-3{margin-top:.75rem}.mt-6{margin-top:1.5rem}.block{display:block}.\\!inline{display:inline!important}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.min-h-\\[36px\\]{min-height:36px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\\.5{width:.875rem}.w-3\\/4{width:75%}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-\\[8rem\\]{min-width:8rem}.max-w-3xl{max-width:48rem}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1{--tw-translate-x:-0.25rem}.-translate-x-1,.-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%}.rotate-180{--tw-rotate:180deg}.rotate-180,.rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate:45deg}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-outside{list-style-position:outside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(2rem*var(--tw-space-y-reverse));margin-top:calc(2rem*(1 - var(--tw-space-y-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-b-lg{border-bottom-left-radius:var(--radius);border-bottom-right-radius:var(--radius)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-black{--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-400{--tw-border-opacity:1;border-color:rgb(156 163 175/var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#86efac\\]{--tw-bg-opacity:1;background-color:rgb(134 239 172/var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-200{--tw-bg-opacity:1;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-zinc-800\\/80{background-color:rgba(39,39,42,.8)}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-20{padding-bottom:5rem;padding-top:5rem}.pb-1{padding-bottom:.25rem}.pb-24{padding-bottom:6rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.tracking-widest{letter-spacing:.1em}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\\:text-gray-400::-moz-placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.placeholder\\:text-gray-400::placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.hover\\:bg-\\[\\#86efac\\]\\/90:hover{background-color:rgba(134,239,172,.9)}.hover\\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\\:bg-destructive\\/90:hover{background-color:hsl(var(--destructive)/.9)}.hover\\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\\:bg-primary\\/90:hover{background-color:hsl(var(--primary)/.9)}.hover\\:bg-secondary\\/80:hover{background-color:hsl(var(--secondary)/.8)}.hover\\:bg-zinc-700\\/50:hover{background-color:rgba(63,63,70,.5)}.hover\\:bg-opacity-50:hover{--tw-bg-opacity:0.5}.hover\\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\\:text-gray-700:hover{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.hover\\:text-zinc-100:hover{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-90:hover{opacity:.9}.focus\\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked]{--tw-translate-x:1rem}.data-\\[state\\=checked\\]\\:translate-x-4[data-state=checked],.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px}.data-\\[state\\=checked\\]\\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\\[state\\=unchecked\\]\\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=open\\]\\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-duration:.15s;animation-name:enter}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-duration:.15s;animation-name:exit}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}:is([data-mode=dark] .dark\\:border-white){--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.\\[\\&\\>svg\\]\\:shrink-0>svg{flex-shrink:0}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}'),"function"==typeof SuppressedError&&SuppressedError;var P=e.forwardRef(((t,r)=>{const{children:a,...o}=t,n=e.Children.toArray(a),i=n.find(Y);if(i){const t=i.props.children,a=n.map((r=>r===i?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:r));return $(W,{...o,ref:r,children:e.isValidElement(t)?e.cloneElement(t,void 0,a):null})}return $(W,{...o,ref:r,children:a})}));P.displayName="Slot";var W=e.forwardRef(((t,r)=>{const{children:a,...o}=t;if(e.isValidElement(a)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(a);return e.cloneElement(a,{...H(o,a.props),ref:r?Z(r,t):t})}return e.Children.count(a)>1?e.Children.only(null):null}));W.displayName="SlotClone";var V=({children:e})=>$(R,{children:e});function Y(t){return e.isValidElement(t)&&t.type===V}function H(e,t){const r={...t};for(const a in t){const o=e[a],n=t[a];/^on[A-Z]/.test(a)?o&&n?r[a]=(...e)=>{n(...e),o(...e)}:o&&(r[a]=o):"style"===a?r[a]={...o,...n}:"className"===a&&(r[a]=[o,n].filter(Boolean).join(" "))}return{...e,...r}}function X(...e){return A(I(e))}const D=L("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),K=e.forwardRef(((t,r)=>{var{className:a,variant:o,size:n,asChild:i=!1}=t,s=Q(t,["className","variant","size","asChild"]);const l=i?P:"button";return e.createElement(l,Object.assign({className:X(D({variant:o,size:n,className:a})),ref:r},s))}));K.displayName="Button";const J={javascript:".js",python:".py",java:".java",c:".c",cpp:".cpp","c++":".cpp","c#":".cs",ruby:".rb",php:".php",swift:".swift","objective-c":".m",kotlin:".kt",typescript:".ts",go:".go",perl:".pl",rust:".rs",scala:".scala",haskell:".hs",lua:".lua",shell:".sh",sql:".sql",html:".html",css:".css"},G=O,ee=r((({language:e,value:r})=>{const[o,n]=a(!1);return t.createElement("div",{className:"relative font-sans text-sm mt-1"},t.createElement("div",{className:"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur"},t.createElement("div",{className:"flex h-8 items-center justify-between px-3"},t.createElement("span",{className:"text-xs font-medium text-zinc-400"},e),t.createElement("div",{className:"flex gap-1"},t.createElement(K,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{B(void 0,void 0,void 0,(function*(){if(navigator.clipboard&&navigator.clipboard.writeText)try{yield navigator.clipboard.writeText(r),n(!0),setTimeout((()=>{n(!1)}),2e3)}catch(e){console.error("Failed to copy:",e)}}))}},o?t.createElement(i,{size:18}):t.createElement(s,{size:18})),t.createElement(K,{variant:"ghost",size:"icon",className:"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100",onClick:()=>{const t=J[e]||".file",a=`file-${((e,t=!1)=>{const r="ABCDEFGHJKLMNPQRSTUVWXY3456789";let a="";for(let t=0;t<e;t+=1)a+=r.charAt(Math.floor(30*Math.random()));return t?a.toLowerCase():a})(3,!0)}${t}`,o=new Blob([r],{type:"text/plain"}),n=URL.createObjectURL(o),i=document.createElement("a");i.download=a,i.href=n,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}},t.createElement(l,{size:18}))))),t.createElement("div",{className:"rounded-b-lg"},t.createElement(G,{language:e,style:S,PreTag:"div",wrapLongLines:!0,customStyle:{margin:0,borderTopLeftRadius:0,borderTopRightRadius:0}},r)))}));ee.displayName="CodeBlock";const te=e.forwardRef((({src:t,border:r,width:a="100%",height:o="400px",title:n},i)=>{const[s,l]=e.useState(!1);return e.useEffect((()=>{let e=!0;return setTimeout((()=>{e&&l(!0)}),0),()=>{e=!1}}),[]),e.createElement("div",{className:"overflow-hidden rounded-lg "+(r?"border":""),style:{width:a,height:o}},s&&e.createElement(e.Fragment,null,e.createElement("iframe",{ref:i,src:t,sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads",width:a,height:o,frameBorder:"0",title:"embed",loading:"lazy",allowFullScreen:!0,className:"block rounded-lg"}),n&&e.createElement("span",{className:"block text-center text-sm font-medium"},n)))}));function re(t){const r=t.attrs.href.replace("share","embed");return e.createElement(te,Object.assign({},t,{src:r,title:"Loom Embed"}))}function ae(t){return e.createElement(te,Object.assign({},t,{src:t.attrs.href,title:"Supademo Embed"}))}function oe(t){return e.createElement(te,Object.assign({},t,{src:t.attrs.href,title:"Typeform Embed"}))}function ne(t){const r=t.attrs.href.match(/(http|https)?:\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:\/|\?)?([\d\w]+)?/);if(!r)return null;const a=r[4],o=r[5],n=`https://player.vimeo.com/video/${a}?byline=0${o?`&h=${o}`:""}`;return e.createElement(te,Object.assign({},t,{src:n,title:`Vimeo Embed (${a})`,height:"412px",border:!1}))}function ie(t){const r=(e=>{const t=[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)\/?$/,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)\/?$/];for(const r of t){const t=e.match(r);if(t)return t}return null})(t.attrs.href);if(!r)return null;const a=r[1],o=r[2]||r[1],n=a?`https://${a}.wistia.com/embed/iframe/${o}?seo=true&videoFoam=false`:`https://fast.wistia.com/embed/iframe/${o}`;return e.createElement(te,Object.assign({},t,{src:n,border:!0,title:`Wistia Embed (${o})`}))}function se(t){const r=(e=>{const t=e.match(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([a-zA-Z0-9_-]{11})$/i);return t?t[1]:null})(t.attrs.href);return r?e.createElement(te,Object.assign({},t,{src:`https://www.youtube.com/embed/${r}?modestbranding=1`,title:`YouTube Embed (${r})`})):null}re.isMatch=e=>/^https:\/\/(www\.)?(use)?loom\.com\/(embed|share)\/(.*)$/.test(e),ae.isMatch=e=>/^https:\/\/app\.supademo\.com\/embed\/(.*)$/.test(e),oe.isMatch=e=>/^https:\/\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\.typeform\.com\/to\/(.*)$/.test(e),ne.isMatch=e=>/^(https?):\/\/(www\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)?(\d+)(\/)?(?:\?.*|#.*)?$/i.test(e),ie.isMatch=e=>[/^https?:\/\/([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^https?:\/\/fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^fast\.wistia\.com\/embed\/iframe\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i,/^([a-zA-Z0-9-_~]+)\.wistia\.com\/medias\/([a-zA-Z0-9-_~]+)(\/)?(\?.*)?$/i].some((t=>t.test(e))),se.isMatch=e=>/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?:\/|[?&].*)?$/i.test(e);const le=[re,ae,oe,se,ie,ne],ce=t=>{const{href:r}=t.attrs,[n,i]=a(null);if(o((()=>{let e=!0;return B(void 0,void 0,void 0,(function*(){try{const a=le.find((e=>e.isMatch(r)));if(a&&e)return void i({Component:a,props:t});const o=(yield Promise.all(asyncEmbedComponents.map((e=>e.isMatch(r).catch((()=>!1)))))).findIndex((e=>e));if(-1!==o){const e=asyncEmbedComponents[o];e&&i({Component:e,props:t})}}catch(e){console.error("Error finding embed match:",e)}})),()=>{e=!1}}),[r,t]),n){const{Component:t,props:r}=n;return e.createElement(t,Object.assign({},r))}return null},de=r(T,((e,t)=>e.children===t.children)),me=r((({message:e})=>(e.content=e.content.replace(/^\n+|(\n+|\\)+$/g,""),t.createElement(de,{className:"dark:prose-invert prose flex-1",remarkPlugins:[C],rehypePlugins:[j],components:{code(e){var{inline:r,className:a,children:o}=e,n=Q(e,["inline","className","children"]);const i=/language-(\w+)/.exec(a||""),s=i&&i[1];return!r&&s?t.createElement(ee,Object.assign({key:Math.random(),language:s,value:String(o).replace(/\n$/,"")},n)):t.createElement("code",Object.assign({className:`text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${a}`.trim()},n),o)},marker:({children:e})=>t.createElement("div",{className:"my-2"},t.createElement("span",{className:"highlight"},e)),table:({children:e})=>t.createElement("table",{className:"border-collapse border border-black px-3 py-1 dark:border-white"},e),th:({children:e})=>t.createElement("th",{className:"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white"},e),td:({children:e})=>t.createElement("td",{className:"break-words border border-black px-3 py-1 dark:border-white"},e),a(e){var{children:r}=e,a=Q(e,["children"]);if(a.href){const e=ce({attrs:{href:a.href}});if(t.isValidElement(e))return e}return t.createElement("a",Object.assign({className:"link",target:"_blank",rel:"noopener noreferrer"},a),r)},pre:({children:e})=>t.createElement(t.Fragment,null,e),img({src:e,alt:r}){const a=ce({attrs:{href:null!=e?e:""}});return t.isValidElement(a)?a:t.createElement("img",{src:e,alt:r,className:"w-full"})},li:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("li",Object.assign({className:"py-1"},a),r)},ul:({children:e})=>t.createElement("ul",{className:"ml-4 list-outside list-disc"},e),ol:({children:e})=>t.createElement("ol",{className:"ml-4 list-outside list-decimal"},e),strong:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("span",Object.assign({className:"font-semibold"},a),r)},h1:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("h1",Object.assign({className:"mb-2 mt-6 text-3xl font-semibold"},a),r)},h2:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("h2",Object.assign({className:"mb-2 mt-6 text-2xl font-semibold"},a),r)},h3:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("h3",Object.assign({className:"mb-2 mt-6 text-xl font-semibold"},a),r)},h4:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("h4",Object.assign({className:"mb-2 mt-6 text-lg font-semibold"},a),r)},h5:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("h5",Object.assign({className:"mb-2 mt-6 text-base font-semibold"},a),r)},h6:e=>{var{children:r}=e,a=Q(e,["children"]);return t.createElement("h6",Object.assign({className:"mb-2 mt-6 text-sm font-semibold"},a),r)}}},e.content))));function pe({answer:e,question:r,theme:o,searchResults:n,followUpQuestions:i,onFollowUpClick:s}){const[l,f]=a(null),[w,y]=a(!1),[v,x]=a(!1),k=()=>B(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(e),x(!0),setTimeout((()=>x(!1)),2e3)}catch(e){console.error("Failed to copy text:",e)}}));return t.createElement("div",{className:"space-y-6"},t.createElement("div",{className:"rounded-xl",style:{borderColor:o.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"p-6 space-y-4"},t.createElement("div",{className:"flex items-start justify-between"},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(c,{className:"h-5 w-5",style:{color:o.primary}}),t.createElement("h2",{className:"text-xl",style:{color:o.text}},r)),t.createElement("button",{onClick:()=>{k()},className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 transition-colors duration-200"},v?t.createElement(t.Fragment,null,t.createElement(d,{className:"h-4 w-4 text-green-500"}),t.createElement("span",{className:"text-green-500"},"Copied!")):t.createElement(t.Fragment,null,t.createElement(m,{className:"h-4 w-4"}),t.createElement("span",null,"Copy")))),e&&t.createElement("div",{className:"prose prose-sm max-w-none",style:{color:o.text}},t.createElement(me,{message:{content:e}})),e&&t.createElement("div",{className:"mt-6 flex justify-end gap-2"},t.createElement(K,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!1===l?o.primary:`${o.text}60`},onClick:()=>f(!1)},t.createElement(p,{className:"h-4 w-4"})),t.createElement(K,{variant:"ghost",size:"sm",className:"hover:opacity-90 transition-colors duration-200 h-8 w-8",style:{color:!0===l?o.primary:`${o.text}60`},onClick:()=>f(!0)},t.createElement(u,{className:"h-4 w-4"}))),e&&i&&i.length>0&&t.createElement("div",{className:"mt-6 space-y-3"},t.createElement("div",{className:"text-sm font-medium",style:{color:o.text}},"Follow-up Questions"),t.createElement("div",{className:"flex flex-wrap gap-2"},i.map(((e,r)=>t.createElement("button",{key:r,onClick:()=>null==s?void 0:s(e),className:"px-3 py-1.5 rounded-lg text-sm transition-all duration-200 hover:opacity-90",style:{backgroundColor:`${o.accent}30`,color:o.text,border:`1px solid ${o.border}`}},e))))),n&&n.length>0&&t.createElement("div",{className:"mt-6 rounded-lg overflow-hidden",style:{backgroundColor:o.surface,borderWidth:"1px",borderStyle:"solid",borderColor:o.surfaceBorder}},t.createElement("button",{onClick:()=>y(!w),className:"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50",style:{color:o.text,borderBottom:w?`1px solid ${o.surfaceBorder}`:"none"}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement(g,{className:"h-4 w-4",style:{color:o.primary}}),t.createElement("span",{className:"font-medium"},"Related Articles (",n.length,")")),t.createElement(h,{className:"h-4 w-4 transition-transform duration-200 "+(w?"rotate-180":""),style:{color:o.text}})),t.createElement("div",{className:"overflow-hidden transition-all duration-200 ease-in-out",style:{maxHeight:w?48*n.length+"px":"0",opacity:w?1:0,transform:`translateY(${w?"0":"-10px"})`}},t.createElement("div",{className:"divide-y divide-gray-200"},n.map((e=>t.createElement("a",{key:e.id,href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50",style:{color:o.text,backgroundColor:o.surface}},t.createElement(g,{className:"h-4 w-4",style:{color:o.primary}}),t.createElement("span",{className:"flex-grow"},e.title),t.createElement(b,{className:"h-4 w-4",style:{color:`${o.text}60`}}))))))),!e&&t.createElement("div",{className:"animate-pulse space-y-4"},t.createElement("div",{className:"h-4 rounded w-full",style:{backgroundColor:`${o.border}40`}}),t.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${o.border}40`}})))))}function ue({theme:e,loadingText:r="Analyzing..."}){return t.createElement("div",{className:"w-full space-y-6 rounded-xl p-6",style:{borderColor:e.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"flex items-center gap-2"},t.createElement("div",{className:"w-5 h-5 rounded-full animate-pulse",style:{backgroundColor:`${e.primary}30`}}),t.createElement("div",{className:"text-sm",style:{color:e.text}},r)),t.createElement("div",{className:"space-y-4 animate-pulse"},Array.from({length:4}).map(((r,a)=>t.createElement("div",{key:a,className:"h-4 rounded w-full",style:{backgroundColor:`${e.border}40`}}))),t.createElement("div",{className:"h-4 rounded w-3/4",style:{backgroundColor:`${e.border}40`}})),t.createElement("div",{className:"rounded-lg p-4",style:{backgroundColor:`${e.accent}50`}},t.createElement("div",{className:"flex items-center justify-between"},t.createElement("div",{className:"h-4 rounded w-48",style:{backgroundColor:`${e.border}80`}}),t.createElement("div",{className:"flex gap-2"},t.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${e.border}80`}}),t.createElement("div",{className:"w-8 h-8 rounded-full",style:{backgroundColor:`${e.border}80`}})))))}function ge({onClick:e,theme:r}){return t.createElement(K,{className:"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300",style:{backgroundColor:r.background,borderColor:r.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},onClick:e},t.createElement(f,{className:"h-5 w-5",style:{color:r.text}}))}function he({questions:e,currentIndex:r,activeIndex:a,onNavigate:o,theme:n,offset:i}){return t.createElement(N.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},className:"fixed left-4 top-1/2 -translate-y-1/2 z-50 flex flex-col gap-2",style:Object.assign({},i?{left:`${i}px`}:{})},e.map(((e,i)=>t.createElement("div",{key:i,className:"relative group"},t.createElement("button",{onClick:()=>o(i),className:"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 "+(i<=r?"hover:opacity-90":""),style:{backgroundColor:i===a?n.primary:"#ccc",color:i===a?n.background:"#333",opacity:i>r?.5:1,cursor:"pointer"}},i+1),t.createElement("div",{className:"absolute left-12 top-0 px-3 py-2 rounded-lg whitespace-normal opacity-0 group-hover:opacity-100 w-48 text-sm transition-opacity duration-200",style:{backgroundColor:n.background,color:n.text,borderColor:n.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},e,t.createElement("div",{className:"absolute left-0 top-3 -translate-x-1 w-2 h-2 rotate-45",style:{backgroundColor:n.background,borderLeft:`1px solid ${n.border}`,borderBottom:`1px solid ${n.border}`}}))))))}function be({questions:e,onQuestionClick:r,borderColor:a}){return e&&0!==e.length?t.createElement("div",{className:"w-full"},t.createElement("h3",{className:"text-base font-medium mb-4 text-gray-900"},"Suggested questions"),t.createElement("div",{className:"flex flex-wrap gap-2"},e.map(((e,o)=>t.createElement("button",{key:o,onClick:()=>r(e),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm",style:{borderColor:a}},e))))):null}const fe=q.Root,we=q.Trigger;e.forwardRef(((t,r)=>{var{className:a,inset:o,children:n}=t,i=Q(t,["className","inset","children"]);return e.createElement(q.SubTrigger,Object.assign({ref:r,className:X("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",o&&"pl-8",a)},i),n,e.createElement(F,{className:"ml-auto"}))})).displayName=q.SubTrigger.displayName;e.forwardRef(((t,r)=>{var{className:a}=t,o=Q(t,["className"]);return e.createElement(q.SubContent,Object.assign({ref:r,className:X("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",a)},o))})).displayName=q.SubContent.displayName;const ye=e.forwardRef(((t,r)=>{var{className:a,sideOffset:o=4}=t,n=Q(t,["className","sideOffset"]);return e.createElement(q.Portal,null,e.createElement(q.Content,Object.assign({ref:r,sideOffset:o,className:X("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",a)},n)))}));ye.displayName=q.Content.displayName;const ve=e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=Q(t,["className","inset"]);return e.createElement(q.Item,Object.assign({ref:r,className:X("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",o&&"pl-8",a)},n))}));ve.displayName=q.Item.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o,checked:n}=t,i=Q(t,["className","children","checked"]);return e.createElement(q.CheckboxItem,Object.assign({ref:r,className:X("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:n},i),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(q.ItemIndicator,null,e.createElement(U,{className:"h-4 w-4"}))),o)})).displayName=q.CheckboxItem.displayName;e.forwardRef(((t,r)=>{var{className:a,children:o}=t,n=Q(t,["className","children"]);return e.createElement(q.RadioItem,Object.assign({ref:r,className:X("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a)},n),e.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},e.createElement(q.ItemIndicator,null,e.createElement(_,{className:"h-2 w-2 fill-current"}))),o)})).displayName=q.RadioItem.displayName;e.forwardRef(((t,r)=>{var{className:a,inset:o}=t,n=Q(t,["className","inset"]);return e.createElement(q.Label,Object.assign({ref:r,className:X("px-2 py-1.5 text-sm font-semibold",o&&"pl-8",a)},n))})).displayName=q.Label.displayName;function xe({endpoint:e,query:t,collectionId:r,headers:a}){var o;return B(this,void 0,void 0,(function*(){try{const n=yield fetch(e,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},a),body:JSON.stringify(Object.assign({query:t,limit:5},r&&"all"!==r&&{collectionId:r}))});if(!n.ok)throw new Error("Failed to fetch search results");const i=yield n.json();return{results:null==i?void 0:i.data,searchQueryId:null===(o=null==i?void 0:i.searchQuery)||void 0===o?void 0:o.id}}catch(e){throw console.error("Error searching:",e),e}}))}function ke({endpoint:e,searchQueryId:t,headers:r}){return B(this,void 0,void 0,(function*(){try{const a=yield fetch(e,{method:"POST",headers:Object.assign({"Content-Type":"application/json"},r),body:JSON.stringify({searchQueryId:t})});if(!a.ok)throw new Error("Failed to fetch answer");return a}catch(e){throw console.error("Error fetching answer:",e),e}}))}e.forwardRef(((t,r)=>{var{className:a}=t,o=Q(t,["className"]);return e.createElement(q.Separator,Object.assign({ref:r,className:X("-mx-1 my-1 h-px bg-muted",a)},o))})).displayName=q.Separator.displayName;const Ee={primary:"#A3E635",accent:"#f9fafb",background:"white",text:"#171717",border:"#171717",hover:"#171717",surface:"#F9FAFB",surfaceBorder:"#E5E7EB",surfaceHover:"#F3F4F6"};function Ne({suggestedQuestions:e,theme:r={},collections:i=[],selectedCollectionId:s,onCollectionChange:l,searchEndpoint:c,answerEndpoint:d,followUpQuestionsEndpoint:m,disableFollowUpQuestions:p=!1,siblingNode:u,offset:g=0,headers:b}){var f;const j=Object.assign(Object.assign({},Ee),r),[C,O]=a(""),[S,$]=a(""),[R,L]=a(!1),[I,A]=a(!1),[T,q]=a([]),[F,U]=a(!1),[_,Q]=a(0),[M,Z]=a([]),[P,W]=a(s),V=n(null),Y=n(null),H=n([]),X=n(null),D=n(null);o((()=>{W(s)}),[s]);const J=e=>{e.style.height="auto",e.style.height=`${e.scrollHeight}px`},G=()=>{setTimeout((()=>{var e;H.current[H.current.length-1]&&(null===(e=H.current[H.current.length-1])||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),X.current&&X.current.scrollBy(0,-80))}),100)},ee=(e,t,r)=>B(this,void 0,void 0,(function*(){if(!e.body)throw new Error("No response body");const a=e.body.getReader(),o=new TextDecoder;let n="";const i=p?Promise.resolve([]):function(e,t,r){return B(this,void 0,void 0,(function*(){try{const a=new AbortController,o=setTimeout((()=>a.abort()),5e3),n=yield fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({question:t,answer:r||"Generating answer..."}),signal:a.signal});if(clearTimeout(o),!n.ok)throw new Error("Failed to fetch follow-up questions");return(yield n.json()).questions.slice(0,3)}catch(e){return e instanceof Error&&console.error("Error fetching follow-up questions:",e.message),[]}}))}(m,t,"");let s=!0;for(;s;){const{done:e,value:l}=yield a.read();if(e){if(s=!1,!p)try{const e=yield i;q((t=>{const r=[...t];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{followUpQuestions:e}),r}))}catch(e){console.error("Error fetching follow-up questions:",e)}continue}const c=o.decode(l);n+=c,q((e=>{const a=[...e];return a[a.length-1]={question:t,answer:n,isLoading:!1,searchResults:r},a}))}})),te=()=>B(this,void 0,void 0,(function*(){if(C.trim()){L(!0),A(!0),q((e=>[...e,{question:C,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const e=yield xe(Object.assign({endpoint:c,query:C,collectionId:P},b?{headers:b}:{})),t=e.results,r=e.searchQueryId;q((e=>{const r=[...e];return r[r.length-1]=Object.assign(Object.assign({},r[r.length-1]),{searchResults:t,isSearchLoading:!1}),r}));const a=yield ke(Object.assign({endpoint:d,searchQueryId:r},b?{headers:b}:{}));yield ee(a,C,t)}catch(e){console.error("Error generating answer:",e),q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{L(!1),G()}}})),re=()=>B(this,void 0,void 0,(function*(){if(S.trim()){const e=S;O(e),$(""),L(!0),q((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}]));try{const t=yield xe(Object.assign({endpoint:c,query:e,collectionId:P},b?{headers:b}:{})),r=t.results,a=t.searchQueryId;q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const o=yield ke(Object.assign({endpoint:d,searchQueryId:a},b?{headers:b}:{}));yield ee(o,e,r)}catch(e){console.error("Error generating answer:",e),q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{L(!1),G()}}}));o((()=>{const e=X.current;if(!e)return;const t=()=>{const{scrollTop:t,scrollHeight:r,clientHeight:a}=e;U(!(r-t-a<100))};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}),[]),o((()=>()=>{M.forEach((e=>URL.revokeObjectURL(e.preview)))}),[M]);return t.createElement("div",{className:"relative min-h-screen"},t.createElement("div",{ref:X,className:"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20 h-screen overflow-y-auto"},t.createElement(z,null,I?t.createElement(N.div,{key:"results",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"w-full space-y-8 pb-24"},T.map(((e,r)=>t.createElement(N.div,{key:r,ref:e=>H.current[r]=e,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1*r}},e.isLoading?t.createElement(ue,{theme:j,loadingText:e.isSearchLoading?"Looking for relevant content...":"Analyzing..."}):t.createElement(pe,{answer:e.answer,question:e.question,theme:j,searchResults:e.searchResults,followUpQuestions:p?void 0:e.followUpQuestions,onFollowUpClick:p?void 0:e=>{$(e),re()}}))))):t.createElement(N.div,{key:"search",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"w-full space-y-8"},t.createElement("div",{className:"w-full text-center space-y-4"},t.createElement(N.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.3},className:"text-5xl font-bold",style:{color:j.text}},"How can we help you today?")),t.createElement(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4}},t.createElement("div",{className:"relative w-full rounded-md overflow-hidden",style:{backgroundColor:j.background,borderColor:j.border,borderWidth:"1px",borderStyle:"solid"}},t.createElement("div",{className:"p-3 flex items-center"},t.createElement(w,{className:"h-5 w-5 text-gray-400 mr-2"}),t.createElement("textarea",{ref:V,placeholder:"Ask a question or type a search term here ...",value:C,onChange:e=>{O(e.target.value),J(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),te())},className:"w-full resize-none outline-none text-lg font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent",style:{color:j.text},rows:1})),M.length>0&&t.createElement("div",{className:"flex gap-2 mt-3 overflow-x-auto pb-1 px-3"},M.map(((e,r)=>t.createElement("div",{key:r,className:"relative group rounded-lg overflow-hidden flex-shrink-0",style:{width:"80px",height:"80px"}},t.createElement("img",{src:e.preview,alt:`Attached ${r+1}`,className:"w-full h-full object-cover"}),t.createElement("button",{onClick:()=>(e=>{Z((t=>(URL.revokeObjectURL(t[e].preview),t.filter(((t,r)=>r!==e)))))})(r),className:"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},t.createElement(y,{className:"h-3 w-3 text-white"})))))),t.createElement("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200"},t.createElement("div",{className:"flex gap-2"},i.length>0&&t.createElement(fe,null,t.createElement(we,{asChild:!0},t.createElement(K,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700"},t.createElement("div",{className:"w-5 h-5 rounded-full border-2 border-gray-400 border-dashed flex items-center justify-center"}),(null===(f=i.find((e=>e.id===P)))||void 0===f?void 0:f.name)||"All documents",t.createElement(h,{className:"h-4 w-4 opacity-50"}))),t.createElement(ye,null,i.map((e=>t.createElement(ve,{key:e.id,onClick:()=>{return t=e.id,W(t),void(null==l||l(t));var t},className:e.id===P?"bg-gray-100":""},e.name))))),t.createElement("input",{type:"file",ref:D,accept:"image/*",multiple:!0,className:"hidden",onChange:e=>{const t=e.target.files;if(t){const e=Array.from(t).map((e=>({file:e,preview:URL.createObjectURL(e)})));Z((t=>[...t,...e]))}D.current&&(D.current.value="")}}),t.createElement(K,{variant:"ghost",size:"sm",className:"hover:bg-gray-200 rounded-md h-8 text-gray-700",onClick:()=>{var e;return null===(e=D.current)||void 0===e?void 0:e.click()}},t.createElement(v,{className:"h-4 w-4 mr-1.5"}),"Attach image")),t.createElement("div",{className:"flex items-center"},t.createElement(K,{size:"sm",disabled:!C||R,className:"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50",onClick:()=>{te()}},R?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent",style:{borderColor:"white"}}):t.createElement(x,{className:"h-4 w-4 text-gray-700"})))))),t.createElement(be,{questions:e,onQuestionClick:e=>{A(!0),L(!0),q((t=>[...t,{question:e,answer:"",isLoading:!0,isSearchLoading:!0}])),(()=>{B(this,void 0,void 0,(function*(){try{const t=yield xe(Object.assign({endpoint:c,query:e,collectionId:P},b?{headers:b}:{})),r=t.results;q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{searchResults:r,isSearchLoading:!1}),t}));const a=yield ke(Object.assign({endpoint:d,searchQueryId:t.searchQueryId},b?{headers:b}:{}));yield ee(a,e,r)}catch(e){console.error("Error generating answer:",e),q((e=>{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{answer:"Sorry, there was an error generating the answer.",isLoading:!1,isSearchLoading:!1}),t}))}finally{L(!1),G()}}))})()},borderColor:j.border}),u)),I&&T.length>0&&t.createElement(he,{questions:T.map((e=>e.question)),currentIndex:R?T.length-1:_,activeIndex:_,onNavigate:e=>{Q(e),(e=>{setTimeout((()=>{var t;H.current[e]&&(null===(t=H.current[e])||void 0===t||t.scrollIntoView({behavior:"smooth",block:"start"}),X.current&&X.current.scrollBy(0,-80))}),100)})(e)},theme:j,offset:g}),I&&t.createElement(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10",style:{left:`${g}px`}},t.createElement("div",{className:"rounded-full px-4 py-2 flex items-center justify-between",style:{backgroundColor:j.background,borderColor:j.border,borderWidth:"1px",borderStyle:"solid",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"}},t.createElement("div",{className:"flex items-center gap-2 flex-grow overflow-hidden"},t.createElement(k,{className:"h-4 w-4 flex-shrink-0",style:{color:j.primary}}),t.createElement("textarea",{ref:Y,placeholder:"Ask follow-up",value:S,onChange:e=>{$(e.target.value),J(e.target)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),re())},disabled:R,className:"w-full bg-transparent outline-none text-sm resize-none overflow-hidden disabled:opacity-50 border-none",style:{color:j.text},rows:1})),t.createElement("div",{className:"flex items-center gap-3 ml-2 flex-shrink-0"},t.createElement(K,{size:"icon",variant:"ghost",disabled:R||!S.trim(),className:"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 flex items-center justify-center",style:{color:j.text,backgroundColor:"transparent"},onClick:()=>{re()}},R?t.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-2",style:{borderColor:`${j.text}40`,borderTopColor:j.text}}):t.createElement(E,{className:"h-4 w-4"}))))),F&&I&&t.createElement(ge,{onClick:G,theme:j})))}export{Ne as ChatSearch};
package/dist/index.d.ts CHANGED
@@ -21,6 +21,9 @@ interface Theme {
21
21
  text: string;
22
22
  border: string;
23
23
  hover: string;
24
+ surface: string;
25
+ surfaceBorder: string;
26
+ surfaceHover: string;
24
27
  }
25
28
  interface Collection {
26
29
  id: string;
@@ -39,8 +42,9 @@ interface ChatSearchProps {
39
42
  onCollectionChange?: (collectionId: string) => void;
40
43
  siblingNode?: React.ReactNode;
41
44
  offset?: number;
45
+ headers?: Record<string, string>;
42
46
  }
43
47
 
44
- declare function ChatSearch({ suggestedQuestions, theme, collections, selectedCollectionId, onCollectionChange, searchEndpoint, answerEndpoint, followUpQuestionsEndpoint, disableFollowUpQuestions, siblingNode, offset, }: ChatSearchProps): React$1.JSX.Element;
48
+ declare function ChatSearch({ suggestedQuestions, theme, collections, selectedCollectionId, onCollectionChange, searchEndpoint, answerEndpoint, followUpQuestionsEndpoint, disableFollowUpQuestions, siblingNode, offset, headers, }: ChatSearchProps): React$1.JSX.Element;
45
49
 
46
50
  export { type Answer, ChatSearch, type ChatSearchProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainfish-ai/components",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Brainfish Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -104,8 +104,10 @@
104
104
  "@radix-ui/react-icons": "^1.3.2",
105
105
  "@radix-ui/react-switch": "^1.1.2",
106
106
  "framer-motion": "^11.15.0",
107
+ "phosphor-react": "^1.4.1",
107
108
  "react-markdown": "^9.0.1",
108
109
  "react-syntax-highlighter": "^15.6.1",
110
+ "rehype-raw": "^7.0.0",
109
111
  "remark-gfm": "^4.0.0"
110
112
  }
111
113
  }