farming-code 2.2.8 → 2.2.12

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.
Files changed (107) hide show
  1. package/README.md +42 -28
  2. package/README.zh_cn.md +42 -28
  3. package/THIRD_PARTY_NOTICES.md +11 -2
  4. package/backend/acp-checkpoint-store.js +198 -0
  5. package/backend/acp-runtime.js +306 -83
  6. package/backend/acp-session-state.js +202 -6
  7. package/backend/acp-transcript.js +112 -0
  8. package/backend/agent-activity.js +6 -157
  9. package/backend/agent-manager.js +1592 -741
  10. package/backend/agent-provider-session.js +17 -242
  11. package/backend/agent-runtime-binding.js +219 -0
  12. package/backend/agent-session-history.js +66 -1
  13. package/backend/auth.js +79 -6
  14. package/backend/codex-models.js +81 -84
  15. package/backend/codex-session-archive.js +54 -0
  16. package/backend/codex-terminal-profile.js +500 -0
  17. package/backend/codex-transcript-sanitizer.js +12 -0
  18. package/backend/codex-transcript.js +230 -8
  19. package/backend/config-manager.js +35 -0
  20. package/backend/control-api.js +192 -17
  21. package/backend/executable-discovery.js +2 -0
  22. package/backend/farming-net-pass.js +285 -0
  23. package/backend/farming-net-registry.js +112 -0
  24. package/backend/farming-net-server.js +298 -0
  25. package/backend/farming-session-store.js +5 -13
  26. package/backend/git-worktree-info.js +181 -0
  27. package/backend/local-session-engine.js +411 -186
  28. package/backend/main-page-session.js +5 -2
  29. package/backend/native-pty-controller-generation.js +106 -0
  30. package/backend/native-pty-host-client.js +275 -7
  31. package/backend/native-pty-host-identity.js +86 -0
  32. package/backend/native-pty-host.js +813 -114
  33. package/backend/native-session-engine.js +100 -28
  34. package/backend/packaged-node-pty.js +22 -2
  35. package/backend/provider-adapters.js +253 -0
  36. package/backend/provider-session-service.js +241 -0
  37. package/backend/runtime-observation.js +81 -0
  38. package/backend/server.js +354 -84
  39. package/backend/session-engine-bridge.js +21 -2
  40. package/backend/session-engine-router.js +1 -1
  41. package/backend/session-engine.js +1 -1
  42. package/backend/session-stream-protocol.js +185 -0
  43. package/backend/storage-layout.js +55 -0
  44. package/backend/terminal-attach-checkpoint.js +74 -0
  45. package/backend/terminal-exit-quiescence.js +39 -0
  46. package/backend/terminal-reducer-flow-control.js +97 -0
  47. package/backend/terminal-screen-state.js +11 -2
  48. package/backend/terminal-screen-worker-pool.js +59 -6
  49. package/backend/terminal-screen-worker-thread.js +97 -57
  50. package/backend/terminal-screen-worker.js +133 -51
  51. package/backend/terminal-state-serialization.js +127 -0
  52. package/backend/terminal-status.js +23 -4
  53. package/backend/usage-monitor.js +176 -17
  54. package/backend/workspace-directory.js +232 -0
  55. package/backend/workspace-file-router.js +182 -76
  56. package/backend/workspace-file-service.js +319 -4
  57. package/backend/workspace-root-registry.js +164 -0
  58. package/dist/assets/App-DWsa7DXG.js +206 -0
  59. package/dist/assets/{FileEditorMarkdownPreview-elKWc8Im.js → FileEditorMarkdownPreview-UlVd0O4D.js} +92 -92
  60. package/dist/assets/FileEditorPane-Dxx4rKOg.js +2 -0
  61. package/dist/assets/IconGlyphs-AU22gPDY.js +1 -0
  62. package/dist/assets/ProjectFilesSection-DE7Nb9Jk.js +12 -0
  63. package/dist/assets/ReviewPage-CeDKDyZh.js +3 -0
  64. package/dist/assets/code-dark-DPiuyeSp.css +1 -0
  65. package/dist/assets/file-icons-Bw2qd5iT.js +1 -0
  66. package/dist/assets/{index-BrbljRqn.js → index-CUFPJoa5.js} +3 -3
  67. package/dist/assets/main-Bqtb5kuz.css +1 -0
  68. package/dist/assets/{monaco.contribution-CyLosfZI.js → monaco.contribution-BXz-lfFB.js} +2 -2
  69. package/dist/assets/{tsMode-DGZTlTj8.js → tsMode-B0oUTcXQ.js} +1 -1
  70. package/dist/assets/workspace-editor-model-BQol4qbA.js +1 -0
  71. package/dist/assets/workspace-editor-monaco-BICJESG0.js +4 -0
  72. package/dist/assets/workspace-editor-monaco-DRJ7IaXk.js +1 -0
  73. package/dist/assets/workspace-view-state-DvYG_9PH.js +7 -0
  74. package/dist/assets/workspace-working-copy-D8-s_Sgh.js +1 -0
  75. package/dist/farming-2/site.webmanifest +2 -0
  76. package/dist/index.html +1 -1
  77. package/frontend/farming-net/app.css +625 -0
  78. package/frontend/farming-net/app.js +268 -0
  79. package/frontend/farming-net/index.html +86 -0
  80. package/frontend/reading-anchor.js +198 -0
  81. package/frontend/session-bridge.js +12 -3
  82. package/frontend/session-modal-bridge.js +5 -12
  83. package/frontend/skins/crt/app.js +1978 -793
  84. package/frontend/skins/crt/index.html +313 -23
  85. package/frontend/skins/crt/styles/billing.css +294 -223
  86. package/frontend/skins/crt/styles/monochrome-green.css +7 -2
  87. package/frontend/terminal-replay.js +372 -0
  88. package/package.json +10 -3
  89. package/shared/browser-protocol.d.ts +5 -0
  90. package/shared/browser-protocol.js +130 -0
  91. package/dist/assets/App-8dYAM6ql.js +0 -124
  92. package/dist/assets/FileEditorPane-RWiFD2cq.js +0 -5
  93. package/dist/assets/IconGlyphs-DfL0EBnj.js +0 -1
  94. package/dist/assets/ProjectFilesSection-Q4PDsWmM.js +0 -12
  95. package/dist/assets/ReviewPage-BaXu1ZdX.js +0 -3
  96. package/dist/assets/code-dark-CDkOQAtK.css +0 -1
  97. package/dist/assets/file-icons-EFUGSSwf.js +0 -1
  98. package/dist/assets/main-D073SnW4.css +0 -1
  99. package/dist/assets/qoder-C9LmmOSf.svg +0 -1
  100. package/dist/assets/qoder-Cf9gl0Y5.svg +0 -1
  101. package/dist/assets/qoder-gHCinseV.svg +0 -1
  102. package/dist/assets/workspace-view-state-CTyDzk2D.js +0 -1
  103. package/dist/assets/zsh-CLpveKlF.svg +0 -1
  104. package/dist/assets/zsh-FxSpMPbz.svg +0 -1
  105. /package/dist/assets/{api-D1lyBYIQ.js → api-D8nyOEbz.js} +0 -0
  106. /package/dist/assets/{core-ZlAPicox.js → core-D0LFJkDt.js} +0 -0
  107. /package/dist/assets/{useWorkspaceMenuKeyboard-CneKAZUJ.js → useWorkspaceMenuKeyboard-Brws6Ar9.js} +0 -0
