├── .gitignore ├── app ├── style.css ├── pages │ ├── error │ │ ├── error.pug │ │ └── page.js │ ├── errors │ │ ├── errors.pug │ │ ├── normalize.js │ │ └── page.js │ ├── warnings │ │ ├── warnings.pug │ │ └── page.js │ ├── home │ │ ├── page.js │ │ └── home.pug │ ├── assets │ │ ├── page.js │ │ └── assets.pug │ ├── chunks │ │ ├── page.js │ │ └── chunks.pug │ ├── select │ │ ├── page.js │ │ └── application.pug │ ├── chunk │ │ ├── page.js │ │ └── chunk.pug │ ├── module │ │ ├── page.js │ │ └── module.pug │ ├── modules │ │ ├── page.js │ │ └── modules.pug │ ├── upload │ │ ├── application.pug │ │ └── page.js │ └── hints │ │ ├── page.js │ │ └── hints.pug ├── findById.js ├── formatSize.js ├── index.html ├── googleAnalytics.js ├── percentageToColor.js ├── entry.js ├── graphs │ ├── chunks.js │ └── modules.js └── app.js ├── web_modules └── sigma.js │ ├── patch-force-atlas.js │ ├── plugins │ ├── sigma.parsers.json.min.js │ ├── sigma.plugins.neighborhoods.min.js │ ├── sigma.plugins.animate.min.js │ ├── sigma.parsers.gexf.min.js │ └── sigma.layout.forceAtlas2.min.js │ ├── index.js │ ├── README.md │ └── sigma.min.js ├── .prettierrc.js ├── README.md ├── package.json ├── webpack.config.js └── Gruntfile.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /dist 3 | /.grunt 4 | *.log -------------------------------------------------------------------------------- /app/style.css: -------------------------------------------------------------------------------- 1 | table pre { 2 | margin-bottom: 0px; 3 | } 4 | .sortable-th { 5 | cursor: pointer; 6 | } 7 | -------------------------------------------------------------------------------- /app/pages/error/error.pug: -------------------------------------------------------------------------------- 1 | .jumbotron 2 | h1 3 | span Page 4 | code= page 5 | span not found 6 | p: a.btn.btn-primary.btn-lg(href="#home") Back home -------------------------------------------------------------------------------- /app/pages/errors/errors.pug: -------------------------------------------------------------------------------- 1 | if errors.length === 0 2 | h2 No errors. 3 | each error in errors 4 | .alert.alert-danger 5 | h4= error.moduleName 6 | pre= error.message -------------------------------------------------------------------------------- /app/pages/warnings/warnings.pug: -------------------------------------------------------------------------------- 1 | if warnings.length === 0 2 | h2 No warnings. 3 | each warning in warnings 4 | .alert.alert-warning 5 | h4= warning.moduleName 6 | pre= warning.message -------------------------------------------------------------------------------- /app/findById.js: -------------------------------------------------------------------------------- 1 | module.exports = function findById(array, id) { 2 | for (var i = 0; i < array.length; i++) { 3 | if (array[i].id === id) return array[i]; 4 | } 5 | return null; 6 | }; 7 | -------------------------------------------------------------------------------- /web_modules/sigma.js/patch-force-atlas.js: -------------------------------------------------------------------------------- 1 | module.exports = function(source) { 2 | this.cacheable(); 3 | return source.replace(/\.mass\/Math\.pow\(([a-z]+),2\)/g, ".mass/Math.pow($1,3)"); 4 | } -------------------------------------------------------------------------------- /app/pages/error/page.js: -------------------------------------------------------------------------------- 1 | module.exports = function(err, page) { 2 | document.title = "error"; 3 | $(".page").html( 4 | require("./error.pug")({ 5 | err: err, 6 | page: page 7 | }) 8 | ); 9 | }; 10 | -------------------------------------------------------------------------------- /app/formatSize.js: -------------------------------------------------------------------------------- 1 | module.exports = function formatSize(s) { 2 | if (s < 2048) return s + " bytes"; 3 | s /= 1024; 4 | if (s < 2048) return Math.round(s) + " KiB"; 5 | s /= 1024; 6 | return Math.round(s) + " MiB"; 7 | }; 8 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 80, 3 | useTabs: true, 4 | tabWidth: 2, 5 | overrides: [ 6 | { 7 | files: "*.json", 8 | options: { 9 | useTabs: false 10 | } 11 | } 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /app/pages/home/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | 3 | module.exports = function() { 4 | document.title = "home"; 5 | $(".page").html( 6 | require("./home.pug")({ 7 | stats: app.stats 8 | }) 9 | ); 10 | }; 11 | -------------------------------------------------------------------------------- /app/pages/assets/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | 3 | module.exports = function() { 4 | document.title = "assets"; 5 | $(".page").html( 6 | require("./assets.pug")({ 7 | stats: app.stats 8 | }) 9 | ); 10 | }; 11 | -------------------------------------------------------------------------------- /app/pages/errors/normalize.js: -------------------------------------------------------------------------------- 1 | module.exports = function(str) { 2 | if (typeof str === "string") { 3 | str = str.split("\n"); 4 | var moduleName = str.shift(); 5 | return { 6 | moduleName: moduleName, 7 | message: str.join("\n") 8 | }; 9 | } else { 10 | return str; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /app/pages/errors/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | var normalize = require("./normalize"); 3 | 4 | module.exports = function() { 5 | document.title = "errors"; 6 | $(".page").html( 7 | require("./errors.pug")({ 8 | stats: app.stats, 9 | errors: app.stats.errors.map(normalize) 10 | }) 11 | ); 12 | }; 13 | -------------------------------------------------------------------------------- /app/pages/warnings/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | var normalize = require("../errors/normalize"); 3 | 4 | module.exports = function() { 5 | document.title = "warnings"; 6 | $(".page").html( 7 | require("./warnings.pug")({ 8 | stats: app.stats, 9 | warnings: app.stats.warnings.map(normalize) 10 | }) 11 | ); 12 | }; 13 | -------------------------------------------------------------------------------- /app/pages/chunks/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | var chunksGraph = require("../../graphs/chunks"); 3 | 4 | module.exports = function() { 5 | document.title = "chunks"; 6 | $(".page").html( 7 | require("./chunks.pug")({ 8 | stats: app.stats 9 | }) 10 | ); 11 | chunksGraph.show(); 12 | return function() { 13 | chunksGraph.hide(); 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /app/pages/select/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | 3 | module.exports = function(stats) { 4 | document.title = "select"; 5 | $("body").html(require("./application.pug")(stats)); 6 | $(".modal").modal({ show: true }); 7 | $(".js-select").click(function() { 8 | var index = $(this).data("index"); 9 | app.load(stats.children[index]); 10 | $(".modal").modal("hide"); 11 | app.loadPage("home"); 12 | }); 13 | }; 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # analyse 2 | 3 | [http://webpack.github.io/analyse](http://webpack.github.io/analyse) 4 | 5 | ## Running 6 | 7 | You can generate the required JSON file for this tool by running `webpack --profile --json > stats.json` 8 | 9 | ## Build 10 | 11 | Development: 12 | 13 | ``` text 14 | grunt dev 15 | ``` 16 | 17 | Production: 18 | 19 | ``` text 20 | grunt 21 | ``` 22 | 23 | Publish: 24 | 25 | ``` text 26 | grunt deploy 27 | ``` 28 | -------------------------------------------------------------------------------- /app/pages/chunk/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | var modulesGraph = require("../../graphs/modules"); 3 | 4 | module.exports = function(id) { 5 | id = parseInt(id, 10); 6 | document.title = "chunk " + id; 7 | $(".page").html( 8 | require("./chunk.pug")({ 9 | stats: app.stats, 10 | id: id, 11 | chunk: app.mapChunks[id] 12 | }) 13 | ); 14 | modulesGraph.show(); 15 | modulesGraph.setActiveChunk(id); 16 | return function() { 17 | modulesGraph.hide(); 18 | }; 19 | }; 20 | -------------------------------------------------------------------------------- /app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/pages/module/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | var modulesGraph = require("../../graphs/modules"); 3 | 4 | module.exports = function(id) { 5 | id = parseInt(id, 10); 6 | var m = app.mapModulesUid[id]; 7 | document.title = "module " + m.id; 8 | $(".page").html( 9 | require("./module.pug")({ 10 | stats: app.stats, 11 | id: id, 12 | module: m, 13 | issuer: app.mapModulesUid[m.issuerUid] 14 | }) 15 | ); 16 | modulesGraph.show(); 17 | modulesGraph.setActiveModule(id); 18 | return function() { 19 | modulesGraph.hide(); 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /app/pages/assets/assets.pug: -------------------------------------------------------------------------------- 1 | table.table.table-condensed 2 | thead 3 | tr 4 | th assets 5 | th size 6 | th chunks 7 | th names 8 | th flags 9 | tbody 10 | each asset in stats.assets 11 | tr 12 | td: pre: code= asset.name 13 | td= require("../../formatSize")(asset.size) 14 | td 15 | each chunk in asset.chunks 16 | a.btn.btn-info(href=`#chunk/${chunk}`)= chunk 17 | = " " 18 | td 19 | each name in asset.chunkNames 20 | code= name 21 | = " " 22 | td 23 | if module.emitted 24 | span.label.label-success emitted 25 | = " " -------------------------------------------------------------------------------- /app/pages/modules/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | var modulesGraph = require("../../graphs/modules"); 3 | 4 | function renderTable() { 5 | $(".page").html( 6 | require("./modules.pug")({ 7 | stats: app.stats 8 | }) 9 | ); 10 | } 11 | 12 | module.exports = function() { 13 | document.title = "modules"; 14 | renderTable(); 15 | 16 | var sortDir; 17 | $(document).on("click", ".size-th", function() { 18 | sortDir = sortDir === "desc" ? "asc" : "desc"; 19 | app.stats.modules.sort(function(a, b) { 20 | return sortDir === "asc" ? b.size - a.size : a.size - b.size; 21 | }); 22 | renderTable(); 23 | }); 24 | 25 | modulesGraph.show(); 26 | modulesGraph.setNormal(); 27 | return function() { 28 | $(document).off("click", ".size-th"); 29 | modulesGraph.hide(); 30 | }; 31 | }; 32 | -------------------------------------------------------------------------------- /app/pages/select/application.pug: -------------------------------------------------------------------------------- 1 | nav.navbar.navbar-default 2 | .container-fluid 3 | ul.nav.navbar-nav 4 | li: a(href="") Open 5 | li: a(href="#home") Home 6 | li: a(href="#modules") Modules 7 | li: a(href="#chunks") Chunks 8 | li: a(href="#assets") Assets 9 | li: a(href="#warnings") Warnings 10 | li: a(href="#errors") Errors 11 | li: a(href="#hints") Hints 12 | #sigma-modules(style="width: 99%; height: 500px; display:none;") 13 | #sigma-chunks(style="width: 99%; height: 500px; display:none;") 14 | .page 15 | 16 | .modal.fade: .modal-dialog: .modal-content 17 | .modal-header 18 | h4.modal-title Select webpack compile 19 | .modal-body 20 | each val, index in children 21 | button.js-select.btn.btn-primary.btn-block(data-index=index)= val.name || ("Compile #" + (index+1)) 22 | .modal-footer 23 | -------------------------------------------------------------------------------- /web_modules/sigma.js/plugins/sigma.parsers.json.min.js: -------------------------------------------------------------------------------- 1 | (function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.parsers"),sigma.utils.pkg("sigma.utils"),sigma.utils.xhr=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;var a,b;if(window.ActiveXObject){a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(b in a)try{return new ActiveXObject(a[b])}catch(c){}}return null},sigma.parsers.json=function(a,b,c){var d,e=sigma.utils.xhr();if(!e)throw"XMLHttpRequest not supported, cannot load the file.";e.open("GET",a,!0),e.onreadystatechange=function(){4===e.readyState&&(d=JSON.parse(e.responseText),b instanceof sigma?(b.graph.clear(),b.graph.read(d)):"object"==typeof b?(b.graph=d,b=new sigma(b)):"function"==typeof b&&(c=b,b=null),c&&c(b||d))},e.send()}}).call(this); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-analyse", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "rimraf dist && webpack --mode production --env.longTermCaching --env.googleAnalytics", 7 | "deploy": "yarn build && gh-pages -d dist -m \"Publish\" -a", 8 | "dev": "webpack-dev-server" 9 | }, 10 | "dependencies": { 11 | "d3": "^5.15.0", 12 | "jquery": "^3.4.1" 13 | }, 14 | "devDependencies": { 15 | "css-loader": "^3.4.0", 16 | "gh-pages": "^2.1.1", 17 | "html-webpack-plugin": "^4.0.0-beta.11", 18 | "imports-loader": "^0.8.0", 19 | "pug": "^2.0.4", 20 | "pug-loader": "^2.4.0", 21 | "rimraf": "^3.0.0", 22 | "style-loader": "^1.1.2", 23 | "webpack": "^5.0.0-beta.11", 24 | "webpack-cli": "^3.3.10", 25 | "webpack-dev-server": "^3.10.1" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/pages/chunks/chunks.pug: -------------------------------------------------------------------------------- 1 | table.table.table-condensed 2 | thead 3 | tr 4 | th id 5 | th names 6 | th modules 7 | th size 8 | th parents 9 | th flags 10 | tbody 11 | each chunk in stats.chunks 12 | tr 13 | td: a.btn.btn-info(href=`#chunk/${chunk.id}`)= chunk.id 14 | td 15 | each name in chunk.names 16 | code= name 17 | = " " 18 | td= chunk.modules ? chunk.modules.length : "N/A" 19 | td= require("../../formatSize")(chunk.size) 20 | td 21 | each parent in chunk.parents 22 | a.btn.btn-info(href=`#chunk/${parent}`)= parent 23 | = " " 24 | td 25 | if chunk.rendered 26 | span.label.label-success rendered 27 | = " " 28 | if chunk.initial 29 | span.label.label-info initial 30 | = " " 31 | if chunk.entry 32 | span.label.label-danger entry 33 | -------------------------------------------------------------------------------- /app/pages/upload/application.pug: -------------------------------------------------------------------------------- 1 | nav.navbar.navbar-default 2 | .container-fluid 3 | ul.nav.navbar-nav 4 | li: a(href="") Open 5 | li: a(href="#home") Home 6 | li: a(href="#modules") Modules 7 | li: a(href="#chunks") Chunks 8 | li: a(href="#assets") Assets 9 | li: a(href="#warnings") Warnings 10 | li: a(href="#errors") Errors 11 | li: a(href="#hints") Hints 12 | #sigma-modules(style="width: 99%; height: 500px; display:none;") 13 | #sigma-chunks(style="width: 99%; height: 500px; display:none;") 14 | .page 15 | 16 | .modal.fade: .modal-dialog: .modal-content 17 | .modal-header 18 | h4.modal-title Upload webpack stats 19 | .modal-body 20 | .form-group 21 | label(for="file") JSON file 22 | input.form-control(type="file", id="file") 23 | .form-group 24 | label(for="example") Examples 25 | div: button(type="btn btn-default", id="example1") webpack 1 test cases 26 | div: button(type="btn btn-default", id="example2") webpack 5 test cases 27 | .modal-footer -------------------------------------------------------------------------------- /app/googleAnalytics.js: -------------------------------------------------------------------------------- 1 | if (typeof GA_TRACKING_CODE !== "undefined") { 2 | (function(window, document, script, url, r, tag, firstScriptTag) { 3 | window["GoogleAnalyticsObject"] = r; 4 | window[r] = 5 | window[r] || 6 | function() { 7 | (window[r].q = window[r].q || []).push(arguments); 8 | }; 9 | window[r].l = 1 * new Date(); 10 | (tag = document.createElement(script)), 11 | (firstScriptTag = document.getElementsByTagName(script)[0]); 12 | tag.async = 1; 13 | tag.src = url; 14 | firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 15 | })( 16 | window, 17 | document, 18 | "script", 19 | "//www.google-analytics.com/analytics.js", 20 | "ga" 21 | ); 22 | 23 | var ga = window.ga; 24 | 25 | ga("create", GA_TRACKING_CODE, GA_TRACKING_CONFIG); 26 | // ga('send', 'pageview'); 27 | 28 | module.exports = function() { 29 | return window.ga.apply(window.ga, arguments); 30 | }; 31 | } else { 32 | module.exports = function() { 33 | console.log(arguments); 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /web_modules/sigma.js/index.js: -------------------------------------------------------------------------------- 1 | require("imports-loader?this=>window&module=>undefined&exports=>undefined!./sigma.min.js"); 2 | 3 | require("./patch-force-atlas!./plugins/sigma.layout.forceAtlas2.min.js"); 4 | 5 | module.exports = sigma; 6 | 7 | sigma.canvas.labels.webpack = function(node, context, settings) { 8 | var old = node.label; 9 | if (node.shortLabel) node.label = node.shortLabel; 10 | sigma.canvas.labels.def(node, context, settings); 11 | node.label = old; 12 | }; 13 | 14 | sigma.canvas.edges.dashedArrow = function( 15 | edge, 16 | source, 17 | target, 18 | context, 19 | settings 20 | ) { 21 | if (!context.getLineDash || !context.setLineDash) 22 | return sigma.canvas.edges.array(edge, source, target, context, settings); 23 | var old = context.getLineDash(); 24 | context.setLineDash(edge.lineDash || [5, 5]); 25 | sigma.canvas.edges.arrow(edge, source, target, context, settings); 26 | context.setLineDash(old); 27 | }; 28 | 29 | sigma.layout.forceatlas2.edgeWeightInfluence = 0.5; 30 | sigma.layout.forceatlas2.adjustSizes = true; 31 | -------------------------------------------------------------------------------- /app/percentageToColor.js: -------------------------------------------------------------------------------- 1 | function hsv2rgb(h, s, v) { 2 | h = ((h % 1) + 1) % 1; // wrap hue 3 | 4 | var i = Math.floor(h * 6), 5 | f = h * 6 - i, 6 | p = v * (1 - s), 7 | q = v * (1 - s * f), 8 | t = v * (1 - s * (1 - f)); 9 | 10 | switch (i) { 11 | case 0: 12 | return [v, t, p]; 13 | case 1: 14 | return [q, v, p]; 15 | case 2: 16 | return [p, v, t]; 17 | case 3: 18 | return [p, q, v]; 19 | case 4: 20 | return [t, p, v]; 21 | case 5: 22 | return [v, p, q]; 23 | } 24 | return [0, 0, 0]; 25 | } 26 | 27 | function toString(rgb) { 28 | return ( 29 | "rgb(" + 30 | rgb 31 | .map(function(x) { 32 | return Math.floor(256 * x); 33 | }) 34 | .join(",") + 35 | ")" 36 | ); 37 | } 38 | 39 | exports.colorSpace = function colorSpace(p) { 40 | var rgb = hsv2rgb(p, 1, 0.7); 41 | return toString(rgb); 42 | }; 43 | 44 | exports.greenRed = function greenRed(p) { 45 | var rgb = hsv2rgb((1 - p) / 3, 1, 0.7); 46 | return toString(rgb); 47 | }; 48 | 49 | exports.blue = function blue(p) { 50 | var rgb = hsv2rgb(p / 3 + 0.5, 1, 0.7); 51 | return toString(rgb); 52 | }; 53 | -------------------------------------------------------------------------------- /app/pages/upload/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | 3 | module.exports = function() { 4 | var nextPage = Array.prototype.slice.call(arguments); 5 | document.title = "upload"; 6 | $("body").html(require("./application.pug")()); 7 | $(".modal").modal({ show: true }); 8 | $("#file").change(loadFromFile); 9 | $("#example1").click(() => loadFromExample(1)); 10 | $("#example2").click(() => loadFromExample(2)); 11 | 12 | function loadFromExample(n) { 13 | import(`./example${n}.json`).then(function(exampleModule) { 14 | var example = exampleModule.default; 15 | app.load(example); 16 | $(".modal").modal("hide"); 17 | app.loadPage.apply(app, nextPage); 18 | }); 19 | } 20 | 21 | function loadFromFile() { 22 | var files = $("#file")[0].files; 23 | var fileReader = new FileReader(); 24 | fileReader.readAsText(files[0]); 25 | fileReader.onload = function() { 26 | var data = fileReader.result; 27 | app.load(JSON.parse(data)); 28 | $(".modal").modal("hide"); 29 | app.loadPage.apply(app, nextPage); 30 | }; 31 | fileReader.onerror = function(err) { 32 | alert(err); 33 | }; 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /app/pages/modules/modules.pug: -------------------------------------------------------------------------------- 1 | table.table.table-condensed 2 | thead 3 | tr 4 | th id 5 | th name 6 | th.sortable-th.size-th size 7 | th chunks 8 | th flags 9 | tbody 10 | each module in stats.modules 11 | tr 12 | td 13 | if typeof module.uid === "number" 14 | a.btn.btn-success(href=`#module/${module.uid}`)= module.id 15 | else 16 | span.btn.btn-success= module.id 17 | td: pre: code= module.name.split("!").join("\n") 18 | td= require("../../formatSize")(module.size) 19 | td 20 | each chunk in module.chunks 21 | a.btn.btn-info(href=`#chunk/${chunk}`)= chunk 22 | = " " 23 | td 24 | if module.built 25 | span.label.label-success built 26 | = " " 27 | if !module.cacheable 28 | span.label.label-warning not cacheable 29 | = " " 30 | if module.prefetched 31 | span.label.label-success prefetched 32 | = " " 33 | if module.failed 34 | span.label.label-danger failed 35 | = " " 36 | if module.warnings 37 | span.label.label-warning= module.warnings + " warnings" 38 | = " " 39 | if module.errors 40 | span.label.label-danger= module.errors + " errors" 41 | -------------------------------------------------------------------------------- /web_modules/sigma.js/plugins/sigma.plugins.neighborhoods.min.js: -------------------------------------------------------------------------------- 1 | (function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.classes.graph.addMethod("neighborhood",function(a){var b,c,d,e,f,g={},h={},i={nodes:[],edges:[]};if(!this.nodes(a))return i;e=this.nodes(a),f={},f.center=!0;for(b in e)f[b]=e[b];g[a]=!0,i.nodes.push(f);for(b in this.allNeighborsIndex[a]){g[b]||(g[b]=!0,i.nodes.push(this.nodesIndex[b]));for(c in this.allNeighborsIndex[a][b])h[c]||(h[c]=!0,i.edges.push(this.edgesIndex[c]))}for(b in g)if(b!==a)for(c in g)if(c!==a&&b!==c&&this.allNeighborsIndex[b][c])for(d in this.allNeighborsIndex[b][c])h[d]||(h[d]=!0,i.edges.push(this.edgesIndex[d]));return i}),sigma.utils.pkg("sigma.plugins"),sigma.plugins.neighborhoods=function(){var a=new sigma.classes.graph;this.neighborhood=function(b){return a.neighborhood(b)},this.load=function(b,c){var d=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;var a,b;if(window.ActiveXObject){a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(b in a)try{return new ActiveXObject(a[b])}catch(c){}}return null}();if(!d)throw"XMLHttpRequest not supported, cannot load the data.";return d.open("GET",b,!0),d.onreadystatechange=function(){4===d.readyState&&(a.clear().read(JSON.parse(d.responseText)),c&&c())},d.send(),this},this.read=function(b){a.clear().read(b)}}}).call(window); -------------------------------------------------------------------------------- /app/entry.js: -------------------------------------------------------------------------------- 1 | var ga = require("./googleAnalytics"); 2 | require("./style.css"); 3 | 4 | var app = require("./app"); 5 | 6 | var lastHash = ""; 7 | window.addEventListener( 8 | "hashchange", 9 | function() { 10 | if (location.hash !== lastHash) { 11 | lastHash = location.hash; 12 | loadPageFromHash(); 13 | } 14 | }, 15 | false 16 | ); 17 | loadPageFromHash(); 18 | 19 | function loadPageFromHash() { 20 | loadPage.apply(null, location.hash.replace(/^#/, "").split("/")); 21 | } 22 | 23 | var lastPage; 24 | 25 | function loadPage(name) { 26 | if (!name) name = "home"; 27 | var pageBundle; 28 | var args = Array.prototype.slice.call(arguments, 1); 29 | if (!app.stats && name != "select") { 30 | args.unshift(name); 31 | name = "upload"; 32 | } 33 | function activatePageModule(pageModule) { 34 | var page = pageModule.default; 35 | $(function() { 36 | if (lastPage) lastPage(); 37 | lastPage = page.apply(null, args); 38 | window.scrollTo(0, 0); 39 | if (name !== "upload") { 40 | ga("send", "pageview", { 41 | page: 42 | window.location.pathname.replace(/\/$/, "") + 43 | "/" + 44 | [name].concat(args).join("/"), 45 | title: document.title 46 | }); 47 | } 48 | }); 49 | } 50 | import("./pages/" + name + "/page.js") 51 | .catch(err => { 52 | args.unshift(err, name); 53 | return import(/* webpackMode: "eager" */ "./pages/error/page.js"); 54 | }) 55 | .then(activatePageModule); 56 | } 57 | app.loadPage = loadPage; 58 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var webpack = require("webpack"); 3 | var HtmlWebpackPlugin = require("html-webpack-plugin"); 4 | module.exports = ({ googleAnalytics, longTermCaching } = {}) => ({ 5 | entry: { 6 | web: "./app/entry.js" 7 | }, 8 | cache: { 9 | type: "filesystem", 10 | buildDependencies: { 11 | config: [__filename] 12 | } 13 | }, 14 | resolve: { 15 | modules: [path.resolve(__dirname, "web_modules"), "node_modules"] 16 | }, 17 | output: { 18 | publicPath: "", 19 | filename: "[name].js", 20 | chunkFilename: longTermCaching ? "[contenthash].js" : undefined 21 | }, 22 | module: { 23 | rules: [ 24 | { 25 | test: /\.js$/, 26 | include: path.resolve(__dirname, "node_modules/sigma"), 27 | loader: "imports-loader", 28 | options: { this: ">window" } 29 | }, 30 | { test: /\.pug$/, use: "pug-loader" }, 31 | { test: /\.css$/, use: ["style-loader", "css-loader"] }, 32 | { test: /\.png$/, type: "asset" } 33 | ] 34 | }, 35 | plugins: [ 36 | compiler => { 37 | // Hack to make html-webpack-plugin work 38 | compiler.hooks.thisCompilation.tap("webpack.config.js", compilation => { 39 | compilation.fileTimestamps = new Map(); 40 | }); 41 | }, 42 | new HtmlWebpackPlugin({ 43 | template: "./app/index.html" 44 | }), 45 | googleAnalytics && 46 | new webpack.DefinePlugin({ 47 | GA_TRACKING_CODE: JSON.stringify("UA-46921629-1"), 48 | GA_TRACKING_CONFIG: JSON.stringify("webpack.github.io") 49 | }) 50 | ].filter(Boolean) 51 | }); 52 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | module.exports = function(grunt) { 3 | require("matchdep").filterAll("grunt-*").forEach(grunt.loadNpmTasks); 4 | var webpack = require("webpack"); 5 | grunt.initConfig({ 6 | webpack: { 7 | options: require("./webpack.config.js"), 8 | production: { 9 | plugins: [ 10 | new webpack.DefinePlugin({ 11 | GA_TRACKING_CODE: JSON.stringify('UA-46921629-1'), 12 | GA_TRACKING_CONFIG: JSON.stringify('webpack.github.io') 13 | }), 14 | new webpack.optimize.OccurenceOrderPlugin(), 15 | new webpack.optimize.UglifyJsPlugin() 16 | ] 17 | } 18 | }, 19 | "webpack-dev-server": { 20 | development: { 21 | contentBase: "dist", 22 | port: 8080, 23 | keepAlive: true, 24 | webpack: merge(require("./webpack.config.js"), { 25 | devtool: "eval" 26 | }) 27 | } 28 | }, 29 | "gh-pages": { 30 | options: { 31 | message: "Publish", 32 | base: "dist" 33 | }, 34 | src: ["**"] 35 | }, 36 | copy: { 37 | main: { 38 | src: "index.html", 39 | dest: "dist/" 40 | } 41 | }, 42 | clean: ["dist"] 43 | }); 44 | grunt.registerTask("development", ["copy", "webpack-dev-server:development"]); 45 | grunt.registerTask("production", ["copy", "webpack:production"]); 46 | grunt.registerTask("deploy", ["clean", "production", "gh-pages"]); 47 | 48 | grunt.registerTask("dev", ["development"]); 49 | grunt.registerTask("default", ["production"]); 50 | }; 51 | 52 | function merge(a, b) { 53 | var o = {}; 54 | for(var key in a) { 55 | o[key] = a[key]; 56 | } 57 | for(var key in b) { 58 | o[key] = b[key]; 59 | } 60 | return o; 61 | } -------------------------------------------------------------------------------- /app/pages/home/home.pug: -------------------------------------------------------------------------------- 1 | .container-fluid 2 | .row 3 | .col-md-12 4 | .page-header 5 | h1 webpack analyse 6 | .row 7 | .col-md-3 8 | .well: center 9 | h1 10 | a(href="https://webpack.js.org/", target="_blank", rel="noopener noreferrer") webpack 11 | br 12 | a(href="https://github.com/webpack/webpack/releases", target="_blank", rel="noopener noreferrer")= stats.version 13 | .col-md-3 14 | .well: center 15 | h1 16 | = stats.time 17 | br 18 | | ms 19 | .col-md-6 20 | .well: center 21 | h1 22 | | hash 23 | br 24 | = stats.hash 25 | .row 26 | .col-md-3 27 | .well: center 28 | h1: a(href="#modules") 29 | = stats.modules.length 30 | br 31 | | modules 32 | .col-md-3 33 | .well: center 34 | h1: a(href="#chunks") 35 | = stats.chunks.length 36 | br 37 | | chunks 38 | .col-md-3 39 | .well: center 40 | h1: a(href="#assets") 41 | = stats.assets.length 42 | br 43 | | assets 44 | .col-md-3 45 | .well: center 46 | h1 47 | if stats.errors.length && stats.warnings.length 48 | a(href="#warnings") 49 | = stats.warnings.length 50 | | warnings 51 | br 52 | a(href="#errors") 53 | = stats.errors.length 54 | | errors 55 | else if stats.errors.length 56 | a(href="#errors") 57 | = stats.errors.length 58 | br 59 | | errors 60 | else if stats.warnings.length 61 | a(href="#warnings") 62 | = stats.warnings.length 63 | br 64 | | warnings 65 | else 66 | | no 67 | br 68 | | warnings/errors 69 | 70 | -------------------------------------------------------------------------------- /web_modules/sigma.js/plugins/sigma.plugins.animate.min.js: -------------------------------------------------------------------------------- 1 | (function(){"use strict";function a(a){if(d[a])return d[a];var b=[0,0,0];return a.match(/^#/)?(a=(a||"").replace(/^#/,""),b=3===a.length?[parseInt(a.charAt(0)+a.charAt(0),16),parseInt(a.charAt(1)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(2),16)]:[parseInt(a.charAt(0)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(3),16),parseInt(a.charAt(4)+a.charAt(5),16)]):a.match(/^ *rgba? *\(/)&&(a=a.match(/^ *rgba? *\( *([0-9]*) *, *([0-9]*) *, *([0-9]*) *(,.*)?\) *$/),b=[+a[1],+a[2],+a[3]]),d[a]={r:b[0],g:b[1],b:b[2]},d[a]}function b(b,c,d){b=a(b),c=a(c);var e={r:b.r*(1-d)+c.r*d,g:b.g*(1-d)+c.g*d,b:b.b*(1-d)+c.b*d};return"rgb("+[0|e.r,0|e.g,0|e.b].join(",")+")"}if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins");var c=0,d={};sigma.plugins.animate=function(a,d,e){function f(){var c=(sigma.utils.dateNow()-k)/i;c>=1?(a.graph.nodes().forEach(function(a){for(var b in d)b in d&&(a[b]=a[d[b]])}),a.refresh(),"function"==typeof g.onComplete&&g.onComplete()):(c=j(c),a.graph.nodes().forEach(function(a){for(var e in d)e in d&&(a[e]=e.match(/color$/)?b(l[a.id][e],a[d[e]],c):a[d[e]]*c+l[a.id][e]*(1-c))}),a.refresh(),a.animations[h]=requestAnimationFrame(f))}var g=e||{},h=++c,i=g.duration||a.settings("animationsTime"),j="string"==typeof g.easing?sigma.utils.easings[g.easing]:"function"==typeof g.easing?g.easing:sigma.utils.easings.quadraticInOut,k=sigma.utils.dateNow(),l=a.graph.nodes().reduce(function(a,b){var c;a[b.id]={};for(c in d)c in b&&(a[b.id][c]=b[c]);return a},{});a.animations=a.animations||Object.create({}),sigma.plugins.kill(a),f()},sigma.plugins.kill=function(a){for(var b in a.animations||{})cancelAnimationFrame(a.animations[b])}}).call(window); -------------------------------------------------------------------------------- /web_modules/sigma.js/README.md: -------------------------------------------------------------------------------- 1 | sigma.js - v1.0.0 2 | ================= 3 | 4 | Sigma is a JavaScript library dedicated to graph drawing. 5 | 6 | ### Resources 7 | 8 | [The website](http://sigmajs.org) provides a global overview of the project, and the documentation is available in the [Github Wiki](https://github.com/jacomyal/sigma.js/wiki). 9 | 10 | Also, the `plugins` and `examples` directories contain some various use-cases, that might help you understanding how to use sigma. 11 | 12 | ### How to use it 13 | 14 | To use it, clone the repository: 15 | 16 | ``` 17 | git clone git@github.com:jacomyal/sigma.js.git 18 | ``` 19 | 20 | To build the code: 21 | 22 | - Install [Node.js](http://nodejs.org/), [NPM](https://npmjs.org/) and [Grunt](http://gruntjs.com/installing-grunt). 23 | - Install [gjslint](https://developers.google.com/closure/utilities/docs/linter_howto?hl=en). 24 | - Use `npm install` to install sigma development dependencies. 25 | - Use `grunt uglify` to minify the code with [Uglify](https://github.com/mishoo/UglifyJS). The minified file `sigma.min.js` will then be accessible in the `build/` folder. 26 | 27 | Also, you can customize the build by adding or removing files from the `coreJsFiles` array in `Gruntfile.js` before applying the grunt task. 28 | 29 | ### Contributing 30 | 31 | You can contribute by submitting [issues tickets](http://github.com/jacomyal/sigma.js/issues) and proposing [pull requests](http://github.com/jacomyal/sigma.js/pulls). Make sure that tests and linting pass before submitting any pull request by running the command `grunt`. 32 | 33 | The whole source code is validated by the [Google Closure Linter](https://developers.google.com/closure/utilities/) and [JSHint](http://www.jshint.com/), and the comments are written in [JSDoc](http://en.wikipedia.org/wiki/JSDoc) (tags description is available [here](https://developers.google.com/closure/compiler/docs/js-for-compiler)). 34 | -------------------------------------------------------------------------------- /app/pages/hints/page.js: -------------------------------------------------------------------------------- 1 | var app = require("../../app"); 2 | var findById = require("../../findById"); 3 | 4 | module.exports = function() { 5 | document.title = "hints"; 6 | var multiRefs = []; 7 | app.stats.modules.forEach(function(module) { 8 | var requiresSum = {}; 9 | module.dependencies.forEach(function(d) { 10 | if (!requiresSum[d.moduleId]) 11 | requiresSum[d.moduleId] = { 12 | module: module, 13 | count: 1, 14 | otherModule: findById(app.stats.modules, d.moduleId) 15 | }; 16 | else requiresSum[d.moduleId].count++; 17 | }); 18 | Object.keys(requiresSum).forEach(function(id) { 19 | var item = requiresSum[id]; 20 | if (item.count >= 2) multiRefs.push(item); 21 | }); 22 | }); 23 | multiRefs.forEach(function(item) { 24 | var refModLength = (item.otherModule.id + "").length; 25 | item.saving = item.count * (2 + refModLength) - 6 - refModLength; 26 | }); 27 | multiRefs = multiRefs.filter(function(item) { 28 | return item.saving > 10; 29 | }); 30 | multiRefs.sort(function(a, b) { 31 | return b.saving - a.saving; 32 | }); 33 | 34 | var multiChunks = []; 35 | app.stats.modules.forEach(function(module) { 36 | if (module.chunks.length >= 2) { 37 | multiChunks.push({ 38 | module: module, 39 | count: module.chunks.length, 40 | saving: (module.chunks.length - 1) * module.size 41 | }); 42 | } 43 | }); 44 | multiChunks = multiChunks.filter(function(item) { 45 | return item.saving > 100; 46 | }); 47 | multiChunks.sort(function(a, b) { 48 | return b.saving - a.saving; 49 | }); 50 | 51 | var modulesByTimestamp = app.stats.modules 52 | .filter(function(m) { 53 | return typeof m.timestamp === "number"; 54 | }) 55 | .sort(function(a, b) { 56 | return b.timestamp - a.timestamp; 57 | }) 58 | .slice(0, 10); 59 | 60 | var longChains = modulesByTimestamp.map(function(m) { 61 | var chain = [m]; 62 | while (typeof m.issuerUid === "number") { 63 | m = app.mapModulesUid[m.issuerUid]; 64 | if (!m) break; 65 | chain.unshift(m); 66 | } 67 | return chain; 68 | }); 69 | 70 | $(".page").html( 71 | require("./hints.pug")({ 72 | stats: app.stats, 73 | multiRefs: multiRefs, 74 | multiChunks: multiChunks, 75 | longChains: longChains 76 | }) 77 | ); 78 | }; 79 | -------------------------------------------------------------------------------- /app/graphs/chunks.js: -------------------------------------------------------------------------------- 1 | var app = require("../app"); 2 | var sigma = require("sigma.js"); 3 | var findById = require("../findById"); 4 | var percentageToColor = require("../percentageToColor").greenRed; 5 | 6 | var element = document.getElementById("sigma-chunks"); 7 | 8 | var nodes = []; 9 | var edges = []; 10 | var chunkCount = app.stats.chunks.length; 11 | var maxSize = 0; 12 | app.stats.chunks.forEach(function(chunk, idx) { 13 | if (chunk.size > maxSize) maxSize = chunk.size; 14 | }); 15 | app.stats.chunks.forEach(function(chunk, idx) { 16 | var color = percentageToColor( 17 | Math.pow((chunk.size + 1) / (maxSize + 1), 1 / 4) 18 | ); 19 | nodes.push({ 20 | id: "chunk" + chunk.id, 21 | chunkId: chunk.id, 22 | size: Math.ceil(Math.sqrt(chunk.size + 1)), 23 | type: "webpack", 24 | shortLabel: "" + chunk.id, 25 | label: 26 | "[" + 27 | chunk.id + 28 | "] " + 29 | chunk.origins 30 | .map(function(o) { 31 | return (o.reasons || []) 32 | .concat(o.name) 33 | .concat(o.moduleName) 34 | .join(" "); 35 | }) 36 | .join(", "), 37 | x: Math.cos((idx / chunkCount) * Math.PI * 2) * chunkCount, 38 | y: Math.sin((idx / chunkCount) * Math.PI * 2) * chunkCount, 39 | color: color 40 | }); 41 | }); 42 | app.stats.chunks.forEach(function(chunk) { 43 | chunk.parents.forEach(function(parent) { 44 | edges.push({ 45 | id: "edge" + chunk.id + "-" + parent, 46 | source: "chunk" + parent, 47 | target: "chunk" + chunk.id, 48 | arrow: "target", 49 | type: "arrow", 50 | size: chunk.parents.length 51 | }); 52 | }); 53 | }); 54 | var s = new sigma({ 55 | graph: { 56 | nodes: nodes, 57 | edges: edges 58 | }, 59 | renderer: { 60 | type: "canvas", 61 | container: element 62 | }, 63 | settings: { 64 | edgeColor: "target", 65 | maxNodeSize: 20, 66 | minNodeSize: 4, 67 | maxEdgeSize: 3, 68 | minEdgeSize: 1 69 | } 70 | }); 71 | s.bind("clickNode", function(e) { 72 | window.location.hash = "#chunk/" + e.data.node.chunkId; 73 | }); 74 | 75 | s.refresh(); 76 | 77 | exports.show = function() { 78 | element.style.display = "block"; 79 | s.refresh(); 80 | s.startForceAtlas2(); 81 | s.renderers[0].resize(); 82 | }; 83 | 84 | exports.hide = function() { 85 | element.style.display = "none"; 86 | s.stopForceAtlas2(); 87 | }; 88 | -------------------------------------------------------------------------------- /app/pages/hints/hints.pug: -------------------------------------------------------------------------------- 1 | .container-fluid 2 | .row 3 | .col-md-12 4 | if multiChunks.length === 0 && multiRefs.length === 0 && longChains.length === 0 5 | h2 Everything seem to be fine. 6 | if multiChunks.length > 0 7 | h2 Module in multiple chunks 8 | p Check if it is a good idea to move modules into a common parent. You may want to use require.include or insert them into the parents require.ensure array. 9 | table.table.table-bordered 10 | thead 11 | tr 12 | th module 13 | th name 14 | th count 15 | th chunks 16 | th saving 17 | tbody 18 | for item in multiChunks 19 | tr 20 | td 21 | if typeof item.module.uid === "number" 22 | a.btn.btn-success(href=`#module/${item.module.uid}`)= item.module.id 23 | else 24 | span.btn.btn-success= item.module.id 25 | td: pre: code= item.module.name.split("!").join("\n") 26 | td= item.count 27 | td 28 | for chunk, idx in item.module.chunks 29 | if idx > 0 30 | = " " 31 | a.btn.btn-info(href=`#chunk/${chunk}`)= chunk 32 | td= require("../../formatSize")(item.saving) 33 | if multiRefs.length > 0 34 | h2 Multiple references to the same module 35 | p Refactor this: 36 | pre: code. 37 | var a = require("xyz").a; 38 | var b = require("xyz").b; 39 | var c = require("xyz").c; 40 | p To this: 41 | pre: code. 42 | var xyz = require("xyz"); 43 | var a = xyz.a; 44 | var a = xyz.b; 45 | var c = xyz.c; 46 | table.table.table-bordered 47 | thead 48 | tr 49 | th module 50 | th name 51 | th count 52 | th referenced module 53 | th referenced name 54 | th saving 55 | tbody 56 | for item in multiRefs 57 | tr 58 | td 59 | if typeof item.module.uid === "number" 60 | a.btn.btn-success(href=`#module/${item.module.uid}`)= item.module.id 61 | else 62 | span.btn.btn-success= item.module.id 63 | td: pre: code= item.module.name.split("!").join("\n") 64 | td= item.count 65 | td 66 | if typeof item.otherModule.uid === "number" 67 | a.btn.btn-success(href=`#module/${item.otherModule.uid}`)= item.otherModule.id 68 | else 69 | span.btn.btn-success= item.otherModule.id 70 | td: pre: code= item.otherModule.name.split("!").join("\n") 71 | td= require("../../formatSize")(item.saving) + "+" 72 | if longChains.length > 0 73 | h2 Long module build chains 74 | p Use prefetching to increase build performance. Prefetch a module from the middle of the chain. 75 | for chain in longChains 76 | table.table.table-bordered 77 | thead 78 | tr 79 | th module 80 | th name 81 | th time 82 | th finished @ 83 | tbody 84 | for module in chain 85 | tr 86 | td 87 | if typeof module.uid === "number" 88 | a.btn.btn-success(href=`#module/${module.uid}`)= module.id 89 | else 90 | span.btn.btn-success= module.id 91 | td: pre: code= module.name.split("!").join("\n") 92 | td= module.time + " ms" 93 | td= module.timestamp + " ms" 94 | -------------------------------------------------------------------------------- /app/pages/module/module.pug: -------------------------------------------------------------------------------- 1 | .container-fluid 2 | .row 3 | .col-md-6: .well 4 | table(width="100%"): tbody: tr 5 | td: a.btn.btn-success.disabled(href=`#module/${module.uid}`)= module.id 6 | td: pre: code= module.name.split("!").join("\n") 7 | .col-md-3: .well 8 | h4 time 9 | if module.time 10 | code= module.time + "ms" 11 | if module.timestamp 12 | = " finished @ " 13 | code= module.timestamp + "ms" 14 | else 15 | | Compile with --profile. 16 | .col-md-3: .well 17 | h4 size 18 | = require("../../formatSize")(module.size) 19 | .row 20 | .col-md-3: .well 21 | h4 flags 22 | if module.built 23 | span.label.label-success built 24 | = " " 25 | if !module.cacheable 26 | span.label.label-warning not cacheable 27 | = " " 28 | if module.prefetched 29 | span.label.label-success prefetched 30 | = " " 31 | if module.failed 32 | span.label.label-danger failed 33 | = " " 34 | if module.warnings 35 | span.label.label-warning= module.warnings + " warnings" 36 | = " " 37 | if module.errors 38 | span.label.label-danger= module.errors + " errors" 39 | .col-md-3: .well 40 | h4 chunks 41 | each chunk in module.chunks 42 | a.btn.btn-info(href=`#chunk/${chunk}`)= chunk 43 | .col-md-6: .well 44 | if issuer 45 | h4 issuer 46 | table(width="100%"): tbody: tr 47 | td 48 | if typeof issuer.uid === "number" 49 | a.btn.btn-success(href=`#module/${issuer.uid}`)= issuer.id 50 | else 51 | span.btn.btn-success= issuer.id 52 | td: pre: code= issuer.name.split("!").join("\n") 53 | .row 54 | .col-md-12: .well 55 | h4 reasons 56 | table.table.table-condensed 57 | thead 58 | tr 59 | th type 60 | th(colspan=2) module 61 | th user request 62 | th location 63 | tbody 64 | each reason in module.reasons 65 | tr 66 | td= reason.type 67 | td(style="width: 1px") 68 | if typeof reason.moduleUid === "number" 69 | a.btn.btn-success(href=`#module/${reason.moduleUid}`)= reason.moduleId 70 | else 71 | span.btn.btn-success= reason.moduleId 72 | td: if reason.module 73 | pre: code= reason.module.split("!").join("\n") 74 | td: if reason.userRequest 75 | pre: code= reason.userRequest.split("!").join("\n") 76 | td 77 | if reason.loc 78 | code= reason.loc 79 | .row 80 | .col-md-12: .well 81 | h4 dependencies 82 | table.table 83 | thead 84 | tr 85 | th type 86 | th(colspan=2) module 87 | th user request 88 | th location 89 | tbody 90 | each dependency in module.dependencies 91 | tr 92 | td= dependency.type 93 | td(style="width: 1px") 94 | if typeof dependency.moduleUid === "number" 95 | a.btn.btn-success(href=`#module/${dependency.moduleUid}`)= dependency.moduleId 96 | else 97 | span.btn.btn-success= dependency.moduleId 98 | td: if dependency.module 99 | pre: code= dependency.module.split("!").join("\n") 100 | td: if dependency.userRequest 101 | pre: code= dependency.userRequest.split("!").join("\n") 102 | td 103 | if dependency.loc 104 | code= dependency.loc 105 | .row 106 | .col-md-12 107 | pre: code= module.source -------------------------------------------------------------------------------- /app/pages/chunk/chunk.pug: -------------------------------------------------------------------------------- 1 | .container-fluid 2 | .row 3 | .col-md-4: .well 4 | h4 chunk id 5 | = id 6 | .col-md-4: .well 7 | h4 size 8 | = require("../../formatSize")(chunk.size) 9 | .col-md-4: .well 10 | h4 names 11 | each name in chunk.names 12 | code= name 13 | .row 14 | if chunk.parents.length && chunk.children.length 15 | .col-md-3: .well 16 | h4 parents 17 | each parent in chunk.parents 18 | a.btn.btn-info(href=`#chunk/${parent}`)= parent 19 | = " " 20 | .col-md-3: .well 21 | h4 children 22 | each child in chunk.children 23 | a.btn.btn-info(href=`#chunk/${child}`)= child 24 | = " " 25 | else if chunk.parents.length 26 | .col-md-6: .well 27 | h4 parents 28 | each parent in chunk.parents 29 | a.btn.btn-info(href=`#chunk/${parent}`)= parent 30 | = " " 31 | else if chunk.children.length 32 | .col-md-6: .well 33 | h4 children 34 | each child in chunk.children 35 | a.btn.btn-info(href=`#chunk/${child}`)= child 36 | = " " 37 | .col-md-6: .well 38 | h4 files 39 | each file in chunk.files 40 | a.btn.btn-default(href="#assets")= file 41 | = " " 42 | .row 43 | .col-md-12: .well 44 | h4 origins 45 | table.table.table-condensed 46 | thead 47 | tr 48 | th reasons 49 | th name 50 | th(colspan="2") module 51 | th location 52 | tbody 53 | each origin in chunk.origins 54 | tr 55 | td 56 | if Array.isArray(origin.reasons) 57 | each reason in origin.reasons 58 | code= reason 59 | = " " 60 | td: code= origin.name 61 | td 62 | if typeof origin.moduleUid === "number" 63 | a.btn.btn-success(href=`#module/${origin.moduleUid}`)= origin.moduleId 64 | else 65 | span.btn.btn-success= origin.moduleId 66 | td: pre: code= origin.moduleName.split("!").join("\n") 67 | td 68 | if origin.loc 69 | code= origin.loc 70 | if chunk.modules && chunk.modules.length > 0 71 | .row: .col-md-12: .well 72 | h4 modules 73 | table.table.table-condensed 74 | thead 75 | tr 76 | th id 77 | th name 78 | th size 79 | th chunks 80 | th flags 81 | tbody 82 | each module in chunk.modules 83 | tr 84 | td 85 | if typeof module.uid === "number" 86 | a.btn.btn-success(href=`#module/${module.uid}`)= module.id 87 | else 88 | span.btn.btn-success= module.id 89 | td: pre: code= module.name.split("!").join("\n") 90 | td= require("../../formatSize")(module.size) 91 | td 92 | each chunk in module.chunks 93 | a.btn.btn-info(href=`#chunk/${chunk}`)= chunk 94 | = " " 95 | td 96 | if module.built 97 | span.label.label-success built 98 | = " " 99 | if !module.cacheable 100 | span.label.label-warning not cacheable 101 | = " " 102 | if module.prefetched 103 | span.label.label-success prefetched 104 | = " " 105 | if module.failed 106 | span.label.label-danger failed 107 | = " " 108 | if module.warnings 109 | span.label.label-warning= module.warnings + " warnings" 110 | = " " 111 | if module.errors 112 | span.label.label-danger= module.errors + " errors" 113 | -------------------------------------------------------------------------------- /app/app.js: -------------------------------------------------------------------------------- 1 | exports.stats = null; 2 | exports.mapModules = null; 3 | exports.mapChunks = null; 4 | 5 | function load(stats) { 6 | stats.assets = stats.assets || []; 7 | stats.assets.sort(function(a, b) { 8 | return b.size - a.size; 9 | }); 10 | stats.modules.sort(function(a, b) { 11 | return a.id - b.id; 12 | }); 13 | var mapModules = {}; 14 | var mapModulesIdent = {}; 15 | var mapModulesUid = {}; 16 | stats.modules.forEach(function(module, idx) { 17 | mapModules[module.id] = module; 18 | mapModulesIdent["$" + module.identifier] = module; 19 | mapModulesUid[(module.uid = idx)] = module; 20 | module.dependencies = []; 21 | }); 22 | var mapChunks = {}; 23 | stats.chunks = stats.chunks || []; 24 | stats.chunks.forEach(function(chunk) { 25 | mapChunks[chunk.id] = chunk; 26 | chunk.children = []; 27 | }); 28 | stats.modules.forEach(function(module) { 29 | module.reasons = module.reasons || []; 30 | module.reasons.forEach(function(reason) { 31 | var m = mapModulesIdent["$" + reason.moduleIdentifier]; 32 | if (!m) return; 33 | reason.moduleUid = m.uid; 34 | m.dependencies.push({ 35 | type: reason.type, 36 | moduleId: module.id, 37 | moduleUid: module.uid, 38 | module: module.name, 39 | userRequest: reason.userRequest, 40 | loc: reason.loc 41 | }); 42 | }); 43 | module.issuerUid = 44 | mapModulesIdent["$" + module.issuer] && 45 | mapModulesIdent["$" + module.issuer].uid; 46 | (function setTimestamp(module) { 47 | if (typeof module.timestamp === "number") return module.timestamp; 48 | if (!module.profile) return; 49 | var factory = module.profile.factory || 0; 50 | var building = module.profile.building || 0; 51 | module.time = factory + building; 52 | if (!module.issuer) return (module.timestamp = module.time); 53 | var issuer = mapModulesIdent["$" + module.issuer]; 54 | if (!issuer) return (module.timestamp = NaN); 55 | setTimestamp(issuer); 56 | module.timestamp = issuer.timestamp + module.time; 57 | })(module); 58 | }); 59 | stats.chunks.forEach(function(chunk) { 60 | chunk.parents.forEach(function(parent) { 61 | var c = mapChunks[parent]; 62 | c.children.push(chunk.id); 63 | }); 64 | chunk.origins.forEach(function(origin) { 65 | var m = mapModulesIdent["$" + origin.moduleIdentifier]; 66 | if (!m) return; 67 | origin.moduleUid = m.uid; 68 | }); 69 | }); 70 | stats.modules.forEach(function(module) { 71 | module.dependencies.sort(function(a, b) { 72 | if (!a.loc && !b.loc) return 0; 73 | if (!a.loc) return 1; 74 | if (!b.loc) return -1; 75 | a = a.loc.split(/[:-]/); 76 | b = b.loc.split(/[:-]/); 77 | if (+a[0] < +b[0]) return -1; 78 | if (+a[0] > +b[0]) return 1; 79 | if (+a[1] < +b[1]) return -1; 80 | if (+a[1] > +b[1]) return 1; 81 | return 0; 82 | }); 83 | }); 84 | var maxLength = 0; 85 | stats.assets.forEach(function(a) { 86 | if (a.name.length > maxLength) maxLength = a.name.length; 87 | }); 88 | stats.assets.forEach(function(a) { 89 | a.normalizedName = a.name; 90 | while (a.normalizedName.length < maxLength) 91 | a.normalizedName = " " + a.normalizedName; 92 | }); 93 | stats.assets.sort(function(a, b) { 94 | a = a.normalizedName; 95 | b = b.normalizedName; 96 | return a < b ? -1 : 1; 97 | }); 98 | exports.stats = stats; 99 | exports.mapChunks = mapChunks; 100 | exports.mapModules = mapModules; 101 | exports.mapModulesUid = mapModulesUid; 102 | exports.mapModulesIdent = mapModulesIdent; 103 | 104 | var ga = require("./googleAnalytics"); 105 | ga("set", "dimension1", categorize(stats.modules.length) + ""); 106 | ga("set", "dimension2", categorize(stats.chunks.length) + ""); 107 | ga("set", "dimension3", categorize(stats.assets.length) + ""); 108 | ga("set", "dimension4", categorize(stats.time) + ""); 109 | } 110 | 111 | exports.load = function(stats) { 112 | var isMultiCompile = 113 | !stats.assets && 114 | !stats.modules && 115 | stats.children && 116 | stats.children.length > 1; 117 | if (isMultiCompile) { 118 | exports.loadPage("select", stats); 119 | } else { 120 | load(stats); 121 | } 122 | }; 123 | 124 | function categorize(number) { 125 | if (number <= 0) return 0; 126 | var factor = 1; 127 | do { 128 | if (number <= 10) return number * factor; 129 | factor *= 10; 130 | number = Math.floor(number / 10); 131 | } while (number > 0); 132 | return ""; 133 | } 134 | -------------------------------------------------------------------------------- /web_modules/sigma.js/plugins/sigma.parsers.gexf.min.js: -------------------------------------------------------------------------------- 1 | (function(a){"use strict";function b(a){return{id:a.id,label:a.label,attributes:a.attributes||{},viz:a.viz||{}}}function c(a){return{id:a.id,type:a.type||"undirected",label:a.label||"",source:a.source,target:a.target,weight:+a.weight||1,viz:a.viz||{}}}function d(a){function d(){var a={};return l.els.meta?(a.lastmodifieddate=l.els.meta.getAttribute("lastmodifieddate"),h.nodeListEach(l.els.meta.childNodes,function(b){a[b.tagName.toLowerCase()]=b.textContent}),a):a}function e(){var a=[];return h.nodeListEach(l.els.model,function(b){var c={id:b.getAttribute("id")||b.getAttribute("for"),type:b.getAttribute("type")||"string",title:b.getAttribute("title")||""},d=h.nodeListToArray(b.childNodes);d.length>0&&(c.defaultValue=d[0].textContent),a.push(c)}),a}function f(a){var c=[];return h.nodeListEach(l.els.nodes,function(d){var e={id:d.getAttribute("id"),label:d.getAttribute("label")||""};a.length>0&&(e.attributes=g(a,d)),l.hasViz&&(e.viz=i(d)),c.push(b(e))}),c}function g(a,b){var c={},d=b.getElementsByTagName("attvalue"),e=h.nodeListToHash(d,function(a){var b=h.namedNodeMapToObject(a.attributes),c=b.id||b["for"];return{key:c,value:b.value}});return a.map(function(a){var b=a.title.toLowerCase();c[b]=!(a.id in e)&&"defaultValue"in a?h.enforceType(a.type,a.defaultValue):h.enforceType(a.type,e[a.id])}),c}function i(a){var b={},c=h.getFirstElementByTagNS(a,"viz","color");if(c){var d=["r","g","b","a"].map(function(a){return c.getAttribute(a)});b.color=h.getRGB(d)}var e=h.getFirstElementByTagNS(a,"viz","position");e&&(b.position={},["x","y","z"].map(function(a){b.position[a]=+e.getAttribute(a)}));var f=h.getFirstElementByTagNS(a,"viz","size");f&&(b.size=+f.getAttribute("value"));var g=h.getFirstElementByTagNS(a,"viz","shape");return g&&(b.shape=g.getAttribute("value")),b}function j(a){var b=[];return h.nodeListEach(l.els.edges,function(d){var e=h.namedNodeMapToObject(d.attributes);"type"in e||(e.type=a),l.hasViz&&(e.viz=k(d)),b.push(c(e))}),b}function k(a){var b={},c=h.getFirstElementByTagNS(a,"viz","color");if(c){var d=["r","g","b","a"].map(function(a){return c.getAttribute(a)});b.color=h.getRGB(d)}var e=h.getFirstElementByTagNS(a,"viz","shape");e&&(b.shape=e.getAttribute("value"));var f=h.getFirstElementByTagNS(a,"viz","thickness");return f&&(b.thickness=+f.getAttribute("value")),b}var l={};l.els={root:a.getElementsByTagName("gexf")[0],graph:a.getElementsByTagName("graph")[0],meta:a.getElementsByTagName("meta")[0],model:a.getElementsByTagName("attribute"),nodes:a.getElementsByTagName("node"),edges:a.getElementsByTagName("edge")},l.hasViz=!!h.getAttributeNS(l.els.root,"xmlns","viz"),l.version=l.els.root.getAttribute("version")||"1.0",l.mode=l.els.graph.getAttribute("mode")||"static";var m=l.els.graph.getAttribute("defaultedgetype");return l.defaultEdgetype=m||"undirected",l.model=e(),{version:l.version,mode:l.mode,defaultEdgeType:l.defaultEdgetype,meta:d(),model:l.model,nodes:f(l.model),edges:j(l.defaultEdgetype)}}function e(a,b){var c=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;var a,b;if(window.ActiveXObject){a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(b in a)try{return new ActiveXObject(a[b])}catch(c){}}return null}();if(!c)throw"XMLHttpRequest not supported, cannot load the file.";var d,e="function"==typeof b;return c.overrideMimeType?(c.overrideMimeType("text/xml"),d=function(a){return a.responseXML}):d=function(a){var b=new DOMParser;return b.parseFromString(a.responseText,"application/xml")},c.open("GET",a,e),e&&(c.onreadystatechange=function(){4===c.readyState&&b(d(c))}),c.send(),e?c:d(c)}function f(a){return d(a)}function g(a,b){return"function"==typeof b?e(a,function(a){b(d(a))}):d(e(a))}var h={nodeListToArray:function(a){for(var b=[],c=0,d=a.length;d>c;++c)"#text"!==a[c].nodeName&&b.push(a[c]);return b},nodeListEach:function(a,b){for(var c=0,d=a.length;d>c;++c)"#text"!==a[c].nodeName&&b(a[c])},nodeListToHash:function(a,b){for(var c={},d=0;df;f++)i=h[f],i.id=i.id,i.viz&&"object"==typeof i.viz&&(i.viz.position&&"object"==typeof i.viz.position&&(i.x=i.viz.position.x,i.y=i.viz.position.y),i.size=i.viz.size,i.color=i.viz.color);for(h=b.edges,f=0,g=h.length;g>f;f++)i=h[f],i.id="string"==typeof i.id?i.id:a(),i.size=i.weight,i.source=""+i.source,i.target=""+i.target;if(c instanceof sigma){for(c.graph.clear(),h=b.nodes,f=0,g=h.length;g>f;f++)c.graph.addNode(h[f]);for(h=b.edges,f=0,g=h.length;g>f;f++)c.graph.addEdge(h[f])}else"object"==typeof c?(c.graph=b,c=new sigma(c)):"function"==typeof c&&(c=null,d=c);return d?void d(c||b):b}var f,g,h,i;if("string"==typeof b)GexfParser.fetch(b,e);else if("object"==typeof b)return e(GexfParser.parse(b))}}.call(this); -------------------------------------------------------------------------------- /app/graphs/modules.js: -------------------------------------------------------------------------------- 1 | var app = require("../app"); 2 | var sigma = require("sigma.js"); 3 | var findById = require("../findById"); 4 | var percentageToColor = require("../percentageToColor").greenRed; 5 | var percentageToColor2 = require("../percentageToColor").blue; 6 | 7 | var element = document.getElementById("sigma-modules"); 8 | 9 | var nodes = []; 10 | var edges = []; 11 | var moduleCount = app.stats.modules.length; 12 | var chunkCount = app.stats.chunks.length; 13 | var maxTimestamp = 0; 14 | var maxSize = 0; 15 | app.stats.modules.forEach(function(module, idx) { 16 | if (module.size > maxSize) maxSize = module.size; 17 | if (module.timestamp > maxTimestamp) maxTimestamp = module.timestamp; 18 | }); 19 | app.stats.modules.forEach(function(module, idx) { 20 | var color = percentageToColor( 21 | Math.pow((module.size + 1) / (maxSize + 1), 1 / 4) 22 | ); 23 | var done = {}; 24 | var uniqueReasons = module.reasons.filter(function(reason) { 25 | var parent = reason.module; 26 | if (done["$" + parent]) return false; 27 | done["$" + parent] = true; 28 | return true; 29 | }); 30 | var uid = module.uid; 31 | nodes.push({ 32 | id: "module" + uid, 33 | uid: uid, 34 | moduleUid: uid, 35 | moduleId: module.id, 36 | module: module, 37 | type: "webpack", 38 | size: module.size + 1, 39 | label: "[" + module.id + "] " + module.name, 40 | shortLabel: "" + module.id, 41 | x: 42 | Math.cos((idx / moduleCount) * Math.PI * 2) * 43 | Math.sqrt(uniqueReasons.length + 1) * 44 | Math.sqrt(moduleCount), 45 | y: 46 | Math.sin((idx / moduleCount) * Math.PI * 2) * 47 | Math.sqrt(uniqueReasons.length + 1) * 48 | Math.sqrt(moduleCount), 49 | originalColor: color, 50 | color: color 51 | }); 52 | var edgeColor = 53 | typeof module.timestamp === "number" 54 | ? percentageToColor2(module.timestamp / maxTimestamp) 55 | : undefined; 56 | uniqueReasons.forEach(function(reason) { 57 | var parentIdent = reason.moduleIdentifier; 58 | var parentModule = app.mapModulesIdent["$" + parentIdent]; 59 | if (!parentModule) return; 60 | var weight = 1 / uniqueReasons.length / uniqueReasons.length; 61 | var async = !module.chunks.some(function(chunk) { 62 | return (function isInChunks(chunks, checked) { 63 | if (chunks.length === 0) return false; 64 | if (chunks.indexOf(chunk) >= 0) return true; 65 | chunks = chunks.filter(function(c) { 66 | return checked.indexOf(c) < 0; 67 | }); 68 | if (chunks.length === 0) return false; 69 | return chunks.some(function(c) { 70 | return isInChunks(app.mapChunks[c].parents, checked.concat(c)); 71 | }); 72 | })(parentModule.chunks, []); 73 | }); 74 | edges.push({ 75 | id: "edge" + module.uid + "-" + +parentModule.uid, 76 | sourceModuleUid: parentModule.uid, 77 | sourceModule: parentModule, 78 | source: "module" + parentModule.uid, 79 | targetModule: module, 80 | targetModuleUid: module.uid, 81 | target: "module" + module.uid, 82 | arrow: "target", 83 | type: async ? "dashedArrow" : "arrow", 84 | lineDash: module.chunks.length === 0 ? [2] : [5], 85 | originalColor: edgeColor, 86 | color: edgeColor, 87 | size: weight, 88 | weight: async ? weight / 4 : weight 89 | }); 90 | }); 91 | }); 92 | var s = new sigma({ 93 | graph: { 94 | nodes: nodes, 95 | edges: edges 96 | }, 97 | renderer: { 98 | type: "canvas", 99 | container: element 100 | }, 101 | settings: { 102 | edgeColor: "target", 103 | maxNodeSize: 4, 104 | minNodeSize: 4, 105 | maxEdgeSize: 2, 106 | minEdgeSize: 0.05 107 | } 108 | }); 109 | 110 | var activeModuleUid = null; 111 | 112 | s.bind("clickNode", function(e) { 113 | if (e.data.node.moduleUid === activeModuleUid) 114 | window.location.hash = "#modules"; 115 | else window.location.hash = "#module/" + e.data.node.moduleUid; 116 | }); 117 | 118 | s.refresh(); 119 | 120 | exports.show = function() { 121 | element.style.display = "block"; 122 | s.refresh(); 123 | s.startForceAtlas2(); 124 | s.forceatlas2.p.adjustSizes = false; 125 | s.forceatlas2.p.edgeWeightInfluence = 0.5; 126 | s.renderers[0].resize(); 127 | }; 128 | 129 | exports.hide = function() { 130 | element.style.display = "none"; 131 | s.stopForceAtlas2(); 132 | }; 133 | 134 | exports.setNormal = function() { 135 | activeModuleUid = null; 136 | s.graph.nodes().forEach(function(n) { 137 | n.color = n.originalColor; 138 | n.active = false; 139 | }); 140 | s.graph.edges().forEach(function(e) { 141 | e.color = e.originalColor; 142 | }); 143 | s.refresh(); 144 | }; 145 | 146 | exports.setActiveModule = function(activeModule) { 147 | activeModuleUid = activeModule; 148 | var colors = {}; 149 | var m = app.mapModulesUid[activeModule]; 150 | m.reasons.forEach(function(r) { 151 | colors[r.moduleUid] = "#ff0000"; 152 | }); 153 | m.dependencies.forEach(function(d) { 154 | colors[d.moduleUid] = "#00aa00"; 155 | }); 156 | colors[activeModule] = "#000000"; 157 | s.graph.nodes().forEach(function(n) { 158 | n.color = colors[n.moduleUid] || "#aaaaaa"; 159 | }); 160 | s.graph.edges().forEach(function(e) { 161 | if (e.targetModuleUid === activeModule) e.color = "#ff0000"; 162 | else if (e.sourceModuleUid === activeModule) e.color = "#00aa00"; 163 | else e.color = "#aaaaaa"; 164 | }); 165 | s.refresh(); 166 | }; 167 | 168 | exports.setActiveChunk = function(activeChunk) { 169 | activeModuleUid = null; 170 | s.graph.nodes().forEach(function(n) { 171 | var m = n.module; 172 | if (m.chunks.indexOf(activeChunk) >= 0) n.color = "#000000"; 173 | else n.color = "#aaaaaa"; 174 | n.active = false; 175 | }); 176 | s.graph.edges().forEach(function(e) { 177 | var sm = e.sourceModule; 178 | var tm = e.targetModule; 179 | var sc = sm.chunks.indexOf(activeChunk) >= 0; 180 | var tc = tm.chunks.indexOf(activeChunk) >= 0; 181 | if (sc && tc) e.color = "#000000"; 182 | else if (sc) e.color = "#00aa00"; 183 | else if (tc) e.color = "#ff0000"; 184 | else e.color = "#aaaaaa"; 185 | }); 186 | s.refresh(); 187 | }; 188 | -------------------------------------------------------------------------------- /web_modules/sigma.js/plugins/sigma.layout.forceAtlas2.min.js: -------------------------------------------------------------------------------- 1 | !function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";var a=sigma.utils.pkg("sigma.layout.forceatlas2");a.ForceAtlas2=function(b,c){var d=this;this.graph=b,this.p=sigma.utils.extend(c||{},a.defaultSettings),this.state={step:0,index:0},this.init=function(){return d.state={step:0,index:0},d.graph.nodes().forEach(function(a){a.fa2={mass:1+d.graph.degree(a.id),old_dx:0,old_dy:0,dx:0,dy:0}}),d},this.go=function(){for(;d.atomicGo(););},this.atomicGo=function(){var b,c,e,f,g,h,i,j=d.graph,k=j.nodes,l=j.edges,m=k(),n=l(),o=d.p.complexIntervals,p=d.p.simpleIntervals;switch(d.state.step){case 0:for(b=0,f=m.length;f>b;b++)c=m[b],c.fa2=c.fa2?{mass:1+d.graph.degree(c.id),old_dx:c.fa2.dx||0,old_dy:c.fa2.dy||0,dx:0,dy:0}:{mass:1+d.graph.degree(c.id),old_dx:0,old_dy:0,dx:0,dy:0};if(d.p.barnesHutOptimize&&(d.rootRegion=new a.Region(m,0),d.rootRegion.buildSubRegions()),d.p.outboundAttractionDistribution){for(d.p.outboundAttCompensation=0,b=0,f=m.length;f>b;b++)c=m[b],d.p.outboundAttCompensation+=c.fa2.mass;d.p.outboundAttCompensation/=m.length}return d.state.step=1,d.state.index=0,!0;case 1:var q,r,s,t,u,v,w=d.ForceFactory.buildRepulsion(d.p.adjustSizes,d.p.scalingRatio);if(d.p.barnesHutOptimize){for(u=d.rootRegion,v=d.p.barnesHutTheta,b=d.state.index;bt;t++)(r=m[t]).fa2&&w.apply_nn(q,r);s===m.length?d.state={step:2,index:0}:d.state.index=s}return!0;case 2:var x=d.p.strongGravityMode?d.ForceFactory.getStrongGravity(d.p.scalingRatio):d.ForceFactory.buildRepulsion(d.p.adjustSizes,d.p.scalingRatio),y=d.p.gravity,z=d.p.scalingRatio;for(b=d.state.index;bb;b++)c=m[b],g=c.fixed||!1,!g&&c.fa2&&(h=Math.sqrt(Math.pow(c.fa2.old_dx-c.fa2.dx,2)+Math.pow(c.fa2.old_dy-c.fa2.dy,2)),D+=c.fa2.mass*h,E+=.5*c.fa2.mass*Math.sqrt(Math.pow(c.fa2.old_dx+c.fa2.dx,2)+Math.pow(c.fa2.old_dy+c.fa2.dy,2)));for(d.p.totalSwinging=D,d.p.totalEffectiveTraction=E,C=Math.pow(d.p.jitterTolerance,2)*d.p.totalEffectiveTraction/d.p.totalSwinging,B=.5,d.p.speed=d.p.speed+Math.min(C-d.p.speed,B*d.p.speed),b=0,f=m.length;f>b;b++)c=m[b],c.old_x=+c.x,c.old_y=+c.y;return d.state.step=5,!0;case 5:var F,G;if(b=d.state.index,d.p.adjustSizes)for(G=d.p.speed;ba;a++)delete b[a].fa2},this.setAutoSettings=function(){var a=this.graph;return this.p.scalingRatio=a.nodes().length>=100?2:10,this.p.strongGravityMode=!1,this.p.gravity=1,this.p.outboundAttractionDistribution=!1,this.p.linLogMode=!1,this.p.adjustSizes=!1,this.p.edgeWeightInfluence=1,this.p.jitterTolerance=a.nodes().length>=5e4?10:a.nodes().length>=5e3?1:.1,this.p.barnesHutOptimize=a.nodes().length>=1e3?!0:!1,this.p.barnesHutTheta=1.2,this},this.kill=function(){},this.ForceFactory={buildRepulsion:function(a,b){return a?new this.linRepulsion_antiCollision(b):new this.linRepulsion(b)},getStrongGravity:function(a){return new this.strongGravity(a)},buildAttraction:function(a,b,c,d){return c?a?b?new this.logAttraction_degreeDistributed_antiCollision(d):new this.logAttraction_antiCollision(d):b?new this.linAttraction_degreeDistributed_antiCollision(d):new this.linAttraction_antiCollision(d):a?b?new this.logAttraction_degreeDistributed(d):new this.logAttraction(d):b?new this.linAttraction_massDistributed(d):new this.linAttraction(d)},linRepulsion:function(a){this.coefficient=a,this.apply_nn=function(a,b){if(a.fa2&&b.fa2){var c=a.x-b.x,d=a.y-b.y,e=Math.sqrt(c*c+d*d);if(e>0){var f=this.coefficient*a.fa2.mass*b.fa2.mass/Math.pow(e,2);a.fa2.dx+=c*f,a.fa2.dy+=d*f,b.fa2.dx-=c*f,b.fa2.dy-=d*f}}},this.apply_nr=function(a,b){var c=a.x-b.p.massCenterX,d=a.y-b.p.massCenterY,e=Math.sqrt(c*c+d*d);if(e>0){var f=this.coefficient*a.fa2.mass*b.p.mass/Math.pow(e,2);a.fa2.dx+=c*f,a.fa2.dy+=d*f}},this.apply_g=function(a,b){var c=a.x,d=a.y,e=Math.sqrt(c*c+d*d);if(e>0){var f=this.coefficient*a.fa2.mass*b/e;a.fa2.dx-=c*f,a.fa2.dy-=d*f}}},linRepulsion_antiCollision:function(a){this.coefficient=a,this.apply_nn=function(a,b){var c;if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e)-a.size-b.size;f>0?(c=this.coefficient*a.fa2.mass*b.fa2.mass/Math.pow(f,2),a.fa2.dx+=d*c,a.fa2.dy+=e*c,b.fa2.dx-=d*c,b.fa2.dy-=e*c):0>f&&(c=100*this.coefficient*a.fa2.mass*b.fa2.mass,a.fa2.dx+=d*c,a.fa2.dy+=e*c,b.fa2.dx-=d*c,b.fa2.dy-=e*c)}},this.apply_nr=function(a,b){var c,d=a.fa2.x()-b.getMassCenterX(),e=a.fa2.y()-b.getMassCenterY(),f=Math.sqrt(d*d+e*e);f>0?(c=this.coefficient*a.fa2.mass*b.getMass()/Math.pow(f,2),a.fa2.dx+=d*c,a.fa2.dy+=e*c):0>f&&(c=-this.coefficient*a.fa2.mass*b.getMass()/f,a.fa2.dx+=d*c,a.fa2.dy+=e*c)},this.apply_g=function(a,b){var c=a.x,d=a.y,e=Math.sqrt(c*c+d*d);if(e>0){var f=this.coefficient*a.fa2.mass*b/e;a.fa2.dx-=c*f,a.fa2.dy-=d*f}}},strongGravity:function(a){this.coefficient=a,this.apply_nn=function(){},this.apply_nr=function(){},this.apply_g=function(a,b){var c=a.x,d=a.y,e=Math.sqrt(c*c+d*d);if(e>0){var f=this.coefficient*a.fa2.mass*b;a.fa2.dx-=c*f,a.fa2.dy-=d*f}}},linAttraction:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=-this.coefficient*c;a.fa2.dx+=d*f,a.fa2.dy+=e*f,b.fa2.dx-=d*f,b.fa2.dy-=e*f}}},linAttraction_massDistributed:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=-this.coefficient*c/a.fa2.mass;a.fa2.dx+=d*f,a.fa2.dy+=e*f,b.fa2.dx-=d*f,b.fa2.dy-=e*f}}},logAttraction:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e);if(f>0){var g=-this.coefficient*c*Math.log(1+f)/f;a.fa2.dx+=d*g,a.fa2.dy+=e*g,b.fa2.dx-=d*g,b.fa2.dy-=e*g}}}},logAttraction_degreeDistributed:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e);if(f>0){var g=-this.coefficient*c*Math.log(1+f)/f/a.fa2.mass;a.fa2.dx+=d*g,a.fa2.dy+=e*g,b.fa2.dx-=d*g,b.fa2.dy-=e*g}}}},linAttraction_antiCollision:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e);if(f>0){var g=-this.coefficient*c;a.fa2.dx+=d*g,a.fa2.dy+=e*g,b.fa2.dx-=d*g,b.fa2.dy-=e*g}}}},linAttraction_degreeDistributed_antiCollision:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e);if(f>0){var g=-this.coefficient*c/a.fa2.mass;a.fa2.dx+=d*g,a.fa2.dy+=e*g,b.fa2.dx-=d*g,b.fa2.dy-=e*g}}}},logAttraction_antiCollision:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e);if(f>0){var g=-this.coefficient*c*Math.log(1+f)/f;a.fa2.dx+=d*g,a.fa2.dy+=e*g,b.fa2.dx-=d*g,b.fa2.dy-=e*g}}}},logAttraction_degreeDistributed_antiCollision:function(a){this.coefficient=a,this.apply_nn=function(a,b,c){if(a.fa2&&b.fa2){var d=a.x-b.x,e=a.y-b.y,f=Math.sqrt(d*d+e*e);if(f>0){var g=-this.coefficient*c*Math.log(1+f)/f/a.fa2.mass;a.fa2.dx+=d*g,a.fa2.dy+=e*g,b.fa2.dx-=d*g,b.fa2.dy-=e*g}}}}}},a.Region=function(a,b){this.depthLimit=20,this.size=0,this.nodes=a,this.subregions=[],this.depth=b,this.p={mass:0,massCenterX:0,massCenterY:0},this.updateMassAndGeometry()},a.Region.prototype.updateMassAndGeometry=function(){if(this.nodes.length>1){var a=0,b=0,c=0;this.nodes.forEach(function(d){a+=d.fa2.mass,b+=d.x*d.fa2.mass,c+=d.y*d.fa2.mass});var d,e=b/a,f=c/a;this.nodes.forEach(function(a){var b=Math.sqrt((a.x-e)*(a.x-e)+(a.y-f)*(a.y-f));d=Math.max(d||2*b,2*b)}),this.p.mass=a,this.p.massCenterX=e,this.p.massCenterY=f,this.size=d}},a.Region.prototype.buildSubRegions=function(){if(this.nodes.length>1){var b,c,d,e,f=[],g=[],h=[],i=this.p.massCenterX,j=this.p.massCenterY,k=this.depth+1,l=this,m=[],n=[],o=[],p=[];this.nodes.forEach(function(a){b=a.xthis.size?b.apply_nr(a,this):this.subregions.forEach(function(d){d.applyForce(a,b,c)})}},sigma.prototype.startForceAtlas2=function(){function b(){conrad.hasJob("forceatlas2_"+c.id)||conrad.addJob({id:"forceatlas2_"+c.id,job:c.forceatlas2.atomicGo,end:function(){c.refresh(),c.forceatlas2.isRunning&&b()}})}if((this.forceatlas2||{}).isRunning)return this;this.forceatlas2||(this.forceatlas2=new a.ForceAtlas2(this.graph),this.forceatlas2.setAutoSettings(),this.forceatlas2.init()),this.forceatlas2.isRunning=!0;var c=this;return b(),this},sigma.prototype.stopForceAtlas2=function(){return conrad.hasJob("forceatlas2_"+this.id)&&conrad.killJob("forceatlas2_"+this.id),(this.forceatlas2||{}).isRunning&&(this.forceatlas2.state={step:0,index:0},this.forceatlas2.isRunning=!1,this.forceatlas2.clean()),this},a.defaultSettings={autoSettings:!0,linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:0,scalingRatio:1,strongGravityMode:!1,gravity:1,jitterTolerance:1,barnesHutOptimize:!1,barnesHutTheta:1.2,speed:1,outboundAttCompensation:1,totalSwinging:0,totalEffectiveTraction:0,complexIntervals:500,simpleIntervals:1e3}}(); -------------------------------------------------------------------------------- /web_modules/sigma.js/sigma.min.js: -------------------------------------------------------------------------------- 1 | /* sigma.js - A JavaScript library dedicated to graph drawing. - Version: 1.0.0 - Author: Alexis Jacomy, Sciences-Po Médialab - License: MIT */ 2 | (function(){"use strict";var a={},b=function(c){var d,e,f,g,h;b.classes.dispatcher.extend(this);var i=this,j=c||{};if("string"==typeof j||j instanceof HTMLElement?j={renderers:[j]}:"[object Array]"===Object.prototype.toString.call(j)&&(j={renderers:j}),g=j.renderers||j.renderer||j.container,j.renderers&&0!==j.renderers.length||("string"==typeof g||g instanceof HTMLElement||"object"==typeof g&&"container"in g)&&(j.renderers=[g]),j.id){if(a[j.id])throw'sigma: Instance "'+j.id+'" already exists.';Object.defineProperty(this,"id",{value:j.id})}else{for(h=0;a[h];)h++;Object.defineProperty(this,"id",{value:""+h})}for(a[this.id]=this,this.settings=new b.classes.configurable(b.settings,j.settings||{}),Object.defineProperty(this,"graph",{value:new b.classes.graph(this.settings),configurable:!0}),Object.defineProperty(this,"middlewares",{value:[],configurable:!0}),Object.defineProperty(this,"cameras",{value:{},configurable:!0}),Object.defineProperty(this,"renderers",{value:{},configurable:!0}),Object.defineProperty(this,"renderersPerCamera",{value:{},configurable:!0}),Object.defineProperty(this,"cameraFrames",{value:{},configurable:!0}),this._handler=function(a){var b,c={};for(b in a.data)c[b]=a.data[b];c.renderer=a.target,this.dispatchEvent(a.type,c)}.bind(this),f=j.renderers||[],d=0,e=f.length;e>d;d++)this.addRenderer(f[d]);for(f=j.middlewares||[],d=0,e=f.length;e>d;d++)this.middlewares.push("string"==typeof f[d]?b.middlewares[f[d]]:f[d]);"object"==typeof j.graph&&j.graph&&(this.graph.read(j.graph),this.refresh()),window.addEventListener("resize",function(){i.settings&&i.refresh()})};if(b.prototype.addCamera=function(a){var c,d=this;if(!arguments.length){for(a=0;this.cameras[""+a];)a++;a=""+a}if(this.cameras[a])throw'sigma.addCamera: The camera "'+a+'" already exists.';return c=new b.classes.camera(a,this.graph,this.settings),this.cameras[a]=c,c.quadtree=new b.classes.quad,c.bind("coordinatesUpdated",function(){d.renderCamera(c,c.isAnimated)}),this.renderersPerCamera[a]=[],c},b.prototype.killCamera=function(a){if(a="string"==typeof a?this.cameras[a]:a,!a)throw"sigma.killCamera: The camera is undefined.";var b,c,d=this.renderersPerCamera[a.id];for(c=d.length,b=c-1;b>=0;b--)this.killRenderer(d[b]);return delete this.renderersPerCamera[a.id],delete this.cameraFrames[a.id],delete this.cameras[a.id],a.kill&&a.kill(),this},b.prototype.addRenderer=function(a){var c,d,e,f,g=a||{};if("string"==typeof g?g={container:document.getElementById(g)}:g instanceof HTMLElement&&(g={container:g}),"id"in g)c=g.id;else{for(c=0;this.renderers[""+c];)c++;c=""+c}if(this.renderers[c])throw'sigma.addRenderer: The renderer "'+c+'" already exists.';if(d="function"==typeof g.type?g.type:b.renderers[g.type],d=d||b.renderers.def,e="camera"in g?g.camera instanceof b.classes.camera?g.camera:this.cameras[g.camera]||this.addCamera(g.camera):this.addCamera(),this.cameras[e.id]!==e)throw"sigma.addRenderer: The camera is not properly referenced.";return f=new d(this.graph,e,this.settings,g),this.renderers[c]=f,Object.defineProperty(f,"id",{value:c}),f.bind&&f.bind(["click","clickStage","clickNode","clickNodes","overNode","overNodes","outNode","outNodes","downNode","downNodes","upNode","upNodes"],this._handler),this.renderersPerCamera[e.id].push(f),f},b.prototype.killRenderer=function(a){if(a="string"==typeof a?this.renderers[a]:a,!a)throw"sigma.killRenderer: The renderer is undefined.";var b=this.renderersPerCamera[a.camera.id],c=b.indexOf(a);return c>=0&&b.splice(c,1),a.kill&&a.kill(),delete this.renderers[a.id],this},b.prototype.refresh=function(){var a,c,d,e,f,g,h=0;for(e=this.middlewares||[],a=0,c=e.length;c>a;a++)e[a].call(this,0===a?"":"tmp"+h+":",a===c-1?"ready:":"tmp"+ ++h+":");for(d in this.cameras)f=this.cameras[d],f.settings("autoRescale")&&this.renderersPerCamera[f.id]&&this.renderersPerCamera[f.id].length?b.middlewares.rescale.call(this,e.length?"ready:":"",f.readPrefix,{width:this.renderersPerCamera[f.id][0].width,height:this.renderersPerCamera[f.id][0].height}):b.middlewares.copy.call(this,e.length?"ready:":"",f.readPrefix),g=b.utils.getBoundaries(this.graph,f.readPrefix),f.quadtree.index(this.graph.nodes(),{prefix:f.readPrefix,bounds:{x:g.minX,y:g.minY,width:g.maxX-g.minX,height:g.maxY-g.minY}});for(e=Object.keys(this.renderers),a=0,c=e.length;c>a;a++)if(this.renderers[e[a]].process)if(this.settings("skipErrors"))try{this.renderers[e[a]].process()}catch(i){console.log('Warning: The renderer "'+e[a]+'" crashed on ".process()"')}else this.renderers[e[a]].process();return this.render(),this},b.prototype.render=function(){var a,b,c;for(c=Object.keys(this.renderers),a=0,b=c.length;b>a;a++)if(this.settings("skipErrors"))try{this.renderers[c[a]].render()}catch(d){this.settings("verbose")&&console.log('Warning: The renderer "'+c[a]+'" crashed on ".render()"')}else this.renderers[c[a]].render();return this},b.prototype.renderCamera=function(a,b){var c,d,e,f=this;if(b)for(e=this.renderersPerCamera[a.id],c=0,d=e.length;d>c;c++)if(this.settings("skipErrors"))try{e[c].render()}catch(g){this.settings("verbose")&&console.log('Warning: The renderer "'+e[c].id+'" crashed on ".render()"')}else e[c].render();else if(!this.cameraFrames[a.id]){for(e=this.renderersPerCamera[a.id],c=0,d=e.length;d>c;c++)if(this.settings("skipErrors"))try{e[c].render()}catch(g){this.settings("verbose")&&console.log('Warning: The renderer "'+e[c].id+'" crashed on ".render()"')}else e[c].render();this.cameraFrames[a.id]=requestAnimationFrame(function(){delete f.cameraFrames[a.id]})}return this},b.prototype.kill=function(){var b;this.graph.kill(),delete this.middlewares;for(b in this.renderers)this.killRenderer(this.renderers[b]);for(b in this.cameras)this.killCamera(this.cameras[b]);delete this.renderers,delete this.cameras;for(b in this)this.hasOwnProperty(b)&&delete this[b];delete a[this.id]},b.instances=function(c){return arguments.length?a[c]:b.utils.extends({},a)},"undefined"!=typeof this.sigma)throw"An object called sigma is already in the global scope.";"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.sigma=b):this.sigma=b}).call(this),function(a){"use strict";function b(a,c){var d,e,f;if(arguments.length)if(1===arguments.length&&Object(arguments[0])===arguments[0])for(a in arguments[0])b(a,arguments[0][a]);else if(arguments.length>1){f=Array.isArray(a)?a:a.split(/ /);for(d in f)e=f[d],C[e]||(C[e]=[]),C[e].push({handler:c})}}function c(a,b){var c,d,e,f,g=Array.isArray(a)?a:a.split(/ /);if(arguments.length)if(b)for(c in g){if(f=g[c],C[f]){e=[];for(d in C[f])C[f][d].handler!==b&&e.push(C[f][d]);C[f]=e}C[f]&&0===C[f].length&&delete C[f]}else for(c in g)delete C[g[c]];else C=Object.create(null)}function d(a,b){var c,d,e,f,g=Array.isArray(a)?a:a.split(/ /);b=void 0===b?{}:b;for(c in g)if(f=g[c],C[f]){e={type:f,data:b||{}};for(d in C[f])try{C[f][d].handler(e)}catch(h){}}}function e(){var a,b,c,d,e=!1,f=s(),g=x.shift();if(c=g.job(),f=s()-f,g.done++,g.time+=f,g.currentTime+=f,g.weightTime=g.currentTime/(g.weight||1),g.averageTime=g.time/g.done,d=g.count?g.count<=g.done:!c,!d){for(a=0,b=x.length;b>a;a++)if(x[a].weightTime>g.weightTime){x.splice(a,0,g),e=!0;break}e||x.push(g)}return d?g:null}function f(a){var b=x.length;w[a.id]=a,a.status="running",b&&(a.weightTime=x[b-1].weightTime,a.currentTime=a.weightTime*(a.weight||1)),a.startTime=s(),d("jobStarted",q(a)),x.push(a)}function g(){var a,b,c;for(a in v)b=v[a],b.after?y[a]=b:f(b),delete v[a];for(u=!!x.length;x.length&&s()-tc;c++)h(a[c].id,p(a[c],b));A=!1,u||(t=s(),d("start"),g())}else if("object"==typeof a)if("string"==typeof a.id)h(a.id,a);else{A=!0;for(c in a)"function"==typeof a[c]?h(c,p({job:a[c]},b)):h(c,p(a[c],b));A=!1,u||(t=s(),d("start"),g())}else{if("string"!=typeof a)throw new Error("[conrad.addJob] Wrong arguments.");if(k(a))throw new Error('[conrad.addJob] Job with id "'+a+'" already exists.');if("function"==typeof b)f={id:a,done:0,time:0,status:"waiting",currentTime:0,averageTime:0,weightTime:0,job:b};else{if("object"!=typeof b)throw new Error("[conrad.addJob] Wrong arguments.");f=p({id:a,done:0,time:0,status:"waiting",currentTime:0,averageTime:0,weightTime:0},b)}v[a]=f,d("jobAdded",q(f)),u||A||(t=s(),d("start"),g())}return this}function i(a){var b,c,e,f,g=!1;if(Array.isArray(a))for(b=0,c=a.length;c>b;b++)i(a[b]);else{if("string"!=typeof a)throw new Error("[conrad.killJob] Wrong arguments.");for(e=[w,y,v],b=0,c=e.length;c>b;b++)a in e[b]&&(f=e[b][a],B.history&&(f.status="done",z.push(f)),d("jobEnded",q(f)),delete e[b][a],"function"==typeof f.end&&f.end(),g=!0);for(e=x,b=0,c=e.length;c>b;b++)if(e[b].id===a){e.splice(b,1);break}if(!g)throw new Error('[conrad.killJob] Job "'+a+'" not found.')}return this}function j(){var a,b=p(v,w,y);if(B.history)for(a in b)b[a].status="done",z.push(b[a]),"function"==typeof b[a].end&&b[a].end();return v={},y={},w={},x=[],u=!1,this}function k(a){var b=v[a]||w[a]||y[a];return b?p(b):null}function l(){var a;if("string"==typeof a1&&1===arguments.length)return B[a1];a="object"==typeof a1&&1===arguments.length?a1||{}:{},"string"==typeof a1&&(a[a1]=a2);for(var b in a)void 0!==a[b]?B[b]=a[b]:delete B[b];return this}function m(){return u}function n(){return z=[],this}function o(a,b){var c,d,e,f,g,h,i;if(!arguments.length){g=[];for(d in v)g.push(v[d]);for(d in y)g.push(y[d]);for(d in w)g.push(w[d]);g=g.concat(z)}if("string"==typeof a)switch(a){case"waiting":g=r(y);break;case"running":g=r(w);break;case"done":g=z;break;default:h=a}if(a instanceof RegExp&&(h=a),!h&&("string"==typeof b||b instanceof RegExp)&&(h=b),h){if(i="string"==typeof h,g instanceof Array)c=g;else if("object"==typeof g){c=[];for(d in g)c=c.concat(g[d])}else{c=[];for(d in v)c.push(v[d]);for(d in y)c.push(y[d]);for(d in w)c.push(w[d]);c=c.concat(z)}for(g=[],e=0,f=c.length;f>e;e++)(i?c[e].id===h:c[e].id.match(h))&&g.push(c[e])}return q(g)}function p(){var a,b,c={},d=arguments.length;for(a=d-1;a>=0;a--)for(b in arguments[a])c[b]=arguments[a][b];return c}function q(a){var b,c,d;if(!a)return a;if(Array.isArray(a))for(b=[],c=0,d=a.length;d>c;c++)b.push(q(a[c]));else if("object"==typeof a){b={};for(c in a)b[c]=q(a[c])}else b=a;return b}function r(a){var b,c=[];for(b in a)c.push(a[b]);return c}function s(){return Date.now?Date.now():(new Date).getTime()}if(a.conrad)throw new Error("conrad already exists");var t,u=!1,v={},w={},x=[],y={},z=[],A=!1,B={frameDuration:20,history:!0},C=Object.create(null);Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});var D={hasJob:k,addJob:h,killJob:i,killAll:j,settings:l,getStats:o,isRunning:m,clearHistory:n,bind:b,unbind:c,version:"0.1.0"};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=D),exports.conrad=D):a.conrad=D}(this),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";var b=this;sigma.utils=sigma.utils||{},sigma.utils.extend=function(){var a,b,c={},d=arguments.length;for(a=d-1;a>=0;a--)for(b in arguments[a])c[b]=arguments[a][b];return c},sigma.utils.dateNow=function(){return Date.now?Date.now():(new Date).getTime()},sigma.utils.pkg=function(a){return(a||"").split(".").reduce(function(a,b){return b in a?a[b]:a[b]={}},b)},sigma.utils.id=function(){var a=0;return function(){return++a}}(),sigma.utils.floatColor=function(a){var b=[0,0,0];return a.match(/^#/)?(a=(a||"").replace(/^#/,""),b=3===a.length?[parseInt(a.charAt(0)+a.charAt(0),16),parseInt(a.charAt(1)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(2),16)]:[parseInt(a.charAt(0)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(3),16),parseInt(a.charAt(4)+a.charAt(5),16)]):a.match(/^ *rgba? *\(/)&&(a=a.match(/^ *rgba? *\( *([0-9]*) *, *([0-9]*) *, *([0-9]*) *(,.*)?\) *$/),b=[+a[1],+a[2],+a[3]]),256*b[0]*256+256*b[1]+b[2]},sigma.utils.getX=function(b){return b.offsetX!==a&&b.offsetX||b.layerX!==a&&b.layerX||b.clientX!==a&&b.clientX},sigma.utils.getY=function(b){return b.offsetY!==a&&b.offsetY||b.layerY!==a&&b.layerY||b.clientY!==a&&b.clientY},sigma.utils.getDelta=function(b){return b.wheelDelta!==a&&b.wheelDelta||b.detail!==a&&-b.detail},sigma.utils.getOffset=function(a){for(var b=0,c=0;a;)c+=parseInt(a.offsetTop),b+=parseInt(a.offsetLeft),a=a.offsetParent;return{top:c,left:b}},sigma.utils.doubleClick=function(a,b,c){var d=0;a.addEventListener(b,function(a){return d++,2===d?(d=0,c(a)):void(1===d&&setTimeout(function(){d=0},sigma.settings.doubleClickTimeout))},!1)},sigma.utils.easings=sigma.utils.easings||{},sigma.utils.easings.linearNone=function(a){return a},sigma.utils.easings.quadraticIn=function(a){return a*a},sigma.utils.easings.quadraticOut=function(a){return a*(2-a)},sigma.utils.easings.quadraticInOut=function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)},sigma.utils.easings.cubicIn=function(a){return a*a*a},sigma.utils.easings.cubicOut=function(a){return--a*a*a+1},sigma.utils.easings.cubicInOut=function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)},sigma.utils.loadShader=function(a,b,c,d){var e,f=a.createShader(c);return a.shaderSource(f,b),a.compileShader(f),e=a.getShaderParameter(f,a.COMPILE_STATUS),e?f:(d&&d('Error compiling shader "'+f+'":'+a.getShaderInfoLog(f)),a.deleteShader(f),null)},sigma.utils.loadProgram=function(a,b,c,d,e){var f,g,h=a.createProgram();for(f=0;fb;b++)if(a in e[b]&&void 0!==e[b][a])return e[b][a];return void 0}if("object"==typeof a&&"string"==typeof g)return g in(a||{})?a[g]:f(g);h="object"==typeof a&&void 0===g?a:{},"string"==typeof a&&(h[a]=g);for(i in h)d[i]=h[i];return this};for(f.embedObjects=function(){var b=e.concat(d).concat(Array.prototype.splice.call(arguments,0));return a.apply({},b)},b=0,c=arguments.length;c>b;b++)f(arguments[b]);return f};"undefined"!=typeof this.sigma?(this.sigma.classes=this.sigma.classes||{},this.sigma.classes.configurable=a):"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=a),exports.configurable=a):this.configurable=a}.call(this),function(){"use strict";function a(a,b,c){var d=function(){var d,e;e=c.apply(b,arguments);for(d in f[a])f[a][d].apply(b,arguments);return e};return d}function b(a){var b;for(b in a)"hasOwnProperty"in a&&!a.hasOwnProperty(b)||delete a[b];return a}var c=Object.create(null),d=Object.create(null),e=Object.create(null),f=Object.create(null),g={immutable:!0,clone:!0},h=function(a){return g[a]},i=function(b){var d,f,g;g={settings:b||h,nodesArray:[],edgesArray:[],nodesIndex:Object.create(null),edgesIndex:Object.create(null),inNeighborsIndex:Object.create(null),outNeighborsIndex:Object.create(null),allNeighborsIndex:Object.create(null),inNeighborsCount:Object.create(null),outNeighborsCount:Object.create(null),allNeighborsCount:Object.create(null)};for(d in e)e[d].call(g);for(d in c)f=a(d,g,c[d]),this[d]=f,g[d]=f};i.addMethod=function(a,b){if("string"!=typeof a||"function"!=typeof b||2!==arguments.length)throw"addMethod: Wrong arguments.";if(c[a])throw'The method "'+a+'" already exists.';return c[a]=b,f[a]=Object.create(null),this},i.attach=function(a,b,c){if("string"!=typeof a||"string"!=typeof b||"function"!=typeof c||3!==arguments.length)throw"attach: Wrong arguments.";var d;if("constructor"===a)d=e;else{if(!f[a])throw'The method "'+a+'" does not exist.';d=f[a]}if(d[b])throw'A function "'+b+'" is already attached to the method "'+a+'".';return d[b]=c,this},i.addIndex=function(a,b){if("string"!=typeof a||Object(b)!==b||2!==arguments.length)throw"addIndex: Wrong arguments.";if(d[a])throw'The index "'+a+'" already exists.';var c;d[a]=b;for(c in b){if("function"!=typeof b[c])throw"The bindings must be functions.";i.attach(c,a,b[c])}return this},i.addMethod("addNode",function(a){if(Object(a)!==a||1!==arguments.length)throw"addNode: Wrong arguments.";if("string"!=typeof a.id)throw"The node must have a string id.";if(this.nodesIndex[a.id])throw'The node "'+a.id+'" already exists.';var b,c=a.id,d=Object.create(null);if(this.settings("clone"))for(b in a)"id"!==b&&(d[b]=a[b]);else d=a;return this.settings("immutable")?Object.defineProperty(d,"id",{value:c,enumerable:!0}):d.id=c,this.inNeighborsIndex[c]=Object.create(null),this.outNeighborsIndex[c]=Object.create(null),this.allNeighborsIndex[c]=Object.create(null),this.inNeighborsCount[c]=0,this.outNeighborsCount[c]=0,this.allNeighborsCount[c]=0,this.nodesArray.push(d),this.nodesIndex[d.id]=d,this}),i.addMethod("addEdge",function(a){if(Object(a)!==a||1!==arguments.length)throw"addEdge: Wrong arguments.";if("string"!=typeof a.id)throw"The edge must have a string id.";if("string"!=typeof a.source||!this.nodesIndex[a.source])throw"The edge source must have an existing node id.";if("string"!=typeof a.target||!this.nodesIndex[a.target])throw"The edge target must have an existing node id.";if(this.edgesIndex[a.id])throw'The edge "'+a.id+'" already exists.';var b,c=Object.create(null);if(this.settings("clone"))for(b in a)"id"!==b&&"source"!==b&&"target"!==b&&(c[b]=a[b]);else c=a;return this.settings("immutable")?(Object.defineProperty(c,"id",{value:a.id,enumerable:!0}),Object.defineProperty(c,"source",{value:a.source,enumerable:!0}),Object.defineProperty(c,"target",{value:a.target,enumerable:!0})):(c.id=a.id,c.source=a.source,c.target=a.target),this.edgesArray.push(c),this.edgesIndex[c.id]=c,this.inNeighborsIndex[a.target][a.source]||(this.inNeighborsIndex[a.target][a.source]=Object.create(null)),this.inNeighborsIndex[a.target][a.source][a.id]=a,this.outNeighborsIndex[a.source][a.target]||(this.outNeighborsIndex[a.source][a.target]=Object.create(null)),this.outNeighborsIndex[a.source][a.target][a.id]=a,this.allNeighborsIndex[a.source][a.target]||(this.allNeighborsIndex[a.source][a.target]=Object.create(null)),this.allNeighborsIndex[a.source][a.target][a.id]=a,this.allNeighborsIndex[a.target][a.source]||(this.allNeighborsIndex[a.target][a.source]=Object.create(null)),this.allNeighborsIndex[a.target][a.source][a.id]=a,this.inNeighborsCount[a.target]++,this.outNeighborsCount[a.source]++,this.allNeighborsCount[a.target]++,this.allNeighborsCount[a.source]++,this}),i.addMethod("dropNode",function(a){if("string"!=typeof a||1!==arguments.length)throw"dropNode: Wrong arguments.";if(!this.nodesIndex[a])throw'The node "'+a+'" does not exist.';var b,c,d;for(delete this.nodesIndex[a],b=0,d=this.nodesArray.length;d>b;b++)if(this.nodesArray[b].id===a){this.nodesArray.splice(b,1);break}for(b=this.edgesArray.length-1;b>=0;b--)(this.edgesArray[b].source===a||this.edgesArray[b].target===a)&&this.dropEdge(this.edgesArray[b].id);delete this.inNeighborsIndex[a],delete this.outNeighborsIndex[a],delete this.allNeighborsIndex[a],delete this.inNeighborsCount[a],delete this.outNeighborsCount[a],delete this.allNeighborsCount[a];for(c in this.nodesIndex)delete this.inNeighborsIndex[c][a],delete this.outNeighborsIndex[c][a],delete this.allNeighborsIndex[c][a];return this}),i.addMethod("dropEdge",function(a){if("string"!=typeof a||1!==arguments.length)throw"dropEdge: Wrong arguments.";if(!this.edgesIndex[a])throw'The edge "'+a+'" does not exist.';var b,c,d;for(d=this.edgesIndex[a],delete this.edgesIndex[a],b=0,c=this.edgesArray.length;c>b;b++)if(this.edgesArray[b].id===a){this.edgesArray.splice(b,1);break}return delete this.inNeighborsIndex[d.target][d.source][d.id],Object.keys(this.inNeighborsIndex[d.target][d.source]).length||delete this.inNeighborsIndex[d.target][d.source],delete this.outNeighborsIndex[d.source][d.target][d.id],Object.keys(this.outNeighborsIndex[d.source][d.target]).length||delete this.outNeighborsIndex[d.source][d.target],delete this.allNeighborsIndex[d.source][d.target][d.id],Object.keys(this.allNeighborsIndex[d.source][d.target]).length||delete this.allNeighborsIndex[d.source][d.target],delete this.allNeighborsIndex[d.target][d.source][d.id],Object.keys(this.allNeighborsIndex[d.target][d.source]).length||delete this.allNeighborsIndex[d.target][d.source],this.inNeighborsCount[d.target]--,this.outNeighborsCount[d.source]--,this.allNeighborsCount[d.source]--,this.allNeighborsCount[d.target]--,this}),i.addMethod("kill",function(){this.nodesArray.length=0,this.edgesArray.length=0,delete this.nodesArray,delete this.edgesArray,delete this.nodesIndex,delete this.edgesIndex,delete this.inNeighborsIndex,delete this.outNeighborsIndex,delete this.allNeighborsIndex,delete this.inNeighborsCount,delete this.outNeighborsCount,delete this.allNeighborsCount}),i.addMethod("clear",function(){return this.nodesArray.length=0,this.edgesArray.length=0,b(this.nodesIndex),b(this.edgesIndex),b(this.nodesIndex),b(this.inNeighborsIndex),b(this.outNeighborsIndex),b(this.allNeighborsIndex),b(this.inNeighborsCount),b(this.outNeighborsCount),b(this.allNeighborsCount),this}),i.addMethod("read",function(a){var b,c,d;for(c=a.nodes||[],b=0,d=c.length;d>b;b++)this.addNode(c[b]);for(c=a.edges||[],b=0,d=c.length;d>b;b++)this.addEdge(c[b]);return this}),i.addMethod("nodes",function(a){if(!arguments.length)return this.nodesArray.slice(0);if(1===arguments.length&&"string"==typeof a)return this.nodesIndex[a];if(1===arguments.length&&"[object Array]"===Object.prototype.toString.call(a)){var b,c,d=[];for(b=0,c=a.length;c>b;b++){if("string"!=typeof a[b])throw"nodes: Wrong arguments.";d.push(this.nodesIndex[a[b]])}return d}throw"nodes: Wrong arguments."}),i.addMethod("degree",function(a,b){if(b={"in":this.inNeighborsCount,out:this.outNeighborsCount}[b||""]||this.allNeighborsCount,"string"==typeof a)return b[a];if("[object Array]"===Object.prototype.toString.call(a)){var c,d,e=[];for(c=0,d=a.length;d>c;c++){if("string"!=typeof a[c])throw"degree: Wrong arguments.";e.push(b[a[c]])}return e}throw"degree: Wrong arguments."}),i.addMethod("edges",function(a){if(!arguments.length)return this.edgesArray.slice(0);if(1===arguments.length&&"string"==typeof a)return this.edgesIndex[a];if(1===arguments.length&&"[object Array]"===Object.prototype.toString.call(a)){var b,c,d=[];for(b=0,c=a.length;c>b;b++){if("string"!=typeof a[b])throw"edges: Wrong arguments.";d.push(this.edgesIndex[a[b]])}return d}throw"edges: Wrong arguments."}),"undefined"!=typeof sigma?(sigma.classes=sigma.classes||Object.create(null),sigma.classes.graph=i):"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=i),exports.graph=i):this.graph=i}.call(this),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.classes"),sigma.classes.camera=function(a,b,c,d){sigma.classes.dispatcher.extend(this),Object.defineProperty(this,"graph",{value:b}),Object.defineProperty(this,"id",{value:a}),Object.defineProperty(this,"readPrefix",{value:"read_cam"+a+":"}),Object.defineProperty(this,"prefix",{value:"cam"+a+":"}),this.x=0,this.y=0,this.ratio=1,this.angle=0,this.isAnimated=!1,this.settings="object"==typeof d&&d?c.embedObject(d):c},sigma.classes.camera.prototype.goTo=function(b){if(!this.settings("enableCamera"))return this;var c,d,e=b||{},f=["x","y","ratio","angle"];for(c=0,d=f.length;d>c;c++)if(e[f[c]]!==a){if("number"!=typeof e[f[c]]||isNaN(e[f[c]]))throw'Value for "'+f[c]+'" is not a number.';this[f[c]]=e[f[c]]}return this.dispatchEvent("coordinatesUpdated"),this},sigma.classes.camera.prototype.applyView=function(b,c,d){d=d||{},c=c!==a?c:this.prefix,b=b!==a?b:this.readPrefix;var e,f,g,h=d.nodes||this.graph.nodes(),i=d.edges||this.graph.edges(),j=Math.cos(this.angle),k=Math.sin(this.angle);for(e=0,f=h.length;f>e;e++)g=h[e],g[c+"x"]=(((g[b+"x"]||0)-this.x)*j+((g[b+"y"]||0)-this.y)*k)/this.ratio+(d.width||0)/2,g[c+"y"]=(((g[b+"y"]||0)-this.y)*j-((g[b+"x"]||0)-this.x)*k)/this.ratio+(d.height||0)/2,g[c+"size"]=(g[b+"size"]||0)/Math.pow(this.ratio,this.settings("nodesPowRatio"));for(e=0,f=i.length;f>e;e++)i[e][c+"size"]=(i[e][b+"size"]||0)/Math.pow(this.ratio,this.settings("edgesPowRatio"));return this},sigma.classes.camera.prototype.graphPosition=function(a,b,c){var d=0,e=0,f=Math.cos(this.angle),g=Math.sin(this.angle);return c||(d=-(this.x*f+this.y*g)/this.ratio,e=-(this.y*f-this.x*g)/this.ratio),{x:(a*f+b*g)/this.ratio+d,y:(b*f-a*g)/this.ratio+e}},sigma.classes.camera.prototype.cameraPosition=function(a,b,c){var d=0,e=0,f=Math.cos(this.angle),g=Math.sin(this.angle);return c||(d=-(this.x*f+this.y*g)/this.ratio,e=-(this.y*f-this.x*g)/this.ratio),{x:((a-d)*f-(b-e)*g)*this.ratio,y:((b-e)*f+(a-d)*g)*this.ratio}},sigma.classes.camera.prototype.getMatrix=function(){var a=sigma.utils.matrices.scale(1/this.ratio),b=sigma.utils.matrices.rotation(this.angle),c=sigma.utils.matrices.translation(-this.x,-this.y),d=sigma.utils.matrices.multiply(c,sigma.utils.matrices.multiply(b,a));return d},sigma.classes.camera.prototype.getRectangle=function(a,b){var c=this.cameraPosition(a,0,!0),d=this.cameraPosition(0,b,!0),e=this.cameraPosition(a/2,b/2,!0),f=this.cameraPosition(a/4,0,!0).x,g=this.cameraPosition(0,b/4,!0).y;return{x1:this.x-e.x-f,y1:this.y-e.y-g,x2:this.x-e.x+f+c.x,y2:this.y-e.y-g+c.y,height:Math.sqrt(Math.pow(d.x,2)+Math.pow(d.y+2*g,2))}}}.call(this),function(a){"use strict";function b(a,b){var c=b.x+b.width/2,d=b.y+b.height/2,e=a.yd;d++)a.x2>=b[d][0].x&&a.x1<=b[d][1].x&&a.y1+a.height>=b[d][0].y&&a.y1<=b[d][2].y&&c.push(d);return c}function d(a,b){for(var c=[],d=0;4>d;d++)j.collision(a,b[d])&&c.push(d);return c}function e(a,b){var c,d,e=b.level+1,f=Math.round(b.bounds.width/2),g=Math.round(b.bounds.height/2),h=Math.round(b.bounds.x),j=Math.round(b.bounds.y);switch(a){case 0:c=h,d=j;break;case 1:c=h+f,d=j;break;case 2:c=h,d=j+g;break;case 3:c=h+f,d=j+g}return i({x:c,y:d,width:f,height:g},e,b.maxElements,b.maxLevel)}function f(b,d,g){if(g.leveli;i++)g.nodes[h[i]]===a&&(g.nodes[h[i]]=e(h[i],g)),f(b,d,g.nodes[h[i]]);else g.elements.push(b)}function g(c,d){if(d.levelg;g++)c.nodes[f[g]]!==a&&h(b,c.nodes[f[g]],d,e);else for(var j=0,k=c.elements.length;k>j;j++)e[c.elements[j].id]===a&&(e[c.elements[j].id]=c.elements[j]);return e}function i(a,b,c,d){return{level:b||0,bounds:a,corners:j.splitSquare(a),maxElements:c||20,maxLevel:d||4,elements:[],nodes:[]}}var j={pointToSquare:function(a){return{x1:a.x-a.size,y1:a.y-a.size,x2:a.x+a.size,y2:a.y-a.size,height:2*a.size}},isAxisAligned:function(a){return a.x1===a.x2||a.y1===a.y2},axisAlignedTopPoints:function(a){return a.y1===a.y2&&a.x1a.y1?{x1:a.x1-a.height,y1:a.y1,x2:a.x1,y2:a.y1,height:a.height}:a.x1===a.x2&&a.y2f;f++){var g=this.projection(b[f],a),h=this.projection(c[f],a);d.push(g.x*a.x+g.y*a.y),e.push(h.x*a.x+h.y*a.y)}var i=Math.max.apply(Math,d),j=Math.max.apply(Math,e),k=Math.min.apply(Math,d),l=Math.min.apply(Math,e);return i>=l&&j>=k},collision:function(a,b){for(var c=this.axis(a,b),d=!0,e=0;4>e;e++)d*=this.axisCollision(c[e],a,b);return!!d}},k=function(){this._geom=j,this._tree=null,this._cache={query:!1,result:!1}};k.prototype.index=function(a,b){if(!b.bounds)throw"sigma.classes.quad.index: bounds information not given.";var c=b.prefix||"";this._tree=i(b.bounds,0,b.maxElements,b.maxLevel);for(var d=0,e=a.length;e>d;d++)f(a[d],j.pointToSquare({x:a[d][c+"x"],y:a[d][c+"y"],size:a[d][c+"size"]}),this._tree);return this._cache={query:!1,result:!1},this._tree},k.prototype.point=function(a,b){return this._tree?g({x:a,y:b},this._tree)||[]:[]},k.prototype.area=function(a){var b,e,f=JSON.stringify(a);if(this._cache.query===f)return this._cache.result;j.isAxisAligned(a)?(b=c,e=j.axisAlignedTopPoints(a)):(b=d,e=j.rectangleCorners(a));var g=this._tree?h(e,this._tree,b):[],i=[];for(var k in g)i.push(g[k]);return this._cache.query=f,this._cache.result=i,i},"undefined"!=typeof this.sigma?(this.sigma.classes=this.sigma.classes||{},this.sigma.classes.quad=k):"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=k),exports.quad=k):this.quad=k}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.captors"),sigma.captors.mouse=function(a,b,c){function d(a){var b,c,d;return w("mouseEnabled")&&t.dispatchEvent("mousemove",{x:sigma.utils.getX(a)-a.target.width/2,y:sigma.utils.getY(a)-a.target.height/2}),w("mouseEnabled")&&q?(r=!0,s&&clearTimeout(s),s=setTimeout(function(){r=!1},w("dragTimeout")),sigma.misc.animation.killAll(v),v.isMoving=!0,d=v.cameraPosition(sigma.utils.getX(a)-o,sigma.utils.getY(a)-p,!0),b=k-d.x,c=l-d.y,(b!==v.x||c!==v.y)&&(m=v.x,n=v.y,v.goTo({x:b,y:c})),a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation(),!1):void 0}function e(a){if(w("mouseEnabled")&&q){q=!1,s&&clearTimeout(s),v.isMoving=!1;var b=sigma.utils.getX(a),c=sigma.utils.getY(a);r?(sigma.misc.animation.killAll(v),sigma.misc.animation.camera(v,{x:v.x+w("mouseInertiaRatio")*(v.x-m),y:v.y+w("mouseInertiaRatio")*(v.y-n)},{easing:"quadraticOut",duration:w("mouseInertiaDuration")})):(o!==b||p!==c)&&v.goTo({x:v.x,y:v.y}),t.dispatchEvent("mouseup",{x:b-a.target.width/2,y:c-a.target.height/2}),r=!1}}function f(a){w("mouseEnabled")&&(q=!0,k=v.x,l=v.y,m=v.x,n=v.y,o=sigma.utils.getX(a),p=sigma.utils.getY(a),t.dispatchEvent("mouseup",{x:o-a.target.width/2,y:p-a.target.height/2}))}function g(){w("mouseEnabled")&&t.dispatchEvent("mouseout")}function h(a){return w("mouseEnabled")&&t.dispatchEvent("click",{x:sigma.utils.getX(a)-a.target.width/2,y:sigma.utils.getY(a)-a.target.height/2}),a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation(),!1}function i(a){var b,c,d,e;return w("mouseEnabled")?(d=1/w("doubleClickZoomingRatio"),e=Math.max(w("zoomMin"),Math.min(w("zoomMax"),v.ratio*d)),d=e/v.ratio,e!==v.ratio&&(c=sigma.misc.animation.killAll(v),b=v.cameraPosition(sigma.utils.getX(a)-a.target.width/2,sigma.utils.getY(a)-a.target.height/2,!0),sigma.misc.animation.camera(v,{x:b.x*(1-d)+v.x,y:b.y*(1-d)+v.y,ratio:e},{easing:c?"quadraticOut":"quadraticInOut",duration:w("doubleClickZoomDuration")})),a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation(),!1):void 0}function j(a){var b,c,d,e;return w("mouseEnabled")?(d=sigma.utils.getDelta(a)>0?1/w("zoomingRatio"):w("zoomingRatio"),e=Math.max(w("zoomMin"),Math.min(w("zoomMax"),v.ratio*d)),d=e/v.ratio,e!==v.ratio&&(c=sigma.misc.animation.killAll(v),b=v.cameraPosition(sigma.utils.getX(a)-a.target.width/2,sigma.utils.getY(a)-a.target.height/2,!0),sigma.misc.animation.camera(v,{x:b.x*(1-d)+v.x,y:b.y*(1-d)+v.y,ratio:e},{easing:c?"quadraticOut":"quadraticInOut",duration:w("mouseZoomDuration")})),a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation(),!1):void 0}var k,l,m,n,o,p,q,r,s,t=this,u=a,v=b,w=c;sigma.classes.dispatcher.extend(this),sigma.utils.doubleClick(u,"click",i),u.addEventListener("DOMMouseScroll",j,!1),u.addEventListener("mousewheel",j,!1),u.addEventListener("mousemove",d,!1),u.addEventListener("mousedown",f,!1),u.addEventListener("click",h,!1),u.addEventListener("mouseout",g,!1),document.addEventListener("mouseup",e,!1)}}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.captors"),sigma.captors.touch=function(a,b,c){function d(a){var b=sigma.utils.getOffset(B);return{x:a.pageX-b.left,y:a.pageY-b.top}}function e(a){if(D("touchEnabled")){var b,c,e,f,g,h;switch(E=a.touches,E.length){case 1:C.isMoving=!0,w=1,i=C.x,j=C.y,m=C.x,n=C.y,g=d(E[0]),q=g.x,r=g.y;break;case 2:return C.isMoving=!0,w=2,g=d(E[0]),h=d(E[1]),b=g.x,e=g.y,c=h.x,f=h.y,m=C.x,n=C.y,k=C.angle,l=C.ratio,i=C.x,j=C.y,q=b,r=e,s=c,t=f,u=Math.atan2(t-r,s-q),v=Math.sqrt(Math.pow(t-r,2)+Math.pow(s-q,2)),a.preventDefault(),!1}}}function f(a){if(D("touchEnabled")){E=a.touches;var b=D("touchInertiaRatio");switch(z&&(x=!1,clearTimeout(z)),w){case 2:if(1===a.touches.length){e(a),a.preventDefault();break}case 1:C.isMoving=!1,A.dispatchEvent("stopDrag"),x&&(y=!1,sigma.misc.animation.camera(C,{x:C.x+b*(C.x-m),y:C.y+b*(C.y-n)},{easing:"quadraticOut",duration:D("touchInertiaDuration")})),x=!1,w=0}}}function g(a){if(!y&&D("touchEnabled")){var b,c,e,f,g,h,B,F,G,H,I,J,K,L,M,N,O;switch(E=a.touches,x=!0,z&&clearTimeout(z),z=setTimeout(function(){x=!1},D("dragTimeout")),w){case 1:F=d(E[0]),b=F.x,e=F.y,H=C.cameraPosition(b-q,e-r,!0),L=i-H.x,M=j-H.y,(L!==C.x||M!==C.y)&&(m=C.x,n=C.y,C.goTo({x:L,y:M}),A.dispatchEvent("drag"));break;case 2:F=d(E[0]),G=d(E[1]),b=F.x,e=F.y,c=G.x,f=G.y,I=C.cameraPosition((q+s)/2-a.target.width/2,(r+t)/2-a.target.height/2,!0),B=C.cameraPosition((b+c)/2-a.target.width/2,(e+f)/2-a.target.height/2,!0),J=Math.atan2(f-e,c-b)-u,K=Math.sqrt(Math.pow(f-e,2)+Math.pow(c-b,2))/v,b=I.x,e=I.y,N=l/K,b*=K,e*=K,O=k-J,g=Math.cos(-J),h=Math.sin(-J),c=b*g+e*h,f=e*g-b*h,b=c,e=f,L=b-B.x+i,M=e-B.y+j,(N!==C.ratio||O!==C.angle||L!==C.x||M!==C.y)&&(m=C.x,n=C.y,o=C.angle,p=C.ratio,C.goTo({x:L,y:M,angle:O,ratio:N}),A.dispatchEvent("drag"))}return a.preventDefault(),!1}}function h(a){var b,c,e,f;return a.touches&&1===a.touches.length&&D("touchEnabled")?(y=!0,e=1/D("doubleClickZoomingRatio"),f=Math.max(D("zoomMin"),Math.min(D("zoomMax"),C.ratio*e)),e=f/C.ratio,f!==C.ratio&&(c=sigma.misc.animation.killAll(C),b=d(a.touches[0]),b=C.cameraPosition(b.x-a.target.width/2,b.y-a.target.height/2,!0),sigma.misc.animation.camera(C,{x:b.x*(1-e)+C.x,y:b.y*(1-e)+C.y,ratio:f},{easing:c?"quadraticOut":"quadraticInOut",duration:D("doubleClickZoomDuration"),onComplete:function(){y=!1}})),a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation(),!1):void 0}var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A=this,B=a,C=b,D=c,E=[];sigma.classes.dispatcher.extend(this),sigma.utils.doubleClick(B,"touchstart",h),B.addEventListener("touchstart",e),B.addEventListener("touchend",f),B.addEventListener("touchcancel",f),B.addEventListener("touchleave",f),B.addEventListener("touchmove",g)}}.call(this),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";if("undefined"==typeof conrad)throw"conrad is not declared";sigma.utils.pkg("sigma.renderers"),sigma.renderers.canvas=function(a,b,c,d){if("object"!=typeof d)throw"sigma.renderers.canvas: Wrong arguments.";if(!(d.container instanceof HTMLElement))throw"Container not found.";var e,f,g,h,i=this;for(sigma.classes.dispatcher.extend(this),Object.defineProperty(this,"conradId",{value:sigma.utils.id()}),this.graph=a,this.camera=b,this.contexts={},this.domElements={},this.options=d,this.container=this.options.container,this.settings="object"==typeof d.settings&&d.settings?c.embedObjects(d.settings):c,this.nodesOnScreen=[],this.edgesOnScreen=[],this.jobs={},this.options.prefix="renderer"+this.conradId+":",this.settings("batchEdgesDrawing")?(this.initDOM("canvas","edges"),this.initDOM("canvas","scene"),this.contexts.nodes=this.contexts.scene,this.contexts.labels=this.contexts.scene):(this.initDOM("canvas","scene"),this.contexts.edges=this.contexts.scene,this.contexts.nodes=this.contexts.scene,this.contexts.labels=this.contexts.scene),this.initDOM("canvas","mouse"),this.contexts.hover=this.contexts.mouse,this.captors=[],g=this.options.captors||[sigma.captors.mouse,sigma.captors.touch],e=0,f=g.length;f>e;e++)h="function"==typeof g[e]?g[e]:sigma.captors[g[e]],this.captors.push(new h(this.domElements.mouse,this.camera,this.settings));window.addEventListener("resize",function(){i.resize()}),sigma.misc.bindEvents.call(this,this.options.prefix),sigma.misc.drawHovers.call(this,this.options.prefix),this.resize(!1)},sigma.renderers.canvas.prototype.render=function(b){b=b||{};var c,d,e,f,g,h,i,j,k,l,m,n,o={},p=this.graph,q=(this.options.prefix||"",this.settings(b,"drawEdges")),r=this.settings(b,"drawNodes"),s=this.settings(b,"drawLabels"),t=this.settings.embedObjects(b,{prefix:this.options.prefix});this.settings(b,"hideEdgesOnMove")&&(this.camera.isAnimated||this.camera.isMoving)&&(q=!1),this.camera.applyView(a,this.options.prefix,{width:this.width,height:this.height}),this.clear();for(e in this.jobs)conrad.hasJob(e)&&conrad.killJob(e);for(this.edgesOnScreen=[],this.nodesOnScreen=this.camera.quadtree.area(this.camera.getRectangle(this.width,this.height)),c=this.nodesOnScreen,d=0,f=c.length;f>d;d++)o[c[d].id]=c[d];if(q){for(c=p.edges(),d=0,f=c.length;f>d;d++)g=c[d],(o[g.source]||o[g.target])&&this.edgesOnScreen.push(g);if(this.settings(b,"batchEdgesDrawing"))h="edges_"+this.conradId,n=t("canvasEdgesBatchSize"),l=this.edgesOnScreen,f=l.length,k=0,i=Math.min(l.length,k+n),j=function(){for(m=sigma.canvas.edges,d=k;i>d;d++)g=l[d],(m[g.type]||m.def)(g,p.nodes(g.source),p.nodes(g.target),this.contexts.edges,t);return i===l.length?(delete this.jobs[h],!1):(k=i+1,i=Math.min(l.length,k+n),!0)},this.jobs[h]=j,conrad.addJob(h,j.bind(this));else for(m=sigma.canvas.edges,c=this.edgesOnScreen,d=0,f=c.length;f>d;d++)g=c[d],(m[g.type]||m.def)(g,p.nodes(g.source),p.nodes(g.target),this.contexts.edges,t)}if(r)for(m=sigma.canvas.nodes,c=this.nodesOnScreen,d=0,f=c.length;f>d;d++)(m[c[d].type]||m.def)(c[d],this.contexts.nodes,t);if(s)for(m=sigma.canvas.labels,c=this.nodesOnScreen,d=0,f=c.length;f>d;d++)(m[c[d].type]||m.def)(c[d],this.contexts.labels,t);return this.dispatchEvent("render"),this},sigma.renderers.canvas.prototype.initDOM=function(a,b){var c=document.createElement(a);c.style.position="absolute",c.setAttribute("class","sigma-"+b),this.domElements[b]=c,this.container.appendChild(c),"canvas"===a.toLowerCase()&&(this.contexts[b]=c.getContext("2d"))},sigma.renderers.canvas.prototype.resize=function(b,c){var d,e=this.width,f=this.height,g=1;if(b!==a&&c!==a?(this.width=b,this.height=c):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,b=this.width,c=this.height),e!==this.width||f!==this.height)for(d in this.domElements)this.domElements[d].style.width=b+"px",this.domElements[d].style.height=c+"px","canvas"===this.domElements[d].tagName.toLowerCase()&&(this.domElements[d].setAttribute("width",b*g+"px"),this.domElements[d].setAttribute("height",c*g+"px"),1!==g&&this.contexts[d].scale(g,g));return this},sigma.renderers.canvas.prototype.clear=function(){var a;for(a in this.domElements)"CANVAS"===this.domElements[a].tagName&&(this.domElements[a].width=this.domElements[a].width);return this},sigma.utils.pkg("sigma.canvas.nodes"),sigma.utils.pkg("sigma.canvas.edges"),sigma.utils.pkg("sigma.canvas.labels")}.call(this),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.renderers"),sigma.renderers.webgl=function(a,b,c,d){if("object"!=typeof d)throw"sigma.renderers.webgl: Wrong arguments.";if(!(d.container instanceof HTMLElement))throw"Container not found.";var e,f,g,h,i=this;for(sigma.classes.dispatcher.extend(this),this.jobs={},Object.defineProperty(this,"conradId",{value:sigma.utils.id()}),this.graph=a,this.camera=b,this.contexts={},this.domElements={},this.options=d,this.container=this.options.container,this.settings="object"==typeof d.settings&&d.settings?c.embedObjects(d.settings):c,this.options.prefix=this.camera.readPrefix,Object.defineProperty(this,"nodePrograms",{value:{}}),Object.defineProperty(this,"edgePrograms",{value:{}}),Object.defineProperty(this,"nodeFloatArrays",{value:{}}),Object.defineProperty(this,"edgeFloatArrays",{value:{}}),this.initDOM("canvas","scene",!0),this.initDOM("canvas","labels"),this.initDOM("canvas","mouse"),this.contexts.hover=this.contexts.mouse,this.contexts.nodes=this.contexts.scene,this.contexts.edges=this.contexts.scene,this.captors=[],g=this.options.captors||[sigma.captors.mouse,sigma.captors.touch],e=0,f=g.length;f>e;e++)h="function"==typeof g[e]?g[e]:sigma.captors[g[e]],this.captors.push(new h(this.domElements.mouse,this.camera,this.settings));window.addEventListener("resize",function(){i.resize()}),sigma.misc.bindEvents.call(this,this.camera.prefix),sigma.misc.drawHovers.call(this,this.camera.prefix),this.resize()},sigma.renderers.webgl.prototype.process=function(){var a,b,c,d,e,f=this.graph,g=sigma.utils.extend(g,this.options);for(d in this.nodeFloatArrays)delete this.nodeFloatArrays[d];for(d in this.edgeFloatArrays)delete this.edgeFloatArrays[d];for(a=f.edges(),b=0,c=a.length;c>b;b++)d=a[b].type&&sigma.webgl.edges[a[b].type]?a[b].type:"def",this.edgeFloatArrays[d]||(this.edgeFloatArrays[d]={edges:[]}),this.edgeFloatArrays[d].edges.push(a[b]);for(a=f.nodes(),b=0,c=a.length;c>b;b++)d=a[b].type&&sigma.webgl.nodes[a[b].type]?d:"def",this.nodeFloatArrays[d]||(this.nodeFloatArrays[d]={nodes:[]}),this.nodeFloatArrays[d].nodes.push(a[b]);for(d in this.edgeFloatArrays)for(e=sigma.webgl.edges[d],a=this.edgeFloatArrays[d].edges,b=0,c=a.length;c>b;b++)this.edgeFloatArrays[d].array||(this.edgeFloatArrays[d].array=new Float32Array(a.length*e.POINTS*e.ATTRIBUTES)),e.addEdge(a[b],f.nodes(a[b].source),f.nodes(a[b].target),this.edgeFloatArrays[d].array,b*e.POINTS*e.ATTRIBUTES,g.prefix,this.settings);for(d in this.nodeFloatArrays)for(e=sigma.webgl.nodes[d],a=this.nodeFloatArrays[d].nodes,b=0,c=a.length;c>b;b++)this.nodeFloatArrays[d].array||(this.nodeFloatArrays[d].array=new Float32Array(a.length*e.POINTS*e.ATTRIBUTES)),e.addNode(a[b],this.nodeFloatArrays[d].array,b*e.POINTS*e.ATTRIBUTES,g.prefix,this.settings);return this},sigma.renderers.webgl.prototype.render=function(b){var c,d,e,f,g,h,i=this,j=(this.graph,this.contexts.nodes),k=this.contexts.edges,l=this.camera.getMatrix(),m=sigma.utils.extend(b,this.options),n=this.settings(m,"drawLabels"),o=this.settings(m,"drawEdges"),p=this.settings(m,"drawNodes");this.settings(m,"hideEdgesOnMove")&&(this.camera.isAnimated||this.camera.isMoving)&&(o=!1),this.clear(),l=sigma.utils.matrices.multiply(l,sigma.utils.matrices.translation(this.width/2,this.height/2));for(f in this.jobs)conrad.hasJob(f)&&conrad.killJob(f);if(o)if(this.settings(m,"batchEdgesDrawing"))(function(){var a,b,c,d,e,f,g,h,i;c="edges_"+this.conradId,i=this.settings(m,"webglEdgesBatchSize"),a=Object.keys(this.edgeFloatArrays),a.length&&(b=0,h=sigma.webgl.edges[a[b]],e=this.edgeFloatArrays[a[b]].array,g=0,f=Math.min(g+i*h.POINTS,e.length/h.ATTRIBUTES),d=function(){return this.edgePrograms[a[b]]||(this.edgePrograms[a[b]]=h.initProgram(k)),f>g&&(k.useProgram(this.edgePrograms[a[b]]),h.render(k,this.edgePrograms[a[b]],e,{settings:this.settings,matrix:l,width:this.width,height:this.height,ratio:this.camera.ratio,scalingRatio:this.settings("webglOversamplingRatio"),start:g,count:f-g})),f>=e.length/h.ATTRIBUTES&&b===a.length-1?(delete this.jobs[c],!1):(f>=e.length/h.ATTRIBUTES?(b++,e=this.edgeFloatArrays[a[b]].array,h=sigma.webgl.edges[a[b]],g=0,f=Math.min(g+i*h.POINTS,e.length/h.ATTRIBUTES)):(g=f,f=Math.min(g+i*h.POINTS,e.length/h.ATTRIBUTES)),!0)},this.jobs[c]=d,conrad.addJob(c,d.bind(this)))}).call(this);else for(f in this.edgeFloatArrays)h=sigma.webgl.edges[f],this.edgePrograms[f]||(this.edgePrograms[f]=h.initProgram(k)),this.edgeFloatArrays[f]&&(k.useProgram(this.edgePrograms[f]),h.render(k,this.edgePrograms[f],this.edgeFloatArrays[f].array,{settings:this.settings,matrix:l,width:this.width,height:this.height,ratio:this.camera.ratio,scalingRatio:this.settings("webglOversamplingRatio")}));if(p){j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA),j.enable(j.BLEND);for(f in this.nodeFloatArrays)h=sigma.webgl.nodes[f],this.nodePrograms[f]||(this.nodePrograms[f]=h.initProgram(j)),this.nodeFloatArrays[f]&&(j.useProgram(this.nodePrograms[f]),h.render(j,this.nodePrograms[f],this.nodeFloatArrays[f].array,{settings:this.settings,matrix:l,width:this.width,height:this.height,ratio:this.camera.ratio,scalingRatio:this.settings("webglOversamplingRatio")}))}if(n)for(c=this.camera.quadtree.area(this.camera.getRectangle(this.width,this.height)),this.camera.applyView(a,a,{nodes:c,edges:[],width:this.width,height:this.height}),g=function(a){return i.settings({prefix:i.camera.prefix},a)},d=0,e=c.length;e>d;d++)(sigma.canvas.labels[c[d].type]||sigma.canvas.labels.def)(c[d],this.contexts.labels,g);return this.dispatchEvent("render"),this},sigma.renderers.webgl.prototype.initDOM=function(a,b,c){var d=document.createElement(a);d.style.position="absolute",d.setAttribute("class","sigma-"+b),this.domElements[b]=d,this.container.appendChild(d),"canvas"===a.toLowerCase()&&(this.contexts[b]=d.getContext(c?"experimental-webgl":"2d",{preserveDrawingBuffer:!0}))},sigma.renderers.webgl.prototype.resize=function(b,c){var d,e=this.width,f=this.height;if(b!==a&&c!==a?(this.width=b,this.height=c):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,b=this.width,c=this.height),e!==this.width||f!==this.height)for(d in this.domElements)this.domElements[d].style.width=b+"px",this.domElements[d].style.height=c+"px","canvas"===this.domElements[d].tagName.toLowerCase()&&(this.contexts[d]&&this.contexts[d].scale?(this.domElements[d].setAttribute("width",b+"px"),this.domElements[d].setAttribute("height",c+"px")):(this.domElements[d].setAttribute("width",b*this.settings("webglOversamplingRatio")+"px"),this.domElements[d].setAttribute("height",c*this.settings("webglOversamplingRatio")+"px")));for(d in this.contexts)this.contexts[d]&&this.contexts[d].viewport&&this.contexts[d].viewport(0,0,this.width*this.settings("webglOversamplingRatio"),this.height*this.settings("webglOversamplingRatio"));return this},sigma.renderers.webgl.prototype.clear=function(){var a;for(a in this.domElements)"CANVAS"===this.domElements[a].tagName&&(this.domElements[a].width=this.domElements[a].width);return this.contexts.nodes.clear(this.contexts.nodes.COLOR_BUFFER_BIT),this.contexts.edges.clear(this.contexts.edges.COLOR_BUFFER_BIT),this},sigma.utils.pkg("sigma.webgl.nodes"),sigma.utils.pkg("sigma.webgl.edges"),sigma.utils.pkg("sigma.canvas.labels")}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.renderers");var a,b=!!window.WebGLRenderingContext;b&&(a=document.createElement("canvas"),b=!(!a.getContext("webgl")&&!a.getContext("experimental-webgl"))),sigma.renderers.def=b?sigma.renderers.webgl:sigma.renderers.canvas}.call(this),function(){"use strict";sigma.utils.pkg("sigma.webgl.nodes"),sigma.webgl.nodes.def={POINTS:3,ATTRIBUTES:5,addNode:function(a,b,c,d,e){var f=sigma.utils.floatColor(a.color||e("defaultNodeColor"));b[c++]=a[d+"x"],b[c++]=a[d+"y"],b[c++]=a[d+"size"],b[c++]=f,b[c++]=0,b[c++]=a[d+"x"],b[c++]=a[d+"y"],b[c++]=a[d+"size"],b[c++]=f,b[c++]=2*Math.PI/3,b[c++]=a[d+"x"],b[c++]=a[d+"y"],b[c++]=a[d+"size"],b[c++]=f,b[c++]=4*Math.PI/3},render:function(a,b,c,d){var e,f=a.getAttribLocation(b,"a_position"),g=a.getAttribLocation(b,"a_size"),h=a.getAttribLocation(b,"a_color"),i=a.getAttribLocation(b,"a_angle"),j=a.getUniformLocation(b,"u_resolution"),k=a.getUniformLocation(b,"u_matrix"),l=a.getUniformLocation(b,"u_ratio"),m=a.getUniformLocation(b,"u_scale");e=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,e),a.bufferData(a.ARRAY_BUFFER,c,a.DYNAMIC_DRAW),a.uniform2f(j,d.width,d.height),a.uniform1f(l,1/Math.pow(d.ratio,d.settings("nodesPowRatio"))),a.uniform1f(m,d.scalingRatio),a.uniformMatrix3fv(k,!1,d.matrix),a.enableVertexAttribArray(f),a.enableVertexAttribArray(g),a.enableVertexAttribArray(h),a.enableVertexAttribArray(i),a.vertexAttribPointer(f,2,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),a.vertexAttribPointer(g,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),a.vertexAttribPointer(h,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,12),a.vertexAttribPointer(i,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,16),a.drawArrays(a.TRIANGLES,d.start||0,d.count||c.length/this.ATTRIBUTES)},initProgram:function(a){var b,c,d;return b=sigma.utils.loadShader(a,["attribute vec2 a_position;","attribute float a_size;","attribute float a_color;","attribute float a_angle;","uniform vec2 u_resolution;","uniform float u_ratio;","uniform float u_scale;","uniform mat3 u_matrix;","varying vec4 color;","varying vec2 center;","varying float radius;","void main() {","radius = a_size * u_ratio;","vec2 position = (u_matrix * vec3(a_position, 1)).xy;","center = position * u_scale;","center = vec2(center.x, u_scale * u_resolution.y - center.y);","position = position +","2.0 * radius * vec2(cos(a_angle), sin(a_angle));","position = (position / u_resolution * 2.0 - 1.0) * vec2(1, -1);","radius = radius * u_scale;","gl_Position = vec4(position, 0, 1);","float c = a_color;","color.b = mod(c, 256.0); c = floor(c / 256.0);","color.g = mod(c, 256.0); c = floor(c / 256.0);","color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;","color.a = 1.0;","}"].join("\n"),a.VERTEX_SHADER),c=sigma.utils.loadShader(a,["precision mediump float;","varying vec4 color;","varying vec2 center;","varying float radius;","void main(void) {","vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);","vec2 m = gl_FragCoord.xy - center;","float diff = radius - sqrt(m.x * m.x + m.y * m.y);","if (diff > 0.0)","gl_FragColor = color;","else","gl_FragColor = color0;","}"].join("\n"),a.FRAGMENT_SHADER),d=sigma.utils.loadProgram(a,[b,c])}}}(),function(){"use strict";sigma.utils.pkg("sigma.webgl.nodes"),sigma.webgl.nodes.fast={POINTS:1,ATTRIBUTES:4,addNode:function(a,b,c,d,e){b[c++]=a[d+"x"],b[c++]=a[d+"y"],b[c++]=a[d+"size"],b[c++]=sigma.utils.floatColor(a.color||e("defaultNodeColor"))},render:function(a,b,c,d){var e,f=a.getAttribLocation(b,"a_position"),g=a.getAttribLocation(b,"a_size"),h=a.getAttribLocation(b,"a_color"),i=a.getUniformLocation(b,"u_resolution"),j=a.getUniformLocation(b,"u_matrix"),k=a.getUniformLocation(b,"u_ratio"),l=a.getUniformLocation(b,"u_scale");e=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,e),a.bufferData(a.ARRAY_BUFFER,c,a.DYNAMIC_DRAW),a.uniform2f(i,d.width,d.height),a.uniform1f(k,1/Math.pow(d.ratio,d.settings("nodesPowRatio"))),a.uniform1f(l,d.scalingRatio),a.uniformMatrix3fv(j,!1,d.matrix),a.enableVertexAttribArray(f),a.enableVertexAttribArray(g),a.enableVertexAttribArray(h),a.vertexAttribPointer(f,2,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),a.vertexAttribPointer(g,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),a.vertexAttribPointer(h,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,12),a.drawArrays(a.POINTS,d.start||0,d.count||c.length/this.ATTRIBUTES)},initProgram:function(a){var b,c,d;return b=sigma.utils.loadShader(a,["attribute vec2 a_position;","attribute float a_size;","attribute float a_color;","uniform vec2 u_resolution;","uniform float u_ratio;","uniform float u_scale;","uniform mat3 u_matrix;","varying vec4 color;","void main() {","gl_Position = vec4(","((u_matrix * vec3(a_position, 1)).xy /","u_resolution * 2.0 - 1.0) * vec2(1, -1),","0,","1",");","gl_PointSize = a_size * u_ratio * u_scale * 2.0;","float c = a_color;","color.b = mod(c, 256.0); c = floor(c / 256.0);","color.g = mod(c, 256.0); c = floor(c / 256.0);","color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;","color.a = 1.0;","}"].join("\n"),a.VERTEX_SHADER),c=sigma.utils.loadShader(a,["precision mediump float;","varying vec4 color;","void main(void) {","gl_FragColor = color;","}"].join("\n"),a.FRAGMENT_SHADER),d=sigma.utils.loadProgram(a,[b,c])}}}(),function(){"use strict";sigma.utils.pkg("sigma.webgl.edges"),sigma.webgl.edges.def={POINTS:6,ATTRIBUTES:7,addEdge:function(a,b,c,d,e,f,g){var h=(a[f+"size"]||1)/2,i=b[f+"x"],j=b[f+"y"],k=c[f+"x"],l=c[f+"y"],m=a.color;if(!m)switch(g("edgeColor")){case"source":m=b.color||g("defaultNodeColor");break;case"target":m=c.color||g("defaultNodeColor");break;default:m=g("defaultEdgeColor")}m=sigma.utils.floatColor(m),d[e++]=i,d[e++]=j,d[e++]=k,d[e++]=l,d[e++]=h,d[e++]=0,d[e++]=m,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=1,d[e++]=m,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=0,d[e++]=m,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=0,d[e++]=m,d[e++]=i,d[e++]=j,d[e++]=k,d[e++]=l,d[e++]=h,d[e++]=1,d[e++]=m,d[e++]=i,d[e++]=j,d[e++]=k,d[e++]=l,d[e++]=h,d[e++]=0,d[e++]=m},render:function(a,b,c,d){var e,f=a.getAttribLocation(b,"a_color"),g=a.getAttribLocation(b,"a_position1"),h=a.getAttribLocation(b,"a_position2"),i=a.getAttribLocation(b,"a_thickness"),j=a.getAttribLocation(b,"a_minus"),k=a.getUniformLocation(b,"u_resolution"),l=a.getUniformLocation(b,"u_matrix"),m=a.getUniformLocation(b,"u_matrixHalfPi"),n=a.getUniformLocation(b,"u_matrixHalfPiMinus"),o=a.getUniformLocation(b,"u_ratio"),p=a.getUniformLocation(b,"u_scale");e=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,e),a.bufferData(a.ARRAY_BUFFER,c,a.STATIC_DRAW),a.uniform2f(k,d.width,d.height),a.uniform1f(o,d.ratio/Math.pow(d.ratio,d.settings("edgesPowRatio"))),a.uniform1f(p,d.scalingRatio),a.uniformMatrix3fv(l,!1,d.matrix),a.uniformMatrix2fv(m,!1,sigma.utils.matrices.rotation(Math.PI/2,!0)),a.uniformMatrix2fv(n,!1,sigma.utils.matrices.rotation(-Math.PI/2,!0)),a.enableVertexAttribArray(f),a.enableVertexAttribArray(g),a.enableVertexAttribArray(h),a.enableVertexAttribArray(i),a.enableVertexAttribArray(j),a.vertexAttribPointer(g,2,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),a.vertexAttribPointer(h,2,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),a.vertexAttribPointer(i,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,16),a.vertexAttribPointer(j,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,20),a.vertexAttribPointer(f,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,24),a.drawArrays(a.TRIANGLES,d.start||0,d.count||c.length/this.ATTRIBUTES)},initProgram:function(a){var b,c,d;return b=sigma.utils.loadShader(a,["attribute vec2 a_position1;","attribute vec2 a_position2;","attribute float a_thickness;","attribute float a_minus;","attribute float a_color;","uniform vec2 u_resolution;","uniform float u_ratio;","uniform float u_scale;","uniform mat3 u_matrix;","uniform mat2 u_matrixHalfPi;","uniform mat2 u_matrixHalfPiMinus;","varying vec4 color;","void main() {","vec2 position = a_thickness * u_ratio *","normalize(a_position2 - a_position1);","mat2 matrix = a_minus * u_matrixHalfPiMinus +","(1.0 - a_minus) * u_matrixHalfPi;","position = matrix * position + a_position1;","gl_Position = vec4(","((u_matrix * vec3(position, 1)).xy /","u_resolution * 2.0 - 1.0) * vec2(1, -1),","0,","1",");","float c = a_color;","color.b = mod(c, 256.0); c = floor(c / 256.0);","color.g = mod(c, 256.0); c = floor(c / 256.0);","color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;","color.a = 1.0;","}"].join("\n"),a.VERTEX_SHADER),c=sigma.utils.loadShader(a,["precision mediump float;","varying vec4 color;","void main(void) {","gl_FragColor = color;","}"].join("\n"),a.FRAGMENT_SHADER),d=sigma.utils.loadProgram(a,[b,c])}}}(),function(){"use strict";sigma.utils.pkg("sigma.webgl.edges"),sigma.webgl.edges.fast={POINTS:2,ATTRIBUTES:3,addEdge:function(a,b,c,d,e,f,g){var h=((a[f+"size"]||1)/2,b[f+"x"]),i=b[f+"y"],j=c[f+"x"],k=c[f+"y"],l=a.color;if(!l)switch(g("edgeColor")){case"source":l=b.color||g("defaultNodeColor");break;case"target":l=c.color||g("defaultNodeColor");break;default:l=g("defaultEdgeColor")}l=sigma.utils.floatColor(l),d[e++]=h,d[e++]=i,d[e++]=l,d[e++]=j,d[e++]=k,d[e++]=l},render:function(a,b,c,d){var e,f=a.getAttribLocation(b,"a_color"),g=a.getAttribLocation(b,"a_position"),h=a.getUniformLocation(b,"u_resolution"),i=a.getUniformLocation(b,"u_matrix");e=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,e),a.bufferData(a.ARRAY_BUFFER,c,a.DYNAMIC_DRAW),a.uniform2f(h,d.width,d.height),a.uniformMatrix3fv(i,!1,d.matrix),a.enableVertexAttribArray(g),a.enableVertexAttribArray(f),a.vertexAttribPointer(g,2,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),a.vertexAttribPointer(f,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),a.lineWidth(3),a.drawArrays(a.LINES,d.start||0,d.count||c.length/this.ATTRIBUTES)},initProgram:function(a){var b,c,d;return b=sigma.utils.loadShader(a,["attribute vec2 a_position;","attribute float a_color;","uniform vec2 u_resolution;","uniform mat3 u_matrix;","varying vec4 color;","void main() {","gl_Position = vec4(","((u_matrix * vec3(a_position, 1)).xy /","u_resolution * 2.0 - 1.0) * vec2(1, -1),","0,","1",");","float c = a_color;","color.b = mod(c, 256.0); c = floor(c / 256.0);","color.g = mod(c, 256.0); c = floor(c / 256.0);","color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;","color.a = 1.0;","}"].join("\n"),a.VERTEX_SHADER),c=sigma.utils.loadShader(a,["precision mediump float;","varying vec4 color;","void main(void) {","gl_FragColor = color;","}"].join("\n"),a.FRAGMENT_SHADER),d=sigma.utils.loadProgram(a,[b,c])}}}(),function(){"use strict";sigma.utils.pkg("sigma.webgl.edges"),sigma.webgl.edges.arrow={POINTS:9,ATTRIBUTES:11,addEdge:function(a,b,c,d,e,f,g){var h=(a[f+"size"]||1)/2,i=b[f+"x"],j=b[f+"y"],k=c[f+"x"],l=c[f+"y"],m=c[f+"size"],n=a.color;if(!n)switch(g("edgeColor")){case"source":n=b.color||g("defaultNodeColor");break;case"target":n=c.color||g("defaultNodeColor");break;default:n=g("defaultEdgeColor")}n=sigma.utils.floatColor(n),d[e++]=i,d[e++]=j,d[e++]=k,d[e++]=l,d[e++]=h,d[e++]=m,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=n,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=m,d[e++]=1,d[e++]=1,d[e++]=0,d[e++]=0,d[e++]=n,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=m,d[e++]=1,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=n,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=m,d[e++]=1,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=n,d[e++]=i,d[e++]=j,d[e++]=k,d[e++]=l,d[e++]=h,d[e++]=m,d[e++]=0,d[e++]=1,d[e++]=0,d[e++]=0,d[e++]=n,d[e++]=i,d[e++]=j,d[e++]=k,d[e++]=l,d[e++]=h,d[e++]=m,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=n,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=m,d[e++]=1,d[e++]=0,d[e++]=1,d[e++]=-1,d[e++]=n,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=m,d[e++]=1,d[e++]=0,d[e++]=1,d[e++]=0,d[e++]=n,d[e++]=k,d[e++]=l,d[e++]=i,d[e++]=j,d[e++]=h,d[e++]=m,d[e++]=1,d[e++]=0,d[e++]=1,d[e++]=1,d[e++]=n 4 | },render:function(a,b,c,d){var e,f=a.getAttribLocation(b,"a_pos1"),g=a.getAttribLocation(b,"a_pos2"),h=a.getAttribLocation(b,"a_thickness"),i=a.getAttribLocation(b,"a_tSize"),j=a.getAttribLocation(b,"a_delay"),k=a.getAttribLocation(b,"a_minus"),l=a.getAttribLocation(b,"a_head"),m=a.getAttribLocation(b,"a_headPosition"),n=a.getAttribLocation(b,"a_color"),o=a.getUniformLocation(b,"u_resolution"),p=a.getUniformLocation(b,"u_matrix"),q=a.getUniformLocation(b,"u_matrixHalfPi"),r=a.getUniformLocation(b,"u_matrixHalfPiMinus"),s=a.getUniformLocation(b,"u_ratio"),t=a.getUniformLocation(b,"u_nodeRatio"),u=a.getUniformLocation(b,"u_arrowHead"),v=a.getUniformLocation(b,"u_scale");e=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,e),a.bufferData(a.ARRAY_BUFFER,c,a.STATIC_DRAW),a.uniform2f(o,d.width,d.height),a.uniform1f(s,d.ratio/Math.pow(d.ratio,d.settings("edgesPowRatio"))),a.uniform1f(t,Math.pow(d.ratio,d.settings("nodesPowRatio"))/d.ratio),a.uniform1f(u,5),a.uniform1f(v,d.scalingRatio),a.uniformMatrix3fv(p,!1,d.matrix),a.uniformMatrix2fv(q,!1,sigma.utils.matrices.rotation(Math.PI/2,!0)),a.uniformMatrix2fv(r,!1,sigma.utils.matrices.rotation(-Math.PI/2,!0)),a.enableVertexAttribArray(f),a.enableVertexAttribArray(g),a.enableVertexAttribArray(h),a.enableVertexAttribArray(i),a.enableVertexAttribArray(j),a.enableVertexAttribArray(k),a.enableVertexAttribArray(l),a.enableVertexAttribArray(m),a.enableVertexAttribArray(n),a.vertexAttribPointer(f,2,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,0),a.vertexAttribPointer(g,2,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,8),a.vertexAttribPointer(h,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,16),a.vertexAttribPointer(i,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,20),a.vertexAttribPointer(j,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,24),a.vertexAttribPointer(k,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,28),a.vertexAttribPointer(l,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,32),a.vertexAttribPointer(m,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,36),a.vertexAttribPointer(n,1,a.FLOAT,!1,this.ATTRIBUTES*Float32Array.BYTES_PER_ELEMENT,40),a.drawArrays(a.TRIANGLES,d.start||0,d.count||c.length/this.ATTRIBUTES)},initProgram:function(a){var b,c,d;return b=sigma.utils.loadShader(a,["attribute vec2 a_pos1;","attribute vec2 a_pos2;","attribute float a_thickness;","attribute float a_tSize;","attribute float a_delay;","attribute float a_minus;","attribute float a_head;","attribute float a_headPosition;","attribute float a_color;","uniform vec2 u_resolution;","uniform float u_ratio;","uniform float u_nodeRatio;","uniform float u_arrowHead;","uniform float u_scale;","uniform mat3 u_matrix;","uniform mat2 u_matrixHalfPi;","uniform mat2 u_matrixHalfPiMinus;","varying vec4 color;","void main() {","vec2 pos = normalize(a_pos2 - a_pos1);","mat2 matrix = (1.0 - a_head) *","(","a_minus * u_matrixHalfPiMinus +","(1.0 - a_minus) * u_matrixHalfPi",") + a_head * (","a_headPosition * u_matrixHalfPiMinus * 0.6 +","(a_headPosition * a_headPosition - 1.0) * mat2(1.0)",");","pos = a_pos1 + (","(1.0 - a_head) * a_thickness * u_ratio * matrix * pos +","a_head * u_arrowHead * a_thickness * u_ratio * matrix * pos +","a_delay * pos * (","a_tSize / u_nodeRatio +","u_arrowHead * a_thickness * u_ratio",")",");","gl_Position = vec4(","((u_matrix * vec3(pos, 1)).xy /","u_resolution * 2.0 - 1.0) * vec2(1, -1),","0,","1",");","float c = a_color;","color.b = mod(c, 256.0); c = floor(c / 256.0);","color.g = mod(c, 256.0); c = floor(c / 256.0);","color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;","color.a = 1.0;","}"].join("\n"),a.VERTEX_SHADER),c=sigma.utils.loadShader(a,["precision mediump float;","varying vec4 color;","void main(void) {","gl_FragColor = color;","}"].join("\n"),a.FRAGMENT_SHADER),d=sigma.utils.loadProgram(a,[b,c])}}}(),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.canvas.labels"),sigma.canvas.labels.def=function(a,b,c){var d,e=c("prefix")||"",f=a[e+"size"];f0&&(b.beginPath(),b.fillStyle="node"===c("nodeBorderColor")?a.color||c("defaultNodeColor"):c("defaultNodeBorderColor"),b.arc(a[j+"x"],a[j+"y"],k+c("borderSize"),0,2*Math.PI,!0),b.closePath(),b.fill());var m=sigma.canvas.nodes[a.type]||sigma.canvas.nodes.def;m(a,b,c),"string"==typeof a.label&&(b.fillStyle="node"===c("labelHoverColor")?a.color||c("defaultNodeColor"):c("defaultLabelHoverColor"),b.fillText(a.label,Math.round(a[j+"x"]+k+3),Math.round(a[j+"y"]+l/3)))}}.call(this),function(){"use strict";sigma.utils.pkg("sigma.canvas.nodes"),sigma.canvas.nodes.def=function(a,b,c){var d=c("prefix")||"";b.fillStyle=a.color||c("defaultNodeColor"),b.beginPath(),b.arc(a[d+"x"],a[d+"y"],a[d+"size"],0,2*Math.PI,!0),b.closePath(),b.fill()}}(),function(){"use strict";sigma.utils.pkg("sigma.canvas.edges"),sigma.canvas.edges.def=function(a,b,c,d,e){var f=a.color,g=e("prefix")||"",h=e("edgeColor"),i=e("defaultNodeColor"),j=e("defaultEdgeColor");if(!f)switch(h){case"source":f=b.color||i;break;case"target":f=c.color||i;break;default:f=j}d.strokeStyle=f,d.lineWidth=a[g+"size"]||1,d.beginPath(),d.moveTo(b[g+"x"],b[g+"y"]),d.lineTo(c[g+"x"],c[g+"y"]),d.stroke()}}(),function(){"use strict";sigma.utils.pkg("sigma.canvas.edges"),sigma.canvas.edges.arrow=function(a,b,c,d,e){var f=a.color,g=e("prefix")||"",h=e("edgeColor"),i=e("defaultNodeColor"),j=e("defaultEdgeColor"),k=a[g+"size"]||1,l=c[g+"size"],m=b[g+"x"],n=b[g+"y"],o=c[g+"x"],p=c[g+"y"],q=2.5*k,r=Math.sqrt(Math.pow(o-m,2)+Math.pow(p-n,2)),s=m+(o-m)*(r-q-l)/r,t=n+(p-n)*(r-q-l)/r,u=(o-m)*q/r,v=(p-n)*q/r;if(!f)switch(h){case"source":f=b.color||i;break;case"target":f=c.color||i;break;default:f=j}d.strokeStyle=f,d.lineWidth=k,d.beginPath(),d.moveTo(m,n),d.lineTo(s,t),d.stroke(),d.fillStyle=f,d.beginPath(),d.moveTo(s+u,t+v),d.lineTo(s+.6*v,t-.6*u),d.lineTo(s-.6*v,t+.6*u),d.lineTo(s+u,t+v),d.closePath(),d.fill()}}(),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.middlewares"),sigma.utils.pkg("sigma.utils"),sigma.middlewares.rescale=function(a,b,c){var d,e,f,g,h,i,j,k,l=this.graph.nodes(),m=this.graph.edges(),n=this.settings.embedObjects(c||{}),o=n("bounds")||sigma.utils.getBoundaries(this.graph,a,!0),p=o.minX,q=o.minY,r=o.maxX,s=o.maxY,t=o.sizeMax,u=o.weightMax,v=n("width")||1,w=n("height")||1;for(j="outside"===n("scalingMode")?Math.max(v/Math.max(r-p,1),w/Math.max(s-q,1)):Math.min(v/Math.max(r-p,1),w/Math.max(s-q,1)),k=(n("rescaleIgnoreSize")?0:(n("maxNodeSize")||t)/j)+(n("sideMargin")||0),r+=k,p-=k,s+=k,q-=k,j="outside"===n("scalingMode")?Math.max(v/Math.max(r-p,1),w/Math.max(s-q,1)):Math.min(v/Math.max(r-p,1),w/Math.max(s-q,1)),n("maxNodeSize")||n("minNodeSize")?n("maxNodeSize")===n("minNodeSize")?(f=0,g=n("maxNodeSize")):(f=(n("maxNodeSize")-n("minNodeSize"))/t,g=n("minNodeSize")):(f=1,g=0),n("maxEdgeSize")||n("minEdgeSize")?n("maxEdgeSize")===n("minEdgeSize")?(h=0,i=n("minEdgeSize")):(h=(n("maxEdgeSize")-n("minEdgeSize"))/u,i=n("minEdgeSize")):(h=1,i=0),d=0,e=m.length;e>d;d++)m[d][b+"size"]=m[d][a+"size"]*h+i;for(d=0,e=l.length;e>d;d++)l[d][b+"size"]=l[d][a+"size"]*f+g,l[d][b+"x"]=(l[d][a+"x"]-(r+p)/2)*j,l[d][b+"y"]=(l[d][a+"y"]-(s+q)/2)*j},sigma.utils.getBoundaries=function(a,b,c){var d,e,f=a.edges(),g=a.nodes(),h=-1/0,i=-1/0,j=1/0,k=1/0,l=-1/0,m=-1/0;if(c)for(d=0,e=f.length;e>d;d++)h=Math.max(f[d][b+"size"],h);for(d=0,e=g.length;e>d;d++)i=Math.max(g[d][b+"size"],i),l=Math.max(g[d][b+"x"],l),j=Math.min(g[d][b+"x"],j),m=Math.max(g[d][b+"y"],m),k=Math.min(g[d][b+"y"],k);return h=h||1,i=i||1,{weightMax:h,sizeMax:i,minX:j,minY:k,maxX:l,maxY:m}}}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.middlewares"),sigma.middlewares.copy=function(a,b){var c,d,e;if(b+""!=a+""){for(e=this.graph.nodes(),c=0,d=e.length;d>c;c++)e[c][b+"x"]=e[c][a+"x"],e[c][b+"y"]=e[c][a+"y"],e[c][b+"size"]=e[c][a+"size"];for(e=this.graph.edges(),c=0,d=e.length;d>c;c++)e[c][b+"size"]=e[c][a+"size"]}}}.call(this),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.misc.animation.running");var b=function(){var a=0;return function(){return""+ ++a}}();sigma.misc.animation.camera=function(c,d,e){if(!(c instanceof sigma.classes.camera&&"object"==typeof d&&d))throw"animation.camera: Wrong arguments.";if("number"!=typeof d.x&&"number"!=typeof d.y&&"number"!=typeof d.ratio&&"number"!=typeof d.angle)throw"There must be at least one valid coordinate in the given val.";var f,g,h,i,j,k,l=e||{},m=sigma.utils.dateNow();return k={x:c.x,y:c.y,ratio:c.ratio,angle:c.angle},j=l.duration,i="function"!=typeof l.easing?sigma.utils.easings[l.easing||"quadraticInOut"]:l.easing,f=function(){var b,e=l.duration?(sigma.utils.dateNow()-m)/l.duration:1;e>=1?(c.isAnimated=!1,c.goTo({x:d.x!==a?d.x:k.x,y:d.y!==a?d.y:k.y,ratio:d.ratio!==a?d.ratio:k.ratio,angle:d.angle!==a?d.angle:k.angle}),cancelAnimationFrame(g),delete sigma.misc.animation.running[g],"function"==typeof l.onComplete&&l.onComplete()):(b=i(e),c.isAnimated=!0,c.goTo({x:d.x!==a?k.x+(d.x-k.x)*b:k.x,y:d.y!==a?k.y+(d.y-k.y)*b:k.y,ratio:d.ratio!==a?k.ratio+(d.ratio-k.ratio)*b:k.ratio,angle:d.angle!==a?k.angle+(d.angle-k.angle)*b:k.angle}),"function"==typeof l.onNewFrame&&l.onNewFrame(),h.frameId=requestAnimationFrame(f))},g=b(),h={frameId:requestAnimationFrame(f),target:c,type:"camera",options:l,fn:f},sigma.misc.animation.running[g]=h,g},sigma.misc.animation.kill=function(a){if(1!==arguments.length||"number"!=typeof a)throw"animation.kill: Wrong arguments.";var b=sigma.misc.animation.running[a];return b&&(cancelAnimationFrame(a),delete sigma.misc.animation.running[b.frameId],"camera"===b.type&&(b.target.isAnimated=!1),"function"==typeof(b.options||{}).onComplete&&b.options.onComplete()),this},sigma.misc.animation.killAll=function(a){var b,c,d=0,e="string"==typeof a?a:null,f="object"==typeof a?a:null,g=sigma.misc.animation.running;for(c in g)e&&g[c].type!==e||f&&g[c].target!==f||(b=sigma.misc.animation.running[c],cancelAnimationFrame(b.frameId),delete sigma.misc.animation.running[c],"camera"===b.type&&(b.target.isAnimated=!1),d++,"function"==typeof(b.options||{}).onComplete&&b.options.onComplete());return d},sigma.misc.animation.has=function(a){var b,c="string"==typeof a?a:null,d="object"==typeof a?a:null,e=sigma.misc.animation.running;for(b in e)if(!(c&&e[b].type!==c||d&&e[b].target!==d))return!0;return!1}}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.misc"),sigma.misc.bindEvents=function(a){function b(b){b&&(f="x"in b.data?b.data.x:f,g="y"in b.data?b.data.y:g);var c,d,e,i,j,k,l,m,n=[],o=f+h.width/2,p=g+h.height/2,q=h.camera.cameraPosition(f,g),r=h.camera.quadtree.point(q.x,q.y);if(r.length)for(c=0,e=r.length;e>c;c++)if(i=r[c],j=i[a+"x"],k=i[a+"y"],l=i[a+"size"],o>j-l&&j+l>o&&p>k-l&&k+l>p&&Math.sqrt(Math.pow(o-j,2)+Math.pow(p-k,2))n[d].size){n.splice(d,0,i),m=!0;break}m||n.push(i)}return n}function c(a){function c(a){h.settings("eventsEnabled")&&(h.dispatchEvent("click",a.data),f=b(a),f.length?(h.dispatchEvent("clickNode",{node:f[0]}),h.dispatchEvent("clickNodes",{node:f})):h.dispatchEvent("clickStage"))}function d(){if(h.settings("eventsEnabled")){var a,b,c,d=[];for(a in g)d.push(g[a]);for(g={},b=0,c=d.length;c>b;b++)h.dispatchEvent("outNode",{node:d[b]});d.length&&h.dispatchEvent("outNodes",{nodes:d})}}function e(a){if(h.settings("eventsEnabled")){f=b(a);var c,d,e,i=[],j=[],k={},l=f.length;for(c=0;l>c;c++)e=f[c],k[e.id]=e,g[e.id]||(j.push(e),g[e.id]=e);for(d in g)k[d]||(i.push(g[d]),delete g[d]);for(c=0,l=j.length;l>c;c++)h.dispatchEvent("overNode",{node:j[c]});for(c=0,l=i.length;l>c;c++)h.dispatchEvent("outNode",{node:i[c]});j.length&&h.dispatchEvent("overNodes",{nodes:j}),i.length&&h.dispatchEvent("outNodes",{nodes:i})}}var f,g={};a.bind("click",c),a.bind("mouseup",e),a.bind("mousemove",e),a.bind("mouseout",d)}var d,e,f,g,h=this;for(d=0,e=this.captors.length;e>d;d++)c(this.captors[d])}}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.misc"),sigma.misc.drawHovers=function(a){function b(){c.contexts.hover.canvas.width=c.contexts.hover.canvas.width;var b,e=sigma.canvas.hovers,f=c.settings.embedObjects({prefix:a});if(f("enableHovering"))for(b in d)(e[d[b].type]||e.def)(d[b],c.contexts.hover,f)}var c=this,d={};this.bind("overNodes",function(a){var c,e=a.data.nodes,f=e.length;for(c=0;f>c;c++)d[e[c].id]=e[c];b()}),this.bind("outNodes",function(a){var c,e=a.data.nodes,f=e.length;for(c=0;f>c;c++)delete d[e[c].id];b()}),this.bind("render",function(){b()})}}.call(this); --------------------------------------------------------------------------------