@autoai-ui/autoui 0.1.10 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +18 -9
- package/dist/index.mjs +2509 -1988
- package/dist/lib/components/chat/hooks/useChat.d.ts +1 -1
- package/dist/lib/components/chat/hooks/useSpeechToText.d.ts +9 -0
- package/dist/lib/components/chat/hooks/useTheme.d.ts +6 -0
- package/dist/lib/components/chat/types/index.d.ts +7 -0
- package/dist/lib/components/chat/ui/ChatMenu.d.ts +1 -0
- package/dist/lib/components/chat/ui/ChatTextBox.d.ts +5 -0
- package/dist/lib/components/chat/ui/MicButton.d.ts +4 -0
- package/dist/lib/components/chat/ui/ScrollToBottomButton.d.ts +7 -0
- package/dist/lib/components/chat/ui/SendButton.d.ts +1 -0
- package/dist/lib/components/menu/index.d.ts +1 -0
- package/dist/lib/components/menu/ui/Menu.d.ts +6 -0
- package/dist/lib/components/menu/ui/MenuItem.d.ts +16 -0
- package/dist/lib/components/menu/ui/MenuSelectedIcon.d.ts +4 -0
- package/dist/lib/components/popover/index.d.ts +2 -0
- package/dist/lib/components/popover/ui/Popover.d.ts +10 -0
- package/dist/lib/components/popover/ui/PopoverMenu.d.ts +10 -0
- package/dist/lib/components/spinner/ui/Spinner.d.ts +1 -0
- package/dist/lib/components/switch/index.d.ts +1 -0
- package/dist/lib/components/switch/ui/Switch.d.ts +30 -0
- package/dist/lib/core/buildDataAnalyzingPrompt.d.ts +3 -0
- package/dist/lib/core/extraDataAnalyzingWithLLM.d.ts +3 -0
- package/dist/lib/core/llmClient.d.ts +1 -1
- package/dist/lib/core/sseParser.d.ts +1 -0
- package/dist/lib/runtime/runtimeEngine.d.ts +1 -1
- package/dist/lib/runtime/stepExecutor.d.ts +1 -1
- package/dist/lib/types/index.d.ts +10 -13
- package/dist/lib/types/llmTypes.d.ts +1 -0
- package/dist/stats.html +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(":root{--autoui-bg: #ffffff;--autoui-bg-alt: #f4f4f5;--autoui-text: #111111;--autoui-accent: #007aff;--autoui-border: #e5e5e5}[data-theme=dark]{--autoui-bg: #1c1c1e;--autoui-bg-alt: #2c2c2e;--autoui-text: #f2f2f7;--autoui-accent: #0a84ff;--autoui-border: #3a3a3c}.autoui-chat{background:var(--autoui-bg);color:var(--autoui-text);border:1px solid var(--autoui-border);border-radius:12px;display:flex;flex-direction:column;height:480px;width:360px;overflow:hidden;font-family:system-ui,sans-serif}.autoui-chat-header{background:var(--autoui-bg-alt);padding:.75rem 1rem;border-bottom:1px solid var(--autoui-border);display:flex;justify-content:space-between;align-items:center}.autoui-chat-title{font-size:1rem;display:flex;align-items:center;font-weight:600;margin:0}.autoui-chat-closebtn{width:2rem;height:2rem!important;display:flex;justify-content:center;border:none;cursor:pointer;font-size:1rem;color:#000;background-color:transparent;align-items:center;border-radius:100%}.autoui-chat-messages{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.5rem;scroll-behavior:smooth}.autoui-chat-messages::-webkit-scrollbar{width:8px}.autoui-chat-messages::-webkit-scrollbar-track{background:transparent}.autoui-chat-messages::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#444,#666);border-radius:6px;-webkit-transition:background .3s ease;transition:background .3s ease}.autoui-chat-messages::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,#555,#777)}.autoui-chat-messages{scrollbar-width:thin;scrollbar-color:#555 transparent}.autoui-chat-message{display:flex;margin-bottom:.75rem}.autoui-chat-message.user{justify-content:flex-end}.autoui-chat-message.assistant{justify-content:flex-start}.autoui-chat-bubble{background:var(--autoui-bg-alt);padding:.5rem .75rem;border-radius:16px;max-width:80%;word-break:break-word}.autoui-chat-message.assistant .autoui-chat-bubble:has(>div[class*=w-full]){max-width:100%;width:100%;padding:1rem;background:transparent}.autoui-chat-bubble>div[class*=w-full]{max-width:100%;width:100%;min-width:0}.autoui-chat-message.user .autoui-chat-bubble{background:var(--autoui-accent);color:#fff}.autoui-chat-input{display:flex;border-top:1px solid var(--autoui-border);background:var(--autoui-bg-alt);padding:.5rem;gap:.5rem}.autoui-chat-textbox{flex:1;border:1px solid var(--autoui-border);border-radius:8px;padding:.5rem .75rem;background:var(--autoui-bg);color:var(--autoui-text)}.autoui-chat-send{background:var(--autoui-accent);border:none;color:#fff;border-radius:8px;padding:0 1rem;cursor:pointer;font-size:1rem}.autoui-chat-send img{height:1.5rem;color:#fff;fill:#fff}.autoui-chat-send:hover{opacity:.9}.autoui-chat-open-btn{width:50px;height:50px;border-radius:50%;border:1px solid var(--autoui-border);background:var(--autoui-bg-alt);color:var(--autoui-text);cursor:pointer;font-size:1rem;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 4px #0000001a;transition:all .2s ease;position:fixed;bottom:1.75rem;right:1.75rem;z-index:10000}.autoui-chat-open-btn:hover{background:var(--autoui-accent);color:#fff;transform:translateY(-2px)}.autoui-chat-open-btn:active{transform:translateY(0);opacity:.9}.autoui-chat-portal{position:fixed;right:4rem;bottom:4rem;z-index:9999;display:flex;justify-content:flex-end;align-items:flex-end;pointer-events:none;background:transparent}.autoui-chat-wrapper{pointer-events:auto;margin:1rem;width:full;max-height:600px;background:var(--autoui-bg);border-radius:16px;box-shadow:0 8px 24px #00000026;overflow:hidden;transform:translateY(20px);opacity:0;animation:autoui-slide-up .25s ease forwards}@keyframes autoui-slide-up{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}")),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".spinner-base{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;background-color:transparent;position:absolute;bottom:0;left:50%;transform:translate(-50%)}.spinner-label{margin-top:.5rem;font-size:14px;color:#666}.spinner-dots-wrapper{display:flex;gap:6px}.spinner-dot{width:8px;height:8px;border-radius:50%;animation:bounce .6s infinite ease-in-out}@keyframes bounce{0%,80%,to{transform:scale(.4)}40%{transform:scale(1)}}.spinner-simple{animation:spin 1s linear infinite}.spinner-simple-circle1{opacity:.25}.spinner-simple-circle2{opacity:.75}@keyframes spin{to{transform:rotate(360deg)}}.spinner-bars-wrapper{position:relative;width:24px;height:24px}.spinner-bar{position:absolute;left:50%;top:50%;width:3px;height:6px;opacity:.2;animation:pulse 1s infinite linear;transform-origin:center}@keyframes pulse{0%,20%{opacity:1}to{opacity:.2}}.spinner-default{position:relative;width:32px;height:32px}.spinner-default-circle1,.spinner-default-circle2{position:absolute;inset:0;border-width:4px;border-style:solid;border-radius:50%}.spinner-default-circle1{opacity:.25}.spinner-default-circle2{border-top-color:transparent!important;animation:spin 1s linear infinite}:root{--hero-bg: #ffffff;--hero-text: #111111;--hero-hover: rgba(0, 0, 0, .05);--hero-selected: rgba(0, 0, 0, .07);--hero-muted: rgba(0, 0, 0, .6);--hero-accent: #007aff}[data-theme=dark]{--hero-bg: #2c2c2e;--hero-text: #f2f2f7;--hero-hover: rgba(255, 255, 255, .06);--hero-selected: rgba(255, 255, 255, .1);--hero-muted: rgba(255, 255, 255, .6);--hero-accent: #0a84ff}.hero-menu{list-style:none;padding:6px;margin:0;width:240px;background:var(--hero-bg);color:var(--hero-text);border-radius:10px}.hero-menu-item{display:flex;align-items:center;padding:8px 10px;gap:10px;cursor:pointer;border-radius:8px;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:background .15s ease}.content .label{display:flex;align-items:center}.hero-menu-item:hover{background:var(--hero-hover)}.hero-menu-item.selected{background:var(--hero-selected);font-weight:500}.hero-menu-item.disabled{opacity:.4;pointer-events:none}.hero-menu-item .content{flex:1;display:flex;flex-direction:column}.hero-menu-item .description{font-size:12px;margin-top:-2px;color:var(--hero-muted)}.hero-menu-item .shortcut{font-size:12px;color:var(--hero-muted)}.selected-icon svg{width:16px;height:16px;color:var(--hero-accent)}.autoui-switch{--sw-track-off: color-mix(in srgb, var(--autoui-border, #e5e5e5) 85%, transparent);--sw-track-on: var(--autoui-accent, #007aff);--sw-thumb: var(--autoui-bg, #fff);--sw-ring: color-mix(in srgb, var(--autoui-accent, #007aff) 35%, transparent);--sw-text: var(--autoui-text, #111);display:inline-flex;align-items:center;gap:10px;-webkit-user-select:none;-moz-user-select:none;user-select:none;color:var(--sw-text)}.autoui-switch.is-disabled{opacity:.5;pointer-events:none}.autoui-switch__control{position:relative;display:inline-flex;align-items:center}.autoui-switch__input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.autoui-switch__track{display:block;border-radius:999px;background:var(--sw-track-off);transition:background .16s ease;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--autoui-border, #e5e5e5) 55%,transparent)}.autoui-switch__thumb{position:absolute;top:50%;transform:translateY(-50%);border-radius:999px;background:var(--sw-thumb);display:grid;place-items:center;transition:left .16s ease,width .16s ease,height .16s ease,transform .16s ease;box-shadow:0 2px 8px #0000002e,inset 0 0 0 1px color-mix(in srgb,var(--autoui-border, #e5e5e5) 45%,transparent)}.autoui-switch__thumbContent{display:inline-flex;align-items:center;justify-content:center;line-height:0}.autoui-switch__input:focus-visible~.autoui-switch__track{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--autoui-border, #e5e5e5) 55%,transparent),0 0 0 4px var(--sw-ring)}.autoui-switch__input:checked~.autoui-switch__track{background:var(--sw-track-on)}.autoui-switch--sm .autoui-switch__track{width:36px;height:20px}.autoui-switch--sm .autoui-switch__thumb{width:16px;height:16px;left:2px}.autoui-switch--sm .autoui-switch__input:checked~.autoui-switch__thumb{left:18px}.autoui-switch--md .autoui-switch__track{width:44px;height:24px}.autoui-switch--md .autoui-switch__thumb{width:20px;height:20px;left:2px}.autoui-switch--md .autoui-switch__input:checked~.autoui-switch__thumb{left:22px}.autoui-switch--lg .autoui-switch__track{width:54px;height:30px}.autoui-switch--lg .autoui-switch__thumb{width:26px;height:26px;left:2px}.autoui-switch--lg .autoui-switch__input:checked~.autoui-switch__thumb{left:26px}.autoui-switch__text{display:flex;flex-direction:column;gap:2px;min-width:0}.autoui-switch__label{display:flex;align-items:center;font-weight:600}.autoui-switch__description{font-size:12px;opacity:.7}:root{--autoui-bg: #ffffff;--autoui-bg-alt: #f4f4f5;--autoui-text: #111111;--autoui-accent: #007aff;--autoui-border: #e5e5e5;--icon-filter-text: invert(0%);--icon-filter-accent: invert(77%) sepia(82%) saturate(1012%) hue-rotate(359deg) brightness(103%) contrast(103%)}[data-theme=dark]{--autoui-bg: #1c1c1e;--autoui-bg-alt: #2c2c2e;--autoui-text: #f2f2f7;--autoui-accent: #004d99;--autoui-border: #3a3a3c;--icon-filter-text: invert(100%);--icon-filter-accent: invert(77%) sepia(82%) saturate(1012%) hue-rotate(359deg) brightness(103%) contrast(103%)}.autoui-chat{background:var(--autoui-bg);color:var(--autoui-text);border:1px solid var(--autoui-border);border-radius:1rem;display:flex;flex-direction:column;width:400px;height:560px;font-family:system-ui,sans-serif}.autoui-chat-header{background:var(--autoui-bg-alt);padding:.75rem 1rem;border-bottom:1px solid var(--autoui-border);display:flex;justify-content:space-between;align-items:center;border-top-left-radius:1rem;border-top-right-radius:1rem}.autoui-chat-title{font-size:1rem;display:flex;color:var(--autoui-text);align-items:center;font-weight:600;margin:0}.autoui-chat-closebtn{width:2rem;height:2rem!important;display:flex;justify-content:center;border:none;cursor:pointer;font-size:1rem;fill:var(--autoui-text);color:var(--autoui-text);background-color:transparent;align-items:center;border-radius:100%}.autoui-chat-messages{position:relative;flex:1;overflow-y:auto;padding:0 .5rem;display:flex;flex-direction:column;gap:.5rem;scroll-behavior:smooth}.autoui-chat-messages-wrapper{padding:.5rem 0}[data-testid=virtuoso-item-list]{padding-right:.5rem!important}.autoui-chat-messages::-webkit-scrollbar{width:8px}.autoui-chat-messages::-webkit-scrollbar-track{background:transparent}.autoui-chat-messages::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#444,#666);border-radius:6px;-webkit-transition:background .3s ease;transition:background .3s ease}.autoui-chat-messages::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,#555,#777)}.autoui-chat-messages{scrollbar-width:thin;scrollbar-color:#555 transparent}.autoui-message-row{padding:.6rem 0}.autoui-message-row.is-user{justify-self:flex-end;display:flex;justify-content:flex-end}.autoui-chat-bubble{background:var(--autoui-bg-alt);padding:.5rem .75rem;border-radius:16px;max-width:80%;word-break:break-word}.autoui-chat-message.assistant .autoui-chat-bubble:has(>div[class*=w-full]){max-width:100%;width:100%;background:transparent}.autoui-chat-bubble>div[class*=w-full]{max-width:100%;width:100%;min-width:0}.autoui-chat-bubble--react-node{background:transparent;padding:0}.autoui-chat-message.user .autoui-chat-bubble{background:var(--autoui-accent);color:#fff;justify-content:flex-end;justify-self:flex-end}.autoui-chat-input{width:100%;display:flex;position:relative;background:transparent;padding:.5rem;gap:.5rem}.autoui-chat-textbox{flex:1;border:1px solid var(--autoui-border);border-radius:1rem;width:100%;padding:.5rem 5rem .5rem 2rem;background:var(--autoui-bg);color:var(--autoui-text);outline:none;transition:border-color .25s ease,box-shadow .25s ease}.autoui-chat-textbox:focus{border-color:color-mix(in srgb,var(--autoui-accent, #4a8cff) 45%,transparent);box-shadow:0 0}.autoui-chat-send{background:transparent;border:none;color:color-mix(in srgb,var(--autoui-accent, #4a8cff) 45%,transparent);border-radius:100%;display:flex;justify-content:center;align-items:center;box-shadow:0 2px 4px #00000014,0 6px 12px #0000000f;cursor:pointer;position:absolute!important;right:.9rem;top:20%;width:2rem;height:2rem;font-size:1rem}[data-theme=dark] .autoui-chat-send{box-shadow:0 2px 4px #00000073,0 6px 12px #00000059}.autoui-chat-messages>div{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--autoui-border) 40%,transparent) transparent}.autoui-chat-messages>div::-webkit-scrollbar{width:6px;padding-right:8px;padding-ещз:8px}.autoui-chat-messages>div::-webkit-scrollbar-track{background:transparent}.autoui-chat-messages>div::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--autoui-border) 50%,transparent);border-radius:8px;-webkit-transition:background .2s ease;transition:background .2s ease}.autoui-chat-messages>div::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--autoui-accent) 40%,var(--autoui-border))}.autoui-chat-send img{height:1.5rem;color:var(--autoui-accent)}.autoui-chat-send:hover{opacity:.9}.autoui-chat-open-btn{width:50px;height:50px;border-radius:50%;border:1px solid var(--autoui-border);background:#fff;cursor:pointer;font-size:1rem;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 4px #0000001a;transition:all .2s ease;position:fixed;bottom:1.75rem;right:1.75rem;background:var(--autoui-bg);color:var(--autoui-text);z-index:999}.autoui-chat-open-btn:hover{background:var(--autoui-accent);color:#fff;transform:translateY(-2px)}.autoui-chat-open-btn:active{transform:translateY(0);opacity:.9}.autoui-chat-input-start{width:1.5rem;height:1.5rem;left:1rem;position:absolute;top:30%}.autoui-chat-portal{position:fixed;right:4rem;bottom:4rem;z-index:1000;display:flex;justify-content:flex-end;align-items:flex-end;background:transparent}.autoui-chat-wrapper{pointer-events:auto;margin:1rem;width:full;max-height:600px;background:var(--autoui-bg);border-radius:16px;box-shadow:0 8px 24px #00000026;transform:translateY(20px);opacity:0;animation:autoui-slide-up .25s ease forwards}@keyframes autoui-slide-up{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}@media(max-width:520px){.autoui-chat-portal{position:fixed;inset:0;margin:0;padding:0;z-index:1000;display:flex;justify-content:center;align-items:flex-end;pointer-events:auto!important}.autoui-chat-wrapper{width:100vw!important;height:100vh!important;max-height:none;max-width:none;margin:0!important;border-radius:0!important;box-shadow:none!important}.autoui-chat{width:100vw!important;height:100vh!important;max-width:none;max-height:none;border-radius:0!important}}.empty__palceholder{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%}.empty__palceholder--main{font-size:1.2rem}.empty__palceholder--secondary{font-size:.8rem}.autoui-icon{width:16px;height:16px;color:red}.chat-scroll-bottom{position:absolute;right:1.5rem;bottom:1.5rem;display:flex;justify-content:center;align-items:center;width:2.5rem;height:2.5rem;border-radius:100%;border:none;background:var(--autoui-bg);color:var(--autoui-text);font-size:1.2rem;cursor:pointer;box-shadow:0 4px 12px #0003;transition:transform .15s ease,opacity .15s ease}.chat-scroll-bottom:hover{transform:translateY(-2px)}.chat-mic-btn{position:absolute;right:3.2rem;top:50%;transform:translateY(-50%);width:2rem;height:2rem;border-radius:50%;display:flex;align-items:center;justify-content:center;background:transparent;border:none;cursor:pointer;transition:opacity .2s ease,background .2s ease,transform .2s ease}.chat-mic-btn:hover{opacity:.9;background:color-mix(in srgb,var(--autoui-accent) 12%,transparent)}.chat-mic-btn img{width:20px;height:20px;filter:var(--icon-filter-text);transition:filter .2s ease}.chat-mic-btn.is-active{opacity:1;background:color-mix(in srgb,var(--autoui-accent) 20%,transparent);animation:mic-pulse 1.2s ease-in-out infinite}@keyframes mic-pulse{0%{box-shadow:0 0 color-mix(in srgb,var(--autoui-accent) 40%,transparent)}70%{box-shadow:0 0 0 8px color-mix(in srgb,var(--autoui-accent) 0%,transparent)}to{box-shadow:0 0 0 0 transparent}}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),zn=require("react-dom");function To(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const kt=To(x);var gt={exports:{}},tt={};var sn;function bo(){if(sn)return tt;sn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,r,s){var i=null;if(s!==void 0&&(i=""+s),r.key!==void 0&&(i=""+r.key),"key"in r){s={};for(var l in r)l!=="key"&&(s[l]=r[l])}else s=r;return r=s.ref,{$$typeof:e,type:o,key:i,ref:r!==void 0?r:null,props:s}}return tt.Fragment=t,tt.jsx=n,tt.jsxs=n,tt}var nt={};var ln;function yo(){return ln||(ln=1,process.env.NODE_ENV!=="production"&&(function(){function e(w){if(w==null)return null;if(typeof w=="function")return w.$$typeof===H?null:w.displayName||w.name||null;if(typeof w=="string")return w;switch(w){case v:return"Fragment";case h:return"Profiler";case f:return"StrictMode";case M:return"Suspense";case d:return"SuspenseList";case k:return"Activity"}if(typeof w=="object")switch(typeof w.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),w.$$typeof){case E:return"Portal";case P:return w.displayName||"Context";case b:return(w._context.displayName||"Context")+".Consumer";case z:var L=w.render;return w=w.displayName,w||(w=L.displayName||L.name||"",w=w!==""?"ForwardRef("+w+")":"ForwardRef"),w;case C:return L=w.displayName||null,L!==null?L:e(w.type)||"Memo";case y:L=w._payload,w=w._init;try{return e(w(L))}catch{}}return null}function t(w){return""+w}function n(w){try{t(w);var L=!1}catch{L=!0}if(L){L=console;var J=L.error,Q=typeof Symbol=="function"&&Symbol.toStringTag&&w[Symbol.toStringTag]||w.constructor.name||"Object";return J.call(L,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Q),t(w)}}function o(w){if(w===v)return"<>";if(typeof w=="object"&&w!==null&&w.$$typeof===y)return"<...>";try{var L=e(w);return L?"<"+L+">":"<...>"}catch{return"<...>"}}function r(){var w=F.A;return w===null?null:w.getOwner()}function s(){return Error("react-stack-top-frame")}function i(w){if(D.call(w,"key")){var L=Object.getOwnPropertyDescriptor(w,"key").get;if(L&&L.isReactWarning)return!1}return w.key!==void 0}function l(w,L){function J(){X||(X=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",L))}J.isReactWarning=!0,Object.defineProperty(w,"key",{get:J,configurable:!0})}function a(){var w=e(this.type);return K[w]||(K[w]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),w=this.props.ref,w!==void 0?w:null}function c(w,L,J,Q,Be,Me){var ee=J.ref;return w={$$typeof:R,type:w,key:L,props:J,_owner:Q},(ee!==void 0?ee:null)!==null?Object.defineProperty(w,"ref",{enumerable:!1,get:a}):Object.defineProperty(w,"ref",{enumerable:!1,value:null}),w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(w,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(w,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Be}),Object.defineProperty(w,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Me}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function u(w,L,J,Q,Be,Me){var ee=L.children;if(ee!==void 0)if(Q)if(A(ee)){for(Q=0;Q<ee.length;Q++)g(ee[Q]);Object.freeze&&Object.freeze(ee)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(ee);if(D.call(L,"key")){ee=e(w);var j=Object.keys(L).filter(function(oe){return oe!=="key"});Q=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",Ce[ee+Q]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
3
3
|
let props = %s;
|
|
4
4
|
<%s {...props} />
|
|
5
5
|
React keys must be passed directly to JSX without using spread:
|
|
6
6
|
let props = %s;
|
|
7
|
-
<%s key={someKey} {...props} />`,Q,ee,E,ee),Te[ee+Q]=!0)}if(ee=null,q!==void 0&&(o(q),ee=""+q),i(M)&&(o(M.key),ee=""+M.key),"key"in M){q={};for(var G in M)G!=="key"&&(q[G]=M[G])}else q=M;return ee&&l(q,typeof h=="function"?h.displayName||h.name||"Unknown":h),c(h,ee,q,r(),Pe,Be)}function T(h){p(h)?h._store&&(h._store.validated=1):typeof h=="object"&&h!==null&&h.$$typeof===y&&(h._payload.status==="fulfilled"?p(h._payload.value)&&h._payload.value._store&&(h._payload.value._store.validated=1):h._store&&(h._store.validated=1))}function p(h){return typeof h=="object"&&h!==null&&h.$$typeof===C}var x=I,C=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),H=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),F=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,_=Array.isArray,V=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(h){return h()}};var X,K={},ve=x.react_stack_bottom_frame.bind(x,s)(),we=V(n(s)),Te={};et.Fragment=g,et.jsx=function(h,M,q){var Q=1e4>F.recentlyCreatedOwnerStacks++;return m(h,M,q,!1,Q?Error("react-stack-top-frame"):ve,Q?V(n(h)):we)},et.jsxs=function(h,M,q){var Q=1e4>F.recentlyCreatedOwnerStacks++;return m(h,M,q,!0,Q?Error("react-stack-top-frame"):ve,Q?V(n(h)):we)}})()),et}var io;function wn(){return io||(io=1,process.env.NODE_ENV==="production"?pt.exports=xn():pt.exports=vn()),pt.exports}var R=wn();function zo(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(o=zo(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function xe(){for(var e,t,o=0,n="",r=arguments.length;o<r;o++)(e=arguments[o])&&(t=zo(e))&&(n&&(n+=" "),n+=t);return n}const Tn=I.forwardRef(({variant:e="default",label:t,className:o,classNames:n={},...r},s)=>{const i=xe("inline-flex flex-col items-center justify-center",o),l=I.useMemo(()=>{switch(e){case"wave":case"dots":return R.jsx("div",{className:xe("flex gap-1",n.wrapper),children:[...Array(3)].map((a,c)=>R.jsx("i",{className:xe("block w-2 h-2 bg-current rounded-full animate-bounce",n.dots),style:{animationDelay:`${c*.2}s`}},c))});case"simple":return R.jsxs("svg",{className:xe("animate-spin text-current",n.wrapper),width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",children:[R.jsx("circle",{className:xe("opacity-25",n.circle1),cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),R.jsx("path",{className:xe("opacity-75",n.circle2),fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.37 0 0 5.37 0 12h4z"})]});case"spinner":return R.jsx("div",{className:xe("relative w-6 h-6",n.wrapper),children:[...Array(12)].map((a,c)=>R.jsx("i",{className:xe("absolute left-1/2 top-1/2 w-0.5 h-1.5 bg-current origin-center opacity-20 animate-pulse",n.spinnerBars),style:{transform:`rotate(${c*30}deg) translateY(-8px)`,animationDelay:`${c*.1}s`}},c))});default:return R.jsxs("div",{className:xe("relative w-8 h-8",n.wrapper),children:[R.jsx("i",{className:xe("absolute inset-0 rounded-full border-4 border-current border-opacity-25",n.circle1)}),R.jsx("i",{className:xe("absolute inset-0 rounded-full border-4 border-t-transparent animate-spin",n.circle2)})]})}},[e,n]);return R.jsxs("div",{ref:s,className:i,"aria-label":t||"Loading",...r,children:[l,t&&R.jsx("span",{className:xe("mt-2 text-sm text-gray-600",n.label),children:t})]})}),jo=I.createContext(void 0),In=({children:e,value:t,config:o})=>R.jsx(jo.Provider,{value:{...t,config:o},children:e}),St=()=>{const e=I.useContext(jo);if(!e)throw new Error("useChatContext must be used within a ChatProvider");return e};function tt(...e){return e.filter(Boolean).join(" ")}const Sn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2012H20M12%204V20'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Oo="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6%206L18%2018M18%206L6%2018'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",bn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%206V18M12%206L7%2011M12%206L17%2011'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Cn=()=>{const{classNames:e,handleSend:t}=St(),[o,n]=I.useState(""),r=s=>{s.preventDefault(),t(o),n("")};return R.jsxs("form",{role:"inputWrapper",className:tt("autoui-chat-input",e?.inputWrapper),onSubmit:r,"aria-label":"Chat input area",children:[R.jsx("input",{role:"input",className:tt("autoui-chat-textbox",e?.input),type:"text",value:o,onChange:s=>n(s.target.value),placeholder:"Type a message...","aria-label":"Message input"}),R.jsx("button",{role:"inputButton",type:"submit",className:tt("autoui-chat-send",e?.inputButton),"aria-label":"Send message",children:R.jsx("img",{src:bn,alt:"arrow up"})})]})},yn=({message:e})=>{const t=e.role==="user",{classNames:o}=St();return R.jsx("div",{role:"message",className:xe("autoui-chat-message",t?"user":"assistant",o?.message),"aria-label":t?"User message":"Assistant message",children:R.jsx("div",{className:"autoui-chat-bubble",children:e.content})})},bt=0,Fe=1,Ze=2,Ho=4;function lo(e){return()=>e}function Rn(e){e()}function Po(e,t){return o=>e(t(o))}function ao(e,t){return()=>e(t)}function En(e,t){return o=>e(t,o)}function Ft(e){return e!==void 0}function kn(...e){return()=>{e.map(Rn)}}function Ke(){}function Ct(e,t){return t(e),e}function zn(e,t){return t(e)}function ie(...e){return e}function Z(e,t){return e(Fe,t)}function $(e,t){e(bt,t)}function Dt(e){e(Ze)}function ae(e){return e(Ho)}function B(e,t){return Z(e,En(t,bt))}function Oe(e,t){const o=e(Fe,n=>{o(),t(n)});return o}function co(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout(()=>{n(t)},e)}}function Bo(e,t){return e===t}function se(e=Bo){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function W(e){return t=>o=>{e(o)&&t(o)}}function O(e){return t=>Po(t,e)}function Ae(e){return t=>()=>{t(e)}}function w(e,...t){const o=jn(...t);return(n,r)=>{switch(n){case Ze:Dt(e);return;case Fe:return Z(e,o(r))}}}function _e(e,t){return o=>n=>{o(t=e(t,n))}}function Ue(e){return t=>o=>{e>0?e--:t(o)}}function Ne(e){let t=null,o;return n=>r=>{t=r,!o&&(o=setTimeout(()=>{o=void 0,n(t)},e))}}function U(...e){const t=new Array(e.length);let o=0,n=null;const r=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Z(s,a=>{const c=o;o=o|l,t[i]=a,c!==r&&o===r&&n&&(n(),n=null)})}),s=>i=>{const l=()=>{s([i].concat(t))};o===r?l():n=l}}function jn(...e){return t=>e.reduceRight(zn,t)}function On(e){let t,o;const n=()=>t?.();return function(r,s){switch(r){case Fe:return s?o===s?void 0:(n(),o=s,t=Z(e,s),t):(n(),Ke);case Ze:n(),o=null;return}}}function b(e){let t=e;const o=Y();return(n,r)=>{switch(n){case bt:t=r;break;case Fe:{r(t);break}case Ho:return t}return o(n,r)}}function Se(e,t){return Ct(b(t),o=>B(e,o))}function Y(){const e=[];return(t,o)=>{switch(t){case bt:e.slice().forEach(n=>{n(o)});return;case Ze:e.splice(0,e.length);return;case Fe:return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}}}function Re(e){return Ct(Y(),t=>B(e,t))}function J(e,t=[],{singleton:o}={singleton:!0}){return{constructor:e,dependencies:t,id:Hn(),singleton:o}}const Hn=()=>Symbol();function Pn(e){const t=new Map,o=({constructor:n,dependencies:r,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const l=n(r.map(a=>o(a)));return i&&t.set(s,l),l};return o(e)}function de(...e){const t=Y(),o=new Array(e.length);let n=0;const r=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Z(s,a=>{o[i]=a,n=n|l,n===r&&$(t,o)})}),function(s,i){switch(s){case Ze:{Dt(t);return}case Fe:return n===r&&i(o),Z(t,i)}}}function N(e,t=Bo){return w(e,se(t))}function Pt(...e){return function(t,o){switch(t){case Ze:return;case Fe:return kn(...e.map(n=>Z(n,o)))}}}var Ce=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ce||{});const Bn={0:"debug",3:"error",1:"log",2:"warn"},An=()=>typeof globalThis>"u"?window:globalThis,De=J(()=>{const e=b(3);return{log:b((t,o,n=1)=>{var r;const s=(r=An().VIRTUOSO_LOG_LEVEL)!=null?r:ae(e);n>=s&&console[Bn[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)}),logLevel:e}},[],{singleton:!0});function Ge(e,t,o){return Lt(e,t,o).callbackRef}function Lt(e,t,o){const n=I.useRef(null);let r=i=>{};const s=I.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const l=()=>{const a=i[0].target;a.offsetParent!==null&&e(a)};o?l():requestAnimationFrame(l)}):null,[e,o]);return r=i=>{i&&t?(s?.observe(i),n.current=i):(n.current&&s?.unobserve(n.current),n.current=null)},{callbackRef:r,ref:n}}function _n(e,t,o,n,r,s,i,l,a){const c=I.useCallback(m=>{const T=Mn(m.children,t,l?"offsetWidth":"offsetHeight",r);let p=m.parentElement;for(;!p.dataset.virtuosoScroller;)p=p.parentElement;const x=p.lastElementChild.dataset.viewportType==="window";let C;x&&(C=p.ownerDocument.defaultView);const k=i?l?i.scrollLeft:i.scrollTop:x?l?C.scrollX||C.document.documentElement.scrollLeft:C.scrollY||C.document.documentElement.scrollTop:l?p.scrollLeft:p.scrollTop,g=i?l?i.scrollWidth:i.scrollHeight:x?l?C.document.documentElement.scrollWidth:C.document.documentElement.scrollHeight:l?p.scrollWidth:p.scrollHeight,d=i?l?i.offsetWidth:i.offsetHeight:x?l?C.innerWidth:C.innerHeight:l?p.offsetWidth:p.offsetHeight;n({scrollHeight:g,scrollTop:Math.max(k,0),viewportHeight:d}),s?.(l?uo("column-gap",getComputedStyle(m).columnGap,r):uo("row-gap",getComputedStyle(m).rowGap,r)),T!==null&&e(T)},[e,t,r,s,i,n,l]);return Lt(c,o,a)}function Mn(e,t,o,n){const r=e.length;if(r===0)return null;const s=[];for(let i=0;i<r;i++){const l=e.item(i);if(l.dataset.index===void 0)continue;const a=parseInt(l.dataset.index),c=parseFloat(l.dataset.knownSize),m=t(l,o);if(m===0&&n("Zero-sized element, this should not happen",{child:l},Ce.ERROR),m===c)continue;const T=s[s.length-1];s.length===0||T.size!==m||T.endIndex!==a-1?s.push({endIndex:a,size:m,startIndex:a}):s[s.length-1].endIndex++}return s}function uo(e,t,o){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&o(`${e} was not resolved to pixel value correctly`,t,Ce.WARN),t==="normal"?0:parseInt(t??"0",10)}function Ao(e,t,o){const n=I.useRef(null),r=I.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const c=a.getBoundingClientRect(),m=c.width;let T,p;if(t){const x=t.getBoundingClientRect(),C=c.top-x.top;p=x.height-Math.max(0,C),T=C+t.scrollTop}else{const x=i.current.ownerDocument.defaultView;p=x.innerHeight-Math.max(0,c.top),T=c.top+x.scrollY}n.current={offsetTop:T,visibleHeight:p,visibleWidth:m},e(n.current)},[e,t]),{callbackRef:s,ref:i}=Lt(r,!0,o),l=I.useCallback(()=>{r(i.current)},[r,i]);return I.useEffect(()=>{var a;if(t){t.addEventListener("scroll",l);const c=new ResizeObserver(()=>{requestAnimationFrame(l)});return c.observe(t),()=>{t.removeEventListener("scroll",l),c.unobserve(t)}}else{const c=(a=i.current)==null?void 0:a.ownerDocument.defaultView;return c?.addEventListener("scroll",l),c?.addEventListener("resize",l),()=>{c?.removeEventListener("scroll",l),c?.removeEventListener("resize",l)}}},[l,t,i]),s}const be=J(()=>{const e=Y(),t=Y(),o=b(0),n=Y(),r=b(0),s=Y(),i=Y(),l=b(0),a=b(0),c=b(0),m=b(0),T=Y(),p=Y(),x=b(!1),C=b(!1),k=b(!1);return B(w(e,O(({scrollTop:g})=>g)),t),B(w(e,O(({scrollHeight:g})=>g)),i),B(t,r),{deviation:o,fixedFooterHeight:c,fixedHeaderHeight:a,footerHeight:m,headerHeight:l,horizontalDirection:C,scrollBy:p,scrollContainerState:e,scrollHeight:i,scrollingInProgress:x,scrollTo:T,scrollTop:t,skipAnimationFrameInResizeObserver:k,smoothScrollTargetReached:n,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),rt={lvl:0};function _o(e,t){const o=e.length;if(o===0)return[];let{index:n,value:r}=t(e[0]);const s=[];for(let i=1;i<o;i++){const{index:l,value:a}=t(e[i]);s.push({end:l-1,start:n,value:r}),n=l,r=a}return s.push({end:1/0,start:n,value:r}),s}function oe(e){return e===rt}function st(e,t){if(!oe(e))return t===e.k?e.v:t<e.k?st(e.l,t):st(e.r,t)}function He(e,t,o="k"){if(oe(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=He(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return He(e.l,t,o)}function ye(e,t,o){return oe(e)?Wo(t,o,1):t===e.k?me(e,{k:t,v:o}):t<e.k?fo(me(e,{l:ye(e.l,t,o)})):fo(me(e,{r:ye(e.r,t,o)}))}function Je(){return rt}function Xe(e,t,o){if(oe(e))return[];const n=He(e,t)[0];return Nn(At(e,n,o))}function Bt(e,t){if(oe(e))return rt;const{k:o,l:n,r}=e;if(t===o){if(oe(n))return r;if(oe(r))return n;{const[s,i]=No(n);return vt(me(e,{k:s,l:Mo(n),v:i}))}}else return t<o?vt(me(e,{l:Bt(n,t)})):vt(me(e,{r:Bt(r,t)}))}function $e(e){return oe(e)?[]:[...$e(e.l),{k:e.k,v:e.v},...$e(e.r)]}function At(e,t,o){if(oe(e))return[];const{k:n,l:r,r:s,v:i}=e;let l=[];return n>t&&(l=l.concat(At(r,t,o))),n>=t&&n<=o&&l.push({k:n,v:i}),n<=o&&(l=l.concat(At(s,t,o))),l}function vt(e){const{l:t,lvl:o,r:n}=e;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(kt(t))return Fo(me(e,{lvl:o-1}));if(!oe(t)&&!oe(t.r))return me(t.r,{l:me(t,{r:t.r.l}),lvl:o,r:me(e,{l:t.r.r,lvl:o-1})});throw new Error("Unexpected empty nodes")}else{if(kt(e))return _t(me(e,{lvl:o-1}));if(!oe(n)&&!oe(n.l)){const r=n.l,s=kt(r)?n.lvl-1:n.lvl;return me(r,{l:me(e,{lvl:o-1,r:r.l}),lvl:r.lvl+1,r:_t(me(n,{l:r.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function me(e,t){return Wo(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Mo(e){return oe(e.r)?e.l:vt(me(e,{r:Mo(e.r)}))}function kt(e){return oe(e)||e.lvl>e.r.lvl}function No(e){return oe(e.r)?[e.k,e.v]:No(e.r)}function Wo(e,t,o,n=rt,r=rt){return{k:e,l:n,lvl:o,r,v:t}}function fo(e){return _t(Fo(e))}function Fo(e){const{l:t}=e;return!oe(t)&&t.lvl===e.lvl?me(t,{r:me(e,{l:t.r})}):e}function _t(e){const{lvl:t,r:o}=e;return!oe(o)&&!oe(o.r)&&o.lvl===t&&o.r.lvl===t?me(o,{l:me(e,{r:o.l}),lvl:t+1}):e}function Nn(e){return _o(e,({k:t,v:o})=>({index:t,value:o}))}function Do(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function it(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Vt=J(()=>({recalcInProgress:b(!1)}),[],{singleton:!0});function Lo(e,t,o){return e[Tt(e,t,o)]}function Tt(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const s=Math.floor((n+r)/2),i=e[s],l=o(i,t);if(l===0)return s;if(l===-1){if(r-n<2)return s-1;r=s-1}else{if(r===n)return s;n=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Wn(e,t,o,n){const r=Tt(e,t,n),s=Tt(e,o,n,r);return e.slice(r,s+1)}function We(e,t){return Math.round(e.getBoundingClientRect()[t])}function yt(e){return!oe(e.groupOffsetTree)}function $t({index:e},t){return t===e?0:t<e?-1:1}function Fn(){return{groupIndices:[],groupOffsetTree:Je(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Je()}}function Dn(e,t){let o=oe(e)?0:1/0;for(const n of t){const{endIndex:r,size:s,startIndex:i}=n;if(o=Math.min(o,i),oe(e)){e=ye(e,0,s);continue}const l=Xe(e,i-1,r+1);if(l.some(qn(n)))continue;let a=!1,c=!1;for(const{end:m,start:T,value:p}of l)a?(r>=T||s===p)&&(e=Bt(e,T)):(c=p!==s,a=!0),m>r&&r>=T&&p!==s&&(e=ye(e,r+1,p));c&&(e=ye(e,i,s))}return[e,o]}function Ln(e){return typeof e.groupIndex<"u"}function Vn({offset:e},t){return t===e?0:t<e?-1:1}function lt(e,t,o){if(t.length===0)return 0;const{index:n,offset:r,size:s}=Lo(t,e,$t),i=e-n,l=s*i+(i-1)*o+r;return l>0?l+o:l}function Vo(e,t){if(!yt(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function $o(e,t,o){if(Ln(e))return t.groupIndices[e.groupIndex]+1;{const n=e.index==="LAST"?o:e.index;let r=Vo(n,t);return r=Math.max(0,r,Math.min(o,r)),r}}function $n(e,t,o,n=0){return n>0&&(t=Math.max(t,Lo(e,n,$t).offset)),_o(Wn(e,t,o,Vn),Yn)}function Un(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,Ce.DEBUG);const s=e.sizeTree;let i=s,l=0;if(o.length>0&&oe(s)&&t.length===2){const p=t[0].size,x=t[1].size;i=o.reduce((C,k)=>ye(ye(C,k,p),k+1,x),i)}else[i,l]=Dn(i,t);if(i===s)return e;const{lastIndex:a,lastOffset:c,lastSize:m,offsetTree:T}=Mt(e.offsetTree,l,i,r);return{groupIndices:o,groupOffsetTree:o.reduce((p,x)=>ye(p,x,lt(x,T,r)),Je()),lastIndex:a,lastOffset:c,lastSize:m,offsetTree:T,sizeTree:i}}function Gn(e){return $e(e).map(({k:t,v:o},n,r)=>{const s=r[n+1];return{endIndex:s?s.k-1:1/0,size:o,startIndex:t}})}function mo(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function Mt(e,t,o,n){let r=e,s=0,i=0,l=0,a=0;if(t!==0){a=Tt(r,t-1,$t),l=r[a].offset;const c=He(o,t-1);s=c[0],i=c[1],r.length&&r[a].size===He(o,t)[1]&&(a-=1),r=r.slice(0,a+1)}else r=[];for(const{start:c,value:m}of Xe(o,t,1/0)){const T=c-s,p=T*i+l+T*n;r.push({index:c,offset:p,size:m}),s=c,l=p,i=m}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function Yn(e){return{index:e.index,value:e}}function qn(e){const{endIndex:t,size:o,startIndex:n}=e;return r=>r.start===n&&(r.end===t||r.end===1/0)&&r.value===o}const Jn={offsetHeight:"height",offsetWidth:"width"},Me=J(([{log:e},{recalcInProgress:t}])=>{const o=Y(),n=Y(),r=Se(n,0),s=Y(),i=Y(),l=b(0),a=b([]),c=b(void 0),m=b(void 0),T=b(void 0),p=b(void 0),x=b((u,v)=>We(u,Jn[v])),C=b(void 0),k=b(0),g=Fn(),d=Se(w(o,U(a,e,k),_e(Un,g),se()),g),f=Se(w(a,se(),_e((u,v)=>({current:v,prev:u.current}),{current:[],prev:[]}),O(({prev:u})=>u)),[]);B(w(a,W(u=>u.length>0),U(d,k),O(([u,v,y])=>{const j=u.reduce((A,F,D)=>ye(A,F,lt(F,v.offsetTree,y)||D),Je());return{...v,groupIndices:u,groupOffsetTree:j}})),d),B(w(n,U(d),W(([u,{lastIndex:v}])=>u<v),O(([u,{lastIndex:v,lastSize:y}])=>[{endIndex:v,size:y,startIndex:u}])),o),B(c,m);const S=Se(w(c,O(u=>u===void 0)),!0);B(w(m,W(u=>u!==void 0&&oe(ae(d).sizeTree)),O(u=>{const v=ae(T),y=ae(a).length>0;return v?y?[{endIndex:0,size:v,startIndex:0},{endIndex:1,size:u,startIndex:1}]:[]:[{endIndex:0,size:u,startIndex:0}]})),o),B(w(p,W(u=>u!==void 0&&u.length>0&&oe(ae(d).sizeTree)),O(u=>{const v=[];let y=u[0],j=0;for(let A=1;A<u.length;A++){const F=u[A];F!==y&&(v.push({endIndex:A-1,size:y,startIndex:j}),y=F,j=A)}return v.push({endIndex:u.length-1,size:y,startIndex:j}),v})),o),B(w(a,U(T,m),W(([,u,v])=>u!==void 0&&v!==void 0),O(([u,v,y])=>{const j=[];for(let A=0;A<u.length;A++){const F=u[A],D=u[A+1];j.push({startIndex:F,endIndex:F,size:v}),D!==void 0&&j.push({startIndex:F+1,endIndex:D-1,size:y})}return j})),o);const H=Re(w(o,U(d),_e(({sizes:u},[v,y])=>({changed:y!==u,sizes:y}),{changed:!1,sizes:g}),O(u=>u.changed)));Z(w(l,_e((u,v)=>({diff:u.prev-v,prev:v}),{diff:0,prev:0}),O(u=>u.diff)),u=>{const{groupIndices:v}=ae(d);if(u>0)$(t,!0),$(s,u+mo(u,v));else if(u<0){const y=ae(f);y.length>0&&(u-=mo(-u,y)),$(i,u)}}),Z(w(l,U(e)),([u,v])=>{u<0&&v("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},Ce.ERROR)});const z=Re(s);B(w(s,U(d),O(([u,v])=>{const y=v.groupIndices.length>0,j=[],A=v.lastSize;if(y){const F=st(v.sizeTree,0);let D=0,_=0;for(;D<u;){const X=v.groupIndices[_],K=v.groupIndices.length===_+1?1/0:v.groupIndices[_+1]-X-1;j.push({endIndex:X,size:F,startIndex:X}),j.push({endIndex:X+1+K-1,size:A,startIndex:X+1}),_++,D+=K+1}const V=$e(v.sizeTree);return D!==u&&V.shift(),V.reduce((X,{k:K,v:ve})=>{let we=X.ranges;return X.prevSize!==0&&(we=[...X.ranges,{endIndex:K+u-1,size:X.prevSize,startIndex:X.prevIndex}]),{prevIndex:K+u,prevSize:ve,ranges:we}},{prevIndex:u,prevSize:0,ranges:j}).ranges}return $e(v.sizeTree).reduce((F,{k:D,v:_})=>({prevIndex:D+u,prevSize:_,ranges:[...F.ranges,{endIndex:D+u-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:A,ranges:[]}).ranges})),o);const P=Re(w(i,U(d,k),O(([u,{offsetTree:v},y])=>{const j=-u;return lt(j,v,y)})));return B(w(i,U(d,k),O(([u,v,y])=>{if(v.groupIndices.length>0){if(oe(v.sizeTree))return v;let j=Je();const A=ae(f);let F=0,D=0,_=0;for(;F<-u;){_=A[D];const V=A[D+1]-_-1;D++,F+=V+1}if(j=$e(v.sizeTree).reduce((V,{k:X,v:K})=>ye(V,Math.max(0,X+u),K),j),F!==-u){const V=st(v.sizeTree,_);j=ye(j,0,V);const X=He(v.sizeTree,-u+1)[1];j=ye(j,1,X)}return{...v,sizeTree:j,...Mt(v.offsetTree,0,j,y)}}else{const j=$e(v.sizeTree).reduce((A,{k:F,v:D})=>ye(A,Math.max(0,F+u),D),Je());return{...v,sizeTree:j,...Mt(v.offsetTree,0,j,y)}}})),d),{beforeUnshiftWith:z,data:C,defaultItemSize:m,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:T,gap:k,groupIndices:a,heightEstimates:p,itemSize:x,listRefresh:H,shiftWith:i,shiftWithOffset:P,sizeRanges:o,sizes:d,statefulTotalCount:r,totalCount:n,trackItemSizes:S,unshiftWith:s}},ie(De,Vt),{singleton:!0});function Xn(e){return e.reduce((t,o)=>(t.groupIndices.push(t.totalCount),t.totalCount+=o+1,t),{groupIndices:[],totalCount:0})}const Uo=J(([{groupIndices:e,sizes:t,totalCount:o},{headerHeight:n,scrollTop:r}])=>{const s=Y(),i=Y(),l=Re(w(s,O(Xn)));return B(w(l,O(a=>a.totalCount)),o),B(w(l,O(a=>a.groupIndices)),e),B(w(de(r,t,n),W(([a,c])=>yt(c)),O(([a,c,m])=>He(c.groupOffsetTree,Math.max(a-m,0),"v")[0]),se(),O(a=>[a])),i),{groupCounts:s,topItemsIndexes:i}},ie(Me,be)),Le=J(([{log:e}])=>{const t=b(!1),o=Re(w(t,W(n=>n),se()));return Z(t,n=>{n&&ae(e)("props updated",{},Ce.DEBUG)}),{didMount:o,propsReady:t}},ie(De),{singleton:!0}),Zn=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Go(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Zn)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const dt=J(([{gap:e,listRefresh:t,sizes:o,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:a,scrollTo:c,smoothScrollTargetReached:m,viewportHeight:T},{log:p}])=>{const x=Y(),C=Y(),k=b(0);let g=null,d=null,f=null;function S(){g&&(g(),g=null),f&&(f(),f=null),d&&(clearTimeout(d),d=null),$(a,!1)}return B(w(x,U(o,T,n,k,l,i,p),U(e,s,r),O(([[H,z,P,u,v,y,j,A],F,D,_])=>{const V=Go(H),{align:X,behavior:K,offset:ve}=V,we=u-1,Te=$o(V,z,we);let h=lt(Te,z.offsetTree,F)+y;X==="end"?(h+=D+He(z.sizeTree,Te)[1]-P+_,Te===we&&(h+=j)):X==="center"?h+=(D+He(z.sizeTree,Te)[1]-P+_)/2:h-=v,ve&&(h+=ve);const M=q=>{S(),q?(A("retrying to scroll to",{location:H},Ce.DEBUG),$(x,H)):($(C,!0),A("list did not change, scroll successful",{},Ce.DEBUG))};if(S(),K==="smooth"){let q=!1;f=Z(t,Q=>{q=q||Q}),g=Oe(m,()=>{M(q)})}else g=Oe(w(t,Kn(150)),M);return d=setTimeout(()=>{S()},1200),$(a,!0),A("scrolling from index to",{behavior:K,index:Te,top:h},Ce.DEBUG),{behavior:K,top:h}})),c),{scrollTargetReached:C,scrollToIndex:x,topListHeight:k}},ie(Me,be,De),{singleton:!0});function Kn(e){return t=>{const o=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(o))}}}function Ut(e,t){e==0?t():requestAnimationFrame(()=>{Ut(e-1,t)})}function Gt(e,t){const o=t-1;return typeof e=="number"?e:e.index==="LAST"?o:e.index}const ft=J(([{defaultItemSize:e,listRefresh:t,sizes:o},{scrollTop:n},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=b(!0),a=b(0),c=b(!0);return B(w(i,U(a),W(([m,T])=>!!T),Ae(!1)),l),B(w(i,U(a),W(([m,T])=>!!T),Ae(!1)),c),Z(w(de(t,i),U(l,o,e,c),W(([[,m],T,{sizeTree:p},x,C])=>m&&(!oe(p)||Ft(x))&&!T&&!C),U(a)),([,m])=>{Oe(r,()=>{$(c,!0)}),Ut(4,()=>{Oe(n,()=>{$(l,!0)}),$(s,m)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:a,scrolledToInitialItem:l}},ie(Me,be,dt,Le),{singleton:!0});function Yo(e,t){return Math.abs(e-t)<1.01}const at="up",ot="down",Qn="none",er={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},tr=0,mt=J(([{footerHeight:e,headerHeight:t,scrollBy:o,scrollContainerState:n,scrollTop:r,viewportHeight:s}])=>{const i=b(!1),l=b(!0),a=Y(),c=Y(),m=b(4),T=b(tr),p=Se(w(Pt(w(N(r),Ue(1),Ae(!0)),w(N(r),Ue(1),Ae(!1),co(100))),se()),!1),x=Se(w(Pt(w(o,Ae(!0)),w(o,Ae(!1),co(200))),se()),!1);B(w(de(N(r),N(T)),O(([f,S])=>f<=S),se()),l),B(w(l,Ne(50)),c);const C=Re(w(de(n,N(s),N(t),N(e),N(m)),_e((f,[{scrollHeight:S,scrollTop:H},z,P,u,v])=>{const y=H+z-S>-v,j={scrollHeight:S,scrollTop:H,viewportHeight:z};if(y){let F,D;return H>f.state.scrollTop?(F="SCROLLED_DOWN",D=f.state.scrollTop-H):(F="SIZE_DECREASED",D=f.state.scrollTop-H||f.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:D,state:j}}let A;return j.scrollHeight>f.state.scrollHeight?A="SIZE_INCREASED":z<f.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":H<f.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:j}},er),se((f,S)=>f&&f.atBottom===S.atBottom))),k=Se(w(n,_e((f,{scrollHeight:S,scrollTop:H,viewportHeight:z})=>{if(Yo(f.scrollHeight,S))return{changed:!1,jump:0,scrollHeight:S,scrollTop:H};{const P=S-(H+z)<1;return f.scrollTop!==H&&P?{changed:!0,jump:f.scrollTop-H,scrollHeight:S,scrollTop:H}:{changed:!0,jump:0,scrollHeight:S,scrollTop:H}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),W(f=>f.changed),O(f=>f.jump)),0);B(w(C,O(f=>f.atBottom)),i),B(w(i,Ne(50)),a);const g=b(ot);B(w(n,O(({scrollTop:f})=>f),se(),_e((f,S)=>ae(x)?{direction:f.direction,prevScrollTop:S}:{direction:S<f.prevScrollTop?at:ot,prevScrollTop:S},{direction:ot,prevScrollTop:0}),O(f=>f.direction)),g),B(w(n,Ne(50),Ae(Qn)),g);const d=b(0);return B(w(p,W(f=>!f),Ae(0)),d),B(w(r,Ne(100),U(p),W(([f,S])=>!!S),_e(([f,S],[H])=>[S,H],[0,0]),O(([f,S])=>S-f)),d),{atBottomState:C,atBottomStateChange:a,atBottomThreshold:m,atTopStateChange:c,atTopThreshold:T,isAtBottom:i,isAtTop:l,isScrolling:p,lastJumpDueToItemResize:k,scrollDirection:g,scrollVelocity:d}},ie(be)),ct="top",ut="bottom",ho="none";function po(e,t,o){return typeof e=="number"?o===at&&t===ct||o===ot&&t===ut?e:0:o===at?t===ct?e.main:e.reverse:t===ut?e.main:e.reverse}function go(e,t){var o;return typeof e=="number"?e:(o=e[t])!=null?o:0}const Yt=J(([{deviation:e,fixedHeaderHeight:t,headerHeight:o,scrollTop:n,viewportHeight:r}])=>{const s=Y(),i=b(0),l=b(0),a=b(0),c=Se(w(de(N(n),N(r),N(o),N(s,it),N(a),N(i),N(t),N(e),N(l)),O(([m,T,p,[x,C],k,g,d,f,S])=>{const H=m-f,z=g+d,P=Math.max(p-H,0);let u=ho;const v=go(S,ct),y=go(S,ut);return x-=f,x+=p+d,C+=p+d,C-=f,x>m+z-v&&(u=at),C<m-P+T+y&&(u=ot),u!==ho?[Math.max(H-p-po(k,ct,u)-v,0),H-P-d+T+po(k,ut,u)+y]:null}),W(m=>m!=null),se(it)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:a,topListHeight:i,visibleRange:c}},ie(be),{singleton:!0});function or(e,t,o){if(yt(t)){const n=Vo(e,t);return[{index:He(t.groupOffsetTree,n)[0],offset:0,size:0},{data:o?.[0],index:n,offset:0,size:0}]}return[{data:o?.[0],index:e,offset:0,size:0}]}const zt={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function wt(e,t,o,n,r,s){const{lastIndex:i,lastOffset:l,lastSize:a}=r;let c=0,m=0;if(e.length>0){c=e[0].offset;const k=e[e.length-1];m=k.offset+k.size}const T=o-i,p=l+T*a+(T-1)*n,x=c,C=p-m;return{bottom:m,firstItemIndex:s,items:xo(e,r,s),offsetBottom:C,offsetTop:c,top:x,topItems:xo(t,r,s),topListHeight:t.reduce((k,g)=>g.size+k,0),totalCount:o}}function qo(e,t,o,n,r,s){let i=0;if(o.groupIndices.length>0)for(const m of o.groupIndices){if(m-i>=e)break;i++}const l=e+i,a=Gt(t,l),c=Array.from({length:l}).map((m,T)=>({data:s[T+a],index:T+a,offset:0,size:0}));return wt(c,[],l,r,o,n)}function xo(e,t,o){if(e.length===0)return[];if(!yt(t))return e.map(c=>({...c,index:c.index+o,originalIndex:c.index}));const n=e[0].index,r=e[e.length-1].index,s=[],i=Xe(t.groupOffsetTree,n,r);let l,a=0;for(const c of e){(!l||l.end<c.index)&&(l=i.shift(),a=t.groupIndices.indexOf(l.start));let m;c.index===l.start?m={index:a,type:"group"}:m={groupIndex:a,index:c.index-(a+1)+o},s.push({...m,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function vo(e,t){var o;return e===void 0?0:typeof e=="number"?e:(o=e[t])!=null?o:0}const Ye=J(([{data:e,firstItemIndex:t,gap:o,sizes:n,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:a},{initialTopMostItemIndex:c,scrolledToInitialItem:m},{topListHeight:T},p,{didMount:x},{recalcInProgress:C}])=>{const k=b([]),g=b(0),d=Y(),f=b(0);B(s.topItemsIndexes,k);const S=Se(w(de(x,C,N(a,it),N(r),N(n),N(c),m,N(k),N(t),N(o),N(f),e),W(([u,v,,y,,,,,,,,j])=>{const A=j&&j.length!==y;return u&&!v&&!A}),O(([,,[u,v],y,j,A,F,D,_,V,X,K])=>{var ve,we,Te,h;const M=j,{offsetTree:q,sizeTree:Q}=M,Pe=ae(g);if(y===0)return{...zt,totalCount:y};if(u===0&&v===0)return Pe===0?{...zt,totalCount:y}:qo(Pe,A,j,_,V,K||[]);if(oe(Q))return Pe>0?null:wt(or(Gt(A,y),M,K),[],y,V,M,_);const Be=[];if(D.length>0){const fe=D[0],ce=D[D.length-1];let he=0;for(const ue of Xe(Q,fe,ce)){const te=ue.value,re=Math.max(ue.start,fe),ke=Math.min(ue.end,ce);for(let ge=re;ge<=ke;ge++)Be.push({data:K?.[ge],index:ge,offset:he,size:te}),he+=te}}if(!F)return wt([],Be,y,V,M,_);const ee=D.length>0?D[D.length-1]+1:0,E=$n(q,u,v,ee);if(E.length===0)return null;const G=y-1,ne=Ct([],fe=>{for(const ce of E){const he=ce.value;let ue=he.offset,te=ce.start;const re=he.size;if(he.offset<u){te+=Math.floor((u-he.offset+V)/(re+V));const ge=te-ce.start;ue+=ge*re+ge*V}te<ee&&(ue+=(ee-te)*re,te=ee);const ke=Math.min(ce.end,G);for(let ge=te;ge<=ke&&!(ue>=v);ge++)fe.push({data:K?.[ge],index:ge,offset:ue,size:re}),ue+=re+V}}),pe=vo(X,ct),Ee=vo(X,ut);if(ne.length>0&&(pe>0||Ee>0)){const fe=ne[0],ce=ne[ne.length-1];if(pe>0&&fe.index>ee){const he=Math.min(pe,fe.index-ee),ue=[];let te=fe.offset;for(let re=fe.index-1;re>=fe.index-he;re--){const ke=(we=(ve=Xe(Q,re,re)[0])==null?void 0:ve.value)!=null?we:fe.size;te-=ke+V,ue.unshift({data:K?.[re],index:re,offset:te,size:ke})}ne.unshift(...ue)}if(Ee>0&&ce.index<G){const he=Math.min(Ee,G-ce.index);let ue=ce.offset+ce.size+V;for(let te=ce.index+1;te<=ce.index+he;te++){const re=(h=(Te=Xe(Q,te,te)[0])==null?void 0:Te.value)!=null?h:ce.size;ne.push({data:K?.[te],index:te,offset:ue,size:re}),ue+=re+V}}}return wt(ne,Be,y,V,M,_)}),W(u=>u!==null),se()),zt);B(w(e,W(Ft),O(u=>u?.length)),r),B(w(S,O(u=>u.topListHeight)),T),B(T,l),B(w(S,O(u=>[u.top,u.bottom])),i),B(w(S,O(u=>u.items)),d);const H=Re(w(S,W(({items:u})=>u.length>0),U(r,e),W(([{items:u},v])=>u[u.length-1].originalIndex===v-1),O(([,u,v])=>[u-1,v]),se(it),O(([u])=>u))),z=Re(w(S,Ne(200),W(({items:u,topItems:v})=>u.length>0&&u[0].originalIndex===v.length),O(({items:u})=>u[0].index),se())),P=Re(w(S,W(({items:u})=>u.length>0),O(({items:u})=>{let v=0,y=u.length-1;for(;u[v].type==="group"&&v<y;)v++;for(;u[y].type==="group"&&y>v;)y--;return{endIndex:u[y].index,startIndex:u[v].index}}),se(Do)));return{endReached:H,initialItemCount:g,itemsRendered:d,listState:S,minOverscanItemCount:f,rangeChanged:P,startReached:z,topItemsIndexes:k,...p}},ie(Me,Uo,Yt,ft,dt,mt,Le,Vt),{singleton:!0}),Jo=J(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:o,headerHeight:n},{listState:r}])=>{const s=Y(),i=Se(w(de(o,e,n,t,r),O(([l,a,c,m,T])=>l+a+c+m+T.offsetBottom+T.bottom)),0);return B(N(i),s),{totalListHeight:i,totalListHeightChanged:s}},ie(be,Ye),{singleton:!0}),nr=J(([{viewportHeight:e},{totalListHeight:t}])=>{const o=b(!1),n=Se(w(de(o,e,t),W(([r])=>r),O(([,r,s])=>Math.max(0,r-s)),Ne(0),se()),0);return{alignToBottom:o,paddingTopAddition:n}},ie(be,Jo),{singleton:!0}),Xo=J(()=>({context:b(null)})),rr=({itemBottom:e,itemTop:t,locationParams:{align:o,behavior:n,...r},viewportBottom:s,viewportTop:i})=>t<i?{...r,align:o??"start",behavior:n}:e>s?{...r,align:o??"end",behavior:n}:null,Zo=J(([{gap:e,sizes:t,totalCount:o},{fixedFooterHeight:n,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:a},{scrollToIndex:c}])=>{const m=Y();return B(w(m,U(t,a,o,s,r,n,l),U(e),O(([[T,p,x,C,k,g,d,f],S])=>{const{align:H,behavior:z,calculateViewLocation:P=rr,done:u,...v}=T,y=$o(T,p,C-1),j=lt(y,p.offsetTree,S)+k+g,A=j+He(p.sizeTree,y)[1],F=f+g,D=f+x-d,_=P({itemBottom:A,itemTop:j,locationParams:{align:H,behavior:z,...v},viewportBottom:D,viewportTop:F});return _?u&&Oe(w(i,W(V=>!V),Ue(ae(i)?1:2)),u):u&&u(),_}),W(T=>T!==null)),c),{scrollIntoView:m}},ie(Me,be,dt,Ye,De),{singleton:!0});function wo(e){return e?e==="smooth"?"smooth":"auto":!1}const sr=(e,t)=>typeof e=="function"?wo(e(t)):t&&wo(e),ir=J(([{listRefresh:e,totalCount:t,fixedItemSize:o,data:n},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:a,propsReady:c},{log:m},{scrollingInProgress:T},{context:p},{scrollIntoView:x}])=>{const C=b(!1),k=Y();let g=null;function d(z){$(i,{align:"end",behavior:z,index:"LAST"})}Z(w(de(w(N(t),Ue(1)),a),U(N(C),s,l,T),O(([[z,P],u,v,y,j])=>{let A=P&&y,F="auto";return A&&(F=sr(u,v||j),A=A&&!!F),{followOutputBehavior:F,shouldFollow:A,totalCount:z}}),W(({shouldFollow:z})=>z)),({followOutputBehavior:z,totalCount:P})=>{g&&(g(),g=null),ae(o)?requestAnimationFrame(()=>{ae(m)("following output to ",{totalCount:P},Ce.DEBUG),d(z)}):g=Oe(e,()=>{ae(m)("following output to ",{totalCount:P},Ce.DEBUG),d(z),g=null})});function f(z){const P=Oe(r,u=>{z&&!u.atBottom&&u.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(ae(m)("scrolling to bottom due to increased size",{},Ce.DEBUG),d("auto"))});setTimeout(P,100)}Z(w(de(N(C),t,c),W(([z,,P])=>z&&P),_e(({value:z},[,P])=>({refreshed:z===P,value:P}),{refreshed:!1,value:0}),W(({refreshed:z})=>z),U(C,t)),([,z])=>{ae(l)&&f(z!==!1)}),Z(k,()=>{f(ae(C)!==!1)}),Z(de(N(C),r),([z,P])=>{z&&!P.atBottom&&P.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&d("auto")});const S=b(null),H=Y();return B(Pt(w(N(n),O(z=>{var P;return(P=z?.length)!=null?P:0})),w(N(t))),H),Z(w(de(w(H,Ue(1)),a),U(N(S),l,T,p),O(([[z,P],u,v,y,j])=>P&&v&&u?.({context:j,totalCount:z,scrollingInProgress:y})),W(z=>!!z),Ne(0)),z=>{g&&(g(),g=null),ae(o)?requestAnimationFrame(()=>{ae(m)("scrolling into view",{}),$(x,z)}):g=Oe(e,()=>{ae(m)("scrolling into view",{}),$(x,z),g=null})}),{autoscrollToBottom:k,followOutput:C,scrollIntoViewOnChange:S}},ie(Me,mt,dt,ft,Le,De,be,Xo,Zo)),lr=J(([{data:e,firstItemIndex:t,gap:o,sizes:n},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(B(w(l,U(s),W(([,a])=>a!==0),U(r,n,t,o,e),O(([[,a],c,m,T,p,x=[]])=>qo(a,c,m,T,p,x))),i),{}),ie(Me,ft,Ye,Le),{singleton:!0}),ar=J(([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=b(0);return Z(w(e,U(n),W(([,r])=>r!==0),O(([,r])=>({top:r}))),r=>{Oe(w(o,Ue(1),W(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{$(t,r)})})}),{initialScrollTop:n}},ie(Le,be,Ye),{singleton:!0}),Ko=J(([{scrollVelocity:e}])=>{const t=b(!1),o=Y(),n=b(!1);return B(w(e,U(n,t,o),W(([r,s])=>!!s),O(([r,s,i,l])=>{const{enter:a,exit:c}=s;if(i){if(c(r,l))return!1}else if(a(r,l))return!0;return i}),se()),t),Z(w(de(t,e,o),U(n)),([[r,s,i],l])=>{r&&l&&l.change&&l.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:o,scrollVelocity:e}},ie(mt),{singleton:!0}),qt=J(([{scrollContainerState:e,scrollTo:t}])=>{const o=Y(),n=Y(),r=Y(),s=b(!1),i=b(void 0);return B(w(de(o,n),O(([{scrollHeight:l,scrollTop:a,viewportHeight:c},{offsetTop:m}])=>({scrollHeight:l,scrollTop:Math.max(0,a-m),viewportHeight:c}))),e),B(w(t,U(n),O(([l,{offsetTop:a}])=>({...l,top:l.top+a}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:o,windowScrollTo:r,windowViewportRect:n}},ie(be)),cr=J(([{sizeRanges:e,sizes:t},{headerHeight:o,scrollTop:n},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:a}])=>{const c=Y(),m=b(void 0),T=b(null),p=b(null);return B(l,T),B(a,p),Z(w(c,U(t,n,i,T,p,o)),([x,C,k,g,d,f,S])=>{const H=Gn(C.sizeTree);g&&d!==null&&f!==null&&(k=d.scrollTop-f.offsetTop),k-=S,x({ranges:H,scrollTop:k})}),B(w(m,W(Ft),O(ur)),r),B(w(s,U(m),W(([,x])=>x!==void 0),se(),O(([,x])=>x.ranges)),e),{getState:c,restoreStateFrom:m}},ie(Me,be,ft,Le,qt));function ur(e){return{align:"start",index:0,offset:e.scrollTop}}const dr=J(([{topItemsIndexes:e}])=>{const t=b(0);return B(w(t,W(o=>o>=0),O(o=>Array.from({length:o}).map((n,r)=>r))),e),{topItemCount:t}},ie(Ye));function Qo(e){let t=!1,o;return()=>(t||(t=!0,o=e()),o)}const fr=Qo(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),mr=J(([{deviation:e,scrollBy:t,scrollingInProgress:o,scrollTop:n},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:l},{listState:a},{beforeUnshiftWith:c,gap:m,shiftWithOffset:T,sizes:p},{log:x},{recalcInProgress:C}])=>{const k=Re(w(a,U(i),_e(([,d,f,S],[{bottom:H,items:z,offsetBottom:P,totalCount:u},v])=>{const y=H+P;let j=0;return f===u&&d.length>0&&z.length>0&&(z[0].originalIndex===0&&d[0].originalIndex===0||(j=y-S,j!==0&&(j+=v))),[j,z,u,y]},[0,[],0,0]),W(([d])=>d!==0),U(n,l,o,r,x,C),W(([,d,f,S,,,H])=>!H&&!S&&d!==0&&f===at),O(([[d],,,,,f])=>(f("Upward scrolling compensation",{amount:d},Ce.DEBUG),d))));function g(d){d>0?($(t,{behavior:"auto",top:-d}),$(e,0)):($(e,0),$(t,{behavior:"auto",top:-d}))}return Z(w(k,U(e,s)),([d,f,S])=>{S&&fr()?$(e,f-d):g(-d)}),Z(w(de(Se(s,!1),e,C),W(([d,f,S])=>!d&&!S&&f!==0),O(([d,f])=>f),Ne(1)),g),B(w(T,O(d=>({top:-d}))),t),Z(w(c,U(p,m),O(([d,{groupIndices:f,lastSize:S,sizeTree:H},z])=>{function P(u){return u*(S+z)}if(f.length===0)return P(d);{let u=0;const v=st(H,0);let y=0,j=0;for(;y<d;){y++,u+=v;let A=f.length===j+1?1/0:f[j+1]-f[j]-1;y+A>d&&(u-=v,A=d-y+1),y+=A,u+=P(A),j++}return u}})),d=>{$(e,d),requestAnimationFrame(()=>{$(t,{top:d}),requestAnimationFrame(()=>{$(e,0),$(C,!1)})})}),{deviation:e}},ie(be,mt,Ye,Me,De,Vt)),hr=J(([e,t,o,n,r,s,i,l,a,c,m])=>({...e,...t,...o,...n,...r,...s,...i,...l,...a,...c,...m}),ie(Yt,lr,Le,Ko,Jo,ar,nr,qt,Zo,De,Xo)),en=J(([{data:e,defaultItemSize:t,firstItemIndex:o,fixedItemSize:n,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:l,itemSize:a,sizeRanges:c,sizes:m,statefulTotalCount:T,totalCount:p,trackItemSizes:x},{initialItemFinalLocationReached:C,initialTopMostItemIndex:k,scrolledToInitialItem:g},d,f,S,H,{scrollToIndex:z},P,{topItemCount:u},{groupCounts:v},y])=>{const{listState:j,minOverscanItemCount:A,topItemsIndexes:F,rangeChanged:D,..._}=H;return B(D,y.scrollSeekRangeChanged),B(w(y.windowViewportRect,O(V=>V.visibleHeight)),d.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:o,fixedItemHeight:n,fixedGroupHeight:r,gap:s,groupCounts:v,heightEstimates:l,initialItemFinalLocationReached:C,initialTopMostItemIndex:k,scrolledToInitialItem:g,sizeRanges:c,topItemCount:u,topItemsIndexes:F,totalCount:p,...S,groupIndices:i,itemSize:a,listState:j,minOverscanItemCount:A,scrollToIndex:z,statefulTotalCount:T,trackItemSizes:x,rangeChanged:D,..._,...y,...d,sizes:m,...f}},ie(Me,ft,be,cr,ir,Ye,dt,mr,dr,Uo,hr));function pr(e,t){const o={},n={};let r=0;const s=e.length;for(;r<s;)n[e[r]]=1,r+=1;for(const i in t)Object.hasOwn(n,i)||(o[i]=t[i]);return o}const gt=typeof document<"u"?I.useLayoutEffect:I.useEffect;function tn(e,t,o){const n=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),l=I.createContext({});function a(g,d){g.propsReady&&$(g.propsReady,!1);for(const f of n){const S=g[t.required[f]];$(S,d[f])}for(const f of r)if(f in d){const S=g[t.optional[f]];$(S,d[f])}g.propsReady&&$(g.propsReady,!0)}function c(g){return s.reduce((d,f)=>(d[f]=S=>{const H=g[t.methods[f]];$(H,S)},d),{})}function m(g){return i.reduce((d,f)=>(d[f]=On(g[t.events[f]]),d),{})}const T=I.forwardRef((g,d)=>{const{children:f,...S}=g,[H]=I.useState(()=>Ct(Pn(e),u=>{a(u,S)})),[z]=I.useState(ao(m,H));gt(()=>{for(const u of i)u in S&&Z(z[u],S[u]);return()=>{Object.values(z).map(Dt)}},[S,z,H]),gt(()=>{a(H,S)}),I.useImperativeHandle(d,lo(c(H)));const P=o;return R.jsx(l.Provider,{value:H,children:o?R.jsx(P,{...pr([...n,...r,...i],S),children:f}):f})}),p=g=>{const d=I.useContext(l);return I.useCallback(f=>{$(d[g],f)},[d,g])},x=g=>{const d=I.useContext(l)[g],f=I.useCallback(S=>Z(d,S),[d]);return I.useSyncExternalStore(f,()=>ae(d),()=>ae(d))},C=g=>{const d=I.useContext(l)[g],[f,S]=I.useState(ao(ae,d));return gt(()=>Z(d,H=>{H!==f&&S(lo(H))}),[d,f]),f},k=I.version.startsWith("18")?x:C;return{Component:T,useEmitter:(g,d)=>{const f=I.useContext(l)[g];gt(()=>Z(f,d),[d,f])},useEmitterValue:k,usePublisher:p}}const on=I.createContext(void 0),nn=I.createContext(void 0),rn=typeof document<"u"?I.useLayoutEffect:I.useEffect;function jt(e){return"self"in e}function gr(e){return"body"in e}function sn(e,t,o,n=Ke,r,s){const i=I.useRef(null),l=I.useRef(null),a=I.useRef(null),c=I.useCallback(p=>{let x,C,k;const g=p.target;if(gr(g)||jt(g)){const f=jt(g)?g:g.defaultView;k=s?f.scrollX:f.scrollY,x=s?f.document.documentElement.scrollWidth:f.document.documentElement.scrollHeight,C=s?f.innerWidth:f.innerHeight}else k=s?g.scrollLeft:g.scrollTop,x=s?g.scrollWidth:g.scrollHeight,C=s?g.offsetWidth:g.offsetHeight;const d=()=>{e({scrollHeight:x,scrollTop:Math.max(k,0),viewportHeight:C})};p.suppressFlushSync?d():ko.flushSync(d),l.current!==null&&(k===l.current||k<=0||k===x-C)&&(l.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t,s]);I.useEffect(()=>{const p=r||i.current;return n(r||i.current),c({suppressFlushSync:!0,target:p}),p.addEventListener("scroll",c,{passive:!0}),()=>{n(null),p.removeEventListener("scroll",c)}},[i,c,o,n,r]);function m(p){const x=i.current;if(!x||(s?"offsetWidth"in x&&x.offsetWidth===0:"offsetHeight"in x&&x.offsetHeight===0))return;const C=p.behavior==="smooth";let k,g,d;jt(x)?(g=Math.max(We(x.document.documentElement,s?"width":"height"),s?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight),k=s?x.innerWidth:x.innerHeight,d=s?window.scrollX:window.scrollY):(g=x[s?"scrollWidth":"scrollHeight"],k=We(x,s?"width":"height"),d=x[s?"scrollLeft":"scrollTop"]);const f=g-k;if(p.top=Math.ceil(Math.max(Math.min(f,p.top),0)),Yo(k,g)||p.top===d){e({scrollHeight:g,scrollTop:d,viewportHeight:k}),C&&t(!0);return}C?(l.current=p.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,l.current=null,t(!0)},1e3)):l.current=null,s&&(p={behavior:p.behavior,left:p.top}),x.scrollTo(p)}function T(p){s&&(p={behavior:p.behavior,left:p.top}),i.current.scrollBy(p)}return{scrollByCallback:T,scrollerRef:i,scrollToCallback:m}}const Ot="-webkit-sticky",To="sticky",Jt=Qo(()=>{if(typeof document>"u")return To;const e=document.createElement("div");return e.style.position=Ot,e.style.position===Ot?Ot:To});function Xt(e){return e}const xr=J(()=>{const e=b(l=>`Item ${l}`),t=b(l=>`Group ${l}`),o=b({}),n=b(Xt),r=b("div"),s=b(Ke),i=(l,a=null)=>Se(w(o,O(c=>c[l]),se()),a);return{components:o,computeItemKey:n,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),vr=J(([e,t])=>({...e,...t}),ie(en,xr)),wr=({height:e})=>R.jsx("div",{style:{height:e}}),Tr={overflowAnchor:"none",position:Jt(),zIndex:1},ln={overflowAnchor:"none"},Ir={...ln,display:"inline-block",height:"100%"},Io=I.memo(function({showTopList:e=!1}){const t=L("listState"),o=ze("sizeRanges"),n=L("useWindowScroll"),r=L("customScrollParent"),s=ze("windowScrollContainerState"),i=ze("scrollContainerState"),l=r||n?s:i,a=L("itemContent"),c=L("context"),m=L("groupContent"),T=L("trackItemSizes"),p=L("itemSize"),x=L("log"),C=ze("gap"),k=L("horizontalDirection"),{callbackRef:g}=_n(o,p,T,e?Ke:l,x,C,r,k,L("skipAnimationFrameInResizeObserver")),[d,f]=I.useState(0);Zt("deviation",_=>{d!==_&&f(_)});const S=L("EmptyPlaceholder"),H=L("ScrollSeekPlaceholder")||wr,z=L("ListComponent"),P=L("ItemComponent"),u=L("GroupComponent"),v=L("computeItemKey"),y=L("isSeeking"),j=L("groupIndices").length>0,A=L("alignToBottom"),F=L("initialItemFinalLocationReached"),D=e?{}:{boxSizing:"border-box",...k?{display:"inline-block",height:"100%",marginLeft:d!==0?d:A?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:d!==0?d:A?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...F?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&S?R.jsx(S,{...Ie(S,c)}):R.jsx(z,{...Ie(z,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:D,children:(e?t.topItems:t.items).map(_=>{const V=_.originalIndex,X=v(V+t.firstItemIndex,_.data,c);return y?I.createElement(H,{...Ie(H,c),height:_.size,index:_.index,key:X,type:_.type||"item",..._.type==="group"?{}:{groupIndex:_.groupIndex}}):_.type==="group"?I.createElement(u,{...Ie(u,c),"data-index":V,"data-item-index":_.index,"data-known-size":_.size,key:X,style:Tr},m(_.index,c)):I.createElement(P,{...Ie(P,c),...yr(P,_.data),"data-index":V,"data-item-group-index":_.groupIndex,"data-item-index":_.index,"data-known-size":_.size,key:X,style:k?Ir:ln},j?a(_.index,_.groupIndex,_.data,c):a(_.index,_.data,c))})})}),Sr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},br={outline:"none",overflowX:"auto",position:"relative"},Rt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Cr={position:Jt(),top:0,width:"100%",zIndex:1};function Ie(e,t){if(typeof e!="string")return{context:t}}function yr(e,t){return{item:typeof e=="string"?void 0:t}}const Rr=I.memo(function(){const e=L("HeaderComponent"),t=ze("headerHeight"),o=L("HeaderFooterTag"),n=Ge(I.useMemo(()=>s=>{t(We(s,"height"))},[t]),!0,L("skipAnimationFrameInResizeObserver")),r=L("context");return e?R.jsx(o,{ref:n,children:R.jsx(e,{...Ie(e,r)})}):null}),Er=I.memo(function(){const e=L("FooterComponent"),t=ze("footerHeight"),o=L("HeaderFooterTag"),n=Ge(I.useMemo(()=>s=>{t(We(s,"height"))},[t]),!0,L("skipAnimationFrameInResizeObserver")),r=L("context");return e?R.jsx(o,{ref:n,children:R.jsx(e,{...Ie(e,r)})}):null});function an({useEmitter:e,useEmitterValue:t,usePublisher:o}){return I.memo(function({children:n,style:r,context:s,...i}){const l=o("scrollContainerState"),a=t("ScrollerComponent"),c=o("smoothScrollTargetReached"),m=t("scrollerRef"),T=t("horizontalDirection")||!1,{scrollByCallback:p,scrollerRef:x,scrollToCallback:C}=sn(l,c,a,m,void 0,T);return e("scrollTo",C),e("scrollBy",p),R.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...T?br:Sr,...r},tabIndex:0,...i,...Ie(a,s),children:n})})}function cn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return I.memo(function({children:n,style:r,context:s,...i}){const l=o("windowScrollContainerState"),a=t("ScrollerComponent"),c=o("smoothScrollTargetReached"),m=t("totalListHeight"),T=t("deviation"),p=t("customScrollParent"),x=I.useRef(null),C=t("scrollerRef"),{scrollByCallback:k,scrollerRef:g,scrollToCallback:d}=sn(l,c,a,C,p);return rn(()=>{var f;return g.current=p||((f=x.current)==null?void 0:f.ownerDocument.defaultView),()=>{g.current=null}},[g,p]),e("windowScrollTo",d),e("scrollBy",k),R.jsx(a,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...m!==0?{height:m+T}:{}},...i,...Ie(a,s),children:n})})}const kr=({children:e})=>{const t=I.useContext(on),o=ze("viewportHeight"),n=ze("fixedItemHeight"),r=L("alignToBottom"),s=L("horizontalDirection"),i=I.useMemo(()=>Po(o,a=>We(a,s?"width":"height")),[o,s]),l=Ge(i,!0,L("skipAnimationFrameInResizeObserver"));return I.useEffect(()=>{t&&(o(t.viewportHeight),n(t.itemHeight))},[t,o,n]),R.jsx("div",{"data-viewport-type":"element",ref:l,style:Rt(r),children:e})},zr=({children:e})=>{const t=I.useContext(on),o=ze("windowViewportRect"),n=ze("fixedItemHeight"),r=L("customScrollParent"),s=Ao(o,r,L("skipAnimationFrameInResizeObserver")),i=L("alignToBottom");return I.useEffect(()=>{t&&(n(t.itemHeight),o({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,o,n]),R.jsx("div",{"data-viewport-type":"window",ref:s,style:Rt(i),children:e})},jr=({children:e})=>{const t=L("TopItemListComponent")||"div",o=L("headerHeight"),n={...Cr,marginTop:`${o}px`},r=L("context");return R.jsx(t,{style:n,...Ie(t,r),children:e})},Or=I.memo(function(e){const t=L("useWindowScroll"),o=L("topItemsIndexes").length>0,n=L("customScrollParent"),r=L("context");return R.jsxs(n||t?Br:Pr,{...e,context:r,children:[o&&R.jsx(jr,{children:R.jsx(Io,{showTopList:!0})}),R.jsxs(n||t?zr:kr,{children:[R.jsx(Rr,{}),R.jsx(Io,{}),R.jsx(Er,{})]})]})}),{Component:Hr,useEmitter:Zt,useEmitterValue:L,usePublisher:ze}=tn(vr,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Or),Pr=an({useEmitter:Zt,useEmitterValue:L,usePublisher:ze}),Br=cn({useEmitter:Zt,useEmitterValue:L,usePublisher:ze}),Ar=Hr,_r=J(()=>{const e=b(c=>R.jsxs("td",{children:["Item $",c]})),t=b(null),o=b(c=>R.jsxs("td",{colSpan:1e3,children:["Group ",c]})),n=b(null),r=b(null),s=b({}),i=b(Xt),l=b(Ke),a=(c,m=null)=>Se(w(s,O(T=>T[c]),se()),m);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:r,fixedHeaderContent:n,itemContent:e,groupContent:o,ScrollerComponent:a("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr"),GroupComponent:a("Group","tr")}});ie(en,_r);Jt();const So={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Mr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:bo,floor:It,max:nt,min:Ht,round:Co}=Math;function yo(e,t,o){return Array.from({length:t-e+1}).map((n,r)=>({data:o===null?null:o[r+e],index:r+e}))}function Nr(e){return{...Mr,items:e}}function xt(e,t){return e&&e.width===t.width&&e.height===t.height}function Wr(e,t){return e&&e.column===t.column&&e.row===t.row}const Fr=J(([{increaseViewportBy:e,listBoundary:t,overscan:o,visibleRange:n},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:a,scrollTop:c,smoothScrollTargetReached:m,viewportHeight:T},p,x,{didMount:C,propsReady:k},{customScrollParent:g,useWindowScroll:d,windowScrollContainerState:f,windowScrollTo:S,windowViewportRect:H},z])=>{const P=b(0),u=b(0),v=b(So),y=b({height:0,width:0}),j=b({height:0,width:0}),A=Y(),F=Y(),D=b(0),_=b(null),V=b({column:0,row:0}),X=Y(),K=Y(),ve=b(!1),we=b(0),Te=b(!0),h=b(!1),M=b(!1);Z(w(C,U(we),W(([E,G])=>!!G)),()=>{$(Te,!1)}),Z(w(de(C,Te,j,y,we,h),W(([E,G,ne,pe,,Ee])=>E&&!G&&ne.height!==0&&pe.height!==0&&!Ee)),([,,,,E])=>{$(h,!0),Ut(1,()=>{$(A,E)}),Oe(w(c),()=>{$(t,[0,0]),$(Te,!0)})}),B(w(K,W(E=>E!=null&&E.scrollTop>0),Ae(0)),u),Z(w(C,U(K),W(([,E])=>E!=null)),([,E])=>{E&&($(y,E.viewport),$(j,E.item),$(V,E.gap),E.scrollTop>0&&($(ve,!0),Oe(w(c,Ue(1)),G=>{$(ve,!1)}),$(a,{top:E.scrollTop})))}),B(w(y,O(({height:E})=>E)),T),B(w(de(N(y,xt),N(j,xt),N(V,(E,G)=>E&&E.column===G.column&&E.row===G.row),N(c)),O(([E,G,ne,pe])=>({gap:ne,item:G,scrollTop:pe,viewport:E}))),X),B(w(de(N(P),n,N(V,Wr),N(j,xt),N(y,xt),N(_),N(u),N(ve),N(Te),N(we)),W(([,,,,,,,E])=>!E),O(([E,[G,ne],pe,Ee,fe,ce,he,,ue,te])=>{const{column:re,row:ke}=pe,{height:ge,width:Et}=Ee,{width:Kt}=fe;if(he===0&&(E===0||Kt===0))return So;if(Et===0){const no=Gt(te,E),gn=no+Math.max(he-1,0);return Nr(yo(no,gn,ce))}const ht=un(Kt,Et,re);let qe,Ve;ue?G===0&&ne===0&&he>0?(qe=0,Ve=he-1):(qe=ht*It((G+ke)/(ge+ke)),Ve=ht*bo((ne+ke)/(ge+ke))-1,Ve=Ht(E-1,nt(Ve,ht-1)),qe=Ht(Ve,nt(0,qe))):(qe=0,Ve=-1);const Qt=yo(qe,Ve,ce),{bottom:eo,top:to}=Ro(fe,pe,Ee,Qt),oo=bo(E/ht),pn=oo*ge+(oo-1)*ke-eo;return{bottom:eo,itemHeight:ge,items:Qt,itemWidth:Et,offsetBottom:pn,offsetTop:to,top:to}})),v),B(w(_,W(E=>E!==null),O(E=>E.length)),P),B(w(de(y,j,v,V),W(([E,G,{items:ne}])=>ne.length>0&&G.height!==0&&E.height!==0),O(([E,G,{items:ne},pe])=>{const{bottom:Ee,top:fe}=Ro(E,pe,G,ne);return[fe,Ee]}),se(it)),t);const q=b(!1);B(w(c,U(q),O(([E,G])=>G||E!==0)),q);const Q=Re(w(de(v,P),W(([{items:E}])=>E.length>0),U(q),W(([[E,G],ne])=>{const pe=E.items[E.items.length-1].index===G-1;return(ne||E.bottom>0&&E.itemHeight>0&&E.offsetBottom===0&&E.items.length===G)&&pe}),O(([[,E]])=>E-1),se())),Pe=Re(w(N(v),W(({items:E})=>E.length>0&&E[0].index===0),Ae(0),se())),Be=Re(w(N(v),U(ve),W(([{items:E},G])=>E.length>0&&!G),O(([{items:E}])=>({endIndex:E[E.length-1].index,startIndex:E[0].index})),se(Do),Ne(0)));B(Be,x.scrollSeekRangeChanged),B(w(A,U(y,j,P,V),O(([E,G,ne,pe,Ee])=>{const fe=Go(E),{align:ce,behavior:he,offset:ue}=fe;let te=fe.index;te==="LAST"&&(te=pe-1),te=nt(0,te,Ht(pe-1,te));let re=Nt(G,Ee,ne,te);return ce==="end"?re=Co(re-G.height+ne.height):ce==="center"&&(re=Co(re-G.height/2+ne.height/2)),ue&&(re+=ue),{behavior:he,top:re}})),a);const ee=Se(w(v,O(E=>E.offsetBottom+E.bottom)),0);return B(w(H,O(E=>({height:E.visibleHeight,width:E.visibleWidth}))),y),{customScrollParent:g,data:_,deviation:D,footerHeight:r,gap:V,headerHeight:s,increaseViewportBy:e,initialItemCount:u,itemDimensions:j,overscan:o,restoreStateFrom:K,scrollBy:i,scrollContainerState:l,scrollHeight:F,scrollTo:a,scrollToIndex:A,scrollTop:c,smoothScrollTargetReached:m,totalCount:P,useWindowScroll:d,viewportDimensions:y,windowScrollContainerState:f,windowScrollTo:S,windowViewportRect:H,...x,gridState:v,horizontalDirection:M,initialTopMostItemIndex:we,totalListHeight:ee,...p,endReached:Q,propsReady:k,rangeChanged:Be,startReached:Pe,stateChanged:X,stateRestoreInProgress:ve,...z}},ie(Yt,be,mt,Ko,Le,qt,De));function un(e,t,o){return nt(1,It((e+o)/(It(t)+o)))}function Ro(e,t,o,n){const{height:r}=o;if(r===void 0||n.length===0)return{bottom:0,top:0};const s=Nt(e,t,o,n[0].index);return{bottom:Nt(e,t,o,n[n.length-1].index)+r,top:s}}function Nt(e,t,o,n){const r=un(e.width,o.width,t.column),s=It(n/r),i=s*o.height+nt(0,s-1)*t.row;return i>0?i+t.row:i}const Dr=J(()=>{const e=b(T=>`Item ${T}`),t=b({}),o=b(null),n=b("virtuoso-grid-item"),r=b("virtuoso-grid-list"),s=b(Xt),i=b("div"),l=b(Ke),a=(T,p=null)=>Se(w(t,O(x=>x[T]),se()),p),c=b(!1),m=b(!1);return B(N(m),c),{components:t,computeItemKey:s,context:o,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:i,itemClassName:n,ItemComponent:a("Item","div"),itemContent:e,listClassName:r,ListComponent:a("List","div"),readyStateChanged:c,reportReadyState:m,ScrollerComponent:a("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),Lr=J(([e,t])=>({...e,...t}),ie(Fr,Dr)),Vr=I.memo(function(){const e=le("gridState"),t=le("listClassName"),o=le("itemClassName"),n=le("itemContent"),r=le("computeItemKey"),s=le("isSeeking"),i=je("scrollHeight"),l=le("ItemComponent"),a=le("ListComponent"),c=le("ScrollSeekPlaceholder"),m=le("context"),T=je("itemDimensions"),p=je("gap"),x=le("log"),C=le("stateRestoreInProgress"),k=je("reportReadyState"),g=Ge(I.useMemo(()=>d=>{const f=d.parentElement.parentElement.scrollHeight;i(f);const S=d.firstChild;if(S){const{height:H,width:z}=S.getBoundingClientRect();T({height:H,width:z})}p({column:Eo("column-gap",getComputedStyle(d).columnGap,x),row:Eo("row-gap",getComputedStyle(d).rowGap,x)})},[i,T,p,x]),!0,!1);return rn(()=>{e.itemHeight>0&&e.itemWidth>0&&k(!0)},[e]),C?null:R.jsx(a,{className:t,ref:g,...Ie(a,m),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(d=>{const f=r(d.index,d.data,m);return s?R.jsx(c,{...Ie(c,m),height:e.itemHeight,index:d.index,width:e.itemWidth},f):I.createElement(l,{...Ie(l,m),className:o,"data-index":d.index,key:f},n(d.index,d.data,m))})})}),$r=I.memo(function(){const e=le("HeaderComponent"),t=je("headerHeight"),o=le("headerFooterTag"),n=Ge(I.useMemo(()=>s=>{t(We(s,"height"))},[t]),!0,!1),r=le("context");return e?R.jsx(o,{ref:n,children:R.jsx(e,{...Ie(e,r)})}):null}),Ur=I.memo(function(){const e=le("FooterComponent"),t=je("footerHeight"),o=le("headerFooterTag"),n=Ge(I.useMemo(()=>s=>{t(We(s,"height"))},[t]),!0,!1),r=le("context");return e?R.jsx(o,{ref:n,children:R.jsx(e,{...Ie(e,r)})}):null}),Gr=({children:e})=>{const t=I.useContext(nn),o=je("itemDimensions"),n=je("viewportDimensions"),r=Ge(I.useMemo(()=>s=>{n(s.getBoundingClientRect())},[n]),!0,!1);return I.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),o({height:t.itemHeight,width:t.itemWidth}))},[t,n,o]),R.jsx("div",{ref:r,style:Rt(!1),children:e})},Yr=({children:e})=>{const t=I.useContext(nn),o=je("windowViewportRect"),n=je("itemDimensions"),r=le("customScrollParent"),s=Ao(o,r,!1);return I.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),o({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,o,n]),R.jsx("div",{ref:s,style:Rt(!1),children:e})},qr=I.memo(function({...e}){const t=le("useWindowScroll"),o=le("customScrollParent"),n=o||t?Xr:Jr,r=o||t?Yr:Gr,s=le("context");return R.jsx(n,{...e,...Ie(n,s),children:R.jsxs(r,{children:[R.jsx($r,{}),R.jsx(Vr,{}),R.jsx(Ur,{})]})})}),{useEmitter:dn,useEmitterValue:le,usePublisher:je}=tn(Lr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},qr),Jr=an({useEmitter:dn,useEmitterValue:le,usePublisher:je}),Xr=cn({useEmitter:dn,useEmitterValue:le,usePublisher:je});function Eo(e,t,o){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&o(`${e} was not resolved to pixel value correctly`,t,Ce.WARN),t==="normal"?0:parseInt(t??"0",10)}const Zr=()=>{const{messages:e,classNames:t,isOpen:o,isLoading:n}=St(),r=I.useRef(null),s=()=>{const l=r.current;l&&l.scrollTo({top:l.scrollHeight,behavior:"smooth"})},i=e?.length??1;return I.useEffect(()=>{o&&setTimeout(s,0)},[o]),R.jsxs("div",{className:tt("autoui-chat-messages",t?.messageList),children:[R.jsx(Ar,{data:e,overscan:100,followOutput:"smooth",initialTopMostItemIndex:i-1,itemContent:(l,a)=>R.jsx(yn,{message:a},a.id)}),n&&R.jsx(Tn,{variant:"dots"})]})};function Kr(e,t){const o=Object.entries(t.functions).map(([i,l])=>{const a=l.params?Object.entries(l.params).map(([c,m])=>`- ${c}: ${m}`).join(`
|
|
7
|
+
<%s key={someKey} {...props} />`,Q,ee,j,ee),Ce[ee+Q]=!0)}if(ee=null,J!==void 0&&(n(J),ee=""+J),i(L)&&(n(L.key),ee=""+L.key),"key"in L){J={};for(var G in L)G!=="key"&&(J[G]=L[G])}else J=L;return ee&&l(J,typeof w=="function"?w.displayName||w.name||"Unknown":w),c(w,ee,J,r(),Be,Me)}function g(w){p(w)?w._store&&(w._store.validated=1):typeof w=="object"&&w!==null&&w.$$typeof===y&&(w._payload.status==="fulfilled"?p(w._payload.value)&&w._payload.value._store&&(w._payload.value._store.validated=1):w._store&&(w._store.validated=1))}function p(w){return typeof w=="object"&&w!==null&&w.$$typeof===R}var S=x,R=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),P=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),F=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,A=Array.isArray,V=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(w){return w()}};var X,K={},ve=S.react_stack_bottom_frame.bind(S,s)(),we=V(o(s)),Ce={};nt.Fragment=v,nt.jsx=function(w,L,J){var Q=1e4>F.recentlyCreatedOwnerStacks++;return u(w,L,J,!1,Q?Error("react-stack-top-frame"):ve,Q?V(o(w)):we)},nt.jsxs=function(w,L,J){var Q=1e4>F.recentlyCreatedOwnerStacks++;return u(w,L,J,!0,Q?Error("react-stack-top-frame"):ve,Q?V(o(w)):we)}})()),nt}var an;function Io(){return an||(an=1,process.env.NODE_ENV==="production"?gt.exports=bo():gt.exports=yo()),gt.exports}var m=Io();function On(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=On(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function xe(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=On(e))&&(o&&(o+=" "),o+=t);return o}const Ro=x.forwardRef(({variant:e="default",label:t,className:n,classNames:o={},color:r="currentColor",...s},i)=>{const l=x.useMemo(()=>{switch(e){case"wave":case"dots":return m.jsx("div",{className:xe("spinner-dots-wrapper",o.wrapper),children:[0,1,2].map(a=>m.jsx("i",{className:xe("spinner-dot",o.dots),style:{animationDelay:`${a*.2}s`,backgroundColor:r}},a))});case"simple":return m.jsxs("svg",{className:xe("spinner-simple",o.wrapper),width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",style:{color:r},children:[m.jsx("circle",{className:xe("spinner-simple-circle1",o.circle1),cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),m.jsx("path",{className:xe("spinner-simple-circle2",o.circle2),fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.37 0 0 5.37 0 12h4z"})]});case"spinner":return m.jsx("div",{className:xe("spinner-bars-wrapper",o.wrapper),children:[...Array(12)].map((a,c)=>m.jsx("i",{className:xe("spinner-bar",o.spinnerBars),style:{transform:`rotate(${c*30}deg) translateY(-8px)`,animationDelay:`${c*.1}s`,backgroundColor:r}},c))});default:return m.jsxs("div",{className:xe("spinner-default",o.wrapper),children:[m.jsx("i",{className:xe("spinner-default-circle1",o.circle1),style:{borderColor:r}}),m.jsx("i",{className:xe("spinner-default-circle2",o.circle2),style:{borderColor:r}})]})}},[e,o,r]);return m.jsxs("div",{ref:i,className:xe("spinner-base",n),"aria-label":t||"Loading",...s,children:[l,t&&m.jsx("span",{className:xe("spinner-label",o.label),children:t})]})}),Pn=x.createContext(void 0),Eo=({children:e,value:t,config:n})=>m.jsx(Pn.Provider,{value:{...t,config:n},children:e}),Ye=()=>{const e=x.useContext(Pn);if(!e)throw new Error("useChatContext must be used within a ChatProvider");return e};function Oe(...e){return e.filter(Boolean).join(" ")}const Hn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2012H20M12%204V20'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Bn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M183.1%20137.4C170.6%20124.9%20150.3%20124.9%20137.8%20137.4C125.3%20149.9%20125.3%20170.2%20137.8%20182.7L275.2%20320L137.9%20457.4C125.4%20469.9%20125.4%20490.2%20137.9%20502.7C150.4%20515.2%20170.7%20515.2%20183.2%20502.7L320.5%20365.3L457.9%20502.6C470.4%20515.1%20490.7%20515.1%20503.2%20502.6C515.7%20490.1%20515.7%20469.8%20503.2%20457.3L365.8%20320L503.1%20182.6C515.6%20170.1%20515.6%20149.8%20503.1%20137.3C490.6%20124.8%20470.3%20124.8%20457.8%20137.3L320.5%20274.7L183.1%20137.4z'/%3e%3c/svg%3e",Mn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%206V18M12%206L7%2011M12%206L17%2011'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",ko="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2018L20%2018'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M4%2012L20%2012'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M4%206L20%206'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e",jo="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%201024%201024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='%23000000'%20d='M352%20192V95.936a32%2032%200%200%201%2032-32h256a32%2032%200%200%201%2032%2032V192h256a32%2032%200%201%201%200%2064H96a32%2032%200%200%201%200-64h256zm64%200h192v-64H416v64zM192%20960a32%2032%200%200%201-32-32V256h704v672a32%2032%200%200%201-32%2032H192zm224-192a32%2032%200%200%200%2032-32V416a32%2032%200%200%200-64%200v320a32%2032%200%200%200%2032%2032zm192%200a32%2032%200%200%200%2032-32V416a32%2032%200%200%200-64%200v320a32%2032%200%200%200%2032%2032z'/%3e%3c/svg%3e",zo="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M210.2%2053.9C217.6%2050.8%20226%2051.7%20232.7%2056.1L320.5%20114.3L408.3%2056.1C415%2051.7%20423.4%2050.9%20430.8%2053.9C438.2%2056.9%20443.4%2063.5%20445%2071.3L465.9%20174.5L569.1%20195.4C576.9%20197%20583.5%20202.4%20586.5%20209.7C589.5%20217%20588.7%20225.5%20584.3%20232.2L526.1%20320L584.3%20407.8C588.7%20414.5%20589.5%20422.9%20586.5%20430.3C583.5%20437.7%20576.9%20443.1%20569.1%20444.6L465.8%20465.4L445%20568.7C443.4%20576.5%20438%20583.1%20430.7%20586.1C423.4%20589.1%20414.9%20588.3%20408.2%20583.9L320.4%20525.7L232.6%20583.9C225.9%20588.3%20217.5%20589.1%20210.1%20586.1C202.7%20583.1%20197.3%20576.5%20195.8%20568.7L175%20465.4L71.7%20444.5C63.9%20442.9%2057.3%20437.5%2054.3%20430.2C51.3%20422.9%2052.1%20414.4%2056.5%20407.7L114.7%20320L56.5%20232.2C52.1%20225.5%2051.3%20217.1%2054.3%20209.7C57.3%20202.3%2063.9%20196.9%2071.7%20195.4L175%20174.6L195.9%2071.3C197.5%2063.5%20202.9%2056.9%20210.2%2053.9zM239.6%20320C239.6%20275.6%20275.6%20239.6%20320%20239.6C364.4%20239.6%20400.4%20275.6%20400.4%20320C400.4%20364.4%20364.4%20400.4%20320%20400.4C275.6%20400.4%20239.6%20364.4%20239.6%20320zM448.4%20320C448.4%20249.1%20390.9%20191.6%20320%20191.6C249.1%20191.6%20191.6%20249.1%20191.6%20320C191.6%20390.9%20249.1%20448.4%20320%20448.4C390.9%20448.4%20448.4%20390.9%20448.4%20320z'/%3e%3c/svg%3e",Oo="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M320%2064C178.6%2064%2064%20178.6%2064%20320C64%20461.4%20178.6%20576%20320%20576C388.8%20576%20451.3%20548.8%20497.3%20504.6C504.6%20497.6%20506.7%20486.7%20502.6%20477.5C498.5%20468.3%20488.9%20462.6%20478.8%20463.4C473.9%20463.8%20469%20464%20464%20464C362.4%20464%20280%20381.6%20280%20280C280%20207.9%20321.5%20145.4%20382.1%20115.2C391.2%20110.7%20396.4%20100.9%20395.2%2090.8C394%2080.7%20386.6%2072.5%20376.7%2070.3C358.4%2066.2%20339.4%2064%20320%2064z'/%3e%3c/svg%3e",Po="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M320%2064C267%2064%20224%20107%20224%20160L224%20288C224%20341%20267%20384%20320%20384C373%20384%20416%20341%20416%20288L416%20160C416%20107%20373%2064%20320%2064zM176%20248C176%20234.7%20165.3%20224%20152%20224C138.7%20224%20128%20234.7%20128%20248L128%20288C128%20385.9%20201.3%20466.7%20296%20478.5L296%20528L248%20528C234.7%20528%20224%20538.7%20224%20552C224%20565.3%20234.7%20576%20248%20576L392%20576C405.3%20576%20416%20565.3%20416%20552C416%20538.7%20405.3%20528%20392%20528L344%20528L344%20478.5C438.7%20466.7%20512%20385.9%20512%20288L512%20248C512%20234.7%20501.3%20224%20488%20224C474.7%20224%20464%20234.7%20464%20248L464%20288C464%20367.5%20399.5%20432%20320%20432C240.5%20432%20176%20367.5%20176%20288L176%20248z'/%3e%3c/svg%3e",Ho=({isOpen:e,onClose:t,triggerRef:n,children:o,styles:r,position:s="top-center"})=>{const i=x.useRef(null);if(x.useEffect(()=>{const c=u=>{i.current&&!i.current.contains(u.target)&&!n.current?.contains(u.target)&&t()};return e&&document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[e,t,n]),!e||!n.current)return null;const l=n.current.getBoundingClientRect();let a={};switch(s){case"top-center":a={width:"50%",transform:"translate(-2.5%, -110%)"};break;case"bottom-left":a={top:l.bottom+6+window.scrollY,left:l.left+window.scrollX};break;case"bottom-right":a={top:l.bottom+6+window.scrollY,left:l.right+window.scrollX,transform:"translateX(-100%)"};break}return m.jsx("div",{ref:i,style:{position:"absolute",zIndex:9999,...a,...r},children:o})};function Bo({isSelected:e,disableAnimation:t,...n}){return m.jsx("svg",{"aria-hidden":"true","data-selected":e,role:"presentation",viewBox:"0 0 17 18",...n,children:m.jsx("polyline",{fill:"none",points:"1 9 7 14 15 4",stroke:"currentColor",strokeDasharray:22,strokeDashoffset:e?44:66,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,style:t?{}:{transition:"stroke-dashoffset 200ms ease"}})})}const Mo=({label:e,description:t,shortcut:n,startContent:o,endContent:r,isSelected:s,isDisabled:i,onSelect:l,disableAnimation:a,hideSelectedIcon:c,selectedIcon:u})=>{const g=x.useMemo(()=>{const p=m.jsx(Bo,{disableAnimation:a,isSelected:!!s});return typeof u=="function"?u({icon:p,isSelected:s,isDisabled:i}):u||p},[u,s,i,a]);return m.jsxs("li",{className:`hero-menu-item ${s?"selected":""} ${i?"disabled":""}`,onClick:()=>{console.log(1),!i&&l?.()},children:[o&&m.jsx("span",{className:"start",children:o}),m.jsxs("div",{className:"content",children:[m.jsx("span",{className:"label",children:e}),t&&m.jsx("span",{className:"description",children:t})]}),n&&m.jsx("kbd",{className:"shortcut",children:n}),!c&&m.jsx("span",{className:"selected-icon",children:g}),r&&m.jsx("span",{className:"end",children:r})]})},Ao=({items:e,defaultSelectedKey:t,onSelectionChange:n})=>{const[o,r]=x.useState(t),s=i=>{r(i),n?.(i)};return m.jsx("ul",{className:"hero-menu",children:e.map(i=>m.jsx(Mo,{label:i.label,description:i.description,shortcut:i.shortcut,startContent:i.startContent,endContent:i.endContent,isSelected:i.key===o,isDisabled:i.isDisabled,onSelect:()=>{i?.onSelect?.(),s(i.key)}},i.key))})},Lo=({items:e,button:t,popoverStyles:n,defaultSelectedKey:o,closeAfterSelect:r,onSelectionChange:s})=>{const i=x.useRef(null),[l,a]=x.useState(!1),c={ref:i,onClick:()=>{a(u=>!u)},style:{cursor:"pointer"}};return m.jsxs(m.Fragment,{children:[t?x.cloneElement(t,c):m.jsx("button",{ref:i,onClick:()=>a(u=>!u),style:{cursor:"pointer"},children:m.jsx("img",{src:ko,alt:"menu"})}),m.jsx(Ho,{styles:n,isOpen:l,onClose:()=>a(!1),triggerRef:i,children:m.jsx("div",{style:{borderRadius:10,zIndex:9999,boxShadow:"0 4px 12px rgba(0,0,0,0.12)"},children:m.jsx(Ao,{items:e,defaultSelectedKey:o,onSelectionChange:u=>{s?.(u),r?.(u)&&a(!1)}})})})]})},No=kt.forwardRef(function({checked:t,defaultChecked:n,onCheckedChange:o,disabled:r=!1,required:s=!1,name:i,value:l,id:a,label:c,description:u,size:g="md",className:p,trackClassName:S,thumbClassName:R,labelClassName:E,startContent:v,endContent:f,thumb:h,"aria-label":b,"aria-labelledby":P},z){const M=typeof t=="boolean",[d,C]=kt.useState(!!n),y=M?!!t:d,k=a??kt.useId(),H=D=>{const A=D.target.checked;M||C(A),o?.(A,D)},F=h?.({checked:y,disabled:r,size:g})??(y?f:v);return m.jsxs("label",{className:Oe("autoui-switch",`autoui-switch--${g}`,r&&"is-disabled",p),htmlFor:k,children:[m.jsxs("span",{className:Oe("autoui-switch__control",S),"aria-hidden":"true",children:[m.jsx("input",{ref:z,id:k,className:"autoui-switch__input",type:"checkbox",checked:y,defaultChecked:n,onChange:H,disabled:r,required:s,name:i,value:l,"aria-label":b,"aria-labelledby":P}),m.jsx("span",{className:Oe("autoui-switch__track")}),m.jsx("span",{className:Oe("autoui-switch__thumb",R),children:F?m.jsx("span",{className:"autoui-switch__thumbContent",children:F}):null})]}),(c||u)&&m.jsxs("span",{className:Oe("autoui-switch__text",E),children:[c&&m.jsx("span",{className:"autoui-switch__label",children:c}),u&&m.jsx("span",{className:"autoui-switch__description",children:u})]})]})}),_o=()=>{const{handleClear:e,setTheme:t,theme:n,mode:o}=Ye();return console.log(o),m.jsx(Lo,{popoverStyles:{position:"absolute"},button:m.jsx("button",{type:"button",className:"autoui-chat-input-start",children:m.jsx("img",{src:Hn,alt:"menu",width:20,height:20,style:{filter:"var(--icon-filter-text)"}})}),items:[{startContent:m.jsx("img",{src:jo,width:16,height:16,style:{filter:"var(--icon-filter-text)"}}),key:"clear",label:"Clear Messages",onSelect:e},{key:"switchTheme",label:m.jsx(No,{defaultChecked:n==="light",onCheckedChange:r=>{t?.(r?"light":"dark")},label:"Theme mode",thumb:({checked:r})=>m.jsx(m.Fragment,{children:r?m.jsx("img",{src:zo,width:14,height:14,style:{filter:"var(--icon-filter-accent)"}}):m.jsx("img",{src:Oo,width:14,height:14,style:{filter:"var(--icon-filter-text)"}})})})}],closeAfterSelect:r=>r!=="switchTheme",onSelectionChange:r=>console.log("Selected:",r)})},Fo=({value:e,setValue:t})=>{const{classNames:n}=Ye();return m.jsx("input",{role:"input",className:Oe("autoui-chat-textbox",n?.input),type:"text",value:e,autoFocus:!0,onChange:o=>t(o.target.value),placeholder:"Type a message...","aria-label":"Message input"})},Do=()=>{const{classNames:e}=Ye();return m.jsx("button",{role:"inputButton",type:"submit",className:Oe("autoui-chat-send",e?.inputButton),"aria-label":"Send message",children:m.jsx("img",{src:Mn,alt:"arrow up",width:24,height:24,style:{filter:"var(--icon-filter-text)"}})})},Wo=({lang:e="en-us"}={})=>{const t=x.useRef(null),[n,o]=x.useState(""),[r,s]=x.useState(!1),i=typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window),l=x.useCallback(()=>{if(!i||r)return;const c=window.SpeechRecognition||window.webkitSpeechRecognition;if(!c)return;const u=new c;u.lang=e,u.continuous=!1,u.interimResults=!1,u.onstart=()=>s(!0),u.onend=()=>s(!1),u.onresult=g=>{const p=g.results[0][0].transcript;o(p),s(!1)},u.onerror=()=>{u.stop(),s(!1)},t.current=u,u.start()},[i,r,e]),a=x.useCallback(()=>{t.current?.stop(),s(!1)},[]);return{start:l,stop:a,text:n,listening:r,isSupported:i}},Vo=({active:e,onClick:t})=>m.jsx("button",{type:"button",className:`chat-mic-btn ${e?"is-active":""}`,onClick:t,"aria-label":"Voice input",children:m.jsx("img",{src:Po,width:20,height:20,style:{filter:"var(--icon-filter-text)"}})}),$o=()=>{const{classNames:e,handleSend:t}=Ye(),[n,o]=x.useState(""),r=Wo({lang:"en-us"});x.useEffect(()=>{r.text&&o(i=>i?`${i} ${r.text}`:r.text)},[r.text]);const s=i=>{i.preventDefault(),t(n),o("")};return m.jsxs("form",{className:Oe("autoui-chat-input",e?.inputWrapper),onSubmit:s,children:[m.jsx(_o,{}),m.jsx(Fo,{value:n,setValue:o}),r.isSupported&&m.jsx(Vo,{active:r.listening,onClick:()=>{r.listening?r.stop():r.start()}}),m.jsx(Do,{})]})},Uo=({message:e})=>{const t=e.role==="user",{classNames:n}=Ye(),o=typeof e.content=="string"||e.content instanceof String;return m.jsx("div",{role:"message",className:xe("autoui-chat-message",t?"user":"assistant",n?.message),"aria-label":t?"User message":"Assistant message",children:m.jsx("div",{className:`autoui-chat-bubble ${o?"autoui-chat-bubble--string":"autoui-chat-bubble--react-node"}`,children:e.content})})},bt=0,De=1,Qe=2,An=4;function cn(e){return()=>e}function Go(e){e()}function Ln(e,t){return n=>e(t(n))}function un(e,t){return()=>e(t)}function Yo(e,t){return n=>e(t,n)}function Dt(e){return e!==void 0}function Jo(...e){return()=>{e.map(Go)}}function et(){}function yt(e,t){return t(e),e}function qo(e,t){return t(e)}function ie(...e){return e}function Z(e,t){return e(De,t)}function $(e,t){e(bt,t)}function Wt(e){e(Qe)}function ae(e){return e(An)}function B(e,t){return Z(e,Yo(t,bt))}function Pe(e,t){const n=e(De,o=>{n(),t(o)});return n}function dn(e){let t,n;return o=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{o(t)},e)}}function Nn(e,t){return e===t}function se(e=Nn){let t;return n=>o=>{e(t,o)||(t=o,n(o))}}function _(e){return t=>n=>{e(n)&&t(n)}}function O(e){return t=>Ln(t,e)}function Ae(e){return t=>()=>{t(e)}}function T(e,...t){const n=Xo(...t);return(o,r)=>{switch(o){case Qe:Wt(e);return;case De:return Z(e,n(r))}}}function Le(e,t){return n=>o=>{n(t=e(t,o))}}function Ge(e){return t=>n=>{e>0?e--:t(n)}}function _e(e){let t=null,n;return o=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,o(t)},e))}}function U(...e){const t=new Array(e.length);let n=0,o=null;const r=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Z(s,a=>{const c=n;n=n|l,t[i]=a,c!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(t))};n===r?l():o=l}}function Xo(...e){return t=>e.reduceRight(qo,t)}function Zo(e){let t,n;const o=()=>t?.();return function(r,s){switch(r){case De:return s?n===s?void 0:(o(),n=s,t=Z(e,s),t):(o(),et);case Qe:o(),n=null;return}}}function I(e){let t=e;const n=Y();return(o,r)=>{switch(o){case bt:t=r;break;case De:{r(t);break}case An:return t}return n(o,r)}}function Te(e,t){return yt(I(t),n=>B(e,n))}function Y(){const e=[];return(t,n)=>{switch(t){case bt:e.slice().forEach(o=>{o(n)});return;case Qe:e.splice(0,e.length);return;case De:return e.push(n),()=>{const o=e.indexOf(n);o>-1&&e.splice(o,1)}}}}function Re(e){return yt(Y(),t=>B(e,t))}function q(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Ko(),singleton:n}}const Ko=()=>Symbol();function Qo(e){const t=new Map,n=({constructor:o,dependencies:r,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const l=o(r.map(a=>n(a)));return i&&t.set(s,l),l};return n(e)}function de(...e){const t=Y(),n=new Array(e.length);let o=0;const r=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);Z(s,a=>{n[i]=a,o=o|l,o===r&&$(t,n)})}),function(s,i){switch(s){case Qe:{Wt(t);return}case De:return o===r&&i(n),Z(t,i)}}}function N(e,t=Nn){return T(e,se(t))}function Bt(...e){return function(t,n){switch(t){case Qe:return;case De:return Jo(...e.map(o=>Z(o,n)))}}}var ye=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(ye||{});const er={0:"debug",3:"error",1:"log",2:"warn"},tr=()=>typeof globalThis>"u"?window:globalThis,We=q(()=>{const e=I(3);return{log:I((t,n,o=1)=>{var r;const s=(r=tr().VIRTUOSO_LOG_LEVEL)!=null?r:ae(e);o>=s&&console[er[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function Je(e,t,n){return Vt(e,t,n).callbackRef}function Vt(e,t,n){const o=x.useRef(null);let r=i=>{};const s=x.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const l=()=>{const a=i[0].target;a.offsetParent!==null&&e(a)};n?l():requestAnimationFrame(l)}):null,[e,n]);return r=i=>{i&&t?(s?.observe(i),o.current=i):(o.current&&s?.unobserve(o.current),o.current=null)},{callbackRef:r,ref:o}}function nr(e,t,n,o,r,s,i,l,a){const c=x.useCallback(u=>{const g=or(u.children,t,l?"offsetWidth":"offsetHeight",r);let p=u.parentElement;for(;!p.dataset.virtuosoScroller;)p=p.parentElement;const S=p.lastElementChild.dataset.viewportType==="window";let R;S&&(R=p.ownerDocument.defaultView);const E=i?l?i.scrollLeft:i.scrollTop:S?l?R.scrollX||R.document.documentElement.scrollLeft:R.scrollY||R.document.documentElement.scrollTop:l?p.scrollLeft:p.scrollTop,v=i?l?i.scrollWidth:i.scrollHeight:S?l?R.document.documentElement.scrollWidth:R.document.documentElement.scrollHeight:l?p.scrollWidth:p.scrollHeight,f=i?l?i.offsetWidth:i.offsetHeight:S?l?R.innerWidth:R.innerHeight:l?p.offsetWidth:p.offsetHeight;o({scrollHeight:v,scrollTop:Math.max(E,0),viewportHeight:f}),s?.(l?fn("column-gap",getComputedStyle(u).columnGap,r):fn("row-gap",getComputedStyle(u).rowGap,r)),g!==null&&e(g)},[e,t,r,s,i,o,l]);return Vt(c,n,a)}function or(e,t,n,o){const r=e.length;if(r===0)return null;const s=[];for(let i=0;i<r;i++){const l=e.item(i);if(l.dataset.index===void 0)continue;const a=parseInt(l.dataset.index),c=parseFloat(l.dataset.knownSize),u=t(l,n);if(u===0&&o("Zero-sized element, this should not happen",{child:l},ye.ERROR),u===c)continue;const g=s[s.length-1];s.length===0||g.size!==u||g.endIndex!==a-1?s.push({endIndex:a,size:u,startIndex:a}):s[s.length-1].endIndex++}return s}function fn(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ye.WARN),t==="normal"?0:parseInt(t??"0",10)}function _n(e,t,n){const o=x.useRef(null),r=x.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const c=a.getBoundingClientRect(),u=c.width;let g,p;if(t){const S=t.getBoundingClientRect(),R=c.top-S.top;p=S.height-Math.max(0,R),g=R+t.scrollTop}else{const S=i.current.ownerDocument.defaultView;p=S.innerHeight-Math.max(0,c.top),g=c.top+S.scrollY}o.current={offsetTop:g,visibleHeight:p,visibleWidth:u},e(o.current)},[e,t]),{callbackRef:s,ref:i}=Vt(r,!0,n),l=x.useCallback(()=>{r(i.current)},[r,i]);return x.useEffect(()=>{var a;if(t){t.addEventListener("scroll",l);const c=new ResizeObserver(()=>{requestAnimationFrame(l)});return c.observe(t),()=>{t.removeEventListener("scroll",l),c.unobserve(t)}}else{const c=(a=i.current)==null?void 0:a.ownerDocument.defaultView;return c?.addEventListener("scroll",l),c?.addEventListener("resize",l),()=>{c?.removeEventListener("scroll",l),c?.removeEventListener("resize",l)}}},[l,t,i]),s}const be=q(()=>{const e=Y(),t=Y(),n=I(0),o=Y(),r=I(0),s=Y(),i=Y(),l=I(0),a=I(0),c=I(0),u=I(0),g=Y(),p=Y(),S=I(!1),R=I(!1),E=I(!1);return B(T(e,O(({scrollTop:v})=>v)),t),B(T(e,O(({scrollHeight:v})=>v)),i),B(t,r),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:a,footerHeight:u,headerHeight:l,horizontalDirection:R,scrollBy:p,scrollContainerState:e,scrollHeight:i,scrollingInProgress:S,scrollTo:g,scrollTop:t,skipAnimationFrameInResizeObserver:E,smoothScrollTargetReached:o,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),st={lvl:0};function Fn(e,t){const n=e.length;if(n===0)return[];let{index:o,value:r}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:l,value:a}=t(e[i]);s.push({end:l-1,start:o,value:r}),o=l,r=a}return s.push({end:1/0,start:o,value:r}),s}function ne(e){return e===st}function it(e,t){if(!ne(e))return t===e.k?e.v:t<e.k?it(e.l,t):it(e.r,t)}function He(e,t,n="k"){if(ne(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const o=He(e.r,t,n);return o[0]===-1/0?[e.k,e.v]:o}return He(e.l,t,n)}function Ie(e,t,n){return ne(e)?Vn(t,n,1):t===e.k?he(e,{k:t,v:n}):t<e.k?hn(he(e,{l:Ie(e.l,t,n)})):hn(he(e,{r:Ie(e.r,t,n)}))}function Ze(){return st}function Ke(e,t,n){if(ne(e))return[];const o=He(e,t)[0];return rr(At(e,o,n))}function Mt(e,t){if(ne(e))return st;const{k:n,l:o,r}=e;if(t===n){if(ne(o))return r;if(ne(r))return o;{const[s,i]=Wn(o);return wt(he(e,{k:s,l:Dn(o),v:i}))}}else return t<n?wt(he(e,{l:Mt(o,t)})):wt(he(e,{r:Mt(r,t)}))}function Ue(e){return ne(e)?[]:[...Ue(e.l),{k:e.k,v:e.v},...Ue(e.r)]}function At(e,t,n){if(ne(e))return[];const{k:o,l:r,r:s,v:i}=e;let l=[];return o>t&&(l=l.concat(At(r,t,n))),o>=t&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(At(s,t,n))),l}function wt(e){const{l:t,lvl:n,r:o}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(jt(t))return $n(he(e,{lvl:n-1}));if(!ne(t)&&!ne(t.r))return he(t.r,{l:he(t,{r:t.r.l}),lvl:n,r:he(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(jt(e))return Lt(he(e,{lvl:n-1}));if(!ne(o)&&!ne(o.l)){const r=o.l,s=jt(r)?o.lvl-1:o.lvl;return he(r,{l:he(e,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Lt(he(o,{l:r.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function he(e,t){return Vn(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Dn(e){return ne(e.r)?e.l:wt(he(e,{r:Dn(e.r)}))}function jt(e){return ne(e)||e.lvl>e.r.lvl}function Wn(e){return ne(e.r)?[e.k,e.v]:Wn(e.r)}function Vn(e,t,n,o=st,r=st){return{k:e,l:o,lvl:n,r,v:t}}function hn(e){return Lt($n(e))}function $n(e){const{l:t}=e;return!ne(t)&&t.lvl===e.lvl?he(t,{r:he(e,{l:t.r})}):e}function Lt(e){const{lvl:t,r:n}=e;return!ne(n)&&!ne(n.r)&&n.lvl===t&&n.r.lvl===t?he(n,{l:he(e,{r:n.l}),lvl:t+1}):e}function rr(e){return Fn(e,({k:t,v:n})=>({index:t,value:n}))}function Un(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function lt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const $t=q(()=>({recalcInProgress:I(!1)}),[],{singleton:!0});function Gn(e,t,n){return e[St(e,t,n)]}function St(e,t,n,o=0){let r=e.length-1;for(;o<=r;){const s=Math.floor((o+r)/2),i=e[s],l=n(i,t);if(l===0)return s;if(l===-1){if(r-o<2)return s-1;r=s-1}else{if(r===o)return s;o=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function sr(e,t,n,o){const r=St(e,t,o),s=St(e,n,o,r);return e.slice(r,s+1)}function Fe(e,t){return Math.round(e.getBoundingClientRect()[t])}function It(e){return!ne(e.groupOffsetTree)}function Ut({index:e},t){return t===e?0:t<e?-1:1}function ir(){return{groupIndices:[],groupOffsetTree:Ze(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ze()}}function lr(e,t){let n=ne(e)?0:1/0;for(const o of t){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),ne(e)){e=Ie(e,0,s);continue}const l=Ke(e,i-1,r+1);if(l.some(mr(o)))continue;let a=!1,c=!1;for(const{end:u,start:g,value:p}of l)a?(r>=g||s===p)&&(e=Mt(e,g)):(c=p!==s,a=!0),u>r&&r>=g&&p!==s&&(e=Ie(e,r+1,p));c&&(e=Ie(e,i,s))}return[e,n]}function ar(e){return typeof e.groupIndex<"u"}function cr({offset:e},t){return t===e?0:t<e?-1:1}function at(e,t,n){if(t.length===0)return 0;const{index:o,offset:r,size:s}=Gn(t,e,Ut),i=e-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Yn(e,t){if(!It(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Jn(e,t,n){if(ar(e))return t.groupIndices[e.groupIndex]+1;{const o=e.index==="LAST"?n:e.index;let r=Yn(o,t);return r=Math.max(0,r,Math.min(n,r)),r}}function ur(e,t,n,o=0){return o>0&&(t=Math.max(t,Gn(e,o,Ut).offset)),Fn(sr(e,t,n,cr),hr)}function dr(e,[t,n,o,r]){t.length>0&&o("received item sizes",t,ye.DEBUG);const s=e.sizeTree;let i=s,l=0;if(n.length>0&&ne(s)&&t.length===2){const p=t[0].size,S=t[1].size;i=n.reduce((R,E)=>Ie(Ie(R,E,p),E+1,S),i)}else[i,l]=lr(i,t);if(i===s)return e;const{lastIndex:a,lastOffset:c,lastSize:u,offsetTree:g}=Nt(e.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((p,S)=>Ie(p,S,at(S,g,r)),Ze()),lastIndex:a,lastOffset:c,lastSize:u,offsetTree:g,sizeTree:i}}function fr(e){return Ue(e).map(({k:t,v:n},o,r)=>{const s=r[o+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function mn(e,t){let n=0,o=0;for(;n<e;)n+=t[o+1]-t[o]-1,o++;return o-(n===e?0:1)}function Nt(e,t,n,o){let r=e,s=0,i=0,l=0,a=0;if(t!==0){a=St(r,t-1,Ut),l=r[a].offset;const c=He(n,t-1);s=c[0],i=c[1],r.length&&r[a].size===He(n,t)[1]&&(a-=1),r=r.slice(0,a+1)}else r=[];for(const{start:c,value:u}of Ke(n,t,1/0)){const g=c-s,p=g*i+l+g*o;r.push({index:c,offset:p,size:u}),s=c,l=p,i=u}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function hr(e){return{index:e.index,value:e}}function mr(e){const{endIndex:t,size:n,startIndex:o}=e;return r=>r.start===o&&(r.end===t||r.end===1/0)&&r.value===n}const pr={offsetHeight:"height",offsetWidth:"width"},Ne=q(([{log:e},{recalcInProgress:t}])=>{const n=Y(),o=Y(),r=Te(o,0),s=Y(),i=Y(),l=I(0),a=I([]),c=I(void 0),u=I(void 0),g=I(void 0),p=I(void 0),S=I((d,C)=>Fe(d,pr[C])),R=I(void 0),E=I(0),v=ir(),f=Te(T(n,U(a,e,E),Le(dr,v),se()),v),h=Te(T(a,se(),Le((d,C)=>({current:C,prev:d.current}),{current:[],prev:[]}),O(({prev:d})=>d)),[]);B(T(a,_(d=>d.length>0),U(f,E),O(([d,C,y])=>{const k=d.reduce((H,F,D)=>Ie(H,F,at(F,C.offsetTree,y)||D),Ze());return{...C,groupIndices:d,groupOffsetTree:k}})),f),B(T(o,U(f),_(([d,{lastIndex:C}])=>d<C),O(([d,{lastIndex:C,lastSize:y}])=>[{endIndex:C,size:y,startIndex:d}])),n),B(c,u);const b=Te(T(c,O(d=>d===void 0)),!0);B(T(u,_(d=>d!==void 0&&ne(ae(f).sizeTree)),O(d=>{const C=ae(g),y=ae(a).length>0;return C?y?[{endIndex:0,size:C,startIndex:0},{endIndex:1,size:d,startIndex:1}]:[]:[{endIndex:0,size:d,startIndex:0}]})),n),B(T(p,_(d=>d!==void 0&&d.length>0&&ne(ae(f).sizeTree)),O(d=>{const C=[];let y=d[0],k=0;for(let H=1;H<d.length;H++){const F=d[H];F!==y&&(C.push({endIndex:H-1,size:y,startIndex:k}),y=F,k=H)}return C.push({endIndex:d.length-1,size:y,startIndex:k}),C})),n),B(T(a,U(g,u),_(([,d,C])=>d!==void 0&&C!==void 0),O(([d,C,y])=>{const k=[];for(let H=0;H<d.length;H++){const F=d[H],D=d[H+1];k.push({startIndex:F,endIndex:F,size:C}),D!==void 0&&k.push({startIndex:F+1,endIndex:D-1,size:y})}return k})),n);const P=Re(T(n,U(f),Le(({sizes:d},[C,y])=>({changed:y!==d,sizes:y}),{changed:!1,sizes:v}),O(d=>d.changed)));Z(T(l,Le((d,C)=>({diff:d.prev-C,prev:C}),{diff:0,prev:0}),O(d=>d.diff)),d=>{const{groupIndices:C}=ae(f);if(d>0)$(t,!0),$(s,d+mn(d,C));else if(d<0){const y=ae(h);y.length>0&&(d-=mn(-d,y)),$(i,d)}}),Z(T(l,U(e)),([d,C])=>{d<0&&C("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},ye.ERROR)});const z=Re(s);B(T(s,U(f),O(([d,C])=>{const y=C.groupIndices.length>0,k=[],H=C.lastSize;if(y){const F=it(C.sizeTree,0);let D=0,A=0;for(;D<d;){const X=C.groupIndices[A],K=C.groupIndices.length===A+1?1/0:C.groupIndices[A+1]-X-1;k.push({endIndex:X,size:F,startIndex:X}),k.push({endIndex:X+1+K-1,size:H,startIndex:X+1}),A++,D+=K+1}const V=Ue(C.sizeTree);return D!==d&&V.shift(),V.reduce((X,{k:K,v:ve})=>{let we=X.ranges;return X.prevSize!==0&&(we=[...X.ranges,{endIndex:K+d-1,size:X.prevSize,startIndex:X.prevIndex}]),{prevIndex:K+d,prevSize:ve,ranges:we}},{prevIndex:d,prevSize:0,ranges:k}).ranges}return Ue(C.sizeTree).reduce((F,{k:D,v:A})=>({prevIndex:D+d,prevSize:A,ranges:[...F.ranges,{endIndex:D+d-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:H,ranges:[]}).ranges})),n);const M=Re(T(i,U(f,E),O(([d,{offsetTree:C},y])=>{const k=-d;return at(k,C,y)})));return B(T(i,U(f,E),O(([d,C,y])=>{if(C.groupIndices.length>0){if(ne(C.sizeTree))return C;let k=Ze();const H=ae(h);let F=0,D=0,A=0;for(;F<-d;){A=H[D];const V=H[D+1]-A-1;D++,F+=V+1}if(k=Ue(C.sizeTree).reduce((V,{k:X,v:K})=>Ie(V,Math.max(0,X+d),K),k),F!==-d){const V=it(C.sizeTree,A);k=Ie(k,0,V);const X=He(C.sizeTree,-d+1)[1];k=Ie(k,1,X)}return{...C,sizeTree:k,...Nt(C.offsetTree,0,k,y)}}else{const k=Ue(C.sizeTree).reduce((H,{k:F,v:D})=>Ie(H,Math.max(0,F+d),D),Ze());return{...C,sizeTree:k,...Nt(C.offsetTree,0,k,y)}}})),f),{beforeUnshiftWith:z,data:R,defaultItemSize:u,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:g,gap:E,groupIndices:a,heightEstimates:p,itemSize:S,listRefresh:P,shiftWith:i,shiftWithOffset:M,sizeRanges:n,sizes:f,statefulTotalCount:r,totalCount:o,trackItemSizes:b,unshiftWith:s}},ie(We,$t),{singleton:!0});function gr(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const qn=q(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const s=Y(),i=Y(),l=Re(T(s,O(gr)));return B(T(l,O(a=>a.totalCount)),n),B(T(l,O(a=>a.groupIndices)),e),B(T(de(r,t,o),_(([a,c])=>It(c)),O(([a,c,u])=>He(c.groupOffsetTree,Math.max(a-u,0),"v")[0]),se(),O(a=>[a])),i),{groupCounts:s,topItemsIndexes:i}},ie(Ne,be)),Ve=q(([{log:e}])=>{const t=I(!1),n=Re(T(t,_(o=>o),se()));return Z(t,o=>{o&&ae(e)("props updated",{},ye.DEBUG)}),{didMount:n,propsReady:t}},ie(We),{singleton:!0}),xr=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Xn(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!xr)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const ft=q(([{gap:e,listRefresh:t,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:a,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:g},{log:p}])=>{const S=Y(),R=Y(),E=I(0);let v=null,f=null,h=null;function b(){v&&(v(),v=null),h&&(h(),h=null),f&&(clearTimeout(f),f=null),$(a,!1)}return B(T(S,U(n,g,o,E,l,i,p),U(e,s,r),O(([[P,z,M,d,C,y,k,H],F,D,A])=>{const V=Xn(P),{align:X,behavior:K,offset:ve}=V,we=d-1,Ce=Jn(V,z,we);let w=at(Ce,z.offsetTree,F)+y;X==="end"?(w+=D+He(z.sizeTree,Ce)[1]-M+A,Ce===we&&(w+=k)):X==="center"?w+=(D+He(z.sizeTree,Ce)[1]-M+A)/2:w-=C,ve&&(w+=ve);const L=J=>{b(),J?(H("retrying to scroll to",{location:P},ye.DEBUG),$(S,P)):($(R,!0),H("list did not change, scroll successful",{},ye.DEBUG))};if(b(),K==="smooth"){let J=!1;h=Z(t,Q=>{J=J||Q}),v=Pe(u,()=>{L(J)})}else v=Pe(T(t,vr(150)),L);return f=setTimeout(()=>{b()},1200),$(a,!0),H("scrolling from index to",{behavior:K,index:Ce,top:w},ye.DEBUG),{behavior:K,top:w}})),c),{scrollTargetReached:R,scrollToIndex:S,topListHeight:E}},ie(Ne,be,We),{singleton:!0});function vr(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return o=>{o&&(t(!0),clearTimeout(n))}}}function Gt(e,t){e==0?t():requestAnimationFrame(()=>{Gt(e-1,t)})}function Yt(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const ht=q(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=I(!0),a=I(0),c=I(!0);return B(T(i,U(a),_(([u,g])=>!!g),Ae(!1)),l),B(T(i,U(a),_(([u,g])=>!!g),Ae(!1)),c),Z(T(de(t,i),U(l,n,e,c),_(([[,u],g,{sizeTree:p},S,R])=>u&&(!ne(p)||Dt(S))&&!g&&!R),U(a)),([,u])=>{Pe(r,()=>{$(c,!0)}),Gt(4,()=>{Pe(o,()=>{$(l,!0)}),$(s,u)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:a,scrolledToInitialItem:l}},ie(Ne,be,ft,Ve),{singleton:!0});function Zn(e,t){return Math.abs(e-t)<1.01}const ct="up",ot="down",wr="none",Cr={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Sr=0,mt=q(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=I(!1),l=I(!0),a=Y(),c=Y(),u=I(4),g=I(Sr),p=Te(T(Bt(T(N(r),Ge(1),Ae(!0)),T(N(r),Ge(1),Ae(!1),dn(100))),se()),!1),S=Te(T(Bt(T(n,Ae(!0)),T(n,Ae(!1),dn(200))),se()),!1);B(T(de(N(r),N(g)),O(([h,b])=>h<=b),se()),l),B(T(l,_e(50)),c);const R=Re(T(de(o,N(s),N(t),N(e),N(u)),Le((h,[{scrollHeight:b,scrollTop:P},z,M,d,C])=>{const y=P+z-b>-C,k={scrollHeight:b,scrollTop:P,viewportHeight:z};if(y){let F,D;return P>h.state.scrollTop?(F="SCROLLED_DOWN",D=h.state.scrollTop-P):(F="SIZE_DECREASED",D=h.state.scrollTop-P||h.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:D,state:k}}let H;return k.scrollHeight>h.state.scrollHeight?H="SIZE_INCREASED":z<h.state.viewportHeight?H="VIEWPORT_HEIGHT_DECREASING":P<h.state.scrollTop?H="SCROLLING_UPWARDS":H="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:H,state:k}},Cr),se((h,b)=>h&&h.atBottom===b.atBottom))),E=Te(T(o,Le((h,{scrollHeight:b,scrollTop:P,viewportHeight:z})=>{if(Zn(h.scrollHeight,b))return{changed:!1,jump:0,scrollHeight:b,scrollTop:P};{const M=b-(P+z)<1;return h.scrollTop!==P&&M?{changed:!0,jump:h.scrollTop-P,scrollHeight:b,scrollTop:P}:{changed:!0,jump:0,scrollHeight:b,scrollTop:P}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),_(h=>h.changed),O(h=>h.jump)),0);B(T(R,O(h=>h.atBottom)),i),B(T(i,_e(50)),a);const v=I(ot);B(T(o,O(({scrollTop:h})=>h),se(),Le((h,b)=>ae(S)?{direction:h.direction,prevScrollTop:b}:{direction:b<h.prevScrollTop?ct:ot,prevScrollTop:b},{direction:ot,prevScrollTop:0}),O(h=>h.direction)),v),B(T(o,_e(50),Ae(wr)),v);const f=I(0);return B(T(p,_(h=>!h),Ae(0)),f),B(T(r,_e(100),U(p),_(([h,b])=>!!b),Le(([h,b],[P])=>[b,P],[0,0]),O(([h,b])=>b-h)),f),{atBottomState:R,atBottomStateChange:a,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:g,isAtBottom:i,isAtTop:l,isScrolling:p,lastJumpDueToItemResize:E,scrollDirection:v,scrollVelocity:f}},ie(be)),ut="top",dt="bottom",pn="none";function gn(e,t,n){return typeof e=="number"?n===ct&&t===ut||n===ot&&t===dt?e:0:n===ct?t===ut?e.main:e.reverse:t===dt?e.main:e.reverse}function xn(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const Jt=q(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=Y(),i=I(0),l=I(0),a=I(0),c=Te(T(de(N(o),N(r),N(n),N(s,lt),N(a),N(i),N(t),N(e),N(l)),O(([u,g,p,[S,R],E,v,f,h,b])=>{const P=u-h,z=v+f,M=Math.max(p-P,0);let d=pn;const C=xn(b,ut),y=xn(b,dt);return S-=h,S+=p+f,R+=p+f,R-=h,S>u+z-C&&(d=ct),R<u-M+g+y&&(d=ot),d!==pn?[Math.max(P-p-gn(E,ut,d)-C,0),P-M-f+g+gn(E,dt,d)+y]:null}),_(u=>u!=null),se(lt)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:a,topListHeight:i,visibleRange:c}},ie(be),{singleton:!0});function Tr(e,t,n){if(It(t)){const o=Yn(e,t);return[{index:He(t.groupOffsetTree,o)[0],offset:0,size:0},{data:n?.[0],index:o,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}const zt={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ct(e,t,n,o,r,s){const{lastIndex:i,lastOffset:l,lastSize:a}=r;let c=0,u=0;if(e.length>0){c=e[0].offset;const E=e[e.length-1];u=E.offset+E.size}const g=n-i,p=l+g*a+(g-1)*o,S=c,R=p-u;return{bottom:u,firstItemIndex:s,items:vn(e,r,s),offsetBottom:R,offsetTop:c,top:S,topItems:vn(t,r,s),topListHeight:t.reduce((E,v)=>v.size+E,0),totalCount:n}}function Kn(e,t,n,o,r,s){let i=0;if(n.groupIndices.length>0)for(const u of n.groupIndices){if(u-i>=e)break;i++}const l=e+i,a=Yt(t,l),c=Array.from({length:l}).map((u,g)=>({data:s[g+a],index:g+a,offset:0,size:0}));return Ct(c,[],l,r,n,o)}function vn(e,t,n){if(e.length===0)return[];if(!It(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const o=e[0].index,r=e[e.length-1].index,s=[],i=Ke(t.groupOffsetTree,o,r);let l,a=0;for(const c of e){(!l||l.end<c.index)&&(l=i.shift(),a=t.groupIndices.indexOf(l.start));let u;c.index===l.start?u={index:a,type:"group"}:u={groupIndex:a,index:c.index-(a+1)+n},s.push({...u,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function wn(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const qe=q(([{data:e,firstItemIndex:t,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:a},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:g},p,{didMount:S},{recalcInProgress:R}])=>{const E=I([]),v=I(0),f=Y(),h=I(0);B(s.topItemsIndexes,E);const b=Te(T(de(S,R,N(a,lt),N(r),N(o),N(c),u,N(E),N(t),N(n),N(h),e),_(([d,C,,y,,,,,,,,k])=>{const H=k&&k.length!==y;return d&&!C&&!H}),O(([,,[d,C],y,k,H,F,D,A,V,X,K])=>{var ve,we,Ce,w;const L=k,{offsetTree:J,sizeTree:Q}=L,Be=ae(v);if(y===0)return{...zt,totalCount:y};if(d===0&&C===0)return Be===0?{...zt,totalCount:y}:Kn(Be,H,k,A,V,K||[]);if(ne(Q))return Be>0?null:Ct(Tr(Yt(H,y),L,K),[],y,V,L,A);const Me=[];if(D.length>0){const fe=D[0],ce=D[D.length-1];let me=0;for(const ue of Ke(Q,fe,ce)){const te=ue.value,re=Math.max(ue.start,fe),ke=Math.min(ue.end,ce);for(let ge=re;ge<=ke;ge++)Me.push({data:K?.[ge],index:ge,offset:me,size:te}),me+=te}}if(!F)return Ct([],Me,y,V,L,A);const ee=D.length>0?D[D.length-1]+1:0,j=ur(J,d,C,ee);if(j.length===0)return null;const G=y-1,oe=yt([],fe=>{for(const ce of j){const me=ce.value;let ue=me.offset,te=ce.start;const re=me.size;if(me.offset<d){te+=Math.floor((d-me.offset+V)/(re+V));const ge=te-ce.start;ue+=ge*re+ge*V}te<ee&&(ue+=(ee-te)*re,te=ee);const ke=Math.min(ce.end,G);for(let ge=te;ge<=ke&&!(ue>=C);ge++)fe.push({data:K?.[ge],index:ge,offset:ue,size:re}),ue+=re+V}}),pe=wn(X,ut),Ee=wn(X,dt);if(oe.length>0&&(pe>0||Ee>0)){const fe=oe[0],ce=oe[oe.length-1];if(pe>0&&fe.index>ee){const me=Math.min(pe,fe.index-ee),ue=[];let te=fe.offset;for(let re=fe.index-1;re>=fe.index-me;re--){const ke=(we=(ve=Ke(Q,re,re)[0])==null?void 0:ve.value)!=null?we:fe.size;te-=ke+V,ue.unshift({data:K?.[re],index:re,offset:te,size:ke})}oe.unshift(...ue)}if(Ee>0&&ce.index<G){const me=Math.min(Ee,G-ce.index);let ue=ce.offset+ce.size+V;for(let te=ce.index+1;te<=ce.index+me;te++){const re=(w=(Ce=Ke(Q,te,te)[0])==null?void 0:Ce.value)!=null?w:ce.size;oe.push({data:K?.[te],index:te,offset:ue,size:re}),ue+=re+V}}}return Ct(oe,Me,y,V,L,A)}),_(d=>d!==null),se()),zt);B(T(e,_(Dt),O(d=>d?.length)),r),B(T(b,O(d=>d.topListHeight)),g),B(g,l),B(T(b,O(d=>[d.top,d.bottom])),i),B(T(b,O(d=>d.items)),f);const P=Re(T(b,_(({items:d})=>d.length>0),U(r,e),_(([{items:d},C])=>d[d.length-1].originalIndex===C-1),O(([,d,C])=>[d-1,C]),se(lt),O(([d])=>d))),z=Re(T(b,_e(200),_(({items:d,topItems:C})=>d.length>0&&d[0].originalIndex===C.length),O(({items:d})=>d[0].index),se())),M=Re(T(b,_(({items:d})=>d.length>0),O(({items:d})=>{let C=0,y=d.length-1;for(;d[C].type==="group"&&C<y;)C++;for(;d[y].type==="group"&&y>C;)y--;return{endIndex:d[y].index,startIndex:d[C].index}}),se(Un)));return{endReached:P,initialItemCount:v,itemsRendered:f,listState:b,minOverscanItemCount:h,rangeChanged:M,startReached:z,topItemsIndexes:E,...p}},ie(Ne,qn,Jt,ht,ft,mt,Ve,$t),{singleton:!0}),Qn=q(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=Y(),i=Te(T(de(n,e,o,t,r),O(([l,a,c,u,g])=>l+a+c+u+g.offsetBottom+g.bottom)),0);return B(N(i),s),{totalListHeight:i,totalListHeightChanged:s}},ie(be,qe),{singleton:!0}),br=q(([{viewportHeight:e},{totalListHeight:t}])=>{const n=I(!1),o=Te(T(de(n,e,t),_(([r])=>r),O(([,r,s])=>Math.max(0,r-s)),_e(0),se()),0);return{alignToBottom:n,paddingTopAddition:o}},ie(be,Qn),{singleton:!0}),eo=q(()=>({context:I(null)})),yr=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:o,...r},viewportBottom:s,viewportTop:i})=>t<i?{...r,align:n??"start",behavior:o}:e>s?{...r,align:n??"end",behavior:o}:null,to=q(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:a},{scrollToIndex:c}])=>{const u=Y();return B(T(u,U(t,a,n,s,r,o,l),U(e),O(([[g,p,S,R,E,v,f,h],b])=>{const{align:P,behavior:z,calculateViewLocation:M=yr,done:d,...C}=g,y=Jn(g,p,R-1),k=at(y,p.offsetTree,b)+E+v,H=k+He(p.sizeTree,y)[1],F=h+v,D=h+S-f,A=M({itemBottom:H,itemTop:k,locationParams:{align:P,behavior:z,...C},viewportBottom:D,viewportTop:F});return A?d&&Pe(T(i,_(V=>!V),Ge(ae(i)?1:2)),d):d&&d(),A}),_(g=>g!==null)),c),{scrollIntoView:u}},ie(Ne,be,ft,qe,We),{singleton:!0});function Cn(e){return e?e==="smooth"?"smooth":"auto":!1}const Ir=(e,t)=>typeof e=="function"?Cn(e(t)):t&&Cn(e),Rr=q(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:a,propsReady:c},{log:u},{scrollingInProgress:g},{context:p},{scrollIntoView:S}])=>{const R=I(!1),E=Y();let v=null;function f(z){$(i,{align:"end",behavior:z,index:"LAST"})}Z(T(de(T(N(t),Ge(1)),a),U(N(R),s,l,g),O(([[z,M],d,C,y,k])=>{let H=M&&y,F="auto";return H&&(F=Ir(d,C||k),H=H&&!!F),{followOutputBehavior:F,shouldFollow:H,totalCount:z}}),_(({shouldFollow:z})=>z)),({followOutputBehavior:z,totalCount:M})=>{v&&(v(),v=null),ae(n)?requestAnimationFrame(()=>{ae(u)("following output to ",{totalCount:M},ye.DEBUG),f(z)}):v=Pe(e,()=>{ae(u)("following output to ",{totalCount:M},ye.DEBUG),f(z),v=null})});function h(z){const M=Pe(r,d=>{z&&!d.atBottom&&d.notAtBottomBecause==="SIZE_INCREASED"&&!v&&(ae(u)("scrolling to bottom due to increased size",{},ye.DEBUG),f("auto"))});setTimeout(M,100)}Z(T(de(N(R),t,c),_(([z,,M])=>z&&M),Le(({value:z},[,M])=>({refreshed:z===M,value:M}),{refreshed:!1,value:0}),_(({refreshed:z})=>z),U(R,t)),([,z])=>{ae(l)&&h(z!==!1)}),Z(E,()=>{h(ae(R)!==!1)}),Z(de(N(R),r),([z,M])=>{z&&!M.atBottom&&M.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const b=I(null),P=Y();return B(Bt(T(N(o),O(z=>{var M;return(M=z?.length)!=null?M:0})),T(N(t))),P),Z(T(de(T(P,Ge(1)),a),U(N(b),l,g,p),O(([[z,M],d,C,y,k])=>M&&C&&d?.({context:k,totalCount:z,scrollingInProgress:y})),_(z=>!!z),_e(0)),z=>{v&&(v(),v=null),ae(n)?requestAnimationFrame(()=>{ae(u)("scrolling into view",{}),$(S,z)}):v=Pe(e,()=>{ae(u)("scrolling into view",{}),$(S,z),v=null})}),{autoscrollToBottom:E,followOutput:R,scrollIntoViewOnChange:b}},ie(Ne,mt,ft,ht,Ve,We,be,eo,to)),Er=q(([{data:e,firstItemIndex:t,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(B(T(l,U(s),_(([,a])=>a!==0),U(r,o,t,n,e),O(([[,a],c,u,g,p,S=[]])=>Kn(a,c,u,g,p,S))),i),{}),ie(Ne,ht,qe,Ve),{singleton:!0}),kr=q(([{didMount:e},{scrollTo:t},{listState:n}])=>{const o=I(0);return Z(T(e,U(o),_(([,r])=>r!==0),O(([,r])=>({top:r}))),r=>{Pe(T(n,Ge(1),_(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{$(t,r)})})}),{initialScrollTop:o}},ie(Ve,be,qe),{singleton:!0}),no=q(([{scrollVelocity:e}])=>{const t=I(!1),n=Y(),o=I(!1);return B(T(e,U(o,t,n),_(([r,s])=>!!s),O(([r,s,i,l])=>{const{enter:a,exit:c}=s;if(i){if(c(r,l))return!1}else if(a(r,l))return!0;return i}),se()),t),Z(T(de(t,e,n),U(o)),([[r,s,i],l])=>{r&&l&&l.change&&l.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:e}},ie(mt),{singleton:!0}),qt=q(([{scrollContainerState:e,scrollTo:t}])=>{const n=Y(),o=Y(),r=Y(),s=I(!1),i=I(void 0);return B(T(de(n,o),O(([{scrollHeight:l,scrollTop:a,viewportHeight:c},{offsetTop:u}])=>({scrollHeight:l,scrollTop:Math.max(0,a-u),viewportHeight:c}))),e),B(T(t,U(o),O(([l,{offsetTop:a}])=>({...l,top:l.top+a}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},ie(be)),jr=q(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:a}])=>{const c=Y(),u=I(void 0),g=I(null),p=I(null);return B(l,g),B(a,p),Z(T(c,U(t,o,i,g,p,n)),([S,R,E,v,f,h,b])=>{const P=fr(R.sizeTree);v&&f!==null&&h!==null&&(E=f.scrollTop-h.offsetTop),E-=b,S({ranges:P,scrollTop:E})}),B(T(u,_(Dt),O(zr)),r),B(T(s,U(u),_(([,S])=>S!==void 0),se(),O(([,S])=>S.ranges)),e),{getState:c,restoreStateFrom:u}},ie(Ne,be,ht,Ve,qt));function zr(e){return{align:"start",index:0,offset:e.scrollTop}}const Or=q(([{topItemsIndexes:e}])=>{const t=I(0);return B(T(t,_(n=>n>=0),O(n=>Array.from({length:n}).map((o,r)=>r))),e),{topItemCount:t}},ie(qe));function oo(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const Pr=oo(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Hr=q(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:o},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:l},{listState:a},{beforeUnshiftWith:c,gap:u,shiftWithOffset:g,sizes:p},{log:S},{recalcInProgress:R}])=>{const E=Re(T(a,U(i),Le(([,f,h,b],[{bottom:P,items:z,offsetBottom:M,totalCount:d},C])=>{const y=P+M;let k=0;return h===d&&f.length>0&&z.length>0&&(z[0].originalIndex===0&&f[0].originalIndex===0||(k=y-b,k!==0&&(k+=C))),[k,z,d,y]},[0,[],0,0]),_(([f])=>f!==0),U(o,l,n,r,S,R),_(([,f,h,b,,,P])=>!P&&!b&&f!==0&&h===ct),O(([[f],,,,,h])=>(h("Upward scrolling compensation",{amount:f},ye.DEBUG),f))));function v(f){f>0?($(t,{behavior:"auto",top:-f}),$(e,0)):($(e,0),$(t,{behavior:"auto",top:-f}))}return Z(T(E,U(e,s)),([f,h,b])=>{b&&Pr()?$(e,h-f):v(-f)}),Z(T(de(Te(s,!1),e,R),_(([f,h,b])=>!f&&!b&&h!==0),O(([f,h])=>h),_e(1)),v),B(T(g,O(f=>({top:-f}))),t),Z(T(c,U(p,u),O(([f,{groupIndices:h,lastSize:b,sizeTree:P},z])=>{function M(d){return d*(b+z)}if(h.length===0)return M(f);{let d=0;const C=it(P,0);let y=0,k=0;for(;y<f;){y++,d+=C;let H=h.length===k+1?1/0:h[k+1]-h[k]-1;y+H>f&&(d-=C,H=f-y+1),y+=H,d+=M(H),k++}return d}})),f=>{$(e,f),requestAnimationFrame(()=>{$(t,{top:f}),requestAnimationFrame(()=>{$(e,0),$(R,!1)})})}),{deviation:e}},ie(be,mt,qe,Ne,We,$t)),Br=q(([e,t,n,o,r,s,i,l,a,c,u])=>({...e,...t,...n,...o,...r,...s,...i,...l,...a,...c,...u}),ie(Jt,Er,Ve,no,Qn,kr,br,qt,to,We,eo)),ro=q(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:o,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:l,itemSize:a,sizeRanges:c,sizes:u,statefulTotalCount:g,totalCount:p,trackItemSizes:S},{initialItemFinalLocationReached:R,initialTopMostItemIndex:E,scrolledToInitialItem:v},f,h,b,P,{scrollToIndex:z},M,{topItemCount:d},{groupCounts:C},y])=>{const{listState:k,minOverscanItemCount:H,topItemsIndexes:F,rangeChanged:D,...A}=P;return B(D,y.scrollSeekRangeChanged),B(T(y.windowViewportRect,O(V=>V.visibleHeight)),f.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:o,fixedGroupHeight:r,gap:s,groupCounts:C,heightEstimates:l,initialItemFinalLocationReached:R,initialTopMostItemIndex:E,scrolledToInitialItem:v,sizeRanges:c,topItemCount:d,topItemsIndexes:F,totalCount:p,...b,groupIndices:i,itemSize:a,listState:k,minOverscanItemCount:H,scrollToIndex:z,statefulTotalCount:g,trackItemSizes:S,rangeChanged:D,...A,...y,...f,sizes:u,...h}},ie(Ne,ht,be,jr,Rr,qe,ft,Hr,Or,qn,Br));function Mr(e,t){const n={},o={};let r=0;const s=e.length;for(;r<s;)o[e[r]]=1,r+=1;for(const i in t)Object.hasOwn(o,i)||(n[i]=t[i]);return n}const xt=typeof document<"u"?x.useLayoutEffect:x.useEffect;function so(e,t,n){const o=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),l=x.createContext({});function a(v,f){v.propsReady&&$(v.propsReady,!1);for(const h of o){const b=v[t.required[h]];$(b,f[h])}for(const h of r)if(h in f){const b=v[t.optional[h]];$(b,f[h])}v.propsReady&&$(v.propsReady,!0)}function c(v){return s.reduce((f,h)=>(f[h]=b=>{const P=v[t.methods[h]];$(P,b)},f),{})}function u(v){return i.reduce((f,h)=>(f[h]=Zo(v[t.events[h]]),f),{})}const g=x.forwardRef((v,f)=>{const{children:h,...b}=v,[P]=x.useState(()=>yt(Qo(e),d=>{a(d,b)})),[z]=x.useState(un(u,P));xt(()=>{for(const d of i)d in b&&Z(z[d],b[d]);return()=>{Object.values(z).map(Wt)}},[b,z,P]),xt(()=>{a(P,b)}),x.useImperativeHandle(f,cn(c(P)));const M=n;return m.jsx(l.Provider,{value:P,children:n?m.jsx(M,{...Mr([...o,...r,...i],b),children:h}):h})}),p=v=>{const f=x.useContext(l);return x.useCallback(h=>{$(f[v],h)},[f,v])},S=v=>{const f=x.useContext(l)[v],h=x.useCallback(b=>Z(f,b),[f]);return x.useSyncExternalStore(h,()=>ae(f),()=>ae(f))},R=v=>{const f=x.useContext(l)[v],[h,b]=x.useState(un(ae,f));return xt(()=>Z(f,P=>{P!==h&&b(cn(P))}),[f,h]),h},E=x.version.startsWith("18")?S:R;return{Component:g,useEmitter:(v,f)=>{const h=x.useContext(l)[v];xt(()=>Z(h,f),[f,h])},useEmitterValue:E,usePublisher:p}}const io=x.createContext(void 0),lo=x.createContext(void 0),ao=typeof document<"u"?x.useLayoutEffect:x.useEffect;function Ot(e){return"self"in e}function Ar(e){return"body"in e}function co(e,t,n,o=et,r,s){const i=x.useRef(null),l=x.useRef(null),a=x.useRef(null),c=x.useCallback(p=>{let S,R,E;const v=p.target;if(Ar(v)||Ot(v)){const h=Ot(v)?v:v.defaultView;E=s?h.scrollX:h.scrollY,S=s?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight,R=s?h.innerWidth:h.innerHeight}else E=s?v.scrollLeft:v.scrollTop,S=s?v.scrollWidth:v.scrollHeight,R=s?v.offsetWidth:v.offsetHeight;const f=()=>{e({scrollHeight:S,scrollTop:Math.max(E,0),viewportHeight:R})};p.suppressFlushSync?f():zn.flushSync(f),l.current!==null&&(E===l.current||E<=0||E===S-R)&&(l.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t,s]);x.useEffect(()=>{const p=r||i.current;return o(r||i.current),c({suppressFlushSync:!0,target:p}),p.addEventListener("scroll",c,{passive:!0}),()=>{o(null),p.removeEventListener("scroll",c)}},[i,c,n,o,r]);function u(p){const S=i.current;if(!S||(s?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const R=p.behavior==="smooth";let E,v,f;Ot(S)?(v=Math.max(Fe(S.document.documentElement,s?"width":"height"),s?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),E=s?S.innerWidth:S.innerHeight,f=s?window.scrollX:window.scrollY):(v=S[s?"scrollWidth":"scrollHeight"],E=Fe(S,s?"width":"height"),f=S[s?"scrollLeft":"scrollTop"]);const h=v-E;if(p.top=Math.ceil(Math.max(Math.min(h,p.top),0)),Zn(E,v)||p.top===f){e({scrollHeight:v,scrollTop:f,viewportHeight:E}),R&&t(!0);return}R?(l.current=p.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,l.current=null,t(!0)},1e3)):l.current=null,s&&(p={behavior:p.behavior,left:p.top}),S.scrollTo(p)}function g(p){s&&(p={behavior:p.behavior,left:p.top}),i.current.scrollBy(p)}return{scrollByCallback:g,scrollerRef:i,scrollToCallback:u}}const Pt="-webkit-sticky",Sn="sticky",Xt=oo(()=>{if(typeof document>"u")return Sn;const e=document.createElement("div");return e.style.position=Pt,e.style.position===Pt?Pt:Sn});function Zt(e){return e}const Lr=q(()=>{const e=I(l=>`Item ${l}`),t=I(l=>`Group ${l}`),n=I({}),o=I(Zt),r=I("div"),s=I(et),i=(l,a=null)=>Te(T(n,O(c=>c[l]),se()),a);return{components:n,computeItemKey:o,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),Nr=q(([e,t])=>({...e,...t}),ie(ro,Lr)),_r=({height:e})=>m.jsx("div",{style:{height:e}}),Fr={overflowAnchor:"none",position:Xt(),zIndex:1},uo={overflowAnchor:"none"},Dr={...uo,display:"inline-block",height:"100%"},Tn=x.memo(function({showTopList:e=!1}){const t=W("listState"),n=je("sizeRanges"),o=W("useWindowScroll"),r=W("customScrollParent"),s=je("windowScrollContainerState"),i=je("scrollContainerState"),l=r||o?s:i,a=W("itemContent"),c=W("context"),u=W("groupContent"),g=W("trackItemSizes"),p=W("itemSize"),S=W("log"),R=je("gap"),E=W("horizontalDirection"),{callbackRef:v}=nr(n,p,g,e?et:l,S,R,r,E,W("skipAnimationFrameInResizeObserver")),[f,h]=x.useState(0);Kt("deviation",A=>{f!==A&&h(A)});const b=W("EmptyPlaceholder"),P=W("ScrollSeekPlaceholder")||_r,z=W("ListComponent"),M=W("ItemComponent"),d=W("GroupComponent"),C=W("computeItemKey"),y=W("isSeeking"),k=W("groupIndices").length>0,H=W("alignToBottom"),F=W("initialItemFinalLocationReached"),D=e?{}:{boxSizing:"border-box",...E?{display:"inline-block",height:"100%",marginLeft:f!==0?f:H?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:f!==0?f:H?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...F?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&b?m.jsx(b,{...Se(b,c)}):m.jsx(z,{...Se(z,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:D,children:(e?t.topItems:t.items).map(A=>{const V=A.originalIndex,X=C(V+t.firstItemIndex,A.data,c);return y?x.createElement(P,{...Se(P,c),height:A.size,index:A.index,key:X,type:A.type||"item",...A.type==="group"?{}:{groupIndex:A.groupIndex}}):A.type==="group"?x.createElement(d,{...Se(d,c),"data-index":V,"data-item-index":A.index,"data-known-size":A.size,key:X,style:Fr},u(A.index,c)):x.createElement(M,{...Se(M,c),...Ur(M,A.data),"data-index":V,"data-item-group-index":A.groupIndex,"data-item-index":A.index,"data-known-size":A.size,key:X,style:E?Dr:uo},k?a(A.index,A.groupIndex,A.data,c):a(A.index,A.data,c))})})}),Wr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Vr={outline:"none",overflowX:"auto",position:"relative"},Rt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),$r={position:Xt(),top:0,width:"100%",zIndex:1};function Se(e,t){if(typeof e!="string")return{context:t}}function Ur(e,t){return{item:typeof e=="string"?void 0:t}}const Gr=x.memo(function(){const e=W("HeaderComponent"),t=je("headerHeight"),n=W("HeaderFooterTag"),o=Je(x.useMemo(()=>s=>{t(Fe(s,"height"))},[t]),!0,W("skipAnimationFrameInResizeObserver")),r=W("context");return e?m.jsx(n,{ref:o,children:m.jsx(e,{...Se(e,r)})}):null}),Yr=x.memo(function(){const e=W("FooterComponent"),t=je("footerHeight"),n=W("HeaderFooterTag"),o=Je(x.useMemo(()=>s=>{t(Fe(s,"height"))},[t]),!0,W("skipAnimationFrameInResizeObserver")),r=W("context");return e?m.jsx(n,{ref:o,children:m.jsx(e,{...Se(e,r)})}):null});function fo({useEmitter:e,useEmitterValue:t,usePublisher:n}){return x.memo(function({children:o,style:r,context:s,...i}){const l=n("scrollContainerState"),a=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("scrollerRef"),g=t("horizontalDirection")||!1,{scrollByCallback:p,scrollerRef:S,scrollToCallback:R}=co(l,c,a,u,void 0,g);return e("scrollTo",R),e("scrollBy",p),m.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?Vr:Wr,...r},tabIndex:0,...i,...Se(a,s),children:o})})}function ho({useEmitter:e,useEmitterValue:t,usePublisher:n}){return x.memo(function({children:o,style:r,context:s,...i}){const l=n("windowScrollContainerState"),a=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("totalListHeight"),g=t("deviation"),p=t("customScrollParent"),S=x.useRef(null),R=t("scrollerRef"),{scrollByCallback:E,scrollerRef:v,scrollToCallback:f}=co(l,c,a,R,p);return ao(()=>{var h;return v.current=p||((h=S.current)==null?void 0:h.ownerDocument.defaultView),()=>{v.current=null}},[v,p]),e("windowScrollTo",f),e("scrollBy",E),m.jsx(a,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...u!==0?{height:u+g}:{}},...i,...Se(a,s),children:o})})}const Jr=({children:e})=>{const t=x.useContext(io),n=je("viewportHeight"),o=je("fixedItemHeight"),r=W("alignToBottom"),s=W("horizontalDirection"),i=x.useMemo(()=>Ln(n,a=>Fe(a,s?"width":"height")),[n,s]),l=Je(i,!0,W("skipAnimationFrameInResizeObserver"));return x.useEffect(()=>{t&&(n(t.viewportHeight),o(t.itemHeight))},[t,n,o]),m.jsx("div",{"data-viewport-type":"element",ref:l,style:Rt(r),children:e})},qr=({children:e})=>{const t=x.useContext(io),n=je("windowViewportRect"),o=je("fixedItemHeight"),r=W("customScrollParent"),s=_n(n,r,W("skipAnimationFrameInResizeObserver")),i=W("alignToBottom");return x.useEffect(()=>{t&&(o(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,o]),m.jsx("div",{"data-viewport-type":"window",ref:s,style:Rt(i),children:e})},Xr=({children:e})=>{const t=W("TopItemListComponent")||"div",n=W("headerHeight"),o={...$r,marginTop:`${n}px`},r=W("context");return m.jsx(t,{style:o,...Se(t,r),children:e})},Zr=x.memo(function(e){const t=W("useWindowScroll"),n=W("topItemsIndexes").length>0,o=W("customScrollParent"),r=W("context");return m.jsxs(o||t?es:Qr,{...e,context:r,children:[n&&m.jsx(Xr,{children:m.jsx(Tn,{showTopList:!0})}),m.jsxs(o||t?qr:Jr,{children:[m.jsx(Gr,{}),m.jsx(Tn,{}),m.jsx(Yr,{})]})]})}),{Component:Kr,useEmitter:Kt,useEmitterValue:W,usePublisher:je}=so(Nr,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Zr),Qr=fo({useEmitter:Kt,useEmitterValue:W,usePublisher:je}),es=ho({useEmitter:Kt,useEmitterValue:W,usePublisher:je}),ts=Kr,ns=q(()=>{const e=I(c=>m.jsxs("td",{children:["Item $",c]})),t=I(null),n=I(c=>m.jsxs("td",{colSpan:1e3,children:["Group ",c]})),o=I(null),r=I(null),s=I({}),i=I(Zt),l=I(et),a=(c,u=null)=>Te(T(s,O(g=>g[c]),se()),u);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:e,groupContent:n,ScrollerComponent:a("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr"),GroupComponent:a("Group","tr")}});ie(ro,ns);Xt();const bn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},os={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:yn,floor:Tt,max:rt,min:Ht,round:In}=Math;function Rn(e,t,n){return Array.from({length:t-e+1}).map((o,r)=>({data:n===null?null:n[r+e],index:r+e}))}function rs(e){return{...os,items:e}}function vt(e,t){return e&&e.width===t.width&&e.height===t.height}function ss(e,t){return e&&e.column===t.column&&e.row===t.row}const is=q(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:a,scrollTop:c,smoothScrollTargetReached:u,viewportHeight:g},p,S,{didMount:R,propsReady:E},{customScrollParent:v,useWindowScroll:f,windowScrollContainerState:h,windowScrollTo:b,windowViewportRect:P},z])=>{const M=I(0),d=I(0),C=I(bn),y=I({height:0,width:0}),k=I({height:0,width:0}),H=Y(),F=Y(),D=I(0),A=I(null),V=I({column:0,row:0}),X=Y(),K=Y(),ve=I(!1),we=I(0),Ce=I(!0),w=I(!1),L=I(!1);Z(T(R,U(we),_(([j,G])=>!!G)),()=>{$(Ce,!1)}),Z(T(de(R,Ce,k,y,we,w),_(([j,G,oe,pe,,Ee])=>j&&!G&&oe.height!==0&&pe.height!==0&&!Ee)),([,,,,j])=>{$(w,!0),Gt(1,()=>{$(H,j)}),Pe(T(c),()=>{$(t,[0,0]),$(Ce,!0)})}),B(T(K,_(j=>j!=null&&j.scrollTop>0),Ae(0)),d),Z(T(R,U(K),_(([,j])=>j!=null)),([,j])=>{j&&($(y,j.viewport),$(k,j.item),$(V,j.gap),j.scrollTop>0&&($(ve,!0),Pe(T(c,Ge(1)),G=>{$(ve,!1)}),$(a,{top:j.scrollTop})))}),B(T(y,O(({height:j})=>j)),g),B(T(de(N(y,vt),N(k,vt),N(V,(j,G)=>j&&j.column===G.column&&j.row===G.row),N(c)),O(([j,G,oe,pe])=>({gap:oe,item:G,scrollTop:pe,viewport:j}))),X),B(T(de(N(M),o,N(V,ss),N(k,vt),N(y,vt),N(A),N(d),N(ve),N(Ce),N(we)),_(([,,,,,,,j])=>!j),O(([j,[G,oe],pe,Ee,fe,ce,me,,ue,te])=>{const{column:re,row:ke}=pe,{height:ge,width:Et}=Ee,{width:Qt}=fe;if(me===0&&(j===0||Qt===0))return bn;if(Et===0){const rn=Yt(te,j),So=rn+Math.max(me-1,0);return rs(Rn(rn,So,ce))}const pt=mo(Qt,Et,re);let Xe,$e;ue?G===0&&oe===0&&me>0?(Xe=0,$e=me-1):(Xe=pt*Tt((G+ke)/(ge+ke)),$e=pt*yn((oe+ke)/(ge+ke))-1,$e=Ht(j-1,rt($e,pt-1)),Xe=Ht($e,rt(0,Xe))):(Xe=0,$e=-1);const en=Rn(Xe,$e,ce),{bottom:tn,top:nn}=En(fe,pe,Ee,en),on=yn(j/pt),Co=on*ge+(on-1)*ke-tn;return{bottom:tn,itemHeight:ge,items:en,itemWidth:Et,offsetBottom:Co,offsetTop:nn,top:nn}})),C),B(T(A,_(j=>j!==null),O(j=>j.length)),M),B(T(de(y,k,C,V),_(([j,G,{items:oe}])=>oe.length>0&&G.height!==0&&j.height!==0),O(([j,G,{items:oe},pe])=>{const{bottom:Ee,top:fe}=En(j,pe,G,oe);return[fe,Ee]}),se(lt)),t);const J=I(!1);B(T(c,U(J),O(([j,G])=>G||j!==0)),J);const Q=Re(T(de(C,M),_(([{items:j}])=>j.length>0),U(J),_(([[j,G],oe])=>{const pe=j.items[j.items.length-1].index===G-1;return(oe||j.bottom>0&&j.itemHeight>0&&j.offsetBottom===0&&j.items.length===G)&&pe}),O(([[,j]])=>j-1),se())),Be=Re(T(N(C),_(({items:j})=>j.length>0&&j[0].index===0),Ae(0),se())),Me=Re(T(N(C),U(ve),_(([{items:j},G])=>j.length>0&&!G),O(([{items:j}])=>({endIndex:j[j.length-1].index,startIndex:j[0].index})),se(Un),_e(0)));B(Me,S.scrollSeekRangeChanged),B(T(H,U(y,k,M,V),O(([j,G,oe,pe,Ee])=>{const fe=Xn(j),{align:ce,behavior:me,offset:ue}=fe;let te=fe.index;te==="LAST"&&(te=pe-1),te=rt(0,te,Ht(pe-1,te));let re=_t(G,Ee,oe,te);return ce==="end"?re=In(re-G.height+oe.height):ce==="center"&&(re=In(re-G.height/2+oe.height/2)),ue&&(re+=ue),{behavior:me,top:re}})),a);const ee=Te(T(C,O(j=>j.offsetBottom+j.bottom)),0);return B(T(P,O(j=>({height:j.visibleHeight,width:j.visibleWidth}))),y),{customScrollParent:v,data:A,deviation:D,footerHeight:r,gap:V,headerHeight:s,increaseViewportBy:e,initialItemCount:d,itemDimensions:k,overscan:n,restoreStateFrom:K,scrollBy:i,scrollContainerState:l,scrollHeight:F,scrollTo:a,scrollToIndex:H,scrollTop:c,smoothScrollTargetReached:u,totalCount:M,useWindowScroll:f,viewportDimensions:y,windowScrollContainerState:h,windowScrollTo:b,windowViewportRect:P,...S,gridState:C,horizontalDirection:L,initialTopMostItemIndex:we,totalListHeight:ee,...p,endReached:Q,propsReady:E,rangeChanged:Me,startReached:Be,stateChanged:X,stateRestoreInProgress:ve,...z}},ie(Jt,be,mt,no,Ve,qt,We));function mo(e,t,n){return rt(1,Tt((e+n)/(Tt(t)+n)))}function En(e,t,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=_t(e,t,n,o[0].index);return{bottom:_t(e,t,n,o[o.length-1].index)+r,top:s}}function _t(e,t,n,o){const r=mo(e.width,n.width,t.column),s=Tt(o/r),i=s*n.height+rt(0,s-1)*t.row;return i>0?i+t.row:i}const ls=q(()=>{const e=I(g=>`Item ${g}`),t=I({}),n=I(null),o=I("virtuoso-grid-item"),r=I("virtuoso-grid-list"),s=I(Zt),i=I("div"),l=I(et),a=(g,p=null)=>Te(T(t,O(S=>S[g]),se()),p),c=I(!1),u=I(!1);return B(N(u),c),{components:t,computeItemKey:s,context:n,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:a("Item","div"),itemContent:e,listClassName:r,ListComponent:a("List","div"),readyStateChanged:c,reportReadyState:u,ScrollerComponent:a("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),as=q(([e,t])=>({...e,...t}),ie(is,ls)),cs=x.memo(function(){const e=le("gridState"),t=le("listClassName"),n=le("itemClassName"),o=le("itemContent"),r=le("computeItemKey"),s=le("isSeeking"),i=ze("scrollHeight"),l=le("ItemComponent"),a=le("ListComponent"),c=le("ScrollSeekPlaceholder"),u=le("context"),g=ze("itemDimensions"),p=ze("gap"),S=le("log"),R=le("stateRestoreInProgress"),E=ze("reportReadyState"),v=Je(x.useMemo(()=>f=>{const h=f.parentElement.parentElement.scrollHeight;i(h);const b=f.firstChild;if(b){const{height:P,width:z}=b.getBoundingClientRect();g({height:P,width:z})}p({column:kn("column-gap",getComputedStyle(f).columnGap,S),row:kn("row-gap",getComputedStyle(f).rowGap,S)})},[i,g,p,S]),!0,!1);return ao(()=>{e.itemHeight>0&&e.itemWidth>0&&E(!0)},[e]),R?null:m.jsx(a,{className:t,ref:v,...Se(a,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(f=>{const h=r(f.index,f.data,u);return s?m.jsx(c,{...Se(c,u),height:e.itemHeight,index:f.index,width:e.itemWidth},h):x.createElement(l,{...Se(l,u),className:n,"data-index":f.index,key:h},o(f.index,f.data,u))})})}),us=x.memo(function(){const e=le("HeaderComponent"),t=ze("headerHeight"),n=le("headerFooterTag"),o=Je(x.useMemo(()=>s=>{t(Fe(s,"height"))},[t]),!0,!1),r=le("context");return e?m.jsx(n,{ref:o,children:m.jsx(e,{...Se(e,r)})}):null}),ds=x.memo(function(){const e=le("FooterComponent"),t=ze("footerHeight"),n=le("headerFooterTag"),o=Je(x.useMemo(()=>s=>{t(Fe(s,"height"))},[t]),!0,!1),r=le("context");return e?m.jsx(n,{ref:o,children:m.jsx(e,{...Se(e,r)})}):null}),fs=({children:e})=>{const t=x.useContext(lo),n=ze("itemDimensions"),o=ze("viewportDimensions"),r=Je(x.useMemo(()=>s=>{o(s.getBoundingClientRect())},[o]),!0,!1);return x.useEffect(()=>{t&&(o({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,o,n]),m.jsx("div",{ref:r,style:Rt(!1),children:e})},hs=({children:e})=>{const t=x.useContext(lo),n=ze("windowViewportRect"),o=ze("itemDimensions"),r=le("customScrollParent"),s=_n(n,r,!1);return x.useEffect(()=>{t&&(o({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,o]),m.jsx("div",{ref:s,style:Rt(!1),children:e})},ms=x.memo(function({...e}){const t=le("useWindowScroll"),n=le("customScrollParent"),o=n||t?gs:ps,r=n||t?hs:fs,s=le("context");return m.jsx(o,{...e,...Se(o,s),children:m.jsxs(r,{children:[m.jsx(us,{}),m.jsx(cs,{}),m.jsx(ds,{})]})})}),{useEmitter:po,useEmitterValue:le,usePublisher:ze}=so(as,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},ms),ps=fo({useEmitter:po,useEmitterValue:le,usePublisher:ze}),gs=ho({useEmitter:po,useEmitterValue:le,usePublisher:ze});function kn(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ye.WARN),t==="normal"?0:parseInt(t??"0",10)}const xs=({visible:e,onClick:t})=>e?m.jsx("button",{type:"button",className:"chat-scroll-bottom",onClick:t,"aria-label":"Scroll to bottom",children:m.jsx("img",{src:Mn,alt:"arrow up",width:24,height:24,style:{transform:"rotate(180deg)",filter:"var(--icon-filter-text)"}})}):null,vs=()=>{const{messages:e=[],classNames:t,isOpen:n,isLoading:o}=Ye(),[r,s]=x.useState(!1),i=x.useRef(null),l=()=>{i.current?.scrollToIndex({index:e.length-1,behavior:"smooth"})},a=e?.length??1;return x.useEffect(()=>{n&&setTimeout(l,0)},[n]),x.useEffect(()=>{l()},[e?.length]),m.jsxs("div",{className:Oe("autoui-chat-messages",t?.messageList),children:[m.jsx(ts,{ref:i,data:e,overscan:100,followOutput:"smooth",atBottomStateChange:c=>s(!c),components:{EmptyPlaceholder:()=>m.jsxs("div",{className:"empty__palceholder",children:[m.jsx("span",{className:"empty__palceholder--main",children:"Nothing here yet"}),m.jsx("span",{className:"empty__palceholder--secondary",children:"Start the conversation!"})]})},initialTopMostItemIndex:a-1,itemContent:(c,u)=>m.jsx("div",{className:Oe("autoui-message-row",u.role==="user"&&"is-user",u.role==="assistant"&&"is-assistant"),children:m.jsx(Uo,{message:u})})}),m.jsx(xs,{visible:r,onClick:l}),o&&m.jsx(Ro,{variant:"dots",color:"#0a84ff"})]})};async function go(e){const t=e.getReader(),n=new TextDecoder;let o="",r="";for(;;){const{value:i,done:l}=await t.read();if(l)break;o+=n.decode(i,{stream:!0});const a=o.split(`
|
|
8
|
+
|
|
9
|
+
`);o=a.pop()??"";for(const c of a){if(!c.startsWith("data:"))continue;const u=c.slice(5).trim();if(u==="[DONE]"){t.cancel();break}try{const p=JSON.parse(u).choices?.[0]?.delta?.content;p&&(r+=p)}catch{}}}const s=r.match(/\{[\s\S]*\}$/);if(!s)throw new Error("LLM did not return valid JSON InstructionPlan");return JSON.parse(s[0])}function ws(e,t){const n=Object.entries(t.functions).map(([i,l])=>{const a=l.params?Object.entries(l.params).map(([c,u])=>`- ${c}: ${u}`).join(`
|
|
8
10
|
`):"(no documented params)";return`FUNCTION ${i}:
|
|
9
11
|
Description: ${l.prompt}
|
|
10
12
|
Params:
|
|
11
|
-
${a}`}),
|
|
13
|
+
${a}`}),o=Object.entries(t.components).map(([i,l])=>{const a=l.props?Object.entries(l.props).map(([c,u])=>`- ${c}: ${u}`).join(`
|
|
12
14
|
`):"(no documented props)";return`COMPONENT ${i}:
|
|
13
15
|
Description: ${l.prompt}
|
|
14
16
|
Props:
|
|
@@ -20,7 +22,7 @@ SCHEMA (must match exactly):
|
|
|
20
22
|
{
|
|
21
23
|
"type": "sequence",
|
|
22
24
|
"steps": [
|
|
23
|
-
{ "type": "function", "name": "<function name>", "params": { /* optional */ }, "assign": "<ctxKey>" },
|
|
25
|
+
{ "type": "function", "name": "<function name>", "params": { /* optional */ }, "assign": "<ctxKey>", "hasToShareDataWithLLM": true|false },
|
|
24
26
|
{ "type": "component", "name": "<component name>", "props": { /* optional, may reference {{ctxKey}} */ } }
|
|
25
27
|
{ "type": "text", "text": "<actual generated text>"} }
|
|
26
28
|
]
|
|
@@ -35,17 +37,24 @@ RULES:
|
|
|
35
37
|
- Output a single JSON object (no arrays or strings at top-level).
|
|
36
38
|
|
|
37
39
|
${t.llm.appDescriptionPrompt&&`Here is the description of the current app using AUTOUI library made by developer so that you would know the context of what your answers must be about. If userMessages are not related to that description below then inform user that you can only answer questions related to this current website: ${t.llm.appDescriptionPrompt} ${t.metadata?.appName}`}
|
|
38
|
-
`,"","Available functions:",
|
|
40
|
+
`,"","Available functions:",n.join(`
|
|
39
41
|
|
|
40
|
-
`),"","Available components:",
|
|
42
|
+
`),"","Available components:",o.join(`
|
|
41
43
|
|
|
42
44
|
`),"",`VALID EXAMPLE:
|
|
43
45
|
{
|
|
44
46
|
"type": "sequence",
|
|
45
47
|
"steps": [
|
|
46
|
-
{ "type": "function", "name": "fetchProducts", "params": { "color": "red" }, "assign": "items" },
|
|
48
|
+
{ "type": "function", "name": "fetchProducts", "params": { "color": "red" }, "assign": "items", hasToShareDataWithLLM: true },
|
|
47
49
|
{ "type": "component", "name": "ProductList", "props": { "products": "{{items}}", "onAddToCart": "addToCart" } }
|
|
48
50
|
{ "type": "text", "text": "Here is the product list we found for you" }
|
|
49
51
|
]
|
|
50
52
|
}`,"",`USER MESSAGE: "${e}"`,"","Respond with ONLY the plan JSON (no code fences, no commentary)."].join(`
|
|
51
|
-
`)}
|
|
53
|
+
`)}async function Cs(e,t){const n=await fetch(`${t.llm.proxyUrl}/chat/create`,{method:"POST",headers:{"Content-Type":"application/json","X-AUTOUI-APP-ID":t.appId,...t.llm.sharedSecret&&{"X-AUTOUI-SECRET":t.llm.sharedSecret}},body:JSON.stringify({messages:[{role:"user",content:ws(e,t)}],temperature:t.llm.temperature,maxTokens:t.llm.maxTokens,appDescriptionPrompt:t.llm.appDescriptionPrompt})});if(!n.ok||!n.body)throw new Error(`AutoUI proxy error: ${n.status}`);return go(n.body)}function Ss(e){return{processMessage:x.useCallback(async n=>{let o=await Cs(n,e);if(console.log("RAW PLAN FROM LLM:",o),typeof o=="string")try{o=JSON.parse(o)}catch{throw console.error("❌ Failed to parse plan JSON:",o),new Error("Invalid plan format: could not parse JSON")}if(!o||typeof o!="object"||!o.type||!o.steps)throw console.error("❌ Invalid plan structure:",o),new Error("Plan must be an object with 'type' and 'steps'.");return o},[e])}}function Ft(e,t,n){if(e==null)return e;if(typeof e=="string"){if(e.startsWith("{{")&&e.endsWith("}}")){const o=e.slice(2,-2).trim();return t[o]}return e}if(Array.isArray(e))return e.map(o=>Ft(o,t,n));if(typeof e=="object"){const o={};for(const[r,s]of Object.entries(e))if(typeof s=="string"&&/^on[A-Z]/.test(r)&&n.functions[s]){const i=s;o[r]=async(...l)=>await n.functions[i].callFunc({args:l})}else o[r]=Ft(s,t,n);return o}return e}const Ts=(e,t,n,o,r)=>{const s=o.steps.find(a=>a.type=="function"&&a.name===r);console.log("Building data analyzing prompt for current step: ",s);const i=o.steps.indexOf(s)+1;return console.log("Data being passed to the next step, which is ",o.steps[i]),`You are an expert data analyst. Analyze the following data according to that user's message ${n}.
|
|
54
|
+
|
|
55
|
+
Data:
|
|
56
|
+
${JSON.stringify(e,null,2)}
|
|
57
|
+
Please provide response the same way as data structurized so that the data would fit for the next step to be executed properly. Note that the response which you give will most probably be passed as the params to the next step in the InstructionPlan. Here is the whole instruction plan for context: ${JSON.stringify(o,null,2)}.
|
|
58
|
+
Current step name is: ${r}. Next step will use the data you provide as input parameters, so make sure to provide data in the correct format. The data about the next step is: ${o.steps[i]}.
|
|
59
|
+
|
|
60
|
+
Provide only the JSON response without any additional text. The config for the next step is ${JSON.stringify(t.functions[o.steps[i].name])}`},bs=async(e,t,n,o,r)=>{const s=await fetch(`${t.llm.proxyUrl}/chat/extra-analysis`,{method:"POST",headers:{"Content-Type":"application/json","X-AUTOUI-APP-ID":t.appId,...t.llm.sharedSecret&&{"X-AUTOUI-SECRET":t.llm.sharedSecret}},body:JSON.stringify({messages:[{role:"user",content:Ts(e,t,n,o,r)}],temperature:t.llm.temperature})});if(!s.ok||!s.body)throw new Error(`AutoUI proxy error: ${s.status}`);return go(s.body)};async function ys(e,t,n,o,r,s){const i={};for(const l of e.steps)await Is(l,i,t,n,o,r,s,e);return i}async function Is(e,t,n,o,r,s,i,l){const a=u=>!!u&&typeof u=="object"&&!Array.isArray(u);if(e.type==="function"){const u=n.functions[e.name];if(!u)throw new Error(`Unknown function: ${e.name}`);const g=u.callFunc,p=e,S=Array.isArray(p.args),R=!!p.params&&typeof p.params=="object";let E;if(S){let v=p.args;if(v.length===1&&a(v[0])&&Array.isArray(u.params)&&u.params.length>0){const f=v[0];v=u.params.map(h=>f[h])}try{E=await g(...v)}catch{E=await g(v)}}else R?E=await g(p.params):E=await g();if(u.canShareDataWithLLM&&e.hasToShareDataWithLLM){const v=await bs(E,n,i,l,e.name);e.assign&&(t[e.assign]=v)}else e.assign&&(t[e.assign]=E);return}if(e.type==="component"){const u=Ft(e.props??{},t,n),g=o(e.name,u);r(g),s(p=>u?.children?[...p,{id:`${Date.now()}-a`,role:"assistant",kind:"ui",ui:{t:"fragment",children:u.children}}]:[...p,{id:`${Date.now()}-a`,role:"assistant",kind:"ui",ui:{t:"component",name:e.name,props:u}}]);return}if(e.type==="text"){const u=e;s(g=>[...g,{id:`${Date.now()}-a`,role:"assistant",kind:"text",text:u.text}]),r(u.text??"");return}return e}function Rs(e){if(typeof e!="object"||e===null)throw new Error("Plan must be an object.");if(e.type!=="sequence")throw new Error('Plan.type must be "sequence".');if(!Array.isArray(e.steps))throw new Error("Plan.steps must be an array.");const t=new Set(["function","component","text"]);e.steps.forEach((n,o)=>{if(typeof n!="object"||n===null)throw new Error(`Step[${o}] must be an object.`);if(!t.has(n.type))throw new Error(`Step[${o}].type must be one of "function" | "component" | "text".`);if(n.type==="function"){if(typeof n.name!="string"||!n.name)throw new Error(`Step[${o}].name (function) must be a non-empty string.`);if(n.params!==void 0&&typeof n.params!="object")throw new Error(`Step[${o}].params (function) must be an object if provided.`);if(n.assign!==void 0&&typeof n.assign!="string")throw new Error(`Step[${o}].assign (function) must be a string if provided.`)}if(n.type==="component"){if(typeof n.name!="string"||!n.name)throw new Error(`Step[${o}].name (component) must be a non-empty string.`);if(n.props!==void 0&&typeof n.props!="object")throw new Error(`Step[${o}].props (component) must be an object if provided.`)}if(n.type==="text"&&typeof n.text!="string")throw new Error(`Step[${o}].text (text) must be a string.`)})}async function Es(e,t,n,o,r,s,i){return console.log("Running instruction plan:",e,"userMessage: ",s),Rs(e),await ys(e,t,n,o,r,s)}const ks=(e,t,n)=>{let o=[];for(let r of e){if(r.kind=="ui"){const{t:s}=r.ui;let i=s=="component"?t(r.ui.name,r.ui.props):"unsuccessful rerender";i&&n(i),o.push({id:r.id,role:r.role,content:i})}r.kind=="text"&&(n(r.text),o.push({id:r.id,role:r.role,content:r.text}))}return o};function xo(e){const t=x.useRef(null),n=x.useCallback(s=>{t.current=s},[]),o=x.useCallback((s,i)=>{const l=e?.components?.[s];if(!l?.callComponent)return;const a=l.callComponent;return m.jsx(a,{...i})},[e?.components]),r=x.useCallback(s=>{t.current?.(s)},[]);return{setUIRenderer:n,resolveComponent:o,setUI:r}}function js(e,t){const{resolveComponent:n,setUI:o}=xo(t),[r,s]=x.useState(()=>{try{const a=sessionStorage.getItem(e);return a?JSON.parse(a):[]}catch{return[]}}),i=x.useRef(!1);x.useEffect(()=>{i.current=!0},[]),x.useEffect(()=>{try{const a=sessionStorage.getItem(e);s(a?JSON.parse(a):[])}catch{s([])}},[e]);const l=x.useMemo(()=>ks(r,n,o),[r,n,o]);return x.useEffect(()=>{if(!i.current)return;const a=setTimeout(()=>{sessionStorage.setItem(e,JSON.stringify(r))},50);return()=>clearTimeout(a)},[r,e]),{messages:l,serializedMessages:r,setSerializedMessages:s}}function zs({config:e,theme:t,mode:n,setTheme:o,onError:r,onClose:s,storageKey:i="autoui_chat_history",title:l,classNames:a,isOpen:c}){const{messages:u,setSerializedMessages:g}=js(i,e),{processMessage:p}=Ss(e),{resolveComponent:S,setUI:R}=xo(e),[E,v]=x.useState(!1),f=x.useCallback(async d=>{if(!d.trim())return;const y={id:Date.now().toString(),role:"user",kind:"text",text:d,ts:Date.now()};g(k=>[...k,y]);try{v(!0);const k=await p(d);await Es(k,e,S,R,g,d,{validate:!0})}catch(k){g(H=>[...H,{id:`${Date.now()}-e`,role:"assistant",kind:"text",text:"⚠️ Something went wrong.",ts:Date.now()}]),r?.(k)}finally{v(!1)}},[p,e,S,R,g,r]),h=x.useCallback(()=>{g([]),sessionStorage.removeItem(i)},[g,i]),b=x.useCallback(()=>({onSend:f,disabled:E}),[f,E]),P=x.useCallback(()=>({title:"AutoUI Chat",onClose:s}),[s]),z=x.useCallback(()=>({messages:u}),[u]);return x.useMemo(()=>({config:e,isOpen:c,title:l,theme:t,mode:n,classNames:a,messages:u,isLoading:E,setTheme:o,handleSend:f,onClose:s,handleClear:h,getChatInputProps:b,getChatHeaderProps:P,getMessageListProps:z}),[e,c,l,a,u,E,f,s,h,b,P,z])}const Os=()=>{const{title:e,classNames:t,onClose:n,closeIcon:o}=Ye();return m.jsxs("header",{role:"header",className:xe("autoui-chat-header",t?.header),children:[m.jsx("h2",{role:"title",className:xe("autoui-chat-title",t?.title),children:e}),n&&m.jsx("button",{role:"closeButton",className:xe("autoui-chat-closebtn",t?.closeButton),onClick:n,children:o??m.jsx("img",{src:Bn,alt:"Open char",width:20,height:20,style:{filter:"var(--icon-filter-text)"}})})]})},jn="theme-mode",Ps=()=>{const e=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",t=()=>typeof window>"u"?"auto":localStorage.getItem(jn)||"auto",[n,o]=x.useState(t),[r,s]=x.useState(n==="auto"?e():n),i=x.useCallback(l=>{const a=l==="auto"?e():l;o(l),s(a),localStorage.setItem(jn,l),document.documentElement.dataset.theme=a},[]);return x.useEffect(()=>{i(n)},[n,i]),x.useEffect(()=>{if(n!=="auto")return;const l=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{const c=l.matches?"dark":"light";s(c),document.documentElement.dataset.theme=c};return l.addEventListener("change",a),()=>l.removeEventListener("change",a)},[n]),{mode:n,theme:r,setTheme:i}},vo=x.memo(({config:e,title:t="AutoUI Chat",isOpen:n=!0,classNames:o,onClose:r,onError:s,closeIcon:i})=>{const{theme:l,mode:a,setTheme:c}=Ps(),u=zs({config:e,title:t,isOpen:n,classNames:o,onClose:r,theme:l,mode:a,setTheme:c,onError:s});return n?m.jsx(Eo,{config:e,value:u,children:m.jsxs("section",{role:"base",className:xe("autoui-chat",o?.base),"aria-label":"Chat",children:[m.jsx(Os,{}),m.jsx(vs,{}),m.jsx($o,{})]})}):null}),Hs=Object.freeze(Object.defineProperty({__proto__:null,Chat:vo},Symbol.toStringTag,{value:"Module"})),wo=x.createContext(void 0),Bs=({config:e,children:t})=>{const[n,o]=x.useState({isOpen:!1}),r=x.useMemo(()=>({value:n,setValue:o,config:e}),[n,o,e]);return m.jsx(wo.Provider,{value:r,children:t})},Ms=()=>{const e=x.useContext(wo);if(!e)throw new Error("useModalChatContext must be used within a ModalChatProvider");return e},As=({onOpenChange:e,isOpen:t,className:n})=>{const o=t??!0,r=o?Bn:Hn;return m.jsx("button",{onClick:e,className:Oe("autoui-chat-open-btn",n),children:m.jsx("img",{src:r,alt:o?"Close chat":"Open chat",width:24,height:24,style:{filter:"var(--icon-filter-text)"}})})},Ls=x.lazy(()=>Promise.resolve().then(()=>Hs).then(e=>({default:e.Chat}))),Ns=x.memo(({config:e,portalContainer:t})=>m.jsx(Bs,{config:e,children:m.jsx(_s,{config:e,portalContainer:t})})),_s=({config:e,portalContainer:t})=>{const{value:n,setValue:o}=Ms(),{isOpen:r}=n,s=()=>o(a=>({...a,isOpen:!1})),i=()=>o(a=>({...a,isOpen:!a.isOpen})),l=t??document.body;return m.jsxs(m.Fragment,{children:[m.jsx(As,{onOpenChange:i,isOpen:r}),r&&zn.createPortal(m.jsx("div",{className:"autoui-chat-portal",children:m.jsx("div",{className:"autoui-chat-wrapper",children:m.jsx(Ls,{config:e,...n,onClose:s})})}),l)]})};exports.Chat=vo;exports.ModalChat=Ns;
|