UNPKG

@cloudquery/plugin-config-ui-lib

Version:

Plugin configuration UI library for CloudQuery Cloud App

1 lines 300 kB
import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import r,{buttonClasses as o}from"@mui/material/Button";import i from"@mui/material/Stack";import a,{useState as s,useRef as l,useCallback as c,useEffect as u,createElement as d,useMemo as h,useLayoutEffect as f,createContext as g,useContext as p,Suspense as m,forwardRef as v,useId as y}from"react";import b from"@mui/icons-material/Close";import w from"@mui/icons-material/ExpandMore";import{Box as x,Typography as S,CircularProgress as T,AccordionDetails as C,Divider as k,FormControlLabel as I,FormControl as E,FormHelperText as A}from"@mui/material";import O from"@mui/material/Accordion";import P,{accordionSummaryClasses as R}from"@mui/material/AccordionSummary";import D,{alertClasses as M}from"@mui/material/Alert";import _ from"@mui/material/AlertTitle";import L,{cardClasses as $}from"@mui/material/Card";import F,{cardContentClasses as B}from"@mui/material/CardContent";import N,{linearProgressClasses as H}from"@mui/material/LinearProgress";import z from"@mui/material/Typography";import{useTheme as V,alpha as U,createTheme as j,ThemeProvider as W,styled as G}from"@mui/material/styles";import K from"@mui/icons-material/Download";import q from"@mui/material/Box";import Y,{menuItemClasses as Q}from"@mui/material/MenuItem";import J from"react-dom";import{backdropClasses as Z}from"@mui/material/Backdrop";import X from"@mui/material/CircularProgress";import ee from"@mui/material/IconButton";import te from"@mui/material/Modal";import ne from"@mui/icons-material/Link";import re from"@mui/material/Divider";import oe from"@mui/material/Link";import ie from"@mui/icons-material/ContentCopy";import ae from"@mui/icons-material/ContentCopyRounded";import*as se from"yup";import le from"@mui/icons-material/ChevronRight";import ce from"@mui/material/Step";import ue from"@mui/material/StepLabel";import de from"@mui/material/Stepper";import he from"@mui/material/Checkbox";import fe from"@mui/material/Tab";import ge from"@mui/material/Tabs";import pe from"@mui/material/ToggleButton";import me from"@mui/material/Tooltip";import ve,{cardHeaderClasses as ye}from"@mui/material/CardHeader";import be from"@mui/material/List";import we from"@mui/material/ListItem";import{filledInputClasses as xe}from"@mui/material/FilledInput";import Se,{formLabelClasses as Te}from"@mui/material/FormLabel";import{inputLabelClasses as Ce}from"@mui/material/InputLabel";import{outlinedInputClasses as ke}from"@mui/material/OutlinedInput";import{paginationItemClasses as Ie}from"@mui/material/PaginationItem";import{tableCellClasses as Ee}from"@mui/material/TableCell";import{tableRowClasses as Ae}from"@mui/material/TableRow";import"@mui/lab/themeAugmentation";import{common as Oe}from"@mui/material/colors";import Pe from"@emotion/cache";import{CacheProvider as Re}from"@emotion/react";import De from"@mui/material/CssBaseline";import Me from"@mui/material/FormHelperText";import _e from"@mui/material/TextField";import Le from"@mui/material/Skeleton";import $e from"@mui/material/AccordionDetails";import Fe from"@mui/icons-material/Check";import Be from"@mui/material/FormControl";import Ne from"@mui/material/FormControlLabel";import He from"@mui/material/Switch";import ze from"@mui/material/Autocomplete";import{inputBaseClasses as Ve}from"@mui/material/InputBase";import{AdapterDayjs as Ue}from"@mui/x-date-pickers/AdapterDayjs";import{DateTimeField as je}from"@mui/x-date-pickers/DateTimeField";import{LocalizationProvider as We}from"@mui/x-date-pickers/LocalizationProvider";import{LocalizationProvider as Ge,DateField as Ke}from"@mui/x-date-pickers";import qe from"@mui/material/Radio";import Ye from"@mui/material/ToggleButtonGroup";import Qe from"@mui/icons-material/FilterAlt";import Je from"@mui/material/Menu";import Ze from"@mui/material/RadioGroup";import Xe from"@mui/icons-material/Search";var et=function(){return et=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},et.apply(this,arguments)};function tt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function nt(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function rt(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function ot(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var it="undefined"!=typeof window&&window.REACT_APP_CLOUDQUERY_API_BASE_URL||process.env.REACT_APP_CLOUDQUERY_API_BASE_URL||"https://api.cloudquery.io",at="undefined"!=typeof window&&window.REACT_APP_CLOUDQUERY_OAUTH_CONNECTOR_URL||process.env.REACT_APP_CLOUDQUERY_OAUTH_CONNECTOR_URL||"https://cloud.cloudquery.io/auth/connector",st="b25b8efe-63fd-4c32-9f87-059cfd649128",lt="************",ct=function(e){return nt(void 0,void 0,void 0,(function(){var t,n,r,o,i,a,s,l,c,u,d,h,f,g,p,m,v,y,b,w,x;return rt(this,(function(S){switch(S.label){case 0:for(t=e.data,n=e.headers,r=e.method,o=e.params,i=e.signal,a=e.streamData,s=e.url,l="",c=function(e,t){l+=Array.isArray(t)?"".concat(t.map((function(t){return"".concat(e,"=").concat(encodeURIComponent(t))})).join("&"),"&"):"".concat(e,"=").concat(encodeURIComponent(t),"&")},u=0,d=Object.entries(o||{});u<d.length;u++)h=d[u],f=h[0],g=h[1],c(f,g);return p="".concat(s).concat(l?"?".concat(l):""),m="".concat(s.startsWith("http")?"":it).concat(p),[4,fetch(m,et(et({method:r},t?{body:JSON.stringify(t)}:{}),{credentials:"include",headers:et({Accept:"application/json","Content-Type":"application/json"},n),signal:i}))];case 1:return v=S.sent(),a?(b={},[3,4]):[3,2];case 2:return[4,v.json().catch((function(){return{}}))];case 3:b=S.sent(),S.label=4;case 4:return y=b,v.ok&&205!==v.status?[2,{data:y,headers:v.headers,response:v,status:v.status,statusText:v.statusText}]:(x={},a?[4,v.json().catch((function(){return{}}))]:[3,6]);case 5:return w=S.sent(),[3,7];case 6:w=y,S.label=7;case 7:throw x.data=w,x.headers=v.headers,x.isCustom=!0,x.message="There was an error during the API request",x.payload=t,x.status=v.status,x}}))}))};function ut(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dt,ht={exports:{}};var ft=(dt||(dt=1,ht.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",a="hour",s="day",l="week",c="month",u="quarter",d="year",h="date",f="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},v=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},y={s:v,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+v(r,2,"0")+":"+v(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,a=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-a:a-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:s,D:h,h:a,m:i,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",w={};w[b]=m;var x="$isDayjsObject",S=function(e){return e instanceof I||!(!e||!e[x])},T=function e(t,n,r){var o;if(!t)return b;if("string"==typeof t){var i=t.toLowerCase();w[i]&&(o=i),n&&(w[i]=n,o=i);var a=t.split("-");if(!o&&a.length>1)return e(a[0])}else{var s=t.name;w[s]=t,o=s}return!r&&o&&(b=o),o||!r&&b},C=function(e,t){if(S(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new I(n)},k=y;k.l=T,k.i=S,k.w=function(e,t){return C(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var I=function(){function m(e){this.$L=T(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var v=m.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(k.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(g);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return k},v.isValid=function(){return!(this.$d.toString()===f)},v.isSame=function(e,t){var n=C(e);return this.startOf(t)<=n&&n<=this.endOf(t)},v.isAfter=function(e,t){return C(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<C(e)},v.$g=function(e,t,n){return k.u(e)?this[t]:this.set(n,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var n=this,r=!!k.u(t)||t,u=k.p(e),f=function(e,t){var o=k.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(s)},g=function(e,t){return k.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},p=this.$W,m=this.$M,v=this.$D,y="set"+(this.$u?"UTC":"");switch(u){case d:return r?f(1,0):f(31,11);case c:return r?f(1,m):f(0,m+1);case l:var b=this.$locale().weekStart||0,w=(p<b?p+7:p)-b;return f(r?v-w:v+(6-w),m);case s:case h:return g(y+"Hours",0);case a:return g(y+"Minutes",1);case i:return g(y+"Seconds",2);case o:return g(y+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var n,l=k.p(e),u="set"+(this.$u?"UTC":""),f=(n={},n[s]=u+"Date",n[h]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[a]=u+"Hours",n[i]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],g=l===s?this.$D+(t-this.$W):t;if(l===c||l===d){var p=this.clone().set(h,1);p.$d[f](g),p.init(),this.$d=p.set(h,Math.min(this.$D,p.daysInMonth())).$d}else f&&this.$d[f](g);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[k.p(e)]()},v.add=function(r,u){var h,f=this;r=Number(r);var g=k.p(u),p=function(e){var t=C(f);return k.w(t.date(t.date()+Math.round(e*r)),f)};if(g===c)return this.set(c,this.$M+r);if(g===d)return this.set(d,this.$y+r);if(g===s)return p(1);if(g===l)return p(7);var m=(h={},h[i]=t,h[a]=n,h[o]=e,h)[g]||1,v=this.$d.getTime()+r*m;return k.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=k.z(this),i=this.$H,a=this.$m,s=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},h=function(e){return k.s(i%12||12,e,"0")},g=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(p,(function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return k.s(t.$y,4,"0");case"M":return s+1;case"MM":return k.s(s+1,2,"0");case"MMM":return d(n.monthsShort,s,c,3);case"MMMM":return d(c,s);case"D":return t.$D;case"DD":return k.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(i);case"HH":return k.s(i,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return g(i,a,!0);case"A":return g(i,a,!1);case"m":return String(a);case"mm":return k.s(a,2,"0");case"s":return String(t.$s);case"ss":return k.s(t.$s,2,"0");case"SSS":return k.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(r,h,f){var g,p=this,m=k.p(h),v=C(r),y=(v.utcOffset()-this.utcOffset())*t,b=this-v,w=function(){return k.m(p,v)};switch(m){case d:g=w()/12;break;case c:g=w();break;case u:g=w()/3;break;case l:g=(b-y)/6048e5;break;case s:g=(b-y)/864e5;break;case a:g=b/n;break;case i:g=b/t;break;case o:g=b/e;break;default:g=b}return f?g:k.a(g)},v.daysInMonth=function(){return this.endOf(c).$D},v.$locale=function(){return w[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=T(e,t,!0);return r&&(n.$L=r),n},v.clone=function(){return k.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},m}(),E=I.prototype;return C.prototype=E,[["$ms",r],["$s",o],["$m",i],["$H",a],["$W",s],["$M",c],["$y",d],["$D",h]].forEach((function(e){E[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),C.extend=function(e,t){return e.$i||(e(t,I,C),e.$i=!0),C},C.locale=T,C.isDayjs=S,C.unix=function(e){return C(1e3*e)},C.en=w[b],C.Ls=w,C.p={},C}()),ht.exports),gt=ut(ft);function pt(r,o){var i={debug:o.info.dark,error:o.error.main,fatal:o.error.dark,info:o.text.primary,panic:o.error.dark,trace:o.info.main,warn:o.warning.main};return r.replace(/}\s*{/g,"}\n{").split("\n").map((function(r){try{var o=JSON.parse(r),a=o.level,s=o.time,l=tt(o,["level","time"]),c=i[a.toLowerCase()];return{logLevel:a.toLowerCase(),logLine:e(t,{children:["[",gt(s).format("YYYY-MM-DD HH:mm:ss:SSS"),"] |"," ",n("span",{style:{color:c},children:a.toUpperCase().padEnd(5," ")})," |"," ",n("span",{style:{color:c,wordBreak:"break-word"},children:JSON.stringify(l)})]}),logText:"".concat(gt(s).format("YYYY-MM-DD HH:mm:ss:SSS")," | ").concat(a.toUpperCase().padEnd(5," ")," | ").concat(JSON.stringify(l))}}catch(e){return}})).filter(Boolean)}function mt(r){var o=r.LoadingSkeleton,a=r.children,s=r.data,l=r.emptyAction,c=r.emptyCondensed,u=r.emptyImage,d=r.emptyMessage,h=r.emptyTitle,f=r.errorMessage,g=r.errorTitle,p=r.isError,m=r.isLoading,v=r.loaderText,y=r.errorActionText;return p?e(x,{padding:3,textAlign:"center",width:"100%",children:[n(S,{marginBottom:2,variant:"h5",children:null!=g?g:"Something went wrong"}),n(S,{variant:"body1",whiteSpace:"pre-line",children:f||"Error occurred when trying to ".concat(y,".")})]}):m||!p&&!s&&!1===m?n(t,{children:o?n(o,{}):n(i,{padding:1,width:"100%",children:e(x,{alignItems:"center",display:"flex",flexDirection:"column",gap:2,height:150,justifyContent:"center",children:[n(T,{}),!!v&&n(S,{variant:"body1",children:v})]})})}):s&&Array.isArray(s)&&0===s.length?n(x,{sx:{bgcolor:"background.paper",borderRadius:2.5,padding:c?5:9},textAlign:"center",width:"100%",children:e(i,{spacing:3,children:[u&&n(x,{display:"flex",justifyContent:"center",width:"100%",children:u}),e(i,{alignItems:"center",spacing:2,children:[n(S,{color:"text.primary",variant:"h5",children:h}),!!d&&n(S,{maxWidth:"600px",sx:{color:"text.secondary"},variant:"body1",whiteSpace:"pre-line",children:d})]}),l&&n("div",{children:l})]})}):n(t,{children:a(s)})}function vt(e){return()=>e}function yt(e){e()}function bt(e,t){return n=>e(t(n))}function wt(e,t){return()=>e(t)}function xt(e,t){return n=>e(t,n)}function St(e){return void 0!==e}function Tt(){}function Ct(e,t){return t(e),e}function kt(e,t){return t(e)}function It(...e){return e}function Et(e,t){return e(1,t)}function At(e,t){e(0,t)}function Ot(e){e(2)}function Pt(e){return e(4)}function Rt(e,t){return Et(e,xt(t,0))}function Dt(e,t){const n=e(1,(e=>{n(),t(e)}));return n}function Mt(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout((()=>{r(t)}),e)}}function _t(e,t){return e===t}function Lt(e=_t){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function $t(e){return t=>n=>{e(n)&&t(n)}}function Ft(e){return t=>bt(t,e)}function Bt(e){return t=>()=>{t(e)}}function Nt(e,...t){const n=function(...e){return t=>e.reduceRight(kt,t)}(...t);return(t,r)=>{switch(t){case 2:return void Ot(e);case 1:return Et(e,n(r))}}}function Ht(e,t){return n=>r=>{n(t=e(t,r))}}function zt(e){return t=>n=>{e>0?e--:t(n)}}function Vt(e){let t,n=null;return r=>o=>{n=o,!t&&(t=setTimeout((()=>{t=void 0,r(n)}),e))}}function Ut(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const a=Math.pow(2,i);Et(e,(e=>{const s=n;n|=a,t[i]=e,s!==o&&n===o&&r&&(r(),r=null)}))})),e=>i=>{const a=()=>{e([i].concat(t))};n===o?a():r=a}}function jt(e){let t=e;const n=Gt();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function Wt(e,t){return Ct(jt(t),(t=>Rt(e,t)))}function Gt(){const e=[];return(t,n)=>{switch(t){case 0:return void e.slice().forEach((e=>{e(n)}));case 2:return void e.splice(0,e.length);case 1:return e.push(n),()=>{const t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function Kt(e){return Ct(Gt(),(t=>Rt(e,t)))}function qt(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Yt(),singleton:n}}const Yt=()=>Symbol();function Qt(...e){const t=Gt(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const a=Math.pow(2,i);Et(e,(e=>{n[i]=e,r|=a,r===o&&At(t,n)}))})),function(e,i){switch(e){case 2:return void Ot(t);case 1:return r===o&&i(n),Et(t,i)}}}function Jt(e,t=_t){return Nt(e,Lt(t))}function Zt(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(yt)}}(...e.map((e=>Et(e,n))))}}}var Xt=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Xt||{});const en={0:"debug",3:"error",1:"log",2:"warn"},tn=qt((()=>{const e=jt(3);return{log:jt(((t,n,r=1)=>{var o;r>=(null!=(o=(typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL)?o:Pt(e))&&console[en[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)})),logLevel:e}}),[],{singleton:!0});function nn(e,t,n){return rn(e,t,n).callbackRef}function rn(e,t,n){const r=a.useRef(null);let o=e=>{};if(typeof ResizeObserver<"u"){const i=a.useMemo((()=>new ResizeObserver((t=>{const r=()=>{const n=t[0].target;null!==n.offsetParent&&e(n)};n?r():requestAnimationFrame(r)}))),[e]);o=e=>{e&&t?(i.observe(e),r.current=e):(r.current&&i.unobserve(r.current),r.current=null)}}return{callbackRef:o,ref:r}}function on(e,t,n,r,o,i,s,l,c){const u=a.useCallback((n=>{const a=function(e,t,n,r){const o=e.length;if(0===o)return null;const i=[];for(let a=0;a<o;a++){const o=e.item(a);if(void 0===o.dataset.index)continue;const s=parseInt(o.dataset.index),l=parseFloat(o.dataset.knownSize),c=t(o,n);if(0===c&&r("Zero-sized element, this should not happen",{child:o},Xt.ERROR),c===l)continue;const u=i[i.length-1];0===i.length||u.size!==c||u.endIndex!==s-1?i.push({endIndex:s,size:c,startIndex:s}):i[i.length-1].endIndex++}return i}(n.children,t,l?"offsetWidth":"offsetHeight",o);let c=n.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const u="window"===c.lastElementChild.dataset.viewportType;let d;u&&(d=c.ownerDocument.defaultView);const h=s?l?s.scrollLeft:s.scrollTop:u?l?d.scrollX||d.document.documentElement.scrollLeft:d.scrollY||d.document.documentElement.scrollTop:l?c.scrollLeft:c.scrollTop,f=s?l?s.scrollWidth:s.scrollHeight:u?l?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:l?c.scrollWidth:c.scrollHeight,g=s?l?s.offsetWidth:s.offsetHeight:u?l?d.innerWidth:d.innerHeight:l?c.offsetWidth:c.offsetHeight;r({scrollHeight:f,scrollTop:Math.max(h,0),viewportHeight:g}),null==i||i(l?an("column-gap",getComputedStyle(n).columnGap,o):an("row-gap",getComputedStyle(n).rowGap,o)),null!==a&&e(a)}),[e,t,o,i,s,r]);return rn(u,n,c)}function an(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Xt.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function sn(e,t,n){const r=a.useRef(null),o=a.useCallback((n=>{if(null==n||!n.offsetParent)return;const o=n.getBoundingClientRect(),i=o.width;let a,l;if(t){const e=t.getBoundingClientRect(),n=o.top-e.top;l=e.height-Math.max(0,n),a=n+t.scrollTop}else{const e=s.current.ownerDocument.defaultView;l=e.innerHeight-Math.max(0,o.top),a=o.top+e.scrollY}r.current={offsetTop:a,visibleHeight:l,visibleWidth:i},e(r.current)}),[e,t]),{callbackRef:i,ref:s}=rn(o,!0,n),l=a.useCallback((()=>{o(s.current)}),[o,s]);return a.useEffect((()=>{var e;if(t){t.addEventListener("scroll",l);const e=new ResizeObserver((()=>{requestAnimationFrame(l)}));return e.observe(t),()=>{t.removeEventListener("scroll",l),e.unobserve(t)}}{const t=null==(e=s.current)?void 0:e.ownerDocument.defaultView;return null==t||t.addEventListener("scroll",l),null==t||t.addEventListener("resize",l),()=>{null==t||t.removeEventListener("scroll",l),null==t||t.removeEventListener("resize",l)}}}),[l,t]),i}const ln=qt((()=>{const e=Gt(),t=Gt(),n=jt(0),r=Gt(),o=jt(0),i=Gt(),a=Gt(),s=jt(0),l=jt(0),c=jt(0),u=jt(0),d=Gt(),h=Gt(),f=jt(!1),g=jt(!1),p=jt(!1);return Rt(Nt(e,Ft((({scrollTop:e})=>e))),t),Rt(Nt(e,Ft((({scrollHeight:e})=>e))),a),Rt(t,o),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:u,headerHeight:s,horizontalDirection:g,scrollBy:h,scrollContainerState:e,scrollHeight:a,scrollingInProgress:f,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:p,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:i}}),[],{singleton:!0}),cn={lvl:0};function un(e,t){const n=e.length;if(0===n)return[];let{index:r,value:o}=t(e[0]);const i=[];for(let a=1;a<n;a++){const{index:n,value:s}=t(e[a]);i.push({end:n-1,start:r,value:o}),r=n,o=s}return i.push({end:1/0,start:r,value:o}),i}function dn(e){return e===cn}function hn(e,t){if(!dn(e))return t===e.k?e.v:t<e.k?hn(e.l,t):hn(e.r,t)}function fn(e,t,n="k"){if(dn(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=fn(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return fn(e.l,t,n)}function gn(e,t,n){return dn(e)?kn(t,n,1):t===e.k?xn(e,{k:t,v:n}):t<e.k?In(xn(e,{l:gn(e.l,t,n)})):In(xn(e,{r:gn(e.r,t,n)}))}function pn(){return cn}function mn(e,t,n){if(dn(e))return[];return function(e){return un(e,(({k:e,v:t})=>({index:e,value:t})))}(bn(e,fn(e,t)[0],n))}function vn(e,t){if(dn(e))return cn;const{k:n,l:r,r:o}=e;if(t===n){if(dn(r))return o;if(dn(o))return r;{const[t,n]=Cn(r);return wn(xn(e,{k:t,l:Sn(r),v:n}))}}return wn(xn(e,t<n?{l:vn(r,t)}:{r:vn(o,t)}))}function yn(e){return dn(e)?[]:[...yn(e.l),{k:e.k,v:e.v},...yn(e.r)]}function bn(e,t,n){if(dn(e))return[];const{k:r,l:o,r:i,v:a}=e;let s=[];return r>t&&(s=s.concat(bn(o,t,n))),r>=t&&r<=n&&s.push({k:r,v:a}),r<=n&&(s=s.concat(bn(i,t,n))),s}function wn(e){const{l:t,lvl:n,r:r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Tn(t))return En(xn(e,{lvl:n-1}));if(!dn(t)&&!dn(t.r))return xn(t.r,{l:xn(t,{r:t.r.l}),lvl:n,r:xn(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Tn(e))return An(xn(e,{lvl:n-1}));if(dn(r)||dn(r.l))throw new Error("Unexpected empty nodes");{const t=r.l,o=Tn(t)?r.lvl-1:r.lvl;return xn(t,{l:xn(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:An(xn(r,{l:t.r,lvl:o}))})}}function xn(e,t){return kn(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function Sn(e){return dn(e.r)?e.l:wn(xn(e,{r:Sn(e.r)}))}function Tn(e){return dn(e)||e.lvl>e.r.lvl}function Cn(e){return dn(e.r)?[e.k,e.v]:Cn(e.r)}function kn(e,t,n,r=cn,o=cn){return{k:e,l:r,lvl:n,r:o,v:t}}function In(e){return An(En(e))}function En(e){const{l:t}=e;return dn(t)||t.lvl!==e.lvl?e:xn(t,{r:xn(e,{l:t.r})})}function An(e){const{lvl:t,r:n}=e;return dn(n)||dn(n.r)||n.lvl!==t||n.r.lvl!==t?e:xn(n,{l:xn(e,{r:n.l}),lvl:t+1})}function On(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function Pn(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const Rn=qt((()=>({recalcInProgress:jt(!1)})),[],{singleton:!0});function Dn(e,t,n){return e[Mn(e,t,n)]}function Mn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const i=Math.floor((r+o)/2),a=n(e[i],t);if(0===a)return i;if(-1===a){if(o-r<2)return i-1;o=i-1}else{if(o===r)return i;r=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function _n(e,t){return Math.round(e.getBoundingClientRect()[t])}function Ln(e){return!dn(e.groupOffsetTree)}function $n({index:e},t){return t===e?0:t<e?-1:1}function Fn({offset:e},t){return t===e?0:t<e?-1:1}function Bn(e,t,n){if(0===t.length)return 0;const{index:r,offset:o,size:i}=Dn(t,e,$n),a=e-r,s=i*a+(a-1)*n+o;return s>0?s+n:s}function Nn(e,t){if(!Ln(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Hn(e,t,n){if(function(e){return typeof e.groupIndex<"u"}(e))return t.groupIndices[e.groupIndex]+1;{let r=Nn("LAST"===e.index?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}}function zn(e,t,n,r=0){return r>0&&(t=Math.max(t,Dn(e,r,$n).offset)),un(function(e,t,n,r){const o=Mn(e,t,r),i=Mn(e,n,r,o);return e.slice(o,i+1)}(e,t,n,Fn),Wn)}function Vn(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Xt.DEBUG);const i=e.sizeTree;let a=i,s=0;if(n.length>0&&dn(i)&&2===t.length){const e=t[0].size,r=t[1].size;a=n.reduce(((t,n)=>gn(gn(t,n,e),n+1,r)),a)}else[a,s]=function(e,t){let n=dn(e)?0:1/0;for(const r of t){const{endIndex:t,size:o,startIndex:i}=r;if(n=Math.min(n,i),dn(e)){e=gn(e,0,o);continue}const a=mn(e,i-1,t+1);if(a.some(Gn(r)))continue;let s=!1,l=!1;for(const{end:n,start:r,value:i}of a)s?(t>=r||o===i)&&(e=vn(e,r)):(l=i!==o,s=!0),n>t&&t>=r&&i!==o&&(e=gn(e,t+1,i));l&&(e=gn(e,i,o))}return[e,n]}(a,t);if(a===i)return e;const{lastIndex:l,lastOffset:c,lastSize:u,offsetTree:d}=jn(e.offsetTree,s,a,o);return{groupIndices:n,groupOffsetTree:n.reduce(((e,t)=>gn(e,t,Bn(t,d,o))),pn()),lastIndex:l,lastOffset:c,lastSize:u,offsetTree:d,sizeTree:a}}function Un(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function jn(e,t,n,r){let o=e,i=0,a=0,s=0,l=0;if(0!==t){l=Mn(o,t-1,$n),s=o[l].offset;const e=fn(n,t-1);i=e[0],a=e[1],o.length&&o[l].size===fn(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:e,value:l}of mn(n,t,1/0)){const t=e-i,n=t*a+s+t*r;o.push({index:e,offset:n,size:l}),i=e,s=n,a=l}return{lastIndex:i,lastOffset:s,lastSize:a,offsetTree:o}}function Wn(e){return{index:e.index,value:e}}function Gn(e){const{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}const Kn={offsetHeight:"height",offsetWidth:"width"},qn=qt((([{log:e},{recalcInProgress:t}])=>{const n=Gt(),r=Gt(),o=Wt(r,0),i=Gt(),a=Gt(),s=jt(0),l=jt([]),c=jt(void 0),u=jt(void 0),d=jt(((e,t)=>_n(e,Kn[t]))),h=jt(void 0),f=jt(0),g={groupIndices:[],groupOffsetTree:pn(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:pn()},p=Wt(Nt(n,Ut(l,e,f),Ht(Vn,g),Lt()),g),m=Wt(Nt(l,Lt(),Ht(((e,t)=>({current:t,prev:e.current})),{current:[],prev:[]}),Ft((({prev:e})=>e))),[]);Rt(Nt(l,$t((e=>e.length>0)),Ut(p,f),Ft((([e,t,n])=>{const r=e.reduce(((e,r,o)=>gn(e,r,Bn(r,t.offsetTree,n)||o)),pn());return{...t,groupIndices:e,groupOffsetTree:r}}))),p),Rt(Nt(r,Ut(p),$t((([e,{lastIndex:t}])=>e<t)),Ft((([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}]))),n),Rt(c,u);const v=Wt(Nt(c,Ft((e=>void 0===e))),!0);Rt(Nt(u,$t((e=>void 0!==e&&dn(Pt(p).sizeTree))),Ft((e=>[{endIndex:0,size:e,startIndex:0}]))),n);const y=Kt(Nt(n,Ut(p),Ht((({sizes:e},[t,n])=>({changed:n!==e,sizes:n})),{changed:!1,sizes:g}),Ft((e=>e.changed))));Et(Nt(s,Ht(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),Ft((e=>e.diff))),(e=>{const{groupIndices:n}=Pt(p);if(e>0)At(t,!0),At(i,e+Un(e,n));else if(e<0){const t=Pt(m);t.length>0&&(e-=Un(-e,t)),At(a,e)}})),Et(Nt(s,Ut(e)),(([e,t])=>{e<0&&t("`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:s},Xt.ERROR)}));const b=Kt(i);Rt(Nt(i,Ut(p),Ft((([e,t])=>{const n=t.groupIndices.length>0,r=[],o=t.lastSize;if(n){const n=hn(t.sizeTree,0);let i=0,a=0;for(;i<e;){const e=t.groupIndices[a],s=t.groupIndices.length===a+1?1/0:t.groupIndices[a+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:o,startIndex:e+1}),a++,i+=s+1}const s=yn(t.sizeTree);return i!==e&&s.shift(),s.reduce(((t,{k:n,v:r})=>{let o=t.ranges;return 0!==t.prevSize&&(o=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:o}}),{prevIndex:e,prevSize:0,ranges:r}).ranges}return yn(t.sizeTree).reduce(((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]})),{prevIndex:0,prevSize:o,ranges:[]}).ranges}))),n);const w=Kt(Nt(a,Ut(p,f),Ft((([e,{offsetTree:t},n])=>Bn(-e,t,n)))));return Rt(Nt(a,Ut(p,f),Ft((([e,t,n])=>{if(t.groupIndices.length>0){if(dn(t.sizeTree))return t;let r=pn();const o=Pt(m);let i=0,a=0,s=0;for(;i<-e;){s=o[a];const e=o[a+1]-s-1;a++,i+=e+1}if(r=yn(t.sizeTree).reduce(((t,{k:n,v:r})=>gn(t,Math.max(0,n+e),r)),r),i!==-e){r=gn(r,0,hn(t.sizeTree,s));r=gn(r,1,fn(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...jn(t.offsetTree,0,r,n)}}{const r=yn(t.sizeTree).reduce(((t,{k:n,v:r})=>gn(t,Math.max(0,n+e),r)),pn());return{...t,sizeTree:r,...jn(t.offsetTree,0,r,n)}}}))),p),{beforeUnshiftWith:b,data:h,defaultItemSize:u,firstItemIndex:s,fixedItemSize:c,gap:f,groupIndices:l,itemSize:d,listRefresh:y,shiftWith:a,shiftWithOffset:w,sizeRanges:n,sizes:p,statefulTotalCount:o,totalCount:r,trackItemSizes:v,unshiftWith:i}}),It(tn,Rn),{singleton:!0});function Yn(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{groupIndices:[],totalCount:0})}const Qn=qt((([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const i=Gt(),a=Gt(),s=Kt(Nt(i,Ft(Yn)));return Rt(Nt(s,Ft((e=>e.totalCount))),n),Rt(Nt(s,Ft((e=>e.groupIndices))),e),Rt(Nt(Qt(o,t,r),$t((([e,t])=>Ln(t))),Ft((([e,t,n])=>fn(t.groupOffsetTree,Math.max(e-n,0),"v")[0])),Lt(),Ft((e=>[e]))),a),{groupCounts:i,topItemsIndexes:a}}),It(qn,ln)),Jn=qt((([{log:e}])=>{const t=jt(!1),n=Kt(Nt(t,$t((e=>e)),Lt()));return Et(t,(t=>{t&&Pt(e)("props updated",{},Xt.DEBUG)})),{didMount:n,propsReady:t}}),It(tn),{singleton:!0}),Zn=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Xn(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Zn)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const er=qt((([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:i,footerHeight:a,headerHeight:s,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:d},{log:h}])=>{const f=Gt(),g=Gt(),p=jt(0);let m=null,v=null,y=null;function b(){m&&(m(),m=null),y&&(y(),y=null),v&&(clearTimeout(v),v=null),At(l,!1)}return Rt(Nt(f,Ut(n,d,r,p,s,a,h),Ut(e,i,o),Ft((([[e,n,r,o,i,a,s,c],d,h,p])=>{const w=Xn(e),{align:x,behavior:S,offset:T}=w,C=o-1,k=Hn(w,n,C);let I=Bn(k,n.offsetTree,d)+a;"end"===x?(I+=h+fn(n.sizeTree,k)[1]-r+p,k===C&&(I+=s)):"center"===x?I+=(h+fn(n.sizeTree,k)[1]-r+p)/2:I-=i,T&&(I+=T);const E=t=>{b(),t?(c("retrying to scroll to",{location:e},Xt.DEBUG),At(f,e)):(At(g,!0),c("list did not change, scroll successful",{},Xt.DEBUG))};if(b(),"smooth"===S){let e=!1;y=Et(t,(t=>{e=e||t})),m=Dt(u,(()=>{E(e)}))}else m=Dt(Nt(t,function(e){return t=>{const n=setTimeout((()=>{t(!1)}),e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),E);return v=setTimeout((()=>{b()}),1200),At(l,!0),c("scrolling from index to",{behavior:S,index:k,top:I},Xt.DEBUG),{behavior:S,top:I}}))),c),{scrollTargetReached:g,scrollToIndex:f,topListHeight:p}}),It(qn,ln,tn),{singleton:!0});function tr(e,t){0==e?t():requestAnimationFrame((()=>{tr(e-1,t)}))}function nr(e,t){const n=t-1;return"number"==typeof e?e:"LAST"===e.index?n:e.index}const rr=qt((([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:i},{didMount:a}])=>{const s=jt(!0),l=jt(0),c=jt(!0);return Rt(Nt(a,Ut(l),$t((([e,t])=>!!t)),Bt(!1)),s),Rt(Nt(a,Ut(l),$t((([e,t])=>!!t)),Bt(!1)),c),Et(Nt(Qt(t,a),Ut(s,n,e,c),$t((([[,e],t,{sizeTree:n},r,o])=>e&&(!dn(n)||St(r))&&!t&&!o)),Ut(l)),(([,e])=>{Dt(o,(()=>{At(c,!0)})),tr(4,(()=>{Dt(r,(()=>{At(s,!0)})),At(i,e)}))})),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:s}}),It(qn,ln,er,Jn),{singleton:!0});function or(e,t){return Math.abs(e-t)<1.01}const ir="up",ar="down",sr={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},lr=qt((([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:i}])=>{const a=jt(!1),s=jt(!0),l=Gt(),c=Gt(),u=jt(4),d=jt(0),h=Wt(Nt(Zt(Nt(Jt(o),zt(1),Bt(!0)),Nt(Jt(o),zt(1),Bt(!1),Mt(100))),Lt()),!1),f=Wt(Nt(Zt(Nt(n,Bt(!0)),Nt(n,Bt(!1),Mt(200))),Lt()),!1);Rt(Nt(Qt(Jt(o),Jt(d)),Ft((([e,t])=>e<=t)),Lt()),s),Rt(Nt(s,Vt(50)),c);const g=Kt(Nt(Qt(r,Jt(i),Jt(t),Jt(e),Jt(u)),Ht(((e,[{scrollHeight:t,scrollTop:n},r,o,i,a])=>{const s={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-a){let t,r;return n>e.state.scrollTop?(t="SCROLLED_DOWN",r=e.state.scrollTop-n):(t="SIZE_DECREASED",r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:s}}let l;return l=s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":r<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":n<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:l,state:s}}),sr),Lt(((e,t)=>e&&e.atBottom===t.atBottom)))),p=Wt(Nt(r,Ht(((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(or(e.scrollHeight,t))return{changed:!1,jump:0,scrollHeight:t,scrollTop:n};{const o=t-(n+r)<1;return e.scrollTop!==n&&o?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}}),{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),$t((e=>e.changed)),Ft((e=>e.jump))),0);Rt(Nt(g,Ft((e=>e.atBottom))),a),Rt(Nt(a,Vt(50)),l);const m=jt(ar);Rt(Nt(r,Ft((({scrollTop:e})=>e)),Lt(),Ht(((e,t)=>Pt(f)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ir:ar,prevScrollTop:t}),{direction:ar,prevScrollTop:0}),Ft((e=>e.direction))),m),Rt(Nt(r,Vt(50),Bt("none")),m);const v=jt(0);return Rt(Nt(h,$t((e=>!e)),Bt(0)),v),Rt(Nt(o,Vt(100),Ut(h),$t((([e,t])=>!!t)),Ht((([e,t],[n])=>[t,n]),[0,0]),Ft((([e,t])=>t-e))),v),{atBottomState:g,atBottomStateChange:l,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:d,isAtBottom:a,isAtTop:s,isScrolling:h,lastJumpDueToItemResize:p,scrollDirection:m,scrollVelocity:v}}),It(ln)),cr="top",ur="bottom",dr="none";function hr(e,t,n){return"number"==typeof e?n===ir&&t===cr||n===ar&&t===ur?e:0:n===ir?t===cr?e.main:e.reverse:t===ur?e.main:e.reverse}function fr(e,t){var n;return"number"==typeof e?e:null!=(n=e[t])?n:0}const gr=qt((([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const i=Gt(),a=jt(0),s=jt(0),l=jt(0),c=Wt(Nt(Qt(Jt(r),Jt(o),Jt(n),Jt(i,Pn),Jt(l),Jt(a),Jt(t),Jt(e),Jt(s)),Ft((([e,t,n,[r,o],i,a,s,l,c])=>{const u=e-l,d=a+s,h=Math.max(n-u,0);let f=dr;const g=fr(c,cr),p=fr(c,ur);return r-=l,o+=n+s,(r+=n+s)>e+d-g&&(f=ir),(o-=l)<e-h+t+p&&(f=ar),f!==dr?[Math.max(u-n-hr(i,cr,f)-g,0),u-h-s+t+hr(i,ur,f)+p]:null})),$t((e=>null!=e)),Lt(Pn)),[0,0]);return{increaseViewportBy:s,listBoundary:i,overscan:l,topListHeight:a,visibleRange:c}}),It(ln),{singleton:!0});const pr={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function mr(e,t,n,r,o,i){const{lastIndex:a,lastOffset:s,lastSize:l}=o;let c=0,u=0;if(e.length>0){c=e[0].offset;const t=e[e.length-1];u=t.offset+t.size}const d=n-a,h=c,f=s+d*l+(d-1)*r-u;return{bottom:u,firstItemIndex:i,items:yr(e,o,i),offsetBottom:f,offsetTop:c,top:h,topItems:yr(t,o,i),topListHeight:t.reduce(((e,t)=>t.size+e),0),totalCount:n}}function vr(e,t,n,r,o,i){let a=0;if(n.groupIndices.length>0)for(const t of n.groupIndices){if(t-a>=e)break;a++}const s=e+a,l=nr(t,s);return mr(Array.from({length:s}).map(((e,t)=>({data:i[t+l],index:t+l,offset:0,size:0}))),[],s,o,n,r)}function yr(e,t,n){if(0===e.length)return[];if(!Ln(t))return e.map((e=>({...e,index:e.index+n,originalIndex:e.index})));const r=e[0].index,o=e[e.length-1].index,i=[],a=mn(t.groupOffsetTree,r,o);let s,l=0;for(const r of e){let e;(!s||s.end<r.index)&&(s=a.shift(),l=t.groupIndices.indexOf(s.start)),e=r.index===s.start?{index:l,type:"group"}:{groupIndex:l,index:r.index-(l+1)+n},i.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return i}const br=qt((([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},i,{listBoundary:a,topListHeight:s,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:d},h,{didMount:f},{recalcInProgress:g}])=>{const p=jt([]),m=jt(0),v=Gt();Rt(i.topItemsIndexes,p);const y=Wt(Nt(Qt(f,g,Jt(l,Pn),Jt(o),Jt(r),Jt(c),u,Jt(p),Jt(t),Jt(n),e),$t((([e,t,,n,,,,,,,r])=>{const o=r&&r.length!==n;return e&&!t&&!o})),Ft((([,,[e,t],n,r,o,i,a,s,l,c])=>{const u=r,{offsetTree:d,sizeTree:h}=u,f=Pt(m);if(0===n)return{...pr,totalCount:n};if(0===e&&0===t)return 0===f?{...pr,totalCount:n}:vr(f,o,r,s,l,c||[]);if(dn(h))return f>0?null:mr(function(e,t,n){if(Ln(t)){const r=Nn(e,t);return[{index:fn(t.groupOffsetTree,r)[0],offset:0,size:0},{data:null==n?void 0:n[0],index:r,offset:0,size:0}]}return[{data:null==n?void 0:n[0],index:e,offset:0,size:0}]}(nr(o,n),u,c),[],n,l,u,s);const g=[];if(a.length>0){const e=a[0],t=a[a.length-1];let n=0;for(const r of mn(h,e,t)){const o=r.value,i=Math.max(r.start,e),a=Math.min(r.end,t);for(let e=i;e<=a;e++)g.push({data:null==c?void 0:c[e],index:e,offset:n,size:o}),n+=o}}if(!i)return mr([],g,n,l,u,s);const p=a.length>0?a[a.length-1]+1:0,v=zn(d,e,t,p);if(0===v.length)return null;const y=n-1,b=Ct([],(n=>{for(const r of v){const o=r.value;let i=o.offset,a=r.start;const s=o.size;if(o.offset<e){a+=Math.floor((e-o.offset+l)/(s+l));const t=a-r.start;i+=t*s+t*l}a<p&&(i+=(p-a)*s,a=p);const u=Math.min(r.end,y);for(let e=a;e<=u&&!(i>=t);e++)n.push({data:null==c?void 0:c[e],index:e,offset:i,size:s}),i+=s+l}}));return mr(b,g,n,l,u,s)})),$t((e=>null!==e)),Lt()),pr);Rt(Nt(e,$t(St),Ft((e=>null==e?void 0:e.length))),o),Rt(Nt(y,Ft((e=>e.topListHeight))),d),Rt(d,s),Rt(Nt(y,Ft((e=>[e.top,e.bottom]))),a),Rt(Nt(y,Ft((e=>e.items))),v);const b=Kt(Nt(y,$t((({items:e})=>e.length>0)),Ut(o,e),$t((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),Ft((([,e,t])=>[e-1,t])),Lt(Pn),Ft((([e])=>e)))),w=Kt(Nt(y,Vt(200),$t((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),Ft((({items:e})=>e[0].index)),Lt())),x=Kt(Nt(y,$t((({items:e})=>e.length>0)),Ft((({items:e})=>{let t=0,n=e.length-1;for(;"group"===e[t].type&&t<n;)t++;for(;"group"===e[n].type&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}})),Lt(On)));return{endReached:b,initialItemCount:m,itemsRendered:v,listState:y,rangeChanged:x,startReached:w,topItemsIndexes:p,...h}}),It(qn,Qn,gr,rr,er,lr,Jn,Rn),{singleton:!0}),wr=qt((([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const i=Gt(),a=Wt(Nt(Qt(n,e,r,t,o),Ft((([e,t,n,r,o])=>e+t+n+r+o.offsetBottom+o.bottom))),0);return Rt(Jt(a),i),{totalListHeight:a,totalListHeightChanged:i}}),It(ln,br),{singleton:!0}),xr=qt((([{viewportHeight:e},{totalListHeight:t}])=>{const n=jt(!1),r=Wt(Nt(Qt(n,e,t),$t((([e])=>e)),Ft((([,e,t])=>Math.max(0,e-t))),Vt(0),Lt()),0);return{alignToBottom:n,paddingTopAddition:r}}),It(ln,wr),{singleton:!0});function Sr(e){return!!e&&("smooth"===e?"smooth":"auto")}const Tr=qt((([{listRefresh:e,totalCount:t},{atBottomState:n,isAtBottom:r},{scrollToIndex:o},{scrolledToInitialItem:i},{didMount:a,propsReady:s},{log:l},{scrollingInProgress:c}])=>{const u=jt(!1),d=Gt();let h=null;function f(e){At(o,{align:"end",behavior:e,index:"LAST"})}function g(e){const t=Dt(n,(t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&!h&&(Pt(l)("scrolling to bottom due to increased size",{},Xt.DEBUG),f("auto"))}));setTimeout(t,100)}return Et(Nt(Qt(Nt(Jt(t),zt(1)),a),Ut(Jt(u),r,i,c),Ft((([[e,t],n,r,o,i])=>{let a=t&&o,s="auto";return a&&(s=((e,t)=>"function"==typeof e?Sr(e(t)):t&&Sr(e))(n,r||i),a=a&&!!s),{followOutputBehavior:s,shouldFollow:a,totalCount:e}})),$t((({shouldFollow:e})=>e))),(({followOutputBehavior:t,totalCount:n})=>{h&&(h(),h=null),h=Dt(e,(()=>{Pt(l)("following output to ",{totalCount:n},Xt.DEBUG),f(t),h=null}))})),Et(Nt(Qt(Jt(u),t,s),$t((([e,,t])=>e&&t)),Ht((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),$t((({refreshed:e})=>e)),Ut(u,t)),(([,e])=>{Pt(i)&&g(!1!==e)})),Et(d,(()=>{g(!1!==Pt(u))})),Et(Qt(Jt(u),n),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&f("auto")})),{autoscrollToBottom:d,followOutput:u}}),It(qn,lr,er,rr,Jn,tn,ln)),Cr=qt((([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:i,listState:a},{didMount:s}])=>(Rt(Nt(s,Ut(i),$t((([,e])=>0!==e)),Ut(o,r,t,n,e),Ft((([[,e],t,n,r,o,i=[]])=>vr(e,t,n,r,o,i)))),a),{})),It(qn,rr,br,Jn),{singleton:!0}),kr=qt((([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=jt(0);return Et(Nt(e,Ut(r),$t((([,e])=>0!==e)),Ft((([,e])=>({top:e})))),(e=>{Dt(Nt(n,zt(1),$t((e=>e.items.length>1))),(()=>{requestAnimationFrame((()=>{At(t,e)}))}))})),{initialScrollTop:r}}),It(Jn,ln,br),{singleton:!0}),Ir=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:i,viewportTop:a})=>t<a?{...o,align:null!=n?n:"start",behavior:r}:e>i?{...o,align:null!=n?n:"end",behavior:r}:null,Er=qt((([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:i,scrollingInProgress:a,scrollTop:s,viewportHeight:l},{scrollToIndex:c}])=>{const u=Gt();return Rt(Nt(u,Ut(t,l,n,i,o,r,s),Ut(e),Ft((([[e,t,n,r,o,i,s,l],c])=>{const{align:u,behavior:d,calculateViewLocation:h=Ir,done:f,...g}=e,p=Hn(e,t,r-1),m=Bn(p,t.offsetTree,c)+o+i,v=h({itemBottom:m+fn(t.sizeTree,p)[1],itemTop:m,locationParams:{align:u,behavior:d,...g},viewportBottom:l+n-s,viewportTop:l+i});return v?f&&Dt(Nt(a,$t((e=>!e)),zt(Pt(a)?1:2)),f):f&&f(),v})),$t((e=>null!==e))),c),{scrollIntoView:u}}),It(qn,ln,er,br,tn),{singleton:!0}),Ar=qt((([{scrollVelocity:e}])=>{const t=jt(!1),n=Gt(),r=jt(!1);return Rt(Nt(e,Ut(r,t,n),$t((([e,t])=>!!t)),Ft((([e,t,n,r])=>{const{enter:o,exit:i}=t;if(n){if(i(e,r))return!1}else if(o(e,r))return!0;return n})),Lt()),t),Et(Nt(Qt(t,e,n),Ut(r)),(([[e,t,n],r])=>{e&&r&&r.change&&r.change(t,n)})),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}}),It(lr),{singleton:!0}),Or=qt((([{scrollContainerState:e,scrollTo:t}])=>{const n=Gt(),r=Gt(),o=Gt(),i=jt(!1),a=jt(void 0);return Rt(Nt(Qt(n,r),Ft((([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n})))),e),Rt(Nt(t,Ut(r),Ft((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),o),{customScrollParent:a,useWindowScroll:i,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}}),It(ln)),Pr=qt((([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:i},{useWindowScroll:a,windowScrollContainerState:s,windowViewportRect:l}])=>{const c=Gt(),u=jt(void 0),d=jt(null),h=jt(null);return Rt(s,d),Rt(l,h),Et(Nt(c,Ut(t,r,a,d,h,n)),(([e,t,n,r,o,i,a])=>{const s=function(e){return yn(e).map((({k:e,v:t},n,r)=>{const o=r[n+1];return{endIndex:o?o.k-1:1/0,size:t,startIndex:e}}))}(t.sizeTree);r&&null!==o&&null!==i&&(n=o.scrollTop-i.offsetTop),e({ranges:s,scrollTop:n-=a})})),Rt(Nt(u,$t(St),Ft(Rr)),o),Rt(Nt(i,Ut(u),$t((([,e])=>void 0!==e)),Lt(),Ft((([,e])=>e.ranges))),e),{getState:c,restoreStateFrom:u}}),It(qn,ln,rr,Jn,Or));function Rr(e){return{align:"start",index:0,offset:e.scrollTop}}const Dr=qt((([{topItemsIndexes:e}])=>{const t=jt(0);return Rt(Nt(t,$t((e=>e>=0)),Ft((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),It(br));function Mr(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const _r=Mr((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),Lr=qt((([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:i,lastJumpDueToItemResize:a,scrollDirection:s},{listState:l},{beforeUnshiftWith:c,gap:u,shiftWithOffset:d,sizes:h},{log:f},{recalcInProgress:g}])=>{const p=Kt(Nt(l,Ut(a),Ht((([,e,t,n],[{bottom:r,items:o,offsetBottom:i,totalCount:a},s])=>{const l=r+i;let c=0;return t===a&&e.length>0&&o.length>0&&(0===o[0].originalIndex&&0===e[0].originalIndex||(c=l-n,0!==c&&(c+=s))),[c,o,a,l]}),[0,[],0,0]),$t((([e])=>0!==e)),Ut(r,s,n,o,f,g),$t((([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===ir)),Ft((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},Xt.DEBUG),e)))));function m(n){n>0?(At(t,{behavior:"auto",top:-n}),At(e,0)):(At(e,0),At(t,{behavior:"auto",top:-n}))}return Et(Nt(p,Ut(e,i)),(([t,n,r])=>{r&&_r()?At(e,n-t):m(-t)})),Et(Nt(Qt(Wt(i,!1),e,g),$t((([e,t,n])=>!e&&!n&&0!==t)),Ft((([e,t])=>t)),Vt(1)),m),Rt(Nt(d,Ft((e=>({top:-e})))),t),Et(Nt(c,Ut(h,u),Ft((([e,{groupIndices:t,lastSize:n,sizeTree:r},o])=>{function i(e){return e*(n+o)}if(0===t.length)return i(e);{let n=0;const o=hn(r,0);let a=0,s=0;for(;a<e;){a++,n+=o;let r=t.length===s+1?1/0:t[s+1]-t[s]-1;a+r>e&&(n-=o,r=e-a+1),a+=r,n+=i(r),s++}return n}}))),(n=>{At(e,n),requestAnimationFrame((()=>{At(t,{top:n}),requestAnimationFrame((()=>{At(e,0),At(g,!1)}))}))})),{deviation:e}}),It(ln,lr,br,qn,tn,Rn)),$r=qt((([e,t,n,r,o,i,a,s,l,c])=>({...e,...t,...n,...r,...o,...i,...a,...s,...l,...c})),It(gr,Cr,Jn,Ar,wr,kr,xr,Or,Er,tn)),Fr=qt((([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,gap:o,groupIndices:i,itemSize:a,sizeRanges:s,sizes:l,statefulTotalCount:c,totalCount:u,trackItemSizes:d},{initialItemFinalLocationReached:h,initialTopMostItemIndex:f,scrolledToInitialItem:g},p,m,v,{listState:y,topItemsIndexes:b,...w},{scrollToIndex:x},S,{topItemCount:T},{groupCounts:C},k])=>(Rt(w.rangeChanged,k.scrollSeekRangeChanged),Rt(Nt(k.windowViewportRect,Ft((e=>e.visibleHeight))),p.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,gap:o,groupCounts:C,initialItemFinalLocationReached:h,initialTopMostItemIndex:f,scrolledToInitialItem:g,sizeRanges:s,topItemCount:T,topItemsIndexes:b,totalCount:u,...v,groupIndices:i,itemSize:a,listState:y,scrollToIndex:x,statefulTotalCount:c,trackItemSizes:d,...w,...k,...p,sizes:l,...m})),It(qn,rr,ln,Pr,Tr,br,er,Lr,Dr,Qn,$r));function Br(e,t){const n={},r={};let o=0;const i=e.length;for(;o<i;)r[e[o]]=1,o+=1;for(const e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}const Nr=typeof document<"u"?a.useLayoutEffect:a.useEffect;function Hr(e,t,r){const o=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),l=Object.keys(t.events||{}),c=a.createContext({});function u(e,n){e.propsReady&&At(e.propsReady,!1);for(const r of o){At(e[t.required[r]],n[r])}for(const r of i)if(r in n){At(e[t.optional[r]],n[r])}e.propsReady&&At(e.propsReady,!0)}function d(e){return l.reduce(((n,r)=>(n[r]=function(e){let t,n;const r=()=>null==t?void 0:t();return function(o,i){switch(o){case 1:return i?n===i?void 0:(r(),n=i,t=Et(e,i),t):(r(),Tt);case 2:return r(),void(n=null)}}}(e[t.events[r]]),n)),{})}const h=a.forwardRef(((h,f)=>{const{children:g,...p}=h,[m]=a.useState((()=>Ct(function(e){const t=new Map,n=({constructor:e,dependencies:r,id:o,singleton:i})=>{if(i&&t.has(o))return t.get(o);const a=e(r.map((e=>n(e))));return i&&t.set(o,a),a};return n(e)}(e),(e=>{u(e,p)})))),[v]=a.useState(wt(d,m));Nr((()=>{for(const e of l)e in p&&Et(v[e],p[e]);return()=>{Object.values(v).map(Ot)}}),[p,v,m]),Nr((()=>{u(m,p)})),a.useImperativeHandle(f,vt(function(e){return s.reduce(((n,r)=>(n[r]=n=>{At(e[t.methods[r]],n)},n)),{})}(m)));const y=r;return n(c.Provider,{value:m,children:r?n(y,{...Br([...o,...i,...l],p),children:g}):g})})),f=a.version.startsWith("18")?e=>{const t=a.useContext(c)[e],n=a.useCallback((e=>Et(t,e)),[t]);return a.useSyncExternalStore(n,(()=>Pt(t)),(()=>Pt(t)))}:e=>{const t=a.useContext(c)[e],[n,r]=a.useState(wt(Pt,t));return Nr((()=>Et(t,(e=>{e!==n&&r(vt(e))}))),[t,n]),n};return{Component:h,useEmitter:(e,t)=>{const n=a.useContext(c)[e];Nr((()=>Et(n,t)),[t,n])},useEmitterValue:f,usePublisher:e=>a.useCallback(xt(At,a.useContext(c)[e]),[e])}}const zr=a.createContext(void 0),Vr=a.createContext(void 0),Ur=typeof document<"u"?a.useLayoutEffect:a.useEffect;function jr(e){return"self"in e}func