forked from algorithm-visualizer/algorithm-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgorithm_visualizer.min.js
More file actions
4 lines (4 loc) · 64.4 KB
/
Copy pathalgorithm_visualizer.min.js
File metadata and controls
4 lines (4 loc) · 64.4 KB
1
2
3
4
!function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[o]={exports:{}};e[o][0].call(l.exports,function(t){var r=e[o][1][t];return i(r?r:t)},l,l.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";var n=$,i=n.extend,a={lastFileUsed:"",files:{}},o=function(t){if(!t)throw"Missing file name"};e.exports={getCachedFile:function(t){return o(t),a.files[t]},updateCachedFile:function(t,e){o(t),a.files[t]||(a.files[t]={}),i(a.files[t],e)},getLastFileUsed:function(){return a.lastFileUsed},setLastFileUsed:function(t){a.lastFileUsed=t}}},{}],2:[function(t,e,r){"use strict";var n=t("../editor"),i=t("../tracer_manager"),a=t("../dom/setup"),o=t("../dom/loading_slider"),s=o.showLoadingSlider,c=o.hideLoadingSlider,u=t("../utils"),l=(u.getFileDir,t("./cache")),h={isLoading:null,editor:null,tracerManager:null,categories:null,loadedScratch:null},p=function(t){h.isLoading=!1,h.editor=new n(t),h.tracerManager=t,h.categories={},h.loadedScratch=null},f=function(){this.getIsLoading=function(){return h.isLoading},this.setIsLoading=function(t){h.isLoading=t,t?s():c()},this.getEditor=function(){return h.editor},this.getCategories=function(){return h.categories},this.getCategory=function(t){return h.categories[t]},this.setCategories=function(t){h.categories=t},this.updateCategory=function(t,e){$.extend(h.categories[t],e)},this.getTracerManager=function(){return h.tracerManager},this.getLoadedScratch=function(){return h.loadedScratch},this.setLoadedScratch=function(t){h.loadedScratch=t};var t=i.init();p(t),a.setup(t)};f.prototype=l,e.exports=f},{"../dom/loading_slider":7,"../dom/setup":8,"../editor":26,"../tracer_manager":59,"../utils":65,"./cache":1}],3:[function(t,e,r){"use strict";e.exports={}},{}],4:[function(t,e,r){"use strict";var n=t("../app"),i=t("../server"),a=t("./show_algorithm"),o=$,s=o.each,c=function(t,e,r){var n=$('<button class="indent collapse">').append(e[r]).attr("data-algorithm",r).attr("data-category",t).click(function(){i.loadAlgorithm(t,r).then(function(e){a(t,r,e)})});$("#list").append(n)},u=function(t){var e=n.getCategory(t),r=e.name,i=e.list,a=$('<button class="category">').append('<i class="fa fa-fw fa-caret-right">').append(r).attr("data-category",t);a.click(function(){$('.indent[data-category="'+t+'"]').toggleClass("collapse"),$(this).find("i.fa").toggleClass("fa-caret-right fa-caret-down")}),$("#list").append(a),s(i,function(e){c(t,i,e)})};e.exports=function(){s(n.getCategories(),u)}},{"../app":3,"../server":53,"./show_algorithm":19}],5:[function(t,e,r){"use strict";var n=t("../server"),i=$,a=i.each,o=function(t,e,r,i){var a=$("<button>").append(r).attr("data-file",r).click(function(){n.loadFile(t,e,r,i),$(".files_bar > .wrapper > button").removeClass("active"),$(this).addClass("active")});return $(".files_bar > .wrapper").append(a),a};e.exports=function(t,e,r,n){$(".files_bar > .wrapper").empty(),a(r,function(r,i){var a=o(t,e,r,i);n&&n==r&&a.click()}),n||$(".files_bar > .wrapper > button").first().click(),$(".files_bar > .wrapper").scroll()}},{"../server":53}],6:[function(t,e,r){"use strict";var n=t("./show_algorithm"),i=t("./add_categories"),a=t("./show_description"),o=t("./add_files"),s=t("./show_first_algorithm"),c=t("./show_requested_algorithm");e.exports={showAlgorithm:n,addCategories:i,showDescription:a,addFiles:o,showFirstAlgorithm:s,showRequestedAlgorithm:c}},{"./add_categories":4,"./add_files":5,"./show_algorithm":19,"./show_description":20,"./show_first_algorithm":21,"./show_requested_algorithm":22}],7:[function(t,e,r){"use strict";var n=function(){$("#loading-slider").removeClass("loaded")},i=function(){$("#loading-slider").addClass("loaded")};e.exports={showLoadingSlider:n,hideLoadingSlider:i}},{}],8:[function(t,e,r){"use strict";var n=t("./setup_dividers"),i=t("./setup_document"),a=t("./setup_files_bar"),o=t("./setup_interval"),s=t("./setup_module_container"),c=t("./setup_powered_by"),u=t("./setup_scratch_paper"),l=t("./setup_side_menu"),h=t("./setup_top_menu"),p=t("./setup_window"),f=function(){$(".btn input").click(function(t){t.stopPropagation()}),n(),i(),a(),o(),s(),c(),u(),l(),h(),p()};e.exports={setup:f}},{"./setup_dividers":9,"./setup_document":10,"./setup_files_bar":11,"./setup_interval":12,"./setup_module_container":13,"./setup_powered_by":14,"./setup_scratch_paper":15,"./setup_side_menu":16,"./setup_top_menu":17,"./setup_window":18}],9:[function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=t("../../app"),a=function(t){var e=n(t,3),r=e[0],a=e[1],o=e[2],s=a.parent(),c=5,u=$('<div class="divider">'),l=!1;r?!function(){u.addClass("vertical");var t=-c/2;u.css({top:0,bottom:0,left:t,width:c});var e=void 0;u.mousedown(function(t){var r=t.pageX;e=r,l=!0}),$(document).mousemove(function(t){var r=t.pageX;if(l){var n=o.position().left+r-e,c=n/s.width()*100;c=Math.min(90,Math.max(10,c)),a.css("right",100-c+"%"),o.css("left",c+"%"),e=r,i.getTracerManager().resize(),$(".files_bar > .wrapper").scroll()}}),$(document).mouseup(function(t){l=!1})}():!function(){u.addClass("horizontal");var t=-c/2;u.css({top:t,height:c,left:0,right:0});var e=void 0;u.mousedown(function(t){var r=t.pageY;e=r,l=!0}),$(document).mousemove(function(t){var r=t.pageY;if(l){var n=o.position().top+r-e,c=n/s.height()*100;c=Math.min(90,Math.max(10,c)),a.css("bottom",100-c+"%"),o.css("top",c+"%"),e=r,i.getTracerManager().resize()}}),$(document).mouseup(function(t){l=!1})}(),o.append(u)};e.exports=function(){for(var t=[["v",$(".sidemenu"),$(".workspace")],["v",$(".viewer_container"),$(".editor_container")],["h",$(".data_container"),$(".code_container")]],e=0;e<t.length;e++)a(t[e])}},{"../../app":3}],10:[function(t,e,r){"use strict";var n=t("../../app");e.exports=function(){$(document).on("click","a",function(t){console.log(t),t.preventDefault(),window.open($(this).attr("href"),"_blank")||alert("Please allow popups for this site")}),$(document).mouseup(function(t){n.getTracerManager().command("mouseup",t)})}},{"../../app":3}],11:[function(t,e,r){"use strict";var n=function(t,e){return t>e+2};e.exports=function(){$(".files_bar > .btn-left").click(function(){var t=$(".files_bar > .wrapper"),e=t.width(),r=t.scrollLeft();$(t.children("button").get().reverse()).each(function(){var n=$(this).position().left,i=n+$(this).outerWidth();return 0>n?(t.scrollLeft(r+i-e),!1):void 0})}),$(".files_bar > .btn-right").click(function(){var t=$(".files_bar > .wrapper"),e=t.width(),r=t.scrollLeft();t.children("button").each(function(){var n=$(this).position().left,i=n+$(this).outerWidth();return i>e?(t.scrollLeft(r+n),!1):void 0})}),$(".files_bar > .wrapper").scroll(function(){var t=$(".files_bar > .wrapper"),e=t.width(),r=t.children("button:first-child"),i=t.children("button:last-child"),a=r.position().left,o=i.position().left+i.outerWidth();if(n(0,a)&&n(e,o)){var s=t.scrollLeft();return void t.scrollLeft(s+e-o)}var c=n(0,a),u=n(o,e);t.toggleClass("shadow-left",c),t.toggleClass("shadow-right",u),$(".files_bar > .btn-left").attr("disabled",!c),$(".files_bar > .btn-right").attr("disabled",!u)})}},{}],12:[function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=t("../../app"),a=t("../toast"),o=Number.parseFloat,s=.1,c=10,u=.5,l=.1,h=function(t){var e=void 0,r=void 0;return s>t?(e=s,r="Interval of "+t+" seconds is too low. Setting to min allowed interval of "+s+" second(s)."):t>c?(e=c,r="Interval of "+t+" seconds is too high. Setting to max allowed interval of "+c+" second(s)."):(e=t,r="Interval has been set to "+t+" second(s)."),[e,r]};e.exports=function(){var t=$("#interval");t.val(u),t.attr({max:c,min:s,step:l}),$("#interval").on("change",function(){var t=i.getTracerManager(),e=h(o($(this).val())),r=n(e,2),s=r[0],c=r[1];$(this).val(s),t.interval=1e3*s,a.showInfoToast(c)})}},{"../../app":3,"../toast":23}],13:[function(t,e,r){"use strict";var n=t("../../app");e.exports=function(){var t=$(".module_container");t.on("mousedown",".module_wrapper",function(t){n.getTracerManager().findOwner(this).mousedown(t)}),t.on("mousemove",".module_wrapper",function(t){n.getTracerManager().findOwner(this).mousemove(t)}),t.on("DOMMouseScroll mousewheel",".module_wrapper",function(t){n.getTracerManager().findOwner(this).mousewheel(t)})}},{"../../app":3}],14:[function(t,e,r){"use strict";e.exports=function(){$("#powered-by").click(function(){$("#powered-by-list button").toggleClass("collapse")})}},{}],15:[function(t,e,r){"use strict";var n=t("../../app"),i=t("../../server"),a=t("../show_algorithm");e.exports=function(){$("#scratch-paper").click(function(){var t="scratch",e=n.getLoadedScratch();i.loadAlgorithm(t,e).then(function(r){a(t,e,r)})})}},{"../../app":3,"../../server":53,"../show_algorithm":19}],16:[function(t,e,r){"use strict";var n=t("../../app"),i=void 0;e.exports=function(){$("#navigation").click(function(){var t=$(".sidemenu"),e=$(".workspace");t.toggleClass("active"),$(".nav-dropdown").toggleClass("fa-caret-down fa-caret-up"),t.hasClass("active")?(t.css("right",100-i+"%"),e.css("left",i+"%")):(i=e.position().left/$("body").width()*100,t.css("right",0),e.css("left",0)),n.getTracerManager().resize()})}},{"../../app":3}],17:[function(t,e,r){"use strict";var n=t("../../app"),i=t("../../server"),a=t("../toast");e.exports=function(){$("#shared").mouseup(function(){$(this).select()}),$("#btn_share").click(function(){var t=$(this).find(".fa-share");t.addClass("fa-spin fa-spin-faster"),i.shareScratchPaper().then(function(e){t.removeClass("fa-spin fa-spin-faster"),$("#shared").removeClass("collapse"),$("#shared").val(e),a.showInfoToast("Shareable link is created.")})}),$("#btn_run").click(function(){$("#btn_trace").click();var t=n.getEditor().execute();t&&(console.error(t),a.showErrorToast(t))}),$("#btn_pause").click(function(){n.getTracerManager().isPause()?n.getTracerManager().resumeStep():n.getTracerManager().pauseStep()}),$("#btn_prev").click(function(){n.getTracerManager().pauseStep(),n.getTracerManager().prevStep()}),$("#btn_next").click(function(){n.getTracerManager().pauseStep(),n.getTracerManager().nextStep()}),$("#btn_desc").click(function(){$(".tab_container > .tab").removeClass("active"),$("#tab_desc").addClass("active"),$(".tab_bar > button").removeClass("active"),$(this).addClass("active")}),$("#btn_trace").click(function(){$(".tab_container > .tab").removeClass("active"),$("#tab_module").addClass("active"),$(".tab_bar > button").removeClass("active"),$(this).addClass("active")})}},{"../../app":3,"../../server":53,"../toast":23}],18:[function(t,e,r){"use strict";var n=t("../../app");e.exports=function(){$(window).resize(function(){n.getTracerManager().resize()})}},{"../../app":3}],19:[function(t,e,r){"use strict";var n=t("../app"),i=t("../utils"),a=i.isScratchPaper,o=t("./show_description"),s=t("./add_files");e.exports=function(t,e,r,i){var c=void 0,u=void 0,l=void 0;if(a(t))c=$("#scratch-paper"),u="Scratch Paper",l=e?"Shared":"Temporary";else{c=$('[data-category="'+t+'"][data-algorithm="'+e+'"]');var h=n.getCategory(t);u=h.name,l=h.list[e]}$(".sidemenu button").removeClass("active"),c.addClass("active"),$("#category").html(u),$("#algorithm").html(l),$("#tab_desc > .wrapper").empty(),$(".files_bar > .wrapper").empty(),$("#explanation").html(""),n.setLastFileUsed(null),n.getEditor().clearContent();var p=r.files;delete r.files,o(r),s(t,e,p,i)}},{"../app":3,"../utils":65,"./add_files":5,"./show_description":20}],20:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},i=Array.isArray,a=$,o=a.each;e.exports=function(t){var e=$("#tab_desc > .wrapper");e.empty(),o(t,function(t,r){t&&e.append($("<h3>").html(t)),"string"==typeof r?e.append($("<p>").html(r)):i(r)?!function(){var t=$("<ul>");e.append(t),r.forEach(function(e){t.append($("<li>").html(e))})}():"object"===("undefined"==typeof r?"undefined":n(r))&&!function(){var t=$("<ul>");e.append(t),o(r,function(e){t.append($("<li>").append($("<strong>").html(e)).append(" "+r[e]))})}()})}},{}],21:[function(t,e,r){"use strict";e.exports=function(){$("#list button.category").first().click(),$("#list button.category + .indent").first().click()}},{}],22:[function(t,e,r){"use strict";var n=t("../server"),i=t("./show_algorithm");e.exports=function(t,e,r){$('.category[data-category="'+t+'"]').click(),n.loadAlgorithm(t,e).then(function(n){i(t,e,n,r)})}},{"../server":53,"./show_algorithm":19}],23:[function(t,e,r){"use strict";var n=function(t,e){var r=$('<div class="toast '+e+'">').append(t);$(".toast_container").append(r),setTimeout(function(){r.fadeOut(function(){r.remove()})},3e3)},i=function(t){n(t,"error")},a=function(t){n(t,"info")};e.exports={showErrorToast:i,showInfoToast:a}},{}],24:[function(t,e,r){"use strict";e.exports=function(t){var e=ace.edit(t);return e.setOptions({enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}),e.setTheme("ace/theme/tomorrow_night_eighties"),e.session.setMode("ace/mode/javascript"),e.$blockScrolling=1/0,e}},{}],25:[function(require,module,exports){"use strict";var execute=function execute(tracerManager,code){try{tracerManager.deallocateAll(),eval(code),tracerManager.visualize()}catch(err){return err}finally{tracerManager.removeUnallocated()}},executeData=function(t,e){return execute(t,e)},executeDataAndCode=function(t,e,r){return execute(t,e+";"+r)};module.exports={executeData:executeData,executeDataAndCode:executeDataAndCode}},{}],26:[function(t,e,r){"use strict";function n(t){var e=this;if(!t)throw"Cannot create Editor. Missing the tracerManager";ace.require("ace/ext/language_tools"),this.dataEditor=a("data"),this.codeEditor=a("code"),this.setData=function(t){e.dataEditor.setValue(t,-1)},this.setCode=function(t){e.codeEditor.setValue(t,-1)},this.setContent=function(t){var r=t.data,n=t.code;e.setData(r),e.setCode(n)},this.clearData=function(){e.dataEditor.setValue("")},this.clearCode=function(){e.codeEditor.setValue("")},this.clearContent=function(){e.clearData(),e.clearCode()},this.execute=function(){var r=e.dataEditor.getValue(),n=e.codeEditor.getValue();return o.executeDataAndCode(t,r,n)},this.dataEditor.on("change",function(){var r=e.dataEditor.getValue(),n=i.getLastFileUsed();n&&i.updateCachedFile(n,{data:r}),o.executeData(t,r)}),this.codeEditor.on("change",function(){var t=e.codeEditor.getValue(),r=i.getLastFileUsed();r&&i.updateCachedFile(r,{code:t})})}var i=t("../app"),a=t("./create"),o=t("./executor");e.exports=n},{"../app":3,"./create":24,"./executor":25}],27:[function(t,e,r){"use strict";var n=t("rsvp"),i=t("./app"),a=t("./app/constructor"),o=t("./dom"),s=t("./server"),c=t("./module"),u=$,l=u.extend;$.ajaxSetup({cache:!1,dataType:"text"});var h=t("./utils"),p=h.isScratchPaper,f=t("./server/helpers"),d=f.getPath;n.on("error",function(t){console.assert(!1,t)}),$(function(){var t=new a;l(!0,i,t),l(!0,window,c),s.loadCategories().then(function(t){i.setCategories(t),o.addCategories();var e=d(),r=e.category,n=e.algorithm,a=e.file;p(r)?n?s.loadScratchPaper(n).then(function(t){var e=t.category,r=t.algorithm,n=t.data;o.showAlgorithm(e,r,n)}):s.loadAlgorithm(r).then(function(t){o.showAlgorithm(r,null,t)}):r&&n?o.showRequestedAlgorithm(r,n,a):o.showFirstAlgorithm()})})},{"./app":3,"./app/constructor":2,"./dom":6,"./module":36,"./server":53,"./server/helpers":52,"./utils":65,rsvp:67}],28:[function(t,e,r){"use strict";var n=t("./array2d"),i=function(t,e,r){return n.random(1,t,e,r)[0]},a=function(t,e,r){return n.randomSorted(1,t,e,r)[0]};e.exports={random:i,randomSorted:a}},{"./array2d":29}],29:[function(t,e,r){"use strict";var n=function(t,e,r,n){t||(t=10),e||(e=10),void 0===r&&(r=1),void 0===n&&(n=9);for(var i=[],a=0;t>a;a++){i.push([]);for(var o=0;e>o;o++)i[a].push((Math.random()*(n-r+1)|0)+r)}return i},i=function(t,e,r,n){return(void 0).random(t,e,r,n).map(function(t){return t.sort(function(t,e){return t-e})})};e.exports={random:n,randomSorted:i}},{}],30:[function(t,e,r){"use strict";var n=function(t,e,r){t||(t=7),e||(e=1),r||(r=10);for(var n=new Array(t),i=0;t>i;i++)n[i]=new Array(2);for(var i=0;t>i;i++)for(var a=0;a<n[i].length;a++)n[i][a]=(Math.random()*(r-e+1)|0)+e;return n};e.exports={random:n}},{}],31:[function(t,e,r){"use strict";var n=function(t,e){t||(t=5),e||(e=.3);for(var r=new Array(t),n=0;t>n;n++){r[n]=new Array(t);for(var i=0;t>i;i++)n!=i&&(r[n][i]=0==(Math.random()*(1/e)|0)?1:0)}return r};e.exports={random:n}},{}],32:[function(t,e,r){"use strict";var n=t("./array1d"),i=t("./array2d"),a=t("./coordinate_system"),o=t("./directed_graph"),s=t("./undirected_graph"),c=t("./weighted_directed_graph"),u=t("./weighted_undirected_graph");e.exports={Array1D:n,Array2D:i,CoordinateSystem:a,DirectedGraph:o,UndirectedGraph:s,WeightedDirectedGraph:c,WeightedUndirectedGraph:u}},{"./array1d":28,"./array2d":29,"./coordinate_system":30,"./directed_graph":31,"./undirected_graph":33,"./weighted_directed_graph":34,"./weighted_undirected_graph":35}],33:[function(t,e,r){"use strict";var n=function(t,e){t||(t=5),e||(e=.3);for(var r=new Array(t),n=0;t>n;n++)r[n]=new Array(t);for(var n=0;t>n;n++)for(var i=0;t>i;i++)n>i&&(r[n][i]=r[i][n]=0==(Math.random()*(1/e)|0)?1:0);return r};e.exports={random:n}},{}],34:[function(t,e,r){"use strict";var n=function(t,e,r,n){t||(t=5),e||(e=.3),r||(r=1),n||(n=5);for(var i=new Array(t),a=0;t>a;a++){i[a]=new Array(t);for(var o=0;t>o;o++)a!=o&&0==(Math.random()*(1/e)|0)&&(i[a][o]=(Math.random()*(n-r+1)|0)+r)}return i};e.exports={random:n}},{}],35:[function(t,e,r){"use strict";var n=function(t,e,r,n){t||(t=5),e||(e=.3),r||(r=1),n||(n=5);for(var i=new Array(t),a=0;t>a;a++)i[a]=new Array(t);for(var a=0;t>a;a++)for(var o=0;t>o;o++)a>o&&0==(Math.random()*(1/e)|0)&&(i[a][o]=i[o][a]=(Math.random()*(n-r+1)|0)+r);return i};e.exports={random:n}},{}],36:[function(t,e,r){"use strict";var n=t("./tracer"),i=t("./data"),a=$,o=a.extend;e.exports=o(!0,{},n,i)},{"./data":32,"./tracer":42}],37:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)}var i=t("./array2d");n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"Array1DTracer",_notify:function(t,e){return i.prototype._notify.call(this,0,t,e),this},_denotify:function(t){return i.prototype._denotify.call(this,0,t),this},_select:function(t,e){return void 0===e?i.prototype._select.call(this,0,t):i.prototype._selectRow.call(this,0,t,e),this},_deselect:function(t,e){return void 0===e?i.prototype._deselect.call(this,0,t):i.prototype._deselectRow.call(this,0,t,e),this},setData:function(t){return i.prototype.setData.call(this,[t])}}),e.exports=n},{"./array2d":38}],38:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this),!0):!1}var i=t("./tracer"),a=t("../../tracer_manager/util/index"),o=a.refineByType;n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"Array2DTracer",init:function(){this.$table=this.capsule.$table=$('<div class="mtbl-table">'),this.$container.append(this.$table)},_notify:function(t,e,r){return this.manager.pushStep(this.capsule,{type:"notify",x:t,y:e,v:r}),this},_denotify:function(t,e){return this.manager.pushStep(this.capsule,{type:"denotify",x:t,y:e}),this},_select:function(t,e,r,n){return this.pushSelectingStep("select",null,arguments),this},_selectRow:function(t,e,r){return this.pushSelectingStep("select","row",arguments),this},_selectCol:function(t,e,r){return this.pushSelectingStep("select","col",arguments),this},_deselect:function(t,e,r,n){return this.pushSelectingStep("deselect",null,arguments),this},_deselectRow:function(t,e,r){return this.pushSelectingStep("deselect","row",arguments),this},_deselectCol:function(t,e,r){return this.pushSelectingStep("deselect","col",arguments),this},_separate:function(t,e){return this.manager.pushStep(this.capsule,{type:"separate",x:t,y:e}),this},_separateRow:function(t){return this._separate(t,-1),this},_separateCol:function(t){return this._separate(-1,t),this},_deseparate:function(t,e){return this.manager.pushStep(this.capsule,{type:"deseparate",x:t,y:e}),this},_deseparateRow:function(t){return this._deseparate(t,-1),this},_deseparateCol:function(t){return this._deseparate(-1,t),this},pushSelectingStep:function(){var t=Array.prototype.slice.call(arguments),e=t.shift(),r=t.shift();t=Array.prototype.slice.call(t.shift());var n;switch(r){case"row":n={x:t[0],sy:t[1],ey:t[2]};break;case"col":n={y:t[0],sx:t[1],ex:t[2]};break;default:n=void 0===t[2]&&void 0===t[3]?{x:t[0],y:t[1]}:{sx:t[0],sy:t[1],ex:t[2],ey:t[3]}}var i={type:e};$.extend(i,n),this.manager.pushStep(this.capsule,i)},processStep:function(t,e){switch(t.type){case"notify":if(void 0!==t.v){var r=this.$table.find(".mtbl-row").eq(t.x),n=r.find(".mtbl-col").eq(t.y);n.text(o(t.v))}case"denotify":case"select":case"deselect":var a="select"==t.type||"deselect"==t.type?this.colorClass.selected:this.colorClass.notified,s="select"==t.type||"notify"==t.type,c=t.sx,u=t.sy,l=t.ex,h=t.ey;void 0===c&&(c=t.x),void 0===u&&(u=t.y),void 0===l&&(l=t.x),void 0===h&&(h=t.y),this.paintColor(c,u,l,h,a,s);break;case"separate":this.deseparate(t.x,t.y),this.separate(t.x,t.y);break;case"deseparate":this.deseparate(t.x,t.y);break;default:i.prototype.processStep.call(this,t,e)}},setData:function(t){if(this.viewX=this.viewY=0,this.paddingH=6,this.paddingV=3,this.fontSize=16,i.prototype.setData.apply(this,arguments))return this.$table.find(".mtbl-row").each(function(e){$(this).find(".mtbl-col").each(function(r){$(this).text(o(t[e][r]))})}),!0;this.$table.empty();for(var e=0;e<t.length;e++){var r=$('<div class="mtbl-row">');this.$table.append(r);for(var n=0;n<t[e].length;n++){var a=$('<div class="mtbl-col">').css(this.getCellCss()).text(o(t[e][n]));r.append(a)}}return this.resize(),!1},resize:function(){i.prototype.resize.call(this),this.refresh()},clear:function(){i.prototype.clear.call(this),this.clearColor(),this.deseparateAll()},getCellCss:function(){return{padding:this.paddingV.toFixed(1)+"px "+this.paddingH.toFixed(1)+"px","font-size":this.fontSize.toFixed(1)+"px"}},refresh:function(){i.prototype.refresh.call(this);var t=this.$table.parent(),e=t.height()/2-this.$table.height()/2+this.viewY,r=t.width()/2-this.$table.width()/2+this.viewX;this.$table.css("margin-top",e),this.$table.css("margin-left",r)},mousedown:function(t){i.prototype.mousedown.call(this,t),this.dragX=t.pageX,this.dragY=t.pageY,this.dragging=!0},mousemove:function(t){i.prototype.mousemove.call(this,t),this.dragging&&(this.viewX+=t.pageX-this.dragX,this.viewY+=t.pageY-this.dragY,this.dragX=t.pageX,this.dragY=t.pageY,this.refresh())},mouseup:function(t){i.prototype.mouseup.call(this,t),this.dragging=!1},mousewheel:function(t){i.prototype.mousewheel.call(this,t),t.preventDefault(),t=t.originalEvent;var e=void 0!==t.wheelDelta&&t.wheelDelta||void 0!==t.detail&&-t.detail,r=1.01,n=e>0?1/r:r;this.fontSize<4&&1>n||this.fontSize>40&&n>1||(this.paddingV*=n,this.paddingH*=n,this.fontSize*=n,this.$table.find(".mtbl-col").css(this.getCellCss()),this.refresh())},paintColor:function(t,e,r,n,i,a){for(var o=t;r>=o;o++)for(var s=this.$table.find(".mtbl-row").eq(o),c=e;n>=c;c++){var u=s.find(".mtbl-col").eq(c);a?u.addClass(i):u.removeClass(i)}},clearColor:function(){this.$table.find(".mtbl-col").removeClass(Object.keys(this.colorClass).join(" "))},colorClass:{selected:"selected",notified:"notified"},separate:function(t,e){this.$table.find(".mtbl-row").each(function(r){var n=$(this);r==t&&n.after($('<div class="mtbl-empty-row">').attr("data-row",r)),n.find(".mtbl-col").each(function(t){var r=$(this);t==e&&r.after($('<div class="mtbl-empty-col">').attr("data-col",t))})})},deseparate:function(t,e){this.$table.find("[data-row="+t+"]").remove(),this.$table.find("[data-col="+e+"]").remove()},deseparateAll:function(){this.$table.find(".mtbl-empty-row, .mtbl-empty-col").remove()}}),e.exports=n},{"../../tracer_manager/util/index":62,"./tracer":44}],39:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this,arguments),!0):!1}var i=t("./tracer");n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"ChartTracer",init:function(){this.$wrapper=this.capsule.$wrapper=$('<canvas id="chart">'),this.$container.append(this.$wrapper)},setData:function(t){if(i.prototype.setData.apply(this,arguments))return!0;for(var e=[],r=0;r<t.length;r++)e.push("rgba(136, 136, 136, 1)");var n={type:"bar",data:{labels:t.map(String),datasets:[{backgroundColor:e,data:t}]},options:{scales:{yAxes:[{ticks:{beginAtZero:!0}}]}}};this.chart=this.capsule.chart=new Chart(this.$wrapper,n)},_notify:function(t,e){return this.manager.pushStep(this.capsule,{type:"notify",s:t,v:e}),this},_denotify:function(t){return this.manager.pushStep(this.capsule,{type:"denotify",s:t}),this},_select:function(t,e){return this.manager.pushStep(this.capsule,{type:"select",s:t,e:e}),this},_deselect:function(t,e){return this.manager.pushStep(this.capsule,{type:"deselect",s:t,e:e}),this},processStep:function(t,e){switch(t.type){case"notify":void 0!==t.v&&(this.chart.config.data.datasets[0].data[t.s]=t.v,this.chart.config.data.labels[t.s]=t.v.toString());case"denotify":case"deselect":var r="denotify"==t.type||"deselect"==t.type?"rgba(136, 136, 136, 1)":"rgba(255, 0, 0, 1)";case"select":if(void 0===r)var r="rgba(0, 0, 255, 1)";if(void 0!==t.e)for(var n=t.s;n<=t.e;n++)this.chart.config.data.datasets[0].backgroundColor[n]=r;else this.chart.config.data.datasets[0].backgroundColor[t.s]=r;this.chart.update();break;default:i.prototype.processStep.call(this,t,e)}}}),e.exports=n},{"./tracer":44}],40:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this),!0):!1}var i=t("./directed_graph");n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"CoordinateSystemTracer",init:function(){var t=this;this.s.settings({defaultEdgeType:"def",funcEdgesDef:function(e,r,n,i,a){var o=t.getColor(e,r,n,a);t.drawEdge(e,r,n,o,i,a)}})},setData:function(t){if(Tracer.prototype.setData.apply(this,arguments))return!0;this.graph.clear();for(var e=[],r=[],n=0;n<t.length;n++)e.push({id:this.n(n),x:t[n][0],y:t[n][1],label:""+n,size:1,color:this.color["default"]});return this.graph.read({nodes:e,edges:r}),this.s.camera.goTo({x:0,y:0,angle:0,ratio:1}),this.refresh(),!1},processStep:function(t,e){switch(t.type){case"visit":case"leave":var r="visit"==t.type,n=this.graph.nodes(this.n(t.target)),i=r?this.color.visited:this.color.left;if(n.color=i,void 0!==t.source){var a=this.e(t.source,t.target);if(this.graph.edges(a)){var o=this.graph.edges(a);o.color=i,this.graph.dropEdge(a).addEdge(o)}else this.graph.addEdge({id:this.e(t.target,t.source),source:this.n(t.source),target:this.n(t.target),color:i,size:1})}if(this.logTracer){var s=t.source;void 0===s&&(s=""),this.logTracer.print(r?s+" -> "+t.target:s+" <- "+t.target)}break;default:Tracer.prototype.processStep.call(this,t,e)}},e:function(t,e){if(t>e){var r=t;t=e,e=r}return"e"+t+"_"+e},drawOnHover:function(t,e,r,n){var i=this;e.setLineDash([5,5]);var a=t.id.substring(1);this.graph.edges().forEach(function(o){var s=o.id.substring(1).split("_");if(s[0]==a){var c="#0ff",u=t,l=i.graph.nodes("n"+s[1]);i.drawEdge(o,u,l,c,e,r),n&&n(o,u,l,c,e,r)}else if(s[1]==a){var c="#0ff",u=i.graph.nodes("n"+s[0]),l=t;i.drawEdge(o,u,l,c,e,r),n&&n(o,u,l,c,e,r)}})},drawEdge:function(t,e,r,n,i,a){var o=a("prefix")||"",s=t[o+"size"]||1;i.strokeStyle=n,i.lineWidth=s,i.beginPath(),i.moveTo(e[o+"x"],e[o+"y"]),i.lineTo(r[o+"x"],r[o+"y"]),i.stroke()}}),e.exports=n},{"./directed_graph":41}],41:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this),!0):!1}var i=t("./tracer");n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"DirectedGraphTracer",init:function(){var t=this;this.s=this.capsule.s=new sigma({renderer:{container:this.$container[0],type:"canvas"},settings:{minArrowSize:8,defaultEdgeType:"arrow",maxEdgeSize:2.5,labelThreshold:4,font:"Roboto",defaultLabelColor:"#fff",zoomMin:.6,zoomMax:1.2,skipErrors:!0,minNodeSize:.5,maxNodeSize:12,labelSize:"proportional",labelSizeRatio:1.3,funcLabelsDef:function(e,r,n){t.drawLabel(e,r,n)},funcHoversDef:function(e,r,n,i){t.drawOnHover(e,r,n,i)},funcEdgesArrow:function(e,r,n,i,a){var o=t.getColor(e,r,n,a);t.drawArrow(e,r,n,o,i,a)}}}),sigma.plugins.dragNodes(this.s,this.s.renderers[0]),this.graph=this.capsule.graph=this.s.graph},_setTreeData:function(t,e){return this.manager.pushStep(this.capsule,{type:"setTreeData",arguments:arguments}),this},_visit:function(t,e){return this.manager.pushStep(this.capsule,{type:"visit",target:t,source:e}),this},_leave:function(t,e){return this.manager.pushStep(this.capsule,{type:"leave",target:t,source:e}),this},processStep:function(t,e){switch(t.type){case"setTreeData":this.setTreeData.apply(this,t.arguments);break;case"visit":case"leave":var r="visit"==t.type,n=this.graph.nodes(this.n(t.target)),a=r?this.color.visited:this.color.left;if(n.color=a,void 0!==t.source){var o=this.e(t.source,t.target),s=this.graph.edges(o);s.color=a,this.graph.dropEdge(o).addEdge(s)}if(this.logTracer){var c=t.source;void 0===c&&(c=""),this.logTracer.print(r?c+" -> "+t.target:c+" <- "+t.target)}break;default:i.prototype.processStep.call(this,t,e)}},setTreeData:function(t,e){var r=this;e=e||0;var n=-1,i=new Array(t.length),a=function u(e,r){if(i[e])throw"the given graph is not a tree because it forms a circuit";i[e]=!0,r>n&&(n=r);for(var a=0;a<t[e].length;a++)t[e][a]&&u(a,r+1)};if(a(e,1),this.setData.apply(this,arguments))return!0;var o=function(t,e,n){var i=r.graph.nodes(r.n(t));i.x=e,i.y=n},s=1/(n-1),c=function l(e,r,n,i){o(e,n+i,r*s);for(var a=0,c=0;c<t[e].length;c++)t[e][c]&&a++;for(var u=(i-n)/a,h=0,c=0;c<t[e].length;c++)t[e][c]&&l(c,r+1,n+u*h,n+u*++h)};c(e,0,0,1),this.refresh()},setData:function(t){if(i.prototype.setData.apply(this,arguments))return!0;this.graph.clear();for(var e=[],r=[],n=2*Math.PI/t.length,a=0,o=0;o<t.length;o++){a+=n,e.push({id:this.n(o),label:""+o,x:.5+Math.sin(a)/2,y:.5+Math.cos(a)/2,size:1,color:this.color["default"]});for(var s=0;s<t[o].length;s++)t[o][s]&&r.push({id:this.e(o,s),source:this.n(o),target:this.n(s),color:this.color["default"],size:1})}return this.graph.read({nodes:e,edges:r}),this.s.camera.goTo({x:0,y:0,angle:0,ratio:1}),this.refresh(),!1},resize:function(){i.prototype.resize.call(this),this.s.renderers[0].resize(),this.refresh()},refresh:function(){i.prototype.refresh.call(this),this.s.refresh()},clear:function(){i.prototype.clear.call(this),this.clearGraphColor()},color:{visited:"#f00",left:"#000","default":"#888"},clearGraphColor:function(){var t=this;this.graph.nodes().forEach(function(e){e.color=t.color["default"]}),this.graph.edges().forEach(function(e){e.color=t.color["default"]})},n:function(t){return"n"+t},e:function(t,e){return"e"+t+"_"+e},getColor:function(t,e,r,n){var i=t.color,a=n("edgeColor"),o=n("defaultNodeColor"),s=n("defaultEdgeColor");if(!i)switch(a){case"source":i=e.color||o;break;case"target":i=r.color||o;break;default:
i=s}return i},drawLabel:function(t,e,r){var n,i=r("prefix")||"",a=t[i+"size"];a<r("labelThreshold")||t.label&&"string"==typeof t.label&&(n="fixed"===r("labelSize")?r("defaultLabelSize"):r("labelSizeRatio")*a,e.font=(r("fontStyle")?r("fontStyle")+" ":"")+n+"px "+r("font"),e.fillStyle="node"===r("labelColor")?t.color||r("defaultNodeColor"):r("defaultLabelColor"),e.textAlign="center",e.fillText(t.label,Math.round(t[i+"x"]),Math.round(t[i+"y"]+n/3)))},drawArrow:function(t,e,r,n,i,a){var o=a("prefix")||"",s=t[o+"size"]||1,c=r[o+"size"],u=e[o+"x"],l=e[o+"y"],h=r[o+"x"],p=r[o+"y"],f=Math.atan2(p-l,h-u),d=3;u+=Math.sin(f)*d,h+=Math.sin(f)*d,l+=-Math.cos(f)*d,p+=-Math.cos(f)*d;var g=Math.max(2.5*s,a("minArrowSize")),v=Math.sqrt(Math.pow(h-u,2)+Math.pow(p-l,2)),y=u+(h-u)*(v-g-c)/v,m=l+(p-l)*(v-g-c)/v,w=(h-u)*g/v,_=(p-l)*g/v;i.strokeStyle=n,i.lineWidth=s,i.beginPath(),i.moveTo(u,l),i.lineTo(y,m),i.stroke(),i.fillStyle=n,i.beginPath(),i.moveTo(y+w,m+_),i.lineTo(y+.6*_,m-.6*w),i.lineTo(y-.6*_,m+.6*w),i.lineTo(y+w,m+_),i.closePath(),i.fill()},drawOnHover:function(t,e,r,n){var i=this;e.setLineDash([5,5]);var a=t.id.substring(1);this.graph.edges().forEach(function(o){var s=o.id.substring(1).split("_");if(s[0]==a){var c="#0ff",u=t,l=i.graph.nodes("n"+s[1]);i.drawArrow(o,u,l,c,e,r),n&&n(o,u,l,c,e,r)}else if(s[1]==a){var c="#ff0",u=i.graph.nodes("n"+s[0]),l=t;i.drawArrow(o,u,l,c,e,r),n&&n(o,u,l,c,e,r)}})}}),sigma.canvas.labels.def=function(t,e,r){var n=r("funcLabelsDef");n&&n(t,e,r)},sigma.canvas.hovers.def=function(t,e,r){var n=r("funcHoversDef");n&&n(t,e,r)},sigma.canvas.edges.def=function(t,e,r,n,i){var a=i("funcEdgesDef");a&&a(t,e,r,n,i)},sigma.canvas.edges.arrow=function(t,e,r,n,i){var a=i("funcEdgesArrow");a&&a(t,e,r,n,i)},e.exports=n},{"./tracer":44}],42:[function(t,e,r){"use strict";var n=t("./tracer"),i=t("./log"),a=t("./array1d"),o=t("./array2d"),s=t("./chart"),c=t("./coordinate_system"),u=t("./directed_graph"),l=t("./undirected_graph"),h=t("./weighted_directed_graph"),p=t("./weighted_undirected_graph");e.exports={Tracer:n,LogTracer:i,Array1DTracer:a,Array2DTracer:o,ChartTracer:s,CoordinateSystemTracer:c,DirectedGraphTracer:u,UndirectedGraphTracer:l,WeightedDirectedGraphTracer:h,WeightedUndirectedGraphTracer:p}},{"./array1d":37,"./array2d":38,"./chart":39,"./coordinate_system":40,"./directed_graph":41,"./log":43,"./tracer":44,"./undirected_graph":45,"./weighted_directed_graph":46,"./weighted_undirected_graph":47}],43:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this),!0):!1}var i=t("./tracer");n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"LogTracer",init:function(){this.$wrapper=this.capsule.$wrapper=$('<div class="wrapper">'),this.$container.append(this.$wrapper)},_print:function(t){return this.manager.pushStep(this.capsule,{type:"print",msg:t}),this},processStep:function(t,e){switch(t.type){case"print":this.print(t.msg)}},refresh:function(){this.scrollToEnd(Math.min(50,this.interval))},clear:function(){i.prototype.clear.call(this),this.$wrapper.empty()},print:function(t){this.$wrapper.append($("<span>").append(t+"<br/>"))},scrollToEnd:function(t){this.$container.animate({scrollTop:this.$container[0].scrollHeight},t)}}),e.exports=n},{"./tracer":44}],44:[function(t,e,r){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function i(t){return this.module=this.constructor,this.capsule=this.manager.allocate(this),$.extend(this,this.capsule),this.setName(t),this.isNew}var a=t("../../tracer_manager/util/index"),o=a.toJSON,s=a.fromJSON;i.prototype={constructor:i,name:"Tracer",manager:null,_setData:function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return this.manager.pushStep(this.capsule,{type:"setData",args:o(e)}),this},_clear:function(){return this.manager.pushStep(this.capsule,{type:"clear"}),this},_wait:function(){return this.manager.newStep(),this},processStep:function(t,e){var r=t.type,i=t.args;switch(r){case"setData":this.setData.apply(this,n(s(i)));break;case"clear":this.clear()}},setName:function(t){var e=void 0;this.isNew?(e=$('<span class="name">'),this.$container.append(e)):e=this.$container.find("span.name"),e.text(t||this.defaultName)},setData:function(){var t=o(arguments);return this.isNew||this.lastData!==t?(this.isNew=this.capsule.isNew=!1,this.lastData=this.capsule.lastData=t,!1):!0},resize:function(){},refresh:function(){},clear:function(){},attach:function(t){return t.module===LogTracer&&(this.logTracer=t),this},mousedown:function(t){},mousemove:function(t){},mouseup:function(t){},mousewheel:function(t){}},e.exports=i},{"../../tracer_manager/util/index":62}],45:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this),!0):!1}var i=t("./directed_graph");n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"UndirectedGraphTracer",init:function(){var t=this;this.s.settings({defaultEdgeType:"def",funcEdgesDef:function(e,r,n,i,a){var o=t.getColor(e,r,n,a);t.drawEdge(e,r,n,o,i,a)}})},setData:function(t){if(Tracer.prototype.setData.apply(this,arguments))return!0;this.graph.clear();for(var e=[],r=[],n=2*Math.PI/t.length,i=0,a=0;a<t.length;a++)i+=n,e.push({id:this.n(a),label:""+a,x:.5+Math.sin(i)/2,y:.5+Math.cos(i)/2,size:1,color:this.color["default"]});for(var a=0;a<t.length;a++)for(var o=0;a>=o;o++)(t[a][o]||t[o][a])&&r.push({id:this.e(a,o),source:this.n(a),target:this.n(o),color:this.color["default"],size:1});return this.graph.read({nodes:e,edges:r}),this.s.camera.goTo({x:0,y:0,angle:0,ratio:1}),this.refresh(),!1},e:function(t,e){if(t>e){var r=t;t=e,e=r}return"e"+t+"_"+e},drawOnHover:function(t,e,r,n){var i=this;e.setLineDash([5,5]);var a=t.id.substring(1);this.graph.edges().forEach(function(o){var s=o.id.substring(1).split("_");if(s[0]==a){var c="#0ff",u=t,l=i.graph.nodes("n"+s[1]);i.drawEdge(o,u,l,c,e,r),n&&n(o,u,l,c,e,r)}else if(s[1]==a){var c="#0ff",u=i.graph.nodes("n"+s[0]),l=t;i.drawEdge(o,u,l,c,e,r),n&&n(o,u,l,c,e,r)}})},drawEdge:function(t,e,r,n,i,a){var o=a("prefix")||"",s=t[o+"size"]||1;i.strokeStyle=n,i.lineWidth=s,i.beginPath(),i.moveTo(e[o+"x"],e[o+"y"]),i.lineTo(r[o+"x"],r[o+"y"]),i.stroke()}}),e.exports=n},{"./directed_graph":41}],46:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this),!0):!1}var i=t("./directed_graph"),a=t("../../tracer_manager/util/index"),o=a.refineByType;n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"WeightedDirectedGraphTracer",init:function(){var t=this;this.s.settings({edgeLabelSize:"proportional",defaultEdgeLabelSize:20,edgeLabelSizePowRatio:.8,funcLabelsDef:function(e,r,n){t.drawNodeWeight(e,r,n),t.drawLabel(e,r,n)},funcHoversDef:function(e,r,n){t.drawOnHover(e,r,n,t.drawEdgeWeight)},funcEdgesArrow:function(e,r,n,i,a){var o=t.getColor(e,r,n,a);t.drawArrow(e,r,n,o,i,a),t.drawEdgeWeight(e,r,n,o,i,a)}})},_weight:function(t,e){return this.manager.pushStep(this.capsule,{type:"weight",target:t,weight:e}),this},_visit:function(t,e,r){return this.manager.pushStep(this.capsule,{type:"visit",target:t,source:e,weight:r}),this},_leave:function(t,e,r){return this.manager.pushStep(this.capsule,{type:"leave",target:t,source:e,weight:r}),this},processStep:function(t,e){switch(t.type){case"weight":var r=this.graph.nodes(this.n(t.target));void 0!==t.weight&&(r.weight=o(t.weight));break;case"visit":case"leave":var n="visit"==t.type,r=this.graph.nodes(this.n(t.target)),a=n?this.color.visited:this.color.left;if(r.color=a,void 0!==t.weight&&(r.weight=o(t.weight)),void 0!==t.source){var s=this.e(t.source,t.target),c=this.graph.edges(s);c.color=a,this.graph.dropEdge(s).addEdge(c)}if(this.logTracer){var u=t.source;void 0===u&&(u=""),this.logTracer.print(n?u+" -> "+t.target:u+" <- "+t.target)}break;default:i.prototype.processStep.call(this,t,e)}},setData:function(t){if(Tracer.prototype.setData.apply(this,arguments))return!0;this.graph.clear();for(var e=[],r=[],n=2*Math.PI/t.length,i=0,a=0;a<t.length;a++){i+=n,e.push({id:this.n(a),label:""+a,x:.5+Math.sin(i)/2,y:.5+Math.cos(i)/2,size:1,color:this.color["default"],weight:0});for(var s=0;s<t[a].length;s++)t[a][s]&&r.push({id:this.e(a,s),source:this.n(a),target:this.n(s),color:this.color["default"],size:1,weight:o(t[a][s])})}return this.graph.read({nodes:e,edges:r}),this.s.camera.goTo({x:0,y:0,angle:0,ratio:1}),this.refresh(),!1},clear:function(){i.prototype.clear.call(this),this.clearWeights()},clearWeights:function(){this.graph.nodes().forEach(function(t){t.weight=0})},drawEdgeWeight:function(t,e,r,n,i,a){if(e!=r){var o=a("prefix")||"",s=t[o+"size"]||1;if(!(s<a("edgeLabelThreshold"))){if(0===a("edgeLabelSizePowRatio"))throw'"edgeLabelSizePowRatio" must not be 0.';var c,u=(e[o+"x"]+r[o+"x"])/2,l=(e[o+"y"]+r[o+"y"])/2,h=r[o+"x"]-e[o+"x"],p=r[o+"y"]-e[o+"y"],f=Math.atan2(p,h);c="fixed"===a("edgeLabelSize")?a("defaultEdgeLabelSize"):a("defaultEdgeLabelSize")*s*Math.pow(s,-1/a("edgeLabelSizePowRatio")),i.save(),t.active?(i.font=[a("activeFontStyle"),c+"px",a("activeFont")||a("font")].join(" "),i.fillStyle=n):(i.font=[a("fontStyle"),c+"px",a("font")].join(" "),i.fillStyle=n),i.textAlign="center",i.textBaseline="alphabetic",i.translate(u,l),i.rotate(f),i.fillText(t.weight,0,-s/2-3),i.restore()}}},drawNodeWeight:function(t,e,r){var n,i=r("prefix")||"",a=t[i+"size"];a<r("labelThreshold")||(n="fixed"===r("labelSize")?r("defaultLabelSize"):r("labelSizeRatio")*a,e.font=(r("fontStyle")?r("fontStyle")+" ":"")+n+"px "+r("font"),e.fillStyle="node"===r("labelColor")?t.color||r("defaultNodeColor"):r("defaultLabelColor"),e.textAlign="left",e.fillText(t.weight,Math.round(t[i+"x"]+1.5*a),Math.round(t[i+"y"]+n/3)))}}),e.exports=n},{"../../tracer_manager/util/index":62,"./directed_graph":41}],47:[function(t,e,r){"use strict";function n(){return i.apply(this,arguments)?(n.prototype.init.call(this),!0):!1}var i=t("./weighted_directed_graph"),a=t("./undirected_graph");n.prototype=$.extend(!0,Object.create(i.prototype),{constructor:n,name:"WeightedUndirectedGraphTracer",init:function(){var t=this;this.s.settings({defaultEdgeType:"def",funcEdgesDef:function(e,r,n,i,a){var o=t.getColor(e,r,n,a);t.drawEdge(e,r,n,o,i,a),t.drawEdgeWeight(e,r,n,o,i,a)}})},setData:function(t){if(Tracer.prototype.setData.apply(this,arguments))return!0;this.graph.clear();for(var e=[],r=[],n=2*Math.PI/t.length,i=0,a=0;a<t.length;a++)i+=n,e.push({id:this.n(a),label:""+a,x:.5+Math.sin(i)/2,y:.5+Math.cos(i)/2,size:1,color:this.color["default"],weight:0});for(var a=0;a<t.length;a++)for(var o=0;a>=o;o++)(t[a][o]||t[o][a])&&r.push({id:this.e(a,o),source:this.n(a),target:this.n(o),color:this.color["default"],size:1,weight:t[a][o]});return this.graph.read({nodes:e,edges:r}),this.s.camera.goTo({x:0,y:0,angle:0,ratio:1}),this.refresh(),!1},e:a.prototype.e,drawOnHover:a.prototype.drawOnHover,drawEdge:a.prototype.drawEdge,drawEdgeWeight:function(t,e,r,n,a,o){var s=o("prefix")||"";if(e[s+"x"]>r[s+"x"]){var c=e;e=r,r=c}i.prototype.drawEdgeWeight.call(this,t,e,r,n,a,o)}}),e.exports=n},{"./undirected_graph":45,"./weighted_directed_graph":46}],48:[function(t,e,r){"use strict";var n=t("./request");e.exports=function(t){return n(t,{type:"GET"})}},{"./request":51}],49:[function(t,e,r){"use strict";var n=t("./request");e.exports=function(t){return n(t,{dataType:"json",type:"GET"})}},{"./request":51}],50:[function(t,e,r){"use strict";var n=t("./request");e.exports=function(t,e){return n(t,{dataType:"json",type:"POST",data:JSON.stringify(e)})}},{"./request":51}],51:[function(t,e,r){"use strict";var n=t("rsvp"),i=t("../../app"),a=$,o=a.ajax,s=a.extend,c={};e.exports=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return i.setIsLoading(!0),new n.Promise(function(r,n){var a={success:function(t){i.setIsLoading(!1),r(t)},error:function(t){i.setIsLoading(!1),n(t)}},u=s({},c,e,a,{url:t});o(u)})}},{"../../app":3,rsvp:67}],52:[function(t,e,r){"use strict";var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(c){i=!0,a=c}finally{try{!n&&s["return"]&&s["return"]()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=t("../app"),a=t("../dom/toast"),o=function(){return i.getIsLoading()?(a.showErrorToast("Wait until it completes loading of previous file."),!0):!1},s=function(t){var e=window.location.href,r=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)"),i=r.exec(e);if(!i||3!==i.length)return null;var a=n(i,3),o=a[2];return o},c=function(t){if(!t)return null;for(var e=window.location.hash.substr(1),r=e?e.split("&"):[],n=0;n<r.length;n++){var i=r[n].split("=");if(i[0]===t)return i[1]}return null},u=function(t,e){if(t&&e){for(var r=window.location.hash.substr(1),n=r?r.split("&"):[],i=!1,a=0;a<n.length&&!i;a++){var o=n[a].split("=");o[0]===t&&(o[1]=e,n[a]=o.join("="),i=!0)}i||n.push([t,e].join("="));var s=n.join("&");window.location.hash="#"+s}},l=function(t){if(t){for(var e=window.location.hash.substr(1),r=e?e.split("&"):[],n=0;n<r.length;n++){var i=r[n].split("=");if(i[0]===t){r.splice(n,1);break}}var a=r.join("&");window.location.hash="#"+a}},h=function(t,e,r){var n=t?t+(e?"/"+e+(r?"/"+r:""):""):"";u("path",n)},p=function(){var t=c("path");if(t){var e=t.split("/"),r=n(e,3),i=r[0],a=r[1],o=r[2];return{category:i,algorithm:a,file:o}}return!1};e.exports={checkLoading:o,getParameterByName:s,getHashValue:c,setHashValue:u,removeHashValue:l,setPath:h,getPath:p}},{"../app":3,"../dom/toast":23}],53:[function(t,e,r){"use strict";var n=t("./load_algorithm"),i=t("./load_categories"),a=t("./load_file"),o=t("./load_scratch_paper"),s=t("./share_scratch_paper");e.exports={loadAlgorithm:n,loadCategories:i,loadFile:a,loadScratchPaper:o,shareScratchPaper:s}},{"./load_algorithm":54,"./load_categories":55,"./load_file":56,"./load_scratch_paper":57,"./share_scratch_paper":58}],54:[function(t,e,r){"use strict";var n=t("./ajax/get_json"),i=t("../utils"),a=i.getAlgorithmDir;e.exports=function(t,e){var r=a(t,e);return n(r+"desc.json")}},{"../utils":65,"./ajax/get_json":49}],55:[function(t,e,r){"use strict";var n=t("./ajax/get_json");e.exports=function(){return n("./algorithm/category.json")}},{"./ajax/get_json":49}],56:[function(t,e,r){"use strict";var n=t("rsvp"),i=t("../app"),a=t("../utils"),o=a.getFileDir,s=a.isScratchPaper,c=t("./helpers"),u=c.checkLoading,l=c.setPath,h=t("./ajax/get"),p=function(t){return n.hash({data:h(t+"data.js"),code:h(t+"code.js")})},f=function(t){return i.getEditor().clearContent(),p(t).then(function(e){i.updateCachedFile(t,e),i.getEditor().setContent(e)})},d=function(t){return t&&void 0!==t.data&&void 0!==t.code};e.exports=function(t,e,r,a){return new n.Promise(function(n,c){if(u())c();else{s(t)?l(t,i.getLoadedScratch()):l(t,e,r),$("#explanation").html(a);var h=o(t,e,r);i.setLastFileUsed(h);var p=i.getCachedFile(h);d(p)?(i.getEditor().setContent(p),n()):f(h).then(n,c)}})}},{"../app":3,"../utils":65,"./ajax/get":48,"./helpers":52,rsvp:67}],57:[function(t,e,r){"use strict";var n=t("rsvp"),i=t("../app"),a=t("../utils"),o=a.getFileDir,s=t("./ajax/get_json"),c=t("./load_algorithm"),u=function(t,e){return t[e+".js"].content};e.exports=function(t){return new n.Promise(function(e,r){i.setLoadedScratch(t),s("https://api.github.com/gists/"+t).then(function(r){var n=r.files,a="scratch",s=t;c(a,s).then(function(t){var r=u(n,"data"),c=u(n,"code"),l=o(a,s,"scratch_paper");i.updateCachedFile(l,{data:r,code:c,"CREDIT.md":"Shared by an anonymous user from http://parkjs814.github.io/AlgorithmVisualizer"}),e({category:a,algorithm:s,data:t})})})})}},{"../app":3,"../utils":65,"./ajax/get_json":49,"./load_algorithm":54,rsvp:67}],58:[function(t,e,r){"use strict";var n=t("rsvp"),i=t("../app"),a=t("./ajax/post_json"),o=t("./helpers"),s=o.setPath;e.exports=function(){return new n.Promise(function(t,e){var r=i.getEditor(),n=r.dataEditor,o=r.codeEditor,c={description:"temp","public":!0,files:{"data.js":{content:n.getValue()},"code.js":{content:o.getValue()}}};a("https://api.github.com/gists",c).then(function(e){var r=e.id;i.setLoadedScratch(r),s("scratch",r);var n=location,a=n.href;$("#algorithm").html("Shared"),t(a)})})}},{"../app":3,"./ajax/post_json":50,"./helpers":52,rsvp:67}],59:[function(t,e,r){"use strict";var n=t("./manager"),i=t("../module/tracer/tracer");e.exports={init:function(){var t=new n;return i.prototype.manager=t,t}}},{"../module/tracer/tracer":44,"./manager":60}],60:[function(t,e,r){"use strict";var n=1e6,i=function(){this.timer=null,this.pause=!1,this.capsules=[],this.interval=500};i.prototype={add:function(t){var e=$('<section class="module_wrapper">');$(".module_container").append(e);var r={module:t.module,tracer:t,allocated:!0,defaultName:null,$container:e,isNew:!0};return this.capsules.push(r),r},allocate:function(t){var e=null,r=0;return $.each(this.capsules,function(n,i){return i.module!==t.module||(r++,i.allocated)?void 0:(i.tracer=t,i.allocated=!0,i.isNew=!1,e=i,!1)}),null===e&&(r++,e=this.add(t)),e.defaultName=t.name+" "+r,e.order=this.order++,e},deallocateAll:function(){this.order=0,this.reset(),$.each(this.capsules,function(t,e){e.allocated=!1})},removeUnallocated:function(){var t=!1;this.capsules=$.grep(this.capsules,function(e){var r=!e.allocated;return(e.isNew||r)&&(t=!0),r&&e.$container.remove(),!r}),t&&this.place()},place:function(){var t=this.capsules;$.each(t,function(e,r){var n=100,i=100/t.length,a=i*r.order;r.$container.css({top:a+"%",width:n+"%",height:i+"%"}),r.tracer.resize()})},resize:function(){this.command("resize")},isPause:function(){return this.pause},setInterval:function(t){$("#interval").val(t)},reset:function(){this.traces=[],this.traceIndex=-1,this.stepCnt=0,this.timer&&clearTimeout(this.timer),this.command("clear")},pushStep:function(t,e){if(this.stepCnt++>n)throw"Tracer's stack overflow";var r=this.traces.length,i=[];0===r?this.traces.push(i):i=this.traces[r-1],i.push($.extend(e,{capsule:t}))},newStep:function(){this.traces.push([])},pauseStep:function(){this.traceIndex<0||(this.pause=!0,this.timer&&clearTimeout(this.timer),$("#btn_pause").addClass("active"))},resumeStep:function(){this.pause=!1,this.step(this.traceIndex+1),$("#btn_pause").removeClass("active")},step:function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=this;if(!(isNaN(t)||t>=this.traces.length||0>t)){this.traceIndex=t;var n=this.traces[t];n.forEach(function(t){t.capsule.tracer.processStep(t,e)}),e.virtual||this.command("refresh"),this.pause||(this.timer=setTimeout(function(){r.step(t+1,e)},this.interval))}},prevStep:function(){this.command("clear");var t=this.traceIndex-1;if(0>t)return this.traceIndex=-1,void this.command("refresh");for(var e=0;t>e;e++)this.step(e,{virtual:!0});this.step(t)},nextStep:function(){this.step(this.traceIndex+1)},visualize:function(){this.traceIndex=-1,this.resumeStep()},command:function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];var n=e.shift();$.each(this.capsules,function(t,r){r.allocated&&r.tracer.module.prototype[n].apply(r.tracer,e)})},findOwner:function(t){var e=null;return $.each(this.capsules,function(r,n){return n.$container[0]===t?(e=n,!1):void 0}),e.tracer}},e.exports=i},{}],61:[function(t,e,r){"use strict";var n=JSON.parse,i=function(t){return n(t,function(t,e){return"Infinity"===e?1/0:e})};e.exports=i},{}],62:[function(t,e,r){"use strict";var n=t("./to_json"),i=t("./from_json"),a=t("./refine_by_type");e.exports={toJSON:n,fromJSON:i,refineByType:a}},{"./from_json":61,"./refine_by_type":63,"./to_json":64}],63:[function(t,e,r){"use strict";var n=function(t){return"number"==typeof t?a(t):i(t)},i=function(t){return""===t?" ":t},a=function(t){return t===1/0?"∞":t};e.exports=n},{}],64:[function(t,e,r){"use strict";var n=JSON.stringify,i=function(t){return n(t,function(t,e){return e===1/0?"Infinity":e})};e.exports=i},{}],65:[function(t,e,r){"use strict";var n=function(t,e){return"scratch"==t},i=function(t,e){return n(t)?"./algorithm/scratch_paper/":"./algorithm/"+t+"/"+e+"/"},a=function(t,e,r){return n(t)?"./algorithm/scratch_paper/":"./algorithm/"+t+"/"+e+"/"+r+"/"};e.exports={isScratchPaper:n,getAlgorithmDir:i,getFileDir:a}},{}],66:[function(t,e,r){function n(){l&&s&&(l=!1,s.length?u=s.concat(u):h=-1,u.length&&i())}function i(){if(!l){var t=setTimeout(n);l=!0;for(var e=u.length;e;){for(s=u,u=[];++h<e;)s&&s[h].run();h=-1,e=u.length}s=null,l=!1,clearTimeout(t)}}function a(t,e){this.fun=t,this.array=e}function o(){}var s,c=e.exports={},u=[],l=!1,h=-1;c.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new a(t,e)),1!==u.length||l||setTimeout(i,0)},a.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=o,c.addListener=o,c.once=o,c.off=o,c.removeListener=o,c.removeAllListeners=o,c.emit=o,c.binding=function(t){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(t){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],67:[function(t,e,r){(function(r,n){(function(){"use strict";function i(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(){}function c(t,e){for(var r=0,n=t.length;n>r;r++)if(t[r]===e)return r;return-1}function u(t){var e=t._promiseCallbacks;return e||(e=t._promiseCallbacks={}),e}function l(t,e){return"onerror"===t?void Ct.on("error",e):2!==arguments.length?Ct[t]:void(Ct[t]=e)}function h(){setTimeout(function(){for(var t,e=0;e<Et.length;e++){t=Et[e];var r=t.payload;r.guid=r.key+r.id,r.childGuid=r.key+r.childId,r.error&&(r.stack=r.error.stack),Ct.trigger(t.name,t.payload)}Et.length=0},50)}function p(t,e,r){1===Et.push({name:t,payload:{key:e._guidKey,id:e._id,eventName:t,detail:e._result,childId:r&&r._id,label:e._label,timeStamp:$t(),error:Ct["instrument-with-stack"]?new Error(e._label):null}})&&h()}function f(t,e,r){var n=this,i=n._state;if(i===Ft&&!t||i===Rt&&!e)return Ct.instrument&&At("chained",n,n),n;n._onError=null;var a=new n.constructor(S,r),o=n._result;if(Ct.instrument&&At("chained",n,a),i){var s=arguments[i-1];Ct.async(function(){N(i,a,s,o)})}else z(n,a,t,e);return a}function d(t,e){var r=this;if(t&&"object"==typeof t&&t.constructor===r)return t;var n=new r(S,e);return M(n,t),n}function g(t,e,r){return t===Ft?{state:"fulfilled",value:r}:{state:"rejected",reason:r}}function v(t,e,r,n){this._instanceConstructor=t,this.promise=new t(S,n),this._abortOnReject=r,this._validateInput(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._init(),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&k(this.promise,this._result))):L(this.promise,this._validationError())}function y(t,e){return new jt(this,t,!0,e).promise}function m(t,e){function r(t){M(a,t)}function n(t){L(a,t)}var i=this,a=new i(S,e);if(!xt(t))return L(a,new TypeError("You must pass an array to race.")),a;for(var o=t.length,s=0;a._state===Nt&&o>s;s++)z(i.resolve(t[s]),void 0,r,n);return a}function w(t,e){var r=this,n=new r(S,e);return L(n,t),n}function _(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function b(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function x(t,e){this._id=Pt++,this._label=e,this._state=void 0,this._result=void 0,this._subscribers=[],Ct.instrument&&At("created",this),S!==t&&("function"!=typeof t&&_(),this instanceof x?F(this,t):b())}function $(){return new TypeError("A promises callback cannot return that same promise.")}function S(){}function T(t){try{return t.then}catch(e){return Wt.error=e,Wt}}function C(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function E(t,e,r){Ct.async(function(t){var n=!1,i=C(r,e,function(r){n||(n=!0,e!==r?M(t,r,void 0):k(t,r))},function(e){n||(n=!0,L(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,L(t,i))},t)}function A(t,e){e._state===Ft?k(t,e._result):e._state===Rt?(e._onError=null,L(t,e._result)):z(e,void 0,function(r){e!==r?M(t,r,void 0):k(t,r)},function(e){L(t,e)})}function D(t,e,r){e.constructor===t.constructor&&r===Dt&&constructor.resolve===Mt?A(t,e):r===Wt?L(t,Wt.error):void 0===r?k(t,e):a(r)?E(t,e,r):k(t,e)}function M(t,e){t===e?k(t,e):i(e)?D(t,e,T(e)):k(t,e)}function j(t){t._onError&&t._onError(t._result),O(t)}function k(t,e){t._state===Nt&&(t._result=e,t._state=Ft,0===t._subscribers.length?Ct.instrument&&At("fulfilled",t):Ct.async(O,t))}function L(t,e){t._state===Nt&&(t._state=Rt,t._result=e,Ct.async(j,t))}function z(t,e,r,n){var i=t._subscribers,a=i.length;t._onError=null,i[a]=e,i[a+Ft]=r,i[a+Rt]=n,0===a&&t._state&&Ct.async(O,t)}function O(t){var e=t._subscribers,r=t._state;if(Ct.instrument&&At(r===Ft?"fulfilled":"rejected",t),0!==e.length){for(var n,i,a=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+r],n?N(r,n,i,a):i(a);t._subscribers.length=0}}function P(){this.error=null}function I(t,e){try{return t(e)}catch(r){return Ut.error=r,Ut}}function N(t,e,r,n){var i,o,s,c,u=a(r);if(u){if(i=I(r,n),i===Ut?(c=!0,o=i.error,i=null):s=!0,e===i)return void L(e,$())}else i=n,s=!0;e._state!==Nt||(u&&s?M(e,i):c?L(e,o):t===Ft?k(e,i):t===Rt&&L(e,i))}function F(t,e){var r=!1;try{e(function(e){r||(r=!0,M(t,e))},function(e){r||(r=!0,L(t,e))})}catch(n){L(t,n)}}function R(t,e,r){this._superConstructor(t,e,!1,r)}function W(t,e){return new R(It,t,e).promise}function U(t,e){return It.all(t,e)}function q(t,e){te[Yt]=t,te[Yt+1]=e,Yt+=2,2===Yt&&Vt()}function V(){var t=r.nextTick,e=r.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(e)&&"0"===e[1]&&"10"===e[2]&&(t=setImmediate),function(){t(J)}}function G(){return function(){qt(J)}}function H(){var t=0,e=new Kt(J),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function Y(){var t=new MessageChannel;return t.port1.onmessage=J,function(){t.port2.postMessage(0)}}function X(){return function(){setTimeout(J,1)}}function J(){for(var t=0;Yt>t;t+=2){var e=te[t],r=te[t+1];e(r),te[t]=void 0,te[t+1]=void 0}Yt=0}function B(){try{var e=t,r=e("vertx");return qt=r.runOnLoop||r.runOnContext,G()}catch(n){return X()}}function K(t){var e={};return e.promise=new It(function(t,r){e.resolve=t,e.reject=r},t),e}function Z(t,e,r){return It.all(t,r).then(function(t){if(!a(e))throw new TypeError("You must pass a function as filter's second argument.");for(var n=t.length,i=new Array(n),o=0;n>o;o++)i[o]=e(t[o]);return It.all(i,r).then(function(e){for(var r=new Array(n),i=0,a=0;n>a;a++)e[a]&&(r[i]=t[a],i++);return r.length=i,r})})}function Q(t,e,r){this._superConstructor(t,e,!0,r)}function tt(t,e,r){this._superConstructor(t,e,!1,r)}function et(t,e){return new tt(It,t,e).promise}function rt(t,e){return new ne(It,t,e).promise}function nt(t,e,r){return It.all(t,r).then(function(t){if(!a(e))throw new TypeError("You must pass a function as map's second argument.");for(var n=t.length,i=new Array(n),o=0;n>o;o++)i[o]=e(t[o]);return It.all(i,r)})}function it(){this.value=void 0}function at(t){try{return t.then}catch(e){return ce.value=e,ce}}function ot(t,e,r){try{t.apply(e,r)}catch(n){return ce.value=n,ce}}function st(t,e){for(var r,n,i={},a=t.length,o=new Array(a),s=0;a>s;s++)o[s]=t[s];for(n=0;n<e.length;n++)r=e[n],i[r]=o[n+1];return i}function ct(t){for(var e=t.length,r=new Array(e-1),n=1;e>n;n++)r[n-1]=t[n];return r}function ut(t,e){return{then:function(r,n){return t.call(e,r,n)}}}function lt(t,e){var r=function(){for(var r,n=this,i=arguments.length,a=new Array(i+1),o=!1,s=0;i>s;++s){if(r=arguments[s],!o){if(o=ft(r),o===ue){var c=new It(S);return L(c,ue.value),c}o&&o!==!0&&(r=ut(o,r))}a[s]=r}var u=new It(S);return a[i]=function(t,r){t?L(u,t):void 0===e?M(u,r):e===!0?M(u,ct(arguments)):xt(e)?M(u,st(arguments,e)):M(u,r)},o?pt(u,a,t,n):ht(u,a,t,n)};return r.__proto__=t,r}function ht(t,e,r,n){var i=ot(r,n,e);return i===ce&&L(t,i.value),t}function pt(t,e,r,n){return It.all(e).then(function(e){var i=ot(r,n,e);return i===ce&&L(t,i.value),t})}function ft(t){return t&&"object"==typeof t?t.constructor===It?!0:at(t):!1}function dt(t,e){return It.race(t,e)}function gt(t,e){return It.reject(t,e)}function vt(t,e){return It.resolve(t,e)}function yt(t){throw setTimeout(function(){throw t}),t}function mt(t,e){Ct.async(t,e)}function wt(){Ct.on.apply(Ct,arguments)}function _t(){Ct.off.apply(Ct,arguments)}var bt;bt=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var xt=bt,$t=Date.now||function(){return(new Date).getTime()},St=Object.create||function(t){if(arguments.length>1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return s.prototype=t,new s},Tt={mixin:function(t){return t.on=this.on,t.off=this.off,t.trigger=this.trigger,t._promiseCallbacks=void 0,t},on:function(t,e){if("function"!=typeof e)throw new TypeError("Callback must be a function");var r,n=u(this);r=n[t],r||(r=n[t]=[]),-1===c(r,e)&&r.push(e)},off:function(t,e){var r,n,i=u(this);return e?(r=i[t],n=c(r,e),void(-1!==n&&r.splice(n,1))):void(i[t]=[])},trigger:function(t,e,r){var n,i,a=u(this);if(n=a[t])for(var o=0;o<n.length;o++)(i=n[o])(e,r)}},Ct={instrument:!1};Tt.mixin(Ct);var Et=[],At=p,Dt=f,Mt=d,jt=v;v.prototype._validateInput=function(t){return xt(t)},v.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},v.prototype._init=function(){this._result=new Array(this.length)},v.prototype._enumerate=function(){for(var t=this.length,e=this.promise,r=this._input,n=0;e._state===Nt&&t>n;n++)this._eachEntry(r[n],n)},v.prototype._settleMaybeThenable=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===Mt){var i=T(t);if(i===Dt&&t._state!==Nt)t._onError=null,this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=this._makeResult(Ft,e,t);else if(r===It){var a=new r(S);D(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new r(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},v.prototype._eachEntry=function(t,e){o(t)?this._settleMaybeThenable(t,e):(this._remaining--,this._result[e]=this._makeResult(Ft,e,t))},v.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===Nt&&(this._remaining--,this._abortOnReject&&t===Rt?L(n,r):this._result[e]=this._makeResult(t,e,r)),0===this._remaining&&k(n,this._result)},v.prototype._makeResult=function(t,e,r){return r},v.prototype._willSettleAt=function(t,e){var r=this;z(t,void 0,function(t){r._settledAt(Ft,e,t)},function(t){r._settledAt(Rt,e,t)})};var kt=y,Lt=m,zt=w,Ot="rsvp_"+$t()+"-",Pt=0,It=x;x.cast=Mt,x.all=kt,x.race=Lt,x.resolve=Mt,x.reject=zt,x.prototype={constructor:x,_guidKey:Ot,_onError:function(t){var e=this;Ct.after(function(){e._onError&&Ct.trigger("error",t,e._label)})},then:Dt,"catch":function(t,e){return this.then(void 0,t,e)},"finally":function(t,e){var r=this,n=r.constructor;return r.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){return n.reject(e)})},e)}};var Nt=void 0,Ft=1,Rt=2,Wt=new P,Ut=new P;R.prototype=St(jt.prototype),R.prototype._superConstructor=jt,R.prototype._makeResult=g,R.prototype._validationError=function(){return new Error("allSettled must be called with an array")};var qt,Vt,Gt=W,Ht=U,Yt=0,Xt=({}.toString,q),Jt="undefined"!=typeof window?window:void 0,Bt=Jt||{},Kt=Bt.MutationObserver||Bt.WebKitMutationObserver,Zt="undefined"==typeof self&&"undefined"!=typeof r&&"[object process]"==={}.toString.call(r),Qt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);
Vt=Zt?V():Kt?H():Qt?Y():void 0===Jt&&"function"==typeof t?B():X();var ee=K,re=Z,ne=Q;Q.prototype=St(jt.prototype),Q.prototype._superConstructor=jt,Q.prototype._init=function(){this._result={}},Q.prototype._validateInput=function(t){return t&&"object"==typeof t},Q.prototype._validationError=function(){return new Error("Promise.hash must be called with an object")},Q.prototype._enumerate=function(){var t=this,e=t.promise,r=t._input,n=[];for(var i in r)e._state===Nt&&Object.prototype.hasOwnProperty.call(r,i)&&n.push({position:i,entry:r[i]});var a=n.length;t._remaining=a;for(var o,s=0;e._state===Nt&&a>s;s++)o=n[s],t._eachEntry(o.entry,o.position)},tt.prototype=St(ne.prototype),tt.prototype._superConstructor=jt,tt.prototype._makeResult=g,tt.prototype._validationError=function(){return new Error("hashSettled must be called with an object")};var ie,ae=et,oe=rt,se=nt,ce=new it,ue=new it,le=lt;if("object"==typeof self)ie=self;else{if("object"!=typeof n)throw new Error("no global: `self` or `global` found");ie=n}var he=ie,pe=dt,fe=gt,de=vt,ge=yt;Ct.async=Xt,Ct.after=function(t){setTimeout(t,0)};if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){var ve=window.__PROMISE_INSTRUMENTATION__;l("instrument",!0);for(var ye in ve)ve.hasOwnProperty(ye)&&wt(ye,ve[ye])}var me={race:pe,Promise:It,allSettled:Gt,hash:oe,hashSettled:ae,denodeify:le,on:wt,off:_t,map:se,filter:re,resolve:de,reject:fe,all:Ht,rethrow:ge,defer:ee,EventTarget:Tt,configure:l,async:mt};"function"==typeof define&&define.amd?define(function(){return me}):"undefined"!=typeof e&&e.exports?e.exports=me:"undefined"!=typeof he&&(he.RSVP=me)}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:66}]},{},[27]);
//# sourceMappingURL=algorithm_visualizer.min.js.map