@evandu/super-pi 0.1.307 → 0.1.308

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "hash": "549fd5c359e7eae5b874441fb61a99012ad62381f6afcb0032eaab0cc6dcbe08",
2
+ "hash": "efd69de2771ed1c55a970d9ca91979e8ca90e937e6045d3481261d42d521540c",
3
3
  "files": {
4
4
  "src/client/AnchoredPopover.tsx": "3d683cc9e4305678141c83987a37a36b3da30e20d7bd17ea8e48a72504475605",
5
5
  "src/client/App.tsx": "158c4e596e1f1930f9b98113bb3fc48e577ede47938354c5069739edfce35272",
@@ -20,7 +20,7 @@
20
20
  "src/client/FindControls.tsx": "d98c14e74e1d026c48a487d112974cc70f73889de6daf3446b501fd66b01e4db",
21
21
  "src/client/GitDiffEditor.tsx": "93c183b42d8d8c7da27bd1b4f943bb6eb2c87db87827d0287ea7d774a717b302",
22
22
  "src/client/GitPanel.tsx": "ad405173cbae5100586a10195253df74136ca6cbe485aef92a219a10802d217b",
23
- "src/client/GroupChatPane.tsx": "a4ea3275042d3d4fa08908c0e9116dbb6ac3419c4c8bb1910bda81bc5454926d",
23
+ "src/client/GroupChatPane.tsx": "d97151d9fbbfe7e601cf928c3b4d5ffb1456ac553af27945fbe7ef615cad4bd9",
24
24
  "src/client/GroupExecutionPane.tsx": "2f593d99a5fdd5d37983a93b523c94747d4679135017d9711eed7334f8da29a9",
25
25
  "src/client/GroupModelSelect.tsx": "85ed1a52e4bac3683ddf405a4b273173b2f3c1f90d55fc15beaee0273c50f76a",
26
26
  "src/client/GroupRsiPanel.tsx": "28db70d165395e7f537ee6ce2f588fb7409000fbb095fd86e41b27cd73a8ad64",
@@ -98,7 +98,7 @@
98
98
  "src/client/git-workbench.css": "adc9725e880304904cb5785412785f3d0e56332cd454c7ef0ce2d20681049881",
99
99
  "src/client/group-chat-client.ts": "23daaa55daa08819cafada4e91650d6b4be34da07f6ce1f57bf98900f56ea140",
100
100
  "src/client/group-chat-preferences.ts": "e52a3b1ff7d1436e0a35bd0d1951ba7a0d3a7490d14d2788aa6a7b404956d2a2",
101
- "src/client/group-chat.css": "c294682734b178f1ac71ec7d86a0ded89bc8026bfb9d520b7cf71a5031d26207",
101
+ "src/client/group-chat.css": "89bb225b021b52b3129991643efbed3a25684fe9a7f730b4711acfb2e7459cb2",
102
102
  "src/client/group-rsi.css": "2dd82c046854a2eecc79cd62794f2a04562f7a6ba6d7d373be17ca5b3106bff3",
103
103
  "src/client/main.tsx": "d6325cec79ebc225e4972c33ad9b4266fa1eab5f962fec36ed4c539124a8fcab",
104
104
  "src/client/managed-recovery.css": "496e1d25fdeb3c8fbfdc195be803ea67012cf53d8458ced5995415431f74c537",
@@ -139,5 +139,5 @@
139
139
  "src/client/workbench-navigation.ts": "fff6e8546b2fb19a5db474764628bd10e147779dc26512aa6de9e3a0145a1de5",
140
140
  "src/client/workbench-search-panel.css": "cf256f436f344cff60f54838a18553ee05ba8170ef823d3ca265b5d15044859d"
141
141
  },
