PageSourceSearch

https://nickz.ai/assets/js/sankeyDiagram-WA2Y5GQK-C6jY7bl2.js

js nickz.ai collected 2026-10-05 14:21:43 UTC 22,046 bytes, 1 lines download raw bytes

1var t,n,e;import{q as i,t as s,s as r,g as o,b as a,a as c,_ as l,c as h,A as u,d as f,ab as y,z as d,k as p}from"./index-C16DHWFp.js";import{o as g}from"./ordinal-BXL5nHgV.js";import"./vendor-react-DejgYtBM.js";import"./vendor-semi-D8d7bTtM.js";import"./index-BeIIFw6E.js";import"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./vendor-katex-BuQuj6Fv.js";import"./dayjs.min-CASHsil8.js";import"./purify.es-Bm-lHtoJ.js";import"./index-DcbB2zxU.js";import"./vendor-highlight-CaHTjBxz.js";import"./index-B_PxGnmD.js";import"./init-C0SZ43gy.js";const _=function(t){for(var n=new Array(10),e=0;e<10;)n[e]="#"+t.slice(6*e,6*++e);return n}("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");function m(t,n){let e;if(void 0===n)for(const i of t)null!=i&&(e<i||void 0===e&&i>=i)&&(e=i);else{let i=-1;for(let s of t)null!=(s=n(s,++i,t))&&(e<s||void 0===e&&s>=s)&&(e=s)}return e}function x(t,n){let e;if(void 0===n)for(const i of t)null!=i&&(e>i||void 0===e&&i>=i)&&(e=i);else{let i=-1;for(let s of t)null!=(s=n(s,++i,t))&&(e>s||void 0===e&&s>=s)&&(e=s)}return e}function k(t,n){let e=0;if(void 0===n)for(let i of t)(i=+i)&&(e+=i);else{let i=-1;for(let s of t)(s=+n(s,++i,t))&&(e+=s)}return e}function v(t){return t.target.depth}function b(t,n){return t.sourceLinks.length?t.depth:n-1}function w(t){return function(){return t}}function S(t,n){return L(t.source,n.source)||t.index-n.index}function E(t,n){return L(t.target,n.target)||t.index-n.index}function L(t,n){return t.y0-n.y0}function A(t){return t.value}function M(t){return t.index}function I(t){return t.nodes}function j(t){return t.links}function T(t,n){const e=t.get(n);if(!e)throw new Error("missing: "+n);return e}function O({nodes:t}){for(const n of t){let t=n.y0,e=t;for(const i of n.sourceLinks)i.y0=t+i.width/2,t+=i.width;for(const i of n.targetLinks)i.y1=e+i.width/2,e+=i.width}}var P=Math.PI,N=2*P,C=1e-6,D=N-C;function $(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function z(){return new $}function F(t){return function(){return t}}function U(t){return t[0]}function W(t){return t[1]}$.prototype=z.prototype={constructor:$,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,i){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+i)},bezierCurveTo:function(t,n,e,i,s,r){this._+="C"+ +t+","+ +n+","+ +e+","+ +i+","+(this._x1=+s)+","+(this._y1=+r)},arcTo:function(t,n,e,i,s){t=+t,n=+n,e=+e,i=+i,s=+s;var r=this._x1,o=this._y1,a=e-t,c=i-n,l=r-t,h=o-n,u=l*l+h*h;if(s<0)throw new Error("negative radius: "+s);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(u>C)if(Math.abs(h*a-c*l)>C&&s){var f=e-r,y=i-o,d=a*a+c*c,p=f*f+y*y,g=Math.sqrt(d),_=Math.sqrt(u),m=s*Math.tan((P-Math.acos((d+u-p)/(2*g*_)))/2),x=m/_,k=m/g;Math.abs(x-1)>C&&(this._+="L"+(t+x*l)+","+(n+x*h)),this._+="A"+s+","+s+",0,0,"+ +(h*f>l*y)+","+(this._x1=t+k*a)+","+(this._y1=n+k*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n)},arc:function(t,n,e,i,s,r){t=+t,n=+n,r=!!r;var o=(e=+e)*Math.cos(i),a=e*Math.sin(i),c=t+o,l=n+a,h=1^r,u=r?i-s:s-i;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+l:(Math.abs(this._x1-c)>C||Math.abs(this._y1-l)>C)&&(this._+="L"+c+","+l),e&&(u<0&&(u=u%N+N),u>D?this._+="A"+e+","+e+",0,1,"+h+","+(t-o)+","+(n-a)+"A"+e+","+e+",0,1,"+h+","+(this._x1=c)+","+(this._y1=l):u>C&&(this._+="A"+e+","+e+",0,"+ +(u>=P)+","+h+","+(this._x1=t+e*Math.cos(s))+","+(this._y1=n+e*Math.sin(s))))},rect:function(t,n,e,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +i+"h"+-e+"Z"},toString:function(){return this._}};var G=Array.prototype.slice;function q(t){return t.source}function V(t){return t.target}function X(t,n,e,i,s){t.moveTo(n,e),t.bezierCurveTo(n=(n+i)/2,e,n,s,i,s)}function Q(t){return[t.source.x1,t.y0]}function R(t){return[t.target.x0,t.y1]}var Y=function(){var t=l(function(t,n,e,i){for(e=e||{},i=t.length;i--;e[t[i]]=n);return e},"o"),n=[1,9],e=[1,10],i=[1,5,10,12],s={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:l(function(t,n,e,i,s,r,o){var a=r.length-1;switch(s){case 7:const t=i.findOrCreateNode(r[a-4].trim().replaceAll('""','"')),n=i.findOrCreateNode(r[a-2].trim().replaceAll('""','"')),e=parseFloat(r[a].trim());i.addLink(t,n,e);break;
1case 8:case 9:case 11:this.$=r[a];break;case 10:this.$=r[a-1]}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:e},{1:[2,6],7:11,10:[1,12]},t(e,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(i,[2,8]),t(i,[2,9]),{19:[1,16]},t(i,[2,11]),{1:[2,1]},{1:[2,5]},t(e,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:e},{15:18,16:7,17:8,18:n,20:e},{18:[1,19]},t(e,[2,3]),{12:[1,20]},t(i,[2,10]),{15:21,16:7,17:8,18:n,20:e},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:l(function(t,n){if(!n.recoverable){var e=new Error(t);throw e.hash=n,e}this.trace(t)},"parseError"),parse:l(function(t){var n=this,e=[0],i=[],s=[null],r=[],o=this.table,a="",c=0,h=0,u=r.slice.call(arguments,1),f=Object.create(this.lexer),y={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(y.yy[d]=this.yy[d]);f.setInput(t,y.yy),y.yy.lexer=f,y.yy.parser=this,void 0===f.yylloc&&(f.yylloc={});var p=f.yylloc;r.push(p);var g=f.options&&f.options.ranges;function _(){var t;return"number"!=typeof(t=i.pop()||f.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,l(function(t){e.length=e.length-2*t,s.length=s.length-t,r.length=r.length-t},"popStack"),l(_,"lex");for(var m,x,k,v,b,w,S,E,L={};;){if(x=e[e.length-1],this.defaultActions[x]?k=this.defaultActions[x]:(null==m&&(m=_()),k=o[x]&&o[x][m]),void 0===k||!k.length||!k[0]){var A;for(b in E=[],o[x])this.terminals_[b]&&b>2&&E.push("'"+this.terminals_[b]+"'");A=f.showPosition?"Parse error on line "+(c+1)+":\n"+f.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(A,{text:f.match,token:this.terminals_[m]||m,line:f.yylineno,loc:p,expected:E})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+m);switch(k[0]){case 1:e.push(m),s.push(f.yytext),r.push(f.yylloc),e.push(k[1]),m=null,h=f.yyleng,a=f.yytext,c=f.yylineno,p=f.yylloc;break;case 2:if(w=this.productions_[k[1]][1],L.$=s[s.length-w],L._$={first_line:r[r.length-(w||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(w||1)].first_column,last_column:r[r.length-1].last_column},g&&(L._$.range=[r[r.length-(w||1)].range[0],r[r.length-1].range[1]]),void 0!==(v=this.performAction.apply(L,[a,h,c,y.yy,k[1],s,r].concat(u))))return v;w&&(e=e.slice(0,-1*w*2),s=s.slice(0,-1*w),r=r.slice(0,-1*w)),e.push(this.productions_[k[1]][0]),s.push(L.$),r.push(L._$),S=o[e[e.length-2]][e[e.length-1]],e.push(S);break;case 3:return!0}}return!0},"parse")},r=function(){return{EOF:1,parseError:l(function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},"parseError"),setInput:l(function(t,n){return this.yy=n||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:l(function(t){var n=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),e.length-1&&(this.yylineno-=e.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:e?(e.length===i.length?this.yylloc.first_column:0)+i[i.length-e.length].length-e[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:l(function(t){this.unput(this.match.slice(t))},"less"),pastInput:l(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var t=this.pastInput(),n=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+n+"^"},"showPosition"),test_match:l(function(t,n){var e,i,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack){for(var r in s)this[r]=s[r];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;var t,n,e,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;r<s.length;r++)if((e=this._input.match(this.rules[s[r]]))&&(!n||e[0].length>n[0].length)){if(n=e,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(e,s[r])))return t;if(this._backtrack){n=!1;continue}return!1}if(!this.options.flex)break}return n?!1!==(t=this.test_match(n,s[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){return this.next()||this.lex()},"lex"),begin:l(function(t){this.conditionStack.push(t)},"begin"),popState:l(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:l(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:l(function(t){this.begin(t)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(t,n,e,i){switch(e){case 0:case 1:return this.pushState("csv"),4;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;case 6:return 20;case 7:return this.popState("escaped_text"),18;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}}}();function o(){this.yy={}}return s.lexer=r,l(o,"Parser"),o.prototype=s,s.Parser=o,new o}();Y.parser=Y;var Z=Y,B=[],K=[],H=new Map,J=l(()=>{B=[],K=[],H=new Map,d()},"clear"),tt=(l(t=class{constructor(t,n,e=0){this.source=t,this.target=n,this.value=e}},"SankeyLink"),t),nt=l((t,n,e)=>{B.push(new tt(t,n,e))},"addLink"),et=(l(n=class{constructor(t){this.ID=t}},"SankeyNode"),n),it=l(t=>{t=p.sanitizeText(t,h());let n=H.get(t);return void 0===n&&(n=new et(t),H.set(t,n),K.push(n)),n},"findOrCreateNode"),st=l(()=>K,"getNodes"),rt=l(()=>B,"getLinks"),ot=l(()=>({nodes:K.map(t=>({id:t.ID})),links:B.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),"getGraph"),at={nodesMap:H,getConfig:l(()=>h().sankey,"getConfig"),getNodes:st,getLinks:rt,getGraph:ot,addLink:nt,findOrCreateNode:it,getAccTitle:c,setAccTitle:a,getAccDescription:o,setAccDescription:r,getDiagramTitle:s,setDiagramTitle:i,clear:J},ct=(l(e=class{static next(t){return new e(t+ ++e.count)}constructor(t){this.id=t,this.href=`#${t}`}
1toString(){return"url("+this.href+")"}},"Uid"),e.count=0,e),lt={left:function(t){return t.depth},right:function(t,n){return n-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?x(t.sourceLinks,v)-1:0},justify:b},ht={draw:l(function(t,n,e,i){const{securityLevel:s,sankey:r}=h(),o=u.sankey;let a;"sandbox"===s&&(a=f("#i"+n));const c=f("sandbox"===s?a.nodes()[0].contentDocument.body:"body"),d="sandbox"===s?c.select(`[id="${n}"]`):f(`[id="${n}"]`),p=r?.width??o.width,v=r?.height??o.width,P=r?.useMaxWidth??o.useMaxWidth,N=r?.nodeAlignment??o.nodeAlignment,C=r?.prefix??o.prefix,D=r?.suffix??o.suffix,$=r?.showValues??o.showValues,Y=i.db.getGraph(),Z=lt[N];(function(){let t,n,e,i=0,s=0,r=1,o=1,a=24,c=8,l=M,h=b,u=I,f=j,y=6;function d(){const d={nodes:u.apply(null,arguments),links:f.apply(null,arguments)};return function({nodes:t,links:n}){for(const[e,s]of t.entries())s.index=e,s.sourceLinks=[],s.targetLinks=[];const i=new Map(t.map((n,e)=>[l(n,e,t),n]));for(const[e,s]of n.entries()){s.index=e;let{source:t,target:n}=s;"object"!=typeof t&&(t=s.source=T(i,t)),"object"!=typeof n&&(n=s.target=T(i,n)),t.sourceLinks.push(s),n.targetLinks.push(s)}if(null!=e)for(const{sourceLinks:s,targetLinks:r}of t)s.sort(e),r.sort(e)}(d),function({nodes:t}){for(const n of t)n.value=void 0===n.fixedValue?Math.max(k(n.sourceLinks,A),k(n.targetLinks,A)):n.fixedValue}(d),function({nodes:t}){const n=t.length;let e=new Set(t),i=new Set,s=0;for(;e.size;){for(const t of e){t.depth=s;for(const{target:n}of t.sourceLinks)i.add(n)}if(++s>n)throw new Error("circular link");e=i,i=new Set}}(d),function({nodes:t}){const n=t.length;let e=new Set(t),i=new Set,s=0;for(;e.size;){for(const t of e){t.height=s;for(const{source:n}of t.targetLinks)i.add(n)}if(++s>n)throw new Error("circular link");e=i,i=new Set}}(d),function(e){const l=function({nodes:t}){const e=m(t,t=>t.depth)+1,s=(r-i-a)/(e-1),o=new Array(e);for(const n of t){const t=Math.max(0,Math.min(e-1,Math.floor(h.call(null,n,e))));n.layer=t,n.x0=i+t*s,n.x1=n.x0+a,o[t]?o[t].push(n):o[t]=[n]}if(n)for(const i of o)i.sort(n);return o}(e);t=Math.min(c,(o-s)/(m(l,t=>t.length)-1)),function(n){const e=x(n,n=>(o-s-(n.length-1)*t)/k(n,A));for(const i of n){let n=s;for(const s of i){s.y0=n,s.y1=n+s.value*e,n=s.y1+t;for(const t of s.sourceLinks)t.width=t.value*e}n=(o-n+t)/(i.length+1);for(let t=0;t<i.length;++t){const e=i[t];e.y0+=n*(t+1),e.y1+=n*(t+1)}C(i)}}(l);for(let t=0;t<y;++t){const n=Math.pow(.99,t),e=Math.max(1-n,(t+1)/y);g(l,n,e),p(l,n,e)}}(d),O(d),d}function p(t,e,i){for(let s=1,r=t.length;s<r;++s){const r=t[s];for(const t of r){let n=0,i=0;for(const{source:e,value:r}of t.targetLinks){let s=r*(t.layer-e.layer);n+=D(e,t)*s,i+=s}if(!(i>0))continue;let s=(n/i-t.y0)*e;t.y0+=s,t.y1+=s,N(t)}void 0===n&&r.sort(L),_(r,i)}}function g(t,e,i){for(let s=t.length-2;s>=0;--s){const r=t[s];for(const t of r){let n=0,i=0;for(const{target:e,value:r}of t.sourceLinks){let s=r*(e.layer-t.layer);n+=$(t,e)*s,i+=s}if(!(i>0))continue;let s=(n/i-t.y0)*e;t.y0+=s,t.y1+=s,N(t)}void 0===n&&r.sort(L),_(r,i)}}function _(n,e){const i=n.length>>1,r=n[i];P(n,r.y0-t,i-1,e),v(n,r.y1+t,i+1,e),P(n,o,n.length-1,e),v(n,s,0,e)}function v(n,e,i,s){for(;i<n.length;++i){const r=n[i],o=(e-r.y0)*s;o>1e-6&&(r.y0+=o,r.y1+=o),e=r.y1+t}}function P(n,e,i,s){for(;i>=0;--i){const r=n[i],o=(r.y1-e)*s;o>1e-6&&(r.y0-=o,r.y1-=o),e=r.y0-t}}function N({sourceLinks:t,targetLinks:n}){if(void 0===e){for(const{source:{sourceLinks:t}}of n)t.sort(E);for(const{target:{targetLinks:n}}of t)n.sort(S)}}function C(t){if(void 0===e)for(const{sourceLinks:n,targetLinks:e}of t)n.sort(E),e.sort(S)}function D(n,e){let i=n.y0-(n.sourceLinks.length-1)*t/2;for(const{target:s,width:r}of n.sourceLinks){if(s===e)break;i+=r+t}for(const{source:t,width:s}of e.targetLinks){if(t===n)break;i-=s}return i}function $(n,e){let i=e.y0-(e.targetLinks.length-1)*t/2;for(const{source:s,width:r}of e.targetLinks){if(s===n)break;i+=r+t}for(const{target:t,width:s}of n.sourceLinks){if(t===e)break;i-=s}return i}return d.update=function(t){return O(t),t},d.nodeId=function(t){return arguments.length?(l="function"==typeof t?t:w(t),d):l},d.nodeAlign=function(t){return arguments.length?(h="function"==typeof t?t:w(t),d):h},d.nodeSort=function(t){return arguments.length?(n=t,d):n},d.nodeWidth=function(t){return arguments.length?(a=+t,d):a},d.nodePadding=function(n){return arguments.length?(c=t=+n,d):c},d.nodes=function(t){return arguments.length?(u="function"==typeof t?t:w(t),d):u},d.links=function(t){return arguments.length?(f="function"==typeof t?t:w(t),d):f},d.linkSort=function(t){return arguments.length?(e=t,d):e},d.size=function(t){return arguments.length?(i=s=0,r=+t[0],o=+t[1],d):[r-i,o-s]},d.extent=function(t){return arguments.length?(i=+t[0][0],r=+t[1][0],s=+t[0][1],o=+t[1][1],d):[[i,s],[r,o]]},d.iterations=function(t){return arguments.length?(y=+t,d):y},d})().nodeId(t=>
1t.id).nodeWidth(10).nodePadding(10+($?15:0)).nodeAlign(Z).extent([[0,0],[p,v]])(Y);const B=g(_);d.append("g").attr("class","nodes").selectAll(".node").data(Y.nodes).join("g").attr("class","node").attr("id",t=>(t.uid=ct.next("node-")).id).attr("transform",function(t){return"translate("+t.x0+","+t.y0+")"}).attr("x",t=>t.x0).attr("y",t=>t.y0).append("rect").attr("height",t=>t.y1-t.y0).attr("width",t=>t.x1-t.x0).attr("fill",t=>B(t.id));const K=l(({id:t,value:n})=>$?`${t}\n${C}${Math.round(100*n)/100}${D}`:t,"getText");d.append("g").attr("class","node-labels").attr("font-size",14).selectAll("text").data(Y.nodes).join("text").attr("x",t=>t.x0<p/2?t.x1+6:t.x0-6).attr("y",t=>(t.y1+t.y0)/2).attr("dy",($?"0":"0.35")+"em").attr("text-anchor",t=>t.x0<p/2?"start":"end").text(K);const H=d.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(Y.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),J=r?.linkColor??"gradient";if("gradient"===J){const t=H.append("linearGradient").attr("id",t=>(t.uid=ct.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",t=>t.source.x1).attr("x2",t=>t.target.x0);t.append("stop").attr("offset","0%").attr("stop-color",t=>B(t.source.id)),t.append("stop").attr("offset","100%").attr("stop-color",t=>B(t.target.id))}let tt;switch(J){case"gradient":tt=l(t=>t.uid,"coloring");break;case"source":tt=l(t=>B(t.source.id),"coloring");break;case"target":tt=l(t=>B(t.target.id),"coloring");break;default:tt=J}H.append("path").attr("d",function(t){var n=q,e=V,i=U,s=W,r=null;function o(){var o,a=G.call(arguments),c=n.apply(this,a),l=e.apply(this,a);if(r||(r=o=z()),t(r,+i.apply(this,(a[0]=c,a)),+s.apply(this,a),+i.apply(this,(a[0]=l,a)),+s.apply(this,a)),o)return r=null,o+""||null}return o.source=function(t){return arguments.length?(n=t,o):n},o.target=function(t){return arguments.length?(e=t,o):e},o.x=function(t){return arguments.length?(i="function"==typeof t?t:F(+t),o):i},o.y=function(t){return arguments.length?(s="function"==typeof t?t:F(+t),o):s},o.context=function(t){return arguments.length?(r=t??null,o):r},o}(X).source(Q).target(R)).attr("stroke",tt).attr("stroke-width",t=>Math.max(1,t.width)),y(void 0,d,0,P)},"draw")},ut=l(t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,"\n").trim(),"prepareTextForParsing"),ft=l(t=>`.label {\n      font-family: ${t.fontFamily};\n    }`,"getStyles"),yt=Z.parse.bind(Z);Z.parse=t=>yt(ut(t));var dt={styles:ft,parser:Z,db:at,renderer:ht};export{dt as diagram};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.