@yuriai/web 0.2.27-beta.2 → 0.2.27-beta.6

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 (157) hide show
  1. package/README.md +9 -0
  2. package/dist/assets/{AgentAvatar-BW4Zg8bo.js → AgentAvatar-Bi1vvWPC.js} +1 -1
  3. package/dist/assets/AssistantContactStatus-CWq-PDz6.js +3 -0
  4. package/dist/assets/AssistantUnreadBadge-DdJyySwn.js +1 -0
  5. package/dist/assets/AssistantView-Br1iETTs.js +1 -0
  6. package/dist/assets/{DiagramView-D6wdXRzu.js → DiagramView-CI4bTtxy.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-gOsILpSk.js → FadeInOnReveal-BB4qEnAn.js} +1 -1
  8. package/dist/assets/GuiPluginSurface-CguxFUbM.js +1 -0
  9. package/dist/assets/{GuiPluginWindow-tGvc4_0g.js → GuiPluginWindow-DOJ7wuRH.js} +1 -1
  10. package/dist/assets/Icon-t2xvbAyN.js +1 -0
  11. package/dist/assets/{ImageLoadingPlaceholder-9xYbKqtf.js → ImageLoadingPlaceholder-D1L13TK0.js} +1 -1
  12. package/dist/assets/{LoadingImage-CiOcKPfb.js → LoadingImage-5rY_edNm.js} +1 -1
  13. package/dist/assets/{MarkdownRenderer-DZkP4UNr.js → MarkdownRenderer-BlGxjOei.js} +2 -2
  14. package/dist/assets/{MarkdownRendererImpl-BXzPUEEo.js → MarkdownRendererImpl-cE-0AYRg.js} +1 -1
  15. package/dist/assets/{MarkstreamRendererImpl-B-NWd069.js → MarkstreamRendererImpl-BZyqDl82.js} +1 -1
  16. package/dist/assets/MobileDetailNavigation-tbfsMfB-.js +1 -0
  17. package/dist/assets/{MobileResizableSheet-ZL-zPa3W.js → MobileResizableSheet-BeRmT6_x.js} +1 -1
  18. package/dist/assets/{MobileShareBridge-JSH_Y8Ps.js → MobileShareBridge-C3Equ3P_.js} +2 -2
  19. package/dist/assets/MobileTabPageHeader-DQRqAAEf.js +2 -0
  20. package/dist/assets/{MultiRunWindow-ZPz62Aqg.js → MultiRunWindow-CAM2XPII.js} +1 -1
  21. package/dist/assets/{OnboardingScreen-BQNoy9o1.js → OnboardingScreen-4ftRerP5.js} +1 -1
  22. package/dist/assets/{OverlayScrollbar-BwCFalSw.js → OverlayScrollbar-CF0PCvQz.js} +1 -1
  23. package/dist/assets/{SettingsView-B17qt8dh.js → SettingsView-2tk4WH7R.js} +15 -15
  24. package/dist/assets/{SettingsWindow-CIFNHb-F.js → SettingsWindow-B9zbeJaW.js} +1 -1
  25. package/dist/assets/TerminalView-DfxvTHye.js +8 -0
  26. package/dist/assets/{ToolOutputDialog-BKuVpgEu.js → ToolOutputDialog-CrjDIhru.js} +1 -1
  27. package/dist/assets/{YuriLogo-C1Ty-RTB.js → YuriLogo-QvS1ZEHi.js} +1 -1
  28. package/dist/assets/{appThemeRegistry-DqGuzMaH.js → appThemeRegistry-Bb_DtiV9.js} +1 -1
  29. package/dist/assets/{button-DuHjvKJJ.js → button-DinGM3tu.js} +1 -1
  30. package/dist/assets/{capgoAdapter-B-tddboe.js → capgoAdapter-DufzjXRs.js} +1 -1
  31. package/dist/assets/{collapsible-B8eL5nLo.js → collapsible-Bh1GLNYV.js} +1 -1
  32. package/dist/assets/context-menu-DpbkRkk1.js +1 -0
  33. package/dist/assets/{diagram-ChoQDKzy.js → diagram-BmG-7Jb4.js} +1 -1
  34. package/dist/assets/{dialog-CVhqZux0.js → dialog-BXssfGXA.js} +1 -1
  35. package/dist/assets/es-HP_Ise0X.js +15 -0
  36. package/dist/assets/{fileMentionTouchSelection-Dd-iSIe2.js → fileMentionTouchSelection-DSl0tj2r.js} +1 -1
  37. package/dist/assets/{fileReferenceActions-BAoEu4z8.js → fileReferenceActions-CGpBSFq4.js} +1 -1
  38. package/dist/assets/fr-D0kJXJ6U.js +13 -0
  39. package/dist/assets/gitApi-Wo0IZow9.js +370 -0
  40. package/dist/assets/{gitApiHttp-DHrRqnYh.js → gitApiHttp-De9liKnG.js} +4 -4
  41. package/dist/assets/host-FR_grJxM.js +1 -0
  42. package/dist/assets/{input-E_oYiXZT.js → input-v8-rVbo-.js} +1 -1
  43. package/dist/assets/insertionBoundaries-CZz7TWJv.js +1 -0
  44. package/dist/assets/ja-BjHKXazE.js +15 -0
  45. package/dist/assets/ko-Llwnl876.js +15 -0
  46. package/dist/assets/main-Bp9HHqTr.js +2 -0
  47. package/dist/assets/main-DOwAfmxJ.js +169 -0
  48. package/dist/assets/{markdownHeightCache-heNXHdzb.js → markdownHeightCache-BVV2dktw.js} +1 -1
  49. package/dist/assets/{mcpQueries-BqKVe4Su.js → mcpQueries-BoBrB4a4.js} +1 -1
  50. package/dist/assets/miniChat-BJDgCrfF.js +2 -0
  51. package/dist/assets/mobile-GM9931J_.js +2 -0
  52. package/dist/assets/{mobileBackNavigation-DHxFQ7SY.js → mobileBackNavigation-DMSzAvb6.js} +1 -1
  53. package/dist/assets/{multirun-CPOzaEQj.js → multirun-BhWttsRQ.js} +1 -1
  54. package/dist/assets/{native-De1DIkLZ.js → native-DSvNnKAm.js} +1 -1
  55. package/dist/assets/{native-config-oauL2ekt.js → native-config-DjdrW_9n.js} +1 -1
  56. package/dist/assets/{persistence-JyLTFv27.js → persistence-CfrHIiIS.js} +1 -1
  57. package/dist/assets/pl-BOd_idqn.js +15 -0
  58. package/dist/assets/{projectMeta-YDMdD3AP.js → projectMeta-31PobC-M.js} +1 -1
  59. package/dist/assets/pt-BR-B8djxMsl.js +15 -0
  60. package/dist/assets/react-B9v0P7kT.js +1 -0
  61. package/dist/assets/{readiness-BveVUOIb.js → readiness-CYNnsekT.js} +1 -1
  62. package/dist/assets/renderElectronMiniChatApp-N2r999Bf.js +2 -0
  63. package/dist/assets/renderMobileApp-CU1ec6Ak.js +28 -0
  64. package/dist/assets/{runtimeConfig-BpcgdIV9.js → runtimeConfig-Db7yfo6L.js} +1 -1
  65. package/dist/assets/runtimeEndpointReset-DO5WVetV.js +149 -0
  66. package/dist/assets/scheduledTaskNavigation-Bsrhv3Ow.js +1 -0
  67. package/dist/assets/sessionLookup-DRVy7LM1.js +1 -0
  68. package/dist/assets/sortable-tabs-strip-yKyqsqut.js +1 -0
  69. package/dist/assets/speechSettingsQueries-DU25rmGc.js +4 -0
  70. package/dist/assets/src-Bckdo2XS.css +2 -0
  71. package/dist/assets/store-CUBymvAC.js +15 -0
  72. package/dist/assets/{terminalApi-B5o8UqWA.js → terminalApi-BblSkqch.js} +1 -1
  73. package/dist/assets/{textarea-DmKaqHSb.js → textarea-B39OCNPV.js} +1 -1
  74. package/dist/assets/{tooltip-DUKu4nC6.js → tooltip-d8TNN4lx.js} +1 -1
  75. package/dist/assets/{types-DRTMRW4R.js → types-BqFQhQTt.js} +1 -1
  76. package/dist/assets/{uk-CYZXWdd7.js → uk-BNd7CjVO.js} +4 -4
  77. package/dist/assets/{useAppFontEffects-BiQf6tgZ.js → useAppFontEffects-BVoVpJYO.js} +57 -55
  78. package/dist/assets/{useAssistantUIStore-C9FPlYQz.js → useAssistantUIStore-Bp6TxG5E.js} +1 -1
  79. package/dist/assets/useDesktopWindowControlsLayout-CYx1LNO5.js +1 -0
  80. package/dist/assets/{useEffectiveDirectory-B8q00InF.js → useEffectiveDirectory-D8FFE5Yn.js} +1 -1
  81. package/dist/assets/{useFontPreferences-DMiP_Yy-.js → useFontPreferences-BFyBjtQ6.js} +1 -1
  82. package/dist/assets/useMobileNavigationStore-BHMFeMjo.js +23 -0
  83. package/dist/assets/useUIStore-BbYD420L.js +1 -0
  84. package/dist/assets/{useWorkerHighlightedLines-B6lWNk01.js → useWorkerHighlightedLines-CPxG8Fya.js} +1 -1
  85. package/dist/assets/{vendor-codemirror-search-ZqtrPLjU.js → vendor-codemirror-search-DiPwvA-6.js} +2 -2
  86. package/dist/assets/{vendor-opencode-plugin-Bw7Q6Nv9.js → vendor-opencode-plugin-CgKz9Hcy.js} +1 -1
  87. package/dist/assets/{vendor-replit-codemirror-vim-DDj0dSVY.js → vendor-replit-codemirror-vim-DCdAdxvE.js} +3 -3
  88. package/dist/assets/zh-CN-BkTAEOZG.js +15 -0
  89. package/dist/assets/zh-TW-x8SfMzfc.js +15 -0
  90. package/dist/index.html +10 -10
  91. package/dist/mini-chat.html +10 -10
  92. package/dist/mobile.html +10 -10
  93. package/package.json +3 -3
  94. package/server/lib/assistants/DOCUMENTATION.md +30 -0
  95. package/server/lib/assistants/contact-store.js +16 -0
  96. package/server/lib/assistants/contact-store.test.js +19 -0
  97. package/server/lib/assistants/contracts.js +1 -0
  98. package/server/lib/assistants/routes.js +25 -3
  99. package/server/lib/assistants/service.js +30 -8
  100. package/server/lib/assistants/service.test.js +151 -0
  101. package/server/lib/assistants/weixin/DOCUMENTATION.md +199 -0
  102. package/server/lib/assistants/weixin/api.js +113 -0
  103. package/server/lib/assistants/weixin/api.test.js +80 -0
  104. package/server/lib/assistants/weixin/routes.js +24 -0
  105. package/server/lib/assistants/weixin/routes.test.js +71 -0
  106. package/server/lib/assistants/weixin/runtime.js +426 -0
  107. package/server/lib/assistants/weixin/runtime.test.js +500 -0
  108. package/server/lib/assistants/weixin/store.js +116 -0
  109. package/server/lib/assistants/weixin/typing.js +88 -0
  110. package/server/lib/assistants/weixin/typing.test.js +185 -0
  111. package/server/lib/opencode/DOCUMENTATION.md +2 -1
  112. package/server/lib/opencode/npm-registry.js +7 -21
  113. package/server/lib/opencode/npm-registry.test.js +36 -5
  114. package/server/lib/opencode/plugin-icon.d.ts +2 -0
  115. package/server/lib/opencode/plugin-icon.js +43 -0
  116. package/server/lib/opencode/plugin-icon.test.js +41 -0
  117. package/server/lib/opencode/plugin-routes.js +3 -1
  118. package/server/lib/opencode/plugin-routes.test.js +13 -0
  119. package/server/lib/opencode/shutdown-runtime.js +1 -1
  120. package/server/lib/opencode/shutdown-runtime.test.js +12 -0
  121. package/dist/assets/AssistantView-Cl0ZeXwr.js +0 -3
  122. package/dist/assets/GuiPluginSurface-DOZAQKX0.js +0 -1
  123. package/dist/assets/Icon-DvUDsV1z.js +0 -1
  124. package/dist/assets/MobileDetailNavigation-5U28hfYf.js +0 -1
  125. package/dist/assets/MobileTabPageHeader-Bj9MIS38.js +0 -2
  126. package/dist/assets/TerminalView-BZZ8LW4d.js +0 -8
  127. package/dist/assets/dropdown-menu.styles-DGvlOX_5.js +0 -1
  128. package/dist/assets/es-B8sAsuo5.js +0 -15
  129. package/dist/assets/fr-BPpW8T-l.js +0 -13
  130. package/dist/assets/gitApi-D43bAQh1.js +0 -10
  131. package/dist/assets/host-D1EpSUMR.js +0 -1
  132. package/dist/assets/insertionBoundaries-BQjiZAmZ.js +0 -1
  133. package/dist/assets/ja-DEoFDi7P.js +0 -15
  134. package/dist/assets/ko-B45xHN6I.js +0 -15
  135. package/dist/assets/main-C6MDfyZy.js +0 -2
  136. package/dist/assets/main-u5iQScJs.js +0 -169
  137. package/dist/assets/miniChat-Dhfn71Re.js +0 -2
  138. package/dist/assets/mobile-DSVdPfcG.js +0 -2
  139. package/dist/assets/pl-Bm3Je_AX.js +0 -15
  140. package/dist/assets/pt-BR-BiQwFHhL.js +0 -15
  141. package/dist/assets/react-CURmDhtB.js +0 -1
  142. package/dist/assets/renderElectronMiniChatApp-NC8iRPyy.js +0 -2
  143. package/dist/assets/renderMobileApp-D5ai1i6y.js +0 -28
  144. package/dist/assets/runtimeEndpointReset-ByKa_0nu.js +0 -149
  145. package/dist/assets/scheduledTaskNavigation-CZfAnPD-.js +0 -1
  146. package/dist/assets/sessionChangeSummary-D6NlE_5k.js +0 -1
  147. package/dist/assets/sessionLookup-C70EoX-V.js +0 -1
  148. package/dist/assets/sortable-tabs-strip-aKussO2c.js +0 -1
  149. package/dist/assets/speechSettingsQueries-B6qf-mCh.js +0 -4
  150. package/dist/assets/src-NKCZI3Lg.css +0 -2
  151. package/dist/assets/store-BeD2keas.js +0 -15
  152. package/dist/assets/useDesktopWindowControlsLayout-DJxNmCWb.js +0 -1
  153. package/dist/assets/useMobileNavigationStore-Bn4SaalY.js +0 -418
  154. package/dist/assets/useUIStore-DI7va1HH.js +0 -1
  155. package/dist/assets/zh-CN-CMLBHipA.js +0 -15
  156. package/dist/assets/zh-TW-CJlmnnhK.js +0 -15
  157. /package/dist/assets/{sessionChangeSummary-8C8nv-EP.css → sessionLookup-8C8nv-EP.css} +0 -0
