@markusylisiurunen/tau 0.3.101 → 0.3.102

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 (63) hide show
  1. package/dist/core/config/ownership.js +3 -1
  2. package/dist/core/config/ownership.js.map +1 -1
  3. package/dist/core/config/schema.js +3 -1
  4. package/dist/core/config/schema.js.map +1 -1
  5. package/dist/core/history/migrations.js +6 -1
  6. package/dist/core/history/migrations.js.map +1 -1
  7. package/dist/core/static/tau_docs/config-reference.md +17 -5
  8. package/dist/core/static/tau_docs/credentials.md +4 -4
  9. package/dist/core/static/tau_docs/index.md +2 -1
  10. package/dist/core/static/tau_docs/manifest.json +1 -0
  11. package/dist/core/static/tau_docs/prompts-and-project-context.md +4 -4
  12. package/dist/core/static/tau_docs/session-protocol.md +1 -1
  13. package/dist/core/static/tau_docs/telegram-commands.md +55 -0
  14. package/dist/core/static/tau_docs/telegram.md +10 -38
  15. package/dist/core/static/tau_docs/tui.md +17 -11
  16. package/dist/core/subagents/claude_code_runner.mjs +65 -65
  17. package/dist/core/telegram/adapter.js +178 -61
  18. package/dist/core/telegram/adapter.js.map +1 -1
  19. package/dist/core/telegram/cli.js +1 -3
  20. package/dist/core/telegram/cli.js.map +1 -1
  21. package/dist/core/telegram/config.js +3 -1
  22. package/dist/core/telegram/config.js.map +1 -1
  23. package/dist/core/telegram/runtime.js +1 -1
  24. package/dist/core/telegram/runtime.js.map +1 -1
  25. package/dist/core/utils/scribe_transcription.js +283 -0
  26. package/dist/core/utils/scribe_transcription.js.map +1 -0
  27. package/dist/core/utils/speech_cleanup.js +198 -0
  28. package/dist/core/utils/speech_cleanup.js.map +1 -0
  29. package/dist/core/utils/speech_to_text.js +3 -3
  30. package/dist/core/utils/speech_to_text_keywords.js +5 -4
  31. package/dist/core/utils/speech_to_text_keywords.js.map +1 -1
  32. package/dist/core/version.js +1 -1
  33. package/dist/diff_tool/app/dist/assets/{core-CXVpaOO1.js → core-Cnp6wBC7.js} +1 -1
  34. package/dist/diff_tool/app/dist/assets/engine-oniguruma-ConHyUk6.js +1 -0
  35. package/dist/diff_tool/app/dist/assets/{highlights-DuJNYjEh.js → highlights-DeO0fGqQ.js} +1 -1
  36. package/dist/diff_tool/app/dist/assets/index-BDuQ2wXS.js +221 -0
  37. package/dist/diff_tool/app/dist/assets/langs-DDFHLNuJ.js +1 -0
  38. package/dist/diff_tool/app/dist/assets/{loader-bi21_x0K.js → loader-DrwOwtvp.js} +1 -1
  39. package/dist/diff_tool/app/dist/assets/{preload-helper-CRzLMJPS.js → preload-helper-DclECHGd.js} +1 -1
  40. package/dist/diff_tool/app/dist/assets/{shiki-D6ZyrNQD.js → shiki-CwKGJZFi.js} +2 -2
  41. package/dist/diff_tool/app/dist/assets/{stream-tokenizer-BdsyU_yB.js → stream-tokenizer-D4-m26wx.js} +1 -1
  42. package/dist/diff_tool/app/dist/assets/{themes-9lpTYI_i.js → themes-Do3waJhf.js} +2 -2
  43. package/dist/diff_tool/app/dist/index.html +2 -2
  44. package/dist/history/worker/index.js +77 -51
  45. package/dist/history/worker/index.js.map +1 -1
  46. package/dist/history/worker/migrations/0003_digest_schedule.sql +36 -0
  47. package/dist/history/worker/migrations/0004_recent_sessions.sql +1 -0
  48. package/dist/store/session_snapshot_migrations.js +14 -1
  49. package/dist/store/session_snapshot_migrations.js.map +1 -1
  50. package/dist/tui/chat_view.js +3 -1
  51. package/dist/tui/chat_view.js.map +1 -1
  52. package/dist/tui/listen_capture.js +7 -5
  53. package/dist/tui/listen_capture.js.map +1 -1
  54. package/dist/tui/session_chat_controller.js +93 -15
  55. package/dist/tui/session_chat_controller.js.map +1 -1
  56. package/dist/tui/ui/custom_editor.js +3 -0
  57. package/dist/tui/ui/custom_editor.js.map +1 -1
  58. package/package.json +8 -7
  59. package/dist/core/utils/gemini_transcription.js +0 -566
  60. package/dist/core/utils/gemini_transcription.js.map +0 -1
  61. package/dist/diff_tool/app/dist/assets/engine-oniguruma-Rz_7DPcV.js +0 -1
  62. package/dist/diff_tool/app/dist/assets/index-F9is7PUw.js +0 -221
  63. package/dist/diff_tool/app/dist/assets/langs-CTftvgbb.js +0 -1
