mycode-cli 0.7.0__py3-none-any.whl → 0.7.2__py3-none-any.whl

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.
mycode_cli/config.py CHANGED
@@ -84,7 +84,7 @@ class Settings:
84
84
  default_model: str | None
85
85
  port: int
86
86
  cwd: str
87
- workspace_root: str
87
+ project: str
88
88
  default_reasoning_effort: str | None = None
89
89
  compact_threshold: float | None = None
90
90
  permission: PermissionConfig = field(default_factory=PermissionConfig)
@@ -103,16 +103,6 @@ class ResolvedProvider:
103
103
  provider_name: str | None = None
104
104
 
105
105
 
106
- def find_workspace_root(cwd: str) -> Path:
107
- """Resolve the project/workspace root for the current cwd."""
108
-
109
- current = Path(cwd).expanduser().resolve(strict=False)
110
- for parent in [current, *current.parents]:
111
- if (parent / ".git").exists():
112
- return parent
113
- return current
114
-
115
-
116
106
  def _load_json(path: Path) -> dict[str, Any] | None:
117
107
  if not path.is_file():
118
108
  return None
@@ -123,6 +113,32 @@ def _load_json(path: Path) -> dict[str, Any] | None:
123
113
  return data if isinstance(data, dict) else None
124
114
 
125
115
 
116
+ def resolve_project(cwd: str) -> Path:
117
+ """Return the nearest Git project root, or cwd when no .git is found."""
118
+
119
+ cwd_path = Path(cwd).expanduser().resolve(strict=False)
120
+ for path in (cwd_path, *cwd_path.parents):
121
+ if (path / ".git").exists():
122
+ return path
123
+ return cwd_path
124
+
125
+
126
+ def project_dirs(cwd: str, project: str | Path | None = None) -> list[Path]:
127
+ """Return directories from project to cwd, inclusive."""
128
+
129
+ cwd_path = Path(cwd).expanduser().resolve(strict=False)
130
+ project_path = Path(project).expanduser().resolve(strict=False) if project is not None else resolve_project(cwd)
131
+
132
+ dirs = [cwd_path]
133
+ while dirs[-1] != project_path:
134
+ parent = dirs[-1].parent
135
+ if parent == dirs[-1]:
136
+ break
137
+ dirs.append(parent)
138
+
139
+ return list(reversed(dirs))
140
+
141
+
126
142
  def _normalize_models(value: Any) -> dict[str, ModelConfig]:
127
143
  if not isinstance(value, dict):
128
144
  return {}
@@ -264,12 +280,10 @@ def provider_has_api_key(provider: ProviderConfig) -> bool:
264
280
  return bool(provider.api_key or provider_api_key_from_env(provider.type))
265
281
 
266
282
 
267
- def _candidate_config_paths(cwd: str) -> list[Path]:
268
- workspace_root = find_workspace_root(cwd)
269
- return [
270
- resolve_mycode_home() / "config.json",
271
- workspace_root / ".mycode" / "config.json",
272
- ]
283
+ def _candidate_config_paths(cwd: str, project: str | Path) -> list[Path]:
284
+ paths = [resolve_mycode_home() / "config.json"]
285
+ paths.extend(path / ".mycode" / "config.json" for path in project_dirs(cwd, project))
286
+ return paths
273
287
 
274
288
 
275
289
  def _build_providers(raw_providers: dict[str, dict[str, Any]]) -> dict[str, ProviderConfig]:
@@ -302,10 +316,10 @@ def _build_providers(raw_providers: dict[str, dict[str, Any]]) -> dict[str, Prov
302
316
 
303
317
 
304
318
  def get_settings(cwd: str | None = None) -> Settings:
305
- """Load settings from global and workspace config files."""
319
+ """Load settings from global and project config files."""
306
320
 
307
321
  resolved_cwd = str(Path(cwd or os.getcwd()).expanduser().resolve(strict=False))
308
- workspace_root = find_workspace_root(resolved_cwd)
322
+ resolved_project = str(resolve_project(resolved_cwd))
309
323
 
310
324
  raw_providers: dict[str, dict[str, Any]] = {}
311
325
  default_provider: str | None = None
@@ -315,7 +329,7 @@ def get_settings(cwd: str | None = None) -> Settings:
315
329
  permission = PermissionConfig()
316
330
  config_paths: list[str] = []
317
331
 
318
- for path in _candidate_config_paths(resolved_cwd):
332
+ for path in _candidate_config_paths(resolved_cwd, resolved_project):
319
333
  data = _load_json(path)
320
334
  if data is None:
321
335
  continue
@@ -373,7 +387,7 @@ def get_settings(cwd: str | None = None) -> Settings:
373
387
  permission=permission,
374
388
  port=int(os.environ.get("PORT", "8000")),
375
389
  cwd=resolved_cwd,
376
- workspace_root=str(workspace_root),
390
+ project=resolved_project,
377
391
  config_paths=config_paths,
378
392
  )
379
393
 
