diff --git a/client/galaxy/scripts/mvc/workflow/workflow-canvas.js b/client/galaxy/scripts/mvc/workflow/workflow-canvas.js index f1417aac7a9..ef5b1a52d9f 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-canvas.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-canvas.js @@ -7,6 +7,8 @@ function CanvasManager(app, canvas_viewport, overview) { this.ov = overview.find("#overview-viewport"); // Make overview box draggable this.init_drag(); + // Initialize Copy & Paste events + this.init_copy_paste(); } $.extend(CanvasManager.prototype, { init_drag: function() { @@ -96,6 +98,27 @@ $.extend(CanvasManager.prototype, { only be done by dragging the borders */ $("#overview-border div").bind("drag", () => {}); }, + init_copy_paste: function() { + document.addEventListener('copy', (e) => { + if (this.app.workflow.active_node) { + e.clipboardData.setData('application/json', JSON.stringify({ + nodeId: this.app.workflow.active_node.id + })); + } + e.preventDefault(); + }); + + document.addEventListener('paste', (e) => { + var nodeId; + try { + nodeId = JSON.parse(e.clipboardData.getData('application/json')).nodeId; + } catch (error) {} + if (nodeId && this.app.workflow.nodes.hasOwnProperty(nodeId)) { + this.app.workflow.nodes[nodeId].clone(); + } + e.preventDefault(); + }); + }, update_viewport_overlay: function() { var cc = this.cc; var cv = this.cv; diff --git a/client/galaxy/scripts/mvc/workflow/workflow-node.js b/client/galaxy/scripts/mvc/workflow/workflow-node.js index a14919d35e3..cb4771f8f28 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-node.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-node.js @@ -1,3 +1,4 @@ +import Utils from "utils/utils"; import NodeView from "mvc/workflow/workflow-view-node"; var Node = Backbone.Model.extend({ initialize: function(app, attr) { @@ -129,6 +130,33 @@ var Node = Backbone.Model.extend({ t.redraw(); }); }, + clone: function() { + var copiedData = { + name: this.name, + label: this.label, + annotation: this.annotation, + post_job_actions: this.post_job_actions + }; + var node = this.app.workflow.create_node( + this.type, this.name, this.content_id + ); + + Utils.request({ + type: "POST", + url: `${Galaxy.root}api/workflows/build_module`, + data: { + type: this.type, + tool_id: this.content_id, + inputs: this.tool_state + }, + success: (data) => { + var newData = Object.assign({}, data, copiedData); + node.init_field_data(newData); + node.update_field_data(newData); + this.app.workflow.activate_node(node); + } + }); + }, destroy: function() { $.each(this.input_terminals, (k, t) => { t.destroy(); diff --git a/client/galaxy/scripts/mvc/workflow/workflow-view.js b/client/galaxy/scripts/mvc/workflow/workflow-view.js index 938cccdbe95..2c79f499fef 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-view.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-view.js @@ -763,6 +763,13 @@ export default Backbone.View.extend({ // Fix width to computed width // Now add floats var buttons = $("
"); + buttons.append( + $("
") + .addClass("fa-icon-button fa fa-files-o") + .click(e => { + node.clone(); + }) + ); buttons.append( $("
") .addClass("fa-icon-button fa fa-times") diff --git a/client/yarn.lock b/client/yarn.lock index 4b4cd79f60d..f206aa1f837 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -2249,11 +2249,7 @@ ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" -electron-to-chromium@^1.2.7: - version "1.3.27" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" - -electron-to-chromium@^1.3.24: +electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.24: version "1.3.25" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz#453b21009836d0997d86035601ff6cae4791c460" @@ -2482,9 +2478,9 @@ espower-location-detector@^1.0.0: source-map "^0.5.0" xtend "^4.0.0" -esprima@^1.0.3: - version "1.2.5" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.2.5.tgz#0993502feaf668138325756f30f9a51feeec11e9" +esprima@^1.0.3, "esprima@~ 1.0.2", esprima@~1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad" esprima@^2.6.0: version "2.7.3" @@ -2494,10 +2490,6 @@ esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" -"esprima@~ 1.0.2", esprima@~1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad" - esprima@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.1.1.tgz#5b6f1547f4d102e670e140c509be6771d6aeb549" @@ -4795,7 +4787,7 @@ minimatch@~0.2.11, minimatch@~0.2.12: lru-cache "2" sigmund "~1.0.0" -minimist@0.0.8: +minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -4803,10 +4795,6 @@ minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - mkdirp@0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" @@ -5222,7 +5210,7 @@ os-locale@^2.0.0: lcid "^1.0.0" mem "^1.1.0" -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2: +os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -5906,11 +5894,7 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^1.7.0: - version "1.8.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.1.tgz#91064d778c08c85ac1cbe6b23195c34310d039f9" - -prettier@^1.7.4: +prettier@^1.7.0, prettier@^1.7.4: version "1.8.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.2.tgz#bff83e7fd573933c607875e5ba3abbdffb96aeb8" @@ -6075,16 +6059,7 @@ raw-body@2.3.2: iconv-lite "0.4.19" unpipe "1.0.0" -rc@^1.0.1, rc@^1.1.6: - version "1.2.2" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -rc@^1.1.7: +rc@^1.0.1, rc@^1.1.6, rc@^1.1.7: version "1.2.1" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" dependencies: @@ -6145,7 +6120,7 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -readable-stream@1.1: +readable-stream@1.1, readable-stream@~1.1.9: version "1.1.13" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" dependencies: @@ -6175,15 +6150,6 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable string_decoder "~1.0.3" util-deprecate "~1.0.1" -readable-stream@~1.1.9: - version "1.1.14" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readdirp@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" @@ -6418,13 +6384,7 @@ resolve@1.3.2: dependencies: path-parse "^1.0.5" -resolve@^1.1.6, resolve@^1.1.7: - version "1.4.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" - dependencies: - path-parse "^1.0.5" - -resolve@^1.4.0: +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.4.0: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: @@ -6722,7 +6682,11 @@ source-map@0.1.34: dependencies: amdefine ">=0.0.4" -source-map@0.X, "source-map@>= 0.1.2", source-map@^0.6.1: +source-map@0.X, source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +"source-map@>= 0.1.2", source-map@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" @@ -6732,10 +6696,6 @@ source-map@^0.1.38, source-map@^0.1.40, source-map@~0.1.33, source-map@~0.1.7: dependencies: amdefine ">=0.0.4" -source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - source-map@~0.4.1: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" @@ -6988,18 +6948,12 @@ supports-color@^3.1.0, supports-color@^3.2.3: dependencies: has-flag "^1.0.0" -supports-color@^4.0.0, supports-color@^4.4.0: +supports-color@^4.0.0, supports-color@^4.2.1, supports-color@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" dependencies: has-flag "^2.0.0" -supports-color@^4.2.1: - version "4.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" - dependencies: - has-flag "^2.0.0" - svgo@^0.7.0: version "0.7.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5" @@ -7148,18 +7102,12 @@ tiny-lr-fork@0.0.5: noptify "~0.0.3" qs "~0.5.2" -tmp@0.0.31: +tmp@0.0.31, tmp@0.0.x: version "0.0.31" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" dependencies: os-tmpdir "~1.0.1" -tmp@0.0.x: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - dependencies: - os-tmpdir "~1.0.2" - to-array@0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890" diff --git a/static/scripts/bundled/extended.bundled.js b/static/scripts/bundled/extended.bundled.js index 4ecc647af37..bda2e3d8f54 100644 --- a/static/scripts/bundled/extended.bundled.js +++ b/static/scripts/bundled/extended.bundled.js @@ -41,9 +41,9 @@ if(n.core.selected)return s=this,this.deselect_all(),e.each(n.core.selected,func w1 = oi.width() * oi.length, w2 = ai.width() * ai.length, */ -s=n,l=e("
",{css:{position:"absolute",top:"-200px",left:i?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),c=e("",{value:s,class:"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(){var n=o.children(".jstree-rename-input"),i=n.val();""===i&&(i=s),l.remove(),o.replaceWith(a),o.remove(),this.set_text(t,s),!1===this.rename_node(t,e("
").text(i)[this.settings.core.force_text?"text":"html"]())&&this.set_text(t,s)},this),keydown:function(e){var t=e.which;27===t&&(this.value=s),27!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&32!==t||e.stopImmediatePropagation(),27!==t&&13!==t||(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){c.width(Math.min(l.text("pW"+this.value).width(),r))},keypress:function(e){if(13===e.which)return!1}}),d={fontFamily:a.css("fontFamily")||"",fontSize:a.css("fontSize")||"",fontWeight:a.css("fontWeight")||"",fontStyle:a.css("fontStyle")||"",fontStretch:a.css("fontStretch")||"",fontVariant:a.css("fontVariant")||"",letterSpacing:a.css("letterSpacing")||"",wordSpacing:a.css("wordSpacing")||""};o.attr("class",a.attr("class")).append(a.contents().clone()).append(c),a.replaceWith(o),l.css(d),c.css(d).width(Math.min(l.text("pW"+c[0].value).width(),r))[0].select()},set_theme:function(t,n){if(!t)return!1;if(!0===n){var i=this.settings.core.themes.dir;i||(i=e.jstree.path+"/themes"),n=i+"/"+t+"/style.css"}n&&-1===e.inArray(n,l)&&(e("head").append(''),l.push(n)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},set_icon:function(t,n){var i,r,a,o;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;i250)&&e.vakata.context.hide()},this)),e(document).on("context_hide.vakata",e.proxy(function(){this._data.contextmenu.visible=!1},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),i.teardown.call(this)},this.show_contextmenu=function(n,i,r,a){if(!(n=this.get_node(n))||"#"===n.id)return!1;var o=this.settings.contextmenu,s=this.get_node(n,!0),l=s.children(".jstree-anchor"),c=!1,d=!1;(o.show_at_node||i===t||r===t)&&(c=l.offset(),i=c.left,r=c.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(n)&&this.activate_node(n,a),d=o.items,e.isFunction(d)&&(d=d.call(this,n,e.proxy(function(e){this._show_contextmenu(n,i,r,e)},this))),e.isPlainObject(d)&&this._show_contextmenu(n,i,r,d)},this._show_contextmenu=function(t,n,i,r){var a=this.get_node(t,!0),o=a.children(".jstree-anchor");e(document).one("context_show.vakata",e.proxy(function(t,n){var i="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(n.element).addClass(i)},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(o,{x:n,y:i},r),this.trigger("show_contextmenu",{node:t,x:n,y:i})}},function(e){var t=!1,n={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(document).triggerHandler("context_"+t+".vakata",{reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_execute:function(t){return!(!(t=n.items[t])||t._disabled&&(!e.isFunction(t._disabled)||t._disabled({item:t,reference:n.reference,element:n.element}))||!t.action)&&t.action.call(null,{item:t,reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_parse:function(t,i){if(!t)return!1;i||(n.html="",n.items=[]);var r,a="",o=!1;return i&&(a+=""),i||(n.html=a,e.vakata.context._trigger("parse")),a.length>10&&a},_show_submenu:function(n){if(n=e(n),n.length&&n.children("ul").length){var i=n.children("ul"),r=n.offset().left+n.outerWidth(),a=n.offset().top,o=i.width(),s=i.height(),l=e(window).width()+e(window).scrollLeft(),c=e(window).height()+e(window).scrollTop();t?n[r-(o+10+n.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):n[r+o+10>l?"addClass":"removeClass"]("vakata-context-right"),a+s+10>c&&i.css("bottom","-1px"),i.show()}},show:function(i,r,a){var o,s,l,c,d,u,h,f;switch(n.element&&n.element.length&&n.element.width(""),!0){case!r&&!i:return!1;case!!r&&!!i:n.reference=i,n.position_x=r.x,n.position_y=r.y;break;case!r&&!!i:n.reference=i,o=i.offset(),n.position_x=o.left+i.outerHeight(),n.position_y=o.top;break;case!!r&&!i:n.position_x=r.x,n.position_y=r.y}i&&!a&&e(i).data("vakata_contextmenu")&&(a=e(i).data("vakata_contextmenu")),e.vakata.context._parse(a)&&n.element.html(n.html),n.items.length&&(s=n.element,l=n.position_x,c=n.position_y,d=s.width(),u=s.height(),h=e(window).width()+e(window).scrollLeft(),f=e(window).height()+e(window).scrollTop(),t&&(l-=s.outerWidth())h&&(l=h-(d+20)),c+u+20>f&&(c=f-(u+20)),n.element.css({left:l,top:c}).show().find("a:eq(0)").focus().parent().addClass("vakata-context-hover"),n.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){n.is_visible&&(n.element.hide().find("ul").hide().end().find(":focus").blur(),n.is_visible=!1,e.vakata.context._trigger("hide"))}},e(function(){t="rtl"===e("body").css("direction");var i=!1;n.element=e("
    "),n.element.on("mouseenter","li",function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(i&&clearTimeout(i),n.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))}).on("mouseleave","li",function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(t){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(i=setTimeout(function(t){return function(){e.vakata.context.hide()}}(),e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||!1===e.vakata.context._execute(e(this).attr("rel"))||e.vakata.context.hide()}).on("keydown","a",function(t){var i=null;switch(t.which){case 13:case 32:t.type="mouseup",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:n.is_visible&&(n.element.find(".vakata-context-hover").last().parents("li:eq(0)").find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:n.is_visible&&(i=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),i.length||(i=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:n.is_visible&&(n.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:n.is_visible&&(i=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),i.length||(i=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault()}}).on("keydown",function(e){e.preventDefault();var t=n.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.mouseup()}).appendTo("body"),e(document).on("mousedown",function(t){n.is_visible&&!e.contains(n.element[0],t.target)&&e.vakata.context.hide()}).on("context_show.vakata",function(e,i){n.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&n.element.addClass("vakata-context-rtl").css("direction","rtl"),n.element.find("ul").hide().end()})})}(e),e.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0},e.jstree.plugins.dnd=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("mousedown.jstree touchstart.jstree",".jstree-anchor",e.proxy(function(t){var n=this.get_node(t.target),i=this.is_selected(n)?this.get_selected().length:1;if(n&&n.id&&"#"!==n.id&&(1===t.which||"touchstart"===t.type)&&(!0===this.settings.dnd.is_draggable||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,i>1?this.get_selected(!0):[n])))return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,{jstree:!0,origin:this,obj:this.get_node(n,!0),nodes:i>1?this.get_selected():[n.id]},'
    '+(i>1?i+" "+this.get_string("nodes"):this.get_text(t.currentTarget,!0))+'
    ')},this))}},e(function(){var t=!1,n=!1,i=!1,r=e('
     
    ').hide().appendTo("body");e(document).bind("dnd_start.vakata",function(e,n){t=!1}).bind("dnd_move.vakata",function(a,o){if(i&&clearTimeout(i),o&&o.data&&o.data.jstree&&(!o.event.target.id||"jstree-marker"!==o.event.target.id)){var s,l,c,d,u,h,f,p,_,g,m,v,y,b,w=e.jstree.reference(o.event.target),x=!1,k=!1,M=!1;if(w&&w._data&&w._data.dnd)if(r.attr("class","jstree-"+w.get_theme()+(w.settings.core.themes.responsive?" jstree-dnd-responsive":"")),o.helper.children().attr("class","jstree-"+w.get_theme()+(w.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy:eq(0)")[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"show":"hide"](),o.event.target!==w.element[0]&&o.event.target!==w.get_container_ul()[0]||0!==w.get_container_ul().children().length){if((x=e(o.event.target).closest(".jstree-anchor"))&&x.length&&x.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(k=x.offset(),M=o.event.pageY-k.top,c=x.height(),h=Mc-c/3?["a","i","b"]:M>c/2?["i","a","b"]:["i","b","a"],e.each(h,function(a,M){switch(M){case"b":s=k.left-6,l=k.top,d=w.get_parent(x),u=x.parent().index();break;case"i":y=w.settings.dnd.inside_pos,b=w.get_node(x.parent()),s=k.left-2,l=k.top+c/2+1,d=b.id,u="first"===y?0:"last"===y?b.children.length:Math.min(y,b.children.length);break;case"a":s=k.left-6,l=k.top+c,d=w.get_parent(x),u=x.parent().index()+1}for(/*! +s=n,l=e("
    ",{css:{position:"absolute",top:"-200px",left:i?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),c=e("",{value:s,class:"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(){var n=o.children(".jstree-rename-input"),i=n.val();""===i&&(i=s),l.remove(),o.replaceWith(a),o.remove(),this.set_text(t,s),!1===this.rename_node(t,e("
    ").text(i)[this.settings.core.force_text?"text":"html"]())&&this.set_text(t,s)},this),keydown:function(e){var t=e.which;27===t&&(this.value=s),27!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&32!==t||e.stopImmediatePropagation(),27!==t&&13!==t||(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){c.width(Math.min(l.text("pW"+this.value).width(),r))},keypress:function(e){if(13===e.which)return!1}}),d={fontFamily:a.css("fontFamily")||"",fontSize:a.css("fontSize")||"",fontWeight:a.css("fontWeight")||"",fontStyle:a.css("fontStyle")||"",fontStretch:a.css("fontStretch")||"",fontVariant:a.css("fontVariant")||"",letterSpacing:a.css("letterSpacing")||"",wordSpacing:a.css("wordSpacing")||""};o.attr("class",a.attr("class")).append(a.contents().clone()).append(c),a.replaceWith(o),l.css(d),c.css(d).width(Math.min(l.text("pW"+c[0].value).width(),r))[0].select()},set_theme:function(t,n){if(!t)return!1;if(!0===n){var i=this.settings.core.themes.dir;i||(i=e.jstree.path+"/themes"),n=i+"/"+t+"/style.css"}n&&-1===e.inArray(n,l)&&(e("head").append(''),l.push(n)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},set_icon:function(t,n){var i,r,a,o;if(e.isArray(t)){for(t=t.slice(),i=0,r=t.length;i250)&&e.vakata.context.hide()},this)),e(document).on("context_hide.vakata",e.proxy(function(){this._data.contextmenu.visible=!1},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),i.teardown.call(this)},this.show_contextmenu=function(n,i,r,a){if(!(n=this.get_node(n))||"#"===n.id)return!1;var o=this.settings.contextmenu,s=this.get_node(n,!0),l=s.children(".jstree-anchor"),c=!1,d=!1;(o.show_at_node||i===t||r===t)&&(c=l.offset(),i=c.left,r=c.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(n)&&this.activate_node(n,a),d=o.items,e.isFunction(d)&&(d=d.call(this,n,e.proxy(function(e){this._show_contextmenu(n,i,r,e)},this))),e.isPlainObject(d)&&this._show_contextmenu(n,i,r,d)},this._show_contextmenu=function(t,n,i,r){var a=this.get_node(t,!0),o=a.children(".jstree-anchor");e(document).one("context_show.vakata",e.proxy(function(t,n){var i="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(n.element).addClass(i)},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(o,{x:n,y:i},r),this.trigger("show_contextmenu",{node:t,x:n,y:i})}},function(e){var t=!1,n={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(document).triggerHandler("context_"+t+".vakata",{reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_execute:function(t){return!(!(t=n.items[t])||t._disabled&&(!e.isFunction(t._disabled)||t._disabled({item:t,reference:n.reference,element:n.element}))||!t.action)&&t.action.call(null,{item:t,reference:n.reference,element:n.element,position:{x:n.position_x,y:n.position_y}})},_parse:function(t,i){if(!t)return!1;i||(n.html="",n.items=[]);var r,a="",o=!1;return i&&(a+=""),i||(n.html=a,e.vakata.context._trigger("parse")),a.length>10&&a},_show_submenu:function(n){if(n=e(n),n.length&&n.children("ul").length){var i=n.children("ul"),r=n.offset().left+n.outerWidth(),a=n.offset().top,o=i.width(),s=i.height(),l=e(window).width()+e(window).scrollLeft(),c=e(window).height()+e(window).scrollTop();t?n[r-(o+10+n.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):n[r+o+10>l?"addClass":"removeClass"]("vakata-context-right"),a+s+10>c&&i.css("bottom","-1px"),i.show()}},show:function(i,r,a){var o,s,l,c,d,u,h,f;switch(n.element&&n.element.length&&n.element.width(""),!0){case!r&&!i:return!1;case!!r&&!!i:n.reference=i,n.position_x=r.x,n.position_y=r.y;break;case!r&&!!i:n.reference=i,o=i.offset(),n.position_x=o.left+i.outerHeight(),n.position_y=o.top;break;case!!r&&!i:n.position_x=r.x,n.position_y=r.y}i&&!a&&e(i).data("vakata_contextmenu")&&(a=e(i).data("vakata_contextmenu")),e.vakata.context._parse(a)&&n.element.html(n.html),n.items.length&&(s=n.element,l=n.position_x,c=n.position_y,d=s.width(),u=s.height(),h=e(window).width()+e(window).scrollLeft(),f=e(window).height()+e(window).scrollTop(),t&&(l-=s.outerWidth())h&&(l=h-(d+20)),c+u+20>f&&(c=f-(u+20)),n.element.css({left:l,top:c}).show().find("a:eq(0)").focus().parent().addClass("vakata-context-hover"),n.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){n.is_visible&&(n.element.hide().find("ul").hide().end().find(":focus").blur(),n.is_visible=!1,e.vakata.context._trigger("hide"))}},e(function(){t="rtl"===e("body").css("direction");var i=!1;n.element=e("
      "),n.element.on("mouseenter","li",function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(i&&clearTimeout(i),n.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))}).on("mouseleave","li",function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(t){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(i=setTimeout(function(t){return function(){e.vakata.context.hide()}}(),e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||!1===e.vakata.context._execute(e(this).attr("rel"))||e.vakata.context.hide()}).on("keydown","a",function(t){var i=null;switch(t.which){case 13:case 32:t.type="mouseup",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:n.is_visible&&(n.element.find(".vakata-context-hover").last().parents("li:eq(0)").find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:n.is_visible&&(i=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),i.length||(i=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:n.is_visible&&(n.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:n.is_visible&&(i=n.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),i.length||(i=n.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),i.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault()}}).on("keydown",function(e){e.preventDefault();var t=n.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.mouseup()}).appendTo("body"),e(document).on("mousedown",function(t){n.is_visible&&!e.contains(n.element[0],t.target)&&e.vakata.context.hide()}).on("context_show.vakata",function(e,i){n.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&n.element.addClass("vakata-context-rtl").css("direction","rtl"),n.element.find("ul").hide().end()})})}(e),e.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0},e.jstree.plugins.dnd=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("mousedown.jstree touchstart.jstree",".jstree-anchor",e.proxy(function(t){var n=this.get_node(t.target),i=this.is_selected(n)?this.get_selected().length:1;if(n&&n.id&&"#"!==n.id&&(1===t.which||"touchstart"===t.type)&&(!0===this.settings.dnd.is_draggable||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,i>1?this.get_selected(!0):[n])))return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,{jstree:!0,origin:this,obj:this.get_node(n,!0),nodes:i>1?this.get_selected():[n.id]},'
      '+(i>1?i+" "+this.get_string("nodes"):this.get_text(t.currentTarget,!0))+'
      ')},this))}},e(function(){var t=!1,n=!1,i=!1,r=e('
       
      ').hide().appendTo("body");e(document).bind("dnd_start.vakata",function(e,n){t=!1}).bind("dnd_move.vakata",function(a,o){if(i&&clearTimeout(i),o&&o.data&&o.data.jstree&&(!o.event.target.id||"jstree-marker"!==o.event.target.id)){var s,l,c,d,u,h,f,p,_,g,m,v,y,b,w=e.jstree.reference(o.event.target),x=!1,k=!1,j=!1;if(w&&w._data&&w._data.dnd)if(r.attr("class","jstree-"+w.get_theme()+(w.settings.core.themes.responsive?" jstree-dnd-responsive":"")),o.helper.children().attr("class","jstree-"+w.get_theme()+(w.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy:eq(0)")[o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"show":"hide"](),o.event.target!==w.element[0]&&o.event.target!==w.get_container_ul()[0]||0!==w.get_container_ul().children().length){if((x=e(o.event.target).closest(".jstree-anchor"))&&x.length&&x.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(k=x.offset(),j=o.event.pageY-k.top,c=x.height(),h=jc-c/3?["a","i","b"]:j>c/2?["i","a","b"]:["i","b","a"],e.each(h,function(a,j){switch(j){case"b":s=k.left-6,l=k.top,d=w.get_parent(x),u=x.parent().index();break;case"i":y=w.settings.dnd.inside_pos,b=w.get_node(x.parent()),s=k.left-2,l=k.top+c/2+1,d=b.id,u="first"===y?0:"last"===y?b.children.length:Math.min(y,b.children.length);break;case"a":s=k.left-6,l=k.top+c,d=w.get_parent(x),u=x.parent().index()+1}for(/*! // TODO: moving inside, but the node is not yet loaded? // the check will work anyway, as when moving the node will be loaded first and checked again if(v === 'i' && !ins.is_loaded(p)) { } */ -f=!0,p=0,_=o.data.nodes.length;p<_;p++)if(g=o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node",m=u,"move_node"===g&&"a"===M&&o.data.origin&&o.data.origin===w&&d===w.get_parent(o.data.nodes[p])&&(v=w.get_node(d),m>e.inArray(o.data.nodes[p],v.children)&&(m-=1)),!(f=f&&(w&&w.settings&&w.settings.dnd&&!1===w.settings.dnd.check_while_dragging||w.check(g,o.data.origin&&o.data.origin!==w?o.data.origin.get_node(o.data.nodes[p]):o.data.nodes[p],d,m,{dnd:!0,ref:w.get_node(x.parent()),pos:M,is_multi:o.data.origin&&o.data.origin!==w,is_foreign:!o.data.origin})))){w&&w.last_error&&(n=w.last_error());break}if(f)return"i"===M&&x.parent().is(".jstree-closed")&&w.settings.dnd.open_timeout&&(i=setTimeout(function(e,t){return function(){e.open_node(t)}}(w,x),w.settings.dnd.open_timeout)),t={ins:w,par:d,pos:"i"!==M||"last"!==y||0!==u||w.is_loaded(b)?u:"last"},r.css({left:s+"px",top:l+"px"}).show(),o.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),n={},h=!0,!1}),!0===h))return}else{for(f=!0,p=0,_=o.data.nodes.length;p<_&&(f=f&&w.check(o.data.origin&&(o.data.origin.settings.dnd.always_copy||o.data.origin.settings.dnd.copy&&(o.event.metaKey||o.event.ctrlKey))?"copy_node":"move_node",o.data.origin&&o.data.origin!==w?o.data.origin.get_node(o.data.nodes[p]):o.data.nodes[p],"#","last",{dnd:!0,ref:w.get_node("#"),pos:"i",is_multi:o.data.origin&&o.data.origin!==w,is_foreign:!o.data.origin}));p++);if(f)return t={ins:w,par:"#",pos:"last"},r.hide(),void o.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok")}t=!1,o.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),r.hide()}}).bind("dnd_scroll.vakata",function(e,n){n&&n.data&&n.data.jstree&&(r.hide(),t=!1,n.helper.find(".jstree-icon:eq(0)").removeClass("jstree-ok").addClass("jstree-er"))}).bind("dnd_stop.vakata",function(a,o){if(i&&clearTimeout(i),o&&o.data&&o.data.jstree){r.hide();var s,l,c=[];if(t){for(s=0,l=o.data.nodes.length;s
      ").html(r).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(document).bind("mousemove touchmove",e.vakata.dnd.drag),e(document).bind("mouseup touchend",e.vakata.dnd.stop),!1},drag:function(n){if("touchmove"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_down){if(!t.is_drag){if(!(Math.abs(n.pageX-t.init_x)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(n.pageY-t.init_y)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;t.helper&&(t.helper.appendTo("body"),t.helper_w=t.helper.outerWidth()),t.is_drag=!0,e.vakata.dnd._trigger("start",n)}var i=!1,r=!1,a=!1,o=!1,s=!1,l=!1,c=!1,d=!1,u=!1,h=!1;return t.scroll_t=0,t.scroll_l=0,t.scroll_e=!1,e(e(n.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var i=e(this),r=i.offset();if(this.scrollHeight>this.offsetHeight&&(r.top+i.height()-n.pageYthis.offsetWidth&&(r.left+i.width()-n.pageXo&&n.pageY-co&&o-(n.pageY-c)l&&n.pageX-dl&&l-(n.pageX-d)a&&(u=a-50),s&&h+t.helper_w>s&&(h=s-(t.helper_w+2)),t.helper.css({left:h+"px",top:u+"px"})),e.vakata.dnd._trigger("move",n),!1}},stop:function(n){if("touchend"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=document.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_drag)e.vakata.dnd._trigger("stop",n);else if("touchend"===n.type&&n.target===t.target){var i=setTimeout(function(){e(n.target).click()},100);e(n.target).one("click",function(){i&&clearTimeout(i)})}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(t,n){this.bind=function(){n.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this.element.on("before_open.jstree",e.proxy(function(t,n){var i,r,a=this._data.search.res,o=[],s=e();if(a&&a.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(a,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search"),this.settings.search.show_only_matches&&this._data.search.res.length)){for(i=0,r=a.length;i32&&(n.fuzzy=!1),n.fuzzy&&(i=1<=p;l--)if(m=r[t.charAt(l-1)],g[l]=0===o?(g[l+1]<<1|1)&m:(g[l+1]<<1|1)&m|(f[l+1]|f[l])<<1|1|f[l+1],g[l]&i&&(x=a(o,l-1))<=y){if(y=x,b=l-1,k.push(b),!(b>s))break;p=Math.max(1,2*s-b)}if(a(o+1,s)>y)break;f=g}return{isMatch:b>=0,score:x}},!0===t?{search:o}:o(t)}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,n){this.bind=function(){n.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,n){var i,r;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),n))for(i=0,r=t.children_d.length;it.ttl)&&(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!!t&&(this.element.one("set_state.jstree",function(n,i){i.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={"#":{},default:{}},e.jstree.plugins.types=function(n,i){this.init=function(e,n){var r,a;if(n&&n.types&&n.types.default)for(r in n.types)if("default"!==r&&"#"!==r&&n.types.hasOwnProperty(r))for(a in n.types.default)n.types.default.hasOwnProperty(a)&&n.types[r][a]===t&&(n.types[r][a]=n.types.default[a]);i.init.call(this,e,n),this._model.data["#"].type="#"},this.refresh=function(e,t){i.refresh.call(this,e,t),this._model.data["#"].type="#"},this.bind=function(){this.element.on("model.jstree",e.proxy(function(e,n){var i,r,a=this._model.data,o=n.nodes,s=this.settings.types,l="default";for(i=0,r=o.length;i .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var n=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor:eq(0)").trigger(n).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),n.teardown.call(this)},this.redraw_node=function(t,i,r){if(t=n.redraw_node.call(this,t,i,r)){var a=p.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(a.className+=" jstree-wholerow-clicked"),t.insertBefore(a,t.childNodes[0])}return t}}}})},13:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=n(297),r=function(e){return e&&e.__esModule?e:{default:e}}(i),a=e.Model.extend({urlRoot:Galaxy.root+"api/libraries/",isVisible:function(e){var t=!0;return!e&&this.get("deleted")&&(t=!1),t}}),o=e.Collection.extend({urlRoot:Galaxy.root+"api/libraries",model:a,initialize:function(e){e=e||{}},search:function(e){if(""==e)return this;var t=e.toLowerCase();return this.filter(function(e){return-1!==e.get("name").toLowerCase().indexOf(t)})},getVisible:function(e,t){return t=t||[],new o(this.filter(function(t){return t.isVisible(e)}))},sortLibraries:function(e,t){this.comparator=r.default.generateLibraryComparator(e,t),this.sort()}}),s=e.Model.extend({}),l=s.extend({urlRoot:Galaxy.root+"api/libraries/datasets/"}),c=s.extend({urlRoot:Galaxy.root+"api/folders/"}),d=e.Collection.extend({model:s,sortFolder:function(e,t){this.comparator=r.default.generateFolderComparator(e,t),this.sort()}}),u=e.Model.extend({defaults:{folder:new d,urlRoot:Galaxy.root+"api/folders/",id:"unknown"},parse:function(e){this.get("folder").reset();for(var t=0;t ').addClass(i);t.before(r)}}Object.defineProperty(t,"__esModule",{value:!0});var l=n(3),c=a(l),d=n(286),u=a(d),h=n(287),f=a(h),p=n(288),_=a(p),g=n(61),m=a(g),v=n(293),y=a(v),b=n(6),w=a(b),x=n(79),k=a(x),M=n(7);!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(M);n(20),window.workflow_globals=window.workflow_globals||{},t.default=i.View.extend({initialize:function(t){function n(){var t=e('

      ');window.show_modal("Save As a New Workflow",t,{OK:function(){var t=e("#workflow_rename").val().length>0?e("#workflow_rename").val():"SavedAs_"+l.workflow.name,n=e("#wf_annotation").val().length>0?e("#wf_annotation").val():"";e.ajax({url:l.urls.workflow_save_as,type:"POST",data:{workflow_name:t,workflow_annotation:n,workflow_data:function(){return JSON.stringify(l.workflow.to_simple())}}}).done(function(e){window.onbeforeunload=void 0,window.location=Galaxy.root+"workflow/editor?id="+e,hide_modal()}).fail(function(){hide_modal(),alert("Saving this workflow failed. Please contact this site's administrator.")})},Cancel:hide_modal})}function i(){l.workflow.layout(),l.workflow.fit_canvas_to_nodes(),l.scroll_to_nodes(),l.canvas_manager.draw_overview()}function a(){e.jStorage.set("overview-off",!1),e("#overview-border").css("right","0px"),e("#close-viewport").css("background-position","0px 0px")}function s(){e.jStorage.set("overview-off",!0),e("#overview-border").css("right","20000px"),e("#close-viewport").css("background-position","12px 0px")}var l=window.workflow_globals.app=this;this.options=t,this.urls=t&&t.urls||{};var d=function(){if(l.workflow.check_changes_in_active_form(),workflow&&l.workflow.has_changes){var e=function(){window.onbeforeunload=void 0,window.document.location=l.urls.workflow_index};window.show_modal("Close workflow editor","There are unsaved changes to your workflow which will be lost.",{Cancel:hide_modal,"Save Changes":function(){u(null,e)}},{"Don't Save":e})}else window.document.location=l.urls.workflow_index},u=function(t,n){if(show_message("Saving workflow","progress"),l.workflow.check_changes_in_active_form(),!l.workflow.has_changes)return hide_modal(),void(n&&n());l.workflow.rectify_workflow_outputs(),c.default.request({url:Galaxy.root+"api/workflows/"+l.options.id,type:"PUT",data:{workflow:l.workflow.to_simple()},success:function(t){var i=e("
      ").text(t.message);if(t.errors){i.addClass("warningmark");var r=e("