@pi-chamber/web 0.9.4 → 0.9.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 (107) hide show
  1. package/README.md +15 -0
  2. package/dist/assets/DiagramView-0Iq1ak1I.js +1 -0
  3. package/dist/assets/{DiffView-CBOrV4hS.js → DiffView-DD1AFRi3.js} +2 -2
  4. package/dist/assets/FileSaveConflictDialog-CoKwDovb.js +3 -0
  5. package/dist/assets/FilesView-B_BF39ef.js +6 -0
  6. package/dist/assets/GitView-LFEpCasf.js +8 -0
  7. package/dist/assets/{JsonTreeView-CKWGm5MS.js → JsonTreeView-Cwjgvh4g.js} +1 -1
  8. package/dist/assets/MarkdownRendererImpl-_7kV1yNw.js +12 -0
  9. package/dist/assets/PatchDiff-DG43C1HW.js +1 -0
  10. package/dist/assets/{SessionSwitcherContent-z9VYCXrT.js → SessionSwitcherContent-DCFXPY3d.js} +1 -1
  11. package/dist/assets/SessionSwitcherDropdown-QY7FKuEQ.js +2 -0
  12. package/dist/assets/SessionUnreadDot-DGT31A3z.js +1 -0
  13. package/dist/assets/SettingsView-eG-wN-yY.js +2 -0
  14. package/dist/assets/SettingsWindow-Dvnp8YrA.js +1 -0
  15. package/dist/assets/ToolOutputDialog-IlCrS6BR.js +8 -0
  16. package/dist/assets/ToolPartDiffPreview-D68JV0rR.js +1 -0
  17. package/dist/assets/{VirtualizedFileDiff-DfaXovGB.js → VirtualizedFileDiff-Bl-rAYeh.js} +3 -3
  18. package/dist/assets/collapsible-BjniCdZ5.js +1 -0
  19. package/dist/assets/computeVirtualFileMetrics-FSOm2VrW.js +3 -0
  20. package/dist/assets/contextFileOpenGuard-Bxb6AIPa.js +1 -0
  21. package/dist/assets/gitStatusPredicates-DxolDpMd.js +134 -0
  22. package/dist/assets/index-BpmGBboM.css +1 -0
  23. package/dist/assets/index-DZnzXhTs.js +8 -0
  24. package/dist/assets/index-Dh58uD3I.js +1 -0
  25. package/dist/assets/isDiffPlainText-D3_04XCh.js +1 -0
  26. package/dist/assets/isFilePlainText-CHouYQhH.js +1 -0
  27. package/dist/assets/{main-DG1oZ0Wj.js → main-CH3EqGJI.js} +2 -2
  28. package/dist/assets/main-HzTrVvbB.js +135 -0
  29. package/dist/assets/{markdownCore-DUjQU2i0.js → markdownCore-DJU4KvHP.js} +2 -2
  30. package/dist/assets/{miniChat-BEAtOkr9.js → miniChat-Ca3TpaaA.js} +2 -2
  31. package/dist/assets/{mobile-DOFBBQg2.js → mobile-lj4gpGsO.js} +2 -2
  32. package/dist/assets/renderElectronMiniChatApp-rUFfaD-T.js +2 -0
  33. package/dist/assets/renderMobileApp-CcWQ1sCf.js +11 -0
  34. package/dist/assets/runtimeEndpointReset-D2MmSbDk.js +53 -0
  35. package/dist/assets/{runtimeSurface-CySRuLbN.js → runtimeSurface-CE_VNjdH.js} +1 -1
  36. package/dist/assets/{useAppFontEffects-C4JL1x7k.js → useAppFontEffects-BvFAP9zG.js} +102 -103
  37. package/dist/assets/useFilesViewSearch-BD79p3A2.js +7 -0
  38. package/dist/assets/usePushVisibilityBeacon-CWg0j-Wg.js +10 -0
  39. package/dist/assets/useSwitcherItems-CazJ6Yox.js +1 -0
  40. package/dist/assets/{vendor-base-ui-vkqQ2P9o.js → vendor-base-ui-CdaWtC7e.js} +1 -1
  41. package/dist/assets/vendor-beautiful-mermaid-D3YCkKz7.js +111 -0
  42. package/dist/assets/{vendor-codemirror-commands-DYppkHEk.js → vendor-codemirror-commands-CNlncqrr.js} +1 -1
  43. package/dist/assets/{vendor-codemirror-language-data-C493X_9w.js → vendor-codemirror-language-data-CP3j3-xu.js} +2 -2
  44. package/dist/assets/{vendor-replit-codemirror-vim-CGHHNQxC.js → vendor-replit-codemirror-vim-DaSwPsXt.js} +1 -1
  45. package/dist/assets/{web-components-B2Rw__yK.js → web-components-DWuadqra.js} +3 -3
  46. package/dist/index.html +4 -4
  47. package/dist/mini-chat.html +3 -3
  48. package/dist/mobile.html +3 -3
  49. package/package.json +2 -2
  50. package/server/lib/fs/DOCUMENTATION.md +15 -3
  51. package/server/lib/fs/routes.js +369 -51
  52. package/server/lib/fs/routes.test.js +565 -3
  53. package/server/lib/fs/search.js +74 -29
  54. package/server/lib/pi/routes.js +56 -3
  55. package/server/lib/pi/routes.test.js +165 -0
  56. package/server/lib/pi/session-daemon/DOCUMENTATION.md +19 -6
  57. package/server/lib/pi/session-daemon/prompt-operations.test.js +151 -3
  58. package/server/lib/pi/session-daemon/prompt-preflight.test.js +556 -0
  59. package/server/lib/pi/session-daemon/sdk-upgrade.test.js +157 -0
  60. package/server/lib/pi/session-daemon/send-operation-dedup.test.js +331 -0
  61. package/server/lib/pi/session-daemon/send-operation-registry.js +264 -0
  62. package/server/lib/pi/session-daemon/send-operation-registry.test.js +205 -0
  63. package/server/lib/pi/session-daemon/session-daemon-extensions.e2e.test.js +16 -5
  64. package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +3 -1
  65. package/server/lib/pi/session-daemon/session-daemon.js +514 -107
  66. package/server/lib/pi/session-daemon/session-daemon.test.js +37 -13
  67. package/server/lib/pi/session-daemon/session-idle-residency.test.js +749 -0
  68. package/server/lib/pi/session-daemon/session-replay.js +98 -0
  69. package/server/lib/pi/session-daemon/session-replay.test.js +628 -0
  70. package/server/lib/pi/ui-settings-store.js +16 -10
  71. package/server/lib/pi/ui-settings-store.test.js +91 -0
  72. package/server/lib/server/cors.js +6 -0
  73. package/server/lib/server/cors.test.js +3 -0
  74. package/server/lib/stt/DOCUMENTATION.md +1 -1
  75. package/server/lib/stt/local/worker-client.js +11 -3
  76. package/server/lib/stt/local/worker-client.test.js +255 -0
  77. package/server/lib/workspace/host.js +6 -2
  78. package/server/lib/workspace/host.test.js +15 -0
  79. package/dist/assets/DiagramEditor-DuGmiPZ5.js +0 -1
  80. package/dist/assets/DiagramView-CHy1Glsl.js +0 -1
  81. package/dist/assets/FilesView-CK2YVs_W.js +0 -6
  82. package/dist/assets/GitView-BEFLOv_7.js +0 -8
  83. package/dist/assets/MarkdownRendererImpl-hE_nmSqe.js +0 -12
  84. package/dist/assets/PatchDiff-BagRxMON.js +0 -1
  85. package/dist/assets/SessionSwitcherDropdown-icxJk_lT.js +0 -2
  86. package/dist/assets/SessionUnreadDot-Bv-5KguB.js +0 -1
  87. package/dist/assets/SettingsView-Ck0qxtKP.js +0 -2
  88. package/dist/assets/SettingsWindow-GQRL2CdD.js +0 -1
  89. package/dist/assets/ToolOutputDialog-CxJUXVZW.js +0 -8
  90. package/dist/assets/ToolPartDiffPreview-BXuLRWHT.js +0 -1
  91. package/dist/assets/collapsible-szfZ0Syc.js +0 -1
  92. package/dist/assets/computeVirtualFileMetrics-DG_E6iaN.js +0 -3
  93. package/dist/assets/contextFileOpenGuard-DPBE3ELv.js +0 -1
  94. package/dist/assets/gitStatusPredicates-OljV4Bb2.js +0 -134
  95. package/dist/assets/index-DNoEeZ2U.css +0 -1
  96. package/dist/assets/index-DmexVlTQ.js +0 -1
  97. package/dist/assets/index-KIdiBFJs.js +0 -8
  98. package/dist/assets/isDiffPlainText-aikgiqLb.js +0 -1
  99. package/dist/assets/isFilePlainText-D-Dl6LqX.js +0 -1
  100. package/dist/assets/main-BXdraZTZ.js +0 -135
  101. package/dist/assets/renderElectronMiniChatApp-B0K72YnS.js +0 -2
  102. package/dist/assets/renderMobileApp-Ca_BO_s4.js +0 -11
  103. package/dist/assets/runtimeEndpointReset-Cx2tsgTo.js +0 -54
  104. package/dist/assets/useFilesViewSearch-Du0DnmKs.js +0 -7
  105. package/dist/assets/usePushVisibilityBeacon-BnHxIv4r.js +0 -10
  106. package/dist/assets/useSwitcherItems-C91mwPJD.js +0 -1
  107. package/dist/assets/vendor-beautiful-mermaid-DneUawHp.js +0 -119
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-shiki-Bbf2GEcE.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-shikijs-core-CGM_jqPK.js","assets/vendor-shikijs-types-CPSbSeK6.js","assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js","assets/vendor-hast-util-to-html-BKBhbTDb.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-property-information-rJCbAzvX.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-comma-separated-tokens-D8TqSuIK.js","assets/vendor-space-separated-tokens-DD3iYX1K.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-shikijs-engine-oniguruma-DPWuIF1G.js"])))=>i.map(i=>d[i]);
2
+ import{_ as I}from"./vendor-vite-runtime-DD1OZmLC.js";import{b as T,c as O}from"./vendor-shiki-Bbf2GEcE.js";import{t as f}from"./themeResolver-yJ9XpNMI.js";import{s as M,p as F,n as v}from"./vendor-pierre-theming-Dgp7B_O4.js";import{c as N}from"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import{c as z}from"./vendor-shikijs-engine-javascript-Cme4830A.js";import{bT as L,cK as G}from"./useAppFontEffects-BvFAP9zG.js";import{t as H}from"./vendor-shikijs-transformers-CZWsLLKm.js";function pe(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ue(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function S(e){return{type:"text",value:e}}function m({tagName:e,children:t=[],properties:r={}}){return{type:"element",tagName:e,properties:r,children:t}}function fe({name:e,width:t=16,height:r=16,properties:n}){return m({tagName:"svg",properties:{width:t,height:r,viewBox:"0 0 16 16",...n},children:[m({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function V(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function de(e){return m({tagName:"div",properties:{"data-gutter":""},children:e})}function me(e,t,r,n={}){return m({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":r,...n},children:t!=null?[m({tagName:"span",properties:{"data-line-number-content":""},children:[S(`${t}`)]})]:void 0})}function he(e,t,r){return m({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":r,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${r};`:`grid-row: span ${r};min-height:calc(${r} * 1lh);`}})}const g=new Map,k=new Map,A=new Map,j=new Set;function E(e,t){e=Array.isArray(e)?e:[e];for(const r of e){if(j.has(r.name))continue;let n=g.get(r.name);n==null&&(n=r,g.set(r.name,n)),j.add(n.name),t.loadLanguageSync(n.data)}}function q(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function D(e){if(q())throw new 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.`);const t=k.get(e);if(t!=null)return t;try{let r=A.get(e);if(r==null&&Object.prototype.hasOwnProperty.call(T,e)&&(r=T[e]),r==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const n=r().then(({default:o})=>{const s={name:e,data:o};return g.has(e)||g.set(e,s),s});return k.set(e,n),await n}finally{k.delete(e)}}function W(e){return g.get(e)??D(e)}const $=new Set;function R(e,t){e=Array.isArray(e)?e:[e];for(let r of e){let n;if(typeof r=="string"){if(n=f.getResolvedTheme(r),n==null)throw new Error(`loadResolvedThemes: ${r} is not resolved, you must resolve it before calling loadResolvedThemes`)}else n=r,r=r.name,f.getResolvedTheme(r)==null&&f.seedResolvedTheme(r,n);$.has(r)||($.add(r),t.loadThemeSync(n))}}function P(e){if(q())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(f.hasRegisteredTheme(e))return;const t=M.getTheme(e);if(t!=null){f.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function U(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function K(e){P(e);const t=await f.resolveTheme(e);return U(e,t),t}function X(e){return f.getResolvedTheme(e)??K(e)}let c;async function ge({themes:e,langs:t,preferredHighlighter:r="shiki-js"}){c??=O({themes:[],langs:["text"],engine:r==="shiki-wasm"?N(I(()=>import("./vendor-shiki-Bbf2GEcE.js").then(a=>a.w),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))):z()});const n=B(c)?await c:c;c=n;const o=[];for(const a of t){if(a==="text"||a==="ansi")continue;const i=W(a);"then"in i?o.push(i):E(i,n)}const s=[];for(const a of e){const i=X(a);"then"in i?s.push(i):R(i,c)}return(o.length>0||s.length>0)&&await Promise.all([Promise.all(o).then(a=>{E(a,n)}),Promise.all(s).then(a=>{R(a,n)})]),n}function be(){if(c!=null&&!("then"in c))return c}function B(e=c){return e!=null&&"then"in e}for(const e of F.getThemes())f.registerThemeIfAbsent(e.name,e.load);function ye(e=L){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}const d=new Map;let J=0;const h={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function ve(e){if(d.has(e))return d.get(e)??"text";if(h[e]!=null)return h[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(d.has(t[1]))return d.get(t[1])??"text";if(h[t[1]]!=null)return h[t[1]]??"text"}const r=e.match(/\.([^.]+)$/)?.[1]??"";return d.has(r)?d.get(r)??"text":h[r]??"text"}function ke(){return J}function we(){return Object.fromEntries(d)}function Q(e,t,r){const n=typeof r.lineInfo=="function"?r.lineInfo(t):r.lineInfo[t-1];if(n==null){const o=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(o,{node:e,line:t,state:r}),new Error(o)}return e.tagName="div",e.properties["data-line"]=n.lineNumber,e.properties["data-alt-line"]=n.altLineNumber,e.properties["data-line-type"]=n.type,e.properties["data-line-index"]=n.lineIndex,e.children.length===0&&e.children.push(S(`
3
+ `)),e}const b=Symbol("no-token"),w=Symbol("multiple-tokens");function _(e){const t=Y(e);if(t!=null)return t;let r=b;const n=[];let o=[],s;const a=()=>{if(o.length===0||s==null){o=[],s=void 0;return}if(o.length===1){const l=o[0];if(l?.type==="element"){Z(l,s);for(const p of l.children)y(p)}else y(l);n.push(l),o=[],s=void 0;return}for(const l of o)y(l);n.push(m({tagName:"span",properties:{"data-char":s},children:o})),o=[],s=void 0},i=l=>{if(l!==b){if(l===w){r=w;return}if(r===b){r=l;return}r!==l&&(r=w)}};for(const l of e.children){const p=l.type==="element"?_(l):b;if(i(p),typeof p!="number"){a(),n.push(l);continue}s!=null&&s!==p&&a(),s??=p,o.push(l)}return a(),e.children=n,r}function Y(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function y(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)y(t)}}function Z(e,t){e.properties["data-char"]=t}function xe(e=!1,t=!1){const r={lineInfo:[]},n=[{line(o){return delete o.properties.class,o},pre(o){const s=V(o),a=[];if(s!=null){let i=1;for(const l of s.children)l.type==="element"&&(e&&_(l),a.push(Q(l,i,r)),i++);s.children=a}return o},...e?{tokens(o){for(const s of o){let a=0;for(const i of s){const l=i;l.__lineChar??=a,a+=i.content.length}}},preprocess(o,s){s.mergeWhitespaces="never"},span(o,s,a,i,l){if(l?.offset!=null&&l.content!=null){const p=l.__lineChar;return p!=null&&(o.properties["data-char"]=p),o}return o}}:null}];return t&&n.push(ee,C),e&&n.push({line:o=>(o.type==="element"&&o.children.length===0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]}),o)}),{state:r,transformers:n,toClass:C}}const C=H({classPrefix:"hl-"}),ee={name:"token-style-normalizer",tokens(e){for(const t of e)for(const r of t){if(r.htmlStyle!=null)continue;const n={};r.color!=null&&(n.color=r.color),r.bgColor!=null&&(n["background-color"]=r.bgColor),r.fontStyle!=null&&r.fontStyle!==0&&((r.fontStyle&1)!==0&&(n["font-style"]="italic"),(r.fontStyle&2)!==0&&(n["font-weight"]="bold"),(r.fontStyle&4)!==0&&(n["text-decoration"]="underline")),Object.keys(n).length>0&&(r.htmlStyle=n)}}};function u(e){return`--${e==="token"?"diffs-token":"diffs"}-`}function Te({theme:e=L,highlighter:t,prefix:r}){let n="";if(typeof e=="string"){const o=t.getTheme(e),s=v(o);n+=`color:${s.fg};`,n+=`background-color:${s.bg};`,n+=`${u("global")}fg:${s.fg};`,n+=`${u("global")}bg:${s.bg};`,n+=x(o,r)}else{let o=t.getTheme(e.dark),s=v(o);n+=`${u("global")}dark:${s.fg};`,n+=`${u("global")}dark-bg:${s.bg};`,n+=x(o,"dark"),o=t.getTheme(e.light),s=v(o),n+=`${u("global")}light:${s.fg};`,n+=`${u("global")}light-bg:${s.bg};`,n+=x(o,"light")}return n}function x(e,t){t=t!=null?`${t}-`:"";let r="";const n=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];n!=null&&(r+=`${u("global")}${t}addition-color:${n};`);const o=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];o!=null&&(r+=`${u("global")}${t}deletion-color:${o};`);const s=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return s!=null&&(r+=`${u("global")}${t}modified-color:${s};`),r}function je(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function Ee(e){return{...G,...e}}function $e(e,t){const r=te(e,t);return t?r:e.diffHeaderHeight+r}function te(e,t){return e.paddingTop??(t?e.spacing:0)}function Re(e){return e.paddingBottom??e.spacing}function Ce(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}export{j as A,S as B,Ee as C,g as R,ye as a,pe as b,R as c,ge as d,we as e,ue as f,W as g,ke as h,ve as i,be as j,he as k,me as l,m,de as n,$e as o,P as p,Re as q,D as r,xe as s,Te as t,je as u,U as v,u as w,Ce as x,fe as y,$ as z};
@@ -0,0 +1 @@
1
+ import{r as a}from"./index-DZnzXhTs.js";import{ca as c,c9 as l,c7 as u,cb as d}from"./useAppFontEffects-BvFAP9zG.js";const o=5e3,f=(r,t)=>{if(!r)return 1;let e=1;for(let n=0;n<r.length;n+=1)if(r.charCodeAt(n)===10&&(e+=1,e>t))return e;return e},y=r=>{const e=(r instanceof Error?r.message:String(r??"")).toLowerCase();return e.includes("file not found")||e.includes("not found")||e.includes("enoent")||e.includes("no such file")||e.includes("does not exist")?"missing":"unreadable"},g=async(r,t,e)=>{if(r.readFile)return(await r.readFile(t,{optional:!0,directory:e?.directory})).content??"";const n=new URLSearchParams({path:t,optional:"true"});e?.directory&&n.set("directory",e.directory);const i=await a(`/api/fs/read?${n.toString()}`,{cache:"no-store",headers:e?.directory?{"x-pichamber-directory":e.directory}:void 0});if(!i.ok){const s=await i.json().catch(()=>({error:i.statusText}));throw new Error(s.error||"Failed to read file")}return i.text()},w=async(r,t,e)=>{if(c(t)||l(t)||u(t))return{ok:!0};try{const n=await g(r,t,e);return d(n)?{ok:!1,reason:"binary"}:f(n,o)>o?{ok:!1,reason:"too-large"}:{ok:!0}}catch(n){return{ok:!1,reason:y(n)}}},x=r=>r==="too-large"?`File is too large to open (>${o.toLocaleString("en-US")} lines)`:r==="missing"?"File not found":r==="binary"?"Cannot preview binary file":"Failed to open file";export{x as g,w as v};
@@ -0,0 +1,134 @@
1
+ import{R as Q,j as o,r as v}from"./vendor-react-B5Z1Mdn3.js";import{a0 as fe,a3 as ge,I as pe,a5 as me,dk as ve,dl as N,aP as be,ad as ye}from"./useAppFontEffects-BvFAP9zG.js";import{B as we}from"./web-components-DWuadqra.js";import{f as ee}from"./computeVirtualFileMetrics-FSOm2VrW.js";import{V as xe,F as Re}from"./VirtualizedFileDiff-Bl-rAYeh.js";import{ap as Se}from"./runtimeEndpointReset-D2MmSbDk.js";import{ensurePierreThemeRegistered as te,getResolvedShikiTheme as ne}from"./appThemeRegistry-gegrE2dq.js";import{V as ie,m as re}from"./index-DZnzXhTs.js";const G=new Set;let X=null;function E(r){G.add(r),X??=requestAnimationFrame(ce)}function ce(r){const e=new Set(G);G.clear();for(const t of e)try{t(r)}catch(n){console.error(n)}G.size>0?X=requestAnimationFrame(ce):X=null}function se({scrollTop:r,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:i=0,overscrollSize:s}){const a=t+s*2,d=n?t+i*2:a;if(e=Math.max(e,d),a>=e||n){const f=Math.max(r-i,0),p=Math.min(r+d,e);return{top:f,bottom:Math.max(p,f)}}let l=r+t/2-a/2,u=l+a;return l<0&&(l=0),u>e&&(u=e),l=Math.floor(Math.max(l,0)),{top:l,bottom:Math.ceil(Math.max(Math.min(u,e),l))}}function ke(r,e){return r==null||e==null?r===e:r.top===e.top&&r.bottom===e.bottom}const de=1e3,Ee=de*4,Te=[0,1e-6,.99999,1],Oe={overscrollSize:de,intersectionObserverMargin:Ee,resizeDebugging:!1};let $=0,ze=-1;var Ce=class z{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++ze}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Oe,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Te,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{z.__STOP?(z.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:z.__lastScrollPosition}),E(this.computeRenderRangeAndEmit)):(z.__lastScrollPosition=this.getScrollTop(),z.__STOP=!0)};for(const[n,i]of this.connectQueue.entries())this.connect(n,i);this.connectQueue.clear(),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=se({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),i=this.getHeight(),s=this.config.intersectionObserverMargin,a=n-s,d=n+i+s;return!(e<a-t||e>d)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const i=n.borderBoxSize[0].blockSize;this.root instanceof Document?i!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:i-$,newSize:i}),$=i)):n.target===this.root?i!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:i-$,newSize:i}),$=i))}t&&E(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+V(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),E(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{z.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,E(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{z.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{z.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(z.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const s=se({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&ke(this.windowSpecs,s)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=s}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),i=new Set;for(const s of e?this.observers.values():this.visibleInstances.values())s.onRender(e)&&i.add(s);for(const s of this.instancesChanged)i.has(s)||s.onRender(e)&&i.add(s);this.scrollFix(n);for(const s of i)s.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&E(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:i,fileElement:s,fileOffset:a,fileTypeOffset:d}=e;if(n!=null&&i!=null){const u=s.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(u instanceof HTMLElement){const f=V(u,t);if(f!==i){const p=f-i;this.applyScrollFix(p)}return}}const l=V(s,t);if(d==="top")l!==a&&this.applyScrollFix(l-a);else{const u=l+s.getBoundingClientRect().height;u!==a&&this.applyScrollFix(u-a)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[i]of this.visibleInstances.entries()){const s=V(i,t),a=s+i.offsetHeight;let d,l;a<=0?(d=a,l="bottom"):(d=s,l="top");let u,f;if(a>0&&s<e)for(const k of i.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(k instanceof HTMLElement))continue;const T=k.dataset.lineIndex;if(T==null)continue;const w=V(k,t);if(!(w<0)){u=T,f=w;break}}if(n?.lineOffset!=null&&f==null)continue;let p=!1;(n==null||f!=null&&(n.lineOffset==null||f<n.lineOffset)||f==null&&n.lineOffset==null&&(d>=0&&(n.fileOffset<0||d<n.fileOffset)||d<0&&n.fileOffset<0&&d>n.fileOffset))&&(p=!0),p&&(n={fileElement:i,fileTypeOffset:l,fileOffset:d,lineIndex:u,lineOffset:f})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const i=this.observers.get(t);i!=null&&(n&&!this.visibleInstances.has(t)?(i.setVisibility(!0),this.visibleInstances.set(t,i),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(i.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&E(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function V(r,e){const t=r.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const Ye=Q.memo(function({scope:e,isGitRepo:t,branchAvailable:n,allCount:i,workingCount:s,stagedCount:a,turnCount:d,branchCount:l,onScopeChange:u}){const[f,p]=Q.useState(!1),k=e==="all"?i:e==="staged"?a:e==="turn"?d:e==="branch"?l:s,T=e==="staged"?"Staged":e==="turn"?"Last turn":e==="branch"?"Branch":e==="all"?"All":"Changed";return o.jsxs(fe,{open:f,onOpenChange:p,children:[o.jsx(ge,{asChild:!0,children:o.jsxs("button",{type:"button",className:"flex h-7 flex-shrink-0 items-center gap-1.5 rounded-md px-2 typography-ui-label font-semibold text-foreground outline-none hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Select change mode",children:[o.jsxs("span",{className:"whitespace-nowrap",children:[T,o.jsxs("span",{className:"diff-toolbar__scope-count",children:[": ",k]})]}),o.jsx(pe,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-60"})]})}),o.jsx(me,{align:"start",className:"w-40",children:o.jsxs(ve,{value:e,onValueChange:w=>{(w==="all"||w==="working"||w==="staged"||w==="turn"||w==="branch")&&(u?.(w),p(!1))},children:[t!==!1?o.jsx(N,{value:"all",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"All"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:i})]})}):null,t!==!1?o.jsx(N,{value:"working",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Changed"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:s})]})}):null,t!==!1?o.jsx(N,{value:"staged",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Staged"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:a})]})}):null,o.jsx(N,{value:"turn",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Last turn"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}),n?o.jsx(N,{value:"branch",children:o.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[o.jsx("span",{children:"Branch"}),o.jsx("span",{className:"typography-meta text-muted-foreground",children:l})]})}):null]})})]})}),oe=5e5,De=`
2
+ :host {
3
+ font-family: var(--font-mono);
4
+ font-size: var(--text-code);
5
+ }
6
+
7
+ pre, [data-code] {
8
+ font-family: var(--font-mono);
9
+ font-size: var(--text-code);
10
+ }
11
+
12
+ /* Mobile touch selection support */
13
+ [data-line-number] {
14
+ touch-action: manipulation;
15
+ -webkit-tap-highlight-color: transparent;
16
+ cursor: pointer;
17
+ }
18
+
19
+ /* Ensure interactive line numbers work on touch */
20
+ pre[data-interactive-line-numbers] [data-line-number] {
21
+ touch-action: manipulation;
22
+ }
23
+ `,Me=`
24
+ ${De}
25
+
26
+ :host {
27
+ --diffs-bg-separator-override: var(--surface-elevated);
28
+ }
29
+
30
+ [data-diff-header],
31
+ [data-diff] {
32
+ [data-separator] {
33
+ height: 24px !important;
34
+ }
35
+ }
36
+
37
+ [data-separator="line-info-basic"] {
38
+ height: 24px !important;
39
+ background: var(--diffs-bg) !important;
40
+ position: relative;
41
+ }
42
+
43
+ [data-diff-type="single"] [data-gutter],
44
+ [data-diff-type="split"] [data-deletions] [data-gutter] {
45
+ [data-separator-wrapper] {
46
+ position: absolute;
47
+ left: 100%;
48
+ display: flex;
49
+ align-items: center;
50
+ gap: unset;
51
+ width: max-content;
52
+ background: transparent;
53
+ color: var(--diffs-fg-number);
54
+ font-family: var(--diffs-header-font-family, var(--font-sans));
55
+ font-size: 0.75rem;
56
+ line-height: 1;
57
+ margin-left: calc(-2ch - 2px);
58
+ }
59
+
60
+ [data-separator-wrapper][data-separator-multi-button] {
61
+ margin-left: calc(-3ch - 2px);
62
+ }
63
+
64
+ [data-expand-button],
65
+ [data-separator-content] {
66
+ display: block;
67
+ align-self: unset;
68
+ min-width: unset;
69
+ min-height: unset;
70
+ padding: 0;
71
+ flex-shrink: 0;
72
+ grid-column: unset;
73
+ border: none;
74
+ width: auto;
75
+ height: auto;
76
+ background-color: transparent;
77
+ color: inherit;
78
+ font: inherit;
79
+ }
80
+
81
+ [data-expand-button]:not([data-expand-all-button]) {
82
+ &[data-expand-down]::before {
83
+ content: '\\2191';
84
+ }
85
+
86
+ &[data-expand-up]::before {
87
+ content: '\\2193';
88
+ }
89
+
90
+ &[data-expand-both]::before {
91
+ content: '\\2195';
92
+ }
93
+
94
+ svg {
95
+ display: none;
96
+ }
97
+ }
98
+
99
+ [data-separator-content] {
100
+ background: transparent;
101
+ margin-left: calc(2px + 1ch);
102
+ }
103
+
104
+ [data-expand-all-button] {
105
+ position: relative;
106
+ margin-left: 14px;
107
+ text-transform: lowercase;
108
+ }
109
+
110
+ [data-expand-all-button]::before {
111
+ content: '';
112
+ display: block;
113
+ position: absolute;
114
+ top: 50%;
115
+ left: -8px;
116
+ margin-top: -1px;
117
+ width: 3px;
118
+ height: 3px;
119
+ border-radius: 2px;
120
+ background-color: var(--diffs-fg-number);
121
+ pointer-events: none;
122
+ }
123
+
124
+ [data-separator-content]:hover,
125
+ [data-expand-button]:hover,
126
+ [data-expand-all-button]:hover {
127
+ color: var(--diffs-fg);
128
+ }
129
+
130
+ [data-expand-all-button]:hover {
131
+ text-decoration: underline;
132
+ }
133
+ }
134
+ `;function Ie(r){let e=2166136261;for(let t=0;t<r.length;t+=1)e^=r.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)}function le(r){const e=r.length>400?`${r.slice(0,200)}${r.slice(-200)}`:r;return`${r.length}:${Ie(e)}`}const He=r=>r==="auto"||r==="scroll"||r==="overlay",Pe=r=>{let e=r?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(He(t.overflowY))return e;e=e.parentElement}return null},Le=(r,e)=>{if(!r||!e||typeof window>"u")return()=>{};const t=Pe(r);if(!t)return()=>{};const n=e.getBoundingClientRect().height;if(!n)return()=>{};const i=r.getBoundingClientRect().top-t.getBoundingClientRect().top,s=e.style.minHeight;e.style.minHeight=`${Math.ceil(n)}px`;let a=!1;return()=>{if(a)return;a=!0,e.style.minHeight=s;const l=r.getBoundingClientRect().top-t.getBoundingClientRect().top-i;l&&(t.scrollTop+=l)}},Ae=(r,e)=>{if(typeof window>"u")return()=>{};let t=null,n=null,i=!1;const s=()=>{i||(n?.disconnect(),n=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{i||e()})}))},a=()=>r.querySelector("diffs-container")?.shadowRoot??void 0,d=(l=a())=>!!l?.querySelector("[data-line]");return d()?s():typeof MutationObserver<"u"?(n=new MutationObserver(()=>{const l=a();if(l){if(d(l)){s();return}n?.disconnect(),n=new MutationObserver(()=>{d(l)&&s()}),n.observe(l,{childList:!0,subtree:!0})}}),n.observe(r,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(s),()=>{i=!0,n?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},U=new WeakMap,_e={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function je(r){const e=r.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function Fe(r){if(typeof document>"u")return null;const e=je(r);let t=U.get(e.key);if(!t){const i=new Ce;i.setup(e.root,e.content),t={virtualizer:i,refs:0},U.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(n)return;n=!0;const i=U.get(e.key);i&&(i.refs-=1,!(i.refs>0)&&(i.virtualizer.cleanUp(),U.delete(e.key)))}}}const Ne=(r,e,t)=>{if(typeof window>"u")return()=>{};const n=[],i=()=>{try{r.rerender()}catch{}const s=e?.root;s instanceof HTMLElement?s.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return n.push(window.requestAnimationFrame(i)),n.push(window.requestAnimationFrame(()=>{n.push(window.requestAnimationFrame(i))})),()=>{for(const s of n)window.cancelAnimationFrame(s)}},Ze=({original:r,modified:e,fileDiff:t,language:n,fileName:i,renderSideBySide:s,wrapLines:a,layout:d="fill"})=>{const l=be(),u=l?.currentTheme.metadata.variant==="dark",f=l?.availableThemes.find(h=>h.metadata.id===l.lightThemeId)??ie(!1),p=l?.availableThemes.find(h=>h.metadata.id===l.darkThemeId)??ie(!0);te(f),te(p);const k=`${f.metadata.id}:${p.metadata.id}:${u?"dark":"light"}`,T=v.useMemo(()=>{if(t){const h=t.deletionLines.reduce((m,g)=>m+g.length,0),c=t.additionLines.reduce((m,g)=>m+g.length,0);return Math.max(h,c)>oe}return Math.max(r.length,e.length)>oe},[t,e.length,r.length]),w=v.useRef(null),j=v.useRef(null),L=v.useRef(null),F=v.useRef(null),K=v.useRef(null),Y=v.useRef(null),Z=v.useRef(void 0),q=v.useRef(void 0),B=v.useRef(void 0),W=v.useRef(void 0),[,J]=Q.useReducer(h=>h+1,0),A=Se(T?"unified":s?"split":"unified"),C=v.useMemo(()=>ne(f),[f]),D=v.useMemo(()=>ne(p),[p]);Q.useLayoutEffect(()=>{const h=w.current;if(!h)return;const c=h.querySelector("diffs-container");if(!c)return;const m=u?D:C,g=(he,ue)=>he.colors?.[ue],R=g(C,"terminal.ansiGreen"),y=g(C,"terminal.ansiRed"),x=g(C,"terminal.ansiBlue"),H=g(D,"terminal.ansiGreen"),O=g(D,"terminal.ansiRed"),M=g(D,"terminal.ansiBlue");c.style.setProperty("--shiki-light",C.fg),c.style.setProperty("--shiki-light-bg",C.bg),R&&c.style.setProperty("--shiki-light-addition-color",R),y&&c.style.setProperty("--shiki-light-deletion-color",y),x&&c.style.setProperty("--shiki-light-modified-color",x),c.style.setProperty("--shiki-dark",D.fg),c.style.setProperty("--shiki-dark-bg",D.bg),H&&c.style.setProperty("--shiki-dark-addition-color",H),O&&c.style.setProperty("--shiki-dark-deletion-color",O),M&&c.style.setProperty("--shiki-dark-modified-color",M),c.style.setProperty("--diffs-bg",m.bg),c.style.setProperty("--diffs-fg",m.fg);const S=u?H:R,P=u?O:y,_=u?M:x;S&&c.style.setProperty("--diffs-addition-color-override",S),P&&c.style.setProperty("--diffs-deletion-color-override",P),_&&c.style.setProperty("--diffs-modified-color-override",_);const b=c.shadowRoot?.querySelector("pre");b&&(b.style.setProperty("--shiki-light",C.fg),b.style.setProperty("--shiki-light-bg",C.bg),R&&b.style.setProperty("--shiki-light-addition-color",R),y&&b.style.setProperty("--shiki-light-deletion-color",y),x&&b.style.setProperty("--shiki-light-modified-color",x),b.style.setProperty("--shiki-dark",D.fg),b.style.setProperty("--shiki-dark-bg",D.bg),H&&b.style.setProperty("--shiki-dark-addition-color",H),O&&b.style.setProperty("--shiki-dark-deletion-color",O),M&&b.style.setProperty("--shiki-dark-modified-color",M),b.style.setProperty("--diffs-bg",m.bg),b.style.setProperty("--diffs-fg",m.fg),S&&b.style.setProperty("--diffs-addition-color-override",S),P&&b.style.setProperty("--diffs-deletion-color-override",P),_&&b.style.setProperty("--diffs-modified-color-override",_))},[D,k,u,C]);const I=v.useMemo(()=>({theme:{dark:p.metadata.id,light:f.metadata.id},themeType:u?"dark":"light",diffStyle:s?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:T?0:1e3,maxLineLengthForHighlighting:T?1:1e3,tokenizeMaxLineLength:T?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:a?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:!1,enableHoverUtility:!1,unsafeCSS:Me}),[p.metadata.id,u,T,f.metadata.id,s,a]);return v.useEffect(()=>{const h=j.current;return()=>{L.current?.cleanUp(),L.current=null,F.current?.release(),F.current=null,K.current=null,Y.current=null,Z.current=void 0,q.current=void 0,B.current=void 0,W.current=void 0,h&&(h.innerHTML="")}},[]),v.useEffect(()=>{if(typeof window>"u")return;const h=j.current,c=w.current;if(!h||!A)return;const m=Le(c,h);let g=F.current;g||(g=Fe(h),F.current=g),F.current=g;const R=g?.virtualizer??null,y=t?void 0:{name:i||"",contents:r,lang:n,cacheKey:`old:${k}:${i}:${le(r)}`},x=t?void 0:{name:i||"",contents:e,lang:n,cacheKey:`new:${k}:${i}:${le(e)}`},H=t?q.current!==t:q.current!==void 0||!y||!x||!B.current||!W.current||!ee(B.current,y)||!ee(W.current,x),O=L.current,M=!!(O&&(K.current!==R||Y.current!==A||R&&(Z.current!==I.hunkSeparators||H)));M&&(O?.cleanUp(),L.current=null,h.innerHTML="");let S=L.current;const P=!M&&O?!we(O.options,I):!1;if(S?S.setOptions(I):(S=g?new xe(I,g.virtualizer,_e,A):new Re(I,A),L.current=S),K.current=R,Y.current=A,Z.current=R?I.hunkSeparators:void 0,q.current=t,B.current=y,W.current=x,t)S.render({fileDiff:t,forceRender:P,containerWrapper:h});else{if(!y||!x)return;S.render({oldFile:y,newFile:x,forceRender:P,containerWrapper:h})}const _=Ae(h,()=>{m(),Ne(S,g,J)});return()=>{_(),m()}},[k,t,i,n,e,I,r,A]),v.useEffect(()=>{const h=j.current;if(!h)return;let c=null,m=null;const R=setTimeout(()=>{const y=h.querySelector("diffs-container");if(!(y instanceof HTMLElement))return;const x=y.shadowRoot;c=new MutationObserver(()=>{m&&cancelAnimationFrame(m),m=requestAnimationFrame(()=>{J(),m=null})}),c.observe(y,{childList:!0,subtree:!0}),x&&c.observe(x,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(R),m&&cancelAnimationFrame(m),c?.disconnect()}},[k,i]),typeof window>"u"?null:d==="fill"?o.jsx("div",{className:re("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:o.jsx("div",{className:"flex-1 relative min-h-0",children:o.jsx(ye,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:o.jsx("div",{ref:w,className:"size-full relative",children:o.jsx("div",{ref:j,className:"size-full"})})})})}):o.jsx("div",{className:re("relative","w-full"),children:o.jsx("div",{ref:w,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative","data-no-drawer-swipe":"true",children:o.jsx("div",{ref:j,className:"w-full"})})})},ae={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function Xe(r){const e=r.index?.trim(),t=r.working_dir?.trim(),n=e&&e!=="?"?e.charAt(0):t?.charAt(0)||e?.charAt(0)||"M";return ae[n]??ae.M}function Je(r){const e=r.index?.trim();return!!(e&&e!=="?")}function et(r){return!!r.working_dir?.trim()||r.index?.trim()==="?"}function tt(r){const e=r.index?.trim(),t=r.working_dir?.trim();return e==="A"||t==="A"||e==="?"||t==="?"}export{Ye as C,Ze as P,et as a,tt as b,Xe as d,Je as i};