UNPKG

code-server

Version:

Run VS Code on a remote server.

25 lines (24 loc) โ€ข 11.3 kB
import{a as pe}from"./chunk-TCSUPM5X.js";import{a as de}from"./chunk-KU3KRRIP.js";import"./chunk-EVYRJEN4.js";import{a as oe}from"./chunk-CKZWEBBA.js";import"./chunk-UJGYKXFV.js";import"./chunk-SVS6VOAY.js";import"./chunk-7PMLKA6X.js";import"./chunk-OX3BH5OR.js";import"./chunk-EQI6FYDH.js";import"./chunk-KCFSBXDE.js";import"./chunk-OQIZJQUY.js";import"./chunk-WIPFUQZE.js";import{a as ce}from"./chunk-GEXIQSUR.js";import{c as ie,d as T}from"./chunk-IR42YTGA.js";import{o as I}from"./chunk-PKRYIESI.js";import"./chunk-JBQZ5UCE.js";import{B as R,O as K,T as Q,U as Z,V as ee,W as te,X as ae,Y as le,Z as se,p as q,r as J}from"./chunk-VBOJ6TJX.js";import{b as h,d as H,j as D,l as F,m as re,n as ne,o as B}from"./chunk-XDY7PRES.js";import"./chunk-YKM3JX66.js";import"./chunk-ZIJQPUA2.js";import"./chunk-OOJM4CTU.js";var he=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=Z,this.getAccTitle=ee,this.setDiagramTitle=le,this.getDiagramTitle=se,this.getAccDescription=ae,this.setAccDescription=te}static{h(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let s=J,r=R();return I({...s.treemap,...r.treemap??{}})}addNode(s,r){this.nodes.push(s),this.levels.set(s,r),r===0&&(this.outerNodes.push(s),this.root??=s)}getRoot(){return{name:"",children:this.outerNodes}}addClass(s,r){let i=this.classes.get(s)??{id:s,styles:[],textStyles:[]},c=r.replace(/\\,/g,"\xA7\xA7\xA7").replace(/,/g,";").replace(/ยงยงยง/g,",").split(";");c&&c.forEach(l=>{ie(l)&&(i?.textStyles?i.textStyles.push(l):i.textStyles=[l]),i?.styles?i.styles.push(l):i.styles=[l]}),this.classes.set(s,i)}getClasses(){return this.classes}getStylesForClass(s){return this.classes.get(s)?.styles??[]}clear(){Q(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function me(s){if(!s.length)return[];let r=[],i=[];return s.forEach(c=>{let l={name:c.name,children:c.type==="Leaf"?void 0:[]};for(l.classSelector=c?.classSelector,c?.cssCompiledStyles&&(l.cssCompiledStyles=c.cssCompiledStyles),c.type==="Leaf"&&c.value!==void 0&&(l.value=c.value);i.length>0&&i[i.length-1].level>=c.level;)i.pop();if(i.length===0)r.push(l);else{let n=i[i.length-1].node;n.children?n.children.push(l):n.children=[l]}c.type!=="Leaf"&&i.push({node:l,level:c.level})}),r}h(me,"buildHierarchy");var Ce=h((s,r)=>{pe(s,r);let i=[];for(let n of s.TreemapRows??[])n.$type==="ClassDefStatement"&&r.addClass(n.className??"",n.styleText??"");for(let n of s.TreemapRows??[]){let d=n.item;if(!d)continue;let m=n.indent?parseInt(n.indent):0,k=we(d),a=d.classSelector?r.getStylesForClass(d.classSelector):[],N=a.length>0?a:void 0,v={level:m,name:k,type:d.$type,value:d.value,classSelector:d.classSelector,cssCompiledStyles:N};i.push(v)}let c=me(i),l=h((n,d)=>{for(let m of n)r.addNode(m,d),m.children&&m.children.length>0&&l(m.children,d+1)},"addNodesRecursively");l(c,0)},"populate"),we=h(s=>s.name?String(s.name):"","getItemName"),ue={parser:{yy:void 0},parse:h(async s=>{try{let i=await de("treemap",s);H.debug("Treemap AST:",i);let c=ue.parser?.yy;if(!(c instanceof he))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ce(i,c)}catch(r){throw H.error("Error parsing treemap:",r),r}},"parse")},Te=10,z=10,M=25,Le=h((s,r,i,c)=>{let l=c.db,n=l.getConfig(),d=n.padding??Te,m=l.getDiagramTitle(),k=l.getRoot(),{themeVariables:a}=R();if(!k)return;let N=m?30:0,v=oe(r),G=n.nodeWidth?n.nodeWidth*z:960,X=n.nodeHeight?n.nodeHeight*z:500,O=G,Y=X+N;v.attr("viewBox",`0 0 ${O} ${Y}`),K(v,Y,O,n.useMaxWidth);let C;try{let e=n.valueFormat||",";if(e==="$0,0")C=h(t=>"$"+F(",")(t),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){let t=/\.\d+/.exec(e),o=t?t[0]:"";C=h(u=>"$"+F(","+o)(u),"valueFormat")}else if(e.startsWith("$")){let t=e.substring(1);C=h(o=>"$"+F(t||"")(o),"valueFormat")}else C=F(e)}catch(e){H.error("Error creating format function:",e),C=F(",")}let A=B().range(["transparent",a.cScale0,a.cScale1,a.cScale2,a.cScale3,a.cScale4,a.cScale5,a.cScale6,a.cScale7,a.cScale8,a.cScale9,a.cScale10,a.cScale11]),fe=B().range(["transparent",a.cScalePeer0,a.cScalePeer1,a.cScalePeer2,a.cScalePeer3,a.cScalePeer4,a.cScalePeer5,a.cScalePeer6,a.cScalePeer7,a.cScalePeer8,a.cScalePeer9,a.cScalePeer10,a.cScalePeer11]),W=B().range([a.cScaleLabel0,a.cScaleLabel1,a.cScaleLabel2,a.cScaleLabel3,a.cScaleLabel4,a.cScaleLabel5,a.cScaleLabel6,a.cScaleLabel7,a.cScaleLabel8,a.cScaleLabel9,a.cScaleLabel10,a.cScaleLabel11]);m&&v.append("text").attr("x",O/2).attr("y",N/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(m);let j=v.append("g").attr("transform",`translate(0, ${N})`).attr("class","treemapContainer"),ye=re(k).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),U=ne().size([G,X]).paddingTop(e=>e.children&&e.children.length>0?M+z:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?z:0).paddingRight(e=>e.children&&e.children.length>0?z:0).paddingBottom(e=>e.children&&e.children.length>0?z:0).round(!0)(ye),ge=U.descendants().filter(e=>e.children&&e.children.length>0),V=j.selectAll(".treemapSection").data(ge).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);V.append("rect").attr("width",e=>e.x1-e.x0).attr("height",M).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),V.append("clipPath").attr("id",(e,t)=>`clip-section-${r}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",M),V.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,t)=>`treemapSection section${t}`).attr("fill",e=>A(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>fe(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";let t=T({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+";"+t.borderStyles.join(";")}),V.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",M/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(e.depth===0)return"display: none;";let t="dominant-baseline: middle; font-size: 12px; fill:"+W(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",o=T({cssCompiledStyles:e.data.cssCompiledStyles});return t+o.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;let t=D(this),o=e.data.name;t.text(o);let u=e.x1-e.x0,g=6,S;n.showValues!==!1&&e.value?S=u-10-30-10-g:S=u-g-6;let f=Math.max(15,S),p=t.node();if(p.getComputedTextLength()>f){let y=o;for(;y.length>0;){if(y=o.substring(0,y.length-1),y.length===0){t.text("..."),p.getComputedTextLength()>f&&t.text("");break}if(t.text(y+"..."),p.getComputedTextLength()<=f)break}}}),n.showValues!==!1&&V.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",M/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?C(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";let t="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+W(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",o=T({cssCompiledStyles:e.data.cssCompiledStyles});return t+o.labelStyles.replace("color:","fill:")});let Se=U.leaves(),E=j.selectAll(".treemapLeafGroup").data(Se).enter().append("g").attr("class",(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);E.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?A(e.parent.data.name):A(e.data.name)).attr("style",e=>T({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?A(e.parent.data.name):A(e.data.name)).attr("stroke-width",3),E.append("clipPath").attr("id",(e,t)=>`clip-${r}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),E.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{let t="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+W(e.data.name)+";",o=T({cssCompiledStyles:e.data.cssCompiledStyles});return t+o.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,t)=>`url(#clip-${r}-${t})`).text(e=>e.data.name).each(function(e){let t=D(this),o=e.x1-e.x0,u=e.y1-e.y0,g=t.node(),S=4,L=o-2*S,f=u-2*S;if(L<10||f<10){t.style("display","none");return}let p=parseInt(t.style("font-size"),10),w=8,x=28,y=.6,b=6,P=2;for(;g.getComputedTextLength()>L&&p>w;)p--,t.style("font-size",`${p}px`);let $=Math.max(b,Math.min(x,Math.round(p*y))),_=p+P+$;for(;_>f&&p>w&&(p--,$=Math.max(b,Math.min(x,Math.round(p*y))),!($<b&&p===w));)t.style("font-size",`${p}px`),_=p+P+$,$<=b&&_>f;t.style("font-size",`${p}px`),(g.getComputedTextLength()>L||p<w||f<p)&&t.style("display","none")}),n.showValues!==!1&&E.append("text").attr("class","treemapValue").attr("x",t=>(t.x1-t.x0)/2).attr("y",function(t){return(t.y1-t.y0)/2}).attr("style",t=>{let o="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+W(t.data.name)+";",u=T({cssCompiledStyles:t.data.cssCompiledStyles});return o+u.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,o)=>`url(#clip-${r}-${o})`).text(t=>t.value?C(t.value):"").each(function(t){let o=D(this),u=this.parentNode;if(!u){o.style("display","none");return}let g=D(u).select(".treemapLabel");if(g.empty()||g.style("display")==="none"){o.style("display","none");return}let S=parseFloat(g.style("font-size")),L=28,f=.6,p=6,w=2,x=Math.max(p,Math.min(L,Math.round(S*f)));o.style("font-size",`${x}px`);let b=(t.y1-t.y0)/2+S/2+w;o.attr("y",b);let P=t.x1-t.x0,be=t.y1-t.y0-4,ve=P-8;o.node().getComputedTextLength()>ve||b+x>be||x<p?o.style("display","none"):o.style("display",null)});let xe=n.diagramPadding??8;ce(v,xe,"flowchart",n?.useMaxWidth||!1)},"draw"),$e=h(function(s,r){return r.db.getClasses()},"getClasses"),Fe={draw:Le,getClasses:$e},ze={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},Ne=h(({treemap:s}={})=>{let r=q(),i=R(),c=I(r,i.themeVariables),l=I(ze,s),n=l.titleColor??c.titleColor,d=l.labelColor??c.textColor,m=l.valueColor??c.textColor;return` .treemapNode.section { stroke: ${l.sectionStrokeColor}; stroke-width: ${l.sectionStrokeWidth}; fill: ${l.sectionFillColor}; } .treemapNode.leaf { stroke: ${l.leafStrokeColor}; stroke-width: ${l.leafStrokeWidth}; fill: ${l.leafFillColor}; } .treemapLabel { fill: ${d}; font-size: ${l.labelFontSize}; } .treemapValue { fill: ${m}; font-size: ${l.valueFontSize}; } .treemapTitle { fill: ${n}; font-size: ${l.titleFontSize}; } `},"getStyles"),Ae=Ne,Ie={parser:ue,get db(){return new he},renderer:Fe,styles:Ae};export{Ie as diagram};