@aiworker/web 1.23.0 → 1.23.2

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 (152) hide show
  1. package/dist/assets/{CodeMirrorCommentWidgets-B1Gizi3a.js → CodeMirrorCommentWidgets-COGJG0Iv.js} +1 -1
  2. package/dist/assets/DiffView-BviYY3zL.js +4 -0
  3. package/dist/assets/{DirtyBranchSwitchDialog-aig6zJjg.js → DirtyBranchSwitchDialog-C26DvfVJ.js} +1 -1
  4. package/dist/assets/FilesView-D0ZU_nCt.js +13 -0
  5. package/dist/assets/{GitView-BXsS3jG6.js → GitView-CYgiDRH-.js} +4 -4
  6. package/dist/assets/{JsonTreeView-D_hpXBnF.js → JsonTreeView-GsV9UScz.js} +1 -1
  7. package/dist/assets/{LinearIssuesView-BoUiLQG1.js → LinearIssuesView-shqUS8nl.js} +1 -1
  8. package/dist/assets/{MarkdownImageGallery-B_B_a9KS.js → MarkdownImageGallery-CQSTFp6m.js} +1 -1
  9. package/dist/assets/{MarkdownRendererImpl-xgyyLiBM.js → MarkdownRendererImpl-DJWP3A8X.js} +2 -2
  10. package/dist/assets/{OnboardingScreen-DIp84OWt.js → OnboardingScreen-CTuu4lgo.js} +1 -1
  11. package/dist/assets/{PatchDiff-8p6nLJaU.js → PatchDiff-Dp53v2pl.js} +1 -1
  12. package/dist/assets/{PierreDiffViewer-DjC8nTk9.js → PierreDiffViewer-B5l0djPS.js} +1 -1
  13. package/dist/assets/PlanView-CLUWkGiG.js +5 -0
  14. package/dist/assets/SettingsView-CojPQVHx.js +28 -0
  15. package/dist/assets/{SettingsWindow-Cpb4hM6q.js → SettingsWindow-DbgEnZ6T.js} +1 -1
  16. package/dist/assets/{ToolOutputDialog-DfaKZXNU.js → ToolOutputDialog-Du-RZj-a.js} +6 -6
  17. package/dist/assets/{ToolPartDiffPreview-DtZLzrSK.js → ToolPartDiffPreview-HBLSokoe.js} +2 -2
  18. package/dist/assets/{VirtualizedFileDiff-C8i9HpTB.js → VirtualizedFileDiff-Bzp3hClU.js} +4 -4
  19. package/dist/assets/WalkthroughView-CpgA4s9w.js +4 -0
  20. package/dist/assets/{computeVirtualFileMetrics-BBI7ZwrC.js → computeVirtualFileMetrics-CI1PC_z2.js} +2 -2
  21. package/dist/assets/de-BX8b4hDD.js +10 -0
  22. package/dist/assets/es-e98cS-yM.js +16 -0
  23. package/dist/assets/fr-BOiqxJAs.js +14 -0
  24. package/dist/assets/index-BD8ILbxF.js +40 -0
  25. package/dist/assets/{index-jXSK5RrB.js → index-Cmn74sw-.js} +1 -1
  26. package/dist/assets/index-zhgg-SDz.css +1 -0
  27. package/dist/assets/{isDiffPlainText-B_x_rVon.js → isDiffPlainText-DVralkU-.js} +1 -1
  28. package/dist/assets/{isFilePlainText-DW_xMer1.js → isFilePlainText-CgTREsRX.js} +1 -1
  29. package/dist/assets/ja-aoO55hGu.js +16 -0
  30. package/dist/assets/{ko-idhXGF8j.js → ko-BGzFLogk.js} +3 -3
  31. package/dist/assets/{main-CzdPuL0s.js → main-BgfXQ-4g.js} +2 -2
  32. package/dist/assets/main-DGYUWmIt.js +930 -0
  33. package/dist/assets/{markdownCore-Cn4Tyejo.js → markdownCore-BesaNs_G.js} +3 -3
  34. package/dist/assets/{miniChat-CCkqKOLp.js → miniChat-DHKXp-_I.js} +2 -2
  35. package/dist/assets/{mobile-mvxTo055.js → mobile-lXQ08VnX.js} +2 -2
  36. package/dist/assets/patchFileDiff-i1lTtNbn.js +13 -0
  37. package/dist/assets/{pl-CGZWUqZJ.js → pl-B5x19laq.js} +3 -3
  38. package/dist/assets/pt-BR-C3oU51Il.js +16 -0
  39. package/dist/assets/renderElectronMiniChatApp-CuO4ue6B.js +2 -0
  40. package/dist/assets/renderMobileApp-B3zFlHy4.js +25 -0
  41. package/dist/assets/runtimeEndpointReset-BLzrtrmj.js +41 -0
  42. package/dist/assets/scheduledTasksApi-BEuUF_cj.js +1 -0
  43. package/dist/assets/{shikiHighlight-CRl0SUC9.js → shikiHighlight-ctlcPvvx.js} +1 -1
  44. package/dist/assets/surface-COKb77Ua.js +1 -0
  45. package/dist/assets/tr-C0QQa7et.js +7 -0
  46. package/dist/assets/uk-CqLSe9wT.js +16 -0
  47. package/dist/assets/{useAppFontEffects-CPKeOpUo.js → useAppFontEffects-B6OfEypo.js} +153 -155
  48. package/dist/assets/useGitComparison-BXZXEAW6.js +1 -0
  49. package/dist/assets/{useInlineCommentController-BiWz4AVb.js → useInlineCommentController-CgbrpEWu.js} +2 -2
  50. package/dist/assets/{useRootScrollLock-BS4-kr7P.js → useRootScrollLock-Me41OjBT.js} +1 -1
  51. package/dist/assets/{vendor-base-ui-DdV8vhHn.js → vendor-base-ui-BY_5qla_.js} +1 -1
  52. package/dist/assets/{vendor-codemirror-language-data-Bg4AEeCr.js → vendor-codemirror-language-data-SJuFp0a0.js} +2 -2
  53. package/dist/assets/vendor-legendapp-list-BuBPBC3R.js +1 -0
  54. package/dist/assets/{vendor-zod-BPAANqvH.js → vendor-zod-B6551dwG.js} +2 -2
  55. package/dist/assets/{web-components-z7hfnS8n.js → web-components-D8GS8Ork.js} +1 -1
  56. package/dist/assets/zh-CN-iJEie4d6.js +16 -0
  57. package/dist/assets/zh-TW-CyslEwlK.js +16 -0
  58. package/dist/index.html +4 -4
  59. package/dist/mini-chat.html +4 -4
  60. package/dist/mobile.html +4 -4
  61. package/package.json +1 -1
  62. package/server/index.js +3 -13
  63. package/server/lib/agent-memory/runtime.js +7 -2
  64. package/server/lib/agent-memory/runtime.test.js +22 -0
  65. package/server/lib/event-stream/DOCUMENTATION.md +3 -0
  66. package/server/lib/event-stream/global-hub.js +29 -4
  67. package/server/lib/event-stream/global-hub.test.js +22 -0
  68. package/server/lib/event-stream/global-ws-bridge.js +15 -18
  69. package/server/lib/event-stream/protocol.js +21 -7
  70. package/server/lib/event-stream/runtime.js +9 -6
  71. package/server/lib/event-stream/runtime.test.js +60 -0
  72. package/server/lib/git/DOCUMENTATION.md +10 -1
  73. package/server/lib/git/routes.js +21 -8
  74. package/server/lib/git/routes.test.js +78 -0
  75. package/server/lib/git/service.js +159 -4
  76. package/server/lib/git/service.test.js +74 -0
  77. package/server/lib/github/DOCUMENTATION.md +5 -0
  78. package/server/lib/github/routes.js +2 -2
  79. package/server/lib/message-queue/DOCUMENTATION.md +7 -0
  80. package/server/lib/message-queue/runtime.js +13 -0
  81. package/server/lib/message-queue/runtime.test.js +31 -1
  82. package/server/lib/notifications/DOCUMENTATION.md +1 -1
  83. package/server/lib/notifications/emitter-runtime.js +4 -3
  84. package/server/lib/opencode/DOCUMENTATION.md +18 -4
  85. package/server/lib/opencode/env-runtime.js +5 -1
  86. package/server/lib/opencode/env-runtime.test.js +72 -0
  87. package/server/lib/opencode/feature-routes-runtime.js +15 -1
  88. package/server/lib/opencode/lifecycle.js +4 -3
  89. package/server/lib/opencode/lifecycle.test.js +29 -0
  90. package/server/lib/opencode/managed-plugin-config.js +1 -1
  91. package/server/lib/opencode/proxy.js +33 -0
  92. package/server/lib/opencode/settings-helpers.js +3 -0
  93. package/server/lib/opencode/settings-helpers.test.js +11 -1
  94. package/server/lib/opencode/settings-registry.json +3 -0
  95. package/server/lib/opencode/settings-runtime.js +36 -9
  96. package/server/lib/opencode/settings-runtime.test.js +158 -2
  97. package/server/lib/project-context/DOCUMENTATION.md +13 -3
  98. package/server/lib/project-context/runtime.js +8 -2
  99. package/server/lib/project-context/runtime.test.js +54 -0
  100. package/server/lib/projects/DOCUMENTATION.md +2 -1
  101. package/server/lib/projects/project-config.js +38 -9
  102. package/server/lib/projects/project-config.test.js +97 -0
  103. package/server/lib/projects/project-id.js +26 -0
  104. package/server/lib/relay/DOCUMENTATION.md +20 -0
  105. package/server/lib/relay/host-client.js +7 -0
  106. package/server/lib/relay/host-client.test.js +14 -0
  107. package/server/lib/scheduled-tasks/DOCUMENTATION.md +9 -1
  108. package/server/lib/scheduled-tasks/issue-2710-double-execution.test.js +28 -0
  109. package/server/lib/scheduled-tasks/runtime.js +12 -2
  110. package/server/lib/scheduled-tasks/runtime.test.js +53 -0
  111. package/server/lib/session-assist/DOCUMENTATION.md +131 -66
  112. package/server/lib/session-assist/context.js +127 -0
  113. package/server/lib/session-assist/context.test.js +132 -0
  114. package/server/lib/session-assist/prompt.js +54 -0
  115. package/server/lib/session-assist/runtime.js +111 -257
  116. package/server/lib/session-assist/runtime.test.js +203 -0
  117. package/server/lib/walkthrough/DOCUMENTATION.md +15 -5
  118. package/server/lib/walkthrough/pr-source.test.js +21 -0
  119. package/server/lib/walkthrough/pull-request.js +7 -4
  120. package/server/lib/walkthrough/pull-request.test.js +16 -0
  121. package/server/lib/walkthrough/routes.js +19 -0
  122. package/server/lib/walkthrough/routes.test.js +26 -0
  123. package/server/lib/walkthrough/sources.js +13 -2
  124. package/server/opencode-worktree-readiness.test.js +130 -0
  125. package/dist/assets/DiffView-DXjVsEOw.js +0 -4
  126. package/dist/assets/FilesView-CJdG0-wk.js +0 -17
  127. package/dist/assets/PlanView-CJTmOF6I.js +0 -5
  128. package/dist/assets/SettingsView-DD-JqIJx.js +0 -28
  129. package/dist/assets/WalkthroughView-DeKMvZlL.js +0 -4
  130. package/dist/assets/de-DCrsQ5zS.js +0 -10
  131. package/dist/assets/es-Dwv4YfH6.js +0 -16
  132. package/dist/assets/fr-BCWg4Cnx.js +0 -14
  133. package/dist/assets/index-B68h5S5B.css +0 -1
  134. package/dist/assets/index-DVwMarHI.js +0 -39
  135. package/dist/assets/ja-Bruw3RYC.js +0 -16
  136. package/dist/assets/main-BkyaQhJX.js +0 -930
  137. package/dist/assets/patchFileDiff-Csk4iNUi.js +0 -13
  138. package/dist/assets/pt-BR-B8V7u7tA.js +0 -16
  139. package/dist/assets/renderElectronMiniChatApp-BxoyujA5.js +0 -2
  140. package/dist/assets/renderMobileApp-B48CsP4r.js +0 -25
  141. package/dist/assets/runtimeEndpointReset-Bg5gx18H.js +0 -17
  142. package/dist/assets/scheduledTasksApi-BW0Etzwz.js +0 -1
  143. package/dist/assets/surface-oMvhsog3.js +0 -1
  144. package/dist/assets/tr-BK_KiO2V.js +0 -7
  145. package/dist/assets/uk-CG74xV8N.js +0 -16
  146. package/dist/assets/useGitComparison-DH220WmO.js +0 -1
  147. package/dist/assets/vendor-legendapp-list-gg7YLRW7.js +0 -1
  148. package/dist/assets/zh-CN-T4AXofZI.js +0 -16
  149. package/dist/assets/zh-TW-Dte40sxp.js +0 -16
  150. package/server/lib/mcp-reconnect/DOCUMENTATION.md +0 -55
  151. package/server/lib/mcp-reconnect/runtime.js +0 -122
  152. package/server/lib/mcp-reconnect/runtime.test.js +0 -140
