farming-code 2.2.18 → 2.2.19
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/backend/agent-manager.js +145 -42
- package/backend/bundle-update-helper.js +109 -0
- package/backend/config-manager.js +110 -4
- package/backend/farming-session-store.js +62 -2
- package/backend/server.js +364 -58
- package/backend/update-service.js +46 -23
- package/dist/assets/App-CbXYBccJ.js +210 -0
- package/dist/assets/{FileEditorPane-DNy3LAqS.js → FileEditorPane-CJs6kfZO.js} +1 -1
- package/dist/assets/{IconGlyphs-BsUfqpKN.js → IconGlyphs-CZzDr5o2.js} +1 -1
- package/dist/assets/{ProjectFilesSection-BhDEUVHA.js → ProjectFilesSection-DWCV07lA.js} +1 -1
- package/dist/assets/{ReviewPage-ChtByBe3.js → ReviewPage-DBKNOWsJ.js} +1 -1
- package/dist/assets/code-dark-qIBiLBWV.css +1 -0
- package/dist/assets/{index-fp8VhOes.js → index-DQdtPfCk.js} +2 -2
- package/dist/assets/main-yzZEfgft.css +1 -0
- package/dist/index.html +1 -1
- package/frontend/skins/crt/app.js +91 -9
- package/frontend/skins/crt/index.html +16 -28
- package/package.json +1 -1
- package/dist/assets/App-DTAQilnX.js +0 -210
- package/dist/assets/code-dark-5esj0bRu.css +0 -1
- package/dist/assets/main-DSO3i_Gs.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{i as r,n as i,t as a}from"./jsx-runtime-BthL93pI.js";import{t as o}from"./react-dom-gtU6X-Hj.js";import{$ as s,B as c,D as l,E as u,F as d,G as f,H as p,J as m,K as h,M as g,N as _,O as v,P as y,Q as b,U as x,V as S,W as C,X as w,Y as T,Z as E,f as D,j as O,p as k,q as A,r as j,s as M,t as N,y as ee,z as P}from"./workspace-view-state-BpPINu84.js";import{A as te,O as ne,_ as re,a as ie,c as F,d as I,f as ae,h as oe,i as L,n as R,r as se,t as ce,u as le,y as ue}from"./file-icons-DpbrD5ZP.js";import{_ as de,c as z,s as fe,u as B,v as pe}from"./IconGlyphs-BsUfqpKN.js";import{u as me}from"./workspace-working-copy-D8-s_Sgh.js";import{t as he}from"./useWorkspaceMenuKeyboard-Brws6Ar9.js";var V=t(r()),H=a();function ge(e){return{"--change-indent":`${18+e*12}px`,"--change-guide-width":`${e*12}px`}}function _e(e){return e.sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)||e.path.localeCompare(t.path)),e.forEach(e=>{e.type===`directory`&&_e(e.children)}),e}function ve(e){return e.reduce((e,t)=>t.type===`file`?e+1:(t.descendantCount=+!!t.change+ve(t.children),e+t.descendantCount),0)}function ye(e){return e.map(e=>{if(e.type===`file`)return e;let t={...e,children:ye(e.children)};for(;!t.change&&t.children.length===1&&t.children[0]?.type===`directory`&&!t.children[0].change;){let e=t.children[0];t={...e,displayName:`${t.displayName??t.name}/${e.displayName??e.name}`}}return t})}function be(e,t){let n=[],r=new Map([[``,n]]),i=new Map,a=(e,n,a)=>{let o=i.get(e);if(o)return o;let s=[],c={id:`${t}:dir:${e}`,name:a,path:e,type:`directory`,children:s,descendantCount:0};return i.set(e,c),r.set(e,s),r.get(n)?.push(c),c};e.forEach(e=>{let n=e.path.replace(/\/+$/,``),o=n.split(`/`).filter(Boolean);if(o.length===0)return;let s=``,c=e.type===`directory`||e.path.endsWith(`/`),l=c?o.length:o.length-1;for(let e=0;e<l;e+=1){let t=o[e];if(!t)continue;let n=o.slice(0,e+1).join(`/`);a(n,s,t),s=n}if(c){let t=i.get(n);t&&(t.change=e);return}r.get(s)?.push({id:`${t}:file:${g(e)}`,name:o[o.length-1]||e.name,path:e.path,type:`file`,change:e})});let o=ye(_e(n));return ve(o),o}function xe({activeFilePath:e,change:t,copy:n,onOpenChange:r}){let i=e===t.path,a=n.gitStatus(t.gitStatus),o=t.gitStatus===`untracked`?``:t.gitStatusLabel,s=t.previousPath?O(t):``;return(0,H.jsx)(`div`,{className:`code-file-change-row ${i?`active`:``}`,"data-testid":`code-file-change-row`,"data-file-path":t.path,"data-file-type":`file`,title:_(t,a),children:(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-main`,onClick:()=>r(t),children:[(0,H.jsx)(`span`,{className:`code-file-chevron placeholder`,"aria-hidden":`true`}),(0,H.jsx)(`img`,{className:`code-file-type-icon file`,src:R(t.path),alt:``,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`code-file-change-name`,children:t.name}),(0,H.jsx)(`span`,{className:`code-file-change-path`,children:s}),(0,H.jsx)(`span`,{className:`code-file-change-status ${t.gitStatus}`,title:a,children:o})]})},g(t))}function Se({activeFilePath:e,copy:t,depth:n,nodes:r,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o}){return(0,H.jsx)(H.Fragment,{children:r.map(r=>{if(r.type===`file`)return(0,H.jsx)(`div`,{style:ge(n),children:(0,H.jsx)(xe,{activeFilePath:e,change:r.change,copy:t,onOpenChange:a})},r.id);let s=r.children.length>0,c=s&&i.has(r.id);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`code-file-change-row directory`,"data-testid":`code-file-change-directory-row`,"data-file-path":r.path,"data-file-type":`directory`,title:r.path,style:ge(n),children:(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-main directory`,"aria-expanded":s?c:void 0,onClick:()=>{s&&o(r.id)},children:[(0,H.jsx)(`span`,{className:`code-file-chevron ${s?c?`expanded`:`collapsed`:`placeholder`}`,"aria-hidden":`true`,children:s?c?(0,H.jsx)(z,{}):(0,H.jsx)(B,{}):null}),(0,H.jsx)(`span`,{className:`code-file-change-name`,children:r.displayName??r.name}),(0,H.jsx)(`span`,{className:`code-file-change-status directory`,children:r.descendantCount||``})]})}),c&&(0,H.jsx)(Se,{activeFilePath:e,copy:t,depth:n+1,nodes:r.children,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o})]},r.id)})})}function Ce({activeFilePath:e,projectWorkspace:t,changes:n,collapsed:r,copy:a,projectId:o,refreshing:s,onOpenChange:c,onToggleCollapsed:l}){let[u,d]=(0,V.useState)(!0),[f,p]=(0,V.useState)(()=>new Set),m=(0,V.useMemo)(()=>n.items.filter(e=>e.gitStatus!==`untracked`),[n.items]),h=(0,V.useMemo)(()=>n.items.filter(e=>e.gitStatus===`untracked`),[n.items]),g=(0,V.useMemo)(()=>be(m,`tracked`),[m]),_=(0,V.useMemo)(()=>be(h,`untracked`),[h]),v=s||n.loading,y=v?`refreshing`:n.error?`stale`:`refreshed`;if(n.items.length===0&&!n.error)return null;let b=()=>{r&&n.refreshChanges(),l()},x=()=>{d(e=>(e&&n.refreshChanges(),!e))},S=e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},C=e=>{let n=new URLSearchParams({root:t,scope:e});e===`untracked`&&n.set(`modifiedWithinDays`,`3`),window.open(i(`/review?${n.toString()}`),`_blank`,`noopener,noreferrer`)};return(0,H.jsxs)(`div`,{className:`code-file-changes-section`,"data-testid":`code-file-changes-section`,"data-project-id":o,"aria-label":a.changedFiles,"aria-busy":v,children:[m.length>0&&(0,H.jsxs)(`div`,{className:`code-file-change-group tracked ${r?`collapsed`:``}`,"data-testid":`code-file-change-tracked-group`,children:[(0,H.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!r,onClick:b,children:[(0,H.jsx)(`span`,{className:`code-file-section-chevron ${r?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:r?(0,H.jsx)(B,{}):(0,H.jsx)(z,{})}),(0,H.jsx)(`span`,{children:a.changes}),(0,H.jsx)(`span`,{className:`code-file-changes-count ${y}`,"data-testid":`code-file-changes-tracked-count`,"data-refresh-state":y,"aria-label":v?a.refreshingFiles:void 0,title:n.error??void 0,children:v?(0,H.jsx)(`span`,{className:`code-file-changes-count-loader`,"aria-hidden":`true`,children:`···`}):m.length})]}),(0,H.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>C(`tracked`),children:a.reviewChanges})]}),!r&&(0,H.jsx)(Se,{activeFilePath:e,copy:a,depth:0,nodes:g,openDirectoryIds:f,onOpenChange:c,onToggleDirectory:S})]}),h.length>0&&(0,H.jsxs)(`div`,{className:`code-file-change-group untracked ${u?`collapsed`:``}`,"data-testid":`code-file-change-untracked-group`,children:[(0,H.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!u,onClick:x,children:[(0,H.jsx)(`span`,{className:`code-file-section-chevron ${u?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:u?(0,H.jsx)(B,{}):(0,H.jsx)(z,{})}),(0,H.jsx)(`span`,{children:a.untrackedChanges}),(0,H.jsx)(`span`,{className:`code-file-changes-count ${y}`,"data-testid":`code-file-changes-untracked-count`,"data-refresh-state":y,"aria-label":v?a.refreshingFiles:void 0,title:n.error??void 0,children:v?(0,H.jsx)(`span`,{className:`code-file-changes-count-loader`,"aria-hidden":`true`,children:`···`}):(0,H.jsxs)(H.Fragment,{children:[h.length,n.truncated?`+`:``]})})]}),(0,H.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>C(`untracked`),children:a.reviewChanges})]}),!u&&(0,H.jsx)(Se,{activeFilePath:e,copy:a,depth:0,nodes:_,openDirectoryIds:f,onOpenChange:c,onToggleDirectory:S})]}),n.error&&(0,H.jsx)(`div`,{className:`code-file-changes-status error`,"data-testid":`code-file-changes-error`,children:n.error})]})}function we(e){let t=e.trim().replace(/^\.\/+/,``);if(!t)return null;let n=t.match(/^(.+?)#L(\d+)(?:C(\d+))?$/i);if(n)return{path:n[1]||``,lineNumber:Number(n[2]),column:n[3]?Number(n[3]):void 0};let r=t.match(/^(.+?):(\d+)(?::(\d+))?$/);return r?{path:r[1]||``,lineNumber:Number(r[2]),column:r[3]?Number(r[3]):void 0}:null}function Te(e){let t=e.ranges[0];return t?{lineNumber:e.lineNumber,column:t.start+1,endColumn:Math.max(t.start+1,t.end+1)}:{lineNumber:e.lineNumber}}function Ee(e){return e.kind===`path`?{path:e.path}:{path:e.path,target:Te(e)}}function De(e){let t=we(e);return t?{path:t.path,target:{lineNumber:t.lineNumber,column:t.column}}:null}function Oe({active:e,activeMatchIndex:t,jumpTarget:n,listboxId:r}){if(e)return n?`${r}-jump`:t>=0?`${r}-${t}`:void 0}function ke(e,t){let n=t.trim().replace(/^\.\/+/,``).toLowerCase();if(!e||!n)return null;let r=e.toLowerCase().indexOf(n);return r===-1?null:{start:r,end:r+n.length}}function Ae(e,t){if(t===0)return!0;let n=e[t-1]??``,r=e[t]??``;return/[-_\s./\\]/.test(n)?!0:/[a-z0-9]/.test(n)&&/[A-Z]/.test(r)}function je(e,t,n){let r=[],i=0;for(let a=0;a<e.length&&i<t.length;a+=1)n&&!Ae(e,a)||e[a]?.toLowerCase()===t[i]&&(r.push({start:a,end:a+1}),i+=1);return i===t.length?r:[]}function Me(e,t){let n=t.trim().replace(/^\.\/+/,``).toLowerCase();if(!e||!n||n.length>6)return[];let r=je(e,n,!0);return r.length>0?r:je(e,n,!1)}function Ne(e,t){let n=[];return t.map(t=>({start:Math.max(0,Math.min(e.length,t.start)),end:Math.max(0,Math.min(e.length,t.end))})).filter(e=>e.end>e.start).sort((e,t)=>e.start-t.start||e.end-t.end).forEach(e=>{let t=n[n.length-1];if(t&&e.start<=t.end){t.end=Math.max(t.end,e.end);return}n.push(e)}),n}function Pe(e,t){let n=ke(e,t);return n?[n]:Me(e,t)}function Fe(e,t=[]){let n=Ne(e,t);if(n.length===0)return e;let r=[],i=0;return n.forEach((t,n)=>{t.start>i&&r.push(e.slice(i,t.start)),r.push((0,H.jsx)(`span`,{className:`code-file-search-highlight`,children:e.slice(t.start,t.end)},`${t.start}:${t.end}:${n}`)),i=t.end}),i<e.length&&r.push(e.slice(i)),r}function Ie(e,t){return Fe(e,Pe(e,t))}function Le(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n===-1?{directory:``,name:t}:{directory:t.slice(0,n),name:t.slice(n+1)||t}}function Re(e){if(!e||typeof window>`u`)return null;let t=e.getBoundingClientRect();if(ne()){let n=window.visualViewport,r=n?.offsetTop??0,i=n?.offsetLeft??0,a=n?.width??window.innerWidth,o=n?.height??window.innerHeight,s=e.closest(`.code-sidebar`)?.getBoundingClientRect(),c=Math.max(i+6,(s?.left??i)+6),l=Math.min(i+a-6,(s?.right??i+a)-6),u=r+o-t.bottom-10,d=t.top-r-10,f=u<120&&d>u,p=Math.max(72,Math.min(320,f?d:u));return{left:c,top:f?Math.max(r+6,t.top-p-4):Math.max(r+6,t.bottom+4),width:Math.max(180,l-c),maxHeight:p}}let n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),r=Math.max(document.documentElement.clientHeight,window.innerHeight||0),i=Math.max(240,n-24),a=Math.min(620,i,Math.max(420,t.width)),o=Math.max(12,Math.min(t.left,n-a-12)),s=Math.min(t.bottom+6,r-12);return{left:o,top:s,width:a,maxHeight:Math.max(168,Math.min(420,r-s-12))}}function ze({path:e,query:t}){let{directory:n,name:r}=Le(e);return(0,H.jsxs)(`span`,{className:`code-file-search-copy`,children:[(0,H.jsx)(`span`,{className:`code-file-search-name`,children:Ie(r,t)}),n&&(0,H.jsx)(`span`,{className:`code-file-search-directory`,children:Ie(n,t)})]})}function Be({activeMatchIndex:e,anchorRef:t,copy:n,containerRef:r,error:i,jumpTarget:a,listboxId:o,loading:s,matches:c,openFileError:l,query:u,showIgnoredSearch:d,timeoutMs:f,truncated:p,onOpenJumpQuery:m,onOpenMatch:h,onSearchIgnored:g,onSelectMatchIndex:_}){let[v,y]=(0,V.useState)(()=>Re(t.current)),b=(0,V.useCallback)(()=>{y(Re(t.current))},[t]);return(0,V.useLayoutEffect)(()=>{b();let e=t.current?.closest(`.code-project-list`);return window.addEventListener(`resize`,b),window.addEventListener(`scroll`,b,!0),window.visualViewport?.addEventListener(`resize`,b),window.visualViewport?.addEventListener(`scroll`,b),e?.addEventListener(`scroll`,b,{passive:!0}),()=>{window.removeEventListener(`resize`,b),window.removeEventListener(`scroll`,b,!0),window.visualViewport?.removeEventListener(`resize`,b),window.visualViewport?.removeEventListener(`scroll`,b),e?.removeEventListener(`scroll`,b)}},[t,b]),(0,H.jsx)(`div`,{ref:r,id:o,className:`code-file-search-results`,"data-testid":`code-file-search-results`,role:`listbox`,"aria-label":n.searchFilesOrJump,style:v?{left:v.left,top:v.top,width:v.width,maxHeight:v.maxHeight}:void 0,children:a?l?(0,H.jsx)(`div`,{className:`code-file-search-state error`,children:l}):(0,H.jsxs)(`button`,{id:`${o}-jump`,type:`button`,className:`code-file-search-result jump active`,onClick:()=>m(u),role:`option`,"aria-selected":`true`,children:[(0,H.jsx)(`span`,{className:`code-file-search-kind`,children:n.go}),(0,H.jsx)(ze,{path:a.path,query:u}),(0,H.jsx)(`span`,{className:`code-file-search-line`,children:a.lineNumber})]}):s?(0,H.jsx)(`div`,{className:`code-file-search-state`,children:n.searching}):i?(0,H.jsx)(`div`,{className:`code-file-search-state error`,children:i}):c.length===0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`code-file-search-state`,children:n.noMatches}),d&&(0,H.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,H.jsx)(`div`,{className:`code-file-search-state muted`,children:n.searchIncomplete(f)})]}):(0,H.jsxs)(H.Fragment,{children:[c.map((t,r)=>(0,H.jsxs)(`button`,{id:`${o}-${r}`,type:`button`,className:`code-file-search-result ${r===e?`active`:``}`,onPointerMove:e=>{e.pointerType===`mouse`&&_(r)},onClick:()=>h(t),title:t.entryType===`directory`?t.path:`${t.path}:${t.lineNumber}`,role:`option`,"aria-selected":r===e,children:[(0,H.jsx)(`img`,{className:`code-file-type-icon ${t.entryType===`directory`?`folder`:`file`}`,src:t.entryType===`directory`?ce(t.path,!1):R(t.path),alt:``,"aria-hidden":`true`}),(0,H.jsx)(ze,{path:t.path,query:u}),t.kind===`path`?(0,H.jsx)(`span`,{className:`code-file-search-kind`,children:t.entryType===`directory`?n.folder:n.file}):(0,H.jsx)(`span`,{className:`code-file-search-line`,children:t.lineNumber}),t.lines&&(0,H.jsx)(`span`,{className:`code-file-search-preview`,children:Fe(t.lines,t.ranges)})]},`${t.path}:${t.lineNumber}:${r}`)),d&&(0,H.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,H.jsx)(`div`,{className:`code-file-search-state muted`,children:n.moreMatchesOmitted})]})})}var Ve=12;function He(e,t){return e===`git`?t.containsUncommittedChanges:e===`external`?t.changedOnDisk:e===`dirty`?t.unsavedChanges:t.changedOnDisk}function Ue(e){return{"--file-indent":`${6+e*Ve}px`,"--file-status-indent":`${24+e*Ve}px`,"--file-guide-width":`${e*Ve}px`,"--file-depth":e}}function We(e){return e===`untracked`?void 0:e}function Ge(e){let t=We(e);return t?`code-file-descendant-status ${t}`:``}function Ke(e,t){for(let n of e)if(T(t,n))return!0;return!1}function qe({activeFilePath:e,editorDirtyFilePaths:t,editorExternalChangedFilePaths:n,openFilePendingPath:r,item:i,isFocused:a,isOpen:o,isSelected:s}){let c=i.type===`directory`,l=e===i.path,u=c&&i.loading===!0,d=!c&&r===i.path,f=!c&&t.has(i.path),p=!c&&n.has(i.path),m=c&&Ke(t,i.path),h=c&&Ke(n,i.path),g=We(i.gitStatus),_=We(i.descendantGitStatus),v=g?i.gitStatusLabel:void 0,y=!!g,b=c&&!!_,x=c&&(b||m||h),S=_??(h?`external`:m?`dirty`:void 0),C=_?Ge(_):S?`code-file-descendant-status ${S}`:``,w=b?`git`:h?`external`:m?`dirty`:null,T=p?`external`:f?`dirty`:void 0,E=T?`code-file-changed ${T}`:``,D=p?`external`:f?`dirty`:null,O=g?`code-file-git-status ${g}`:``;return{active:l,chevronState:c?o?`expanded`:`collapsed`:`placeholder`,directoryLoading:u,directoryDotClassName:C,directoryDotKind:S,directoryDotTitleKind:w,editorDirty:f,editorExternalChanged:p,fileChangedClassName:E,fileChangedKind:T,fileChangedTitleKind:D,fileOpening:d,hasDescendantGitStatus:b,hasEditorDirtyDescendant:m,hasEditorExternalChangedDescendant:h,isDirectory:c,rowClasses:[`code-file-row`,c?`directory`:`file`,l?`active`:``,f?`editor-dirty`:``,p?`editor-external-changed`:``,m?`editor-descendant-dirty`:``,h?`editor-descendant-external-changed`:``,a?`focused`:``,s?`selected`:``,u?`loading`:``,d?`opening`:``,i.ignored?`ignored`:``,i.symbolicLink?`symbolic-link`:``,i.external?`external-link`:``,i.linkError?`link-error`:``,y?`git-status`:``,g?`git-${g}`:``,b?`git-descendant`:``,_?`git-descendant-${_}`:``].filter(Boolean).join(` `),showDirectoryDot:x,visibleGitStatus:g,visibleGitStatusClassName:O,visibleGitStatusLabel:v}}function Je({label:e,options:t,testId:n,submenuTestId:r,onOpenDialog:i,onSelect:a}){let[o,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(`right`),d=(0,V.useRef)(null),f=(0,V.useRef)(null),p=(0,V.useRef)(null),m=(0,V.useRef)(null),h=t.length>0,g=(0,V.useCallback)(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),_=(0,V.useCallback)((e=f.current)=>{if(!h)return;g();let t=e?.getBoundingClientRect();t&&t.right+156+12>window.innerWidth?u(`left`):u(`right`),c(!0)},[g,h]),v=(0,V.useCallback)(()=>{g(),m.current=window.setTimeout(()=>{c(!1),m.current=null},120)},[g]),y=(0,V.useCallback)(e=>{_(e.currentTarget.querySelector(`button`))},[_]),x=(0,V.useCallback)(()=>{window.setTimeout(()=>{p.current?.querySelector(`button:not(:disabled)`)?.focus()},0)},[]),S=(0,V.useCallback)(e=>{h&&e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),_(e.currentTarget),x())},[x,h,_]),C=(0,V.useCallback)(e=>{e.key===`ArrowLeft`&&(e.preventDefault(),e.stopPropagation(),c(!1),f.current?.focus())},[]);return(0,H.jsxs)(`div`,{ref:d,className:`code-agent-launch-submenu`,onPointerEnter:y,onPointerLeave:v,onFocus:()=>g(),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(!1)},children:[(0,H.jsxs)(`button`,{ref:f,type:`button`,role:`menuitem`,className:`code-agent-launch-submenu-trigger`,"data-testid":n,"aria-haspopup":h?`menu`:void 0,"aria-expanded":h?o:void 0,onClick:i,onKeyDown:S,children:[(0,H.jsx)(`span`,{children:e}),h&&(0,H.jsx)(B,{className:`code-agent-launch-submenu-arrow`})]}),h&&o&&(0,H.jsx)(`div`,{ref:p,className:`code-agent-launch-submenu-panel ${l}`,"data-testid":r,role:`menu`,onPointerEnter:()=>g(),onPointerLeave:v,onKeyDown:C,children:t.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`agent-launch-${e.name}`,onClick:()=>a(e.command||e.name),children:[(0,H.jsx)(b,{name:e.name}),(0,H.jsx)(`span`,{children:s(e.name)})]},e.name))})]})}function Ye({copy:e,agentLaunchOptions:t,fileMenu:n,menuRef:r,onClose:i,onCloseWithFocusRestore:a,onCopyRelativePath:o,onCopyShareUrl:s,onOpenNewAgent:c,onRefreshTarget:l,onStartAgent:u,onStartOperation:d,readOnly:f=!1}){let p=he({menuOpen:!!n,menuRef:r,onClose:i,onCloseWithFocusRestore:a});if(!n)return null;let m=n.item?.readOnly===!0,h=!f&&!m,g=!f&&(!m||n.item?.symbolicLink===!0);return(0,H.jsxs)(`div`,{ref:r,className:`code-context-menu code-file-context-menu`,"data-testid":`code-file-context-menu`,style:{left:n.x,top:n.y},role:`menu`,onKeyDown:p,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[h&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,autoFocus:!0,onClick:()=>d(`new-file`),children:e.newFile}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`new-folder`),children:e.newFolder}),(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,H.jsx)(Je,{label:e.newAgent,options:t,testId:`file-new-agent-submenu-trigger`,submenuTestId:`file-new-agent-submenu`,onOpenDialog:c,onSelect:u}),(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`})]}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:l,children:e.refresh}),n.item&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),g&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`rename`),children:e.rename}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o,children:e.copyRelativePath}),(n.item.type===`file`||n.item.type===`directory`)&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:s,children:e.copyShareUrl}),g&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`danger`,onClick:()=>d(`delete`),children:e.delete})]})]})]})}var Xe=220,Ze=8,Qe=26,$e=11,et=10;function tt(e){return e?e.type===`directory`?e.path:w(e.path):``}function nt(e,t){return e===`rename`||e===`delete`?t?.name??``:``}function rt(e,t){return{kind:e,item:t,parentPath:tt(t),name:nt(e,t)}}function it(e){if(e.kind!==`rename`||e.item?.type!==`file`)return e.name.length;let t=e.name.lastIndexOf(`.`);return t>0?t:e.name.length}function at(e){let t=e.name.trim();if(e.kind!==`rename`||e.item?.type!==`file`)return t;let n=e.item.name.lastIndexOf(`.`);if(n<=0)return t;let r=e.item.name.slice(n);return t.endsWith(`${r}${r}`)?t.slice(0,-r.length):t}function U(e,t){switch(e.kind){case`new-file`:return t.newFile;case`new-folder`:return t.newFolder;case`rename`:return t.rename;case`delete`:return t.delete}}function ot(e,t,n,r,i,a=0){let o=n?8:4,s=n?4:2,c=a>0?et+a*Qe:0,l=et+o*Qe+s*$e+c;return{x:Math.max(Ze,Math.min(e,r-Xe-Ze)),y:Math.max(Ze,Math.min(t,i-l-Ze))}}function st({agentId:e,copy:t,fileOperation:n,inputRef:r,onCancel:i,onInputName:a,onSubmit:o,onUpdateName:s}){return!n||n.kind===`rename`?null:(0,H.jsx)(`div`,{className:n.kind===`delete`?`code-file-operation-shell delete-confirm`:`code-file-operation-shell`,"data-testid":`code-file-operation-backdrop`,onMouseDown:e=>{e.stopPropagation(),n.kind===`delete`&&e.target===e.currentTarget&&i()},children:(0,H.jsxs)(`form`,{className:`code-file-operation-dialog`,"data-testid":`code-file-operation-dialog`,role:`dialog`,"aria-labelledby":`code-file-operation-title`,autoComplete:`off`,onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i())},onSubmit:e=>{e.preventDefault(),o()},children:[(0,H.jsx)(`label`,{id:`code-file-operation-title`,htmlFor:`code-file-operation-input`,children:U(n,t)}),n.kind===`delete`?(0,H.jsx)(`p`,{className:`code-file-operation-text`,children:n.item?.type===`directory`?t.deleteFolderContents(n.item?.path):t.deleteFile(n.item?.path)}):(0,H.jsx)(`input`,{id:`code-file-operation-input`,"data-testid":`code-file-operation-input`,name:`farming-file-${e}-${n.kind}`,type:`text`,inputMode:`text`,ref:r,value:n.name,autoComplete:`off`,"aria-autocomplete":`none`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,autoFocus:!0,onInput:e=>{a(e.currentTarget.value)},onChange:e=>{s(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),o())}}),(0,H.jsxs)(`div`,{className:`code-rename-actions`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:i,children:t.cancel}),(0,H.jsx)(`button`,{type:`submit`,className:n.kind===`delete`?`danger`:`primary`,disabled:n.kind!==`delete`&&!n.name.trim(),children:n.kind===`delete`?t.delete:t.save})]})]})})}function ct({agentId:e,copy:t,agentLaunchOptions:n,fileMenu:r,fileMenuRef:i,fileOperation:a,fileOperationInputRef:o,onCloseFileMenu:s,onCloseFileMenuWithFocusRestore:c,onCloseFileOperation:l,onCopyFileMenuPath:u,onCopyFileMenuShareUrl:d,onOpenNewAgent:f,onRefreshFileMenuTarget:p,onRememberFileOperationName:m,onStartAgent:h,onStartFileMenuOperation:g,onSubmitFileOperation:_,onUpdateFileOperationName:v,readOnly:y=!1}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ye,{copy:t,agentLaunchOptions:n,fileMenu:r,menuRef:i,onClose:s,onCloseWithFocusRestore:c,onCopyRelativePath:u,onCopyShareUrl:d,onOpenNewAgent:f,onRefreshTarget:p,onStartAgent:h,onStartOperation:g,readOnly:y}),(0,H.jsx)(st,{agentId:e,copy:t,fileOperation:a,inputRef:o,onCancel:l,onInputName:m,onSubmit:()=>{_()},onUpdateName:v})]})}var lt=n((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ut=n(((e,t)=>{t.exports=lt()})),dt=(0,V.createContext)(null);function W(){let e=(0,V.useContext)(dt);if(e===null)throw Error(`No Tree Api Provided`);return e}var ft=(0,V.createContext)(null);function pt(){let e=(0,V.useContext)(ft);if(e===null)throw Error(`Provide a NodesContext`);return e}var mt=(0,V.createContext)(null);function ht(){let e=(0,V.useContext)(mt);if(e===null)throw Error(`Provide a DnDContext`);return e}var gt=(0,V.createContext)(0);function _t(){(0,V.useContext)(gt)}var vt=e({access:()=>Nt,bound:()=>yt,dfs:()=>Et,focusNextElement:()=>Ot,focusPrevElement:()=>kt,getInsertIndex:()=>zt,getInsertParentId:()=>Ht,getTreeLinePrefix:()=>Vt,identify:()=>Ft,identifyNull:()=>Pt,indexOf:()=>wt,isClosed:()=>xt,isDescendant:()=>Ct,isItem:()=>bt,isOpenWithEmptyChildren:()=>St,mergeRefs:()=>It,noop:()=>Tt,safeRun:()=>Lt,waitFor:()=>Rt,walk:()=>Dt});function yt(e,t,n){return Math.max(Math.min(e,n),t)}function bt(e){return e&&e.isLeaf}function xt(e){return e&&e.isInternal&&!e.isOpen}function St(e){return e&&e.isOpen&&!e.children?.length}var Ct=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},wt=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function Tt(){}function Et(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=Et(n,t);if(e)return e}return null}function Dt(e,t){if(t(e),e.children)for(let n of e.children)Dt(n,t)}function Ot(e){let t=Mt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=At(t,r);break}n?.focus()}function kt(e){let t=Mt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=jt(t,r);break}n?.focus()}function At(e,t){return t+1<e.length?e[t+1]:e[0]}function jt(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Mt(e){return Array.from(document.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)`)).filter(t=>t===e||!e.contains(t))}function Nt(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Pt(e){return e===null?null:Ft(e)}function Ft(e){return typeof e==`string`?e:e.id}function It(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Lt(e,...t){if(e)return e(...t)}function Rt(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function zt(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}var Bt={last:`└ `,middle:`├ `,pipe:`│ `,blank:` `};function Vt(e,t={}){let n=Object.assign(Object.assign({},Bt),t);if(e.level===0)return``;let r=e.nextSibling===null?n.last:n.middle,i=e.parent;for(;i&&i.level>0;)r=(i.nextSibling===null?n.blank:n.pipe)+r,i=i.parent;return r}function Ht(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Ut={display:`flex`,alignItems:`center`,zIndex:1},Wt={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Gt={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Kt=V.memo(function({top:e,left:t,indent:n}){let r={position:`absolute`,pointerEvents:`none`,top:e-2+`px`,left:t+`px`,right:n+`px`};return(0,H.jsxs)(`div`,{style:Object.assign(Object.assign({},Ut),r),children:[(0,H.jsx)(`div`,{style:Object.assign({},Gt)}),(0,H.jsx)(`div`,{style:Object.assign({},Wt)})]})});function qt({node:e,attrs:t,innerRef:n,children:r}){return(0,H.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function Jt(e){return(0,H.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,H.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,H.jsx)(Xt,Object.assign({},e)):(0,H.jsx)(Yt,Object.assign({},e))]})}function Yt(e){return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`span`,{children:e.node.data.name})})}function Xt({node:e}){let t=(0,V.useRef)();return(0,V.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,H.jsx)(`input`,{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{n.key===`Escape`&&e.reset(),n.key===`Enter`&&e.submit(t.current?.value||``)}})}var Zt=`__REACT_ARBORIST_INTERNAL_ROOT__`;function Qt(e){function t(n,r,i){let a=new $t({tree:e,data:n,level:r,parent:i,id:e.accessId(n),children:null,isDraggable:e.isDraggable(n),rowIndex:null}),o=e.accessChildren(n);return o&&(a.children=o.map(e=>t(e,r+1,a))),a}let n=new $t({tree:e,id:Zt,data:{id:Zt},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var $t=class e{constructor(e){this.handleClick=e=>{(e.metaKey||e.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===Zt}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){return this.isSelected&&!this.prev?.isSelected}get isSelectedEnd(){return this.isSelected&&!this.next?.isSelected}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){let e=this.childIndex;return this.parent?.children[e+1]??null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new e(Object.assign({},this))}edit(){return this.tree.edit(this)}};function en(e){return{type:`EDIT`,id:e}}function tn(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function nn(e){return{type:`FOCUS`,id:e}}function rn(){return{type:`TREE_BLUR`}}function an(e={id:null,treeFocused:!1},t){return t.type===`FOCUS`?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type===`TREE_BLUR`?Object.assign(Object.assign({},e),{treeFocused:!1}):e}var on={open(e,t){return{type:`VISIBILITY_OPEN`,id:e,filtered:t}},close(e,t){return{type:`VISIBILITY_CLOSE`,id:e,filtered:t}},toggle(e,t){return{type:`VISIBILITY_TOGGLE`,id:e,filtered:t}},clear(e){return{type:`VISIBILITY_CLEAR`,filtered:e}}};function sn(e={},t){if(t.type===`VISIBILITY_OPEN`)return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type===`VISIBILITY_CLOSE`)return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type===`VISIBILITY_TOGGLE`){let n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}else if(t.type===`VISIBILITY_CLEAR`)return{};else return e}function cn(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:sn(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:sn(e.unfiltered,t)}):e}var ln=e=>({nodes:{open:{filtered:{},unfiltered:e?.initialOpenState??{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:`none`},dragId:null,dragIds:[],parentId:null,index:-1}}),un={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:Ft(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(Ft)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(Ft)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:Ft(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:Ft(e)})};function dn(e=ln().nodes.selection,t){let n=e.ids;switch(t.type){case`SELECTION_CLEAR`:return Object.assign(Object.assign({},e),{ids:new Set});case`SELECTION_ONLY`:return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case`SELECTION_ADD`:return t.ids.length===0?e:(t.ids.forEach(e=>n.add(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_REMOVE`:return t.ids.length===0?e:(t.ids.forEach(e=>n.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_SET`:return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case`SELECTION_MOST_RECENT`:return Object.assign(Object.assign({},e),{mostRecent:t.id});case`SELECTION_ANCHOR`:return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}var fn={cursor(e){return{type:`DND_CURSOR`,cursor:e}},dragStart(e,t){return{type:`DND_DRAG_START`,id:e,dragIds:t}},dragEnd(){return{type:`DND_DRAG_END`}},hovering(e,t){return{type:`DND_HOVERING`,parentId:e,index:t}}};function pn(e=ln().dnd,t){switch(t.type){case`DND_CURSOR`:return Object.assign(Object.assign({},e),{cursor:t.cursor});case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case`DND_DRAG_END`:return ln().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var mn={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},hn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},gn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function _n({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,H.jsxs)(vn,{isDragging:i,children:[(0,H.jsx)(yn,{offset:e,children:(0,H.jsx)(xn,{id:n,dragIds:r})}),(0,H.jsx)(bn,{mouse:t,count:r.length})]})}var vn=(0,V.memo)(function(e){return e.isDragging?(0,H.jsx)(`div`,{style:mn,children:e.children}):null});function yn(e){return(0,H.jsx)(`div`,{className:`row preview`,style:hn(e.offset),children:e.children})}function bn(e){let{count:t,mouse:n}=e;return t>1?(0,H.jsx)(`div`,{className:`selected-count`,style:gn(n),children:t}):null}var xn=(0,V.memo)(function(e){let t=W(),n=t.get(e.id);return n?(0,H.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null});function Sn(){return Sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sn.apply(null,arguments)}function Cn(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function wn(e,t){return wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wn(e,t)}function Tn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,wn(e,t)}var En=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function Dn(e,t){return!!(e===t||En(e)&&En(t))}function On(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Dn(e[n],t[n]))return!1;return!0}function kn(e,t){t===void 0&&(t=On);var n,r=[],i,a=!1;function o(){var o=[...arguments];return a&&n===this&&t(o,r)?i:(i=e.apply(this,o),a=!0,n=this,r=o,i)}return o}var An=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function jn(e){cancelAnimationFrame(e.id)}function Mn(e,t){var n=An();function r(){An()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var Nn=-1;function Pn(e){if(e===void 0&&(e=!1),Nn===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),Nn=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Nn}var Fn=null;function In(e){if(e===void 0&&(e=!1),Fn===null||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,n.direction=`rtl`;var r=document.createElement(`div`),i=r.style;return i.width=`100px`,i.height=`100px`,t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Fn=`positive-descending`:(t.scrollLeft=1,Fn=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),Fn}return Fn}var Ln=150,Rn=function(e,t){return e};function zn(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(e){Tn(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,Cn(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:Cn(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=kn(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=kn(function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var t=r.props,a=t.direction,o=t.itemSize,s=t.layout,c=r._getItemStyleCache(l&&o,l&&s,l&&a),u;if(c.hasOwnProperty(e))u=c[e];else{var d=n(r.props,e,r._instanceProps),f=i(r.props,e,r._instanceProps),p=a===`horizontal`||s===`horizontal`,m=a===`rtl`,h=p?d:0;c[e]=u={position:`absolute`,left:m?void 0:h,right:m?h:void 0,top:p?0:d,height:p?`100%`:f,width:p?f:`100%`}}return u},r._getItemStyleCache=void 0,r._getItemStyleCache=kn(function(e,t,n){return{}}),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;r.setState(function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,o=i;if(t===`rtl`)switch(In()){case`negative`:o=-i;break;case`positive-descending`:o=a-n-i;break}return o=Math.max(0,Math.min(o,a-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?`forward`:`backward`,scrollOffset:o,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;r.setState(function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?`forward`:`backward`,scrollOffset:t,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,typeof t==`function`?t(e):typeof t==`object`&&t&&t.hasOwnProperty(`current`)&&(t.current=e)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&jn(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Mn(r._resetIsScrolling,Ln)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Bn(e,t),u(e),null};var d=t.prototype;return d.scrollTo=function(e){e=Math.max(0,e),this.setState(function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?`forward`:`backward`,scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},d.scrollToItem=function(e,t){t===void 0&&(t=`auto`);var n=this.props,r=n.itemCount,i=n.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var s=0;if(this._outerRef){var c=this._outerRef;s=i===`vertical`?c.scrollWidth>c.clientWidth?Pn():0:c.scrollHeight>c.clientHeight?Pn():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},d.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if(typeof n==`number`&&this._outerRef!=null){var i=this._outerRef;t===`horizontal`||r===`horizontal`?i.scrollLeft=n:i.scrollTop=n}this._callPropsCallbacks()},d.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,i=r.scrollOffset;if(r.scrollUpdateWasRequested&&this._outerRef!=null){var a=this._outerRef;if(t===`horizontal`||n===`horizontal`)if(t===`rtl`)switch(In()){case`negative`:a.scrollLeft=-i;break;case`positive-ascending`:a.scrollLeft=i;break;default:var o=a.clientWidth;a.scrollLeft=a.scrollWidth-o-i;break}else a.scrollLeft=i;else a.scrollTop=i}this._callPropsCallbacks()},d.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&jn(this._resetIsScrollingTimeoutId)},d.render=function(){var e=this.props,t=e.children,n=e.className,i=e.direction,a=e.height,o=e.innerRef,s=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=d===void 0?Rn:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,v=e.width,y=this.state.isScrolling,b=i===`horizontal`||p===`horizontal`,x=b?this._onScrollHorizontal:this._onScrollVertical,S=this._getRangeToRender(),C=S[0],w=S[1],T=[];if(l>0)for(var E=C;E<=w;E++)T.push((0,V.createElement)(t,{data:u,key:f(E,u),index:E,isScrolling:_?y:void 0,style:this._getItemStyle(E)}));var D=r(this.props,this._instanceProps);return(0,V.createElement)(m||h||`div`,{className:n,onScroll:x,ref:this._outerRefSetter,style:Sn({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,V.createElement)(s||c||`div`,{children:T,ref:o,style:{height:b?`100%`:D,pointerEvents:y?`none`:void 0,width:b?D:`100%`}}))},d._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered==`function`&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if(typeof this.props.onScroll==`function`){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,c=a.scrollUpdateWasRequested;this._callOnScroll(o,s,c)}},d._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,a=r.scrollDirection,c=r.scrollOffset;if(t===0)return[0,0,0,0];var l=o(this.props,c,this._instanceProps),u=s(this.props,l,c,this._instanceProps),d=!i||a===`backward`?Math.max(1,n):1,f=!i||a===`forward`?Math.max(1,n):1;return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},t}(V.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Bn=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Vn=50,Hn=function(e,t,n){var r=e.itemSize,i=n.itemMetadataMap,a=n.lastMeasuredIndex;if(t>a){var o=0;if(a>=0){var s=i[a];o=s.offset+s.size}for(var c=a+1;c<=t;c++){var l=r(c);i[c]={offset:o,size:l},o+=l}n.lastMeasuredIndex=t}return i[t]},Un=function(e,t,n){var r=t.itemMetadataMap,i=t.lastMeasuredIndex;return(i>0?r[i].offset:0)>=n?Wn(e,t,i,0,n):Gn(e,t,Math.max(0,i),n)},Wn=function(e,t,n,r,i){for(;r<=n;){var a=r+Math.floor((n-r)/2),o=Hn(e,a,t).offset;if(o===i)return a;o<i?r=a+1:o>i&&(n=a-1)}return r>0?r-1:0},Gn=function(e,t,n,r){for(var i=e.itemCount,a=1;n<i&&Hn(e,n,t).offset<r;)n+=a,a*=2;return Wn(e,t,Math.min(n,i-1),Math.floor(n/2),r)},Kn=function(e,t){var n=e.itemCount,r=t.itemMetadataMap,i=t.estimatedItemSize,a=t.lastMeasuredIndex,o=0;if(a>=n&&(a=n-1),a>=0){var s=r[a];o=s.offset+s.size}var c=(n-a-1)*i;return o+c},qn=zn({getItemOffset:function(e,t,n){return Hn(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:Kn,getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.layout,l=e.width,u=o===`horizontal`||c===`horizontal`?l:s,d=Hn(e,t,i),f=Kn(e,i),p=Math.max(0,Math.min(f-u,d.offset)),m=Math.max(0,d.offset-u+d.size+a);switch(n===`smart`&&(n=r>=m-u&&r<=p+u?`auto`:`center`),n){case`start`:return p;case`end`:return m;case`center`:return Math.round(m+(p-m)/2);default:return r>=m&&r<=p?r:r<m?m:p}},getStartIndexForOffset:function(e,t,n){return Un(e,n,t)},getStopIndexForStartIndex:function(e,t,n,r){for(var i=e.direction,a=e.height,o=e.itemCount,s=e.layout,c=e.width,l=i===`horizontal`||s===`horizontal`?c:a,u=Hn(e,t,r),d=n+l,f=u.offset+u.size,p=t;p<o-1&&f<d;)p++,f+=Hn(e,p,r).size;return p},initInstanceProps:function(e,t){var n={itemMetadataMap:{},estimatedItemSize:e.estimatedItemSize||Vn,lastMeasuredIndex:-1};return t.resetAfterIndex=function(e,r){r===void 0&&(r=!0),n.lastMeasuredIndex=Math.min(n.lastMeasuredIndex,e-1),t._getItemStyleCache(-1),r&&t.forceUpdate()},n},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(e){e.itemSize}}),Jn=zn({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f=o===`horizontal`||u===`horizontal`?d:s,p=Math.max(0,c*l-f),m=Math.min(p,t*l),h=Math.max(0,t*l-f+l+a);switch(n===`smart`&&(n=r>=h-f&&r<=m+f?`auto`:`center`),n){case`start`:return m;case`end`:return h;case`center`:var g=Math.round(h+(m-h)/2);return g<Math.ceil(f/2)?0:g>p+Math.floor(f/2)?p:g;default:return r>=h&&r<=m?r:r<h?h:m}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,c=e.width,l=r===`horizontal`||s===`horizontal`,u=t*o,d=Math.ceil(((l?c:i)+n-u)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function Yn(){let e=W(),t=ht().cursor;if(!t||t.type!==`line`)return null;let n=e.indent,r=e.rowTopPosition(t.index)+(e.props.padding??e.props.paddingTop??0),i=n*t.level,a=e.renderCursor;return(0,H.jsx)(a,{top:r,left:i,indent:n})}var Xn=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Zn=(0,V.forwardRef)(function(e,t){let{children:n}=e,r=Xn(e,[`children`]),i=W();return(0,H.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&i.deselectAll()},children:[(0,H.jsx)(Qn,{}),n]}))}),Qn=()=>{let e=W();return(0,H.jsx)(`div`,{style:{height:e.rowTopPosition(e.visibleNodes.length),width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,H.jsx)(Yn,{})})},$n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},er=(0,V.forwardRef)(function(e,t){var{style:n}=e,r=$n(e,[`style`]);let i=W(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,H.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))}),tr=(0,V.createContext)({dragDropManager:void 0}),G;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(G||={});function K(e,t){var n=[...arguments].slice(2);if(!e){var r;if(t===void 0)r=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var i=0;r=Error(t.replace(/%s/g,function(){return n[i++]})),r.name=`Invariant Violation`}throw r.framesToPop=1,r}}var nr=`dnd-core/INIT_COORDS`,rr=`dnd-core/BEGIN_DRAG`,ir=`dnd-core/PUBLISH_DRAG_SOURCE`,ar=`dnd-core/HOVER`,or=`dnd-core/DROP`,sr=`dnd-core/END_DRAG`;function cr(e,t){return{type:nr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function lr(e){"@babel/helpers - typeof";return lr=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},lr(e)}function ur(e,t,n){return t.split(`.`).reduce(function(e,t){return e&&e[t]?e[t]:n||null},e)}function dr(e,t){return e.filter(function(e){return e!==t})}function fr(e){return lr(e)===`object`}function pr(e,t){var n=new Map,r=function(e){n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);var i=[];return n.forEach(function(e,t){e===1&&i.push(t)}),i}function mr(e,t){return e.filter(function(e){return t.indexOf(e)>-1})}var hr={type:nr,payload:{clientOffset:null,sourceClientOffset:null}};function gr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},r=n.publishSource,i=r===void 0?!0:r,a=n.clientOffset,o=n.getSourceClientOffset,s=e.getMonitor(),c=e.getRegistry();e.dispatch(cr(a)),_r(t,s,c);var l=br(t,s);if(l===null){e.dispatch(hr);return}var u=null;if(a){if(!o)throw Error(`getSourceClientOffset must be defined`);vr(o),u=o(l)}e.dispatch(cr(a,u));var d=c.getSource(l).beginDrag(s,l);if(d!=null)return yr(d),c.pinSource(l),{type:rr,payload:{itemType:c.getSourceType(l),item:d,sourceId:l,clientOffset:a||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}function _r(e,t,n){K(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){K(n.getSource(e),`Expected sourceIds to be registered.`)})}function vr(e){K(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function yr(e){K(fr(e),`Item must be an object.`)}function br(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function xr(e){return function(){if(e.getMonitor().isDragging())return{type:ir}}}function Sr(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function Cr(e){return function(t){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;wr(t);var r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Tr(r,i,a),Er(r,a,i.getItemType()),Dr(r,i,a),{type:ar,payload:{targetIds:r,clientOffset:n||null}}}}function wr(e){K(Array.isArray(e),`Expected targetIds to be an array.`)}function Tr(e,t,n){K(t.isDragging(),`Cannot call hover while not dragging.`),K(!t.didDrop(),`Cannot call hover after drop.`);for(var r=0;r<e.length;r++){var i=e[r];K(e.lastIndexOf(i)===r,`Expected targetIds to be unique in the passed array.`),K(n.getTarget(i),`Expected targetIds to be registered.`)}}function Er(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r];Sr(t.getTargetType(i),n)||e.splice(r,1)}}function Dr(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Or(Object(n),!0).forEach(function(t){Ar(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Or(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ar(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();Mr(n),Fr(n).forEach(function(i,a){var o=Nr(i,a,r,n),s={type:or,payload:{dropResult:kr(kr({},t),o)}};e.dispatch(s)})}}function Mr(e){K(e.isDragging(),`Cannot call drop while not dragging.`),K(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Nr(e,t,n,r){var i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Pr(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Pr(e){K(e===void 0||fr(e),`Drop result must either be an object or undefined.`)}function Fr(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ir(e){return function(){var t=e.getMonitor(),n=e.getRegistry();Lr(t);var r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:sr}}}function Lr(e){K(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Rr(e){return{beginDrag:gr(e),publishDragSource:xr(e),hover:Cr(e),drop:jr(e),endDrag:Ir(e)}}function zr(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Br(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Vr(e,t,n){return t&&Br(e.prototype,t),n&&Br(e,n),e}function Hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ur=function(){function e(t,n){var r=this;zr(this,e),Hr(this,`store`,void 0),Hr(this,`monitor`,void 0),Hr(this,`backend`,void 0),Hr(this,`isSetUp`,!1),Hr(this,`handleRefCountChange`,function(){var e=r.store.getState().refCount>0;r.backend&&(e&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!e&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return Vr(e,[{key:`receiveBackend`,value:function(e){this.backend=e}},{key:`getMonitor`,value:function(){return this.monitor}},{key:`getBackend`,value:function(){return this.backend}},{key:`getRegistry`,value:function(){return this.monitor.registry}},{key:`getActions`,value:function(){var e=this,t=this.store.dispatch;function n(n){return function(){var r=[...arguments],i=n.apply(e,r);i!==void 0&&t(i)}}var r=Rr(this);return Object.keys(r).reduce(function(e,t){var i=r[t];return e[t]=n(i),e},{})}},{key:`dispatch`,value:function(e){this.store.dispatch(e)}}]),e}();function q(e){return`Minified Redux error #`+e+`; visit https://redux.js.org/Errors?code=`+e+` for the full message or use the non-minified dev environment for full errors. `}var Wr=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),Gr=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},Kr={INIT:`@@redux/INIT`+Gr(),REPLACE:`@@redux/REPLACE`+Gr(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+Gr()}};function qr(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Jr(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(q(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(q(1));return n(Jr)(e,t)}if(typeof e!=`function`)throw Error(q(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(q(3));return a}function d(e){if(typeof e!=`function`)throw Error(q(4));if(c)throw Error(q(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(q(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!qr(e))throw Error(q(7));if(e.type===void 0)throw Error(q(8));if(c)throw Error(q(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(q(10));i=e,f({type:Kr.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(q(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[Wr]=function(){return this},e}return f({type:Kr.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[Wr]=m,r}var Yr=function(e,t){return e===t};function Xr(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Zr(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Yr;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function Qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Qr(Object(n),!0).forEach(function(t){ei(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ti={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function ni(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ti,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case nr:case rr:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case ar:return Xr(e.clientOffset,n.clientOffset)?e:$r($r({},e),{},{clientOffset:n.clientOffset});case sr:case or:return ti;default:return e}}var ri=`dnd-core/ADD_SOURCE`,ii=`dnd-core/ADD_TARGET`,ai=`dnd-core/REMOVE_SOURCE`,oi=`dnd-core/REMOVE_TARGET`;function si(e){return{type:ri,payload:{sourceId:e}}}function ci(e){return{type:ii,payload:{targetId:e}}}function li(e){return{type:ai,payload:{sourceId:e}}}function ui(e){return{type:oi,payload:{targetId:e}}}function di(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?di(Object(n),!0).forEach(function(t){fi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):di(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pi={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function mi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pi,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case rr:return J(J({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case ir:return J(J({},e),{},{isSourcePublic:!0});case ar:return J(J({},e),{},{targetIds:n.targetIds});case oi:return e.targetIds.indexOf(n.targetId)===-1?e:J(J({},e),{},{targetIds:dr(e.targetIds,n.targetId)});case or:return J(J({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case sr:return J(J({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function hi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case ri:case ii:return e+1;case ai:case oi:return e-1;default:return e}}var gi=[],_i=[];gi.__IS_NONE__=!0,_i.__IS_ALL__=!0;function vi(e,t){return e===gi?!1:e===_i||t===void 0?!0:mr(t,e).length>0}function yi(){arguments.length>0&&arguments[0]!==void 0&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case ar:break;case ri:case ii:case oi:case ai:return gi;case rr:case ir:case sr:case or:default:return _i}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,i=t.prevTargetIds,a=i===void 0?[]:i,o=pr(r,a);if(!(o.length>0||!Zr(r,a)))return gi;var s=a[a.length-1],c=r[r.length-1];return s!==c&&(s&&o.push(s),c&&o.push(c)),o}function bi(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function xi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Si(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?xi(Object(n),!0).forEach(function(t){Ci(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:yi(e.dirtyHandlerIds,{type:t.type,payload:Si(Si({},t.payload),{},{prevTargetIds:ur(e,`dragOperation.targetIds`,[])})}),dragOffset:ni(e.dragOffset,t),refCount:hi(e.refCount,t),dragOperation:mi(e.dragOperation,t),stateId:bi(e.stateId)}}function Ti(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Ei(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Di(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:Ei(Ti(t,r),n)}function Oi(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:Ei(t,n)}function ki(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ai(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ji(e,t,n){return t&&Ai(e.prototype,t),n&&Ai(e,n),e}function Mi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ni=function(){function e(t,n){ki(this,e),Mi(this,`store`,void 0),Mi(this,`registry`,void 0),this.store=t,this.registry=n}return ji(e,[{key:`subscribeToStateChange`,value:function(e){var t=this,n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0}).handlerIds;K(typeof e==`function`,`listener must be a function.`),K(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);var r=this.store.getState().stateId;return this.store.subscribe(function(){var i=t.store.getState(),a=i.stateId;try{a===r||a===r+1&&!vi(i.dirtyHandlerIds,n)||e()}finally{r=a}})}},{key:`subscribeToOffsetChange`,value:function(e){var t=this;K(typeof e==`function`,`listener must be a function.`);var n=this.store.getState().dragOffset;return this.store.subscribe(function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())})}},{key:`canDragSource`,value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return K(t,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:t.canDrag(this,e)}},{key:`canDropOnTarget`,value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return K(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Sr(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}},{key:`isDragging`,value:function(){return!!this.getItemType()}},{key:`isDraggingSource`,value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return K(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}},{key:`isOverTarget`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!e)return!1;var n=t.shallow;if(!this.isDragging())return!1;var r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!Sr(r,i))return!1;var a=this.getTargetIds();if(!a.length)return!1;var o=a.indexOf(e);return n?o===a.length-1:o>-1}},{key:`getItemType`,value:function(){return this.store.getState().dragOperation.itemType}},{key:`getItem`,value:function(){return this.store.getState().dragOperation.item}},{key:`getSourceId`,value:function(){return this.store.getState().dragOperation.sourceId}},{key:`getTargetIds`,value:function(){return this.store.getState().dragOperation.targetIds}},{key:`getDropResult`,value:function(){return this.store.getState().dragOperation.dropResult}},{key:`didDrop`,value:function(){return this.store.getState().dragOperation.didDrop}},{key:`isSourcePublic`,value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:`getInitialClientOffset`,value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:`getInitialSourceClientOffset`,value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:`getClientOffset`,value:function(){return this.store.getState().dragOffset.clientOffset}},{key:`getSourceClientOffset`,value:function(){return Di(this.store.getState().dragOffset)}},{key:`getDifferenceFromInitialOffset`,value:function(){return Oi(this.store.getState().dragOffset)}}]),e}(),Pi=0;function Fi(){return Pi++}function Ii(e){"@babel/helpers - typeof";return Ii=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ii(e)}function Li(e){K(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),K(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),K(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function Ri(e){K(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),K(typeof e.hover==`function`,`Expected hover to be a function.`),K(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function zi(e,t){if(t&&Array.isArray(e)){e.forEach(function(e){return zi(e,!1)});return}K(typeof e==`string`||Ii(e)===`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var Bi=typeof global<`u`?global:self,Vi=Bi.MutationObserver||Bi.WebKitMutationObserver;function Hi(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function Ui(e){let t=1,n=new Vi(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var Wi=typeof Vi==`function`?Ui:Hi,Gi=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Wi(this.flush),this.requestErrorThrow=Hi(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},Ki=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},qi=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new Ki(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},Ji=new Gi,Yi=new qi(Ji.registerPendingError);function Xi(e){Ji.enqueueTask(Yi.create(e))}function Zi(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Qi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $i(e,t,n){return t&&Qi(e.prototype,t),n&&Qi(e,n),e}function ea(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ta(e,t){return oa(e)||aa(e,t)||ra(e,t)||na()}function na(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{i as r,n as i,t as a}from"./jsx-runtime-BthL93pI.js";import{t as o}from"./react-dom-gtU6X-Hj.js";import{$ as s,B as c,D as l,E as u,F as d,G as f,H as p,J as m,K as h,M as g,N as _,O as v,P as y,Q as b,U as x,V as S,W as C,X as w,Y as T,Z as E,f as D,j as O,p as k,q as A,r as j,s as M,t as N,y as ee,z as P}from"./workspace-view-state-BpPINu84.js";import{A as te,O as ne,_ as re,a as ie,c as F,d as I,f as ae,h as oe,i as L,n as R,r as se,t as ce,u as le,y as ue}from"./file-icons-DpbrD5ZP.js";import{_ as de,c as z,s as fe,u as B,v as pe}from"./IconGlyphs-CZzDr5o2.js";import{u as me}from"./workspace-working-copy-D8-s_Sgh.js";import{t as he}from"./useWorkspaceMenuKeyboard-Brws6Ar9.js";var V=t(r()),H=a();function ge(e){return{"--change-indent":`${18+e*12}px`,"--change-guide-width":`${e*12}px`}}function _e(e){return e.sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)||e.path.localeCompare(t.path)),e.forEach(e=>{e.type===`directory`&&_e(e.children)}),e}function ve(e){return e.reduce((e,t)=>t.type===`file`?e+1:(t.descendantCount=+!!t.change+ve(t.children),e+t.descendantCount),0)}function ye(e){return e.map(e=>{if(e.type===`file`)return e;let t={...e,children:ye(e.children)};for(;!t.change&&t.children.length===1&&t.children[0]?.type===`directory`&&!t.children[0].change;){let e=t.children[0];t={...e,displayName:`${t.displayName??t.name}/${e.displayName??e.name}`}}return t})}function be(e,t){let n=[],r=new Map([[``,n]]),i=new Map,a=(e,n,a)=>{let o=i.get(e);if(o)return o;let s=[],c={id:`${t}:dir:${e}`,name:a,path:e,type:`directory`,children:s,descendantCount:0};return i.set(e,c),r.set(e,s),r.get(n)?.push(c),c};e.forEach(e=>{let n=e.path.replace(/\/+$/,``),o=n.split(`/`).filter(Boolean);if(o.length===0)return;let s=``,c=e.type===`directory`||e.path.endsWith(`/`),l=c?o.length:o.length-1;for(let e=0;e<l;e+=1){let t=o[e];if(!t)continue;let n=o.slice(0,e+1).join(`/`);a(n,s,t),s=n}if(c){let t=i.get(n);t&&(t.change=e);return}r.get(s)?.push({id:`${t}:file:${g(e)}`,name:o[o.length-1]||e.name,path:e.path,type:`file`,change:e})});let o=ye(_e(n));return ve(o),o}function xe({activeFilePath:e,change:t,copy:n,onOpenChange:r}){let i=e===t.path,a=n.gitStatus(t.gitStatus),o=t.gitStatus===`untracked`?``:t.gitStatusLabel,s=t.previousPath?O(t):``;return(0,H.jsx)(`div`,{className:`code-file-change-row ${i?`active`:``}`,"data-testid":`code-file-change-row`,"data-file-path":t.path,"data-file-type":`file`,title:_(t,a),children:(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-main`,onClick:()=>r(t),children:[(0,H.jsx)(`span`,{className:`code-file-chevron placeholder`,"aria-hidden":`true`}),(0,H.jsx)(`img`,{className:`code-file-type-icon file`,src:R(t.path),alt:``,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`code-file-change-name`,children:t.name}),(0,H.jsx)(`span`,{className:`code-file-change-path`,children:s}),(0,H.jsx)(`span`,{className:`code-file-change-status ${t.gitStatus}`,title:a,children:o})]})},g(t))}function Se({activeFilePath:e,copy:t,depth:n,nodes:r,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o}){return(0,H.jsx)(H.Fragment,{children:r.map(r=>{if(r.type===`file`)return(0,H.jsx)(`div`,{style:ge(n),children:(0,H.jsx)(xe,{activeFilePath:e,change:r.change,copy:t,onOpenChange:a})},r.id);let s=r.children.length>0,c=s&&i.has(r.id);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`code-file-change-row directory`,"data-testid":`code-file-change-directory-row`,"data-file-path":r.path,"data-file-type":`directory`,title:r.path,style:ge(n),children:(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-main directory`,"aria-expanded":s?c:void 0,onClick:()=>{s&&o(r.id)},children:[(0,H.jsx)(`span`,{className:`code-file-chevron ${s?c?`expanded`:`collapsed`:`placeholder`}`,"aria-hidden":`true`,children:s?c?(0,H.jsx)(z,{}):(0,H.jsx)(B,{}):null}),(0,H.jsx)(`span`,{className:`code-file-change-name`,children:r.displayName??r.name}),(0,H.jsx)(`span`,{className:`code-file-change-status directory`,children:r.descendantCount||``})]})}),c&&(0,H.jsx)(Se,{activeFilePath:e,copy:t,depth:n+1,nodes:r.children,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o})]},r.id)})})}function Ce({activeFilePath:e,projectWorkspace:t,changes:n,collapsed:r,copy:a,projectId:o,refreshing:s,onOpenChange:c,onToggleCollapsed:l}){let[u,d]=(0,V.useState)(!0),[f,p]=(0,V.useState)(()=>new Set),m=(0,V.useMemo)(()=>n.items.filter(e=>e.gitStatus!==`untracked`),[n.items]),h=(0,V.useMemo)(()=>n.items.filter(e=>e.gitStatus===`untracked`),[n.items]),g=(0,V.useMemo)(()=>be(m,`tracked`),[m]),_=(0,V.useMemo)(()=>be(h,`untracked`),[h]),v=s||n.loading,y=v?`refreshing`:n.error?`stale`:`refreshed`;if(n.items.length===0&&!n.error)return null;let b=()=>{r&&n.refreshChanges(),l()},x=()=>{d(e=>(e&&n.refreshChanges(),!e))},S=e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},C=e=>{let n=new URLSearchParams({root:t,scope:e});e===`untracked`&&n.set(`modifiedWithinDays`,`3`),window.open(i(`/review?${n.toString()}`),`_blank`,`noopener,noreferrer`)};return(0,H.jsxs)(`div`,{className:`code-file-changes-section`,"data-testid":`code-file-changes-section`,"data-project-id":o,"aria-label":a.changedFiles,"aria-busy":v,children:[m.length>0&&(0,H.jsxs)(`div`,{className:`code-file-change-group tracked ${r?`collapsed`:``}`,"data-testid":`code-file-change-tracked-group`,children:[(0,H.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!r,onClick:b,children:[(0,H.jsx)(`span`,{className:`code-file-section-chevron ${r?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:r?(0,H.jsx)(B,{}):(0,H.jsx)(z,{})}),(0,H.jsx)(`span`,{children:a.changes}),(0,H.jsx)(`span`,{className:`code-file-changes-count ${y}`,"data-testid":`code-file-changes-tracked-count`,"data-refresh-state":y,"aria-label":v?a.refreshingFiles:void 0,title:n.error??void 0,children:v?(0,H.jsx)(`span`,{className:`code-file-changes-count-loader`,"aria-hidden":`true`,children:`···`}):m.length})]}),(0,H.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>C(`tracked`),children:a.reviewChanges})]}),!r&&(0,H.jsx)(Se,{activeFilePath:e,copy:a,depth:0,nodes:g,openDirectoryIds:f,onOpenChange:c,onToggleDirectory:S})]}),h.length>0&&(0,H.jsxs)(`div`,{className:`code-file-change-group untracked ${u?`collapsed`:``}`,"data-testid":`code-file-change-untracked-group`,children:[(0,H.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!u,onClick:x,children:[(0,H.jsx)(`span`,{className:`code-file-section-chevron ${u?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:u?(0,H.jsx)(B,{}):(0,H.jsx)(z,{})}),(0,H.jsx)(`span`,{children:a.untrackedChanges}),(0,H.jsx)(`span`,{className:`code-file-changes-count ${y}`,"data-testid":`code-file-changes-untracked-count`,"data-refresh-state":y,"aria-label":v?a.refreshingFiles:void 0,title:n.error??void 0,children:v?(0,H.jsx)(`span`,{className:`code-file-changes-count-loader`,"aria-hidden":`true`,children:`···`}):(0,H.jsxs)(H.Fragment,{children:[h.length,n.truncated?`+`:``]})})]}),(0,H.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>C(`untracked`),children:a.reviewChanges})]}),!u&&(0,H.jsx)(Se,{activeFilePath:e,copy:a,depth:0,nodes:_,openDirectoryIds:f,onOpenChange:c,onToggleDirectory:S})]}),n.error&&(0,H.jsx)(`div`,{className:`code-file-changes-status error`,"data-testid":`code-file-changes-error`,children:n.error})]})}function we(e){let t=e.trim().replace(/^\.\/+/,``);if(!t)return null;let n=t.match(/^(.+?)#L(\d+)(?:C(\d+))?$/i);if(n)return{path:n[1]||``,lineNumber:Number(n[2]),column:n[3]?Number(n[3]):void 0};let r=t.match(/^(.+?):(\d+)(?::(\d+))?$/);return r?{path:r[1]||``,lineNumber:Number(r[2]),column:r[3]?Number(r[3]):void 0}:null}function Te(e){let t=e.ranges[0];return t?{lineNumber:e.lineNumber,column:t.start+1,endColumn:Math.max(t.start+1,t.end+1)}:{lineNumber:e.lineNumber}}function Ee(e){return e.kind===`path`?{path:e.path}:{path:e.path,target:Te(e)}}function De(e){let t=we(e);return t?{path:t.path,target:{lineNumber:t.lineNumber,column:t.column}}:null}function Oe({active:e,activeMatchIndex:t,jumpTarget:n,listboxId:r}){if(e)return n?`${r}-jump`:t>=0?`${r}-${t}`:void 0}function ke(e,t){let n=t.trim().replace(/^\.\/+/,``).toLowerCase();if(!e||!n)return null;let r=e.toLowerCase().indexOf(n);return r===-1?null:{start:r,end:r+n.length}}function Ae(e,t){if(t===0)return!0;let n=e[t-1]??``,r=e[t]??``;return/[-_\s./\\]/.test(n)?!0:/[a-z0-9]/.test(n)&&/[A-Z]/.test(r)}function je(e,t,n){let r=[],i=0;for(let a=0;a<e.length&&i<t.length;a+=1)n&&!Ae(e,a)||e[a]?.toLowerCase()===t[i]&&(r.push({start:a,end:a+1}),i+=1);return i===t.length?r:[]}function Me(e,t){let n=t.trim().replace(/^\.\/+/,``).toLowerCase();if(!e||!n||n.length>6)return[];let r=je(e,n,!0);return r.length>0?r:je(e,n,!1)}function Ne(e,t){let n=[];return t.map(t=>({start:Math.max(0,Math.min(e.length,t.start)),end:Math.max(0,Math.min(e.length,t.end))})).filter(e=>e.end>e.start).sort((e,t)=>e.start-t.start||e.end-t.end).forEach(e=>{let t=n[n.length-1];if(t&&e.start<=t.end){t.end=Math.max(t.end,e.end);return}n.push(e)}),n}function Pe(e,t){let n=ke(e,t);return n?[n]:Me(e,t)}function Fe(e,t=[]){let n=Ne(e,t);if(n.length===0)return e;let r=[],i=0;return n.forEach((t,n)=>{t.start>i&&r.push(e.slice(i,t.start)),r.push((0,H.jsx)(`span`,{className:`code-file-search-highlight`,children:e.slice(t.start,t.end)},`${t.start}:${t.end}:${n}`)),i=t.end}),i<e.length&&r.push(e.slice(i)),r}function Ie(e,t){return Fe(e,Pe(e,t))}function Le(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n===-1?{directory:``,name:t}:{directory:t.slice(0,n),name:t.slice(n+1)||t}}function Re(e){if(!e||typeof window>`u`)return null;let t=e.getBoundingClientRect();if(ne()){let n=window.visualViewport,r=n?.offsetTop??0,i=n?.offsetLeft??0,a=n?.width??window.innerWidth,o=n?.height??window.innerHeight,s=e.closest(`.code-sidebar`)?.getBoundingClientRect(),c=Math.max(i+6,(s?.left??i)+6),l=Math.min(i+a-6,(s?.right??i+a)-6),u=r+o-t.bottom-10,d=t.top-r-10,f=u<120&&d>u,p=Math.max(72,Math.min(320,f?d:u));return{left:c,top:f?Math.max(r+6,t.top-p-4):Math.max(r+6,t.bottom+4),width:Math.max(180,l-c),maxHeight:p}}let n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),r=Math.max(document.documentElement.clientHeight,window.innerHeight||0),i=Math.max(240,n-24),a=Math.min(620,i,Math.max(420,t.width)),o=Math.max(12,Math.min(t.left,n-a-12)),s=Math.min(t.bottom+6,r-12);return{left:o,top:s,width:a,maxHeight:Math.max(168,Math.min(420,r-s-12))}}function ze({path:e,query:t}){let{directory:n,name:r}=Le(e);return(0,H.jsxs)(`span`,{className:`code-file-search-copy`,children:[(0,H.jsx)(`span`,{className:`code-file-search-name`,children:Ie(r,t)}),n&&(0,H.jsx)(`span`,{className:`code-file-search-directory`,children:Ie(n,t)})]})}function Be({activeMatchIndex:e,anchorRef:t,copy:n,containerRef:r,error:i,jumpTarget:a,listboxId:o,loading:s,matches:c,openFileError:l,query:u,showIgnoredSearch:d,timeoutMs:f,truncated:p,onOpenJumpQuery:m,onOpenMatch:h,onSearchIgnored:g,onSelectMatchIndex:_}){let[v,y]=(0,V.useState)(()=>Re(t.current)),b=(0,V.useCallback)(()=>{y(Re(t.current))},[t]);return(0,V.useLayoutEffect)(()=>{b();let e=t.current?.closest(`.code-project-list`);return window.addEventListener(`resize`,b),window.addEventListener(`scroll`,b,!0),window.visualViewport?.addEventListener(`resize`,b),window.visualViewport?.addEventListener(`scroll`,b),e?.addEventListener(`scroll`,b,{passive:!0}),()=>{window.removeEventListener(`resize`,b),window.removeEventListener(`scroll`,b,!0),window.visualViewport?.removeEventListener(`resize`,b),window.visualViewport?.removeEventListener(`scroll`,b),e?.removeEventListener(`scroll`,b)}},[t,b]),(0,H.jsx)(`div`,{ref:r,id:o,className:`code-file-search-results`,"data-testid":`code-file-search-results`,role:`listbox`,"aria-label":n.searchFilesOrJump,style:v?{left:v.left,top:v.top,width:v.width,maxHeight:v.maxHeight}:void 0,children:a?l?(0,H.jsx)(`div`,{className:`code-file-search-state error`,children:l}):(0,H.jsxs)(`button`,{id:`${o}-jump`,type:`button`,className:`code-file-search-result jump active`,onClick:()=>m(u),role:`option`,"aria-selected":`true`,children:[(0,H.jsx)(`span`,{className:`code-file-search-kind`,children:n.go}),(0,H.jsx)(ze,{path:a.path,query:u}),(0,H.jsx)(`span`,{className:`code-file-search-line`,children:a.lineNumber})]}):s?(0,H.jsx)(`div`,{className:`code-file-search-state`,children:n.searching}):i?(0,H.jsx)(`div`,{className:`code-file-search-state error`,children:i}):c.length===0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`code-file-search-state`,children:n.noMatches}),d&&(0,H.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,H.jsx)(`div`,{className:`code-file-search-state muted`,children:n.searchIncomplete(f)})]}):(0,H.jsxs)(H.Fragment,{children:[c.map((t,r)=>(0,H.jsxs)(`button`,{id:`${o}-${r}`,type:`button`,className:`code-file-search-result ${r===e?`active`:``}`,onPointerMove:e=>{e.pointerType===`mouse`&&_(r)},onClick:()=>h(t),title:t.entryType===`directory`?t.path:`${t.path}:${t.lineNumber}`,role:`option`,"aria-selected":r===e,children:[(0,H.jsx)(`img`,{className:`code-file-type-icon ${t.entryType===`directory`?`folder`:`file`}`,src:t.entryType===`directory`?ce(t.path,!1):R(t.path),alt:``,"aria-hidden":`true`}),(0,H.jsx)(ze,{path:t.path,query:u}),t.kind===`path`?(0,H.jsx)(`span`,{className:`code-file-search-kind`,children:t.entryType===`directory`?n.folder:n.file}):(0,H.jsx)(`span`,{className:`code-file-search-line`,children:t.lineNumber}),t.lines&&(0,H.jsx)(`span`,{className:`code-file-search-preview`,children:Fe(t.lines,t.ranges)})]},`${t.path}:${t.lineNumber}:${r}`)),d&&(0,H.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,H.jsx)(`div`,{className:`code-file-search-state muted`,children:n.moreMatchesOmitted})]})})}var Ve=12;function He(e,t){return e===`git`?t.containsUncommittedChanges:e===`external`?t.changedOnDisk:e===`dirty`?t.unsavedChanges:t.changedOnDisk}function Ue(e){return{"--file-indent":`${6+e*Ve}px`,"--file-status-indent":`${24+e*Ve}px`,"--file-guide-width":`${e*Ve}px`,"--file-depth":e}}function We(e){return e===`untracked`?void 0:e}function Ge(e){let t=We(e);return t?`code-file-descendant-status ${t}`:``}function Ke(e,t){for(let n of e)if(T(t,n))return!0;return!1}function qe({activeFilePath:e,editorDirtyFilePaths:t,editorExternalChangedFilePaths:n,openFilePendingPath:r,item:i,isFocused:a,isOpen:o,isSelected:s}){let c=i.type===`directory`,l=e===i.path,u=c&&i.loading===!0,d=!c&&r===i.path,f=!c&&t.has(i.path),p=!c&&n.has(i.path),m=c&&Ke(t,i.path),h=c&&Ke(n,i.path),g=We(i.gitStatus),_=We(i.descendantGitStatus),v=g?i.gitStatusLabel:void 0,y=!!g,b=c&&!!_,x=c&&(b||m||h),S=_??(h?`external`:m?`dirty`:void 0),C=_?Ge(_):S?`code-file-descendant-status ${S}`:``,w=b?`git`:h?`external`:m?`dirty`:null,T=p?`external`:f?`dirty`:void 0,E=T?`code-file-changed ${T}`:``,D=p?`external`:f?`dirty`:null,O=g?`code-file-git-status ${g}`:``;return{active:l,chevronState:c?o?`expanded`:`collapsed`:`placeholder`,directoryLoading:u,directoryDotClassName:C,directoryDotKind:S,directoryDotTitleKind:w,editorDirty:f,editorExternalChanged:p,fileChangedClassName:E,fileChangedKind:T,fileChangedTitleKind:D,fileOpening:d,hasDescendantGitStatus:b,hasEditorDirtyDescendant:m,hasEditorExternalChangedDescendant:h,isDirectory:c,rowClasses:[`code-file-row`,c?`directory`:`file`,l?`active`:``,f?`editor-dirty`:``,p?`editor-external-changed`:``,m?`editor-descendant-dirty`:``,h?`editor-descendant-external-changed`:``,a?`focused`:``,s?`selected`:``,u?`loading`:``,d?`opening`:``,i.ignored?`ignored`:``,i.symbolicLink?`symbolic-link`:``,i.external?`external-link`:``,i.linkError?`link-error`:``,y?`git-status`:``,g?`git-${g}`:``,b?`git-descendant`:``,_?`git-descendant-${_}`:``].filter(Boolean).join(` `),showDirectoryDot:x,visibleGitStatus:g,visibleGitStatusClassName:O,visibleGitStatusLabel:v}}function Je({label:e,options:t,testId:n,submenuTestId:r,onOpenDialog:i,onSelect:a}){let[o,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(`right`),d=(0,V.useRef)(null),f=(0,V.useRef)(null),p=(0,V.useRef)(null),m=(0,V.useRef)(null),h=t.length>0,g=(0,V.useCallback)(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),_=(0,V.useCallback)((e=f.current)=>{if(!h)return;g();let t=e?.getBoundingClientRect();t&&t.right+156+12>window.innerWidth?u(`left`):u(`right`),c(!0)},[g,h]),v=(0,V.useCallback)(()=>{g(),m.current=window.setTimeout(()=>{c(!1),m.current=null},120)},[g]),y=(0,V.useCallback)(e=>{_(e.currentTarget.querySelector(`button`))},[_]),x=(0,V.useCallback)(()=>{window.setTimeout(()=>{p.current?.querySelector(`button:not(:disabled)`)?.focus()},0)},[]),S=(0,V.useCallback)(e=>{h&&e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),_(e.currentTarget),x())},[x,h,_]),C=(0,V.useCallback)(e=>{e.key===`ArrowLeft`&&(e.preventDefault(),e.stopPropagation(),c(!1),f.current?.focus())},[]);return(0,H.jsxs)(`div`,{ref:d,className:`code-agent-launch-submenu`,onPointerEnter:y,onPointerLeave:v,onFocus:()=>g(),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||c(!1)},children:[(0,H.jsxs)(`button`,{ref:f,type:`button`,role:`menuitem`,className:`code-agent-launch-submenu-trigger`,"data-testid":n,"aria-haspopup":h?`menu`:void 0,"aria-expanded":h?o:void 0,onClick:i,onKeyDown:S,children:[(0,H.jsx)(`span`,{children:e}),h&&(0,H.jsx)(B,{className:`code-agent-launch-submenu-arrow`})]}),h&&o&&(0,H.jsx)(`div`,{ref:p,className:`code-agent-launch-submenu-panel ${l}`,"data-testid":r,role:`menu`,onPointerEnter:()=>g(),onPointerLeave:v,onKeyDown:C,children:t.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`agent-launch-${e.name}`,onClick:()=>a(e.command||e.name),children:[(0,H.jsx)(b,{name:e.name}),(0,H.jsx)(`span`,{children:s(e.name)})]},e.name))})]})}function Ye({copy:e,agentLaunchOptions:t,fileMenu:n,menuRef:r,onClose:i,onCloseWithFocusRestore:a,onCopyRelativePath:o,onCopyShareUrl:s,onOpenNewAgent:c,onRefreshTarget:l,onStartAgent:u,onStartOperation:d,readOnly:f=!1}){let p=he({menuOpen:!!n,menuRef:r,onClose:i,onCloseWithFocusRestore:a});if(!n)return null;let m=n.item?.readOnly===!0,h=!f&&!m,g=!f&&(!m||n.item?.symbolicLink===!0);return(0,H.jsxs)(`div`,{ref:r,className:`code-context-menu code-file-context-menu`,"data-testid":`code-file-context-menu`,style:{left:n.x,top:n.y},role:`menu`,onKeyDown:p,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[h&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,autoFocus:!0,onClick:()=>d(`new-file`),children:e.newFile}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`new-folder`),children:e.newFolder}),(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,H.jsx)(Je,{label:e.newAgent,options:t,testId:`file-new-agent-submenu-trigger`,submenuTestId:`file-new-agent-submenu`,onOpenDialog:c,onSelect:u}),(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`})]}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:l,children:e.refresh}),n.item&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),g&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`rename`),children:e.rename}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o,children:e.copyRelativePath}),(n.item.type===`file`||n.item.type===`directory`)&&(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:s,children:e.copyShareUrl}),g&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`danger`,onClick:()=>d(`delete`),children:e.delete})]})]})]})}var Xe=220,Ze=8,Qe=26,$e=11,et=10;function tt(e){return e?e.type===`directory`?e.path:w(e.path):``}function nt(e,t){return e===`rename`||e===`delete`?t?.name??``:``}function rt(e,t){return{kind:e,item:t,parentPath:tt(t),name:nt(e,t)}}function it(e){if(e.kind!==`rename`||e.item?.type!==`file`)return e.name.length;let t=e.name.lastIndexOf(`.`);return t>0?t:e.name.length}function at(e){let t=e.name.trim();if(e.kind!==`rename`||e.item?.type!==`file`)return t;let n=e.item.name.lastIndexOf(`.`);if(n<=0)return t;let r=e.item.name.slice(n);return t.endsWith(`${r}${r}`)?t.slice(0,-r.length):t}function U(e,t){switch(e.kind){case`new-file`:return t.newFile;case`new-folder`:return t.newFolder;case`rename`:return t.rename;case`delete`:return t.delete}}function ot(e,t,n,r,i,a=0){let o=n?8:4,s=n?4:2,c=a>0?et+a*Qe:0,l=et+o*Qe+s*$e+c;return{x:Math.max(Ze,Math.min(e,r-Xe-Ze)),y:Math.max(Ze,Math.min(t,i-l-Ze))}}function st({agentId:e,copy:t,fileOperation:n,inputRef:r,onCancel:i,onInputName:a,onSubmit:o,onUpdateName:s}){return!n||n.kind===`rename`?null:(0,H.jsx)(`div`,{className:n.kind===`delete`?`code-file-operation-shell delete-confirm`:`code-file-operation-shell`,"data-testid":`code-file-operation-backdrop`,onMouseDown:e=>{e.stopPropagation(),n.kind===`delete`&&e.target===e.currentTarget&&i()},children:(0,H.jsxs)(`form`,{className:`code-file-operation-dialog`,"data-testid":`code-file-operation-dialog`,role:`dialog`,"aria-labelledby":`code-file-operation-title`,autoComplete:`off`,onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i())},onSubmit:e=>{e.preventDefault(),o()},children:[(0,H.jsx)(`label`,{id:`code-file-operation-title`,htmlFor:`code-file-operation-input`,children:U(n,t)}),n.kind===`delete`?(0,H.jsx)(`p`,{className:`code-file-operation-text`,children:n.item?.type===`directory`?t.deleteFolderContents(n.item?.path):t.deleteFile(n.item?.path)}):(0,H.jsx)(`input`,{id:`code-file-operation-input`,"data-testid":`code-file-operation-input`,name:`farming-file-${e}-${n.kind}`,type:`text`,inputMode:`text`,ref:r,value:n.name,autoComplete:`off`,"aria-autocomplete":`none`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,autoFocus:!0,onInput:e=>{a(e.currentTarget.value)},onChange:e=>{s(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),o())}}),(0,H.jsxs)(`div`,{className:`code-rename-actions`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:i,children:t.cancel}),(0,H.jsx)(`button`,{type:`submit`,className:n.kind===`delete`?`danger`:`primary`,disabled:n.kind!==`delete`&&!n.name.trim(),children:n.kind===`delete`?t.delete:t.save})]})]})})}function ct({agentId:e,copy:t,agentLaunchOptions:n,fileMenu:r,fileMenuRef:i,fileOperation:a,fileOperationInputRef:o,onCloseFileMenu:s,onCloseFileMenuWithFocusRestore:c,onCloseFileOperation:l,onCopyFileMenuPath:u,onCopyFileMenuShareUrl:d,onOpenNewAgent:f,onRefreshFileMenuTarget:p,onRememberFileOperationName:m,onStartAgent:h,onStartFileMenuOperation:g,onSubmitFileOperation:_,onUpdateFileOperationName:v,readOnly:y=!1}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ye,{copy:t,agentLaunchOptions:n,fileMenu:r,menuRef:i,onClose:s,onCloseWithFocusRestore:c,onCopyRelativePath:u,onCopyShareUrl:d,onOpenNewAgent:f,onRefreshTarget:p,onStartAgent:h,onStartOperation:g,readOnly:y}),(0,H.jsx)(st,{agentId:e,copy:t,fileOperation:a,inputRef:o,onCancel:l,onInputName:m,onSubmit:()=>{_()},onUpdateName:v})]})}var lt=n((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ut=n(((e,t)=>{t.exports=lt()})),dt=(0,V.createContext)(null);function W(){let e=(0,V.useContext)(dt);if(e===null)throw Error(`No Tree Api Provided`);return e}var ft=(0,V.createContext)(null);function pt(){let e=(0,V.useContext)(ft);if(e===null)throw Error(`Provide a NodesContext`);return e}var mt=(0,V.createContext)(null);function ht(){let e=(0,V.useContext)(mt);if(e===null)throw Error(`Provide a DnDContext`);return e}var gt=(0,V.createContext)(0);function _t(){(0,V.useContext)(gt)}var vt=e({access:()=>Nt,bound:()=>yt,dfs:()=>Et,focusNextElement:()=>Ot,focusPrevElement:()=>kt,getInsertIndex:()=>zt,getInsertParentId:()=>Ht,getTreeLinePrefix:()=>Vt,identify:()=>Ft,identifyNull:()=>Pt,indexOf:()=>wt,isClosed:()=>xt,isDescendant:()=>Ct,isItem:()=>bt,isOpenWithEmptyChildren:()=>St,mergeRefs:()=>It,noop:()=>Tt,safeRun:()=>Lt,waitFor:()=>Rt,walk:()=>Dt});function yt(e,t,n){return Math.max(Math.min(e,n),t)}function bt(e){return e&&e.isLeaf}function xt(e){return e&&e.isInternal&&!e.isOpen}function St(e){return e&&e.isOpen&&!e.children?.length}var Ct=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},wt=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function Tt(){}function Et(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=Et(n,t);if(e)return e}return null}function Dt(e,t){if(t(e),e.children)for(let n of e.children)Dt(n,t)}function Ot(e){let t=Mt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=At(t,r);break}n?.focus()}function kt(e){let t=Mt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=jt(t,r);break}n?.focus()}function At(e,t){return t+1<e.length?e[t+1]:e[0]}function jt(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Mt(e){return Array.from(document.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)`)).filter(t=>t===e||!e.contains(t))}function Nt(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Pt(e){return e===null?null:Ft(e)}function Ft(e){return typeof e==`string`?e:e.id}function It(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Lt(e,...t){if(e)return e(...t)}function Rt(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function zt(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}var Bt={last:`└ `,middle:`├ `,pipe:`│ `,blank:` `};function Vt(e,t={}){let n=Object.assign(Object.assign({},Bt),t);if(e.level===0)return``;let r=e.nextSibling===null?n.last:n.middle,i=e.parent;for(;i&&i.level>0;)r=(i.nextSibling===null?n.blank:n.pipe)+r,i=i.parent;return r}function Ht(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Ut={display:`flex`,alignItems:`center`,zIndex:1},Wt={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Gt={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Kt=V.memo(function({top:e,left:t,indent:n}){let r={position:`absolute`,pointerEvents:`none`,top:e-2+`px`,left:t+`px`,right:n+`px`};return(0,H.jsxs)(`div`,{style:Object.assign(Object.assign({},Ut),r),children:[(0,H.jsx)(`div`,{style:Object.assign({},Gt)}),(0,H.jsx)(`div`,{style:Object.assign({},Wt)})]})});function qt({node:e,attrs:t,innerRef:n,children:r}){return(0,H.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function Jt(e){return(0,H.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,H.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,H.jsx)(Xt,Object.assign({},e)):(0,H.jsx)(Yt,Object.assign({},e))]})}function Yt(e){return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`span`,{children:e.node.data.name})})}function Xt({node:e}){let t=(0,V.useRef)();return(0,V.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,H.jsx)(`input`,{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{n.key===`Escape`&&e.reset(),n.key===`Enter`&&e.submit(t.current?.value||``)}})}var Zt=`__REACT_ARBORIST_INTERNAL_ROOT__`;function Qt(e){function t(n,r,i){let a=new $t({tree:e,data:n,level:r,parent:i,id:e.accessId(n),children:null,isDraggable:e.isDraggable(n),rowIndex:null}),o=e.accessChildren(n);return o&&(a.children=o.map(e=>t(e,r+1,a))),a}let n=new $t({tree:e,id:Zt,data:{id:Zt},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var $t=class e{constructor(e){this.handleClick=e=>{(e.metaKey||e.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===Zt}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){return this.isSelected&&!this.prev?.isSelected}get isSelectedEnd(){return this.isSelected&&!this.next?.isSelected}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){let e=this.childIndex;return this.parent?.children[e+1]??null}isAncestorOf(e){if(!e)return!1;let t=e;for(;t;){if(t.id===this.id)return!0;t=t.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new e(Object.assign({},this))}edit(){return this.tree.edit(this)}};function en(e){return{type:`EDIT`,id:e}}function tn(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function nn(e){return{type:`FOCUS`,id:e}}function rn(){return{type:`TREE_BLUR`}}function an(e={id:null,treeFocused:!1},t){return t.type===`FOCUS`?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type===`TREE_BLUR`?Object.assign(Object.assign({},e),{treeFocused:!1}):e}var on={open(e,t){return{type:`VISIBILITY_OPEN`,id:e,filtered:t}},close(e,t){return{type:`VISIBILITY_CLOSE`,id:e,filtered:t}},toggle(e,t){return{type:`VISIBILITY_TOGGLE`,id:e,filtered:t}},clear(e){return{type:`VISIBILITY_CLEAR`,filtered:e}}};function sn(e={},t){if(t.type===`VISIBILITY_OPEN`)return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type===`VISIBILITY_CLOSE`)return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type===`VISIBILITY_TOGGLE`){let n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}else if(t.type===`VISIBILITY_CLEAR`)return{};else return e}function cn(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:sn(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:sn(e.unfiltered,t)}):e}var ln=e=>({nodes:{open:{filtered:{},unfiltered:e?.initialOpenState??{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:`none`},dragId:null,dragIds:[],parentId:null,index:-1}}),un={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:Ft(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(Ft)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(Ft)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:Ft(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:Ft(e)})};function dn(e=ln().nodes.selection,t){let n=e.ids;switch(t.type){case`SELECTION_CLEAR`:return Object.assign(Object.assign({},e),{ids:new Set});case`SELECTION_ONLY`:return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case`SELECTION_ADD`:return t.ids.length===0?e:(t.ids.forEach(e=>n.add(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_REMOVE`:return t.ids.length===0?e:(t.ids.forEach(e=>n.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case`SELECTION_SET`:return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case`SELECTION_MOST_RECENT`:return Object.assign(Object.assign({},e),{mostRecent:t.id});case`SELECTION_ANCHOR`:return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}var fn={cursor(e){return{type:`DND_CURSOR`,cursor:e}},dragStart(e,t){return{type:`DND_DRAG_START`,id:e,dragIds:t}},dragEnd(){return{type:`DND_DRAG_END`}},hovering(e,t){return{type:`DND_HOVERING`,parentId:e,index:t}}};function pn(e=ln().dnd,t){switch(t.type){case`DND_CURSOR`:return Object.assign(Object.assign({},e),{cursor:t.cursor});case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case`DND_DRAG_END`:return ln().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var mn={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},hn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},gn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function _n({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,H.jsxs)(vn,{isDragging:i,children:[(0,H.jsx)(yn,{offset:e,children:(0,H.jsx)(xn,{id:n,dragIds:r})}),(0,H.jsx)(bn,{mouse:t,count:r.length})]})}var vn=(0,V.memo)(function(e){return e.isDragging?(0,H.jsx)(`div`,{style:mn,children:e.children}):null});function yn(e){return(0,H.jsx)(`div`,{className:`row preview`,style:hn(e.offset),children:e.children})}function bn(e){let{count:t,mouse:n}=e;return t>1?(0,H.jsx)(`div`,{className:`selected-count`,style:gn(n),children:t}):null}var xn=(0,V.memo)(function(e){let t=W(),n=t.get(e.id);return n?(0,H.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null});function Sn(){return Sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sn.apply(null,arguments)}function Cn(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function wn(e,t){return wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wn(e,t)}function Tn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,wn(e,t)}var En=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function Dn(e,t){return!!(e===t||En(e)&&En(t))}function On(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Dn(e[n],t[n]))return!1;return!0}function kn(e,t){t===void 0&&(t=On);var n,r=[],i,a=!1;function o(){var o=[...arguments];return a&&n===this&&t(o,r)?i:(i=e.apply(this,o),a=!0,n=this,r=o,i)}return o}var An=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function jn(e){cancelAnimationFrame(e.id)}function Mn(e,t){var n=An();function r(){An()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var Nn=-1;function Pn(e){if(e===void 0&&(e=!1),Nn===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),Nn=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Nn}var Fn=null;function In(e){if(e===void 0&&(e=!1),Fn===null||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,n.direction=`rtl`;var r=document.createElement(`div`),i=r.style;return i.width=`100px`,i.height=`100px`,t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Fn=`positive-descending`:(t.scrollLeft=1,Fn=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),Fn}return Fn}var Ln=150,Rn=function(e,t){return e};function zn(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,a=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(e){Tn(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,Cn(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:Cn(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=kn(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=kn(function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var t=r.props,a=t.direction,o=t.itemSize,s=t.layout,c=r._getItemStyleCache(l&&o,l&&s,l&&a),u;if(c.hasOwnProperty(e))u=c[e];else{var d=n(r.props,e,r._instanceProps),f=i(r.props,e,r._instanceProps),p=a===`horizontal`||s===`horizontal`,m=a===`rtl`,h=p?d:0;c[e]=u={position:`absolute`,left:m?void 0:h,right:m?h:void 0,top:p?0:d,height:p?`100%`:f,width:p?f:`100%`}}return u},r._getItemStyleCache=void 0,r._getItemStyleCache=kn(function(e,t,n){return{}}),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,a=t.scrollWidth;r.setState(function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,o=i;if(t===`rtl`)switch(In()){case`negative`:o=-i;break;case`positive-descending`:o=a-n-i;break}return o=Math.max(0,Math.min(o,a-n)),{isScrolling:!0,scrollDirection:e.scrollOffset<o?`forward`:`backward`,scrollOffset:o,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var t=e.currentTarget,n=t.clientHeight,i=t.scrollHeight,a=t.scrollTop;r.setState(function(e){if(e.scrollOffset===a)return null;var t=Math.max(0,Math.min(a,i-n));return{isScrolling:!0,scrollDirection:e.scrollOffset<t?`forward`:`backward`,scrollOffset:t,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var t=r.props.outerRef;r._outerRef=e,typeof t==`function`?t(e):typeof t==`object`&&t&&t.hasOwnProperty(`current`)&&(t.current=e)},r._resetIsScrollingDebounced=function(){r._resetIsScrollingTimeoutId!==null&&jn(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Mn(r._resetIsScrolling,Ln)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Bn(e,t),u(e),null};var d=t.prototype;return d.scrollTo=function(e){e=Math.max(0,e),this.setState(function(t){return t.scrollOffset===e?null:{scrollDirection:t.scrollOffset<e?`forward`:`backward`,scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},d.scrollToItem=function(e,t){t===void 0&&(t=`auto`);var n=this.props,r=n.itemCount,i=n.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,r-1));var s=0;if(this._outerRef){var c=this._outerRef;s=i===`vertical`?c.scrollWidth>c.clientWidth?Pn():0:c.scrollHeight>c.clientHeight?Pn():0}this.scrollTo(a(this.props,e,t,o,this._instanceProps,s))},d.componentDidMount=function(){var e=this.props,t=e.direction,n=e.initialScrollOffset,r=e.layout;if(typeof n==`number`&&this._outerRef!=null){var i=this._outerRef;t===`horizontal`||r===`horizontal`?i.scrollLeft=n:i.scrollTop=n}this._callPropsCallbacks()},d.componentDidUpdate=function(){var e=this.props,t=e.direction,n=e.layout,r=this.state,i=r.scrollOffset;if(r.scrollUpdateWasRequested&&this._outerRef!=null){var a=this._outerRef;if(t===`horizontal`||n===`horizontal`)if(t===`rtl`)switch(In()){case`negative`:a.scrollLeft=-i;break;case`positive-ascending`:a.scrollLeft=i;break;default:var o=a.clientWidth;a.scrollLeft=a.scrollWidth-o-i;break}else a.scrollLeft=i;else a.scrollTop=i}this._callPropsCallbacks()},d.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&jn(this._resetIsScrollingTimeoutId)},d.render=function(){var e=this.props,t=e.children,n=e.className,i=e.direction,a=e.height,o=e.innerRef,s=e.innerElementType,c=e.innerTagName,l=e.itemCount,u=e.itemData,d=e.itemKey,f=d===void 0?Rn:d,p=e.layout,m=e.outerElementType,h=e.outerTagName,g=e.style,_=e.useIsScrolling,v=e.width,y=this.state.isScrolling,b=i===`horizontal`||p===`horizontal`,x=b?this._onScrollHorizontal:this._onScrollVertical,S=this._getRangeToRender(),C=S[0],w=S[1],T=[];if(l>0)for(var E=C;E<=w;E++)T.push((0,V.createElement)(t,{data:u,key:f(E,u),index:E,isScrolling:_?y:void 0,style:this._getItemStyle(E)}));var D=r(this.props,this._instanceProps);return(0,V.createElement)(m||h||`div`,{className:n,onScroll:x,ref:this._outerRefSetter,style:Sn({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,V.createElement)(s||c||`div`,{children:T,ref:o,style:{height:b?`100%`:D,pointerEvents:y?`none`:void 0,width:b?D:`100%`}}))},d._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered==`function`&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if(typeof this.props.onScroll==`function`){var a=this.state,o=a.scrollDirection,s=a.scrollOffset,c=a.scrollUpdateWasRequested;this._callOnScroll(o,s,c)}},d._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,a=r.scrollDirection,c=r.scrollOffset;if(t===0)return[0,0,0,0];var l=o(this.props,c,this._instanceProps),u=s(this.props,l,c,this._instanceProps),d=!i||a===`backward`?Math.max(1,n):1,f=!i||a===`forward`?Math.max(1,n):1;return[Math.max(0,l-d),Math.max(0,Math.min(t-1,u+f)),l,u]},t}(V.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Bn=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Vn=50,Hn=function(e,t,n){var r=e.itemSize,i=n.itemMetadataMap,a=n.lastMeasuredIndex;if(t>a){var o=0;if(a>=0){var s=i[a];o=s.offset+s.size}for(var c=a+1;c<=t;c++){var l=r(c);i[c]={offset:o,size:l},o+=l}n.lastMeasuredIndex=t}return i[t]},Un=function(e,t,n){var r=t.itemMetadataMap,i=t.lastMeasuredIndex;return(i>0?r[i].offset:0)>=n?Wn(e,t,i,0,n):Gn(e,t,Math.max(0,i),n)},Wn=function(e,t,n,r,i){for(;r<=n;){var a=r+Math.floor((n-r)/2),o=Hn(e,a,t).offset;if(o===i)return a;o<i?r=a+1:o>i&&(n=a-1)}return r>0?r-1:0},Gn=function(e,t,n,r){for(var i=e.itemCount,a=1;n<i&&Hn(e,n,t).offset<r;)n+=a,a*=2;return Wn(e,t,Math.min(n,i-1),Math.floor(n/2),r)},Kn=function(e,t){var n=e.itemCount,r=t.itemMetadataMap,i=t.estimatedItemSize,a=t.lastMeasuredIndex,o=0;if(a>=n&&(a=n-1),a>=0){var s=r[a];o=s.offset+s.size}var c=(n-a-1)*i;return o+c},qn=zn({getItemOffset:function(e,t,n){return Hn(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:Kn,getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.layout,l=e.width,u=o===`horizontal`||c===`horizontal`?l:s,d=Hn(e,t,i),f=Kn(e,i),p=Math.max(0,Math.min(f-u,d.offset)),m=Math.max(0,d.offset-u+d.size+a);switch(n===`smart`&&(n=r>=m-u&&r<=p+u?`auto`:`center`),n){case`start`:return p;case`end`:return m;case`center`:return Math.round(m+(p-m)/2);default:return r>=m&&r<=p?r:r<m?m:p}},getStartIndexForOffset:function(e,t,n){return Un(e,n,t)},getStopIndexForStartIndex:function(e,t,n,r){for(var i=e.direction,a=e.height,o=e.itemCount,s=e.layout,c=e.width,l=i===`horizontal`||s===`horizontal`?c:a,u=Hn(e,t,r),d=n+l,f=u.offset+u.size,p=t;p<o-1&&f<d;)p++,f+=Hn(e,p,r).size;return p},initInstanceProps:function(e,t){var n={itemMetadataMap:{},estimatedItemSize:e.estimatedItemSize||Vn,lastMeasuredIndex:-1};return t.resetAfterIndex=function(e,r){r===void 0&&(r=!0),n.lastMeasuredIndex=Math.min(n.lastMeasuredIndex,e-1),t._getItemStyleCache(-1),r&&t.forceUpdate()},n},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(e){e.itemSize}}),Jn=zn({getItemOffset:function(e,t){return t*e.itemSize},getItemSize:function(e,t){return e.itemSize},getEstimatedTotalSize:function(e){var t=e.itemCount;return e.itemSize*t},getOffsetForIndexAndAlignment:function(e,t,n,r,i,a){var o=e.direction,s=e.height,c=e.itemCount,l=e.itemSize,u=e.layout,d=e.width,f=o===`horizontal`||u===`horizontal`?d:s,p=Math.max(0,c*l-f),m=Math.min(p,t*l),h=Math.max(0,t*l-f+l+a);switch(n===`smart`&&(n=r>=h-f&&r<=m+f?`auto`:`center`),n){case`start`:return m;case`end`:return h;case`center`:var g=Math.round(h+(m-h)/2);return g<Math.ceil(f/2)?0:g>p+Math.floor(f/2)?p:g;default:return r>=h&&r<=m?r:r<h?h:m}},getStartIndexForOffset:function(e,t){var n=e.itemCount,r=e.itemSize;return Math.max(0,Math.min(n-1,Math.floor(t/r)))},getStopIndexForStartIndex:function(e,t,n){var r=e.direction,i=e.height,a=e.itemCount,o=e.itemSize,s=e.layout,c=e.width,l=r===`horizontal`||s===`horizontal`,u=t*o,d=Math.ceil(((l?c:i)+n-u)/o);return Math.max(0,Math.min(a-1,t+d-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}});function Yn(){let e=W(),t=ht().cursor;if(!t||t.type!==`line`)return null;let n=e.indent,r=e.rowTopPosition(t.index)+(e.props.padding??e.props.paddingTop??0),i=n*t.level,a=e.renderCursor;return(0,H.jsx)(a,{top:r,left:i,indent:n})}var Xn=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Zn=(0,V.forwardRef)(function(e,t){let{children:n}=e,r=Xn(e,[`children`]),i=W();return(0,H.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&i.deselectAll()},children:[(0,H.jsx)(Qn,{}),n]}))}),Qn=()=>{let e=W();return(0,H.jsx)(`div`,{style:{height:e.rowTopPosition(e.visibleNodes.length),width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,H.jsx)(Yn,{})})},$n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},er=(0,V.forwardRef)(function(e,t){var{style:n}=e,r=$n(e,[`style`]);let i=W(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,H.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))}),tr=(0,V.createContext)({dragDropManager:void 0}),G;(function(e){e.SOURCE=`SOURCE`,e.TARGET=`TARGET`})(G||={});function K(e,t){var n=[...arguments].slice(2);if(!e){var r;if(t===void 0)r=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var i=0;r=Error(t.replace(/%s/g,function(){return n[i++]})),r.name=`Invariant Violation`}throw r.framesToPop=1,r}}var nr=`dnd-core/INIT_COORDS`,rr=`dnd-core/BEGIN_DRAG`,ir=`dnd-core/PUBLISH_DRAG_SOURCE`,ar=`dnd-core/HOVER`,or=`dnd-core/DROP`,sr=`dnd-core/END_DRAG`;function cr(e,t){return{type:nr,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function lr(e){"@babel/helpers - typeof";return lr=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},lr(e)}function ur(e,t,n){return t.split(`.`).reduce(function(e,t){return e&&e[t]?e[t]:n||null},e)}function dr(e,t){return e.filter(function(e){return e!==t})}function fr(e){return lr(e)===`object`}function pr(e,t){var n=new Map,r=function(e){n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);var i=[];return n.forEach(function(e,t){e===1&&i.push(t)}),i}function mr(e,t){return e.filter(function(e){return t.indexOf(e)>-1})}var hr={type:nr,payload:{clientOffset:null,sourceClientOffset:null}};function gr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},r=n.publishSource,i=r===void 0?!0:r,a=n.clientOffset,o=n.getSourceClientOffset,s=e.getMonitor(),c=e.getRegistry();e.dispatch(cr(a)),_r(t,s,c);var l=br(t,s);if(l===null){e.dispatch(hr);return}var u=null;if(a){if(!o)throw Error(`getSourceClientOffset must be defined`);vr(o),u=o(l)}e.dispatch(cr(a,u));var d=c.getSource(l).beginDrag(s,l);if(d!=null)return yr(d),c.pinSource(l),{type:rr,payload:{itemType:c.getSourceType(l),item:d,sourceId:l,clientOffset:a||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}function _r(e,t,n){K(!t.isDragging(),`Cannot call beginDrag while dragging.`),e.forEach(function(e){K(n.getSource(e),`Expected sourceIds to be registered.`)})}function vr(e){K(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function yr(e){K(fr(e),`Item must be an object.`)}function br(e,t){for(var n=null,r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function xr(e){return function(){if(e.getMonitor().isDragging())return{type:ir}}}function Sr(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function Cr(e){return function(t){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;wr(t);var r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Tr(r,i,a),Er(r,a,i.getItemType()),Dr(r,i,a),{type:ar,payload:{targetIds:r,clientOffset:n||null}}}}function wr(e){K(Array.isArray(e),`Expected targetIds to be an array.`)}function Tr(e,t,n){K(t.isDragging(),`Cannot call hover while not dragging.`),K(!t.didDrop(),`Cannot call hover after drop.`);for(var r=0;r<e.length;r++){var i=e[r];K(e.lastIndexOf(i)===r,`Expected targetIds to be unique in the passed array.`),K(n.getTarget(i),`Expected targetIds to be registered.`)}}function Er(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r];Sr(t.getTargetType(i),n)||e.splice(r,1)}}function Dr(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function Or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Or(Object(n),!0).forEach(function(t){Ar(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Or(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ar(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();Mr(n),Fr(n).forEach(function(i,a){var o=Nr(i,a,r,n),s={type:or,payload:{dropResult:kr(kr({},t),o)}};e.dispatch(s)})}}function Mr(e){K(e.isDragging(),`Cannot call drop while not dragging.`),K(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Nr(e,t,n,r){var i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Pr(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Pr(e){K(e===void 0||fr(e),`Drop result must either be an object or undefined.`)}function Fr(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ir(e){return function(){var t=e.getMonitor(),n=e.getRegistry();Lr(t);var r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:sr}}}function Lr(e){K(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Rr(e){return{beginDrag:gr(e),publishDragSource:xr(e),hover:Cr(e),drop:jr(e),endDrag:Ir(e)}}function zr(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Br(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Vr(e,t,n){return t&&Br(e.prototype,t),n&&Br(e,n),e}function Hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ur=function(){function e(t,n){var r=this;zr(this,e),Hr(this,`store`,void 0),Hr(this,`monitor`,void 0),Hr(this,`backend`,void 0),Hr(this,`isSetUp`,!1),Hr(this,`handleRefCountChange`,function(){var e=r.store.getState().refCount>0;r.backend&&(e&&!r.isSetUp?(r.backend.setup(),r.isSetUp=!0):!e&&r.isSetUp&&(r.backend.teardown(),r.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return Vr(e,[{key:`receiveBackend`,value:function(e){this.backend=e}},{key:`getMonitor`,value:function(){return this.monitor}},{key:`getBackend`,value:function(){return this.backend}},{key:`getRegistry`,value:function(){return this.monitor.registry}},{key:`getActions`,value:function(){var e=this,t=this.store.dispatch;function n(n){return function(){var r=[...arguments],i=n.apply(e,r);i!==void 0&&t(i)}}var r=Rr(this);return Object.keys(r).reduce(function(e,t){var i=r[t];return e[t]=n(i),e},{})}},{key:`dispatch`,value:function(e){this.store.dispatch(e)}}]),e}();function q(e){return`Minified Redux error #`+e+`; visit https://redux.js.org/Errors?code=`+e+` for the full message or use the non-minified dev environment for full errors. `}var Wr=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),Gr=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},Kr={INIT:`@@redux/INIT`+Gr(),REPLACE:`@@redux/REPLACE`+Gr(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+Gr()}};function qr(e){if(typeof e!=`object`||!e)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Jr(e,t,n){var r;if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(q(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(q(1));return n(Jr)(e,t)}if(typeof e!=`function`)throw Error(q(2));var i=e,a=t,o=[],s=o,c=!1;function l(){s===o&&(s=o.slice())}function u(){if(c)throw Error(q(3));return a}function d(e){if(typeof e!=`function`)throw Error(q(4));if(c)throw Error(q(5));var t=!0;return l(),s.push(e),function(){if(t){if(c)throw Error(q(6));t=!1,l();var n=s.indexOf(e);s.splice(n,1),o=null}}}function f(e){if(!qr(e))throw Error(q(7));if(e.type===void 0)throw Error(q(8));if(c)throw Error(q(9));try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,n=0;n<t.length;n++){var r=t[n];r()}return e}function p(e){if(typeof e!=`function`)throw Error(q(10));i=e,f({type:Kr.REPLACE})}function m(){var e,t=d;return e={subscribe:function(e){if(typeof e!=`object`||!e)throw Error(q(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}},e[Wr]=function(){return this},e}return f({type:Kr.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[Wr]=m,r}var Yr=function(e,t){return e===t};function Xr(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Zr(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Yr;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}function Qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Qr(Object(n),!0).forEach(function(t){ei(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ti={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function ni(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ti,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case nr:case rr:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case ar:return Xr(e.clientOffset,n.clientOffset)?e:$r($r({},e),{},{clientOffset:n.clientOffset});case sr:case or:return ti;default:return e}}var ri=`dnd-core/ADD_SOURCE`,ii=`dnd-core/ADD_TARGET`,ai=`dnd-core/REMOVE_SOURCE`,oi=`dnd-core/REMOVE_TARGET`;function si(e){return{type:ri,payload:{sourceId:e}}}function ci(e){return{type:ii,payload:{targetId:e}}}function li(e){return{type:ai,payload:{sourceId:e}}}function ui(e){return{type:oi,payload:{targetId:e}}}function di(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?di(Object(n),!0).forEach(function(t){fi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):di(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pi={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function mi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pi,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case rr:return J(J({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case ir:return J(J({},e),{},{isSourcePublic:!0});case ar:return J(J({},e),{},{targetIds:n.targetIds});case oi:return e.targetIds.indexOf(n.targetId)===-1?e:J(J({},e),{},{targetIds:dr(e.targetIds,n.targetId)});case or:return J(J({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case sr:return J(J({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function hi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case ri:case ii:return e+1;case ai:case oi:return e-1;default:return e}}var gi=[],_i=[];gi.__IS_NONE__=!0,_i.__IS_ALL__=!0;function vi(e,t){return e===gi?!1:e===_i||t===void 0?!0:mr(t,e).length>0}function yi(){arguments.length>0&&arguments[0]!==void 0&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case ar:break;case ri:case ii:case oi:case ai:return gi;case rr:case ir:case sr:case or:default:return _i}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,i=t.prevTargetIds,a=i===void 0?[]:i,o=pr(r,a);if(!(o.length>0||!Zr(r,a)))return gi;var s=a[a.length-1],c=r[r.length-1];return s!==c&&(s&&o.push(s),c&&o.push(c)),o}function bi(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function xi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Si(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?xi(Object(n),!0).forEach(function(t){Ci(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:yi(e.dirtyHandlerIds,{type:t.type,payload:Si(Si({},t.payload),{},{prevTargetIds:ur(e,`dragOperation.targetIds`,[])})}),dragOffset:ni(e.dragOffset,t),refCount:hi(e.refCount,t),dragOperation:mi(e.dragOperation,t),stateId:bi(e.stateId)}}function Ti(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Ei(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Di(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:Ei(Ti(t,r),n)}function Oi(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:Ei(t,n)}function ki(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ai(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ji(e,t,n){return t&&Ai(e.prototype,t),n&&Ai(e,n),e}function Mi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ni=function(){function e(t,n){ki(this,e),Mi(this,`store`,void 0),Mi(this,`registry`,void 0),this.store=t,this.registry=n}return ji(e,[{key:`subscribeToStateChange`,value:function(e){var t=this,n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0}).handlerIds;K(typeof e==`function`,`listener must be a function.`),K(n===void 0||Array.isArray(n),`handlerIds, when specified, must be an array of strings.`);var r=this.store.getState().stateId;return this.store.subscribe(function(){var i=t.store.getState(),a=i.stateId;try{a===r||a===r+1&&!vi(i.dirtyHandlerIds,n)||e()}finally{r=a}})}},{key:`subscribeToOffsetChange`,value:function(e){var t=this;K(typeof e==`function`,`listener must be a function.`);var n=this.store.getState().dragOffset;return this.store.subscribe(function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())})}},{key:`canDragSource`,value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return K(t,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:t.canDrag(this,e)}},{key:`canDropOnTarget`,value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return K(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop()?!1:Sr(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}},{key:`isDragging`,value:function(){return!!this.getItemType()}},{key:`isDraggingSource`,value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return K(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic()||this.registry.getSourceType(e)!==this.getItemType()?!1:t.isDragging(this,e)}},{key:`isOverTarget`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!e)return!1;var n=t.shallow;if(!this.isDragging())return!1;var r=this.registry.getTargetType(e),i=this.getItemType();if(i&&!Sr(r,i))return!1;var a=this.getTargetIds();if(!a.length)return!1;var o=a.indexOf(e);return n?o===a.length-1:o>-1}},{key:`getItemType`,value:function(){return this.store.getState().dragOperation.itemType}},{key:`getItem`,value:function(){return this.store.getState().dragOperation.item}},{key:`getSourceId`,value:function(){return this.store.getState().dragOperation.sourceId}},{key:`getTargetIds`,value:function(){return this.store.getState().dragOperation.targetIds}},{key:`getDropResult`,value:function(){return this.store.getState().dragOperation.dropResult}},{key:`didDrop`,value:function(){return this.store.getState().dragOperation.didDrop}},{key:`isSourcePublic`,value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:`getInitialClientOffset`,value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:`getInitialSourceClientOffset`,value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:`getClientOffset`,value:function(){return this.store.getState().dragOffset.clientOffset}},{key:`getSourceClientOffset`,value:function(){return Di(this.store.getState().dragOffset)}},{key:`getDifferenceFromInitialOffset`,value:function(){return Oi(this.store.getState().dragOffset)}}]),e}(),Pi=0;function Fi(){return Pi++}function Ii(e){"@babel/helpers - typeof";return Ii=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ii(e)}function Li(e){K(typeof e.canDrag==`function`,`Expected canDrag to be a function.`),K(typeof e.beginDrag==`function`,`Expected beginDrag to be a function.`),K(typeof e.endDrag==`function`,`Expected endDrag to be a function.`)}function Ri(e){K(typeof e.canDrop==`function`,`Expected canDrop to be a function.`),K(typeof e.hover==`function`,`Expected hover to be a function.`),K(typeof e.drop==`function`,`Expected beginDrag to be a function.`)}function zi(e,t){if(t&&Array.isArray(e)){e.forEach(function(e){return zi(e,!1)});return}K(typeof e==`string`||Ii(e)===`symbol`,t?`Type can only be a string, a symbol, or an array of either.`:`Type can only be a string or a symbol.`)}var Bi=typeof global<`u`?global:self,Vi=Bi.MutationObserver||Bi.WebKitMutationObserver;function Hi(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function Ui(e){let t=1,n=new Vi(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var Wi=typeof Vi==`function`?Ui:Hi,Gi=class{enqueueTask(e){let{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Wi(this.flush),this.requestErrorThrow=Hi(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},Ki=class{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}},qi=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new Ki(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},Ji=new Gi,Yi=new qi(Ji.registerPendingError);function Xi(e){Ji.enqueueTask(Yi.create(e))}function Zi(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Qi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $i(e,t,n){return t&&Qi(e.prototype,t),n&&Qi(e,n),e}function ea(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ta(e,t){return oa(e)||aa(e,t)||ra(e,t)||na()}function na(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ra(e,t){if(e){if(typeof e==`string`)return ia(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ia(e,t)}}function ia(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function aa(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function oa(e){if(Array.isArray(e))return e}function sa(e){var t=Fi().toString();switch(e){case G.SOURCE:return`S${t}`;case G.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function ca(e){switch(e[0]){case`S`:return G.SOURCE;case`T`:return G.TARGET;default:K(!1,`Cannot parse handler ID: ${e}`)}}function la(e,t){var n=e.entries(),r=!1;do{var i=n.next(),a=i.done;if(ta(i.value,2)[1]===t)return!0;r=!!a}while(!r);return!1}var ua=function(){function e(t){Zi(this,e),ea(this,`types`,new Map),ea(this,`dragSources`,new Map),ea(this,`dropTargets`,new Map),ea(this,`pinnedSourceId`,null),ea(this,`pinnedSource`,null),ea(this,`store`,void 0),this.store=t}return $i(e,[{key:`addSource`,value:function(e,t){zi(e),Li(t);var n=this.addHandler(G.SOURCE,e,t);return this.store.dispatch(si(n)),n}},{key:`addTarget`,value:function(e,t){zi(e,!0),Ri(t);var n=this.addHandler(G.TARGET,e,t);return this.store.dispatch(ci(n)),n}},{key:`containsHandler`,value:function(e){return la(this.dragSources,e)||la(this.dropTargets,e)}},{key:`getSource`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return K(this.isSourceId(e),`Expected a valid source ID.`),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:`getTarget`,value:function(e){return K(this.isTargetId(e),`Expected a valid target ID.`),this.dropTargets.get(e)}},{key:`getSourceType`,value:function(e){return K(this.isSourceId(e),`Expected a valid source ID.`),this.types.get(e)}},{key:`getTargetType`,value:function(e){return K(this.isTargetId(e),`Expected a valid target ID.`),this.types.get(e)}},{key:`isSourceId`,value:function(e){return ca(e)===G.SOURCE}},{key:`isTargetId`,value:function(e){return ca(e)===G.TARGET}},{key:`removeSource`,value:function(e){var t=this;K(this.getSource(e),`Expected an existing source.`),this.store.dispatch(li(e)),Xi(function(){t.dragSources.delete(e),t.types.delete(e)})}},{key:`removeTarget`,value:function(e){K(this.getTarget(e),`Expected an existing target.`),this.store.dispatch(ui(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:`pinSource`,value:function(e){var t=this.getSource(e);K(t,`Expected an existing source.`),this.pinnedSourceId=e,this.pinnedSource=t}},{key:`unpinSource`,value:function(){K(this.pinnedSource,`No source is pinned at the time.`),this.pinnedSourceId=null,this.pinnedSource=null}},{key:`addHandler`,value:function(e,t,n){var r=sa(e);return this.types.set(r,t),e===G.SOURCE?this.dragSources.set(r,n):e===G.TARGET&&this.dropTargets.set(r,n),r}}]),e}();function da(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=fa(arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1),i=new Ur(r,new Ni(r,new ua(r))),a=e(i,t,n);return i.receiveBackend(a),i}function fa(e){var t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return Jr(wi,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}var pa=[`children`];function ma(e,t){return ya(e)||va(e,t)||ga(e,t)||ha()}function ha(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ga(e,t){if(e){if(typeof e==`string`)return _a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _a(e,t)}}function _a(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function va(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function ya(e){if(Array.isArray(e))return e}function ba(e,t){if(e==null)return{};var n=xa(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xa(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Sa=0,Ca=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),wa=(0,V.memo)(function(e){var t=e.children,n=ma(Ta(ba(e,pa)),2),r=n[0],i=n[1];return(0,V.useEffect)(function(){if(i){var e=Da();return++Sa,function(){--Sa===0&&(e[Ca]=null)}}},[]),(0,H.jsx)(tr.Provider,Object.assign({value:r},{children:t}),void 0)});function Ta(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[Ea(e.backend,e.context,e.options,e.debugMode),!e.context]}function Ea(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Da(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=t;return i[Ca]||(i[Ca]={dragDropManager:da(e,t,n,r)}),i[Ca]}function Da(){return typeof global<`u`?global:window}function Oa(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ka(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Aa(e,t,n){return t&&ka(e.prototype,t),n&&ka(e,n),e}function ja(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ma=!1,Na=!1,Pa=function(){function e(t){Oa(this,e),ja(this,`internalMonitor`,void 0),ja(this,`sourceId`,null),this.internalMonitor=t.getMonitor()}return Aa(e,[{key:`receiveHandlerId`,value:function(e){this.sourceId=e}},{key:`getHandlerId`,value:function(){return this.sourceId}},{key:`canDrag`,value:function(){K(!Ma,`You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return Ma=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ma=!1}}},{key:`isDragging`,value:function(){if(!this.sourceId)return!1;K(!Na,`You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor`);try{return Na=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Na=!1}}},{key:`subscribeToStateChange`,value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:`isDraggingSource`,value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:`isOverTarget`,value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{key:`getTargetIds`,value:function(){return this.internalMonitor.getTargetIds()}},{key:`isSourcePublic`,value:function(){return this.internalMonitor.isSourcePublic()}},{key:`getSourceId`,value:function(){return this.internalMonitor.getSourceId()}},{key:`subscribeToOffsetChange`,value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:`canDragSource`,value:function(e){return this.internalMonitor.canDragSource(e)}},{key:`canDropOnTarget`,value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:`getItemType`,value:function(){return this.internalMonitor.getItemType()}},{key:`getItem`,value:function(){return this.internalMonitor.getItem()}},{key:`getDropResult`,value:function(){return this.internalMonitor.getDropResult()}},{key:`didDrop`,value:function(){return this.internalMonitor.didDrop()}},{key:`getInitialClientOffset`,value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:`getInitialSourceClientOffset`,value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:`getSourceClientOffset`,value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:`getClientOffset`,value:function(){return this.internalMonitor.getClientOffset()}},{key:`getDifferenceFromInitialOffset`,value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function Fa(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ia(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function La(e,t,n){return t&&Ia(e.prototype,t),n&&Ia(e,n),e}function Ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var za=!1,Ba=function(){function e(t){Fa(this,e),Ra(this,`internalMonitor`,void 0),Ra(this,`targetId`,null),this.internalMonitor=t.getMonitor()}return La(e,[{key:`receiveHandlerId`,value:function(e){this.targetId=e}},{key:`getHandlerId`,value:function(){return this.targetId}},{key:`subscribeToStateChange`,value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:`canDrop`,value:function(){if(!this.targetId)return!1;K(!za,`You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor`);try{return za=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{za=!1}}},{key:`isOver`,value:function(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!1}},{key:`getItemType`,value:function(){return this.internalMonitor.getItemType()}},{key:`getItem`,value:function(){return this.internalMonitor.getItem()}},{key:`getDropResult`,value:function(){return this.internalMonitor.getDropResult()}},{key:`didDrop`,value:function(){return this.internalMonitor.didDrop()}},{key:`getInitialClientOffset`,value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:`getInitialSourceClientOffset`,value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:`getSourceClientOffset`,value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:`getClientOffset`,value:function(){return this.internalMonitor.getClientOffset()}},{key:`getDifferenceFromInitialOffset`,value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function Va(e){if(typeof e.type!=`string`){var t=e.type.displayName||e.type.name||`the component`;throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}}function Ha(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!(0,V.isValidElement)(t)){var r=t;return e(r,n),r}var i=t;return Va(i),Ga(i,n?function(t){return e(t,n)}:e)}}function Ua(e){var t={};return Object.keys(e).forEach(function(n){var r=e[n];if(n.endsWith(`Ref`))t[n]=e[n];else{var i=Ha(r);t[n]=function(){return i}}}),t}function Wa(e,t){typeof e==`function`?e(t):e.current=t}function Ga(e,t){var n=e.ref;return K(typeof n!=`string`,`Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs`),n?(0,V.cloneElement)(e,{ref:function(e){Wa(n,e),Wa(t,e)}}):(0,V.cloneElement)(e,{ref:t})}function Ka(e){"@babel/helpers - typeof";return Ka=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ka(e)}function qa(e){return e!==null&&Ka(e)===`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Ja(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;c<a.length;c++){var l=a[c];if(!s(l))return!1;var u=e[l],d=t[l];if(i=n?n.call(r,u,d,l):void 0,i===!1||i===void 0&&u!==d)return!1}return!0}function Ya(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Xa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Za(e,t,n){return t&&Xa(e.prototype,t),n&&Xa(e,n),e}function Y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qa=function(){function e(t){var n=this;Ya(this,e),Y(this,`hooks`,Ua({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,qa(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,qa(e)?n.dragPreviewRef=e:n.dragPreviewNode=e,n.reconnectDragPreview()}})),Y(this,`handlerId`,null),Y(this,`dragSourceRef`,null),Y(this,`dragSourceNode`,void 0),Y(this,`dragSourceOptionsInternal`,null),Y(this,`dragSourceUnsubscribe`,void 0),Y(this,`dragPreviewRef`,null),Y(this,`dragPreviewNode`,void 0),Y(this,`dragPreviewOptionsInternal`,null),Y(this,`dragPreviewUnsubscribe`,void 0),Y(this,`lastConnectedHandlerId`,null),Y(this,`lastConnectedDragSource`,null),Y(this,`lastConnectedDragSourceOptions`,null),Y(this,`lastConnectedDragPreview`,null),Y(this,`lastConnectedDragPreviewOptions`,null),Y(this,`backend`,void 0),this.backend=t}return Za(e,[{key:`receiveHandlerId`,value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:`connectTarget`,get:function(){return this.dragSource}},{key:`dragSourceOptions`,get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:`dragPreviewOptions`,get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:`reconnect`,value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:`reconnectDragSource`,value:function(){var e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(t&&this.disconnectDragSource(),this.handlerId){if(!e){this.lastConnectedDragSource=e;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions))}}},{key:`reconnectDragPreview`,value:function(){var e=this.dragPreview,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(t&&this.disconnectDragPreview(),this.handlerId){if(!e){this.lastConnectedDragPreview=e;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions))}}},{key:`didHandlerIdChange`,value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:`didConnectedDragSourceChange`,value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:`didConnectedDragPreviewChange`,value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:`didDragSourceOptionsChange`,value:function(){return!Ja(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:`didDragPreviewOptionsChange`,value:function(){return!Ja(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:`disconnectDragSource`,value:function(){this.dragSourceUnsubscribe&&=(this.dragSourceUnsubscribe(),void 0)}},{key:`disconnectDragPreview`,value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:`dragSource`,get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:`dragPreview`,get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:`clearDragSource`,value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:`clearDragPreview`,value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function $a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function eo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function to(e,t,n){return t&&eo(e.prototype,t),n&&eo(e,n),e}function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var no=function(){function e(t){var n=this;$a(this,e),X(this,`hooks`,Ua({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,qa(e)?n.dropTargetRef=e:n.dropTargetNode=e,n.reconnect()}})),X(this,`handlerId`,null),X(this,`dropTargetRef`,null),X(this,`dropTargetNode`,void 0),X(this,`dropTargetOptionsInternal`,null),X(this,`unsubscribeDropTarget`,void 0),X(this,`lastConnectedHandlerId`,null),X(this,`lastConnectedDropTarget`,null),X(this,`lastConnectedDropTargetOptions`,null),X(this,`backend`,void 0),this.backend=t}return to(e,[{key:`connectTarget`,get:function(){return this.dropTarget}},{key:`reconnect`,value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}},{key:`receiveHandlerId`,value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:`dropTargetOptions`,get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:`didHandlerIdChange`,value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:`didDropTargetChange`,value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:`didOptionsChange`,value:function(){return!Ja(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:`disconnectDropTarget`,value:function(){this.unsubscribeDropTarget&&=(this.unsubscribeDropTarget(),void 0)}},{key:`dropTarget`,get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:`clearDropTarget`,value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function ro(e,t,n){var r=n.getRegistry(),i=r.addTarget(e,t);return[i,function(){return r.removeTarget(i)}]}function io(e,t,n){var r=n.getRegistry(),i=r.addSource(e,t);return[i,function(){return r.removeSource(i)}]}var ao=typeof window<`u`?V.useLayoutEffect:V.useEffect;function oo(e){"@babel/helpers - typeof";return oo=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},oo(e)}function so(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function co(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function lo(e,t,n){return t&&co(e.prototype,t),n&&co(e,n),e}function uo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var fo=function(){function e(t,n,r){so(this,e),uo(this,`spec`,void 0),uo(this,`monitor`,void 0),uo(this,`connector`,void 0),this.spec=t,this.monitor=n,this.connector=r}return lo(e,[{key:`beginDrag`,value:function(){var e=this.spec,t=this.monitor,n=null;return n=oo(e.item)===`object`?e.item:typeof e.item==`function`?e.item(t):{},n??null}},{key:`canDrag`,value:function(){var e=this.spec,t=this.monitor;return typeof e.canDrag==`boolean`?e.canDrag:typeof e.canDrag==`function`?e.canDrag(t):!0}},{key:`isDragging`,value:function(e,t){var n=this.spec,r=this.monitor,i=n.isDragging;return i?i(r):t===e.getSourceId()}},{key:`endDrag`,value:function(){var e=this.spec,t=this.monitor,n=this.connector,r=e.end;r&&r(t.getItem(),t),n.reconnect()}}]),e}();function po(e,t,n){var r=(0,V.useMemo)(function(){return new fo(e,t,n)},[t,n]);return(0,V.useEffect)(function(){r.spec=e},[e]),r}function mo(){var e=(0,V.useContext)(tr).dragDropManager;return K(e!=null,`Expected drag drop context`),e}function ho(e){return(0,V.useMemo)(function(){var t=e.type;return K(t!=null,`spec.type must be defined`),t},[e])}function go(e,t){return xo(e)||bo(e,t)||vo(e,t)||_o()}function _o(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vo(e,t){if(e){if(typeof e==`string`)return yo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yo(e,t)}}function yo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bo(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function xo(e){if(Array.isArray(e))return e}function So(e,t,n){var r=mo(),i=po(e,t,n),a=ho(e);ao(function(){if(a!=null){var e=go(io(a,i,r),2),o=e[0],s=e[1];return t.receiveHandlerId(o),n.receiveHandlerId(o),s}},[r,t,n,i,a])}function Co(e){return Do(e)||Eo(e)||To(e)||wo()}function wo(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|