lookatstudy-mobile 0.12.1

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.
Files changed (77) hide show
  1. package/README.txt +19 -0
  2. package/install-termux.sh +327 -0
  3. package/package.json +10 -0
  4. package/seed-course.json +679 -0
  5. package/server.cjs +495218 -0
  6. package/sql-wasm.wasm +0 -0
  7. package/web/assets/abnfDiagram-N423BO3Z-BFNTWI49.js +1 -0
  8. package/web/assets/api-web-BSU76jU3.js +1 -0
  9. package/web/assets/app-height-D5bf5z0g.js +1 -0
  10. package/web/assets/arc-Ci0WYiAH.js +1 -0
  11. package/web/assets/architectureDiagram-T3A2C74G-DX5jRTha.js +36 -0
  12. package/web/assets/blockDiagram-VBNYF7ZC-DjzKFpxY.js +132 -0
  13. package/web/assets/c4Diagram-5PPSVZJV-CIG-Sdcg.js +10 -0
  14. package/web/assets/channel-BmMZwizg.js +1 -0
  15. package/web/assets/chunk-2GRJ4B5K-D1h0uIyK.js +1 -0
  16. package/web/assets/chunk-2Q5K7J3B-cLoZ93yC.js +1 -0
  17. package/web/assets/chunk-5RXB4S5H-CSaMcbxs.js +231 -0
  18. package/web/assets/chunk-5VM5RSS4-JLvS-B89.js +15 -0
  19. package/web/assets/chunk-6Q2QTUOP-DXM7xtsH.js +88 -0
  20. package/web/assets/chunk-GF5L2VYU-BMXbp2Lo.js +206 -0
  21. package/web/assets/chunk-JWPE2WC7-DPQPMhNL.js +1 -0
  22. package/web/assets/chunk-KBJHAD2P-Bh3aU5gZ.js +1 -0
  23. package/web/assets/chunk-RYQCIY6F-wL-LEvWn.js +1 -0
  24. package/web/assets/chunk-XXDRQBXY-BPEP-05C.js +1 -0
  25. package/web/assets/classDiagram-JCYQIIEL-vXvWKIQn.js +1 -0
  26. package/web/assets/classDiagram-v2-OCEON4UE-vXvWKIQn.js +1 -0
  27. package/web/assets/cose-bilkent-JH36ORCC-CIy59RcY.js +1 -0
  28. package/web/assets/cynefin-VYW2F7L2-jbV2BJ_V.js +178 -0
  29. package/web/assets/cynefinDiagram-MW4NZA55-Cc7aMDYj.js +62 -0
  30. package/web/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
  31. package/web/assets/dagre-VZM6K2ZE-Dsdu5Zt7.js +4 -0
  32. package/web/assets/defaultLocale-DX6XiGOO.js +1 -0
  33. package/web/assets/diagram-7IWD3JNH-DJ4Yft6o.js +30 -0
  34. package/web/assets/diagram-B4RE2ZJO-CBh3xkIP.js +3 -0
  35. package/web/assets/diagram-LBJQPF4R-C-Iljnoj.js +24 -0
  36. package/web/assets/diagram-Q27KOJAE-8HHiRyk2.js +24 -0
  37. package/web/assets/diagram-UB23O5K3-C3K2kFAQ.js +41 -0
  38. package/web/assets/ebnfDiagram-BXEA7PRR-r1mdnIKj.js +1 -0
  39. package/web/assets/erDiagram-JOGREHBK-dYLNtxz3.js +85 -0
  40. package/web/assets/flowDiagram-UKHOOZJN-BYDIRoMm.js +156 -0
  41. package/web/assets/ganttDiagram-PKOTCBZU-CnCtvDzl.js +292 -0
  42. package/web/assets/gitGraphDiagram-DS77QQ5N-rG8kwFmL.js +106 -0
  43. package/web/assets/graph-C9eacEi8.js +1 -0
  44. package/web/assets/index-132uBtFQ.css +1 -0
  45. package/web/assets/index-CG9cZjNC.js +548 -0
  46. package/web/assets/infoDiagram-6WML65LV-BTcUhfqr.js +2 -0
  47. package/web/assets/init-Gi6I4Gst.js +1 -0
  48. package/web/assets/ishikawaDiagram-WSZJBQD7-CJviqcY8.js +70 -0
  49. package/web/assets/journeyDiagram-NVQOT4AX-8JWo64Wa.js +139 -0
  50. package/web/assets/kanban-definition-27J2QSJJ-BHD0yFL_.js +89 -0
  51. package/web/assets/katex-C5jXJg4s.js +257 -0
  52. package/web/assets/layout-DEXfKzaS.js +1 -0
  53. package/web/assets/linear-CT2ADXOb.js +1 -0
  54. package/web/assets/map-Czzmt4hB.js +1 -0
  55. package/web/assets/mermaid.core-DntY_Zhl.js +314 -0
  56. package/web/assets/mindmap-definition-FAOFIHXS-B_yUIQHi.js +96 -0
  57. package/web/assets/ordinal-Cboi1Yqb.js +1 -0
  58. package/web/assets/pegDiagram-VL7TDLO6-BopqqStm.js +1 -0
  59. package/web/assets/pieDiagram-7S7Q4E2Y-Com2ypw6.js +39 -0
  60. package/web/assets/quadrantDiagram-CIZ2JOQS-G0dlgjbr.js +7 -0
  61. package/web/assets/railroadDiagram-AXF67PYL-ChpuDwPP.js +1 -0
  62. package/web/assets/requirementDiagram-LRYGKXZP-CDD5pE1Z.js +84 -0
  63. package/web/assets/sankeyDiagram-W5VNT64P-DO-0GGh4.js +40 -0
  64. package/web/assets/sequenceDiagram-SI44F4Z6-__Qnpiz7.js +162 -0
  65. package/web/assets/sizeCapture-X5ZJPWSS-BxPWVmpa.js +1 -0
  66. package/web/assets/stateDiagram-OKZ733FA-DD0m6rt6.js +1 -0
  67. package/web/assets/stateDiagram-v2-UEYNNEHI-BHOUKhEe.js +1 -0
  68. package/web/assets/swimlanes-SLNWSIFB-m5XzOcas.js +2 -0
  69. package/web/assets/swimlanesDiagram-ULZ7WXOC-Bs3hfWP0.js +8 -0
  70. package/web/assets/timeline-definition-Z64GVDOM-D19Nd7I_.js +120 -0
  71. package/web/assets/vennDiagram-T6HMQDX7-DqFIJV1L.js +34 -0
  72. package/web/assets/wardleyDiagram-T6FBY63Y-CKVK_9QD.js +78 -0
  73. package/web/assets/xychartDiagram-ELKLHX3M-B85Rr0Fa.js +7 -0
  74. package/web/icon-192.png +0 -0
  75. package/web/icon-512.png +0 -0
  76. package/web/index.html +53 -0
  77. package/web/manifest.webmanifest +31 -0
