@shinsa/darwin-arm64 1.0.0-canary.76 → 1.0.0-canary.78
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.
- package/bin/shinsa +2 -2
- package/package.json +1 -1
- package/web/assets/{code-CAV2kP02.js → code-CJNLJLz9.js} +2 -2
- package/web/assets/{code-diff-view-CFo3O3xF.js → code-diff-view-Bqtomkyj.js} +2 -2
- package/web/assets/{code-editor-DhG-JLE8.js → code-editor-DdJTCq3u.js} +1 -1
- package/web/assets/{core-BU5nAoHX.js → core-D4r3kkys.js} +1 -1
- package/web/assets/{highlights-2GptTPDT.js → highlights-5Ib9I28J.js} +1 -1
- package/web/assets/{index-DMSaWVDU.js → index-BEh7N9D3.js} +1 -1
- package/web/assets/{index-Caeev9KI.js → index-BFzmBibt.js} +3 -3
- package/web/assets/{index-CtN82P_V.js → index-BHmgaggz.js} +1 -1
- package/web/assets/index-DRw_nRXT.js +460 -0
- package/web/assets/{langs-Bmhkncrj.js → langs-jiDTFbsS.js} +1 -1
- package/web/assets/{loader-RFCgyI9b.js → loader-BeIW1huH.js} +1 -1
- package/web/assets/{quick-open-BQPPZnwX.js → quick-open-kYNVCs5z.js} +1 -1
- package/web/assets/{shiki-V-uttHoH.js → shiki-Q9s3qbjg.js} +2 -2
- package/web/assets/{stream-tokenizer-DXIXiHaX.js → stream-tokenizer-B2pFBuwu.js} +1 -1
- package/web/assets/{themes-DCO5gmgj.js → themes-DxQeOWjX.js} +2 -2
- package/web/index.html +1 -1
- package/web/assets/index-BzYsYcj3.js +0 -441
package/bin/shinsa
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bin/shinsa
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 95668144 bytes
|
|
4
|
+
sha256: a6b82a00eea0b1f99b56049a5e1f674e63d9ace646083d21acd4217f344fa29d
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-
|
|
2
|
-
import{v as Je,W as Ie,a as r,w as Xe,_ as Ze,x as Fe,y as oe,z as et,D as tt,E as st,G as nt,j as a,H as te,B as G,J as at,K as it,M as rt,N as lt,O as J,p as se,T as D,P as he,Q as ne,S as ot,U as H,c as E,I as ct,V as dt,X as ut,Y as me,Z as Me,$ as ft,a0 as ht,a1 as mt,a2 as Oe,s as X,a3 as xt,a4 as Le,a5 as xe,a6 as pt,a7 as gt,a8 as Z,a9 as ce,aa as $e,ab as bt,ac as vt,r as _e,ad as ve,ae as yt,af as jt,ag as wt,ah as St,ai as kt,aj as Et,ak as Nt,al as Rt,am as Ct,an as Tt,ao as Pt,ap as It,L as Ft,aq as Mt,ar as Ot,q as Lt,as as $t,n as _t,at as Vt,au as ee,av as Dt,aw as Ht,ax as zt,ay as Ve,az as At,aA as Kt,aB as qt,aC as Gt,aD as q,aE as De,aF as Wt,aG as Bt,aH as Ut,aI as Qt,aJ as Yt,aK as Jt,aL as Xt,aM as Zt,aN as es,aO as ts,aP as ye,aQ as je,aR as ss,aS as ns,aT as as,aU as is,aV as rs,aW as ls,aX as os,aY as cs,aZ as we,a_ as Se,a$ as ds,b0 as us,b1 as fs,b2 as hs,b3 as ms,b4 as xs,b5 as ps,b6 as gs}from"./index-BzYsYcj3.js";import{l as bs,a as vs,F as He,C as ys,Q as js}from"./quick-open-BQPPZnwX.js";import{Q as ws,U as Ss,V as ue,X as ze,Y as ks,Z as Es}from"./commands-C30s37KG.js";function Ae(e){const t=Je(e.task);return t?{editable:!1,reason:t}:e.gitRef!==e.refs.head&&e.gitRef!==Ie?{editable:!1,reason:"This is an earlier commit, so it is read-only. Pick Head of the branch to edit."}:e.headPath===null?{editable:!1,reason:null}:{editable:!0,reason:null}}function Ns(e,t){return t!==null&&(e.editedPaths??[]).includes(t)}const ke=256,Rs=55295;function de(e){return e.match(/[^\n]*\n|[^\n]+$/g)??[]}function Cs(e){const t=new Map,s=e.map(n=>n.map(i=>{const o=t.get(i);if(o)return o;const c=String.fromCharCode(ke+t.size);return t.set(i,c),c}).join(""));return ke+t.size>Rs?null:s}function Ee(e,t,s){return ws(e,t).map(n=>({from:n.fromA,to:n.toA,lines:s.slice(n.fromB,n.toB)}))}function Ts(e,t){return e.from===t.from&&e.to===t.to&&e.lines.join("")===t.lines.join("")}function Ps(e,t){return e.from<t.to&&t.from<e.to||e.from===t.from||e.to===t.to}function Is(e,t,s){const n=[de(e),de(t),de(s)],i=Cs([...n]);if(!i)return null;const[o="",c="",f=""]=i,h=Ee(o,c,n[1]),p=Ee(o,f,n[2]).filter(v=>!h.some(b=>Ts(b,v)));if(p.some(v=>h.some(b=>Ps(b,v))))return null;const y=[];let m=0;for(const v of[...h,...p].sort((b,w)=>b.from-w.from))y.push(...n[0].slice(m,v.from),...v.lines),m=v.to;return[...y,...n[0].slice(m)].join("")}const Ke=new Map;function qe(e,t){return`${e}\0${t}`}function Fs(e,t,s,n){Ke.set(qe(e,t),{from:s,text:n})}function Ms(e,t,s){const n=Ke.get(qe(e,t));return n?.from===s?n.text:null}const Os="This file changed on disk where you were typing, so it shows the new version.",Ls="This file was deleted on disk. Your next edit puts it back.";class $s{#t;#n=null;#s=null;#r=!1;#c=[];#i={saving:!1,notice:null,refusal:null};#e;constructor(t,s){this.#t=t,this.#e=s}get disk(){return this.#t}edit(){this.#i.refusal||(this.#l(),this.#n=setTimeout(()=>{this.#n=null,this.#o()},this.#e.delayMs??600),this.#i.notice&&this.#a({notice:null}))}async flush(){for(this.#n&&(this.#l(),await this.#o());this.#s!==null;)await this.#s}reload(t,s){if(t!==s){if(this.#s!==null){this.#c.push({previous:t,next:s});return}s!==this.#t&&this.#d(t,s)}}dispose(){this.#l()}#l(){this.#n&&clearTimeout(this.#n),this.#n=null}#a(t){this.#i={...this.#i,...t},this.#e.onState(this.#i)}#o(){if(this.#s!==null)return this.#r=!0,this.#s;const t=this.#e.read();return t===this.#t?Promise.resolve():(this.#a({saving:!0}),this.#s=this.#u(t).finally(()=>{this.#s=null,this.#a({saving:!1});for(const{previous:s,next:n}of this.#c.splice(0))this.reload(s,n);this.#r&&(this.#r=!1,this.#o())}),this.#s)}async#u(t){const s=this.#t;try{const n=await this.#e.save(t,s);n.kind==="saved"?(this.#t=t,this.#e.onSaved(t)):this.#d(s,n.content)}catch(n){this.#a({refusal:n instanceof Error?n.message:String(n)})}}#d(t,s){const n=this.#e.read();if(s===null){this.#t=null,this.#a({notice:Ls});return}if(this.#t=s,n===s)return;const i=Is(t??"",n,s);if(i===null){this.#e.apply(s),this.#a({notice:Os});return}this.#e.apply(i),i!==s&&this.edit()}}const _s={saving:!1,notice:null,refusal:null};function Vs(e){const{taskId:t,path:s,text:n,buffer:i}=e,[o,c]=r.useState(_s),f=r.useRef(null);if(f.current===null&&n!==null&&s!==null){const p=Ms(t,s,n)??n,y=n;f.current={text:n,start:p,latest:p,saver:new $s(p,{save:(m,v)=>Xe(t,{path:s,content:m,base:v}),read:()=>i.current?.readText()??f.current?.latest??p,apply:m=>{f.current&&(f.current.latest=m),i.current?.replaceText(m)},onSaved:m=>Fs(t,s,f.current?.text??y,m),onState:c})}}const h=f.current;return r.useEffect(()=>{if(!h||n===null||h.text===n)return;const p=h.text;h.text=n,h.saver.reload(p,n)},[h,n]),r.useEffect(()=>()=>{h&&h.saver.flush().finally(()=>h.saver.dispose())},[h]),{start:h?.start??n,state:o,edit:()=>{h&&(h.latest=i.current?.readText()??h.latest,h.saver.edit())},save:()=>{h&&h.saver.flush()}}}let fe=null;async function Ge(){return fe=await Ze(()=>import("./code-editor-DhG-JLE8.js"),__vite__mapDeps([0,1,2,3,4])),fe}function Ds(e){const[t,s]=r.useState(fe);return r.useEffect(()=>{t||Ge().then(s,()=>s("failed"))},[t]),t==="failed"?a.jsx("p",{className:"p-3 text-xs text-fg-2",children:"The editor did not load. Reload the page to try again."}):t?a.jsx(t.default,{...e}):a.jsx(We,{path:e.path})}function Hs(e){const[t,s]=r.useState(e);return r.useEffect(()=>{if(!e)return;s(e);const n=setTimeout(()=>s(null),ot);return()=>clearTimeout(n)},[e]),e!==null&&t===e}function zs(e,t){const s=t.line?{key:`${e}:${t.line}:${t.end??""}:${t.spot??""}`,line:t.line,side:"new"}:null,n=Hs(s?.key??null);return{reveal:s,focus:rt(t.line,t.end,n)}}function We({path:e}){return a.jsx(ne,{label:`Opening ${e}…`})}function As({task:e,gitRef:t,path:s,label:n}){const[i,o]=r.useState(!1);return a.jsxs("figure",{className:"flex min-w-0 flex-1 flex-col items-center gap-2 p-4",children:[a.jsx("figcaption",{className:"text-2xs text-fg-2",children:n}),a.jsx("img",{src:dt(e.id,t,s),alt:s,onLoad:()=>o(!0),style:{visibility:i?"visible":"hidden"},className:E(ct,"max-h-[60vh] max-w-full bg-[repeating-conic-gradient(var(--bg-2)_0_25%,transparent_0_50%)] bg-[length:16px_16px] object-contain")})]})}function Ks(e,t){return e.tooLarge?`${t} is ${ut(e.size)}, too large to show as text.`:e.binary?`${t} is a binary file, so there is no text to show.`:`There is no ${t} at this point in the history.`}function qs({task:e,refs:t,gitRef:s,source:n,head:i}){const o=[n.basePath&&n.change?.binary&&t.base?{ref:t.base,path:n.basePath,label:"Before"}:null,i?.image&&n.headPath?{ref:s,path:n.headPath,label:n.change?"After":i.path}:null].filter(c=>c!==null);return o.length>0?a.jsx("div",{className:"flex min-h-0 flex-1 flex-wrap justify-center overflow-auto",children:o.map(c=>a.jsx(As,{task:e,gitRef:c.ref,path:c.path,label:c.label},c.label))}):a.jsx(te,{size:"sm",icon:"IconFileText",title:"Nothing to show as text",description:i?Ks(i,n.file.path):`${n.file.path} was deleted.`})}function Gs({split:e,onToggle:t}){const s=e?"Show unified":"Show side by side";return a.jsx(H,{label:s,children:a.jsx(G,{variant:"secondary",size:"icon-sm",icon:e?"IconLayoutTopBottom":"IconLayoutColumn","aria-label":s,onClick:t,className:"max-md:hidden"})})}function Ws({source:e,split:t,showLayout:s,saving:n,toolbar:i,onSplit:o}){const c=e.file.path;return a.jsxs(lt,{className:"gap-1.5",children:[i,a.jsx(J,{name:se(c),size:"sm"}),a.jsx(He,{path:c,className:"min-w-0"}),e.change?.previousPath&&a.jsxs(D,{className:"text-2xs text-fg-2 max-lg:hidden",children:["renamed from ",e.change.previousPath]}),e.change&&!e.change.binary&&a.jsx(he,{added:e.change.additions,removed:e.change.deletions}),a.jsx("span",{className:"flex-1"}),n&&a.jsx("span",{className:"shrink-0 text-2xs text-fg-2",children:"Saving…"}),s&&o&&a.jsx(Gs,{split:t,onToggle:o})]})}function Bs({text:e,readOnly:t}){return a.jsxs("p",{className:"flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-1.5 text-2xs text-fg-2",children:[a.jsx(J,{name:t?"IconLock":"IconCircleInfo",size:"sm"}),a.jsx(D,{children:e})]})}function Us({task:e,refs:t,gitRef:s,source:n,location:i,targets:o,split:c,onSplit:f,handle:h,session:p,toolbar:y}){const m=Fe(),v=n.file.path,b=Ae({task:e,refs:t,gitRef:s,headPath:n.headPath}),w=b.editable&&t.working&&Ns(e,n.headPath),P=oe(e,s,n.headPath),N=oe(e,w?Ie:null,w?n.headPath:null),C=w?N:P,g=oe(e,t.base,n.basePath??n.baselinePath),[S,R]=r.useState(null),O=n.change!==null,T=et(n),u=r.useRef(null),x=tt(u.current,st({headPath:n.headPath,basePath:n.basePath,baselinePath:n.baselinePath,diffing:O,head:C,base:g}));u.current=x;const[I,z]=r.useState(!1),L=x.kind==="text"&&!I?nt(v,[x.content,x.original]):null,l=r.useRef(null),j=r.useCallback(F=>{l.current=F,h.current=F},[h]),k=Vs({taskId:e.id,path:b.editable?n.headPath:null,text:x.kind==="text"?x.content:null,buffer:l}),W=b.editable&&k.state.refusal===null,B=k.state.refusal??k.state.notice??b.reason,U=s===t.head,$=bs({path:v,ref:s,findings:U?e.findings:[],comments:m.comments,composer:S}),A=U?vs(o,v,i.spot):[],{reveal:Q,focus:V}=zs(v,i);function ae(F){return a.jsx(ys,{note:F,task:e,onRemove:m.enabled?m.removeComment:null,onCancel:()=>R(null),onSave:_=>{F.kind==="composer"&&(m.addComment({path:v,side:F.side,line:F.start,endLine:F.endLine,ref:s,text:_}),R(null))}})}return a.jsxs("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[a.jsx(Ws,{source:n,split:c,showLayout:O&&!T&&x.kind==="text",saving:k.state.saving,toolbar:y,onSplit:f}),x.kind==="text"&&B&&!L&&a.jsx(Bs,{text:B,readOnly:!W}),L&&a.jsx(te,{size:"sm",icon:"IconFileText",title:"Opening this file may slow the page",description:L,children:a.jsx(G,{variant:"secondary",size:"sm",onClick:()=>z(!0),children:"Open anyway"})}),x.kind==="waiting"&&a.jsx(We,{path:v}),x.kind==="failed"&&a.jsx("p",{className:"p-3 text-xs text-fg-2",children:x.message}),x.kind==="absent"&&a.jsx(qs,{task:e,refs:t,gitRef:s,source:n,head:x.head}),x.kind==="text"&&!L&&a.jsx(Ds,{path:v,docKey:it(s,n.file),...p?{session:p}:{},content:k.start??x.content,original:x.original,baseline:x.baseline,split:O&&c&&!T,editable:W,notes:$,spots:A,keep:at($,A,i.line,i.end),focus:V,reveal:Q,onComment:m.enabled?(F,_,Y)=>R({side:F,line:_,endLine:Y}):null,onEdit:k.edit,onSave:k.save,renderNote:ae,handle:j})]})}function Qs(e,t=!1){const s=r.useCallback(n=>{const i=window.matchMedia(e);return i.addEventListener("change",n),()=>i.removeEventListener("change",n)},[e]);return r.useSyncExternalStore(s,()=>window.matchMedia(e).matches,()=>t)}const Ne=8,Re=4,Ys=7,pe="flex flex-col px-1 py-1",ge=22,Js="group/tree",Xs=40;function Zs(e){const t=r.useRef(null);return r.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]),{onPointerEnter:()=>{!e||t.current||(t.current=setTimeout(()=>{t.current=null,e()},Xs))},onPointerLeave:()=>{t.current&&clearTimeout(t.current),t.current=null}}}function K({depth:e,guide:t,selected:s=!1,expanded:n,icon:i,children:o,end:c,label:f,className:h,onOpen:p,onPrefetch:y}){const m=r.useRef(!1),v=Zs(y);return a.jsxs("div",{role:"treeitem","aria-selected":s,"aria-expanded":n,"aria-label":f,tabIndex:-1,onPointerDown:b=>{m.current=b.pointerType==="mouse"&&b.button===0&&!b.metaKey&&!b.ctrlKey&&!b.shiftKey,m.current&&(v.onPointerLeave(),p())},onClick:()=>{if(m.current){m.current=!1;return}p()},onPointerEnter:v.onPointerEnter,onPointerLeave:v.onPointerLeave,onFocus:y,onKeyDown:b=>{b.key==="Enter"&&p()},style:{paddingInlineStart:Re+e*Ne},className:E("corner-superellipse/1.125 relative flex h-5.5 w-full shrink-0 cursor-pointer items-center gap-1 rounded-control-sm pe-1.5 text-2xs outline-none select-none",s?"bg-primary-a1 text-fg-4":"text-fg-3 hover:bg-bg-a2 active:bg-bg-a2",h),children:[Array.from({length:e},(b,w)=>a.jsx("span",{"aria-hidden":!0,className:E("pointer-events-none absolute inset-y-0 w-px opacity-0 group-hover/tree:opacity-100",w===t?"bg-fg-1":"bg-bg-a4"),style:{insetInlineStart:Re+w*Ne+Ys-1}},w)),a.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center",children:n!==void 0&&a.jsx(J,{name:"IconChevronDownSmall",size:"sm",className:E(!n&&"-rotate-90")})}),i&&a.jsx(J,{name:i,size:"sm"}),a.jsx("span",{className:"ms-0.5 flex min-w-0 flex-1 items-center gap-1.5",children:o}),c]})}function Be({status:e,muted:t=!1}){return a.jsx(H,{label:ce[e].name,children:a.jsx("span",{className:E("inline-flex w-2 shrink-0 justify-center text-2xs font-medium",t?"text-fg-1":ce[e].className),children:ce[e].letter})})}function Ue({viewed:e,label:t="Viewed",indeterminate:s=!1,onToggle:n}){return a.jsx(bt,{size:"sm","aria-label":t,checked:e,indeterminate:s,onCheckedChange:n,onPointerDown:i=>i.stopPropagation(),onClick:i=>i.stopPropagation()})}function en({file:e,muted:t}){return e.risk!=="high"?null:a.jsx(H,{label:a.jsxs("span",{className:"flex flex-col items-start",children:[a.jsx("span",{className:"text-red-text",children:"High risk"}),e.riskReason&&a.jsx(vt,{children:e.riskReason})]}),children:a.jsx("span",{className:E("size-1.5 shrink-0 rounded-full",t?"bg-fg-1":"bg-red-4")})})}function tn({file:e,comments:t,viewed:s,muted:n,onToggleViewed:i}){return a.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[a.jsx(en,{file:e,muted:n}),t>0&&a.jsx(H,{label:`${Le(t,"comment","comments")} from you`,children:a.jsx("span",{className:E("inline-flex w-fit text-2xs tabular-nums",n?"text-fg-1":"text-primary-text"),children:t})}),e.binary?a.jsx("span",{className:E("text-2xs",n?"text-fg-1":"text-fg-2"),children:"Binary"}):a.jsx(he,{added:e.additions,removed:e.deletions,muted:n}),a.jsx(Be,{status:e.status,muted:n}),a.jsx(Ue,{viewed:s,onToggle:i})]})}const sn=r.memo(function({path:t,name:s,depth:n,guide:i,selected:o,file:c,comments:f,viewed:h,actions:p}){const y=h&&!o;return a.jsx(K,{depth:n,guide:i,selected:o,label:t,icon:se(t),className:E(y&&"text-fg-1 file-icons-muted"),onOpen:()=>p.open(t),onPrefetch:()=>p.prefetch(t),end:c&&a.jsx(tn,{file:c,comments:f,viewed:h,muted:y,onToggleViewed:()=>p.toggleViewed(t)}),children:a.jsx(D,{className:"flex-1",children:s})})});function nn({row:e,guide:t,open:s,state:n,onOpen:i,onMarkViewed:o}){const c=n==="all";return a.jsx(K,{depth:e.depth,guide:t,expanded:s,icon:$e(e.path,s),label:e.path,className:E(c&&"file-icons-muted"),onOpen:i,end:a.jsx(Ue,{viewed:c,indeterminate:n==="some",label:`Viewed: every file in ${e.name}`,onToggle:()=>o(!c)}),children:a.jsx(D,{className:E("flex-1",c?"text-fg-1":"text-fg-2"),children:e.name})})}function an(){return a.jsx("p",{className:"py-1 ps-1 text-2xs text-fg-2",children:"Every file is viewed."})}function rn({hidden:e,onToggle:t}){const s=e?"Show viewed files":"Hide viewed files";return a.jsx(H,{label:s,children:a.jsx(G,{variant:"secondary",size:"icon-xs",icon:e?"IconEyeSlash":"IconEyeOpen","aria-label":"Hide viewed files","aria-pressed":e,className:e?"bg-bg-a3 text-fg-4":void 0,onClick:t})})}function ln({persistId:e,diff:t,activePath:s,commentCounts:n,viewed:i,onToggleViewed:o,onMarkViewed:c,onOpen:f,onPrefetch:h}){const[p,y]=me(e,!1),[m,v]=Me(),b=r.useMemo(()=>ft(t.files,i,m,s),[t.files,i,m,s]),w=r.useMemo(()=>ht(b,p),[b,p]),P=mt(w,s),N=r.useMemo(()=>w.flatMap(u=>u.kind==="file"?[u.path]:[]),[w]),C=Oe(N,s).join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-DdJTCq3u.js","assets/index-DRw_nRXT.js","assets/index-Vhuy6UWU.css","assets/commands-C30s37KG.js","assets/quick-open-kYNVCs5z.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{v as Je,W as Ie,a as r,w as Xe,_ as Ze,x as Fe,y as oe,z as et,D as tt,E as st,G as nt,j as a,H as te,B as G,J as at,K as it,M as rt,N as lt,O as J,p as se,T as D,P as he,Q as ne,S as ot,U as H,c as E,I as ct,V as dt,X as ut,Y as me,Z as Me,$ as ft,a0 as ht,a1 as mt,a2 as Oe,s as X,a3 as xt,a4 as Le,a5 as xe,a6 as pt,a7 as gt,a8 as Z,a9 as ce,aa as $e,ab as bt,ac as vt,r as _e,ad as ve,ae as yt,af as jt,ag as wt,ah as St,ai as kt,aj as Et,ak as Nt,al as Rt,am as Ct,an as Tt,ao as Pt,ap as It,L as Ft,aq as Mt,ar as Ot,q as Lt,as as $t,n as _t,at as Vt,au as ee,av as Dt,aw as Ht,ax as zt,ay as Ve,az as At,aA as Kt,aB as qt,aC as Gt,aD as q,aE as De,aF as Wt,aG as Bt,aH as Ut,aI as Qt,aJ as Yt,aK as Jt,aL as Xt,aM as Zt,aN as es,aO as ts,aP as ye,aQ as je,aR as ss,aS as ns,aT as as,aU as is,aV as rs,aW as ls,aX as os,aY as cs,aZ as we,a_ as Se,a$ as ds,b0 as us,b1 as fs,b2 as hs,b3 as ms,b4 as xs,b5 as ps,b6 as gs}from"./index-DRw_nRXT.js";import{l as bs,a as vs,F as He,C as ys,Q as js}from"./quick-open-kYNVCs5z.js";import{Q as ws,U as Ss,V as ue,X as ze,Y as ks,Z as Es}from"./commands-C30s37KG.js";function Ae(e){const t=Je(e.task);return t?{editable:!1,reason:t}:e.gitRef!==e.refs.head&&e.gitRef!==Ie?{editable:!1,reason:"This is an earlier commit, so it is read-only. Pick Head of the branch to edit."}:e.headPath===null?{editable:!1,reason:null}:{editable:!0,reason:null}}function Ns(e,t){return t!==null&&(e.editedPaths??[]).includes(t)}const ke=256,Rs=55295;function de(e){return e.match(/[^\n]*\n|[^\n]+$/g)??[]}function Cs(e){const t=new Map,s=e.map(n=>n.map(i=>{const o=t.get(i);if(o)return o;const c=String.fromCharCode(ke+t.size);return t.set(i,c),c}).join(""));return ke+t.size>Rs?null:s}function Ee(e,t,s){return ws(e,t).map(n=>({from:n.fromA,to:n.toA,lines:s.slice(n.fromB,n.toB)}))}function Ts(e,t){return e.from===t.from&&e.to===t.to&&e.lines.join("")===t.lines.join("")}function Ps(e,t){return e.from<t.to&&t.from<e.to||e.from===t.from||e.to===t.to}function Is(e,t,s){const n=[de(e),de(t),de(s)],i=Cs([...n]);if(!i)return null;const[o="",c="",f=""]=i,h=Ee(o,c,n[1]),p=Ee(o,f,n[2]).filter(v=>!h.some(b=>Ts(b,v)));if(p.some(v=>h.some(b=>Ps(b,v))))return null;const y=[];let m=0;for(const v of[...h,...p].sort((b,w)=>b.from-w.from))y.push(...n[0].slice(m,v.from),...v.lines),m=v.to;return[...y,...n[0].slice(m)].join("")}const Ke=new Map;function qe(e,t){return`${e}\0${t}`}function Fs(e,t,s,n){Ke.set(qe(e,t),{from:s,text:n})}function Ms(e,t,s){const n=Ke.get(qe(e,t));return n?.from===s?n.text:null}const Os="This file changed on disk where you were typing, so it shows the new version.",Ls="This file was deleted on disk. Your next edit puts it back.";class $s{#t;#n=null;#s=null;#r=!1;#c=[];#i={saving:!1,notice:null,refusal:null};#e;constructor(t,s){this.#t=t,this.#e=s}get disk(){return this.#t}edit(){this.#i.refusal||(this.#l(),this.#n=setTimeout(()=>{this.#n=null,this.#o()},this.#e.delayMs??600),this.#i.notice&&this.#a({notice:null}))}async flush(){for(this.#n&&(this.#l(),await this.#o());this.#s!==null;)await this.#s}reload(t,s){if(t!==s){if(this.#s!==null){this.#c.push({previous:t,next:s});return}s!==this.#t&&this.#d(t,s)}}dispose(){this.#l()}#l(){this.#n&&clearTimeout(this.#n),this.#n=null}#a(t){this.#i={...this.#i,...t},this.#e.onState(this.#i)}#o(){if(this.#s!==null)return this.#r=!0,this.#s;const t=this.#e.read();return t===this.#t?Promise.resolve():(this.#a({saving:!0}),this.#s=this.#u(t).finally(()=>{this.#s=null,this.#a({saving:!1});for(const{previous:s,next:n}of this.#c.splice(0))this.reload(s,n);this.#r&&(this.#r=!1,this.#o())}),this.#s)}async#u(t){const s=this.#t;try{const n=await this.#e.save(t,s);n.kind==="saved"?(this.#t=t,this.#e.onSaved(t)):this.#d(s,n.content)}catch(n){this.#a({refusal:n instanceof Error?n.message:String(n)})}}#d(t,s){const n=this.#e.read();if(s===null){this.#t=null,this.#a({notice:Ls});return}if(this.#t=s,n===s)return;const i=Is(t??"",n,s);if(i===null){this.#e.apply(s),this.#a({notice:Os});return}this.#e.apply(i),i!==s&&this.edit()}}const _s={saving:!1,notice:null,refusal:null};function Vs(e){const{taskId:t,path:s,text:n,buffer:i}=e,[o,c]=r.useState(_s),f=r.useRef(null);if(f.current===null&&n!==null&&s!==null){const p=Ms(t,s,n)??n,y=n;f.current={text:n,start:p,latest:p,saver:new $s(p,{save:(m,v)=>Xe(t,{path:s,content:m,base:v}),read:()=>i.current?.readText()??f.current?.latest??p,apply:m=>{f.current&&(f.current.latest=m),i.current?.replaceText(m)},onSaved:m=>Fs(t,s,f.current?.text??y,m),onState:c})}}const h=f.current;return r.useEffect(()=>{if(!h||n===null||h.text===n)return;const p=h.text;h.text=n,h.saver.reload(p,n)},[h,n]),r.useEffect(()=>()=>{h&&h.saver.flush().finally(()=>h.saver.dispose())},[h]),{start:h?.start??n,state:o,edit:()=>{h&&(h.latest=i.current?.readText()??h.latest,h.saver.edit())},save:()=>{h&&h.saver.flush()}}}let fe=null;async function Ge(){return fe=await Ze(()=>import("./code-editor-DdJTCq3u.js"),__vite__mapDeps([0,1,2,3,4])),fe}function Ds(e){const[t,s]=r.useState(fe);return r.useEffect(()=>{t||Ge().then(s,()=>s("failed"))},[t]),t==="failed"?a.jsx("p",{className:"p-3 text-xs text-fg-2",children:"The editor did not load. Reload the page to try again."}):t?a.jsx(t.default,{...e}):a.jsx(We,{path:e.path})}function Hs(e){const[t,s]=r.useState(e);return r.useEffect(()=>{if(!e)return;s(e);const n=setTimeout(()=>s(null),ot);return()=>clearTimeout(n)},[e]),e!==null&&t===e}function zs(e,t){const s=t.line?{key:`${e}:${t.line}:${t.end??""}:${t.spot??""}`,line:t.line,side:"new"}:null,n=Hs(s?.key??null);return{reveal:s,focus:rt(t.line,t.end,n)}}function We({path:e}){return a.jsx(ne,{label:`Opening ${e}…`})}function As({task:e,gitRef:t,path:s,label:n}){const[i,o]=r.useState(!1);return a.jsxs("figure",{className:"flex min-w-0 flex-1 flex-col items-center gap-2 p-4",children:[a.jsx("figcaption",{className:"text-2xs text-fg-2",children:n}),a.jsx("img",{src:dt(e.id,t,s),alt:s,onLoad:()=>o(!0),style:{visibility:i?"visible":"hidden"},className:E(ct,"max-h-[60vh] max-w-full bg-[repeating-conic-gradient(var(--bg-2)_0_25%,transparent_0_50%)] bg-[length:16px_16px] object-contain")})]})}function Ks(e,t){return e.tooLarge?`${t} is ${ut(e.size)}, too large to show as text.`:e.binary?`${t} is a binary file, so there is no text to show.`:`There is no ${t} at this point in the history.`}function qs({task:e,refs:t,gitRef:s,source:n,head:i}){const o=[n.basePath&&n.change?.binary&&t.base?{ref:t.base,path:n.basePath,label:"Before"}:null,i?.image&&n.headPath?{ref:s,path:n.headPath,label:n.change?"After":i.path}:null].filter(c=>c!==null);return o.length>0?a.jsx("div",{className:"flex min-h-0 flex-1 flex-wrap justify-center overflow-auto",children:o.map(c=>a.jsx(As,{task:e,gitRef:c.ref,path:c.path,label:c.label},c.label))}):a.jsx(te,{size:"sm",icon:"IconFileText",title:"Nothing to show as text",description:i?Ks(i,n.file.path):`${n.file.path} was deleted.`})}function Gs({split:e,onToggle:t}){const s=e?"Show unified":"Show side by side";return a.jsx(H,{label:s,children:a.jsx(G,{variant:"secondary",size:"icon-sm",icon:e?"IconLayoutTopBottom":"IconLayoutColumn","aria-label":s,onClick:t,className:"max-md:hidden"})})}function Ws({source:e,split:t,showLayout:s,saving:n,toolbar:i,onSplit:o}){const c=e.file.path;return a.jsxs(lt,{className:"gap-1.5",children:[i,a.jsx(J,{name:se(c),size:"sm"}),a.jsx(He,{path:c,className:"min-w-0"}),e.change?.previousPath&&a.jsxs(D,{className:"text-2xs text-fg-2 max-lg:hidden",children:["renamed from ",e.change.previousPath]}),e.change&&!e.change.binary&&a.jsx(he,{added:e.change.additions,removed:e.change.deletions}),a.jsx("span",{className:"flex-1"}),n&&a.jsx("span",{className:"shrink-0 text-2xs text-fg-2",children:"Saving…"}),s&&o&&a.jsx(Gs,{split:t,onToggle:o})]})}function Bs({text:e,readOnly:t}){return a.jsxs("p",{className:"flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-1.5 text-2xs text-fg-2",children:[a.jsx(J,{name:t?"IconLock":"IconCircleInfo",size:"sm"}),a.jsx(D,{children:e})]})}function Us({task:e,refs:t,gitRef:s,source:n,location:i,targets:o,split:c,onSplit:f,handle:h,session:p,toolbar:y}){const m=Fe(),v=n.file.path,b=Ae({task:e,refs:t,gitRef:s,headPath:n.headPath}),w=b.editable&&t.working&&Ns(e,n.headPath),P=oe(e,s,n.headPath),N=oe(e,w?Ie:null,w?n.headPath:null),C=w?N:P,g=oe(e,t.base,n.basePath??n.baselinePath),[S,R]=r.useState(null),O=n.change!==null,T=et(n),u=r.useRef(null),x=tt(u.current,st({headPath:n.headPath,basePath:n.basePath,baselinePath:n.baselinePath,diffing:O,head:C,base:g}));u.current=x;const[I,z]=r.useState(!1),L=x.kind==="text"&&!I?nt(v,[x.content,x.original]):null,l=r.useRef(null),j=r.useCallback(F=>{l.current=F,h.current=F},[h]),k=Vs({taskId:e.id,path:b.editable?n.headPath:null,text:x.kind==="text"?x.content:null,buffer:l}),W=b.editable&&k.state.refusal===null,B=k.state.refusal??k.state.notice??b.reason,U=s===t.head,$=bs({path:v,ref:s,findings:U?e.findings:[],comments:m.comments,composer:S}),A=U?vs(o,v,i.spot):[],{reveal:Q,focus:V}=zs(v,i);function ae(F){return a.jsx(ys,{note:F,task:e,onRemove:m.enabled?m.removeComment:null,onCancel:()=>R(null),onSave:_=>{F.kind==="composer"&&(m.addComment({path:v,side:F.side,line:F.start,endLine:F.endLine,ref:s,text:_}),R(null))}})}return a.jsxs("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[a.jsx(Ws,{source:n,split:c,showLayout:O&&!T&&x.kind==="text",saving:k.state.saving,toolbar:y,onSplit:f}),x.kind==="text"&&B&&!L&&a.jsx(Bs,{text:B,readOnly:!W}),L&&a.jsx(te,{size:"sm",icon:"IconFileText",title:"Opening this file may slow the page",description:L,children:a.jsx(G,{variant:"secondary",size:"sm",onClick:()=>z(!0),children:"Open anyway"})}),x.kind==="waiting"&&a.jsx(We,{path:v}),x.kind==="failed"&&a.jsx("p",{className:"p-3 text-xs text-fg-2",children:x.message}),x.kind==="absent"&&a.jsx(qs,{task:e,refs:t,gitRef:s,source:n,head:x.head}),x.kind==="text"&&!L&&a.jsx(Ds,{path:v,docKey:it(s,n.file),...p?{session:p}:{},content:k.start??x.content,original:x.original,baseline:x.baseline,split:O&&c&&!T,editable:W,notes:$,spots:A,keep:at($,A,i.line,i.end),focus:V,reveal:Q,onComment:m.enabled?(F,_,Y)=>R({side:F,line:_,endLine:Y}):null,onEdit:k.edit,onSave:k.save,renderNote:ae,handle:j})]})}function Qs(e,t=!1){const s=r.useCallback(n=>{const i=window.matchMedia(e);return i.addEventListener("change",n),()=>i.removeEventListener("change",n)},[e]);return r.useSyncExternalStore(s,()=>window.matchMedia(e).matches,()=>t)}const Ne=8,Re=4,Ys=7,pe="flex flex-col px-1 py-1",ge=22,Js="group/tree",Xs=40;function Zs(e){const t=r.useRef(null);return r.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]),{onPointerEnter:()=>{!e||t.current||(t.current=setTimeout(()=>{t.current=null,e()},Xs))},onPointerLeave:()=>{t.current&&clearTimeout(t.current),t.current=null}}}function K({depth:e,guide:t,selected:s=!1,expanded:n,icon:i,children:o,end:c,label:f,className:h,onOpen:p,onPrefetch:y}){const m=r.useRef(!1),v=Zs(y);return a.jsxs("div",{role:"treeitem","aria-selected":s,"aria-expanded":n,"aria-label":f,tabIndex:-1,onPointerDown:b=>{m.current=b.pointerType==="mouse"&&b.button===0&&!b.metaKey&&!b.ctrlKey&&!b.shiftKey,m.current&&(v.onPointerLeave(),p())},onClick:()=>{if(m.current){m.current=!1;return}p()},onPointerEnter:v.onPointerEnter,onPointerLeave:v.onPointerLeave,onFocus:y,onKeyDown:b=>{b.key==="Enter"&&p()},style:{paddingInlineStart:Re+e*Ne},className:E("corner-superellipse/1.125 relative flex h-5.5 w-full shrink-0 cursor-pointer items-center gap-1 rounded-control-sm pe-1.5 text-2xs outline-none select-none",s?"bg-primary-a1 text-fg-4":"text-fg-3 hover:bg-bg-a2 active:bg-bg-a2",h),children:[Array.from({length:e},(b,w)=>a.jsx("span",{"aria-hidden":!0,className:E("pointer-events-none absolute inset-y-0 w-px opacity-0 group-hover/tree:opacity-100",w===t?"bg-fg-1":"bg-bg-a4"),style:{insetInlineStart:Re+w*Ne+Ys-1}},w)),a.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center",children:n!==void 0&&a.jsx(J,{name:"IconChevronDownSmall",size:"sm",className:E(!n&&"-rotate-90")})}),i&&a.jsx(J,{name:i,size:"sm"}),a.jsx("span",{className:"ms-0.5 flex min-w-0 flex-1 items-center gap-1.5",children:o}),c]})}function Be({status:e,muted:t=!1}){return a.jsx(H,{label:ce[e].name,children:a.jsx("span",{className:E("inline-flex w-2 shrink-0 justify-center text-2xs font-medium",t?"text-fg-1":ce[e].className),children:ce[e].letter})})}function Ue({viewed:e,label:t="Viewed",indeterminate:s=!1,onToggle:n}){return a.jsx(bt,{size:"sm","aria-label":t,checked:e,indeterminate:s,onCheckedChange:n,onPointerDown:i=>i.stopPropagation(),onClick:i=>i.stopPropagation()})}function en({file:e,muted:t}){return e.risk!=="high"?null:a.jsx(H,{label:a.jsxs("span",{className:"flex flex-col items-start",children:[a.jsx("span",{className:"text-red-text",children:"High risk"}),e.riskReason&&a.jsx(vt,{children:e.riskReason})]}),children:a.jsx("span",{className:E("size-1.5 shrink-0 rounded-full",t?"bg-fg-1":"bg-red-4")})})}function tn({file:e,comments:t,viewed:s,muted:n,onToggleViewed:i}){return a.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[a.jsx(en,{file:e,muted:n}),t>0&&a.jsx(H,{label:`${Le(t,"comment","comments")} from you`,children:a.jsx("span",{className:E("inline-flex w-fit text-2xs tabular-nums",n?"text-fg-1":"text-primary-text"),children:t})}),e.binary?a.jsx("span",{className:E("text-2xs",n?"text-fg-1":"text-fg-2"),children:"Binary"}):a.jsx(he,{added:e.additions,removed:e.deletions,muted:n}),a.jsx(Be,{status:e.status,muted:n}),a.jsx(Ue,{viewed:s,onToggle:i})]})}const sn=r.memo(function({path:t,name:s,depth:n,guide:i,selected:o,file:c,comments:f,viewed:h,actions:p}){const y=h&&!o;return a.jsx(K,{depth:n,guide:i,selected:o,label:t,icon:se(t),className:E(y&&"text-fg-1 file-icons-muted"),onOpen:()=>p.open(t),onPrefetch:()=>p.prefetch(t),end:c&&a.jsx(tn,{file:c,comments:f,viewed:h,muted:y,onToggleViewed:()=>p.toggleViewed(t)}),children:a.jsx(D,{className:"flex-1",children:s})})});function nn({row:e,guide:t,open:s,state:n,onOpen:i,onMarkViewed:o}){const c=n==="all";return a.jsx(K,{depth:e.depth,guide:t,expanded:s,icon:$e(e.path,s),label:e.path,className:E(c&&"file-icons-muted"),onOpen:i,end:a.jsx(Ue,{viewed:c,indeterminate:n==="some",label:`Viewed: every file in ${e.name}`,onToggle:()=>o(!c)}),children:a.jsx(D,{className:E("flex-1",c?"text-fg-1":"text-fg-2"),children:e.name})})}function an(){return a.jsx("p",{className:"py-1 ps-1 text-2xs text-fg-2",children:"Every file is viewed."})}function rn({hidden:e,onToggle:t}){const s=e?"Show viewed files":"Hide viewed files";return a.jsx(H,{label:s,children:a.jsx(G,{variant:"secondary",size:"icon-xs",icon:e?"IconEyeSlash":"IconEyeOpen","aria-label":"Hide viewed files","aria-pressed":e,className:e?"bg-bg-a3 text-fg-4":void 0,onClick:t})})}function ln({persistId:e,diff:t,activePath:s,commentCounts:n,viewed:i,onToggleViewed:o,onMarkViewed:c,onOpen:f,onPrefetch:h}){const[p,y]=me(e,!1),[m,v]=Me(),b=r.useMemo(()=>ft(t.files,i,m,s),[t.files,i,m,s]),w=r.useMemo(()=>ht(b,p),[b,p]),P=mt(w,s),N=r.useMemo(()=>w.flatMap(u=>u.kind==="file"?[u.path]:[]),[w]),C=Oe(N,s).join(`
|
|
3
3
|
`),g=r.useRef({onOpen:f,onPrefetch:h,onToggleViewed:o});g.current={onOpen:f,onPrefetch:h,onToggleViewed:o};const S=r.useMemo(()=>({open:u=>g.current.onOpen(u),prefetch:u=>g.current.onPrefetch(u),toggleViewed:u=>g.current.onToggleViewed(u)}),[]);r.useEffect(()=>X(()=>{for(const u of C.split(`
|
|
4
4
|
`))u&&S.prefetch(u)}),[C,S]);const R=r.useMemo(()=>xt(t.files),[t.files]),O=r.useMemo(()=>t.files.filter(u=>i.has(u.path)).length,[t.files,i]),T=t.files.length-b.length;return t.files.length===0?a.jsx("p",{className:"px-3 py-2.5 text-2xs text-fg-2",children:"Nothing on this branch differs from its base."}):a.jsxs("div",{className:pe,children:[a.jsxs("div",{className:"flex h-5.5 items-center gap-2 ps-1 text-2xs text-fg-2",children:[a.jsxs("span",{className:"flex-1",children:[Le(t.files.length,"file","files")," ·"," ",m&&T>0?`${T} viewed hidden`:`${O} viewed`]}),a.jsx(he,{added:R.added,removed:R.removed}),a.jsx(rn,{hidden:m,onToggle:v})]}),w.length===0&&a.jsx(an,{}),a.jsx("div",{role:"tree","aria-label":"Changed files",className:"flex flex-col",children:a.jsx(xe,{items:w,rowHeight:ge,keyOf:u=>`${u.kind}:${u.path}`,children:u=>{if(u.kind==="directory"){const x=pt(t.files,u.path);return a.jsx(nn,{row:u,guide:Z(P,u.path),open:!p.has(u.path),state:gt(x,i),onOpen:()=>y(u.path,!p.has(u.path)),onMarkViewed:I=>c(x,I)})}return a.jsx(sn,{path:u.path,name:u.name,depth:u.depth,guide:Z(P,u.path),selected:u.path===s,file:u.file,comments:n.get(u.path)??0,viewed:i.has(u.path),actions:S})}})})]})}const on=64;function cn(e){return e.kind==="entry"?`e:${e.entry.path}`:`${e.kind}:${e.dir}`}function dn({task:e,gitRef:t,activePath:s,changes:n,onOpen:i,onPrefetch:o,onPrefetchFolder:c}){const[f,h]=me(_e(e.id,"code","files"),!0),[p,y]=r.useState(null),m=r.useMemo(()=>p===s?f:new Set([...f,...ve(s??"")]),[f,p,s]),v=r.useMemo(()=>new Map(n.map(l=>[l.path,l])),[n]),b=r.useRef(f);b.current=f,r.useEffect(()=>{for(const l of ve(s??""))b.current.has(l)||h(l,!0);y(s)},[s,h]);const w=yt(e,t,jt(m)),P=wt(w,m),N=r.useRef(null);St(P)&&(N.current={ref:t,rows:P});const C=kt(s),g=N.current?.rows.flatMap(l=>l.kind==="entry"&&l.entry.kind==="file"?[l.entry.path]:[]),S=Oe(g??[],s).join(`
|
|
5
5
|
`),R=r.useRef(o);R.current=o,r.useEffect(()=>X(()=>{for(const l of S.split(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/loader-
|
|
2
|
-
import{_ as qe,a as _,j as $,g4 as ur,g5 as cr,g6 as hr,g7 as fr,g8 as pr,a4 as gr,g9 as mr,ga as mn,gb as vr}from"./index-BzYsYcj3.js";import{t as Ut}from"./index-DMSaWVDU.js";const fi="diffs-container";(()=>{try{return!1}catch{return!1}})();const br=/(?=^From [a-f0-9]+ .+$)/m,pi=/(?=^diff --git)/gm,Sr=new RegExp("(?<=\\n)"),yr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Cr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,gi="header-prefix",mi="header-filename-suffix",vi="header-metadata",sn="header-custom",ge={dark:"pierre-dark",light:"pierre-light"},xr="data-theme-css",kr="data-unsafe-css",Lr="data-diffs-scrollbar-measure",bi="--diffs-scrollbar-gutter-measured",wr=1e5,Er={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Rr=Object.freeze({fromStart:0,fromEnd:0}),vn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Si=Object.freeze([]),Ar={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};let Le,_t=0;var pt=class extends Error{constructor(){super("Highlighter is disposed"),this.name="HighlighterDisposedError"}};function Dr(){return Le}function an(e){return e??Le??"shiki-js"}function Tr(e){if(Le!=null&&Le!==e)throw new Error(`Cannot load the "${e}" highlighter while "${Le}" is in use. Only one highlighter type can be active at a time; dispose every "${Le}" instance (disposeHighlighter() disposes the shared one) before switching.`)}function Hr(e){Tr(e),Le=e,_t++}function Ir(){_t--,_t===0&&(Le=void 0)}const yd=new Map,Cd=new Map,xd=new Map,Mr=new Set;function ln(e=ge){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Fr(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function dn(e){let t;return()=>t??=e().then(n=>(t=n,n),n=>{throw t=void 0,n})}function Pr(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Nr=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},bn=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},zr=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Or(e={}){const t=new Map,n=new Map,i=new Map;let r=0;function o(m,S){if(t.has(m))throw new Nr(m);t.set(m,S)}function a(m,S){return t.has(m)?!1:(t.set(m,S),!0)}function l(m){return t.has(m)}function s(m){const S=n.get(m);if(S!==void 0)return Promise.resolve(S);const C=i.get(m);if(C!==void 0)return C;const y=t.get(m);if(y===void 0&&e.fallbackLoader===void 0)return Promise.reject(new bn(m));const x=r,k=Promise.resolve().then(()=>y!==void 0?y():e.fallbackLoader?.(m)).then(async E=>{if(E===void 0)throw new bn(m);const w=Pr(E),D=e.normalizeTheme===void 0?w:await e.normalizeTheme(w,m);return x===r&&n.set(m,D),i.get(m)===k&&i.delete(m),D}).catch(E=>{throw i.get(m)===k&&i.delete(m),E});return i.set(m,k),k}function u(m){return Promise.all(m.map(S=>s(S)))}function d(m,S){n.set(m,S)}function c(m){for(const[S,C]of m)d(S,C)}function f(m){return n.get(m)}function h(m){const S=[];for(const C of m){const y=n.get(C);if(y===void 0)throw new zr(C);S.push(y)}return S}function g(m){return n.has(m)}function p(m){for(const S of m)if(!n.has(S))return!1;return!0}function v(m){const S=n.get(m);return S!==void 0?S:s(m)}function b(){r++,n.clear(),i.clear()}return{clearResolvedThemes:b,getResolvedOrResolveTheme:v,getResolvedTheme:f,getResolvedThemes:h,hasRegisteredTheme:l,hasResolvedTheme:g,hasResolvedThemes:p,registerTheme:o,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:u,seedResolvedTheme:d,seedResolvedThemes:c}}const Bt=new Map,Sn=new Map,Ur=dn(()=>qe(()=>import("./loader-RFCgyI9b.js"),__vite__mapDeps([0,1,2]))),_r=dn(()=>qe(()=>import("./themes-DCO5gmgj.js"),__vite__mapDeps([3,1,2,4]))),Br=dn(()=>qe(()=>import("./core-BU5nAoHX.js").then(e=>e.M),__vite__mapDeps([5,4,1,2]))),$r=[["editor.lineHighlightBackground","editor.active_line.background"],["editor.selectionBackground","element.selected"],["editor.findMatchBackground","search.match_background"],["editor.findMatchHighlightBackground","search.match_background"],["editorBracketMatch.background","editor.document_highlight.bracket_background"],["editorError.foreground","error"],["editorWarning.foreground","warning"],["editorInfo.foreground","info"],["editorHint.foreground","hint"],["gitDecoration.addedResourceForeground","created","terminal.ansi.green"],["gitDecoration.deletedResourceForeground","deleted","terminal.ansi.red"],["gitDecoration.modifiedResourceForeground","modified","terminal.ansi.blue"]];function yn(e,t){const n="themes"in t?t.themes[0]:t;if(n==null)throw new Error(`Theme "${e}" is an empty Zed theme family.`);const i={...n,name:e},r={};for(const[l,s]of Object.entries(i.style))typeof s=="string"&&(r[l]=s);const o=i.style.players?.[0];o?.cursor!=null&&(r["editorCursor.foreground"]??=o.cursor),o?.selection!=null&&(r["editor.selectionBackground"]??=o.selection);for(const[l,...s]of $r){if(r[l]!=null)continue;const u=s.find(d=>r[d]!=null);u!=null&&(r[l]=r[u])}if(i.cssVariables===!0)r["editor.foreground"]="var(--hls-foreground)",r["editor.background"]="var(--hls-background)";else if(typeof i.cssVariables=="object"){r["editor.foreground"]??=r.text??r.foreground??"foreground",r["editor.background"]??=r.background??"background";const{prefix:l="--hls-",defaults:s}=i.cssVariables;for(const[u,d]of Object.entries(r)){const c=s?.[d];r[u]=`var(${l}${d}${c?`, ${c}`:""})`}}const a=i.appearance==="light"?"light":"dark";return{name:e,type:a,colors:r,zed:i,fg:r["editor.foreground"]??r.text??r.foreground??(a==="light"?"#333333":"#bbbbbb"),bg:r["editor.background"]??r.background??(a==="light"?"#ffffff":"#1e1e1e")}}function Wr(e){let t=Sn.get(e);return t!=null||(t=Or({fallbackLoader:async n=>{if(typeof __DIFFS_WORKER__<"u"?__DIFFS_WORKER__:Fr())throw new Error(`Theme "${n}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedThemes parameter.`);const i=Bt.get(n);if(e==="highlights"){const r=i?.zed??i?.diffs;if(r!=null){const s=await r(),u="default"in s?s.default:s;if("zed"in u&&u.zed!=null)return u;if("style"in u||"themes"in u)return yn(n,u);throw new Error(`Theme "${n}" is a TextMate theme; register a Zed theme with registerCustomTheme(name, loader, 'zed') for Highlights.`)}const o=Ur(),{themes:a}=o instanceof Promise?await o:o,l=a[n];if(l!=null)return yn(n,(await l()).default);if(i?.textmate!=null)throw new Error(`Theme "${n}" is only registered for TextMate; use registerCustomTheme(name, loader, 'zed') for Highlights.`)}else{const r=i?.textmate??i?.diffs;let o;if(r!=null){const d=await r();o="default"in d?d.default:d}else{const d=_r(),{themes:c}=d instanceof Promise?await d:d,f=c.getTheme(n);if(f==null&&i?.zed!=null)throw new Error(`Theme "${n}" is only registered for Zed; use registerCustomTheme(name, loader, 'textmate') for Shiki.`);if(f==null)throw new Error(`No valid theme loader registered for "${n}"`);const h=await f.load();o="default"in h?h.default:h}if("style"in o||"themes"in o)throw new Error(`Theme "${n}" is a Zed theme; use preferredHighlighter: 'highlights' or register a TextMate theme for Shiki.`);const a=Br(),{normalizeTheme:l,createCssVariablesTheme:s}=a instanceof Promise?await a:a;if("cssVariables"in o&&o.cssVariables!=null)return{...o,textmate:l(s(o.cssVariables))};if("textmate"in o&&o.textmate!=null)return{...o,textmate:l(o.textmate)};const u=l(o);return{name:u.name,type:u.type,fg:u.fg,bg:u.bg,colors:u.colors,textmate:u}}throw new Error(`No valid theme loader registered for "${n}"`)},normalizeTheme:(n,i)=>{if(n.name!==i)throw new Error(`resolvedTheme: themeName: ${i} does not match theme.name: ${n.name}`);return n}}),Sn.set(e,t)),t}function $t(e,t=an()){return typeof t!="string"&&t.isDisposed?!1:(typeof t=="string"?Wr(t):t.themeResolver).hasResolvedThemes(ln(e))}let oe;async function Vr(e){const t=an(e);Hr(t);try{if(t==="highlights"){const{HighlightsHighlighter:i}=await qe(async()=>{const{HighlightsHighlighter:r}=await import("./highlights-2GptTPDT.js");return{HighlightsHighlighter:r}},__vite__mapDeps([6,7,1,2,4]));return new i}const{ShikiHighlighter:n}=await qe(async()=>{const{ShikiHighlighter:i}=await import("./shiki-V-uttHoH.js");return{ShikiHighlighter:i}},__vite__mapDeps([8,1,2,7,5,4]));return await n.create(t)}finally{Ir()}}async function un({themes:e,langs:t,preferredHighlighter:n}){yi();const i=oe??=Vr(Dr()??n);let r;try{r=await i}catch(o){throw oe===i&&(oe=void 0),o}if(oe===i&&(oe=r),await Promise.all([r.themeResolver.resolveThemes(e),r.loadLanguages(t)]),r.isDisposed)throw new pt;return r}function yi(){oe!=null&&!("then"in oe)&&oe.isDisposed&&(oe=void 0)}function Ne({theme:e,lang:t,langs:n}={}){yi();const i=oe;if(!(i==null||"then"in i||e!=null&&!$t(e,i)||(t!=null||n!=null)&&!i.hasLoadedLanguages([...t!=null?[t]:[],...n??[]])))return i}async function jr(e){await un(e)}const Oe=new Set;let Ue=null;function Ci(e){Oe.add(e),Ue??=requestAnimationFrame(xi)}function Wt(e){Oe.delete(e)&&Oe.size===0&&Ue!=null&&(cancelAnimationFrame(Ue),Ue=null)}function xi(e){const t=new Set(Oe);Oe.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Oe.size>0?Ue=requestAnimationFrame(xi):Ue=null}function Vt(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const a of r)if(o.delete(a),!i.has(a)&&(!(a in t)||e[a]!==t[a]))return!1;for(const a of Array.from(o))if(!i.has(a))return!1;return!0}function cn(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ki(e,t){const n=e?.theme??ge,i=t?.theme??ge,r=Cn(e),o=Cn(t);return cn(n,i)&&Vt(e,t,["theme","parseDiffOptions"])&&Vt(r,o)}function Cn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function jt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function se(e){return{type:"text",value:e}}function M({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function gt({name:e,width:t=16,height:n=16,properties:i}){return M({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[M({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function Ye(e){return M({tagName:"div",properties:{"data-gutter":""},children:e})}function Gr(e,t,n,i={}){return M({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[M({tagName:"span",properties:{"data-line-number-content":""},children:[se(`${t}`)]})]:void 0})}function ee(e,t,n){return M({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function qr(){return M({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[gt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}const Kr=new Set(["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"]),Xr=new Set(["svg","template","script","style"]),Yr={class:"class",className:"class",id:"id",role:"role",style:"style",tabIndex:"tabindex",tabindex:"tabindex",title:"title"},Zr=/^data-[\w.:-]+$/,Jr=/[<&]/g,Qr=/[\0"&'`]/g,eo={"<":"<","&":"&",'"':""","'":"'","`":"`","\0":"�"},to=256;function we(e){const t=new Map;return Array.isArray(e)?hn(e,t):Li(e,t)}function hn(e,t){let n="";for(const i of e)n+=Li(i,t);return n}function Li(e,t){switch(e.type){case"text":return Ei(e.value);case"element":return no(e,t);case"root":return hn(e.children,t);default:return Ut(e)}}function no(e,t){const{tagName:n}=e;if(n==="span"&&e.children.length===1&&e.children[0].type==="text"&&typeof e.properties?.style=="string"){let a=!0;for(const l in e.properties)if(l!=="style"&&e.properties[l]!=null){a=!1;break}if(a)return`<span ${wi(e.properties.style,t)}>${Ei(e.children[0].value)}</span>`}if(Xr.has(n))return Ut(e);const i=io(e.properties,t);if(i==null)return Ut(e);const r=i===""?`<${n}>`:`<${n} ${i}>`,o=hn(e.children,t);return o===""&&Kr.has(n.toLowerCase())?r:`${r}${o}</${n}>`}function wi(e,t){let n=t.get(e);return n==null&&(n=`style="${Ri(e)}"`,t.size<to&&t.set(e,n)),n}function io(e,t){let n="";for(const i in e){const r=e[i];if(r==null)continue;const o=Yr[i]??(Zr.test(i)?i:void 0);if(o==null)return;if(r===!1||typeof r=="number"&&Number.isNaN(r))continue;const a=i==="style"&&typeof r=="string"?wi(r,t):r===!0?o:`${o}="${Ri(Array.isArray(r)?r.join(" ").trim():String(r))}"`;n+=n===""?a:` ${a}`}return n}function Ei(e){return e.indexOf("<")<0&&e.indexOf("&")<0?e:e.replace(Jr,Ai)}function Ri(e){return e.replace(Qr,Ai)}function Ai(e){return eo[e]}function ro(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ze(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}var oo=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),Wt(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){const n=!(e===this.selectedRange||jt(e??void 0,this.selectedRange??void 0)),i=t?.lineNumberOnly??!1,r=t?.activeLineSide!==this.selectedRangeHighlightSide||i!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!r||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=i,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){const i=e!==this.editorActiveLine,r=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!i&&!r||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&Ze(e.composedPath())||(ue(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:a=!1}=this.options;t==="disabled"&&!a&&n==null&&i==null&&r==null&&o==null||(ue(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(ue(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){ue(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();ue(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);ue(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:a,onLineEnter:l,onLineLeave:s,onTokenClick:u,onTokenEnter:d,onTokenLeave:c,onHunkExpand:f,onMergeConflictActionClick:h}=this.options;switch(e){case"move":{const g=kt(r)&&this.hoveredLine?.lineElement===r.lineElement;ut(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ut(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),d?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(s?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),kt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(lo(r)&&h!=null){h(r);break}if(ao(r)&&f!=null){f(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!kt(r))break;ut(r)&&u!=null&&u(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);a!=null&&r.numberColumn?a({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:a,onTokenClick:l,onTokenEnter:s,onTokenLeave:u,onHunkExpand:d,onMergeConflictActionClick:c,enableGutterUtility:f=!1,enableLineSelection:h=!1,onGutterUtilityClick:g}=this.options,p=g!=null,v=n!=="disabled"||i!=null||r!=null||o!=null||a!=null||l!=null||s!=null||u!=null||d!=null||c!=null||f||h||p;v&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,ue(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const S=[];return(t==="both"||t==="click")&&(i!=null&&S.push("onLineClick"),r!=null&&S.push("onLineNumberClick"),d!=null&&S.push("expandable hunk separators"),c!=null&&S.push("merge conflict actions")),S})()),ue(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),ue(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!v&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const b=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",m=this.pointerSession.mode==="gutterSelecting";(!h&&b||!p&&m)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();Ze(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:a}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const s=l.start<=l.end?a>=l.start:a<=l.end;this.selectionAnchor={lineNumber:s?this.selectedRange.start:this.selectedRange.end,side:s?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{onGutterUtilityClick:t}=this.options;if(t==null)return;const n=this.currentSelectionEnds(),i=n?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=n?.top??i;i==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:i},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const n={lineNumber:t.lineNumber,side:t.eventSide};if(ro(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{const{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(n.current=i,this.updateSelection(i.lineNumber,i.side));const r=this.buildSelectedLineRange(n.anchor,n.current);t?.({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=we(qr());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);We(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(_e(r));if(We(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(We(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(We(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Ze(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=_e(e);if(t&&Ze(n))return;const i=co(e);return i!=null?_e(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=ho(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute("data-line")||t.hasAttribute("data-column-number")))return _e(t);const n=po(fo(e));if(n==null)return;const i=this.targetForSelectionPoint(n);return i!=null?_e(i.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=Ln(t)?t:Ln(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,a=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(a,e,o,t)}jt(i??void 0,r??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,Ci(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;const i=this.getIndexesFromSelection(e.range,t);if(i==null)throw console.error({rowRange:i,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return i}getLineRenderColumns(e,t,n,i){if(this.pre==null||t==null&&i==null)return[];const{children:r}=this.pre;if(r.length>2)throw console.error(r),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const o=[];for(const a of r){const l=a.hasAttribute("data-deletions")?"deletions":a.hasAttribute("data-additions")?"additions":void 0,s=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),u=n!=null&&i!=null&&(n.highlightSide==null||l==null||n.highlightSide===l);if(!s&&!u)continue;const[d,c]=a.children;if(!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(c.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:c,gutter:d,renderEditorActiveLine:u,renderSelectedLines:s})}return o}renderSelection=()=>{Wt(this.renderSelection);const e=this.getSelectionRenderState();if(this.pre==null)return;const{editorActiveLine:t,selectedLines:n}=e,i=!wn(this.renderedSelectedLinesState,n),r=!wn(this.renderedEditorActiveLineState,t);if(!i&&!r)return;i&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);const o=this.pre.getAttribute("data-diff-type")==="split",a=i?this.resolveLineRenderRange(n,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,s=this.getLineRenderColumns(i?n:void 0,a,r?t:void 0,l),u=n.range==null||s.some(p=>p.renderSelectedLines),d=t.range==null||s.some(p=>p.renderEditorActiveLine);if(i)for(const p of this.pre.querySelectorAll("[data-selected-line]"))p.removeAttribute("data-selected-line");if(r)for(const p of this.pre.querySelectorAll("[data-editor-active-line]"))p.removeAttribute("data-editor-active-line");const c=a==null?void 0:Math.min(a.start,a.end),f=a==null?void 0:Math.max(a.start,a.end),h=c===f,g=l?.start;for(const p of s){const{content:v,gutter:b,renderEditorActiveLine:m,renderSelectedLines:S}=p,C=Math.max(S?f??-1/0:-1/0,m?g??-1/0:-1/0),y=v.children.length;for(let x=0;x<y;x++){const k=v.children[x],E=b.children[x];if(!(k instanceof HTMLElement)||!(E instanceof HTMLElement))continue;const w=this.parseLineIndex(k,o);if((w??0)>C)break;if(w!=null){if(S&&c!=null&&f!=null&&w>=c&&w<=f){let D=h?"single":w===c?"first":w===f?"last":"";E.setAttribute("data-selected-line",D),n.lineNumberOnly||(k.setAttribute("data-selected-line",D),E.nextSibling instanceof HTMLElement&&k.nextSibling instanceof HTMLElement&&(k.nextSibling.hasAttribute("data-line-annotation")||k.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(h?(D="last",k.setAttribute("data-selected-line","first")):w===c?D="":w===f&&k.setAttribute("data-selected-line",""),k.nextSibling.setAttribute("data-selected-line",D),E.nextSibling.setAttribute("data-selected-line",D)))}m&&w===g&&(E.setAttribute("data-editor-active-line",""),t.lineNumberOnly||k.setAttribute("data-editor-active-line",""))}}}i&&u&&(this.renderedSelectedLinesState=n),r&&d&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode==="file"?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...n!=null?{side:n}:{},...n!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let t=!1,n,i,r,o,a,l,s,u,d,c;for(const h of e){if(!(h instanceof HTMLElement))continue;if(c==null&&h.hasAttribute("data-merge-conflict-action")){const b=h.getAttribute("data-merge-conflict-action")??void 0,m=h.getAttribute("data-merge-conflict-conflict-index")??void 0,S=m!=null?Number.parseInt(m,10):NaN;uo(b)&&Number.isFinite(S)&&(c={kind:"merge-conflict-action",resolution:b,conflictIndex:S})}if(l==null&&h.hasAttribute("data-char")){l=h;const b=h.getAttribute("data-char");if(b!=null){const m=Number.parseInt(b,10);if(!Number.isNaN(m)){const S=h.textContent??"",C=m+S.length;(S.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(s={tokenElement:l,lineCharStart:m,lineCharEnd:C,tokenText:S});continue}}}const g=a==null?h.getAttribute("data-column-number")??void 0:void 0;if(g!=null){a=h,d=Number.parseInt(g,10),t=!0,n=Rn(h),o=h.getAttribute("data-line-index")??void 0;continue}const p=r==null?h.getAttribute("data-line")??void 0:void 0;if(p!=null){r=h,d=Number.parseInt(p,10),n=Rn(h),o=h.getAttribute("data-line-index")??void 0;continue}if(u==null&&(h.hasAttribute("data-expand-button")||h.hasAttribute("data-unmodified-lines"))){u={hunkIndex:void 0,direction:h.hasAttribute("data-expand-up")?"up":h.hasAttribute("data-expand-down")?"down":"both",all:h.hasAttribute("data-expand-all-button")};continue}const v=u!=null?h.getAttribute("data-expand-index")??void 0:void 0;if(u!=null&&v!=null){const b=Number.parseInt(v,10);Number.isNaN(b)||(u.hunkIndex=b);continue}if(i==null&&h.hasAttribute("data-code")){i=h;break}}if(c!=null)return c;if(u?.hunkIndex!=null)return{type:"line-info",hunkIndex:u.hunkIndex,direction:u.direction,all:u.all};if(r??=o!=null?kn(i,`[data-line][data-line-index="${o}"]`):void 0,a??=o!=null?kn(i,`[data-column-number][data-line-index="${o}"]`):void 0,i==null||r==null||a==null||n==null||d==null||Number.isNaN(d))return;const f=this.parseLineIndex(r,this.isSplitDiff());return s!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:void 0,splitLineIndex:f,...s}:{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:En(n,i),splitLineIndex:f,...s}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:void 0,splitLineIndex:f}:{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:En(n,i),splitLineIndex:f}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const n=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function xn({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:a,onLineNumberClick:l,onTokenClick:s,onTokenEnter:u,onTokenLeave:d,renderGutterUtility:c,__debugPointerEvents:f,enableLineSelection:h,controlledSelection:g,onLineSelected:p,onLineSelectionStart:v,onLineSelectionChange:b,onLineSelectionEnd:m},S,C,y){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:so({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:S,onMergeConflictActionClick:y,onLineClick:r,onLineEnter:o,onLineLeave:a,onLineNumberClick:l,onTokenClick:s,onTokenEnter:u,onTokenLeave:d,__debugPointerEvents:f,enableLineSelection:h,controlledSelection:g,onLineSelected:p,onLineSelectionStart:v,onLineSelectionChange:b,onLineSelectionEnd:m,getLineIndex:C}}function so({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function We(e){return e!=null&&"kind"in e&&e.kind==="line"}function ut(e){return e!=null&&"kind"in e&&e.kind==="token"}function kt(e){return We(e)||ut(e)}function ao(e){return"type"in e&&e.type==="line-info"}function lo(e){return"kind"in e&&e.kind==="merge-conflict-action"}function uo(e){return e==="current"||e==="incoming"||e==="both"}function kn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function _e(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function co(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function ho(e){const t=e.closest('[slot^="annotation-"]'),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName==="SLOT"?e:void 0)?.closest("[data-line-annotation]");return n instanceof HTMLElement?n:void 0}function fo(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function po(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Ln(e){return e!=null&&typeof e.elementFromPoint=="function"}function go(e,t){return e===t||jt(e??void 0,t??void 0)}function wn(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&go(e?.range??null,t.range)}function En(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function Rn(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function ue(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return}console.log(...n)}var mo=class fe{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=fe.resizeObserver??new ResizeObserver(fe.handleSharedResizeEntries);return fe.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=fe.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,{disableAnnotations:n,columnVariables:i="apply"}){const r=new Set,o=i==="apply";let a=0;const l=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(a===2)break;const u=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(u==null)continue;a++;let d=l.get(u);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let c=u.firstElementChild;c instanceof HTMLElement||(c=null),d!=null?(this.observedNodes.set(u,d),l.delete(u),d.numberElement!==c?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),c!=null&&(this.observe(c),l.delete(c),this.observedNodes.set(c,d)),d.numberElement=c,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,So(d,o)):(d={type:"code",codeElement:u,numberElement:c,codeWidth:"auto",numberWidth:0,applyColumnVariables:o},this.observedNodes.set(u,d),this.observe(u),c!=null&&(this.observedNodes.set(c,d),this.observe(c)))}if(a>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),u=new Map;for(const d of s){if(!(d instanceof HTMLElement))continue;const c=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(c)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:c,element:d});continue}let f=u.get(c);f==null&&(f=[],u.set(c,f)),f.push(d)}for(const[d,c]of u){if(c.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,c);continue}const[f,h]=c,g=f.firstElementChild,p=h.firstElementChild;if(!(f instanceof HTMLElement)||!(h instanceof HTMLElement)||!(g instanceof HTMLElement)||!(p instanceof HTMLElement))continue;let v=l.get(g);if(v!=null){this.observedNodes.set(g,v),this.observedNodes.set(p,v),l.delete(g),l.delete(p);continue}const b=g.getBoundingClientRect().height,m=p.getBoundingClientRect().height;v={type:"annotations",column1:{container:f,child:g,childHeight:b},column2:{container:h,child:p,childHeight:m},currentHeight:"auto"},r.add({child1:g,child2:p,item:v,newHeight:Math.max(b,m)})}for(const d of r)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);r.clear()}for(const[s,u]of l)this.unobserve(s),u.type==="code"?yo(u):Co(u);l.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=fe,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),fe.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=fe,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),fe.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:a,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const s=this.observedNodes.get(o);if(s==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(s.type==="annotations"){const u=(()=>{if(o===s.column1.child)return s.column1;if(o===s.column2.child)return s.column2})();if(u==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:s,target:o});continue}u.childHeight=a[0].blockSize,i.add(s)}else if(s.type==="code"){const u=n.get(s)??{},d=l[0].inlineSize;o===s.codeElement?u.codeInlineSize=d:o===s.numberElement&&(u.numberInlineSize=d),n.set(s,u)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?vo(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?bo(i.numberInlineSize):n.numberWidth,a=r!==n.codeWidth,l=o!==n.numberWidth;!a&&!l||(n.codeWidth=r,n.numberWidth=o,n.applyColumnVariables&&Di(n,{codeWidthChanged:a,numberWidthChanged:l}))}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function vo(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function bo(e){return Math.max(Math.ceil(e),0)}function So(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Di(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Ti(e))}function Di(e,{codeWidthChanged:t,numberWidthChanged:n}){const{codeElement:i,codeWidth:r,numberWidth:o}=e;if(t&&i.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),n&&i.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),t||n&&r!=="auto"){const a=typeof r=="number"?Math.max(r-o,0):0;i.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}function Ti(e){e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width")}function yo(e){e.codeElement.isConnected&&Ti(e)}function Co(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}function An(e,t){const n=Array.isArray(e)?e:[e];return t!=null?t.hasLoadedLanguages(n):n.every(i=>i==="text"||i==="ansi"||Mr.has(i))}function Hi(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function xo(e){return M({tagName:"div",children:[M({tagName:"div",children:e.annotations?.map(t=>M({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function ko(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Lo({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return M({tagName:"div",children:[t==="custom"?M({tagName:"slot",properties:{name:sn}}):wo({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Eo(i)]],properties:r})}function wo({name:e,prevName:t,iconType:n}){const i=[M({tagName:"slot",properties:{name:gi}}),gt({name:ko(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(M({tagName:"div",children:[M({tagName:"bdi",children:[se(t)]})],properties:{"data-prev-name":""}})),i.push(gt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(M({tagName:"div",children:[M({tagName:"bdi",children:[se(e)]})],properties:{"data-title":""}})),i.push(M({tagName:"slot",properties:{name:mi}})),M({tagName:"div",children:i,properties:{"data-header-content":""}})}function Eo(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(M({tagName:"span",children:[se(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(M({tagName:"span",children:[se(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(M({tagName:"slot",properties:{name:vi}})),M({tagName:"div",children:t,properties:{"data-metadata":""}})}function Ro(e){return M({tagName:"pre",properties:Ao(e)})}function Ao({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:a,customProperties:l}){return{...l,"data-diff":a==="diff"?"":void 0,"data-file":a==="file"?"":void 0,"data-diff-type":a==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const Me=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",odin:"odin",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",BUCK:"python",BUILD:"python",PACKAGE:"python",WORKSPACE:"python",Tiltfile:"python",bazel:"python",bxl:"python",bzl:"python",bzlmod:"python",star:"python",sky:"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",mts:"typescript",cts:"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 ae(e){const t=Dn(e);if(t!=null)return t;const n=e.split(/[/\\]/).pop()??e;return n===e?"text":Dn(n)??"text"}function Dn(e){if(Me.has(e))return Me.get(e)??"text";if(Object.hasOwn(Fe,e))return Fe[e]??null;const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Me.has(t[1]))return Me.get(t[1])??"text";if(Object.hasOwn(Fe,t[1]))return Fe[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return Me.has(n)?Me.get(n)??"text":Object.hasOwn(Fe,n)?Fe[n]??"text":null}function Do(e,{theme:t,preferredHighlighter:n}){return{langs:Array.isArray(e)?e:[e??"text"],themes:ln(t),preferredHighlighter:an(n)}}function Te(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function Gt(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function te(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const To=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Ho=/^0(?:\.0+)?%?$/;function Io(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function Mo(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function Lt(e){if(e==null)return null;const t=Mo(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=a=>a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function Tn(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||To.test(t))return!0;const n=Io(t);return n!=null&&Ho.test(n)}function Fo(e,t,n){if(t==null||n==null)return!1;const i=Lt(e),r=Lt(t),o=Lt(n);return i==null||r==null||o==null?!1:Math.abs(i-o)<Math.abs(i-r)}const Hn=new WeakMap;function Po(e){const t=Hn.get(e);if(t!=null)return t;const n=e.colors??{},i={...n},r=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,a=n["sideBar.background"]??r,l=n["sideBar.foreground"]??o;re(i,"editor.background",r),re(i,"editor.foreground",o),re(i,"sideBar.background",a),re(i,"sideBar.foreground",l),re(i,"input.background",n["input.background"]??a),re(i,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),re(i,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),re(i,"gitDecoration.addedResourceForeground",wt(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),re(i,"gitDecoration.modifiedResourceForeground",wt(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),re(i,"gitDecoration.deletedResourceForeground",wt(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const s=(Tn(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(Tn(n.focusBorder)?void 0:n.focusBorder);s!=null?i["list.focusOutline"]=s:delete i["list.focusOutline"];const u=n["list.hoverBackground"];u!=null&&(No(u,a)||Fo(u,a,l))&&delete i["list.hoverBackground"];const d=Object.freeze({...e,colors:Object.freeze(i)});return Hn.set(e,d),d}function re(e,t,n){n!=null&&n!==""&&(e[t]=n)}function wt(...e){for(const t of e)if(t!=null&&t!=="")return t}function No(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function zo({theme:e=ge,highlighter:t,prefix:n}){let i="";if(typeof e=="string"){const r=t.getTheme(e),o=Et(r,t);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${te("global")}fg:${o.fg};`,i+=`${te("global")}bg:${o.bg};`,i+=Rt(r,n)}else{let r=t.getTheme(e.dark),o=Et(r,t);i+=`${te("global")}dark:${o.fg};`,i+=`${te("global")}dark-bg:${o.bg};`,i+=Rt(r,"dark"),r=t.getTheme(e.light),o=Et(r,t),i+=`${te("global")}light:${o.fg};`,i+=`${te("global")}light-bg:${o.bg};`,i+=Rt(r,"light")}return i}function Et(e,t){if(t.name==="highlights"&&e.zed?.cssVariables===!0){const n=te("token");return{fg:`var(${n}foreground)`,bg:`var(${n}background)`}}return Po(e)}function Rt(e,t){t=t!=null?`${t}-`:"";let n="";const i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];i!=null&&(n+=`${te("global")}${t}addition-color:${i};`);const r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];r!=null&&(n+=`${te("global")}${t}deletion-color:${r};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${te("global")}${t}modified-color:${o};`),n}function Oo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),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(se(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/loader-BeIW1huH.js","assets/index-DRw_nRXT.js","assets/index-Vhuy6UWU.css","assets/themes-DxQeOWjX.js","assets/index-BEh7N9D3.js","assets/core-D4r3kkys.js","assets/highlights-5Ib9I28J.js","assets/stream-tokenizer-B2pFBuwu.js","assets/shiki-Q9s3qbjg.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as qe,a as _,j as $,g4 as ur,g5 as cr,g6 as hr,g7 as fr,g8 as pr,a4 as gr,g9 as mr,ga as mn,gb as vr}from"./index-DRw_nRXT.js";import{t as Ut}from"./index-BEh7N9D3.js";const fi="diffs-container";(()=>{try{return!1}catch{return!1}})();const br=/(?=^From [a-f0-9]+ .+$)/m,pi=/(?=^diff --git)/gm,Sr=new RegExp("(?<=\\n)"),yr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Cr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,gi="header-prefix",mi="header-filename-suffix",vi="header-metadata",sn="header-custom",ge={dark:"pierre-dark",light:"pierre-light"},xr="data-theme-css",kr="data-unsafe-css",Lr="data-diffs-scrollbar-measure",bi="--diffs-scrollbar-gutter-measured",wr=1e5,Er={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Rr=Object.freeze({fromStart:0,fromEnd:0}),vn={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Si=Object.freeze([]),Ar={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};let Le,_t=0;var pt=class extends Error{constructor(){super("Highlighter is disposed"),this.name="HighlighterDisposedError"}};function Dr(){return Le}function an(e){return e??Le??"shiki-js"}function Tr(e){if(Le!=null&&Le!==e)throw new Error(`Cannot load the "${e}" highlighter while "${Le}" is in use. Only one highlighter type can be active at a time; dispose every "${Le}" instance (disposeHighlighter() disposes the shared one) before switching.`)}function Hr(e){Tr(e),Le=e,_t++}function Ir(){_t--,_t===0&&(Le=void 0)}const yd=new Map,Cd=new Map,xd=new Map,Mr=new Set;function ln(e=ge){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Fr(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function dn(e){let t;return()=>t??=e().then(n=>(t=n,n),n=>{throw t=void 0,n})}function Pr(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Nr=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},bn=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},zr=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Or(e={}){const t=new Map,n=new Map,i=new Map;let r=0;function o(m,S){if(t.has(m))throw new Nr(m);t.set(m,S)}function a(m,S){return t.has(m)?!1:(t.set(m,S),!0)}function l(m){return t.has(m)}function s(m){const S=n.get(m);if(S!==void 0)return Promise.resolve(S);const C=i.get(m);if(C!==void 0)return C;const y=t.get(m);if(y===void 0&&e.fallbackLoader===void 0)return Promise.reject(new bn(m));const x=r,k=Promise.resolve().then(()=>y!==void 0?y():e.fallbackLoader?.(m)).then(async E=>{if(E===void 0)throw new bn(m);const w=Pr(E),D=e.normalizeTheme===void 0?w:await e.normalizeTheme(w,m);return x===r&&n.set(m,D),i.get(m)===k&&i.delete(m),D}).catch(E=>{throw i.get(m)===k&&i.delete(m),E});return i.set(m,k),k}function u(m){return Promise.all(m.map(S=>s(S)))}function d(m,S){n.set(m,S)}function c(m){for(const[S,C]of m)d(S,C)}function f(m){return n.get(m)}function h(m){const S=[];for(const C of m){const y=n.get(C);if(y===void 0)throw new zr(C);S.push(y)}return S}function g(m){return n.has(m)}function p(m){for(const S of m)if(!n.has(S))return!1;return!0}function v(m){const S=n.get(m);return S!==void 0?S:s(m)}function b(){r++,n.clear(),i.clear()}return{clearResolvedThemes:b,getResolvedOrResolveTheme:v,getResolvedTheme:f,getResolvedThemes:h,hasRegisteredTheme:l,hasResolvedTheme:g,hasResolvedThemes:p,registerTheme:o,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:u,seedResolvedTheme:d,seedResolvedThemes:c}}const Bt=new Map,Sn=new Map,Ur=dn(()=>qe(()=>import("./loader-BeIW1huH.js"),__vite__mapDeps([0,1,2]))),_r=dn(()=>qe(()=>import("./themes-DxQeOWjX.js"),__vite__mapDeps([3,1,2,4]))),Br=dn(()=>qe(()=>import("./core-D4r3kkys.js").then(e=>e.M),__vite__mapDeps([5,4,1,2]))),$r=[["editor.lineHighlightBackground","editor.active_line.background"],["editor.selectionBackground","element.selected"],["editor.findMatchBackground","search.match_background"],["editor.findMatchHighlightBackground","search.match_background"],["editorBracketMatch.background","editor.document_highlight.bracket_background"],["editorError.foreground","error"],["editorWarning.foreground","warning"],["editorInfo.foreground","info"],["editorHint.foreground","hint"],["gitDecoration.addedResourceForeground","created","terminal.ansi.green"],["gitDecoration.deletedResourceForeground","deleted","terminal.ansi.red"],["gitDecoration.modifiedResourceForeground","modified","terminal.ansi.blue"]];function yn(e,t){const n="themes"in t?t.themes[0]:t;if(n==null)throw new Error(`Theme "${e}" is an empty Zed theme family.`);const i={...n,name:e},r={};for(const[l,s]of Object.entries(i.style))typeof s=="string"&&(r[l]=s);const o=i.style.players?.[0];o?.cursor!=null&&(r["editorCursor.foreground"]??=o.cursor),o?.selection!=null&&(r["editor.selectionBackground"]??=o.selection);for(const[l,...s]of $r){if(r[l]!=null)continue;const u=s.find(d=>r[d]!=null);u!=null&&(r[l]=r[u])}if(i.cssVariables===!0)r["editor.foreground"]="var(--hls-foreground)",r["editor.background"]="var(--hls-background)";else if(typeof i.cssVariables=="object"){r["editor.foreground"]??=r.text??r.foreground??"foreground",r["editor.background"]??=r.background??"background";const{prefix:l="--hls-",defaults:s}=i.cssVariables;for(const[u,d]of Object.entries(r)){const c=s?.[d];r[u]=`var(${l}${d}${c?`, ${c}`:""})`}}const a=i.appearance==="light"?"light":"dark";return{name:e,type:a,colors:r,zed:i,fg:r["editor.foreground"]??r.text??r.foreground??(a==="light"?"#333333":"#bbbbbb"),bg:r["editor.background"]??r.background??(a==="light"?"#ffffff":"#1e1e1e")}}function Wr(e){let t=Sn.get(e);return t!=null||(t=Or({fallbackLoader:async n=>{if(typeof __DIFFS_WORKER__<"u"?__DIFFS_WORKER__:Fr())throw new Error(`Theme "${n}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedThemes parameter.`);const i=Bt.get(n);if(e==="highlights"){const r=i?.zed??i?.diffs;if(r!=null){const s=await r(),u="default"in s?s.default:s;if("zed"in u&&u.zed!=null)return u;if("style"in u||"themes"in u)return yn(n,u);throw new Error(`Theme "${n}" is a TextMate theme; register a Zed theme with registerCustomTheme(name, loader, 'zed') for Highlights.`)}const o=Ur(),{themes:a}=o instanceof Promise?await o:o,l=a[n];if(l!=null)return yn(n,(await l()).default);if(i?.textmate!=null)throw new Error(`Theme "${n}" is only registered for TextMate; use registerCustomTheme(name, loader, 'zed') for Highlights.`)}else{const r=i?.textmate??i?.diffs;let o;if(r!=null){const d=await r();o="default"in d?d.default:d}else{const d=_r(),{themes:c}=d instanceof Promise?await d:d,f=c.getTheme(n);if(f==null&&i?.zed!=null)throw new Error(`Theme "${n}" is only registered for Zed; use registerCustomTheme(name, loader, 'textmate') for Shiki.`);if(f==null)throw new Error(`No valid theme loader registered for "${n}"`);const h=await f.load();o="default"in h?h.default:h}if("style"in o||"themes"in o)throw new Error(`Theme "${n}" is a Zed theme; use preferredHighlighter: 'highlights' or register a TextMate theme for Shiki.`);const a=Br(),{normalizeTheme:l,createCssVariablesTheme:s}=a instanceof Promise?await a:a;if("cssVariables"in o&&o.cssVariables!=null)return{...o,textmate:l(s(o.cssVariables))};if("textmate"in o&&o.textmate!=null)return{...o,textmate:l(o.textmate)};const u=l(o);return{name:u.name,type:u.type,fg:u.fg,bg:u.bg,colors:u.colors,textmate:u}}throw new Error(`No valid theme loader registered for "${n}"`)},normalizeTheme:(n,i)=>{if(n.name!==i)throw new Error(`resolvedTheme: themeName: ${i} does not match theme.name: ${n.name}`);return n}}),Sn.set(e,t)),t}function $t(e,t=an()){return typeof t!="string"&&t.isDisposed?!1:(typeof t=="string"?Wr(t):t.themeResolver).hasResolvedThemes(ln(e))}let oe;async function Vr(e){const t=an(e);Hr(t);try{if(t==="highlights"){const{HighlightsHighlighter:i}=await qe(async()=>{const{HighlightsHighlighter:r}=await import("./highlights-5Ib9I28J.js");return{HighlightsHighlighter:r}},__vite__mapDeps([6,7,1,2,4]));return new i}const{ShikiHighlighter:n}=await qe(async()=>{const{ShikiHighlighter:i}=await import("./shiki-Q9s3qbjg.js");return{ShikiHighlighter:i}},__vite__mapDeps([8,1,2,7,5,4]));return await n.create(t)}finally{Ir()}}async function un({themes:e,langs:t,preferredHighlighter:n}){yi();const i=oe??=Vr(Dr()??n);let r;try{r=await i}catch(o){throw oe===i&&(oe=void 0),o}if(oe===i&&(oe=r),await Promise.all([r.themeResolver.resolveThemes(e),r.loadLanguages(t)]),r.isDisposed)throw new pt;return r}function yi(){oe!=null&&!("then"in oe)&&oe.isDisposed&&(oe=void 0)}function Ne({theme:e,lang:t,langs:n}={}){yi();const i=oe;if(!(i==null||"then"in i||e!=null&&!$t(e,i)||(t!=null||n!=null)&&!i.hasLoadedLanguages([...t!=null?[t]:[],...n??[]])))return i}async function jr(e){await un(e)}const Oe=new Set;let Ue=null;function Ci(e){Oe.add(e),Ue??=requestAnimationFrame(xi)}function Wt(e){Oe.delete(e)&&Oe.size===0&&Ue!=null&&(cancelAnimationFrame(Ue),Ue=null)}function xi(e){const t=new Set(Oe);Oe.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Oe.size>0?Ue=requestAnimationFrame(xi):Ue=null}function Vt(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const a of r)if(o.delete(a),!i.has(a)&&(!(a in t)||e[a]!==t[a]))return!1;for(const a of Array.from(o))if(!i.has(a))return!1;return!0}function cn(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ki(e,t){const n=e?.theme??ge,i=t?.theme??ge,r=Cn(e),o=Cn(t);return cn(n,i)&&Vt(e,t,["theme","parseDiffOptions"])&&Vt(r,o)}function Cn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function jt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function se(e){return{type:"text",value:e}}function M({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function gt({name:e,width:t=16,height:n=16,properties:i}){return M({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[M({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function Ye(e){return M({tagName:"div",properties:{"data-gutter":""},children:e})}function Gr(e,t,n,i={}){return M({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[M({tagName:"span",properties:{"data-line-number-content":""},children:[se(`${t}`)]})]:void 0})}function ee(e,t,n){return M({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function qr(){return M({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[gt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}const Kr=new Set(["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"]),Xr=new Set(["svg","template","script","style"]),Yr={class:"class",className:"class",id:"id",role:"role",style:"style",tabIndex:"tabindex",tabindex:"tabindex",title:"title"},Zr=/^data-[\w.:-]+$/,Jr=/[<&]/g,Qr=/[\0"&'`]/g,eo={"<":"<","&":"&",'"':""","'":"'","`":"`","\0":"�"},to=256;function we(e){const t=new Map;return Array.isArray(e)?hn(e,t):Li(e,t)}function hn(e,t){let n="";for(const i of e)n+=Li(i,t);return n}function Li(e,t){switch(e.type){case"text":return Ei(e.value);case"element":return no(e,t);case"root":return hn(e.children,t);default:return Ut(e)}}function no(e,t){const{tagName:n}=e;if(n==="span"&&e.children.length===1&&e.children[0].type==="text"&&typeof e.properties?.style=="string"){let a=!0;for(const l in e.properties)if(l!=="style"&&e.properties[l]!=null){a=!1;break}if(a)return`<span ${wi(e.properties.style,t)}>${Ei(e.children[0].value)}</span>`}if(Xr.has(n))return Ut(e);const i=io(e.properties,t);if(i==null)return Ut(e);const r=i===""?`<${n}>`:`<${n} ${i}>`,o=hn(e.children,t);return o===""&&Kr.has(n.toLowerCase())?r:`${r}${o}</${n}>`}function wi(e,t){let n=t.get(e);return n==null&&(n=`style="${Ri(e)}"`,t.size<to&&t.set(e,n)),n}function io(e,t){let n="";for(const i in e){const r=e[i];if(r==null)continue;const o=Yr[i]??(Zr.test(i)?i:void 0);if(o==null)return;if(r===!1||typeof r=="number"&&Number.isNaN(r))continue;const a=i==="style"&&typeof r=="string"?wi(r,t):r===!0?o:`${o}="${Ri(Array.isArray(r)?r.join(" ").trim():String(r))}"`;n+=n===""?a:` ${a}`}return n}function Ei(e){return e.indexOf("<")<0&&e.indexOf("&")<0?e:e.replace(Jr,Ai)}function Ri(e){return e.replace(Qr,Ai)}function Ai(e){return eo[e]}function ro(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ze(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}var oo=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),Wt(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){const n=!(e===this.selectedRange||jt(e??void 0,this.selectedRange??void 0)),i=t?.lineNumberOnly??!1,r=t?.activeLineSide!==this.selectedRangeHighlightSide||i!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!r||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=i,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){const i=e!==this.editorActiveLine,r=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!i&&!r||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&Ze(e.composedPath())||(ue(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:a=!1}=this.options;t==="disabled"&&!a&&n==null&&i==null&&r==null&&o==null||(ue(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(ue(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){ue(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();ue(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);ue(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:a,onLineEnter:l,onLineLeave:s,onTokenClick:u,onTokenEnter:d,onTokenLeave:c,onHunkExpand:f,onMergeConflictActionClick:h}=this.options;switch(e){case"move":{const g=kt(r)&&this.hoveredLine?.lineElement===r.lineElement;ut(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ut(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),d?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(s?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),kt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(lo(r)&&h!=null){h(r);break}if(ao(r)&&f!=null){f(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!kt(r))break;ut(r)&&u!=null&&u(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);a!=null&&r.numberColumn?a({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:a,onTokenClick:l,onTokenEnter:s,onTokenLeave:u,onHunkExpand:d,onMergeConflictActionClick:c,enableGutterUtility:f=!1,enableLineSelection:h=!1,onGutterUtilityClick:g}=this.options,p=g!=null,v=n!=="disabled"||i!=null||r!=null||o!=null||a!=null||l!=null||s!=null||u!=null||d!=null||c!=null||f||h||p;v&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,ue(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const S=[];return(t==="both"||t==="click")&&(i!=null&&S.push("onLineClick"),r!=null&&S.push("onLineNumberClick"),d!=null&&S.push("expandable hunk separators"),c!=null&&S.push("merge conflict actions")),S})()),ue(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),ue(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!v&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const b=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",m=this.pointerSession.mode==="gutterSelecting";(!h&&b||!p&&m)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();Ze(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:a}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const s=l.start<=l.end?a>=l.start:a<=l.end;this.selectionAnchor={lineNumber:s?this.selectedRange.start:this.selectedRange.end,side:s?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{onGutterUtilityClick:t}=this.options;if(t==null)return;const n=this.currentSelectionEnds(),i=n?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=n?.top??i;i==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:i},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const n={lineNumber:t.lineNumber,side:t.eventSide};if(ro(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{const{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(n.current=i,this.updateSelection(i.lineNumber,i.side));const r=this.buildSelectedLineRange(n.anchor,n.current);t?.({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=we(qr());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);We(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(_e(r));if(We(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(We(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(We(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Ze(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=_e(e);if(t&&Ze(n))return;const i=co(e);return i!=null?_e(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=ho(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute("data-line")||t.hasAttribute("data-column-number")))return _e(t);const n=po(fo(e));if(n==null)return;const i=this.targetForSelectionPoint(n);return i!=null?_e(i.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=Ln(t)?t:Ln(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,a=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(a,e,o,t)}jt(i??void 0,r??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,Ci(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;const i=this.getIndexesFromSelection(e.range,t);if(i==null)throw console.error({rowRange:i,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return i}getLineRenderColumns(e,t,n,i){if(this.pre==null||t==null&&i==null)return[];const{children:r}=this.pre;if(r.length>2)throw console.error(r),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const o=[];for(const a of r){const l=a.hasAttribute("data-deletions")?"deletions":a.hasAttribute("data-additions")?"additions":void 0,s=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),u=n!=null&&i!=null&&(n.highlightSide==null||l==null||n.highlightSide===l);if(!s&&!u)continue;const[d,c]=a.children;if(!(d instanceof HTMLElement)||!(c instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(c.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:c,gutter:d,renderEditorActiveLine:u,renderSelectedLines:s})}return o}renderSelection=()=>{Wt(this.renderSelection);const e=this.getSelectionRenderState();if(this.pre==null)return;const{editorActiveLine:t,selectedLines:n}=e,i=!wn(this.renderedSelectedLinesState,n),r=!wn(this.renderedEditorActiveLineState,t);if(!i&&!r)return;i&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);const o=this.pre.getAttribute("data-diff-type")==="split",a=i?this.resolveLineRenderRange(n,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,s=this.getLineRenderColumns(i?n:void 0,a,r?t:void 0,l),u=n.range==null||s.some(p=>p.renderSelectedLines),d=t.range==null||s.some(p=>p.renderEditorActiveLine);if(i)for(const p of this.pre.querySelectorAll("[data-selected-line]"))p.removeAttribute("data-selected-line");if(r)for(const p of this.pre.querySelectorAll("[data-editor-active-line]"))p.removeAttribute("data-editor-active-line");const c=a==null?void 0:Math.min(a.start,a.end),f=a==null?void 0:Math.max(a.start,a.end),h=c===f,g=l?.start;for(const p of s){const{content:v,gutter:b,renderEditorActiveLine:m,renderSelectedLines:S}=p,C=Math.max(S?f??-1/0:-1/0,m?g??-1/0:-1/0),y=v.children.length;for(let x=0;x<y;x++){const k=v.children[x],E=b.children[x];if(!(k instanceof HTMLElement)||!(E instanceof HTMLElement))continue;const w=this.parseLineIndex(k,o);if((w??0)>C)break;if(w!=null){if(S&&c!=null&&f!=null&&w>=c&&w<=f){let D=h?"single":w===c?"first":w===f?"last":"";E.setAttribute("data-selected-line",D),n.lineNumberOnly||(k.setAttribute("data-selected-line",D),E.nextSibling instanceof HTMLElement&&k.nextSibling instanceof HTMLElement&&(k.nextSibling.hasAttribute("data-line-annotation")||k.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(h?(D="last",k.setAttribute("data-selected-line","first")):w===c?D="":w===f&&k.setAttribute("data-selected-line",""),k.nextSibling.setAttribute("data-selected-line",D),E.nextSibling.setAttribute("data-selected-line",D)))}m&&w===g&&(E.setAttribute("data-editor-active-line",""),t.lineNumberOnly||k.setAttribute("data-editor-active-line",""))}}}i&&u&&(this.renderedSelectedLinesState=n),r&&d&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode==="file"?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...n!=null?{side:n}:{},...n!==i&&i!=null?{endSide:i}:{}}}resolvePointerTarget(e){let t=!1,n,i,r,o,a,l,s,u,d,c;for(const h of e){if(!(h instanceof HTMLElement))continue;if(c==null&&h.hasAttribute("data-merge-conflict-action")){const b=h.getAttribute("data-merge-conflict-action")??void 0,m=h.getAttribute("data-merge-conflict-conflict-index")??void 0,S=m!=null?Number.parseInt(m,10):NaN;uo(b)&&Number.isFinite(S)&&(c={kind:"merge-conflict-action",resolution:b,conflictIndex:S})}if(l==null&&h.hasAttribute("data-char")){l=h;const b=h.getAttribute("data-char");if(b!=null){const m=Number.parseInt(b,10);if(!Number.isNaN(m)){const S=h.textContent??"",C=m+S.length;(S.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(s={tokenElement:l,lineCharStart:m,lineCharEnd:C,tokenText:S});continue}}}const g=a==null?h.getAttribute("data-column-number")??void 0:void 0;if(g!=null){a=h,d=Number.parseInt(g,10),t=!0,n=Rn(h),o=h.getAttribute("data-line-index")??void 0;continue}const p=r==null?h.getAttribute("data-line")??void 0:void 0;if(p!=null){r=h,d=Number.parseInt(p,10),n=Rn(h),o=h.getAttribute("data-line-index")??void 0;continue}if(u==null&&(h.hasAttribute("data-expand-button")||h.hasAttribute("data-unmodified-lines"))){u={hunkIndex:void 0,direction:h.hasAttribute("data-expand-up")?"up":h.hasAttribute("data-expand-down")?"down":"both",all:h.hasAttribute("data-expand-all-button")};continue}const v=u!=null?h.getAttribute("data-expand-index")??void 0:void 0;if(u!=null&&v!=null){const b=Number.parseInt(v,10);Number.isNaN(b)||(u.hunkIndex=b);continue}if(i==null&&h.hasAttribute("data-code")){i=h;break}}if(c!=null)return c;if(u?.hunkIndex!=null)return{type:"line-info",hunkIndex:u.hunkIndex,direction:u.direction,all:u.all};if(r??=o!=null?kn(i,`[data-line][data-line-index="${o}"]`):void 0,a??=o!=null?kn(i,`[data-column-number][data-line-index="${o}"]`):void 0,i==null||r==null||a==null||n==null||d==null||Number.isNaN(d))return;const f=this.parseLineIndex(r,this.isSplitDiff());return s!=null?this.mode==="file"?{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:void 0,splitLineIndex:f,...s}:{kind:"token",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:En(n,i),splitLineIndex:f,...s}:this.mode==="file"?{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:void 0,splitLineIndex:f}:{kind:"line",lineType:n,lineElement:r,lineNumber:d,numberColumn:t,numberElement:a,side:En(n,i),splitLineIndex:f}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const n=(e.getAttribute("data-line-index")??"").split(",").map(i=>Number.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function xn({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:a,onLineNumberClick:l,onTokenClick:s,onTokenEnter:u,onTokenLeave:d,renderGutterUtility:c,__debugPointerEvents:f,enableLineSelection:h,controlledSelection:g,onLineSelected:p,onLineSelectionStart:v,onLineSelectionChange:b,onLineSelectionEnd:m},S,C,y){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:so({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:S,onMergeConflictActionClick:y,onLineClick:r,onLineEnter:o,onLineLeave:a,onLineNumberClick:l,onTokenClick:s,onTokenEnter:u,onTokenLeave:d,__debugPointerEvents:f,enableLineSelection:h,controlledSelection:g,onLineSelected:p,onLineSelectionStart:v,onLineSelectionChange:b,onLineSelectionEnd:m,getLineIndex:C}}function so({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function We(e){return e!=null&&"kind"in e&&e.kind==="line"}function ut(e){return e!=null&&"kind"in e&&e.kind==="token"}function kt(e){return We(e)||ut(e)}function ao(e){return"type"in e&&e.type==="line-info"}function lo(e){return"kind"in e&&e.kind==="merge-conflict-action"}function uo(e){return e==="current"||e==="incoming"||e==="both"}function kn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function _e(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function co(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function ho(e){const t=e.closest('[slot^="annotation-"]'),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName==="SLOT"?e:void 0)?.closest("[data-line-annotation]");return n instanceof HTMLElement?n:void 0}function fo(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function po(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Ln(e){return e!=null&&typeof e.elementFromPoint=="function"}function go(e,t){return e===t||jt(e??void 0,t??void 0)}function wn(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&go(e?.range??null,t.range)}function En(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function Rn(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function ue(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return}console.log(...n)}var mo=class fe{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=fe.resizeObserver??new ResizeObserver(fe.handleSharedResizeEntries);return fe.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=fe.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,{disableAnnotations:n,columnVariables:i="apply"}){const r=new Set,o=i==="apply";let a=0;const l=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(a===2)break;const u=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(u==null)continue;a++;let d=l.get(u);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let c=u.firstElementChild;c instanceof HTMLElement||(c=null),d!=null?(this.observedNodes.set(u,d),l.delete(u),d.numberElement!==c?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),c!=null&&(this.observe(c),l.delete(c),this.observedNodes.set(c,d)),d.numberElement=c,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,So(d,o)):(d={type:"code",codeElement:u,numberElement:c,codeWidth:"auto",numberWidth:0,applyColumnVariables:o},this.observedNodes.set(u,d),this.observe(u),c!=null&&(this.observedNodes.set(c,d),this.observe(c)))}if(a>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),u=new Map;for(const d of s){if(!(d instanceof HTMLElement))continue;const c=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(c)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:c,element:d});continue}let f=u.get(c);f==null&&(f=[],u.set(c,f)),f.push(d)}for(const[d,c]of u){if(c.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,c);continue}const[f,h]=c,g=f.firstElementChild,p=h.firstElementChild;if(!(f instanceof HTMLElement)||!(h instanceof HTMLElement)||!(g instanceof HTMLElement)||!(p instanceof HTMLElement))continue;let v=l.get(g);if(v!=null){this.observedNodes.set(g,v),this.observedNodes.set(p,v),l.delete(g),l.delete(p);continue}const b=g.getBoundingClientRect().height,m=p.getBoundingClientRect().height;v={type:"annotations",column1:{container:f,child:g,childHeight:b},column2:{container:h,child:p,childHeight:m},currentHeight:"auto"},r.add({child1:g,child2:p,item:v,newHeight:Math.max(b,m)})}for(const d of r)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);r.clear()}for(const[s,u]of l)this.unobserve(s),u.type==="code"?yo(u):Co(u);l.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=fe,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),fe.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=fe,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),fe.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:a,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const s=this.observedNodes.get(o);if(s==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(s.type==="annotations"){const u=(()=>{if(o===s.column1.child)return s.column1;if(o===s.column2.child)return s.column2})();if(u==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:s,target:o});continue}u.childHeight=a[0].blockSize,i.add(s)}else if(s.type==="code"){const u=n.get(s)??{},d=l[0].inlineSize;o===s.codeElement?u.codeInlineSize=d:o===s.numberElement&&(u.numberInlineSize=d),n.set(s,u)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?vo(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?bo(i.numberInlineSize):n.numberWidth,a=r!==n.codeWidth,l=o!==n.numberWidth;!a&&!l||(n.codeWidth=r,n.numberWidth=o,n.applyColumnVariables&&Di(n,{codeWidthChanged:a,numberWidthChanged:l}))}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function vo(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function bo(e){return Math.max(Math.ceil(e),0)}function So(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Di(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Ti(e))}function Di(e,{codeWidthChanged:t,numberWidthChanged:n}){const{codeElement:i,codeWidth:r,numberWidth:o}=e;if(t&&i.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),n&&i.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),t||n&&r!=="auto"){const a=typeof r=="number"?Math.max(r-o,0):0;i.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}function Ti(e){e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width")}function yo(e){e.codeElement.isConnected&&Ti(e)}function Co(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}function An(e,t){const n=Array.isArray(e)?e:[e];return t!=null?t.hasLoadedLanguages(n):n.every(i=>i==="text"||i==="ansi"||Mr.has(i))}function Hi(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function xo(e){return M({tagName:"div",children:[M({tagName:"div",children:e.annotations?.map(t=>M({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function ko(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Lo({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return M({tagName:"div",children:[t==="custom"?M({tagName:"slot",properties:{name:sn}}):wo({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Eo(i)]],properties:r})}function wo({name:e,prevName:t,iconType:n}){const i=[M({tagName:"slot",properties:{name:gi}}),gt({name:ko(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(M({tagName:"div",children:[M({tagName:"bdi",children:[se(t)]})],properties:{"data-prev-name":""}})),i.push(gt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(M({tagName:"div",children:[M({tagName:"bdi",children:[se(e)]})],properties:{"data-title":""}})),i.push(M({tagName:"slot",properties:{name:mi}})),M({tagName:"div",children:i,properties:{"data-header-content":""}})}function Eo(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(M({tagName:"span",children:[se(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(M({tagName:"span",children:[se(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(M({tagName:"slot",properties:{name:vi}})),M({tagName:"div",children:t,properties:{"data-metadata":""}})}function Ro(e){return M({tagName:"pre",properties:Ao(e)})}function Ao({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:a,customProperties:l}){return{...l,"data-diff":a==="diff"?"":void 0,"data-file":a==="file"?"":void 0,"data-diff-type":a==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const Me=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",odin:"odin",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",BUCK:"python",BUILD:"python",PACKAGE:"python",WORKSPACE:"python",Tiltfile:"python",bazel:"python",bxl:"python",bzl:"python",bzlmod:"python",star:"python",sky:"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",mts:"typescript",cts:"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 ae(e){const t=Dn(e);if(t!=null)return t;const n=e.split(/[/\\]/).pop()??e;return n===e?"text":Dn(n)??"text"}function Dn(e){if(Me.has(e))return Me.get(e)??"text";if(Object.hasOwn(Fe,e))return Fe[e]??null;const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Me.has(t[1]))return Me.get(t[1])??"text";if(Object.hasOwn(Fe,t[1]))return Fe[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return Me.has(n)?Me.get(n)??"text":Object.hasOwn(Fe,n)?Fe[n]??"text":null}function Do(e,{theme:t,preferredHighlighter:n}){return{langs:Array.isArray(e)?e:[e??"text"],themes:ln(t),preferredHighlighter:an(n)}}function Te(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function Gt(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function te(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const To=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Ho=/^0(?:\.0+)?%?$/;function Io(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function Mo(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function Lt(e){if(e==null)return null;const t=Mo(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=a=>a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function Tn(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||To.test(t))return!0;const n=Io(t);return n!=null&&Ho.test(n)}function Fo(e,t,n){if(t==null||n==null)return!1;const i=Lt(e),r=Lt(t),o=Lt(n);return i==null||r==null||o==null?!1:Math.abs(i-o)<Math.abs(i-r)}const Hn=new WeakMap;function Po(e){const t=Hn.get(e);if(t!=null)return t;const n=e.colors??{},i={...n},r=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,a=n["sideBar.background"]??r,l=n["sideBar.foreground"]??o;re(i,"editor.background",r),re(i,"editor.foreground",o),re(i,"sideBar.background",a),re(i,"sideBar.foreground",l),re(i,"input.background",n["input.background"]??a),re(i,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),re(i,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),re(i,"gitDecoration.addedResourceForeground",wt(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),re(i,"gitDecoration.modifiedResourceForeground",wt(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),re(i,"gitDecoration.deletedResourceForeground",wt(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const s=(Tn(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(Tn(n.focusBorder)?void 0:n.focusBorder);s!=null?i["list.focusOutline"]=s:delete i["list.focusOutline"];const u=n["list.hoverBackground"];u!=null&&(No(u,a)||Fo(u,a,l))&&delete i["list.hoverBackground"];const d=Object.freeze({...e,colors:Object.freeze(i)});return Hn.set(e,d),d}function re(e,t,n){n!=null&&n!==""&&(e[t]=n)}function wt(...e){for(const t of e)if(t!=null&&t!=="")return t}function No(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function zo({theme:e=ge,highlighter:t,prefix:n}){let i="";if(typeof e=="string"){const r=t.getTheme(e),o=Et(r,t);i+=`color:${o.fg};`,i+=`background-color:${o.bg};`,i+=`${te("global")}fg:${o.fg};`,i+=`${te("global")}bg:${o.bg};`,i+=Rt(r,n)}else{let r=t.getTheme(e.dark),o=Et(r,t);i+=`${te("global")}dark:${o.fg};`,i+=`${te("global")}dark-bg:${o.bg};`,i+=Rt(r,"dark"),r=t.getTheme(e.light),o=Et(r,t),i+=`${te("global")}light:${o.fg};`,i+=`${te("global")}light-bg:${o.bg};`,i+=Rt(r,"light")}return i}function Et(e,t){if(t.name==="highlights"&&e.zed?.cssVariables===!0){const n=te("token");return{fg:`var(${n}foreground)`,bg:`var(${n}background)`}}return Po(e)}function Rt(e,t){t=t!=null?`${t}-`:"";let n="";const i=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];i!=null&&(n+=`${te("global")}${t}addition-color:${i};`);const r=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];r!=null&&(n+=`${te("global")}${t}deletion-color:${r};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${te("global")}${t}modified-color:${o};`),n}function Oo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),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(se(`
|
|
3
3
|
`)),e}const In=new WeakMap;function Ii(e,t=!1){const{htmlStyle:n}=e;if(n!=null){let r=t?In.get(n):void 0;if(r==null){r="";for(const o in n)r+=`${r===""?"":";"}${o}:${n[o]}`;t&&In.set(n,r)}return r}let i=e.color!=null?`color:${e.color}`:"";if(e.bgColor!=null&&(i+=`;background-color:${e.bgColor}`),e.fontStyle!=null){(e.fontStyle&1)!==0&&(i+=";font-style:italic"),(e.fontStyle&2)!==0&&(i+=";font-weight:bold");const r=(e.fontStyle&4)!==0,o=(e.fontStyle&8)!==0;(r||o)&&(i+=`;text-decoration:${r?"underline":""}${r&&o?" ":""}${o?"line-through":""}`)}return i.replace(/^;/,"")}function Mi(e,t,n){let i=!1,r;Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return i||(r=n(),i=!0),Object.getOwnPropertyDescriptor(e,t)?.configurable===!0&&Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}),r},set(o){if(Object.getOwnPropertyDescriptor(e,t)?.configurable===!0)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:o});else{if(Object.isFrozen(e))throw new TypeError(`Cannot assign to read only array index '${t}'`);r=o,i=!0}}})}const Je=Symbol("no-token"),At=Symbol("multiple-tokens");function Fi(e){const t=Uo(e);if(t!=null)return t;let n=Je;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"){_o(s,o);for(const u of s.children)ct(u)}else ct(s);i.push(s),r=[],o=void 0;return}for(const s of r)ct(s);i.push(M({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=s=>{if(s!==Je){if(s===At){n=At;return}if(n===Je){n=s;return}n!==s&&(n=At)}};for(const s of e.children){const u=s.type==="element"?Fi(s):Je;if(l(u),typeof u!="number"){a(),i.push(s);continue}o!=null&&o!==u&&a(),o??=u,r.push(s)}return a(),e.children=i,n}function Uo(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function ct(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)ct(t)}}function _o(e,t){e.properties["data-char"]=t}function Bo(e,{state:t,lazyLineAST:n=!1,cacheHtmlStyles:i=!1,useTokenTransformer:r=!1,mergeWhitespaces:o="always",decorations:a=[],lineOffsets:l=[]}){let s;for(const c of a){const f=s??=new Map,h={...c,start:Mn(c.start,l),end:Mn(c.end,l)},g=Math.min(h.end.line,e.length-1);for(let p=h.start.line;p<=g;p++){let v=f.get(p);v==null&&f.set(p,v=[]),v.push(h)}}const u=(c,f)=>{let h;if(r||o!=="never"){let b="",m=0;for(let S=0;S<c.length;S++){let C=c[S];if(r){const y=C.content.trim();if(y!==""&&y!==C.content){h??=c.slice(0,S);const x=C.content.indexOf(y);x>0&&h.push({content:C.content.slice(0,x),offset:C.offset}),h.push({...C,content:y,offset:C.offset+x});const k=x+y.length;k<C.content.length&&h.push({content:C.content.slice(k),offset:C.offset+k});continue}}else{const y=((C.fontStyle??0)&12)!==0;if(!y&&/^\s+$/.test(C.content)&&S<c.length-1){h??=c.slice(0,S),b===""&&(m=C.offset),b+=C.content;continue}b!==""&&h!=null&&(y?h.push({content:b,offset:m}):C={...C,content:b+C.content,offset:m},b="")}h?.push(C)}}h??=c;const g={type:"element",tagName:t==null?"span":"div",properties:t==null?{class:"line"}:{},children:[]},p=s?.get(f),v=p==null?$o(g,h,r,i):Wo(g,h,p,f,r,i);return r&&v===0&&g.children.push({type:"element",tagName:"br",properties:{},children:[]}),r&&p!=null&&Fi(g),t==null?g:Oo(g,f+1,t)};if(!n)return e.map(u);const d=new Array(e.length);for(let c=0;c<e.length;c++){const f=e[c];Mi(d,c,()=>u(f,c))}return d}function $o(e,t,n,i){let r=0;for(const o of t)o.content!==""&&(e.children.push(Pi(o,Ii(o,i),o.content,r,n)),r+=o.content.length);return r}function Wo(e,t,n,i,r,o){n.length>1&&n.sort((v,b)=>v.start.line!==b.start.line?v.start.line-b.start.line:v.start.character!==b.start.character?v.start.character-b.start.character:v.end.line!==b.end.line?b.end.line-v.end.line:b.end.character-v.end.character);const a=t.reduce((v,b)=>v+b.content.length,0),l=[];for(let v=0;v<n.length;v++){const b=n[v],m={decoration:b,order:v,from:b.start.line===i?b.start.character:0,to:b.end.line===i?b.end.character:a};l.push({position:Math.max(0,Math.min(m.from,a)),range:m,start:!0},{position:Math.max(0,Math.min(m.to,a)),range:m,start:!1})}l.sort((v,b)=>v.position-b.position);const s=[],u=[];let d=0;const c=(v,b)=>{let m=0,S=s.length;for(;m<S;){const C=m+S>>>1;s[C].order<v.order?m=C+1:S=C}b?s.splice(m,0,v):s[m]===v&&s.splice(m,1)},f=()=>{let v=e,b=0;for(const m of s){if(u[b]?.range!==m){u.length=b;const S={type:"element",tagName:"span",properties:{...m.decoration.properties},children:[]};v.children.push(S),u.push({range:m,node:S})}v=u[b++].node}return u.length=b,v};let h=e;const g=v=>{const b=d;for(;l[d]?.position===v;)d++;let m=!1;for(let S=b;S<d;S++){const{range:C,start:y}=l[S];!y&&C.from!==C.to&&v<a&&c(C,!1)}for(let S=b;S<d;S++){const{range:C,start:y}=l[S];y&&C.from<=v&&C.to>=v&&(C.to>v||C.from===v||v===a)&&(c(C,!0),C.from===C.to&&(m=!0))}if(m){f();for(let S=b;S<d;S++){const{range:C,start:y}=l[S];y&&C.from===C.to&&c(C,!1)}}v<a&&(h=f())};let p=0;for(const v of t){if(v.content==="")continue;const b=p,m=b+v.content.length,S=Ii(v,o);for(;p<m;){l[d]?.position===p&&g(p);const C=Math.min(m,l[d]?.position??m);h.children.push(Pi(v,S,p===b&&C===m?v.content:v.content.slice(p-b,C-b),b,r)),p=C}}return l[d]?.position===p&&g(p),p}function Pi(e,t,n,i,r){const o=e.htmlAttrs!=null?{...e.htmlAttrs}:{};return t!==""&&(o.style=t),r&&(o["data-char"]=i),{type:"element",tagName:"span",properties:o,children:[{type:"text",value:n}]}}function Mn(e,t){if(typeof e!="number")return e;let n=0,i=t.length;for(;n+1<i;){const r=n+i>>>1;t[r]<=e?n=r:i=r}return{line:n,character:e-(t[n]??0)}}function Vo(e,t){for(const n of t)e.push(n)}function jo(e,t,n){return{lang:e,...typeof t=="string"?{theme:t}:{themes:t},defaultColor:!1,cssVariablePrefix:te("token"),tokenizeMaxLineLength:n,tokenizeTimeLimit:0}}function Ni(e,t){return e?.getPreferredHighlighter()??t.preferredHighlighter}function Fn(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}const Go="-1,-1";function qo(e){return e?.some(t=>t.lineNumber===0)??!1}function Pn(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function zi(e){return e.startingLine===0&&e.totalLines>0}function Ko(e,t){return e.endsWith(`\r
|
|
4
4
|
`)?t+`\r
|
|
5
5
|
`:e.endsWith("\r")?t+"\r":e.endsWith(`
|