@@ -0,0 +1 @@
1
+ import{g as e,r as t}from"./runtime-switch-DEZ1K7qW.js";import{a as n,i as r,r as i}from"./vendor-zustand-B43HCgwC.js";import"./brand-storage-bootstrap-D4BW3w-M.js";var a=null,o=null,s=null,c=new Set,l=!1,u=e=>{if(c.add(e),l||typeof window>`u`)return;l=!0;let t=()=>{for(let e of c)e()};try{window.addEventListener(`pagehide`,t,{capture:!0}),window.addEventListener(`beforeunload`,t,{capture:!0}),window.addEventListener(`visibilitychange`,()=>{typeof document<`u`&&document.visibilityState===`hidden`&&t()}),window.addEventListener(`freeze`,t)}catch{}},d=(e,t)=>{let n;try{n=e()}catch{return}let r=new Map,i=new Set,a,o=()=>{if(a=void 0,r.size===0&&i.size===0)return!0;let e=Array.from(r.entries()),o=Array.from(i);r.clear(),i.clear();let c=!0;for(let[i,a]of e)try{n.setItem(i,JSON.stringify(a,t?.replacer))}catch(e){console.error(`Failed to persist deferred storage value`,e),r.set(i,a),c=!1}for(let e of o)try{n.removeItem(e)}catch(t){console.error(`Failed to remove deferred storage value`,t),i.add(e),c=!1}return c||s(),c},s=()=>{a===void 0&&(a=setTimeout(o,0))};return u(o),{getItem:e=>{if(r.has(e))return r.get(e)??null;if(i.has(e))return null;let a=e=>e===null?null:JSON.parse(e,t?.reviver),o=n.getItem(e);return o instanceof Promise?o.then(a):a(o)},setItem:(e,t)=>{r.set(e,t),i.delete(e),s()},removeItem:e=>{r.delete(e),i.add(e),s()},flush:o}},f=e=>d(()=>h(),e),ee=e=>{let t=new Map,n=new Set,r,i=()=>{if(r=void 0,t.size===0&&n.size===0)return;let i=Array.from(t.entries()),a=Array.from(n);t.clear(),n.clear();for(let[t,n]of i)try{e.setItem(t,n)}catch(e){console.error(`Failed to persist deferred storage value`,e)}for(let t of a)try{e.removeItem(t)}catch(e){console.error(`Failed to remove deferred storage value`,e)}},a=()=>{r===void 0&&(r=setTimeout(i,0))};return u(i),{getItem:r=>t.has(r)?t.get(r)??null:n.has(r)?null:e.getItem(r),setItem:(e,r)=>{t.set(e,r),n.delete(e),a()},removeItem:e=>{t.delete(e),n.add(e),a()},clear:()=>{t.clear(),n.clear(),r!==void 0&&(clearTimeout(r),r=void 0),e.clear()},key:t=>e.key(t),get length(){return e.length}}},p=e=>{if(typeof window>`u`)return null;try{return window[e]??null}catch{return null}},m=()=>{let e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)},clear:()=>{e.clear()},key:t=>Array.from(e.keys())[t]??null,get length(){return e.size}}},te=()=>{let e=p(`localStorage`);if(!e)return m();let t=m(),n=!0,r=()=>{n=!1};return{getItem:i=>{if(n)try{let t=e.getItem(i);if(t!==null)return t}catch{r()}return t.getItem(i)},setItem:(i,a)=>{if(n)try{e.setItem(i,a),t.removeItem(i);return}catch{r();try{e.removeItem(i)}catch{}}t.setItem(i,a)},removeItem:n=>{try{e.removeItem(n)}catch{r()}t.removeItem(n)},clear:()=>{try{e.clear()}catch{r()}t.clear()},key:i=>{if(n)try{return e.key(i)}catch{r()}return t.key(i)},get length(){if(n)try{return e.length+t.length}catch{r()}return t.length}}},h=()=>(a||=te(),a),ne=()=>(s||=ee(h()),s),re=()=>{let e=p(`sessionStorage`);if(!e)return m();let t=m(),n=!0,r=()=>{n=!1};return{getItem:i=>{if(n)try{let t=e.getItem(i);if(t!==null)return t}catch{r()}return t.getItem(i)},setItem:(i,a)=>{if(n)try{e.setItem(i,a),t.removeItem(i);return}catch{r();try{e.removeItem(i)}catch{}}t.setItem(i,a)},removeItem:n=>{try{e.removeItem(n)}catch{r()}t.removeItem(n)},clear:()=>{try{e.clear()}catch{r()}t.clear()},key:i=>{if(n)try{return e.key(i)}catch{r()}return t.key(i)},get length(){if(n)try{return e.length+t.length}catch{r()}return t.length}}},ie=()=>(o||=re(),o);function ae(e,t){return t>=12?e:(e.chatRenderMode===`live`&&(e.chatRenderMode=`sorted`),e.activityRenderMode===`summary`&&(e.activityRenderMode=`collapsed`),e.showTurnChangedFiles===!1&&(e.showTurnChangedFiles=!0),e)}var g={markdown:`0.875rem`,code:`0.75rem`,uiHeader:`0.9375rem`,uiLabel:`0.8750rem`,meta:`0.875rem`,micro:`0.875rem`},oe={markdown:`0.9375rem`,code:`0.8125rem`,uiHeader:`0.875rem`,uiLabel:`0.8125rem`,meta:`0.8125rem`,micro:`0.75rem`},se={markdown:`0.9063rem`,code:`0.8750rem`,uiHeader:`0.9063rem`,uiLabel:`0.8438rem`,meta:`0.8438rem`,micro:`0.7813rem`};function _(e){return`--text-${e.replace(/([A-Z])/g,`-$1`).toLowerCase()}`}function v(e=document.documentElement){return e.classList.contains(`mobile-pointer`)&&!e.classList.contains(`desktop-runtime`)}function ce(e,t){return t?.mobile?oe[e]:g[e]}var y={semanticMarkdown:{fontSize:`var(--text-markdown)`},semanticCode:{fontSize:`var(--text-code)`},uiHeader:{fontSize:`var(--text-ui-header)`},uiLabel:{fontSize:`var(--text-ui-label)`},meta:{fontSize:`var(--text-meta)`},micro:{fontSize:`var(--text-micro)`},ui:{button:{fontSize:`var(--text-ui-label)`,lineHeight:`var(--ui-button-line-height)`,letterSpacing:`var(--ui-button-letter-spacing)`,fontWeight:`var(--ui-button-font-weight)`},buttonSmall:{fontSize:`var(--text-meta)`,lineHeight:`var(--ui-button-small-line-height)`,letterSpacing:`var(--ui-button-small-letter-spacing)`,fontWeight:`var(--ui-button-small-font-weight)`},buttonLarge:{fontSize:`var(--text-ui-label)`,lineHeight:`var(--ui-button-large-line-height)`,letterSpacing:`var(--ui-button-large-letter-spacing)`,fontWeight:`var(--ui-button-large-font-weight)`},label:{fontSize:`var(--text-meta)`,lineHeight:`var(--ui-label-line-height)`,letterSpacing:`var(--ui-label-letter-spacing)`,fontWeight:`var(--ui-label-font-weight)`},caption:{fontSize:`var(--text-micro)`,lineHeight:`var(--ui-caption-line-height)`,letterSpacing:`var(--ui-caption-letter-spacing)`,fontWeight:`var(--ui-caption-font-weight)`},badge:{fontSize:`var(--text-micro)`,lineHeight:`var(--ui-badge-line-height)`,letterSpacing:`var(--ui-badge-letter-spacing)`,fontWeight:`var(--ui-badge-font-weight)`},tooltip:{fontSize:`var(--text-micro)`,lineHeight:`var(--ui-tooltip-line-height)`,letterSpacing:`var(--ui-tooltip-letter-spacing)`,fontWeight:`var(--ui-tooltip-font-weight)`},input:{fontSize:`var(--text-ui-label)`,lineHeight:`var(--ui-input-line-height)`,letterSpacing:`var(--ui-input-letter-spacing)`,fontWeight:`var(--ui-input-font-weight)`},helperText:{fontSize:`var(--text-meta)`,lineHeight:`var(--ui-helper-text-line-height)`,letterSpacing:`var(--ui-helper-text-letter-spacing)`,fontWeight:`var(--ui-helper-text-font-weight)`}},code:{inline:{fontSize:`var(--text-code)`,lineHeight:`var(--code-inline-line-height)`,letterSpacing:`var(--code-inline-letter-spacing)`,fontWeight:`var(--code-inline-font-weight)`},block:{fontSize:`var(--text-code)`,lineHeight:`var(--code-block-line-height)`,letterSpacing:`var(--code-block-letter-spacing)`,fontWeight:`var(--code-block-font-weight)`},lineNumbers:{fontSize:`var(--text-micro)`,lineHeight:`var(--code-line-numbers-line-height)`,letterSpacing:`var(--code-line-numbers-letter-spacing)`,fontWeight:`var(--code-line-numbers-font-weight)`}},markdown:{body:{fontSize:`var(--text-markdown)`,lineHeight:`var(--markdown-body-line-height)`,letterSpacing:`var(--markdown-body-letter-spacing)`,fontWeight:`var(--markdown-body-font-weight)`},bodySmall:{fontSize:`var(--text-meta)`,lineHeight:`var(--markdown-body-small-line-height)`,letterSpacing:`var(--markdown-body-small-letter-spacing)`,fontWeight:`var(--markdown-body-small-font-weight)`},bodyLarge:{fontSize:`var(--text-markdown)`,lineHeight:`var(--markdown-body-large-line-height)`,letterSpacing:`var(--markdown-body-large-letter-spacing)`,fontWeight:`var(--markdown-body-large-font-weight)`},blockquote:{fontSize:`var(--text-markdown)`,lineHeight:`var(--markdown-blockquote-line-height)`,letterSpacing:`var(--markdown-blockquote-letter-spacing)`,fontWeight:`var(--markdown-blockquote-font-weight)`},list:{fontSize:`var(--text-markdown)`,lineHeight:`var(--markdown-list-line-height)`,letterSpacing:`var(--markdown-list-letter-spacing)`,fontWeight:`var(--markdown-list-font-weight)`},link:{fontSize:`var(--text-markdown)`,lineHeight:`var(--markdown-link-line-height)`,letterSpacing:`var(--markdown-link-letter-spacing)`,fontWeight:`var(--markdown-link-font-weight)`},code:{fontSize:`var(--text-code)`,lineHeight:`var(--markdown-code-line-height)`,letterSpacing:`var(--markdown-code-letter-spacing)`,fontWeight:`var(--markdown-code-font-weight)`},codeBlock:{fontSize:`var(--text-code)`,lineHeight:`var(--markdown-code-block-line-height)`,letterSpacing:`var(--markdown-code-block-letter-spacing)`,fontWeight:`var(--markdown-code-block-font-weight)`}},tool:{collapsed:{fontSize:`var(--text-code)`,lineHeight:`var(--code-block-line-height)`,letterSpacing:`var(--code-block-letter-spacing)`,fontWeight:`var(--code-block-font-weight)`},popup:{fontSize:`var(--text-code)`,lineHeight:`var(--code-block-line-height)`,letterSpacing:`var(--code-block-letter-spacing)`,fontWeight:`var(--code-block-font-weight)`},inline:{fontSize:`var(--text-code)`,lineHeight:`var(--code-inline-line-height)`,letterSpacing:`var(--code-inline-letter-spacing)`,fontWeight:`var(--code-inline-font-weight)`}}},b={padding:{collapsed:`0.375rem`,popup:`0.75rem`,popupContainer:`1rem`},backgroundOpacity:{muted:`30`,mutedAlt:`50`},getCollapsedStyles:()=>({...y.tool.collapsed,background:`transparent`,backgroundColor:`transparent`,margin:0,padding:b.padding.collapsed,borderRadius:0}),getPopupStyles:()=>({...y.tool.popup,background:`transparent`,backgroundColor:`transparent`,margin:0,padding:b.padding.popup,borderRadius:`0.75rem`}),getPopupContainerStyles:()=>({...y.tool.popup,background:`transparent`,backgroundColor:`transparent`,margin:0,padding:b.padding.popupContainer,borderRadius:`0.5rem`,overflowX:`auto`}),getInlineStyles:()=>({...y.tool.inline})},x=[{id:`inter`,label:`Inter`,description:`Modern UI sans with excellent readability at small sizes.`,stack:`"Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`Inter`,packageName:`@fontsource/inter`,filePrefix:`inter`,weights:[400,500,600]}},{id:`geist-sans`,label:`Geist Sans`,description:`Crisp sans-serif with a technical interface feel.`,stack:`"Geist Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`Geist Sans`,packageName:`@fontsource/geist-sans`,filePrefix:`geist-sans`,weights:[400,500,600]}},{id:`atkinson-hyperlegible`,label:`Atkinson Hyperlegible`,description:`Accessibility-focused sans-serif optimized for character distinction.`,stack:`"Atkinson Hyperlegible", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`Atkinson Hyperlegible`,packageName:`@fontsource/atkinson-hyperlegible`,filePrefix:`atkinson-hyperlegible`,weights:[400,700]}},{id:`source-sans-3`,label:`Source Sans 3`,description:`Adobe sans-serif tuned for clean, readable interfaces.`,stack:`"Source Sans 3", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`Source Sans 3`,packageName:`@fontsource/source-sans-3`,filePrefix:`source-sans-3`,weights:[400,500,600]}},{id:`roboto`,label:`Roboto`,description:`Familiar Material-style sans-serif with broad UI usage.`,stack:`"Roboto", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`Roboto`,packageName:`@fontsource/roboto`,filePrefix:`roboto`,weights:[400,500,600]}},{id:`noto-sans`,label:`Noto Sans`,description:`Readable sans-serif with strong international coverage.`,stack:`"Noto Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`Noto Sans`,packageName:`@fontsource/noto-sans`,filePrefix:`noto-sans`,weights:[400,500,600]}},{id:`dm-sans`,label:`DM Sans`,description:`Modern product UI sans-serif with friendly proportions.`,stack:`"DM Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`DM Sans`,packageName:`@fontsource/dm-sans`,filePrefix:`dm-sans`,weights:[400,500,600]}},{id:`manrope`,label:`Manrope`,description:`Polished geometric sans-serif for modern app interfaces.`,stack:`"Manrope", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,source:{family:`Manrope`,packageName:`@fontsource/manrope`,filePrefix:`manrope`,weights:[400,500,600]}},{id:`system`,label:`System`,description:`Native operating system interface font.`,stack:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`}],S=[{id:`jetbrains-mono`,label:`JetBrains Mono`,description:`Developer-focused monospace with strong punctuation clarity.`,stack:`"JetBrains Mono", "SFMono-Regular", "Menlo", monospace`,source:{family:`JetBrains Mono`,packageName:`@fontsource/jetbrains-mono`,filePrefix:`jetbrains-mono`,weights:[400,500,600]}},{id:`fira-code`,label:`Fira Code`,description:`Readable coding font with ligature support.`,stack:`"Fira Code", "SFMono-Regular", "Menlo", monospace`,source:{family:`Fira Code`,packageName:`@fontsource/fira-code`,filePrefix:`fira-code`,weights:[400,500,600]}},{id:`geist-mono`,label:`Geist Mono`,description:`Sharp monospace pair for Geist Sans.`,stack:`"Geist Mono", "SFMono-Regular", "Menlo", monospace`,source:{family:`Geist Mono`,packageName:`@fontsource/geist-mono`,filePrefix:`geist-mono`,weights:[400,500,600]}},{id:`commit-mono`,label:`Commit Mono`,description:`Code-oriented monospace with polished editor ergonomics.`,stack:`"Commit Mono", "SFMono-Regular", "Menlo", monospace`,source:{family:`Commit Mono`,packageName:`@fontsource/commit-mono`,filePrefix:`commit-mono`,weights:[400,500,600]}},{id:`source-code-pro`,label:`Source Code Pro`,description:`Adobe monospace designed for source code readability.`,stack:`"Source Code Pro", "SFMono-Regular", "Menlo", monospace`,source:{family:`Source Code Pro`,packageName:`@fontsource/source-code-pro`,filePrefix:`source-code-pro`,weights:[400,500,600]}},{id:`cascadia-code`,label:`Cascadia Code`,description:`Microsoft coding font popular in terminals and editors.`,stack:`"Cascadia Code", "SFMono-Regular", "Menlo", monospace`,source:{family:`Cascadia Code`,packageName:`@fontsource/cascadia-code`,filePrefix:`cascadia-code`,weights:[400,500,600]}},{id:`roboto-mono`,label:`Roboto Mono`,description:`Neutral monospace companion to Roboto.`,stack:`"Roboto Mono", "SFMono-Regular", "Menlo", monospace`,source:{family:`Roboto Mono`,packageName:`@fontsource/roboto-mono`,filePrefix:`roboto-mono`,weights:[400,500,600]}},{id:`iosevka`,label:`Iosevka`,description:`Compact monospace for dense code and terminal layouts.`,stack:`"Iosevka", "SFMono-Regular", "Menlo", monospace`,source:{family:`Iosevka`,packageName:`@fontsource/iosevka`,filePrefix:`iosevka`,weights:[400,500,600]}},{id:`system-mono`,label:`System Mono`,description:`Native operating system monospace font.`,stack:`ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`}],le=e=>Object.fromEntries(e.map(e=>[e.id,e])),ue=le(x),de=le(S),fe=`system`,C=`system-mono`,pe=e=>typeof e==`string`&&e in ue,me=e=>typeof e==`string`&&e in de,w=`yuri.mobileKeyboardMode`,he=`meta[name="viewport"]`,ge=`width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover`,_e=()=>!0;function T(e,t=`resize-content`){return e===`native`||e===`resize-content`?e:t}var ve=e=>T(e)===`resize-content`?`${ge}, interactive-widget=resizes-content`:ge,ye=()=>{if(typeof window>`u`)return`resize-content`;try{return T(localStorage.getItem(w))}catch{return`resize-content`}},E=e=>{let t=T(e);if(typeof window<`u`)try{t===`resize-content`?localStorage.removeItem(w):localStorage.setItem(w,t)}catch{}return t},be=e=>{let t=E(e);if(typeof document>`u`)return t;document.documentElement.setAttribute(`data-yuri-mobile-keyboard-mode`,t);let n=document.querySelector(he);if(n instanceof HTMLMetaElement){let e=ve(t);n.getAttribute(`content`)!==e&&n.setAttribute(`content`,e)}return t};function D(e){return e===`vim`?`vim`:`default`}var xe={completion:{title:`{agent_name} is ready`,message:`{last_message}`},error:{title:`Tool error`,message:`{last_message}`},question:{title:`{agent_name} needs input`,message:`{last_message}`},subtask:{title:`Subtask complete`,message:`{last_message}`}},Se={completion:{title:`Task completed`,message:`{session_name}`},error:{title:`Something went wrong`,message:`{session_name}`},question:{title:`Needs your answer`,message:`{session_name}`},subtask:{title:`Task completed`,message:`{session_name}`}},Ce={completion:{title:`{agent_name} is ready`,message:`{model_name} completed the task`},error:{title:`Tool error`,message:`{last_message}`},question:{title:`Input needed`,message:`{last_message}`},subtask:{title:`{agent_name} is ready`,message:`{model_name} completed the task`}},O={completion:{title:``,message:``},error:{title:``,message:``},question:{title:``,message:``},subtask:{title:``,message:``}},k=(e,t)=>e?e.title===t.title&&e.message===t.message:!1,we=e=>{if(!e||typeof e!=`object`)return!1;let t=e,n=e=>k(t.completion,e.completion)&&k(t.error,e.error)&&k(t.question,e.question)&&k(t.subtask,e.subtask);return n(xe)||n(Se)||n(Ce)},A=600,Te=300,Ee=1400,j=12,De=40,M=120,N=260,P=360,F=new Map,I=e=>(e??t()).trim()||`default`,L=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+$/g,``);return r=r.replace(/\/+/g,`/`),n&&!r.startsWith(`//`)&&(r=`/${r}`),r===``?t.startsWith(`/`)?`/`:``:r},R=e=>Number.isFinite(e)?Math.min(Ee,Math.max(Te,Math.round(e))):A,z=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t?t.replace(/\\/g,`/`):null},B=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t?t.length>M?t.slice(0,M):t:null},V=e=>e===`working`||e===`staged`||e===`turn`?e:null,H=e=>typeof e==`string`&&e.trim()||null,U=e=>typeof e==`string`&&e.trim()||null,Oe=(e,t)=>(e===`file`||e===`preview`)&&t||e,W=(e,t,n)=>{if(e===`diff`||e===`file-diff`)return e;if(typeof n==`string`){let e=n.trim();if(e)return e}return Oe(e,t)},ke=(e,t)=>t===e?e:`${e}:${t}`,G=e=>e===`turn-diff-outside-workspace`?e:null,Ae=e=>{let t=z(e.targetPath),n=W(e.mode,t,e.dedupeKey);return{id:ke(e.mode,n),mode:e.mode,targetPath:t,dedupeKey:n,label:B(e.label),sessionTitleFallback:B(e.sessionTitleFallback),readOnly:e.readOnly===!0,stagedDiff:e.stagedDiff===!0,diffScope:V(e.diffScope)??(e.stagedDiff===!0?`staged`:`working`),diffTargetLine:typeof e.diffTargetLine==`number`&&Number.isFinite(e.diffTargetLine)?Math.max(1,Math.trunc(e.diffTargetLine)):null,diffTurnMessageId:H(e.diffTurnMessageId),diffSessionId:U(e.diffSessionId),fileNotice:e.mode===`file`?G(e.fileNotice):null,touchedAt:Date.now()}},K=(e,t,n)=>{if(e.length<=t)return e;let r=[...e].sort((e,t)=>e.touchedAt-t.touchedAt).filter(e=>e.id!==n),i=e.length-t;if(i<=0||r.length===0)return e.slice(-t);let a=new Set(r.slice(0,i).map(e=>e.id));return e.filter(e=>!a.has(e.id))},je=e=>{if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r;if(e.mode!==`diff`&&e.mode!==`file-diff`&&e.mode!==`file`&&e.mode!==`context`&&e.mode!==`chat`&&e.mode!==`preview`&&e.mode!==`browser`&&e.mode!==`btw`)continue;let i=z(typeof e.targetPath==`string`?e.targetPath:null),a=W(e.mode,i,typeof e.dedupeKey==`string`?e.dedupeKey:null),o=ke(e.mode,a);!o||n.has(o)||(n.add(o),t.push({id:o,mode:e.mode,targetPath:i,dedupeKey:a,label:B(typeof e.label==`string`?e.label:null),sessionTitleFallback:B(typeof e.sessionTitleFallback==`string`?e.sessionTitleFallback:null),readOnly:e.readOnly===!0,stagedDiff:e.stagedDiff===!0,diffScope:V(e.diffScope)??(e.stagedDiff===!0?`staged`:`working`),diffTargetLine:typeof e.diffTargetLine==`number`&&Number.isFinite(e.diffTargetLine)?Math.max(1,Math.trunc(e.diffTargetLine)):null,diffTurnMessageId:H(e.diffTurnMessageId),diffSessionId:U(e.diffSessionId),fileNotice:e.mode===`file`?G(e.fileNotice):null,touchedAt:typeof e.touchedAt==`number`&&Number.isFinite(e.touchedAt)?e.touchedAt:Date.now()}))}return t},q=(e,t)=>t&&e.some(e=>e.id===t)?t:e.length===0?null:e[e.length-1].id,J=e=>{if(e){let t=je(e.tabs),n=q(t,e.activeTabId);return{...e,tabs:t,activeTabId:n,touchedAt:Date.now()}}return{isOpen:!1,expanded:!1,tabs:[],activeTabId:null,width:A,touchedAt:Date.now()}},Me=(e,t)=>{let n=Ae(t),r=e.tabs.findIndex(e=>e.id===n.id),i=r===-1?[...e.tabs,n]:e.tabs.map((e,t)=>t===r?{...e,diffTargetLine:n.diffTargetLine,diffTurnMessageId:n.diffTurnMessageId,diffSessionId:n.diffSessionId,mode:n.mode,targetPath:n.targetPath||e.targetPath,dedupeKey:n.dedupeKey,label:n.label,sessionTitleFallback:n.sessionTitleFallback||e.sessionTitleFallback,stagedDiff:n.stagedDiff,diffScope:n.diffScope,readOnly:n.readOnly,fileNotice:n.mode===`file`?n.fileNotice:null,touchedAt:Date.now()}:e),a=n.id,o=K(i,j,a);return{...e,isOpen:!0,tabs:o,activeTabId:q(o,a),touchedAt:Date.now()}},Ne=(e,t)=>{let n=e.tabs.filter(e=>e.id!==t),r=e.activeTabId===t?n[n.length-1]?.id??null:q(n,e.activeTabId);return{...e,tabs:n,activeTabId:r,touchedAt:Date.now()}},Pe=(e,t,n)=>{if(t===n)return e;let r=e.tabs.findIndex(e=>e.id===t),i=e.tabs.findIndex(e=>e.id===n);if(r===-1||i===-1)return e;let a=[...e.tabs],[o]=a.splice(r,1);return o?(a.splice(i,0,o),{...e,tabs:a,touchedAt:Date.now()}):e},Fe=(e,t,n)=>({...e,tabs:e.tabs.map(e=>e.id===t?{...e,targetPath:n}:e)}),Y=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=L(e);if(!t||!r||typeof r!=`object`)continue;let i=r,a=je(i.tabs).filter(e=>e.mode!==`btw`),o=typeof i.activeTabId==`string`?i.activeTabId:null;a.length===0&&(i.mode===`diff`||i.mode===`file-diff`||i.mode===`file`||i.mode===`context`||i.mode===`chat`)&&(a=[Ae({mode:i.mode,targetPath:typeof i.targetPath==`string`?i.targetPath:null,dedupeKey:typeof i.dedupeKey==`string`?i.dedupeKey:null,label:typeof i.label==`string`?i.label:null})],o=a[0]?.id??null);let s=q(a,o),c=K(a,j,s);n[t]={isOpen:i.isOpen===!0&&(c.length>0||Array.isArray(i.tabs)&&i.tabs.length===0),expanded:i.expanded===!0,tabs:c,activeTabId:q(c,s),width:R(typeof i.width==`number`?i.width:A),touchedAt:typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now()}}return n},X=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},Ie=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},Le=(e,t)=>{let n=L((t||``).trim())||null,r=n?e.contextPanelByDirectory[n]:void 0;return{isRightSidebarOpen:e.isRightSidebarOpen,rightSidebarTab:e.rightSidebarTab,contextPanelDirectory:n,contextPanelIsOpen:!!r?.isOpen,contextPanelActiveTabId:r?.activeTabId??null,contextPanelExpanded:!!r?.expanded,touchedAt:Date.now()}},Re=(e,t,n)=>{let r=L((t||``).trim());if(!r)return e;let i=e[r];if(!i)return e;let a=!!(n?.contextPanelIsOpen&&n.contextPanelDirectory===r),o=a?q(i.tabs,n?.contextPanelActiveTabId??i.activeTabId):i.activeTabId,s=a?!!n?.contextPanelExpanded:i.expanded;return i.isOpen===a&&i.activeTabId===o&&i.expanded===s?e:{...e,[r]:{...i,isOpen:a,activeTabId:o,expanded:s,touchedAt:Date.now()}}},Z=(e,t,n,r)=>{let i=e.contextPanelByDirectory[t],a=i?.tabs.find(e=>e.id===i.activeTabId);return a?.mode===`file`&&a.targetPath===n?!0:e.mainTabGuard?.(`files`,r)??!0},Q=n()(i(r((t,n)=>({theme:`system`,isMultiRunLauncherOpen:!1,isSidebarOpen:!0,sidebarWidth:N,hasManuallyResizedLeftSidebar:!1,isRightSidebarOpen:!1,rightSidebarWidth:P,hasManuallyResizedRightSidebar:!1,rightSidebarTab:`git`,contextPanelByDirectory:{},contextToolDiffByDirectory:{},sessionWorkspacePanelById:{},isBottomTerminalOpen:!1,isBottomTerminalExpanded:!1,bottomTerminalHeight:300,hasManuallyResizedBottomTerminal:!1,isSessionSwitcherOpen:!1,isSessionDropdownOpen:!1,activeMainTab:`chat`,mainTabGuard:null,sidebarOpenBeforeFullscreenTab:null,pendingDiffFile:null,pendingDiffStaged:!1,pendingDiffScope:null,pendingDiffLine:null,pendingDiagramFile:null,pendingFileNavigation:null,pendingFileFocusPath:null,pendingFileViewerMode:null,isMobile:!1,isCommandPaletteOpen:!1,isHelpDialogOpen:!1,isAboutDialogOpen:!1,isOpenCodeStatusDialogOpen:!1,openCodeStatusText:``,isSessionCreateDialogOpen:!1,isScheduledTasksDialogOpen:!1,scheduledTaskOpenRequest:null,isArchivedSessionsDialogOpen:!1,isSettingsDialogOpen:!1,isNewWorktreeDialogOpen:!1,isModelSelectorOpen:!1,isAgentSelectorOpen:!1,isModelSelectorInstant:!1,isAgentSelectorInstant:!1,sidebarSection:`sessions`,settingsPage:`home`,devicePairingRequested:!1,settingsHasOpenedOnce:!1,settingsProjectsSelectedId:null,settingsRemoteInstancesSelectedId:null,eventStreamStatus:`idle`,eventStreamHint:null,showReasoningTraces:!0,sessionTitleRefreshEnabled:!0,sessionGoalEnabled:!0,sessionGoalDefaultBudgetEnabled:!1,sessionGoalDefaultBudget:2e5,collapsibleThinkingBlocks:!0,chatRenderMode:`sorted`,activityRenderMode:`collapsed`,showDeletionDialog:!0,autoDeleteEnabled:!1,autoDeleteAfterDays:30,sessionRetentionAction:`archive`,autoDeleteLastRunAt:null,messageLimit:200,fontSize:100,codeFontSize:100,globalDraftStarters:null,terminalFontSize:13,editorFontSize:13,uiFont:fe,monoFont:C,padding:100,cornerRadius:18,inputBarOffset:0,mobileKeyboardMode:ye(),favoriteModels:[],hiddenModels:[],providerOrder:[],collapsedModelProviders:[],recentModels:[],recentAgents:[],recentEfforts:{},diffLayoutPreference:`inline`,diffFileLayout:{},diffWrapLines:!1,gitChangesViewMode:`tree`,isTimelineDialogOpen:!1,isPromptNavigatorPanelOpen:!1,isImagePreviewOpen:!1,nativeNotificationsEnabled:!1,notificationMode:`hidden-only`,notifyOnSubtasks:!1,dockBadgeEnabled:!0,notifyOnCompletion:!0,notifyOnError:!0,notifyOnQuestion:!0,notifyOnPermission:!0,notifyOnScheduledTasks:!0,notifyOnAssistants:!0,notifyOnGoals:!0,notificationTemplates:{completion:{...O.completion},error:{...O.error},question:{...O.question},subtask:{...O.subtask}},summarizeLastMessage:!1,summaryThreshold:200,summaryLength:100,maxLastMessageLength:250,showTerminalQuickKeysOnDesktop:!1,persistChatDraft:!0,showOpenCodeUpdateNotifications:!0,inputSpellcheckEnabled:!1,wideChatLayoutEnabled:!1,codeBlockLineWrap:!0,showToolFileIcons:!0,showTurnChangedFiles:!0,showExpandedBashTools:!1,showSubagentTaskDetails:!1,timeFormatPreference:`auto`,weekStartPreference:`auto`,desktopWindowControlsPosition:`auto`,userMessageRenderingMode:`markdown`,collapsibleUserMessages:!0,stickyUserHeader:!1,promptNavigatorEnabled:!1,expandedEditorToolbar:!1,showSplitAssistantMessageActions:!1,showAssistantTps:!0,allowPromptingSubagentSessions:!1,isMobileSessionStatusBarCollapsed:!1,mobileSessionPanelOpen:!1,mobileSessionFilterProjectId:null,otaChannelOverride:null,isExpandedInput:!1,workStatusPanelEnabled:!0,workStatusHiddenSections:[],workStatusSectionOrder:[],workStatusExpandedSections:{},workStatusScrollTop:0,workStatusPanelVisible:!1,workStatusPanelFits:!1,workStatusOverlayOpen:!1,reportUsage:!1,shortcutOverrides:{},fileEditorKeymap:`default`,setTheme:e=>{t({theme:e}),n().applyTheme()},toggleSidebar:()=>{t(e=>{let t=!e.isSidebarOpen;return t&&!e.hasManuallyResizedLeftSidebar?{isSidebarOpen:t,sidebarWidth:N}:{isSidebarOpen:t}})},setSidebarOpen:e=>{t(t=>t.isSidebarOpen===e?e&&!t.hasManuallyResizedLeftSidebar&&t.sidebarWidth!==N?{isSidebarOpen:e,sidebarWidth:N}:t:e&&!t.hasManuallyResizedLeftSidebar?{isSidebarOpen:e,sidebarWidth:N}:{isSidebarOpen:e})},setSidebarWidth:e=>{t({sidebarWidth:e,hasManuallyResizedLeftSidebar:!0})},toggleRightSidebar:()=>{t(e=>{let t=!e.isRightSidebarOpen;return{isRightSidebarOpen:t,...t&&!e.hasManuallyResizedRightSidebar?{rightSidebarWidth:P}:{}}})},setRightSidebarOpen:e=>{t(t=>t.isRightSidebarOpen===e?t:{isRightSidebarOpen:e,rightSidebarWidth:e&&!t.hasManuallyResizedRightSidebar&&t.rightSidebarWidth!==P?P:t.rightSidebarWidth})},setRightSidebarWidth:e=>{t({rightSidebarWidth:Math.min(860,Math.max(240,e)),hasManuallyResizedRightSidebar:!0})},setRightSidebarTab:e=>{t({rightSidebarTab:e})},syncWorkspacePanelsForSessionSwitch:({previousSessionId:e,previousDirectory:n,nextSessionId:r,nextDirectory:i})=>{let a=typeof e==`string`?e.trim():``,o=typeof r==`string`?r.trim():``;a!==o&&t(e=>{let t=e.sessionWorkspacePanelById;a&&(t={...t,[a]:Le(e,n)});let r=o?t[o]:void 0,s=Re(e.contextPanelByDirectory,i,r),c=L((n||``).trim()),l=L((i||``).trim()),u=s;if(c&&c!==l){let e=u[c];e?.isOpen&&(u={...u,[c]:{...e,isOpen:!1,touchedAt:Date.now()}})}let d=r?r.isRightSidebarOpen:!1,f=r?.rightSidebarTab??e.rightSidebarTab;return{sessionWorkspacePanelById:Ie(t,De),contextPanelByDirectory:u,isRightSidebarOpen:d,rightSidebarTab:f}})},openContextPanel:e=>{let n=L((e||``).trim());n&&t(e=>{let t=e.contextPanelByDirectory[n];return t?.isOpen?e:{contextPanelByDirectory:X({...e.contextPanelByDirectory,[n]:{...J(t),isOpen:!0}},20),...t?{}:{isRightSidebarOpen:!0,rightSidebarTab:e.activeMainTab===`git`?`files`:`git`}}})},toggleContextPanel:e=>{let t=L((e||``).trim());t&&(n().contextPanelByDirectory[t]?.isOpen?n().closeContextPanel(t):n().openContextPanel(t))},openContextPanelTab:(e,n)=>{let r=L((e||``).trim());r&&t(e=>{let t=e.contextPanelByDirectory[r],i=J(t),a={...e.contextPanelByDirectory,[r]:Me(i,n)};if(n.mode===`diff`||n.mode===`file-diff`){let t={...e.contextToolDiffByDirectory};return delete t[r],{contextPanelByDirectory:X(a,20),contextToolDiffByDirectory:t}}return{contextPanelByDirectory:X(a,20)}})},openContextDiff:(e,t,r=!1,i=null,a,o,s)=>{let c=L((e||``).trim()),l=(t||``).trim();if(!c||!l)return;let u=V(i)??(r?`staged`:`working`);n().openContextPanelTab(c,{mode:`diff`,targetPath:l,stagedDiff:u===`staged`,diffScope:u,diffTargetLine:a,diffTurnMessageId:o,diffSessionId:s})},openContextToolDiff:(e,n,r,i,a,o)=>{let s=L((e||``).trim()),c=(n||``).trim(),l=r.flatMap(e=>{let t=z(e.path),n=typeof e.patch==`string`?e.patch:``;return t&&n.trim()?[{path:t,patch:n}]:[]});if(!s||!c||l.length===0)return;let u={mode:`diff`,targetPath:c,stagedDiff:!1,diffScope:`turn`,diffTargetLine:i,diffTurnMessageId:a,diffSessionId:o};t(e=>{let t=e.contextPanelByDirectory[s],n=J(t),r=X({...e.contextPanelByDirectory,[s]:Me(n,u)},20),i=new Set(Object.keys(r)),o=Object.fromEntries(Object.entries(e.contextToolDiffByDirectory).filter(([e])=>i.has(e)));return o[s]={targetPath:c,patches:l,turnMessageId:H(a)},{contextPanelByDirectory:r,contextToolDiffByDirectory:o}})},openContextFileDiff:(e,t,r=!1,i=null)=>{let a=L((e||``).trim()),o=(t||``).trim();if(!a||!o)return;let s=V(i)??(r?`staged`:`working`);n().openContextPanelTab(a,{mode:`file-diff`,targetPath:o,stagedDiff:s===`staged`,diffScope:s})},openContextFile:(e,t,r)=>{let i=L((e||``).trim()),a=z(t);!i||!a||Z(n(),i,a,()=>n().openContextFile(e,t,r))&&(n().openContextPanelTab(i,{mode:`file`,targetPath:a,fileNotice:G(r?.fileNotice)}),n().setPendingFileFocusPath(a),n().setPendingFileNavigation(null),n().setPendingFileViewerMode(r?.viewerMode??null))},openContextFileAtLine:(e,t,r,i)=>{let a=L((e||``).trim()),o=z(t),s=Number.isFinite(r)?Math.max(1,Math.trunc(r)):1,c=Number.isFinite(i)?Math.max(1,Math.trunc(i)):1;!a||!o||Z(n(),a,o,()=>n().openContextFileAtLine(e,t,r,i))&&(n().openContextPanelTab(a,{mode:`file`,targetPath:o}),n().setPendingFileFocusPath(null),n().setPendingFileNavigation({path:o,line:s,column:c}))},openContextOverview:e=>{let t=L((e||``).trim());t&&n().openContextPanelTab(t,{mode:`context`})},openContextPreview:(e,t)=>{let r=L((e||``).trim()),i=(t||``).trim();if(!r||!i)return;let a=null;try{let e=new URL(i);(e.protocol===`http:`||e.protocol===`https:`)&&(a=e.host||e.hostname||`Preview`)}catch{}n().openContextPanelTab(r,{mode:`preview`,targetPath:i,dedupeKey:i,label:a})},openContextBrowser:(e,t=``)=>{let r=L((e||``).trim());if(!r)return;let i=typeof t==`string`&&t.trim().length>0?t.trim():``;n().openContextPanelTab(r,{mode:`browser`,targetPath:i,dedupeKey:`desktop-browser`,label:`Browser`})},setContextPanelTabTargetPath:(e,n,r)=>{let i=L((e||``).trim()),a=(n||``).trim();!i||!a||t(e=>{let t=e.contextPanelByDirectory[i];return t?{contextPanelByDirectory:{...e.contextPanelByDirectory,[i]:Fe(t,a,r)}}:e})},setActiveContextPanelTab:(e,r)=>{let i=L((e||``).trim()),a=(r||``).trim();if(!i||!a)return;let o=n().contextPanelByDirectory[i]?.tabs.find(e=>e.id===a);o?.mode===`file`&&!Z(n(),i,o.targetPath,()=>n().setActiveContextPanelTab(e,r))||t(e=>{let t=e.contextPanelByDirectory[i],n=J(t);return!n.tabs.some(e=>e.id===a)||n.activeTabId===a&&n.isOpen?e:{contextPanelByDirectory:X({...e.contextPanelByDirectory,[i]:{...n,isOpen:!0,activeTabId:a,touchedAt:Date.now(),tabs:n.tabs.map(e=>e.id===a?{...e,touchedAt:Date.now()}:e)}},20)}})},reorderContextPanelTabs:(e,n,r)=>{let i=L((e||``).trim()),a=(n||``).trim(),o=(r||``).trim();!i||!a||!o||t(e=>{let t=e.contextPanelByDirectory[i],n=J(t);if(!n.tabs.some(e=>e.id===a)||!n.tabs.some(e=>e.id===o))return e;let r=Pe(n,a,o);return r.tabs===n.tabs?e:{contextPanelByDirectory:X({...e.contextPanelByDirectory,[i]:r},20)}})},closeContextPanelTab:(e,n)=>{let r=L((e||``).trim()),i=(n||``).trim();!r||!i||t(e=>{let t=e.contextPanelByDirectory[r],n=J(t);if(!n.tabs.some(e=>e.id===i))return e;let a={...e.contextPanelByDirectory,[r]:Ne(n,i)};if(i===`diff`){let t={...e.contextToolDiffByDirectory};return delete t[r],{contextPanelByDirectory:X(a,20),contextToolDiffByDirectory:t}}return{contextPanelByDirectory:X(a,20)}})},closeActiveContextPanelTab:e=>{let t=L((e||``).trim());if(!t)return!1;let r=n().contextPanelByDirectory[t];if(!r?.isOpen)return!1;if(r.tabs.length===0)return n().closeContextPanel(t),!0;let i=q(r.tabs,r.activeTabId);return i?(n().closeContextPanelTab(t,i),!0):!1},closeContextPanel:e=>{let n=L((e||``).trim());n&&t(e=>{let t=e.contextPanelByDirectory[n];return!t||!t.isOpen?e:{contextPanelByDirectory:X({...e.contextPanelByDirectory,[n]:{...J(t),isOpen:!1}},20)}})},toggleContextPanelExpanded:e=>{let n=L((e||``).trim());n&&t(e=>{let t=e.contextPanelByDirectory[n],r=J(t);return{contextPanelByDirectory:X({...e.contextPanelByDirectory,[n]:{...r,expanded:!r.expanded}},20)}})},setContextPanelWidth:(e,n)=>{let r=L((e||``).trim());r&&t(e=>{let t=e.contextPanelByDirectory[r],i=J(t);return{contextPanelByDirectory:X({...e.contextPanelByDirectory,[r]:{...i,width:R(n)}},20)}})},toggleBottomTerminal:()=>{t(e=>{let t=!e.isBottomTerminalOpen;return t&&typeof window<`u`?{isBottomTerminalOpen:t,bottomTerminalHeight:Math.floor(window.innerHeight*.32),hasManuallyResizedBottomTerminal:!1}:{isBottomTerminalOpen:t}})},setBottomTerminalOpen:e=>{t(t=>{if(t.isBottomTerminalOpen===e){if(!e)return t;if(!t.hasManuallyResizedBottomTerminal&&typeof window<`u`){let n=Math.floor(window.innerHeight*.32);return t.bottomTerminalHeight===n&&t.hasManuallyResizedBottomTerminal===!1?t:{isBottomTerminalOpen:e,bottomTerminalHeight:n,hasManuallyResizedBottomTerminal:!1}}return t}return e&&typeof window<`u`?{isBottomTerminalOpen:e,bottomTerminalHeight:Math.floor(window.innerHeight*.32),hasManuallyResizedBottomTerminal:!1}:{isBottomTerminalOpen:e}})},setBottomTerminalExpanded:e=>{t({isBottomTerminalExpanded:e})},setBottomTerminalHeight:e=>{t({bottomTerminalHeight:e,hasManuallyResizedBottomTerminal:!0})},setSessionSwitcherOpen:e=>{n().isSessionSwitcherOpen!==e&&t({isSessionSwitcherOpen:e})},setSessionDropdownOpen:e=>{n().isSessionDropdownOpen!==e&&t({isSessionDropdownOpen:e})},setMainTabGuard:e=>{n().mainTabGuard!==e&&t({mainTabGuard:e})},setActiveMainTab:e=>{let r=n().mainTabGuard;return r&&!r(e)?!1:(F.set(I(),e),t({activeMainTab:e}),!0)},prepareForRuntimeSwitch:e=>{F.set(I(e),n().activeMainTab),t({contextToolDiffByDirectory:{}})},restoreForRuntimeSwitch:e=>{t({activeMainTab:F.get(I(e))??`chat`})},setPendingDiffFile:(e,n=!1,r=null,i)=>{t({pendingDiffFile:e,pendingDiffStaged:e?n:!1,pendingDiffScope:e?r:null,pendingDiffLine:e&&typeof i==`number`&&Number.isFinite(i)?Math.max(1,Math.trunc(i)):null})},setPendingDiagramFile:e=>{t({pendingDiagramFile:e})},setPendingFileNavigation:e=>{t({pendingFileNavigation:e})},setPendingFileFocusPath:e=>{t({pendingFileFocusPath:e})},setPendingFileViewerMode:e=>{t({pendingFileViewerMode:e})},navigateToDiff:(e,r=!1,i=null,a)=>{let o=n().mainTabGuard;o&&!o(`diff`)||t({pendingDiffFile:e,pendingDiffStaged:r,pendingDiffScope:i,pendingDiffLine:typeof a==`number`&&Number.isFinite(a)?Math.max(1,Math.trunc(a)):null,activeMainTab:`diff`})},consumePendingDiffFile:()=>{let{pendingDiffFile:e}=n();return e&&t({pendingDiffFile:null,pendingDiffStaged:!1,pendingDiffScope:null,pendingDiffLine:null}),e},navigateToDiagram:e=>{let r=n().mainTabGuard;r&&!r(`diagram`)||t({pendingDiagramFile:e,activeMainTab:`diagram`})},consumePendingDiagramFile:()=>{let{pendingDiagramFile:e}=n();return e&&t({pendingDiagramFile:null}),e},setIsMobile:e=>{t({isMobile:e})},toggleCommandPalette:()=>{t(e=>({isCommandPaletteOpen:!e.isCommandPaletteOpen}))},setCommandPaletteOpen:e=>{t({isCommandPaletteOpen:e})},toggleHelpDialog:()=>{t(e=>({isHelpDialogOpen:!e.isHelpDialogOpen}))},setHelpDialogOpen:e=>{t({isHelpDialogOpen:e})},setAboutDialogOpen:e=>{t({isAboutDialogOpen:e})},setOpenCodeStatusDialogOpen:e=>{t({isOpenCodeStatusDialogOpen:e})},setOpenCodeStatusText:e=>{t({openCodeStatusText:e})},setSessionCreateDialogOpen:e=>{t({isSessionCreateDialogOpen:e})},setScheduledTasksDialogOpen:e=>{t({isScheduledTasksDialogOpen:e})},setScheduledTaskOpenRequest:e=>{t({scheduledTaskOpenRequest:e})},setArchivedSessionsDialogOpen:e=>{t({isArchivedSessionsDialogOpen:e})},setSettingsDialogOpen:e=>{t(t=>e?t.settingsHasOpenedOnce?{isSettingsDialogOpen:!0}:{isSettingsDialogOpen:!0,settingsHasOpenedOnce:!0}:{isSettingsDialogOpen:!1})},setNewWorktreeDialogOpen:e=>{t({isNewWorktreeDialogOpen:e})},setModelSelectorOpen:(e,n)=>{t(t=>e?{isModelSelectorOpen:!0,isAgentSelectorOpen:!1,isModelSelectorInstant:n?.instant===!0}:{isModelSelectorOpen:!1,isModelSelectorInstant:n?.instant===!0||n?.instant!==!1&&t.isModelSelectorInstant})},setAgentSelectorOpen:(e,n)=>{t(t=>e?{isAgentSelectorOpen:!0,isModelSelectorOpen:!1,isAgentSelectorInstant:n?.instant===!0}:{isAgentSelectorOpen:!1,isAgentSelectorInstant:n?.instant!==!1&&t.isAgentSelectorInstant})},setSidebarSection:e=>{t({sidebarSection:e})},setSettingsPage:e=>{t({settingsPage:e})},setSettingsProjectsSelectedId:e=>{t({settingsProjectsSelectedId:e})},setSettingsRemoteInstancesSelectedId:e=>{t({settingsRemoteInstancesSelectedId:e})},setEventStreamStatus:(e,n)=>{t({eventStreamStatus:e,eventStreamHint:n??null})},setShowReasoningTraces:n=>{t({showReasoningTraces:n}),e(n)},setSessionTitleRefreshEnabled:e=>{t({sessionTitleRefreshEnabled:e})},setSessionGoalEnabled:e=>{t({sessionGoalEnabled:e})},setSessionGoalDefaultBudgetEnabled:e=>{t({sessionGoalDefaultBudgetEnabled:e})},setSessionGoalDefaultBudget:e=>{t({sessionGoalDefaultBudget:e})},setCollapsibleThinkingBlocks:e=>{t({collapsibleThinkingBlocks:e})},setChatRenderMode:e=>{t({chatRenderMode:e})},setActivityRenderMode:e=>{t({activityRenderMode:e})},setShowDeletionDialog:e=>{t({showDeletionDialog:e})},setAutoDeleteEnabled:e=>{t({autoDeleteEnabled:e})},setAutoDeleteAfterDays:e=>{t({autoDeleteAfterDays:Math.max(1,Math.min(365,e))})},setSessionRetentionAction:e=>{t({sessionRetentionAction:e})},setAutoDeleteLastRunAt:e=>{t({autoDeleteLastRunAt:e})},setMessageLimit:e=>{t({messageLimit:Math.max(10,Math.min(500,Math.round(e)))})},setFontSize:e=>{t({fontSize:Math.max(50,Math.min(200,e))}),n().applyTypography()},setCodeFontSize:e=>{t({codeFontSize:Math.max(50,Math.min(200,e))}),n().applyTypography()},setGlobalDraftStarters:e=>{t({globalDraftStarters:e})},setTerminalFontSize:e=>{t({terminalFontSize:Math.max(9,Math.min(52,Math.round(e)))})},setEditorFontSize:e=>{t({editorFontSize:Math.max(9,Math.min(32,Math.round(e)))})},setUiFont:e=>{t({uiFont:e})},setMonoFont:e=>{t({monoFont:e})},setPadding:e=>{t({padding:Math.max(50,Math.min(200,e))}),n().applyPadding()},setCornerRadius:e=>{t({cornerRadius:e})},applyTypography:()=>{let{fontSize:e,codeFontSize:t}=n(),r=document.documentElement,i=e/100,a=t/100,o=typeof document<`u`&&v(r),s=Object.keys(g);if(i===1&&a===1){for(let e of s)r.style.removeProperty(_(e));return}for(let e of s){let t=ce(e,{mobile:o}),n=parseFloat(t);if(!Number.isFinite(n))continue;let s=e===`code`?a:i;if(s===1){r.style.removeProperty(_(e));continue}if(o){let t=n*16*s;r.style.setProperty(_(e),`calc(${Math.round(t*1e3)/1e3} * var(--dpt))`)}else r.style.setProperty(_(e),`${n*s}rem`)}},applyPadding:()=>{let{padding:e}=n(),t=document.documentElement,r=e/100;if(r===1){t.style.removeProperty(`--user-padding-scale`),t.style.removeProperty(`--line-height-tight`),t.style.removeProperty(`--line-height-normal`),t.style.removeProperty(`--line-height-relaxed`),t.style.removeProperty(`--line-height-loose`);return}let i=Math.sqrt(r);t.style.setProperty(`--user-padding-scale`,i.toString());let a=1+(r-1)*.15;t.style.setProperty(`--line-height-tight`,(1.25*a).toFixed(3)),t.style.setProperty(`--line-height-normal`,(1.5*a).toFixed(3)),t.style.setProperty(`--line-height-relaxed`,(1.625*a).toFixed(3)),t.style.setProperty(`--line-height-loose`,(2*a).toFixed(3))},setDiffLayoutPreference:e=>{t({diffLayoutPreference:e})},setDiffFileLayout:(e,n)=>{t(t=>({diffFileLayout:{...t.diffFileLayout,[e]:n}}))},setDiffWrapLines:e=>{t({diffWrapLines:e})},setGitChangesViewMode:e=>{t({gitChangesViewMode:e})},setInputBarOffset:e=>{t({inputBarOffset:e})},setMobileKeyboardMode:e=>{t(t=>t.mobileKeyboardMode===e?t:{mobileKeyboardMode:e})},toggleFavoriteModel:(e,n,r)=>{t(t=>t.favoriteModels.some(t=>t.providerID===e&&t.modelID===n)?{favoriteModels:t.favoriteModels.filter(t=>t.providerID!==e||t.modelID!==n)}:{favoriteModels:[r===void 0?{providerID:e,modelID:n}:{providerID:e,modelID:n,variant:r},...t.favoriteModels]})},reorderFavoriteModel:(e,n,r,i)=>{t(t=>{let a=t.favoriteModels.findIndex(t=>t.providerID===e&&t.modelID===n),o=t.favoriteModels.findIndex(e=>e.providerID===r&&e.modelID===i);if(a===-1||o===-1||a===o)return t;let s=t.favoriteModels.slice(),[c]=s.splice(a,1);return c?(s.splice(o,0,c),{favoriteModels:s}):t})},setProviderOrder:e=>{t(t=>{let n=e.filter(e=>typeof e==`string`&&e.length>0),r=t.providerOrder;return r.length===n.length&&r.every((e,t)=>e===n[t])?t:{providerOrder:n}})},toggleHiddenModel:(e,n)=>{t(t=>t.hiddenModels.some(t=>t.providerID===e&&t.modelID===n)?{hiddenModels:t.hiddenModels.filter(t=>t.providerID!==e||t.modelID!==n)}:{hiddenModels:[{providerID:e,modelID:n},...t.hiddenModels]})},isHiddenModel:(e,t)=>{let{hiddenModels:r}=n();return r.some(n=>n.providerID===e&&n.modelID===t)},hideAllModels:(e,n)=>{t(t=>{let r=t.hiddenModels.filter(t=>t.providerID!==e);return{hiddenModels:[...n.filter(e=>typeof e==`string`&&e.length>0).map(t=>({providerID:e,modelID:t})),...r]}})},showAllModels:e=>{t(t=>({hiddenModels:t.hiddenModels.filter(t=>t.providerID!==e)}))},toggleModelProviderCollapsed:e=>{let n=typeof e==`string`?e.trim():``;n&&t(e=>e.collapsedModelProviders.includes(n)?{collapsedModelProviders:e.collapsedModelProviders.filter(e=>e!==n)}:{collapsedModelProviders:[...e.collapsedModelProviders,n]})},setModelProvidersCollapsed:(e,n)=>{let r=Array.from(new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean)));r.length!==0&&t(e=>{let t=new Set(r),i=e.collapsedModelProviders.filter(e=>!t.has(e));return{collapsedModelProviders:n?[...i,...r]:i}})},isFavoriteModel:(e,t)=>{let{favoriteModels:r}=n();return r.some(n=>n.providerID===e&&n.modelID===t)},addRecentModel:(e,n,r)=>{t(t=>{let i=[r===void 0?{providerID:e,modelID:n}:{providerID:e,modelID:n,variant:r},...t.recentModels.filter(t=>t.providerID!==e||t.modelID!==n)].slice(0,5),a=t.favoriteModels.findIndex(t=>t.providerID===e&&t.modelID===n);if(a===-1)return{recentModels:i};let o=t.favoriteModels[a];if(o.variant===r)return{recentModels:i};let s=r===void 0?{providerID:o.providerID,modelID:o.modelID}:{providerID:o.providerID,modelID:o.modelID,variant:r},c=t.favoriteModels.slice();return c[a]=s,{recentModels:i,favoriteModels:c}})},addRecentAgent:e=>{let n=typeof e==`string`?e.trim():``;n&&t(e=>{if(e.recentAgents.includes(n))return e;let t=e.recentAgents;return{recentAgents:[n,...t].slice(0,5)}})},addRecentEffort:(e,n,r)=>{let i=typeof e==`string`?e.trim():``,a=typeof n==`string`?n.trim():``;if(!i||!a)return;let o=`${i}/${a}`,s=typeof r==`string`&&r.trim().length>0?r.trim():`default`;t(e=>{let t=e.recentEfforts[o]??[];if(t.includes(s))return e;let n=t;return{recentEfforts:{...e.recentEfforts,[o]:[s,...n].slice(0,5)}}})},updateProportionalSidebarWidths:()=>{typeof window>`u`||t(e=>{let t={};if(e.isBottomTerminalOpen&&!e.hasManuallyResizedBottomTerminal){let n=Math.floor(window.innerHeight*.32);e.bottomTerminalHeight!==n&&(t.bottomTerminalHeight=n)}return Object.keys(t).length>0?t:e})},applyTheme:()=>{let{theme:e}=n(),t=document.documentElement;if(t.classList.remove(`light`,`dark`),e===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;t.classList.add(e)}else t.classList.add(e)},setMultiRunLauncherOpen:e=>{t({isMultiRunLauncherOpen:e})},openMultiRunLauncher:()=>{t({isMultiRunLauncherOpen:!0,isSessionSwitcherOpen:!1})},setTimelineDialogOpen:e=>{t({isTimelineDialogOpen:e})},setPromptNavigatorPanelOpen:e=>{t({isPromptNavigatorPanelOpen:e})},togglePromptNavigatorPanel:()=>{t(e=>({isPromptNavigatorPanelOpen:!e.isPromptNavigatorPanelOpen}))},setImagePreviewOpen:e=>{t({isImagePreviewOpen:e})},setNativeNotificationsEnabled:e=>{t({nativeNotificationsEnabled:e})},setNotificationMode:e=>{t({notificationMode:e})},setShowTerminalQuickKeysOnDesktop:e=>{t({showTerminalQuickKeysOnDesktop:e})},setNotifyOnSubtasks:e=>{t({notifyOnSubtasks:e})},setDockBadgeEnabled:e=>{t({dockBadgeEnabled:e})},setNotifyOnCompletion:e=>{t({notifyOnCompletion:e})},setNotifyOnError:e=>{t({notifyOnError:e})},setNotifyOnQuestion:e=>{t({notifyOnQuestion:e})},setNotifyOnPermission:e=>{t({notifyOnPermission:e})},setNotifyOnScheduledTasks:e=>{t({notifyOnScheduledTasks:e})},setNotifyOnAssistants:e=>{t({notifyOnAssistants:e})},setNotifyOnGoals:e=>{t({notifyOnGoals:e})},setNotificationTemplates:e=>{t({notificationTemplates:e})},setSummarizeLastMessage:e=>{t({summarizeLastMessage:e})},setSummaryThreshold:e=>{t({summaryThreshold:e})},setSummaryLength:e=>{t({summaryLength:e})},setMaxLastMessageLength:e=>{t({maxLastMessageLength:e})},setPersistChatDraft:e=>{t({persistChatDraft:e})},setShowOpenCodeUpdateNotifications:e=>{t({showOpenCodeUpdateNotifications:e})},setInputSpellcheckEnabled:e=>{t({inputSpellcheckEnabled:e})},setWideChatLayoutEnabled:e=>{t({wideChatLayoutEnabled:e})},setCodeBlockLineWrap:e=>{t({codeBlockLineWrap:e})},setShowToolFileIcons:e=>{t({showToolFileIcons:e})},setShowTurnChangedFiles:e=>{t({showTurnChangedFiles:e})},setShowExpandedBashTools:e=>{t({showExpandedBashTools:e})},setShowSubagentTaskDetails:e=>{t({showSubagentTaskDetails:e})},setTimeFormatPreference:e=>{t({timeFormatPreference:e})},setWeekStartPreference:e=>{t({weekStartPreference:e})},setDesktopWindowControlsPosition:e=>{t({desktopWindowControlsPosition:e})},setUserMessageRenderingMode:e=>{t({userMessageRenderingMode:e})},setCollapsibleUserMessages:e=>{t({collapsibleUserMessages:e})},setStickyUserHeader:e=>{t({stickyUserHeader:e})},setPromptNavigatorEnabled:e=>{t({promptNavigatorEnabled:e})},setExpandedEditorToolbar:e=>{t({expandedEditorToolbar:e})},setShowSplitAssistantMessageActions:e=>{t({showSplitAssistantMessageActions:e})},setShowAssistantTps:e=>{t({showAssistantTps:e})},setAllowPromptingSubagentSessions:e=>{t({allowPromptingSubagentSessions:e})},setIsMobileSessionStatusBarCollapsed:e=>{t({isMobileSessionStatusBarCollapsed:e})},setMobileSessionPanelOpen:e=>{t({mobileSessionPanelOpen:e})},setMobileSessionFilterProjectId:e=>{t({mobileSessionFilterProjectId:e})},setOtaChannelOverride:e=>{t({otaChannelOverride:e})},setReportUsage:e=>{t({reportUsage:e})},viewPagerPage:`center`,setViewPagerPage:e=>{t({viewPagerPage:e}),t(e===`left`?{isSessionSwitcherOpen:!0,isRightSidebarOpen:!1}:e===`right`?{isRightSidebarOpen:!0,isSessionSwitcherOpen:!1}:{isSessionSwitcherOpen:!1,isRightSidebarOpen:!1})},setShortcutOverride:(e,n)=>{t(t=>({shortcutOverrides:{...t.shortcutOverrides,[e]:n}}))},clearShortcutOverride:e=>{t(t=>{let n={...t.shortcutOverrides};return delete n[e],{shortcutOverrides:n}})},resetAllShortcutOverrides:()=>{t({shortcutOverrides:{}})},setFileEditorKeymap:e=>{t({fileEditorKeymap:D(e)})},toggleExpandedInput:()=>{t(e=>({isExpandedInput:!e.isExpandedInput}))},setExpandedInput:e=>{t({isExpandedInput:e})},setWorkStatusPanelEnabled:e=>{t({workStatusPanelEnabled:e,workStatusOverlayOpen:!1})},setWorkStatusPanelVisible:e=>{t(t=>t.workStatusPanelVisible===e?t:{workStatusPanelVisible:e})},setWorkStatusPanelFits:e=>{t(t=>t.workStatusPanelFits===e?t:{workStatusPanelFits:e})},setWorkStatusOverlayOpen:e=>{t({workStatusOverlayOpen:e})},setWorkStatusSectionVisible:(e,n)=>{t(t=>{let r=t.workStatusHiddenSections.filter(t=>t!==e);return n||r.push(e),{workStatusHiddenSections:r}})},setWorkStatusHiddenSections:e=>{t({workStatusHiddenSections:e})},setWorkStatusSectionOrder:e=>{t({workStatusSectionOrder:e})},setWorkStatusSectionExpanded:(e,n)=>{t(t=>({workStatusExpandedSections:{...t.workStatusExpandedSections,[e]:n}}))},setWorkStatusScrollTop:e=>{t({workStatusScrollTop:e})}}),{name:`ui-store`,storage:f(),version:14,migrate:(e,t)=>{if(!e||typeof e!=`object`)return e;let n=e;if(delete n.mermaidRenderingMode,ae(n,t),t<11&&n.sidebarWidth===280&&(n.sidebarWidth=N),t<10&&delete n.diffViewMode,t<13&&(delete n.notesPanelHeight,delete n.todoPanelHeight,(n.activeMainTab===`plan`||n.activeMainTab===`context`)&&(n.activeMainTab=`chat`),n.rightSidebarTab===`context`&&(n.rightSidebarTab=`files`)),t<1&&we(n.notificationTemplates)&&(n.notificationTemplates={completion:{...O.completion},error:{...O.error},question:{...O.question},subtask:{...O.subtask}}),t<3){let e=new Set([90,120,180,220]),t=n.memoryLimitHistorical,r=n.memoryLimitActiveSession;typeof t==`number`&&!e.has(t)?n.messageLimit=t:typeof r==`number`&&!e.has(r)&&(n.messageLimit=r),delete n.memoryLimitHistorical,delete n.memoryLimitViewport,delete n.memoryLimitActiveSession}if((typeof n.rightSidebarTab!=`string`||n.rightSidebarTab!==`git`&&n.rightSidebarTab!==`files`&&n.rightSidebarTab!==`browser`)&&(n.rightSidebarTab=`files`),n.contextPanelByDirectory=Y(n.contextPanelByDirectory),t<5)if(!n.shortcutOverrides||typeof n.shortcutOverrides!=`object`)n.shortcutOverrides={};else{let e=n.shortcutOverrides,t={};for(let[n,r]of Object.entries(e))typeof n==`string`&&typeof r==`string`&&(t[n]=r);n.shortcutOverrides=t}return t<6&&(n.contextPanelByDirectory=Y(n.contextPanelByDirectory)),t<7&&(n.contextPanelByDirectory=Y(n.contextPanelByDirectory)),t<8&&n.gitChangesViewMode!==`flat`&&n.gitChangesViewMode!==`tree`&&(n.gitChangesViewMode=`tree`),n.fileEditorKeymap=D(n.fileEditorKeymap),n},partialize:e=>({theme:e.theme,isSidebarOpen:e.isSidebarOpen,sidebarWidth:e.sidebarWidth,isRightSidebarOpen:e.isRightSidebarOpen,rightSidebarWidth:e.rightSidebarWidth,rightSidebarTab:e.rightSidebarTab,contextPanelByDirectory:Object.fromEntries(Object.entries(e.contextPanelByDirectory).map(([e,t])=>{let n=t.tabs.filter(e=>e.mode!==`btw`);return[e,{...t,tabs:n,activeTabId:q(n,t.activeTabId),isOpen:t.isOpen&&(t.tabs.length===0||n.length>0)}]})),isBottomTerminalOpen:e.isBottomTerminalOpen,isBottomTerminalExpanded:e.isBottomTerminalExpanded,bottomTerminalHeight:e.bottomTerminalHeight,isSessionSwitcherOpen:e.isSessionSwitcherOpen,activeMainTab:e.activeMainTab,sidebarSection:e.sidebarSection,settingsPage:e.settingsPage,settingsHasOpenedOnce:e.settingsHasOpenedOnce,settingsProjectsSelectedId:e.settingsProjectsSelectedId,settingsRemoteInstancesSelectedId:e.settingsRemoteInstancesSelectedId,isSessionCreateDialogOpen:e.isSessionCreateDialogOpen,showReasoningTraces:e.showReasoningTraces,sessionTitleRefreshEnabled:e.sessionTitleRefreshEnabled,sessionGoalEnabled:e.sessionGoalEnabled,sessionGoalDefaultBudgetEnabled:e.sessionGoalDefaultBudgetEnabled,sessionGoalDefaultBudget:e.sessionGoalDefaultBudget,collapsibleThinkingBlocks:e.collapsibleThinkingBlocks,chatRenderMode:e.chatRenderMode,activityRenderMode:e.activityRenderMode,showDeletionDialog:e.showDeletionDialog,autoDeleteEnabled:e.autoDeleteEnabled,autoDeleteAfterDays:e.autoDeleteAfterDays,sessionRetentionAction:e.sessionRetentionAction,autoDeleteLastRunAt:e.autoDeleteLastRunAt,messageLimit:e.messageLimit,fontSize:e.fontSize,codeFontSize:e.codeFontSize,globalDraftStarters:e.globalDraftStarters,terminalFontSize:e.terminalFontSize,editorFontSize:e.editorFontSize,uiFont:e.uiFont,monoFont:e.monoFont,padding:e.padding,cornerRadius:e.cornerRadius,favoriteModels:e.favoriteModels,hiddenModels:e.hiddenModels,providerOrder:e.providerOrder,collapsedModelProviders:e.collapsedModelProviders,recentModels:e.recentModels,recentAgents:e.recentAgents,recentEfforts:e.recentEfforts,diffLayoutPreference:e.diffLayoutPreference,diffWrapLines:e.diffWrapLines,gitChangesViewMode:e.gitChangesViewMode,nativeNotificationsEnabled:e.nativeNotificationsEnabled,notificationMode:e.notificationMode,showTerminalQuickKeysOnDesktop:e.showTerminalQuickKeysOnDesktop,notifyOnSubtasks:e.notifyOnSubtasks,dockBadgeEnabled:e.dockBadgeEnabled,notifyOnCompletion:e.notifyOnCompletion,notifyOnError:e.notifyOnError,notifyOnQuestion:e.notifyOnQuestion,notifyOnPermission:e.notifyOnPermission,notifyOnScheduledTasks:e.notifyOnScheduledTasks,notifyOnAssistants:e.notifyOnAssistants,notifyOnGoals:e.notifyOnGoals,notificationTemplates:e.notificationTemplates,summarizeLastMessage:e.summarizeLastMessage,summaryThreshold:e.summaryThreshold,summaryLength:e.summaryLength,maxLastMessageLength:e.maxLastMessageLength,persistChatDraft:e.persistChatDraft,showOpenCodeUpdateNotifications:e.showOpenCodeUpdateNotifications,inputSpellcheckEnabled:e.inputSpellcheckEnabled,wideChatLayoutEnabled:e.wideChatLayoutEnabled,workStatusPanelEnabled:e.workStatusPanelEnabled,workStatusHiddenSections:e.workStatusHiddenSections,workStatusSectionOrder:e.workStatusSectionOrder,workStatusExpandedSections:e.workStatusExpandedSections,workStatusScrollTop:e.workStatusScrollTop,codeBlockLineWrap:e.codeBlockLineWrap,showToolFileIcons:e.showToolFileIcons,showTurnChangedFiles:e.showTurnChangedFiles,showExpandedBashTools:e.showExpandedBashTools,showSubagentTaskDetails:e.showSubagentTaskDetails,timeFormatPreference:e.timeFormatPreference,weekStartPreference:e.weekStartPreference,desktopWindowControlsPosition:e.desktopWindowControlsPosition,userMessageRenderingMode:e.userMessageRenderingMode,collapsibleUserMessages:e.collapsibleUserMessages,stickyUserHeader:e.stickyUserHeader,promptNavigatorEnabled:e.promptNavigatorEnabled,expandedEditorToolbar:e.expandedEditorToolbar,showSplitAssistantMessageActions:e.showSplitAssistantMessageActions,showAssistantTps:e.showAssistantTps,allowPromptingSubagentSessions:e.allowPromptingSubagentSessions,isMobileSessionStatusBarCollapsed:e.isMobileSessionStatusBarCollapsed,mobileSessionFilterProjectId:e.mobileSessionFilterProjectId,otaChannelOverride:e.otaChannelOverride,shortcutOverrides:e.shortcutOverrides,fileEditorKeymap:e.fileEditorKeymap})}),{name:`ui-store`}));e(Q.getState().showReasoningTraces);var $=Q.persist;$?.hasHydrated?.()&&e(Q.getState().showReasoningTraces),typeof $?.onFinishHydration==`function`&&$.onFinishHydration(()=>{e(Q.getState().showReasoningTraces)});export{h as C,ie as S,b as _,E as a,f as b,de as c,x as d,ue as f,se as g,g as h,T as i,C as l,pe as m,Q as n,_e as o,me as p,be as r,S as s,L as t,fe as u,y as v,ne as x,v as y};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{at as t,it as n}from"./vendor-base-ui-BQjbsJ43.js";import{v as r}from"./useUIStore-DI7va1HH.js";import{n as i}from"./vendor-react-D5d-V1vN.js";import{f as a,r as o,t as s}from"./button-DuHjvKJJ.js";import{n as c}from"./useThemeSystem-CGF5jnIh.js";import{n as l}from"./Icon-DvUDsV1z.js";import{n as u}from"./MarkdownRenderer-DZkP4UNr.js";import{n as d,r as f}from"./toolHelpers-iEHVHQ9p.js";import{n as p}from"./markdownTheme-hpURsgju.js";import{n as m,t as h}from"./markdown-worker-oBGEB9Eg.js";var g=e(t(),1),_=i(),v=n(),y=e=>e===`in_progress`||e===`completed`||e===`cancelled`?e:`pending`,b=e=>e.status===`completed`||e.status===`cancelled`,x={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},S={in_progress:`text-foreground`,pending:`text-muted-foreground/60`,completed:`text-muted-foreground`,cancelled:`text-muted-foreground/60`},C={in_progress:`text-foreground`,pending:`text-muted-foreground`,completed:`text-muted-foreground/60 line-through decoration-1`,cancelled:`text-muted-foreground/60 line-through decoration-1`},w=1.2,T=24,E=`1 1`,D=e=>{let t=(0,_.c)(23),{status:n,className:r}=e,{t:i}=a(),s=x[n],c;t[0]!==i||t[1]!==s?(c=i(s),t[0]=i,t[1]=s,t[2]=c):c=t[2];let l=S[n],u;t[3]!==r||t[4]!==l?(u=o(`size-[1em] shrink-0 transition-colors duration-300`,l,r),t[3]=r,t[4]=l,t[5]=u):u=t[5];let d=n===`pending`?w:void 0,f=n===`pending`?T:void 0,p=n===`pending`?E:void 0,m;t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,v.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:d,pathLength:f,strokeDasharray:p}),t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n?h=t[11]:(h=n===`in_progress`?(0,v.jsx)(`path`,{d:`M4.8 8h6.4M8.6 5.4 11.2 8l-2.6 2.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[10]=n,t[11]=h);let g;t[12]===n?g=t[13]:(g=n===`completed`?(0,v.jsx)(`path`,{d:`M5 8 7.5 11 11 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[12]=n,t[13]=g);let y;t[14]===n?y=t[15]:(y=n===`cancelled`?(0,v.jsx)(`path`,{d:`M3.5 12.5 12.5 3.5`,stroke:`currentColor`}):null,t[14]=n,t[15]=y);let b;return t[16]!==g||t[17]!==y||t[18]!==c||t[19]!==u||t[20]!==m||t[21]!==h?(b=(0,v.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,role:`img`,"aria-label":c,className:u,children:[m,h,g,y]}),t[16]=g,t[17]=y,t[18]=c,t[19]=u,t[20]=m,t[21]=h,t[22]=b):b=t[22],b},O=3.2,k=e=>{let t=Math.PI*2*e,n=8+O*Math.sin(t),r=8-O*Math.cos(t);return`M8 8 L8 4.8 A${O} ${O} 0 ${+(e>.5)} 1 ${n.toFixed(3)} ${r.toFixed(3)} Z`},A=e=>{let t=(0,_.c)(11),{done:n,total:r,spinning:i,className:a}=e,s=n===void 0?0:n,c=r===void 0?0:r,l=i!==void 0&&i,u=c>0?Math.min(1,s/c):0,d;t[0]===a?d=t[1]:(d=o(`size-[1.15em] shrink-0 text-foreground`,a),t[0]=a,t[1]=d);let f=l?`yuri-todo-spin`:void 0,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={transformBox:`fill-box`,transformOrigin:`center`},t[2]=p):p=t[2];let m;t[3]===f?m=t[4]:(m=(0,v.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:w,pathLength:T,strokeDasharray:E,className:f,style:p}),t[3]=f,t[4]=m);let h;t[5]===u?h=t[6]:(h=u>0?(0,v.jsx)(`path`,{d:k(u),fill:`currentColor`,className:`transition-opacity duration-300`}):null,t[5]=u,t[6]=h);let g;return t[7]!==d||t[8]!==m||t[9]!==h?(g=(0,v.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:d,children:[m,h]}),t[7]=d,t[8]=m,t[9]=h,t[10]=g):g=t[10],g},j=({done:e,total:t,className:n,animate:r=!0})=>{let i=g.useRef(e),a=r&&i.current!==e;return g.useEffect(()=>{i.current=e},[e]),(0,v.jsxs)(`span`,{className:o(`shrink-0 tabular-nums`,n),children:[(0,v.jsx)(`span`,{className:o(a&&`yuri-todo-count-tick`),children:e},e),`/${t}`]})},ee=e=>{let t=(0,_.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=o(`flex size-[1.15em] shrink-0 items-center justify-center rounded-full bg-[var(--status-success)] text-[var(--status-success-foreground)]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,v.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`size-[70%]`,children:(0,v.jsx)(`path`,{d:`M4.5 8.2 7 10.8 11.5 5.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,v.jsx)(`span`,{"data-todo-complete":!0,className:r,children:i}),t[3]=r,t[4]=a),a},M=e=>{let t=(0,_.c)(27),{todos:n,isWorking:r,animate:i,className:s,rowClassName:c,listRef:l,id:u}=e,d=r!==void 0&&r,f=i!==void 0&&i,{t:p}=a(),m=n.findIndex(N),h;t[0]!==m||t[1]!==n?(h=m>=0?m:n.findIndex(P),t[0]=m,t[1]=n,t[2]=h):h=t[2];let g=h,b;t[3]===n?b=t[4]:(b=n.some(F),t[3]=n,t[4]=b);let S=b,w;t[5]===s?w=t[6]:(w=o(`m-0 flex min-w-0 list-none flex-col gap-[0.125em] p-0`,s),t[5]=s,t[6]=w);let T;if(t[7]!==g||t[8]!==f||t[9]!==S||t[10]!==d||t[11]!==c||t[12]!==p||t[13]!==n){let e;t[15]!==g||t[16]!==f||t[17]!==S||t[18]!==d||t[19]!==c||t[20]!==p?(e=(e,t)=>{let n=y(e.status),r=d&&!S&&t===g&&n===`pending`?`in_progress`:n;return(0,v.jsxs)(`li`,{"data-status":r,"aria-current":t===g?`step`:void 0,className:o(`grid min-w-0 shrink-0 grid-cols-[auto_minmax(0,1fr)] items-start py-[0.25em]`,c??`gap-[0.6em] px-[0.5em]`,f&&`yuri-todo-row-in`),children:[(0,v.jsx)(`span`,{className:o(`flex h-[1.32em] w-[1.15em] items-center justify-center`,f&&`yuri-todo-icon-pop`),title:p(x[r]),children:(0,v.jsx)(D,{status:r})},r),(0,v.jsx)(`span`,{dir:`auto`,title:e.content,className:o(`line-clamp-3 min-w-0 whitespace-normal text-[0.88em] break-words leading-[1.5] transition-colors duration-300`,C[r]),children:(0,v.jsx)(`span`,{className:o(r===`in_progress`&&`animate-text-shimmer`),children:e.content})})]},e.id??`${t}:${e.content}`)},t[15]=g,t[16]=f,t[17]=S,t[18]=d,t[19]=c,t[20]=p,t[21]=e):e=t[21],T=n.map(e),t[7]=g,t[8]=f,t[9]=S,t[10]=d,t[11]=c,t[12]=p,t[13]=n,t[14]=T}else T=t[14];let E;return t[22]!==u||t[23]!==l||t[24]!==w||t[25]!==T?(E=(0,v.jsx)(`ul`,{id:u,ref:l,className:w,children:T}),t[22]=u,t[23]=l,t[24]=w,t[25]=T,t[26]=E):E=t[26],E};function N(e){return e.status===`in_progress`}function P(e){return e.status===`pending`}function F(e){return e.status===`in_progress`}var I=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),L=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,R=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=L(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},z=e=>`<pre><code>${I(e)}</code></pre>`,B=e=>{let t=(0,_.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=g.useRef(null),m;t[0]===d?m=t[1]:(m=p(d),t[0]=d,t[1]=m);let y=m,b,x;t[2]!==n||t[3]!==s||t[4]!==u?(b=()=>{let e=f.current;e&&(e.innerHTML=z(n),R(e,u,s))},x=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=b,t[6]=x):(b=t[5],x=t[6]),g.useLayoutEffect(b,x);let S,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(S=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return h(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,R(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=S,t[12]=C):(S=t[11],C=t[12]),g.useEffect(S,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=y,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,v.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},V=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},H=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},U=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,W=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,G=(e,t)=>!e||typeof e!=`object`?String(e):f(e,t||``),K=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},q=e=>{if(!e||typeof e!=`object`)return;let t=K(e.patch)??K(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=K(e.patch)??K(e.diff);if(t)return t}},J=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},Y=(e,t,n)=>{let r=V(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&U(r)&&(r=W(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=q(n);if(e)return e}return r},X=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{at as t,it as n}from"./vendor-base-ui-BQjbsJ43.js";import{v as r}from"./useUIStore-BbYD420L.js";import{n as i}from"./vendor-react-D5d-V1vN.js";import{f as a,r as o,t as s}from"./button-DinGM3tu.js";import{n as c}from"./useThemeSystem-CGF5jnIh.js";import{n as l}from"./Icon-t2xvbAyN.js";import{n as u}from"./MarkdownRenderer-BlGxjOei.js";import{n as d,r as f}from"./toolHelpers-iEHVHQ9p.js";import{n as p}from"./markdownTheme-hpURsgju.js";import{n as m,t as h}from"./markdown-worker-oBGEB9Eg.js";var g=e(t(),1),_=i(),v=n(),y=e=>e===`in_progress`||e===`completed`||e===`cancelled`?e:`pending`,b=e=>e.status===`completed`||e.status===`cancelled`,x={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},S={in_progress:`text-foreground`,pending:`text-muted-foreground/60`,completed:`text-muted-foreground`,cancelled:`text-muted-foreground/60`},C={in_progress:`text-foreground`,pending:`text-muted-foreground`,completed:`text-muted-foreground/60 line-through decoration-1`,cancelled:`text-muted-foreground/60 line-through decoration-1`},w=1.2,T=24,E=`1 1`,D=e=>{let t=(0,_.c)(23),{status:n,className:r}=e,{t:i}=a(),s=x[n],c;t[0]!==i||t[1]!==s?(c=i(s),t[0]=i,t[1]=s,t[2]=c):c=t[2];let l=S[n],u;t[3]!==r||t[4]!==l?(u=o(`size-[1em] shrink-0 transition-colors duration-300`,l,r),t[3]=r,t[4]=l,t[5]=u):u=t[5];let d=n===`pending`?w:void 0,f=n===`pending`?T:void 0,p=n===`pending`?E:void 0,m;t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,v.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:d,pathLength:f,strokeDasharray:p}),t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n?h=t[11]:(h=n===`in_progress`?(0,v.jsx)(`path`,{d:`M4.8 8h6.4M8.6 5.4 11.2 8l-2.6 2.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[10]=n,t[11]=h);let g;t[12]===n?g=t[13]:(g=n===`completed`?(0,v.jsx)(`path`,{d:`M5 8 7.5 11 11 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[12]=n,t[13]=g);let y;t[14]===n?y=t[15]:(y=n===`cancelled`?(0,v.jsx)(`path`,{d:`M3.5 12.5 12.5 3.5`,stroke:`currentColor`}):null,t[14]=n,t[15]=y);let b;return t[16]!==g||t[17]!==y||t[18]!==c||t[19]!==u||t[20]!==m||t[21]!==h?(b=(0,v.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,role:`img`,"aria-label":c,className:u,children:[m,h,g,y]}),t[16]=g,t[17]=y,t[18]=c,t[19]=u,t[20]=m,t[21]=h,t[22]=b):b=t[22],b},O=3.2,k=e=>{let t=Math.PI*2*e,n=8+O*Math.sin(t),r=8-O*Math.cos(t);return`M8 8 L8 4.8 A${O} ${O} 0 ${+(e>.5)} 1 ${n.toFixed(3)} ${r.toFixed(3)} Z`},A=e=>{let t=(0,_.c)(11),{done:n,total:r,spinning:i,className:a}=e,s=n===void 0?0:n,c=r===void 0?0:r,l=i!==void 0&&i,u=c>0?Math.min(1,s/c):0,d;t[0]===a?d=t[1]:(d=o(`size-[1.15em] shrink-0 text-foreground`,a),t[0]=a,t[1]=d);let f=l?`yuri-todo-spin`:void 0,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={transformBox:`fill-box`,transformOrigin:`center`},t[2]=p):p=t[2];let m;t[3]===f?m=t[4]:(m=(0,v.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:w,pathLength:T,strokeDasharray:E,className:f,style:p}),t[3]=f,t[4]=m);let h;t[5]===u?h=t[6]:(h=u>0?(0,v.jsx)(`path`,{d:k(u),fill:`currentColor`,className:`transition-opacity duration-300`}):null,t[5]=u,t[6]=h);let g;return t[7]!==d||t[8]!==m||t[9]!==h?(g=(0,v.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:d,children:[m,h]}),t[7]=d,t[8]=m,t[9]=h,t[10]=g):g=t[10],g},j=({done:e,total:t,className:n,animate:r=!0})=>{let i=g.useRef(e),a=r&&i.current!==e;return g.useEffect(()=>{i.current=e},[e]),(0,v.jsxs)(`span`,{className:o(`shrink-0 tabular-nums`,n),children:[(0,v.jsx)(`span`,{className:o(a&&`yuri-todo-count-tick`),children:e},e),`/${t}`]})},ee=e=>{let t=(0,_.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=o(`flex size-[1.15em] shrink-0 items-center justify-center rounded-full bg-[var(--status-success)] text-[var(--status-success-foreground)]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,v.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`size-[70%]`,children:(0,v.jsx)(`path`,{d:`M4.5 8.2 7 10.8 11.5 5.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,v.jsx)(`span`,{"data-todo-complete":!0,className:r,children:i}),t[3]=r,t[4]=a),a},M=e=>{let t=(0,_.c)(27),{todos:n,isWorking:r,animate:i,className:s,rowClassName:c,listRef:l,id:u}=e,d=r!==void 0&&r,f=i!==void 0&&i,{t:p}=a(),m=n.findIndex(N),h;t[0]!==m||t[1]!==n?(h=m>=0?m:n.findIndex(P),t[0]=m,t[1]=n,t[2]=h):h=t[2];let g=h,b;t[3]===n?b=t[4]:(b=n.some(F),t[3]=n,t[4]=b);let S=b,w;t[5]===s?w=t[6]:(w=o(`m-0 flex min-w-0 list-none flex-col gap-[0.125em] p-0`,s),t[5]=s,t[6]=w);let T;if(t[7]!==g||t[8]!==f||t[9]!==S||t[10]!==d||t[11]!==c||t[12]!==p||t[13]!==n){let e;t[15]!==g||t[16]!==f||t[17]!==S||t[18]!==d||t[19]!==c||t[20]!==p?(e=(e,t)=>{let n=y(e.status),r=d&&!S&&t===g&&n===`pending`?`in_progress`:n;return(0,v.jsxs)(`li`,{"data-status":r,"aria-current":t===g?`step`:void 0,className:o(`grid min-w-0 shrink-0 grid-cols-[auto_minmax(0,1fr)] items-start py-[0.25em]`,c??`gap-[0.6em] px-[0.5em]`,f&&`yuri-todo-row-in`),children:[(0,v.jsx)(`span`,{className:o(`flex h-[1.32em] w-[1.15em] items-center justify-center`,f&&`yuri-todo-icon-pop`),title:p(x[r]),children:(0,v.jsx)(D,{status:r})},r),(0,v.jsx)(`span`,{dir:`auto`,title:e.content,className:o(`line-clamp-3 min-w-0 whitespace-normal text-[0.88em] break-words leading-[1.5] transition-colors duration-300`,C[r]),children:(0,v.jsx)(`span`,{className:o(r===`in_progress`&&`animate-text-shimmer`),children:e.content})})]},e.id??`${t}:${e.content}`)},t[15]=g,t[16]=f,t[17]=S,t[18]=d,t[19]=c,t[20]=p,t[21]=e):e=t[21],T=n.map(e),t[7]=g,t[8]=f,t[9]=S,t[10]=d,t[11]=c,t[12]=p,t[13]=n,t[14]=T}else T=t[14];let E;return t[22]!==u||t[23]!==l||t[24]!==w||t[25]!==T?(E=(0,v.jsx)(`ul`,{id:u,ref:l,className:w,children:T}),t[22]=u,t[23]=l,t[24]=w,t[25]=T,t[26]=E):E=t[26],E};function N(e){return e.status===`in_progress`}function P(e){return e.status===`pending`}function F(e){return e.status===`in_progress`}var I=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),L=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,R=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=L(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},z=e=>`<pre><code>${I(e)}</code></pre>`,B=e=>{let t=(0,_.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=g.useRef(null),m;t[0]===d?m=t[1]:(m=p(d),t[0]=d,t[1]=m);let y=m,b,x;t[2]!==n||t[3]!==s||t[4]!==u?(b=()=>{let e=f.current;e&&(e.innerHTML=z(n),R(e,u,s))},x=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=b,t[6]=x):(b=t[5],x=t[6]),g.useLayoutEffect(b,x);let S,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(S=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return h(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,R(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=S,t[12]=C):(S=t[11],C=t[12]),g.useEffect(S,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=y,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,v.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},V=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},H=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},U=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,W=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,G=(e,t)=>!e||typeof e!=`object`?String(e):f(e,t||``),K=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},q=e=>{if(!e||typeof e!=`object`)return;let t=K(e.patch)??K(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=K(e.patch)??K(e.diff);if(t)return t}},J=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},Y=(e,t,n)=>{let r=V(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&U(r)&&(r=W(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=q(n);if(e)return e}return r},X=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},Z=(e,t)=>{try{let n=e.trim().split(`
4
4
  `).filter(Boolean);if(n.length===0)return null;let i=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,r=Math.floor(e.length/2),a=!n.endsWith(`/`);i.push({name:n.replace(/\/$/,``),depth:r,isFile:a})}}),(0,v.jsx)(`div`,{className:o(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:r.tool.popup,children:i.map((e,t)=>(0,v.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,v.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,v.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},Q={backgroundColor:`var(--status-info)`,opacity:.6},te=(e,t,n)=>{try{let i=e.trim().split(`
@@ -1,2 +1,2 @@
1
- import{$ as e,B as t,H as n,Q as r,U as i,Z as a,_t as o,bt as s,ct as c,dt as l,et as u,ft as d,gt as f,it as p,ot as m,pt as h,q as g,st as ee,ut as _,vt as te,xt as ne}from"./vendor-codemirror-autocomplete-7c2L_4dM.js";var v=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,y=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(v(e)):v,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return f(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ne(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=o(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(y.prototype[Symbol.iterator]=function(){return this});var b={from:-1,to:-1,match:/.*/.exec(``)},x=`gm`+(/x/.unicode==null?``:`u`),S=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=b,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new T(e,t,n,r,i);this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=E(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=E(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},C=new WeakMap,w=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=C.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return C.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),C.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},T=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=b,this.matchPos=E(e,r),this.re=new RegExp(t,x+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=w.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=E(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=w.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(S.prototype[Symbol.iterator]=T.prototype[Symbol.iterator]=function(){return this});function re(e){try{return new RegExp(e,x),!0}catch{return!1}}function E(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var ie=e=>{let{state:t}=e,i=String(t.doc.lineAt(e.state.selection.main.head).number),{close:a,result:o}=r(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:i},focus:!0,submitLabel:t.phrase(`go`)});return o.then(r=>{let i=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!i){e.dispatch({effects:a});return}let o=t.doc.lineAt(t.selection.main.head),[,s,c,l,u]=i,d=l?+l.slice(1):0,f=c?+c:o.number;if(c&&u){let e=f/100;s&&(e=e*(s==`-`?-1:1)+o.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else c&&s&&(f=f*(s==`-`?-1:1)+o.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),h=m.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[a,n.scrollIntoView(h.from,{y:`center`})],selection:h})}),!0},ae=({state:e,dispatch:t})=>{let{selection:n}=e,r=m.create(n.ranges.map(t=>e.wordAt(t.head)||m.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function D(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new y(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new y(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var oe=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return ae({state:e,dispatch:t});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=i))return!1;let a=D(e,i);return a?(t(e.update({selection:e.selection.addRange(m.range(a.from,a.to),!1),effects:n.scrollIntoView(a.to)})),!0):!1},O=c.define({combine(e){return te(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ce(e),scrollToMatch:e=>n.scrollIntoView(e)})}});function se(e){return e?[O.of(e),$]:$}var k=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||re(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
2
- `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new pe(this):new ue(this)}getCursor(e,t=0,n){let r=e.doc?e:ee.create({doc:e});return n??=r.doc.length,this.regexp?M(this,r,t,n):j(this,r,t,n)}},A=class{constructor(e){this.spec=e}};function ce(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function j(e,t,n,r){let i;return e.wholeWord&&(i=le(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ce(e.test,t,i)),new y(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function le(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(N(i,n-a))!=p.Word||t(P(i,n-a))!=p.Word)&&(t(P(i,r-a))!=p.Word||t(N(i,r-a))!=p.Word))}var ue=class extends A{constructor(e){super(e)}nextMatch(e,t,n){let r=j(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=j(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=j(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=j(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=j(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function de(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function M(e,t,n,r){let i;return e.wholeWord&&(i=fe(t.charCategorizer(t.selection.main.head))),e.test&&(i=de(e.test,t,i)),new S(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function N(e,t){return e.slice(s(e,t,!1),t)}function P(e,t){return e.slice(t,s(e,t))}function fe(e){return(t,n,r)=>!r[0].length||(e(N(r.input,r.index))!=p.Word||e(P(r.input,r.index))!=p.Word)&&(e(P(r.input,r.index+r[0].length))!=p.Word||e(N(r.input,r.index+r[0].length))!=p.Word)}var pe=class extends A{nextMatch(e,t,n){let r=M(this.spec,e,n,e.doc.length).next();return r.done&&(r=M(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=M(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=M(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=M(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},F=d.define(),I=d.define(),L=h.define({create(e){return new R(W(e).create(),null)},update(e,t){for(let n of t.effects)n.is(F)?e=new R(n.value.create(),e.panel):n.is(I)&&(e=new R(e.query,n.value?U:null));return e},provide:t=>e.from(t,e=>e.panel)});function me(e){let t=e.field(L,!1);return t?t.query.spec:W(e)}function he(e){return e.field(L,!1)?.panel!=null}var R=class{constructor(e,t){this.query=e,this.panel=t}},ge=t.mark({class:`cm-searchMatch`}),_e=t.mark({class:`cm-searchMatch cm-searchMatch-selected`}),ve=i.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(L))}update(e){let t=e.state.field(L);(t!=e.startState.field(L)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:n}){if(!n||!e.spec.valid)return t.none;let{view:r}=this,i=new l;for(let t=0,n=r.visibleRanges,a=n.length;t<a;t++){let{from:o,to:s}=n[t];for(;t<a-1&&s>n[t+1].from-500;)s=n[++t].to;e.highlight(r.state,o,s,(e,t)=>{let n=r.state.selection.ranges.some(n=>n.from==e&&n.to==t);i.add(e,t,n?_e:ge)})}return i.finish()}},{decorations:e=>e.decorations});function z(e){return t=>{let n=t.state.field(L,!1);return n&&n.query.spec.valid?e(t,n):q(t)}}var B=z((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=m.single(r.from,r.to),a=e.state.facet(O);return e.dispatch({selection:i,effects:[Q(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),K(e),!0}),V=z((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=m.single(i.from,i.to),o=e.state.facet(O);return e.dispatch({selection:a,effects:[Q(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),K(e),!0}),ye=z((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:m.create(n.map(e=>m.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),be=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new y(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(m.range(t.value.from,t.value.to))}return t(e.update({selection:m.create(a,o),userEvent:`select.search.matches`})),!0},H=z((e,{query:t})=>{let{state:r}=e,{from:i,to:a}=r.selection.main;if(r.readOnly)return!1;let o=t.nextMatch(r,i,i);if(!o)return!1;let s=o,c=[],l,u,d=[];s.from==i&&s.to==a&&(u=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:u}),s=t.nextMatch(r,s.from,s.to),d.push(n.announce.of(r.phrase(`replaced match on line $`,r.doc.lineAt(i).number)+`.`)));let f=e.state.changes(c);return s&&(l=m.single(s.from,s.to).map(f),d.push(Q(e,s)),d.push(r.facet(O).scrollToMatch(l.main,e))),e.dispatch({changes:f,selection:l,effects:d,userEvent:`input.replace`}),!0}),xe=z((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!r.length)return!1;let i=e.state.phrase(`replaced $ matches`,r.length)+`.`;return e.dispatch({changes:r,effects:n.announce.of(i),userEvent:`input.replace.all`}),!0});function U(e){return e.state.facet(O).createPanel(e)}function W(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(O);return new k({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function G(e){let t=g(e,U);return t&&t.dom.querySelector(`[main-field]`)}function K(e){let t=G(e);t&&t==e.root.activeElement&&t.select()}var q=e=>{let t=e.state.field(L,!1);if(t&&t.panel){let n=G(e);if(n&&n!=e.root.activeElement){let r=W(e.state,t.query.spec);r.valid&&e.dispatch({effects:F.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[I.of(!0),t?F.of(W(e.state,t.query.spec)):d.appendConfig.of($)]});return!0},J=e=>{let t=e.state.field(L,!1);if(!t||!t.panel)return!1;let n=g(e,U);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:I.of(!1)}),!0},Se=[{key:`Mod-f`,run:q,scope:`editor search-panel`},{key:`F3`,run:B,shift:V,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:B,shift:V,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:J,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:be},{key:`Mod-Alt-g`,run:ie},{key:`Mod-d`,run:oe,preventDefault:!0}],Ce=class{constructor(e){this.view=e;let t=this.query=e.state.field(L).query.spec;this.commit=this.commit.bind(this),this.searchField=u(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=u(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=u(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=u(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=u(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return u(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=u(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>B(e),[Y(e,`next`)]),n(`prev`,()=>V(e),[Y(e,`previous`)]),n(`select`,()=>ye(e),[Y(e,`all`)]),u(`label`,null,[this.caseField,Y(e,`match case`)]),u(`label`,null,[this.reField,Y(e,`regexp`)]),u(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[u(`br`),this.replaceField,n(`replace`,()=>H(e),[Y(e,`replace`)]),n(`replaceAll`,()=>xe(e),[Y(e,`replace all`)])],u(`button`,{name:`close`,onclick:()=>J(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new k({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:F.of(e)}))}keydown(e){a(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?V:B)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),H(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(F)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(O).top}};function Y(e,t){return e.state.phrase(t)}var X=30,Z=/[\s\.,:;?!]/;function Q(e,{from:t,to:r}){let i=e.state.doc.lineAt(t),a=e.state.doc.lineAt(r).to,o=Math.max(i.from,t-X),s=Math.min(a,r+X),c=e.state.sliceDoc(o,s);if(o!=i.from){for(let e=0;e<X;e++)if(!Z.test(c[e+1])&&Z.test(c[e])){c=c.slice(e);break}}if(s!=a){for(let e=c.length-1;e>c.length-X;e--)if(!Z.test(c[e-1])&&Z.test(c[e])){c=c.slice(0,e);break}}return n.announce.of(`${e.state.phrase(`current match`)}. ${c} ${e.state.phrase(`on line`)} ${i.number}.`)}var we=n.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),$=[L,_.low(ve),we];export{q as a,he as c,me as i,F as l,k as n,se as o,J as r,Se as s,S as t};
1
+ import{$ as e,B as t,H as n,Q as r,U as i,Z as a,_t as o,bt as s,ct as c,dt as l,et as u,ft as d,gt as f,it as p,ot as m,pt as h,q as g,st as ee,ut as te,vt as ne,xt as re}from"./vendor-codemirror-autocomplete-7c2L_4dM.js";var _=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,v=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(_(e)):_,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return f(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=re(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=o(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(v.prototype[Symbol.iterator]=function(){return this});var y={from:-1,to:-1,match:/.*/.exec(``)},b=`gm`+(/x/.unicode==null?``:`u`),x=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=y,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new w(e,t,n,r,i);this.re=new RegExp(t,b+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=T(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=T(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},S=new WeakMap,C=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=S.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return S.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),S.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},w=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=y,this.matchPos=T(e,r),this.re=new RegExp(t,b+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=C.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=T(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=C.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(x.prototype[Symbol.iterator]=w.prototype[Symbol.iterator]=function(){return this});function ie(e){try{return new RegExp(e,b),!0}catch{return!1}}function T(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var E=e=>{let{state:t}=e,i=String(t.doc.lineAt(e.state.selection.main.head).number),{close:a,result:o}=r(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:i},focus:!0,submitLabel:t.phrase(`go`)});return o.then(r=>{let i=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!i){e.dispatch({effects:a});return}let o=t.doc.lineAt(t.selection.main.head),[,s,c,l,u]=i,d=l?+l.slice(1):0,f=c?+c:o.number;if(c&&u){let e=f/100;s&&(e=e*(s==`-`?-1:1)+o.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else c&&s&&(f=f*(s==`-`?-1:1)+o.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),h=m.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[a,n.scrollIntoView(h.from,{y:`center`})],selection:h})}),!0},ae=({state:e,dispatch:t})=>{let{selection:n}=e,r=m.create(n.ranges.map(t=>e.wordAt(t.head)||m.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function D(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new v(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new v(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var oe=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return ae({state:e,dispatch:t});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=i))return!1;let a=D(e,i);return a?(t(e.update({selection:e.selection.addRange(m.range(a.from,a.to),!1),effects:n.scrollIntoView(a.to)})),!0):!1},O=c.define({combine(e){return ne(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ce(e),scrollToMatch:e=>n.scrollIntoView(e)})}});function se(e){return e?[O.of(e),$]:$}var k=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||ie(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
2
+ `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new pe(this):new ue(this)}getCursor(e,t=0,n){let r=e.doc?e:ee.create({doc:e});return n??=r.doc.length,this.regexp?M(this,r,t,n):j(this,r,t,n)}},A=class{constructor(e){this.spec=e}};function ce(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function j(e,t,n,r){let i;return e.wholeWord&&(i=le(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ce(e.test,t,i)),new v(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function le(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(N(i,n-a))!=p.Word||t(P(i,n-a))!=p.Word)&&(t(P(i,r-a))!=p.Word||t(N(i,r-a))!=p.Word))}var ue=class extends A{constructor(e){super(e)}nextMatch(e,t,n){let r=j(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=j(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=j(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=j(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=j(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function de(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function M(e,t,n,r){let i;return e.wholeWord&&(i=fe(t.charCategorizer(t.selection.main.head))),e.test&&(i=de(e.test,t,i)),new x(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function N(e,t){return e.slice(s(e,t,!1),t)}function P(e,t){return e.slice(t,s(e,t))}function fe(e){return(t,n,r)=>!r[0].length||(e(N(r.input,r.index))!=p.Word||e(P(r.input,r.index))!=p.Word)&&(e(P(r.input,r.index+r[0].length))!=p.Word||e(N(r.input,r.index+r[0].length))!=p.Word)}var pe=class extends A{nextMatch(e,t,n){let r=M(this.spec,e,n,e.doc.length).next();return r.done&&(r=M(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=M(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=M(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=M(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},F=d.define(),I=d.define(),L=h.define({create(e){return new R(W(e).create(),null)},update(e,t){for(let n of t.effects)n.is(F)?e=new R(n.value.create(),e.panel):n.is(I)&&(e=new R(e.query,n.value?U:null));return e},provide:t=>e.from(t,e=>e.panel)});function me(e){let t=e.field(L,!1);return t?t.query.spec:W(e)}function he(e){return e.field(L,!1)?.panel!=null}var R=class{constructor(e,t){this.query=e,this.panel=t}},ge=t.mark({class:`cm-searchMatch`}),_e=t.mark({class:`cm-searchMatch cm-searchMatch-selected`}),ve=i.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(L))}update(e){let t=e.state.field(L);(t!=e.startState.field(L)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:n}){if(!n||!e.spec.valid)return t.none;let{view:r}=this,i=new l;for(let t=0,n=r.visibleRanges,a=n.length;t<a;t++){let{from:o,to:s}=n[t];for(;t<a-1&&s>n[t+1].from-500;)s=n[++t].to;e.highlight(r.state,o,s,(e,t)=>{let n=r.state.selection.ranges.some(n=>n.from==e&&n.to==t);i.add(e,t,n?_e:ge)})}return i.finish()}},{decorations:e=>e.decorations});function z(e){return t=>{let n=t.state.field(L,!1);return n&&n.query.spec.valid?e(t,n):q(t)}}var B=z((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=m.single(r.from,r.to),a=e.state.facet(O);return e.dispatch({selection:i,effects:[Q(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),K(e),!0}),V=z((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=m.single(i.from,i.to),o=e.state.facet(O);return e.dispatch({selection:a,effects:[Q(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),K(e),!0}),ye=z((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:m.create(n.map(e=>m.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),be=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new v(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(m.range(t.value.from,t.value.to))}return t(e.update({selection:m.create(a,o),userEvent:`select.search.matches`})),!0},H=z((e,{query:t})=>{let{state:r}=e,{from:i,to:a}=r.selection.main;if(r.readOnly)return!1;let o=t.nextMatch(r,i,i);if(!o)return!1;let s=o,c=[],l,u,d=[];s.from==i&&s.to==a&&(u=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:u}),s=t.nextMatch(r,s.from,s.to),d.push(n.announce.of(r.phrase(`replaced match on line $`,r.doc.lineAt(i).number)+`.`)));let f=e.state.changes(c);return s&&(l=m.single(s.from,s.to).map(f),d.push(Q(e,s)),d.push(r.facet(O).scrollToMatch(l.main,e))),e.dispatch({changes:f,selection:l,effects:d,userEvent:`input.replace`}),!0}),xe=z((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!r.length)return!1;let i=e.state.phrase(`replaced $ matches`,r.length)+`.`;return e.dispatch({changes:r,effects:n.announce.of(i),userEvent:`input.replace.all`}),!0});function U(e){return e.state.facet(O).createPanel(e)}function W(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(O);return new k({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function G(e){let t=g(e,U);return t&&t.dom.querySelector(`[main-field]`)}function K(e){let t=G(e);t&&t==e.root.activeElement&&t.select()}var q=e=>{let t=e.state.field(L,!1);if(t&&t.panel){let n=G(e);if(n&&n!=e.root.activeElement){let r=W(e.state,t.query.spec);r.valid&&e.dispatch({effects:F.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[I.of(!0),t?F.of(W(e.state,t.query.spec)):d.appendConfig.of($)]});return!0},J=e=>{let t=e.state.field(L,!1);if(!t||!t.panel)return!1;let n=g(e,U);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:I.of(!1)}),!0},Se=[{key:`Mod-f`,run:q,scope:`editor search-panel`},{key:`F3`,run:B,shift:V,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:B,shift:V,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:J,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:be},{key:`Mod-Alt-g`,run:E},{key:`Mod-d`,run:oe,preventDefault:!0}],Ce=class{constructor(e){this.view=e;let t=this.query=e.state.field(L).query.spec;this.commit=this.commit.bind(this),this.searchField=u(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=u(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=u(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=u(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=u(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return u(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=u(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>B(e),[Y(e,`next`)]),n(`prev`,()=>V(e),[Y(e,`previous`)]),n(`select`,()=>ye(e),[Y(e,`all`)]),u(`label`,null,[this.caseField,Y(e,`match case`)]),u(`label`,null,[this.reField,Y(e,`regexp`)]),u(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[u(`br`),this.replaceField,n(`replace`,()=>H(e),[Y(e,`replace`)]),n(`replaceAll`,()=>xe(e),[Y(e,`replace all`)])],u(`button`,{name:`close`,onclick:()=>J(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new k({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:F.of(e)}))}keydown(e){a(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?V:B)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),H(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(F)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(O).top}};function Y(e,t){return e.state.phrase(t)}var X=30,Z=/[\s\.,:;?!]/;function Q(e,{from:t,to:r}){let i=e.state.doc.lineAt(t),a=e.state.doc.lineAt(r).to,o=Math.max(i.from,t-X),s=Math.min(a,r+X),c=e.state.sliceDoc(o,s);if(o!=i.from){for(let e=0;e<X;e++)if(!Z.test(c[e+1])&&Z.test(c[e])){c=c.slice(e);break}}if(s!=a){for(let e=c.length-1;e>c.length-X;e--)if(!Z.test(c[e-1])&&Z.test(c[e])){c=c.slice(0,e);break}}return n.announce.of(`${e.state.phrase(`current match`)}. ${c} ${e.state.phrase(`on line`)} ${i.number}.`)}var we=n.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),$=[L,te.low(ve),we];export{E as a,Se as c,me as i,he as l,k as n,q as o,J as r,se as s,x as t,F as u};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,C as n,E as r,F as i,O as a,P as o,S as s,_ as c,b as l,k as u,r as d,v as f,x as p}from"./vendor-opencode-client-UL_TecvQ.js";var m=f(),h=f(),g=f(),_=f(),v=Symbol.for(`opencode.plugin.live`);function y(e){return Object.assign(e,{[v]:!0})}function b(e){return v in e}var x={global:(e,t,n)=>({scope:`global`,schema:e,initial:t,from:n}),session:(e,t,n)=>({scope:`session`,schema:e,initial:t,from:n})},S={define:e=>({kind:`registry`,id:e})},C={define:e=>({kind:`contract`,id:e})},w={define:e=>({kind:`ipc`,id:e.id,spec:e})},T=S.define(`command`),E=S.define(`menu-item`),D=S.define(`panel`),O=S.define(`settings-page`),k=S.define(`server`),A=S.define(`link-handler`),j=S.define(`titlebar-item`),M=S.define(`composer-pill`),N=S.define(`slot`),P=S.define(`style`);function F(){let e=i(m);if(!e)throw Error(`usePlugin must run inside a plugin contribution`);return e}function I(e){let t=F();return n=>c(m.Provider,{value:t,get children(){return c(e,n)}})}function L(){let e=i(g);if(!e)throw Error(`usePanel must run inside a panel render`);return e}function R(){return i(_)}function z(e,n,i){let o=e,c=i?.equals,d=b(o)?l(()=>{let e=o();return e.status===`active`?e:void 0},void 0,{equals:(e,t)=>e?.generation===t?.generation}):l(()=>{let e=o();return e==null||e===!1?void 0:{value:e}},void 0,{equals:(e,t)=>e===void 0||t===void 0?e===t:e.value===t.value||!!c?.(e.value,t.value)});p(a(d,e=>{let a=e===void 0?i?.otherwise:()=>n(e.value);if(!a)return;let o={ended:!1},c=s(e=>({owner:r(),dispose:e}));u(()=>{o.ended=!0,c.dispose()}),c.owner&&(c.owner.context={...c.owner.context,[h.id]:o}),t(c.owner,a)}))}function B(e,t){let[n,r]=d({latest:void 0,loading:!1,error:void 0});return z(e,e=>{let n=new AbortController;u(()=>n.abort()),r({loading:!0,error:void 0}),Promise.try(()=>t(e,n.signal)).then(e=>{n.signal.aborted||r({latest:e,loading:!1,error:void 0})},e=>{n.signal.aborted||r({loading:!1,error:e})})},{otherwise:()=>r({loading:!1,error:void 0})}),n}function V(e){let t=F().sessions,r=()=>t.current()?.visit,[i,a]=n({visit:void 0,value:e});return[()=>{let t=i();return t.visit!==void 0&&t.visit===r()?t.value:e},e=>void a({visit:o(r),value:e})]}var H=e({define:()=>U});function U(e){return e}var W=e({Command:()=>T,ComposerPill:()=>M,Contract:()=>C,Ipc:()=>w,LinkHandler:()=>A,MenuItem:()=>E,Panel:()=>D,Plugin:()=>H,Registry:()=>S,Server:()=>k,SettingsPage:()=>O,Slot:()=>N,Store:()=>x,Style:()=>P,TitlebarItem:()=>j,bindPlugin:()=>I,createKeyed:()=>z,createLatest:()=>B,createVisitState:()=>V,useDrawer:()=>R,usePanel:()=>L,usePlugin:()=>F}),G=e({FileTree:()=>K,FileViewer:()=>J,OpenInApp:()=>q}),K=C.define(`file.tree`),q=C.define(`file.openInApp`),J=S.define(`file.viewer`),Y=e({Changes:()=>X}),X=C.define(`review.changes`),Z=e({Browser:()=>Q}),Q=C.define(`browser`),$=e({Rpc:()=>$,define:()=>ee});function ee(e){let t=Object.values(e.methods).flatMap(e=>Object.keys(e.errors??{})).find(e=>e.startsWith(`rpc.`));if(t)throw Error(`RPC error names starting with "rpc." are reserved: ${t}`);return e}var te=e({Rpc:()=>$});export{G as a,A as c,O as d,h as f,y as h,Y as i,E as l,m,$ as n,W as o,g as p,Z as r,T as s,te as t,D as u};
1
+ import{n as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,C as n,E as r,F as i,O as a,P as o,S as s,_ as c,b as l,k as u,r as d,v as f,x as p}from"./vendor-opencode-client-UL_TecvQ.js";var m=f(),h=f(),g=f(),_=f(),v=Symbol.for(`opencode.plugin.live`);function y(e){return Object.assign(e,{[v]:!0})}function b(e){return v in e}var x={global:(e,t,n)=>({scope:`global`,schema:e,initial:t,from:n}),session:(e,t,n)=>({scope:`session`,schema:e,initial:t,from:n})},S={define:e=>({kind:`registry`,id:e})},C={define:e=>({kind:`contract`,id:e})},w={define:e=>({kind:`ipc`,id:e.id,spec:e})},T=S.define(`command`),E=S.define(`menu-item`),D=S.define(`panel`),O=S.define(`settings-page`),k=S.define(`server`),A=S.define(`link-handler`),j=S.define(`titlebar-item`),M=S.define(`composer-pill`),N=S.define(`slot`),P=S.define(`style`);function F(){let e=i(m);if(!e)throw Error(`usePlugin must run inside a plugin contribution`);return e}function I(e){let t=F();return n=>c(m.Provider,{value:t,get children(){return c(e,n)}})}function L(){let e=i(g);if(!e)throw Error(`usePanel must run inside a panel render`);return e}function R(){return i(_)}function z(e,n,i){let o=e,c=i?.equals,d=b(o)?l(()=>{let e=o();return e.status===`active`?e:void 0},void 0,{equals:(e,t)=>e?.generation===t?.generation}):l(()=>{let e=o();return e==null||e===!1?void 0:{value:e}},void 0,{equals:(e,t)=>e===void 0||t===void 0?e===t:e.value===t.value||!!c?.(e.value,t.value)});p(a(d,e=>{let a=e===void 0?i?.otherwise:()=>n(e.value);if(!a)return;let o={ended:!1},c=s(e=>({owner:r(),dispose:e}));u(()=>{o.ended=!0,c.dispose()}),c.owner&&(c.owner.context={...c.owner.context,[h.id]:o}),t(c.owner,a)}))}function B(e,t){let[n,r]=d({latest:void 0,loading:!1,error:void 0});return z(e,e=>{let n=new AbortController;u(()=>n.abort()),r({loading:!0,error:void 0}),Promise.try(()=>t(e,n.signal)).then(e=>{n.signal.aborted||r({latest:e,loading:!1,error:void 0})},e=>{n.signal.aborted||r({loading:!1,error:e})})},{otherwise:()=>r({loading:!1,error:void 0})}),n}function V(e){let t=F().sessions,r=()=>t.current()?.visit,[i,a]=n({visit:void 0,value:e});return[()=>{let t=i();return t.visit!==void 0&&t.visit===r()?t.value:e},e=>void a({visit:o(r),value:e})]}var H=e({define:()=>U});function U(e){return e}var W=e({Command:()=>T,ComposerPill:()=>M,Contract:()=>C,Ipc:()=>w,LinkHandler:()=>A,MenuItem:()=>E,Panel:()=>D,Plugin:()=>H,Registry:()=>S,Server:()=>k,SettingsPage:()=>O,Slot:()=>N,Store:()=>x,Style:()=>P,TitlebarItem:()=>j,bindPlugin:()=>I,createKeyed:()=>z,createLatest:()=>B,createVisitState:()=>V,useDrawer:()=>R,usePanel:()=>L,usePlugin:()=>F}),G=e({FileTree:()=>K,FileViewer:()=>J,OpenInApp:()=>q}),K=C.define(`file.tree`),q=C.define(`file.openInApp`),J=S.define(`file.viewer`),Y=e({Changes:()=>X}),X=C.define(`review.changes`),Z=e({Browser:()=>Q}),Q=C.define(`browser`),$=e({Rpc:()=>$,define:()=>ee});function ee(e){let t=Object.values(e.methods).flatMap(e=>Object.keys(e.errors??{})).find(e=>e.startsWith(`rpc.`));if(t)throw Error(`RPC error names starting with "rpc." are reserved: ${t}`);return e}var te=e({Rpc:()=>$});export{G as a,A as c,O as d,j as f,y as g,m as h,Y as i,E as l,g as m,$ as n,W as o,h as p,Z as r,T as s,te as t,D as u};
@@ -1,4 +1,4 @@
1
- import{$ as e,A as t,B as n,H as r,K as i,M as a,U as o,V as s,Z as c,dt as l,ft as u,lt as d,ot as f,p,pt as m,ut as h,x as g,y as _}from"./vendor-codemirror-autocomplete-7c2L_4dM.js";import{c as v,f as y,i as b,l as x,m as S,n as C,p as w,r as T,t as E,u as D}from"./vendor-codemirror-commands-B8KrBQ9B.js";import{l as O,n as k,t as ee}from"./vendor-codemirror-search-ZqtrPLjU.js";function te(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{keys:`<Left>`,type:`keyToKey`,toKeys:`h`},{keys:`<Right>`,type:`keyToKey`,toKeys:`l`},{keys:`<Up>`,type:`keyToKey`,toKeys:`k`},{keys:`<Down>`,type:`keyToKey`,toKeys:`j`},{keys:`g<Up>`,type:`keyToKey`,toKeys:`gk`},{keys:`g<Down>`,type:`keyToKey`,toKeys:`gj`},{keys:`<Space>`,type:`keyToKey`,toKeys:`l`},{keys:`<BS>`,type:`keyToKey`,toKeys:`h`},{keys:`<Del>`,type:`keyToKey`,toKeys:`x`},{keys:`<C-Space>`,type:`keyToKey`,toKeys:`W`},{keys:`<C-BS>`,type:`keyToKey`,toKeys:`B`},{keys:`<S-Space>`,type:`keyToKey`,toKeys:`w`},{keys:`<S-BS>`,type:`keyToKey`,toKeys:`b`},{keys:`<C-n>`,type:`keyToKey`,toKeys:`j`},{keys:`<C-p>`,type:`keyToKey`,toKeys:`k`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`s`,type:`keyToKey`,toKeys:`cl`,context:`normal`},{keys:`s`,type:`keyToKey`,toKeys:`c`,context:`visual`},{keys:`S`,type:`keyToKey`,toKeys:`cc`,context:`normal`},{keys:`S`,type:`keyToKey`,toKeys:`VdO`,context:`visual`},{keys:`<Home>`,type:`keyToKey`,toKeys:`0`},{keys:`<End>`,type:`keyToKey`,toKeys:`$`},{keys:`<PageUp>`,type:`keyToKey`,toKeys:`<C-b>`},{keys:`<PageDown>`,type:`keyToKey`,toKeys:`<C-f>`},{keys:`<CR>`,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:`<Ins>`,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:`<Ins>`,type:`action`,action:`toggleOverwrite`,context:`insert`},{keys:`H`,type:`motion`,motion:`moveToTopLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`M`,type:`motion`,motion:`moveToMiddleLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`L`,type:`motion`,motion:`moveToBottomLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`h`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!1}},{keys:`l`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!0}},{keys:`j`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,linewise:!0}},{keys:`k`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,linewise:!0}},{keys:`gj`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!0}},{keys:`gk`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!1}},{keys:`w`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1}},{keys:`W`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:`e`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:`E`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`b`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1}},{keys:`B`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:`ge`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:`gE`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`{`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`}`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`(`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!1}},{keys:`)`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!0}},{keys:`<C-f>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:`<C-b>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:`<C-d>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:`<C-u>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!1,explicitRepeat:!0}},{keys:`gg`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`G`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`g$`,type:`motion`,motion:`moveToEndOfDisplayLine`},{keys:`g^`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`g0`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`0`,type:`motion`,motion:`moveToStartOfLine`},{keys:`^`,type:`motion`,motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`+`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0}},{keys:`-`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,toFirstChar:!0}},{keys:`_`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:`$`,type:`motion`,motion:`moveToEol`,motionArgs:{inclusive:!0}},{keys:`%`,type:`motion`,motion:`moveToMatchedSymbol`,motionArgs:{inclusive:!0,toJumplist:!0}},{keys:`f<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'<register>`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0}},{keys:"]`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0}},{keys:"[`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1}},{keys:`]'`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0,linewise:!0}},{keys:`['`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1,linewise:!0}},{keys:`]p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:`[p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:`]<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`|`,type:`motion`,motion:`moveToColumn`},{keys:`o`,type:`motion`,motion:`moveToOtherHighlightedEnd`,context:`visual`},{keys:`O`,type:`motion`,motion:`moveToOtherHighlightedEnd`,motionArgs:{sameLine:!0},context:`visual`},{keys:`d`,type:`operator`,operator:`delete`},{keys:`y`,type:`operator`,operator:`yank`},{keys:`c`,type:`operator`,operator:`change`},{keys:`=`,type:`operator`,operator:`indentAuto`},{keys:`>`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!0}},{keys:`<`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!1}},{keys:`g~`,type:`operator`,operator:`changeCase`},{keys:`gu`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},isEdit:!0},{keys:`gU`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},isEdit:!0},{keys:`n`,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`N`,type:`motion`,motion:`findNext`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`gn`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!0}},{keys:`gN`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!1}},{keys:`gq`,type:`operator`,operator:`hardWrap`},{keys:`gw`,type:`operator`,operator:`hardWrap`,operatorArgs:{keepCursor:!0}},{keys:`g?`,type:`operator`,operator:`rot13`},{keys:`x`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:`X`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:`D`,type:`operatorMotion`,operator:`delete`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`D`,type:`operator`,operator:`delete`,operatorArgs:{linewise:!0},context:`visual`},{keys:`Y`,type:`operatorMotion`,operator:`yank`,motion:`expandToLine`,motionArgs:{linewise:!0},context:`normal`},{keys:`Y`,type:`operator`,operator:`yank`,operatorArgs:{linewise:!0},context:`visual`},{keys:`C`,type:`operatorMotion`,operator:`change`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`C`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0},context:`visual`},{keys:`~`,type:`operatorMotion`,operator:`changeCase`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:`normal`},{keys:`~`,type:`operator`,operator:`changeCase`,context:`visual`},{keys:`<C-u>`,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:`<C-w>`,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:`<C-w>`,type:`idle`,context:`normal`},{keys:`<C-i>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:`<C-o>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:`<C-e>`,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:`<C-y>`,type:`action`,action:`scroll`,actionArgs:{forward:!1,linewise:!0}},{keys:`a`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`charAfter`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`eol`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`endOfSelectedArea`},context:`visual`},{keys:`i`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`inplace`},context:`normal`},{keys:`gi`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`lastEdit`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`firstNonBlank`},context:`normal`},{keys:`gI`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`bol`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`startOfSelectedArea`},context:`visual`},{keys:`o`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:`normal`},{keys:`O`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:`normal`},{keys:`v`,type:`action`,action:`toggleVisualMode`},{keys:`V`,type:`action`,action:`toggleVisualMode`,actionArgs:{linewise:!0}},{keys:`<C-v>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`<C-q>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`gv`,type:`action`,action:`reselectLastSelection`},{keys:`J`,type:`action`,action:`joinLines`,isEdit:!0},{keys:`gJ`,type:`action`,action:`joinLines`,actionArgs:{keepSpaces:!0},isEdit:!0},{keys:`p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:`P`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:`r<character>`,type:`action`,action:`replace`,isEdit:!0},{keys:`@<register>`,type:`action`,action:`replayMacro`},{keys:`q<register>`,type:`action`,action:`enterMacroRecordMode`},{keys:`R`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{replace:!0},context:`normal`},{keys:`R`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0,fullLine:!0},context:`visual`,exitVisualBlock:!0},{keys:`u`,type:`action`,action:`undo`,context:`normal`},{keys:`u`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},context:`visual`,isEdit:!0},{keys:`U`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},context:`visual`,isEdit:!0},{keys:`<C-r>`,type:`action`,action:`redo`},{keys:`m<register>`,type:`action`,action:`setMark`},{keys:`"<register>`,type:`action`,action:`setRegister`},{keys:`<C-r><register>`,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:`<C-o>`,type:`action`,action:`oneNormalCommand`,context:`insert`},{keys:`zz`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`}},{keys:`z.`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zt`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`}},{keys:`z<CR>`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zb`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`}},{keys:`z-`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`.`,type:`action`,action:`repeatLastEdit`},{keys:`<C-a>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:`<C-x>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:`<C-t>`,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:`<C-d>`,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a<register>`,type:`motion`,motion:`textObjectManipulation`},{keys:`i<register>`,type:`motion`,motion:`textObjectManipulation`,motionArgs:{textObjectInner:!0}},{keys:`/`,type:`search`,searchArgs:{forward:!0,querySrc:`prompt`,toJumplist:!0}},{keys:`?`,type:`search`,searchArgs:{forward:!1,querySrc:`prompt`,toJumplist:!0}},{keys:`*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`g*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`g#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`:`,type:`ex`}],i=Object.create(null),a=r.length,o=[{name:`colorscheme`,shortName:`colo`},{name:`map`},{name:`imap`,shortName:`im`},{name:`nmap`,shortName:`nm`},{name:`vmap`,shortName:`vm`},{name:`omap`,shortName:`om`},{name:`noremap`,shortName:`no`},{name:`nnoremap`,shortName:`nn`},{name:`vnoremap`,shortName:`vn`},{name:`inoremap`,shortName:`ino`},{name:`onoremap`,shortName:`ono`},{name:`unmap`},{name:`mapclear`,shortName:`mapc`},{name:`nmapclear`,shortName:`nmapc`},{name:`vmapclear`,shortName:`vmapc`},{name:`imapclear`,shortName:`imapc`},{name:`omapclear`,shortName:`omapc`},{name:`write`,shortName:`w`},{name:`undo`,shortName:`u`},{name:`redo`,shortName:`red`},{name:`set`,shortName:`se`},{name:`setlocal`,shortName:`setl`},{name:`setglobal`,shortName:`setg`},{name:`sort`,shortName:`sor`},{name:`substitute`,shortName:`s`,possiblyAsync:!0},{name:`startinsert`,shortName:`start`},{name:`nohlsearch`,shortName:`noh`},{name:`yank`,shortName:`y`},{name:`delmarks`,shortName:`delm`},{name:`marks`,excludeFromCommandHistory:!0},{name:`registers`,shortName:`reg`,excludeFromCommandHistory:!0},{name:`vglobal`,shortName:`v`},{name:`delete`,shortName:`d`},{name:`join`,shortName:`j`},{name:`normal`,shortName:`norm`},{name:`global`,shortName:`g`}],s=pe(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,Jt),j(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,Jt),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,Et&&clearTimeout(Et)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(V(e.getCursor(),0,1)),we.enterInsertMode(e,{},t))},t.onPasteFn}var d=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],p=[function(e){return/\S/.test(e)}],m=[`<`,`>`],h=[`-`,`"`,`.`,`:`,`_`,`/`,`+`],g=/^\w$/,_=/^[A-Z]$/;try{_=RegExp(`^[\\p{Lu}]$`,`u`)}catch{}function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function b(e){return`()[]{}`.indexOf(e)!=-1}function x(e){return d.test(e)}function S(e){return _.test(e)}function C(e){return/^\s*$/.test(e)}function w(e){return`.?!`.indexOf(e)!=-1}function T(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var E={};function D(e,t,n,r,i){if(t===void 0&&!i)throw Error(`defaultValue is required unless callback is provided`);if(n||=`string`,E[e]={type:n,defaultValue:t,callback:i},r)for(var a=0;a<r.length;a++)E[r[a]]=E[e];t&&O(e,t)}function O(e,t,n,r){var i=E[e];r||={};var a=r.scope;if(!i)return Error(`Unknown option: `+e);if(i.type==`boolean`){if(t&&t!==!0)return Error(`Invalid argument: `+e+`=`+t);t!==!1&&(t=!0)}i.callback?(a!==`local`&&i.callback(t,void 0),a!==`global`&&n&&i.callback(t,n)):(a!==`local`&&(i.value=i.type==`boolean`?!!t:t),a!==`global`&&n&&(n.state.vim.options[e]={value:t}))}function k(e,t,n){var r=E[e];n||={};var i=n.scope;if(!r)return Error(`Unknown option: `+e);if(r.callback){let e=t&&r.callback(void 0,t);return i!==`global`&&e!==void 0?e:i===`local`?void 0:r.callback()}return(i!==`global`&&t&&t.state.vim.options[e]||i!==`local`&&r||{}).value}D(`filetype`,void 0,`string`,[`ft`],function(e,t){if(t!==void 0){if(e===void 0){let e=t.getOption(`mode`);return e==`null`?``:e}{let n=e==``?`null`:e;t.setOption(`mode`,n)}}}),D(`textwidth`,80,`number`,[`tw`],function(e,t){if(t!==void 0){if(e===void 0)return t.getOption(`textwidth`);var n=Math.round(e);n>1&&t.setOption(`textwidth`,n)}});var ee=function(){var e=100,t=-1,n=0,r=0,i=Array(e);function a(a,o,s){var c=i[t%e];function l(n){var r=++t%e,o=i[r];o&&o.clear(),i[r]=a.setBookmark(n)}if(c){var u=c.find();u&&!U(u,o)&&l(o)}else l(o);l(s),n=t,r=t-e+1,r<0&&(r=0)}function o(a,o){t+=o,t>n?t=n:t<r&&(t=r);var s=i[(e+t)%e];if(s&&!s.find()){var c=o>0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!U(u,l))break;while(t<n&&t>r)}return s}function s(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()}return{cachedCursor:void 0,add:a,find:s,move:o}},te=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class A{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=te()}exitMacroRecordMode(){var e=M.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=M.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=Z(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function j(e){return e.state.vim||(e.state.vim={inputState:new me,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new t(0,0),head:new t(0,0)},options:{},expectLiteralNext:!1,status:``}),e.state.vim}var M;function ne(){for(var e in M={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ee(),macroModeState:new A,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new _e({}),searchHistoryController:new ve,exCommandHistoryController:new ve},E){var t=E[e];t.value=t.defaultValue}}class re{constructor(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}}var ie,N={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return M.registerController},resetVimGlobalState_:ne,getVimGlobalState_:function(){return M},maybeInitVimState_:j,suppressErrorLogging:!1,InsertModeKey:re,map:function(e,t,n){$.map(e,t,n)},unmap:function(e,t){return $.unmap(e,t)},noremap:function(e,t,n){$.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=a,i=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var o=i.length-1;o>=0;o--){var s=i[o];if(e!==s.context)if(s.context)this._mapCommand(s);else{var c=[`normal`,`insert`,`visual`];for(var l in c)if(c[l]!==e){var u=Object.assign({},s);u.context=c[l],this._mapCommand(u)}}}},langmap:fe,vimKeyFromEvent:de,setOption:O,getOption:k,defineOption:D,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw Error(`(Vim.defineEx) "`+t+`" is not a prefix of "`+e+`", command not registered`);It[e]=n,$.commandMap_[t]={name:e,shortName:t,type:`api`}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r==`function`)return r()},multiSelectHandleKey:tn,findKey:function(t,n,i){var a=j(t),o=t;function s(){var e=M.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),I(o),!0;i!=`mapping`&&Wt(e,n)}}function c(){if(n==`<Esc>`){if(a.visualMode)J(o);else if(a.insertMode)Rt(o);else return;return I(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=ye.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return I(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),ie&&window.clearTimeout(ie),ie=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&I(o)},k(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();(!s||s.removed.length!=l.length)&&(s=a.inputState.changeQueue=new he),s.inserted+=n;for(var u=0;u<l.length;u++){var d=G(l[u].anchor,l[u].head),f=K(l[u].anchor,l[u].head),p=o.getRange(d,o.state.overwrite?V(f,0,1):f);s.removed[u]=(s.removed[u]||``)+p}}return!t}if(i.type==`full`&&(a.inputState.keyBuffer.length=0),a.expectLiteralNext=!1,ie&&window.clearTimeout(ie),i.command&&s){for(var l=o.listSelections(),u=0;u<l.length;u++){var m=l[u].head;o.replaceRange(s.removed[u]||``,V(m,0,-s.inserted.length),m,`+input`)}M.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||I(o),i.command}function u(){if(s()||c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``);if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return I(o),!1;var i=a.visualMode?`visual`:`normal`,l=t[2]||t[1];a.inputState.operatorShortcut&&a.inputState.operatorShortcut.slice(-1)==l&&(l=a.inputState.operatorShortcut);var u=ye.matchCommand(l,r,a.inputState,i);return u.type==`none`?(I(o),!1):u.type==`partial`?(u.expectLiteralNext&&(a.expectLiteralNext=!0),!0):u.type==`clear`?(I(o),!0):(a.expectLiteralNext=!1,a.inputState.keyBuffer.length=0,t=/^(\d*)(.*)$/.exec(e),t&&t[1]&&t[1]!=`0`&&a.inputState.pushRepeatDigit(t[1]),u.command)}var d=a.insertMode?l():u();if(d===!1)return!a.insertMode&&(n.length===1||e.isMac&&/<A-.>/.test(n))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof d!=`object`)return;d.type==`keyToKey`?F(o,d.toKeys,d):ye.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,j(o),N.suppressErrorLogging,e}return!0})}},handleEx:function(e,t){$.processCommand(e,t)},defineMotion:be,defineAction:Te,defineOperator:Ce,mapCommand:Ht,_mapCommand:zt,defineRegister:ge,exitVisualMode:J,exitInsertMode:Rt},ae=[],oe=!1,P;function se(e){if(!P)throw Error(`No prompt to send key to`);if(e[0]==`<`){var t=e.toLowerCase().slice(1,-1);if(t=t.split(`-`).pop()||``,t==`lt`)e=`<`;else if(t==`space`)e=` `;else if(t==`cr`)e=`
1
+ import{$ as e,A as t,B as n,H as r,K as i,M as a,U as o,V as s,Z as c,dt as l,ft as u,lt as d,ot as f,p,pt as m,ut as h,x as g,y as _}from"./vendor-codemirror-autocomplete-7c2L_4dM.js";import{c as v,f as y,i as b,l as x,m as S,n as C,p as w,r as T,t as E,u as D}from"./vendor-codemirror-commands-B8KrBQ9B.js";import{n as O,t as k,u as ee}from"./vendor-codemirror-search-DiPwvA-6.js";function te(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{keys:`<Left>`,type:`keyToKey`,toKeys:`h`},{keys:`<Right>`,type:`keyToKey`,toKeys:`l`},{keys:`<Up>`,type:`keyToKey`,toKeys:`k`},{keys:`<Down>`,type:`keyToKey`,toKeys:`j`},{keys:`g<Up>`,type:`keyToKey`,toKeys:`gk`},{keys:`g<Down>`,type:`keyToKey`,toKeys:`gj`},{keys:`<Space>`,type:`keyToKey`,toKeys:`l`},{keys:`<BS>`,type:`keyToKey`,toKeys:`h`},{keys:`<Del>`,type:`keyToKey`,toKeys:`x`},{keys:`<C-Space>`,type:`keyToKey`,toKeys:`W`},{keys:`<C-BS>`,type:`keyToKey`,toKeys:`B`},{keys:`<S-Space>`,type:`keyToKey`,toKeys:`w`},{keys:`<S-BS>`,type:`keyToKey`,toKeys:`b`},{keys:`<C-n>`,type:`keyToKey`,toKeys:`j`},{keys:`<C-p>`,type:`keyToKey`,toKeys:`k`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`s`,type:`keyToKey`,toKeys:`cl`,context:`normal`},{keys:`s`,type:`keyToKey`,toKeys:`c`,context:`visual`},{keys:`S`,type:`keyToKey`,toKeys:`cc`,context:`normal`},{keys:`S`,type:`keyToKey`,toKeys:`VdO`,context:`visual`},{keys:`<Home>`,type:`keyToKey`,toKeys:`0`},{keys:`<End>`,type:`keyToKey`,toKeys:`$`},{keys:`<PageUp>`,type:`keyToKey`,toKeys:`<C-b>`},{keys:`<PageDown>`,type:`keyToKey`,toKeys:`<C-f>`},{keys:`<CR>`,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:`<Ins>`,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:`<Ins>`,type:`action`,action:`toggleOverwrite`,context:`insert`},{keys:`H`,type:`motion`,motion:`moveToTopLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`M`,type:`motion`,motion:`moveToMiddleLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`L`,type:`motion`,motion:`moveToBottomLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`h`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!1}},{keys:`l`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!0}},{keys:`j`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,linewise:!0}},{keys:`k`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,linewise:!0}},{keys:`gj`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!0}},{keys:`gk`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!1}},{keys:`w`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1}},{keys:`W`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:`e`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:`E`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`b`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1}},{keys:`B`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:`ge`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:`gE`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`{`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`}`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`(`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!1}},{keys:`)`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!0}},{keys:`<C-f>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:`<C-b>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:`<C-d>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:`<C-u>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!1,explicitRepeat:!0}},{keys:`gg`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`G`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`g$`,type:`motion`,motion:`moveToEndOfDisplayLine`},{keys:`g^`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`g0`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`0`,type:`motion`,motion:`moveToStartOfLine`},{keys:`^`,type:`motion`,motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`+`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0}},{keys:`-`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,toFirstChar:!0}},{keys:`_`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:`$`,type:`motion`,motion:`moveToEol`,motionArgs:{inclusive:!0}},{keys:`%`,type:`motion`,motion:`moveToMatchedSymbol`,motionArgs:{inclusive:!0,toJumplist:!0}},{keys:`f<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'<register>`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0}},{keys:"]`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0}},{keys:"[`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1}},{keys:`]'`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0,linewise:!0}},{keys:`['`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1,linewise:!0}},{keys:`]p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:`[p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:`]<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`|`,type:`motion`,motion:`moveToColumn`},{keys:`o`,type:`motion`,motion:`moveToOtherHighlightedEnd`,context:`visual`},{keys:`O`,type:`motion`,motion:`moveToOtherHighlightedEnd`,motionArgs:{sameLine:!0},context:`visual`},{keys:`d`,type:`operator`,operator:`delete`},{keys:`y`,type:`operator`,operator:`yank`},{keys:`c`,type:`operator`,operator:`change`},{keys:`=`,type:`operator`,operator:`indentAuto`},{keys:`>`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!0}},{keys:`<`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!1}},{keys:`g~`,type:`operator`,operator:`changeCase`},{keys:`gu`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},isEdit:!0},{keys:`gU`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},isEdit:!0},{keys:`n`,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`N`,type:`motion`,motion:`findNext`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`gn`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!0}},{keys:`gN`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!1}},{keys:`gq`,type:`operator`,operator:`hardWrap`},{keys:`gw`,type:`operator`,operator:`hardWrap`,operatorArgs:{keepCursor:!0}},{keys:`g?`,type:`operator`,operator:`rot13`},{keys:`x`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:`X`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:`D`,type:`operatorMotion`,operator:`delete`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`D`,type:`operator`,operator:`delete`,operatorArgs:{linewise:!0},context:`visual`},{keys:`Y`,type:`operatorMotion`,operator:`yank`,motion:`expandToLine`,motionArgs:{linewise:!0},context:`normal`},{keys:`Y`,type:`operator`,operator:`yank`,operatorArgs:{linewise:!0},context:`visual`},{keys:`C`,type:`operatorMotion`,operator:`change`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`C`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0},context:`visual`},{keys:`~`,type:`operatorMotion`,operator:`changeCase`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:`normal`},{keys:`~`,type:`operator`,operator:`changeCase`,context:`visual`},{keys:`<C-u>`,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:`<C-w>`,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:`<C-w>`,type:`idle`,context:`normal`},{keys:`<C-i>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:`<C-o>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:`<C-e>`,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:`<C-y>`,type:`action`,action:`scroll`,actionArgs:{forward:!1,linewise:!0}},{keys:`a`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`charAfter`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`eol`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`endOfSelectedArea`},context:`visual`},{keys:`i`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`inplace`},context:`normal`},{keys:`gi`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`lastEdit`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`firstNonBlank`},context:`normal`},{keys:`gI`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`bol`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`startOfSelectedArea`},context:`visual`},{keys:`o`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:`normal`},{keys:`O`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:`normal`},{keys:`v`,type:`action`,action:`toggleVisualMode`},{keys:`V`,type:`action`,action:`toggleVisualMode`,actionArgs:{linewise:!0}},{keys:`<C-v>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`<C-q>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`gv`,type:`action`,action:`reselectLastSelection`},{keys:`J`,type:`action`,action:`joinLines`,isEdit:!0},{keys:`gJ`,type:`action`,action:`joinLines`,actionArgs:{keepSpaces:!0},isEdit:!0},{keys:`p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:`P`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:`r<character>`,type:`action`,action:`replace`,isEdit:!0},{keys:`@<register>`,type:`action`,action:`replayMacro`},{keys:`q<register>`,type:`action`,action:`enterMacroRecordMode`},{keys:`R`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{replace:!0},context:`normal`},{keys:`R`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0,fullLine:!0},context:`visual`,exitVisualBlock:!0},{keys:`u`,type:`action`,action:`undo`,context:`normal`},{keys:`u`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},context:`visual`,isEdit:!0},{keys:`U`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},context:`visual`,isEdit:!0},{keys:`<C-r>`,type:`action`,action:`redo`},{keys:`m<register>`,type:`action`,action:`setMark`},{keys:`"<register>`,type:`action`,action:`setRegister`},{keys:`<C-r><register>`,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:`<C-o>`,type:`action`,action:`oneNormalCommand`,context:`insert`},{keys:`zz`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`}},{keys:`z.`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zt`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`}},{keys:`z<CR>`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zb`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`}},{keys:`z-`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`.`,type:`action`,action:`repeatLastEdit`},{keys:`<C-a>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:`<C-x>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:`<C-t>`,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:`<C-d>`,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a<register>`,type:`motion`,motion:`textObjectManipulation`},{keys:`i<register>`,type:`motion`,motion:`textObjectManipulation`,motionArgs:{textObjectInner:!0}},{keys:`/`,type:`search`,searchArgs:{forward:!0,querySrc:`prompt`,toJumplist:!0}},{keys:`?`,type:`search`,searchArgs:{forward:!1,querySrc:`prompt`,toJumplist:!0}},{keys:`*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`g*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`g#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`:`,type:`ex`}],i=Object.create(null),a=r.length,o=[{name:`colorscheme`,shortName:`colo`},{name:`map`},{name:`imap`,shortName:`im`},{name:`nmap`,shortName:`nm`},{name:`vmap`,shortName:`vm`},{name:`omap`,shortName:`om`},{name:`noremap`,shortName:`no`},{name:`nnoremap`,shortName:`nn`},{name:`vnoremap`,shortName:`vn`},{name:`inoremap`,shortName:`ino`},{name:`onoremap`,shortName:`ono`},{name:`unmap`},{name:`mapclear`,shortName:`mapc`},{name:`nmapclear`,shortName:`nmapc`},{name:`vmapclear`,shortName:`vmapc`},{name:`imapclear`,shortName:`imapc`},{name:`omapclear`,shortName:`omapc`},{name:`write`,shortName:`w`},{name:`undo`,shortName:`u`},{name:`redo`,shortName:`red`},{name:`set`,shortName:`se`},{name:`setlocal`,shortName:`setl`},{name:`setglobal`,shortName:`setg`},{name:`sort`,shortName:`sor`},{name:`substitute`,shortName:`s`,possiblyAsync:!0},{name:`startinsert`,shortName:`start`},{name:`nohlsearch`,shortName:`noh`},{name:`yank`,shortName:`y`},{name:`delmarks`,shortName:`delm`},{name:`marks`,excludeFromCommandHistory:!0},{name:`registers`,shortName:`reg`,excludeFromCommandHistory:!0},{name:`vglobal`,shortName:`v`},{name:`delete`,shortName:`d`},{name:`join`,shortName:`j`},{name:`normal`,shortName:`norm`},{name:`global`,shortName:`g`}],s=pe(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,Jt),j(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,Jt),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,Et&&clearTimeout(Et)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(V(e.getCursor(),0,1)),we.enterInsertMode(e,{},t))},t.onPasteFn}var d=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],p=[function(e){return/\S/.test(e)}],m=[`<`,`>`],h=[`-`,`"`,`.`,`:`,`_`,`/`,`+`],g=/^\w$/,_=/^[A-Z]$/;try{_=RegExp(`^[\\p{Lu}]$`,`u`)}catch{}function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function b(e){return`()[]{}`.indexOf(e)!=-1}function x(e){return d.test(e)}function S(e){return _.test(e)}function C(e){return/^\s*$/.test(e)}function w(e){return`.?!`.indexOf(e)!=-1}function T(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var E={};function D(e,t,n,r,i){if(t===void 0&&!i)throw Error(`defaultValue is required unless callback is provided`);if(n||=`string`,E[e]={type:n,defaultValue:t,callback:i},r)for(var a=0;a<r.length;a++)E[r[a]]=E[e];t&&O(e,t)}function O(e,t,n,r){var i=E[e];r||={};var a=r.scope;if(!i)return Error(`Unknown option: `+e);if(i.type==`boolean`){if(t&&t!==!0)return Error(`Invalid argument: `+e+`=`+t);t!==!1&&(t=!0)}i.callback?(a!==`local`&&i.callback(t,void 0),a!==`global`&&n&&i.callback(t,n)):(a!==`local`&&(i.value=i.type==`boolean`?!!t:t),a!==`global`&&n&&(n.state.vim.options[e]={value:t}))}function k(e,t,n){var r=E[e];n||={};var i=n.scope;if(!r)return Error(`Unknown option: `+e);if(r.callback){let e=t&&r.callback(void 0,t);return i!==`global`&&e!==void 0?e:i===`local`?void 0:r.callback()}return(i!==`global`&&t&&t.state.vim.options[e]||i!==`local`&&r||{}).value}D(`filetype`,void 0,`string`,[`ft`],function(e,t){if(t!==void 0){if(e===void 0){let e=t.getOption(`mode`);return e==`null`?``:e}{let n=e==``?`null`:e;t.setOption(`mode`,n)}}}),D(`textwidth`,80,`number`,[`tw`],function(e,t){if(t!==void 0){if(e===void 0)return t.getOption(`textwidth`);var n=Math.round(e);n>1&&t.setOption(`textwidth`,n)}});var ee=function(){var e=100,t=-1,n=0,r=0,i=Array(e);function a(a,o,s){var c=i[t%e];function l(n){var r=++t%e,o=i[r];o&&o.clear(),i[r]=a.setBookmark(n)}if(c){var u=c.find();u&&!U(u,o)&&l(o)}else l(o);l(s),n=t,r=t-e+1,r<0&&(r=0)}function o(a,o){t+=o,t>n?t=n:t<r&&(t=r);var s=i[(e+t)%e];if(s&&!s.find()){var c=o>0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!U(u,l))break;while(t<n&&t>r)}return s}function s(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()}return{cachedCursor:void 0,add:a,find:s,move:o}},te=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class A{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=te()}exitMacroRecordMode(){var e=M.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=M.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=Z(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function j(e){return e.state.vim||(e.state.vim={inputState:new me,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new t(0,0),head:new t(0,0)},options:{},expectLiteralNext:!1,status:``}),e.state.vim}var M;function ne(){for(var e in M={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:ee(),macroModeState:new A,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new _e({}),searchHistoryController:new ve,exCommandHistoryController:new ve},E){var t=E[e];t.value=t.defaultValue}}class re{constructor(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}}var ie,N={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return M.registerController},resetVimGlobalState_:ne,getVimGlobalState_:function(){return M},maybeInitVimState_:j,suppressErrorLogging:!1,InsertModeKey:re,map:function(e,t,n){$.map(e,t,n)},unmap:function(e,t){return $.unmap(e,t)},noremap:function(e,t,n){$.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=a,i=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var o=i.length-1;o>=0;o--){var s=i[o];if(e!==s.context)if(s.context)this._mapCommand(s);else{var c=[`normal`,`insert`,`visual`];for(var l in c)if(c[l]!==e){var u=Object.assign({},s);u.context=c[l],this._mapCommand(u)}}}},langmap:fe,vimKeyFromEvent:de,setOption:O,getOption:k,defineOption:D,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw Error(`(Vim.defineEx) "`+t+`" is not a prefix of "`+e+`", command not registered`);It[e]=n,$.commandMap_[t]={name:e,shortName:t,type:`api`}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r==`function`)return r()},multiSelectHandleKey:tn,findKey:function(t,n,i){var a=j(t),o=t;function s(){var e=M.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),I(o),!0;i!=`mapping`&&Wt(e,n)}}function c(){if(n==`<Esc>`){if(a.visualMode)J(o);else if(a.insertMode)Rt(o);else return;return I(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=ye.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return I(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),ie&&window.clearTimeout(ie),ie=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&I(o)},k(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();(!s||s.removed.length!=l.length)&&(s=a.inputState.changeQueue=new he),s.inserted+=n;for(var u=0;u<l.length;u++){var d=G(l[u].anchor,l[u].head),f=K(l[u].anchor,l[u].head),p=o.getRange(d,o.state.overwrite?V(f,0,1):f);s.removed[u]=(s.removed[u]||``)+p}}return!t}if(i.type==`full`&&(a.inputState.keyBuffer.length=0),a.expectLiteralNext=!1,ie&&window.clearTimeout(ie),i.command&&s){for(var l=o.listSelections(),u=0;u<l.length;u++){var m=l[u].head;o.replaceRange(s.removed[u]||``,V(m,0,-s.inserted.length),m,`+input`)}M.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||I(o),i.command}function u(){if(s()||c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``);if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return I(o),!1;var i=a.visualMode?`visual`:`normal`,l=t[2]||t[1];a.inputState.operatorShortcut&&a.inputState.operatorShortcut.slice(-1)==l&&(l=a.inputState.operatorShortcut);var u=ye.matchCommand(l,r,a.inputState,i);return u.type==`none`?(I(o),!1):u.type==`partial`?(u.expectLiteralNext&&(a.expectLiteralNext=!0),!0):u.type==`clear`?(I(o),!0):(a.expectLiteralNext=!1,a.inputState.keyBuffer.length=0,t=/^(\d*)(.*)$/.exec(e),t&&t[1]&&t[1]!=`0`&&a.inputState.pushRepeatDigit(t[1]),u.command)}var d=a.insertMode?l():u();if(d===!1)return!a.insertMode&&(n.length===1||e.isMac&&/<A-.>/.test(n))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof d!=`object`)return;d.type==`keyToKey`?F(o,d.toKeys,d):ye.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,j(o),N.suppressErrorLogging,e}return!0})}},handleEx:function(e,t){$.processCommand(e,t)},defineMotion:be,defineAction:Te,defineOperator:Ce,mapCommand:Ht,_mapCommand:zt,defineRegister:ge,exitVisualMode:J,exitInsertMode:Rt},ae=[],oe=!1,P;function se(e){if(!P)throw Error(`No prompt to send key to`);if(e[0]==`<`){var t=e.toLowerCase().slice(1,-1);if(t=t.split(`-`).pop()||``,t==`lt`)e=`<`;else if(t==`space`)e=` `;else if(t==`cr`)e=`
2
2
  `;else if(ue[t]){var n=P.value||``,r={key:ue[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};P.onKeyDown&&P.onKeyDown(r,P.value,a),P&&P.onKeyUp&&P.onKeyUp(r,P.value,a);return}}if(e==`
3
3
  `){var i=P;P=null,i.onClose&&i.onClose(i.value)}else P.value=(P.value||``)+e;function a(e){P&&(typeof e==`string`?P.value=e:P=null)}}function F(e,t,n){var r=oe;if(n){if(ae.indexOf(n)!=-1)return;ae.push(n),oe=n.noremap!=0}try{for(var i=j(e),a=/<(?:[CSMA]-)*\w+>|./gi,o;o=a.exec(t);){var s=o[0],c=i.insertMode;if(P){se(s);continue}if(!N.handleKey(e,s,`mapping`)&&c&&i.insertMode){if(s[0]==`<`){var l=s.toLowerCase().slice(1,-1);if(l=l.split(`-`).pop()||``,l==`lt`)s=`<`;else if(l==`space`)s=` `;else if(l==`cr`)s=`
4
4
  `;else if(ue.hasOwnProperty(l)){s=ue[l],Qt(e,s);continue}else s=s[0],a.lastIndex=o.index+1}e.replaceSelection(s)}}}finally{if(ae.pop(),oe=ae.length?r:!1,!ae.length&&P){var u=P;P=null,St(e,u)}}}var ce={Return:`CR`,Backspace:`BS`,Delete:`Del`,Escape:`Esc`,Insert:`Ins`,ArrowLeft:`Left`,ArrowRight:`Right`,ArrowUp:`Up`,ArrowDown:`Down`,Enter:`CR`," ":`Space`},le={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},ue={};`Left|Right|Up|Down|End|Home`.split(`|`).concat(Object.keys(ce)).forEach(function(e){ue[(ce[e]||``).toLowerCase()]=ue[e.toLowerCase()]=e});function de(t,n){var r=t.key;if(!le[r]){r.length>1&&r[0]==`n`&&(r=r.replace(`Numpad`,``)),r=ce[r]||r;var a=``;if(t.ctrlKey&&(a+=`C-`),t.altKey&&(a+=`A-`),t.metaKey&&(a+=`M-`),e.isMac&&a==`A-`&&r.length==1&&(a=a.slice(2)),(a||r.length>1)&&t.shiftKey&&(a+=`S-`),n&&!n.expectLiteralNext&&r.length==1){if(s.keymap&&r in s.keymap)(s.remapCtrl!=0||!a)&&(r=s.keymap[r]);else if(r.charCodeAt(0)>128&&!i[r]){var o=t.code?.slice(-1)||``;t.shiftKey||(o=o.toLowerCase()),o&&(r=o,!a&&t.altKey&&(a=`A-`))}}return a+=r,a.length>1&&(a=`<`+a+`>`),a}}function fe(e,t){s.string!==e&&(s=pe(e)),s.remapCtrl=t}function pe(e){let t={};if(!e)return{keymap:t,string:``};function n(e){return e.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(e=>{if(!e)return;let r=e.split(/((?:[^\\;]|\\.)+);/);if(r.length==3){let e=n(r[1]),i=n(r[2]);if(e.length!==i.length)return;for(let n=0;n<e.length;++n)t[e[n]]=i[n]}else if(r.length==1){let r=n(e);if(r.length%2!=0)return;for(let e=0;e<r.length;e+=2)t[r[e]]=r[e+1]}}),{keymap:t,string:e}}D(`langmap`,void 0,`string`,[`lmap`],function(e,t){if(e===void 0)return s.string;fe(e)});class me{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)}getRepeat(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(``),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(``),10))),e}}function I(t,n){t.state.vim.inputState=new me,t.state.vim.expectLiteralNext=!1,e.signal(t,`vim-command-done`,n)}function he(){this.removed=[],this.inserted=``}class L{constructor(e,t,n){this.clear(),this.keyBuffer=[e||``],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}setText(e,t,n){this.keyBuffer=[e||``],this.linewise=!!t,this.blockwise=!!n}pushText(e,t){t&&(this.linewise||this.keyBuffer.push(`
@@ -33,7 +33,7 @@ mark line col
33
33
  `));return}var p=0,m=function(){if(p<u.length){var t=u[p++],n=e.getLineNumber(t);if(n==null){m();return}var r=n+1+c;$.processCommand(e,r,{callback:m})}else e.releaseLineHandles&&e.releaseLineHandles()};m()},substitute:function(e,n){if(!e.getSearchCursor)throw Error(`Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.`);var r=n.argString,i=r?pt(r,r[0]):[],a=``,o=``,s,c,l,u=!1,d=!1;if(i&&i.length)a=i[0],k(`pcre`)&&a!==``&&(a=new RegExp(a).source),o=i[1],o!==void 0&&(o=k(`pcre`)?yt(o.replace(/([^\\])&/g,`$1$$&`)):_t(o),M.lastSubstituteReplacePart=o),s=i[2]?i[2].split(` `):[];else if(r&&r.length){Q(e,`Substitutions should be of the form :s/pattern/replace/`);return}if(s&&(c=s[0],l=parseInt(s[1]),c&&(c.indexOf(`c`)!=-1&&(u=!0),c.indexOf(`g`)!=-1&&(d=!0),a=k(`pcre`)?a+`/`+c:a.replace(/\//g,`\\/`)+`/`+c)),a)try{wt(e,a,!0,!0)}catch{Q(e,`Invalid regex: `+a);return}if(o||=M.lastSubstituteReplacePart,o===void 0){Q(e,`No previous substitute regular expression`);return}var f=X(e).getQuery(),p=n.line===void 0?e.getCursor().line:n.line,m=n.lineEnd||p;p==e.firstLine()&&m==e.lastLine()&&(m=1/0),l&&(p=m,m=p+l-1);var h=z(e,new t(p,0)),g=e.getSearchCursor(f,h);Lt(e,u,d,p,m,g,f,o,n.callback)},startinsert:function(e,t){F(e,t.argString==`!`?`A`:`i`,{})},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){At(e)},yank:function(e){var t=H(e.getCursor()).line,n=e.getLine(t);M.registerController.pushText(`0`,`yank`,n,!0,!0)},delete:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;Se.delete(e,{linewise:!0},[{anchor:new t(r,0),head:new t(i+1,0)}])},join:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;e.setCursor(new t(r,0)),we.joinLines(e,{repeat:i-r},e.state.vim)},delmarks:function(t,n){if(!n.argString||!je(n.argString)){Q(t,`Argument required`);return}for(var r=t.state.vim,i=new e.StringStream(je(n.argString));!i.eol();){i.eatSpace();var a=i.pos;if(!i.match(/[a-zA-Z]/,!1)){Q(t,`Invalid argument: `+n.argString.substring(a));return}var o=i.next();if(i.match(`-`,!0)){if(!i.match(/[a-zA-Z]/,!1)){Q(t,`Invalid argument: `+n.argString.substring(a));return}var s=o,c=i.next();if(s&&c&&y(s)==y(c)){var l=s.charCodeAt(0),u=c.charCodeAt(0);if(l>=u){Q(t,`Invalid argument: `+n.argString.substring(a));return}for(var d=0;d<=u-l;d++){var f=String.fromCharCode(l+d);delete r.marks[f]}}else{Q(t,`Invalid argument: `+s+`-`);return}}else o&&delete r.marks[o]}}},$=new Ft;N.defineEx(`version`,`ve`,e=>{Q(e,`Codemirror-vim version: 6.3.0`)});function Lt(t,n,r,i,a,o,s,c,l){t.state.vim.exMode=!0;var u=!1,d=0,f,p,m;function h(){t.operation(function(){for(;!u;)g(),v();y()})}function g(){var e=``,n=o.match||o.pos&&o.pos.match;e=n?c.replace(/\$(\d{1,3}|[$&])/g,function(e,t){if(t==`$`)return`$`;if(t==`&`)return n[0];for(var r=t;parseInt(r)>=n.length&&r.length>0;)r=r.slice(0,r.length-1);return r?n[r]+t.slice(r.length,t.length):e}):t.getRange(o.from(),o.to()).replace(s,c);var r=o.to().line;o.replace(e),p=o.to().line,a+=p-r,m=p<r}function _(){var e=f&&H(o.to()),t=o.findNext();return t&&!t[0]&&e&&U(o.from(),e)&&(t=o.findNext()),t&&d++,t}function v(){for(;_()&&jt(o.from(),i,a);)if(!(!r&&o.from().line==p&&!m)){t.scrollIntoView(o.from(),30),t.setSelection(o.from(),o.to()),f=o.from(),u=!1;return}u=!0}function y(e){if(e&&e(),t.focus(),f){t.setCursor(f);var n=t.state.vim;n.exMode=!1,n.lastHPos=n.lastHSPos=f.ch}l?l():u&&Q(t,(d?`Found `+d+` matches`:`No matches found`)+` for pattern: `+s+(k(`pcre`)?` (set nopcre to use Vim regexps)`:``))}function b(n,r,i){switch(e.e_stop(n),de(n)){case`y`:g(),v();break;case`n`:v();break;case`a`:var a=l;l=void 0,t.operation(h),l=a;break;case`l`:g();case`q`:case`<Esc>`:case`<C-c>`:case`<C-[>`:y(i)}return u&&y(i),!0}if(v(),u){Q(t,`No matches for `+s+(k(`pcre`)?` (set nopcre to use vim regexps)`:``));return}if(!n){h(),l&&l();return}St(t,{prefix:Z(`span`,`replace with `,Z(`strong`,c),` (y/n/a/q/l)`),onKeyDown:b})}function Rt(t,n){var r=t.state.vim,i=M.macroModeState,a=M.registerController.getRegister(`.`),o=i.isPlaying,s=i.lastInsertModeChanges;o||(t.off(`change`,qt),r.insertEnd&&r.insertEnd.clear(),r.insertEnd=void 0,e.off(t.getInputField(),`keydown`,Xt)),!o&&r.insertModeRepeat&&r.insertModeRepeat>1&&(Zt(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,n||t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption(`keyMap`,`vim`),t.setOption(`disableInput`,!0),t.toggleOverwrite(!1),a.setText(s.changes.join(``)),e.signal(t,`vim-mode-change`,{mode:`normal`}),i.isRecording&&Gt(i)}function zt(e){r.unshift(e),e.keys&&Bt(e.keys)}function Bt(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){e&&(i[e]||(i[e]=0),i[e]++)})}function Vt(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){i[e]&&i[e]--})}function Ht(e,t,n,r,i){var a={keys:e,type:t};for(var o in a[t]=n,a[t+`Args`]=r,i)a[o]=i[o];zt(a)}D(`insertModeEscKeysTimeout`,200,`number`);function Ut(e,t,n,r){var i=M.registerController.getRegister(r);if(r==`:`){i.keyBuffer[0]&&$.processCommand(e,i.keyBuffer[0]),n.isPlaying=!1;return}var a=i.keyBuffer,o=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var s=0;s<a.length;s++)for(var c=a[s],l,u,d=/<(?:[CSMA]-)*\w+>|./gi;l=d.exec(c);)if(u=l[0],N.handleKey(e,u,`macro`),t.insertMode){var f=i.insertModeChanges[o++].changes;M.macroModeState.lastInsertModeChanges.changes=f,$t(e,f,1),Rt(e)}n.isPlaying=!1}function Wt(e,t){if(!e.isPlaying){var n=e.latestRegister,r=M.registerController.getRegister(n);r&&r.pushText(t)}}function Gt(e){if(!e.isPlaying){var t=e.latestRegister,n=M.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}}function Kt(e,t){if(!e.isPlaying){var n=e.latestRegister,r=M.registerController.getRegister(n);r&&r.pushSearchQuery&&r.pushSearchQuery(t)}}function qt(e,t){var n=M.macroModeState,r=n.lastInsertModeChanges;if(!n.isPlaying)for(var i=e.state.vim;t;){if(r.expectCursorActivityForChange=!0,r.ignoreCount>1)r.ignoreCount--;else if(t.origin==`+input`||t.origin==`paste`||t.origin===void 0){var a=e.listSelections().length;a>1&&(r.ignoreCount=a);var o=t.text.join(`
34
34
  `);if(r.maybeReset&&=(r.changes=[],!1),o)if(e.state.overwrite&&!/\n/.test(o))r.changes.push([o]);else{if(o.length>1){var s=i&&i.insertEnd&&i.insertEnd.find(),c=e.getCursor();if(s&&s.line==c.line){var l=s.ch-c.ch;l>0&&l<o.length&&(r.changes.push([o,l]),o=``)}}o&&r.changes.push(o)}}t=t.next}}function Jt(e){var t=e.state.vim;if(t.insertMode){var n=M.macroModeState;if(n.isPlaying)return;var r=n.lastInsertModeChanges;r.expectCursorActivityForChange?r.expectCursorActivityForChange=!1:(r.maybeReset=!0,t.insertEnd&&t.insertEnd.clear(),t.insertEnd=e.setBookmark(e.getCursor(),{insertLeft:!0}))}else e.curOp?.isVimOp||Yt(e,t)}function Yt(t,n){var r=t.getCursor(`anchor`),i=t.getCursor(`head`);if(n.visualMode&&!t.somethingSelected()?J(t,!1):!n.visualMode&&!n.insertMode&&t.somethingSelected()&&(n.visualMode=!0,n.visualLine=!1,e.signal(t,`vim-mode-change`,{mode:`visual`})),n.visualMode){var a=W(i,r)?0:-1,o=W(i,r)?-1:0;i=V(i,0,a),r=V(r,0,o),n.sel={anchor:r,head:i},rt(t,n,`<`,G(i,r)),rt(t,n,`>`,K(i,r))}else n.insertMode||(n.lastHPos=t.getCursor().ch)}function Xt(t){var n=M.macroModeState.lastInsertModeChanges,r=e.keyName?e.keyName(t):t.key;r&&(r.indexOf(`Delete`)!=-1||r.indexOf(`Backspace`)!=-1)&&(n.maybeReset&&=(n.changes=[],!1),n.changes.push(new re(r,t)))}function Zt(e,t,n,r){var i=M.macroModeState;i.isPlaying=!0;var a=t.lastEditActionCommand,o=t.inputState;function s(){a?ye.processAction(e,t,a):ye.evalInput(e,t)}function c(n){if(i.lastInsertModeChanges.changes.length>0){n=t.lastEditActionCommand?n:1;var r=i.lastInsertModeChanges;$t(e,r.changes,n)}}if(t.inputState=t.lastEditInputState,a&&a.interlaceInsertRepeat)for(var l=0;l<n;l++)s(),c(1);else r||s(),c(n);t.inputState=o,t.insertMode&&!r&&Rt(e),i.isPlaying=!1}function Qt(t,n){e.lookupKey(n,`vim-insert`,function(n){return typeof n==`string`?e.commands[n](t):n(t),!0})}function $t(e,t,n){var r=e.getCursor(`head`),i=M.macroModeState.lastInsertModeChanges.visualBlock;i&&(Fe(e,r,i+1),n=e.listSelections().length,e.setCursor(r));for(var a=0;a<n;a++){i&&e.setCursor(V(r,a,0));for(var o=0;o<t.length;o++){var s=t[o];if(s instanceof re)Qt(e,s.keyName);else if(typeof s==`string`)e.replaceSelection(s);else{var c=e.getCursor(),l=V(c,0,s[0].length-(s[1]||0));e.replaceRange(s[0],c,s[1]?c:l),e.setCursor(l)}}}i&&e.setCursor(V(r,0,1))}function en(e){var t=new e.constructor;return Object.keys(e).forEach(function(n){if(n!=`insertEnd`){var r=e[n];Array.isArray(r)?r=r.slice():r&&typeof r==`object`&&r.constructor!=Object&&(r=en(r)),t[n]=r}}),e.sel&&(t.sel={head:e.sel.head&&H(e.sel.head),anchor:e.sel.anchor&&H(e.sel.anchor)}),t}function tn(e,t,n){var r=j(e),i=e,a=!1,r=N.maybeInitVimState_(i),o=r.visualBlock||r.wasInVisualBlock;if(i.state.closeVimNotification){var s=i.state.closeVimNotification;if(i.state.closeVimNotification=null,s(),t==`<CR>`)return I(i),!0}var c=i.isInMultiSelectMode();if(r.wasInVisualBlock&&!c?r.wasInVisualBlock=!1:c&&r.visualBlock&&(r.wasInVisualBlock=!0),t==`<Esc>`&&!r.insertMode&&!r.visualMode&&c&&r.status==`<Esc>`)I(i);else if(o||!c||i.inVirtualSelectionMode)a=N.handleKey(i,t,n);else{var l=en(r),u=r.inputState.changeQueueList||[];i.operation(function(){i.curOp&&(i.curOp.isVimOp=!0);var e=0;i.forEachSelection(function(){i.state.vim.inputState.changeQueue=u[e];var r=i.getCursor(`head`),o=i.getCursor(`anchor`),s=W(r,o)?0:-1,c=W(r,o)?-1:0;r=V(r,0,s),o=V(o,0,c),i.state.vim.sel.head=r,i.state.vim.sel.anchor=o,a=N.handleKey(i,t,n),i.virtualSelection&&(u[e]=i.state.vim.inputState.changeQueue,i.state.vim=en(l)),e++}),i.curOp?.cursorActivity&&!a&&(i.curOp.cursorActivity=!1),i.state.vim=r,r.inputState.changeQueueList=u,r.inputState.changeQueue=null},!0)}return a&&!r.visualMode&&!r.insertMode&&r.visualMode!=i.somethingSelected()&&Yt(i,r),a}return ne(),N}function A(e,t){var n=t.ch,r=t.line+1;r<1&&(r=1,n=0),r>e.lines&&(r=e.lines,n=Number.MAX_VALUE);var i=e.line(r);return Math.min(i.from+Math.max(0,n),i.to)}function j(e,t){let n=e.lineAt(t);return{line:n.number-1,ch:t-n.from}}var M=class{constructor(e,t){this.line=e,this.ch=t}};function ne(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{var r=e._handlers||={};r[t]=(r[t]||[]).concat(n)}}function re(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else{var r=e._handlers,i=r&&r[t];if(i){var a=i.indexOf(n);a>-1&&(r[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function ie(e,t,...n){var r=e._handlers?.[t];if(r)for(var i=0;i<r.length;++i)r[i](...n)}function N(e,...t){if(e)for(var n=0;n<e.length;++n)e[n](...t)}var ae;try{ae=RegExp(`[\\w\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{ae=/[\w]/}function oe(e,t){var n=e.cm6;if(!n.state.readOnly){var r=`input.type.compose`;if(e.curOp&&(e.curOp.lastChange||(r=`input.type.compose.start`)),t.annotations)try{t.annotations.some(function(e){e.value==`input`&&(e.value=r)})}catch(e){console.error(e)}else t.userEvent=r;return n.dispatch(t)}}function P(e,t){e.curOp&&(e.curOp.$changeStart=void 0),(t?S:w)(e.cm6);let n=e.curOp?.$changeStart;n!=null&&e.cm6.dispatch({selection:{anchor:n}})}var se={Left:e=>c(e.cm6,{key:`Left`},`editor`),Right:e=>c(e.cm6,{key:`Right`},`editor`),Up:e=>c(e.cm6,{key:`Up`},`editor`),Down:e=>c(e.cm6,{key:`Down`},`editor`),Backspace:e=>c(e.cm6,{key:`Backspace`},`editor`),Delete:e=>c(e.cm6,{key:`Delete`},`editor`)},F=class e{openDialog(e,t,n){return pe(this,e,t,n)}openNotification(e,t){return ue(this,e,t)}constructor(e){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=e,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}on(e,t){ne(this,e,t)}off(e,t){re(this,e,t)}signal(e,t,n){ie(this,e,t,n)}indexFromPos(e){return A(this.cm6.state.doc,e)}posFromIndex(e){return j(this.cm6.state.doc,e)}foldCode(e){let t=this.cm6,n=t.state.selection.ranges,r=this.cm6.state.doc,i=A(r,e),a=f.create([f.range(i,i)],0).ranges;t.state.selection.ranges=a,g(t),t.state.selection.ranges=n}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(e,t){typeof e==`object`&&(t=e.ch,e=e.line);var n=A(this.cm6.state.doc,{line:e,ch:t||0});this.cm6.dispatch({selection:{anchor:n}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(e){var t=this.cm6.state.selection.main,n=e==`head`||!e?t.head:e==`anchor`?t.anchor:e==`start`?t.from:e==`end`?t.to:null;if(n==null)throw Error(`Invalid cursor type`);return this.posFromIndex(n)}listSelections(){var e=this.cm6.state.doc;return this.cm6.state.selection.ranges.map(t=>({anchor:j(e,t.anchor),head:j(e,t.head)}))}setSelections(e,t){var n=this.cm6.state.doc,r=e.map(e=>{var t=A(n,e.head),r=A(n,e.anchor);return t==r?f.cursor(t,1):f.range(r,t)});this.cm6.dispatch({selection:f.create(r,t)})}setSelection(e,t,n){this.setSelections([{anchor:e,head:t}],0),n&&n.origin==`*mouse`&&this.onBeforeEndOperation()}getLine(e){var t=this.cm6.state.doc;return e<0||e>=t.lines?``:this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||=[],{row:e,index:this.indexFromPos(new M(e,0))}}getLineNumber(e){var t=this.$lineHandleChanges;if(!t)return null;for(var n=e.index,r=0;r<t.length;r++)if(n=t[r].changes.mapPos(n,1,d.TrackAfter),n==null)return null;var i=this.posFromIndex(n);return i.ch==0?i.line:null}releaseLineHandles(){this.$lineHandleChanges=void 0}getRange(e,t){var n=this.cm6.state.doc;return this.cm6.state.sliceDoc(A(n,e),A(n,t))}replaceRange(e,t,n,r){n||=t;var i=this.cm6.state.doc,a=A(i,t),o=A(i,n);oe(this,{changes:{from:a,to:o,insert:e}})}replaceSelection(e){oe(this,this.cm6.state.replaceSelection(e))}replaceSelections(e){var t=this.cm6.state.selection.ranges.map((t,n)=>({from:t.from,to:t.to,insert:e[n]||``}));oe(this,{changes:t})}getSelection(){return this.getSelections().join(`
35
35
  `)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var t=this.cm6.state.doc,n=e.ch,r=e.line+1;r<1&&(r=1,n=0),r>t.lines&&(r=t.lines,n=Number.MAX_VALUE);var i=t.line(r);return n=Math.min(Math.max(0,n),i.to-i.from),new M(r-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var t=this.cm6;return t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},selection:f.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e,t){var n=this.cm6.state,r=A(n.doc,e),i=a(n,r+1,-1);return i&&i.end||(i=a(n,r,1),i&&i.end)?{to:j(n.doc,i.end.from)}:{to:void 0}}scanForBracket(e,t,n,r){return he(this,e,t,n,r)}indentLine(e,t){t?this.indentMore():this.indentLess()}indentMore(){x(this.cm6)}indentLess(){v(this.cm6)}execCommand(t){if(t==`indentAuto`)e.commands.indentAuto(this);else if(t==`goLineLeft`)T(this.cm6);else if(t==`goLineRight`){b(this.cm6);let e=this.cm6.state,t=e.selection.main.head;t<e.doc.length&&e.sliceDoc(t,t+1)!==`
36
- `&&E(this.cm6)}else t+``}setBookmark(e,t){var n=t?.insertLeft?1:-1,r=this.indexFromPos(e);return new ve(this,r,n)}addOverlay({query:e}){let t=new k({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(t.valid){t.forVim=!0,this.cm6Query=t;let e=O.of(t);return this.cm6.dispatch({effects:e}),t}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let t=O.of(this.cm6Query);this.cm6.dispatch({effects:t})}getSearchCursor(e,t){var n=this,r=null,i=null,a=!1;t.ch??=Number.MAX_VALUE;var o=A(n.cm6.state.doc,t),s=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(e,t){return t||`\\`+e});function c(t,n=0,r=t.length){return new ee(t,s,{ignoreCase:e.ignoreCase},n,r)}function l(e){var t=n.cm6.state.doc;if(e>t.length)return null;let r=c(t,e).next();return r.done?null:r.value}var u=1e4;function d(e,t){var r=n.cm6.state.doc;for(let n=1;;n++){let i=Math.max(e,t-n*u),a=c(r,i,t),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==e||o.from>i+10))return o;if(i==e)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){var t=n.cm6.state.doc;return r=e?d(0,r?a?r.to-1:r.from:o):l(r?a?r.to+1:r.to:o),i=r&&{from:j(t,r.from),to:j(t,r.to),match:r.match},a=r?r.from==r.to:!1,r&&r.match},from:function(){return i?.from},to:function(){return i?.to},replace:function(e){r&&(oe(n,{changes:{from:r.from,to:r.to,insert:e}}),r.to=r.from+e.length,i&&(i.to=j(n.cm6.state.doc,r.to)))},get match(){return i&&i.match}}}findPosV(e,t,n,r){let{cm6:i}=this,a=i.state.doc,o=n==`page`?i.dom.clientHeight:0,s=A(a,e),c=f.cursor(s,1,void 0,r),l=Math.round(Math.abs(t));for(let e=0;e<l;e++)n==`page`?c=i.moveVertically(c,t>0,o):n==`line`&&(c=i.moveVertically(c,t>0));let u=j(a,c.head);return(t<0&&c.head==0&&r!=0&&e.line==0&&e.ch!=0||t>0&&c.head==a.length&&u.ch!=r&&e.line==u.line)&&(u.hitSide=!0),u}charCoords(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=A(this.cm6.state.doc,e),i=this.cm6.coordsAtPos(r),a=-n.top;return{left:(i?.left||0)-n.left,top:(i?.top||0)+a,bottom:(i?.bottom||0)+a}}coordsChar(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return j(this.cm6.state.doc,r)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,t){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),t!=null&&(this.cm6.scrollDOM.scrollTop=t)}scrollIntoView(e,t){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:r.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:`scroll`})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption(`mode`)}}setSize(e,t){this.cm6.dom.style.width=e+4+`px`,this.cm6.dom.style.height=t+`px`,this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let t in this.marks)this.marks[t].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(t=>t.map(e.changes)));var t=this.curOp=this.curOp||{};e.changes.iterChanges((e,n,r,i,a)=>{(t.$changeStart==null||t.$changeStart>r)&&(t.$changeStart=r),this.$lastChangeEndOffset=i;var o={text:a.toJSON()};t.lastChange?t.lastChange.next=t.lastChange=o:t.lastChange=t.change=o},!0),t.changeHandlers||=this._handlers.change&&this._handlers.change.slice()}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice(),this.curOp.cursorActivity=!0}operation(e,t){this.curOp||={$d:0},this.curOp.$d++;try{var n=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return n}onBeforeEndOperation(){var e=this.curOp,t=!1;e&&(e.change&&N(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(N(e.cursorActivityHandlers,this,null),e.isVimOp&&(t=!0)),this.curOp=null),t&&this.scrollIntoView()}moveH(e,t){if(t==`char`){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,t){switch(e){case`keyMap`:this.state.keyMap=t;break;case`textwidth`:this.state.textwidth=t}}getOption(e){switch(e){case`firstLineNumber`:return 1;case`tabSize`:return this.cm6.state.tabSize||4;case`readOnly`:return this.cm6.state.readOnly;case`indentWithTabs`:return this.cm6.state.facet(t)==` `;case`indentUnit`:return this.cm6.state.facet(t).length||2;case`textwidth`:return this.state.textwidth;case`keyMap`:return this.state.keyMap||`vim`}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var t=this.indexFromPos(e),n=(_(this.cm6.state,t)?.resolve(t))?.type?.name||``;return/comment/i.test(n)?`comment`:/string/i.test(n)?`string`:``}overWriteSelection(e){var t=this.cm6.state.doc,n=this.cm6.state.selection,r=n.ranges.map(e=>{if(e.empty){var n=e.to<t.length?t.sliceString(e.from,e.to+1):``;if(n&&!/\n/.test(n))return f.range(e.from,e.to+1)}return e});this.cm6.dispatch({selection:f.create(r,n.mainIndex)}),this.replaceSelection(e)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var t=this.cm6.state.selection;this.virtualSelection=f.create(t.ranges,t.mainIndex);for(var n=0;n<this.virtualSelection.ranges.length;n++){var r=this.virtualSelection.ranges[n];r&&(this.cm6.dispatch({selection:f.create([r])}),e(),this.virtualSelection.ranges[n]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}hardWrap(e){return ye(this,e)}};F.isMac=typeof navigator<`u`&&/Mac/.test(navigator.platform),F.Pos=M,F.StringStream=p,F.commands={cursorCharLeft:function(e){C(e.cm6)},redo:function(e){P(e,!1)},undo:function(e){P(e,!0)},newlineAndIndent:function(e){y({state:e.cm6.state,dispatch:t=>oe(e,t)})},indentAuto:function(e){D(e.cm6)},newlineAndIndentContinueComment:void 0,save:void 0},F.isWordChar=function(e){return ae.test(e)},F.keys=se,F.addClass=function(e,t){},F.rmClass=function(e,t){},F.e_preventDefault=function(e){e.preventDefault()},F.e_stop=function(e){var t,n;(t=e?.stopPropagation)==null||t.call(e),(n=e?.preventDefault)==null||n.call(e)},F.lookupKey=function(e,t,n){var r=F.keys[e];!r&&/^Arrow/.test(e)&&(r=F.keys[e.slice(5)]),r&&n(r)},F.on=ne,F.off=re,F.signal=ie,F.findMatchingTag=L,F.findEnclosingTag=ge,F.keyName=void 0;function ce(e,t,n){var r=document.createElement(`div`);return r.appendChild(t),r}function le(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}function ue(e,t,n){le(e,s);var r=ce(e,t,n&&n.bottom),i=!1,a,o=n&&n.duration!==void 0?n.duration:5e3;function s(){i||(i=!0,clearTimeout(a),r.remove(),fe(e,r))}return r.onclick=function(e){e.preventDefault(),s()},de(e,r),o&&(a=setTimeout(s,o)),s}function de(e,t){var n=e.state.dialog;e.state.dialog=t,t.style.flex=`1`,t&&n!==t&&(n&&n.contains(document.activeElement)&&e.focus(),n&&n.parentElement?n.parentElement.replaceChild(t,n):n&&n.remove(),F.signal(e,`dialog`))}function fe(e,t){e.state.dialog==t&&(e.state.dialog=null,F.signal(e,`dialog`))}function pe(e,t,n,r){r||={},le(e,void 0);var i=ce(e,t,r.bottom),a=!1;de(e,i);function o(t){if(typeof t==`string`)s.value=t;else{if(a)return;a=!0,fe(e,i),e.state.dialog||e.focus(),r.onClose&&r.onClose(i)}}var s=i.getElementsByTagName(`input`)[0];return s&&(r.value&&(s.value=r.value,r.selectValueOnOpen!==!1&&s.select()),r.onInput&&F.on(s,`input`,function(e){r.onInput(e,s.value,o)}),r.onKeyUp&&F.on(s,`keyup`,function(e){r.onKeyUp(e,s.value,o)}),F.on(s,`keydown`,function(e){r&&r.onKeyDown&&r.onKeyDown(e,s.value,o)||(e.keyCode==13&&n&&n(s.value),(e.keyCode==27||r.closeOnEnter!==!1&&e.keyCode==13)&&(s.blur(),F.e_stop(e),o()))}),r.closeOnBlur!==!1&&F.on(s,`blur`,function(){setTimeout(function(){document.activeElement!==s&&o()})}),s.focus()),o}var me={"(":`)>`,")":`(<`,"[":`]>`,"]":`[<`,"{":`}>`,"}":`{<`,"<":`>>`,">":`<<`};function I(e){return e&&e.bracketRegex||/[(){}[\]]/}function he(e,t,n,r,i){for(var a=i&&i.maxScanLineLength||1e4,o=i&&i.maxScanLines||1e3,s=[],c=I(i),l=n>0?Math.min(t.line+o,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-o),u=t.line;u!=l;u+=n){var d=e.getLine(u);if(d){var f=n>0?0:d.length-1,p=n>0?d.length:-1;if(!(d.length>a))for(u==t.line&&(f=t.ch-+(n<0));f!=p;f+=n){var m=d.charAt(f);if(c.test(m)){var h=me[m];if(h&&h.charAt(1)==`>`==n>0)s.push(m);else if(s.length)s.pop();else return{pos:new M(u,f),ch:m}}}}}return u-n!=(n>0?e.lastLine():e.firstLine())&&null}function L(e,t){return null}function ge(e,t){var n=e.cm6.state,r=e.indexFromPos(t);r<n.doc.length&&n.sliceDoc(r,r+1)==`<`&&r++;for(var i=_(n,r)?.resolve(r)||null;i;){if(i.firstChild?.type.name==`OpenTag`&&i.lastChild?.type.name==`CloseTag`)return{open:_e(n.doc,i.firstChild),close:_e(n.doc,i.lastChild)};i=i.parent}}function _e(e,t){return{from:j(e,t.from),to:j(e,t.to)}}var ve=class{constructor(e,t,n){this.cm=e,this.id=e.$mid++,this.offset=t,this.assoc=n,e.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return this.offset==null?null:this.cm.posFromIndex(this.offset)}update(e){this.offset!=null&&(this.offset=e.mapPos(this.offset,this.assoc,d.TrackDel))}};function ye(e,t){for(var n=t.column||e.getOption(`textwidth`)||80,r=t.allowMerge!=0,i=Math.min(t.from,t.to),a=Math.max(t.from,t.to);i<=a;){var o=e.getLine(i);if(o.length>n){var s=p(o,n,5);if(s){var c=/^\s*/.exec(o)?.[0];e.replaceRange(`
36
+ `&&E(this.cm6)}else t+``}setBookmark(e,t){var n=t?.insertLeft?1:-1,r=this.indexFromPos(e);return new ve(this,r,n)}addOverlay({query:e}){let t=new O({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(t.valid){t.forVim=!0,this.cm6Query=t;let e=ee.of(t);return this.cm6.dispatch({effects:e}),t}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let t=ee.of(this.cm6Query);this.cm6.dispatch({effects:t})}getSearchCursor(e,t){var n=this,r=null,i=null,a=!1;t.ch??=Number.MAX_VALUE;var o=A(n.cm6.state.doc,t),s=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(e,t){return t||`\\`+e});function c(t,n=0,r=t.length){return new k(t,s,{ignoreCase:e.ignoreCase},n,r)}function l(e){var t=n.cm6.state.doc;if(e>t.length)return null;let r=c(t,e).next();return r.done?null:r.value}var u=1e4;function d(e,t){var r=n.cm6.state.doc;for(let n=1;;n++){let i=Math.max(e,t-n*u),a=c(r,i,t),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==e||o.from>i+10))return o;if(i==e)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){var t=n.cm6.state.doc;return r=e?d(0,r?a?r.to-1:r.from:o):l(r?a?r.to+1:r.to:o),i=r&&{from:j(t,r.from),to:j(t,r.to),match:r.match},a=r?r.from==r.to:!1,r&&r.match},from:function(){return i?.from},to:function(){return i?.to},replace:function(e){r&&(oe(n,{changes:{from:r.from,to:r.to,insert:e}}),r.to=r.from+e.length,i&&(i.to=j(n.cm6.state.doc,r.to)))},get match(){return i&&i.match}}}findPosV(e,t,n,r){let{cm6:i}=this,a=i.state.doc,o=n==`page`?i.dom.clientHeight:0,s=A(a,e),c=f.cursor(s,1,void 0,r),l=Math.round(Math.abs(t));for(let e=0;e<l;e++)n==`page`?c=i.moveVertically(c,t>0,o):n==`line`&&(c=i.moveVertically(c,t>0));let u=j(a,c.head);return(t<0&&c.head==0&&r!=0&&e.line==0&&e.ch!=0||t>0&&c.head==a.length&&u.ch!=r&&e.line==u.line)&&(u.hitSide=!0),u}charCoords(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=A(this.cm6.state.doc,e),i=this.cm6.coordsAtPos(r),a=-n.top;return{left:(i?.left||0)-n.left,top:(i?.top||0)+a,bottom:(i?.bottom||0)+a}}coordsChar(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return j(this.cm6.state.doc,r)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,t){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),t!=null&&(this.cm6.scrollDOM.scrollTop=t)}scrollIntoView(e,t){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:r.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:`scroll`})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption(`mode`)}}setSize(e,t){this.cm6.dom.style.width=e+4+`px`,this.cm6.dom.style.height=t+`px`,this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let t in this.marks)this.marks[t].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(t=>t.map(e.changes)));var t=this.curOp=this.curOp||{};e.changes.iterChanges((e,n,r,i,a)=>{(t.$changeStart==null||t.$changeStart>r)&&(t.$changeStart=r),this.$lastChangeEndOffset=i;var o={text:a.toJSON()};t.lastChange?t.lastChange.next=t.lastChange=o:t.lastChange=t.change=o},!0),t.changeHandlers||=this._handlers.change&&this._handlers.change.slice()}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice(),this.curOp.cursorActivity=!0}operation(e,t){this.curOp||={$d:0},this.curOp.$d++;try{var n=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return n}onBeforeEndOperation(){var e=this.curOp,t=!1;e&&(e.change&&N(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(N(e.cursorActivityHandlers,this,null),e.isVimOp&&(t=!0)),this.curOp=null),t&&this.scrollIntoView()}moveH(e,t){if(t==`char`){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,t){switch(e){case`keyMap`:this.state.keyMap=t;break;case`textwidth`:this.state.textwidth=t}}getOption(e){switch(e){case`firstLineNumber`:return 1;case`tabSize`:return this.cm6.state.tabSize||4;case`readOnly`:return this.cm6.state.readOnly;case`indentWithTabs`:return this.cm6.state.facet(t)==` `;case`indentUnit`:return this.cm6.state.facet(t).length||2;case`textwidth`:return this.state.textwidth;case`keyMap`:return this.state.keyMap||`vim`}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var t=this.indexFromPos(e),n=(_(this.cm6.state,t)?.resolve(t))?.type?.name||``;return/comment/i.test(n)?`comment`:/string/i.test(n)?`string`:``}overWriteSelection(e){var t=this.cm6.state.doc,n=this.cm6.state.selection,r=n.ranges.map(e=>{if(e.empty){var n=e.to<t.length?t.sliceString(e.from,e.to+1):``;if(n&&!/\n/.test(n))return f.range(e.from,e.to+1)}return e});this.cm6.dispatch({selection:f.create(r,n.mainIndex)}),this.replaceSelection(e)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var t=this.cm6.state.selection;this.virtualSelection=f.create(t.ranges,t.mainIndex);for(var n=0;n<this.virtualSelection.ranges.length;n++){var r=this.virtualSelection.ranges[n];r&&(this.cm6.dispatch({selection:f.create([r])}),e(),this.virtualSelection.ranges[n]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}hardWrap(e){return ye(this,e)}};F.isMac=typeof navigator<`u`&&/Mac/.test(navigator.platform),F.Pos=M,F.StringStream=p,F.commands={cursorCharLeft:function(e){C(e.cm6)},redo:function(e){P(e,!1)},undo:function(e){P(e,!0)},newlineAndIndent:function(e){y({state:e.cm6.state,dispatch:t=>oe(e,t)})},indentAuto:function(e){D(e.cm6)},newlineAndIndentContinueComment:void 0,save:void 0},F.isWordChar=function(e){return ae.test(e)},F.keys=se,F.addClass=function(e,t){},F.rmClass=function(e,t){},F.e_preventDefault=function(e){e.preventDefault()},F.e_stop=function(e){var t,n;(t=e?.stopPropagation)==null||t.call(e),(n=e?.preventDefault)==null||n.call(e)},F.lookupKey=function(e,t,n){var r=F.keys[e];!r&&/^Arrow/.test(e)&&(r=F.keys[e.slice(5)]),r&&n(r)},F.on=ne,F.off=re,F.signal=ie,F.findMatchingTag=L,F.findEnclosingTag=ge,F.keyName=void 0;function ce(e,t,n){var r=document.createElement(`div`);return r.appendChild(t),r}function le(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}function ue(e,t,n){le(e,s);var r=ce(e,t,n&&n.bottom),i=!1,a,o=n&&n.duration!==void 0?n.duration:5e3;function s(){i||(i=!0,clearTimeout(a),r.remove(),fe(e,r))}return r.onclick=function(e){e.preventDefault(),s()},de(e,r),o&&(a=setTimeout(s,o)),s}function de(e,t){var n=e.state.dialog;e.state.dialog=t,t.style.flex=`1`,t&&n!==t&&(n&&n.contains(document.activeElement)&&e.focus(),n&&n.parentElement?n.parentElement.replaceChild(t,n):n&&n.remove(),F.signal(e,`dialog`))}function fe(e,t){e.state.dialog==t&&(e.state.dialog=null,F.signal(e,`dialog`))}function pe(e,t,n,r){r||={},le(e,void 0);var i=ce(e,t,r.bottom),a=!1;de(e,i);function o(t){if(typeof t==`string`)s.value=t;else{if(a)return;a=!0,fe(e,i),e.state.dialog||e.focus(),r.onClose&&r.onClose(i)}}var s=i.getElementsByTagName(`input`)[0];return s&&(r.value&&(s.value=r.value,r.selectValueOnOpen!==!1&&s.select()),r.onInput&&F.on(s,`input`,function(e){r.onInput(e,s.value,o)}),r.onKeyUp&&F.on(s,`keyup`,function(e){r.onKeyUp(e,s.value,o)}),F.on(s,`keydown`,function(e){r&&r.onKeyDown&&r.onKeyDown(e,s.value,o)||(e.keyCode==13&&n&&n(s.value),(e.keyCode==27||r.closeOnEnter!==!1&&e.keyCode==13)&&(s.blur(),F.e_stop(e),o()))}),r.closeOnBlur!==!1&&F.on(s,`blur`,function(){setTimeout(function(){document.activeElement!==s&&o()})}),s.focus()),o}var me={"(":`)>`,")":`(<`,"[":`]>`,"]":`[<`,"{":`}>`,"}":`{<`,"<":`>>`,">":`<<`};function I(e){return e&&e.bracketRegex||/[(){}[\]]/}function he(e,t,n,r,i){for(var a=i&&i.maxScanLineLength||1e4,o=i&&i.maxScanLines||1e3,s=[],c=I(i),l=n>0?Math.min(t.line+o,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-o),u=t.line;u!=l;u+=n){var d=e.getLine(u);if(d){var f=n>0?0:d.length-1,p=n>0?d.length:-1;if(!(d.length>a))for(u==t.line&&(f=t.ch-+(n<0));f!=p;f+=n){var m=d.charAt(f);if(c.test(m)){var h=me[m];if(h&&h.charAt(1)==`>`==n>0)s.push(m);else if(s.length)s.pop();else return{pos:new M(u,f),ch:m}}}}}return u-n!=(n>0?e.lastLine():e.firstLine())&&null}function L(e,t){return null}function ge(e,t){var n=e.cm6.state,r=e.indexFromPos(t);r<n.doc.length&&n.sliceDoc(r,r+1)==`<`&&r++;for(var i=_(n,r)?.resolve(r)||null;i;){if(i.firstChild?.type.name==`OpenTag`&&i.lastChild?.type.name==`CloseTag`)return{open:_e(n.doc,i.firstChild),close:_e(n.doc,i.lastChild)};i=i.parent}}function _e(e,t){return{from:j(e,t.from),to:j(e,t.to)}}var ve=class{constructor(e,t,n){this.cm=e,this.id=e.$mid++,this.offset=t,this.assoc=n,e.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return this.offset==null?null:this.cm.posFromIndex(this.offset)}update(e){this.offset!=null&&(this.offset=e.mapPos(this.offset,this.assoc,d.TrackDel))}};function ye(e,t){for(var n=t.column||e.getOption(`textwidth`)||80,r=t.allowMerge!=0,i=Math.min(t.from,t.to),a=Math.max(t.from,t.to);i<=a;){var o=e.getLine(i);if(o.length>n){var s=p(o,n,5);if(s){var c=/^\s*/.exec(o)?.[0];e.replaceRange(`
37
37
  `+c,new M(i,s.start),new M(i,s.end))}a++}else if(r&&/\S/.test(o)&&i!=a){var l=e.getLine(i+1);if(l&&/\S/.test(l)){var u=o.replace(/\s+$/,``),d=l.replace(/^\s+/,``),f=u+` `+d,s=p(f,n,5);s&&s.start>u.length||f.length<n?(e.replaceRange(` `,new M(i,u.length),new M(i+1,l.length-d.length)),i--,a--):u.length<o.length&&e.replaceRange(``,new M(i,u.length),new M(i,o.length))}}i++}return i;function p(e,t,n){if(!(e.length<t)){var r=e.slice(0,t),i=e.slice(t),a=/^(?:(\s+)|(\S+)(\s+))/.exec(i),o=/(?:(\s+)|(\s+)(\S+))$/.exec(r),s=0,c=0;if(o&&!o[2]&&(s=t-o[1].length,c=t),a&&!a[2]&&(s||=t,c=t+a[1].length),s)return{start:s,end:c};if(o&&o[2]&&o.index>n)return{start:o.index,end:o.index+o[2].length};if(a&&a[2])return s=t+a[2].length,{start:s,end:s+a[3].length}}}}var R=i||function(){let e={cursorBlinkRate:1200};return function(){return e}}(),be=class{constructor(e,t,n,r,i,a,o,s,c,l){this.left=e,this.top=t,this.height=n,this.fontFamily=r,this.fontSize=i,this.fontWeight=a,this.color=o,this.className=s,this.letter=c,this.partial=l}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,e.style.height=this.height+`px`,e.style.lineHeight=this.height+`px`,e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?`transparent`:this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}},xe=class{constructor(e,t){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=t,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement(`div`)),this.cursorLayer.className=`cm-cursorLayer cm-vimCursorLayer`,this.cursorLayer.setAttribute(`aria-hidden`,`true`),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let e=R(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=e+`ms`}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`),Se(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,t=[];for(let n of e.selection.ranges){let r=n==e.selection.main,i=Te(this.cm,this.view,n,r);i&&t.push(i)}return{cursors:t}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((e,t)=>!e.eq(this.cursors[t]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent=``;for(let t of e)this.cursorLayer.appendChild(t.draw())}else e.forEach((e,n)=>e.adjust(t[n]));this.cursors=e}}destroy(){this.cursorLayer.remove()}};function Se(e){return R(e.startState)!=R(e.state)}var Ce=h.highest(r.theme({".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:`transparent !important`},"&::selection":{backgroundColor:`transparent !important`},caretColor:`transparent !important`},".cm-fat-cursor":{position:`absolute`,background:`#ff9696`,border:`none`,whiteSpace:`pre`},"&:not(.cm-focused) .cm-fat-cursor":{background:`none`,outline:`solid 1px #ff9696`,color:`transparent !important`}}));function we(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==s.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Te(e,t,n,r){var i;let a=n.head,o=!1,s=1,c=e.state.vim;if(c&&(!c.insertMode||e.state.overwrite)){if(o=!0,c.visualBlock&&!r)return null;n.anchor<n.head&&(a<t.state.doc.length&&t.state.sliceDoc(a,a+1))!=`
38
38
  `&&a--,e.state.overwrite?s=.2:c.status&&(s=.5)}if(o){let e=a<t.state.doc.length&&t.state.sliceDoc(a,a+1);e&&/[\uDC00-\uDFFF]/.test(e)&&a>1&&(a--,e=t.state.sliceDoc(a,a+1));let n=t.coordsAtPos(a,1);if(!n)return null;let o=we(t),c=t.domAtPos(a),u=c?c.node:t.contentDOM;for(u instanceof Text&&c.offset>=u.data.length&&u.parentElement?.nextSibling&&(u=u.parentElement?.nextSibling,c={node:u,offset:0});c&&c.node instanceof HTMLElement;)u=c.node,c={node:c.node.childNodes[c.offset],offset:0};if(!(u instanceof HTMLElement)){if(!u.parentNode)return null;u=u.parentNode}let d=getComputedStyle(u),f=n.left,p=(i=t).coordsForChar?.call(i,a);if(p&&(f=p.left),!e||e==`
39
- `||e==`\r`)e=`\xA0`;else if(e==` `){e=`\xA0`;var l=t.coordsAtPos(a+1,-1);l&&(f=l.left-(l.left-n.left)/parseInt(d.tabSize))}else/[\uD800-\uDBFF]/.test(e)&&a<t.state.doc.length-1&&(e+=t.state.sliceDoc(a+1,a+2));let m=n.bottom-n.top;return new be((f-o.left)/t.scaleX,(n.top-o.top+m*(1-s))/t.scaleY,m*s/t.scaleY,d.fontFamily,d.fontSize,d.fontWeight,d.color,r?`cm-fat-cursor cm-cursor-primary`:`cm-fat-cursor cm-cursor-secondary`,e,s!=1)}return null}var z=typeof navigator<`u`&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent),B=te(F),V=r.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:`none`},".cm-vim-panel":{padding:`0px 10px`,fontFamily:`monospace`,minHeight:`1.3em`,display:`flex`},".cm-vim-panel input":{border:`none`,outline:`none`,backgroundColor:`inherit`},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`}}),Ee=o.fromClass(class{constructor(e){this.status=``,this.query=null,this.decorations=n.none,this.waitForCopy=!1,this.lastKeydown=``,this.useNextTextInput=!1,this.compositionText=``,this.view=e;let t=this.cm=new F(e);B.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new xe(e,t),this.updateClass(),this.cm.on(`vim-command-done`,()=>{t.state.vim&&(t.state.vim.status=``),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on(`vim-mode-change`,e=>{t.state.vim&&(t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=` block`),t.state.vim.status=``,this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())}),this.cm.on(`dialog`,()=>{this.cm.state.statusbar?this.updateStatus():e.dispatch({effects:ke.of(!!this.cm.state.dialog)})}),this.dom=document.createElement(`span`),this.spacer=document.createElement(`span`),this.spacer.style.flex=`1`,this.statusButton=document.createElement(`span`),this.statusButton.onclick=e=>{B.handleKey(this.cm,`<Esc>`,`user`),this.cm.focus()},this.statusButton.style.cssText=`cursor: pointer`}update(e){if((e.viewportChanged||e.docChanged)&&this.query&&this.highlight(this.query),e.docChanged&&this.cm.onChange(e),e.selectionSet&&this.cm.onSelectionChange(),e.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),e.transactions){for(let t of e.transactions)for(let e of t.effects)if(e.is(O))if(!e.value?.forVim)this.highlight(null);else{let t=e.value.create();this.highlight(t)}}this.blockCursor.update(e)}updateClass(){let e=this.cm.state;!e.vim||e.vim.insertMode&&!e.overwrite?this.view.scrollDOM.classList.remove(`cm-vimMode`):this.view.scrollDOM.classList.add(`cm-vimMode`)}updateStatus(){let e=this.cm.state.statusbar,t=this.cm.state.vim;if(!e||!t)return;let n=this.cm.state.dialog;if(n)n.parentElement!=e&&(e.textContent=``,e.appendChild(n));else{e.textContent=``;var r=(t.mode||`normal`).toUpperCase();t.insertModeReturn&&(r+=`(C-O)`),this.statusButton.textContent=`--${r}--`,e.appendChild(this.statusButton),e.appendChild(this.spacer)}this.dom.textContent=t.status,e.appendChild(this.dom)}destroy(){B.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(e){if(this.query=e,!e)return this.decorations=n.none;let{view:t}=this,r=new l;for(let n=0,i=t.visibleRanges,a=i.length;n<a;n++){let{from:o,to:s}=i[n];for(;n<a-1&&s>i[n+1].from-500;)s=i[++n].to;e.highlight(t.state,o,s,(e,t)=>{r.add(e,t,Oe)})}return this.decorations=r.finish()}handleKey(e,t){let n=this.cm,r=n.state.vim;if(!r)return;let i=B.vimKeyFromEvent(e,r);if(F.signal(this.cm,`inputEvent`,{type:`handleKey`,key:i}),!i)return;if(i==`<Esc>`&&!r.insertMode&&!r.visualMode&&this.query){let e=r.searchState_;e&&(n.removeOverlay(e.getOverlay()),e.setOverlay(null))}if(i===`<C-c>`&&!F.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||``)+i;let a=B.multiSelectHandleKey(n,i,`user`);return r=B.maybeInitVimState_(n),!a&&r.insertMode&&n.state.overwrite&&(e.key&&e.key.length==1&&!/\n/.test(e.key)?(a=!0,n.overWriteSelection(e.key)):e.key==`Backspace`&&(a=!0,F.commands.cursorCharLeft(n))),a&&(F.signal(this.cm,`vim-keypress`,i),e.preventDefault(),e.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!a}},{eventHandlers:{copy:function(e,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,t=e.state.vim;t&&(t.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),B.handleKey(e,`<Esc>`,`user`)}))}))},compositionstart:function(e,t){this.useNextTextInput=!0,F.signal(this.cm,`inputEvent`,e)},compositionupdate:function(e,t){F.signal(this.cm,`inputEvent`,e)},compositionend:function(e,t){F.signal(this.cm,`inputEvent`,e)},keypress:function(e,t){F.signal(this.cm,`inputEvent`,e),this.lastKeydown==`Dead`&&this.handleKey(e,t)},keydown:function(e,t){F.signal(this.cm,`inputEvent`,e),this.lastKeydown=e.key,this.lastKeydown==`Unidentified`||this.lastKeydown==`Process`||this.lastKeydown==`Dead`?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(e,t))}},provide:()=>[r.inputHandler.of((e,t,n,r)=>{var i=K(e);if(!i)return!1;var a=i.state?.vim,o=i.state.vimPlugin;if(a&&!a.insertMode&&!i.curOp?.isVimOp){if(r===`\0\0`)return!0;if(F.signal(i,`inputEvent`,{type:`text`,text:r,from:t,to:n}),r.length==1&&o.useNextTextInput){if(a.expectLiteralNext&&e.composing)return o.compositionText=r,!1;if(o.compositionText){var s=o.compositionText;o.compositionText=``;var c=e.state.selection.main.head;if(s===e.state.sliceDoc(c-s.length,c)){var l=i.getCursor();i.replaceRange(``,i.posFromIndex(c-s.length),l)}}return o.handleKey({key:r,preventDefault:()=>{},stopPropagation:()=>{}}),De(e),!0}}return!1})],decorations:e=>e.decorations});function De(e){var t=e.scrollDOM.parentElement;if(t){if(z){e.contentDOM.textContent=`\0\0`,e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`));return}var n=e.scrollDOM.nextSibling,r=window.getSelection(),i=r&&{anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset};e.scrollDOM.remove(),t.insertBefore(e.scrollDOM,n);try{i&&r&&(r.setPosition(i.anchorNode,i.anchorOffset),i.focusNode&&r.extend(i.focusNode,i.focusOffset))}catch(e){console.error(e)}e.focus(),e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`))}}var Oe=n.mark({class:`cm-searchMatch`}),ke=u.define(),H=m.define({create:()=>!1,update(e,t){for(let n of t.effects)n.is(ke)&&(e=n.value);return e},provide:t=>e.from(t,e=>e?U:null)});function U(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.dialog&&t.appendChild(n.state.dialog),{top:!1,dom:t}}function W(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.statusbar=t,n.state.vimPlugin.updateStatus(),{dom:t}}function G(t={}){return[V,Ee,Ce,t.status?e.of(W):H]}function K(e){return e.cm||null}export{G as n,K as t};
39
+ `||e==`\r`)e=`\xA0`;else if(e==` `){e=`\xA0`;var l=t.coordsAtPos(a+1,-1);l&&(f=l.left-(l.left-n.left)/parseInt(d.tabSize))}else/[\uD800-\uDBFF]/.test(e)&&a<t.state.doc.length-1&&(e+=t.state.sliceDoc(a+1,a+2));let m=n.bottom-n.top;return new be((f-o.left)/t.scaleX,(n.top-o.top+m*(1-s))/t.scaleY,m*s/t.scaleY,d.fontFamily,d.fontSize,d.fontWeight,d.color,r?`cm-fat-cursor cm-cursor-primary`:`cm-fat-cursor cm-cursor-secondary`,e,s!=1)}return null}var z=typeof navigator<`u`&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent),B=te(F),V=r.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:`none`},".cm-vim-panel":{padding:`0px 10px`,fontFamily:`monospace`,minHeight:`1.3em`,display:`flex`},".cm-vim-panel input":{border:`none`,outline:`none`,backgroundColor:`inherit`},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`}}),Ee=o.fromClass(class{constructor(e){this.status=``,this.query=null,this.decorations=n.none,this.waitForCopy=!1,this.lastKeydown=``,this.useNextTextInput=!1,this.compositionText=``,this.view=e;let t=this.cm=new F(e);B.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new xe(e,t),this.updateClass(),this.cm.on(`vim-command-done`,()=>{t.state.vim&&(t.state.vim.status=``),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on(`vim-mode-change`,e=>{t.state.vim&&(t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=` block`),t.state.vim.status=``,this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())}),this.cm.on(`dialog`,()=>{this.cm.state.statusbar?this.updateStatus():e.dispatch({effects:ke.of(!!this.cm.state.dialog)})}),this.dom=document.createElement(`span`),this.spacer=document.createElement(`span`),this.spacer.style.flex=`1`,this.statusButton=document.createElement(`span`),this.statusButton.onclick=e=>{B.handleKey(this.cm,`<Esc>`,`user`),this.cm.focus()},this.statusButton.style.cssText=`cursor: pointer`}update(e){if((e.viewportChanged||e.docChanged)&&this.query&&this.highlight(this.query),e.docChanged&&this.cm.onChange(e),e.selectionSet&&this.cm.onSelectionChange(),e.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),e.transactions){for(let t of e.transactions)for(let e of t.effects)if(e.is(ee))if(!e.value?.forVim)this.highlight(null);else{let t=e.value.create();this.highlight(t)}}this.blockCursor.update(e)}updateClass(){let e=this.cm.state;!e.vim||e.vim.insertMode&&!e.overwrite?this.view.scrollDOM.classList.remove(`cm-vimMode`):this.view.scrollDOM.classList.add(`cm-vimMode`)}updateStatus(){let e=this.cm.state.statusbar,t=this.cm.state.vim;if(!e||!t)return;let n=this.cm.state.dialog;if(n)n.parentElement!=e&&(e.textContent=``,e.appendChild(n));else{e.textContent=``;var r=(t.mode||`normal`).toUpperCase();t.insertModeReturn&&(r+=`(C-O)`),this.statusButton.textContent=`--${r}--`,e.appendChild(this.statusButton),e.appendChild(this.spacer)}this.dom.textContent=t.status,e.appendChild(this.dom)}destroy(){B.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(e){if(this.query=e,!e)return this.decorations=n.none;let{view:t}=this,r=new l;for(let n=0,i=t.visibleRanges,a=i.length;n<a;n++){let{from:o,to:s}=i[n];for(;n<a-1&&s>i[n+1].from-500;)s=i[++n].to;e.highlight(t.state,o,s,(e,t)=>{r.add(e,t,Oe)})}return this.decorations=r.finish()}handleKey(e,t){let n=this.cm,r=n.state.vim;if(!r)return;let i=B.vimKeyFromEvent(e,r);if(F.signal(this.cm,`inputEvent`,{type:`handleKey`,key:i}),!i)return;if(i==`<Esc>`&&!r.insertMode&&!r.visualMode&&this.query){let e=r.searchState_;e&&(n.removeOverlay(e.getOverlay()),e.setOverlay(null))}if(i===`<C-c>`&&!F.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||``)+i;let a=B.multiSelectHandleKey(n,i,`user`);return r=B.maybeInitVimState_(n),!a&&r.insertMode&&n.state.overwrite&&(e.key&&e.key.length==1&&!/\n/.test(e.key)?(a=!0,n.overWriteSelection(e.key)):e.key==`Backspace`&&(a=!0,F.commands.cursorCharLeft(n))),a&&(F.signal(this.cm,`vim-keypress`,i),e.preventDefault(),e.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!a}},{eventHandlers:{copy:function(e,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,t=e.state.vim;t&&(t.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),B.handleKey(e,`<Esc>`,`user`)}))}))},compositionstart:function(e,t){this.useNextTextInput=!0,F.signal(this.cm,`inputEvent`,e)},compositionupdate:function(e,t){F.signal(this.cm,`inputEvent`,e)},compositionend:function(e,t){F.signal(this.cm,`inputEvent`,e)},keypress:function(e,t){F.signal(this.cm,`inputEvent`,e),this.lastKeydown==`Dead`&&this.handleKey(e,t)},keydown:function(e,t){F.signal(this.cm,`inputEvent`,e),this.lastKeydown=e.key,this.lastKeydown==`Unidentified`||this.lastKeydown==`Process`||this.lastKeydown==`Dead`?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(e,t))}},provide:()=>[r.inputHandler.of((e,t,n,r)=>{var i=K(e);if(!i)return!1;var a=i.state?.vim,o=i.state.vimPlugin;if(a&&!a.insertMode&&!i.curOp?.isVimOp){if(r===`\0\0`)return!0;if(F.signal(i,`inputEvent`,{type:`text`,text:r,from:t,to:n}),r.length==1&&o.useNextTextInput){if(a.expectLiteralNext&&e.composing)return o.compositionText=r,!1;if(o.compositionText){var s=o.compositionText;o.compositionText=``;var c=e.state.selection.main.head;if(s===e.state.sliceDoc(c-s.length,c)){var l=i.getCursor();i.replaceRange(``,i.posFromIndex(c-s.length),l)}}return o.handleKey({key:r,preventDefault:()=>{},stopPropagation:()=>{}}),De(e),!0}}return!1})],decorations:e=>e.decorations});function De(e){var t=e.scrollDOM.parentElement;if(t){if(z){e.contentDOM.textContent=`\0\0`,e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`));return}var n=e.scrollDOM.nextSibling,r=window.getSelection(),i=r&&{anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset};e.scrollDOM.remove(),t.insertBefore(e.scrollDOM,n);try{i&&r&&(r.setPosition(i.anchorNode,i.anchorOffset),i.focusNode&&r.extend(i.focusNode,i.focusOffset))}catch(e){console.error(e)}e.focus(),e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`))}}var Oe=n.mark({class:`cm-searchMatch`}),ke=u.define(),H=m.define({create:()=>!1,update(e,t){for(let n of t.effects)n.is(ke)&&(e=n.value);return e},provide:t=>e.from(t,e=>e?U:null)});function U(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.dialog&&t.appendChild(n.state.dialog),{top:!1,dom:t}}function W(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.statusbar=t,n.state.vimPlugin.updateStatus(),{dom:t}}function G(t={}){return[V,Ee,Ce,t.status?e.of(W):H]}function K(e){return e.cm||null}export{G as n,K as t};