package/sql-wasm.wasm ADDED
Binary file
@@ -0,0 +1 @@
1
+ import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-DXM7xtsH.js";import{p as f}from"./chunk-JWPE2WC7-DPQPMhNL.js";import{_ as n,l as o}from"./mermaid.core-DntY_Zhl.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-jbV2BJ_V.js";import"./index-CG9cZjNC.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var S=(s,e,t)=>e in s?f(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var g=(s,e,t)=>S(s,typeof e!="symbol"?e+"":e,t);const P={listCourses:"course:list",getCourseTree:"course:getTree",importCourseFromRepo:"course:importFromRepo",detectLanguages:"course:detectLanguages",getCourseLanguages:"course:getLanguages",setCourseLanguage:"course:setLanguage",getCourseLanguage:"course:getLanguage",analyzeRepo:"course:analyzeRepo",importAnalyzed:"course:importAnalyzed",importLocalFolder:"import:localFolder",importGithub:"import:github",importCancel:"import:cancel",importResume:"import:resume",importPack:"import:importPack",exportPack:"import:exportPack",generateCourseFromMarkdown:"course:generateFromMarkdown",deleteCourse:"course:delete",restructureCourse:"course:restructure",generateSummaries:"course:generateSummaries",getStarterPrompts:"course:getStarterPrompts",getNodeContent:"course:getNodeContent",getNodeSummary:"course:getNodeSummary",getPracticeForLesson:"course:getPracticeForLesson",getLessonForPractice:"course:getLessonForPractice",listAssetsByNode:"asset:listByNode",listAssetsByCourse:"asset:listByCourse",getAssetDataUrl:"asset:getDataUrl",getProgress:"progress:get",updateProgress:"progress:update",markNodeAttempted:"progress:markAttempted",generateExercise:"exercise:generate",listExercises:"exercise:list",submitExerciseAnswer:"exercise:submit",examPrepare:"exam:prepare",examRegenerate:"exam:regenerate",examGetStatus:"exam:getStatus",examStartAttempt:"exam:startAttempt",examRecordAnswer:"exam:recordAnswer",examSubmitAttempt:"exam:submitAttempt",getDueReviews:"srs:getDue",getAllSrsItems:"srs:getAll",recordReview:"srs:record",getStreak:"streak:get",touchStreakToday:"streak:touchToday",listSouls:"soul:list",getSoul:"soul:get",createSoul:"soul:create",setActiveSoul:"soul:setActive",getActiveSoul:"soul:getActive",agentChat:"agent:chat",abortAgentChat:"agent:abort",getChatHistory:"agent:getHistory",clearChatHistory:"agent:clearHistory",agentChatThread:"agent:chatThread",abortAgentChatThread:"agent:abortThread",getContextUsage:"agent:getContextUsage",getSpeechModelStatus:"speech:getModelStatus",ensureSpeechModel:"speech:ensureModel",deleteSpeechModel:"speech:deleteModel",ttsSpeak:"speech:ttsSpeak",ttsStop:"speech:ttsStop",asrStart:"speech:asrStart",asrFeed:"speech:asrFeed",asrStop:"speech:asrStop",asrCancel:"speech:asrCancel",getAttachmentDataUrl:"attachment:getDataUrl",isAgentReady:"agent:isReady",getProviderPresets:"agent:getProviderPresets",testLlmConnection:"agent:testConnection",testCustomProvider:"agent:testCustomProvider",discoverModels:"agent:discoverModels",discoverProviderModels:"agent:discoverProviderModels",listCustomProviders:"customProvider:list",createCustomProvider:"customProvider:create",updateCustomProvider:"customProvider:update",deleteCustomProvider:"customProvider:delete",listPendingProposals:"proposal:listPending",applyProposal:"proposal:apply",rejectProposal:"proposal:reject",recordQuizAnswer:"quiz:recordAnswer",logFriction:"friction:log",getDashboard:"dashboard:get",searchContent:"search:content",updateMemory:"memory:update",getMemory:"memory:get",consolidateMemory:"consolidate:run",getSetting:"settings:get",setSetting:"settings:set",getXpStatus:"xp:getStatus",exportCourse:"course:export",canvasList:"canvas:list",canvasSave:"canvas:save",canvasDelete:"canvas:delete",canvasTogglePin:"canvas:togglePin",canvasSaveUserNote:"canvas:saveUserNote",canvasRecordQuizResult:"canvas:recordQuizResult",canvasUpdateUserNoteComment:"canvas:updateUserNoteComment",threadList:"thread:list",threadCreate:"thread:create",threadUpdate:"thread:update",threadDelete:"thread:delete",threadGetMessages:"thread:getMessages",threadFindRecentByNode:"thread:findRecentByNode"},h=1,p="ls-serve-token";function y(){const s=new URLSearchParams(window.location.search).get("token");if(s){try{window.localStorage.setItem(p,s)}catch{}return s}try{return window.localStorage.getItem(p)??""}catch{return""}}class m{constructor(){g(this,"ws",null);g(this,"everOpened",!1);g(this,"pending",new Map);g(this,"listeners",new Map);g(this,"connectPromise",null)}connect(){return this.ws&&this.ws.readyState===WebSocket.OPEN?Promise.resolve(this.ws):this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((e,t)=>{const i=window.location.protocol==="https:"?"wss:":"ws:",o=y(),d=`${i}//${window.location.host}/?token=${encodeURIComponent(o)}`;let a=!1;const c=new WebSocket(d);this.ws=c;const u=window.setTimeout(()=>{a||(a=!0,this.connectPromise=null,t(new Error("连接学习服务超时(serve 未启动?)")))},5e3);c.addEventListener("open",()=>{this.everOpened=!0,window.clearTimeout(u),a||(a=!0,this.connectPromise=null,e(c))}),c.addEventListener("message",l=>{let r=null;try{r=JSON.parse(String(l.data))}catch{return}if(!(!r||r.v!==h)){if(r.type==="res"){const n=this.pending.get(r.id);if(!n)return;this.pending.delete(r.id),window.clearTimeout(n.timer),r.ok?n.resolve(r.result):n.reject(new Error(r.error))}else if(r.type==="event"){const n=this.listeners.get(r.channel);if(n)for(const v of n)v(...r.args)}}}),c.addEventListener("close",l=>{if(this.connectPromise=null,this.ws===c&&(this.ws=null),!a){a=!0,window.clearTimeout(u),t(new Error(A(l)));return}const r=l.code===4001?"学习服务拒绝了连接(token 无效)——请用启动时打印的带 token 链接打开":"与服务端的连接已断开";for(const[,n]of this.pending)window.clearTimeout(n.timer),n.reject(new Error(r));if(l.code===4001&&(this.everOpened=!1),this.pending.clear(),l.code===4001){window.dispatchEvent(new CustomEvent(C));return}this.everOpened&&window.setTimeout(()=>void this.connect().catch(()=>{}),2e3)}),c.addEventListener("error",()=>{})}),this.connectPromise)}static float32ToB64(e){const t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);let i="";for(let o=0;o<t.length;o++)i+=String.fromCharCode(t[o]);return btoa(i)}async invoke(e,...t){var d,a;const i=await this.connect(),o=((a=(d=globalThis.crypto)==null?void 0:d.randomUUID)==null?void 0:a.call(d))??String(Math.random()).slice(2);return new Promise((c,u)=>{const l=window.setTimeout(()=>{this.pending.delete(o),u(new Error(`调用 ${e} 超时`))},3e5);this.pending.set(o,{resolve:c,reject:u,timer:l});const r=e==="speech:asrFeed"&&t[0]instanceof Float32Array?[m.float32ToB64(t[0])]:t;i.send(JSON.stringify({v:h,type:"req",id:o,channel:e,args:r}))})}on(e,t){const i=e==="speech:ttsAudio"?(...d)=>{const a=d[0];if(a&&typeof a.wavBase64=="string"){const c=atob(a.wavBase64),u=new Uint8Array(c.length);for(let n=0;n<c.length;n++)u[n]=c.charCodeAt(n);const{wavBase64:l,...r}=a;t({...r,wavBytes:u.buffer})}else t(...d)}:t;let o=this.listeners.get(e);return o||(o=new Set,this.listeners.set(e,o)),o.add(i),this.connect().catch(()=>{}),()=>{o.delete(i)}}}function b(){if(typeof window>"u")return!1;if(new URLSearchParams(window.location.search).get("token"))return!0;try{return!!window.localStorage.getItem(p)}catch{return!1}}function T(s){try{window.localStorage.setItem(p,s)}catch{}const e=new URL(window.location.href);e.searchParams.set("token",s),window.location.replace(e.toString())}const C="ls-web-token-rejected";function A(s){return s.code===4001?"学习服务拒绝了连接(token 无效)——请用启动时打印的带 token 链接打开":"无法连接学习服务(serve 未启动?)"}let w=!1;async function x(){if(w||window.api)return;w=!0;const s=new m,e={};for(const[t,i]of Object.entries(P))e[t]=(...o)=>s.invoke(i,...o);e.on=(t,i)=>s.on(t,i),window.api=e}function L(){return new m}export{C as TOKEN_REJECTED_EVENT,L as createWebTransportForTest,b as hasWebToken,x as installWebApi,T as setWebToken};
@@ -0,0 +1 @@
1
+ function s(){var n;if(typeof window>"u")return;const o=document.documentElement,e=()=>{var i;const t=((i=window.visualViewport)==null?void 0:i.height)??window.innerHeight;o.style.setProperty("--app-height",`${t}px`)};e();for(const t of[100,300,800])window.setTimeout(e,t);(n=window.visualViewport)==null||n.addEventListener("resize",e),window.addEventListener("orientationchange",e,{passive:!0}),window.addEventListener("resize",e,{passive:!0})}export{s as installAppHeight};
@@ -0,0 +1 @@
1
+ import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-DntY_Zhl.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
@@ -0,0 +1,36 @@
1
+ import{p as qe}from"./chunk-JWPE2WC7-DPQPMhNL.js";import{_ as ct,D as Qe,W as Je,l as Fe,b as Ke,a as je,n as _e,o as tr,g as er,s as rr,p as ir,A as ar,y as nr,B as or,c as Ee,a$ as Te,ai as pe,i as sr,d as hr,q as lr,aj as fr,b7 as cr}from"./mermaid.core-DntY_Zhl.js";import{p as gr}from"./cynefin-VYW2F7L2-jbV2BJ_V.js";import{c as be}from"./cytoscape.esm-DTSO7Bv0.js";import{g as ur}from"./index-CG9cZjNC.js";var he={exports:{}},le={exports:{}},fe={exports:{}},dr=fe.exports,De;function vr(){return De||(De=1,(function(I,M){(function(x,N){I.exports=N()})(dr,function(){return(function(C){var x={};function N(v){if(x[v])return x[v].exports;var l=x[v]={i:v,l:!1,exports:{}};return C[v].call(l.exports,l,l.exports,N),l.l=!0,l.exports}return N.m=C,N.c=x,N.i=function(v){return v},N.d=function(v,l,n){N.o(v,l)||Object.defineProperty(v,l,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var l=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(l,"a",l),l},N.o=function(v,l){return Object.prototype.hasOwnProperty.call(v,l)},N.p="",N(N.s=28)})([(function(C,x,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,x,N){var v=N(2),l=N(8),n=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=n.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=n.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,x,N){function v(l){this.vGraphObject=l}C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new n(s.x,s.y,o.width,o.height):this.rect=new n}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),h=0;h<c.length;h++)s=c[h],o=s.withChildren(),o.forEach(function(T){t.add(T)});return t},e.prototype.getNoOfChildren=function(){var t=0,s;if(this.child==null)t=1;else for(var o=this.child.getNodes(),c=0;c<o.length;c++)s=o[c],t+=s.getNoOfChildren();return t==0&&(t=1),t},e.prototype.getEstimatedSize=function(){if(this.estimatedSize==l.MIN_VALUE)throw"assert failed";return this.estimatedSize},e.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},e.prototype.scatter=function(){var t,s,o=-r.INITIAL_WORLD_BOUNDARY,c=r.INITIAL_WORLD_BOUNDARY;t=r.WORLD_CENTER_X+i.nextDouble()*(c-o)+o;var h=-r.INITIAL_WORLD_BOUNDARY,T=r.INITIAL_WORLD_BOUNDARY;s=r.WORLD_CENTER_Y+i.nextDouble()*(T-h)+h,this.rect.x=t,this.rect.y=s},e.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var t=this.getChild();if(t.updateBounds(!0),this.rect.x=t.getLeft(),this.rect.y=t.getTop(),this.setWidth(t.getRight()-t.getLeft()),this.setHeight(t.getBottom()-t.getTop()),r.NODE_DIMENSIONS_INCLUDE_LABELS){var s=t.getRight()-t.getLeft(),o=t.getBottom()-t.getTop();this.labelWidth&&(this.labelPosHorizontal=="left"?(this.rect.x-=this.labelWidth,this.setWidth(s+this.labelWidth)):this.labelPosHorizontal=="center"&&this.labelWidth>s?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),h=t.inverseTransformPoint(c);this.setLocation(h.x,h.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,x,N){var v=N(0);function l(){}for(var n in v)l[n]=v[n];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=l}),(function(C,x,N){function v(l,n){l==null&&n==null?(this.x=0,this.y=0):(this.x=l,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(l){this.x=l},v.prototype.setY=function(l){this.y=l},v.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},C.exports=v}),(function(C,x,N){var v=N(2),l=N(10),n=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,h,T){v.call(this,T),this.estimatedSize=l.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,h!=null&&h instanceof r?this.graphManager=h:h!=null&&h instanceof Layout&&(this.graphManager=h.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,h,T){if(h==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(h)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(h.owner==T.owner&&h.owner==this))throw"Both owners must be this graph!";return h.owner!=T.owner?null:(d.source=h,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),h.edges.push(d),T!=h&&T.edges.push(d),d)}},s.prototype.remove=function(c){var h=c;if(c instanceof i){if(h==null)throw"Node is null!";if(!(h.owner!=null&&h.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=h.edges.slice(),u,d=T.length,L=0;L<d;L++)u=T[L],u.isInterGraph?this.graphManager.remove(u):u.source.owner.remove(u);var b=this.nodes.indexOf(h);if(b==-1)throw"Node not in owner node list!";this.nodes.splice(b,1)}else if(c instanceof f){var u=c;if(u==null)throw"Edge is null!";if(!(u.source!=null&&u.target!=null))throw"Source and/or target is null!";if(!(u.source.owner!=null&&u.target.owner!=null&&u.source.owner==this&&u.target.owner==this))throw"Source and/or target owner is invalid!";var w=u.source.edges.indexOf(u),G=u.target.edges.indexOf(u);if(!(w>-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=l.MAX_VALUE,h=l.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;w<b;w++){var G=L[w];T=G.getTop(),u=G.getLeft(),c>T&&(c=T),h>u&&(h=u)}return c==l.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=h-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V,Y=this.nodes,B=Y.length,A=0;A<B;A++){var j=Y[A];c&&j.child!=null&&j.updateBounds(),L=j.getLeft(),b=j.getRight(),w=j.getTop(),G=j.getBottom(),h>L&&(h=L),T<b&&(T=b),u>w&&(u=w),d<G&&(d=G)}var a=new e(h,u,T-h,d-u);h==l.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),Y[0].getParent().paddingLeft!=null?V=Y[0].getParent().paddingLeft:V=this.margin,this.left=a.x-V,this.right=a.x+a.width+V,this.top=a.y-V,this.bottom=a.y+a.height+V},s.calculateBounds=function(c){for(var h=l.MAX_VALUE,T=-l.MAX_VALUE,u=l.MAX_VALUE,d=-l.MAX_VALUE,L,b,w,G,V=c.length,Y=0;Y<V;Y++){var B=c[Y];L=B.getLeft(),b=B.getRight(),w=B.getTop(),G=B.getBottom(),h>L&&(h=L),T<b&&(T=b),u>w&&(u=w),d<G&&(d=G)}var A=new e(h,u,T-h,d-u);return A},s.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},s.prototype.getEstimatedSize=function(){if(this.estimatedSize==l.MIN_VALUE)throw"assert failed";return this.estimatedSize},s.prototype.calcEstimatedSize=function(){for(var c=0,h=this.nodes,T=h.length,u=0;u<T;u++){var d=h[u];c+=d.calcEstimatedSize()}return c==0?this.estimatedSize=n.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=c/Math.sqrt(this.nodes.length),this.estimatedSize},s.prototype.updateConnected=function(){var c=this;if(this.nodes.length==0){this.isConnected=!0;return}var h=new t,T=new Set,u=this.nodes[0],d,L,b=u.withChildren();for(b.forEach(function(A){h.push(A),T.add(A)});h.length!==0;){u=h.shift(),d=u.getEdges();for(var w=d.length,G=0;G<w;G++){var V=d[G];if(L=V.getOtherEndInGraph(u,this),L!=null&&!T.has(L)){var Y=L.withChildren();Y.forEach(function(A){h.push(A),T.add(A)})}}}if(this.isConnected=!1,T.size>=this.nodes.length){var B=0;T.forEach(function(A){A.owner==c&&B++}),B==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,x,N){var v,l=N(1);function n(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},n.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},n.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t<g;t++)e=f[t],i.remove(e);var s=[];s=s.concat(i.getNodes());var o;g=s.length;for(var t=0;t<g;t++)o=s[t],i.remove(o);i==this.rootGraph&&this.setRootGraph(null);var c=this.graphs.indexOf(i);this.graphs.splice(c,1),i.parent=null}else if(r instanceof l){if(e=r,e==null)throw"Edge is null!";if(!e.isInterGraph)throw"Not an inter-graph edge!";if(!(e.source!=null&&e.target!=null))throw"Source and/or target is null!";if(!(e.source.edges.indexOf(e)!=-1&&e.target.edges.indexOf(e)!=-1))throw"Source and/or target doesn't know this edge!";var c=e.source.edges.indexOf(e);if(e.source.edges.splice(c,1),c=e.target.edges.indexOf(e),e.target.edges.splice(c,1),!(e.source.owner!=null&&e.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(e.source.owner.getGraphManager().edges.indexOf(e)==-1)throw"Not in owner graph manager's edge list!";var c=e.source.owner.getGraphManager().edges.indexOf(e);e.source.owner.getGraphManager().edges.splice(c,1)}},n.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},n.prototype.getGraphs=function(){return this.graphs},n.prototype.getAllNodes=function(){if(this.allNodes==null){for(var r=[],i=this.getGraphs(),f=i.length,e=0;e<f;e++)r=r.concat(i[e].getNodes());this.allNodes=r}return this.allNodes},n.prototype.resetAllNodes=function(){this.allNodes=null},n.prototype.resetAllEdges=function(){this.allEdges=null},n.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},n.prototype.getAllEdges=function(){if(this.allEdges==null){var r=[],i=this.getGraphs();i.length;for(var f=0;f<i.length;f++)r=r.concat(i[f].getEdges());r=r.concat(this.edges),this.allEdges=r}return this.allEdges},n.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},n.prototype.setAllNodesToApplyGravitation=function(r){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=r},n.prototype.getRoot=function(){return this.rootGraph},n.prototype.setRootGraph=function(r){if(r.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=r,r.parent==null&&(r.parent=this.layout.newNode("Root node"))},n.prototype.getLayout=function(){return this.layout},n.prototype.isOneAncestorOfOther=function(r,i){if(!(r!=null&&i!=null))throw"assert failed";if(r==i)return!0;var f=r.getOwner(),e;do{if(e=f.getParent(),e==null)break;if(e==i)return!0;if(f=e.getOwner(),f==null)break}while(!0);f=i.getOwner();do{if(e=f.getParent(),e==null)break;if(e==r)return!0;if(f=e.getOwner(),f==null)break}while(!0);return!1},n.prototype.calcLowestCommonAncestors=function(){for(var r,i,f,e,g,t=this.getAllEdges(),s=t.length,o=0;o<s;o++){if(r=t[o],i=r.source,f=r.target,r.lca=null,r.sourceInLca=i,r.targetInLca=f,i==f){r.lca=i.getOwner();continue}for(e=i.getOwner();r.lca==null;){for(r.targetInLca=f,g=f.getOwner();r.lca==null;){if(g==e){r.lca=g;break}if(g==this.rootGraph)break;if(r.lca!=null)throw"assert failed";r.targetInLca=g.getParent(),g=r.targetInLca.getOwner()}if(e==this.rootGraph)break;r.lca==null&&(r.sourceInLca=e.getParent(),e=r.sourceInLca.getOwner())}if(r.lca==null)throw"assert failed"}},n.prototype.calcLowestCommonAncestor=function(r,i){if(r==i)return r.getOwner();var f=r.getOwner();do{if(f==null)break;var e=i.getOwner();do{if(e==null)break;if(e==f)return e;e=e.getParent().getOwner()}while(!0);f=f.getParent().getOwner()}while(!0);return f},n.prototype.calcInclusionTreeDepths=function(r,i){r==null&&i==null&&(r=this.rootGraph,i=1);for(var f,e=r.getNodes(),g=e.length,t=0;t<g;t++)f=e[t],f.inclusionTreeDepth=i,f.child!=null&&this.calcInclusionTreeDepths(f.child,i+1)},n.prototype.includesInvalidEdge=function(){for(var r,i=[],f=this.edges.length,e=0;e<f;e++)r=this.edges[e],this.isOneAncestorOfOther(r.source,r.target)&&i.push(r);for(var e=0;e<i.length;e++)this.remove(i[e]);return!1},C.exports=n}),(function(C,x,N){var v=N(12);function l(){}l.calcSeparationAmount=function(n,r,i,f){if(!n.intersects(r))throw"assert failed";var e=new Array(2);this.decideDirectionsForOverlappingNodes(n,r,e),i[0]=Math.min(n.getRight(),r.getRight())-Math.max(n.x,r.x),i[1]=Math.min(n.getBottom(),r.getBottom())-Math.max(n.y,r.y),n.getX()<=r.getX()&&n.getRight()>=r.getRight()?i[0]+=Math.min(r.getX()-n.getX(),n.getRight()-r.getRight()):r.getX()<=n.getX()&&r.getRight()>=n.getRight()&&(i[0]+=Math.min(n.getX()-r.getX(),r.getRight()-n.getRight())),n.getY()<=r.getY()&&n.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-n.getY(),n.getBottom()-r.getBottom()):r.getY()<=n.getY()&&r.getBottom()>=n.getBottom()&&(i[1]+=Math.min(n.getY()-r.getY(),r.getBottom()-n.getBottom()));var g=Math.abs((r.getCenterY()-n.getCenterY())/(r.getCenterX()-n.getCenterX()));r.getCenterY()===n.getCenterY()&&r.getCenterX()===n.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]<s?s=i[0]:t=i[1],i[0]=-1*e[0]*(s/2+f),i[1]=-1*e[1]*(t/2+f)},l.decideDirectionsForOverlappingNodes=function(n,r,i){n.getCenterX()<r.getCenterX()?i[0]=-1:i[0]=1,n.getCenterY()<r.getCenterY()?i[1]=-1:i[1]=1},l.getIntersection2=function(n,r,i){var f=n.getCenterX(),e=n.getCenterY(),g=r.getCenterX(),t=r.getCenterY();if(n.intersects(r))return i[0]=f,i[1]=e,i[2]=g,i[3]=t,!0;var s=n.getX(),o=n.getY(),c=n.getRight(),h=n.getX(),T=n.getBottom(),u=n.getRight(),d=n.getWidthHalf(),L=n.getHeightHalf(),b=r.getX(),w=r.getY(),G=r.getRight(),V=r.getX(),Y=r.getBottom(),B=r.getRight(),A=r.getWidthHalf(),j=r.getHeightHalf(),a=!1,E=!1;if(f===g){if(e>t)return i[0]=f,i[1]=o,i[2]=g,i[3]=Y,!1;if(e<t)return i[0]=f,i[1]=T,i[2]=g,i[3]=w,!1}else if(e===t){if(f>g)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(f<g)return i[0]=c,i[1]=e,i[2]=b,i[3]=t,!1}else{var p=n.height/n.width,m=r.height/r.width,y=(t-e)/(g-f),S=void 0,D=void 0,F=void 0,W=void 0,R=void 0,Q=void 0;if(-p===y?f>g?(i[0]=h,i[1]=T,a=!0):(i[0]=c,i[1]=o,a=!0):p===y&&(f>g?(i[0]=s,i[1]=o,a=!0):(i[0]=u,i[1]=T,a=!0)),-m===y?g>f?(i[2]=V,i[3]=Y,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=B,i[3]=Y,E=!0)),a&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),D=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),D=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),D=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),D=this.getCardinalDirection(m,y,4)),!a)switch(S){case 1:W=o,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=h,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(D){case 1:Q=w,R=g+-j/y,i[2]=R,i[3]=Q;break;case 2:R=B,Q=t+A*y,i[2]=R,i[3]=Q;break;case 3:Q=Y,R=g+j/y,i[2]=R,i[3]=Q;break;case 4:R=V,Q=t+-A*y,i[2]=R,i[3]=Q;break}}return!1},l.getCardinalDirection=function(n,r,i){return n>r?i:1+i%4},l.getIntersection=function(n,r,i,f){if(f==null)return this.getIntersection2(n,r,i);var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,V=void 0,Y=void 0,B=void 0;return L=s-g,w=e-t,V=t*g-e*s,b=T-c,G=o-h,Y=h*c-o*T,B=L*G-b*w,B===0?null:(u=(w*Y-G*V)/B,d=(b*V-L*Y)/B,new v(u,d))},l.angleOfVector=function(n,r,i,f){var e=void 0;return n!==i?(e=Math.atan((f-r)/(i-n)),i<n?e+=Math.PI:f<r&&(e+=this.TWO_PI)):f<r?e=this.ONE_AND_HALF_PI:e=this.HALF_PI,e},l.doIntersect=function(n,r,i,f){var e=n.x,g=n.y,t=r.x,s=r.y,o=i.x,c=i.y,h=f.x,T=f.y,u=(t-e)*(T-c)-(h-o)*(s-g);if(u===0)return!1;var d=((T-c)*(h-e)+(o-h)*(T-g))/u,L=((g-s)*(h-e)+(t-e)*(T-g))/u;return 0<d&&d<1&&0<L&&L<1},l.findCircleLineIntersections=function(n,r,i,f,e,g,t){var s=(i-n)*(i-n)+(f-r)*(f-r),o=2*((n-e)*(i-n)+(r-g)*(f-r)),c=(n-e)*(n-e)+(r-g)*(r-g)-t*t,h=o*o-4*s*c;if(h>=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),u=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,C.exports=l}),(function(C,x,N){function v(){}v.sign=function(l){return l>0?1:l<0?-1:0},v.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},v.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},C.exports=v}),(function(C,x,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,x,N){var v=(function(){function e(g,t){for(var s=0;s<t.length;s++){var o=t[s];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(g,o.key,o)}}return function(g,t,s){return t&&e(g.prototype,t),s&&e(g,s),g}})();function l(e,g){if(!(e instanceof g))throw new TypeError("Cannot call a class as a function")}var n=function(g){return{value:g,next:null,prev:null}},r=function(g,t,s,o){return g!==null?g.next=t:o.head=t,s!==null?s.prev=t:o.tail=t,t.prev=g,t.next=s,o.length++,t},i=function(g,t){var s=g.prev,o=g.next;return s!==null?s.next=o:t.head=o,o!==null?o.prev=s:t.tail=s,g.prev=g.next=null,t.length--,g},f=(function(){function e(g){var t=this;l(this,e),this.length=0,this.head=null,this.tail=null,g!=null&&g.forEach(function(s){return t.push(s)})}return v(e,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(t,s){return r(s.prev,n(t),s,this)}},{key:"insertAfter",value:function(t,s){return r(s,n(t),s.next,this)}},{key:"insertNodeBefore",value:function(t,s){return r(s.prev,t,s,this)}},{key:"insertNodeAfter",value:function(t,s){return r(s,t,s.next,this)}},{key:"push",value:function(t){return r(this.tail,n(t),null,this)}},{key:"unshift",value:function(t){return r(null,n(t),this.head,this)}},{key:"remove",value:function(t){return i(t,this)}},{key:"pop",value:function(){return i(this.tail,this).value}},{key:"popNode",value:function(){return i(this.tail,this)}},{key:"shift",value:function(){return i(this.head,this).value}},{key:"shiftNode",value:function(){return i(this.head,this)}},{key:"get_object_at",value:function(t){if(t<=this.length()){for(var s=1,o=this.head;s<t;)o=o.next,s++;return o.value}}},{key:"set_object_at",value:function(t,s){if(t<=this.length()){for(var o=1,c=this.head;o<t;)c=c.next,o++;c.value=s}}}]),e})();C.exports=f}),(function(C,x,N){function v(l,n,r){this.x=null,this.y=null,l==null&&n==null&&r==null?(this.x=0,this.y=0):typeof l=="number"&&typeof n=="number"&&r==null?(this.x=l,this.y=n):l.constructor.name=="Point"&&n==null&&r==null&&(r=l,this.x=r.x,this.y=r.y)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.getLocation=function(){return new v(this.x,this.y)},v.prototype.setLocation=function(l,n,r){l.constructor.name=="Point"&&n==null&&r==null?(r=l,this.setLocation(r.x,r.y)):typeof l=="number"&&typeof n=="number"&&r==null&&(parseInt(l)==l&&parseInt(n)==n?this.move(l,n):(this.x=Math.floor(l+.5),this.y=Math.floor(n+.5)))},v.prototype.move=function(l,n){this.x=l,this.y=n},v.prototype.translate=function(l,n){this.x+=l,this.y+=n},v.prototype.equals=function(l){if(l.constructor.name=="Point"){var n=l;return this.x==n.x&&this.y==n.y}return this==l},v.prototype.toString=function(){return new v().constructor.name+"[x="+this.x+",y="+this.y+"]"},C.exports=v}),(function(C,x,N){function v(l,n,r,i){this.x=0,this.y=0,this.width=0,this.height=0,l!=null&&n!=null&&r!=null&&i!=null&&(this.x=l,this.y=n,this.width=r,this.height=i)}v.prototype.getX=function(){return this.x},v.prototype.setX=function(l){this.x=l},v.prototype.getY=function(){return this.y},v.prototype.setY=function(l){this.y=l},v.prototype.getWidth=function(){return this.width},v.prototype.setWidth=function(l){this.width=l},v.prototype.getHeight=function(){return this.height},v.prototype.setHeight=function(l){this.height=l},v.prototype.getRight=function(){return this.x+this.width},v.prototype.getBottom=function(){return this.y+this.height},v.prototype.intersects=function(l){return!(this.getRight()<l.x||this.getBottom()<l.y||l.getRight()<this.x||l.getBottom()<this.y)},v.prototype.getCenterX=function(){return this.x+this.width/2},v.prototype.getMinX=function(){return this.getX()},v.prototype.getMaxX=function(){return this.getX()+this.width},v.prototype.getCenterY=function(){return this.y+this.height/2},v.prototype.getMinY=function(){return this.getY()},v.prototype.getMaxY=function(){return this.getY()+this.height},v.prototype.getWidthHalf=function(){return this.width/2},v.prototype.getHeightHalf=function(){return this.height/2},C.exports=v}),(function(C,x,N){var v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function l(){}l.lastID=0,l.createID=function(n){return l.isPrimitive(n)?n:(n.uniqueID!=null||(n.uniqueID=l.getString(),l.lastID++),n.uniqueID)},l.getString=function(n){return n==null&&(n=l.lastID),"Object#"+n},l.isPrimitive=function(n){var r=typeof n>"u"?"undefined":v(n);return n==null||r!="object"&&r!="function"},C.exports=l}),(function(C,x,N){function v(o){if(Array.isArray(o)){for(var c=0,h=Array(o.length);c<o.length;c++)h[c]=o[c];return h}else return Array.from(o)}var l=N(0),n=N(7),r=N(3),i=N(1),f=N(6),e=N(5),g=N(17),t=N(29);function s(o){t.call(this),this.layoutQuality=l.QUALITY,this.createBendsAsNeeded=l.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=l.DEFAULT_INCREMENTAL,this.animationOnLayout=l.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=l.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=l.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=l.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new n(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,o!=null&&(this.isRemoteUse=o)}s.RANDOM_SEED=1,s.prototype=Object.create(t.prototype),s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},s.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},s.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},s.prototype.newGraphManager=function(){var o=new n(this);return this.graphManager=o,o},s.prototype.newGraph=function(o){return new f(null,this.graphManager,o)},s.prototype.newNode=function(o){return new r(this.graphManager,o)},s.prototype.newEdge=function(o){return new i(null,null,o)},s.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},s.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var o;return this.checkLayoutSuccess()?o=!1:o=this.layout(),l.ANIMATE==="during"?!1:(o&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,o)},s.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},s.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var o=this.graphManager.getAllEdges(),c=0;c<o.length;c++)o[c];for(var h=this.graphManager.getRoot().getNodes(),c=0;c<h.length;c++)h[c];this.update(this.graphManager.getRoot())}},s.prototype.update=function(o){if(o==null)this.update2();else if(o instanceof r){var c=o;if(c.getChild()!=null)for(var h=c.getChild().getNodes(),T=0;T<h.length;T++)update(h[T]);if(c.vGraphObject!=null){var u=c.vGraphObject;u.update(c)}}else if(o instanceof i){var d=o;if(d.vGraphObject!=null){var L=d.vGraphObject;L.update(d)}}else if(o instanceof f){var b=o;if(b.vGraphObject!=null){var w=b.vGraphObject;w.update(b)}}},s.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=l.QUALITY,this.animationDuringLayout=l.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=l.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=l.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=l.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=l.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=l.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},s.prototype.transform=function(o){if(o==null)this.transform(new e(0,0));else{var c=new g,h=this.graphManager.getRoot().updateLeftTop();if(h!=null){c.setWorldOrgX(o.x),c.setWorldOrgY(o.y),c.setDeviceOrgX(h.x),c.setDeviceOrgY(h.y);for(var T=this.getAllNodes(),u,d=0;d<T.length;d++)u=T[d],u.transform(c)}}},s.prototype.positionNodesRandomly=function(o){if(o==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var c,h,T=o.getNodes(),u=0;u<T.length;u++)c=T[u],h=c.getChild(),h==null||h.getNodes().length==0?c.scatter():(this.positionNodesRandomly(h),c.updateBounds())},s.prototype.getFlatForest=function(){for(var o=[],c=!0,h=this.graphManager.getRoot().getNodes(),T=!0,u=0;u<h.length;u++)h[u].getChild()!=null&&(T=!1);if(!T)return o;var d=new Set,L=[],b=new Map,w=[];for(w=w.concat(h);w.length>0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var V=G.getEdges(),u=0;u<V.length;u++){var Y=V[u].getOtherEnd(G);if(b.get(G)!=Y)if(!d.has(Y))L.push(Y),b.set(Y,G);else{c=!1;break}}}if(!c)o=[];else{var B=[].concat(v(d));o.push(B);for(var u=0;u<B.length;u++){var A=B[u],j=w.indexOf(A);j>-1&&w.splice(j,1)}d=new Set,b=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],h=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u<o.bendpoints.length;u++){var d=this.newNode(null);d.setRect(new Point(0,0),new Dimension(1,1)),T.add(d);var L=this.newEdge(null);this.graphManager.add(L,h,d),c.add(d),h=d}var L=this.newEdge(null);return this.graphManager.add(L,h,o.target),this.edgeToDummyNodes.set(o,c),o.isInterGraph()?this.graphManager.remove(o):T.remove(o),c},s.prototype.createBendpointsFromDummyNodes=function(){var o=[];o=o.concat(this.graphManager.getAllEdges()),o=[].concat(v(this.edgeToDummyNodes.keys())).concat(o);for(var c=0;c<o.length;c++){var h=o[c];if(h.bendpoints.length>0){for(var T=this.edgeToDummyNodes.get(h),u=0;u<T.length;u++){var d=T[u],L=new e(d.getCenterX(),d.getCenterY()),b=h.bendpoints.get(u);b.x=L.x,b.y=L.y,d.getOwner().remove(d)}this.graphManager.add(h,h.source,h.target)}}},s.transform=function(o,c,h,T){if(h!=null&&T!=null){var u=c;if(o<=50){var d=c/h;u-=(c-d)/50*(50-o)}else{var L=c*T;u+=(L-c)/50*(o-50)}return u}else{var b,w;return o<=50?(b=9*c/500,w=c/10):(b=9*c/50,w=-8*c),b*o+w}},s.findCenterOfTree=function(o){var c=[];c=c.concat(o);var h=[],T=new Map,u=!1,d=null;(c.length==1||c.length==2)&&(u=!0,d=c[0]);for(var L=0;L<c.length;L++){var b=c[L],w=b.getNeighborsList().size;T.set(b,b.getNeighborsList().size),w==1&&h.push(b)}var G=[];for(G=G.concat(h);!u;){var V=[];V=V.concat(G),G=[];for(var L=0;L<c.length;L++){var b=c[L],Y=c.indexOf(b);Y>=0&&c.splice(Y,1);var B=b.getNeighborsList();B.forEach(function(a){if(h.indexOf(a)<0){var E=T.get(a),p=E-1;p==1&&G.push(a),T.set(a,p)}})}h=h.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=s}),(function(C,x,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,x,N){var v=N(5);function l(n,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(n){this.lworldOrgX=n},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(n){this.lworldOrgY=n},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(n){this.lworldExtX=n},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(n){this.lworldExtY=n},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(n){this.ldeviceOrgX=n},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(n){this.ldeviceOrgY=n},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(n){this.ldeviceExtX=n},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(n){this.ldeviceExtY=n},l.prototype.transformX=function(n){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/i),r},l.prototype.transformY=function(n){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/i),r},l.prototype.inverseTransformX=function(n){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/i),r},l.prototype.inverseTransformY=function(n){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/i),r},l.prototype.inverseTransformPoint=function(n){var r=new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y));return r},C.exports=l}),(function(C,x,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);s<t.length;s++)o[s]=t[s];return o}else return Array.from(t)}var l=N(15),n=N(4),r=N(0),i=N(8),f=N(9);function e(){l.call(this),this.useSmartIdealEdgeLengthCalculation=n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=n.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=n.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=n.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=n.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=n.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=n.MAX_ITERATIONS}e.prototype=Object.create(l.prototype);for(var g in l)e[g]=l[g];e.prototype.initParameters=function(){l.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},e.prototype.calcIdealEdgeLengths=function(){for(var t,s,o,c,h,T,u,d=this.getGraphManager().getAllEdges(),L=0;L<d.length;L++)t=d[L],s=t.idealLength,t.isInterGraph&&(c=t.getSource(),h=t.getTarget(),T=t.getSourceInLca().getEstimatedSize(),u=t.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(t.idealLength+=T+u-2*r.SIMPLE_NODE_SIZE),o=t.getLca().getInclusionTreeDepth(),t.idealLength+=s*n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(c.getInclusionTreeDepth()+h.getInclusionTreeDepth()-2*o))},e.prototype.initSpringEmbedder=function(){var t=this.getAllNodes().length;this.incremental?(t>n.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o<t.length;o++)s=t[o],this.calcSpringForce(s,s.idealLength)},e.prototype.calcRepulsionForces=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,h,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;o<u.length;o++)h=u[o],this.calculateRepulsionForceOfANode(h,d,t,s),d.add(h);else for(o=0;o<u.length;o++)for(h=u[o],c=o+1;c<u.length;c++)T=u[c],h.getOwner()==T.getOwner()&&this.calcRepulsionForce(h,T)},e.prototype.calcGravitationalForces=function(){for(var t,s=this.getAllNodesToApplyGravitation(),o=0;o<s.length;o++)t=s[o],this.calcGravitationalForce(t)},e.prototype.moveNodes=function(){for(var t=this.getAllNodes(),s,o=0;o<t.length;o++)s=t[o],s.move()},e.prototype.calcSpringForce=function(t,s){var o=t.getSource(),c=t.getTarget(),h,T,u,d;if(this.uniformLeafNodeSizes&&o.getChild()==null&&c.getChild()==null)t.updateLengthSimple();else if(t.updateLength(),t.isOverlapingSourceAndTarget)return;h=t.getLength(),h!=0&&(T=t.edgeElasticity*(h-s),u=T*(t.lengthX/h),d=T*(t.lengthY/h),o.springForceX+=u,o.springForceY+=d,c.springForceX-=u,c.springForceY-=d)},e.prototype.calcRepulsionForce=function(t,s){var o=t.getRect(),c=s.getRect(),h=new Array(2),T=new Array(4),u,d,L,b,w,G,V;if(o.intersects(c)){i.calcSeparationAmount(o,c,h,n.DEFAULT_EDGE_LENGTH/2),G=2*h[0],V=2*h[1];var Y=t.noOfChildren*s.noOfChildren/(t.noOfChildren+s.noOfChildren);t.repulsionForceX-=Y*G,t.repulsionForceY-=Y*V,s.repulsionForceX+=Y*G,s.repulsionForceY+=Y*V}else this.uniformLeafNodeSizes&&t.getChild()==null&&s.getChild()==null?(u=c.getCenterX()-o.getCenterX(),d=c.getCenterY()-o.getCenterY()):(i.getIntersection(o,c,T),u=T[2]-T[0],d=T[3]-T[1]),Math.abs(u)<n.MIN_REPULSION_DIST&&(u=f.sign(u)*n.MIN_REPULSION_DIST),Math.abs(d)<n.MIN_REPULSION_DIST&&(d=f.sign(d)*n.MIN_REPULSION_DIST),L=u*u+d*d,b=Math.sqrt(L),w=(t.nodeRepulsion/2+s.nodeRepulsion/2)*t.noOfChildren*s.noOfChildren/L,G=w*u/b,V=w*d/b,t.repulsionForceX-=G,t.repulsionForceY-=V,s.repulsionForceX+=G,s.repulsionForceY+=V},e.prototype.calcGravitationalForce=function(t){var s,o,c,h,T,u,d,L;s=t.getOwner(),o=(s.getRight()+s.getLeft())/2,c=(s.getTop()+s.getBottom())/2,h=t.getCenterX()-o,T=t.getCenterY()-c,u=Math.abs(h)+t.getWidth()/2,d=Math.abs(T)+t.getHeight()/2,t.getOwner()==this.graphManager.getRoot()?(L=s.getEstimatedSize()*this.gravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*h*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,t||s},e.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},e.prototype.calcNoOfChildrenForAllNodes=function(){for(var t,s=this.graphManager.getAllNodes(),o=0;o<s.length;o++)t=s[o],t.noOfChildren=t.getNoOfChildren()},e.prototype.calcGrid=function(t){var s=0,o=0;s=parseInt(Math.ceil((t.getRight()-t.getLeft())/this.repulsionRange)),o=parseInt(Math.ceil((t.getBottom()-t.getTop())/this.repulsionRange));for(var c=new Array(s),h=0;h<s;h++)c[h]=new Array(o);for(var h=0;h<s;h++)for(var T=0;T<o;T++)c[h][T]=new Array;return c},e.prototype.addNodeToGrid=function(t,s,o){var c=0,h=0,T=0,u=0;c=parseInt(Math.floor((t.getRect().x-s)/this.repulsionRange)),h=parseInt(Math.floor((t.getRect().width+t.getRect().x-s)/this.repulsionRange)),T=parseInt(Math.floor((t.getRect().y-o)/this.repulsionRange)),u=parseInt(Math.floor((t.getRect().height+t.getRect().y-o)/this.repulsionRange));for(var d=c;d<=h;d++)for(var L=T;L<=u;L++)this.grid[d][L].push(t),t.setGridCoordinates(c,h,T,u)},e.prototype.updateGrid=function(){var t,s,o=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),t=0;t<o.length;t++)s=o[t],this.addNodeToGrid(s,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},e.prototype.calculateRepulsionForceOfANode=function(t,s,o,c){if(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&o||c){var h=new Set;t.surrounding=new Array;for(var T,u=this.grid,d=t.startX-1;d<t.finishX+2;d++)for(var L=t.startY-1;L<t.finishY+2;L++)if(!(d<0||L<0||d>=u.length||L>=u[0].length)){for(var b=0;b<u[d][L].length;b++)if(T=u[d][L][b],!(t.getOwner()!=T.getOwner()||t==T)&&!s.has(T)&&!h.has(T)){var w=Math.abs(t.getCenterX()-T.getCenterX())-(t.getWidth()/2+T.getWidth()/2),G=Math.abs(t.getCenterY()-T.getCenterY())-(t.getHeight()/2+T.getHeight()/2);w<=this.repulsionRange&&G<=this.repulsionRange&&h.add(T)}}t.surrounding=[].concat(v(h))}for(d=0;d<t.surrounding.length;d++)this.calcRepulsionForce(t,t.surrounding[d])},e.prototype.calcRepulsionRange=function(){return 0},C.exports=e}),(function(C,x,N){var v=N(1),l=N(4);function n(i,f,e){v.call(this,i,f,e),this.idealLength=l.DEFAULT_EDGE_LENGTH,this.edgeElasticity=l.DEFAULT_SPRING_STRENGTH}n.prototype=Object.create(v.prototype);for(var r in v)n[r]=v[r];C.exports=n}),(function(C,x,N){var v=N(3),l=N(4);function n(i,f,e,g){v.call(this,i,f,e,g),this.nodeRepulsion=l.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}n.prototype=Object.create(v.prototype);for(var r in v)n[r]=v[r];n.prototype.setGridCoordinates=function(i,f,e,g){this.startX=i,this.finishX=f,this.startY=e,this.finishY=g},C.exports=n}),(function(C,x,N){function v(l,n){this.width=0,this.height=0,l!==null&&n!==null&&(this.height=n,this.width=l)}v.prototype.getWidth=function(){return this.width},v.prototype.setWidth=function(l){this.width=l},v.prototype.getHeight=function(){return this.height},v.prototype.setHeight=function(l){this.height=l},C.exports=v}),(function(C,x,N){var v=N(14);function l(){this.map={},this.keys=[]}l.prototype.put=function(n,r){var i=v.createID(n);this.contains(i)||(this.map[i]=r,this.keys.push(n))},l.prototype.contains=function(n){return v.createID(n),this.map[n]!=null},l.prototype.get=function(n){var r=v.createID(n);return this.map[r]},l.prototype.keySet=function(){return this.keys},C.exports=l}),(function(C,x,N){var v=N(14);function l(){this.set={}}l.prototype.add=function(n){var r=v.createID(n);this.contains(r)||(this.set[r]=n)},l.prototype.remove=function(n){delete this.set[v.createID(n)]},l.prototype.clear=function(){this.set={}},l.prototype.contains=function(n){return this.set[v.createID(n)]==n},l.prototype.isEmpty=function(){return this.size()===0},l.prototype.size=function(){return Object.keys(this.set).length},l.prototype.addAllTo=function(n){for(var r=Object.keys(this.set),i=r.length,f=0;f<i;f++)n.push(this.set[r[f]])},l.prototype.size=function(){return Object.keys(this.set).length},l.prototype.addAll=function(n){for(var r=n.length,i=0;i<r;i++){var f=n[i];this.add(f)}},C.exports=l}),(function(C,x,N){function v(){}v.multMat=function(l,n){for(var r=[],i=0;i<l.length;i++){r[i]=[];for(var f=0;f<n[0].length;f++){r[i][f]=0;for(var e=0;e<l[0].length;e++)r[i][f]+=l[i][e]*n[e][f]}}return r},v.transpose=function(l){for(var n=[],r=0;r<l[0].length;r++){n[r]=[];for(var i=0;i<l.length;i++)n[r][i]=l[i][r]}return n},v.multCons=function(l,n){for(var r=[],i=0;i<l.length;i++)r[i]=l[i]*n;return r},v.minusOp=function(l,n){for(var r=[],i=0;i<l.length;i++)r[i]=l[i]-n[i];return r},v.dotProduct=function(l,n){for(var r=0,i=0;i<l.length;i++)r+=l[i]*n[i];return r},v.mag=function(l){return Math.sqrt(this.dotProduct(l,l))},v.normalize=function(l){for(var n=[],r=this.mag(l),i=0;i<l.length;i++)n[i]=l[i]/r;return n},v.multGamma=function(l){for(var n=[],r=0,i=0;i<l.length;i++)r+=l[i];r*=-1/l.length;for(var f=0;f<l.length;f++)n[f]=r+l[f];return n},v.multL=function(l,n,r){for(var i=[],f=[],e=[],g=0;g<n[0].length;g++){for(var t=0,s=0;s<n.length;s++)t+=-.5*n[s][g]*l[s];f[g]=t}for(var o=0;o<r.length;o++){for(var c=0,h=0;h<r.length;h++)c+=r[o][h]*f[h];e[o]=c}for(var T=0;T<n.length;T++){for(var u=0,d=0;d<n[0].length;d++)u+=n[T][d]*e[d];i[T]=u}return i},C.exports=v}),(function(C,x,N){var v=(function(){function i(f,e){for(var g=0;g<e.length;g++){var t=e[g];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(f,t.key,t)}}return function(f,e,g){return e&&i(f.prototype,e),g&&i(f,g),f}})();function l(i,f){if(!(i instanceof f))throw new TypeError("Cannot call a class as a function")}var n=N(11),r=(function(){function i(f,e){l(this,i),(e!==null||e!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var g=void 0;f instanceof n?g=f.size():g=f.length,this._quicksort(f,0,g-1)}return v(i,[{key:"_quicksort",value:function(e,g,t){if(g<t){var s=this._partition(e,g,t);this._quicksort(e,g,s),this._quicksort(e,s+1,t)}}},{key:"_partition",value:function(e,g,t){for(var s=this._get(e,g),o=g,c=t;;){for(;this.compareFunction(s,this._get(e,c));)c--;for(;this.compareFunction(this._get(e,o),s);)o++;if(o<c)this._swap(e,o,c),o++,c--;else return c}}},{key:"_get",value:function(e,g){return e instanceof n?e.get_object_at(g):e[g]}},{key:"_set",value:function(e,g,t){e instanceof n?e.set_object_at(g,t):e[g]=t}},{key:"_swap",value:function(e,g,t){var s=this._get(e,g);this._set(e,g,this._get(e,t)),this._set(e,t,s)}},{key:"_defaultCompareFunction",value:function(e,g){return g>e}}]),i})();C.exports=r}),(function(C,x,N){function v(){}v.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var n=Math.min(this.m,this.n);this.s=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St<bt[0];St++)zt.push($t(bt.slice(1)));return zt};return wt(Tt)})([this.m,n]),this.V=(function(Tt){var wt=function $t(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St<bt[0];St++)zt.push($t(bt.slice(1)));return zt};return wt(Tt)})([this.n,this.n]);for(var r=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.n),i=(function(Tt){for(var wt=[];Tt-- >0;)wt.push(0);return wt})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t<Math.max(e,g);t++){if(t<e){this.s[t]=0;for(var s=t;s<this.m;s++)this.s[t]=v.hypot(this.s[t],l[s][t]);if(this.s[t]!==0){l[t][t]<0&&(this.s[t]=-this.s[t]);for(var o=t;o<this.m;o++)l[o][t]/=this.s[t];l[t][t]+=1}this.s[t]=-this.s[t]}for(var c=t+1;c<this.n;c++){if((function(Tt,wt){return Tt&&wt})(t<e,this.s[t]!==0)){for(var h=0,T=t;T<this.m;T++)h+=l[T][t]*l[T][c];h=-h/l[t][t];for(var u=t;u<this.m;u++)l[u][c]+=h*l[u][t]}r[c]=l[t][c]}if((function(Tt,wt){return wt})(f,t<e))for(var d=t;d<this.m;d++)this.U[d][t]=l[d][t];if(t<g){r[t]=0;for(var L=t+1;L<this.n;L++)r[t]=v.hypot(r[t],r[L]);if(r[t]!==0){r[t+1]<0&&(r[t]=-r[t]);for(var b=t+1;b<this.n;b++)r[b]/=r[t];r[t+1]+=1}if(r[t]=-r[t],(function(Tt,wt){return Tt&&wt})(t+1<this.m,r[t]!==0)){for(var w=t+1;w<this.m;w++)i[w]=0;for(var G=t+1;G<this.n;G++)for(var V=t+1;V<this.m;V++)i[V]+=r[G]*l[V][G];for(var Y=t+1;Y<this.n;Y++)for(var B=-r[Y]/r[t+1],A=t+1;A<this.m;A++)l[A][Y]+=B*i[A]}for(var j=t+1;j<this.n;j++)this.V[j][t]=r[j]}}var a=Math.min(this.n,this.m+1);e<this.n&&(this.s[e]=l[e][e]),this.m<a&&(this.s[a-1]=0),g+1<a&&(r[g]=l[g][a-1]),r[a-1]=0;{for(var E=e;E<n;E++){for(var p=0;p<this.m;p++)this.U[p][E]=0;this.U[E][E]=1}for(var m=e-1;m>=0;m--)if(this.s[m]!==0){for(var y=m+1;y<n;y++){for(var S=0,D=m;D<this.m;D++)S+=this.U[D][m]*this.U[D][y];S=-S/this.U[m][m];for(var F=m;F<this.m;F++)this.U[F][y]+=S*this.U[F][m]}for(var W=m;W<this.m;W++)this.U[W][m]=-this.U[W][m];this.U[m][m]=1+this.U[m][m];for(var R=0;R<m-1;R++)this.U[R][m]=0}else{for(var Q=0;Q<this.m;Q++)this.U[Q][m]=0;this.U[m][m]=1}}for(var z=this.n-1;z>=0;z--){if((function(Tt,wt){return Tt&&wt})(z<g,r[z]!==0))for(var X=z+1;X<n;X++){for(var rt=0,$=z+1;$<this.n;$++)rt+=this.V[$][z]*this.V[$][X];rt=-rt/this.V[z+1][z];for(var O=z+1;O<this.n;O++)this.V[O][X]+=rt*this.V[O][z]}for(var H=0;H<this.n;H++)this.V[H][z]=0;this.V[z][z]=1}for(var Z=a-1,tt=Math.pow(2,-52),ht=Math.pow(2,-966);a>0;){var J=void 0,It=void 0;for(J=a-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===a-2)It=4;else{var Nt=void 0;for(Nt=a-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==a?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===a-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[a-2];r[a-2]=0;for(var ut=a-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),Ct=this.s[ut]/Et,Dt=it/Et;this.s[ut]=Et,ut!==J&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt<this.n;mt++)Et=Ct*this.V[mt][ut]+Dt*this.V[mt][a-1],this.V[mt][a-1]=-Dt*this.V[mt][ut]+Ct*this.V[mt][a-1],this.V[mt][ut]=Et}}break;case 2:{var Ot=r[J-1];r[J-1]=0;for(var Rt=J;Rt<a;Rt++){var Ht=v.hypot(this.s[Rt],Ot),Ut=this.s[Rt]/Ht,Pt=Ot/Ht;this.s[Rt]=Ht,Ot=-Pt*r[Rt],r[Rt]=Ut*r[Rt];for(var Ft=0;Ft<this.m;Ft++)Ht=Ut*this.U[Ft][Rt]+Pt*this.U[Ft][J-1],this.U[Ft][J-1]=-Pt*this.U[Ft][Rt]+Ut*this.U[Ft][J-1],this.U[Ft][Rt]=Ht}}break;case 3:{var Yt=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[a-1]),Math.abs(this.s[a-2])),Math.abs(r[a-2])),Math.abs(this.s[J])),Math.abs(r[J])),Vt=this.s[a-1]/Yt,P=this.s[a-2]/Yt,U=r[a-2]/Yt,k=this.s[J]/Yt,K=r[J]/Yt,q=((P+Vt)*(P-Vt)+U*U)/2,at=Vt*U*(Vt*U),gt=0;(function(Tt,wt){return Tt||wt})(q!==0,at!==0)&&(gt=Math.sqrt(q*q+at),q<0&&(gt=-gt),gt=at/(q+gt));for(var nt=(k+Vt)*(k-Vt)+gt,et=k*K,_=J;_<a-1;_++){var dt=v.hypot(nt,et),Mt=nt/dt,pt=et/dt;_!==J&&(r[_-1]=dt),nt=Mt*this.s[_]+pt*r[_],r[_]=Mt*r[_]-pt*this.s[_],et=pt*this.s[_+1],this.s[_+1]=Mt*this.s[_+1];for(var xt=0;xt<this.n;xt++)dt=Mt*this.V[xt][_]+pt*this.V[xt][_+1],this.V[xt][_+1]=-pt*this.V[xt][_]+Mt*this.V[xt][_+1],this.V[xt][_]=dt;if(dt=v.hypot(nt,et),Mt=nt/dt,pt=et/dt,this.s[_]=dt,nt=Mt*r[_]+pt*this.s[_+1],this.s[_+1]=-pt*r[_]+Mt*this.s[_+1],et=pt*r[_+1],r[_+1]=Mt*r[_+1],_<this.m-1)for(var lt=0;lt<this.m;lt++)dt=Mt*this.U[lt][_]+pt*this.U[lt][_+1],this.U[lt][_+1]=-pt*this.U[lt][_]+Mt*this.U[lt][_+1],this.U[lt][_]=dt}r[a-2]=nt}break;case 4:{if(this.s[J]<=0){this.s[J]=this.s[J]<0?-this.s[J]:0;for(var ot=0;ot<=Z;ot++)this.V[ot][J]=-this.V[ot][J]}for(;J<Z&&!(this.s[J]>=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,J<this.n-1)for(var ft=0;ft<this.n;ft++)Lt=this.V[ft][J+1],this.V[ft][J+1]=this.V[ft][J],this.V[ft][J]=Lt;if(J<this.m-1)for(var st=0;st<this.m;st++)Lt=this.U[st][J+1],this.U[st][J+1]=this.U[st][J],this.U[st][J]=Lt;J++}a--}break}}var Xt={U:this.U,V:this.V,S:this.s};return Xt},v.hypot=function(l,n){var r=void 0;return Math.abs(l)>Math.abs(n)?(r=n/l,r=Math.abs(l)*Math.sqrt(1+r*r)):n!=0?(r=l/n,r=Math.abs(n)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,x,N){var v=(function(){function r(i,f){for(var e=0;e<f.length;e++){var g=f[e];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(i,g.key,g)}}return function(i,f,e){return f&&r(i.prototype,f),e&&r(i,e),i}})();function l(r,i){if(!(r instanceof i))throw new TypeError("Cannot call a class as a function")}var n=(function(){function r(i,f){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s<this.iMax;s++){this.grid[s]=new Array(this.jMax);for(var o=0;o<this.jMax;o++)this.grid[s][o]=0}this.tracebackGrid=new Array(this.iMax);for(var c=0;c<this.iMax;c++){this.tracebackGrid[c]=new Array(this.jMax);for(var h=0;h<this.jMax;h++)this.tracebackGrid[c][h]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return v(r,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var f=1;f<this.jMax;f++)this.grid[0][f]=this.grid[0][f-1]+this.gap_penalty,this.tracebackGrid[0][f]=[!1,!1,!0];for(var e=1;e<this.iMax;e++)this.grid[e][0]=this.grid[e-1][0]+this.gap_penalty,this.tracebackGrid[e][0]=[!1,!0,!1];for(var g=1;g<this.iMax;g++)for(var t=1;t<this.jMax;t++){var s=void 0;this.sequence1[g-1]===this.sequence2[t-1]?s=this.grid[g-1][t-1]+this.match_score:s=this.grid[g-1][t-1]+this.mismatch_penalty;var o=this.grid[g-1][t]+this.gap_penalty,c=this.grid[g][t-1]+this.gap_penalty,h=[s,o,c],T=this.arrayAllMaxIndexes(h);this.grid[g][t]=h[T[0]],this.tracebackGrid[g][t]=[T.includes(0),T.includes(1),T.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var f=[];for(f.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});f[0];){var e=f[0],g=this.tracebackGrid[e.pos[0]][e.pos[1]];g[0]&&f.push({pos:[e.pos[0]-1,e.pos[1]-1],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),g[1]&&f.push({pos:[e.pos[0]-1,e.pos[1]],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:"-"+e.seq2}),g[2]&&f.push({pos:[e.pos[0],e.pos[1]-1],seq1:"-"+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),e.pos[0]===0&&e.pos[1]===0&&this.alignments.push({sequence1:e.seq1,sequence2:e.seq2}),f.shift()}return this.alignments}},{key:"getAllIndexes",value:function(f,e){for(var g=[],t=-1;(t=f.indexOf(e,t+1))!==-1;)g.push(t);return g}},{key:"arrayAllMaxIndexes",value:function(f){return this.getAllIndexes(f,Math.max.apply(null,f))}}]),r})();C.exports=n}),(function(C,x,N){var v=function(){};v.FDLayout=N(18),v.FDLayoutConstants=N(4),v.FDLayoutEdge=N(19),v.FDLayoutNode=N(20),v.DimensionD=N(21),v.HashMap=N(22),v.HashSet=N(23),v.IGeometry=N(8),v.IMath=N(9),v.Integer=N(10),v.Point=N(12),v.PointD=N(5),v.RandomSeed=N(16),v.RectangleD=N(13),v.Transform=N(17),v.UniqueIDGeneretor=N(14),v.Quicksort=N(25),v.LinkedList=N(11),v.LGraphObject=N(2),v.LGraph=N(6),v.LEdge=N(1),v.LGraphManager=N(7),v.LNode=N(3),v.Layout=N(15),v.LayoutConstants=N(0),v.NeedlemanWunsch=N(27),v.Matrix=N(24),v.SVD=N(26),C.exports=v}),(function(C,x,N){function v(){this.listeners=[]}var l=v.prototype;l.addListener=function(n,r){this.listeners.push({event:n,callback:r})},l.removeListener=function(n,r){for(var i=this.listeners.length;i>=0;i--){var f=this.listeners[i];f.event===n&&f.callback===r&&this.listeners.splice(i,1)}},l.emit=function(n,r){for(var i=0;i<this.listeners.length;i++){var f=this.listeners[i];n===f.event&&f.callback(r)}},C.exports=v})])})})(fe)),fe.exports}var pr=le.exports,Oe;function yr(){return Oe||(Oe=1,(function(I,M){(function(x,N){I.exports=N(vr())})(pr,function(C){return(()=>{var x={45:((n,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),n.exports=f}),806:((n,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,n.exports=e}),767:((n,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),880:((n,r,i)=>{var f=i(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),578:((n,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];n.exports=e}),765:((n,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),o=i(806),c=i(902),h=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,V=i(551).LGraph,Y=i(551).Transform,B=i(551).LinkedList;function A(){f.call(this),this.toBeTiled={},this.constraints={}}A.prototype=Object.create(f.prototype);for(var j in f)A[j]=f[j];A.prototype.newGraphManager=function(){var a=new e(this);return this.graphManager=a,a},A.prototype.newGraph=function(a){return new g(null,this.graphManager,a)},A.prototype.newNode=function(a){return new t(this.graphManager,a)},A.prototype.newEdge=function(a){return new s(null,null,a)},A.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){var a=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return a&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return a.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),E={},p=0;p<a.length;p++){var m=a[p].rect,y=a[p].id;E[y]={id:y,x:m.getCenterX(),y:m.getCenterY(),w:m.width,h:m.height}}return E},A.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var a=!1;if(h.ANIMATE==="during")this.emit("layoutstarted");else{for(;!a;)a=this.tick();this.graphManager.updateBounds()}},A.prototype.moveNodes=function(){for(var a=this.getAllNodes(),E,p=0;p<a.length;p++)E=a[p],E.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var p=0;p<a.length;p++)E=a[p],E.move()},A.prototype.initConstraintVariables=function(){var a=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var E=this.graphManager.getAllNodes(),p=0;p<E.length;p++){var m=E[p];this.idToNodeMap.set(m.id,m)}var y=function O(H){for(var Z=H.getChild().getNodes(),tt,ht=0,J=0;J<Z.length;J++)tt=Z[J],tt.getChild()==null?a.fixedNodeSet.has(tt.id)&&(ht+=100):ht+=O(tt);return ht};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(Z){a.fixedNodeSet.add(Z.nodeId)});for(var E=this.graphManager.getAllNodes(),m,p=0;p<E.length;p++)if(m=E[p],m.getChild()!=null){var S=y(m);S>0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var D=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p<W.length;p++)this.dummyToNodeForVerticalAlignment.set("dummy"+p,[]),W[p].forEach(function(H){D.set(H,"dummy"+p),a.dummyToNodeForVerticalAlignment.get("dummy"+p).push(H),a.fixedNodeSet.has(H)&&a.fixedNodesOnHorizontal.add("dummy"+p)});if(this.constraints.alignmentConstraint.horizontal)for(var R=this.constraints.alignmentConstraint.horizontal,p=0;p<R.length;p++)this.dummyToNodeForHorizontalAlignment.set("dummy"+p,[]),R[p].forEach(function(H){F.set(H,"dummy"+p),a.dummyToNodeForHorizontalAlignment.get("dummy"+p).push(H),a.fixedNodeSet.has(H)&&a.fixedNodesOnVertical.add("dummy"+p)})}if(o.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(O){var H,Z,tt;for(tt=O.length-1;tt>=2*O.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),Z=O[tt],O[tt]=O[H],O[H]=Z;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(H)||(a.nodesInRelativeHorizontal.push(H),a.nodeToRelativeConstraintMapHorizontal.set(H,[]),a.dummyToNodeForVerticalAlignment.has(H)?a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(H,a.idToNodeMap.get(H).getCenterX())),a.nodesInRelativeHorizontal.includes(Z)||(a.nodesInRelativeHorizontal.push(Z),a.nodeToRelativeConstraintMapHorizontal.set(Z,[]),a.dummyToNodeForVerticalAlignment.has(Z)?a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(Z)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(Z,a.idToNodeMap.get(Z).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(H).push({right:Z,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(Z).push({left:H,gap:O.gap})}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ht)||(a.nodesInRelativeVertical.push(ht),a.nodeToRelativeConstraintMapVertical.set(ht,[]),a.dummyToNodeForHorizontalAlignment.has(ht)?a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ht,a.idToNodeMap.get(ht).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:O.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var H=D.has(O.left)?D.get(O.left):O.left,Z=D.has(O.right)?D.get(O.right):O.right;Q.has(H)?Q.get(H).push(Z):Q.set(H,[Z]),Q.has(Z)?Q.get(Z).push(H):Q.set(Z,[H])}else{var tt=F.has(O.top)?F.get(O.top):O.top,ht=F.has(O.bottom)?F.get(O.bottom):O.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,Z){var tt=[],ht=[],J=new B,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),Z.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(Ct){It.has(Ct)||(J.push(Ct),It.add(Ct),tt[Nt].push(Ct))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,a.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},A.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var O=a.idToNodeMap.get($.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p<E.length;p++){for(var m=0,y=0;y<E[p].length;y++){if(this.fixedNodeSet.has(E[p][y])){m=0;break}m+=this.idToNodeMap.get(E[p][y]).displacementX}for(var S=m/E[p].length,y=0;y<E[p].length;y++)this.idToNodeMap.get(E[p][y]).displacementX=S}if(this.constraints.alignmentConstraint.horizontal)for(var D=this.constraints.alignmentConstraint.horizontal,p=0;p<D.length;p++){for(var F=0,y=0;y<D[p].length;y++){if(this.fixedNodeSet.has(D[p][y])){F=0;break}F+=this.idToNodeMap.get(D[p][y]).displacementY}for(var W=F/D[p].length,y=0;y<D[p].length;y++)this.idToNodeMap.get(D[p][y]).displacementY=W}}if(this.constraints.relativePlacementConstraint)if(o.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function($){if(!a.fixedNodesOnHorizontal.has($)){var O=0;a.dummyToNodeForVerticalAlignment.has($)?O=a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get($)[0]).displacementX:O=a.idToNodeMap.get($).displacementX,a.nodeToRelativeConstraintMapHorizontal.get($).forEach(function(H){if(H.right){var Z=a.nodeToTempPositionMapHorizontal.get(H.right)-a.nodeToTempPositionMapHorizontal.get($)-O;Z<H.gap&&(O-=H.gap-Z)}else{var Z=a.nodeToTempPositionMapHorizontal.get($)-a.nodeToTempPositionMapHorizontal.get(H.left)+O;Z<H.gap&&(O+=H.gap-Z)}}),a.nodeToTempPositionMapHorizontal.set($,a.nodeToTempPositionMapHorizontal.get($)+O),a.dummyToNodeForVerticalAlignment.has($)?a.dummyToNodeForVerticalAlignment.get($).forEach(function(H){a.idToNodeMap.get(H).displacementX=O}):a.idToNodeMap.get($).displacementX=O}}),this.nodesInRelativeVertical.forEach(function($){if(!a.fixedNodesOnHorizontal.has($)){var O=0;a.dummyToNodeForHorizontalAlignment.has($)?O=a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get($)[0]).displacementY:O=a.idToNodeMap.get($).displacementY,a.nodeToRelativeConstraintMapVertical.get($).forEach(function(H){if(H.bottom){var Z=a.nodeToTempPositionMapVertical.get(H.bottom)-a.nodeToTempPositionMapVertical.get($)-O;Z<H.gap&&(O-=H.gap-Z)}else{var Z=a.nodeToTempPositionMapVertical.get($)-a.nodeToTempPositionMapVertical.get(H.top)+O;Z<H.gap&&(O+=H.gap-Z)}}),a.nodeToTempPositionMapVertical.set($,a.nodeToTempPositionMapVertical.get($)+O),a.dummyToNodeForHorizontalAlignment.has($)?a.dummyToNodeForHorizontalAlignment.get($).forEach(function(H){a.idToNodeMap.get(H).displacementY=O}):a.idToNodeMap.get($).displacementY=O}});else{for(var p=0;p<this.componentsOnHorizontal.length;p++){var R=this.componentsOnHorizontal[p];if(this.fixedComponentsOnHorizontal[p])for(var y=0;y<R.length;y++)this.dummyToNodeForVerticalAlignment.has(R[y])?this.dummyToNodeForVerticalAlignment.get(R[y]).forEach(function(H){a.idToNodeMap.get(H).displacementX=0}):this.idToNodeMap.get(R[y]).displacementX=0;else{for(var Q=0,z=0,y=0;y<R.length;y++)if(this.dummyToNodeForVerticalAlignment.has(R[y])){var X=this.dummyToNodeForVerticalAlignment.get(R[y]);Q+=X.length*this.idToNodeMap.get(X[0]).displacementX,z+=X.length}else Q+=this.idToNodeMap.get(R[y]).displacementX,z++;for(var rt=Q/z,y=0;y<R.length;y++)this.dummyToNodeForVerticalAlignment.has(R[y])?this.dummyToNodeForVerticalAlignment.get(R[y]).forEach(function(H){a.idToNodeMap.get(H).displacementX=rt}):this.idToNodeMap.get(R[y]).displacementX=rt}}for(var p=0;p<this.componentsOnVertical.length;p++){var R=this.componentsOnVertical[p];if(this.fixedComponentsOnVertical[p])for(var y=0;y<R.length;y++)this.dummyToNodeForHorizontalAlignment.has(R[y])?this.dummyToNodeForHorizontalAlignment.get(R[y]).forEach(function(Z){a.idToNodeMap.get(Z).displacementY=0}):this.idToNodeMap.get(R[y]).displacementY=0;else{for(var Q=0,z=0,y=0;y<R.length;y++)if(this.dummyToNodeForHorizontalAlignment.has(R[y])){var X=this.dummyToNodeForHorizontalAlignment.get(R[y]);Q+=X.length*this.idToNodeMap.get(X[0]).displacementY,z+=X.length}else Q+=this.idToNodeMap.get(R[y]).displacementY,z++;for(var rt=Q/z,y=0;y<R.length;y++)this.dummyToNodeForHorizontalAlignment.has(R[y])?this.dummyToNodeForHorizontalAlignment.get(R[y]).forEach(function(J){a.idToNodeMap.get(J).displacementY=rt}):this.idToNodeMap.get(R[y]).displacementY=rt}}}},A.prototype.calculateNodesToApplyGravitationTo=function(){var a=[],E,p=this.graphManager.getGraphs(),m=p.length,y;for(y=0;y<m;y++)E=p[y],E.updateConnected(),E.isConnected||(a=a.concat(E.getNodes()));return a},A.prototype.createBendpoints=function(){var a=[];a=a.concat(this.graphManager.getAllEdges());var E=new Set,p;for(p=0;p<a.length;p++){var m=a[p];if(!E.has(m)){var y=m.getSource(),S=m.getTarget();if(y==S)m.getBendpoints().push(new d),m.getBendpoints().push(new d),this.createDummyNodesForBendpoints(m),E.add(m);else{var D=[];if(D=D.concat(y.getEdgeListToNode(S)),D=D.concat(S.getEdgeListToNode(y)),!E.has(D[0])){if(D.length>1){var F;for(F=0;F<D.length;F++){var W=D[F];W.getBendpoints().push(new d),this.createDummyNodesForBendpoints(W)}}D.forEach(function(R){E.add(R)})}}}if(E.size==a.length)break}},A.prototype.positionNodesRadially=function(a){for(var E=new u(0,0),p=Math.ceil(Math.sqrt(a.length)),m=0,y=0,S=0,D=new d(0,0),F=0;F<a.length;F++){F%p==0&&(S=0,y=m,F!=0&&(y+=o.DEFAULT_COMPONENT_SEPERATION),m=0);var W=a[F],R=b.findCenterOfTree(W);E.x=S,E.y=y,D=A.radialLayout(W,R,E),D.y>m&&(m=Math.floor(D.y)),S=Math.floor(D.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-D.x/2,T.WORLD_CENTER_Y-D.y/2))},A.radialLayout=function(a,E,p){var m=Math.max(this.maxDiagonalInTree(a),o.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(E,null,0,359,0,m);var y=V.calculateBounds(a),S=new Y;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var D=0;D<a.length;D++){var F=a[D];F.transform(S)}var W=new d(y.getMaxX(),y.getMaxY());return S.inverseTransformPoint(W)},A.branchRadialLayout=function(a,E,p,m,y,S){var D=(m-p+1)/2;D<0&&(D+=180);var F=(D+p)%360,W=F*G.TWO_PI/360,R=y*Math.cos(W),Q=y*Math.sin(W);a.setCenter(R,Q);var z=[];z=z.concat(a.getEdges());var X=z.length;E!=null&&X--;for(var rt=0,$=z.length,O,H=a.getEdgesBetween(E);H.length>1;){var Z=H[0];H.splice(0,1);var tt=z.indexOf(Z);tt>=0&&z.splice(tt,1),$--,X--}E!=null?O=(z.indexOf(H[0])+1)%$:O=0;for(var ht=Math.abs(m-p)/X,J=O;rt!=X;J=++J%$){var It=z[J].getOtherEnd(a);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;A.branchRadialLayout(It,a,Nt,vt,y+S,S),rt++}}},A.maxDiagonalInTree=function(a){for(var E=w.MIN_VALUE,p=0;p<a.length;p++){var m=a[p],y=m.getDiagonal();y>E&&(E=y)}return E},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var a=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y<m.length;y++){var S=m[y],D=S.getParent();this.getNodeDegreeWithChildren(S)===0&&(D.id==null||!this.getToBeTiled(D))&&p.push(S)}for(var y=0;y<p.length;y++){var S=p[y],F=S.getParent().id;typeof E[F]>"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var R="DummyCompound_"+W;a.memberGroups[R]=E[W];var Q=E[W][0].getParent(),z=new t(a.graphManager);z.id=R,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,a.idToDummyNode[R]=z;var X=a.getGraphManager().add(a.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$<E[W].length;$++){var O=E[W][$];rt.remove(O),X.add(O)}}})},A.prototype.clearCompounds=function(){var a={},E={};this.performDFSOnCompounds();for(var p=0;p<this.compoundOrder.length;p++)E[this.compoundOrder[p].id]=this.compoundOrder[p],a[this.compoundOrder[p].id]=[].concat(this.compoundOrder[p].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[p].getChild()),this.compoundOrder[p].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(a,E)},A.prototype.clearZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(p){var m=a.idToDummyNode[p];if(E[p]=a.tileNodes(a.memberGroups[p],m.paddingLeft+m.paddingRight),m.rect.width=E[p].width,m.rect.height=E[p].height,m.setCenter(E[p].centerX,E[p].centerY),m.labelMarginLeft=0,m.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var y=m.rect.width,S=m.rect.height;m.labelWidth&&(m.labelPosHorizontal=="left"?(m.rect.x-=m.labelWidth,m.setWidth(y+m.labelWidth),m.labelMarginLeft=m.labelWidth):m.labelPosHorizontal=="center"&&m.labelWidth>y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var E=this.compoundOrder[a],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,D=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,D)}},A.prototype.repopulateZeroDegreeMembers=function(){var a=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=a.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,D=m.labelMarginLeft,F=m.labelMarginTop;a.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,D,F)})},A.prototype.getToBeTiled=function(a){var E=a.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=a.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y<m.length;y++){var S=m[y];if(this.getNodeDegree(S)>0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},A.prototype.getNodeDegree=function(a){a.id;for(var E=a.getEdges(),p=0,m=0;m<E.length;m++){var y=E[m];y.getSource().id!==y.getTarget().id&&(p=p+1)}return p},A.prototype.getNodeDegreeWithChildren=function(a){var E=this.getNodeDegree(a);if(a.getChild()==null)return E;for(var p=a.getChild().getNodes(),m=0;m<p.length;m++){var y=p[m];E+=this.getNodeDegreeWithChildren(y)}return E},A.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},A.prototype.fillCompexOrderByDFS=function(a){for(var E=0;E<a.length;E++){var p=a[E];p.getChild()!=null&&this.fillCompexOrderByDFS(p.getChild().getNodes()),this.getToBeTiled(p)&&this.compoundOrder.push(p)}},A.prototype.adjustLocations=function(a,E,p,m,y,S,D){E+=m+S,p+=y+D;for(var F=E,W=0;W<a.rows.length;W++){var R=a.rows[W];E=F;for(var Q=0,z=0;z<R.length;z++){var X=R[z];X.rect.x=E,X.rect.y=p,E+=X.rect.width+a.horizontalPadding,X.rect.height>Q&&(Q=X.rect.height)}p+=Q+a.verticalPadding}},A.prototype.tileCompoundMembers=function(a,E){var p=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(a[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,D=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(D+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>D?(y.rect.y-=(y.labelHeight-D)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-D)/2):y.labelPosVertical=="bottom"&&y.setHeight(D+y.labelHeight))}})},A.prototype.tileNodes=function(a,E){var p=this.tileNodesByFavoringDim(a,E,!0),m=this.tileNodesByFavoringDim(a,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),D;return S<y?D=m:D=p,D},A.prototype.getOrgRatio=function(a){var E=a.width,p=a.height,m=E/p;return m<1&&(m=1/m),m},A.prototype.calcIdealRowWidth=function(a,E){var p=o.TILING_PADDING_VERTICAL,m=o.TILING_PADDING_HORIZONTAL,y=a.length,S=0,D=0,F=0;a.forEach(function($){S+=$.getWidth(),D+=$.getHeight(),$.getWidth()>F&&(F=$.getWidth())});var W=S/y,R=D/y,Q=Math.pow(p-m,2)+4*(W+m)*(R+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},A.prototype.tileNodesByFavoringDim=function(a,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,S=o.TILING_COMPARE_BY,D={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(D.idealRowWidth=this.calcIdealRowWidth(a,p));var F=function(O){return O.rect.width*O.rect.height},W=function(O,H){return F(H)-F(O)};a.sort(function($,O){var H=W;return D.idealRowWidth?(H=S,H($.id,O.id)):H($,O)});for(var R=0,Q=0,z=0;z<a.length;z++){var X=a[z];R+=X.getCenterX(),Q+=X.getCenterY()}D.centerX=R/a.length,D.centerY=Q/a.length;for(var z=0;z<a.length;z++){var X=a[z];if(D.rows.length==0)this.insertNodeToRow(D,X,0,E);else if(this.canAddHorizontal(D,X.rect.width,X.rect.height)){var rt=D.rows.length-1;D.idealRowWidth||(rt=this.getShortestRowIndex(D)),this.insertNodeToRow(D,X,rt,E)}else this.insertNodeToRow(D,X,D.rows.length,E);this.shiftToLastRow(D)}return D},A.prototype.insertNodeToRow=function(a,E,p,m){var y=m;if(p==a.rows.length){var S=[];a.rows.push(S),a.rowWidth.push(y),a.rowHeight.push(0)}var D=a.rowWidth[p]+E.rect.width;a.rows[p].length>0&&(D+=a.horizontalPadding),a.rowWidth[p]=D,a.width<D&&(a.width=D);var F=E.rect.height;p>0&&(F+=a.verticalPadding);var W=0;F>a.rowHeight[p]&&(W=a.rowHeight[p],a.rowHeight[p]=F,W=a.rowHeight[p]-W),a.height+=W,a.rows[p].push(E)},A.prototype.getShortestRowIndex=function(a){for(var E=-1,p=Number.MAX_VALUE,m=0;m<a.rows.length;m++)a.rowWidth[m]<p&&(E=m,p=a.rowWidth[m]);return E},A.prototype.getLongestRowIndex=function(a){for(var E=-1,p=Number.MIN_VALUE,m=0;m<a.rows.length;m++)a.rowWidth[m]>p&&(E=m,p=a.rowWidth[m]);return E},A.prototype.canAddHorizontal=function(a,E,p){if(a.idealRowWidth){var m=a.rows.length-1,y=a.rowWidth[m];return y+E+a.horizontalPadding<=a.idealRowWidth}var S=this.getShortestRowIndex(a);if(S<0)return!0;var D=a.rowWidth[S];if(D+a.horizontalPadding+E<=a.width)return!0;var F=0;a.rowHeight[S]<p&&S>0&&(F=p+a.verticalPadding-a.rowHeight[S]);var W;a.width-D>=E+a.horizontalPadding?W=(a.height+F)/(D+E+a.horizontalPadding):W=(a.height+F)/a.width,F=p+a.verticalPadding;var R;return a.width<E?R=(a.height+F)/E:R=(a.height+F)/a.width,R<1&&(R=1/R),W<1&&(W=1/W),W<R},A.prototype.shiftToLastRow=function(a){var E=this.getLongestRowIndex(a),p=a.rowWidth.length-1,m=a.rows[E],y=m[m.length-1],S=y.width+a.horizontalPadding;if(a.width-a.rowWidth[p]>S&&E!=p){m.splice(-1,1),a.rows[p].push(y),a.rowWidth[E]=a.rowWidth[E]-S,a.rowWidth[p]=a.rowWidth[p]+S,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var D=Number.MIN_VALUE,F=0;F<m.length;F++)m[F].height>D&&(D=m[F].height);E>0&&(D+=a.verticalPadding);var W=a.rowHeight[E]+a.rowHeight[p];a.rowHeight[E]=D,a.rowHeight[p]<y.height+a.verticalPadding&&(a.rowHeight[p]=y.height+a.verticalPadding);var R=a.rowHeight[E]+a.rowHeight[p];a.height+=R-W,this.shiftToLastRow(a)}},A.prototype.tilingPreLayout=function(){o.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},A.prototype.tilingPostLayout=function(){o.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},A.prototype.reduceTrees=function(){for(var a=[],E=!0,p;E;){var m=this.graphManager.getAllNodes(),y=[];E=!1;for(var S=0;S<m.length;S++)if(p=m[S],p.getEdges().length==1&&!p.getEdges()[0].isInterGraph&&p.getChild()==null){if(o.PURE_INCREMENTAL){var D=p.getEdges()[0].getOtherEnd(p),F=new L(p.getCenterX()-D.getCenterX(),p.getCenterY()-D.getCenterY());y.push([p,p.getEdges()[0],p.getOwner(),F])}else y.push([p,p.getEdges()[0],p.getOwner()]);E=!0}if(E==!0){for(var W=[],R=0;R<y.length;R++)y[R][0].getEdges().length==1&&(W.push(y[R]),y[R][0].getOwner().remove(y[R][0]));a.push(W),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=a},A.prototype.growTree=function(a){for(var E=a.length,p=a[E-1],m,y=0;y<p.length;y++)m=p[y],this.findPlaceforPrunedNode(m),m[2].add(m[0]),m[2].add(m[1],m[1].source,m[1].target);a.splice(a.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},A.prototype.findPlaceforPrunedNode=function(a){var E,p,m=a[0];if(m==a[1].source?p=a[1].target:p=a[1].source,o.PURE_INCREMENTAL)m.setCenter(p.getCenterX()+a[3].getWidth(),p.getCenterY()+a[3].getHeight());else{var y=p.startX,S=p.finishX,D=p.startY,F=p.finishY,W=0,R=0,Q=0,z=0,X=[W,Q,R,z];if(D>0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][D-1].length+this.grid[rt][D].length-1;if(S<this.grid.length-1)for(var rt=D;rt<=F;rt++)X[1]+=this.grid[S+1][rt].length+this.grid[S][rt].length-1;if(F<this.grid[0].length-1)for(var rt=y;rt<=S;rt++)X[2]+=this.grid[rt][F+1].length+this.grid[rt][F].length-1;if(y>0)for(var rt=D;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,O,H,Z=0;Z<X.length;Z++)X[Z]<$?($=X[Z],O=1,H=Z):X[Z]==$&&O++;if(O==3&&$==0)X[0]==0&&X[1]==0&&X[2]==0?E=1:X[0]==0&&X[1]==0&&X[3]==0?E=0:X[0]==0&&X[2]==0&&X[3]==0?E=3:X[1]==0&&X[2]==0&&X[3]==0&&(E=2);else if(O==2&&$==0){var tt=Math.floor(Math.random()*2);X[0]==0&&X[1]==0?tt==0?E=0:E=1:X[0]==0&&X[2]==0?tt==0?E=0:E=2:X[0]==0&&X[3]==0?tt==0?E=0:E=3:X[1]==0&&X[2]==0?tt==0?E=1:E=2:X[1]==0&&X[3]==0?tt==0?E=1:E=3:tt==0?E=2:E=3}else if(O==4&&$==0){var tt=Math.floor(Math.random()*4);E=tt}else E=H;E==0?m.setCenter(p.getCenterX(),p.getCenterY()-p.getHeight()/2-h.DEFAULT_EDGE_LENGTH-m.getHeight()/2):E==1?m.setCenter(p.getCenterX()+p.getWidth()/2+h.DEFAULT_EDGE_LENGTH+m.getWidth()/2,p.getCenterY()):E==2?m.setCenter(p.getCenterX(),p.getCenterY()+p.getHeight()/2+h.DEFAULT_EDGE_LENGTH+m.getHeight()/2):m.setCenter(p.getCenterX()-p.getWidth()/2-h.DEFAULT_EDGE_LENGTH-m.getWidth()/2,p.getCenterY())}},n.exports=A}),991:((n,r,i)=>{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,o,c,h){f.call(this,s,o,c,h)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),h,T=0;T<c.length;T++)h=c[T],h.getChild()==null?(h.displacementX+=s,h.displacementY+=o):h.propogateDisplacementToChildren(s,o)},g.prototype.move=function(){var s=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),s.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},g.prototype.setPred1=function(s){this.pred1=s},g.prototype.getPred1=function(){return pred1},g.prototype.getPred2=function(){return pred2},g.prototype.setNext=function(s){this.next=s},g.prototype.getNext=function(){return next},g.prototype.setProcessed=function(s){this.processed=s},g.prototype.isProcessed=function(){return processed},n.exports=g}),902:((n,r,i)=>{function f(c){if(Array.isArray(c)){for(var h=0,T=Array(c.length);h<c.length;h++)T[h]=c[h];return T}else return Array.from(c)}var e=i(806),g=i(551).LinkedList,t=i(551).Matrix,s=i(551).SVD;function o(){}o.handleConstraints=function(c){var h={};h.fixedNodeConstraint=c.constraints.fixedNodeConstraint,h.alignmentConstraint=c.constraints.alignmentConstraint,h.relativePlacementConstraint=c.constraints.relativePlacementConstraint;for(var T=new Map,u=new Map,d=[],L=[],b=c.getAllNodes(),w=0,G=0;G<b.length;G++){var V=b[G];V.getChild()==null&&(u.set(V.id,w++),d.push(V.getCenterX()),L.push(V.getCenterY()),T.set(V.id,V))}h.relativePlacementConstraint&&h.relativePlacementConstraint.forEach(function(P){!P.gap&&P.gap!=0&&(P.left?P.gap=e.DEFAULT_EDGE_LENGTH+T.get(P.left).getWidth()/2+T.get(P.right).getWidth()/2:P.gap=e.DEFAULT_EDGE_LENGTH+T.get(P.top).getHeight()/2+T.get(P.bottom).getHeight()/2)});var Y=function(U,k){return{x:U.x-k.x,y:U.y-k.y}},B=function(U){var k=0,K=0;return U.forEach(function(q){k+=d[u.get(q)],K+=L[u.get(q)]}),{x:k/U.size,y:K/U.size}},A=function(U,k,K,q,at){function gt(lt,ot){var Lt=new Set(lt),ft=!0,st=!1,Xt=void 0;try{for(var Tt=ot[Symbol.iterator](),wt;!(ft=(wt=Tt.next()).done);ft=!0){var $t=wt.value;Lt.add($t)}}catch(bt){st=!0,Xt=bt}finally{try{!ft&&Tt.return&&Tt.return()}finally{if(st)throw Xt}}return Lt}var nt=new Map;U.forEach(function(lt,ot){nt.set(ot,0)}),U.forEach(function(lt,ot){lt.forEach(function(Lt){nt.set(Lt.id,nt.get(Lt.id)+1)})});var et=new Map,_=new Map,dt=new g;nt.forEach(function(lt,ot){lt==0?(dt.push(ot),K||(k=="horizontal"?et.set(ot,u.has(ot)?d[u.get(ot)]:q.get(ot)):et.set(ot,u.has(ot)?L[u.get(ot)]:q.get(ot)))):et.set(ot,Number.NEGATIVE_INFINITY),K&&_.set(ot,new Set([ot]))}),K&&at.forEach(function(lt){var ot=[];if(lt.forEach(function(st){K.has(st)&&ot.push(st)}),ot.length>0){var Lt=0;ot.forEach(function(st){k=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){k=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var Mt=function(){var ot=dt.shift(),Lt=U.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)<et.get(ot)+ft.gap)if(K&&K.has(ft.id)){var st=void 0;if(k=="horizontal"?st=u.has(ft.id)?d[u.get(ft.id)]:q.get(ft.id):st=u.has(ft.id)?L[u.get(ft.id)]:q.get(ft.id),et.set(ft.id,st),st<et.get(ot)+ft.gap){var Xt=et.get(ot)+ft.gap-st;_.get(ot).forEach(function(Tt){et.set(Tt,et.get(Tt)-Xt)})}}else et.set(ft.id,et.get(ot)+ft.gap);nt.set(ft.id,nt.get(ft.id)-1),nt.get(ft.id)==0&&dt.push(ft.id),K&&_.set(ft.id,gt(_.get(ot),_.get(ft.id)))})};dt.length!=0;)Mt();if(K){var pt=new Set;U.forEach(function(lt,ot){lt.length==0&&pt.add(ot)});var xt=[];_.forEach(function(lt,ot){if(pt.has(ot)){var Lt=!1,ft=!0,st=!1,Xt=void 0;try{for(var Tt=lt[Symbol.iterator](),wt;!(ft=(wt=Tt.next()).done);ft=!0){var $t=wt.value;K.has($t)&&(Lt=!0)}}catch(St){st=!0,Xt=St}finally{try{!ft&&Tt.return&&Tt.return()}finally{if(st)throw Xt}}if(!Lt){var bt=!1,zt=void 0;xt.forEach(function(St,Zt){St.has([].concat(f(lt))[0])&&(bt=!0,zt=Zt)}),bt?lt.forEach(function(St){xt[zt].add(St)}):xt.push(new Set(lt))}}}),xt.forEach(function(lt,ot){var Lt=Number.POSITIVE_INFINITY,ft=Number.POSITIVE_INFINITY,st=Number.NEGATIVE_INFINITY,Xt=Number.NEGATIVE_INFINITY,Tt=!0,wt=!1,$t=void 0;try{for(var bt=lt[Symbol.iterator](),zt;!(Tt=(zt=bt.next()).done);Tt=!0){var St=zt.value,Zt=void 0;k=="horizontal"?Zt=u.has(St)?d[u.get(St)]:q.get(St):Zt=u.has(St)?L[u.get(St)]:q.get(St);var Kt=et.get(St);Zt<Lt&&(Lt=Zt),Zt>st&&(st=Zt),Kt<ft&&(ft=Kt),Kt>Xt&&(Xt=Kt)}}catch(ee){wt=!0,$t=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(wt)throw $t}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},j=function(U){var k=0,K=0,q=0,at=0;if(U.forEach(function(_){_.left?d[u.get(_.left)]-d[u.get(_.right)]>=0?k++:K++:L[u.get(_.top)]-L[u.get(_.bottom)]>=0?q++:at++}),k>K&&q>at)for(var gt=0;gt<u.size;gt++)d[gt]=-1*d[gt],L[gt]=-1*L[gt];else if(k>K)for(var nt=0;nt<u.size;nt++)d[nt]=-1*d[nt];else if(q>at)for(var et=0;et<u.size;et++)L[et]=-1*L[et]},a=function(U){var k=[],K=new g,q=new Set,at=0;return U.forEach(function(gt,nt){if(!q.has(nt)){k[at]=[];var et=nt;for(K.push(et),q.add(et),k[at].push(et);K.length!=0;){et=K.shift();var _=U.get(et);_.forEach(function(dt){q.has(dt.id)||(K.push(dt.id),q.add(dt.id),k[at].push(dt.id))})}at++}}),k},E=function(U){var k=new Map;return U.forEach(function(K,q){k.set(q,[])}),U.forEach(function(K,q){K.forEach(function(at){k.get(q).push(at),k.get(at.id).push({id:q,gap:at.gap,direction:at.direction})})}),k},p=function(U){var k=new Map;return U.forEach(function(K,q){k.set(q,[])}),U.forEach(function(K,q){K.forEach(function(at){k.get(at.id).push({id:q,gap:at.gap,direction:at.direction})})}),k},m=[],y=[],S=!1,D=!1,F=new Set,W=new Map,R=new Map,Q=[];if(h.fixedNodeConstraint&&h.fixedNodeConstraint.forEach(function(P){F.add(P.nodeId)}),h.relativePlacementConstraint&&(h.relativePlacementConstraint.forEach(function(P){P.left?(W.has(P.left)?W.get(P.left).push({id:P.right,gap:P.gap,direction:"horizontal"}):W.set(P.left,[{id:P.right,gap:P.gap,direction:"horizontal"}]),W.has(P.right)||W.set(P.right,[])):(W.has(P.top)?W.get(P.top).push({id:P.bottom,gap:P.gap,direction:"vertical"}):W.set(P.top,[{id:P.bottom,gap:P.gap,direction:"vertical"}]),W.has(P.bottom)||W.set(P.bottom,[]))}),R=E(W),Q=a(R)),e.TRANSFORM_ON_CONSTRAINT_HANDLING){if(h.fixedNodeConstraint&&h.fixedNodeConstraint.length>1)h.fixedNodeConstraint.forEach(function(P,U){m[U]=[P.position.x,P.position.y],y[U]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(h.alignmentConstraint)(function(){var P=0;if(h.alignmentConstraint.vertical){for(var U=h.alignmentConstraint.vertical,k=function(et){var _=new Set;U[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).x,U[et].forEach(function(pt){m[P]=[Mt,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K<U.length;K++)k(K);S=!0}if(h.alignmentConstraint.horizontal){for(var q=h.alignmentConstraint.horizontal,at=function(et){var _=new Set;q[et].forEach(function(pt){_.add(pt)});var dt=new Set([].concat(f(_)).filter(function(pt){return F.has(pt)})),Mt=void 0;dt.size>0?Mt=d[u.get(dt.values().next().value)]:Mt=B(_).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],Mt],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},gt=0;gt<q.length;gt++)at(gt);S=!0}h.relativePlacementConstraint&&(D=!0)})();else if(h.relativePlacementConstraint){for(var z=0,X=0,rt=0;rt<Q.length;rt++)Q[rt].length>z&&(z=Q[rt].length,X=rt);if(z<R.size/2)j(h.relativePlacementConstraint),S=!1,D=!1;else{var $=new Map,O=new Map,H=[];Q[X].forEach(function(P){W.get(P).forEach(function(U){U.direction=="horizontal"?($.has(P)?$.get(P).push(U):$.set(P,[U]),$.has(U.id)||$.set(U.id,[]),H.push({left:P,right:U.id})):(O.has(P)?O.get(P).push(U):O.set(P,[U]),O.has(U.id)||O.set(U.id,[]),H.push({top:P,bottom:U.id}))})}),j(H),D=!1;var Z=A($,"horizontal"),tt=A(O,"vertical");Q[X].forEach(function(P,U){y[U]=[d[u.get(P)],L[u.get(P)]],m[U]=[],Z.has(P)?m[U][0]=Z.get(P):m[U][0]=d[u.get(P)],tt.has(P)?m[U][1]=tt.get(P):m[U][1]=L[u.get(P)]}),S=!0}}if(S){for(var ht=void 0,J=t.transpose(m),It=t.transpose(y),Nt=0;Nt<J.length;Nt++)J[Nt]=t.multGamma(J[Nt]),It[Nt]=t.multGamma(It[Nt]);var vt=t.multMat(J,t.transpose(It)),it=s.svd(vt);ht=t.multMat(it.V,t.transpose(it.U));for(var ut=0;ut<u.size;ut++){var Et=[d[ut],L[ut]],Ct=[ht[0][0],ht[1][0]],Dt=[ht[0][1],ht[1][1]];d[ut]=t.dotProduct(Et,Ct),L[ut]=t.dotProduct(Et,Dt)}D&&j(h.relativePlacementConstraint)}}if(e.ENFORCE_CONSTRAINTS){if(h.fixedNodeConstraint&&h.fixedNodeConstraint.length>0){var mt={x:0,y:0};h.fixedNodeConstraint.forEach(function(P,U){var k={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=Y(K,k);mt.x+=q.x,mt.y+=q.y}),mt.x/=h.fixedNodeConstraint.length,mt.y/=h.fixedNodeConstraint.length,d.forEach(function(P,U){d[U]+=mt.x}),L.forEach(function(P,U){L[U]+=mt.y}),h.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var Ot=h.alignmentConstraint.vertical,Rt=function(U){var k=new Set;Ot[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=B(k).x,k.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht<Ot.length;Ht++)Rt(Ht);if(h.alignmentConstraint.horizontal)for(var Ut=h.alignmentConstraint.horizontal,Pt=function(U){var k=new Set;Ut[U].forEach(function(at){k.add(at)});var K=new Set([].concat(f(k)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=L[u.get(K.values().next().value)]:q=B(k).y,k.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft<Ut.length;Ft++)Pt(Ft)}h.relativePlacementConstraint&&(function(){var P=new Map,U=new Map,k=new Map,K=new Map,q=new Map,at=new Map,gt=new Set,nt=new Set;if(F.forEach(function(Gt){gt.add(Gt),nt.add(Gt)}),h.alignmentConstraint){if(h.alignmentConstraint.vertical)for(var et=h.alignmentConstraint.vertical,_=function(yt){k.set("dummy"+yt,[]),et[yt].forEach(function(At){P.set(At,"dummy"+yt),k.get("dummy"+yt).push(At),F.has(At)&&gt.add("dummy"+yt)}),q.set("dummy"+yt,d[u.get(et[yt][0])])},dt=0;dt<et.length;dt++)_(dt);if(h.alignmentConstraint.horizontal)for(var Mt=h.alignmentConstraint.horizontal,pt=function(yt){K.set("dummy"+yt,[]),Mt[yt].forEach(function(At){U.set(At,"dummy"+yt),K.get("dummy"+yt).push(At),F.has(At)&&nt.add("dummy"+yt)}),at.set("dummy"+yt,L[u.get(Mt[yt][0])])},xt=0;xt<Mt.length;xt++)pt(xt)}var lt=new Map,ot=new Map,Lt=function(yt){W.get(yt).forEach(function(At){var kt=void 0,Bt=void 0;At.direction=="horizontal"?(kt=P.get(yt)?P.get(yt):yt,P.get(At.id)?Bt={id:P.get(At.id),gap:At.gap,direction:At.direction}:Bt=At,lt.has(kt)?lt.get(kt).push(Bt):lt.set(kt,[Bt]),lt.has(Bt.id)||lt.set(Bt.id,[])):(kt=U.get(yt)?U.get(yt):yt,U.get(At.id)?Bt={id:U.get(At.id),gap:At.gap,direction:At.direction}:Bt=At,ot.has(kt)?ot.get(kt).push(Bt):ot.set(kt,[Bt]),ot.has(Bt.id)||ot.set(Bt.id,[]))})},ft=!0,st=!1,Xt=void 0;try{for(var Tt=W.keys()[Symbol.iterator](),wt;!(ft=(wt=Tt.next()).done);ft=!0){var $t=wt.value;Lt($t)}}catch(Gt){st=!0,Xt=Gt}finally{try{!ft&&Tt.return&&Tt.return()}finally{if(st)throw Xt}}var bt=E(lt),zt=E(ot),St=a(bt),Zt=a(zt),Kt=p(lt),ce=p(ot),Qt=[],jt=[];St.forEach(function(Gt,yt){Qt[yt]=[],Gt.forEach(function(At){Kt.get(At).length==0&&Qt[yt].push(At)})}),Zt.forEach(function(Gt,yt){jt[yt]=[],Gt.forEach(function(At){ce.get(At).length==0&&jt[yt].push(At)})});var _t=A(lt,"horizontal",gt,q,Qt),Jt=A(ot,"vertical",nt,at,jt),oe=function(yt){k.get(yt)?k.get(yt).forEach(function(At){d[u.get(At)]=_t.get(yt)}):d[u.get(yt)]=_t.get(yt)},te=!0,ee=!1,Le=void 0;try{for(var ge=_t.keys()[Symbol.iterator](),we;!(te=(we=ge.next()).done);te=!0){var ue=we.value;oe(ue)}}catch(Gt){ee=!0,Le=Gt}finally{try{!te&&ge.return&&ge.return()}finally{if(ee)throw Le}}var ke=function(yt){K.get(yt)?K.get(yt).forEach(function(At){L[u.get(At)]=Jt.get(yt)}):L[u.get(yt)]=Jt.get(yt)},de=!0,Ce=!1,Me=void 0;try{for(var ve=Jt.keys()[Symbol.iterator](),Ae;!(de=(Ae=ve.next()).done);de=!0){var ue=Ae.value;ke(ue)}}catch(Gt){Ce=!0,Me=Gt}finally{try{!de&&ve.return&&ve.return()}finally{if(Ce)throw Me}}})()}for(var Yt=0;Yt<b.length;Yt++){var Vt=b[Yt];Vt.getChild()==null&&Vt.setCenter(d[u.get(Vt.id)],L[u.get(Vt.id)])}},n.exports=o}),551:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(45);return l})()})})(le)),le.exports}var mr=he.exports,xe;function Er(){return xe||(xe=1,(function(I,M){(function(x,N){I.exports=N(yr())})(mr,function(C){return(()=>{var x={658:(n=>{n.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e<i;e++)f[e-1]=arguments[e];return f.forEach(function(g){Object.keys(g).forEach(function(t){return r[t]=g[t]})}),r}}),548:((n,r,i)=>{var f=(function(){function t(s,o){var c=[],h=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(h=(L=d.next()).done)&&(c.push(L.value),!(o&&c.length===o));h=!0);}catch(b){T=!0,u=b}finally{try{!h&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},o=0;o<t.length;o++)s[t[o].id()]=!0;var c=t.filter(function(h,T){typeof h=="number"&&(h=T);for(var u=h.parent()[0];u!=null;){if(s[u.id()])return!1;u=u.parent()[0]}return!0});return c},g.connectComponents=function(t,s,o,c){var h=new e,T=new Set,u=[],d=void 0,L=void 0,b=void 0,w=!1,G=1,V=[],Y=[],B=function(){var j=t.collection();Y.push(j);var a=o[0],E=t.collection();E.merge(a).merge(a.descendants().intersection(s)),u.push(a),E.forEach(function(y){h.push(y),T.add(y),j.merge(y)});for(var p=function(){a=h.shift();var S=t.collection();a.neighborhood().nodes().forEach(function(R){s.intersection(a.edgesWith(R)).length>0&&S.merge(R)});for(var D=0;D<S.length;D++){var F=S[D];if(d=o.intersection(F.union(F.ancestors())),d!=null&&!T.has(d[0])){var W=d.union(d.descendants());W.forEach(function(R){h.push(R),T.add(R),j.merge(R),o.has(R)&&u.push(R)})}}};h.length!=0;)p();if(j.forEach(function(y){s.intersection(y.connectedEdges()).forEach(function(S){j.has(S.source())&&j.has(S.target())&&j.merge(S)})}),u.length==o.length&&(w=!0),!w||w&&G>1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length<b&&(b=y.connectedEdges().length,L=y)}),V.push(L.id());var m=t.collection();m.merge(u[0]),u.forEach(function(y){m.merge(y)}),u=[],o=o.difference(m),G++}};do B();while(!w);return c&&V.length>0&&c.set("dummy"+(c.size+1),V),Y},g.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var V=G.value,Y=f(V,2),B=Y[0],A=Y[1],j=o.cy.getElementById(B);if(j){var a=j.boundingBox(),E=s.xCoords[A]-a.w/2,p=s.xCoords[A]+a.w/2,m=s.yCoords[A]-a.h/2,y=s.yCoords[A]+a.h/2;E<c&&(c=E),p>h&&(h=p),m<T&&(T=m),y>u&&(u=y)}}}catch(R){L=!0,b=R}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(h+c)/2,D=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(R){return R+S}),s.yCoords=s.yCoords.map(function(R){return R+D})}else{Object.keys(s).forEach(function(R){var Q=s[R],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;z<c&&(c=z),X>h&&(h=X),rt<T&&(T=rt),$>u&&(u=$)});var F=t.x-(h+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(R){var Q=s[R];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,o,c){for(var h=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,V=t.descendants().not(":parent"),Y=V.length,B=0;B<Y;B++){var A=V[B];L=s[c.get(A.id())]-A.width()/2,b=s[c.get(A.id())]+A.width()/2,w=o[c.get(A.id())]-A.height()/2,G=o[c.get(A.id())]+A.height()/2,h>L&&(h=L),T<b&&(T=b),u>w&&(u=w),d<G&&(d=G)}var j={};return j.topLeftX=h,j.topLeftY=u,j.width=T-h,j.height=d-u,j},g.calcParentsWithoutChildren=function(t,s){var o=t.collection();return s.nodes(":parent").forEach(function(c){var h=!1;c.children().forEach(function(T){T.css("display")!="none"&&(h=!0)}),h||o.merge(c)}),o},n.exports=g}),816:((n,r,i)=>{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,h=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),V=w.edges(),Y=void 0,B=void 0,A=void 0,j={};d.randomize&&(Y=L.nodeIndexes,B=L.xCoords,A=L.yCoords);var a=function(R){return typeof R=="function"},E=function(R,Q){return a(R)?R(Q):R},p=f.calcParentsWithoutChildren(b,w),m=function W(R,Q,z,X){for(var rt=Q.length,$=0;$<rt;$++){var O=Q[$],H=null;O.intersection(p).length==0&&(H=O.children());var Z=void 0,tt=O.layoutDimensions({nodeDimensionsIncludeLabels:X.nodeDimensionsIncludeLabels});if(O.outerWidth()!=null&&O.outerHeight()!=null)if(X.randomize)if(!O.isParent())Z=R.add(new g(z.graphManager,new t(B[Y.get(O.id())]-tt.w/2,A[Y.get(O.id())]-tt.h/2),new s(parseFloat(tt.w),parseFloat(tt.h))));else{var ht=f.calcBoundingBox(O,B,A,Y);O.intersection(p).length==0?Z=R.add(new g(z.graphManager,new t(ht.topLeftX,ht.topLeftY),new s(ht.width,ht.height))):Z=R.add(new g(z.graphManager,new t(ht.topLeftX,ht.topLeftY),new s(parseFloat(tt.w),parseFloat(tt.h))))}else Z=R.add(new g(z.graphManager,new t(O.position("x")-tt.w/2,O.position("y")-tt.h/2),new s(parseFloat(tt.w),parseFloat(tt.h))));else Z=R.add(new g(this.graphManager));if(Z.id=O.data("id"),Z.nodeRepulsion=E(X.nodeRepulsion,O),Z.paddingLeft=parseInt(O.css("padding")),Z.paddingTop=parseInt(O.css("padding")),Z.paddingRight=parseInt(O.css("padding")),Z.paddingBottom=parseInt(O.css("padding")),X.nodeDimensionsIncludeLabels&&(Z.labelWidth=O.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,Z.labelHeight=O.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,Z.labelPosVertical=O.css("text-valign"),Z.labelPosHorizontal=O.css("text-halign")),j[O.data("id")]=Z,isNaN(Z.rect.x)&&(Z.rect.x=0),isNaN(Z.rect.y)&&(Z.rect.y=0),H!=null&&H.length>0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),Z),W(J,H,z,X)}}},y=function(R,Q,z){for(var X=0,rt=0,$=0;$<z.length;$++){var O=z[$],H=j[O.data("source")],Z=j[O.data("target")];if(H&&Z&&H!==Z&&H.getEdgesBetween(Z).length==0){var tt=Q.add(R.newEdge(),H,Z);tt.id=O.id(),tt.idealLength=E(d.idealEdgeLength,O),tt.edgeElasticity=E(d.edgeElasticity,O),X+=tt.idealLength,rt++}}d.idealEdgeLength!=null&&(rt>0?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:a(d.idealEdgeLength)?h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:h.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,h.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,h.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(R,Q){Q.fixedNodeConstraint&&(R.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(R.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(R.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(h.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(h.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(h.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(h.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(h.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,h.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,h.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,h.TILE=d.tile,h.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,h.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,h.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,h.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!1),d.step=="enforced"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!1),d.step=="cose"&&(h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!1,h.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:h.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?h.TREE_REDUCTION_ON_INCREMENTAL=!1:h.TREE_REDUCTION_ON_INCREMENTAL=!0;var D=new e,F=D.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),D,d),y(D,F,V),S(D,d),D.runLayout(),j};n.exports={coseLayout:T}}),212:((n,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w<b.length;w++){var G=b[w];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(L,G.key,G)}}return function(L,b,w){return b&&d(L.prototype,b),w&&d(L,w),L}})();function e(d,L){if(!(d instanceof L))throw new TypeError("Cannot call a class as a function")}var g=i(658),t=i(548),s=i(657),o=s.spectralLayout,c=i(816),h=c.coseLayout,T=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(L){return 4500},idealEdgeLength:function(L){return 50},edgeElasticity:function(L){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),u=(function(){function d(L){e(this,d),this.options=g({},T,L)}return f(d,[{key:"run",value:function(){var b=this,w=this.options,G=w.cy,V=w.eles,Y=[],B=[],A=void 0,j=[];w.fixedNodeConstraint&&(!Array.isArray(w.fixedNodeConstraint)||w.fixedNodeConstraint.length==0)&&(w.fixedNodeConstraint=void 0),w.alignmentConstraint&&(w.alignmentConstraint.vertical&&(!Array.isArray(w.alignmentConstraint.vertical)||w.alignmentConstraint.vertical.length==0)&&(w.alignmentConstraint.vertical=void 0),w.alignmentConstraint.horizontal&&(!Array.isArray(w.alignmentConstraint.horizontal)||w.alignmentConstraint.horizontal.length==0)&&(w.alignmentConstraint.horizontal=void 0)),w.relativePlacementConstraint&&(!Array.isArray(w.relativePlacementConstraint)||w.relativePlacementConstraint.length==0)&&(w.relativePlacementConstraint=void 0);var a=w.fixedNodeConstraint||w.alignmentConstraint||w.relativePlacementConstraint;a&&(w.tile=!1,w.packComponents=!1);var E=void 0,p=!1;if(G.layoutUtilities&&w.packComponents&&(E=G.layoutUtilities("get"),E||(E=G.layoutUtilities()),p=!0),V.nodes().length>0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(A=t.connectComponents(G,w.eles,S),A.forEach(function(vt){var it=vt.boundingBox();j.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&A.forEach(function(vt){w.eles=vt,Y.push(o(w))}),w.quality=="default"||w.quality=="proof"){var D=G.collection();if(w.tile){var F=new Map,W=[],R=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:R},X=[];if(A.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){D.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),D.length>1){var rt=D.boundingBox();j.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),A.push(D),Y.push(z);for(var $=X.length-1;$>=0;$--)A.splice(X[$],1),Y.splice(X[$],1),j.splice(X[$],1)}}A.forEach(function(vt,it){w.eles=vt,B.push(h(w,Y[it])),t.relocateComponent(j[it],B[it],w)})}else A.forEach(function(vt,it){t.relocateComponent(j[it],Y[it],w)});var O=new Set;if(A.length>1){var H=[],Z=V.filter(function(vt){return vt.css("display")=="none"});A.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=Y[it].nodeIndexes),vt.nodes().not(Z).length>0){var Et={};Et.edges=[],Et.nodes=[];var Ct=void 0;vt.nodes().not(Z).forEach(function(Dt){if(w.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Et.nodes.push({x:Y[it].xCoords[Ct]-Dt.boundingbox().w/2,y:Y[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,Y[it].xCoords,Y[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else B[it][Dt.id()]&&Et.nodes.push({x:B[it][Dt.id()].getLeft(),y:B[it][Dt.id()].getTop(),width:B[it][Dt.id()].getWidth(),height:B[it][Dt.id()].getHeight()})}),vt.edges().forEach(function(Dt){var mt=Dt.source(),Ot=Dt.target();if(mt.css("display")!="none"&&Ot.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Ot.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,Y[it].xCoords,Y[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(Y[it].xCoords[Rt]),Ut.push(Y[it].yCoords[Rt]);if(Ot.isParent()){var Yt=t.calcBoundingBox(Ot,Y[it].xCoords,Y[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(Y[it].xCoords[Ht]),Pt.push(Y[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else B[it][mt.id()]&&B[it][Ot.id()]&&Et.edges.push({startX:B[it][mt.id()].getCenterX(),startY:B[it][mt.id()].getCenterY(),endX:B[it][Ot.id()].getCenterX(),endY:B[it][Ot.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),O.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")Y.forEach(function(vt,it){var ut=vt.xCoords.map(function(Ct){return Ct+tt[it].dx}),Et=vt.yCoords.map(function(Ct){return Ct+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;O.forEach(function(vt){Object.keys(B[vt]).forEach(function(it){var ut=B[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(j.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);Y.push(y)}w.quality=="default"||w.quality=="proof"?(B.push(h(w,Y[0])),t.relocateComponent(j[0],B[0],w)):t.relocateComponent(j[0],Y[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,Ct=void 0,Dt=it.data("id");return B.forEach(function(Ot){Dt in Ot&&(Et={x:Ot[Dt].getRect().getCenterX(),y:Ot[Dt].getRect().getCenterY()},Ct=Ot[Dt])}),w.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Et.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Et.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Et.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Et.y-=Ct.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return Y.forEach(function(Ot){var Rt=Ot.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Ot.xCoords[Rt],y:Ot.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,V),Nt=V.filter(function(vt){return vt.css("display")=="none"});w.eles=V.not(Nt),V.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();n.exports=u}),657:((n,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(o){var c=o.cy,h=o.eles,T=h.nodes(),u=h.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],V=[],Y=[],B=[],A=[],j=[],a=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,S=o.samplingType,D=o.nodeSeparation,F=void 0,W=function(){for(var U=0,k=0,K=!1;k<F;){U=Math.floor(Math.random()*E),K=!1;for(var q=0;q<k;q++)if(Y[q]==U){K=!0;break}if(!K)Y[k]=U,k++;else continue}},R=function(U,k,K){for(var q=[],at=0,gt=0,nt=0,et=void 0,_=[],dt=0,Mt=1,pt=0;pt<E;pt++)_[pt]=p;for(q[gt]=U,_[U]=0;gt>=at;){nt=q[at++];for(var xt=w[nt],lt=0;lt<xt.length;lt++)et=L.get(xt[lt]),_[et]==p&&(_[et]=_[nt]+1,q[++gt]=et);A[nt][k]=_[nt]*D}if(K){for(var ot=0;ot<E;ot++)A[ot][k]<B[ot]&&(B[ot]=A[ot][k]);for(var Lt=0;Lt<E;Lt++)B[Lt]>dt&&(dt=B[Lt],Mt=Lt)}return Mt},Q=function(U){var k=void 0;if(U){k=Math.floor(Math.random()*E);for(var q=0;q<E;q++)B[q]=p;for(var at=0;at<F;at++)Y[at]=k,k=R(k,at,U)}else{W();for(var K=0;K<F;K++)R(Y[K],K,U)}for(var gt=0;gt<E;gt++)for(var nt=0;nt<F;nt++)A[gt][nt]*=A[gt][nt];for(var et=0;et<F;et++)j[et]=[];for(var _=0;_<F;_++)for(var dt=0;dt<F;dt++)j[_][dt]=A[Y[dt]][_]},z=function(){for(var U=g.svd(j),k=U.S,K=U.U,q=U.V,at=k[0]*k[0]*k[0],gt=[],nt=0;nt<F;nt++){gt[nt]=[];for(var et=0;et<F;et++)gt[nt][et]=0,nt==et&&(gt[nt][et]=k[nt]/(k[nt]*k[nt]+at/(k[nt]*k[nt])))}a=e.multMat(e.multMat(q,gt),e.transpose(K))},X=function(){for(var U=void 0,k=void 0,K=[],q=[],at=[],gt=[],nt=0;nt<E;nt++)K[nt]=Math.random(),q[nt]=Math.random();K=e.normalize(K),q=e.normalize(q);for(var et=m,_=m,dt=void 0;;){for(var Mt=0;Mt<E;Mt++)at[Mt]=K[Mt];if(K=e.multGamma(e.multL(e.multGamma(at),A,a)),U=e.dotProduct(at,K),K=e.normalize(K),et=e.dotProduct(at,K),dt=Math.abs(et/_),dt<=1+y&&dt>=1)break;_=et}for(var pt=0;pt<E;pt++)at[pt]=K[pt];for(_=m;;){for(var xt=0;xt<E;xt++)gt[xt]=q[xt];if(gt=e.minusOp(gt,e.multCons(at,e.dotProduct(at,gt))),q=e.multGamma(e.multL(e.multGamma(gt),A,a)),k=e.dotProduct(gt,q),q=e.normalize(q),et=e.dotProduct(gt,q),dt=Math.abs(et/_),dt<=1+y&&dt>=1)break;_=et}for(var lt=0;lt<E;lt++)gt[lt]=q[lt];G=e.multCons(at,Math.sqrt(Math.abs(U))),V=e.multCons(gt,Math.sqrt(Math.abs(k)))};f.connectComponents(c,h,f.getTopMostNodes(T),d),u.forEach(function(P){f.connectComponents(c,h,f.getTopMostNodes(P.descendants().intersection(h)),d)});for(var rt=0,$=0;$<T.length;$++)T[$].isParent()||L.set(T[$].id(),rt++);var O=!0,H=!1,Z=void 0;try{for(var tt=d.keys()[Symbol.iterator](),ht;!(O=(ht=tt.next()).done);O=!0){var J=ht.value;L.set(J,rt++)}}catch(P){H=!0,Z=P}finally{try{!O&&tt.return&&tt.return()}finally{if(H)throw Z}}for(var It=0;It<L.size;It++)w[It]=[];u.forEach(function(P){for(var U=P.children().intersection(h);U.nodes(":childless").length==0;)U=U.nodes()[0].children().intersection(h);var k=0,K=U.nodes(":childless")[0].connectedEdges().length;U.nodes(":childless").forEach(function(q,at){q.connectedEdges().length<K&&(K=q.connectedEdges().length,k=at)}),b.set(P.id(),U.nodes(":childless")[k].id())}),T.forEach(function(P){var U=void 0;P.isParent()?U=L.get(b.get(P.id())):U=L.get(P.id()),P.neighborhood().nodes().forEach(function(k){h.intersection(P.edgesWith(k)).length>0&&(k.isParent()?w[U].push(b.get(k.id())):w[U].push(k.id()))})});var Nt=function(U){var k=L.get(U),K=void 0;d.get(U).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[k].push(K),w[L.get(K)].push(U)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),Ct;!(vt=(Ct=Et.next()).done);vt=!0){var Dt=Ct.value;Nt(Dt)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E<o.sampleSize?E:o.sampleSize;for(var Ot=0;Ot<E;Ot++)A[Ot]=[];for(var Rt=0;Rt<F;Rt++)a[Rt]=[];return o.quality=="draft"||o.step=="all"?(Q(S),z(),X(),mt={nodeIndexes:L,xCoords:G,yCoords:V}):(L.forEach(function(P,U){G.push(c.getElementById(U).position("x")),V.push(c.getElementById(U).position("y"))}),mt={nodeIndexes:L,xCoords:G,yCoords:V}),mt}else{var Ht=L.keys(),Ut=c.getElementById(Ht.next().value),Pt=Ut.position(),Ft=Ut.outerWidth();if(G.push(Pt.x),V.push(Pt.y),E==2){var Yt=c.getElementById(Ht.next().value),Vt=Yt.outerWidth();G.push(Pt.x+Ft/2+Vt/2+o.idealEdgeLength),V.push(Pt.y)}return mt={nodeIndexes:L,xCoords:G,yCoords:V},mt}};n.exports={spectralLayout:t}}),579:((n,r,i)=>{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),n.exports=e}),140:(n=>{n.exports=C})},N={};function v(n){var r=N[n];if(r!==void 0)return r.exports;var i=N[n]={exports:{}};return x[n](i,i.exports,v),i.exports}var l=v(579);return l})()})})(he)),he.exports}var Tr=Er();const Nr=ur(Tr);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:ct(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:ct(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:ct(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:ct(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:ct((I,M)=>I-M+2,"L"),R:ct((I,M)=>I-2,"R"),T:ct((I,M)=>I-M+2,"T"),B:ct((I,M)=>I-2,"B")},Lr=ct(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=ct(function(I){const M=I;return M==="L"||M==="R"||M==="T"||M==="B"},"isArchitectureDirection"),Wt=ct(function(I){const M=I;return M==="L"||M==="R"},"isArchitectureDirectionX"),qt=ct(function(I){const M=I;return M==="T"||M==="B"},"isArchitectureDirectionY"),Ne=ct(function(I,M){const C=Wt(I)&&qt(M),x=qt(I)&&Wt(M);return C||x},"isArchitectureDirectionXY"),wr=ct(function(I){const M=I[0],C=I[1],x=Wt(M)&&qt(C),N=qt(M)&&Wt(C);return x||N},"isArchitecturePairXY"),Cr=ct(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=ct(function(I,M){const C=`${I}${M}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),Mr=ct(function([I,M],C){const x=C[0],N=C[1];return Wt(x)?qt(N)?[I+(x==="L"?-1:1),M+(N==="T"?1:-1)]:[I+(x==="L"?-1:1),M]:Wt(N)?[I+(N==="L"?1:-1),M+(x==="T"?1:-1)]:[I,M+(x==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=ct(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Dr=ct(function(I,M){return Ne(I,M)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=ct(function(I){return I.type==="service"},"isArchitectureService"),xr=ct(function(I){return I.type==="junction"},"isArchitectureJunction"),Pe=ct((I,M)=>{const[C,x]=[I,M].sort();return`${JSON.stringify(C)}-${JSON.stringify(x)}`},"architectureGroupAlignmentKey"),Ge=ct(I=>I.data(),"edgeData"),ie=ct(I=>I.data(),"nodeData"),Ir=or.architecture,ae,Ue=(ae=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(M){this.diagramId=M}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",ir()}addService({id:M,icon:C,in:x,title:N,iconText:v}){if(this.registeredIds.has(M))throw new Error(`The service id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The service [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(x)==="node")throw new Error(`The service [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"service",icon:C,iconText:v,title:N,edges:[],in:x})}getServices(){return[...this.nodes.values()].filter(Or)}addJunction({id:M,in:C}){if(this.registeredIds.has(M))throw new Error(`The junction id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(C!==void 0){if(M===C)throw new Error(`The junction [${M}] cannot be placed within itself`);if(!this.registeredIds.has(C))throw new Error(`The junction [${M}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(C)==="node")throw new Error(`The junction [${M}]'s parent is not a group`)}this.registeredIds.set(M,"node"),this.nodes.set(M,{id:M,type:"junction",edges:[],in:C})}getJunctions(){return[...this.nodes.values()].filter(xr)}getNodes(){return[...this.nodes.values()]}getNode(M){return this.nodes.get(M)??null}addGroup({id:M,icon:C,in:x,title:N}){if(this.registeredIds.has(M))throw new Error(`The group id [${M}] is already in use by another ${this.registeredIds.get(M)}`);if(x!==void 0){if(M===x)throw new Error(`The group [${M}] cannot be placed within itself`);if(!this.registeredIds.has(x))throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(x)==="node")throw new Error(`The group [${M}]'s parent is not a group`)}this.registeredIds.set(M,"group"),this.groups.set(M,{id:M,icon:C,title:N,in:x})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:M,rhsId:C,lhsDir:x,rhsDir:N,lhsInto:v,rhsInto:l,lhsGroup:n,rhsGroup:r,title:i}){if(!Se(x))throw new Error(`Invalid direction given for left hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(x)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${M}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(!this.nodes.has(M)&&!this.groups.has(M))throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(C)&&!this.groups.has(C))throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes.get(M).in,e=this.nodes.get(C).in;if(n&&f&&e&&f==e)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:M,lhsDir:x,lhsInto:v,lhsGroup:n,rhsId:C,rhsDir:N,rhsInto:l,rhsGroup:r,title:i};this.edges.push(g);const t=this.nodes.get(M),s=this.nodes.get(C);t&&s&&(t.edges.push(this.edges[this.edges.length-1]),s.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(M){if(M.members.length<2)throw new Error(`An align directive requires at least two members; got ${M.members.length}`);const C=new Set;M.members.forEach(x=>{if(this.registeredIds.get(x)!=="node")throw new Error(`align ${M.direction} references [${x}], which is not a service or junction`);if(C.has(x))throw new Error(`align ${M.direction} lists [${x}] more than once`);C.add(x)}),this.layoutHints.push(M)}getLayoutHints(){return this.layoutHints}getDataStructures(){var M,C;if(this.dataStructures===void 0){const x=new Map,N=new Map;for(const[i,f]of this.nodes.entries()){const e=new Map;for(const g of f.edges){const t=(M=this.getNode(g.lhsId))==null?void 0:M.in,s=(C=this.getNode(g.rhsId))==null?void 0:C.in;if(t&&s&&t!==s){const o=Dr(g.lhsDir,g.rhsDir);o!=="bend"&&x.set(Pe(t,s),o)}if(g.lhsId===i){const o=ye(g.lhsDir,g.rhsDir);o&&e.set(o,g.rhsId)}else{const o=ye(g.rhsDir,g.lhsDir);o&&e.set(o,g.lhsId)}}N.set(i,e)}const v=new Set,l=new Set(N.keys()),n=ct(i=>{const f=new Map([[i,[0,0]]]),e=[i];for(;e.length>0;){const g=e.shift();if(g){v.add(g),l.delete(g);const t=N.get(g);if(!t)throw new Error(`BFS error: adjacency list for id ${g} not found. Please report this as a bug.`);const s=f.get(g);if(!s)throw new Error(`BFS error: position for id ${g} not found in spatial map. Please report this as a bug.`);const[o,c]=s;t.forEach((h,T)=>{v.has(h)||(f.set(h,Mr([o,c],T)),e.push(h))})}}return f},"BFS"),r=[];for(;l.size>0;){const i=l.values().next().value;r.push(n(i))}this.dataStructures={adjList:N,spatialMaps:r,groupAlignments:x}}return this.dataStructures}setElementForId(M,C){this.elements.set(M,C)}getElementById(M){return this.elements.get(M)}getConfig(){return ar({...Ir,...nr().architecture})}getConfigField(M){return this.getConfig()[M]}},ct(ae,"ArchitectureDB"),ae),Rr=ct((I,M)=>{var C;qe(I,M),I.groups.map(x=>M.addGroup(x)),I.services.map(x=>M.addService({...x,type:"service"})),I.junctions.map(x=>M.addJunction({...x,type:"junction"})),I.edges.map(x=>M.addEdge(x)),(C=I.alignments)==null||C.map(x=>M.addLayoutHint({direction:x.direction,members:[...x.members]}))},"populateDb"),Ye={parser:{yy:void 0},parse:ct(async I=>{var x;const M=await gr("architecture",I);Fe.debug(M);const C=(x=Ye.parser)==null?void 0:x.yy;if(!(C instanceof Ue))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Rr(M,C)},"parse")},Sr=ct(I=>`
2
+ .edge {
3
+ stroke-width: ${I.archEdgeWidth};
4
+ stroke: ${I.archEdgeColor};
5
+ fill: none;
6
+ }
7
+
8
+ .arrow {
9
+ fill: ${I.archEdgeArrowColor};
10
+ }
11
+
12
+ .node-bkg {
13
+ fill: none;
14
+ stroke: ${I.archGroupBorderColor};
15
+ stroke-width: ${I.archGroupBorderWidth};
16
+ stroke-dasharray: 8;
17
+ }
18
+ .node-icon-text {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+
23
+ .node-icon-text > div {
24
+ color: #fff;
25
+ margin: 1px;
26
+ height: fit-content;
27
+ text-align: center;
28
+ overflow: hidden;
29
+ display: -webkit-box;
30
+ -webkit-box-orient: vertical;
31
+ }
32
+ `,"getStyles"),Fr=Sr;function me(I,M){if(I===0)return M();const C=Math.random;let x=I>>>0;Math.random=function(){x=x+1831565813>>>0;let N=x;return N=Math.imul(N^N>>>15,N|1),N^=N+Math.imul(N^N>>>7,N|61),((N^N>>>14)>>>0)/4294967296};try{return M()}finally{Math.random=C}}ct(me,"withSeededRandom");var re=ct(I=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${I}</g>`,"wrapIcon"),ne={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:re('<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},server:{body:re('<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>')},disk:{body:re('<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>')},internet:{body:re('<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},cloud:{body:re('<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},unknown:cr,blank:{body:re("")}}},br=ct(async function(I,M,C,x){const N=C.getConfigField("padding"),v=C.getConfigField("iconSize"),l=v/2,n=v/6,r=n/2;await Promise.all(M.edges().map(async i=>{var Y,B;const{source:f,sourceDir:e,sourceArrow:g,sourceGroup:t,target:s,targetDir:o,targetArrow:c,targetGroup:h,label:T}=Ge(i);let{x:u,y:d}=i[0].sourceEndpoint();const{x:L,y:b}=i[0].midpoint();let{x:w,y:G}=i[0].targetEndpoint();const V=N+4;if(t&&(Wt(e)?u+=e==="L"?-V:V:d+=e==="T"?-V:V+18),h&&(Wt(o)?w+=o==="L"?-V:V:G+=o==="T"?-V:V+18),!t&&((Y=C.getNode(f))==null?void 0:Y.type)==="junction"&&(Wt(e)?u+=e==="L"?l:-l:d+=e==="T"?l:-l),!h&&((B=C.getNode(s))==null?void 0:B.type)==="junction"&&(Wt(o)?w+=o==="L"?l:-l:G+=o==="T"?l:-l),i[0]._private.rscratch){const A=I.insert("g");if(A.insert("path").attr("d",`M ${u},${d} L ${L},${b} L${w},${G} `).attr("class","edge").attr("id",`${x}-${lr(f,s,{prefix:"L"})}`),g){const j=Wt(e)?se[e](u,n):u-r,a=qt(e)?se[e](d,n):d-r;A.insert("polygon").attr("points",Re[e](n)).attr("transform",`translate(${j},${a})`).attr("class","arrow")}if(c){const j=Wt(o)?se[o](w,n):w-r,a=qt(o)?se[o](G,n):G-r;A.insert("polygon").attr("points",Re[o](n)).attr("transform",`translate(${j},${a})`).attr("class","arrow")}if(T){const j=Ne(e,o)?"XY":Wt(e)?"X":"Y";let a=0;j==="X"?a=Math.abs(u-w):j==="Y"?a=Math.abs(d-G)/1.5:a=Math.abs(u-w)/2;const E=A.append("g");if(await Te(E,T,{useHtmlLabels:!1,width:a,classes:"architecture-service-label"},Ee()),E.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),j==="X")E.attr("transform","translate("+L+", "+b+")");else if(j==="Y")E.attr("transform","translate("+L+", "+b+") rotate(-90)");else if(j==="XY"){const p=ye(e,o);if(p&&wr(p)){const m=E.node().getBoundingClientRect(),[y,S]=Ar(p);E.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*y*S*45})`);const D=E.node().getBoundingClientRect();E.attr("transform",`
33
+ translate(${L}, ${b-m.height/2})
34
+ translate(${y*D.width/2}, ${S*D.height/2})
35
+ rotate(${-1*y*S*45}, 0, ${m.height/2})
36
+ `)}}}}}))},"drawEdges"),Pr=ct(async function(I,M,C,x){const v=C.getConfigField("padding")*.75,l=C.getConfigField("fontSize"),r=C.getConfigField("iconSize")/2;await Promise.all(M.nodes().map(async i=>{const f=ie(i);if(f.type==="group"){const{h:e,w:g,x1:t,y1:s}=i.boundingBox(),o=I.append("rect");o.attr("id",`${x}-group-${f.id}`).attr("x",t+r).attr("y",s+r).attr("width",g).attr("height",e).attr("class","node-bkg");const c=I.append("g");let h=t,T=s;if(f.icon){const u=c.append("g");u.html(`<g>${await pe(f.icon,{height:v,width:v,fallbackPrefix:ne.prefix})}</g>`),u.attr("transform","translate("+(h+r+1)+", "+(T+r+1)+")"),h+=v,T+=l/2-1-2}if(f.label){const u=c.append("g");await Te(u,f.label,{useHtmlLabels:!1,width:g,classes:"architecture-service-label"},Ee()),u.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),u.attr("transform","translate("+(h+r+4)+", "+(T+r+2)+")")}C.setElementForId(f.id,o)}}))},"drawGroups"),Gr=ct(async function(I,M,C,x){const N=Ee();for(const v of C){const l=M.append("g"),n=I.getConfigField("iconSize");if(v.title){const e=l.append("g");await Te(e,v.title,{useHtmlLabels:!1,width:n*1.5,classes:"architecture-service-label"},N),e.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),e.attr("transform","translate("+n/2+", "+n+")")}const r=l.append("g");if(v.icon)r.html(`<g>${await pe(v.icon,{height:n,width:n,fallbackPrefix:ne.prefix})}</g>`);else if(v.iconText){r.html(`<g>${await pe("blank",{height:n,width:n,fallbackPrefix:ne.prefix})}</g>`);const t=r.append("g").append("foreignObject").attr("width",n).attr("height",n).append("div").attr("class","node-icon-text").attr("style",`height: ${n}px;`).append("div").html(sr(v.iconText,N)),s=parseInt(window.getComputedStyle(t.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;t.attr("style",`-webkit-line-clamp: ${Math.floor((n-2)/s)};`)}else r.append("path").attr("class","node-bkg").attr("id",`${x}-node-${v.id}`).attr("d",`M0,${n} V5 Q0,0 5,0 H${n-5} Q${n},0 ${n},5 V${n} Z`);l.attr("id",`${x}-service-${v.id}`).attr("class","architecture-service");const{width:i,height:f}=l.node().getBBox();v.width=i,v.height=f,I.setElementForId(v.id,l)}return 0},"drawServices"),Ur=ct(function(I,M,C,x){C.forEach(N=>{const v=M.append("g"),l=I.getConfigField("iconSize");v.append("g").append("rect").attr("id",`${x}-node-${N.id}`).attr("fill-opacity","0").attr("width",l).attr("height",l),v.attr("class","architecture-junction");const{width:r,height:i}=v._groups[0][0].getBBox();v.width=r,v.height=i,I.setElementForId(N.id,v)})},"drawJunctions");fr([{name:ne.prefix,icons:ne}]);be.use(Nr);function Xe(I,M,C){I.forEach(x=>{M.add({group:"nodes",data:{type:"service",id:x.id,icon:x.icon,label:x.title,parent:x.in,width:C.getConfigField("iconSize"),height:C.getConfigField("iconSize")},classes:"node-service"})})}ct(Xe,"addServices");function He(I,M,C){I.forEach(x=>{M.add({group:"nodes",data:{type:"junction",id:x.id,parent:x.in,width:C.getConfigField("iconSize"),height:C.getConfigField("iconSize")},classes:"node-junction"})})}ct(He,"addJunctions");function We(I,M){M.nodes().map(C=>{const x=ie(C);if(x.type==="group")return;x.x=C.position().x,x.y=C.position().y,I.getElementById(x.id).attr("transform","translate("+(x.x||0)+","+(x.y||0)+")")})}ct(We,"positionNodes");function Ve(I,M){I.forEach(C=>{M.add({group:"nodes",data:{type:"group",id:C.id,icon:C.icon,label:C.title,parent:C.in},classes:"node-group"})})}ct(Ve,"addGroups");function ze(I,M){I.forEach(C=>{const{lhsId:x,rhsId:N,lhsInto:v,lhsGroup:l,rhsInto:n,lhsDir:r,rhsDir:i,rhsGroup:f,title:e}=C,g=Ne(C.lhsDir,C.rhsDir)?"segments":"straight",t={id:`${x}-${N}`,label:e,source:x,sourceDir:r,sourceArrow:v,sourceGroup:l,sourceEndpoint:r==="L"?"0 50%":r==="R"?"100% 50%":r==="T"?"50% 0":"50% 100%",target:N,targetDir:i,targetArrow:n,targetGroup:f,targetEndpoint:i==="L"?"0 50%":i==="R"?"100% 50%":i==="T"?"50% 0":"50% 100%"};M.add({group:"edges",data:t,classes:g})})}ct(ze,"addEdges");function $e(I,M,C,x=[]){const N=ct((g,t)=>{const s=new Map;for(const[o,c]of g.entries()){const h=`${o}`;let T=0;const u=[...c.entries()];if(u.length===1){s.set(h,u[0][1]);continue}for(let d=0;d<u.length-1;d++)for(let L=d+1;L<u.length;L++){const[b,w]=u[d],[G,V]=u[L];if(C.get(Pe(b,G))===t)s.set(h,[...s.get(h)??[],...w,...V]);else if(b==="default"||G==="default")s.set(h,[...s.get(h)??[],...w,...V]);else{const B=`${h}-${T++}`;s.set(B,w);const A=`${h}-${T++}`;s.set(A,V)}}}return s},"flattenAlignments"),v=M.map(g=>{const t=new Map,s=new Map;return g.forEach(([o,c],h)=>{var L;const T=((L=I.getNode(h))==null?void 0:L.in)??"default",u=t.get(c)??new Map;t.has(c)||t.set(c,u);const d=s.get(o)??new Map;s.has(o)||s.set(o,d);for(const b of[u,d]){const w=b.get(T)??[];b.has(T)||b.set(T,w),w.push(h)}}),{horiz:[...N(t,"horizontal").values()].filter(o=>o.length>1),vert:[...N(s,"vertical").values()].filter(o=>o.length>1)}}),[l,n]=v.reduce(([g,t],{horiz:s,vert:o})=>[[...g,...s],[...t,...o]],[[],[]]),r=new Set;x.forEach(g=>g.members.forEach(t=>r.add(t)));const i=ct(g=>g.filter(t=>!t.some(s=>r.has(s))),"dropOverlapping"),f=i(l),e=i(n);return x.forEach(g=>{g.members.length<2||(g.direction==="row"?f.push([...g.members]):e.push([...g.members]))}),{horizontal:f,vertical:e}}ct($e,"getAlignments");function Be(I,M,C=[]){const x=[],N=M.getConfigField("iconSize"),v=M.getConfigField("idealEdgeLengthMultiplier"),l=v*N,n=new Set;C.forEach(f=>{for(let e=0;e<f.members.length-1;e++){const g=f.members[e],t=f.members[e+1];n.add(`${g}|${t}`),n.add(`${t}|${g}`),f.direction==="row"?x.push({left:g,right:t,gap:l}):x.push({top:g,bottom:t,gap:l})}});const r=ct(f=>`${f[0]},${f[1]}`,"posToStr"),i=ct(f=>f.split(",").map(e=>parseInt(e)),"strToPos");return I.forEach(f=>{const e=new Map([...f.entries()].map(([o,c])=>[r(c),o])),g=[r([0,0])],t={},s={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;g.length>0;){const o=g.shift();if(o){t[o]=1;const c=e.get(o);if(c){const h=i(o);Object.entries(s).forEach(([T,u])=>{const d=r([h[0]+u[0],h[1]+u[1]]),L=e.get(d);if(L&&!t[d]){if(g.push(d),n.has(`${c}|${L}`))return;x.push({[Ie[T]]:L,[Ie[Lr(T)]]:c,gap:v*N})}})}}}}),x}ct(Be,"getRelativeConstraints");function Ze(I,M,C,x,N,{spatialMaps:v,groupAlignments:l}){return new Promise(n=>{const r=hr("body").append("div").attr("id","cy").attr("style","display:none"),i=be({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${N.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${N.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});r.remove(),Ve(C,i),Xe(I,i,N),He(M,i,N),ze(x,i);const f=N.getLayoutHints(),e=$e(N,v,l,f),g=Be(v,N,f),t=N.getConfigField("iconSize"),s=N.getConfigField("idealEdgeLengthMultiplier")*t,o=.5*t,c=N.getConfigField("edgeElasticity"),h=N.getConfigField("seed"),T=i.layout({name:"fcose",quality:"proof",randomize:N.getConfigField("randomize"),nodeSeparation:N.getConfigField("nodeSeparation"),numIter:N.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(u){const[d,L]=u.connectedNodes(),{parent:b}=ie(d),{parent:w}=ie(L);return b===w?s:o},edgeElasticity(u){const[d,L]=u.connectedNodes(),{parent:b}=ie(d),{parent:w}=ie(L);return b===w?c:.001},alignmentConstraint:e,relativePlacementConstraint:g});T.one("layoutstop",()=>{var d;function u(L,b,w,G){let V,Y;const{x:B,y:A}=L,{x:j,y:a}=b;Y=(G-A+(B-w)*(A-a)/(B-j))/Math.sqrt(1+Math.pow((A-a)/(B-j),2)),V=Math.sqrt(Math.pow(G-A,2)+Math.pow(w-B,2)-Math.pow(Y,2));const E=Math.sqrt(Math.pow(j-B,2)+Math.pow(a-A,2));V=V/E;let p=(j-B)*(G-A)-(a-A)*(w-B);switch(!0){case p>=0:p=1;break;case p<0:p=-1;break}let m=(j-B)*(w-B)+(a-A)*(G-A);switch(!0){case m>=0:m=1;break;case m<0:m=-1;break}return Y=Math.abs(Y)*p,V=V*m,{distances:Y,weights:V}}ct(u,"getSegmentWeights"),i.startBatch();for(const L of Object.values(i.edges()))if((d=L.data)!=null&&d.call(L)){const{x:b,y:w}=L.source().position(),{x:G,y:V}=L.target().position();if(b!==G&&w!==V){const Y=L.sourceEndpoint(),B=L.targetEndpoint(),{sourceDir:A}=Ge(L),[j,a]=qt(A)?[Y.x,B.y]:[B.x,Y.y],{weights:E,distances:p}=u(Y,B,j,a);L.style("segment-distances",p),L.style("segment-weights",E)}}i.endBatch(),me(h,()=>T.run())});try{me(h,()=>T.run())}catch(u){throw u instanceof RangeError&&u.message.includes("Invalid array length")?new Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis."):u}i.ready(u=>{Fe.info("Ready",u),n(i)})})}ct(Ze,"layoutArchitecture");var Yr=ct(async(I,M,C,x)=>{const N=x.db;N.setDiagramId(M);const v=N.getServices(),l=N.getJunctions(),n=N.getGroups(),r=N.getEdges(),i=N.getDataStructures(),f=Qe(M),e=f.append("g");e.attr("class","architecture-edges");const g=f.append("g");g.attr("class","architecture-services");const t=f.append("g");t.attr("class","architecture-groups"),await Gr(N,g,v,M),Ur(N,g,l,M);const s=await Ze(v,l,n,r,N,i);await br(e,s,N,M),await Pr(t,s,N,M),We(N,s),Je(void 0,f,N.getConfigField("padding"),N.getConfigField("useMaxWidth"))},"draw"),Xr={draw:Yr},Br={parser:Ye,get db(){return new Ue},renderer:Xr,styles:Fr};export{Br as diagram};