142
- "recordedAt": "2026-11-26T19:00:24.260Z"
142
+ "recordedAt": "2026-11-27T10:36:12.398Z"
143
143
  }
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-D978o95T.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-DTIPfQj7.js","assets/dist-S5ntGzJB.js","assets/dist-Cus6_oaF.js","assets/dist-DP4hrTBF.js","assets/dist-Qjm1p8SR.js","assets/dist-BJHpSQV1.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{_ as t,c as n,g as r,h as i,i as a,l as o,o as s,r as c,s as l,u,v as d,y as f}from"./index-DLDXS61p.js";var p=e(f(),1);function m(e,t,n,r){return[n.EditorView.decorations.compute([`selection`,`doc`],e=>n.Decoration.set(e.selection.ranges.filter(e=>!e.empty).map(e=>n.Decoration.mark({class:`cm-workbench-selectedText`}).range(e.from,e.to)),!0)),n.ViewPlugin.define(e=>{let n=null,i,a=!1,s=e=>{n&&(e===`expanded`?(a=!a,l()):n.querySelector(`input[name="${e===`caseSensitive`?`case`:e===`wholeWord`?`word`:`re`}"]`)?.click())},c=e=>{let t=o(e);t&&(e.preventDefault(),e.stopPropagation(),s(t))},l=()=>{if(!n||!i)return;let r=t.getSearchQuery(e.state);if(n.dataset.editorSearchExpanded=String(a),i.update({caseSensitive:r.caseSensitive,wholeWord:r.wholeWord,regexp:r.regexp,expanded:a}),n.querySelector(`[data-find-error]`)?.remove(),r.search&&!r.valid){let e=document.createElement(`output`);e.dataset.findError=``,e.setAttribute(`role`,`alert`),e.textContent=`正则表达式无效`,n.append(e)}},d=()=>{let o=r.querySelector(`.cm-panel.cm-search`);if(o===n)return;if(n?.removeEventListener(`keydown`,c,!0),i?.destroy(),n=o,!n){i=void 0;return}for(let[e,t,r]of[[`next`,`↓`,`下一处`],[`prev`,`↑`,`上一处`]]){let i=n.querySelector(`button[name="${e}"]`);i&&(i.textContent=t,i.setAttribute(`aria-label`,r),i.title=r)}let d=document.createElement(`span`);d.dataset.findControls=``,n.prepend(d);let f=t.getSearchQuery(e.state);a=!1,i=u(d,{...f,expanded:a},s),n.addEventListener(`keydown`,c,!0),l()},f=new MutationObserver(d);return f.observe(r,{childList:!0,subtree:!0}),d(),{update(){l()},destroy(){f.disconnect(),n?.removeEventListener(`keydown`,c,!0),i?.destroy()}}}),e.Prec.highest(n.keymap.of([{key:`Mod-Shift-l`,run:t.selectSelectionMatches},{key:`Mod-h`,scope:`editor search-panel`,run:e=>(t.searchPanelOpen(e.state)||t.openSearchPanel(e),requestAnimationFrame(()=>{e.dom.isConnected&&r.querySelector(`[data-editor-search-options][aria-expanded="false"]`)?.click()}),!0)},...[`c`,`w`,`r`].map(e=>({key:`Alt-${e}`,run:n=>{t.searchPanelOpen(n.state)||t.openSearchPanel(n);let r=t.getSearchQuery(n.state);return n.dispatch({effects:t.setSearchQuery.of(new t.SearchQuery({...r,...e===`c`?{caseSensitive:!r.caseSensitive}:e===`w`?{wholeWord:!r.wholeWord}:{regexp:!r.regexp}}))}),!0}}))])),n.panels({topContainer:r}),n.EditorView.scrollMargins.of(()=>({top:r.querySelector(`.cm-search`)?Math.min(r.getBoundingClientRect().height+8,Math.max(0,(r.parentElement?.clientHeight??0)-32)):0})),t.highlightSelectionMatches({wholeWords:!0,minSelectionLength:1,maxMatches:1e3}),t.search({top:!0}),e.EditorState.phrases.of({Find:`查找`,Replace:`替换为`,next:`下一处`,previous:`上一处`,all:`全部选中`,"match case":`区分大小写`,regexp:`正则表达式`,"by word":`全词匹配`,replace:`替换`,"replace all":`全部替换`,close:`关闭查找`,"current match":`当前匹配`,"on line":`所在行`})]}function h(e,t,r,i,a){let o=new e.Compartment,c=()=>{let n=s();return[e.EditorState.tabSize.of(n.tabSize),r.indentUnit.of(n.indent===`tabs`?` `:` `.repeat(n.tabSize)),n.wrap?t.EditorView.lineWrapping:[],n.whitespace?[t.highlightWhitespace(),t.highlightTrailingWhitespace()]:[]]};return[e.EditorState.allowMultipleSelections.of(!0),t.rectangularSelection(),t.crosshairCursor({key:`Alt`}),e.EditorState.phrases.of({"folded code":`已折叠代码`,unfold:`展开代码`,"Fold line":`折叠代码`,"Unfold line":`展开代码`}),t.highlightActiveLineGutter(),t.highlightSpecialChars(),t.dropCursor(),r.bracketMatching(),r.indentOnInput(),r.foldGutter(),i.closeBrackets(),e.Prec.highest(t.keymap.of([...i.closeBracketsKeymap,...r.foldKeymap,{key:`Alt-z`,run:()=>(l({wrap:!s().wrap}),!0)},{key:`Mod-Shift-z`,run:a.redo},{key:`Mod-y`,run:a.redo}])),o.of(c()),t.ViewPlugin.define(e=>({destroy:n(()=>{e.dispatch({effects:o.reconfigure(c())})})}))]}var g=new Map;function ee(e){let t=g.get(e);return t&&(g.delete(e),g.set(e,t)),t}function _(e,t){g.delete(e),g.set(e,t);let n=[...g.values()].reduce((e,t)=>e+t.state.doc.length,0);for(;g.size>32||n>16777216;){let e=g.keys().next().value;n-=g.get(e).state.doc.length,g.delete(e)}}var v=d(),te=262144,y=131072;function ne(e){return e.split(`.`).pop()?.toLowerCase()??``}function b(e,t,n=!1){let r=e=>n?`var(--git-diff-${e.slice(5)}, var(${e}))`:`var(${e})`;return e.HighlightStyle.define([{tag:t.tags.keyword,color:r(`--cm-keyword`)},{tag:t.tags.string,color:r(`--cm-string`)},{tag:t.tags.number,color:r(`--cm-number`)},{tag:t.tags.comment,color:r(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:r(`--cm-function`)},{tag:t.tags.typeName,color:r(`--cm-type`)},{tag:t.tags.className,color:r(`--cm-type`)},{tag:t.tags.propertyName,color:r(`--cm-property`)},{tag:t.tags.operator,color:r(`--cm-operator`)},{tag:t.tags.variableName,color:r(`--cm-variable`)}])}function x({path:e,value:n,onChange:o,jumpToLine:s,onSave:l,workspaceId:u,cwd:d=``,blame:f,onPosition:g,onView:x,readOnly:S=!1,languageOverride:C}){let w=(0,p.useRef)(null),T=(0,p.useRef)(null),E=(0,p.useRef)(null),re=(0,p.useRef)(null),D=JSON.stringify([u,d,e]),O=(0,p.useRef)(void 0),k=(0,p.useRef)(null),A=(0,p.useRef)(null),ie=(0,p.useRef)(null),j=(0,p.useRef)(null),M=(0,p.useRef)(null),N=(0,p.useRef)(null),P=(0,p.useRef)(o),F=(0,p.useRef)(l),I=(0,p.useRef)(n);I.current=n;let L=(0,p.useRef)(!1),R=(0,p.useRef)(x);R.current=x,P.current=o,F.current=l;let[z,ae]=(0,p.useState)(!1),[B,V]=(0,p.useState)(!1),[H,U]=(0,p.useState)(`0,0`),[W,oe]=(0,p.useState)(0),[G,K]=(0,p.useState)(1);(0,p.useEffect)(()=>{let i=!1,o,s,c,l,u;return(async()=>{try{let d=C??ne(e),f=r(d),[p,g,_,v,y,x,z,B,H]=await Promise.all([t(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([0,1])),t(()=>import(`./dist-DTIPfQj7.js`).then(e=>e.s),__vite__mapDeps([2,1,0])),t(()=>import(`./dist-S5ntGzJB.js`),__vite__mapDeps([3,0,1,2,4,5])),t(()=>import(`./dist-Qjm1p8SR.js`),__vite__mapDeps([6,0,1,2])),t(()=>import(`./dist-DP4hrTBF.js`).then(e=>e.d),__vite__mapDeps([5,1,0,2,4])),t(()=>import(`./dist-Cus6_oaF.js`).then(e=>e.n),__vite__mapDeps([4,1])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),a().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null)),t(()=>import(`./dist-BJHpSQV1.js`).then(e=>e.r),__vite__mapDeps([7,1,0,2,5,4]))]);if(i||!w.current||!T.current)return;re.current=g.EditorView,l=y,u=x,A.current=p.Annotation.define(),ie.current=p.Transaction.addToHistory;let W=n.length<=te&&z!==null;s=new p.Compartment;let G=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),_.history(),g.keymap.of([_.indentWithTab,..._.defaultKeymap,..._.historyKeymap,...v.searchKeymap,{key:`Mod-s`,run:()=>(F.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(A.current&&e.transactions.some(e=>e.annotation(A.current)===!0))&&P.current(e.state.doc.toString()),e.selectionSet&&U(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(G.push(g.EditorView.updateListener.of(e=>{e.selectionSet&&K(e.state.selection.ranges.length),e.docChanged?L.current=!1:e.selectionSet&&(L.current=e.transactions.some(e=>e.isUserEvent(`select.search`)||e.isUserEvent(`select.pointer`)))}),m(p,v,g,T.current),h(p,g,y,H,_)),S&&G.push(p.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1),g.EditorView.contentAttributes.of({tabindex:`0`})),B&&!S&&(c=new p.Compartment,G.splice(1,0,c.of([])),G.push(B.base)),z)try{G.push(z)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),W=!1}if(W&&s&&l&&u)try{G.push(s.of(l.syntaxHighlighting(b(l,u))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),W=!1}let q=ee(D),J=q&&q.state.doc.toString()===I.current,Y=J?q.state.update({effects:p.StateEffect.reconfigure.of(G)}).state:p.EditorState.create({doc:I.current,extensions:G});if(o=new g.EditorView({state:Y,parent:w.current}),O.current=J?q.jump:void 0,K(o.state.selection.ranges.length),U(`${o.state.selection.main.from},${o.state.selection.main.to}`),J&&(o.scrollDOM.scrollTop=q.top,o.scrollDOM.scrollLeft=q.left,O.current=q.jump),i){o.destroy();return}E.current=o,R.current?.(o),ae(W),V(!0),j.current=B,M.current=c??null,N.current=null,oe(e=>e+1);let X=new MutationObserver(()=>{let e=E.current;if(e&&W&&s&&l&&u)try{e.dispatch({effects:s.reconfigure(l.syntaxHighlighting(b(l,u)))})}catch{}});k.current=X,X.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||V(!0)}})(),()=>{i=!0,k.current?.disconnect(),k.current=null,o&&_(D,{state:o.state,top:o.scrollDOM.scrollTop,left:o.scrollDOM.scrollLeft,jump:O.current}),o?.destroy(),E.current=null,R.current?.(),V(!1),w.current&&(w.current.textContent=``)}},[D,S,C]),(0,p.useEffect)(()=>{let e=E.current;if(!e)return;let t=e.state.doc.toString();t!==n&&e.dispatch({changes:{from:0,to:t.length,insert:n},annotations:A.current?A.current.of(!0):void 0})},[n,B]),(0,p.useEffect)(()=>{let e=E.current;if(!e||!s||O.current===s.request)return;O.current=s.request;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},effects:re.current?.scrollIntoView(n,{y:`start`,yMargin:Math.round(e.scrollDOM.clientHeight/3)})}),e.focus()},[s,B]);let q=!!(f&&f.state===`ready`&&f.response&&f.path===e&&f.workspaceId===u);(0,p.useEffect)(()=>{let t=E.current,n=j.current,r=M.current;if(!t||!n||!r)return;let i=f&&f.state===`ready`&&f.response&&f.path===e&&f.workspaceId===u?f.response:null,a=i?c(i):null;N.current!==a&&(N.current=a,t.dispatch({effects:[n.setBlame.of(a),r.reconfigure(a?n.gutter:[])]}))},[f?.state,f?.response,f?.path,f?.workspaceId,e,u,W]);let J=E.current?.state.doc.toString()??n,Y=J.length<=y?J:J.slice(0,y),X=C??ne(e),Z=i(X),se=E.current?.state,Q=se?.selection.main.head,$=Q===void 0?void 0:se?.doc.lineAt(Q),ce=$?.number,le=Q!==void 0&&$?Q-$.from+1:void 0;return(0,p.useEffect)(()=>{let e=E.current;if(B&&e&&(!s||O.current===s.request)){let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);g?.({line:n.number,column:t-n.from+1,language:z&&Z||`纯文本`,highlight:z?X:`plain`,navigation:L.current,selections:e.state.selection.ranges.length})}},[B,ce,le,z,Z,X,g,G,s?.request]),(0,p.useEffect)(()=>()=>g?.(),[g]),(0,v.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":Y,"data-file-content-truncated":J.length>y?`1`:`0`,"data-file-selection":H,"data-editor-selection-count":G,"data-file-editor-ready":B?`1`:`0`,"data-file-blame-gutter":q?`1`:void 0,onMouseDown:e=>{e.target.closest(`.cm-panels`)||E.current?.focus()},children:[(0,v.jsx)(`div`,{className:`file-cm`,ref:w,"aria-label":`${S?`查看`:`编辑`} ${e}`}),(0,v.jsx)(`div`,{className:`workbench-editor-search`,ref:T,"data-editor-find-host":`file`}),(!B||!g)&&(0,v.jsxs)(`div`,{className:`file-editor-status`,children:[!B&&(0,v.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),B&&Q!==void 0&&$&&(0,v.jsxs)(`span`,{children:[`第 `,$.number,` 行,第 `,Q-$.from+1,` 列`]}),B&&!z&&(0,v.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),B&&z&&Z&&(0,v.jsx)(`span`,{"data-file-highlight-status":X,children:Z})]})]})}export{x as CodeMirrorEditor,m as n,h as t,b as themeHighlightStyle};
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{_ as t,c as n,g as r,h as i,i as a,l as o,o as s,r as c,s as l,u,v as d,y as f}from"./index-CWwK9CVT.js";var p=e(f(),1);function m(e,t,n,r){return[n.EditorView.decorations.compute([`selection`,`doc`],e=>n.Decoration.set(e.selection.ranges.filter(e=>!e.empty).map(e=>n.Decoration.mark({class:`cm-workbench-selectedText`}).range(e.from,e.to)),!0)),n.ViewPlugin.define(e=>{let n=null,i,a=!1,s=e=>{n&&(e===`expanded`?(a=!a,l()):n.querySelector(`input[name="${e===`caseSensitive`?`case`:e===`wholeWord`?`word`:`re`}"]`)?.click())},c=e=>{let t=o(e);t&&(e.preventDefault(),e.stopPropagation(),s(t))},l=()=>{if(!n||!i)return;let r=t.getSearchQuery(e.state);if(n.dataset.editorSearchExpanded=String(a),i.update({caseSensitive:r.caseSensitive,wholeWord:r.wholeWord,regexp:r.regexp,expanded:a}),n.querySelector(`[data-find-error]`)?.remove(),r.search&&!r.valid){let e=document.createElement(`output`);e.dataset.findError=``,e.setAttribute(`role`,`alert`),e.textContent=`正则表达式无效`,n.append(e)}},d=()=>{let o=r.querySelector(`.cm-panel.cm-search`);if(o===n)return;if(n?.removeEventListener(`keydown`,c,!0),i?.destroy(),n=o,!n){i=void 0;return}for(let[e,t,r]of[[`next`,`↓`,`下一处`],[`prev`,`↑`,`上一处`]]){let i=n.querySelector(`button[name="${e}"]`);i&&(i.textContent=t,i.setAttribute(`aria-label`,r),i.title=r)}let d=document.createElement(`span`);d.dataset.findControls=``,n.prepend(d);let f=t.getSearchQuery(e.state);a=!1,i=u(d,{...f,expanded:a},s),n.addEventListener(`keydown`,c,!0),l()},f=new MutationObserver(d);return f.observe(r,{childList:!0,subtree:!0}),d(),{update(){l()},destroy(){f.disconnect(),n?.removeEventListener(`keydown`,c,!0),i?.destroy()}}}),e.Prec.highest(n.keymap.of([{key:`Mod-Shift-l`,run:t.selectSelectionMatches},{key:`Mod-h`,scope:`editor search-panel`,run:e=>(t.searchPanelOpen(e.state)||t.openSearchPanel(e),requestAnimationFrame(()=>{e.dom.isConnected&&r.querySelector(`[data-editor-search-options][aria-expanded="false"]`)?.click()}),!0)},...[`c`,`w`,`r`].map(e=>({key:`Alt-${e}`,run:n=>{t.searchPanelOpen(n.state)||t.openSearchPanel(n);let r=t.getSearchQuery(n.state);return n.dispatch({effects:t.setSearchQuery.of(new t.SearchQuery({...r,...e===`c`?{caseSensitive:!r.caseSensitive}:e===`w`?{wholeWord:!r.wholeWord}:{regexp:!r.regexp}}))}),!0}}))])),n.panels({topContainer:r}),n.EditorView.scrollMargins.of(()=>({top:r.querySelector(`.cm-search`)?Math.min(r.getBoundingClientRect().height+8,Math.max(0,(r.parentElement?.clientHeight??0)-32)):0})),t.highlightSelectionMatches({wholeWords:!0,minSelectionLength:1,maxMatches:1e3}),t.search({top:!0}),e.EditorState.phrases.of({Find:`查找`,Replace:`替换为`,next:`下一处`,previous:`上一处`,all:`全部选中`,"match case":`区分大小写`,regexp:`正则表达式`,"by word":`全词匹配`,replace:`替换`,"replace all":`全部替换`,close:`关闭查找`,"current match":`当前匹配`,"on line":`所在行`})]}function h(e,t,r,i,a){let o=new e.Compartment,c=()=>{let n=s();return[e.EditorState.tabSize.of(n.tabSize),r.indentUnit.of(n.indent===`tabs`?` `:` `.repeat(n.tabSize)),n.wrap?t.EditorView.lineWrapping:[],n.whitespace?[t.highlightWhitespace(),t.highlightTrailingWhitespace()]:[]]};return[e.EditorState.allowMultipleSelections.of(!0),t.rectangularSelection(),t.crosshairCursor({key:`Alt`}),e.EditorState.phrases.of({"folded code":`已折叠代码`,unfold:`展开代码`,"Fold line":`折叠代码`,"Unfold line":`展开代码`}),t.highlightActiveLineGutter(),t.highlightSpecialChars(),t.dropCursor(),r.bracketMatching(),r.indentOnInput(),r.foldGutter(),i.closeBrackets(),e.Prec.highest(t.keymap.of([...i.closeBracketsKeymap,...r.foldKeymap,{key:`Alt-z`,run:()=>(l({wrap:!s().wrap}),!0)},{key:`Mod-Shift-z`,run:a.redo},{key:`Mod-y`,run:a.redo}])),o.of(c()),t.ViewPlugin.define(e=>({destroy:n(()=>{e.dispatch({effects:o.reconfigure(c())})})}))]}var g=new Map;function ee(e){let t=g.get(e);return t&&(g.delete(e),g.set(e,t)),t}function _(e,t){g.delete(e),g.set(e,t);let n=[...g.values()].reduce((e,t)=>e+t.state.doc.length,0);for(;g.size>32||n>16777216;){let e=g.keys().next().value;n-=g.get(e).state.doc.length,g.delete(e)}}var v=d(),te=262144,y=131072;function ne(e){return e.split(`.`).pop()?.toLowerCase()??``}function b(e,t,n=!1){let r=e=>n?`var(--git-diff-${e.slice(5)}, var(${e}))`:`var(${e})`;return e.HighlightStyle.define([{tag:t.tags.keyword,color:r(`--cm-keyword`)},{tag:t.tags.string,color:r(`--cm-string`)},{tag:t.tags.number,color:r(`--cm-number`)},{tag:t.tags.comment,color:r(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:r(`--cm-function`)},{tag:t.tags.typeName,color:r(`--cm-type`)},{tag:t.tags.className,color:r(`--cm-type`)},{tag:t.tags.propertyName,color:r(`--cm-property`)},{tag:t.tags.operator,color:r(`--cm-operator`)},{tag:t.tags.variableName,color:r(`--cm-variable`)}])}function x({path:e,value:n,onChange:o,jumpToLine:s,onSave:l,workspaceId:u,cwd:d=``,blame:f,onPosition:g,onView:x,readOnly:S=!1,languageOverride:C}){let w=(0,p.useRef)(null),T=(0,p.useRef)(null),E=(0,p.useRef)(null),re=(0,p.useRef)(null),D=JSON.stringify([u,d,e]),O=(0,p.useRef)(void 0),k=(0,p.useRef)(null),A=(0,p.useRef)(null),ie=(0,p.useRef)(null),j=(0,p.useRef)(null),M=(0,p.useRef)(null),N=(0,p.useRef)(null),P=(0,p.useRef)(o),F=(0,p.useRef)(l),I=(0,p.useRef)(n);I.current=n;let L=(0,p.useRef)(!1),R=(0,p.useRef)(x);R.current=x,P.current=o,F.current=l;let[z,ae]=(0,p.useState)(!1),[B,V]=(0,p.useState)(!1),[H,U]=(0,p.useState)(`0,0`),[W,oe]=(0,p.useState)(0),[G,K]=(0,p.useState)(1);(0,p.useEffect)(()=>{let i=!1,o,s,c,l,u;return(async()=>{try{let d=C??ne(e),f=r(d),[p,g,_,v,y,x,z,B,H]=await Promise.all([t(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([0,1])),t(()=>import(`./dist-DTIPfQj7.js`).then(e=>e.s),__vite__mapDeps([2,1,0])),t(()=>import(`./dist-S5ntGzJB.js`),__vite__mapDeps([3,0,1,2,4,5])),t(()=>import(`./dist-Qjm1p8SR.js`),__vite__mapDeps([6,0,1,2])),t(()=>import(`./dist-DP4hrTBF.js`).then(e=>e.d),__vite__mapDeps([5,1,0,2,4])),t(()=>import(`./dist-Cus6_oaF.js`).then(e=>e.n),__vite__mapDeps([4,1])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),a().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null)),t(()=>import(`./dist-BJHpSQV1.js`).then(e=>e.r),__vite__mapDeps([7,1,0,2,5,4]))]);if(i||!w.current||!T.current)return;re.current=g.EditorView,l=y,u=x,A.current=p.Annotation.define(),ie.current=p.Transaction.addToHistory;let W=n.length<=te&&z!==null;s=new p.Compartment;let G=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),_.history(),g.keymap.of([_.indentWithTab,..._.defaultKeymap,..._.historyKeymap,...v.searchKeymap,{key:`Mod-s`,run:()=>(F.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(A.current&&e.transactions.some(e=>e.annotation(A.current)===!0))&&P.current(e.state.doc.toString()),e.selectionSet&&U(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(G.push(g.EditorView.updateListener.of(e=>{e.selectionSet&&K(e.state.selection.ranges.length),e.docChanged?L.current=!1:e.selectionSet&&(L.current=e.transactions.some(e=>e.isUserEvent(`select.search`)||e.isUserEvent(`select.pointer`)))}),m(p,v,g,T.current),h(p,g,y,H,_)),S&&G.push(p.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1),g.EditorView.contentAttributes.of({tabindex:`0`})),B&&!S&&(c=new p.Compartment,G.splice(1,0,c.of([])),G.push(B.base)),z)try{G.push(z)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),W=!1}if(W&&s&&l&&u)try{G.push(s.of(l.syntaxHighlighting(b(l,u))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),W=!1}let q=ee(D),J=q&&q.state.doc.toString()===I.current,Y=J?q.state.update({effects:p.StateEffect.reconfigure.of(G)}).state:p.EditorState.create({doc:I.current,extensions:G});if(o=new g.EditorView({state:Y,parent:w.current}),O.current=J?q.jump:void 0,K(o.state.selection.ranges.length),U(`${o.state.selection.main.from},${o.state.selection.main.to}`),J&&(o.scrollDOM.scrollTop=q.top,o.scrollDOM.scrollLeft=q.left,O.current=q.jump),i){o.destroy();return}E.current=o,R.current?.(o),ae(W),V(!0),j.current=B,M.current=c??null,N.current=null,oe(e=>e+1);let X=new MutationObserver(()=>{let e=E.current;if(e&&W&&s&&l&&u)try{e.dispatch({effects:s.reconfigure(l.syntaxHighlighting(b(l,u)))})}catch{}});k.current=X,X.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),i||V(!0)}})(),()=>{i=!0,k.current?.disconnect(),k.current=null,o&&_(D,{state:o.state,top:o.scrollDOM.scrollTop,left:o.scrollDOM.scrollLeft,jump:O.current}),o?.destroy(),E.current=null,R.current?.(),V(!1),w.current&&(w.current.textContent=``)}},[D,S,C]),(0,p.useEffect)(()=>{let e=E.current;if(!e)return;let t=e.state.doc.toString();t!==n&&e.dispatch({changes:{from:0,to:t.length,insert:n},annotations:A.current?A.current.of(!0):void 0})},[n,B]),(0,p.useEffect)(()=>{let e=E.current;if(!e||!s||O.current===s.request)return;O.current=s.request;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},effects:re.current?.scrollIntoView(n,{y:`start`,yMargin:Math.round(e.scrollDOM.clientHeight/3)})}),e.focus()},[s,B]);let q=!!(f&&f.state===`ready`&&f.response&&f.path===e&&f.workspaceId===u);(0,p.useEffect)(()=>{let t=E.current,n=j.current,r=M.current;if(!t||!n||!r)return;let i=f&&f.state===`ready`&&f.response&&f.path===e&&f.workspaceId===u?f.response:null,a=i?c(i):null;N.current!==a&&(N.current=a,t.dispatch({effects:[n.setBlame.of(a),r.reconfigure(a?n.gutter:[])]}))},[f?.state,f?.response,f?.path,f?.workspaceId,e,u,W]);let J=E.current?.state.doc.toString()??n,Y=J.length<=y?J:J.slice(0,y),X=C??ne(e),Z=i(X),se=E.current?.state,Q=se?.selection.main.head,$=Q===void 0?void 0:se?.doc.lineAt(Q),ce=$?.number,le=Q!==void 0&&$?Q-$.from+1:void 0;return(0,p.useEffect)(()=>{let e=E.current;if(B&&e&&(!s||O.current===s.request)){let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);g?.({line:n.number,column:t-n.from+1,language:z&&Z||`纯文本`,highlight:z?X:`plain`,navigation:L.current,selections:e.state.selection.ranges.length})}},[B,ce,le,z,Z,X,g,G,s?.request]),(0,p.useEffect)(()=>()=>g?.(),[g]),(0,v.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":Y,"data-file-content-truncated":J.length>y?`1`:`0`,"data-file-selection":H,"data-editor-selection-count":G,"data-file-editor-ready":B?`1`:`0`,"data-file-blame-gutter":q?`1`:void 0,onMouseDown:e=>{e.target.closest(`.cm-panels`)||E.current?.focus()},children:[(0,v.jsx)(`div`,{className:`file-cm`,ref:w,"aria-label":`${S?`查看`:`编辑`} ${e}`}),(0,v.jsx)(`div`,{className:`workbench-editor-search`,ref:T,"data-editor-find-host":`file`}),(!B||!g)&&(0,v.jsxs)(`div`,{className:`file-editor-status`,children:[!B&&(0,v.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),B&&Q!==void 0&&$&&(0,v.jsxs)(`span`,{children:[`第 `,$.number,` 行,第 `,Q-$.from+1,` 列`]}),B&&!z&&(0,v.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),B&&z&&Z&&(0,v.jsx)(`span`,{"data-file-highlight-status":X,children:Z})]})]})}export{x as CodeMirrorEditor,m as n,h as t,b as themeHighlightStyle};