@autoai-ui/autoui 0.0.28
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/README.md +73 -0
- package/dist/autoui.css +1 -0
- package/dist/index.cjs +50 -0
- package/dist/index.mjs +4074 -0
- package/dist/stats.html +4949 -0
- package/dist/vite.svg +1 -0
- package/package.json +101 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x';
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom';
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
]);
|
|
73
|
+
```
|
package/dist/autoui.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
: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}}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),ko=require("react-dom");var pt={exports:{}},Qe={};var ro;function xn(){if(ro)return Qe;ro=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(n,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:n,key:i,ref:r!==void 0?r:null,props:s}}return Qe.Fragment=t,Qe.jsx=o,Qe.jsxs=o,Qe}var et={};var so;function vn(){return so||(so=1,process.env.NODE_ENV!=="production"&&(function(){function e(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===A?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case g:return"Fragment";case f:return"Profiler";case d:return"StrictMode";case P:return"Suspense";case u:return"SuspenseList";case j:return"Activity"}if(typeof h=="object")switch(typeof h.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),h.$$typeof){case k:return"Portal";case H:return h.displayName||"Context";case S:return(h._context.displayName||"Context")+".Consumer";case z:var M=h.render;return h=h.displayName,h||(h=M.displayName||M.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case v:return M=h.displayName||null,M!==null?M:e(h.type)||"Memo";case y:M=h._payload,h=h._init;try{return e(h(M))}catch{}}return null}function t(h){return""+h}function o(h){try{t(h);var M=!1}catch{M=!0}if(M){M=console;var q=M.error,Q=typeof Symbol=="function"&&Symbol.toStringTag&&h[Symbol.toStringTag]||h.constructor.name||"Object";return q.call(M,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Q),t(h)}}function n(h){if(h===g)return"<>";if(typeof h=="object"&&h!==null&&h.$$typeof===y)return"<...>";try{var M=e(h);return M?"<"+M+">":"<...>"}catch{return"<...>"}}function r(){var h=F.A;return h===null?null:h.getOwner()}function s(){return Error("react-stack-top-frame")}function i(h){if(D.call(h,"key")){var M=Object.getOwnPropertyDescriptor(h,"key").get;if(M&&M.isReactWarning)return!1}return h.key!==void 0}function l(h,M){function q(){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)",M))}q.isReactWarning=!0,Object.defineProperty(h,"key",{get:q,configurable:!0})}function a(){var h=e(this.type);return K[h]||(K[h]=!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.")),h=this.props.ref,h!==void 0?h:null}function c(h,M,q,Q,Pe,Be){var ee=q.ref;return h={$$typeof:C,type:h,key:M,props:q,_owner:Q},(ee!==void 0?ee:null)!==null?Object.defineProperty(h,"ref",{enumerable:!1,get:a}):Object.defineProperty(h,"ref",{enumerable:!1,value:null}),h._store={},Object.defineProperty(h._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(h,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(h,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Pe}),Object.defineProperty(h,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Be}),Object.freeze&&(Object.freeze(h.props),Object.freeze(h)),h}function m(h,M,q,Q,Pe,Be){var ee=M.children;if(ee!==void 0)if(Q)if(_(ee)){for(Q=0;Q<ee.length;Q++)T(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 T(ee);if(D.call(M,"key")){ee=e(h);var E=Object.keys(M).filter(function(ne){return ne!=="key"});Q=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",Te[ee+Q]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%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
|
+
`):"(no documented params)";return`FUNCTION ${i}:
|
|
8
|
+
Description: ${l.prompt}
|
|
9
|
+
Params:
|
|
10
|
+
${a}`}),n=Object.entries(t.components).map(([i,l])=>{const a=l.props?Object.entries(l.props).map(([c,m])=>`- ${c}: ${m}`).join(`
|
|
11
|
+
`):"(no documented props)";return`COMPONENT ${i}:
|
|
12
|
+
Description: ${l.prompt}
|
|
13
|
+
Props:
|
|
14
|
+
${a}`});return[`You are AutoUI Intent Planner.
|
|
15
|
+
Return ONLY a valid JSON InstructionPlan and nothing else.
|
|
16
|
+
Do not wrap in markdown fences. Do not include any fields outside the schema.
|
|
17
|
+
|
|
18
|
+
SCHEMA (must match exactly):
|
|
19
|
+
{
|
|
20
|
+
"type": "sequence",
|
|
21
|
+
"steps": [
|
|
22
|
+
{ "type": "function", "name": "<function name>", "params": { /* optional */ }, "assign": "<ctxKey>" },
|
|
23
|
+
{ "type": "component", "name": "<component name>", "props": { /* optional, may reference {{ctxKey}} */ } }
|
|
24
|
+
{ "type": "text", "text": "<actual generated text>"} }
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
RULES:
|
|
29
|
+
- "type" must be exactly "sequence".
|
|
30
|
+
- "steps" must be a non-empty array.
|
|
31
|
+
- Use ONLY declared function/component names from the lists below.
|
|
32
|
+
- If a component needs data, call a function first and save it under an "assign" key, then reference it in props via "{{assignKey}}".
|
|
33
|
+
- Do not add "intent", "explanations", or any keys not in the schema.
|
|
34
|
+
- Output a single JSON object (no arrays or strings at top-level).
|
|
35
|
+
|
|
36
|
+
${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}`}
|
|
37
|
+
`,"","Available functions:",o.join(`
|
|
38
|
+
|
|
39
|
+
`),"","Available components:",n.join(`
|
|
40
|
+
|
|
41
|
+
`),"",`VALID EXAMPLE:
|
|
42
|
+
{
|
|
43
|
+
"type": "sequence",
|
|
44
|
+
"steps": [
|
|
45
|
+
{ "type": "function", "name": "fetchProducts", "params": { "color": "red" }, "assign": "items" },
|
|
46
|
+
{ "type": "component", "name": "ProductList", "props": { "products": "{{items}}", "onAddToCart": "addToCart" } }
|
|
47
|
+
{ "type": "text", "text": "Here is the product list we found for you" }
|
|
48
|
+
]
|
|
49
|
+
}`,"",`USER MESSAGE: "${e}"`,"","Respond with ONLY the plan JSON (no code fences, no commentary)."].join(`
|
|
50
|
+
`)}const Qr={},es=async(e,t)=>(await(await fetch(t.llm.baseUrl?t.llm.baseUrl:"https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:t.llm.apiKey?`Bearer ${t.llm.apiKey}`:"","HTTP-Referer":t.metadata?.appName||"autoui library user","X-Title":Qr?.VITE_OPENROUTER_SITE_TITLE??"AutoUI Demo","Content-Type":"application/json"},body:JSON.stringify({model:t.llm.model?t.llm.model:"openai/gpt-5-chat",messages:[{role:"user",content:[{type:"text",text:Kr(e,t)}]}]})})).json()).choices?.[0]?.message?.content;function ts(e){return{processMessage:I.useCallback(async o=>{let n=await es(o,e);if(typeof n=="string")try{n=JSON.parse(n)}catch{throw console.error("❌ Failed to parse plan JSON:",n),new Error("Invalid plan format: could not parse JSON")}if(!n||typeof n!="object"||!n.type||!n.steps)throw console.error("❌ Invalid plan structure:",n),new Error("Plan must be an object with 'type' and 'steps'.");return n},[e])}}function Wt(e,t,o){if(e==null)return e;if(typeof e=="string"){if(e.startsWith("{{")&&e.endsWith("}}")){const n=e.slice(2,-2).trim();return t[n]}return e}if(Array.isArray(e))return e.map(n=>Wt(n,t,o));if(typeof e=="object"){const n={};for(const[r,s]of Object.entries(e))if(typeof s=="string"&&/^on[A-Z]/.test(r)&&o.functions[s]){const i=s;n[r]=async(...l)=>await o.functions[i].callFunc({args:l})}else n[r]=Wt(s,t,o);return n}return e}async function os(e,t,o,n,r){const s={};for(const i of e.steps)await ns(i,s,t,o,n,r);return s}async function ns(e,t,o,n,r,s){const i=a=>!!a&&typeof a=="object"&&!Array.isArray(a);if(e.type==="function"){const a=o.functions[e.name];if(!a)throw new Error(`Unknown function: ${e.name}`);const c=a.callFunc,m=e,T=Array.isArray(m.args),p=!!m.params&&typeof m.params=="object";let x;if(T){let C=m.args;if(C.length===1&&i(C[0])&&Array.isArray(a.params)&&a.params.length>0){const k=C[0];C=a.params.map(g=>k[g])}try{x=await c(...C)}catch{x=await c(C)}}else p?x=await c(m.params):x=await c();e.assign&&(t[e.assign]=x);return}if(e.type==="component"){console.log("component step already includes the context of the instructionPlan, so here it is:",JSON.stringify(t));const a=Wt(e.props??{},t,o),c=n(e.name,a);r(c),s(m=>a?.children?[...m,{id:`${Date.now()}-a`,role:"assistant",kind:"ui",ui:{t:"fragment",children:a.children}}]:[...m,{id:`${Date.now()}-a`,role:"assistant",kind:"ui",ui:{t:"component",name:e.name,props:a}}]);return}if(e.type==="text"){const a=e;s(c=>[...c,{id:`${Date.now()}-a`,role:"assistant",kind:"text",text:a.text}]),r(a.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((o,n)=>{if(typeof o!="object"||o===null)throw new Error(`Step[${n}] must be an object.`);if(!t.has(o.type))throw new Error(`Step[${n}].type must be one of "function" | "component" | "text".`);if(o.type==="function"){if(typeof o.name!="string"||!o.name)throw new Error(`Step[${n}].name (function) must be a non-empty string.`);if(o.params!==void 0&&typeof o.params!="object")throw new Error(`Step[${n}].params (function) must be an object if provided.`);if(o.assign!==void 0&&typeof o.assign!="string")throw new Error(`Step[${n}].assign (function) must be a string if provided.`)}if(o.type==="component"){if(typeof o.name!="string"||!o.name)throw new Error(`Step[${n}].name (component) must be a non-empty string.`);if(o.props!==void 0&&typeof o.props!="object")throw new Error(`Step[${n}].props (component) must be an object if provided.`)}if(o.type==="text"&&typeof o.text!="string")throw new Error(`Step[${n}].text (text) must be a string.`)})}async function ss(e,t,o,n,r,s){return rs(e),await os(e,t,o,n,r)}const is=(e,t,o)=>{let n=[];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&&o(i),n.push({id:r.id,role:r.role,content:i})}r.kind=="text"&&(o(r.text),n.push({id:r.id,role:r.role,content:r.text}))}return n};function fn(e){const t=I.useRef(null),o=I.useCallback(s=>{t.current=s},[]),n=I.useCallback((s,i)=>{const l=e?.components?.[s];if(!l?.callComponent)throw new Error(`Unknown component: ${s}`);const a=l.callComponent;return R.jsx(a,{...i})},[e?.components]),r=I.useCallback(s=>{console.log("setUI called with:",s),t.current?.(s)},[]);return{setUIRenderer:o,resolveComponent:n,setUI:r}}function ls(e,t){const{resolveComponent:o,setUI:n}=fn(t),[r,s]=I.useState(()=>{try{const a=localStorage.getItem(e);return a?JSON.parse(a):[]}catch{return[]}}),i=I.useRef(!1);I.useEffect(()=>{i.current=!0},[]),I.useEffect(()=>{try{const a=localStorage.getItem(e);s(a?JSON.parse(a):[])}catch{s([])}},[e]);const l=I.useMemo(()=>is(r,o,n),[r,o,n]);return I.useEffect(()=>{if(!i.current)return;const a=setTimeout(()=>{localStorage.setItem(e,JSON.stringify(r))},50);return()=>clearTimeout(a)},[r,e]),{messages:l,serializedMessages:r,setSerializedMessages:s}}function as({config:e,onError:t,onClose:o,storageKey:n="autoui_chat_history",title:r,classNames:s,isOpen:i}){const{messages:l,setSerializedMessages:a}=ls(n,e),{processMessage:c}=ts(e),{resolveComponent:m,setUI:T}=fn(e),[p,x]=I.useState(!1),C=I.useCallback(async S=>{if(!S.trim())return;const z={id:Date.now().toString(),role:"user",kind:"text",text:S,ts:Date.now()};a(P=>[...P,z]);try{x(!0);const P=await c(S);await ss(P,e,m,T,a,{validate:!0})}catch(P){a(u=>[...u,{id:`${Date.now()}-e`,role:"assistant",kind:"text",text:"⚠️ Something went wrong.",ts:Date.now()}]),t?.(P)}finally{x(!1)}},[c,e,m,T,a,t]),k=I.useCallback(()=>{a([]),localStorage.removeItem(n)},[a,n]),g=I.useCallback(()=>({onSend:C,disabled:p}),[C,p]),d=I.useCallback(()=>({title:"AutoUI Chat",onClose:o}),[o]),f=I.useCallback(()=>({messages:l}),[l]);return{config:e,isOpen:i,title:r,classNames:s,messages:l,isLoading:p,handleSend:C,onClose:o,handleClear:k,getChatInputProps:g,getChatHeaderProps:d,getMessageListProps:f}}const cs=()=>{const{title:e,classNames:t,onClose:o,closeIcon:n}=St();return R.jsxs("header",{role:"header",className:xe("autoui-chat-header",t?.header),children:[R.jsx("h2",{role:"title",className:xe("autoui-chat-title",t?.title),children:e}),o&&R.jsx("button",{role:"closeButton",className:xe("autoui-chat-closebtn",t?.closeButton),onClick:o,children:n??R.jsx("img",{src:Oo,alt:"Open char",width:24,height:24})})]})},mn=I.memo(({config:e,title:t="AutoUI Chat",isOpen:o=!0,classNames:n,onClose:r,onError:s,closeIcon:i})=>{const l=as({config:e,title:t,isOpen:o,classNames:n,onClose:r,onError:s});return o?R.jsx(In,{config:e,value:l,children:R.jsxs("section",{role:"base",className:xe("autoui-chat",n?.base),"aria-label":"Chat",children:[R.jsx(cs,{}),R.jsx(Zr,{}),R.jsx(Cn,{})]})}):null}),us=Object.freeze(Object.defineProperty({__proto__:null,Chat:mn},Symbol.toStringTag,{value:"Module"})),hn=I.createContext(void 0),ds=({config:e,children:t})=>{const[o,n]=I.useState({isOpen:!1});return R.jsx(hn.Provider,{value:{value:o,setValue:n,config:e},children:t})},fs=()=>{const e=I.useContext(hn);if(!e)throw new Error("useModalChatContext must be used within a ModalChatProvider");return e},ms=({onOpenChange:e,isOpen:t,className:o})=>{const n=t??!0,r=n?Oo:Sn;return R.jsx("button",{onClick:e,className:tt("autoui-chat-open-btn",o),children:R.jsx("img",{src:r,alt:n?"Close chat":"Open chat",width:24,height:24})})},hs=I.lazy(()=>Promise.resolve().then(()=>us).then(e=>({default:e.Chat}))),ps=I.memo(({config:e,portalContainer:t})=>R.jsx(ds,{config:e,children:R.jsx(gs,{config:e,portalContainer:t})})),gs=({config:e,portalContainer:t})=>{const{value:o,setValue:n}=fs(),{isOpen:r}=o,s=()=>n(a=>({...a,isOpen:!1})),i=()=>n(a=>({...a,isOpen:!a.isOpen})),l=t??document.body;return R.jsxs(R.Fragment,{children:[R.jsx(ms,{onOpenChange:i,isOpen:r}),r&&ko.createPortal(R.jsx("div",{className:"autoui-chat-portal",children:R.jsx("div",{className:"autoui-chat-wrapper",children:R.jsx(hs,{config:e,...o,onClose:s})})}),l)]})};exports.Chat=mn;exports.ModalChat=ps;
|