PageSourceSearch

https://kysely.dev/assets/js/3379.595c9032.js

js kysely.dev collected 2026-10-02 02:59:59 UTC 8,782 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkkysely_site=globalThis.webpackChunkkysely_site||[]).push([[3379],{3379(e,t,r){r.r(t),r.d(t,{getEdgesToRender:()=>x,render:()=>b});var n=r(3571),a=r(2201),i=r(3515),o=(r(9321),r(5374),r(1494)),d=(r(9574),r(4634),r(8822),r(3399)),s=r(7694),g=r(1248),l=r(3731),c=r(4071),h=r(781),f=(0,g.K)((e,t,r)=>Math.max(t,Math.min(r,e)),"clamp"),p=(0,g.K)((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),u=(0,g.K)(e=>"flowchart"===e||"flowchart-v2"===e||"stateDiagram"===e,"shouldMergeSelfLoopSegments"),y=(0,g.K)((e,t,r,n,a)=>{const i=[],o=new Set;if(r.forEach(({start:e,end:t})=>{e!==n&&o.add(e),t!==n&&o.add(t)}),o.forEach(t=>{const r=e.node(t);"number"==typeof r?.x&&"number"==typeof r?.y&&i.push(r)}),0===i.length&&r.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{"number"==typeof e?.x&&"number"==typeof e?.y&&i.push(e)})}),0===i.length)return p(a);const d=i.reduce((e,t)=>({x:e.x+t.x/i.length,y:e.y+t.y/i.length}),{x:0,y:0}),s=d.x-t.x,g=d.y-t.y;return Math.abs(s)>Math.abs(g)?s>0?"right":"left":Math.abs(g)>0?g>0?"bottom":"top":p(a)},"getSelfLoopSide"),w=(0,g.K)((e,t="top",r=0,n=0)=>{const a=e.x,i=e.y-r,o=e.width/2,d=e.height/2,s=Math.max(36,Math.min(100,.8*e.width)),g=f(Math.max(n,.35*e.width),36,s),l=f(.45*Math.min(e.width,e.height),24,48);switch(t){case"bottom":{const e=i+d;return[{x:a-g/2,y:e},{x:a-g/2,y:e+l},{x:a+g/2,y:e+l},{x:a+g/2,y:e}]}case"right":{const e=a+o;return[{x:e,y:i-g/2},{x:e+l,y:i-g/2},{x:e+l,y:i+g/2},{x:e,y:i+g/2}]}case"left":{const e=a-o;return[{x:e,y:i-g/2},{x:e-l,y:i-g/2},{x:e-l,y:i+g/2},{x:e,y:i+g/2}]}default:{const e=i-d;return[{x:a-g/2,y:e},{x:a-g/2,y:e-l},{x:a+g/2,y:e-l},{x:a+g/2,y:e}]}}},"getSelfLoopPoints"),m=(0,g.K)((e,t,r="top",n=0,a={})=>{const i=e.x,o=e.y-n,d=a.width??0,s=a.height??0;switch(r){case"bottom":return{x:i,y:Math.max(...t.map(e=>e.y))+s/2+4};case"right":return{x:Math.max(...t.map(e=>e.x))+d/2+4,y:o};case"left":return{x:Math.min(...t.map(e=>e.x))-d/2-4,y:o};default:return{x:i,y:Math.min(...t.map(e=>e.y))-s/2-4}}},"getSelfLoopLabelPosition"),x=(0,g.K)((e,t=0,{mergeSelfLoops:r=!0}={})=>{const n=new Map,a=[],i=e.graph()?.rankdir;
1return e.edges().forEach(t=>{const i=e.edge(t);if(r&&i.selfLoop){const e=i.selfLoop.id;n.has(e)||n.set(e,[]),n.get(e).push({edge:i,start:t.v,end:t.w})}else a.push({edge:i,start:t.v,end:t.w})}),n.forEach(r=>{if(3!==r.length)return void r.forEach(e=>a.push(e));r.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);const[n,o,d]=r,s=n.edge.originalEdge??o.edge.originalEdge??d.edge.originalEdge??o.edge,g=e.node(s.start);if(!g)return void r.forEach(e=>a.push(e));const l={width:o.edge.width,height:o.edge.height},c=y(e,g,r,s.start,i),h=w(g,c,t,l.width??0),f=m(g,h,c,t,l),p={...o.edge,...s,id:s.id,points:h,start:s.start,end:s.end,x:f.x,y:f.y,width:l.width,height:l.height,labelStyle:o.edge.labelStyle,fromCluster:n.edge.fromCluster??o.edge.fromCluster??d.edge.fromCluster,toCluster:n.edge.toCluster??o.edge.toCluster??d.edge.toCluster};delete p.selfLoop,delete p.originalEdge,a.push({edge:p,start:p.start,end:p.end})}),a},"getEdgesToRender"),R=(0,g.K)(async(e,t,r,d,h,f)=>{s.R.warn("Graph in recursive render:XAX",c.M(t),h);const p=t.graph().rankdir;s.R.trace("Dir in recursive render - dir:",p);const y=e.insert("g").attr("class","root");t.nodes()?s.R.info("Recursive render XXX",t.nodes()):s.R.info("No nodes found for",t),t.edges().length>0&&s.R.info("Recursive edges",t.edge(t.edges()[0]));const w=y.insert("g").attr("class","clusters"),m=y.insert("g").attr("class","edgePaths"),b=y.insert("g").attr("class","edgeLabels"),X=y.insert("g").attr("class","nodes"),L=u(r);await Promise.all(t.nodes().map(async function(e){const a=t.node(e);if(void 0!==h){const r=JSON.parse(JSON.stringify(h.clusterData));s.R.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",r.height,"\nParent cluster",h.height),t.setNode(h.id,r),t.parent(e)||(s.R.trace("Setting parent",e,h.id),t.setParent(e,h.id,r))}if(s.R.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),a?.clusterNode){s.R.info("Cluster identified XBX",e,a.width,t.node(e));const{ranksep:n,nodesep:o}=t.graph();a.graph.setGraph({...a.graph.graph(),ranksep:n+25,nodesep:o});const g=await R(X,a.graph,r,d,t.node(e),f),l=g.elem;(0,i.lC)(a,l),a.diff=g.diff||0,s.R.info("New compound node after recursive render XAX",e,"width",a.width,"height",a.height),(0,i.U7)(l,a)}else t.children(e).length>0?(s.R.trace("Cluster - the non recursive path XBX",e,a.id,a,a.width,"Graph:",t),s.R.trace((0,n.dc)(a.id,t)),n.ju.set(a.id,{id:(0,n.dc)(a.id,t),node:a})):(s.R.trace("Node - the non recursive path XAX",e,X,t.node(e),p),await(0,i.on)(X,t.node(e),{config:f,dir:p}))}));const S=(0,g.K)(async()=>{const e=t.edges().map(async function(e){const r=t.edge(e.v,e.w,e.name);if(s.R.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),s.R.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),s.R.info("Fix",n.ju,"ids:",e.v,e.w,"Translating: ",n.ju.get(e.v),n.ju.get(e.w)),L&&r.selfLoop){if(1!==r.selfLoop.order)return;const e=r.id;return r.id=r.selfLoop.id,await(0,a.jP)(b,r),void(r.id=e)}await(0,a.jP)(b,r)});await Promise.all(e)},"processEdges");await S(),s.R.info("Graph before layout:",JSON.stringify(c.M(t))),s.R.info("############################################# XXX"),s.R.info("###                Layout                 ### XXX"),s.R.info("############################################# XXX"),(0,l.Zp)(t),s.R.info("Graph after layout:",JSON.stringify(c.M(t)));let E=0,{subGraphTitleTotalMargin:v}=(0,o.O)(f);await Promise.all((0,n.sc)(t).map(async function(e){const r=t.node(e);if(s.R.info("Position XBX => "+e+": ("+r.x,","+r.y,") width: ",r.width," height: ",r.height),r?.clusterNode)r.y+=v,s.R.info("A tainted cluster node XBX1",e,r.id,r.width,r.height,r.x,r.y,t.parent(e)),n.ju.get(r.id).node=r,(0,i.U_)(r);else if(t.children(e).length>0){s.R.info("A pure cluster node XBX1",e,r.id,r.x,r.y,r.width,r.height,t.parent(e)),r.height+=v,t.node(r.parentId);const a=r?.padding/2||0,o=r?.labelBBox?.height||0,d=o-a||0;s.R.debug("OffsetY",d,"labelHeight",o,"halfPadding",a),await(0,i.U)(w,r),n.ju.get(r.id).node=r}else{const e=t.node(r.parentId);r.y+=v/2,s.R.info("A regular node XBX1 - using the padding",r.id,"parent",r.parentId,r.width,r.height,r.x,r.y,"offsetY",r.offsetY,"parent",e,e?.offsetY,r),(0,i.U_)(r)}}));const M=v/2;return x(t,M,{mergeSelfLoops:L}
1).forEach(function({edge:e,start:i,end:o}){s.R.info("Edge "+i+" -> "+o+": "+JSON.stringify(e),e),e.points.forEach(e=>e.y+=M);const g=t.node(i),l=t.node(o),c=(0,a.Jo)(m,e,n.ju,r,g,l,d);(0,a.T_)(e,c)}),t.nodes().forEach(function(e){const r=t.node(e);s.R.info(e,r.type,r.diff),r.isGroup&&(E=r.diff)}),s.R.warn("Returning from recursive render XAX",y,E),{elem:y,diff:E}},"recursiveRender"),b=(0,g.K)(async(e,t)=>{const r=new h.T({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),o=t.select("g");(0,a.g0)(o,e.markers,e.type,e.diagramId),(0,i.gh)(),(0,a.IU)(),(0,i.IU)(),(0,n.IU)(),e.nodes.forEach(e=>{r.setNode(e.id,{...e}),e.parentId&&r.setParent(e.id,e.parentId)}),s.R.debug("Edges:",e.edges),e.edges.forEach(e=>{if(e.start===e.end){const t=e.start,n=t+"---"+t+"---1",a=t+"---"+t+"---2",i=r.node(t);r.setNode(n,{domId:n,id:n,parentId:i.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(n,i.parentId),r.setNode(a,{domId:a,id:a,parentId:i.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(a,i.parentId);const o=structuredClone(e),d=structuredClone(e),s=structuredClone(e),g=structuredClone(e);d.originalEdge=o,d.selfLoop={id:o.id,order:0},s.originalEdge=o,s.selfLoop={id:o.id,order:1},g.originalEdge=o,g.selfLoop={id:o.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=t+"-cyclic-special-1",s.startLabelRight="",s.startLabelLeft="",s.endLabelLeft="",s.endLabelRight="",s.arrowTypeStart="none",s.arrowTypeEnd="none",s.id=t+"-cyclic-special-mid",g.label="",g.startLabelRight="",g.startLabelLeft="",g.arrowTypeStart="none",i.isGroup&&(d.fromCluster=t,g.toCluster=t),g.id=t+"-cyclic-special-2",g.arrowTypeStart="none",r.setEdge(t,n,d,t+"-cyclic-special-0"),r.setEdge(n,a,s,t+"-cyclic-special-1"),r.setEdge(a,t,g,t+"-cyclic-special-2")}else r.setEdge(e.start,e.end,{...e},e.id)}),s.R.warn("Graph at first:",JSON.stringify(c.M(r))),(0,n.OS)(r),s.R.warn("Graph after XAX:",JSON.stringify(c.M(r)));const g=(0,d.D7)();await R(o,r,e.type,e.diagramId,void 0,g)},"render")}}]);

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.