@@ -418,7 +432,7 @@ def resolve_provider(
418
432
  checked = ", ".join(env_names) or "<api key env>"
419
433
  raise ValueError(
420
434
  "no available providers found; set one of the supported API key env vars "
421
- + f"({checked}) or configure a provider in ~/.mycode/config.json or <workspace>/.mycode/config.json"
435
+ + f"({checked}) or configure a provider in ~/.mycode/config.json or a project .mycode/config.json"
422
436
  )
423
437
 
424
438
 
mycode_cli/permissions.py CHANGED
@@ -76,12 +76,11 @@ def build_permission_hooks(
76
76
  on_user_denied: Callable[[], None] | None = None,
77
77
  ) -> Hooks:
78
78
  hooks = Hooks()
79
- workspace_root = Path(settings.workspace_root).resolve(strict=False)
80
79
  skill_roots = [Path(s.path).parent.resolve(strict=False) for s in discover_skills(settings.cwd)]
81
80
 
82
81
  @hooks.before_tool
83
82
  async def check_permission(ctx: ToolHookContext) -> ToolExecutionResult | None:
84
- check = classify_tool(ctx, cwd=settings.cwd, workspace_root=workspace_root, skill_roots=skill_roots)
83
+ check = classify_tool(ctx, cwd=settings.cwd, project=settings.project, skill_roots=skill_roots)
85
84
  decision = permission_decision(settings.permission, check.tier)
86
85
  if decision == "allow":
87
86
  return None
@@ -118,7 +117,7 @@ def classify_tool(
118
117
  ctx: ToolHookContext,
119
118
  *,
120
119
  cwd: str,
121
- workspace_root: Path,
120
+ project: str,
122
121
  skill_roots: list[Path],
123
122
  ) -> PermissionCheck:
124
123
  name = ctx.tool_name.lower()
@@ -130,10 +129,11 @@ def classify_tool(
130
129
  if name in {"read", "write", "edit"}:
131
130
  raw = str(ctx.tool_input.get("path") or "")
132
131
  path = Path(resolve_path(raw, cwd=cwd)).resolve(strict=False)
132
+ project_path = Path(project).resolve(strict=False)
133
133
  preview = raw or str(path)
134
134
  if name == "read" and any(path.is_relative_to(root) for root in skill_roots):
135
135
  return PermissionCheck("readonly", preview)
136
- if not path.is_relative_to(workspace_root):
136
+ if not path.is_relative_to(project_path):
137
137
  return PermissionCheck("yolo", preview)
138
138
  return PermissionCheck("readonly" if name == "read" else "safe", preview)
139
139
 
@@ -358,6 +358,6 @@ async def get_config(cwd: str | None = None):
358
358
  "default_reasoning_effort": settings.default_reasoning_effort,
359
359
  "reasoning_effort_options": REASONING_EFFORT_OPTIONS,
360
360
  "cwd": resolved_cwd,
361
- "workspace_root": settings.workspace_root,
361
+ "project": settings.project,
362
362
  "config_paths": settings.config_paths,
363
363
  }
@@ -54,6 +54,7 @@ class StreamEvent(BaseModel):
54
54
  seq: int | None = None
55
55
  type: str
56
56
  delta: str | None = None # text/reasoning
57
+ duration_ms: int | None = None # reasoning_done
57
58
  tool_call: ToolCallPayload | None = None # tool_start
58
59
  tool_use_id: str | None = None
59
60
  output: str | None = None # tool_output + tool_done
@@ -1,4 +1,4 @@
1
- import{j as N,r as $,b as Je,a as zn,n as Fn,c as $n,d as _n,_ as qe,e as Wn,t as ce,u as Gn}from"./index-Dp879Ucn.js";const jn={position:"absolute",top:0,bottom:0,textAlign:"center"},Bn={display:"contents"};function Ze(){return null}const we="diffs-container",qn=/(?=^From [a-f0-9]+ .+$)/m,ye=/(?=^diff --git)/gm,Qe=/(?=^---\s+\S)/gm,Vn=/(?=^@@ )/gm,Kn=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,Te=new RegExp("(?<=\\n)"),Xn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Yn=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Jn=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Zn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Ve="header-prefix",Ke="header-metadata",Xe="header-custom",q={dark:"pierre-dark",light:"pierre-light"},Tn="data-theme-css",An="data-unsafe-css",se=1,Qn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},et=Object.freeze({fromStart:0,fromEnd:0}),en={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},nt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function ue(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function tt(e,n){return typeof window>"u"&&n!=null?N.jsxs(N.Fragment,{children:[N.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:n}}),e]}):N.jsx(N.Fragment,{children:e})}const it=$.createContext(void 0);function rt(){return $.useContext(it)}const ee=new Map,Ae=new Map,$e=new Map,_e=new Set;function nn(e,n){e=Array.isArray(e)?e:[e];for(let t of e){let i;if(typeof t=="string"){if(i=ee.get(t),i==null)throw new Error(`loadResolvedThemes: ${t} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=t,t=t.name,ee.has(t)||ee.set(t,i);_e.has(t)||(_e.add(t),n.loadThemeSync(i))}}const he=new Map,Ie=new Map,ot=new Map,We=new Set;function tn(e,n){e=Array.isArray(e)?e:[e];for(const t of e){if(We.has(t.name))continue;let i=he.get(t.name);i==null&&(i=t,he.set(t.name,i)),We.add(i.name),n.loadLanguageSync(i.data)}}function In(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function st(e){if(In())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 n=Ie.get(e);if(n!=null)return n;try{let t=ot.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Je,e)&&(t=Je[e]),t==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=t().then(({default:r})=>{const o={name:e,data:r};return he.has(e)||he.set(e,o),o});return Ie.set(e,i),await i}finally{Ie.delete(e)}}function at(e){return he.get(e)??st(e)}async function lt(e){if(In())throw new Error(`resolveTheme("${e}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const n=Ae.get(e);if(n!=null)return n;try{const t=$e.get(e)??zn[e];if(t==null)throw new Error(`resolveTheme: No valid loader for ${e}`);const i=t().then(o=>dt(e,"default"in o?o.default:o));Ae.set(e,i);const r=await i;if(r.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${r.name}`);return ee.set(r.name,r),r}finally{Ae.delete(e)}}function dt(e,n){const t=ee.get(e);return t??(n=Fn(n),ee.set(e,n),n)}function ft(e){return ee.get(e)??lt(e)}function Rn(e,n){if($e.has(e)){console.error("SharedHighlight.registerCustomTheme: theme name already registered",e);return}$e.set(e,n)}let B;async function ct({themes:e,langs:n,preferredHighlighter:t="shiki-js"}){B??=$n({themes:[],langs:["text"],engine:t==="shiki-wasm"?_n(qe(()=>import("./wasm-CG6Dc4jp.js"),[])):Wn()});const i=ht(B)?await B:B;B=i;const r=[];for(const a of n){if(a==="text"||a==="ansi")continue;const l=at(a);"then"in l?r.push(l):tn(l,i)}const o=[];for(const a of e){const l=ft(a);"then"in l?o.push(l):nn(l,B)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(a=>{tn(a,i)}),Promise.all(o).then(a=>{nn(a,i)})]),i}function ut(){if(B!=null&&!("then"in B))return B}function ht(e=B){return e!=null&&"then"in e}Rn("pierre-dark",async()=>{const{default:e}=await qe(async()=>{const{default:n}=await import("./pierre-dark-DF2SEV7i.js");return{default:n}},[]);return{...e,name:"pierre-dark"}});Rn("pierre-light",async()=>{const{default:e}=await qe(async()=>{const{default:n}=await import("./pierre-light-DOlZxES8.js");return{default:n}},[]);return{...e,name:"pierre-light"}});function Mn(e=q){const n=[];return typeof e=="string"?n.push(e):(n.push(e.dark),n.push(e.light)),n}function Hn(e,n){return e==null||n==null||typeof e=="string"||typeof n=="string"?e===n:e.dark===n.dark&&e.light===n.light}const re=new Map,fe={"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",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 ne(e){if(re.has(e))return re.get(e)??"text";if(fe[e]!=null)return fe[e];const n=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(n!=null){if(re.has(n[1]))return re.get(n[1])??"text";if(fe[n[1]]!=null)return fe[n[1]]??"text"}const t=e.match(/\.([^.]+)$/)?.[1]??"";return re.has(t)?re.get(t)??"text":fe[t]??"text"}function ae(e){return e.replace(/\n$|\r\n$/,"")}function V(e){return{type:"text",value:e}}function T({tagName:e,children:n=[],properties:t={}}){return{type:"element",tagName:e,properties:t,children:n}}function Le({name:e,width:n=16,height:t=16,properties:i}){return T({tagName:"svg",properties:{width:n,height:t,viewBox:"0 0 16 16",...i},children:[T({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function pt(e){let n=e.children[0];for(;n!=null;){if(n.type==="element"&&n.tagName==="code")return n;"children"in n?n=n.children[0]:n=null}}function me(e){return T({tagName:"div",properties:{"data-gutter":""},children:e})}function mt(e,n,t,i={}){return T({tagName:"div",properties:{"data-line-type":e,"data-column-number":n,"data-line-index":t,...i},children:n!=null?[T({tagName:"span",properties:{"data-line-number-content":""},children:[V(`${n}`)]})]:void 0})}function W(e,n,t){return T({tagName:"div",properties:{"data-gutter-buffer":n,"data-buffer-size":t,"data-line-type":n==="annotation"?void 0:e,style:n==="annotation"?`grid-row: span ${t};`:`grid-row: span ${t};min-height:calc(${t} * 1lh);`}})}function gt(e,n,t){const i=typeof t.lineInfo=="function"?t.lineInfo(n):t.lineInfo[n-1];if(i==null){const r=`processLine: line ${n}, contains no state.lineInfo`;throw console.error(r,{node:e,line:n,state:t}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(V(`
1
+ import{j as N,r as $,b as Je,a as zn,n as Fn,c as $n,d as _n,_ as qe,e as Wn,t as ce,u as Gn}from"./index-CBAWKqLI.js";const jn={position:"absolute",top:0,bottom:0,textAlign:"center"},Bn={display:"contents"};function Ze(){return null}const we="diffs-container",qn=/(?=^From [a-f0-9]+ .+$)/m,ye=/(?=^diff --git)/gm,Qe=/(?=^---\s+\S)/gm,Vn=/(?=^@@ )/gm,Kn=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,Te=new RegExp("(?<=\\n)"),Xn=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Yn=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Jn=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Zn=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Ve="header-prefix",Ke="header-metadata",Xe="header-custom",q={dark:"pierre-dark",light:"pierre-light"},Tn="data-theme-css",An="data-unsafe-css",se=1,Qn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},et=Object.freeze({fromStart:0,fromEnd:0}),en={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},nt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function ue(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function tt(e,n){return typeof window>"u"&&n!=null?N.jsxs(N.Fragment,{children:[N.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:n}}),e]}):N.jsx(N.Fragment,{children:e})}const it=$.createContext(void 0);function rt(){return $.useContext(it)}const ee=new Map,Ae=new Map,$e=new Map,_e=new Set;function nn(e,n){e=Array.isArray(e)?e:[e];for(let t of e){let i;if(typeof t=="string"){if(i=ee.get(t),i==null)throw new Error(`loadResolvedThemes: ${t} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=t,t=t.name,ee.has(t)||ee.set(t,i);_e.has(t)||(_e.add(t),n.loadThemeSync(i))}}const he=new Map,Ie=new Map,ot=new Map,We=new Set;function tn(e,n){e=Array.isArray(e)?e:[e];for(const t of e){if(We.has(t.name))continue;let i=he.get(t.name);i==null&&(i=t,he.set(t.name,i)),We.add(i.name),n.loadLanguageSync(i.data)}}function In(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function st(e){if(In())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 n=Ie.get(e);if(n!=null)return n;try{let t=ot.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Je,e)&&(t=Je[e]),t==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=t().then(({default:r})=>{const o={name:e,data:r};return he.has(e)||he.set(e,o),o});return Ie.set(e,i),await i}finally{Ie.delete(e)}}function at(e){return he.get(e)??st(e)}async function lt(e){if(In())throw new Error(`resolveTheme("${e}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const n=Ae.get(e);if(n!=null)return n;try{const t=$e.get(e)??zn[e];if(t==null)throw new Error(`resolveTheme: No valid loader for ${e}`);const i=t().then(o=>dt(e,"default"in o?o.default:o));Ae.set(e,i);const r=await i;if(r.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${r.name}`);return ee.set(r.name,r),r}finally{Ae.delete(e)}}function dt(e,n){const t=ee.get(e);return t??(n=Fn(n),ee.set(e,n),n)}function ft(e){return ee.get(e)??lt(e)}function Rn(e,n){if($e.has(e)){console.error("SharedHighlight.registerCustomTheme: theme name already registered",e);return}$e.set(e,n)}let B;async function ct({themes:e,langs:n,preferredHighlighter:t="shiki-js"}){B??=$n({themes:[],langs:["text"],engine:t==="shiki-wasm"?_n(qe(()=>import("./wasm-CG6Dc4jp.js"),[])):Wn()});const i=ht(B)?await B:B;B=i;const r=[];for(const a of n){if(a==="text"||a==="ansi")continue;const l=at(a);"then"in l?r.push(l):tn(l,i)}const o=[];for(const a of e){const l=ft(a);"then"in l?o.push(l):nn(l,B)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(a=>{tn(a,i)}),Promise.all(o).then(a=>{nn(a,i)})]),i}function ut(){if(B!=null&&!("then"in B))return B}function ht(e=B){return e!=null&&"then"in e}Rn("pierre-dark",async()=>{const{default:e}=await qe(async()=>{const{default:n}=await import("./pierre-dark-DF2SEV7i.js");return{default:n}},[]);return{...e,name:"pierre-dark"}});Rn("pierre-light",async()=>{const{default:e}=await qe(async()=>{const{default:n}=await import("./pierre-light-DOlZxES8.js");return{default:n}},[]);return{...e,name:"pierre-light"}});function Mn(e=q){const n=[];return typeof e=="string"?n.push(e):(n.push(e.dark),n.push(e.light)),n}function Hn(e,n){return e==null||n==null||typeof e=="string"||typeof n=="string"?e===n:e.dark===n.dark&&e.light===n.light}const re=new Map,fe={"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",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 ne(e){if(re.has(e))return re.get(e)??"text";if(fe[e]!=null)return fe[e];const n=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(n!=null){if(re.has(n[1]))return re.get(n[1])??"text";if(fe[n[1]]!=null)return fe[n[1]]??"text"}const t=e.match(/\.([^.]+)$/)?.[1]??"";return re.has(t)?re.get(t)??"text":fe[t]??"text"}function ae(e){return e.replace(/\n$|\r\n$/,"")}function V(e){return{type:"text",value:e}}function T({tagName:e,children:n=[],properties:t={}}){return{type:"element",tagName:e,properties:t,children:n}}function Le({name:e,width:n=16,height:t=16,properties:i}){return T({tagName:"svg",properties:{width:n,height:t,viewBox:"0 0 16 16",...i},children:[T({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function pt(e){let n=e.children[0];for(;n!=null;){if(n.type==="element"&&n.tagName==="code")return n;"children"in n?n=n.children[0]:n=null}}function me(e){return T({tagName:"div",properties:{"data-gutter":""},children:e})}function mt(e,n,t,i={}){return T({tagName:"div",properties:{"data-line-type":e,"data-column-number":n,"data-line-index":t,...i},children:n!=null?[T({tagName:"span",properties:{"data-line-number-content":""},children:[V(`${n}`)]})]:void 0})}function W(e,n,t){return T({tagName:"div",properties:{"data-gutter-buffer":n,"data-buffer-size":t,"data-line-type":n==="annotation"?void 0:e,style:n==="annotation"?`grid-row: span ${t};`:`grid-row: span ${t};min-height:calc(${t} * 1lh);`}})}function gt(e,n,t){const i=typeof t.lineInfo=="function"?t.lineInfo(n):t.lineInfo[n-1];if(i==null){const r=`processLine: line ${n}, contains no state.lineInfo`;throw console.error(r,{node:e,line:n,state:t}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(V(`
2
2
  `)),e}const ge=Symbol("no-token"),Re=Symbol("multiple-tokens");function Pn(e){const n=bt(e);if(n!=null)return n;let t=ge;const i=[];let r=[],o;const a=()=>{if(r.length===0||o==null){r=[],o=void 0;return}if(r.length===1){const s=r[0];if(s?.type==="element"){vt(s,o);for(const d of s.children)Se(d)}else Se(s);i.push(s),r=[],o=void 0;return}for(const s of r)Se(s);i.push(T({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=s=>{if(s!==ge){if(s===Re){t=Re;return}if(t===ge){t=s;return}t!==s&&(t=Re)}};for(const s of e.children){const d=s.type==="element"?Pn(s):ge;if(l(d),typeof d!="number"){a(),i.push(s);continue}o!=null&&o!==d&&a(),o??=d,r.push(s)}return a(),e.children=i,t}function bt(e){const n=e.properties["data-char"];if(typeof n=="number")return n}function Se(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const n of e.children)Se(n)}}function vt(e,n){e.properties["data-char"]=n}function kt(e={}){const{classPrefix:n="__shiki_",classSuffix:t="",classReplacer:i=l=>l}=e,r=new Map;function o(l){return Object.entries(l).map(([s,d])=>`${s}:${d}`).join(";")}function a(l){const s=typeof l=="string"?l:o(l);let d=n+xt(s)+t;return d=i(d),r.has(d)||r.set(d,typeof l=="string"?l:{...l}),d}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const s=a(l.properties.style);delete l.properties.style,this.addClassToHast(l,s)},tokens(l){for(const s of l)for(const d of s){if(!d.htmlStyle)continue;const f=a(d.htmlStyle);d.htmlStyle={},d.htmlAttrs||={},d.htmlAttrs.class?d.htmlAttrs.class+=` ${f}`:d.htmlAttrs.class=f}},getClassRegistry(){return r},getCSS(){let l="";for(const[s,d]of r.entries())l+=`.${s}{${typeof d=="string"?d:o(d)}}`;return l},clearRegistry(){r.clear()}}}function xt(e,n=0){let t=3735928559^n,i=1103547991^n;for(let r=0,o;r<e.length;r++)o=e.charCodeAt(r),t=Math.imul(t^o,2654435761),i=Math.imul(i^o,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&i)+(t>>>0)).toString(36).slice(0,6)}function yt(e=!1,n=!1){const t={lineInfo:[]},i=[{line(r){return delete r.properties.class,r},pre(r){const o=pt(r),a=[];if(o!=null){let l=1;for(const s of o.children)s.type==="element"&&(e&&Pn(s),a.push(gt(s,l,t)),l++);o.children=a}return r},...e?{tokens(r){for(const o of r){let a=0;for(const l of o){const s=l;s.__lineChar??=a,a+=l.content.length}}},preprocess(r,o){o.mergeWhitespaces="never"},span(r,o,a,l,s){if(s?.offset!=null&&s.content!=null){const d=s.__lineChar;return d!=null&&(r.properties["data-char"]=d),r}return r}}:null}];return n&&i.push(St,rn),{state:t,transformers:i,toClass:rn}}const rn=kt({classPrefix:"hl-"}),St={name:"token-style-normalizer",tokens(e){for(const n of e)for(const t of n){if(t.htmlStyle!=null)continue;const i={};t.color!=null&&(i.color=t.color),t.bgColor!=null&&(i["background-color"]=t.bgColor),t.fontStyle!=null&&t.fontStyle!==0&&((t.fontStyle&1)!==0&&(i["font-style"]="italic"),(t.fontStyle&2)!==0&&(i["font-weight"]="bold"),(t.fontStyle&4)!==0&&(i["text-decoration"]="underline")),Object.keys(i).length>0&&(t.htmlStyle=i)}}};function G(e){return`--${e==="token"?"diffs-token":"diffs"}-`}function Ct({theme:e=q,highlighter:n,prefix:t}){let i="";if(typeof e=="string"){const r=n.getTheme(e);i+=`color:${r.fg};`,i+=`background-color:${r.bg};`,i+=`${G("global")}fg:${r.fg};`,i+=`${G("global")}bg:${r.bg};`,i+=Me(r,t)}else{let r=n.getTheme(e.dark);i+=`${G("global")}dark:${r.fg};`,i+=`${G("global")}dark-bg:${r.bg};`,i+=Me(r,"dark"),r=n.getTheme(e.light),i+=`${G("global")}light:${r.fg};`,i+=`${G("global")}light-bg:${r.bg};`,i+=Me(r,"light")}return i}function Me(e,n){n=n!=null?`${n}-`:"";let t="";const i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];i!=null&&(t+=`${G("global")}${n}addition-color:${i};`);const r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];r!=null&&(t+=`${G("global")}${n}deletion-color:${r};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(t+=`${G("global")}${n}modified-color:${o};`),t}function on(e){let n=e.children[0];for(;n!=null;){if(n.type==="element"&&n.tagName==="code")return n.children;"children"in n?n=n.children[0]:n=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function sn(e,n){return e?.cacheKey===n?.cacheKey&&e?.contents===n?.contents&&e?.name===n?.name&&e?.lang===n?.lang}function He(e,n){return Hn(e.theme,n.theme)&&e.useTokenTransformer===n.useTokenTransformer&&e.tokenizeMaxLineLength===n.tokenizeMaxLineLength&&e.lineDiffType===n.lineDiffType&&e.maxLineDiffLength===n.maxLineDiffLength}function wt(e){const n=e.lang??ne(e.name),t=e.lang??(e.prevName!=null?ne(e.prevName):"text");return n==="text"&&t==="text"}function Ee({diff:e,diffStyle:n,startingLine:t=0,totalLines:i=1/0,expandedHunks:r,collapsedContextThreshold:o=se,callback:a}){const l={finalHunk:e.hunks.at(-1),viewportStart:t,viewportEnd:t+i,isWindowedHighlight:t>0||i<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!l.isWindowedHighlight)return!1;const s=l.unifiedCount>=t+i,d=l.splitCount>=t+i;return n==="unified"?s:(n==="split"||s)&&d},shouldSkip(s,d){if(!l.isWindowedHighlight)return!1;const f=l.unifiedCount+s<t,c=l.splitCount+d<t;return n==="unified"?f:(n==="split"||f)&&c},incrementCounts(s,d){(n==="unified"||n==="both")&&(l.unifiedCount+=s),(n==="split"||n==="both")&&(l.splitCount+=d)},isInWindow(s,d){if(!l.isWindowedHighlight)return!0;const f=l.isInUnifiedWindow(s),c=l.isInSplitWindow(d);return n==="unified"?f:n==="split"?c:f||c},isInUnifiedWindow(s){return!l.isWindowedHighlight||l.unifiedCount>=t-s&&l.unifiedCount<t+i},isInSplitWindow(s){return!l.isWindowedHighlight||l.splitCount>=t-s&&l.splitCount<t+i},emit(s,d=!1){return d||(n==="unified"?l.incrementCounts(1,0):n==="split"?l.incrementCounts(0,1):l.incrementCounts(1,1)),a(s)??!1}};e:for(const[s,d]of e.hunks.entries()){let u=function(g,k){return c==null||c.collapsedLines<=0||c.fromStart+c.fromEnd>0?0:n==="unified"?g===d.unifiedLineStart+d.unifiedLineCount-1?c.collapsedLines:0:k===d.splitLineStart+d.splitLineCount-1?c.collapsedLines:0},m=function(){if(f.collapsedLines===0)return 0;const g=f.collapsedLines;return f.collapsedLines=0,g};if(l.shouldBreak())break;const f=an(e.isPartial,d.collapsedBefore,r,s,o),c=(()=>{if(d!==l.finalHunk||!Lt(e))return;const g=e.additionLines.length-(d.additionLineIndex+d.additionCount),k=e.deletionLines.length-(d.deletionLineIndex+d.deletionCount);if(g!==k)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${g}, deletions=${k}) for ${e.name}`);const w=Math.min(g,k);return an(e.isPartial,w,r,e.hunks.length,o)})(),h=f.fromStart+f.fromEnd;if(l.shouldSkip(h,h))l.incrementCounts(h,h),m();else{let g=d.unifiedLineStart-f.rangeSize,k=d.splitLineStart-f.rangeSize,w=d.deletionLineIndex-f.rangeSize,L=d.additionLineIndex-f.rangeSize,E=d.deletionStart-f.rangeSize,A=d.additionStart-f.rangeSize,I=0;for(;I<f.fromStart;){if(l.isInWindow(0,0)){if(l.emit({hunkIndex:s,hunk:d,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:E+I,lineIndex:w+I,noEOFCR:!1,unifiedLineIndex:g+I,splitLineIndex:k+I},additionLine:{unifiedLineIndex:g+I,splitLineIndex:k+I,lineIndex:L+I,lineNumber:A+I,noEOFCR:!1}}))break e}else l.incrementCounts(1,1);I++}for(g=d.unifiedLineStart-f.fromEnd,k=d.splitLineStart-f.fromEnd,w=d.deletionLineIndex-f.fromEnd,L=d.additionLineIndex-f.fromEnd,E=d.deletionStart-f.fromEnd,A=d.additionStart-f.fromEnd,I=0;I<f.fromEnd;){if(l.isInWindow(0,0)){if(l.emit({hunkIndex:s,hunk:d,collapsedBefore:m(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:E+I,lineIndex:w+I,noEOFCR:!1,unifiedLineIndex:g+I,splitLineIndex:k+I},additionLine:{unifiedLineIndex:g+I,splitLineIndex:k+I,lineIndex:L+I,lineNumber:A+I,noEOFCR:!1}}))break e}else l.incrementCounts(1,1);I++}}let x=d.unifiedLineStart,y=d.splitLineStart,C=d.deletionLineIndex,p=d.additionLineIndex,b=d.deletionStart,v=d.additionStart;const S=d.hunkContent.at(-1);for(const g of d.hunkContent){if(l.shouldBreak())break e;const k=g===S;if(g.type==="context"){if(l.shouldSkip(g.lines,g.lines))l.incrementCounts(g.lines,g.lines),m();else{let w=0;for(;w<g.lines;){if(l.isInWindow(0,0)){const L=k&&w===g.lines-1,E=x+w,A=y+w;if(l.emit({hunkIndex:s,hunk:d,collapsedBefore:m(),collapsedAfter:u(E,A),type:"context",deletionLine:{lineNumber:b+w,lineIndex:C+w,noEOFCR:L&&d.noEOFCRDeletions,unifiedLineIndex:E,splitLineIndex:A},additionLine:{unifiedLineIndex:E,splitLineIndex:A,lineIndex:p+w,lineNumber:v+w,noEOFCR:L&&d.noEOFCRAdditions}}))break e}else l.incrementCounts(1,1);w++}}x+=g.lines,y+=g.lines,C+=g.lines,p+=g.lines,b+=g.lines,v+=g.lines}else{const w=Math.max(g.deletions,g.additions),L=g.deletions+g.additions;if(!l.shouldSkip(L,w)){const E=Et(l,g,n);for(const[A,I]of E)for(let R=A;R<I;R++){const U=u(x+R,n==="unified"?y+(R<g.deletions?R:R-g.deletions):y+R);if(l.emit(Tt({hunkIndex:s,hunk:d,collapsedBefore:m(),collapsedAfter:U,diffStyle:n,index:R,unifiedLineIndex:x,splitLineIndex:y,additionLineIndex:p,deletionLineIndex:C,additionLineNumber:v,deletionLineNumber:b,content:g,isLastContent:k,unifiedCount:L,splitCount:w}),!0))break e}}m(),l.incrementCounts(L,w),x+=L,y+=w,C+=g.deletions,p+=g.additions,b+=g.deletions,v+=g.additions}}if(c!=null){const{collapsedLines:g,fromStart:k,fromEnd:w}=c,L=k+w;let E=0;for(;E<L;){if(l.shouldBreak())break e;if(l.isInWindow(0,0)){const A=E===L-1;if(l.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:A?g:0,type:"context-expanded",deletionLine:{lineNumber:b+E,lineIndex:C+E,noEOFCR:!1,unifiedLineIndex:x+E,splitLineIndex:y+E},additionLine:{unifiedLineIndex:x+E,splitLineIndex:y+E,lineIndex:p+E,lineNumber:v+E,noEOFCR:!1}}))break e}else l.incrementCounts(1,1);E++}}}}function an(e,n,t,i,r){if(n=Math.max(n,0),n===0||e)return{fromStart:0,fromEnd:0,rangeSize:n,collapsedLines:Math.max(n,0)};if(t===!0||n<=r)return{fromStart:n,fromEnd:0,rangeSize:n,collapsedLines:0};const o=t?.get(i),a=Math.min(Math.max(o?.fromStart??0,0),n),l=Math.min(Math.max(o?.fromEnd??0,0),n),s=a+l,d=s>=n;return{fromStart:d?n:a,fromEnd:d?0:l,rangeSize:n,collapsedLines:Math.max(n-s,0)}}function Lt(e){const n=e.hunks.at(-1);return n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0?!1:n.additionLineIndex+n.additionCount<e.additionLines.length||n.deletionLineIndex+n.deletionCount<e.deletionLines.length}function Et(e,n,t){if(!e.isWindowedHighlight)return[[0,t==="unified"?n.deletions+n.additions:Math.max(n.deletions,n.additions)]];const i=t!=="split",r=t!=="unified",o=t==="unified"?"unified":"split",a=[];function l(c,h){if(c+h<=e.viewportStart||c>=e.viewportEnd)return;const u=Math.max(0,e.viewportStart-c),m=Math.min(h,e.viewportEnd-c);return m>u?[u,m]:void 0}function s(c,h){return o==="split"?c:h==="additions"?[c[0]+n.deletions,c[1]+n.deletions]:c}function d(c,h){if(c==null)return;const[u,m]=s(c,h);m>u&&a.push([u,m])}if(i&&(d(l(e.unifiedCount,n.deletions),"deletions"),d(l(e.unifiedCount+n.deletions,n.additions),"additions")),r&&(d(l(e.splitCount,n.deletions),"deletions"),d(l(e.splitCount,n.additions),"additions")),a.length===0)return a;a.sort((c,h)=>c[0]-h[0]);const f=[a[0]];for(const[c,h]of a.slice(1)){const u=f[f.length-1];c<=u[1]?u[1]=Math.max(u[1],h):f.push([c,h])}return f}function Tt({hunkIndex:e,hunk:n,collapsedAfter:t,collapsedBefore:i,diffStyle:r,index:o,unifiedLineIndex:a,splitLineIndex:l,additionLineIndex:s,deletionLineIndex:d,additionLineNumber:f,deletionLineNumber:c,content:h,isLastContent:u,unifiedCount:m,splitCount:x}){const y=o<h.deletions?a+o:void 0,C=r==="unified"?o>=h.deletions?a+o:void 0:o<h.additions?a+h.deletions+o:void 0,p=r==="unified"?l+(o<h.deletions?o:o-h.deletions):l+o,b=o<h.deletions?d+o:void 0,v=o<h.deletions?c+o:void 0,S=r==="unified"?o>=h.deletions?s+(o-h.deletions):void 0:o<h.additions?s+o:void 0,g=r==="unified"?o>=h.deletions?f+(o-h.deletions):void 0:o<h.additions?f+o:void 0,k=r==="unified"?u&&o===h.deletions-1&&n.noEOFCRDeletions:u&&o===x-1&&n.noEOFCRDeletions,w=r==="unified"?u&&o===m-1&&n.noEOFCRAdditions:u&&o===x-1&&n.noEOFCRAdditions,L=b!=null&&v!=null&&y!=null?{lineNumber:v,lineIndex:b,noEOFCR:k,unifiedLineIndex:y,splitLineIndex:p}:void 0,E=S!=null&&g!=null&&C!=null?{unifiedLineIndex:C,splitLineIndex:p,lineIndex:S,lineNumber:g,noEOFCR:w}:void 0;if(L==null&&E!=null)return{type:"change",hunkIndex:e,hunk:n,collapsedAfter:t,collapsedBefore:i,deletionLine:void 0,additionLine:E};if(L!=null&&E==null)return{type:"change",hunkIndex:e,hunk:n,collapsedAfter:t,collapsedBefore:i,deletionLine:L,additionLine:void 0};if(L==null||E==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:n,collapsedAfter:t,collapsedBefore:i,deletionLine:L,additionLine:E}}class Ye{diff(n,t,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);const o=this.castInput(n,i),a=this.castInput(t,i),l=this.removeEmpty(this.tokenize(o,i)),s=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(l,s,i,r)}diffWithOptionsObj(n,t,i,r){var o;const a=p=>{if(p=this.postProcess(p,i),r){setTimeout(function(){r(p)},0);return}else return p},l=t.length,s=n.length;let d=1,f=l+s;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));const c=(o=i.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+c,u=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(u[0],t,n,0,i);if(u[0].oldPos+1>=s&&m+1>=l)return a(this.buildValues(u[0].lastComponent,t,n));let x=-1/0,y=1/0;const C=()=>{for(let p=Math.max(x,-d);p<=Math.min(y,d);p+=2){let b;const v=u[p-1],S=u[p+1];v&&(u[p-1]=void 0);let g=!1;if(S){const w=S.oldPos-p;g=S&&0<=w&&w<l}const k=v&&v.oldPos+1<s;if(!g&&!k){u[p]=void 0;continue}if(!k||g&&v.oldPos<S.oldPos?b=this.addToPath(S,!0,!1,0,i):b=this.addToPath(v,!1,!0,1,i),m=this.extractCommon(b,t,n,p,i),b.oldPos+1>=s&&m+1>=l)return a(this.buildValues(b.lastComponent,t,n))||!0;u[p]=b,b.oldPos+1>=s&&(y=Math.min(y,p-1)),m+1>=l&&(x=Math.max(x,p+1))}d++};if(r)(function p(){setTimeout(function(){if(d>f||Date.now()>h)return r(void 0);C()||p()},0)})();else for(;d<=f&&Date.now()<=h;){const p=C();if(p)return p}}addToPath(n,t,i,r,o){const a=n.lastComponent;return a&&!o.oneChangePerToken&&a.added===t&&a.removed===i?{oldPos:n.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:i,previousComponent:a.previousComponent}}:{oldPos:n.oldPos+r,lastComponent:{count:1,added:t,removed:i,previousComponent:a}}}extractCommon(n,t,i,r,o){const a=t.length,l=i.length;let s=n.oldPos,d=s-r,f=0;for(;d+1<a&&s+1<l&&this.equals(i[s+1],t[d+1],o);)d++,s++,f++,o.oneChangePerToken&&(n.lastComponent={count:1,previousComponent:n.lastComponent,added:!1,removed:!1});return f&&!o.oneChangePerToken&&(n.lastComponent={count:f,previousComponent:n.lastComponent,added:!1,removed:!1}),n.oldPos=s,d}equals(n,t,i){return i.comparator?i.comparator(n,t):n===t||!!i.ignoreCase&&n.toLowerCase()===t.toLowerCase()}removeEmpty(n){const t=[];for(let i=0;i<n.length;i++)n[i]&&t.push(n[i]);return t}castInput(n,t){return n}tokenize(n,t){return Array.from(n)}join(n){return n.join("")}postProcess(n,t){return n}get useLongestToken(){return!1}buildValues(n,t,i){const r=[];let o;for(;n;)r.push(n),o=n.previousComponent,delete n.previousComponent,n=o;r.reverse();const a=r.length;let l=0,s=0,d=0;for(;l<a;l++){const f=r[l];if(f.removed)f.value=this.join(i.slice(d,d+f.count)),d+=f.count;else{if(!f.added&&this.useLongestToken){let c=t.slice(s,s+f.count);c=c.map(function(h,u){const m=i[d+u];return m.length>h.length?m:h}),f.value=this.join(c)}else f.value=this.join(t.slice(s,s+f.count));s+=f.count,f.added||(d+=f.count)}}return r}}class At extends Ye{}const It=new At;function Rt(e,n,t){return It.diff(e,n,t)}const ln="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Mt extends Ye{tokenize(n){const t=new RegExp(`(\\r?\\n)|[${ln}]+|[^\\S\\n\\r]+|[^${ln}]`,"ug");return n.match(t)||[]}}const Ht=new Mt;function Pt(e,n,t){return Ht.diff(e,n,t)}class Dt extends Ye{constructor(){super(...arguments),this.tokenize=Ut}equals(n,t,i){return i.ignoreWhitespace?((!i.newlineIsToken||!n.includes(`
3
3
  `))&&(n=n.trim()),(!i.newlineIsToken||!t.includes(`
4
4
  `))&&(t=t.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(n.endsWith(`