@@ -1,12 +0,0 @@
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{A as o,B as s,E as c,G as l,H as u,J as d,K as f,L as p,M as m,N as h,R as g,T as _,U as v,V as y,W as b,X as x,Y as S,Z as C,f as w,j as T,k as E,p as D,q as O,r as k,s as A,t as j,v as ee,w as M,z as te}from"./workspace-view-state-CTyDzk2D.js";import{E as N,a as ne,c as re,f as ie,g as P,i as ae,j as oe,m as se,n as F,r as ce,t as le,u as ue}from"./file-icons-EFUGSSwf.js";import{l as I,s as L}from"./IconGlyphs-DfL0EBnj.js";import{t as de}from"./useWorkspaceMenuKeyboard-CneKAZUJ.js";var R=t(r()),z=a();function fe(e){return{"--change-indent":`${18+e*12}px`,"--change-guide-width":`${e*12}px`}}function pe(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`&&pe(e.children)}),e}function me(e){return e.reduce((e,t)=>t.type===`file`?e+1:(t.descendantCount=+!!t.change+me(t.children),e+t.descendantCount),0)}function he(e){return e.map(e=>{if(e.type===`file`)return e;let t={...e,children:he(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 ge(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(/\/+$/,``),s=n.split(`/`).filter(Boolean);if(s.length===0)return;let c=``,l=e.type===`directory`||e.path.endsWith(`/`),u=l?s.length:s.length-1;for(let e=0;e<u;e+=1){let t=s[e];if(!t)continue;let n=s.slice(0,e+1).join(`/`);a(n,c,t),c=n}if(l){let t=i.get(n);t&&(t.change=e);return}r.get(c)?.push({id:`${t}:file:${o(e)}`,name:s[s.length-1]||e.name,path:e.path,type:`file`,change:e})});let s=he(pe(n));return me(s),s}function _e({activeFilePath:e,change:t,copy:n,onOpenChange:r}){let i=e===t.path,a=n.gitStatus(t.gitStatus),s=t.gitStatus===`untracked`?``:t.gitStatusLabel,c=t.previousPath?E(t):``;return(0,z.jsx)(`div`,{className:`code-file-change-row ${i?`active`:``}`,"data-testid":`code-file-change-row`,"data-file-path":t.path,"data-file-type":`file`,title:T(t,a),children:(0,z.jsxs)(`button`,{type:`button`,className:`code-file-change-main`,onClick:()=>r(t),children:[(0,z.jsx)(`span`,{className:`code-file-chevron placeholder`,"aria-hidden":`true`}),(0,z.jsx)(`img`,{className:`code-file-type-icon file`,src:F(t.path),alt:``,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`code-file-change-name`,children:t.name}),(0,z.jsx)(`span`,{className:`code-file-change-path`,children:c}),(0,z.jsx)(`span`,{className:`code-file-change-status ${t.gitStatus}`,title:a,children:s})]})},o(t))}function ve({activeFilePath:e,copy:t,depth:n,nodes:r,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o}){return(0,z.jsx)(z.Fragment,{children:r.map(r=>{if(r.type===`file`)return(0,z.jsx)(`div`,{style:fe(n),children:(0,z.jsx)(_e,{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,z.jsxs)(`div`,{children:[(0,z.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:fe(n),children:(0,z.jsxs)(`button`,{type:`button`,className:`code-file-change-main directory`,"aria-expanded":s?c:void 0,onClick:()=>{s&&o(r.id)},children:[(0,z.jsx)(`span`,{className:`code-file-chevron ${s?c?`expanded`:`collapsed`:`placeholder`}`,"aria-hidden":`true`,children:s?c?(0,z.jsx)(L,{}):(0,z.jsx)(I,{}):null}),(0,z.jsx)(`span`,{className:`code-file-change-name`,children:r.displayName??r.name}),(0,z.jsx)(`span`,{className:`code-file-change-status directory`,children:r.descendantCount||``})]})}),c&&(0,z.jsx)(ve,{activeFilePath:e,copy:t,depth:n+1,nodes:r.children,openDirectoryIds:i,onOpenChange:a,onToggleDirectory:o})]},r.id)})})}function ye({activeFilePath:e,agentId:t,changes:n,collapsed:r,copy:a,projectId:o,onOpenChange:s,onToggleCollapsed:c}){let[l,u]=(0,R.useState)(!0),[d,f]=(0,R.useState)(()=>new Set),p=(0,R.useMemo)(()=>n.items.filter(e=>e.gitStatus!==`untracked`),[n.items]),m=(0,R.useMemo)(()=>n.items.filter(e=>e.gitStatus===`untracked`),[n.items]),h=(0,R.useMemo)(()=>ge(p,`tracked`),[p]),g=(0,R.useMemo)(()=>ge(m,`untracked`),[m]);if(n.items.length===0)return null;let _=()=>{r&&n.refreshChanges(),c()},v=()=>{u(e=>(e&&n.refreshChanges(),!e))},y=e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},b=e=>{let n=new URLSearchParams({agentId:t,scope:e});e===`untracked`&&n.set(`modifiedWithinDays`,`3`),window.open(i(`/review?${n.toString()}`),`_blank`,`noopener,noreferrer`)};return(0,z.jsxs)(`div`,{className:`code-file-changes-section`,"data-testid":`code-file-changes-section`,"data-project-id":o,"aria-label":a.changedFiles,children:[p.length>0&&(0,z.jsxs)(`div`,{className:`code-file-change-group tracked ${r?`collapsed`:``}`,"data-testid":`code-file-change-tracked-group`,children:[(0,z.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!r,onClick:_,children:[(0,z.jsx)(`span`,{className:`code-file-section-chevron ${r?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:r?(0,z.jsx)(I,{}):(0,z.jsx)(L,{})}),(0,z.jsx)(`span`,{children:a.changes}),(0,z.jsx)(`span`,{className:`code-file-changes-count`,children:p.length})]}),(0,z.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>b(`tracked`),children:a.reviewChanges})]}),!r&&(0,z.jsx)(ve,{activeFilePath:e,copy:a,depth:0,nodes:h,openDirectoryIds:d,onOpenChange:s,onToggleDirectory:y})]}),m.length>0&&(0,z.jsxs)(`div`,{className:`code-file-change-group untracked ${l?`collapsed`:``}`,"data-testid":`code-file-change-untracked-group`,children:[(0,z.jsxs)(`div`,{className:`code-file-change-group-header`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`code-file-change-group-toggle`,"aria-expanded":!l,onClick:v,children:[(0,z.jsx)(`span`,{className:`code-file-section-chevron ${l?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:l?(0,z.jsx)(I,{}):(0,z.jsx)(L,{})}),(0,z.jsx)(`span`,{children:a.untrackedChanges}),(0,z.jsxs)(`span`,{className:`code-file-changes-count`,children:[m.length,n.truncated?`+`:``]})]}),(0,z.jsx)(`button`,{type:`button`,className:`code-file-change-review`,onClick:()=>b(`untracked`),children:a.reviewChanges})]}),!l&&(0,z.jsx)(ve,{activeFilePath:e,copy:a,depth:0,nodes:g,openDirectoryIds:d,onOpenChange:s,onToggleDirectory:y})]}),n.error&&(0,z.jsx)(`div`,{className:`code-file-changes-status error`,"data-testid":`code-file-changes-error`,children:n.error})]})}function be(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 xe(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 Se(e){return e.kind===`path`?{path:e.path}:{path:e.path,target:xe(e)}}function Ce(e){let t=be(e);return t?{path:t.path,target:{lineNumber:t.lineNumber,column:t.column}}:null}function we({active:e,activeMatchIndex:t,jumpTarget:n,listboxId:r}){if(e)return n?`${r}-jump`:t>=0?`${r}-${t}`:void 0}function B(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 V(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 Te(e,t,n){let r=[],i=0;for(let a=0;a<e.length&&i<t.length;a+=1)n&&!V(e,a)||e[a]?.toLowerCase()===t[i]&&(r.push({start:a,end:a+1}),i+=1);return i===t.length?r:[]}function Ee(e,t){let n=t.trim().replace(/^\.\/+/,``).toLowerCase();if(!e||!n||n.length>6)return[];let r=Te(e,n,!0);return r.length>0?r:Te(e,n,!1)}function De(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 Oe(e,t){let n=B(e,t);return n?[n]:Ee(e,t)}function ke(e,t=[]){let n=De(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,z.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 Ae(e,t){return ke(e,Oe(e,t))}function je(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 Me(e){if(!e||typeof window>`u`)return null;let t=e.getBoundingClientRect();if(oe()){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 Ne({path:e,query:t}){let{directory:n,name:r}=je(e);return(0,z.jsxs)(`span`,{className:`code-file-search-copy`,children:[(0,z.jsx)(`span`,{className:`code-file-search-name`,children:Ae(r,t)}),n&&(0,z.jsx)(`span`,{className:`code-file-search-directory`,children:Ae(n,t)})]})}function Pe({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,R.useState)(()=>Me(t.current)),b=(0,R.useCallback)(()=>{y(Me(t.current))},[t]);return(0,R.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,z.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,z.jsx)(`div`,{className:`code-file-search-state error`,children:l}):(0,z.jsxs)(`button`,{id:`${o}-jump`,type:`button`,className:`code-file-search-result jump active`,onClick:()=>m(u),role:`option`,"aria-selected":`true`,children:[(0,z.jsx)(`span`,{className:`code-file-search-kind`,children:n.go}),(0,z.jsx)(Ne,{path:a.path,query:u}),(0,z.jsx)(`span`,{className:`code-file-search-line`,children:a.lineNumber})]}):s?(0,z.jsx)(`div`,{className:`code-file-search-state`,children:n.searching}):i?(0,z.jsx)(`div`,{className:`code-file-search-state error`,children:i}):c.length===0?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`code-file-search-state`,children:n.noMatches}),d&&(0,z.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,z.jsx)(`div`,{className:`code-file-search-state muted`,children:n.searchIncomplete(f)})]}):(0,z.jsxs)(z.Fragment,{children:[c.map((t,r)=>(0,z.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,z.jsx)(`img`,{className:`code-file-type-icon ${t.entryType===`directory`?`folder`:`file`}`,src:t.entryType===`directory`?le(t.path,!1):F(t.path),alt:``,"aria-hidden":`true`}),(0,z.jsx)(Ne,{path:t.path,query:u}),t.kind===`path`?(0,z.jsx)(`span`,{className:`code-file-search-kind`,children:t.entryType===`directory`?n.folder:n.file}):(0,z.jsx)(`span`,{className:`code-file-search-line`,children:t.lineNumber}),t.lines&&(0,z.jsx)(`span`,{className:`code-file-search-preview`,children:ke(t.lines,t.ranges)})]},`${t.path}:${t.lineNumber}:${r}`)),d&&(0,z.jsx)(`button`,{type:`button`,className:`code-file-search-ignored-action`,onClick:g,children:n.searchIgnoredFolders}),p&&(0,z.jsx)(`div`,{className:`code-file-search-state muted`,children:n.moreMatchesOmitted})]})})}var Fe=12;function Ie(e,t){return e===`git`?t.containsUncommittedChanges:e===`external`?t.changedOnDisk:e===`dirty`?t.unsavedChanges:t.changedOnDisk}function H(e){return{"--file-indent":`${4+e*Fe}px`,"--file-status-indent":`${22+e*Fe}px`,"--file-guide-width":`${e*Fe}px`,"--file-depth":e}}function Le(e){return e===`untracked`?void 0:e}function Re(e){let t=Le(e);return t?`code-file-descendant-status ${t}`:``}function ze(e,t){for(let n of e)if(O(t,n))return!0;return!1}function Be({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&&ze(t,i.path),h=c&&ze(n,i.path),g=Le(i.gitStatus),_=Le(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=_?Re(_):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 Ve({label:e,options:t,testId:n,submenuTestId:r,onOpenDialog:i,onSelect:a}){let[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(`right`),u=(0,R.useRef)(null),d=(0,R.useRef)(null),f=(0,R.useRef)(null),p=(0,R.useRef)(null),m=t.length>0,h=(0,R.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),g=(0,R.useCallback)((e=d.current)=>{if(!m)return;h();let t=e?.getBoundingClientRect();t&&t.right+156+12>window.innerWidth?l(`left`):l(`right`),s(!0)},[h,m]),_=(0,R.useCallback)(()=>{h(),p.current=window.setTimeout(()=>{s(!1),p.current=null},120)},[h]),v=(0,R.useCallback)(e=>{g(e.currentTarget.querySelector(`button`))},[g]),y=(0,R.useCallback)(()=>{window.setTimeout(()=>{f.current?.querySelector(`button:not(:disabled)`)?.focus()},0)},[]),b=(0,R.useCallback)(e=>{m&&e.key===`ArrowRight`&&(e.preventDefault(),e.stopPropagation(),g(e.currentTarget),y())},[y,m,g]),S=(0,R.useCallback)(e=>{e.key===`ArrowLeft`&&(e.preventDefault(),e.stopPropagation(),s(!1),d.current?.focus())},[]);return(0,z.jsxs)(`div`,{ref:u,className:`code-agent-launch-submenu`,onPointerEnter:v,onPointerLeave:_,onFocus:()=>h(),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||s(!1)},children:[(0,z.jsxs)(`button`,{ref:d,type:`button`,role:`menuitem`,className:`code-agent-launch-submenu-trigger`,"data-testid":n,"aria-haspopup":m?`menu`:void 0,"aria-expanded":m?o:void 0,onClick:i,onKeyDown:b,children:[(0,z.jsx)(`span`,{children:e}),m&&(0,z.jsx)(I,{className:`code-agent-launch-submenu-arrow`})]}),m&&o&&(0,z.jsx)(`div`,{ref:f,className:`code-agent-launch-submenu-panel ${c}`,"data-testid":r,role:`menu`,onPointerEnter:()=>h(),onPointerLeave:_,onKeyDown:S,children:t.map(e=>(0,z.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`agent-launch-${e.name}`,onClick:()=>a(e.command||e.name),children:[(0,z.jsx)(x,{name:e.name}),(0,z.jsx)(`span`,{children:C(e.name)})]},e.name))})]})}function He({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=de({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,z.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.stopPropagation(),children:[h&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,autoFocus:!0,onClick:()=>d(`new-file`),children:e.newFile}),(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`new-folder`),children:e.newFolder}),(0,z.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,z.jsx)(Ve,{label:e.newAgent,options:t,testId:`file-new-agent-submenu-trigger`,submenuTestId:`file-new-agent-submenu`,onOpenDialog:c,onSelect:u}),(0,z.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`})]}),(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:l,children:e.refresh}),n.item&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),g&&(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>d(`rename`),children:e.rename}),(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o,children:e.copyRelativePath}),(n.item.type===`file`||n.item.type===`directory`)&&(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:s,children:e.copyShareUrl}),g&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`code-context-menu-separator`,role:`separator`}),(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,className:`danger`,onClick:()=>d(`delete`),children:e.delete})]})]})]})}var Ue=220,We=8,Ge=26,Ke=11,qe=10;function Je(e){return e?e.type===`directory`?e.path:d(e.path):``}function Ye(e,t){return e===`rename`||e===`delete`?t?.name??``:``}function Xe(e,t){return{kind:e,item:t,parentPath:Je(t),name:Ye(e,t)}}function Ze(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 Qe(e){let t=e.name.trim();if(e.kind!==`rename`||e.item?.type!==`file`)return t;let n=e.item.name.lastIndexOf(`.`);if(n<=0)return t;let r=e.item.name.slice(n);return t.endsWith(`${r}${r}`)?t.slice(0,-r.length):t}function U(e,t){switch(e.kind){case`new-file`:return t.newFile;case`new-folder`:return t.newFolder;case`rename`:return t.rename;case`delete`:return t.delete}}function $e(e,t,n,r,i,a=0){let o=n?8:4,s=n?4:2,c=a>0?qe+a*Ge:0,l=qe+o*Ge+s*Ke+c;return{x:Math.max(We,Math.min(e,r-Ue-We)),y:Math.max(We,Math.min(t,i-l-We))}}function et({agentId:e,copy:t,fileOperation:n,inputRef:r,onCancel:i,onInputName:a,onSubmit:o,onUpdateName:s}){return!n||n.kind===`rename`?null:(0,z.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,z.jsxs)(`form`,{className:`code-file-operation-dialog`,"data-testid":`code-file-operation-dialog`,role:`dialog`,"aria-labelledby":`code-file-operation-title`,autoComplete:`off`,onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i())},onSubmit:e=>{e.preventDefault(),o()},children:[(0,z.jsx)(`label`,{id:`code-file-operation-title`,htmlFor:`code-file-operation-input`,children:U(n,t)}),n.kind===`delete`?(0,z.jsx)(`p`,{className:`code-file-operation-text`,children:n.item?.type===`directory`?t.deleteFolderContents(n.item?.path):t.deleteFile(n.item?.path)}):(0,z.jsx)(`input`,{id:`code-file-operation-input`,"data-testid":`code-file-operation-input`,name:`farming-file-${e}-${n.kind}`,type:`text`,inputMode:`text`,ref:r,value:n.name,autoComplete:`off`,"aria-autocomplete":`none`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,autoFocus:!0,onInput:e=>{a(e.currentTarget.value)},onChange:e=>{s(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),o())}}),(0,z.jsxs)(`div`,{className:`code-rename-actions`,children:[(0,z.jsx)(`button`,{type:`button`,onClick:i,children:t.cancel}),(0,z.jsx)(`button`,{type:`submit`,className:n.kind===`delete`?`danger`:`primary`,disabled:n.kind!==`delete`&&!n.name.trim(),children:n.kind===`delete`?t.delete:t.save})]})]})})}function tt({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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(He,{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,z.jsx)(et,{agentId:e,copy:t,fileOperation:a,inputRef:o,onCancel:l,onInputName:m,onSubmit:()=>{_()},onUpdateName:v})]})}var nt=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})),rt=n(((e,t)=>{t.exports=nt()})),it=(0,R.createContext)(null);function W(){let e=(0,R.useContext)(it);if(e===null)throw Error(`No Tree Api Provided`);return e}var at=(0,R.createContext)(null);function ot(){let e=(0,R.useContext)(at);if(e===null)throw Error(`Provide a NodesContext`);return e}var st=(0,R.createContext)(null);function ct(){let e=(0,R.useContext)(st);if(e===null)throw Error(`Provide a DnDContext`);return e}var lt=(0,R.createContext)(0);function ut(){(0,R.useContext)(lt)}var dt=e({access:()=>Et,bound:()=>ft,dfs:()=>yt,focusNextElement:()=>xt,focusPrevElement:()=>St,getInsertIndex:()=>Mt,getInsertParentId:()=>Ft,getTreeLinePrefix:()=>Pt,identify:()=>Ot,identifyNull:()=>Dt,indexOf:()=>_t,isClosed:()=>mt,isDescendant:()=>gt,isItem:()=>pt,isOpenWithEmptyChildren:()=>ht,mergeRefs:()=>kt,noop:()=>vt,safeRun:()=>At,waitFor:()=>jt,walk:()=>bt});function ft(e,t,n){return Math.max(Math.min(e,n),t)}function pt(e){return e&&e.isLeaf}function mt(e){return e&&e.isInternal&&!e.isOpen}function ht(e){return e&&e.isOpen&&!e.children?.length}var gt=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},_t=e=>{if(!e.parent)throw Error(`Node does not have a parent`);return e.parent.children.findIndex(t=>t.id===e.id)};function vt(){}function yt(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){let e=yt(n,t);if(e)return e}return null}function bt(e,t){if(t(e),e.children)for(let n of e.children)bt(n,t)}function xt(e){let t=Tt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=Ct(t,r);break}n?.focus()}function St(e){let t=Tt(e),n;for(let r=0;r<t.length;++r)if(t[r]===e){n=wt(t,r);break}n?.focus()}function Ct(e,t){return t+1<e.length?e[t+1]:e[0]}function wt(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Tt(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 Et(e,t){return typeof t==`boolean`?t:typeof t==`string`?e[t]:t(e)}function Dt(e){return e===null?null:Ot(e)}function Ot(e){return typeof e==`string`?e:e.id}function kt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function At(e,...t){if(e)return e(...t)}function jt(e){return new Promise((t,n)=>{let r=0;function i(){r+=1,r===100&&n(),e()?t():setTimeout(i,10)}i()})}function Mt(e){let t=e.focusedNode;return t?t.isOpen?0:t.parent?t.childIndex+1:0:e.root.children?.length??0}var Nt={last:`└ `,middle:`├ `,pipe:`│ `,blank:`  `};function Pt(e,t={}){let n=Object.assign(Object.assign({},Nt),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 Ft(e){let t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}var It={display:`flex`,alignItems:`center`,zIndex:1},Lt={flex:1,height:`2px`,background:`#4B91E2`,borderRadius:`1px`},Rt={width:`4px`,height:`4px`,boxShadow:`0 0 0 3px #4B91E2`,borderRadius:`50%`},zt=R.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,z.jsxs)(`div`,{style:Object.assign(Object.assign({},It),r),children:[(0,z.jsx)(`div`,{style:Object.assign({},Rt)}),(0,z.jsx)(`div`,{style:Object.assign({},Lt)})]})});function Bt({node:e,attrs:t,innerRef:n,children:r}){return(0,z.jsx)(`div`,Object.assign({},t,{ref:n,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:r}))}function Vt(e){return(0,z.jsxs)(`div`,{ref:e.dragHandle,style:e.style,children:[(0,z.jsx)(`span`,{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?`🌳`:e.node.isOpen?`🗁`:`🗀`}),` `,e.node.isEditing?(0,z.jsx)(Ut,Object.assign({},e)):(0,z.jsx)(Ht,Object.assign({},e))]})}function Ht(e){return(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(`span`,{children:e.node.data.name})})}function Ut({node:e}){let t=(0,R.useRef)();return(0,R.useEffect)(()=>{var e,n;(e=t.current)==null||e.focus(),(n=t.current)==null||n.select()},[]),(0,z.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 Wt=`__REACT_ARBORIST_INTERNAL_ROOT__`;function Gt(e){function t(n,r,i){let a=new Kt({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 Kt({tree:e,id:Wt,data:{id:Wt},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return n.children=(e.props.data??[]).map(e=>t(e,0,n)),n}var Kt=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===Wt}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 qt(e){return{type:`EDIT`,id:e}}function Jt(e={id:null},t){return t.type===`EDIT`?Object.assign(Object.assign({},e),{id:t.id}):e}function Yt(e){return{type:`FOCUS`,id:e}}function Xt(){return{type:`TREE_BLUR`}}function Zt(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 Qt={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 $t(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 en(e={filtered:{},unfiltered:{}},t){return t.type.startsWith(`VISIBILITY`)?t.filtered?Object.assign(Object.assign({},e),{filtered:$t(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:$t(e.unfiltered,t)}):e}var tn=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}}),nn={clear:()=>({type:`SELECTION_CLEAR`}),only:e=>({type:`SELECTION_ONLY`,id:Ot(e)}),add:e=>({type:`SELECTION_ADD`,ids:(Array.isArray(e)?e:[e]).map(Ot)}),remove:e=>({type:`SELECTION_REMOVE`,ids:(Array.isArray(e)?e:[e]).map(Ot)}),set:e=>Object.assign({type:`SELECTION_SET`},e),mostRecent:e=>({type:`SELECTION_MOST_RECENT`,id:e===null?null:Ot(e)}),anchor:e=>({type:`SELECTION_ANCHOR`,id:e===null?null:Ot(e)})};function rn(e=tn().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 an={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 on(e=tn().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 tn().dnd;case`DND_HOVERING`:return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}var sn={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},cn=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},ln=e=>{if(!e)return{display:`none`};let{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function un({offset:e,mouse:t,id:n,dragIds:r,isDragging:i}){return(0,z.jsxs)(dn,{isDragging:i,children:[(0,z.jsx)(fn,{offset:e,children:(0,z.jsx)(mn,{id:n,dragIds:r})}),(0,z.jsx)(pn,{mouse:t,count:r.length})]})}var dn=(0,R.memo)(function(e){return e.isDragging?(0,z.jsx)(`div`,{style:sn,children:e.children}):null});function fn(e){return(0,z.jsx)(`div`,{className:`row preview`,style:cn(e.offset),children:e.children})}function pn(e){let{count:t,mouse:n}=e;return t>1?(0,z.jsx)(`div`,{className:`selected-count`,style:ln(n),children:t}):null}var mn=(0,R.memo)(function(e){let t=W(),n=t.get(e.id);return n?(0,z.jsx)(t.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*t.indent,opacity:.2,background:`transparent`},tree:t}):null});function hn(){return hn=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},hn.apply(null,arguments)}function gn(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function _n(e,t){return _n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_n(e,t)}function vn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_n(e,t)}var yn=Number.isNaN||function(e){return typeof e==`number`&&e!==e};function bn(e,t){return!!(e===t||yn(e)&&yn(t))}function xn(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!bn(e[n],t[n]))return!1;return!0}function Sn(e,t){t===void 0&&(t=xn);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 Cn=typeof performance==`object`&&typeof performance.now==`function`?function(){return performance.now()}:function(){return Date.now()};function wn(e){cancelAnimationFrame(e.id)}function Tn(e,t){var n=Cn();function r(){Cn()-n>=t?e.call(null):i.id=requestAnimationFrame(r)}var i={id:requestAnimationFrame(r)};return i}var En=-1;function Dn(e){if(e===void 0&&(e=!1),En===-1||e){var t=document.createElement(`div`),n=t.style;n.width=`50px`,n.height=`50px`,n.overflow=`scroll`,document.body.appendChild(t),En=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return En}var On=null;function kn(e){if(e===void 0&&(e=!1),On===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?On=`positive-descending`:(t.scrollLeft=1,On=t.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(t),On}return On}var An=150,jn=function(e,t){return e};function Mn(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){vn(t,e);function t(t){var r=e.call(this,t)||this;return r._instanceProps=c(r.props,gn(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:gn(r),isScrolling:!1,scrollDirection:`forward`,scrollOffset:typeof r.props.initialScrollOffset==`number`?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Sn(function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})}),r._callOnScroll=void 0,r._callOnScroll=Sn(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=Sn(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(kn()){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&&wn(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=Tn(r._resetIsScrolling,An)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}t.getDerivedStateFromProps=function(e,t){return Nn(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?Dn():0:c.scrollHeight>c.clientHeight?Dn():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(kn()){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&&wn(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?jn: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,R.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,R.createElement)(m||h||`div`,{className:n,onScroll:x,ref:this._outerRefSetter,style:hn({position:`relative`,height:a,width:v,overflow:`auto`,WebkitOverflowScrolling:`touch`,willChange:`transform`,direction:i},g)},(0,R.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}(R.PureComponent),t.defaultProps={direction:`ltr`,itemData:void 0,layout:`vertical`,overscanCount:2,useIsScrolling:!1},t}var Nn=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},Pn=50,Fn=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]},In=function(e,t,n){var r=t.itemMetadataMap,i=t.lastMeasuredIndex;return(i>0?r[i].offset:0)>=n?Ln(e,t,i,0,n):Rn(e,t,Math.max(0,i),n)},Ln=function(e,t,n,r,i){for(;r<=n;){var a=r+Math.floor((n-r)/2),o=Fn(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},Rn=function(e,t,n,r){for(var i=e.itemCount,a=1;n<i&&Fn(e,n,t).offset<r;)n+=a,a*=2;return Ln(e,t,Math.min(n,i-1),Math.floor(n/2),r)},zn=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},Bn=Mn({getItemOffset:function(e,t,n){return Fn(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:zn,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=Fn(e,t,i),f=zn(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 In(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=Fn(e,t,r),d=n+l,f=u.offset+u.size,p=t;p<o-1&&f<d;)p++,f+=Fn(e,p,r).size;return p},initInstanceProps:function(e,t){var n={itemMetadataMap:{},estimatedItemSize:e.estimatedItemSize||Pn,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}}),Vn=Mn({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 Hn(){let e=W(),t=ct().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,z.jsx)(a,{top:r,left:i,indent:n})}var Un=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},Wn=(0,R.forwardRef)(function(e,t){let{children:n}=e,r=Un(e,[`children`]),i=W();return(0,z.jsxs)(`div`,Object.assign({ref:t},r,{onClick:e=>{e.currentTarget===e.target&&i.deselectAll()},children:[(0,z.jsx)(Gn,{}),n]}))}),Gn=()=>{let e=W();return(0,z.jsx)(`div`,{style:{height:e.rowTopPosition(e.visibleNodes.length),width:`100%`,position:`absolute`,left:`0`,right:`0`},children:(0,z.jsx)(Hn,{})})},Kn=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},qn=(0,R.forwardRef)(function(e,t){var{style:n}=e,r=Kn(e,[`style`]);let i=W(),a=i.props.padding??i.props.paddingTop??0,o=i.props.padding??i.props.paddingBottom??0;return(0,z.jsx)(`div`,Object.assign({ref:t,style:Object.assign(Object.assign({},n),{height:`${parseFloat(n.height)+a+o}px`})},r))}),Jn=(0,R.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 Yn=`dnd-core/INIT_COORDS`,Xn=`dnd-core/BEGIN_DRAG`,Zn=`dnd-core/PUBLISH_DRAG_SOURCE`,Qn=`dnd-core/HOVER`,$n=`dnd-core/DROP`,er=`dnd-core/END_DRAG`;function tr(e,t){return{type:Yn,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function nr(e){"@babel/helpers - typeof";return nr=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},nr(e)}function rr(e,t,n){return t.split(`.`).reduce(function(e,t){return e&&e[t]?e[t]:n||null},e)}function ir(e,t){return e.filter(function(e){return e!==t})}function ar(e){return nr(e)===`object`}function or(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 sr(e,t){return e.filter(function(e){return t.indexOf(e)>-1})}var cr={type:Yn,payload:{clientOffset:null,sourceClientOffset:null}};function lr(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(tr(a)),ur(t,s,c);var l=pr(t,s);if(l===null){e.dispatch(cr);return}var u=null;if(a){if(!o)throw Error(`getSourceClientOffset must be defined`);dr(o),u=o(l)}e.dispatch(tr(a,u));var d=c.getSource(l).beginDrag(s,l);if(d!=null)return fr(d),c.pinSource(l),{type:Xn,payload:{itemType:c.getSourceType(l),item:d,sourceId:l,clientOffset:a||null,sourceClientOffset:u||null,isSourcePublic:!!i}}}}function ur(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 dr(e){K(typeof e==`function`,`When clientOffset is provided, getSourceClientOffset must be a function.`)}function fr(e){K(ar(e),`Item must be an object.`)}function pr(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 mr(e){return function(){if(e.getMonitor().isDragging())return{type:Zn}}}function hr(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function gr(e){return function(t){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).clientOffset;_r(t);var r=t.slice(0),i=e.getMonitor(),a=e.getRegistry();return vr(r,i,a),yr(r,a,i.getItemType()),br(r,i,a),{type:Qn,payload:{targetIds:r,clientOffset:n||null}}}}function _r(e){K(Array.isArray(e),`Expected targetIds to be an array.`)}function vr(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 yr(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r];hr(t.getTargetType(i),n)||e.splice(r,1)}}function br(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}function xr(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 Sr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?xr(Object(n),!0).forEach(function(t){Cr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Cr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wr(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),r=e.getRegistry();Tr(n),Or(n).forEach(function(i,a){var o=Er(i,a,r,n),s={type:$n,payload:{dropResult:Sr(Sr({},t),o)}};e.dispatch(s)})}}function Tr(e){K(e.isDragging(),`Cannot call drop while not dragging.`),K(!e.didDrop(),`Cannot call drop twice during one drag operation.`)}function Er(e,t,n,r){var i=n.getTarget(e),a=i?i.drop(r,e):void 0;return Dr(a),a===void 0&&(a=t===0?{}:r.getDropResult()),a}function Dr(e){K(e===void 0||ar(e),`Drop result must either be an object or undefined.`)}function Or(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function kr(e){return function(){var t=e.getMonitor(),n=e.getRegistry();Ar(t);var r=t.getSourceId();return r!=null&&(n.getSource(r,!0).endDrag(t,r),n.unpinSource()),{type:er}}}function Ar(e){K(e.isDragging(),`Cannot call endDrag while not dragging.`)}function jr(e){return{beginDrag:lr(e),publishDragSource:mr(e),hover:gr(e),drop:wr(e),endDrag:kr(e)}}function Mr(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Nr(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 Pr(e,t,n){return t&&Nr(e.prototype,t),n&&Nr(e,n),e}function Fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ir=function(){function e(t,n){var r=this;Mr(this,e),Fr(this,`store`,void 0),Fr(this,`monitor`,void 0),Fr(this,`backend`,void 0),Fr(this,`isSetUp`,!1),Fr(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 Pr(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=jr(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 Lr=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})(),Rr=function(){return Math.random().toString(36).substring(7).split(``).join(`.`)},zr={INIT:`@@redux/INIT`+Rr(),REPLACE:`@@redux/REPLACE`+Rr(),PROBE_UNKNOWN_ACTION:function(){return`@@redux/PROBE_UNKNOWN_ACTION`+Rr()}};function Br(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 Vr(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(Vr)(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(!Br(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:zr.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[Lr]=function(){return this},e}return f({type:zr.INIT}),r={dispatch:f,subscribe:d,getState:u,replaceReducer:p},r[Lr]=m,r}var Hr=function(e,t){return e===t};function Ur(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Wr(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hr;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 Gr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Gr(Object(n),!0).forEach(function(t){qr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jr={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Yr(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Jr,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case Yn:case Xn:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Qn:return Ur(e.clientOffset,n.clientOffset)?e:Kr(Kr({},e),{},{clientOffset:n.clientOffset});case er:case $n:return Jr;default:return e}}var Xr=`dnd-core/ADD_SOURCE`,Zr=`dnd-core/ADD_TARGET`,Qr=`dnd-core/REMOVE_SOURCE`,$r=`dnd-core/REMOVE_TARGET`;function ei(e){return{type:Xr,payload:{sourceId:e}}}function ti(e){return{type:Zr,payload:{targetId:e}}}function ni(e){return{type:Qr,payload:{sourceId:e}}}function ri(e){return{type:$r,payload:{targetId:e}}}function ii(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?ii(Object(n),!0).forEach(function(t){ai(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ii(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ai(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oi={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function si(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oi,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case Xn:return J(J({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Zn:return J(J({},e),{},{isSourcePublic:!0});case Qn:return J(J({},e),{},{targetIds:n.targetIds});case $r:return e.targetIds.indexOf(n.targetId)===-1?e:J(J({},e),{},{targetIds:ir(e.targetIds,n.targetId)});case $n:return J(J({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case er:return J(J({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function ci(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case Xr:case Zr:return e+1;case Qr:case $r:return e-1;default:return e}}var li=[],ui=[];li.__IS_NONE__=!0,ui.__IS_ALL__=!0;function di(e,t){return e===li?!1:e===ui||t===void 0?!0:sr(t,e).length>0}function fi(){arguments.length>0&&arguments[0]!==void 0&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Qn:break;case Xr:case Zr:case $r:case Qr:return li;case Xn:case Zn:case er:case $n:default:return ui}var t=e.payload,n=t.targetIds,r=n===void 0?[]:n,i=t.prevTargetIds,a=i===void 0?[]:i,o=or(r,a);if(!(o.length>0||!Wr(r,a)))return li;var s=a[a.length-1],c=r[r.length-1];return s!==c&&(s&&o.push(s),c&&o.push(c)),o}function pi(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:0)+1}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 hi(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){gi(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 gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _i(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:fi(e.dirtyHandlerIds,{type:t.type,payload:hi(hi({},t.payload),{},{prevTargetIds:rr(e,`dragOperation.targetIds`,[])})}),dragOffset:Yr(e.dragOffset,t),refCount:ci(e.refCount,t),dragOperation:si(e.dragOperation,t),stateId:pi(e.stateId)}}function vi(e,t){return{x:e.x+t.x,y:e.y+t.y}}function yi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function bi(e){var t=e.clientOffset,n=e.initialClientOffset,r=e.initialSourceClientOffset;return!t||!n||!r?null:yi(vi(t,r),n)}function xi(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:yi(t,n)}function Si(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ci(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 wi(e,t,n){return t&&Ci(e.prototype,t),n&&Ci(e,n),e}function Ti(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ei=function(){function e(t,n){Si(this,e),Ti(this,`store`,void 0),Ti(this,`registry`,void 0),this.store=t,this.registry=n}return wi(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&&!di(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:hr(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&&!hr(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 bi(this.store.getState().dragOffset)}},{key:`getDifferenceFromInitialOffset`,value:function(){return xi(this.store.getState().dragOffset)}}]),e}(),Di=0;function Oi(){return Di++}function ki(e){"@babel/helpers - typeof";return ki=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},ki(e)}function Ai(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 ji(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 Mi(e,t){if(t&&Array.isArray(e)){e.forEach(function(e){return Mi(e,!1)});return}K(typeof e==`string`||ki(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 Ni=typeof global<`u`?global:self,Pi=Ni.MutationObserver||Ni.WebKitMutationObserver;function Fi(e){return function(){let t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}function Ii(e){let t=1,n=new Pi(e),r=document.createTextNode(``);return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}var Li=typeof Pi==`function`?Ii:Fi,Ri=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=Li(this.flush),this.requestErrorThrow=Fi(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},zi=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}},Bi=class{create(e){let t=this.freeTasks,n=t.length?t.pop():new zi(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}},Vi=new Ri,Hi=new Bi(Vi.registerPendingError);function Ui(e){Vi.enqueueTask(Hi.create(e))}function Wi(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Gi(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 Ki(e,t,n){return t&&Gi(e.prototype,t),n&&Gi(e,n),e}function qi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ji(e,t){return $i(e)||Qi(e,t)||Xi(e,t)||Yi()}function Yi(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xi(e,t){if(e){if(typeof e==`string`)return Zi(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 Zi(e,t)}}function Zi(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 Qi(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 $i(e){if(Array.isArray(e))return e}function ea(e){var t=Oi().toString();switch(e){case G.SOURCE:return`S${t}`;case G.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}function ta(e){switch(e[0]){case`S`:return G.SOURCE;case`T`:return G.TARGET;default:K(!1,`Cannot parse handler ID: ${e}`)}}function na(e,t){var n=e.entries(),r=!1;do{var i=n.next(),a=i.done;if(Ji(i.value,2)[1]===t)return!0;r=!!a}while(!r);return!1}var ra=function(){function e(t){Wi(this,e),qi(this,`types`,new Map),qi(this,`dragSources`,new Map),qi(this,`dropTargets`,new Map),qi(this,`pinnedSourceId`,null),qi(this,`pinnedSource`,null),qi(this,`store`,void 0),this.store=t}return Ki(e,[{key:`addSource`,value:function(e,t){Mi(e),Ai(t);var n=this.addHandler(G.SOURCE,e,t);return this.store.dispatch(ei(n)),n}},{key:`addTarget`,value:function(e,t){Mi(e,!0),ji(t);var n=this.addHandler(G.TARGET,e,t);return this.store.dispatch(ti(n)),n}},{key:`containsHandler`,value:function(e){return na(this.dragSources,e)||na(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 ta(e)===G.SOURCE}},{key:`isTargetId`,value:function(e){return ta(e)===G.TARGET}},{key:`removeSource`,value:function(e){var t=this;K(this.getSource(e),`Expected an existing source.`),this.store.dispatch(ni(e)),Ui(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(ri(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=ea(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 ia(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=aa(arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1),i=new Ir(r,new Ei(r,new ra(r))),a=e(i,t,n);return i.receiveBackend(a),i}function aa(e){var t=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__;return Vr(_i,e&&t&&t({name:`dnd-core`,instanceId:`dnd-core`}))}var oa=[`children`];function sa(e,t){return fa(e)||da(e,t)||la(e,t)||ca()}function ca(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function la(e,t){if(e){if(typeof e==`string`)return ua(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 ua(e,t)}}function ua(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 da(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 fa(e){if(Array.isArray(e))return e}function pa(e,t){if(e==null)return{};var n=ma(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 ma(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 ha=0,ga=Symbol.for(`__REACT_DND_CONTEXT_INSTANCE__`),_a=(0,R.memo)(function(e){var t=e.children,n=sa(va(pa(e,oa)),2),r=n[0],i=n[1];return(0,R.useEffect)(function(){if(i){var e=ba();return++ha,function(){--ha===0&&(e[ga]=null)}}},[]),(0,z.jsx)(Jn.Provider,Object.assign({value:r},{children:t}),void 0)});function va(e){return`manager`in e?[{dragDropManager:e.manager},!1]:[ya(e.backend,e.context,e.options,e.debugMode),!e.context]}function ya(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ba(),n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=t;return i[ga]||(i[ga]={dragDropManager:ia(e,t,n,r)}),i[ga]}function ba(){return typeof global<`u`?global:window}function xa(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Sa(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 Ca(e,t,n){return t&&Sa(e.prototype,t),n&&Sa(e,n),e}function wa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ta=!1,Ea=!1,Da=function(){function e(t){xa(this,e),wa(this,`internalMonitor`,void 0),wa(this,`sourceId`,null),this.internalMonitor=t.getMonitor()}return Ca(e,[{key:`receiveHandlerId`,value:function(e){this.sourceId=e}},{key:`getHandlerId`,value:function(){return this.sourceId}},{key:`canDrag`,value:function(){K(!Ta,`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 Ta=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ta=!1}}},{key:`isDragging`,value:function(){if(!this.sourceId)return!1;K(!Ea,`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 Ea=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ea=!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 Oa(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ka(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Aa(e,t,n){return t&&ka(e.prototype,t),n&&ka(e,n),e}function ja(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ma=!1,Na=function(){function e(t){Oa(this,e),ja(this,`internalMonitor`,void 0),ja(this,`targetId`,null),this.internalMonitor=t.getMonitor()}return Aa(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(!Ma,`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 Ma=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ma=!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 Pa(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 Fa(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,R.isValidElement)(t)){var r=t;return e(r,n),r}var i=t;return Pa(i),Ra(i,n?function(t){return e(t,n)}:e)}}function Ia(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=Fa(r);t[n]=function(){return i}}}),t}function La(e,t){typeof e==`function`?e(t):e.current=t}function Ra(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,R.cloneElement)(e,{ref:function(e){La(n,e),La(t,e)}}):(0,R.cloneElement)(e,{ref:t})}function za(e){"@babel/helpers - typeof";return za=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},za(e)}function Ba(e){return e!==null&&za(e)===`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Va(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 Ha(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ua(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 Wa(e,t,n){return t&&Ua(e.prototype,t),n&&Ua(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 Ga=function(){function e(t){var n=this;Ha(this,e),Y(this,`hooks`,Ia({dragSource:function(e,t){n.clearDragSource(),n.dragSourceOptions=t||null,Ba(e)?n.dragSourceRef=e:n.dragSourceNode=e,n.reconnectDragSource()},dragPreview:function(e,t){n.clearDragPreview(),n.dragPreviewOptions=t||null,Ba(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 Wa(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!Va(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:`didDragPreviewOptionsChange`,value:function(){return!Va(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 Ka(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function qa(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 Ja(e,t,n){return t&&qa(e.prototype,t),n&&qa(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 Ya=function(){function e(t){var n=this;Ka(this,e),X(this,`hooks`,Ia({dropTarget:function(e,t){n.clearDropTarget(),n.dropTargetOptions=t,Ba(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 Ja(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!Va(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 Xa(e,t,n){var r=n.getRegistry(),i=r.addTarget(e,t);return[i,function(){return r.removeTarget(i)}]}function Za(e,t,n){var r=n.getRegistry(),i=r.addSource(e,t);return[i,function(){return r.removeSource(i)}]}var Qa=typeof window<`u`?R.useLayoutEffect:R.useEffect;function $a(e){"@babel/helpers - typeof";return $a=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},$a(e)}function eo(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function to(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 no(e,t,n){return t&&to(e.prototype,t),n&&to(e,n),e}function ro(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var io=function(){function e(t,n,r){eo(this,e),ro(this,`spec`,void 0),ro(this,`monitor`,void 0),ro(this,`connector`,void 0),this.spec=t,this.monitor=n,this.connector=r}return no(e,[{key:`beginDrag`,value:function(){var e=this.spec,t=this.monitor,n=null;return n=$a(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 ao(e,t,n){var r=(0,R.useMemo)(function(){return new io(e,t,n)},[t,n]);return(0,R.useEffect)(function(){r.spec=e},[e]),r}function oo(){var e=(0,R.useContext)(Jn).dragDropManager;return K(e!=null,`Expected drag drop context`),e}function so(e){return(0,R.useMemo)(function(){var t=e.type;return K(t!=null,`spec.type must be defined`),t},[e])}function co(e,t){return mo(e)||po(e,t)||uo(e,t)||lo()}function lo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uo(e,t){if(e){if(typeof e==`string`)return fo(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 fo(e,t)}}function fo(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 po(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 mo(e){if(Array.isArray(e))return e}function ho(e,t,n){var r=oo(),i=ao(e,t,n),a=so(e);Qa(function(){if(a!=null){var e=co(Za(a,i,r),2),o=e[0],s=e[1];return t.receiveHandlerId(o),n.receiveHandlerId(o),s}},[r,t,n,i,a])}function go(e){return bo(e)||yo(e)||vo(e)||_o()}function _o(){throw TypeError(`Invalid attempt to spread non-iterable instance.
5
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vo(e,t){if(e){if(typeof e==`string`)return xo(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 xo(e,t)}}function yo(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function bo(e){if(Array.isArray(e))return xo(e)}function xo(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 So(e,t){var n=go(t||[]);return t==null&&typeof e!=`function`&&n.push(e),(0,R.useMemo)(function(){return typeof e==`function`?e():e},n)}function Co(){var e=oo();return(0,R.useMemo)(function(){return new Da(e)},[e])}function wo(e,t){var n=oo(),r=(0,R.useMemo)(function(){return new Ga(n.getBackend())},[n]);return Qa(function(){return r.dragSourceOptions=e||null,r.reconnect(),function(){return r.disconnectDragSource()}},[r,e]),Qa(function(){return r.dragPreviewOptions=t||null,r.reconnect(),function(){return r.disconnectDragPreview()}},[r,t]),r}var To=t(n(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}}))());function Eo(e,t){return jo(e)||Ao(e,t)||Oo(e,t)||Do()}function Do(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
6
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oo(e,t){if(e){if(typeof e==`string`)return ko(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 ko(e,t)}}function ko(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 Ao(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 jo(e){if(Array.isArray(e))return e}function Mo(e,t,n){var r=Eo((0,R.useState)(function(){return t(e)}),2),i=r[0],a=r[1],o=(0,R.useCallback)(function(){var r=t(e);(0,To.default)(i,r)||(a(r),n&&n())},[i,e,n]);return Qa(o),[i,o]}function No(e,t){return Ro(e)||Lo(e,t)||Fo(e,t)||Po()}function Po(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
7
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fo(e,t){if(e){if(typeof e==`string`)return Io(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 Io(e,t)}}function Io(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 Lo(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 Ro(e){if(Array.isArray(e))return e}function zo(e,t,n){var r=No(Mo(e,t,n),2),i=r[0],a=r[1];return Qa(function(){var t=e.getHandlerId();if(t!=null)return e.subscribeToStateChange(a,{handlerIds:[t]})},[e,a]),i}function Bo(e,t,n){return zo(t,e||function(){return{}},function(){return n.reconnect()})}function Vo(e){return(0,R.useMemo)(function(){return e.hooks.dragSource()},[e])}function Ho(e){return(0,R.useMemo)(function(){return e.hooks.dragPreview()},[e])}function Uo(e,t){var n=So(e,t);K(!n.begin,`useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);var r=Co(),i=wo(n.options,n.previewOptions);return ho(n,r,i),[Bo(n.collect,r,i),Vo(i),Ho(i)]}function Wo(e){var t=e.accept;return(0,R.useMemo)(function(){return K(e.accept!=null,`accept must be defined`),Array.isArray(t)?t:[t]},[t])}function Go(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ko(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 qo(e,t,n){return t&&Ko(e.prototype,t),n&&Ko(e,n),e}function Jo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yo=function(){function e(t,n){Go(this,e),Jo(this,`spec`,void 0),Jo(this,`monitor`,void 0),this.spec=t,this.monitor=n}return qo(e,[{key:`canDrop`,value:function(){var e=this.spec,t=this.monitor;return e.canDrop?e.canDrop(t.getItem(),t):!0}},{key:`hover`,value:function(){var e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}},{key:`drop`,value:function(){var e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}}]),e}();function Xo(e,t){var n=(0,R.useMemo)(function(){return new Yo(e,t)},[t]);return(0,R.useEffect)(function(){n.spec=e},[e]),n}function Zo(e,t){return ns(e)||ts(e,t)||$o(e,t)||Qo()}function Qo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
8
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $o(e,t){if(e){if(typeof e==`string`)return es(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 es(e,t)}}function es(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 ts(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 ns(e){if(Array.isArray(e))return e}function rs(e,t,n){var r=oo(),i=Xo(e,t),a=Wo(e);Qa(function(){var e=Zo(Xa(a,i,r),2),o=e[0],s=e[1];return t.receiveHandlerId(o),n.receiveHandlerId(o),s},[r,t,i,n,a.map(function(e){return e.toString()}).join(`|`)])}function is(){var e=oo();return(0,R.useMemo)(function(){return new Na(e)},[e])}function as(e){var t=oo(),n=(0,R.useMemo)(function(){return new Ya(t.getBackend())},[t]);return Qa(function(){return n.dropTargetOptions=e||null,n.reconnect(),function(){return n.disconnectDropTarget()}},[e]),n}function os(e){return(0,R.useMemo)(function(){return e.hooks.dropTarget()},[e])}function ss(e,t){var n=So(e,t),r=is(),i=as(n.options);return rs(n,r,i),[Bo(n.collect,r,i),os(i)]}function cs(e,t){return ps(e)||fs(e,t)||us(e,t)||ls()}function ls(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
9
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function us(e,t){if(e){if(typeof e==`string`)return ds(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 ds(e,t)}}function ds(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 fs(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 ps(e){if(Array.isArray(e))return e}function ms(e){var t=oo().getMonitor(),n=cs(Mo(t,e),2),r=n[0],i=n[1];return(0,R.useEffect)(function(){return t.subscribeToOffsetChange(i)}),(0,R.useEffect)(function(){return t.subscribeToStateChange(i)}),r}function hs(e){var t=null;return function(){return t??=e(),t}}function gs(e,t){return e.filter(function(e){return e!==t})}function _s(e,t){var n=new Set,r=function(e){return n.add(e)};e.forEach(r),t.forEach(r);var i=[];return n.forEach(function(e){return i.push(e)}),i}function vs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ys(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 bs(e,t,n){return t&&ys(e.prototype,t),n&&ys(e,n),e}function xs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ss=function(){function e(t){vs(this,e),xs(this,`entered`,[]),xs(this,`isNodeInDocument`,void 0),this.isNodeInDocument=t}return bs(e,[{key:`enter`,value:function(e){var t=this,n=this.entered.length;return this.entered=_s(this.entered.filter(function(n){return t.isNodeInDocument(n)&&(!n.contains||n.contains(e))}),[e]),n===0&&this.entered.length>0}},{key:`leave`,value:function(e){var t=this.entered.length;return this.entered=gs(this.entered.filter(this.isNodeInDocument),e),t>0&&this.entered.length===0}},{key:`reset`,value:function(){this.entered=[]}}]),e}(),Cs=hs(function(){return/firefox/i.test(navigator.userAgent)}),ws=hs(function(){return!!window.safari});function Ts(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Es(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 Ds(e,t,n){return t&&Es(e.prototype,t),n&&Es(e,n),e}function Os(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ks=function(){function e(t,n){Ts(this,e),Os(this,`xs`,void 0),Os(this,`ys`,void 0),Os(this,`c1s`,void 0),Os(this,`c2s`,void 0),Os(this,`c3s`,void 0);for(var r=t.length,i=[],a=0;a<r;a++)i.push(a);i.sort(function(e,n){return t[e]<t[n]?-1:1});for(var o=[],s=[],c=[],l,u,d=0;d<r-1;d++)l=t[d+1]-t[d],u=n[d+1]-n[d],s.push(l),o.push(u),c.push(u/l);for(var f=[c[0]],p=0;p<s.length-1;p++){var m=c[p],h=c[p+1];if(m*h<=0)f.push(0);else{l=s[p];var g=s[p+1],_=l+g;f.push(3*_/((_+g)/m+(_+l)/h))}}f.push(c[c.length-1]);for(var v=[],y=[],b,x=0;x<f.length-1;x++){b=c[x];var S=f[x],C=1/s[x],w=S+f[x+1]-b-b;v.push((b-S-w)*C),y.push(w*C*C)}this.xs=t,this.ys=n,this.c1s=f,this.c2s=v,this.c3s=y}return Ds(e,[{key:`interpolate`,value:function(e){var t=this.xs,n=this.ys,r=this.c1s,i=this.c2s,a=this.c3s,o=t.length-1;if(e===t[o])return n[o];for(var s=0,c=a.length-1,l;s<=c;){l=Math.floor(.5*(s+c));var u=t[l];if(u<e)s=l+1;else if(u>e)c=l-1;else return n[l]}o=Math.max(0,c);var d=e-t[o],f=d*d;return n[o]+r[o]*d+i[o]*f+a[o]*d*f}}]),e}(),As=1;function js(e){var t=e.nodeType===As?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),r=n.top;return{x:n.left,y:r}}function Ms(e){return{x:e.clientX,y:e.clientY}}function Ns(e){var t;return e.nodeName===`IMG`&&(Cs()||!((t=document.documentElement)!=null&&t.contains(e)))}function Ps(e,t,n,r){var i=e?t.width:n,a=e?t.height:r;return ws()&&e&&(a/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:a}}function Fs(e,t,n,r,i){var a=Ns(t),o=js(a?e:t),s={x:n.x-o.x,y:n.y-o.y},c=e.offsetWidth,l=e.offsetHeight,u=r.anchorX,d=r.anchorY,f=Ps(a,t,c,l),p=f.dragPreviewWidth,m=f.dragPreviewHeight,h=function(){var e=new ks([0,.5,1],[s.y,s.y/l*m,s.y+m-l]).interpolate(d);return ws()&&a&&(e+=(window.devicePixelRatio-1)*m),e},g=function(){return new ks([0,.5,1],[s.x,s.x/c*p,s.x+p-c]).interpolate(u)},_=i.offsetX,v=i.offsetY,y=_===0||_,b=v===0||v;return{x:y?_:g(),y:b?v:h()}}var Is=e({FILE:()=>Ls,HTML:()=>Bs,TEXT:()=>zs,URL:()=>Rs}),Ls=`__NATIVE_FILE__`,Rs=`__NATIVE_URL__`,zs=`__NATIVE_TEXT__`,Bs=`__NATIVE_HTML__`;function Vs(e,t,n){return t.reduce(function(t,n){return t||e.getData(n)},``)??n}var Hs;function Us(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ws=(Hs={},Us(Hs,Ls,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:[`Files`]}),Us(Hs,Bs,{exposeProperties:{html:function(e,t){return Vs(e,t,``)},dataTransfer:function(e){return e}},matchesTypes:[`Html`,`text/html`]}),Us(Hs,Rs,{exposeProperties:{urls:function(e,t){return Vs(e,t,``).split(`
10
- `)},dataTransfer:function(e){return e}},matchesTypes:[`Url`,`text/uri-list`]}),Us(Hs,zs,{exposeProperties:{text:function(e,t){return Vs(e,t,``)},dataTransfer:function(e){return e}},matchesTypes:[`Text`,`text/plain`]}),Hs);function Gs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ks(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 qs(e,t,n){return t&&Ks(e.prototype,t),n&&Ks(e,n),e}function Js(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ys=function(){function e(t){Gs(this,e),Js(this,`item`,void 0),Js(this,`config`,void 0),this.config=t,this.item={},this.initializeExposedProperties()}return qs(e,[{key:`initializeExposedProperties`,value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(t){Object.defineProperty(e.item,t,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}},{key:`loadDataTransfer`,value:function(e){var t=this;if(e){var n={};Object.keys(this.config.exposeProperties).forEach(function(r){n[r]={value:t.config.exposeProperties[r](e,t.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,n)}}},{key:`canDrag`,value:function(){return!0}},{key:`beginDrag`,value:function(){return this.item}},{key:`isDragging`,value:function(e,t){return t===e.getSourceId()}},{key:`endDrag`,value:function(){}}]),e}();function Xs(e,t){var n=new Ys(Ws[e]);return n.loadDataTransfer(t),n}function Zs(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ws).filter(function(e){return Ws[e].matchesTypes.some(function(e){return t.indexOf(e)>-1})})[0]||null}function Qs(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function $s(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 ec(e,t,n){return t&&$s(e.prototype,t),n&&$s(e,n),e}function tc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var nc=function(){function e(t,n){Qs(this,e),tc(this,`ownerDocument`,null),tc(this,`globalContext`,void 0),tc(this,`optionsArgs`,void 0),this.globalContext=t,this.optionsArgs=n}return ec(e,[{key:`window`,get:function(){if(this.globalContext)return this.globalContext;if(typeof window<`u`)return window}},{key:`document`,get:function(){var e;if((e=this.globalContext)!=null&&e.document)return this.globalContext.document;if(this.window)return this.window.document}},{key:`rootElement`,get:function(){return this.optionsArgs?.rootElement||this.window}}]),e}();function rc(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 ic(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?rc(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ac(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function oc(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 sc(e,t,n){return t&&oc(e.prototype,t),n&&oc(e,n),e}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cc=function(){function e(t,n,r){var i=this;ac(this,e),Z(this,`options`,void 0),Z(this,`actions`,void 0),Z(this,`monitor`,void 0),Z(this,`registry`,void 0),Z(this,`enterLeaveCounter`,void 0),Z(this,`sourcePreviewNodes`,new Map),Z(this,`sourcePreviewNodeOptions`,new Map),Z(this,`sourceNodes`,new Map),Z(this,`sourceNodeOptions`,new Map),Z(this,`dragStartSourceIds`,null),Z(this,`dropTargetIds`,[]),Z(this,`dragEnterTargetIds`,[]),Z(this,`currentNativeSource`,null),Z(this,`currentNativeHandle`,null),Z(this,`currentDragSourceNode`,null),Z(this,`altKeyPressed`,!1),Z(this,`mouseMoveTimeoutTimer`,null),Z(this,`asyncEndDragFrameId`,null),Z(this,`dragOverTargetIds`,null),Z(this,`lastClientOffset`,null),Z(this,`hoverRafId`,null),Z(this,`getSourceClientOffset`,function(e){var t=i.sourceNodes.get(e);return t&&js(t)||null}),Z(this,`endDragNativeItem`,function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),Z(this,`isNodeInDocument`,function(e){return!!(e&&i.document&&i.document.body&&i.document.body.contains(e))}),Z(this,`endDragIfSourceWasRemovedFromDOM`,function(){var e=i.currentDragSourceNode;e==null||i.isNodeInDocument(e)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),Z(this,`handleTopDragStartCapture`,function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),Z(this,`handleTopDragStart`,function(e){if(!e.defaultPrevented){var t=i.dragStartSourceIds;i.dragStartSourceIds=null;var n=Ms(e);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:n});var r=e.dataTransfer,a=Zs(r);if(i.monitor.isDragging()){if(r&&typeof r.setDragImage==`function`){var o=i.monitor.getSourceId(),s=i.sourceNodes.get(o),c=i.sourcePreviewNodes.get(o)||s;if(c){var l=i.getCurrentSourcePreviewNodeOptions(),u=l.anchorX,d=l.anchorY,f=l.offsetX,p=l.offsetY,m=Fs(s,c,n,{anchorX:u,anchorY:d},{offsetX:f,offsetY:p});r.setDragImage(c,m.x,m.y)}}try{r?.setData(`application/json`,{})}catch{}i.setCurrentDragSourceNode(e.target),i.getCurrentSourcePreviewNodeOptions().captureDraggingState?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(a)i.beginDragNativeItem(a);else if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute(`draggable`)))return;else e.preventDefault()}}),Z(this,`handleTopDragEndCapture`,function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),Z(this,`handleTopDragEnterCapture`,function(e){if(i.dragEnterTargetIds=[],!(!i.enterLeaveCounter.enter(e.target)||i.monitor.isDragging())){var t=e.dataTransfer,n=Zs(t);n&&i.beginDragNativeItem(n,t)}}),Z(this,`handleTopDragEnter`,function(e){var t=i.dragEnterTargetIds;i.dragEnterTargetIds=[],i.monitor.isDragging()&&(i.altKeyPressed=e.altKey,t.length>0&&i.actions.hover(t,{clientOffset:Ms(e)}),t.some(function(e){return i.monitor.canDropOnTarget(e)})&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=i.getCurrentDropEffect())))}),Z(this,`handleTopDragOverCapture`,function(){i.dragOverTargetIds=[]}),Z(this,`handleTopDragOver`,function(e){var t=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`);return}i.altKeyPressed=e.altKey,i.lastClientOffset=Ms(e),i.hoverRafId===null&&typeof requestAnimationFrame<`u`&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(t||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null})),(t||[]).some(function(e){return i.monitor.canDropOnTarget(e)})?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))}),Z(this,`handleTopDragLeaveCapture`,function(e){i.isDraggingNativeItem()&&e.preventDefault(),i.enterLeaveCounter.leave(e.target)&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),Z(this,`handleTopDropCapture`,function(e){if(i.dropTargetIds=[],i.isDraggingNativeItem()){var t;e.preventDefault(),(t=i.currentNativeSource)==null||t.loadDataTransfer(e.dataTransfer)}else Zs(e.dataTransfer)&&e.preventDefault();i.enterLeaveCounter.reset()}),Z(this,`handleTopDrop`,function(e){var t=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(t,{clientOffset:Ms(e)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),Z(this,`handleSelectStart`,function(e){var t=e.target;typeof t.dragDrop==`function`&&(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`||t.isContentEditable||(e.preventDefault(),t.dragDrop()))}),this.options=new nc(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Ss(this.isNodeInDocument)}return sc(e,[{key:`profile`,value:function(){return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:this.dragStartSourceIds?.length||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:this.dragOverTargetIds?.length||0}}},{key:`window`,get:function(){return this.options.window}},{key:`document`,get:function(){return this.options.document}},{key:`rootElement`,get:function(){return this.options.rootElement}},{key:`setup`,value:function(){var e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw Error(`Cannot have two HTML5 backends at the same time.`);e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:`teardown`,value:function(){var e=this.rootElement;if(e!==void 0&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;(t=this.window)==null||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:`connectDragPreview`,value:function(e,t,n){var r=this;return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),function(){r.sourcePreviewNodes.delete(e),r.sourcePreviewNodeOptions.delete(e)}}},{key:`connectDragSource`,value:function(e,t,n){var r=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);var i=function(t){return r.handleDragStart(t,e)},a=function(e){return r.handleSelectStart(e)};return t.setAttribute(`draggable`,`true`),t.addEventListener(`dragstart`,i),t.addEventListener(`selectstart`,a),function(){r.sourceNodes.delete(e),r.sourceNodeOptions.delete(e),t.removeEventListener(`dragstart`,i),t.removeEventListener(`selectstart`,a),t.setAttribute(`draggable`,`false`)}}},{key:`connectDropTarget`,value:function(e,t){var n=this,r=function(t){return n.handleDragEnter(t,e)},i=function(t){return n.handleDragOver(t,e)},a=function(t){return n.handleDrop(t,e)};return t.addEventListener(`dragenter`,r),t.addEventListener(`dragover`,i),t.addEventListener(`drop`,a),function(){t.removeEventListener(`dragenter`,r),t.removeEventListener(`dragover`,i),t.removeEventListener(`drop`,a)}}},{key:`addEventListeners`,value:function(e){e.addEventListener&&(e.addEventListener(`dragstart`,this.handleTopDragStart),e.addEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.addEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.addEventListener(`dragenter`,this.handleTopDragEnter),e.addEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.addEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.addEventListener(`dragover`,this.handleTopDragOver),e.addEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.addEventListener(`drop`,this.handleTopDrop),e.addEventListener(`drop`,this.handleTopDropCapture,!0))}},{key:`removeEventListeners`,value:function(e){e.removeEventListener&&(e.removeEventListener(`dragstart`,this.handleTopDragStart),e.removeEventListener(`dragstart`,this.handleTopDragStartCapture,!0),e.removeEventListener(`dragend`,this.handleTopDragEndCapture,!0),e.removeEventListener(`dragenter`,this.handleTopDragEnter),e.removeEventListener(`dragenter`,this.handleTopDragEnterCapture,!0),e.removeEventListener(`dragleave`,this.handleTopDragLeaveCapture,!0),e.removeEventListener(`dragover`,this.handleTopDragOver),e.removeEventListener(`dragover`,this.handleTopDragOverCapture,!0),e.removeEventListener(`drop`,this.handleTopDrop),e.removeEventListener(`drop`,this.handleTopDropCapture,!0))}},{key:`getCurrentSourceNodeOptions`,value:function(){var e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return ic({dropEffect:this.altKeyPressed?`copy`:`move`},t||{})}},{key:`getCurrentDropEffect`,value:function(){return this.isDraggingNativeItem()?`copy`:this.getCurrentSourceNodeOptions().dropEffect}},{key:`getCurrentSourcePreviewNodeOptions`,value:function(){var e=this.monitor.getSourceId();return ic({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:`isDraggingNativeItem`,value:function(){var e=this.monitor.getItemType();return Object.keys(Is).some(function(t){return Is[t]===e})}},{key:`beginDragNativeItem`,value:function(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=Xs(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:`setCurrentDragSourceNode`,value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){return t.rootElement?.addEventListener(`mousemove`,t.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:`clearCurrentDragSourceNode`,value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;(e=this.window)==null||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener(`mousemove`,this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:`handleDragStart`,value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||=[],this.dragStartSourceIds.unshift(t))}},{key:`handleDragEnter`,value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:`handleDragOver`,value:function(e,t){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:`handleDrop`,value:function(e,t){this.dropTargetIds.unshift(t)}}]),e}(),lc;function uc(){return lc||(lc=new Image,lc.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),lc}var dc=function(e,t,n){return new cc(e,t,n)};function fc(e,t){return typeof e==`function`?e(t):e??`NODE`}function pc(e){return e.isDraggable&&!e.isEditing}function mc(e){let t=W(),n=t.selectedIds,[r,i,a]=Uo(()=>({canDrag:()=>pc(e),type:fc(t.props.dragType,e),item:()=>{let r=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(an.dragStart(e.id,r)),{id:e.id,dragIds:r,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(an.dragEnd())}}),[n,e,t.props.dragType]);return(0,R.useEffect)(()=>{a(uc())},[a]),i}function hc(e,t){let n=e.getBoundingClientRect(),r=t.x-Math.round(n.x),i=t.y-Math.round(n.y),a=n.height,o=i<a/2,s=!o,c=a/4,l=i>c&&i<a-c;return{x:r,inTopHalf:o,inBottomHalf:s,inMiddle:l,atTop:!l&&o,atBottom:!l&&s}}function gc(e,t,n,r){return e?e.isInternal?r.atTop?[t,e]:r.inMiddle?[e,e]:[e,n]:r.inTopHalf?[t,e]:[e,n]:[t,null]}function _c(e,t){return{parentId:e||null,index:t}}function vc(e,t){return{type:`line`,index:e,level:t}}function yc(e){return{type:`highlight`,id:e}}function bc(e,t){let n=e;for(;n.parent&&n.level>t;)n=n.parent;return{parentId:n.parent?.id||null,index:_t(n)+1}}function xc(e){let t=hc(e.element,e.offset),n=e.indent,r=Math.round(Math.max(0,t.x-n)/n),{node:i,nextNode:a,prevNode:o}=e,[s,c]=gc(i,o,a,t);if(i&&i.isInternal&&t.inMiddle)return{drop:_c(i.id,null),cursor:yc(i.id)};if(!s)return{drop:_c(c?.parent?.id,0),cursor:vc(0,0)};if(pt(s)){let e=ft(r,c?.level||0,s.level);return{drop:bc(s,e),cursor:vc(s.rowIndex+1,e)}}if(mt(s)){let e=ft(r,c?.level||0,s.level);return{drop:bc(s,e),cursor:vc(s.rowIndex+1,e)}}if(ht(s)){let e=ft(r,0,s.level+1);return e>s.level?{drop:_c(s.id,0),cursor:vc(s.rowIndex+1,e)}:{drop:bc(s,e),cursor:vc(s.rowIndex+1,e)}}return{drop:_c(s?.id,0),cursor:vc(s.rowIndex+1,s.level+1)}}function Sc(e,t){let n=W(),[r,i]=ss(()=>({accept:`NODE`,canDrop:()=>n.canDrop(),hover:(r,i)=>{let a=i.getClientOffset();if(!e.current||!a)return;let{cursor:o,drop:s}=xc({element:e.current,offset:a,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});s&&n.dispatch(an.hovering(s.parentId,s.index)),i.canDrop()?o&&n.showCursor(o):n.hideCursor()},drop:(e,t)=>{if(!t.canDrop())return null;n.drop()}}),[t,e.current,n.props]);return i}function Cc(e){let t=W(),n=t.at(e);if(!n)throw Error(`Could not find node for index: ${e}`);return(0,R.useMemo)(()=>{let r=n.clone();return t.visibleNodes[e]=r,r},[...Object.values(n.state),n])}var wc=R.memo(function({index:e,style:t}){ut(),ot();let n=W(),r=Cc(e),i=(0,R.useRef)(null),a=mc(r),o=Sc(i,r),s=(0,R.useCallback)(e=>{i.current=e,o(e)},[o]),c=n.indent*r.level,l=(0,R.useMemo)(()=>({paddingLeft:c}),[c]),u=(0,R.useMemo)(()=>Object.assign(Object.assign({},t),{top:parseFloat(t.top)+(n.props.padding??n.props.paddingTop??0),minWidth:`max-content`}),[t,n.props.padding,n.props.paddingTop]),d={role:`treeitem`,"aria-level":r.level+1,"aria-selected":r.isSelected,"aria-expanded":r.isOpen,style:u,tabIndex:-1,className:n.props.rowClassName};(0,R.useEffect)(()=>{var e;!r.isEditing&&r.isFocused&&((e=i.current)==null||e.focus({preventScroll:!0}))},[r.isEditing,r.isFocused,i.current]);let f=n.renderNode,p=n.renderRow;return(0,z.jsx)(p,{node:r,innerRef:s,attrs:d,children:(0,z.jsx)(f,{node:r,tree:n,style:l,dragHandle:a})})}),Tc=``,Ec=null;function Dc(){ut();let e=W();return(0,z.jsx)(`div`,{role:`tree`,"aria-label":e.props[`aria-label`],"aria-labelledby":e.props[`aria-labelledby`],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{if(e.isEditing)return;if(t.key===`Backspace`){if(!e.props.onDelete)return;let t=Array.from(e.selectedIds);if(t.length>1){let n=e.mostRecentNode;for(;n&&n.isSelected;)n=n.nextSibling;n||=e.lastNode,e.focus(n,{scroll:!1}),e.delete(Array.from(t))}else{let t=e.focusedNode;if(t){let n=t.nextSibling,r=t.parent;e.focus(n||r,{scroll:!1}),e.delete(t)}}return}if(t.key===`Tab`&&!t.shiftKey){t.preventDefault(),xt(t.currentTarget);return}if(t.key===`Tab`&&t.shiftKey){t.preventDefault(),St(t.currentTarget);return}if(t.key===`ArrowDown`){t.preventDefault();let n=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}else{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.firstNode);return}}if(t.key===`ArrowUp`){t.preventDefault();let n=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(n);return}else{if(!n)return;let t=e.focusedNode;t?t.isSelected?e.selectContiguous(n):e.selectMulti(n):e.focus(e.lastNode);return}}if(t.key===`ArrowRight`){let t=e.focusedNode;if(!t)return;t.isInternal&&t.isOpen?e.focus(e.nextNode):t.isInternal&&e.open(t.id);return}if(t.key===`ArrowLeft`){let t=e.focusedNode;if(!t||t.isRoot)return;t.isInternal&&t.isOpen?e.close(t.id):t.parent?.isRoot||e.focus(t.parent);return}if(t.key===`a`&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key===`a`&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key===`A`&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key===`Home`){t.preventDefault(),e.focus(e.firstNode);return}if(t.key===`End`){t.preventDefault(),e.focus(e.lastNode);return}if(t.key===`Enter`){let t=e.focusedNode;if(!t||!t.isEditable||!e.props.onRename)return;setTimeout(()=>{t&&e.edit(t)});return}if(t.key===` `){t.preventDefault();let n=e.focusedNode;if(!n)return;n.isLeaf?(n.select(),n.activate()):n.toggle();return}if(t.key===`*`){let t=e.focusedNode;if(!t)return;e.openSiblings(t);return}if(t.key===`PageUp`){t.preventDefault(),e.pageUp();return}t.key===`PageDown`&&(t.preventDefault(),e.pageDown()),clearTimeout(Ec),Tc+=t.key,Ec=setTimeout(()=>{Tc=``},600);let n=e.visibleNodes.find(e=>{let t=e.data.name;return typeof t==`string`?t.toLowerCase().startsWith(Tc):!1});n&&e.focus(n.id)},children:(0,z.jsx)(Oc,{})})}function Oc(){let e=W(),t={className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,overscanCount:e.overscanCount,itemKey:t=>e.visibleNodes[t]?.id||t,outerElementType:e.props.outerElementType??Wn,innerElementType:e.props.innerElementType??qn,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e)};return typeof e.props.rowHeight==`function`?(0,z.jsx)(Bn,Object.assign({},t,{itemSize:e.rowHeightAt,ref:e.list,children:wc})):(0,z.jsx)(Vn,Object.assign({},t,{itemSize:e.rowHeight,ref:e.list,children:wc}))}function kc(e){return e.isFiltered?jc(e.root,e.isMatch.bind(e)):Ac(e.root)}function Ac(e){let t=[];function n(e){var r;e.level>=0&&t.push(e),e.isOpen&&((r=e.children)==null||r.forEach(n))}return n(e),t.forEach(Mc),t}function jc(e,t){let n={},r=[];function i(e){if(!e.isRoot&&t(e)){n[e.id]=!0;let t=e.parent;for(;t;)n[t.id]=!0,t=t.parent}if(e.children)for(let t of e.children)i(t)}function a(e){var t;e.level>=0&&n[e.id]&&r.push(e),e.isOpen&&((t=e.children)==null||t.forEach(a))}return i(e),a(e),r.forEach(Mc),r}function Mc(e,t){e.rowIndex=t}var Nc=e=>e.reduce((e,t,n)=>(e[t.id]=n,e),{}),Pc=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},{safeRun:Q}=dt,Fc=class e{constructor(e,t,n,r){this.store=e,this.props=t,this.list=n,this.listEl=r,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=e=>{let t=this.props.rowHeight;if(typeof t==`function`){let n=this.at(e);return n?t(n):this.rowHeight}return t??24},this.rowTopPosition=e=>{if(typeof this.props.rowHeight!=`function`)return e*this.rowHeight;let t=this.getRowOffsets();return t[Math.max(0,Math.min(e,t.length-1))]},this.redrawList=(e=0)=>{this.rowOffsets=null;let t=this.list.current;t&&`resetAfterIndex`in t&&t.resetAfterIndex(Math.max(0,e))},this.root=Gt(this),this.visibleNodes=kc(this),this.idToIndex=Nc(this.visibleNodes)}update(e){this.props=e,this.root=Gt(this),this.visibleNodes=kc(this),this.idToIndex=Nc(this.visibleNodes),this.rowOffsets=null;let t=this.list.current;t&&`resetAfterIndex`in t&&t.resetAfterIndex(0,!1)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){return this.props.width??300}get height(){return this.props.height??500}get indent(){return this.props.indent??24}get rowHeight(){return typeof this.props.rowHeight==`number`?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;let e=[0];for(let t=0;t<this.visibleNodes.length;t++)e.push(e[t]+this.rowHeightAt(t));return this.rowOffsets=e,e}get overscanCount(){return this.props.overscanCount??1}get searchTerm(){return(this.props.searchTerm||``).trim()}get matchFn(){let e=this.props.searchMatch??((e,t)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(t.toLocaleLowerCase()));return t=>e(t,this.searchTerm)}accessChildren(e){return Et(e,this.props.childrenAccessor||`children`)??null}accessId(e){let t=Et(e,this.props.idAccessor||`id`);if(!t)throw Error(`Data must contain an 'id' property or props.idAccessor must return a string`);return t}identify(e){return typeof e==`string`?e:e instanceof Kt?e.id:Et(e,this.props.idAccessor||`id`)}identifyNull(e){return e==null?null:this.identify(e)}get firstNode(){return this.visibleNodes[0]??null}get lastNode(){return this.visibleNodes[this.visibleNodes.length-1]??null}get focusedNode(){return this.get(this.state.nodes.focus.id)??null}get mostRecentNode(){return this.get(this.state.nodes.selection.mostRecent)??null}get nextNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){let e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,t){if(e===null||t===null)return[];let n=this.indexOf(e)??0,r=this.indexOf(t);if(r===null)return[];let i=Math.min(n,r),a=Math.max(n,r);return this.visibleNodes.slice(i,a+1)}indexOf(e){let t=this.identifyNull(e);return t?this.idToIndex[t]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:`internal`})}createLeaf(){return this.create({type:`leaf`})}create(){return Pc(this,arguments,void 0,function*(e={}){let t=e.parentId===void 0?Ft(this):e.parentId,n=e.index??Mt(this),r=e.type??`leaf`,i=yield Q(this.props.onCreate,{type:r,parentId:t,index:n,parentNode:this.get(t)});i&&(this.focus(i),setTimeout(()=>{this.edit(i).then(()=>{this.select(i),this.activate(i)})}))})}delete(e){return Pc(this,void 0,void 0,function*(){if(!e)return;let t=(Array.isArray(e)?e:[e]).map(e=>this.identify(e)),n=t.map(e=>this.get(e)).filter(e=>!!e),r=n.length?Math.min(...n.map(e=>e.rowIndex??0)):0;yield Q(this.props.onDelete,{nodes:n,ids:t}),this.redrawList(r)})}edit(t){let n=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(qt(n)),this.redrawList(this.get(n)?.rowIndex??0),new Promise(t=>{e.editPromise=t})}submit(e,t){return Pc(this,void 0,void 0,function*(){if(!e)return;let n=this.identify(e);yield Q(this.props.onRename,{id:n,name:t,node:this.get(n)}),this.dispatch(qt(null)),this.resolveEdit({cancelled:!1,value:t}),this.redrawList(this.get(n)?.rowIndex??0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(qt(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(e){let t=this.get(this.identifyNull(e));t&&Q(this.props.onActivate,t)}resolveEdit(t){let n=e.editPromise;n&&n(t),e.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let t of Array.from(this.selectedIds)){let n=this.get(t);n&&e.push(n)}return e}focus(e,t={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Yt(this.identify(e))),t.scroll!==!1&&this.scrollTo(e),this.focusedNode&&Q(this.props.onFocus,this.focusedNode)))}pageUp(){let e=this.visibleStartIndex,t=this.visibleStopIndex-e,n=this.focusedNode?.rowIndex??0;n=n>e?e:Math.max(e-t,0),this.focus(this.at(n))}pageDown(){let e=this.visibleStartIndex,t=this.visibleStopIndex,n=t-e,r=this.focusedNode?.rowIndex??0;r=r<t?t:Math.min(r+n,this.visibleNodes.length-1),this.focus(this.at(r))}select(e,t={}){if(!e)return;let n=t.focus!==!1,r=this.identify(e);n&&this.dispatch(Yt(r)),this.get(r)?.isSelectable&&this.setSelection({ids:[r],anchor:r,mostRecent:r}),this.scrollTo(r,t.align),this.focusedNode&&n&&Q(this.props.onFocus,this.focusedNode)}deselect(e){if(!e)return;let t=this.identify(e);this.dispatch(nn.remove(t)),Q(this.props.onSelect,this.selectedNodes)}selectMulti(e,t={}){let n=this.get(this.identifyNull(e));if(!n)return;let r=t.focus!==!1;r&&this.dispatch(Yt(n.id)),n.isSelectable&&(this.dispatch(nn.add(n.id)),this.dispatch(nn.anchor(n.id)),this.dispatch(nn.mostRecent(n.id))),this.scrollTo(n,t.align),this.focusedNode&&r&&Q(this.props.onFocus,this.focusedNode),Q(this.props.onSelect,this.selectedNodes)}selectContiguous(e){if(!e)return;let t=this.identify(e);if(this.dispatch(Yt(t)),this.get(t)?.isSelectable){let{anchor:e,mostRecent:n}=this.state.nodes.selection,r=this.filterSelectableNodes(this.nodesBetween(e,this.identifyNull(t)));this.dispatch(nn.remove(this.nodesBetween(e,n))),this.dispatch(nn.add(r)),this.dispatch(nn.mostRecent(t))}this.scrollTo(t),this.focusedNode&&Q(this.props.onFocus,this.focusedNode),Q(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){let e=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:e,anchor:e[0]??null,mostRecent:e[e.length-1]??null}),this.dispatch(Yt(this.lastNode?.id)),this.focusedNode&&Q(this.props.onFocus,this.focusedNode)}filterSelectableNodes(e){return e.map(e=>this.get(this.identify(e))).filter(e=>!!e&&e.isSelectable)}setSelection(e){let t=new Set(e.ids?.map(e=>this.identify(e))),n=this.identifyNull(e.anchor),r=this.identifyNull(e.mostRecent);this.dispatch(nn.set({ids:t,anchor:n,mostRecent:r})),Q(this.props.onSelect,this.selectedNodes)}get cursorParentId(){let{cursor:e}=this.state.dnd;switch(e.type){case`highlight`:return e.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type===`highlight`}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){if(this.isFiltered)return!1;let e=this.get(this.state.dnd.parentId)??this.root,t=this.dragNodes,n=this.props.disableDrop;for(let n of t)if(!n||!e||n.isInternal&&gt(e,n))return!1;return typeof n==`function`?!n({parentNode:e,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof n==`string`?!e.data[n]:typeof n==`boolean`?!n:!0}drop(){let{parentId:e,index:t,dragIds:n}=this.state.dnd;Q(this.props.onMove,{dragIds:n,parentId:e===`__REACT_ARBORIST_INTERNAL_ROOT__`?null:e,index:t===null?0:t,dragNodes:this.dragNodes,parentNode:this.get(e)}),this.open(e)}hideCursor(){this.dispatch(an.cursor({type:`none`}))}showCursor(e){this.dispatch(an.cursor(e))}open(e,t=!0){let n=this.identifyNull(e);n&&(this.isOpen(n)||(this.dispatch(Qt.open(n,this.isFiltered)),t&&this.redrawList(this.get(n)?.rowIndex??0),Q(this.props.onToggle,n)))}close(e,t=!0){let n=this.identifyNull(e);n&&this.isOpen(n)&&(this.dispatch(Qt.close(n,this.isFiltered)),t&&this.redrawList(this.get(n)?.rowIndex??0),Q(this.props.onToggle,n))}toggle(e){let t=this.identifyNull(e);if(t)return this.isOpen(t)?this.close(t):this.open(t)}openParents(e){let t=this.identifyNull(e);if(!t)return;let n=yt(this.root,t)?.parent;for(;n;)this.open(n.id,!1),n=n.parent;this.redrawList()}openSiblings(e){let t=e.parent;if(!t)this.toggle(e.id);else if(t.children){let n=e.isOpen;for(let e of t.children)e.isInternal&&(n?this.close(e.id,!1):this.open(e.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){bt(this.root,e=>{e.isInternal&&this.open(e.id,!1)}),this.redrawList()}closeAll(){bt(this.root,e=>{e.isInternal&&this.close(e.id,!1)}),this.redrawList()}scrollTo(e,t=`smart`){if(!e)return;let n=this.identify(e);return this.openParents(n),jt(()=>n in this.idToIndex).then(()=>{var e;let r=this.idToIndex[n];r!==void 0&&((e=this.list.current)==null||e.scrollToItem(r,t))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){return!!this.props.searchTerm?.trim()}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return e?this.state.nodes.selection.ids.has(e):!1}isOpen(e){if(!e)return!1;if(e===`__REACT_ARBORIST_INTERNAL_ROOT__`)return!0;let t=this.props.openByDefault??!0;return this.isFiltered?this.state.nodes.open.filtered[e]??!0:this.state.nodes.open.unfiltered[e]??t}isEditable(e){return this.isActionPossible(e,this.props.disableEdit)}isDraggable(e){return this.isActionPossible(e,this.props.disableDrag)}isSelectable(e){return this.isActionPossible(e,this.props.disableSelect)}isActionPossible(e,t=()=>!1){return!Et(e,t)}isDragging(e){let t=this.identifyNull(e);return t?this.state.nodes.drag.id===t:!1}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){let t=this.identifyNull(e);if(!t)return!1;let{destinationParentId:n,destinationIndex:r}=this.state.nodes.drag;return t===n&&r===null}onFocus(){let e=this.focusedNode||this.firstNode;e&&this.dispatch(Yt(e.id))}onBlur(){this.dispatch(Xt())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Dc}get renderRow(){return this.props.renderRow||Bt}get renderNode(){return this.props.children||Vt}get renderDragPreview(){return this.props.renderDragPreview||un}get renderCursor(){return this.props.renderCursor||zt}};function $(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 Ic=typeof Symbol==`function`&&Symbol.observable||`@@observable`,Lc=()=>Math.random().toString(36).substring(7).split(``).join(`.`),Rc={INIT:`@@redux/INIT${Lc()}`,REPLACE:`@@redux/REPLACE${Lc()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Lc()}`};function zc(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Bc(e,t,n){if(typeof e!=`function`)throw Error($(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error($(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error($(1));return n(Bc)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error($(3));return i}function d(e){if(typeof e!=`function`)throw Error($(4));if(c)throw Error($(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error($(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!zc(e))throw Error($(7));if(e.type===void 0)throw Error($(8));if(typeof e.type!=`string`)throw Error($(17));if(c)throw Error($(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error($(10));r=e,f({type:Rc.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error($(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[Ic](){return this}}}return f({type:Rc.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[Ic]:m}}function Vc(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:Rc.INIT})===void 0)throw Error($(12));if(n(void 0,{type:Rc.PROBE_UNKNOWN_ACTION()})===void 0)throw Error($(13))})}function Hc(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{Vc(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error($(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function Uc(e=tn().nodes.drag,t){switch(t.type){case`DND_DRAG_START`:return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case`DND_DRAG_END`:return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case`DND_HOVERING`:return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}var Wc=Hc({nodes:Hc({focus:Zt,edit:Jt,open:en,selection:rn,drag:Uc}),dnd:on}),Gc=rt(),Kc=tn();function qc({treeProps:e,imperativeHandle:t,children:n}){let r=(0,R.useRef)(null),i=(0,R.useRef)(null),a=(0,R.useRef)(Bc(Wc,tn(e))),o=(0,Gc.useSyncExternalStore)(a.current.subscribe,a.current.getState,()=>Kc),s=(0,R.useMemo)(()=>new Fc(a.current,e,r,i),[]),c=(0,R.useRef)(0);return(0,R.useMemo)(()=>{c.current+=1,s.update(e)},Object.values(e)),(0,R.useMemo)(()=>{c.current+=1,s.update(s.props)},[o.nodes.open]),(0,R.useImperativeHandle)(t,()=>s),(0,R.useEffect)(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),(0,R.useEffect)(()=>{s.props.searchTerm||a.current.dispatch(Qt.clear(!0))},[s.props.searchTerm]),(0,z.jsx)(it.Provider,{value:s,children:(0,z.jsx)(lt.Provider,{value:c.current,children:(0,z.jsx)(at.Provider,{value:o.nodes,children:(0,z.jsx)(st.Provider,{value:o.dnd,children:(0,z.jsx)(_a,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||dc,options:{rootElement:s.props.dndRootElement||void 0}},{children:n}))})})})})}function Jc(){let e=W(),[,t]=ss(()=>({accept:`NODE`,canDrop:(t,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(t,n)=>{if(!n.isOver({shallow:!0}))return;let r=n.getClientOffset();if(!e.listEl.current||!r)return;let{cursor:i,drop:a}=xc({element:e.listEl.current,offset:r,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});a&&e.dispatch(an.hovering(a.parentId,a.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(t,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function Yc(e){return Jc(),e.children}function Xc(){return(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(W().props.renderContainer||Dc,{})})}function Zc(){let e=W(),{offset:t,mouse:n,item:r,isDragging:i}=ms(e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()}));return(0,z.jsx)(e.props.renderDragPreview||un,{offset:t,mouse:n,id:r?.id||null,dragIds:r?.dragIds||[],isDragging:i})}function Qc(e={}){let t=e.idAccessor??`id`,n=e.childrenAccessor??`children`;return{getId:typeof t==`function`?t:e=>e[t],getChildren:typeof n==`function`?n:e=>e[n],childrenKey:typeof n==`string`?n:`children`}}var $c=class{constructor(e,t={}){this.accessors=Qc(t),this.root=el(e,this.accessors)}get data(){return this.root.children?.map(e=>e.data)??[]}create(e){let t=e.parentId?this.find(e.parentId):this.root;if(!t)return null;t.addChild(e.data,e.index)}move(e){let t=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;!t||!n||(n.addChild(t.data,e.index),t.drop())}update(e){let t=this.find(e.id);t&&t.update(e.changes)}drop(e){let t=this.find(e.id);t&&t.drop()}find(e,t=this.root){if(!t)return null;if(t.id===e)return t;if(t.children){for(let n of t.children){let t=this.find(e,n);if(t)return t}return null}return null}};function el(e,t){let n=new nl({},null,t,`ROOT`);return n.children=e.map(e=>tl(e,n,t)),n}function tl(e,t,n){let r=new nl(e,t,n),i=n.getChildren(e);return i&&(r.children=i.map(e=>tl(e,r,n))),r}var nl=class{constructor(e,t,n,r){this.data=e,this.parent=t,this.accessors=n,this.id=r??n.getId(e)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,t){let n=tl(e,this,this.accessors);this.children=this.children??[],this.children.splice(t,0,n);let r=this.accessors.childrenKey,i=this.data;i[r]=i[r]??[],i[r].splice(t,0,e)}removeChild(e){var t,n;(t=this.children)==null||t.splice(e,1),(n=this.data[this.accessors.childrenKey])==null||n.splice(e,1)}update(e){if(this.hasParent()){let t=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),t),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}},rl=0;function il(e,t={}){let[n,r]=(0,R.useState)(e),i=t.idAccessor,a=t.childrenAccessor,o=(0,R.useMemo)(()=>new $c(n,{idAccessor:i,childrenAccessor:a}),[n,i,a]),s=e=>{for(let t of e.dragIds)o.move({id:t,parentId:e.parentId,index:e.index});r(o.data)},c=({name:e,id:t})=>{o.update({id:t,changes:{name:e}}),r(o.data)},l=typeof i==`string`?i:`id`,u=typeof a==`string`?a:`children`;return[n,{onMove:s,onRename:c,onCreate:({parentId:e,index:t,type:n})=>{if(typeof i==`function`)throw Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(n===`internal`&&typeof a==`function`)throw Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");let s={[l]:`simple-tree-id-${rl++}`,name:``};return n===`internal`&&(s[u]=[]),o.create({parentId:e,index:t,data:s}),r(o.data),s},onDelete:e=>{e.ids.forEach(e=>o.drop({id:e})),r(o.data)}}]}function al(e){if(e.initialData&&e.data)throw Error(`React Arborist Tree => Provide either a data or initialData prop, but not both.`);if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
11
- Use the data prop if you want to provide your own handlers.`);if(e.initialData){let[t,n]=il(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}else return e}function ol(e,t){return(0,z.jsxs)(qc,{treeProps:al(e),imperativeHandle:t,children:[(0,z.jsx)(Yc,{children:(0,z.jsx)(Xc,{})}),(0,z.jsx)(Zc,{})]})}var sl=(0,R.forwardRef)(ol),cl=[0,80,180,300,520,900,1200],ll=[80,180,360],ul=new Set([`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`,`Enter`,` `,`F2`,`Delete`,`Backspace`,`ContextMenu`]);function dl(e,t){return t.top<e.top?t.top-e.top:t.bottom>e.bottom?t.bottom-e.bottom:0}function fl(e){return e.focusRow&&!e.operationActive&&!e.activeElementIsSearchInput&&!e.searchInputValue}function pl(e){return e.activeElementIsSearchInput&&!!e.searchInputValue}function ml(e){return e.requestedSelect||!e.searchInputValue}function hl(e){return ul.has(e)}function gl(e){return e.rows.find(t=>t.path===e.lastFocusedPath)?.path??e.rows.find(e=>e.selected)?.path??e.rows[0]?.path??null}function _l(e){return e.selectedPath??e.targetPath??e.focusedPath??e.lastFocusedPath??null}function vl(e,t){return Math.max(1,Math.floor(Math.max(0,e)/Math.max(1,t))-1)}function yl(e){if(e.rowCount<=0)return-1;let t=Math.max(0,Math.min(e.currentIndex,e.rowCount-1))+(e.key===`PageUp`?-1:1)*Math.max(1,e.pageSize);return Math.max(0,Math.min(t,e.rowCount-1))}function bl(e){if(e.nodeType!==`directory`)return!1;let t=e.selectedRow.path===e.nodePath&&e.selectedRow.type===`directory`&&e.selectedRow.expanded===!0;return e.nodeOpen||t||e.openDirectoryPaths.has(e.nodePath)}function xl(e){let t=!e.metaKey&&!e.ctrlKey&&!e.shiftKey;return e.nodeType===`directory`&&t?`toggle-directory`:e.nodeType===`file`&&t?`open-file`:`select`}function Sl(e){return e.nodeType===`directory`?e.nodeOpen?`close-directory`:`open-directory`:e.nodeType===`file`?`open-file`:`none`}function Cl(e,t=30,n=0,r=25){return e+t+n+r}function wl(e,t,n=1){return e<t+n}function Tl(e,t,n,r=1){return e.find(e=>e.bottom>t+r&&e.top<n)?.path??``}function El(e,t,n){if(!e)return[];let r=new Map(t.map(e=>[e.path,e.top]));return y(e).filter(e=>{let t=r.get(e);return typeof t==`number`&&t<n})}function Dl(e){return!e.visible&&e.directoryNodes.length===0?[]:e.directoryNodes.map(e=>({kind:`directory`,key:e.path,node:e}))}function Ol(e){return e.map(e=>e.displayName??e.name).filter(Boolean).join(`/`)}function kl(e){if(!e)return()=>{};let t=e.scrollTop,n=()=>{e.scrollTop=t};return n(),window.requestAnimationFrame(n),window.setTimeout(n,0),window.setTimeout(n,80),window.setTimeout(n,180),n}function Al(e,t,n){let r=Re(e.node.descendantGitStatus);return(0,z.jsxs)(`button`,{type:`button`,className:`code-file-row directory code-file-sticky-row`,style:H(b(e.node.path)),title:e.node.path,onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e.node)},children:[(0,z.jsx)(`span`,{className:`code-file-chevron expanded`,"aria-hidden":`true`,children:(0,z.jsx)(L,{})}),(0,z.jsx)(`span`,{className:`code-file-name`,children:e.node.displayName??e.node.name}),r&&(0,z.jsx)(`span`,{className:r,title:Ie(`git`,t)})]},e.key)}function jl({copy:e,items:t,onFocusDirectory:n}){if(t.length===0)return null;let r=t.filter(e=>e.kind===`directory`),i=r[r.length-1];return(0,z.jsx)(`div`,{className:`code-file-sticky-shell`,children:(0,z.jsxs)(`div`,{className:`code-file-sticky-stack`,"data-testid":`code-file-sticky-stack`,"aria-label":e.stickyFolderPath,children:[(0,z.jsx)(`div`,{className:`code-file-sticky-expanded-rows`,children:r.map(t=>Al(t,e,n))}),i&&(0,z.jsxs)(`button`,{type:`button`,className:`code-file-row directory code-file-sticky-row code-file-sticky-compact-row`,style:H(0),title:i.node.path,onClick:e=>{e.preventDefault(),e.stopPropagation(),n(i.node)},children:[(0,z.jsx)(`span`,{className:`code-file-chevron expanded`,"aria-hidden":`true`,children:(0,z.jsx)(L,{})}),(0,z.jsx)(`span`,{className:`code-file-name`,children:Ol(r.map(e=>e.node))})]})]})})}function Ml({agentId:e,copy:t,fileOperation:n,inputRef:r,item:i,onCancel:a,onInputName:o,onSubmit:s}){return(0,R.useLayoutEffect)(()=>{let e=r.current;e&&(e.focus({preventScroll:!0}),document.activeElement===e&&e.setSelectionRange(0,Ze(n)))},[n.item?.path,r]),(0,z.jsx)(`form`,{className:`code-file-inline-operation`,"data-testid":`code-file-inline-operation`,style:{gridColumn:`3 / -1`},autoComplete:`off`,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),onSubmit:e=>{e.preventDefault(),e.stopPropagation(),s()},children:(0,z.jsx)(`input`,{id:`code-file-operation-input`,"data-testid":`code-file-operation-input`,name:`farming-file-${e}-rename`,type:`text`,inputMode:`text`,ref:r,defaultValue:n.name,"aria-label":t.renameEntry(i.name),autoComplete:`off`,"aria-autocomplete":`none`,autoCapitalize:`none`,autoCorrect:`off`,autoFocus:!0,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,onInput:e=>{o(e.currentTarget.value)},onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),a();return}e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),s())}})})}function Nl({copy:e,item:t,viewState:n}){let{directoryDotClassName:r,directoryDotTitleKind:i,fileChangedClassName:a,fileChangedTitleKind:o,fileOpening:s,isDirectory:c,showDirectoryDot:l,visibleGitStatus:u,visibleGitStatusClassName:d,visibleGitStatusLabel:f}=n;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`code-file-name`,children:t.displayName??t.name}),t.symbolicLink&&(0,z.jsx)(`span`,{className:`code-file-symbolic-link`,"aria-hidden":`true`,children:`↷`}),s&&(0,z.jsx)(`span`,{className:`code-file-open-spinner`,title:e.loading,"aria-hidden":`true`}),!s&&l&&(0,z.jsx)(`span`,{className:r,title:Ie(i,e)}),!s&&!c&&f&&(0,z.jsx)(`span`,{className:d,title:e.gitStatus(u||``),children:f}),!s&&!c&&!f&&a&&(0,z.jsx)(`span`,{className:a,title:Ie(o,e)})]})}function Pl(e){e?.focus({preventScroll:!0})}function Fl({isDirectory:e,item:t,lastFocusedFilePathRef:n,node:r,treeViewportRef:i,onCancelPendingFileFocus:a,onFocusFileTreeTarget:o,onOpenFileContextMenu:s,onOpenFilePath:c,onSetDirectoryOpen:l}){let u=(0,R.useCallback)(()=>{Pl(i.current?.querySelector(`[role="tree"]`))},[i]),d=(0,R.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),a(),n.current=t.path,r.select(),s(e.clientX,e.clientY,t)},[t,n,r,a,s]),f=(0,R.useCallback)(n=>{e||n.button!==0||n.metaKey||n.ctrlKey||n.shiftKey||c(t.path,{transient:!0})},[e,t.path,c]);return{handleRowClick:(0,R.useCallback)(s=>{a(),n.current=t.path;let d=xl({nodeType:t.type,metaKey:s.metaKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey}),f=e?kl(i.current?.closest(`.code-project-list`)):null;if(d===`toggle-directory`){s.preventDefault(),s.stopPropagation();let e=!r.isOpen;l(t.path,e),r.select(),r.focus(),u(),e?r.open():r.close(),o(t),f?.();return}if(d===`open-file`&&s.detail===0&&c(t.path,{transient:!0}),r.handleClick(s),r.focus(),u(),s.shiftKey){Pl(s.currentTarget),f?.();return}o(t),f?.()},[u,e,t,n,r,a,o,c,l,i]),handleRowContextMenu:d,handleRowMouseDown:f}}function Il({activeFilePath:e,agentId:t,copy:n,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,fileOperation:a,fileOperationInputRef:o,lastFocusedFilePathRef:s,locatedFilePath:c,node:l,openFilePendingPath:u,treeViewportRef:d,onCancelPendingFileFocus:f,onCloseFileOperation:p,onFocusFileTreeTarget:m,onOpenFileContextMenu:h,onOpenFilePath:g,onRememberFileOperationName:_,onSetDirectoryOpen:v,onSubmitFileOperation:y}){let b=l.data,x=Be({activeFilePath:e,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,openFilePendingPath:u,item:b,isFocused:l.isFocused,isOpen:l.isOpen,isSelected:l.isSelected}),{chevronState:S,isDirectory:C}=x,w=`${x.rowClasses} ${c===b.path?`located`:``}`.trim(),T=C?``:F(b.path),E=a?.kind===`rename`&&a.item?.path===b.path?a:null,{handleRowClick:D,handleRowContextMenu:O,handleRowMouseDown:k}=Fl({isDirectory:C,item:b,lastFocusedFilePathRef:s,node:l,treeViewportRef:d,onCancelPendingFileFocus:f,onFocusFileTreeTarget:m,onOpenFileContextMenu:h,onOpenFilePath:g,onSetDirectoryOpen:v});return(0,z.jsxs)(`div`,{className:w,style:H(l.level),"data-testid":`code-file-row`,"data-file-path":b.path,"data-file-type":b.type,"data-tree-level":l.level,"aria-label":b.path,title:b.linkTarget?`${b.path} ↷ ${b.linkTarget}`:b.linkError?`${b.path} (${b.linkError})`:void 0,tabIndex:-1,"aria-expanded":C?l.isOpen:void 0,onContextMenu:O,onMouseDown:k,onClick:D,children:[(0,z.jsx)(`span`,{className:`code-file-chevron ${S}`,"aria-hidden":`true`,children:S===`expanded`?(0,z.jsx)(L,{}):S===`collapsed`?(0,z.jsx)(I,{}):null}),!C&&(0,z.jsx)(`img`,{className:`code-file-type-icon file`,src:T,alt:``,"aria-hidden":`true`}),E?(0,z.jsx)(Ml,{agentId:t,copy:n,fileOperation:E,inputRef:o,item:b,onCancel:p,onInputName:_,onSubmit:y}):(0,z.jsx)(Nl,{copy:n,item:b,viewState:x})]})}function Ll({activeFilePath:e,agentId:t,copy:n,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,fileOperation:a,fileOperationInputRef:o,handleTreeKeyDownCapture:s,lastFocusedFilePathRef:c,locatedFilePath:l,openFilePendingPath:u,renderFileTreeRow:d,rowHeight:f,stickyContextItems:p,treeData:m,treeHeight:h,treeRef:g,treeViewportRef:_,visibleTreeRowCount:v,onCancelPendingFileFocus:y,onCloseFileOperation:b,onFocusFileTreeTarget:x,onFocusStickyDirectory:S,onOpenFileContextMenu:C,onOpenFilePath:w,onRememberFileOperationName:T,onSetDirectoryOpen:E,onSubmitFileOperation:D,onToggleTreeNode:O,onTreeFocus:k,onTreeSelect:A,onUpdateFileOperationName:j}){let ee=(0,R.useCallback)(e=>{e.target?.closest(`[data-file-path]`)||(e.preventDefault(),y(),C(e.clientX,e.clientY,null))},[y,C]),M=(0,R.useCallback)(({node:s})=>(0,z.jsx)(Il,{activeFilePath:e,agentId:t,copy:n,editorDirtyFilePaths:r,editorExternalChangedFilePaths:i,fileOperation:a,fileOperationInputRef:o,lastFocusedFilePathRef:c,locatedFilePath:l,node:s,openFilePendingPath:u,treeViewportRef:_,onCancelPendingFileFocus:y,onCloseFileOperation:b,onFocusFileTreeTarget:x,onOpenFileContextMenu:C,onOpenFilePath:w,onRememberFileOperationName:T,onSetDirectoryOpen:E,onSubmitFileOperation:D,onUpdateFileOperationName:j}),[e,t,n,r,i,a,o,c,l,y,b,x,C,w,T,E,D,j,u,_]);return(0,z.jsxs)(`div`,{className:`code-file-tree-viewport`,ref:_,"data-visible-row-count":v,style:{height:h},onKeyDownCapture:s,onContextMenu:ee,children:[(0,z.jsx)(jl,{copy:n,items:p,onFocusDirectory:S}),(0,z.jsx)(sl,{ref:g,data:m,idAccessor:`id`,childrenAccessor:`children`,rowHeight:f,indent:0,height:h,width:`100%`,overscanCount:v,openByDefault:!1,selectionFollowsFocus:!0,className:`code-file-tree`,rowClassName:`code-file-tree-row`,renderRow:d,onToggle:O,onFocus:k,onSelect:A,disableDrag:!0,disableEdit:!0,disableDrop:!0,children:M})]})}function Rl({copy:e,agentLaunchOptions:t,fileMenu:n,fileMenuRef:r,openFileError:i,rootDirectoryError:a,rootDirectoryHasItems:o,rootDirectoryLoading:s,search:c,searchActions:l,tree:u,onCloseFileMenu:d,onCloseFileMenuWithFocusRestore:f,onCopyFileMenuPath:p,onCopyFileMenuShareUrl:m,onOpenNewAgentFromFileMenu:h,onRefreshFileMenuTarget:g,onStartAgentFromFileMenu:_,onStartFileMenuOperation:v,readOnly:y=!1}){return(0,z.jsxs)(z.Fragment,{children:[s&&!o&&(0,z.jsx)(`div`,{className:`code-file-status`,style:H(0),children:e.loading}),a&&(0,z.jsx)(`div`,{className:`code-file-status error`,style:H(0),children:a}),i&&!c.active&&(0,z.jsx)(`div`,{className:`code-file-status error`,"data-testid":`code-file-open-error`,style:H(0),children:i}),c.active&&(0,z.jsx)(Pe,{activeMatchIndex:c.activeMatchIndex,anchorRef:c.anchorRef,containerRef:c.resultsRef,copy:e,error:c.error,jumpTarget:c.jumpTarget,listboxId:c.listboxId,loading:c.loading,matches:c.matches,openFileError:i,query:c.query,showIgnoredSearch:!c.includeIgnored,timeoutMs:c.timeoutMs,truncated:c.truncated,onOpenJumpQuery:l.onOpenJumpQuery,onOpenMatch:l.onOpenMatch,onSearchIgnored:l.onSearchIgnored,onSelectMatchIndex:l.onSelectMatchIndex}),(0,z.jsx)(Ll,{...u,copy:e}),(0,z.jsx)(tt,{agentId:u.agentId,copy:e,agentLaunchOptions:t,fileMenu:n,fileOperation:u.fileOperation,fileMenuRef:r,fileOperationInputRef:u.fileOperationInputRef,onCloseFileMenu:d,onCloseFileMenuWithFocusRestore:f,onCloseFileOperation:u.onCloseFileOperation,onCopyFileMenuPath:p,onCopyFileMenuShareUrl:m,onOpenNewAgent:h,onRefreshFileMenuTarget:g,onRememberFileOperationName:u.onRememberFileOperationName,onStartAgent:_,onStartFileMenuOperation:v,onSubmitFileOperation:u.onSubmitFileOperation,onUpdateFileOperationName:u.onUpdateFileOperationName,readOnly:y})]})}function zl({copy:e,filesCollapsed:t,search:n,onCancelPendingFileFocus:r,onFileSearchKeyDown:i,onSearchQueryChange:a,onToggleFilesCollapsed:o}){return(0,z.jsxs)(`div`,{className:`code-files-header ${t?`collapsed`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`code-files-title`,"aria-expanded":!t,onClick:o,children:[(0,z.jsx)(`span`,{className:`code-file-section-chevron ${t?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:t?(0,z.jsx)(I,{}):(0,z.jsx)(L,{})}),(0,z.jsx)(`span`,{children:e.files})]}),!t&&(0,z.jsxs)(`label`,{className:`code-file-search-box`,children:[(0,z.jsx)(`span`,{className:`code-file-search-icon`,"aria-hidden":`true`}),(0,z.jsx)(`input`,{ref:n.inputRef,type:`search`,name:`farming-file-search`,inputMode:`search`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,enterKeyHint:`search`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,value:n.query,onChange:e=>{r(),a(e.target.value)},onFocus:r,onPointerDown:e=>{r(),oe()&&(e.preventDefault(),e.currentTarget.focus({preventScroll:!0}))},onMouseDown:r,onKeyDownCapture:i,placeholder:e.searchOrPathLine,"aria-label":e.searchFilesOrJump,"aria-autocomplete":`list`,"aria-controls":n.active?n.listboxId:void 0,"aria-expanded":n.active,"aria-activedescendant":n.activeOptionId,role:`combobox`})]})]})}function Bl(e){return e.split(`/`).filter(Boolean).pop()||e}function Vl({activeFilePath:e,collapsed:t,copy:n,files:r,projectId:i,onCloseOpenFile:a,onOpenFileContextMenu:o,onSelectOpenFile:s,onToggleCollapsed:c}){let l=(0,R.useRef)(null),u=(0,R.useRef)(null),f=Math.min(r.length,7),p=(0,R.useMemo)(()=>({"--code-open-editors-visible-rows":f,"--code-open-editors-list-max-height":`${f*28}px`}),[f]);return(0,R.useEffect)(()=>{if(t)return;let e=l.current,n=u.current;if(!e||!n)return;let r=n.offsetTop,i=r+n.offsetHeight;r<e.scrollTop?e.scrollTop=r:i>e.scrollTop+e.clientHeight&&(e.scrollTop=i-e.clientHeight)},[e,t,r.length]),r.length===0?null:(0,z.jsxs)(`div`,{className:`code-open-editors ${t?`collapsed`:``}`,"data-testid":`code-open-editors`,"data-project-id":i,"data-open-editor-count":r.length,"data-visible-editor-count":f,style:p,children:[(0,z.jsx)(`div`,{className:`code-open-editors-header`,children:(0,z.jsxs)(`button`,{type:`button`,className:`code-open-editors-title`,"aria-expanded":!t,onClick:c,children:[(0,z.jsx)(`span`,{className:`code-file-section-chevron ${t?`collapsed`:`expanded`}`,"aria-hidden":`true`,children:t?(0,z.jsx)(I,{}):(0,z.jsx)(L,{})}),(0,z.jsx)(`span`,{children:n.openEditors})]})}),!t&&(0,z.jsx)(`div`,{ref:l,className:`code-open-editors-list`,children:r.map(t=>{let r=e===t.path,i=N(t);return(0,z.jsxs)(`div`,{ref:r?u:void 0,className:`code-open-editor-row ${r?`active`:``}`,"data-testid":`code-open-editor-row`,"data-file-path":t.path,title:t.path,onContextMenu:e=>{o&&(e.preventDefault(),o(e.clientX,e.clientY,t))},children:[(0,z.jsxs)(`button`,{type:`button`,className:`code-open-editor-main`,onClick:()=>s?.(t.agentId,t.path),children:[(0,z.jsx)(`img`,{className:`code-file-type-icon file`,src:F(t.path),alt:``,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`code-open-editor-name`,children:Bl(t.path)}),(0,z.jsx)(`span`,{className:`code-open-editor-path`,children:d(t.path)}),i&&(0,z.jsx)(`span`,{className:`code-open-editor-state ${i}`,title:i===`external`?n.changedOnDisk:n.unsavedChanges})]}),a&&(0,z.jsx)(`button`,{type:`button`,className:`code-open-editor-close`,"aria-label":n.closeFile(t.path),title:n.closeFile(t.path),onClick:()=>a(t.agentId,t.path,t.workspaceRoot)})]},t.key)})})]})}function Hl({activeFilePath:e,activeSearchOptionId:t,agentId:n,agentLaunchOptions:r,copy:i,editorDirtyFilePaths:a,editorExternalChangedFilePaths:o,fileMenu:s,fileMenuRef:c,fileOperation:l,fileOperationInputRef:u,fileSearch:d,fileSearchInputRef:f,fileSearchListboxId:p,fileSearchResultsRef:m,filesCollapsed:h,handleFileSearchKeyDown:g,handleTreeKeyDownCapture:_,lastFocusedFilePathRef:v,locatedFilePath:y,openEditorsCollapsed:b,openFileError:x,openFilePendingPath:S,projectId:C,renderFileTreeRow:w,rootDirectoryError:T,rootDirectoryHasItems:E,rootDirectoryLoading:D,rowHeight:O,readOnly:k=!1,stickyContextItems:A,treeData:j,treeHeight:ee,treeRef:M,treeViewportRef:te,visibleTreeRowCount:N,onCancelPendingFileFocus:ne,onCloseFileMenuWithFocusRestore:re,onCloseFileMenuWithoutFocus:ie,onCloseFileOperation:P,onCloseOpenFile:ae,onCopyFileMenuPath:oe,onCopyFileMenuShareUrl:se,onFocusFileTreeTarget:F,onFocusStickyDirectory:ce,onOpenFileContextMenu:le,onOpenFileJumpQuery:ue,onOpenFilePath:I,onOpenFileSearchMatch:L,onOpenNewAgentFromFileMenu:de,onRefreshFileMenuTarget:z,onRememberFileOperationName:fe,onSearchQueryChange:pe,onSelectOpenFile:me,onSelectSearchMatchIndex:he,onSetDirectoryOpen:ge,onStartAgentFromFileMenu:_e,onStartFileMenuOperation:ve,onSubmitFileOperation:ye,onToggleFilesCollapsed:be,onToggleOpenEditorsCollapsed:xe,onToggleTreeNode:Se,onTreeFocus:Ce,onTreeSelect:we,onUpdateFileOperationName:B}){let V=(0,R.useMemo)(()=>({active:d.active,activeOptionId:t,inputRef:f,listboxId:p,query:d.query}),[t,d.active,d.query,f,p]),Te=(0,R.useMemo)(()=>({active:d.active,activeMatchIndex:d.activeMatchIndex,anchorRef:f,error:d.error,includeIgnored:d.includeIgnored,jumpTarget:d.jumpTarget,listboxId:p,loading:d.loading,matches:d.matches,query:d.query,resultsRef:m,timeoutMs:d.timeoutMs,truncated:d.truncated}),[d.active,d.activeMatchIndex,d.error,d.includeIgnored,f,d.jumpTarget,d.loading,d.matches,d.query,d.timeoutMs,d.truncated,p,m]),Ee=(0,R.useMemo)(()=>({onOpenJumpQuery:ue,onOpenMatch:L,onSearchIgnored:d.searchIgnored,onSelectMatchIndex:he}),[ue,L,d.searchIgnored,he]),De=(0,R.useMemo)(()=>({activeFilePath:e,agentId:n,editorDirtyFilePaths:a,editorExternalChangedFilePaths:o,fileOperation:l,fileOperationInputRef:u,handleTreeKeyDownCapture:_,lastFocusedFilePathRef:v,locatedFilePath:y,openFilePendingPath:S,renderFileTreeRow:w,rowHeight:O,stickyContextItems:A,treeData:j,treeHeight:ee,treeRef:M,treeViewportRef:te,visibleTreeRowCount:N,onCancelPendingFileFocus:ne,onCloseFileOperation:P,onFocusFileTreeTarget:F,onFocusStickyDirectory:ce,onOpenFileContextMenu:le,onOpenFilePath:I,onRememberFileOperationName:fe,onSetDirectoryOpen:ge,onSubmitFileOperation:ye,onToggleTreeNode:Se,onTreeFocus:Ce,onTreeSelect:we,onUpdateFileOperationName:B}),[e,n,a,o,l,u,_,v,y,S,w,O,A,j,ee,M,te,N,ne,P,F,ce,le,I,fe,ge,ye,Se,Ce,we,B]);return{bodySearch:Te,bodySearchActions:Ee,bodyTree:De,fileMenu:s,fileMenuRef:c,filesCollapsed:h,headerSearch:V,openEditors:{activeFilePath:e,collapsed:b,copy:i,projectId:C,onCloseOpenFile:ae,onSelectOpenFile:me,onToggleCollapsed:xe},sectionBody:{copy:i,agentLaunchOptions:r,fileMenu:s,fileMenuRef:c,openFileError:x,rootDirectoryError:T,rootDirectoryHasItems:E,rootDirectoryLoading:D,search:Te,searchActions:Ee,tree:De,onCloseFileMenu:ie,onCloseFileMenuWithFocusRestore:re,onCopyFileMenuPath:oe,onCopyFileMenuShareUrl:se,onOpenNewAgentFromFileMenu:de,onRefreshFileMenuTarget:z,onStartAgentFromFileMenu:_e,onStartFileMenuOperation:ve,readOnly:k},sectionHeader:{copy:i,filesCollapsed:h,search:V,onCancelPendingFileFocus:ne,onFileSearchKeyDown:g,onSearchQueryChange:pe,onToggleFilesCollapsed:be}}}var Ul=200,Wl={error:null,items:[],loaded:!1,loading:!1,truncated:!1};function Gl(e,t){let[n,r]=(0,R.useState)(Wl),i=(0,R.useRef)(null),a=(0,R.useRef)(0),o=(0,R.useRef)(new Map),s=(0,R.useRef)(t),c=(0,R.useCallback)(()=>{if(!e){i.current?.abort(),a.current+=1,r(Wl);return}i.current?.abort();let t=new AbortController;i.current=t;let n=a.current+1;a.current=n,r(e=>({...e,error:null,loading:!0})),re(e,{limit:Ul,signal:t.signal}).then(e=>{a.current===n&&r({error:null,items:e.items,loaded:!0,loading:!1,truncated:e.truncated})}).catch(e=>{t.signal.aborted||a.current!==n||r(t=>({...t,error:e instanceof Error?e.message:`Failed to refresh changes`,loaded:!0,loading:!1}))})},[e]);return(0,R.useEffect)(()=>{s.current=t},[t]),(0,R.useEffect)(()=>{o.current=h(s.current,e),c()},[e,c]),(0,R.useEffect)(()=>{let n=o.current,r=h(t,e);o.current=r,_(n,r)&&c()},[e,t,c]),(0,R.useEffect)(()=>()=>{i.current?.abort()},[]),{...n,refreshChanges:c}}var Kl=50,ql=60,Jl=6e3,Yl=80,Xl=100,Zl=2;function Ql(e){e?.focus({preventScroll:!0})}function $l(){let e=document.activeElement;return e instanceof Element&&!!e.closest(`.code-file-monaco, .monaco-editor`)}function eu(e,t){let n=e.getBoundingClientRect(),r=t.closest(`.code-project-group`),i=t.closest(`.code-files-section`),a=[r?.querySelector(`.code-project-row`),r?.querySelector(`.code-agents-section`),r?.querySelector(`[data-testid="code-open-editors"]`),i?.querySelector(`.code-files-header`),i?.querySelector(`.code-file-sticky-stack`)].reduce((e,t)=>{if(!t)return e;let r=t.getBoundingClientRect();return r.height<=0||r.bottom<=n.top||r.top>=n.bottom?e:Math.max(e,r.bottom)},n.top);return{top:Math.min(a,n.bottom),bottom:n.bottom}}function tu(e,t=!1){let n=e.closest(`.code-project-list`);if(!n)return;let r=eu(n,e),i=e.getBoundingClientRect();n.scrollTop+=t?i.top-r.top-6:dl(r,i)}function nu({treeRef:e,treeViewportRef:t,fileSearchInputRef:n,fileOperationActiveRef:r,lastFocusedFilePathRef:i,treeData:a,isDirectoryLoaded:o,loadMissingDirectories:s,openDirectoriesInLayout:c,refreshTreeLayout:u}){let d=(0,R.useRef)(null),p=(0,R.useRef)([]),m=(0,R.useRef)(null),h=(0,R.useRef)([]),g=(0,R.useRef)([]),_=(0,R.useRef)([]),v=(0,R.useRef)([]),b=(0,R.useRef)(0),[x,C]=(0,R.useState)(null),w=(0,R.useRef)(null),T=(0,R.useRef)(a),E=(0,R.useRef)(o);(0,R.useEffect)(()=>{T.current=a},[a]),(0,R.useEffect)(()=>{E.current=o},[o]);let D=(0,R.useCallback)(()=>{C(null),w.current!==null&&(window.clearTimeout(w.current),w.current=null)},[]),O=(0,R.useCallback)(e=>{document.body.classList.contains(`code-file-location-dismissed`)||(D(),C(e),w.current=window.setTimeout(D,Jl))},[D]),k=(0,R.useCallback)(()=>{d.current!==null&&(window.cancelAnimationFrame(d.current),d.current=null),p.current.forEach(e=>window.clearTimeout(e)),p.current=[]},[]),A=(0,R.useCallback)(()=>{m.current!==null&&(window.cancelAnimationFrame(m.current),m.current=null),h.current.forEach(e=>window.clearTimeout(e)),h.current=[]},[]),j=(0,R.useCallback)(()=>{g.current.forEach(e=>window.clearTimeout(e)),g.current=[]},[]),ee=(0,R.useCallback)(()=>{b.current+=1,A(),j(),_.current.forEach(e=>window.cancelAnimationFrame(e)),_.current=[],v.current.forEach(e=>window.clearTimeout(e)),v.current=[]},[j,A]),M=(0,R.useCallback)(()=>{k(),ee(),D()},[k,ee,D]),te=(0,R.useCallback)((i,a=!1,o=!1)=>{A(),j();let s=!1,c=()=>{let e=0,n=0,r=()=>{n+=1;let a=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]).find(e=>e.dataset.filePath===i)??null;if(e=a?.classList.contains(`selected`)===!0?e+1:0,a&&e>=Zl){g.current=[],O(i);return}n>=Xl||(g.current=[window.setTimeout(r,Yl)])};r()},l=()=>{let e=n.current,s=fl({focusRow:a,operationActive:r.current,activeElementIsSearchInput:document.activeElement===e,searchInputValue:e?.value}),c=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]).find(e=>e.dataset.filePath===i);c&&(c.scrollIntoView({block:`nearest`}),tu(c,o),s&&Ql(c.closest(`[role="tree"]`)))},u=()=>{let t=e.current;if(a&&!s){s=!0,t?.get(i)?.select();let e=t?.scrollTo(i,o?`start`:`smart`);e&&e.then(()=>{window.requestAnimationFrame(l)})}l()};u(),m.current=window.requestAnimationFrame(()=>{u(),m.current=window.requestAnimationFrame(u)}),ll.forEach(e=>{let t=window.setTimeout(u,e);h.current.push(t)}),o&&c()},[j,A,r,n,O,e,t]),N=(0,R.useCallback)((t,n=0,r=!1,i)=>{let a=i??b.current+1;i===void 0&&(b.current=a);let o=()=>b.current===a,s=e.current,d=T.current,p=S(d,t,r),m=l(d,t)??t,h=f(d,m),g=!!s;if(c(p),r&&(h?.type!==`directory`||!E.current(t))&&(g=!1),s&&(p.forEach(e=>{s.get(e)?s.open(e):g=!1}),r&&s.get(m)&&s.open(m),s.get(m)||(g=!1)),!g&&n<ql){let e=window.setTimeout(()=>{v.current=v.current.filter(t=>t!==e),o()&&N(t,n+1,r,a)},Kl);v.current.push(e);return}(e=>{let t=window.requestAnimationFrame(()=>{_.current=_.current.filter(e=>e!==t),o()&&e()});_.current.push(t)})(()=>{o()&&(p.forEach(t=>e.current?.open(t)),u(p),te(m,!0,r))})},[c,u,te,e]),ne=(0,R.useCallback)(async e=>{await s([``,...y(e)]),N(e)},[s,N]),re=(0,R.useCallback)(async(e,t)=>{t===`directory`&&(document.body.classList.remove(`code-file-location-dismissed`),D()),await s([``,...y(e),...t===`directory`&&e?[e]:[]]),N(e,0,t===`directory`)},[D,s,N]),ie=(0,R.useCallback)(()=>{M();let e=(e=!1)=>{let t=n.current;t&&(pl({activeElementIsSearchInput:document.activeElement===t,searchInputValue:t.value})||(t.focus(),ml({requestedSelect:e,searchInputValue:t.value})&&t.select()))};e(!0),d.current=window.requestAnimationFrame(()=>e(!1)),cl.forEach(t=>{let n=window.setTimeout(()=>e(!1),t);p.current.push(n)})},[M,n]),P=(0,R.useCallback)(()=>{M();let r=()=>{if(n.current?.value)return;n.current?.blur();let r=t.current?.querySelector(`[role="tree"]`),a=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]),o=gl({lastFocusedPath:i.current,rows:a.map(e=>({path:e.dataset.filePath??``,selected:e.classList.contains(`selected`)})).filter(e=>e.path)});if(o&&a.find(e=>e.dataset.filePath===o)&&o){i.current=o,e.current?.get(o)?.select(),Ql(r);return}Ql(r)};r(),m.current=window.requestAnimationFrame(r),ll.forEach(e=>{let t=window.setTimeout(r,e);h.current.push(t)})},[M,n,i,e,t]),ae=(0,R.useCallback)(n=>{A();let r=()=>{if(!$l()){if(n){e.current?.get(n)?.select();let r=Array.from(t.current?.querySelectorAll(`[data-file-path]`)??[]).find(e=>e.dataset.filePath===n);if(Ql(r?.closest(`[role="tree"]`)??t.current?.querySelector(`[role="tree"]`)),r){r.scrollIntoView({block:`nearest`}),tu(r);return}}Ql(t.current?.querySelector(`[role="tree"]`))}};r(),m.current=window.requestAnimationFrame(()=>{m.current=null,r()}),[80,180,360].forEach(e=>{let t=window.setTimeout(r,e);h.current.push(t)})},[A,e,t]),oe=(0,R.useCallback)(e=>{ae(e?.path??null)},[ae]);return(0,R.useEffect)(()=>{if(!x)return;let e=e=>{let t=e.target;(t instanceof Element?t.closest(`[data-file-path]`):null)?.dataset.filePath!==x&&(document.body.classList.add(`code-file-location-dismissed`),D())};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,e,!0)}},[D,x]),(0,R.useEffect)(()=>()=>{M(),D()},[M,D]),{cancelPendingFileFocus:M,focusFileSearchInput:ie,focusFileTreeFromSearch:P,focusFileTreePath:ae,focusFileTreeTarget:oe,locatedFilePath:x,revealExplorerPath:re,revealFilePath:ne}}function ru(e){return e.replace(/^\/+|\/+$/g,``)}function iu(e,t=e){let[n,r]=(0,R.useState)({}),i=(0,R.useRef)({}),a=(0,R.useRef)(new Map),o=(0,R.useRef)(new Map),s=(0,R.useRef)(0),c=(0,R.useCallback)((t=``)=>{if(!e)return Promise.resolve(null);let n=ru(t),i=a.current.get(n);if(i)return i;let l=s.current;r(e=>({...e,[n]:{items:e[n]?.items??[],loading:!0,error:null}}));let u=null;return u=(async()=>{try{let t=await ie(e,n);if(s.current!==l)return null;if(r(e=>({...e,[n]:{items:t.items,loading:!1,error:null,gitStatusPending:t.gitStatusPending}})),t.gitStatusPending&&!o.current.has(n)){let e=window.setTimeout(()=>{o.current.delete(n),c(n)},2e3);o.current.set(n,e)}return t}catch(e){return s.current===l&&r(t=>({...t,[n]:{items:t[n]?.items??[],loading:!1,error:e instanceof Error?e.message:`Failed to load directory`}})),null}finally{u&&a.current.get(n)===u&&a.current.delete(n)}})(),a.current.set(n,u),u},[e]),l=(0,R.useCallback)(e=>{let t=ru(e),n=i.current[t];return!n||n.loading||n.error?c(t):Promise.resolve({path:t,items:n.items,gitStatusPending:n.gitStatusPending})},[c]);return(0,R.useEffect)(()=>{i.current=n},[n]),(0,R.useEffect)(()=>{s.current+=1,a.current.clear(),o.current.forEach(e=>window.clearTimeout(e)),o.current.clear()},[e,t]),(0,R.useEffect)(()=>{r({}),i.current={}},[t]),(0,R.useEffect)(()=>()=>{a.current.clear(),o.current.forEach(e=>window.clearTimeout(e)),o.current.clear()},[]),(0,R.useMemo)(()=>({directories:n,loadDirectory:c,ensureDirectoryLoaded:l}),[n,l,c])}var au=12;function ou(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function su(e,t=e){let n=t||``,{directories:r,loadDirectory:i,ensureDirectoryLoaded:a}=iu(e,t),[o,s]=(0,R.useState)(()=>new Set(j(n).openDirectoryPaths??[])),c=(0,R.useRef)(n),l=(0,R.useRef)(o.size>0),d=(0,R.useRef)(new Map),p=(0,R.useRef)(``),m=(0,R.useMemo)(()=>u(r[``]?.items??[],r),[r]),h=(0,R.useMemo)(()=>Math.max(1,v(m,o)),[o,m]),g=(0,R.useCallback)(e=>{s(t=>{let n=new Set(e);return l.current?t.forEach(e=>n.add(e)):t.forEach(e=>{f(m,e)||n.add(e)}),ou(t,n)?t:n})},[m]),_=(0,R.useCallback)(()=>{l.current=!1},[]),y=(0,R.useCallback)((e,t)=>{s(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),b=(0,R.useCallback)(e=>{e.length!==0&&s(t=>{let n=!1,r=new Set(t);return e.forEach(e=>{!e||r.has(e)||(r.add(e),n=!0)}),n?r:t})},[]),x=(0,R.useCallback)(()=>i(``),[i]),S=(0,R.useCallback)(e=>{let t=e.filter(e=>!r[e]);return Promise.all(t.map(e=>i(e)))},[r,i]),C=(0,R.useCallback)(e=>{let t=r[e];return!!(t&&!t.loading&&!t.error)},[r]),w=(0,R.useCallback)(e=>{Array.from(new Set(e.map(e=>e??``))).forEach(e=>{i(e)})},[i]),T=(0,R.useCallback)(e=>{let t=d.current.get(e);if(t)return t;let n;return n=(async()=>{let t=e;for(let e=0;e<au;e+=1){let e=await a(t),n=e?.items.length===1&&e.items[0]?.type===`directory`?e.items[0]:null;if(!n)return;t=n.path}})().finally(()=>{d.current.get(e)===n&&d.current.delete(e)}),d.current.set(e,n),n},[a]);return(0,R.useEffect)(()=>{d.current.clear()},[e]),(0,R.useEffect)(()=>{c.current===n&&k(n,{openDirectoryPaths:Array.from(o)})},[n,o]),(0,R.useEffect)(()=>{if(c.current===n)return;c.current=n,p.current=``;let e=j(n).openDirectoryPaths??[];l.current=e.length>0,s(new Set(e))},[n]),(0,R.useEffect)(()=>{if(o.size===0)return;let e=`${n}:${Array.from(o).join(`
12
- `)}`;p.current!==e&&(p.current=e,x(),S(Array.from(o)))},[S,x,n,o]),(0,R.useMemo)(()=>({directories:r,treeData:m,openDirectoryPaths:o,visibleTreeRowCount:h,loadRootDirectory:x,ensureDirectoryLoaded:a,isDirectoryLoaded:C,loadMissingDirectories:S,refreshDirectories:w,hydrateCompactDirectoryChains:T,syncOpenDirectoryPaths:g,finishRestoringOpenDirectoryPaths:_,setDirectoryOpen:y,openDirectoriesInLayout:b}),[r,a,T,C,S,x,b,o,w,y,g,_,m,h])}function cu({agentId:e,agentLaunchOptionCount:t=0,cancelPendingFileFocus:n,clearFileOperation:r,focusFileTreeTarget:a,refreshDirectories:o,projectWorkspace:s,shareLinkFailed:c,setOpenFileError:l,startFileOperation:u}){let d=(0,R.useRef)(null),[f,p]=(0,R.useState)(null),m=(0,R.useCallback)(()=>{p(null)},[]),h=(0,R.useCallback)((e,i,a)=>{n(),l(null),r(),p({...$e(e,i,a,window.innerWidth,window.innerHeight,t),item:a})},[t,n,r,l]),g=(0,R.useCallback)((e=!1)=>{let t=f?.item??null;p(null),e&&a(t)},[f?.item,a]),_=(0,R.useCallback)(()=>{g(!1)},[g]),v=(0,R.useCallback)(()=>{g(!0)},[g]),y=(0,R.useCallback)((e,t=f?.item??null)=>{n(),p(null),u(e,t)},[n,f?.item,u]),b=(0,R.useCallback)(()=>{e&&(o([Je(f?.item??null)]),p(null))},[e,f?.item,o]);return{fileMenu:f,fileMenuRef:d,clearFileMenu:m,closeFileMenuWithFocusRestore:v,closeFileMenuWithoutFocus:_,copyFileMenuPath:(0,R.useCallback)(async()=>{let e=f?.item;if(e){p(null),l(null);try{await navigator.clipboard?.writeText(e.path)}catch{l(`Copy failed`)}}},[f?.item,l]),copyFileMenuShareUrl:(0,R.useCallback)(async()=>{let t=f?.item;if(!(!e||!t||t.type!==`file`&&t.type!==`directory`)){p(null),l(null);try{let n=t.type===`directory`?{kind:`folder`,agentId:e,folderPath:t.path,absolutePath:w(s,t.path),projectLabel:D(s)}:{kind:`file`,agentId:e,filePath:t.path,absolutePath:w(s,t.path),projectLabel:D(s)},r=await fetch(i(`/api/share/qr-ticket`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:n})}),a=await r.json();if(!r.ok||!a.longUrl||!await A(a.longUrl))throw Error(a.error||c)}catch(e){l(e instanceof Error?e.message:c)}}},[e,f?.item,s,l,c]),fileMenuTargetDirectory:(0,R.useCallback)((e=f?.item??null)=>Je(e),[f?.item]),openFileContextMenu:h,refreshFileMenuTarget:b,startFileMenuOperation:y}}var lu=220;function uu({agentId:e,onClearSearch:t,onOpenFile:n,onRevealFilePath:r,onSelectOpenFile:i}){let a=(0,R.useRef)(0),o=(0,R.useRef)(null),[s,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null),f=(0,R.useCallback)(()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null),d(null)},[]),p=(0,R.useCallback)((e,t)=>{f(),o.current=window.setTimeout(()=>{a.current===e&&d(t),o.current=null},lu)},[f]);return(0,R.useEffect)(()=>()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)},[]),{openFileError:s,openFilePendingPath:u,openFilePath:(0,R.useCallback)(async(o,s)=>{if(!e)return;let u=a.current+1;if(a.current=u,l(null),i?.(e,o,s)){f(),t(),c(s)&&r(o);return}p(u,o);try{let i=await ue(e,o);if(a.current!==u)return;f(),n(e,i,s),t(),c(s)&&r(o)}catch(r){if(a.current!==u)return;if(f(),s&&r instanceof ce&&r.status===404&&M(s)){n(e,ee(o,s),s),t();return}l(r instanceof Error?r.message:`Failed to open file`)}},[e,f,t,n,r,i,p]),setOpenFileError:l}}function du({agentId:e,fileOperationActiveRef:t,ensureDirectoryLoaded:n,focusFileTreePath:r,onDeleteEntries:i,onMoveEntries:a,onOpenFile:o,onWorkspaceChange:c,refreshDirectories:l,setOpenFileError:u}){let d=(0,R.useRef)(null),f=(0,R.useRef)(``),[m,h]=(0,R.useState)(null),_=(0,R.useCallback)(()=>{t.current=!1,h(null)},[]),v=(0,R.useCallback)((e,n)=>{if(n?.readOnly&&!(n.symbolicLink&&(e===`rename`||e===`delete`)))return;let r=Xe(e,n);f.current=r.name,t.current=!0,u(null),h(r)},[u]),y=(0,R.useCallback)(()=>{let e=m?.item??null;_(),r(e?.path??null)},[_,m?.item,r]),b=(0,R.useCallback)(e=>{f.current=e},[]),x=(0,R.useCallback)(e=>{f.current=e,h(t=>t&&{...t,name:e})},[]),S=(0,R.useCallback)(async()=>{if(!e||!m)return;let t=m.kind===`delete`?m:{...m,name:f.current},d=Qe(t);if(!(t.kind!==`delete`&&!d)){u(null);try{if(t.kind===`new-file`||t.kind===`new-folder`){let i=await ae(e,t.parentPath,d,t.kind===`new-folder`?`directory`:`file`);l([t.parentPath]),i.entry.type===`directory`&&(n(i.entry.path),r(i.entry.path)),i.file&&o(e,i.file),c?.(),_();return}if(t.kind===`rename`&&t.item){let n=await se(e,t.item.path,d);l(s(n)),a(e,[n]),c?.(),_(),r(te(n));return}if(t.kind===`delete`&&t.item){let n=await ne(e,t.item.path);l(g(n)),i(e,[n]),c?.(),_(),r(p(n))}}catch(e){u(e instanceof Error?e.message:`File operation failed`)}}},[e,_,n,m,r,i,a,o,c,l,u]);return(0,R.useEffect)(()=>{if(!m)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),y())};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[y,m]),{fileOperation:m,fileOperationActiveRef:t,fileOperationInputRef:d,clearFileOperation:_,closeFileOperation:y,rememberFileOperationName:b,startFileOperation:v,submitFileOperation:S,updateFileOperationName:x}}var fu=3e3;function pu(e){let[t,n]=(0,R.useState)(``),[r,i]=(0,R.useState)([]),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(0),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(fu),[h,g]=(0,R.useState)(!1),_=(0,R.useRef)(0),v=t.trim().length>0,y=(0,R.useMemo)(()=>v?be(t):null,[v,t]),b=r.length>0?Math.min(l,r.length-1):-1,x=b>=0?r[b]??null:null,S=(0,R.useCallback)(()=>{_.current+=1,n(``),i([]),c(null),u(0),f(!1),m(fu),g(!1),o(!1)},[]),C=(0,R.useCallback)(e=>{g(!1),n(e)},[]),w=(0,R.useCallback)(()=>{g(!0)},[]),T=(0,R.useCallback)(()=>{r.length!==0&&u(e=>Math.min(e+1,r.length-1))},[r.length]),E=(0,R.useCallback)(()=>{r.length!==0&&u(e=>Math.max(e-1,0))},[r.length]),D=(0,R.useCallback)(e=>{u(Math.max(0,Math.min(e,Math.max(r.length-1,0))))},[r.length]);return(0,R.useEffect)(()=>{let n=t.trim(),r=_.current+1;if(_.current=r,u(0),!e||!n||be(n)){i([]),o(!1),c(null),f(!1);return}o(!0),c(null);let a=new AbortController,s=window.setTimeout(()=>{P(e,n,{includeIgnored:h,limit:60,signal:a.signal}).then(e=>{_.current===r&&(i(e.matches),f(e.truncated),m(e.timeoutMs??fu),o(!1))}).catch(e=>{_.current===r&&(e instanceof DOMException&&e.name===`AbortError`||(i([]),f(!1),c(e instanceof Error?e.message:`Search failed`),o(!1)))})},180);return()=>{window.clearTimeout(s),a.abort()}},[e,h,t]),(0,R.useEffect)(()=>{u(e=>Math.min(e,Math.max(r.length-1,0)))},[r.length]),(0,R.useMemo)(()=>({query:t,setQuery:C,matches:r,loading:a,error:s,selectMatchIndex:D,truncated:d,timeoutMs:p,includeIgnored:h,active:v,jumpTarget:y,activeMatchIndex:b,selectedMatch:x,clear:S,searchIgnored:w,selectNext:T,selectPrevious:E}),[v,b,S,s,y,a,r,h,w,t,D,T,E,x,d,p])}function mu({fileMenuOpen:e,fileOperationActive:t,fileSearch:n,fileSearchResultsRef:r,filesCollapsed:i,focusFileTreeFromSearch:a,listboxId:o,onOpenFilePath:s,onRevealDirectoryPath:c}){let l=we({active:n.active,activeMatchIndex:n.activeMatchIndex,jumpTarget:n.jumpTarget,listboxId:o}),u=(0,R.useCallback)(e=>{if(e.kind===`path`&&e.entryType===`directory`){c(e.path),n.clear();return}let t=Se(e);s(t.path,t.target),n.clear()},[n,s,c]),d=(0,R.useCallback)(e=>{let t=Ce(e);return t?(s(t.path,t.target),n.clear(),!0):!1},[n,s]),f=(0,R.useCallback)(e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n.clear(),a();return}if(e.key===`ArrowDown`){if(n.matches.length===0)return;e.preventDefault(),n.selectNext();return}if(e.key===`ArrowUp`){if(n.matches.length===0)return;e.preventDefault(),n.selectPrevious();return}if(e.key!==`Enter`||(e.preventDefault(),e.stopPropagation(),d(e.currentTarget.value)))return;let t=n.selectedMatch??n.matches[0];t&&u(t)},[n,a,d,u]);return(0,R.useEffect)(()=>{if(!n.active||n.matches.length===0)return;let e=r.current,t=e?.querySelector(`.code-file-search-result.active`);if(!e||!t)return;let i=t.offsetTop,a=i+t.offsetHeight;i<e.scrollTop?e.scrollTop=i:a>e.scrollTop+e.clientHeight&&(e.scrollTop=a-e.clientHeight)},[n.active,n.activeMatchIndex,n.matches.length,r]),(0,R.useEffect)(()=>{if(i||!n.active||e||t)return;let r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n.clear(),a())};return document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`keydown`,r,!0)}},[e,t,n,i,a]),{activeOptionId:l,handleFileSearchKeyDown:f,openFileJumpQuery:d,openFileSearchMatch:u}}function hu({agentId:e,workspaceKey:t,clearFileMenu:n,clearFileOperation:r,clearFileSearch:i,focusFileSearchInput:a,focusSearchRequest:o,loadRootDirectory:s,openFilesCount:c,refreshTreeLayout:l,revealExplorerPath:u,revealRequest:d,rootDirectoryLoaded:f,setFileSearchQuery:p,setOpenFileError:m,treeData:h}){let[g,_]=(0,R.useState)(()=>j(t).filesCollapsed??!0),[v,y]=(0,R.useState)(!0),b=(0,R.useRef)(null),x=(0,R.useRef)(t),S=(0,R.useCallback)(()=>{let e=!g;e?(n(),r(),i()):f||s(),_(e)},[n,r,i,g,s,f]),C=(0,R.useCallback)(()=>{y(e=>!e)},[]);return(0,R.useEffect)(()=>{m(null),n(),r(),i()},[e,n,r,i,m]),(0,R.useEffect)(()=>{if(d){if(_(!1),!f){s();return}b.current!==d.requestId&&(b.current=d.requestId,u(d.path,d.kind))}},[s,u,d,f]),(0,R.useEffect)(()=>{o&&(_(!1),f||s(),typeof o.query==`string`&&p(o.query),a())},[a,o,s,f,p]),(0,R.useEffect)(()=>{c===0&&y(!0)},[c]),(0,R.useEffect)(()=>{x.current===t&&k(t,{filesCollapsed:g})},[g,t]),(0,R.useEffect)(()=>{x.current!==t&&(x.current=t,_(j(t).filesCollapsed??!0))},[t]),(0,R.useEffect)(()=>{!g&&!f&&s()},[g,s,f]),(0,R.useEffect)(()=>{g||l()},[g,l,h]),{filesCollapsed:g,openEditorsCollapsed:v,toggleFilesCollapsed:S,toggleOpenEditorsCollapsed:C}}function gu(e,t){let n=t.closest(`.code-project-group`),r=n?.querySelector(`.code-project-row`),i=n?.querySelector(`.code-agents-section`),a=n?.querySelector(`[data-testid="code-open-editors"]`);return Cl(e.getBoundingClientRect().top,r?.getBoundingClientRect().height??30,(i?.getBoundingClientRect().height??0)+(a?.getBoundingClientRect().height??0),25)}function _u({filesCollapsed:e,focusFileTreePath:t,lastFocusedFilePathRef:n,openDirectoryPaths:r,refreshTreeLayout:i,resetKey:a,treeData:o,treeViewportRef:s}){let[c,l]=(0,R.useState)([]),[u,d]=(0,R.useState)(!1),p=(0,R.useMemo)(()=>c.map(e=>f(o,e)).filter(e=>!!e),[c,o]),m=(0,R.useMemo)(()=>Dl({visible:u,directoryNodes:p}),[u,p]),h=(0,R.useCallback)(()=>{l(e=>e.length===0?e:[]),d(!1)},[]),g=(0,R.useCallback)(()=>{let t=s.current,n=t?.closest(`.code-project-list`);if(!t||!n||e){h();return}let r=n.getBoundingClientRect(),i=gu(n,t),a=t.getBoundingClientRect(),o=Array.from(t.querySelectorAll(`[data-file-path]`)).flatMap(e=>{let t=e.dataset.filePath;if(!t)return[];let n=e.getBoundingClientRect();return[{path:t,top:n.top,bottom:n.bottom}]}),c=Tl(o,i,r.bottom);if(!c){h();return}d(wl(a.top,i));let u=El(c,o,i);l(e=>e.length===u.length&&e.every((e,t)=>e===u[t])?e:u)},[h,e,s]),_=(0,R.useCallback)(e=>{n.current=e.path,t(e.path)},[t,n]);return(0,R.useEffect)(()=>{h()},[h,a]),(0,R.useEffect)(()=>{if(e){h();return}i();let t=window.requestAnimationFrame(()=>i()),n=window.setTimeout(i,80),r=window.setTimeout(i,180);return()=>{window.cancelAnimationFrame(t),window.clearTimeout(n),window.clearTimeout(r)}},[h,e,r,i,o]),(0,R.useEffect)(()=>{if(e)return;let t=s.current?.closest(`.code-project-list`),n=0,r=()=>{n||=window.requestAnimationFrame(()=>{n=0,g()})};return g(),window.setTimeout(g,80),t?.addEventListener(`scroll`,r,{passive:!0}),window.addEventListener(`resize`,r),()=>{n&&window.cancelAnimationFrame(n),t?.removeEventListener(`scroll`,r),window.removeEventListener(`resize`,r)}},[e,r,g,o,s]),{focusStickyDirectory:_,stickyContextItems:m}}function vu({rowHeight:e,visibleTreeRowCount:t,openDirectoryPaths:n,treeData:r,hydrateCompactDirectoryChains:i,finishRestoringOpenDirectoryPaths:a,setDirectoryOpen:o,syncOpenDirectoryPaths:s}){let c=(0,R.useRef)(void 0),l=(0,R.useRef)(null),u=(0,R.useRef)(null),d=(0,R.useRef)(new Set),f=(0,R.useRef)(new Set),p=Math.max(e,t*e),m=(0,R.useCallback)(()=>{let e=c.current;if(!e)return;let t=new Set;e.visibleNodes.forEach(e=>{e.data.type===`directory`&&e.isOpen&&t.add(e.data.path)}),s(t)},[s]),h=(0,R.useCallback)(e=>{if(e.length===0)return!1;let t=c.current;if(!t)return!1;let n=!1;return e.forEach(e=>{!e||!t.get(e)||d.current.has(e)||t.isOpen(e)||(t.open(e,!1),n=!0)}),n},[]),g=(0,R.useCallback)((e=[])=>{let t=(t=!1)=>{h(e),c.current?.redrawList(),t&&(h(e),m())};t(),window.requestAnimationFrame(()=>t(!0)),window.setTimeout(()=>t(!0),80)},[h,m]),_=(0,R.useCallback)((e,t)=>{t?(d.current.delete(e),f.current.delete(e)):(d.current.add(e),f.current.delete(e)),o(e,t)},[o]);(0,R.useEffect)(()=>{d.current.forEach(e=>{if(!n.has(e)){f.current.add(e);return}f.current.has(e)&&(d.current.delete(e),f.current.delete(e))})},[n]),(0,R.useEffect)(()=>{let e=Array.from(n);if(e.length===0)return;let t=()=>{h(e)&&c.current?.redrawList(),e.every(e=>!!c.current?.get(e))&&a()};t();let r=window.requestAnimationFrame(t),i=window.setTimeout(t,80),o=window.setTimeout(t,180);return()=>{window.cancelAnimationFrame(r),window.clearTimeout(i),window.clearTimeout(o)}},[a,n,h,r]);let v=(0,R.useCallback)(({attrs:e,innerRef:t,children:n})=>{let{style:r,className:i,...a}=e;return(0,R.createElement)(`div`,{...a,ref:t,style:{...r,minWidth:`100%`,width:`100%`},className:`code-file-tree-row-frame ${i??``}`.trim()},n)},[]);return{treeRef:c,treeViewportRef:l,lastFocusedFilePathRef:u,treeHeight:p,handleTreeToggle:(0,R.useCallback)(e=>{kl(l.current?.closest(`.code-project-list`));let t=null,n=()=>{let n=d.current.has(e)?!1:!!c.current?.get(e)?.isOpen;t!==n&&(t=n,o(e,n),n?i(e).finally(g):g())};n(),window.requestAnimationFrame(n),window.setTimeout(n,80)},[i,g,o]),refreshTreeLayout:g,rememberFocusedTreeNode:(0,R.useCallback)(e=>{e&&(u.current=e.data.path)},[]),rememberSelectedTreeNodes:(0,R.useCallback)(e=>{let t=e[e.length-1];t&&(u.current=t.data.path)},[]),renderFileTreeRow:v,setTreePathOpen:_}}function yu({treeRef:e,treeViewportRef:t,lastFocusedFilePathRef:n,fileOperation:r,openDirectoryPaths:i,cancelPendingFileFocus:a,closeFileOperation:o,focusFileSearchInput:s,focusFileTreePath:c,focusFileTreeTarget:l,openFileContextMenu:u,openFilePath:d,startFileOperation:f}){let p=(0,R.useCallback)(()=>t.current?.closest(`.code-project-list`)??null,[t]),m=(0,R.useCallback)(()=>{let e=t.current,n=(e?.querySelector(`[data-file-path]`))?.getBoundingClientRect().height||24;return vl((p()??e)?.getBoundingClientRect().height??n,n)},[p,t]),h=(0,R.useCallback)(e=>{kl(p()),e.open(),n.current=e.data.path,l(e.data)},[l,n,p]),g=(0,R.useCallback)((t,r)=>{kl(p()),r?r.close():e.current?.close(t),n.current=t,r?l(r.data):c(t)},[c,l,n,p,e]),_=(0,R.useCallback)(c=>{if(c.defaultPrevented||c.altKey)return;if((c.ctrlKey||c.metaKey)&&!c.shiftKey&&c.key.toLowerCase()===`p`){c.preventDefault(),c.stopPropagation(),s();return}if(c.ctrlKey||c.metaKey)return;let p=e.current,_=c.target;if(r&&c.key===`Escape`&&_?.closest(`.code-file-inline-operation`)){c.preventDefault(),c.stopPropagation(),o();return}if(_?.closest(`input, textarea, [contenteditable="true"], .code-file-inline-operation`))return;hl(c.key)&&a();let v=_?.closest(`[data-file-path]`)?.dataset.filePath,y=v?void 0:t.current?.querySelector(`[data-file-path].selected`),b={path:y?.dataset.filePath,type:y?.dataset.fileType,expanded:y?.getAttribute(`aria-expanded`)===`true`},x=p?.focusedNode&&!p.focusedNode.isRoot?p.focusedNode:null,S=_l({targetPath:v,selectedPath:b.path,focusedPath:x?.data.path,lastFocusedPath:n.current}),C=S?p?.get(S):p?.focusedNode??p?.mostRecentNode;if(!C||C.isRoot)return;if(n.current=C.data.path,c.key===`ContextMenu`||c.shiftKey&&c.key===`F10`){c.preventDefault(),c.stopPropagation();let e=(c.target?.closest(`[data-file-path]`))?.getBoundingClientRect();u(e?e.left+24:24,e?e.top+e.height:24,C.data);return}if(c.shiftKey)return;if(c.key===`ArrowDown`||c.key===`ArrowUp`){c.preventDefault(),c.stopPropagation();let e=c.key===`ArrowDown`?C.next:C.prev;if(!e||e.isRoot)return;e.focus(),e.select(),n.current=e.data.path;return}if(c.key===`Home`||c.key===`End`){c.preventDefault(),c.stopPropagation();let e=p?.visibleNodes.filter(e=>!e.isRoot)??[],t=c.key===`Home`?e[0]:e[e.length-1];if(!t)return;t.focus(),t.select(),n.current=t.data.path,l(t.data);return}if(c.key===`PageUp`||c.key===`PageDown`){c.preventDefault(),c.stopPropagation();let e=p?.visibleNodes.filter(e=>!e.isRoot)??[],t=yl({currentIndex:e.findIndex(e=>e.id===C.id),key:c.key,pageSize:m(),rowCount:e.length}),r=t>=0?e[t]:null;if(!r)return;r.focus(),r.select(),n.current=r.data.path,l(r.data);return}if(c.key===`F2`){c.preventDefault(),c.stopPropagation(),f(`rename`,C.data);return}if(c.key===`Delete`||c.key===`Backspace`){c.preventDefault(),c.stopPropagation(),f(`delete`,C.data);return}if(c.key===`ArrowRight`){if(C.data.type!==`directory`)return;if(c.preventDefault(),c.stopPropagation(),!C.isOpen){h(C);return}let e=C.children?.[0]??null;e&&(e.select(),e.focus(),n.current=e.data.path,l(e.data));return}if(c.key===`ArrowLeft`){if(c.preventDefault(),c.stopPropagation(),bl({nodePath:C.data.path,nodeType:C.data.type,nodeOpen:C.isOpen,selectedRow:b,openDirectoryPaths:i})){g(C.data.path,C);return}let e=C.parent;e&&!e.isRoot&&(e.select(),e.focus(),n.current=e.data.path,l(e.data));return}if(c.key!==`Enter`&&c.key!==` `)return;c.preventDefault(),c.stopPropagation();let w=Sl({nodeType:C.data.type,nodeOpen:C.isOpen});if(w===`close-directory`){g(C.data.path,C);return}if(w===`open-directory`){h(C);return}w===`open-file`&&(n.current=C.data.path,d(C.data.path))},[a,o,g,r,s,l,n,h,i,u,d,m,f,e,t]);return(0,R.useEffect)(()=>{let n=n=>{if(n.key!==`ArrowLeft`||n.altKey||n.ctrlKey||n.metaKey)return;let r=t.current,i=document.activeElement;if(!r||!(i instanceof Element)||!r.contains(i))return;let a=r.querySelector(`[data-file-path].selected`),o=a?.dataset.filePath;if(!o||a?.dataset.fileType!==`directory`||a.getAttribute(`aria-expanded`)!==`true`)return;n.preventDefault(),n.stopPropagation();let s=e.current?.get(o);g(o,s)};return window.addEventListener(`keydown`,n,!0),()=>{window.removeEventListener(`keydown`,n,!0)}},[g,e,t]),{handleTreeKeyDownCapture:_}}var bu=24,xu=new Set;function Su(e){return e.replace(/[^a-zA-Z0-9_-]+/g,`-`)||`root`}function Cu(e,t){let n=e.replace(/\/+$/,``)||`/`,r=t.replace(/^\/+|\/+$/g,``);return r?n===`/`?`/${r}`:`${n}/${r}`:n}function wu(e){return e.split(`/`).filter(Boolean).pop()||e}function Tu(e){return{id:e.path,name:wu(e.path),path:e.path,type:`file`,size:0,mtimeMs:0}}function Eu({projectId:e,projectWorkspace:t,agentId:n,agentLaunchOptions:r,activeFilePath:i,revealRequest:a,focusSearchRequest:o,editorDirtyFilePaths:s=xu,editorExternalChangedFilePaths:c=xu,openFiles:l=[],onOpenFile:u,onSelectOpenFile:d,onCloseOpenFile:f,onNewAgent:p,onStartAgent:h,onMoveEntries:g,onDeleteEntries:_,onFilesCollapsedChange:v,readOnly:y=!1,copy:b}){let{directories:x,treeData:S,openDirectoryPaths:C,visibleTreeRowCount:w,loadRootDirectory:T,ensureDirectoryLoaded:E,isDirectoryLoaded:D,loadMissingDirectories:O,refreshDirectories:k,hydrateCompactDirectoryChains:A,finishRestoringOpenDirectoryPaths:j,syncOpenDirectoryPaths:ee,setDirectoryOpen:M,openDirectoriesInLayout:te}=su(n,e),N=(0,R.useRef)(!1),ne=(0,R.useRef)(null),re=(0,R.useRef)(null),ie=(0,R.useRef)(null),P=pu(n),ae=`code-file-search-results-${Su(e)}`,{treeRef:oe,treeViewportRef:se,lastFocusedFilePathRef:F,treeHeight:ce,handleTreeToggle:le,refreshTreeLayout:ue,rememberFocusedTreeNode:I,rememberSelectedTreeNodes:L,renderFileTreeRow:de,setTreePathOpen:fe}=vu({rowHeight:bu,visibleTreeRowCount:w,openDirectoryPaths:C,treeData:S,hydrateCompactDirectoryChains:A,finishRestoringOpenDirectoryPaths:j,setDirectoryOpen:M,syncOpenDirectoryPaths:ee}),{cancelPendingFileFocus:pe,focusFileSearchInput:me,focusFileTreeFromSearch:he,focusFileTreePath:ge,focusFileTreeTarget:_e,locatedFilePath:ve,revealExplorerPath:be,revealFilePath:xe}=nu({treeRef:oe,treeViewportRef:se,fileSearchInputRef:ne,fileOperationActiveRef:N,lastFocusedFilePathRef:F,treeData:S,isDirectoryLoaded:D,loadMissingDirectories:O,openDirectoriesInLayout:te,refreshTreeLayout:ue}),Se=P.clear,{openFileError:Ce,openFilePendingPath:we,openFilePath:B,setOpenFileError:V}=uu({agentId:n,onClearSearch:Se,onOpenFile:u,onRevealFilePath:xe,onSelectOpenFile:d}),Te=Gl(y?null:n,l),[Ee,De]=(0,R.useState)(!0);(0,R.useEffect)(()=>{De(!0)},[n]);let Oe=(0,R.useCallback)(()=>{De(e=>!e)},[]),ke=(0,R.useCallback)(e=>{B(e.path,{...m(e),transient:!0})},[B]),{fileOperation:Ae,fileOperationInputRef:je,clearFileOperation:Me,closeFileOperation:Ne,rememberFileOperationName:Pe,startFileOperation:Fe,submitFileOperation:Ie,updateFileOperationName:H}=du({agentId:n,fileOperationActiveRef:N,ensureDirectoryLoaded:E,focusFileTreePath:ge,onDeleteEntries:_,onMoveEntries:g,onOpenFile:u,onWorkspaceChange:Te.refreshChanges,refreshDirectories:k,setOpenFileError:V}),{fileMenu:Le,fileMenuRef:Re,clearFileMenu:ze,closeFileMenuWithFocusRestore:Be,closeFileMenuWithoutFocus:Ve,copyFileMenuPath:He,copyFileMenuShareUrl:Ue,fileMenuTargetDirectory:We,openFileContextMenu:Ge,refreshFileMenuTarget:Ke,startFileMenuOperation:qe}=cu({agentId:n,agentLaunchOptionCount:r.length,cancelPendingFileFocus:pe,clearFileOperation:Me,focusFileTreeTarget:_e,projectWorkspace:t,refreshDirectories:k,shareLinkFailed:b.shareLinkFailed,setOpenFileError:V,startFileOperation:Fe}),Je=(0,R.useCallback)(e=>{V(null),P.setQuery(e)},[P.setQuery,V]),Ye=(0,R.useCallback)(()=>Cu(t,We()),[We,t]),Xe=(0,R.useCallback)(()=>{p&&(Ve(),p(t))},[Ve,p,t]),Ze=(0,R.useCallback)(e=>{if(!h)return;let n=Ye();Ve(),h(e,n,n===t?void 0:{projectWorkspace:t})},[Ve,Ye,h,t]),Qe=(0,R.useCallback)((e,t,n)=>{Ge(e,t,Tu(n))},[Ge]),{filesCollapsed:U,openEditorsCollapsed:$e,toggleFilesCollapsed:et,toggleOpenEditorsCollapsed:nt}=hu({agentId:n,workspaceKey:e,clearFileMenu:ze,clearFileOperation:Me,clearFileSearch:Se,focusFileSearchInput:me,focusSearchRequest:o,loadRootDirectory:T,openFilesCount:l.length,refreshTreeLayout:ue,revealExplorerPath:be,revealRequest:a,rootDirectoryLoaded:!!x[``],setFileSearchQuery:P.setQuery,setOpenFileError:V,treeData:S});(0,R.useEffect)(()=>{v?.(U)},[U,v]);let rt=(0,R.useMemo)(()=>l.length===0?{"--code-open-editors-sticky-height":`0px`}:$e?{"--code-open-editors-sticky-height":`25px`}:{"--code-open-editors-sticky-height":`${25+Math.min(l.length,7)*28}px`},[$e,l.length]);(0,R.useEffect)(()=>{!i||U||!x[``]||ie.current!==i&&(ie.current=i,xe(i))},[i,x,U,xe]);let{focusStickyDirectory:it,stickyContextItems:W}=_u({filesCollapsed:U,focusFileTreePath:ge,lastFocusedFilePathRef:F,openDirectoryPaths:C,refreshTreeLayout:ue,resetKey:n,treeData:S,treeViewportRef:se}),{activeOptionId:at,handleFileSearchKeyDown:ot,openFileJumpQuery:st,openFileSearchMatch:ct}=mu({fileMenuOpen:!!Le,fileOperationActive:!!Ae,fileSearch:P,fileSearchResultsRef:re,filesCollapsed:U,focusFileTreeFromSearch:he,listboxId:ae,onOpenFilePath:B,onRevealDirectoryPath:e=>be(e,`directory`)}),{handleTreeKeyDownCapture:lt}=yu({treeRef:oe,treeViewportRef:se,lastFocusedFilePathRef:F,fileOperation:Ae,openDirectoryPaths:C,cancelPendingFileFocus:pe,closeFileOperation:Ne,focusFileSearchInput:me,focusFileTreePath:ge,focusFileTreeTarget:_e,openFileContextMenu:Ge,openFilePath:B,startFileOperation:qe}),ut=Hl({activeFilePath:i,activeSearchOptionId:at,agentId:n??``,agentLaunchOptions:r,copy:b,editorDirtyFilePaths:s,editorExternalChangedFilePaths:c,fileMenu:Le,fileMenuRef:Re,fileOperation:Ae,fileOperationInputRef:je,fileSearch:P,fileSearchInputRef:ne,fileSearchListboxId:ae,fileSearchResultsRef:re,filesCollapsed:U,handleFileSearchKeyDown:ot,handleTreeKeyDownCapture:lt,lastFocusedFilePathRef:F,locatedFilePath:ve,openEditorsCollapsed:$e,openFileError:Ce,openFilePendingPath:we,projectId:e,renderFileTreeRow:de,rootDirectoryError:x[``]?.error??null,rootDirectoryHasItems:!!x[``]?.items.length,rootDirectoryLoading:!!x[``]?.loading,rowHeight:bu,readOnly:y,stickyContextItems:W,treeData:S,treeHeight:ce,treeRef:oe,treeViewportRef:se,visibleTreeRowCount:w,onCancelPendingFileFocus:pe,onCloseFileMenuWithFocusRestore:Be,onCloseFileMenuWithoutFocus:Ve,onCloseFileOperation:Ne,onCloseOpenFile:f,onCopyFileMenuPath:He,onCopyFileMenuShareUrl:Ue,onFocusFileTreeTarget:_e,onFocusStickyDirectory:it,onOpenFileContextMenu:Ge,onOpenFileJumpQuery:st,onOpenFilePath:B,onOpenFileSearchMatch:ct,onOpenNewAgentFromFileMenu:Xe,onRefreshFileMenuTarget:Ke,onRememberFileOperationName:Pe,onSearchQueryChange:Je,onSelectOpenFile:d,onSelectSearchMatchIndex:P.selectMatchIndex,onSetDirectoryOpen:fe,onStartAgentFromFileMenu:Ze,onStartFileMenuOperation:qe,onSubmitFileOperation:Ie,onToggleFilesCollapsed:et,onToggleOpenEditorsCollapsed:nt,onToggleTreeNode:le,onTreeFocus:I,onTreeSelect:L,onUpdateFileOperationName:H});return n?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Vl,{...ut.openEditors,files:l,onOpenFileContextMenu:Qe}),(0,z.jsxs)(`div`,{className:`code-files-section ${U?`collapsed`:``}`,"data-testid":`code-files-section`,"data-project-id":e,style:rt,children:[(0,z.jsx)(zl,{...ut.sectionHeader}),!U&&(0,z.jsxs)(z.Fragment,{children:[!y&&(0,z.jsx)(ye,{activeFilePath:i,agentId:n,changes:Te,collapsed:Ee,copy:b,projectId:e,onOpenChange:ke,onToggleCollapsed:Oe}),(0,z.jsx)(Rl,{...ut.sectionBody})]})]}),U&&(0,z.jsx)(tt,{agentId:n,copy:b,agentLaunchOptions:r,fileMenu:Le,fileOperation:Ae,fileMenuRef:Re,fileOperationInputRef:je,onCloseFileMenu:Ve,onCloseFileMenuWithFocusRestore:Be,onCloseFileOperation:Ne,onCopyFileMenuPath:He,onCopyFileMenuShareUrl:Ue,onOpenNewAgent:Xe,onRefreshFileMenuTarget:Ke,onRememberFileOperationName:Pe,onStartAgent:Ze,onStartFileMenuOperation:qe,onSubmitFileOperation:Ie,onUpdateFileOperationName:H,readOnly:y})]}):null}export{Eu as ProjectFilesSection};