@@ -0,0 +1 @@
1
+ export{Y as bundledLanguages}from"./index-BDuQ2wXS.js";
@@ -1 +1 @@
1
- import{t as e}from"./preload-helper-CRzLMJPS.js";var t={andromeeda:()=>e(()=>import(`./andromeeda-DW8vo71h.js`),[],import.meta.url),"aurora-x":()=>e(()=>import(`./aurora-x-rMvKqtYI.js`),[],import.meta.url),"ayu-dark":()=>e(()=>import(`./ayu-dark-CwczpL8O.js`),[],import.meta.url),"ayu-light":()=>e(()=>import(`./ayu-light-DSh22xiD.js`),[],import.meta.url),"ayu-mirage":()=>e(()=>import(`./ayu-mirage-JE6hAyHG.js`),[],import.meta.url),"catppuccin-frappe":()=>e(()=>import(`./catppuccin-frappe-pyXErRRU.js`),[],import.meta.url),"catppuccin-latte":()=>e(()=>import(`./catppuccin-latte-BILSUICr.js`),[],import.meta.url),"catppuccin-macchiato":()=>e(()=>import(`./catppuccin-macchiato-Ck60ZZQE.js`),[],import.meta.url),"catppuccin-mocha":()=>e(()=>import(`./catppuccin-mocha-C_2G67cS.js`),[],import.meta.url),"dark-plus":()=>e(()=>import(`./dark-plus-CHgc6GYj.js`),[],import.meta.url),dracula:()=>e(()=>import(`./dracula-Cf1PG3MT.js`),[],import.meta.url),"dracula-soft":()=>e(()=>import(`./dracula-soft-DXuNm1Kq.js`),[],import.meta.url),"everforest-dark":()=>e(()=>import(`./everforest-dark-CjdfwUBe.js`),[],import.meta.url),"everforest-light":()=>e(()=>import(`./everforest-light-CfVwwCBP.js`),[],import.meta.url),"github-dark":()=>e(()=>import(`./github-dark-BL6HSl_n.js`),[],import.meta.url),"github-dark-default":()=>e(()=>import(`./github-dark-default-zacuWV-M.js`),[],import.meta.url),"github-dark-dimmed":()=>e(()=>import(`./github-dark-dimmed-Mc0P9idi.js`),[],import.meta.url),"github-dark-high-contrast":()=>e(()=>import(`./github-dark-high-contrast-IMKX2AVF.js`),[],import.meta.url),"github-light":()=>e(()=>import(`./github-light-mYhEBkPo.js`),[],import.meta.url),"github-light-default":()=>e(()=>import(`./github-light-default-DVlCqP3X.js`),[],import.meta.url),"github-light-high-contrast":()=>e(()=>import(`./github-light-high-contrast-Dj6zTyWR.js`),[],import.meta.url),"gruvbox-dark-hard":()=>e(()=>import(`./gruvbox-dark-hard-QTgQQZn-.js`),[],import.meta.url),"gruvbox-dark-medium":()=>e(()=>import(`./gruvbox-dark-medium-9d5YdCTx.js`),[],import.meta.url),"gruvbox-dark-soft":()=>e(()=>import(`./gruvbox-dark-soft-XCkqeBhR.js`),[],import.meta.url),"gruvbox-light-hard":()=>e(()=>import(`./gruvbox-light-hard--5-nXqNp.js`),[],import.meta.url),"gruvbox-light-medium":()=>e(()=>import(`./gruvbox-light-medium-COA1PZW2.js`),[],import.meta.url),"gruvbox-light-soft":()=>e(()=>import(`./gruvbox-light-soft-CIJpzjAO.js`),[],import.meta.url),horizon:()=>e(()=>import(`./horizon-Ba2cwkSy.js`),[],import.meta.url),"horizon-bright":()=>e(()=>import(`./horizon-bright-DaEDgBmR.js`),[],import.meta.url),houston:()=>e(()=>import(`./houston-B6x0XVpU.js`),[],import.meta.url),"kanagawa-dragon":()=>e(()=>import(`./kanagawa-dragon-DhTFvBMT.js`),[],import.meta.url),"kanagawa-lotus":()=>e(()=>import(`./kanagawa-lotus--m8sdOxn.js`),[],import.meta.url),"kanagawa-wave":()=>e(()=>import(`./kanagawa-wave-D-tTv4k2.js`),[],import.meta.url),laserwave:()=>e(()=>import(`./laserwave-HSLx0L75.js`),[],import.meta.url),"light-plus":()=>e(()=>import(`./light-plus-CUjWrTSi.js`),[],import.meta.url),"material-theme":()=>e(()=>import(`./material-theme-CnthUGfg.js`),[],import.meta.url),"material-theme-darker":()=>e(()=>import(`./material-theme-darker-DUi03Qre.js`),[],import.meta.url),"material-theme-lighter":()=>e(()=>import(`./material-theme-lighter-D2-qr5Vw.js`),[],import.meta.url),"material-theme-ocean":()=>e(()=>import(`./material-theme-ocean-CWR-LogA.js`),[],import.meta.url),"material-theme-palenight":()=>e(()=>import(`./material-theme-palenight-Cnv8m1ra.js`),[],import.meta.url),"min-dark":()=>e(()=>import(`./min-dark-EXoM-6Xo.js`),[],import.meta.url),"min-light":()=>e(()=>import(`./min-light-DVOTDhnA.js`),[],import.meta.url),monokai:()=>e(()=>import(`./monokai-DkggTbGy.js`),[],import.meta.url),"night-owl":()=>e(()=>import(`./night-owl-Bdcs0PMi.js`),[],import.meta.url),"night-owl-light":()=>e(()=>import(`./night-owl-light-RoU30LE0.js`),[],import.meta.url),nord:()=>e(()=>import(`./nord-u7hMircQ.js`),[],import.meta.url),"one-dark-pro":()=>e(()=>import(`./one-dark-pro-08PdtLzi.js`),[],import.meta.url),"one-light":()=>e(()=>import(`./one-light-DgvUEtgI.js`),[],import.meta.url),"pierre-dark":()=>e(()=>import(`./pierre-dark-B2jZWvHG.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>e(()=>import(`./pierre-dark-protanopia-deuteranopia-CebgQdRf.js`),[],import.meta.url),"pierre-dark-soft":()=>e(()=>import(`./pierre-dark-soft-DdE7dyP3.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>e(()=>import(`./pierre-dark-tritanopia-CXimiT7X.js`),[],import.meta.url),"pierre-dark-vibrant":()=>e(()=>import(`./pierre-dark-vibrant-DzBsxHvQ.js`),[],import.meta.url),"pierre-light":()=>e(()=>import(`./pierre-light-Vf__O3ev.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>e(()=>import(`./pierre-light-protanopia-deuteranopia-BUtWcCQC.js`),[],import.meta.url),"pierre-light-soft":()=>e(()=>import(`./pierre-light-soft-C3QCXKvN.js`),[],import.meta.url),"pierre-light-tritanopia":()=>e(()=>import(`./pierre-light-tritanopia-CKLy6XvA.js`),[],import.meta.url),"pierre-light-vibrant":()=>e(()=>import(`./pierre-light-vibrant-DDuTEIhH.js`),[],import.meta.url),plastic:()=>e(()=>import(`./plastic-B8mE6BxX.js`),[],import.meta.url),poimandres:()=>e(()=>import(`./poimandres-DUFjrgxT.js`),[],import.meta.url),red:()=>e(()=>import(`./red-BJvdDEUx.js`),[],import.meta.url),"rose-pine":()=>e(()=>import(`./rose-pine-BSqRqUae.js`),[],import.meta.url),"rose-pine-dawn":()=>e(()=>import(`./rose-pine-dawn-U6TBE82u.js`),[],import.meta.url),"rose-pine-moon":()=>e(()=>import(`./rose-pine-moon-CAU7u1h4.js`),[],import.meta.url),"slack-dark":()=>e(()=>import(`./slack-dark-CMu0smFa.js`),[],import.meta.url),"slack-ochin":()=>e(()=>import(`./slack-ochin-BBne7cjw.js`),[],import.meta.url),"snazzy-light":()=>e(()=>import(`./snazzy-light-CV8HUEmk.js`),[],import.meta.url),"solarized-dark":()=>e(()=>import(`./solarized-dark-CmYmhSgI.js`),[],import.meta.url),"solarized-light":()=>e(()=>import(`./solarized-light-CjLLwxRp.js`),[],import.meta.url),"synthwave-84":()=>e(()=>import(`./synthwave-84-wQeDKbzQ.js`),[],import.meta.url),"tokyo-night":()=>e(()=>import(`./tokyo-night-D4ZgDiA7.js`),[],import.meta.url),vesper:()=>e(()=>import(`./vesper-sUHevyKv.js`),[],import.meta.url),"vitesse-black":()=>e(()=>import(`./vitesse-black-CfklMpOb.js`),[],import.meta.url),"vitesse-dark":()=>e(()=>import(`./vitesse-dark-CJkzwmKT.js`),[],import.meta.url),"vitesse-light":()=>e(()=>import(`./vitesse-light-BxMp8E1Y.js`),[],import.meta.url)};export{t as themes};
1
+ import{t as e}from"./preload-helper-DclECHGd.js";var t={andromeeda:()=>e(()=>import(`./andromeeda-DW8vo71h.js`),[],import.meta.url),"aurora-x":()=>e(()=>import(`./aurora-x-rMvKqtYI.js`),[],import.meta.url),"ayu-dark":()=>e(()=>import(`./ayu-dark-CwczpL8O.js`),[],import.meta.url),"ayu-light":()=>e(()=>import(`./ayu-light-DSh22xiD.js`),[],import.meta.url),"ayu-mirage":()=>e(()=>import(`./ayu-mirage-JE6hAyHG.js`),[],import.meta.url),"catppuccin-frappe":()=>e(()=>import(`./catppuccin-frappe-pyXErRRU.js`),[],import.meta.url),"catppuccin-latte":()=>e(()=>import(`./catppuccin-latte-BILSUICr.js`),[],import.meta.url),"catppuccin-macchiato":()=>e(()=>import(`./catppuccin-macchiato-Ck60ZZQE.js`),[],import.meta.url),"catppuccin-mocha":()=>e(()=>import(`./catppuccin-mocha-C_2G67cS.js`),[],import.meta.url),"dark-plus":()=>e(()=>import(`./dark-plus-CHgc6GYj.js`),[],import.meta.url),dracula:()=>e(()=>import(`./dracula-Cf1PG3MT.js`),[],import.meta.url),"dracula-soft":()=>e(()=>import(`./dracula-soft-DXuNm1Kq.js`),[],import.meta.url),"everforest-dark":()=>e(()=>import(`./everforest-dark-CjdfwUBe.js`),[],import.meta.url),"everforest-light":()=>e(()=>import(`./everforest-light-CfVwwCBP.js`),[],import.meta.url),"github-dark":()=>e(()=>import(`./github-dark-BL6HSl_n.js`),[],import.meta.url),"github-dark-default":()=>e(()=>import(`./github-dark-default-zacuWV-M.js`),[],import.meta.url),"github-dark-dimmed":()=>e(()=>import(`./github-dark-dimmed-Mc0P9idi.js`),[],import.meta.url),"github-dark-high-contrast":()=>e(()=>import(`./github-dark-high-contrast-IMKX2AVF.js`),[],import.meta.url),"github-light":()=>e(()=>import(`./github-light-mYhEBkPo.js`),[],import.meta.url),"github-light-default":()=>e(()=>import(`./github-light-default-DVlCqP3X.js`),[],import.meta.url),"github-light-high-contrast":()=>e(()=>import(`./github-light-high-contrast-Dj6zTyWR.js`),[],import.meta.url),"gruvbox-dark-hard":()=>e(()=>import(`./gruvbox-dark-hard-QTgQQZn-.js`),[],import.meta.url),"gruvbox-dark-medium":()=>e(()=>import(`./gruvbox-dark-medium-9d5YdCTx.js`),[],import.meta.url),"gruvbox-dark-soft":()=>e(()=>import(`./gruvbox-dark-soft-XCkqeBhR.js`),[],import.meta.url),"gruvbox-light-hard":()=>e(()=>import(`./gruvbox-light-hard--5-nXqNp.js`),[],import.meta.url),"gruvbox-light-medium":()=>e(()=>import(`./gruvbox-light-medium-COA1PZW2.js`),[],import.meta.url),"gruvbox-light-soft":()=>e(()=>import(`./gruvbox-light-soft-CIJpzjAO.js`),[],import.meta.url),horizon:()=>e(()=>import(`./horizon-Ba2cwkSy.js`),[],import.meta.url),"horizon-bright":()=>e(()=>import(`./horizon-bright-DaEDgBmR.js`),[],import.meta.url),houston:()=>e(()=>import(`./houston-B6x0XVpU.js`),[],import.meta.url),"kanagawa-dragon":()=>e(()=>import(`./kanagawa-dragon-DhTFvBMT.js`),[],import.meta.url),"kanagawa-lotus":()=>e(()=>import(`./kanagawa-lotus--m8sdOxn.js`),[],import.meta.url),"kanagawa-wave":()=>e(()=>import(`./kanagawa-wave-D-tTv4k2.js`),[],import.meta.url),laserwave:()=>e(()=>import(`./laserwave-HSLx0L75.js`),[],import.meta.url),"light-plus":()=>e(()=>import(`./light-plus-CUjWrTSi.js`),[],import.meta.url),"material-theme":()=>e(()=>import(`./material-theme-CnthUGfg.js`),[],import.meta.url),"material-theme-darker":()=>e(()=>import(`./material-theme-darker-DUi03Qre.js`),[],import.meta.url),"material-theme-lighter":()=>e(()=>import(`./material-theme-lighter-D2-qr5Vw.js`),[],import.meta.url),"material-theme-ocean":()=>e(()=>import(`./material-theme-ocean-CWR-LogA.js`),[],import.meta.url),"material-theme-palenight":()=>e(()=>import(`./material-theme-palenight-Cnv8m1ra.js`),[],import.meta.url),"min-dark":()=>e(()=>import(`./min-dark-EXoM-6Xo.js`),[],import.meta.url),"min-light":()=>e(()=>import(`./min-light-DVOTDhnA.js`),[],import.meta.url),monokai:()=>e(()=>import(`./monokai-DkggTbGy.js`),[],import.meta.url),"night-owl":()=>e(()=>import(`./night-owl-Bdcs0PMi.js`),[],import.meta.url),"night-owl-light":()=>e(()=>import(`./night-owl-light-RoU30LE0.js`),[],import.meta.url),nord:()=>e(()=>import(`./nord-u7hMircQ.js`),[],import.meta.url),"one-dark-pro":()=>e(()=>import(`./one-dark-pro-08PdtLzi.js`),[],import.meta.url),"one-light":()=>e(()=>import(`./one-light-DgvUEtgI.js`),[],import.meta.url),"pierre-dark":()=>e(()=>import(`./pierre-dark-B2jZWvHG.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>e(()=>import(`./pierre-dark-protanopia-deuteranopia-CebgQdRf.js`),[],import.meta.url),"pierre-dark-soft":()=>e(()=>import(`./pierre-dark-soft-DdE7dyP3.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>e(()=>import(`./pierre-dark-tritanopia-CXimiT7X.js`),[],import.meta.url),"pierre-dark-vibrant":()=>e(()=>import(`./pierre-dark-vibrant-DzBsxHvQ.js`),[],import.meta.url),"pierre-light":()=>e(()=>import(`./pierre-light-Vf__O3ev.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>e(()=>import(`./pierre-light-protanopia-deuteranopia-BUtWcCQC.js`),[],import.meta.url),"pierre-light-soft":()=>e(()=>import(`./pierre-light-soft-C3QCXKvN.js`),[],import.meta.url),"pierre-light-tritanopia":()=>e(()=>import(`./pierre-light-tritanopia-CKLy6XvA.js`),[],import.meta.url),"pierre-light-vibrant":()=>e(()=>import(`./pierre-light-vibrant-DDuTEIhH.js`),[],import.meta.url),plastic:()=>e(()=>import(`./plastic-B8mE6BxX.js`),[],import.meta.url),poimandres:()=>e(()=>import(`./poimandres-DUFjrgxT.js`),[],import.meta.url),red:()=>e(()=>import(`./red-BJvdDEUx.js`),[],import.meta.url),"rose-pine":()=>e(()=>import(`./rose-pine-BSqRqUae.js`),[],import.meta.url),"rose-pine-dawn":()=>e(()=>import(`./rose-pine-dawn-U6TBE82u.js`),[],import.meta.url),"rose-pine-moon":()=>e(()=>import(`./rose-pine-moon-CAU7u1h4.js`),[],import.meta.url),"slack-dark":()=>e(()=>import(`./slack-dark-CMu0smFa.js`),[],import.meta.url),"slack-ochin":()=>e(()=>import(`./slack-ochin-BBne7cjw.js`),[],import.meta.url),"snazzy-light":()=>e(()=>import(`./snazzy-light-CV8HUEmk.js`),[],import.meta.url),"solarized-dark":()=>e(()=>import(`./solarized-dark-CmYmhSgI.js`),[],import.meta.url),"solarized-light":()=>e(()=>import(`./solarized-light-CjLLwxRp.js`),[],import.meta.url),"synthwave-84":()=>e(()=>import(`./synthwave-84-wQeDKbzQ.js`),[],import.meta.url),"tokyo-night":()=>e(()=>import(`./tokyo-night-D4ZgDiA7.js`),[],import.meta.url),vesper:()=>e(()=>import(`./vesper-sUHevyKv.js`),[],import.meta.url),"vitesse-black":()=>e(()=>import(`./vitesse-black-CfklMpOb.js`),[],import.meta.url),"vitesse-dark":()=>e(()=>import(`./vitesse-dark-CJkzwmKT.js`),[],import.meta.url),"vitesse-light":()=>e(()=>import(`./vitesse-light-BxMp8E1Y.js`),[],import.meta.url)};export{t as themes};
@@ -1 +1 @@
1
- var e=function(e,t){return new URL(e,t).href},t={},n=function(e){return e.pathname.endsWith(`.css`)},r=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},i=function(i,a,o){let s=Promise.resolve();if(a&&a.length>0){let i,c=document.querySelector(`meta[property=csp-nonce]`),l=c?.nonce||c?.getAttribute(`nonce`);function u(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function d(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}s=u(a.map(a=>{a=e(a,o);let s=d(a),c=n(s);return r(t,s.href,()=>{if(i===void 0){i={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];i.all.add(n.href),n.rel===`stylesheet`&&i.styles.add(n.href)}}if((c?i.styles:i.all).has(s.href))return;let e=document.createElement(`link`);if(e.rel=c?`stylesheet`:`modulepreload`,c||(e.as=`script`),e.crossOrigin=``,e.href=s.href,l&&e.setAttribute(`nonce`,l),document.head.appendChild(e),c)return new Promise((t,n)=>{e.addEventListener(`load`,t),e.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${s}`)))})})}).filter(e=>e!==void 0))}function c(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(e=>{for(let t of e||[])t.status===`rejected`&&c(t.reason);return i().catch(c)})};export{i as t};
1
+ var e=function(e,t){return new URL(e,t).href},t={},n=function(e){return e.pathname.endsWith(`.css`)},r=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},i=function(i,a,o){let s=Promise.resolve();if(a&&a.length>0){let i,c=document.querySelector(`meta[property=csp-nonce]`),l=c?.nonce||c?.getAttribute(`nonce`);function u(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function d(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}s=u(a.map(a=>{a=e(a,o);let s=d(a),c=n(s);return r(t,s.href,()=>{if(i===void 0){i={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];i.all.add(n.href),n.rel===`stylesheet`&&i.styles.add(n.href)}}if((c?i.styles:i.all).has(s.href))return;let e=document.createElement(`link`);if(e.rel=c?`stylesheet`:`modulepreload`,c||(e.as=`script`),e.crossOrigin=``,e.href=s.href,l&&e.setAttribute(`nonce`,l),document.head.appendChild(e),c)return new Promise((t,n)=>{let r=i=>{e.removeEventListener(`load`,r),e.removeEventListener(`error`,r),i.type===`error`?n(Error(`Unable to preload CSS for ${s}`)):t(i)};e.addEventListener(`load`,r),e.addEventListener(`error`,r)})})}).filter(e=>e!==void 0))}function c(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(e=>{for(let t of e||[])t.status===`rejected`&&c(t.reason);return i().catch(c)})};export{i as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./langs-CTftvgbb.js","./index-F9is7PUw.js","./rolldown-runtime-XKyaHtl9.js","./preload-helper-CRzLMJPS.js","./lib-BKZ5ZaMU.js","./index-DuML4oGc.css","./engine-oniguruma-Rz_7DPcV.js"])))=>i.map(i=>d[i]);
2
- import{H as e,U as t,at as n,c as r,ct as i,lt as a,nt as o,ot as s,rt as c,s as l,st as u}from"./index-F9is7PUw.js";import{t as d}from"./preload-helper-CRzLMJPS.js";import{n as f,t as p}from"./stream-tokenizer-BdsyU_yB.js";async function m(e){if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:n())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=a.get(e);if(t!=null)return t;let r=(async()=>{let t=u.get(e);if(t==null){let{bundledLanguages:n}=await d(async()=>{let{bundledLanguages:e}=await import(`./langs-CTftvgbb.js`);return{bundledLanguages:e}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e])}if(t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let{default:n}=await t(),r={name:e,data:n};return i.has(e)||i.set(e,r),r})();a.set(e,r);try{return await r}finally{a.get(e)===r&&a.delete(e)}}function h(e){return i.get(e)??m(e)}async function g(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=h(r)??m(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function _(e,t){for(let n of Array.isArray(e)?e:[e]){let e=i.get(n.name);e??(e=n,i.set(n.name,e)),t.attachLanguages([e]),s.add(e.name)}}function v(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}var y=0,b=0,x=class{backend;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=!1;#u=[t];#d=[];#f=0;#p=[];#m=-1;#h=!0;#g=!1;#_=0;#v=++b;#y=-1;#b=-1;#x;#S=0;#C=[];#w=!1;#T=v(async e=>{if(this.#l)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#i.lineCount);if(this.#t==null&&!C(this.#i.languageId)){if(await this.backend?.loadLanguages([this.#i.languageId]),this.#l)return;this.#t=this.#e.getLanguage(this.#i.languageId)}this.#D(),this.#N(r)},500);#E=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#v&&typeof r==`number`&&r===this.#_&&(this.#y>=0?this.#z(r):this.#B(r))};getStringCommentRegexpRangesInLine(e){if(!this.#s||e<0||e>=this.#i.lineCount||(this.#O(),this.#t==null))return null;if(this.#C[e]===void 0){this.#R(e);let n=this.#u[e]??t,r=this.#P(e,n);this.#u[e+1]=r.state}return this.#C[e]??null}constructor(e,t,n){this.backend=n,this.#e=e,this.#i=t.textDocument,this.#n=t.theme,this.#r=[],this.#a=t.tokenizeMaxLineLength??1e3,this.#o=t.onDeferTokenize,this.#s=t.matchBrackets!==!1,this.#c=t.__debug??!1,this.#O(),this.#D()}setTheme(e){this.#n!==e&&(this.#n=e,this.#D(),this.stopBackgroundTokenize(),this.#u=[t],this.#d=[],this.#f=0,this.#p=[],this.#t!=null&&this.#i.lineCount>0&&this.#M(0))}#D(){if(this.#n===``)return;this.backend?.getTheme(this.#n);let{colorMap:e}=this.#e.setTheme(this.#n);this.#r=e}dispose(){this.#l=!0,this.stopBackgroundTokenize(),this.#A()}tokenize(e,n,r=!1){if(this.#O(),this.#D(),this.#t==null&&!C(this.#i.languageId))throw Error(`Grammar for language "${this.#i.languageId}" not loaded`);let{lineCount:i}=this.#i,{startingLine:a=0,totalLines:o=1/0}=n??{},s=o===1/0?i:Math.min(a+o,i),c=e.startLine,l=Math.max(a,c),u=n!=null&&o!==1/0&&e.lineDelta>0&&c<s&&e.endLine>=s,d=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0);this.#s&&!d&&(this.#C.length=Math.min(this.#C.length,e.startLine));let f=r&&e.lineDelta!==0&&c>=a,p=d||n==null||c>=l,m=e.changedLineRanges??[[c,e.endLine]];this.#d=[],this.#f=0,this.#p=[];let h=-1;if(c<l)for(let[e,t]of m)e<l&&(h=Math.max(h,Math.min(t,l-1)));let g=h>=c&&(d||e.lineDelta<0);d?this.#R(c):(this.#I(e),(n==null||c>=l)&&this.#R(l));let _=0,v=m[_][1],y,b=0,x=d?m[_][0]:l,S=!1,w=new Map,T=g?new Map:void 0;if(T!=null&&!d){let e=Math.min(h+1,l,s);if(e>c){this.#R(e);let n=c,r=this.#u[n]??t;for(;n<e;n++){let e=this.#P(n,r);r=e.state,T.set(n,e.resolvedTokens)}this.#u[e]=r}}let E=this.#u[x]??t;for(;x<s;){let e=d?this.#u[x+1]:f?this.#L(x+1):void 0;p&&(this.#u[x]=E);let{resolvedTokens:t,state:n}=this.#P(x,E);if(E=n,x>=l?w.set(x,t):T?.set(x,t),p&&(this.#u[x+1]=E),S=x>=v&&(d||f)&&e!=null&&E.equals(e),S){_++;let e=m[_];if(e==null)break;if(e[0]>=s){y=e[0],b=_;break}let t=this.#u[e[0]];if(f)for(let n=x+2;n<=e[0]&&(t=this.#L(n),t!=null);n++)this.#u[n]=t;t==null?(v=e[1],x++):(x=e[0],E=t,v=e[1]),S=!1}else x++}if(p&&(x<s?this.#u[x+1]=E:this.#u[x]=E),S&&f&&y==null){for(let e=x+2;e<=i;e++){let t=this.#L(e);if(t==null)break;this.#u[e]=t}this.#d=[],this.#f=0,this.#p=[]}if(T!=null&&T.size>0&&this.#o(T),y!=null)this.#s&&d&&(this.#C.length=Math.min(this.#C.length,y)),this.#M(y,m,b);else if(!S&&x<i){let e=u&&c>=l?s:c<l&&!d?c:x;this.#s&&d&&(this.#C.length=Math.min(this.#C.length,e)),this.#M(e,m,_)}return w}prebuildStateStack(e){this.#O(),this.#T(e)}stopBackgroundTokenize(){this.#b=-1,this.#h||(this.#h=!0,this.#g=!1,this.#m=-1,this.#y=-1,this.#x=void 0,this.#S=0,this.#d=[],this.#f=0,this.#p=[],this.#A())}pauseBackgroundTokenize(){this.#h||this.#g||(this.#c&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#_}),this.#g=!0)}resumeBackgroundTokenize(){this.#h||!this.#g||this.#t==null||this.#m<0||(this.#c&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#_}),this.#g=!1,this.#j(this.#_))}#O(){this.#t==null&&!C(this.#i.languageId)&&this.#e.getLoadedLanguages().includes(this.#i.languageId)&&(this.#t=this.#e.getLanguage(this.#i.languageId))}#k(){this.#w||=(globalThis.addEventListener(`message`,this.#E),!0)}#A(){this.#w&&=(globalThis.removeEventListener(`message`,this.#E),!1)}#j(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#v,jobId:e})}#M(e,t,n=0){if(C(this.#i.languageId))return;let r=++this.#_;this.#c&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#h=!1,this.#g=!1,this.#m=e,this.#y>=0&&(this.#b=Math.max(this.#b,this.#y)),this.#y=-1,this.#x=t,this.#S=n,this.#k(),this.#j(r)}#N(e){if(this.#t==null||this.#u.length>e)return;if(!this.#h){this.#y>=0?this.#y=Math.max(this.#y,e):this.#b=Math.max(this.#b,e);return}let t=++this.#_;this.#h=!1,this.#g=!1,this.#m=this.#u.length-1,this.#y=e,this.#b=-1,this.#x=void 0,this.#S=0,this.#k(),this.#j(t)}#P(e,t){let n=this.#i.getLineText(e);if(n.length>=this.#a)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t==null||n===``||n.trim()===``)return this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=S(this.#t,this.#r,n,t,y,this.#s);return this.#F(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#F(e,t){this.#s&&(this.#C[e]=t)}#I(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#u.length-n?(this.#d=this.#u,this.#f=0,this.#u=this.#u.slice(0,n)):(this.#f=n,this.#d=this.#u.slice(n),this.#u.length=Math.min(this.#u.length,n)),this.#p=t}#L(e){let t=e;for(let n=this.#p.length-1;n>=0;n--){let[r,i,a]=this.#p[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#u[e]}}return this.#d[t-this.#f]??this.#u[e]}#R(e,n){let r=Math.min(Math.max(0,e),this.#i.lineCount);if(this.#u.length>r||this.#t==null)return!0;let i=n==null?0:performance.now(),a=this.#u.length-1,o=this.#u[a]??t;for(;a<r;){this.#u[a]=o;let e=this.#i.getLineText(a);if(e.length<this.#a&&e!==``&&e.trim()!==``){let t=S(this.#t,this.#r,e,o,y,this.#s,!1);this.#F(a,t.bracketIgnoredRanges),o=t.ruleStack}else this.#F(a,null);if(a++,this.#u[a]=o,n!=null&&performance.now()-i>n)break}return a>=r}#z(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let t=this.#R(this.#y,1);this.#h||this.#g||e!==this.#_||(t?this.stopBackgroundTokenize():(this.#m=this.#u.length-1,this.#j(e)))}#B(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let n=performance.now(),r=new Map,i=this.#i.lineCount,a=this.#x,o=this.#m,s=this.#u[o]??t,c=!1,l=this.#S,u=a?.[l]?.[1];for(;o<i;){this.#u[o]=s;let e=u==null?void 0:this.#L(o+1),t=this.#P(o,s);if(r.set(o,t.resolvedTokens),s=t.state,this.#u[o+1]=s,c=u!=null&&o>=u&&e!=null&&s.equals(e),o++,c){l++;let e=a?.[l];if(e==null)break;if(u=e[1],this.#u[e[0]]==null)c=!1;else{o=e[0],s=this.#u[o]??s,c=!1;continue}}if(performance.now()-n>1)break}if(this.#o(r),!(this.#h||this.#g||e!==this.#_)){if(c||o>=i){let e=this.#b;this.stopBackgroundTokenize(),e>=0&&this.#N(e)}else this.#m=o,this.#S=l,this.#j(e)}}};function S(t,n,r,i,a,o=!0,s=!0){let c=t.tokenizeLine2(r,i,a);c.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${r.substring(0,100)}`);let l=c.tokens,u=l.length/2,d=[],f=[];if(!s&&!o)return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f};for(let t=0;t<u;t++){let i=l[2*t],a=t+1<u?l[2*t+2]:r.length;if(i===a)continue;let c=l[2*t+1];if(s){let t=e.getForeground(c);d.push([i,n[t],r.slice(i,a)])}o&&e.getTokenType(c)>0&&f.push([i,a])}return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f}}function C(e){return e===`text`||e===`ansi`}var w=class e extends p{highlighter;options;#e=``;#t;constructor(e,t){super(),this.highlighter=e,this.options=t}tokenizeChunk(e,t){let n=(this.#e+e).split(/(\r\n|\r|\n)/),r=[];for(let e=0;e<n.length;e+=2){let i=n[e],a=this.highlighter.codeToTokens(i,{...this.options,grammarState:this.#t}),s=a.tokens[0].map(e=>({...e,offset:e.offset+this.stableOffset}));e+1<n.length?(o(t,s),this.pushLineBreak(t,i.length,n[e+1]),this.#t=a.grammarState):(r=s,this.#e=i)}return{unstable:r,tailLength:this.#e.length}}clone(){this.assertActive();let t=new e(this.highlighter,this.options);return this.copyStateTo(t),t.#e=this.#e,t.#t=this.#t,t}resetSource(){this.#e=``,this.#t=void 0}releaseSource(){this.resetSource()}},T=class e extends f{raw;loadedThemes=new Map;attachedLanguages=new Set([`text`,`ansi`]);static async create(t){let n=t===`shiki-wasm`?(await d(async()=>{let{createOnigurumaEngine:e}=await import(`./engine-oniguruma-Rz_7DPcV.js`);return{createOnigurumaEngine:e}},__vite__mapDeps([6,1,2,3,4,5]),import.meta.url)).createOnigurumaEngine(d(()=>import(`./wasm-4KdTHw0F.js`),[],import.meta.url)):(await d(async()=>{let{createJavaScriptRegexEngine:e}=await import(`./engine-javascript-DKxkqixV.js`);return{createJavaScriptRegexEngine:e}},[],import.meta.url)).createJavaScriptRegexEngine(),i=await r({themes:[],langs:[],engine:n});return new e(t,i)}constructor(e,t){super(e,c(e)),this.raw=t}getTheme(e){this.assertNotDisposed();let t=this.loadedThemes.get(e),n=this.themeResolver.getResolvedTheme(e)??t;if(n==null)throw Error(`Theme "${e}" has not been resolved`);if(t!==n){let t=n.textmate??(n.cssVariables==null?void 0:l(n.cssVariables));if(t==null)throw Error(`Theme "${e}" does not support Shiki`);this.raw.setTheme({...t,name:e}),this.loadedThemes.set(e,n)}return n}codeToTokens(e,t){return this.raw.codeToTokens(e,this.resolveOptions(t))}createEditorTokenizer(e){return new x(this.raw,e,this)}createStreamTokenizer(e){return new w(this.raw,this.resolveOptions(e))}async loadLanguages(e){this.assertNotDisposed(),_(await g(e.filter(e=>!this.attachedLanguages.has(e))),this)}hasLoadedLanguages(e){if(this.disposed)return!1;let t;return e.every(e=>this.attachedLanguages.has(e)?!0:!u.has(e)&&(t??=this.raw.getLoadedLanguages(),t.includes(e)))}attachLanguages(e){this.assertNotDisposed();for(let t of e){if(this.attachedLanguages.has(t.name))continue;let e=t.data.find(e=>e.name===t.name||e.aliases?.includes(t.name)===!0);if(e==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${t.name}" as its name or an alias.`);this.raw.loadLanguageSync(t.data);try{this.raw.getLanguage(t.name)}catch{throw Error(`attachResolvedLanguages: "${e.name}" is already loaded without alias "${t.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(t.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:e,themes:t,...n}){if(this.assertNotDisposed(),e!=null)return this.getTheme(e),{...n,theme:e};if(t==null)throw Error(`A theme or themes option is required`);for(let e of Object.values(t))this.getTheme(e);return{...n,themes:t}}};export{T as ShikiHighlighter};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./langs-DDFHLNuJ.js","./index-BDuQ2wXS.js","./rolldown-runtime-XKyaHtl9.js","./preload-helper-DclECHGd.js","./lib-BKZ5ZaMU.js","./index-DuML4oGc.css","./engine-oniguruma-ConHyUk6.js"])))=>i.map(i=>d[i]);
2
+ import{H as e,U as t,at as n,c as r,ct as i,lt as a,nt as o,ot as s,rt as c,s as l,st as u}from"./index-BDuQ2wXS.js";import{t as d}from"./preload-helper-DclECHGd.js";import{n as f,t as p}from"./stream-tokenizer-D4-m26wx.js";async function m(e){if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:n())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=a.get(e);if(t!=null)return t;let r=(async()=>{let t=u.get(e);if(t==null){let{bundledLanguages:n}=await d(async()=>{let{bundledLanguages:e}=await import(`./langs-DDFHLNuJ.js`);return{bundledLanguages:e}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e])}if(t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let{default:n}=await t(),r={name:e,data:n};return i.has(e)||i.set(e,r),r})();a.set(e,r);try{return await r}finally{a.get(e)===r&&a.delete(e)}}function h(e){return i.get(e)??m(e)}async function g(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=h(r)??m(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function _(e,t){for(let n of Array.isArray(e)?e:[e]){let e=i.get(n.name);e??(e=n,i.set(n.name,e)),t.attachLanguages([e]),s.add(e.name)}}function v(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}var y=0,b=0,x=class{backend;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=!1;#u=[t];#d=[];#f=0;#p=[];#m=-1;#h=!0;#g=!1;#_=0;#v=++b;#y=-1;#b=-1;#x;#S=0;#C=[];#w=!1;#T=v(async e=>{if(this.#l)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#i.lineCount);if(this.#t==null&&!C(this.#i.languageId)){if(await this.backend?.loadLanguages([this.#i.languageId]),this.#l)return;this.#t=this.#e.getLanguage(this.#i.languageId)}this.#D(),this.#N(r)},500);#E=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#v&&typeof r==`number`&&r===this.#_&&(this.#y>=0?this.#z(r):this.#B(r))};getStringCommentRegexpRangesInLine(e){if(!this.#s||e<0||e>=this.#i.lineCount||(this.#O(),this.#t==null))return null;if(this.#C[e]===void 0){this.#R(e);let n=this.#u[e]??t,r=this.#P(e,n);this.#u[e+1]=r.state}return this.#C[e]??null}constructor(e,t,n){this.backend=n,this.#e=e,this.#i=t.textDocument,this.#n=t.theme,this.#r=[],this.#a=t.tokenizeMaxLineLength??1e3,this.#o=t.onDeferTokenize,this.#s=t.matchBrackets!==!1,this.#c=t.__debug??!1,this.#O(),this.#D()}setTheme(e){this.#n!==e&&(this.#n=e,this.#D(),this.stopBackgroundTokenize(),this.#u=[t],this.#d=[],this.#f=0,this.#p=[],this.#t!=null&&this.#i.lineCount>0&&this.#M(0))}#D(){if(this.#n===``)return;this.backend?.getTheme(this.#n);let{colorMap:e}=this.#e.setTheme(this.#n);this.#r=e}dispose(){this.#l=!0,this.stopBackgroundTokenize(),this.#A()}tokenize(e,n,r=!1){if(this.#O(),this.#D(),this.#t==null&&!C(this.#i.languageId))throw Error(`Grammar for language "${this.#i.languageId}" not loaded`);let{lineCount:i}=this.#i,{startingLine:a=0,totalLines:o=1/0}=n??{},s=o===1/0?i:Math.min(a+o,i),c=e.startLine,l=Math.max(a,c),u=n!=null&&o!==1/0&&e.lineDelta>0&&c<s&&e.endLine>=s,d=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0);this.#s&&!d&&(this.#C.length=Math.min(this.#C.length,e.startLine));let f=r&&e.lineDelta!==0&&c>=a,p=d||n==null||c>=l,m=e.changedLineRanges??[[c,e.endLine]];this.#d=[],this.#f=0,this.#p=[];let h=-1;if(c<l)for(let[e,t]of m)e<l&&(h=Math.max(h,Math.min(t,l-1)));let g=h>=c&&(d||e.lineDelta<0);d?this.#R(c):(this.#I(e),(n==null||c>=l)&&this.#R(l));let _=0,v=m[_][1],y,b=0,x=d?m[_][0]:l,S=!1,w=new Map,T=g?new Map:void 0;if(T!=null&&!d){let e=Math.min(h+1,l,s);if(e>c){this.#R(e);let n=c,r=this.#u[n]??t;for(;n<e;n++){let e=this.#P(n,r);r=e.state,T.set(n,e.resolvedTokens)}this.#u[e]=r}}let E=this.#u[x]??t;for(;x<s;){let e=d?this.#u[x+1]:f?this.#L(x+1):void 0;p&&(this.#u[x]=E);let{resolvedTokens:t,state:n}=this.#P(x,E);if(E=n,x>=l?w.set(x,t):T?.set(x,t),p&&(this.#u[x+1]=E),S=x>=v&&(d||f)&&e!=null&&E.equals(e),S){_++;let e=m[_];if(e==null)break;if(e[0]>=s){y=e[0],b=_;break}let t=this.#u[e[0]];if(f)for(let n=x+2;n<=e[0]&&(t=this.#L(n),t!=null);n++)this.#u[n]=t;t==null?(v=e[1],x++):(x=e[0],E=t,v=e[1]),S=!1}else x++}if(p&&(x<s?this.#u[x+1]=E:this.#u[x]=E),S&&f&&y==null){for(let e=x+2;e<=i;e++){let t=this.#L(e);if(t==null)break;this.#u[e]=t}this.#d=[],this.#f=0,this.#p=[]}if(T!=null&&T.size>0&&this.#o(T),y!=null)this.#s&&d&&(this.#C.length=Math.min(this.#C.length,y)),this.#M(y,m,b);else if(!S&&x<i){let e=u&&c>=l?s:c<l&&!d?c:x;this.#s&&d&&(this.#C.length=Math.min(this.#C.length,e)),this.#M(e,m,_)}return w}prebuildStateStack(e){this.#O(),this.#T(e)}stopBackgroundTokenize(){this.#b=-1,this.#h||(this.#h=!0,this.#g=!1,this.#m=-1,this.#y=-1,this.#x=void 0,this.#S=0,this.#d=[],this.#f=0,this.#p=[],this.#A())}pauseBackgroundTokenize(){this.#h||this.#g||(this.#c&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#_}),this.#g=!0)}resumeBackgroundTokenize(){this.#h||!this.#g||this.#t==null||this.#m<0||(this.#c&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#_}),this.#g=!1,this.#j(this.#_))}#O(){this.#t==null&&!C(this.#i.languageId)&&this.#e.getLoadedLanguages().includes(this.#i.languageId)&&(this.#t=this.#e.getLanguage(this.#i.languageId))}#k(){this.#w||=(globalThis.addEventListener(`message`,this.#E),!0)}#A(){this.#w&&=(globalThis.removeEventListener(`message`,this.#E),!1)}#j(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#v,jobId:e})}#M(e,t,n=0){if(C(this.#i.languageId))return;let r=++this.#_;this.#c&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#h=!1,this.#g=!1,this.#m=e,this.#y>=0&&(this.#b=Math.max(this.#b,this.#y)),this.#y=-1,this.#x=t,this.#S=n,this.#k(),this.#j(r)}#N(e){if(this.#t==null||this.#u.length>e)return;if(!this.#h){this.#y>=0?this.#y=Math.max(this.#y,e):this.#b=Math.max(this.#b,e);return}let t=++this.#_;this.#h=!1,this.#g=!1,this.#m=this.#u.length-1,this.#y=e,this.#b=-1,this.#x=void 0,this.#S=0,this.#k(),this.#j(t)}#P(e,t){let n=this.#i.getLineText(e);if(n.length>=this.#a)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t==null||n===``||n.trim()===``)return this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=S(this.#t,this.#r,n,t,y,this.#s);return this.#F(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#F(e,t){this.#s&&(this.#C[e]=t)}#I(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#u.length-n?(this.#d=this.#u,this.#f=0,this.#u=this.#u.slice(0,n)):(this.#f=n,this.#d=this.#u.slice(n),this.#u.length=Math.min(this.#u.length,n)),this.#p=t}#L(e){let t=e;for(let n=this.#p.length-1;n>=0;n--){let[r,i,a]=this.#p[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#u[e]}}return this.#d[t-this.#f]??this.#u[e]}#R(e,n){let r=Math.min(Math.max(0,e),this.#i.lineCount);if(this.#u.length>r||this.#t==null)return!0;let i=n==null?0:performance.now(),a=this.#u.length-1,o=this.#u[a]??t;for(;a<r;){this.#u[a]=o;let e=this.#i.getLineText(a);if(e.length<this.#a&&e!==``&&e.trim()!==``){let t=S(this.#t,this.#r,e,o,y,this.#s,!1);this.#F(a,t.bracketIgnoredRanges),o=t.ruleStack}else this.#F(a,null);if(a++,this.#u[a]=o,n!=null&&performance.now()-i>n)break}return a>=r}#z(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let t=this.#R(this.#y,1);this.#h||this.#g||e!==this.#_||(t?this.stopBackgroundTokenize():(this.#m=this.#u.length-1,this.#j(e)))}#B(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let n=performance.now(),r=new Map,i=this.#i.lineCount,a=this.#x,o=this.#m,s=this.#u[o]??t,c=!1,l=this.#S,u=a?.[l]?.[1];for(;o<i;){this.#u[o]=s;let e=u==null?void 0:this.#L(o+1),t=this.#P(o,s);if(r.set(o,t.resolvedTokens),s=t.state,this.#u[o+1]=s,c=u!=null&&o>=u&&e!=null&&s.equals(e),o++,c){l++;let e=a?.[l];if(e==null)break;if(u=e[1],this.#u[e[0]]==null)c=!1;else{o=e[0],s=this.#u[o]??s,c=!1;continue}}if(performance.now()-n>1)break}if(this.#o(r),!(this.#h||this.#g||e!==this.#_)){if(c||o>=i){let e=this.#b;this.stopBackgroundTokenize(),e>=0&&this.#N(e)}else this.#m=o,this.#S=l,this.#j(e)}}};function S(t,n,r,i,a,o=!0,s=!0){let c=t.tokenizeLine2(r,i,a);c.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${r.substring(0,100)}`);let l=c.tokens,u=l.length/2,d=[],f=[];if(!s&&!o)return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f};for(let t=0;t<u;t++){let i=l[2*t],a=t+1<u?l[2*t+2]:r.length;if(i===a)continue;let c=l[2*t+1];if(s){let t=e.getForeground(c);d.push([i,n[t],r.slice(i,a)])}o&&e.getTokenType(c)>0&&f.push([i,a])}return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f}}function C(e){return e===`text`||e===`ansi`}var w=class e extends p{highlighter;options;#e=``;#t;constructor(e,t){super(),this.highlighter=e,this.options=t}tokenizeChunk(e,t){let n=(this.#e+e).split(/(\r\n|\r|\n)/),r=[];for(let e=0;e<n.length;e+=2){let i=n[e],a=this.highlighter.codeToTokens(i,{...this.options,grammarState:this.#t}),s=a.tokens[0].map(e=>({...e,offset:e.offset+this.stableOffset}));e+1<n.length?(o(t,s),this.pushLineBreak(t,i.length,n[e+1]),this.#t=a.grammarState):(r=s,this.#e=i)}return{unstable:r,tailLength:this.#e.length}}clone(){this.assertActive();let t=new e(this.highlighter,this.options);return this.copyStateTo(t),t.#e=this.#e,t.#t=this.#t,t}resetSource(){this.#e=``,this.#t=void 0}releaseSource(){this.resetSource()}},T=class e extends f{raw;loadedThemes=new Map;attachedLanguages=new Set([`text`,`ansi`]);static async create(t){let n=t===`shiki-wasm`?(await d(async()=>{let{createOnigurumaEngine:e}=await import(`./engine-oniguruma-ConHyUk6.js`);return{createOnigurumaEngine:e}},__vite__mapDeps([6,1,2,3,4,5]),import.meta.url)).createOnigurumaEngine(d(()=>import(`./wasm-4KdTHw0F.js`),[],import.meta.url)):(await d(async()=>{let{createJavaScriptRegexEngine:e}=await import(`./engine-javascript-DKxkqixV.js`);return{createJavaScriptRegexEngine:e}},[],import.meta.url)).createJavaScriptRegexEngine(),i=await r({themes:[],langs:[],engine:n});return new e(t,i)}constructor(e,t){super(e,c(e)),this.raw=t}getTheme(e){this.assertNotDisposed();let t=this.loadedThemes.get(e),n=this.themeResolver.getResolvedTheme(e)??t;if(n==null)throw Error(`Theme "${e}" has not been resolved`);if(t!==n){let t=n.textmate??(n.cssVariables==null?void 0:l(n.cssVariables));if(t==null)throw Error(`Theme "${e}" does not support Shiki`);this.raw.setTheme({...t,name:e}),this.loadedThemes.set(e,n)}return n}codeToTokens(e,t){return this.raw.codeToTokens(e,this.resolveOptions(t))}createEditorTokenizer(e){return new x(this.raw,e,this)}createStreamTokenizer(e){return new w(this.raw,this.resolveOptions(e))}async loadLanguages(e){this.assertNotDisposed(),_(await g(e.filter(e=>!this.attachedLanguages.has(e))),this)}hasLoadedLanguages(e){if(this.disposed)return!1;let t;return e.every(e=>this.attachedLanguages.has(e)?!0:!u.has(e)&&(t??=this.raw.getLoadedLanguages(),t.includes(e)))}attachLanguages(e){this.assertNotDisposed();for(let t of e){if(this.attachedLanguages.has(t.name))continue;let e=t.data.find(e=>e.name===t.name||e.aliases?.includes(t.name)===!0);if(e==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${t.name}" as its name or an alias.`);this.raw.loadLanguageSync(t.data);try{this.raw.getLanguage(t.name)}catch{throw Error(`attachResolvedLanguages: "${e.name}" is already loaded without alias "${t.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(t.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:e,themes:t,...n}){if(this.assertNotDisposed(),e!=null)return this.getTheme(e),{...n,theme:e};if(t==null)throw Error(`A theme or themes option is required`);for(let e of Object.values(t))this.getTheme(e);return{...n,themes:t}}};export{T as ShikiHighlighter};
@@ -1,4 +1,4 @@
1
- import{$ as e,dt as t,et as n,ft as r,ut as i}from"./index-F9is7PUw.js";function a(t,r,i,a=!1){let o=[0];if(i.decorations?.some(e=>typeof e.start==`number`||typeof e.end==`number`)===!0)for(let e=t.indexOf(`
1
+ import{$ as e,dt as t,et as n,ft as r,ut as i}from"./index-BDuQ2wXS.js";function a(t,r,i,a=!1){let o=[0];if(i.decorations?.some(e=>typeof e.start==`number`||typeof e.end==`number`)===!0)for(let e=t.indexOf(`
2
2
  `);e!==-1;e=t.indexOf(`
3
3
  `,e+1))o.push(e+1);let s={type:`element`,tagName:`code`,properties:{},children:[]},c=n(r.tokens,{decorations:i.decorations,mergeWhitespaces:i.mergeWhitespaces,lineOffsets:o,cacheHtmlStyles:a});for(let e=0;e<c.length;e++)e>0&&s.children.push({type:`text`,value:`
4
4
  `}),s.children.push(c[e]);let l={type:`root`,children:[{type:`element`,tagName:`pre`,properties:{class:`diffs`,style:r.rootStyle===!1?void 0:r.rootStyle??[r.fg==null?``:`color:${r.fg}`,r.bg==null?``:`background-color:${r.bg}`].filter(Boolean).join(`;`),tabIndex:0},children:[s]}]};return e(l)}var o=class{name;themeResolver;disposed=!1;constructor(e,n){this.name=e,this.themeResolver=n,t(e)}codeToHtml(e,t){return a(e,this.codeToTokens(e,t),t,this.name===`highlights`)}get isDisposed(){return this.disposed}dispose(){this.disposed||(this.disposed=!0,this.releaseResources(),r())}assertNotDisposed(){if(this.disposed)throw new i}},s=class{disposed=!1;stableOffset=0;unstable=[];pendingCarriageReturn=``;enqueue(e){this.assertActive(),e=this.pendingCarriageReturn+e,this.pendingCarriageReturn=e.endsWith(`\r`)?`\r`:``,this.pendingCarriageReturn!==``&&(e=e.slice(0,-1));let t=this.unstable.length,n=[],{unstable:r,tailLength:i}=this.tokenizeChunk(e,n);return this.pendingCarriageReturn!==``&&r.push({content:`\r`,offset:this.stableOffset+i}),this.unstable=r,{recall:t,stable:n,unstable:r}}pushLineBreak(e,t,n){for(let r=0;r<n.length;r++)e.push({content:n[r],offset:this.stableOffset+t+r});this.stableOffset+=t+n.length}close(){let e=this.unstable;return this.dispose(),{stable:e}}clear(){this.assertActive(),this.stableOffset=0,this.unstable=[],this.pendingCarriageReturn=``,this.resetSource()}dispose(){this.disposed||(this.disposed=!0,this.unstable=[],this.releaseSource())}copyStateTo(e){e.stableOffset=this.stableOffset,e.unstable=this.unstable.slice(),e.pendingCarriageReturn=this.pendingCarriageReturn}assertActive(){if(this.disposed)throw Error(`stream tokenizer is disposed`)}};export{o as n,s as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./core-CXVpaOO1.js","./index-F9is7PUw.js","./rolldown-runtime-XKyaHtl9.js","./preload-helper-CRzLMJPS.js","./lib-BKZ5ZaMU.js","./index-DuML4oGc.css"])))=>i.map(i=>d[i]);
2
- import{it as e}from"./index-F9is7PUw.js";import{t}from"./preload-helper-CRzLMJPS.js";function n(e){let t=[],i=new Set;for(let n of r(e.themes)){let e=o(n)?n.getThemes():[n];for(let n of e){if(i.has(n.name))throw Error(`Theme collection already contains theme "${n.name}"`);i.add(n.name),t.push(n)}}let a=Object.freeze([...t]),s=Object.freeze(a.filter(e=>e.colorScheme===`light`)),c=Object.freeze(a.filter(e=>e.colorScheme===`dark`)),l=new Map(a.map(e=>[e.name,e])),u=Object.freeze(a.map(e=>e.name)),d=Object.freeze(s.map(e=>e.name)),f=Object.freeze(c.map(e=>e.name));function p(e){if(e==null)return a;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?s:t===`dark`?c:a:a.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return l.get(e)},getThemes(e){return p(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?d:e?.colorScheme===`dark`?f:u:p(e).map(e=>e.name)},hasTheme(e){return l.has(e)},orderBy(e){return n({themes:a.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],r=new Set;for(let n of e){if(r.has(n))throw Error(`Theme collection pick already includes theme "${n}"`);r.add(n);let e=l.get(n);if(e==null)throw Error(`Theme collection does not contain theme "${n}"`);t.push(e)}return n({themes:t})},registerInto(e){for(let t of a)e.registerThemeIfAbsent(t.name,t.load)}}}function r(e){return i(e)?[e]:e}function i(e){return o(e)||a(e)}function a(e){return typeof e.name==`string`&&typeof e.load==`function`}function o(e){return typeof e.getThemes==`function`}function s({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:c(t)}}function c(n){return async()=>{let[r,{normalizeTheme:i}]=await Promise.all([n(),t(()=>import(`./core-CXVpaOO1.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)]);return i(e(r))}}var l=`pierre`,u=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],d=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],f=[...d,...u],p=new Set(d);function m(e){return p.has(e)?`light`:`dark`}var h={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},g={"pierre-dark":()=>t(()=>import(`./pierre-dark-CpLgRqie.js`),[],import.meta.url),"pierre-dark-soft":()=>t(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[],import.meta.url),"pierre-dark-vibrant":()=>t(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>t(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>t(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[],import.meta.url),"pierre-light":()=>t(()=>import(`./pierre-light-CoaEpmwp.js`),[],import.meta.url),"pierre-light-soft":()=>t(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[],import.meta.url),"pierre-light-vibrant":()=>t(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>t(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[],import.meta.url),"pierre-light-tritanopia":()=>t(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[],import.meta.url)};function _(e){return s({name:e,collection:l,colorScheme:m(e),displayName:h[e],load:g[e]})}var v=n({themes:f.map(e=>_(e))}),y=`shiki`,b=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],x=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),S=new Set(b);function C(e){return S.has(e)?`light`:`dark`}var w={andromeeda:()=>t(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url),"aurora-x":()=>t(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url),"ayu-dark":()=>t(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url),"ayu-light":()=>t(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url),"ayu-mirage":()=>t(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url),"catppuccin-frappe":()=>t(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url),"catppuccin-latte":()=>t(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url),"catppuccin-macchiato":()=>t(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url),"catppuccin-mocha":()=>t(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url),"dark-plus":()=>t(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url),dracula:()=>t(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url),"dracula-soft":()=>t(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url),"everforest-dark":()=>t(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url),"everforest-light":()=>t(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url),"github-dark":()=>t(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url),"github-dark-default":()=>t(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url),"github-dark-dimmed":()=>t(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url),"github-dark-high-contrast":()=>t(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url),"github-light":()=>t(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url),"github-light-default":()=>t(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url),"github-light-high-contrast":()=>t(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url),"gruvbox-dark-hard":()=>t(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url),"gruvbox-dark-medium":()=>t(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url),"gruvbox-dark-soft":()=>t(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url),"gruvbox-light-hard":()=>t(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url),"gruvbox-light-medium":()=>t(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url),"gruvbox-light-soft":()=>t(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url),horizon:()=>t(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url),"horizon-bright":()=>t(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url),houston:()=>t(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url),"kanagawa-dragon":()=>t(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url),"kanagawa-lotus":()=>t(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url),"kanagawa-wave":()=>t(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url),laserwave:()=>t(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url),"light-plus":()=>t(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url),"material-theme":()=>t(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url),"material-theme-darker":()=>t(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url),"material-theme-lighter":()=>t(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url),"material-theme-ocean":()=>t(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url),"material-theme-palenight":()=>t(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url),"min-dark":()=>t(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url),"min-light":()=>t(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url),monokai:()=>t(()=>import(`./monokai-BscAjiQZ.js`),[],import.meta.url),"night-owl":()=>t(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url),"night-owl-light":()=>t(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url),nord:()=>t(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url),"one-dark-pro":()=>t(()=>import(`./one-dark-pro-C6YyR8OD.js`),[],import.meta.url),"one-light":()=>t(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url),plastic:()=>t(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url),poimandres:()=>t(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url),red:()=>t(()=>import(`./red-CYlAq2b0.js`),[],import.meta.url),"rose-pine":()=>t(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url),"rose-pine-dawn":()=>t(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url),"rose-pine-moon":()=>t(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url),"slack-dark":()=>t(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url),"slack-ochin":()=>t(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url),"snazzy-light":()=>t(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url),"solarized-dark":()=>t(()=>import(`./solarized-dark-b97czJOk.js`),[],import.meta.url),"solarized-light":()=>t(()=>import(`./solarized-light-DFPxpIYQ.js`),[],import.meta.url),"synthwave-84":()=>t(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url),"tokyo-night":()=>t(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url),vesper:()=>t(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url),"vitesse-black":()=>t(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url),"vitesse-dark":()=>t(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url),"vitesse-light":()=>t(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url)};function T(e){return s({name:e,collection:y,colorScheme:C(e),load:w[e]})}var E=n({themes:Object.freeze([...b.map(e=>T(e)),...x.map(e=>T(e))])}),D=n({themes:[v,E]});export{s as createTheme,v as pierreThemes,E as shikiThemes,D as themes};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./core-Cnp6wBC7.js","./index-BDuQ2wXS.js","./rolldown-runtime-XKyaHtl9.js","./preload-helper-DclECHGd.js","./lib-BKZ5ZaMU.js","./index-DuML4oGc.css"])))=>i.map(i=>d[i]);
2
+ import{it as e}from"./index-BDuQ2wXS.js";import{t}from"./preload-helper-DclECHGd.js";function n(e){let t=[],i=new Set;for(let n of r(e.themes)){let e=o(n)?n.getThemes():[n];for(let n of e){if(i.has(n.name))throw Error(`Theme collection already contains theme "${n.name}"`);i.add(n.name),t.push(n)}}let a=Object.freeze([...t]),s=Object.freeze(a.filter(e=>e.colorScheme===`light`)),c=Object.freeze(a.filter(e=>e.colorScheme===`dark`)),l=new Map(a.map(e=>[e.name,e])),u=Object.freeze(a.map(e=>e.name)),d=Object.freeze(s.map(e=>e.name)),f=Object.freeze(c.map(e=>e.name));function p(e){if(e==null)return a;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?s:t===`dark`?c:a:a.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return l.get(e)},getThemes(e){return p(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?d:e?.colorScheme===`dark`?f:u:p(e).map(e=>e.name)},hasTheme(e){return l.has(e)},orderBy(e){return n({themes:a.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],r=new Set;for(let n of e){if(r.has(n))throw Error(`Theme collection pick already includes theme "${n}"`);r.add(n);let e=l.get(n);if(e==null)throw Error(`Theme collection does not contain theme "${n}"`);t.push(e)}return n({themes:t})},registerInto(e){for(let t of a)e.registerThemeIfAbsent(t.name,t.load)}}}function r(e){return i(e)?[e]:e}function i(e){return o(e)||a(e)}function a(e){return typeof e.name==`string`&&typeof e.load==`function`}function o(e){return typeof e.getThemes==`function`}function s({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:c(t)}}function c(n){return async()=>{let[r,{normalizeTheme:i}]=await Promise.all([n(),t(()=>import(`./core-Cnp6wBC7.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)]);return i(e(r))}}var l=`pierre`,u=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],d=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],f=[...d,...u],p=new Set(d);function m(e){return p.has(e)?`light`:`dark`}var h={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},g={"pierre-dark":()=>t(()=>import(`./pierre-dark-CpLgRqie.js`),[],import.meta.url),"pierre-dark-soft":()=>t(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[],import.meta.url),"pierre-dark-vibrant":()=>t(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>t(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>t(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[],import.meta.url),"pierre-light":()=>t(()=>import(`./pierre-light-CoaEpmwp.js`),[],import.meta.url),"pierre-light-soft":()=>t(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[],import.meta.url),"pierre-light-vibrant":()=>t(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>t(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[],import.meta.url),"pierre-light-tritanopia":()=>t(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[],import.meta.url)};function _(e){return s({name:e,collection:l,colorScheme:m(e),displayName:h[e],load:g[e]})}var v=n({themes:f.map(e=>_(e))}),y=`shiki`,b=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],x=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),S=new Set(b);function C(e){return S.has(e)?`light`:`dark`}var w={andromeeda:()=>t(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url),"aurora-x":()=>t(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url),"ayu-dark":()=>t(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url),"ayu-light":()=>t(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url),"ayu-mirage":()=>t(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url),"catppuccin-frappe":()=>t(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url),"catppuccin-latte":()=>t(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url),"catppuccin-macchiato":()=>t(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url),"catppuccin-mocha":()=>t(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url),"dark-plus":()=>t(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url),dracula:()=>t(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url),"dracula-soft":()=>t(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url),"everforest-dark":()=>t(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url),"everforest-light":()=>t(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url),"github-dark":()=>t(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url),"github-dark-default":()=>t(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url),"github-dark-dimmed":()=>t(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url),"github-dark-high-contrast":()=>t(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url),"github-light":()=>t(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url),"github-light-default":()=>t(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url),"github-light-high-contrast":()=>t(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url),"gruvbox-dark-hard":()=>t(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url),"gruvbox-dark-medium":()=>t(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url),"gruvbox-dark-soft":()=>t(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url),"gruvbox-light-hard":()=>t(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url),"gruvbox-light-medium":()=>t(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url),"gruvbox-light-soft":()=>t(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url),horizon:()=>t(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url),"horizon-bright":()=>t(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url),houston:()=>t(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url),"kanagawa-dragon":()=>t(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url),"kanagawa-lotus":()=>t(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url),"kanagawa-wave":()=>t(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url),laserwave:()=>t(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url),"light-plus":()=>t(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url),"material-theme":()=>t(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url),"material-theme-darker":()=>t(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url),"material-theme-lighter":()=>t(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url),"material-theme-ocean":()=>t(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url),"material-theme-palenight":()=>t(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url),"min-dark":()=>t(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url),"min-light":()=>t(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url),monokai:()=>t(()=>import(`./monokai-BscAjiQZ.js`),[],import.meta.url),"night-owl":()=>t(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url),"night-owl-light":()=>t(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url),nord:()=>t(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url),"one-dark-pro":()=>t(()=>import(`./one-dark-pro-C6YyR8OD.js`),[],import.meta.url),"one-light":()=>t(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url),plastic:()=>t(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url),poimandres:()=>t(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url),red:()=>t(()=>import(`./red-CYlAq2b0.js`),[],import.meta.url),"rose-pine":()=>t(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url),"rose-pine-dawn":()=>t(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url),"rose-pine-moon":()=>t(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url),"slack-dark":()=>t(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url),"slack-ochin":()=>t(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url),"snazzy-light":()=>t(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url),"solarized-dark":()=>t(()=>import(`./solarized-dark-b97czJOk.js`),[],import.meta.url),"solarized-light":()=>t(()=>import(`./solarized-light-DFPxpIYQ.js`),[],import.meta.url),"synthwave-84":()=>t(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url),"tokyo-night":()=>t(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url),vesper:()=>t(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url),"vitesse-black":()=>t(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url),"vitesse-dark":()=>t(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url),"vitesse-light":()=>t(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url)};function T(e){return s({name:e,collection:y,colorScheme:C(e),load:w[e]})}var E=n({themes:Object.freeze([...b.map(e=>T(e)),...x.map(e=>T(e))])}),D=n({themes:[v,E]});export{s as createTheme,v as pierreThemes,E as shikiThemes,D as themes};
@@ -4,9 +4,9 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Tau diff tool</title>
7
- <script type="module" crossorigin src="./assets/index-F9is7PUw.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-BDuQ2wXS.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-XKyaHtl9.js">
9
- <link rel="modulepreload" crossorigin href="./assets/preload-helper-CRzLMJPS.js">
9
+ <link rel="modulepreload" crossorigin href="./assets/preload-helper-DclECHGd.js">
10
10
  <link rel="modulepreload" crossorigin href="./assets/lib-BKZ5ZaMU.js">
11
11
  <link rel="stylesheet" crossorigin href="./assets/index-DuML4oGc.css">
12
12
  </head>
@@ -44,8 +44,6 @@ const VIEWER_SECURITY_HEADERS = {
44
44
  "x-content-type-options": "nosniff",
45
45
  "x-frame-options": "DENY",
46
46
  };
47
- const DIGEST_NEW_ENTRY_THRESHOLD = 8;
48
- const DIGEST_MAX_STALENESS_MS = 12 * 60 * 60 * 1_000;
49
47
  const DIGEST_RETRY_BASE_MS = 5 * 60 * 1_000;
50
48
  const DIGEST_RETRY_MAX_MS = 12 * 60 * 60 * 1_000;
51
49
  const DIGEST_BYTES_PER_TOKEN = 6;
@@ -53,7 +51,6 @@ const DIGEST_TOOL_RESULT_MAX_BYTES = 512 * DIGEST_BYTES_PER_TOKEN;
53
51
  const DIGEST_SOURCE_PAGE_SIZE = 8;
54
52
  const DIGEST_SOURCE_MAX_BYTES = 12 * 1024 * 1024;
55
53
  const DIGEST_MAX_SPLIT_DEPTH = 3;
56
- const DIGEST_IDLE_MS = 10 * 60 * 1_000;
57
54
  const DIGEST_LEASE_MS = 30 * 60 * 1_000;
58
55
  const DIGEST_SESSIONS_PER_CRON = 3;
59
56
  class HistoryApiError extends Error {
@@ -146,41 +143,56 @@ export default {
146
143
  .first();
147
144
  if (!lease)
148
145
  return;
146
+ let failure;
149
147
  try {
150
148
  for (let index = 0; index < DIGEST_SESSIONS_PER_CRON; index += 1) {
151
149
  const attemptedAt = Date.now();
152
150
  const candidate = await selectDigestCandidate(env.DB, attemptedAt);
153
151
  if (!candidate)
154
- return;
152
+ break;
155
153
  await attemptScheduledDigest(env, candidate, attemptedAt);
156
154
  }
157
155
  }
158
- finally {
159
- await env.DB.prepare("UPDATE digest_worker_lease SET claimed_at = NULL WHERE singleton = 1 AND claimed_at = ?")
160
- .bind(claimedAt)
161
- .run();
156
+ catch (caught) {
157
+ failure = { error: caught };
158
+ logWorkerError("history_digest_scheduler_failed", caught, {});
159
+ }
160
+ try {
161
+ await releaseDigestLease(env.DB, claimedAt);
162
+ }
163
+ catch (caught) {
164
+ logWorkerError("history_digest_lease_release_failed", caught, {});
165
+ failure ??= { error: caught };
162
166
  }
167
+ if (failure)
168
+ throw failure.error;
163
169
  },
164
170
  };
165
- async function selectDigestCandidate(database, now) {
171
+ async function releaseDigestLease(database, claimedAt) {
172
+ for (const delay of [0, 1_000, 5_000, 15_000]) {
173
+ if (delay > 0)
174
+ await new Promise((resolve) => setTimeout(resolve, delay));
175
+ try {
176
+ await database
177
+ .prepare("UPDATE digest_worker_lease SET claimed_at = NULL WHERE singleton = 1 AND claimed_at = ?")
178
+ .bind(claimedAt)
179
+ .run();
180
+ return;
181
+ }
182
+ catch (caught) {
183
+ if (delay === 15_000)
184
+ throw caught;
185
+ }
186
+ }
187
+ }
188
+ export async function selectDigestCandidate(database, now) {
166
189
  const candidate = await database
167
- .prepare(`SELECT s.session_id, s.digest_failure_count
168
- FROM sessions s
169
- JOIN entries latest ON latest.session_id = s.session_id
170
- AND latest.position = (SELECT MAX(position) FROM entries WHERE session_id = s.session_id)
171
- LEFT JOIN entries digested ON digested.session_id = s.session_id
172
- AND digested.entry_id = s.digest_through_entry_id
173
- WHERE (s.digest_through_entry_id IS NULL OR s.digest_through_entry_id != latest.entry_id)
174
- AND s.updated_at <= ?
175
- AND (s.digest_next_attempt_at IS NULL OR s.digest_next_attempt_at <= ?)
176
- AND (
177
- s.digest_through_entry_id IS NULL
178
- OR latest.position - COALESCE(digested.position, 0) >= ?
179
- OR s.updated_at <= ?
180
- )
181
- ORDER BY COALESCE(s.digest_last_attempt_at, 0), s.updated_at, s.session_id
190
+ .prepare(`SELECT session_id, digest_failure_count
191
+ FROM sessions
192
+ WHERE digest_due_at <= ?
193
+ ORDER BY COALESCE(digest_last_attempt_at, 0), updated_at, session_id
182
194
  LIMIT 1`)
183
- .bind(now - DIGEST_IDLE_MS, now, DIGEST_NEW_ENTRY_THRESHOLD, now - DIGEST_MAX_STALENESS_MS)
195
+ .bind(now)
184
196
  .first();
185
197
  if (!candidate)
186
198
  return undefined;
@@ -205,18 +217,26 @@ async function attemptScheduledDigest(env, candidate, attemptedAt) {
205
217
  .run();
206
218
  }
207
219
  catch (caught) {
220
+ logWorkerError("history_digest_refresh_failed", caught, {
221
+ sessionId: candidate.sessionId,
222
+ });
208
223
  const failedAt = Date.now();
209
- await env.DB.prepare(`UPDATE sessions
224
+ try {
225
+ await env.DB.prepare(`UPDATE sessions
210
226
  SET digest_failure_count = ?,
211
227
  digest_next_attempt_at = ?,
212
228
  digest_last_error = ?
213
229
  WHERE session_id = ?`)
214
- .bind(candidate.failureCount + 1, failedAt +
215
- digestRetryDelayMs(candidate.failureCount + 1, retryAfterDelayMs(caught, failedAt)), digestErrorMessage(caught), candidate.sessionId)
216
- .run();
217
- logWorkerError("history_digest_refresh_failed", caught, {
218
- sessionId: candidate.sessionId,
219
- });
230
+ .bind(candidate.failureCount + 1, failedAt +
231
+ digestRetryDelayMs(candidate.failureCount + 1, retryAfterDelayMs(caught, failedAt)), digestErrorMessage(caught), candidate.sessionId)
232
+ .run();
233
+ }
234
+ catch (persistenceError) {
235
+ logWorkerError("history_digest_retry_record_failed", persistenceError, {
236
+ sessionId: candidate.sessionId,
237
+ });
238
+ throw caught;
239
+ }
220
240
  }
221
241
  }
222
242
  export function digestRetryDelayMs(failureCount, retryAfterMs = 0) {
@@ -403,7 +423,7 @@ export async function applyOperation(database, operation) {
403
423
  .prepare("INSERT INTO entries_fts (session_id, entry_id, position, text) VALUES (?, ?, ?, ?)")
404
424
  .bind(operation.sessionId, entry.id, position, searchText));
405
425
  }
406
- if (updatedAt > 0) {
426
+ if (statements.length > 0) {
407
427
  statements.push(database
408
428
  .prepare("UPDATE sessions SET updated_at = MAX(updated_at, ?), transcript_revision = transcript_revision + 1 WHERE session_id = ?")
409
429
  .bind(updatedAt, operation.sessionId));
@@ -524,8 +544,8 @@ async function search(database, raw, origin) {
524
544
  const sessionIds = selectedRows.map((row) => String(row.session_id));
525
545
  const snippets = await database
526
546
  .prepare(`WITH ranked_snippets AS (
527
- SELECT session_id,
528
- text AS match_text,
547
+ SELECT rowid AS entry_rowid,
548
+ session_id,
529
549
  ROW_NUMBER() OVER (
530
550
  PARTITION BY session_id
531
551
  ORDER BY CAST(position AS INTEGER), entry_id
@@ -533,19 +553,36 @@ async function search(database, raw, origin) {
533
553
  FROM entries_fts
534
554
  WHERE entries_fts MATCH ?
535
555
  AND session_id IN (${sessionIds.map(() => "?").join(", ")})
556
+ ), snippet_excerpts AS MATERIALIZED (
557
+ SELECT ranked.entry_rowid, ranked.session_id, ranked.snippet_rank,
558
+ substr(snippet(entries_fts, 3, '', '', '…', 32), 1, 361) AS excerpt
559
+ FROM ranked_snippets ranked
560
+ -- Keep ranked rows outermost so snippet extraction uses rowid lookups.
561
+ CROSS JOIN entries_fts ON entries_fts.rowid = ranked.entry_rowid
562
+ WHERE ranked.snippet_rank <= 3 AND entries_fts MATCH ?
536
563
  )
537
- SELECT session_id, match_text
538
- FROM ranked_snippets
539
- WHERE snippet_rank <= 3
564
+ SELECT session_id,
565
+ CASE WHEN length(excerpt) <= 360 THEN excerpt ELSE (
566
+ SELECT CASE
567
+ WHEN length(snippet(entries_fts, 3, '', '', '…', 16)) <= 360
568
+ THEN snippet(entries_fts, 3, '', '', '…', 16)
569
+ WHEN length(snippet(entries_fts, 3, '', '', '…', 8)) <= 360
570
+ THEN snippet(entries_fts, 3, '', '', '…', 8)
571
+ ELSE substr(snippet(entries_fts, 3, '', '', '…', 1), 1, 360)
572
+ END
573
+ FROM entries_fts
574
+ WHERE rowid = snippet_excerpts.entry_rowid AND entries_fts MATCH ?
575
+ ) END AS match_text
576
+ FROM snippet_excerpts
540
577
  ORDER BY session_id, snippet_rank`)
541
- .bind(ftsQuery, ...sessionIds)
578
+ .bind(ftsQuery, ...sessionIds, ftsQuery, ftsQuery)
542
579
  .all();
543
580
  const sessionsById = new Map(sessions.map((session) => [String(session.sessionId), session]));
544
581
  for (const row of snippets.results) {
545
582
  const session = sessionsById.get(String(row.session_id));
546
583
  if (!session || typeof row.match_text !== "string")
547
584
  continue;
548
- session.snippets.push(boundedSnippet(row.match_text, query));
585
+ session.snippets.push(row.match_text);
549
586
  }
550
587
  }
551
588
  return {
@@ -1470,17 +1507,6 @@ function utf8ByteLength(value) {
1470
1507
  function stableJson(value) {
1471
1508
  return JSON.stringify(Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b))));
1472
1509
  }
1473
- export function boundedSnippet(text, query) {
1474
- const normalizedText = text.toLowerCase();
1475
- const exactIndex = normalizedText.indexOf(query.toLowerCase());
1476
- const termIndexes = searchTerms(query)
1477
- .map((term) => normalizedText.indexOf(term.toLowerCase()))
1478
- .filter((index) => index >= 0);
1479
- const index = exactIndex >= 0 ? exactIndex : termIndexes.length > 0 ? Math.min(...termIndexes) : 0;
1480
- const start = Math.max(0, index - 120);
1481
- const end = Math.min(text.length, start + 360);
1482
- return `${start > 0 ? "…" : ""}${text.slice(start, end)}${end < text.length ? "…" : ""}`;
1483
- }
1484
1510
  function buildFtsQuery(query) {
1485
1511
  const terms = searchTerms(query);
1486
1512
  if (terms.length === 0)