farming-code 2.2.22 → 2.2.27

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.
@@ -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,f as c,p as l,r as u,s as d,t as f,v as p}from"./workspace-view-state-BqB4HM7r.js";import{H as m,J as h,K as g,M as _,U as v,V as y,X as b,Y as x,_ as S,a as C,at as w,c as T,ct as E,d as D,dt as O,et as k,f as A,ft as j,h as M,ht as N,i as ee,it as P,lt as te,n as F,nt as ne,ot as re,pt as I,q as L,r as ie,rt as ae,st as R,t as oe,tt as se,u as ce,ut as le,y as ue}from"./file-icons-CHWt5nSy.js";import{c as de,d as z,l as B,v as fe,y as pe}from"./IconGlyphs-C2WFcoJS.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:${L(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?g(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:h(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:F(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})]})},L(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)(B,{}):(0,H.jsx)(z,{}):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)(z,{}):(0,H.jsx)(B,{})}),(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)(z,{}):(0,H.jsx)(B,{})}),(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(I()){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`?oe(t.path,!1):F(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(le(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),m=(0,V.useRef)(null),h=(0,V.useRef)(null),g=t.length>0,_=(0,V.useCallback)(()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)},[]),v=(0,V.useCallback)((e=f.current)=>{if(!g)return;_();let t=e?.getBoundingClientRect();t&&t.right+156+12>window.innerWidth?u(`left`):u(`right`),c(!0)},[_,g]),y=(0,V.useCallback)(()=>{_(),h.current=window.setTimeout(()=>{c(!1),h.current=null},120)},[_]),b=(0,V.useCallback)(e=>{v(e.currentTarget.querySelector(`button`))},[v]),x=(0,V.useCallback)(()=>{window.setTimeout(()=>{m.current?.querySelector(`button:not(:disabled)`)?.focus()},0)},[]),S=(0,V.useCallback)(e=>{g&&e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),v(e.currentTarget),x())},[x,g,v]),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:b,onPointerLeave:y,onFocus:()=>_(),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":g?`menu`:void 0,"aria-expanded":g?o:void 0,onClick:i,onKeyDown:S,children:[(0,H.jsx)(`span`,{children:e}),g&&(0,H.jsx)(z,{className:`code-agent-launch-submenu-arrow`})]}),g&&o&&(0,H.jsx)(`div`,{ref:m,className:`code-agent-launch-submenu-panel ${l}`,"data-testid":r,role:`menu`,onPointerEnter:()=>_(),onPointerLeave:y,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)(s,{name:e.name}),(0,H.jsx)(`span`,{children:p(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:O(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),submitting:!1}}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){return e.kind!==`delete`||!e.item||t.some(t=>t.path===e.item?.path)?null:{path:e.item.path,parentDirectory:O(e.item.path),type:e.item.type,version:e.item.version}}function ot(e,t,n){if(e.kind!==`new-file`&&e.kind!==`new-folder`)return null;let r=e.parentPath?`${e.parentPath}/${t}`:t,i=n.find(e=>e.path===r),a=e.kind===`new-folder`?`directory`:`file`;return i?.type===a?i:null}function st(e,t,n){if(e.kind!==`rename`||!e.item)return null;let r=e.item.path,i=O(r),a=i?`${i}/${t}`:t;if(a===r||n.some(e=>e.path===r))return null;let o=n.find(e=>e.path===a);return!o||o.type!==e.item.type?null:{sourcePath:r,targetPath:a,sourceDirectory:i,targetDirectory:i,sourceVersion:e.item.version,targetVersion:o.version}}function ct(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 lt(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 ut({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-busy":n.submitting,"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:ct(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,disabled:n.submitting,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.submitting||n.kind!==`delete`&&!n.name.trim(),children:n.kind===`delete`?t.delete:t.save})]})]})})}function dt({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)(ut,{agentId:e,copy:t,fileOperation:a,inputRef:o,onCancel:l,onInputName:m,onSubmit:()=>{_()},onUpdateName:v})]})}var ft=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})),pt=n(((e,t)=>{t.exports=ft()})),mt=(0,V.createContext)(null);function W(){let e=(0,V.useContext)(mt);if(e===null)throw Error(`No Tree Api Provided`);return e}var ht=(0,V.createContext)(null);function gt(){let e=(0,V.useContext)(ht);if(e===null)throw Error(`Provide a NodesContext`);return e}var _t=(0,V.createContext)(null);function vt(){let e=(0,V.useContext)(_t);if(e===null)throw Error(`Provide a DnDContext`);return e}var yt=(0,V.createContext)(0);function bt(){(0,V.useContext)(yt)}var xt=e({access:()=>It,bound:()=>St,dfs:()=>kt,focusNextElement:()=>jt,focusPrevElement:()=>Mt,getInsertIndex:()=>Ht,getInsertParentId:()=>Gt,getTreeLinePrefix:()=>Wt,identify:()=>Rt,identifyNull:()=>Lt,indexOf:()=>Dt,isClosed:()=>wt,isDescendant:()=>Et,isItem:()=>Ct,isOpenWithEmptyChildren:()=>Tt,mergeRefs:()=>zt,noop:()=>Ot,safeRun:()=>Bt,waitFor:()=>Vt,walk:()=>At});function St(e,t,n){return Math.max(Math.min(e,n),t)}function Ct(e){return e&&e.isLeaf}function wt(e){return e&&e.isInternal&&!e.isOpen}function Tt(e){return e&&e.isOpen&&!e.children?.length}var Et=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},Dt=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function Ot(){}function kt(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=kt(n,t);if(e)return e}return null}function At(e,t){if(t(e),e.children)for(let n of e.children)At(n,t)}function jt(e){let t=Ft(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Nt(t,r);break}n?.focus()}function Mt(e){let t=Ft(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Pt(t,r);break}n?.focus()}function Nt(e,t){return t+1<e.length?e[t+1]:e[0]}function Pt(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Ft(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 It(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Lt(e){return e===null?null:Rt(e)}function Rt(e){return typeof e==`string`?e:e.id}function zt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Bt(e,...t){if(e)return e(...t)}function Vt(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function Ht(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}var Ut={last:`└ `,middle:`├ `,pipe:`│ `,blank:`  `};function Wt(e,t={}){let n=Object.assign(Object.assign({},Ut),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 Gt(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Kt={display:`flex`,alignItems:`center`,zIndex:1},qt={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Jt={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Yt=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({},Kt),r),children:[(0,H.jsx)(`div`,{style:Object.assign({},Jt)}),(0,H.jsx)(`div`,{style:Object.assign({},qt)})]})});function Xt({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 Zt(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)($t,Object.assign({},e)):(0,H.jsx)(Qt,Object.assign({},e))]})}function Qt(e){return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`span`,{children:e.node.data.name})})}function $t({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 en=`__REACT_ARBORIST_INTERNAL_ROOT__`;function tn(e){function t(n,r,i){let a=new nn({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 nn({tree:e,id:en,data:{id:en},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var nn=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===en}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 rn(e){return{type:`EDIT`,id:e}}function an(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function on(e){return{type:`FOCUS`,id:e}}function sn(){return{type:`TREE_BLUR`}}function cn(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 ln={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 un(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 dn(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:un(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:un(e.unfiltered,t)}):e}var fn=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}}),pn={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:Rt(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(Rt)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(Rt)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:Rt(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:Rt(e)})};function mn(e=fn().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 hn={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 gn(e=fn().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 fn().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var _n={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},vn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},yn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function bn({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,H.jsxs)(xn,{isDragging:i,children:[(0,H.jsx)(Sn,{offset:e,children:(0,H.jsx)(wn,{id:n,dragIds:r})}),(0,H.jsx)(Cn,{mouse:t,count:r.length})]})}var xn=(0,V.memo)(function(e){return e.isDragging?(0,H.jsx)(`div`,{style:_n,children:e.children}):null});function Sn(e){return(0,H.jsx)(`div`,{className:`row preview`,style:vn(e.offset),children:e.children})}function Cn(e){let{count:t,mouse:n}=e;return t>1?(0,H.jsx)(`div`,{className:`selected-count`,style:yn(n),children:t}):null}var wn=(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 Tn(){return Tn=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},Tn.apply(null,arguments)}function En(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Dn(e,t){return Dn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Dn(e,t)}function On(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Dn(e,t)}var kn=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function An(e,t){return!!(e===t||kn(e)&&kn(t))}function jn(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!An(e[n],t[n]))return!1;return!0}function Mn(e,t){t===void 0&&(t=jn);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 Nn=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function Pn(e){cancelAnimationFrame(e.id)}function Fn(e,t){var n=Nn();function r(){Nn()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var In=-1;function Ln(e){if(e===void 0&&(e=!1),In===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),In=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return In}var Rn=null;function zn(e){if(e===void 0&&(e=!1),Rn===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?Rn=`positive-descending`:(t.scrollLeft=1,Rn=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),Rn}return Rn}var Bn=150,Vn=function(e,t){return e};function Hn(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){On(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,En(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:En(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Mn(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Mn(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=Mn(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(zn()){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&&Pn(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Fn(r._resetIsScrolling,Bn)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Un(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?Ln():0:c.scrollHeight>c.clientHeight?Ln():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(zn()){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&&Pn(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?Vn: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:Tn({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 Un=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Wn=50,Gn=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]},Kn=function(e,t,n){var r=t.itemMetadataMap,i=t.lastMeasuredIndex;return(i>0?r[i].offset:0)>=n?qn(e,t,i,0,n):Jn(e,t,Math.max(0,i),n)},qn=function(e,t,n,r,i){for(;r<=n;){var a=r+Math.floor((n-r)/2),o=Gn(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},Jn=function(e,t,n,r){for(var i=e.itemCount,a=1;n<i&&Gn(e,n,t).offset<r;)n+=a,a*=2;return qn(e,t,Math.min(n,i-1),Math.floor(n/2),r)},Yn=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},Xn=Hn({getItemOffset:function(e,t,n){return Gn(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:Yn,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=Gn(e,t,i),f=Yn(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 Kn(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=Gn(e,t,r),d=n+l,f=u.offset+u.size,p=t;p<o-1&&f<d;)p++,f+=Gn(e,p,r).size;return p},initInstanceProps:function(e,t){var n={itemMetadataMap:{},estimatedItemSize:e.estimatedItemSize||Wn,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}}),Zn=Hn({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 Qn(){let e=W(),t=vt().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 $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){let{children:n}=e,r=$n(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)(tr,{}),n]}))}),tr=()=>{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)(Qn,{})})},nr=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},rr=(0,V.forwardRef)(function(e,t){var{style:n}=e,r=nr(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))}),ir=(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 ar=`dnd-core/INIT_COORDS`,or=`dnd-core/BEGIN_DRAG`,sr=`dnd-core/PUBLISH_DRAG_SOURCE`,cr=`dnd-core/HOVER`,lr=`dnd-core/DROP`,ur=`dnd-core/END_DRAG`;function dr(e,t){return{type:ar,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function fr(e){"@babel/helpers - typeof";return fr=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},fr(e)}function pr(e,t,n){return t.split(`.`).reduce(function(e,t){return e&&e[t]?e[t]:n||null},e)}function mr(e,t){return e.filter(function(e){return e!==t})}function hr(e){return fr(e)===`object`}function gr(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 _r(e,t){return e.filter(function(e){return t.indexOf(e)>-1})}var vr={type:ar,payload:{clientOffset:null,sourceClientOffset:null}};function yr(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(dr(a)),br(t,s,c);var l=Cr(t,s);if(l===null){e.dispatch(vr);return}var u=null;if(a){if(!o)throw Error(`getSourceClientOffset must be defined`);xr(o),u=o(l)}e.dispatch(dr(a,u));var d=c.getSource(l).beginDrag(s,l);if(d!=null)return Sr(d),c.pinSource(l),{type:or,payload:{itemType:c.getSourceType(l),item:d,sourceId:l,clientOffset:a||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}function br(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 xr(e){K(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function Sr(e){K(hr(e),`Item must be an object.`)}function Cr(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 wr(e){return function(){if(e.getMonitor().isDragging())return{type:sr}}}function Tr(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function Er(e){return function(t){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;Dr(t);var r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Or(r,i,a),kr(r,a,i.getItemType()),Ar(r,i,a),{type:cr,payload:{targetIds:r,clientOffset:n||null}}}}function Dr(e){K(Array.isArray(e),`Expected targetIds to be an array.`)}function Or(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 kr(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r];Tr(t.getTargetType(i),n)||e.splice(r,1)}}function Ar(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function jr(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 Mr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jr(Object(n),!0).forEach(function(t){Nr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Nr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();Fr(n),Rr(n).forEach(function(i,a){var o=Ir(i,a,r,n),s={type:lr,payload:{dropResult:Mr(Mr({},t),o)}};e.dispatch(s)})}}function Fr(e){K(e.isDragging(),`Cannot call drop while not dragging.`),K(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Ir(e,t,n,r){var i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Lr(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Lr(e){K(e===void 0||hr(e),`Drop result must either be an object or undefined.`)}function Rr(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function zr(e){return function(){var t=e.getMonitor(),n=e.getRegistry();Br(t);var r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:ur}}}function Br(e){K(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Vr(e){return{beginDrag:yr(e),publishDragSource:wr(e),hover:Er(e),drop:Pr(e),endDrag:zr(e)}}function Hr(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ur(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 Wr(e,t,n){return t&&Ur(e.prototype,t),n&&Ur(e,n),e}function Gr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Kr=function(){function e(t,n){var r=this;Hr(this,e),Gr(this,`store`,void 0),Gr(this,`monitor`,void 0),Gr(this,`backend`,void 0),Gr(this,`isSetUp`,!1),Gr(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 Wr(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=Vr(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 qr=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),Jr=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},Yr={INIT:`@@redux/INIT`+Jr(),REPLACE:`@@redux/REPLACE`+Jr(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+Jr()}};function Xr(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 Zr(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(Zr)(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(!Xr(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:Yr.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[qr]=function(){return this},e}return f({type:Yr.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[qr]=m,r}var Qr=function(e,t){return e===t};function $r(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function ei(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Qr;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 ti(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 ni(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ti(Object(n),!0).forEach(function(t){ri(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ti(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ri(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ii={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function ai(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ii,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case ar:case or:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case cr:return $r(e.clientOffset,n.clientOffset)?e:ni(ni({},e),{},{clientOffset:n.clientOffset});case ur:case lr:return ii;default:return e}}var oi=`dnd-core/ADD_SOURCE`,si=`dnd-core/ADD_TARGET`,ci=`dnd-core/REMOVE_SOURCE`,li=`dnd-core/REMOVE_TARGET`;function ui(e){return{type:oi,payload:{sourceId:e}}}function di(e){return{type:si,payload:{targetId:e}}}function fi(e){return{type:ci,payload:{sourceId:e}}}function pi(e){return{type:li,payload:{targetId:e}}}function mi(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?mi(Object(n),!0).forEach(function(t){hi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var gi={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function _i(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gi,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case or:return J(J({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case sr:return J(J({},e),{},{isSourcePublic:!0});case cr:return J(J({},e),{},{targetIds:n.targetIds});case li:return e.targetIds.indexOf(n.targetId)===-1?e:J(J({},e),{},{targetIds:mr(e.targetIds,n.targetId)});case lr:return J(J({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case ur:return J(J({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function vi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case oi:case si:return e+1;case ci:case li:return e-1;default:return e}}var yi=[],bi=[];yi.__IS_NONE__=!0,bi.__IS_ALL__=!0;function xi(e,t){return e===yi?!1:e===bi||t===void 0?!0:_r(t,e).length>0}function Si(){arguments.length>0&&arguments[0]!==void 0&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case cr:break;case oi:case si:case li:case ci:return yi;case or:case sr:case ur:case lr:default:return bi}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,i=t.prevTargetIds,a=i===void 0?[]:i,o=gr(r,a);if(!(o.length>0||!ei(r,a)))return yi;var s=a[a.length-1],c=r[r.length-1];return s!==c&&(s&&o.push(s),c&&o.push(c)),o}function Ci(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function wi(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 Ti(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?wi(Object(n),!0).forEach(function(t){Ei(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wi(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}function Di(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Si(e.dirtyHandlerIds,{type:t.type,payload:Ti(Ti({},t.payload),{},{prevTargetIds:pr(e,`dragOperation.targetIds`,[])})}),dragOffset:ai(e.dragOffset,t),refCount:vi(e.refCount,t),dragOperation:_i(e.dragOperation,t),stateId:Ci(e.stateId)}}function Oi(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ki(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ai(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:ki(Oi(t,r),n)}function ji(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:ki(t,n)}function Mi(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ni(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 Pi(e,t,n){return t&&Ni(e.prototype,t),n&&Ni(e,n),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 Ii=function(){function e(t,n){Mi(this,e),Fi(this,`store`,void 0),Fi(this,`registry`,void 0),this.store=t,this.registry=n}return Pi(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&&!xi(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:Tr(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&&!Tr(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 Ai(this.store.getState().dragOffset)}},{key:`getDifferenceFromInitialOffset`,value:function(){return ji(this.store.getState().dragOffset)}}]),e}(),Li=0;function Ri(){return Li++}function zi(e){"@babel/helpers - typeof";return zi=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},zi(e)}function Bi(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 Vi(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 Hi(e,t){if(t&&Array.isArray(e)){e.forEach(function(e){return Hi(e,!1)});return}K(typeof e==`string`||zi(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 Ui=typeof global<`u`?global:self,Wi=Ui.MutationObserver||Ui.WebKitMutationObserver;function Gi(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function Ki(e){let t=1,n=new Wi(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var qi=typeof Wi==`function`?Ki:Gi,Ji=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=qi(this.flush),this.requestErrorThrow=Gi(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},Yi=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}},Xi=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new Yi(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},Zi=new Ji,Qi=new Xi(Zi.registerPendingError);function $i(e){Zi.enqueueTask(Qi.create(e))}function ea(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ta(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 na(e,t,n){return t&&ta(e.prototype,t),n&&ta(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}function ia(e,t){return la(e)||ca(e,t)||oa(e,t)||aa()}function aa(){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,f as c,p as l,r as u,s as d,t as f,v as p}from"./workspace-view-state-BiuEbmRr.js";import{H as m,J as h,K as g,M as _,U as v,V as y,X as b,Y as x,_ as S,a as C,at as w,c as T,ct as E,d as D,dt as O,et as k,f as A,ft as j,h as M,ht as N,i as ee,it as P,lt as te,n as F,nt as ne,ot as re,pt as I,q as L,r as ie,rt as ae,st as R,t as oe,tt as se,u as ce,ut as le,y as ue}from"./file-icons-BqiH0rDI.js";import{c as de,d as z,l as B,v as fe,y as pe}from"./IconGlyphs-C2WFcoJS.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:${L(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?g(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:h(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:F(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})]})},L(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)(B,{}):(0,H.jsx)(z,{}):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)(z,{}):(0,H.jsx)(B,{})}),(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)(z,{}):(0,H.jsx)(B,{})}),(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(I()){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`?oe(t.path,!1):F(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(le(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),m=(0,V.useRef)(null),h=(0,V.useRef)(null),g=t.length>0,_=(0,V.useCallback)(()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)},[]),v=(0,V.useCallback)((e=f.current)=>{if(!g)return;_();let t=e?.getBoundingClientRect();t&&t.right+156+12>window.innerWidth?u(`left`):u(`right`),c(!0)},[_,g]),y=(0,V.useCallback)(()=>{_(),h.current=window.setTimeout(()=>{c(!1),h.current=null},120)},[_]),b=(0,V.useCallback)(e=>{v(e.currentTarget.querySelector(`button`))},[v]),x=(0,V.useCallback)(()=>{window.setTimeout(()=>{m.current?.querySelector(`button:not(:disabled)`)?.focus()},0)},[]),S=(0,V.useCallback)(e=>{g&&e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),v(e.currentTarget),x())},[x,g,v]),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:b,onPointerLeave:y,onFocus:()=>_(),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":g?`menu`:void 0,"aria-expanded":g?o:void 0,onClick:i,onKeyDown:S,children:[(0,H.jsx)(`span`,{children:e}),g&&(0,H.jsx)(z,{className:`code-agent-launch-submenu-arrow`})]}),g&&o&&(0,H.jsx)(`div`,{ref:m,className:`code-agent-launch-submenu-panel ${l}`,"data-testid":r,role:`menu`,onPointerEnter:()=>_(),onPointerLeave:y,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)(s,{name:e.name}),(0,H.jsx)(`span`,{children:p(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:O(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),submitting:!1}}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){return e.kind!==`delete`||!e.item||t.some(t=>t.path===e.item?.path)?null:{path:e.item.path,parentDirectory:O(e.item.path),type:e.item.type,version:e.item.version}}function ot(e,t,n){if(e.kind!==`new-file`&&e.kind!==`new-folder`)return null;let r=e.parentPath?`${e.parentPath}/${t}`:t,i=n.find(e=>e.path===r),a=e.kind===`new-folder`?`directory`:`file`;return i?.type===a?i:null}function st(e,t,n){if(e.kind!==`rename`||!e.item)return null;let r=e.item.path,i=O(r),a=i?`${i}/${t}`:t;if(a===r||n.some(e=>e.path===r))return null;let o=n.find(e=>e.path===a);return!o||o.type!==e.item.type?null:{sourcePath:r,targetPath:a,sourceDirectory:i,targetDirectory:i,sourceVersion:e.item.version,targetVersion:o.version}}function ct(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 lt(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 ut({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-busy":n.submitting,"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:ct(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,disabled:n.submitting,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.submitting||n.kind!==`delete`&&!n.name.trim(),children:n.kind===`delete`?t.delete:t.save})]})]})})}function dt({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)(ut,{agentId:e,copy:t,fileOperation:a,inputRef:o,onCancel:l,onInputName:m,onSubmit:()=>{_()},onUpdateName:v})]})}var ft=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})),pt=n(((e,t)=>{t.exports=ft()})),mt=(0,V.createContext)(null);function W(){let e=(0,V.useContext)(mt);if(e===null)throw Error(`No Tree Api Provided`);return e}var ht=(0,V.createContext)(null);function gt(){let e=(0,V.useContext)(ht);if(e===null)throw Error(`Provide a NodesContext`);return e}var _t=(0,V.createContext)(null);function vt(){let e=(0,V.useContext)(_t);if(e===null)throw Error(`Provide a DnDContext`);return e}var yt=(0,V.createContext)(0);function bt(){(0,V.useContext)(yt)}var xt=e({access:()=>It,bound:()=>St,dfs:()=>kt,focusNextElement:()=>jt,focusPrevElement:()=>Mt,getInsertIndex:()=>Ht,getInsertParentId:()=>Gt,getTreeLinePrefix:()=>Wt,identify:()=>Rt,identifyNull:()=>Lt,indexOf:()=>Dt,isClosed:()=>wt,isDescendant:()=>Et,isItem:()=>Ct,isOpenWithEmptyChildren:()=>Tt,mergeRefs:()=>zt,noop:()=>Ot,safeRun:()=>Bt,waitFor:()=>Vt,walk:()=>At});function St(e,t,n){return Math.max(Math.min(e,n),t)}function Ct(e){return e&&e.isLeaf}function wt(e){return e&&e.isInternal&&!e.isOpen}function Tt(e){return e&&e.isOpen&&!e.children?.length}var Et=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},Dt=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function Ot(){}function kt(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=kt(n,t);if(e)return e}return null}function At(e,t){if(t(e),e.children)for(let n of e.children)At(n,t)}function jt(e){let t=Ft(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Nt(t,r);break}n?.focus()}function Mt(e){let t=Ft(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Pt(t,r);break}n?.focus()}function Nt(e,t){return t+1<e.length?e[t+1]:e[0]}function Pt(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Ft(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 It(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Lt(e){return e===null?null:Rt(e)}function Rt(e){return typeof e==`string`?e:e.id}function zt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function Bt(e,...t){if(e)return e(...t)}function Vt(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function Ht(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}var Ut={last:`└ `,middle:`├ `,pipe:`│ `,blank:`  `};function Wt(e,t={}){let n=Object.assign(Object.assign({},Ut),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 Gt(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var Kt={display:`flex`,alignItems:`center`,zIndex:1},qt={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Jt={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},Yt=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({},Kt),r),children:[(0,H.jsx)(`div`,{style:Object.assign({},Jt)}),(0,H.jsx)(`div`,{style:Object.assign({},qt)})]})});function Xt({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 Zt(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)($t,Object.assign({},e)):(0,H.jsx)(Qt,Object.assign({},e))]})}function Qt(e){return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`span`,{children:e.node.data.name})})}function $t({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 en=`__REACT_ARBORIST_INTERNAL_ROOT__`;function tn(e){function t(n,r,i){let a=new nn({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 nn({tree:e,id:en,data:{id:en},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var nn=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===en}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 rn(e){return{type:`EDIT`,id:e}}function an(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function on(e){return{type:`FOCUS`,id:e}}function sn(){return{type:`TREE_BLUR`}}function cn(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 ln={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 un(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 dn(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:un(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:un(e.unfiltered,t)}):e}var fn=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}}),pn={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:Rt(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(Rt)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(Rt)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:Rt(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:Rt(e)})};function mn(e=fn().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 hn={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 gn(e=fn().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 fn().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var _n={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},vn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},yn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function bn({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,H.jsxs)(xn,{isDragging:i,children:[(0,H.jsx)(Sn,{offset:e,children:(0,H.jsx)(wn,{id:n,dragIds:r})}),(0,H.jsx)(Cn,{mouse:t,count:r.length})]})}var xn=(0,V.memo)(function(e){return e.isDragging?(0,H.jsx)(`div`,{style:_n,children:e.children}):null});function Sn(e){return(0,H.jsx)(`div`,{className:`row preview`,style:vn(e.offset),children:e.children})}function Cn(e){let{count:t,mouse:n}=e;return t>1?(0,H.jsx)(`div`,{className:`selected-count`,style:yn(n),children:t}):null}var wn=(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 Tn(){return Tn=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},Tn.apply(null,arguments)}function En(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Dn(e,t){return Dn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Dn(e,t)}function On(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Dn(e,t)}var kn=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function An(e,t){return!!(e===t||kn(e)&&kn(t))}function jn(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!An(e[n],t[n]))return!1;return!0}function Mn(e,t){t===void 0&&(t=jn);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 Nn=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function Pn(e){cancelAnimationFrame(e.id)}function Fn(e,t){var n=Nn();function r(){Nn()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var In=-1;function Ln(e){if(e===void 0&&(e=!1),In===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),In=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return In}var Rn=null;function zn(e){if(e===void 0&&(e=!1),Rn===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?Rn=`positive-descending`:(t.scrollLeft=1,Rn=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),Rn}return Rn}var Bn=150,Vn=function(e,t){return e};function Hn(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){On(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,En(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:En(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Mn(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Mn(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=Mn(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(zn()){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&&Pn(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Fn(r._resetIsScrolling,Bn)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Un(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?Ln():0:c.scrollHeight>c.clientHeight?Ln():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(zn()){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&&Pn(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?Vn: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:Tn({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 Un=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Wn=50,Gn=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]},Kn=function(e,t,n){var r=t.itemMetadataMap,i=t.lastMeasuredIndex;return(i>0?r[i].offset:0)>=n?qn(e,t,i,0,n):Jn(e,t,Math.max(0,i),n)},qn=function(e,t,n,r,i){for(;r<=n;){var a=r+Math.floor((n-r)/2),o=Gn(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},Jn=function(e,t,n,r){for(var i=e.itemCount,a=1;n<i&&Gn(e,n,t).offset<r;)n+=a,a*=2;return qn(e,t,Math.min(n,i-1),Math.floor(n/2),r)},Yn=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},Xn=Hn({getItemOffset:function(e,t,n){return Gn(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:Yn,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=Gn(e,t,i),f=Yn(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 Kn(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=Gn(e,t,r),d=n+l,f=u.offset+u.size,p=t;p<o-1&&f<d;)p++,f+=Gn(e,p,r).size;return p},initInstanceProps:function(e,t){var n={itemMetadataMap:{},estimatedItemSize:e.estimatedItemSize||Wn,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}}),Zn=Hn({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 Qn(){let e=W(),t=vt().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 $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){let{children:n}=e,r=$n(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)(tr,{}),n]}))}),tr=()=>{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)(Qn,{})})},nr=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},rr=(0,V.forwardRef)(function(e,t){var{style:n}=e,r=nr(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))}),ir=(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 ar=`dnd-core/INIT_COORDS`,or=`dnd-core/BEGIN_DRAG`,sr=`dnd-core/PUBLISH_DRAG_SOURCE`,cr=`dnd-core/HOVER`,lr=`dnd-core/DROP`,ur=`dnd-core/END_DRAG`;function dr(e,t){return{type:ar,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function fr(e){"@babel/helpers - typeof";return fr=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},fr(e)}function pr(e,t,n){return t.split(`.`).reduce(function(e,t){return e&&e[t]?e[t]:n||null},e)}function mr(e,t){return e.filter(function(e){return e!==t})}function hr(e){return fr(e)===`object`}function gr(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 _r(e,t){return e.filter(function(e){return t.indexOf(e)>-1})}var vr={type:ar,payload:{clientOffset:null,sourceClientOffset:null}};function yr(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(dr(a)),br(t,s,c);var l=Cr(t,s);if(l===null){e.dispatch(vr);return}var u=null;if(a){if(!o)throw Error(`getSourceClientOffset must be defined`);xr(o),u=o(l)}e.dispatch(dr(a,u));var d=c.getSource(l).beginDrag(s,l);if(d!=null)return Sr(d),c.pinSource(l),{type:or,payload:{itemType:c.getSourceType(l),item:d,sourceId:l,clientOffset:a||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}function br(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 xr(e){K(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function Sr(e){K(hr(e),`Item must be an object.`)}function Cr(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 wr(e){return function(){if(e.getMonitor().isDragging())return{type:sr}}}function Tr(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function Er(e){return function(t){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;Dr(t);var r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return Or(r,i,a),kr(r,a,i.getItemType()),Ar(r,i,a),{type:cr,payload:{targetIds:r,clientOffset:n||null}}}}function Dr(e){K(Array.isArray(e),`Expected targetIds to be an array.`)}function Or(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 kr(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r];Tr(t.getTargetType(i),n)||e.splice(r,1)}}function Ar(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function jr(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 Mr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jr(Object(n),!0).forEach(function(t){Nr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Nr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();Fr(n),Rr(n).forEach(function(i,a){var o=Ir(i,a,r,n),s={type:lr,payload:{dropResult:Mr(Mr({},t),o)}};e.dispatch(s)})}}function Fr(e){K(e.isDragging(),`Cannot call drop while not dragging.`),K(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Ir(e,t,n,r){var i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Lr(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Lr(e){K(e===void 0||hr(e),`Drop result must either be an object or undefined.`)}function Rr(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function zr(e){return function(){var t=e.getMonitor(),n=e.getRegistry();Br(t);var r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:ur}}}function Br(e){K(e.isDragging(),`Cannot call endDrag while not dragging.`)}function Vr(e){return{beginDrag:yr(e),publishDragSource:wr(e),hover:Er(e),drop:Pr(e),endDrag:zr(e)}}function Hr(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ur(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 Wr(e,t,n){return t&&Ur(e.prototype,t),n&&Ur(e,n),e}function Gr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Kr=function(){function e(t,n){var r=this;Hr(this,e),Gr(this,`store`,void 0),Gr(this,`monitor`,void 0),Gr(this,`backend`,void 0),Gr(this,`isSetUp`,!1),Gr(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 Wr(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=Vr(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 qr=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),Jr=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},Yr={INIT:`@@redux/INIT`+Jr(),REPLACE:`@@redux/REPLACE`+Jr(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+Jr()}};function Xr(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 Zr(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(Zr)(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(!Xr(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:Yr.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[qr]=function(){return this},e}return f({type:Yr.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[qr]=m,r}var Qr=function(e,t){return e===t};function $r(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function ei(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Qr;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 ti(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 ni(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?ti(Object(n),!0).forEach(function(t){ri(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ti(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ri(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ii={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function ai(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ii,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case ar:case or:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case cr:return $r(e.clientOffset,n.clientOffset)?e:ni(ni({},e),{},{clientOffset:n.clientOffset});case ur:case lr:return ii;default:return e}}var oi=`dnd-core/ADD_SOURCE`,si=`dnd-core/ADD_TARGET`,ci=`dnd-core/REMOVE_SOURCE`,li=`dnd-core/REMOVE_TARGET`;function ui(e){return{type:oi,payload:{sourceId:e}}}function di(e){return{type:si,payload:{targetId:e}}}function fi(e){return{type:ci,payload:{sourceId:e}}}function pi(e){return{type:li,payload:{targetId:e}}}function mi(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?mi(Object(n),!0).forEach(function(t){hi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var gi={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function _i(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gi,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case or:return J(J({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case sr:return J(J({},e),{},{isSourcePublic:!0});case cr:return J(J({},e),{},{targetIds:n.targetIds});case li:return e.targetIds.indexOf(n.targetId)===-1?e:J(J({},e),{},{targetIds:mr(e.targetIds,n.targetId)});case lr:return J(J({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case ur:return J(J({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function vi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case oi:case si:return e+1;case ci:case li:return e-1;default:return e}}var yi=[],bi=[];yi.__IS_NONE__=!0,bi.__IS_ALL__=!0;function xi(e,t){return e===yi?!1:e===bi||t===void 0?!0:_r(t,e).length>0}function Si(){arguments.length>0&&arguments[0]!==void 0&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case cr:break;case oi:case si:case li:case ci:return yi;case or:case sr:case ur:case lr:default:return bi}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,i=t.prevTargetIds,a=i===void 0?[]:i,o=gr(r,a);if(!(o.length>0||!ei(r,a)))return yi;var s=a[a.length-1],c=r[r.length-1];return s!==c&&(s&&o.push(s),c&&o.push(c)),o}function Ci(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}function wi(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 Ti(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?wi(Object(n),!0).forEach(function(t){Ei(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wi(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}function Di(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Si(e.dirtyHandlerIds,{type:t.type,payload:Ti(Ti({},t.payload),{},{prevTargetIds:pr(e,`dragOperation.targetIds`,[])})}),dragOffset:ai(e.dragOffset,t),refCount:vi(e.refCount,t),dragOperation:_i(e.dragOperation,t),stateId:Ci(e.stateId)}}function Oi(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ki(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ai(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:ki(Oi(t,r),n)}function ji(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:ki(t,n)}function Mi(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ni(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 Pi(e,t,n){return t&&Ni(e.prototype,t),n&&Ni(e,n),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 Ii=function(){function e(t,n){Mi(this,e),Fi(this,`store`,void 0),Fi(this,`registry`,void 0),this.store=t,this.registry=n}return Pi(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&&!xi(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:Tr(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&&!Tr(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 Ai(this.store.getState().dragOffset)}},{key:`getDifferenceFromInitialOffset`,value:function(){return ji(this.store.getState().dragOffset)}}]),e}(),Li=0;function Ri(){return Li++}function zi(e){"@babel/helpers - typeof";return zi=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},zi(e)}function Bi(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 Vi(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 Hi(e,t){if(t&&Array.isArray(e)){e.forEach(function(e){return Hi(e,!1)});return}K(typeof e==`string`||zi(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 Ui=typeof global<`u`?global:self,Wi=Ui.MutationObserver||Ui.WebKitMutationObserver;function Gi(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function Ki(e){let t=1,n=new Wi(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var qi=typeof Wi==`function`?Ki:Gi,Ji=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=qi(this.flush),this.requestErrorThrow=Gi(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},Yi=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}},Xi=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new Yi(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},Zi=new Ji,Qi=new Xi(Zi.registerPendingError);function $i(e){Zi.enqueueTask(Qi.create(e))}function ea(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ta(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 na(e,t,n){return t&&ta(e.prototype,t),n&&ta(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}function ia(e,t){return la(e)||ca(e,t)||oa(e,t)||aa()}function aa(){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 oa(e,t){if(e){if(typeof e==`string`)return sa(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 sa(e,t)}}function sa(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 ca(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 la(e){if(Array.isArray(e))return e}function ua(e){var t=Ri().toString();switch(e){case G.SOURCE:return`S${t}`;case G.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function da(e){switch(e[0]){case`S`:return G.SOURCE;case`T`:return G.TARGET;default:K(!1,`Cannot parse handler ID: ${e}`)}}function fa(e,t){var n=e.entries(),r=!1;do{var i=n.next(),a=i.done;if(ia(i.value,2)[1]===t)return!0;r=!!a}while(!r);return!1}var pa=function(){function e(t){ea(this,e),ra(this,`types`,new Map),ra(this,`dragSources`,new Map),ra(this,`dropTargets`,new Map),ra(this,`pinnedSourceId`,null),ra(this,`pinnedSource`,null),ra(this,`store`,void 0),this.store=t}return na(e,[{key:`addSource`,value:function(e,t){Hi(e),Bi(t);var n=this.addHandler(G.SOURCE,e,t);return this.store.dispatch(ui(n)),n}},{key:`addTarget`,value:function(e,t){Hi(e,!0),Vi(t);var n=this.addHandler(G.TARGET,e,t);return this.store.dispatch(di(n)),n}},{key:`containsHandler`,value:function(e){return fa(this.dragSources,e)||fa(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 da(e)===G.SOURCE}},{key:`isTargetId`,value:function(e){return da(e)===G.TARGET}},{key:`removeSource`,value:function(e){var t=this;K(this.getSource(e),`Expected an existing source.`),this.store.dispatch(fi(e)),$i(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(pi(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=ua(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 ma(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=ha(arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1),i=new Kr(r,new Ii(r,new pa(r))),a=e(i,t,n);return i.receiveBackend(a),i}function ha(e){var t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return Zr(Di,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}var ga=[`children`];function _a(e,t){return Sa(e)||xa(e,t)||ya(e,t)||va()}function va(){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 ya(e,t){if(e){if(typeof e==`string`)return ba(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 ba(e,t)}}function ba(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 xa(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 Sa(e){if(Array.isArray(e))return e}function Ca(e,t){if(e==null)return{};var n=wa(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 wa(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 Ta=0,Ea=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),Da=(0,V.memo)(function(e){var t=e.children,n=_a(Oa(Ca(e,ga)),2),r=n[0],i=n[1];return(0,V.useEffect)(function(){if(i){var e=Aa();return++Ta,function(){--Ta===0&&(e[Ea]=null)}}},[]),(0,H.jsx)(ir.Provider,Object.assign({value:r},{children:t}),void 0)});function Oa(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[ka(e.backend,e.context,e.options,e.debugMode),!e.context]}function ka(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Aa(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=t;return i[Ea]||(i[Ea]={dragDropManager:ma(e,t,n,r)}),i[Ea]}function Aa(){return typeof global<`u`?global:window}function ja(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ma(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 Na(e,t,n){return t&&Ma(e.prototype,t),n&&Ma(e,n),e}function Pa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fa=!1,Ia=!1,La=function(){function e(t){ja(this,e),Pa(this,`internalMonitor`,void 0),Pa(this,`sourceId`,null),this.internalMonitor=t.getMonitor()}return Na(e,[{key:`receiveHandlerId`,value:function(e){this.sourceId=e}},{key:`getHandlerId`,value:function(){return this.sourceId}},{key:`canDrag`,value:function(){K(!Fa,`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 Fa=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Fa=!1}}},{key:`isDragging`,value:function(){if(!this.sourceId)return!1;K(!Ia,`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 Ia=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ia=!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 Ra(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function za(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 Ba(e,t,n){return t&&za(e.prototype,t),n&&za(e,n),e}function Va(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ha=!1,Ua=function(){function e(t){Ra(this,e),Va(this,`internalMonitor`,void 0),Va(this,`targetId`,null),this.internalMonitor=t.getMonitor()}return Ba(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(!Ha,`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 Ha=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ha=!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 Wa(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 Ga(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 Wa(i),Ja(i,n?function(t){return e(t,n)}:e)}}function Ka(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=Ga(r);t[n]=function(){return i}}}),t}function qa(e,t){typeof e==`function`?e(t):e.current=t}function Ja(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){qa(n,e),qa(t,e)}}):(0,V.cloneElement)(e,{ref:t})}function Ya(e){"@babel/helpers - typeof";return Ya=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},Ya(e)}function Xa(e){return e!==null&&Ya(e)===`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Za(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 Qa(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function $a(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 eo(e,t,n){return t&&$a(e.prototype,t),n&&$a(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 to=function(){function e(t){var n=this;Qa(this,e),Y(this,`hooks`,Ka({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,Xa(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,Xa(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 eo(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!Za(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:`didDragPreviewOptionsChange`,value:function(){return!Za(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 no(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ro(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 io(e,t,n){return t&&ro(e.prototype,t),n&&ro(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 ao=function(){function e(t){var n=this;no(this,e),X(this,`hooks`,Ka({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,Xa(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 io(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!Za(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 oo(e,t,n){var r=n.getRegistry(),i=r.addTarget(e,t);return[i,function(){return r.removeTarget(i)}]}function so(e,t,n){var r=n.getRegistry(),i=r.addSource(e,t);return[i,function(){return r.removeSource(i)}]}var co=typeof window<`u`?V.useLayoutEffect:V.useEffect;function lo(e){"@babel/helpers - typeof";return lo=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},lo(e)}function uo(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function fo(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 po(e,t,n){return t&&fo(e.prototype,t),n&&fo(e,n),e}function mo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ho=function(){function e(t,n,r){uo(this,e),mo(this,`spec`,void 0),mo(this,`monitor`,void 0),mo(this,`connector`,void 0),this.spec=t,this.monitor=n,this.connector=r}return po(e,[{key:`beginDrag`,value:function(){var e=this.spec,t=this.monitor,n=null;return n=lo(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 go(e,t,n){var r=(0,V.useMemo)(function(){return new ho(e,t,n)},[t,n]);return(0,V.useEffect)(function(){r.spec=e},[e]),r}function _o(){var e=(0,V.useContext)(ir).dragDropManager;return K(e!=null,`Expected drag drop context`),e}function vo(e){return(0,V.useMemo)(function(){var t=e.type;return K(t!=null,`spec.type must be defined`),t},[e])}function yo(e,t){return wo(e)||Co(e,t)||xo(e,t)||bo()}function bo(){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 xo(e,t){if(e){if(typeof e==`string`)return So(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 So(e,t)}}function So(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 Co(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 wo(e){if(Array.isArray(e))return e}function To(e,t,n){var r=_o(),i=go(e,t,n),a=vo(e);co(function(){if(a!=null){var e=yo(so(a,i,r),2),o=e[0],s=e[1];return t.receiveHandlerId(o),n.receiveHandlerId(o),s}},[r,t,n,i,a])}function Eo(e){return Ao(e)||ko(e)||Oo(e)||Do()}function Do(){throw TypeError(`Invalid attempt to spread non-iterable instance.