@@ -1 +1 @@
1
- import{b as q,x as K,y as G,i as M,z as J,B as W,C as A}from"./computeVirtualFileMetrics-BBI7ZwrC.js";import{fA as j,hw as z}from"./useAppFontEffects-CPKeOpUo.js";import{d as X,a as Q}from"./vendor-diff-C3JhlQdm.js";function gn(n,e){return n===e||n?.cacheKey!=null&&n.cacheKey===e?.cacheKey}function mn(n,e){return q(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function P({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function T({item:n,arr:e,enableJoin:r,isNeutral:l=!1,isLastItem:f=!1}){const t=e[e.length-1];if(t==null||f||!r){e.push([l?0:1,n.value]);return}const h=t[0]===0;if(l===h||l&&n.value.length===1&&!h){t[1]+=n.value;return}e.push([l?0:1,n.value])}function B({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:l,collapsedContextThreshold:f}){const t=Math.max(e,0);if(t===0||n)return{fromStart:0,fromEnd:0,rangeSize:t,collapsedLines:t,renderAll:!1};if(r===!0||t<=f)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(l),d=Math.min(Math.max(h?.fromStart??0,0),t),i=Math.min(Math.max(h?.fromEnd??0,0),t),u=d+i,o=u>=t;return{fromStart:o?t:d,fromEnd:o?0:i,rangeSize:t,collapsedLines:Math.max(t-u,0),renderAll:o}}function pn(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-(e.additionLineIndex+e.additionCount),l=n.deletionLines.length-(e.deletionLineIndex+e.deletionCount);return r<=0&&l<=0?!1:r!==l}function Y({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const l=n.additionLines.length-(r.additionLineIndex+r.additionCount),f=n.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(l<=0&&f<=0)return 0;if(l!==f)throw new Error(`${e}: trailing context mismatch (additions=${l}, deletions=${f}) for ${n.name}`);return Math.min(l,f)}function V({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:l,errorPrefix:f}){if(e!==n.hunks.length-1)return;const t=Y({fileDiff:n,errorPrefix:f});if(t<=0)return;if(r===!0||t<=l)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(n.hunks.length),d=Math.min(Math.max(h?.fromStart??0,0),t);return{fromStart:d,fromEnd:0,rangeSize:t,collapsedLines:t-d,renderAll:d>=t}}function $({type:n,metrics:e}){return e.hunkSeparatorHeight??K(n)}function U({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function Z({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function y(n){return n!=="simple"&&n!=="metadata"}function In({type:n,metrics:e,hunkIndex:r,hunkSpecs:l}){if(!Z({type:n,hunkIndex:r,hunkSpecs:l}))return;const f=$({type:n,metrics:e}),t=U({type:n,metrics:e}),h=r>0?t:0,d=t;return{height:f,gapBefore:h,gapAfter:d,totalHeight:h+f+d}}function Cn({type:n,metrics:e}){if(!y(n))return;const r=$({type:n,metrics:e}),l=U({type:n,metrics:e});return{height:r,gapBefore:l,gapAfter:0,totalHeight:l+r}}function nn({diff:n,diffStyle:e,startingLine:r=0,totalLines:l=1/0,expandedHunks:f,collapsedContextThreshold:t=1,callback:h}){const d=en({diff:n,diffStyle:e,startingLine:r,expandedHunks:f,collapsedContextThreshold:t}),i={viewportStart:r,viewportEnd:r+l,isWindowedHighlight:r>0||l<1/0,splitCount:d.splitCount,unifiedCount:d.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!i.isWindowedHighlight)return!1;const u=i.unifiedCount>=r+l,o=i.splitCount>=r+l;return e==="unified"?u:(e==="split"||u)&&o},shouldSkip(u,o){if(!i.isWindowedHighlight)return!1;const s=i.unifiedCount+u<r,a=i.splitCount+o<r;return e==="unified"?s:(e==="split"||s)&&a},incrementCounts(u,o){(e==="unified"||e==="both")&&(i.unifiedCount+=u),(e==="split"||e==="both")&&(i.splitCount+=o)},isInWindow(u,o){if(!i.isWindowedHighlight)return!0;const s=i.isInUnifiedWindow(u),a=i.isInSplitWindow(o);return e==="unified"?s:e==="split"?a:s||a},isInUnifiedWindow(u){return!i.isWindowedHighlight||i.unifiedCount>=r-u&&i.unifiedCount<r+l},isInSplitWindow(u){return!i.isWindowedHighlight||i.splitCount>=r-u&&i.splitCount<r+l},emit(u,o=!1){return o||(e==="unified"?i.incrementCounts(1,0):e==="split"?i.incrementCounts(0,1):i.incrementCounts(1,1)),h(u)??!1}};n:for(let u=d.hunkIndex;u<n.hunks.length;u++){let g=function(c,p){return a==null||a.collapsedLines<=0||a.fromStart+a.fromEnd>0?0:e==="unified"?c===o.unifiedLineStart+o.unifiedLineCount-1?a.collapsedLines:0:p===o.splitLineStart+o.splitLineCount-1?a.collapsedLines:0},b=function(){return O?0:(O=!0,s.collapsedLines)};const o=n.hunks[u];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(i.shouldBreak())break;const s=B({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:f,hunkIndex:u,collapsedContextThreshold:t}),a=u===i.finalHunkIndex?V({fileDiff:n,hunkIndex:u,expandedHunks:f,collapsedContextThreshold:t,errorPrefix:"iterateOverDiff"}):void 0,m=s.fromStart+s.fromEnd;let O=s.collapsedLines===0;if(i.shouldSkip(m,m))i.incrementCounts(m,m),b();else{let c=o.unifiedLineStart-s.rangeSize,p=o.splitLineStart-s.rangeSize,k=o.deletionLineIndex-s.rangeSize,R=o.additionLineIndex-s.rangeSize,S=o.deletionStart-s.rangeSize,H=o.additionStart-s.rangeSize;if(F(i,s.fromStart,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}))||(c=o.unifiedLineStart-s.fromEnd,p=o.splitLineStart-s.fromEnd,k=o.deletionLineIndex-s.fromEnd,R=o.additionLineIndex-s.fromEnd,S=o.deletionStart-s.fromEnd,H=o.additionStart-s.fromEnd,F(i,s.fromEnd,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}),()=>{b()})))break n}let N=o.unifiedLineStart,w=o.splitLineStart,I=o.deletionLineIndex,C=o.additionLineIndex,L=o.deletionStart,v=o.additionStart;const x=o.hunkContent.at(-1);for(const c of o.hunkContent){if(i.shouldBreak())break n;const p=c===x;if(c.type==="context"){if(i.shouldSkip(c.lines,c.lines))i.incrementCounts(c.lines,c.lines),b();else if(F(i,c.lines,e,k=>{const R=p&&k===c.lines-1,S=N+k,H=w+k;return i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:g(S,H),type:"context",deletionLine:{lineNumber:L+k,lineIndex:I+k,noEOFCR:R&&o.noEOFCRDeletions,unifiedLineIndex:S,splitLineIndex:H},additionLine:{unifiedLineIndex:S,splitLineIndex:H,lineIndex:C+k,lineNumber:v+k,noEOFCR:R&&o.noEOFCRAdditions}})},()=>{b()}))break n;N+=c.lines,w+=c.lines,I+=c.lines,C+=c.lines,L+=c.lines,v+=c.lines}else{const k=Math.max(c.deletions,c.additions),R=c.deletions+c.additions;if(!i.shouldSkip(R,k)){const S=rn(i,c,e);(S[0]?.[0]??0)>0&&b();for(const[H,E]of S)for(let D=H;D<E;D++){const _=g(N+D,e==="unified"?w+(D<c.deletions?D:D-c.deletions):w+D);if(i.emit(sn({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:_,diffStyle:e,index:D,unifiedLineIndex:N,splitLineIndex:w,additionLineIndex:C,deletionLineIndex:I,additionLineNumber:v,deletionLineNumber:L,content:c,isLastContent:p,unifiedCount:R,splitCount:k}),!0))break n}}b(),i.incrementCounts(R,k),N+=R,w+=k,I+=c.deletions,C+=c.additions,L+=c.deletions,v+=c.additions}}if(a!=null){const{collapsedLines:c,fromStart:p,fromEnd:k}=a,R=p+k;if(F(i,R,e,S=>{const H=S===R-1;return i.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:H?c:0,type:"context-expanded",deletionLine:{lineNumber:L+S,lineIndex:I+S,noEOFCR:!1,unifiedLineIndex:N+S,splitLineIndex:w+S},additionLine:{unifiedLineIndex:N+S,splitLineIndex:w+S,lineIndex:C+S,lineNumber:v+S,noEOFCR:!1}})},void 0,()=>i.shouldBreak()))break n}}}function en({diff:n,diffStyle:e,startingLine:r,expandedHunks:l,collapsedContextThreshold:f}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const t=tn({diff:n,expandedHunks:l,collapsedContextThreshold:f});let h=0,d=n.hunks.length-1,i=n.hunks.length;for(;h<=d;){const o=h+d>>1,s=t[o+1];if(s==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?s.unifiedCount:s.splitCount)>r?(i=o,d=o-1):h=o+1}if(i>=n.hunks.length){const o=t[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const u=t[i];if(u==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:i,splitCount:u.splitCount,unifiedCount:u.unifiedCount}}function tn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let l=0,f=0;const t=n.hunks.length-1,h=[{splitCount:0,unifiedCount:0}];for(let d=0;d<n.hunks.length;d++){const i=n.hunks[d];if(i==null)throw new Error("iterateOverDiff: invalid hunk summary index");const u=B({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:e,hunkIndex:d,collapsedContextThreshold:r}),o=u.fromStart+u.fromEnd;l+=o+i.splitLineCount,f+=o+i.unifiedLineCount;const s=d===t?V({fileDiff:n,hunkIndex:d,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(s!=null){const a=s.fromStart+s.fromEnd;l+=a,f+=a}h.push({splitCount:l,unifiedCount:f})}return h}function on(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const l=[];function f(d){const i=Math.max(0,n.viewportStart-d),u=Math.min(e,n.viewportEnd-d);u>i&&l.push([i,u])}if(r!=="split"&&f(n.unifiedCount),r!=="unified"&&f(n.splitCount),l.length===0)return[0,0];let t=l[0][0],h=l[0][1];for(let d=1;d<l.length;d++){const i=l[d];t=Math.min(t,i[0]),h=Math.max(h,i[1])}return[t,h]}function F(n,e,r,l,f,t){const[h,d]=on(n,e,r);h>0&&(n.incrementCounts(h,h),f?.());let i=h;for(;i<e;){if(t?.()===!0)return!0;if(i>=d){n.incrementCounts(e-i,e-i);break}if(n.isInWindow(0,0)){if(l(i)===!0)return!0}else n.incrementCounts(1,1);i++}return!1}function rn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const l=r!=="split",f=r!=="unified",t=r==="unified"?"unified":"split",h=[];function d(s,a){if(s+a<=n.viewportStart||s>=n.viewportEnd)return;const m=Math.max(0,n.viewportStart-s),g=Math.min(a,n.viewportEnd-s);return g>m?[m,g]:void 0}function i(s,a){return t==="split"?s:a==="additions"?[s[0]+e.deletions,s[1]+e.deletions]:s}function u(s,a){if(s==null)return;const[m,g]=i(s,a);g>m&&h.push([m,g])}if(l&&(u(d(n.unifiedCount,e.deletions),"deletions"),u(d(n.unifiedCount+e.deletions,e.additions),"additions")),f&&(u(d(n.splitCount,e.deletions),"deletions"),u(d(n.splitCount,e.additions),"additions")),h.length===0)return h;h.sort((s,a)=>s[0]-a[0]);const o=[h[0]];for(const[s,a]of h.slice(1)){const m=o[o.length-1];s<=m[1]?m[1]=Math.max(m[1],a):o.push([s,a])}return o}function sn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,diffStyle:f,index:t,unifiedLineIndex:h,splitLineIndex:d,additionLineIndex:i,deletionLineIndex:u,additionLineNumber:o,deletionLineNumber:s,content:a,isLastContent:m,unifiedCount:g,splitCount:O}){const b=t<a.deletions?h+t:void 0,N=f==="unified"?t>=a.deletions?h+t:void 0:t<a.additions?h+a.deletions+t:void 0,w=f==="unified"?d+(t<a.deletions?t:t-a.deletions):d+t,I=t<a.deletions?u+t:void 0,C=t<a.deletions?s+t:void 0,L=f==="unified"?t>=a.deletions?i+(t-a.deletions):void 0:t<a.additions?i+t:void 0,v=f==="unified"?t>=a.deletions?o+(t-a.deletions):void 0:t<a.additions?o+t:void 0,x=f==="unified"?m&&t===a.deletions-1&&e.noEOFCRDeletions:m&&t===O-1&&e.noEOFCRDeletions,c=f==="unified"?m&&t===g-1&&e.noEOFCRAdditions:m&&t===O-1&&e.noEOFCRAdditions,p=I!=null&&C!=null&&b!=null?{lineNumber:C,lineIndex:I,noEOFCR:x,unifiedLineIndex:b,splitLineIndex:w}:void 0,k=L!=null&&v!=null&&N!=null?{unifiedLineIndex:N,splitLineIndex:w,lineIndex:L,lineNumber:v,noEOFCR:c}:void 0;if(p==null&&k!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:void 0,additionLine:k};if(p!=null&&k==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:void 0};if(p==null||k==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:k}}const ln={forcePlainText:!1};function Ln(n,e,r,{forcePlainText:l,startingLine:f,totalLines:t,expandedHunks:h,collapsedContextThreshold:d=1}=ln){l?(f??=0,t??=1/0):(f=0,t=1/0);const i=f>0||t<1/0,u=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,o=G({theme:r.theme,highlighter:e}),s=l&&!i&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,a={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,g=!l&&!n.isPartial,O=l?h:void 0,b=new Map;function N(I){const C=g?0:I,L=b.get(C)??un();return b.set(C,L),L}function w(I,C,L,v){if(i){let x=L.at(-1);(x==null||x.targetIndex+x.count!==C)&&(x={targetIndex:C,originalOffset:v.length,count:0},L.push(x)),x.count++}v.push(I)}nn({diff:n,diffStyle:"both",startingLine:f,totalLines:t,expandedHunks:i?O:!0,collapsedContextThreshold:d,callback:({hunkIndex:I,additionLine:C,deletionLine:L,type:v})=>{const x=N(I),c=C!=null?C.splitLineIndex:L.splitLineIndex;v==="change"&&C!=null&&L!=null&&an({additionLine:n.additionLines[C.lineIndex],deletionLine:n.deletionLines[L.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:s,maxLineDiffLength:m}),L!=null&&(w(n.deletionLines[L.lineIndex],L.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:v==="change"?"change-deletion":v,lineNumber:L.lineNumber,altLineNumber:v==="change"?void 0:C.lineNumber??void 0,lineIndex:`${L.unifiedLineIndex},${c}`})),C!=null&&(w(n.additionLines[C.lineIndex],C.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:v==="change"?"change-addition":v,lineNumber:C.lineNumber,altLineNumber:v==="change"?void 0:L.lineNumber??void 0,lineIndex:`${C.unifiedLineIndex},${c}`}))}});for(const I of b.values()){if(I.deletionContent.length===0&&I.additionContent.length===0)continue;const C={name:n.prevName??n.name,contents:I.deletionContent.value},L={name:n.name,contents:I.additionContent.value},{deletionLines:v,additionLines:x}=dn({deletionFile:C,deletionInfo:I.deletionInfo,deletionDecorations:I.deletionDecorations,additionFile:L,additionInfo:I.additionInfo,additionDecorations:I.additionDecorations,highlighter:e,options:r,languageOverride:l?"text":n.lang});if(g){a.deletionLines=v,a.additionLines=x;continue}if(I.deletionSegments.length>0)for(const c of I.deletionSegments)for(let p=0;p<c.count;p++)a.deletionLines[c.targetIndex+p]=v[c.originalOffset+p];else a.deletionLines.push(...v);if(I.additionSegments.length>0)for(const c of I.additionSegments)for(let p=0;p<c.count;p++)a.additionLines[c.targetIndex+p]=x[c.originalOffset+p];else a.additionLines.push(...x)}return{code:a,themeStyles:o,baseThemeType:u}}function an({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:l,deletionDecorations:f,additionDecorations:t,lineDiffType:h,maxLineDiffLength:d}){if(n==null||e==null||h==="none"||(n=z(n),e=z(e),n.length>d||e.length>d))return;const i=h==="char"?X(n,e):Q(n,e),u=[],o=[],s=h==="word-alt",a=i.at(-1);for(const g of i){const O=g===a;!g.added&&!g.removed?(T({item:g,arr:u,enableJoin:s,isNeutral:!0,isLastItem:O}),T({item:g,arr:o,enableJoin:s,isNeutral:!0,isLastItem:O})):g.removed?T({item:g,arr:u,enableJoin:s,isLastItem:O}):T({item:g,arr:o,enableJoin:s,isLastItem:O})}let m=0;for(const g of u)g[0]===1&&f.push(P({line:r,spanStart:m,spanLength:g[1].length})),m+=g[1].length;m=0;for(const g of o)g[0]===1&&t.push(P({line:l,spanStart:m,spanLength:g[1].length})),m+=g[1].length}function un(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function dn({deletionFile:n,additionFile:e,deletionInfo:r,additionInfo:l,highlighter:f,deletionDecorations:t,additionDecorations:h,languageOverride:d,options:{theme:i=j,...u}}){const o=d??M(n.name),s=d??M(e.name),{state:a,transformers:m}=J(u.useTokenTransformer),g=typeof i=="string"?{...u,lang:"text",theme:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0}:{...u,lang:"text",themes:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0};return{deletionLines:n.contents===""?[]:(g.lang=o,a.lineInfo=r,g.decorations=t,A(f.codeToHast(z(n.contents),g))),additionLines:e.contents===""?[]:(g.lang=s,g.decorations=h,a.lineInfo=l,A(f.codeToHast(z(e.contents),g)))}}function xn(n){const e=n.lang??M(n.name),r=n.lang??(n.prevName!=null?M(n.prevName):"text");return e==="text"&&r==="text"}export{mn as a,gn as b,nn as c,B as d,In as e,V as f,Y as g,pn as h,xn as i,Cn as j,Ln as r};
1
+ import{b as q,x as K,y as G,i as M,z as J,B as W,C as P}from"./computeVirtualFileMetrics-CI1PC_z2.js";import{fL as j,hI as z}from"./useAppFontEffects-B6OfEypo.js";import{d as X,a as Q}from"./vendor-diff-C3JhlQdm.js";function gn(n,e){return n===e||n?.cacheKey!=null&&n.cacheKey===e?.cacheKey}function mn(n,e){return q(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function A({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function T({item:n,arr:e,enableJoin:r,isNeutral:l=!1,isLastItem:f=!1}){const t=e[e.length-1];if(t==null||f||!r){e.push([l?0:1,n.value]);return}const h=t[0]===0;if(l===h||l&&n.value.length===1&&!h){t[1]+=n.value;return}e.push([l?0:1,n.value])}function B({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:l,collapsedContextThreshold:f}){const t=Math.max(e,0);if(t===0||n)return{fromStart:0,fromEnd:0,rangeSize:t,collapsedLines:t,renderAll:!1};if(r===!0||t<=f)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(l),d=Math.min(Math.max(h?.fromStart??0,0),t),i=Math.min(Math.max(h?.fromEnd??0,0),t),u=d+i,o=u>=t;return{fromStart:o?t:d,fromEnd:o?0:i,rangeSize:t,collapsedLines:Math.max(t-u,0),renderAll:o}}function pn(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-(e.additionLineIndex+e.additionCount),l=n.deletionLines.length-(e.deletionLineIndex+e.deletionCount);return r<=0&&l<=0?!1:r!==l}function Y({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const l=n.additionLines.length-(r.additionLineIndex+r.additionCount),f=n.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(l<=0&&f<=0)return 0;if(l!==f)throw new Error(`${e}: trailing context mismatch (additions=${l}, deletions=${f}) for ${n.name}`);return Math.min(l,f)}function V({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:l,errorPrefix:f}){if(e!==n.hunks.length-1)return;const t=Y({fileDiff:n,errorPrefix:f});if(t<=0)return;if(r===!0||t<=l)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(n.hunks.length),d=Math.min(Math.max(h?.fromStart??0,0),t);return{fromStart:d,fromEnd:0,rangeSize:t,collapsedLines:t-d,renderAll:d>=t}}function $({type:n,metrics:e}){return e.hunkSeparatorHeight??K(n)}function U({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function Z({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function y(n){return n!=="simple"&&n!=="metadata"}function In({type:n,metrics:e,hunkIndex:r,hunkSpecs:l}){if(!Z({type:n,hunkIndex:r,hunkSpecs:l}))return;const f=$({type:n,metrics:e}),t=U({type:n,metrics:e}),h=r>0?t:0,d=t;return{height:f,gapBefore:h,gapAfter:d,totalHeight:h+f+d}}function Cn({type:n,metrics:e}){if(!y(n))return;const r=$({type:n,metrics:e}),l=U({type:n,metrics:e});return{height:r,gapBefore:l,gapAfter:0,totalHeight:l+r}}function nn({diff:n,diffStyle:e,startingLine:r=0,totalLines:l=1/0,expandedHunks:f,collapsedContextThreshold:t=1,callback:h}){const d=en({diff:n,diffStyle:e,startingLine:r,expandedHunks:f,collapsedContextThreshold:t}),i={viewportStart:r,viewportEnd:r+l,isWindowedHighlight:r>0||l<1/0,splitCount:d.splitCount,unifiedCount:d.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!i.isWindowedHighlight)return!1;const u=i.unifiedCount>=r+l,o=i.splitCount>=r+l;return e==="unified"?u:(e==="split"||u)&&o},shouldSkip(u,o){if(!i.isWindowedHighlight)return!1;const s=i.unifiedCount+u<r,a=i.splitCount+o<r;return e==="unified"?s:(e==="split"||s)&&a},incrementCounts(u,o){(e==="unified"||e==="both")&&(i.unifiedCount+=u),(e==="split"||e==="both")&&(i.splitCount+=o)},isInWindow(u,o){if(!i.isWindowedHighlight)return!0;const s=i.isInUnifiedWindow(u),a=i.isInSplitWindow(o);return e==="unified"?s:e==="split"?a:s||a},isInUnifiedWindow(u){return!i.isWindowedHighlight||i.unifiedCount>=r-u&&i.unifiedCount<r+l},isInSplitWindow(u){return!i.isWindowedHighlight||i.splitCount>=r-u&&i.splitCount<r+l},emit(u,o=!1){return o||(e==="unified"?i.incrementCounts(1,0):e==="split"?i.incrementCounts(0,1):i.incrementCounts(1,1)),h(u)??!1}};n:for(let u=d.hunkIndex;u<n.hunks.length;u++){let g=function(c,p){return a==null||a.collapsedLines<=0||a.fromStart+a.fromEnd>0?0:e==="unified"?c===o.unifiedLineStart+o.unifiedLineCount-1?a.collapsedLines:0:p===o.splitLineStart+o.splitLineCount-1?a.collapsedLines:0},b=function(){return O?0:(O=!0,s.collapsedLines)};const o=n.hunks[u];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(i.shouldBreak())break;const s=B({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:f,hunkIndex:u,collapsedContextThreshold:t}),a=u===i.finalHunkIndex?V({fileDiff:n,hunkIndex:u,expandedHunks:f,collapsedContextThreshold:t,errorPrefix:"iterateOverDiff"}):void 0,m=s.fromStart+s.fromEnd;let O=s.collapsedLines===0;if(i.shouldSkip(m,m))i.incrementCounts(m,m),b();else{let c=o.unifiedLineStart-s.rangeSize,p=o.splitLineStart-s.rangeSize,k=o.deletionLineIndex-s.rangeSize,R=o.additionLineIndex-s.rangeSize,S=o.deletionStart-s.rangeSize,H=o.additionStart-s.rangeSize;if(F(i,s.fromStart,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}))||(c=o.unifiedLineStart-s.fromEnd,p=o.splitLineStart-s.fromEnd,k=o.deletionLineIndex-s.fromEnd,R=o.additionLineIndex-s.fromEnd,S=o.deletionStart-s.fromEnd,H=o.additionStart-s.fromEnd,F(i,s.fromEnd,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}),()=>{b()})))break n}let N=o.unifiedLineStart,w=o.splitLineStart,I=o.deletionLineIndex,C=o.additionLineIndex,L=o.deletionStart,v=o.additionStart;const x=o.hunkContent.at(-1);for(const c of o.hunkContent){if(i.shouldBreak())break n;const p=c===x;if(c.type==="context"){if(i.shouldSkip(c.lines,c.lines))i.incrementCounts(c.lines,c.lines),b();else if(F(i,c.lines,e,k=>{const R=p&&k===c.lines-1,S=N+k,H=w+k;return i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:g(S,H),type:"context",deletionLine:{lineNumber:L+k,lineIndex:I+k,noEOFCR:R&&o.noEOFCRDeletions,unifiedLineIndex:S,splitLineIndex:H},additionLine:{unifiedLineIndex:S,splitLineIndex:H,lineIndex:C+k,lineNumber:v+k,noEOFCR:R&&o.noEOFCRAdditions}})},()=>{b()}))break n;N+=c.lines,w+=c.lines,I+=c.lines,C+=c.lines,L+=c.lines,v+=c.lines}else{const k=Math.max(c.deletions,c.additions),R=c.deletions+c.additions;if(!i.shouldSkip(R,k)){const S=rn(i,c,e);(S[0]?.[0]??0)>0&&b();for(const[H,E]of S)for(let D=H;D<E;D++){const _=g(N+D,e==="unified"?w+(D<c.deletions?D:D-c.deletions):w+D);if(i.emit(sn({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:_,diffStyle:e,index:D,unifiedLineIndex:N,splitLineIndex:w,additionLineIndex:C,deletionLineIndex:I,additionLineNumber:v,deletionLineNumber:L,content:c,isLastContent:p,unifiedCount:R,splitCount:k}),!0))break n}}b(),i.incrementCounts(R,k),N+=R,w+=k,I+=c.deletions,C+=c.additions,L+=c.deletions,v+=c.additions}}if(a!=null){const{collapsedLines:c,fromStart:p,fromEnd:k}=a,R=p+k;if(F(i,R,e,S=>{const H=S===R-1;return i.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:H?c:0,type:"context-expanded",deletionLine:{lineNumber:L+S,lineIndex:I+S,noEOFCR:!1,unifiedLineIndex:N+S,splitLineIndex:w+S},additionLine:{unifiedLineIndex:N+S,splitLineIndex:w+S,lineIndex:C+S,lineNumber:v+S,noEOFCR:!1}})},void 0,()=>i.shouldBreak()))break n}}}function en({diff:n,diffStyle:e,startingLine:r,expandedHunks:l,collapsedContextThreshold:f}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const t=tn({diff:n,expandedHunks:l,collapsedContextThreshold:f});let h=0,d=n.hunks.length-1,i=n.hunks.length;for(;h<=d;){const o=h+d>>1,s=t[o+1];if(s==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?s.unifiedCount:s.splitCount)>r?(i=o,d=o-1):h=o+1}if(i>=n.hunks.length){const o=t[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const u=t[i];if(u==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:i,splitCount:u.splitCount,unifiedCount:u.unifiedCount}}function tn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let l=0,f=0;const t=n.hunks.length-1,h=[{splitCount:0,unifiedCount:0}];for(let d=0;d<n.hunks.length;d++){const i=n.hunks[d];if(i==null)throw new Error("iterateOverDiff: invalid hunk summary index");const u=B({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:e,hunkIndex:d,collapsedContextThreshold:r}),o=u.fromStart+u.fromEnd;l+=o+i.splitLineCount,f+=o+i.unifiedLineCount;const s=d===t?V({fileDiff:n,hunkIndex:d,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(s!=null){const a=s.fromStart+s.fromEnd;l+=a,f+=a}h.push({splitCount:l,unifiedCount:f})}return h}function on(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const l=[];function f(d){const i=Math.max(0,n.viewportStart-d),u=Math.min(e,n.viewportEnd-d);u>i&&l.push([i,u])}if(r!=="split"&&f(n.unifiedCount),r!=="unified"&&f(n.splitCount),l.length===0)return[0,0];let t=l[0][0],h=l[0][1];for(let d=1;d<l.length;d++){const i=l[d];t=Math.min(t,i[0]),h=Math.max(h,i[1])}return[t,h]}function F(n,e,r,l,f,t){const[h,d]=on(n,e,r);h>0&&(n.incrementCounts(h,h),f?.());let i=h;for(;i<e;){if(t?.()===!0)return!0;if(i>=d){n.incrementCounts(e-i,e-i);break}if(n.isInWindow(0,0)){if(l(i)===!0)return!0}else n.incrementCounts(1,1);i++}return!1}function rn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const l=r!=="split",f=r!=="unified",t=r==="unified"?"unified":"split",h=[];function d(s,a){if(s+a<=n.viewportStart||s>=n.viewportEnd)return;const m=Math.max(0,n.viewportStart-s),g=Math.min(a,n.viewportEnd-s);return g>m?[m,g]:void 0}function i(s,a){return t==="split"?s:a==="additions"?[s[0]+e.deletions,s[1]+e.deletions]:s}function u(s,a){if(s==null)return;const[m,g]=i(s,a);g>m&&h.push([m,g])}if(l&&(u(d(n.unifiedCount,e.deletions),"deletions"),u(d(n.unifiedCount+e.deletions,e.additions),"additions")),f&&(u(d(n.splitCount,e.deletions),"deletions"),u(d(n.splitCount,e.additions),"additions")),h.length===0)return h;h.sort((s,a)=>s[0]-a[0]);const o=[h[0]];for(const[s,a]of h.slice(1)){const m=o[o.length-1];s<=m[1]?m[1]=Math.max(m[1],a):o.push([s,a])}return o}function sn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,diffStyle:f,index:t,unifiedLineIndex:h,splitLineIndex:d,additionLineIndex:i,deletionLineIndex:u,additionLineNumber:o,deletionLineNumber:s,content:a,isLastContent:m,unifiedCount:g,splitCount:O}){const b=t<a.deletions?h+t:void 0,N=f==="unified"?t>=a.deletions?h+t:void 0:t<a.additions?h+a.deletions+t:void 0,w=f==="unified"?d+(t<a.deletions?t:t-a.deletions):d+t,I=t<a.deletions?u+t:void 0,C=t<a.deletions?s+t:void 0,L=f==="unified"?t>=a.deletions?i+(t-a.deletions):void 0:t<a.additions?i+t:void 0,v=f==="unified"?t>=a.deletions?o+(t-a.deletions):void 0:t<a.additions?o+t:void 0,x=f==="unified"?m&&t===a.deletions-1&&e.noEOFCRDeletions:m&&t===O-1&&e.noEOFCRDeletions,c=f==="unified"?m&&t===g-1&&e.noEOFCRAdditions:m&&t===O-1&&e.noEOFCRAdditions,p=I!=null&&C!=null&&b!=null?{lineNumber:C,lineIndex:I,noEOFCR:x,unifiedLineIndex:b,splitLineIndex:w}:void 0,k=L!=null&&v!=null&&N!=null?{unifiedLineIndex:N,splitLineIndex:w,lineIndex:L,lineNumber:v,noEOFCR:c}:void 0;if(p==null&&k!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:void 0,additionLine:k};if(p!=null&&k==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:void 0};if(p==null||k==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:k}}const ln={forcePlainText:!1};function Ln(n,e,r,{forcePlainText:l,startingLine:f,totalLines:t,expandedHunks:h,collapsedContextThreshold:d=1}=ln){l?(f??=0,t??=1/0):(f=0,t=1/0);const i=f>0||t<1/0,u=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,o=G({theme:r.theme,highlighter:e}),s=l&&!i&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,a={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,g=!l&&!n.isPartial,O=l?h:void 0,b=new Map;function N(I){const C=g?0:I,L=b.get(C)??un();return b.set(C,L),L}function w(I,C,L,v){if(i){let x=L.at(-1);(x==null||x.targetIndex+x.count!==C)&&(x={targetIndex:C,originalOffset:v.length,count:0},L.push(x)),x.count++}v.push(I)}nn({diff:n,diffStyle:"both",startingLine:f,totalLines:t,expandedHunks:i?O:!0,collapsedContextThreshold:d,callback:({hunkIndex:I,additionLine:C,deletionLine:L,type:v})=>{const x=N(I),c=C!=null?C.splitLineIndex:L.splitLineIndex;v==="change"&&C!=null&&L!=null&&an({additionLine:n.additionLines[C.lineIndex],deletionLine:n.deletionLines[L.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:s,maxLineDiffLength:m}),L!=null&&(w(n.deletionLines[L.lineIndex],L.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:v==="change"?"change-deletion":v,lineNumber:L.lineNumber,altLineNumber:v==="change"?void 0:C.lineNumber??void 0,lineIndex:`${L.unifiedLineIndex},${c}`})),C!=null&&(w(n.additionLines[C.lineIndex],C.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:v==="change"?"change-addition":v,lineNumber:C.lineNumber,altLineNumber:v==="change"?void 0:L.lineNumber??void 0,lineIndex:`${C.unifiedLineIndex},${c}`}))}});for(const I of b.values()){if(I.deletionContent.length===0&&I.additionContent.length===0)continue;const C={name:n.prevName??n.name,contents:I.deletionContent.value},L={name:n.name,contents:I.additionContent.value},{deletionLines:v,additionLines:x}=dn({deletionFile:C,deletionInfo:I.deletionInfo,deletionDecorations:I.deletionDecorations,additionFile:L,additionInfo:I.additionInfo,additionDecorations:I.additionDecorations,highlighter:e,options:r,languageOverride:l?"text":n.lang});if(g){a.deletionLines=v,a.additionLines=x;continue}if(I.deletionSegments.length>0)for(const c of I.deletionSegments)for(let p=0;p<c.count;p++)a.deletionLines[c.targetIndex+p]=v[c.originalOffset+p];else a.deletionLines.push(...v);if(I.additionSegments.length>0)for(const c of I.additionSegments)for(let p=0;p<c.count;p++)a.additionLines[c.targetIndex+p]=x[c.originalOffset+p];else a.additionLines.push(...x)}return{code:a,themeStyles:o,baseThemeType:u}}function an({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:l,deletionDecorations:f,additionDecorations:t,lineDiffType:h,maxLineDiffLength:d}){if(n==null||e==null||h==="none"||(n=z(n),e=z(e),n.length>d||e.length>d))return;const i=h==="char"?X(n,e):Q(n,e),u=[],o=[],s=h==="word-alt",a=i.at(-1);for(const g of i){const O=g===a;!g.added&&!g.removed?(T({item:g,arr:u,enableJoin:s,isNeutral:!0,isLastItem:O}),T({item:g,arr:o,enableJoin:s,isNeutral:!0,isLastItem:O})):g.removed?T({item:g,arr:u,enableJoin:s,isLastItem:O}):T({item:g,arr:o,enableJoin:s,isLastItem:O})}let m=0;for(const g of u)g[0]===1&&f.push(A({line:r,spanStart:m,spanLength:g[1].length})),m+=g[1].length;m=0;for(const g of o)g[0]===1&&t.push(A({line:l,spanStart:m,spanLength:g[1].length})),m+=g[1].length}function un(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function dn({deletionFile:n,additionFile:e,deletionInfo:r,additionInfo:l,highlighter:f,deletionDecorations:t,additionDecorations:h,languageOverride:d,options:{theme:i=j,...u}}){const o=d??M(n.name),s=d??M(e.name),{state:a,transformers:m}=J(u.useTokenTransformer),g=typeof i=="string"?{...u,lang:"text",theme:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0}:{...u,lang:"text",themes:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0};return{deletionLines:n.contents===""?[]:(g.lang=o,a.lineInfo=r,g.decorations=t,P(f.codeToHast(z(n.contents),g))),additionLines:e.contents===""?[]:(g.lang=s,g.decorations=h,a.lineInfo=l,P(f.codeToHast(z(e.contents),g)))}}function xn(n){const e=n.lang??M(n.name),r=n.lang??(n.prevName!=null?M(n.prevName):"text");return e==="text"&&r==="text"}export{mn as a,gn as b,nn as c,B as d,In as e,V as f,Y as g,pn as h,xn as i,Cn as j,Ln as r};
@@ -1 +1 @@
1
- import{t as I}from"./themeResolver-BmJyTmjJ.js";import{b as A,z as R,i as y,y as S,C as _,B as T}from"./computeVirtualFileMetrics-BBI7ZwrC.js";import{fA as k}from"./useAppFontEffects-CPKeOpUo.js";function W(e){return I.hasResolvedThemes(e)}function w(e,t){return A(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}const d=10,g=13;function N(e){const t=[0];for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);(r===d||r===g)&&(r===g&&n+1<e.length&&e.charCodeAt(n+1)===d&&n++,t.push(n+1))}return t}function P(e){const t=N(e);return Array.from({length:t.length},(n,r)=>{const i=t[r],s=t[r+1]??e.length;return e.slice(i,s)})}const b={forcePlainText:!1};function D(e,t,{theme:n=k,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:s,startingLine:o,totalLines:a,lines:E}=b){s?(o??=0,a??=1/0):(o=0,a=1/0);const f=o>0||a<1/0,{state:F,transformers:l}=R(i),c=s?"text":e.lang??y(e.name),x=typeof n=="string"?t.getTheme(n).type:void 0,p=S({theme:n,highlighter:t});F.lineInfo=u=>({type:"context",lineIndex:u-1+o,lineNumber:u+o});const C=typeof n=="string"?{lang:c,theme:n,transformers:l,defaultColor:!1,cssVariablePrefix:T("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:c,themes:n,transformers:l,defaultColor:!1,cssVariablePrefix:T("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},m=_(t.codeToHast(f?H(E??P(e.contents),o,a):e.contents,C)),h=f?new Array(o):m;return f&&h.push(...m),{code:h,themeStyles:p,baseThemeType:x}}function H(e,t,n){if(e.length===0)return"";const r=Math.min(t+n,e.length);return e.slice(t,r).join("")}function M(e){return(e.lang??y(e.name))==="text"}export{w as a,W as h,M as i,P as l,D as r};
1
+ import{t as I}from"./themeResolver-BmJyTmjJ.js";import{b as R,z as A,i as y,y as S,C as _,B as T}from"./computeVirtualFileMetrics-CI1PC_z2.js";import{fL as k}from"./useAppFontEffects-B6OfEypo.js";function W(e){return I.hasResolvedThemes(e)}function w(e,t){return R(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}const d=10,g=13;function N(e){const t=[0];for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);(r===d||r===g)&&(r===g&&n+1<e.length&&e.charCodeAt(n+1)===d&&n++,t.push(n+1))}return t}function P(e){const t=N(e);return Array.from({length:t.length},(n,r)=>{const i=t[r],s=t[r+1]??e.length;return e.slice(i,s)})}const b={forcePlainText:!1};function D(e,t,{theme:n=k,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:s,startingLine:o,totalLines:a,lines:E}=b){s?(o??=0,a??=1/0):(o=0,a=1/0);const f=o>0||a<1/0,{state:F,transformers:l}=A(i),c=s?"text":e.lang??y(e.name),x=typeof n=="string"?t.getTheme(n).type:void 0,p=S({theme:n,highlighter:t});F.lineInfo=u=>({type:"context",lineIndex:u-1+o,lineNumber:u+o});const C=typeof n=="string"?{lang:c,theme:n,transformers:l,defaultColor:!1,cssVariablePrefix:T("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:c,themes:n,transformers:l,defaultColor:!1,cssVariablePrefix:T("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},m=_(t.codeToHast(f?H(E??P(e.contents),o,a):e.contents,C)),h=f?new Array(o):m;return f&&h.push(...m),{code:h,themeStyles:p,baseThemeType:x}}function H(e,t,n){if(e.length===0)return"";const r=Math.min(t+n,e.length);return e.slice(t,r).join("")}function M(e){return(e.lang??y(e.name))==="text"}export{w as a,W as h,M as i,P as l,D as r};