1import{r as S}from"./main-D78L-pDZ.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="c799339a-ea76-4ea8-92c4-cb6061b09173",t._sentryDebugIdIdentifier="sentry-dbid-c799339a-ea76-4ea8-92c4-cb6061b09173")}catch{}function I(t,e){let{cursor:y,getKey:o}=t;return{setSelectedKeys(i){e(r=>({...r,selectedKeys:i}))},addKeysToSelection(i){e(r=>r.selectedKeys==="all"?r:i==="all"?{...r,selectedKeys:"all"}:{...r,selectedKeys:new Set([...r.selectedKeys,...i])})},removeKeysFromSelection(i){e(r=>{if(i==="all")return{...r,selectedKeys:new Set};let s=r.selectedKeys==="all"?new Set(r.items.map(o)):new Set(r.selectedKeys);for(let l of i)s.delete(l);return{...r,selectedKeys:s}})},setFilterText(i){e(r=>({...r,filterText:i}))},insert(i,...r){e(s=>x(s,i,...r))},insertBefore(i,...r){e(s=>{let l=s.items.findIndex(n=>o?.(n)===i);if(l===-1)if(s.items.length===0)l=0;else return s;return x(s,l,...r)})},insertAfter(i,...r){e(s=>{let l=s.items.findIndex(n=>o?.(n)===i);if(l===-1)if(s.items.length===0)l=0;else return s;return x(s,l+1,...r)})},prepend(...i){e(r=>x(r,0,...i))},append(...i){e(r=>x(r,r.items.length,...i))},remove(...i){e(r=>{let s=new Set(i),l=r.items.filter(f=>!s.has(o(f))),n="all";if(r.selectedKeys!=="all"){n=new Set(r.selectedKeys);for(let f of i)n.delete(f)}return y==null&&l.length===0&&(n=new Set),{...r,items:l,selectedKeys:n}})},removeSelectedItems(){e(i=>{if(i.selectedKeys==="all")return{...i,items:[],selectedKeys:new Set};let r=i.selectedKeys,s=i.items.filter(l=>!r.has(o(l)));return{...i,items:s,selectedKeys:new Set}})},move(i,r){e(s=>{let l=s.items.findIndex(d=>o(d)===i);if(l===-1)return s;let n=s.items.slice(),[f]=n.splice(l,1);return n.splice(r,0,f),{...s,items:n}})},moveBefore(i,r){e(s=>{let l=s.items.findIndex(d=>o(d)===i);if(l===-1)return s;let f=(Array.isArray(r)?r:[...r]).map(d=>s.items.findIndex(u=>o(u)===d)).sort((d,u)=>d-u);return $(s,f,l)})},moveAfter(i,r){e(s=>{let l=s.items.findIndex(d=>o(d)===i);if(l===-1)return s;let f=(Array.isArray(r)?r:[...r]).map(d=>s.items.findIndex(u=>o(u)===d)).sort((d,u)=>d-u);return $(s,f,l+1)})},update(i,r){e(s=>{let l=s.items.findIndex(n=>o(n)===i);return l===-1?s:{...s,items:[...s.items.slice(0,l),r,...s.items.slice(l+1)]}})}}}function x(t,e,...y){return{...t,items:[...t.items.slice(0,e),...y,...t.items.slice(e)]}}function $(t,e,y){y-=e.filter(r=>r<y).length;let o=e.map(r=>({from:r,to:y++}));for(let r=0;r<o.length;r++){let s=o[r].from;for(let l=r;l<o.length;l++)o[l].from>s&&o[l].from--}for(let r=0;r<o.length;r++){let s=o[r];for(let l=o.length-1;l>r;l--){let n=o[l];n.from<s.to?s.to++:n.from++}}let i=t.items.slice();for(let r of o){let[s]=i.splice(r.from,1);i.splice(r.to,0,s)}return{...t,items:i}}function T(t,e){let y;switch(t.state){case"idle":case"error":switch(e.type){case"loading":case"loadingMore":case"sorting":case"filtering":var o,i;return{...t,filterText:(o=e.filterText)!==null&&o!==void 0?o:t.filterText,state:e.type,items:e.type==="loading"?[]:t.items,sortDescriptor:(i=e.sortDescriptor)!==null&&i!==void 0?i:t.sortDescriptor,abortController:e.abortController};case"update":var r;return{...t,...(r=e.updater)===null||r===void 0?void 0:r.call(e,t)};case"success":case"error":return t;default:throw new Error(`Invalid action "${e.type}" in state "${t.state}"`)}case"loading":case"sorting":case"filtering":switch(e.type){case"success":if(e.abortController!==t.abortController)return t;var s;y=(s=e.selectedKeys)!==null&&s!==void 0?s:t.selectedKeys;var l,n,f;return{...t,filterText:(l=e.filterText)!==null&&l!==void 0?l:t.filterText,state:"idle",items:[...(n=e.items)!==null&&n!==void 0?n:[]],selectedKeys:y==="all"?"all":new Set(y),sortDescriptor:(f=e.sortDescriptor)!==null&&f!==void 0?f:t.sortDescriptor,abortController:void 0,cursor:e.cursor};case"error":return e.abortController!==t.abortController?t:{...t,state:"error",error:e.error,abortController:void 0};case"loading":case"loadingMore":case"sorting":case"filtering":var d;(d=t.abortController)===null||d===void 0||d.abort();var u;return{...t,filterText:(u=e.filterText)!==null&&u!==void 0?u:t.filterText,state:e.type,items:e.type==="loading"?[]:t.items,abortController:e.abortController};case"update":var c;return{...t,...(c=e.updater)===null||c===void 0?void 0:c.call(e,t)};default:throw new Error(`Invalid action "${e.type}" in state "${t.state}"`)}case"loadingMore":switch(e.type){case"success":var m;y=t.selectedKeys==="all"||e.selectedKeys==="all"?"all":new Set([...t.selectedKeys,...(m=e.selectedKeys)!==null&&m!==void 0?m:[]]);var g,b;return{...t,state:"idle",items:[...t.items,...(g=e.items)!==null&&g!==void 0?g:[]],selectedKeys:y,sortDe
1scriptor:(b=e.sortDescriptor)!==null&&b!==void 0?b:t.sortDescriptor,abortController:void 0,cursor:e.cursor};case"error":return e.abortController!==t.abortController?t:{...t,state:"error",error:e.error};case"loading":case"sorting":case"filtering":var p;(p=t.abortController)===null||p===void 0||p.abort();var v;return{...t,filterText:(v=e.filterText)!==null&&v!==void 0?v:t.filterText,state:e.type,items:e.type==="loading"?[]:t.items,abortController:e.abortController};case"loadingMore":var w;return(w=e.abortController)===null||w===void 0||w.abort(),t;case"update":var K;return{...t,...(K=e.updater)===null||K===void 0?void 0:K.call(e,t)};default:throw new Error(`Invalid action "${e.type}" in state "${t.state}"`)}default:throw new Error(`Invalid state "${t.state}"`)}}function D(t){const{load:e,sort:y,initialSelectedKeys:o,initialSortDescriptor:i,getKey:r=u=>u.id||u.key,initialFilterText:s=""}=t;let[l,n]=S.useReducer(T,{state:"idle",error:void 0,items:[],selectedKeys:o==="all"?"all":new Set(o),sortDescriptor:i,filterText:s});const f=async(u,c)=>{let m=new AbortController;try{n({...u,abortController:m});var g;let v=(g=u.filterText)!==null&&g!==void 0?g:l.filterText;var b;let w=await c({items:l.items.slice(),selectedKeys:l.selectedKeys,sortDescriptor:(b=u.sortDescriptor)!==null&&b!==void 0?b:l.sortDescriptor,signal:m.signal,cursor:u.type==="loadingMore"?l.cursor:void 0,filterText:v,loadingState:l.state});var p;let K=(p=w.filterText)!==null&&p!==void 0?p:v;n({type:"success",...w,abortController:m}),K&&K!==v&&!m.signal.aborted&&f({type:"filtering",filterText:K},e)}catch(v){n({type:"error",error:v,abortController:m})}};let d=S.useRef(!1);return S.useEffect(()=>{d.current||(f({type:"loading"},e),d.current=!0)},[]),{items:l.items,selectedKeys:l.selectedKeys,sortDescriptor:l.sortDescriptor,isLoading:l.state==="loading"||l.state==="loadingMore"||l.state==="sorting"||l.state==="filtering",loadingState:l.state,error:l.error,filterText:l.filterText,getItem(u){return l.items.find(c=>r(c)===u)},reload(){f({type:"loading"},e)},loadMore(){l.state==="loading"||l.state==="loadingMore"||l.state==="filtering"||l.cursor==null||f({type:"loadingMore"},e)},sort(u){f({type:"sorting",sortDescriptor:u},y||e)},...I({...t,getKey:r,cursor:l.cursor},u=>{n({type:"update",updater:u})}),setFilterText(u){f({type:"filtering",filterText:u},e)}}}export{D as $}; 2//# sourceMappingURL=useAsyncList-BWMRrDM7.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.