From 1fd38fb3ee467473d5326ef8c197cedcd9472d53 Mon Sep 17 00:00:00 2001 From: Carl Eberhard Date: Tue, 21 Jul 2015 13:08:43 -0400 Subject: [PATCH] Client build: update webpack versions in package.json; recompile --- client/package.json | 4 ++-- static/scripts/bundled/history.bundled.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/package.json b/client/package.json index fb0f5a75876..9c1a86a9b77 100644 --- a/client/package.json +++ b/client/package.json @@ -16,9 +16,9 @@ "grunt-contrib-watch": "^0.6.1", "grunt-exec": "^0.4.6", "grunt-spritesmith": "~1.7.0", - "grunt-webpack": "^1.0.8", + "grunt-webpack": "^1.0.11", "i18n-webpack-plugin": "^0.2.7", - "webpack": "^1.5.1", + "webpack": "^1.10.1", "webpack-dev-server": "^1.7.0" } } diff --git a/static/scripts/bundled/history.bundled.js b/static/scripts/bundled/history.bundled.js index 38fed9f79d6..f4e29f0292e 100644 --- a/static/scripts/bundled/history.bundled.js +++ b/static/scripts/bundled/history.bundled.js @@ -1,8 +1,8 @@ -webpackJsonp([1],[function(e,t,i){var n=i(33).GalaxyApp,s=i(47).HistoryPanelEdit,a=i(24).History,o=i(14).GalaxyMasthead,r=i(35).GalaxyMenu;window.app=function(e,t){if(window.Galaxy||(window.Galaxy=new n(e,t)),!Galaxy.masthead||!Galaxy.menu){var i=_.extend(_.clone(Galaxy.config),{user:{requests:Galaxy.currUser.get("requests"),email:Galaxy.currUser.get("email"),valid:Galaxy.currUser.isAnonymous(),json:Galaxy.currUser.toJSON()}});Galaxy.masthead=new o(i),Galaxy.menu=new r({masthead:Galaxy.masthead,config:i}),console.debug(Galaxy.masthead),console.debug(Galaxy.menu)}return t=t||{},window.panel=new s({show_deleted:t.show_deleted,show_hidden:t.show_deleted,purgeAllowed:Galaxy.config.allow_user_dataset_purge,model:new a(t.history,t.contents)}),$(function(){panel.render().$el.appendTo((e||{}).panelLoc||"body")}),panel}},function(e,t,i){var n,s;n=[],s=function(e){e={};var t=function(i){return t.cacheNonLocalized&&!e.hasOwnProperty(i)&&(t.nonLocalized||(t.nonLocalized={}),t.nonLocalized[i]=navigator.language),e[i]||i};return t.cacheNonLocalized=!1,t}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(31),i(1)],s=function(e,t){function i(e,t){var i=Array.prototype.slice.call(arguments,0),n=i.pop();return i.unshift(n),_.defaults.apply(_,i)}function n(e,i){i=i||"model";var n=_.template(e.join(""));return function(e,s){var a={view:s||{},_l:t};return a[i]=e||{},n(a)}}var s={logger:null,_logNamespace:"?",log:function(){if(this.logger){var e=this.logger.log;return"object"==typeof this.logger.log&&(e=Function.prototype.bind.call(this.logger.log,this.logger)),e.apply(this.logger,arguments)}return void 0}};e(s);var a=Backbone.Model.extend({initialize:function(e){if(this._checkEnabledSessionStorage(),!e.id)throw new Error("SessionStorageModel requires an id in the initial attributes");this.id=e.id;var t=this.isNew()?{}:this._read(this);this.clear({silent:!0}),this.save(_.extend({},this.defaults,t,e),{silent:!0}),this.on("change",function(){this.save()})},_checkEnabledSessionStorage:function(){try{return sessionStorage.length}catch(e){return alert("Please enable cookies in your browser for this Galaxy site"),!1}},sync:function(e,t,i){i.silent||t.trigger("request",t,{},i);var n={};switch(e){case"create":n=this._create(t);break;case"read":n=this._read(t);break;case"update":n=this._update(t);break;case"delete":n=this._delete(t)}return void 0!==n||null!==n?i.success&&i.success():i.error&&i.error(),n},_create:function(e){try{var t=e.toJSON(),i=sessionStorage.setItem(e.id,JSON.stringify(t));return null===i?i:t}catch(n){if(!(n instanceof DOMException&&navigator.userAgent.indexOf("Safari")>-1))throw n}return null},_read:function(e){return JSON.parse(sessionStorage.getItem(e.id))},_update:function(e){return e._create(e)},_delete:function(e){return sessionStorage.removeItem(e.id)},isNew:function(){return!sessionStorage.hasOwnProperty(this.id)},_log:function(){return JSON.stringify(this.toJSON(),null," ")},toString:function(){return"SessionStorageModel("+this.id+")"}});!function(){a.prototype=_.omit(a.prototype,"url","urlRoot")}();var o={searchAttributes:[],searchAliases:{},searchAttribute:function(e,t){var i=this.get(e);return t&&void 0!==i&&null!==i?_.isArray(i)?this._searchArrayAttribute(i,t):-1!==i.toString().toLowerCase().indexOf(t.toLowerCase()):!1},_searchArrayAttribute:function(e,t){return t=t.toLowerCase(),_.any(e,function(e){return-1!==e.toString().toLowerCase().indexOf(t.toLowerCase())})},search:function(e){var t=this;return _.filter(this.searchAttributes,function(i){return t.searchAttribute(i,e)})},matches:function(e){var t="=",i=e.split(t);if(i.length>=2){var n=i[0];return n=this.searchAliases[n]||n,this.searchAttribute(n,i[1])}return!!this.search(e).length},matchesAll:function(e){var t=this;return e=e.match(/(".*"|\w*=".*"|\S*)/g).filter(function(e){return!!e}),_.all(e,function(e){return e=e.replace(/"/g,""),t.matches(e)})}},r={hiddenUntilActivated:function(e,t){if(t=t||{},this.HUAVOptions={$elementShown:this.$el,showFn:jQuery.prototype.toggle,showSpeed:"fast"},_.extend(this.HUAVOptions,t||{}),this.HUAVOptions.hasBeenShown=this.HUAVOptions.$elementShown.is(":visible"),this.hidden=this.isHidden(),e){var i=this;e.on("click",function(e){i.toggle(i.HUAVOptions.showSpeed)})}},isHidden:function(){return this.HUAVOptions.$elementShown.is(":hidden")},toggle:function(){return this.hidden?(this.HUAVOptions.hasBeenShown||_.isFunction(this.HUAVOptions.onshowFirstTime)&&(this.HUAVOptions.hasBeenShown=!0,this.HUAVOptions.onshowFirstTime.call(this)),_.isFunction(this.HUAVOptions.onshow)&&(this.HUAVOptions.onshow.call(this),this.trigger("hiddenUntilActivated:shown",this)),this.hidden=!1):(_.isFunction(this.HUAVOptions.onhide)&&(this.HUAVOptions.onhide.call(this),this.trigger("hiddenUntilActivated:hidden",this)),this.hidden=!0),this.HUAVOptions.showFn.apply(this.HUAVOptions.$elementShown,arguments)}},l={initialize:function(e){this.draggable=e.draggable||!1},$dragHandle:function(){return this.$(".title-bar")},toggleDraggable:function(){this.draggable?this.draggableOff():this.draggableOn()},draggableOn:function(){this.draggable=!0,this.dragStartHandler=_.bind(this._dragStartHandler,this),this.dragEndHandler=_.bind(this._dragEndHandler,this);var e=this.$dragHandle().attr("draggable",!0).get(0);e.addEventListener("dragstart",this.dragStartHandler,!1),e.addEventListener("dragend",this.dragEndHandler,!1)},draggableOff:function(){this.draggable=!1;var e=this.$dragHandle().attr("draggable",!1).get(0);e.removeEventListener("dragstart",this.dragStartHandler,!1),e.removeEventListener("dragend",this.dragEndHandler,!1)},_dragStartHandler:function(e){return e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text",JSON.stringify(this.model.toJSON())),this.trigger("draggable:dragstart",e,this),!1},_dragEndHandler:function(e){return this.trigger("draggable:dragend",e,this),!1}},c={initialize:function(e){this.selectable=e.selectable||!1,this.selected=e.selected||!1},$selector:function(){return this.$(".selector")},_renderSelected:function(){this.$selector().find("span").toggleClass("fa-check-square-o",this.selected).toggleClass("fa-square-o",!this.selected)},toggleSelector:function(){this.$selector().is(":visible")?this.hideSelector():this.showSelector()},showSelector:function(e){e=void 0!==e?e:this.fxSpeed,this.selectable=!0,this.trigger("selectable",!0,this),this._renderSelected(),this.$selector().show(e)},hideSelector:function(e){e=void 0!==e?e:this.fxSpeed,this.selectable=!1,this.trigger("selectable",!1,this),this.$selector().hide(e)},toggleSelect:function(e){this.selected?this.deselect(e):this.select(e)},select:function(e){return this.selected||(this.trigger("selected",this,e),this.selected=!0,this._renderSelected()),!1},deselect:function(e){return this.selected&&(this.trigger("de-selected",this,e),this.selected=!1,this._renderSelected()),!1}};return{LoggableMixin:s,SessionStorageModel:a,mixin:i,SearchableModelMixin:o,HiddenUntilActivatedViewMixin:r,DraggableViewMixin:l,SelectableViewMixin:c,wrapTemplate:n}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[],s=function(){var e={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};return e.READY_STATES=[e.OK,e.EMPTY,e.PAUSED,e.FAILED_METADATA,e.NOT_VIEWABLE,e.DISCARDED,e.ERROR],e.NOT_READY_STATES=[e.UPLOAD,e.QUEUED,e.RUNNING,e.SETTING_METADATA,e.NEW],e}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s,a;!function(i,o){s=[],n=o,a="function"==typeof n?n.apply(t,s):n,!(void 0!==a&&(e.exports=a))}(this,function(){var e=function(e){e=e||{},e.tooltipConfig=e.tooltipConfig||{placement:"bottom"},e.classes=["icon-btn"].concat(e.classes||[]),e.disabled&&e.classes.push("disabled");var t=['','',""].join(""),i=$(t).tooltip(e.tooltipConfig);return _.isFunction(e.onclick)&&i.click(e.onclick),i};return e})},function(e,t,i){var n,s;n=[i(13),i(9),i(2),i(1)],s=function(e,t,i,n){var s=e.FoldoutListItemView,a=e.ListItemView,o=s.extend({className:s.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,s.prototype.initialize.call(this,e)},_setUpListeners:function(){s.prototype._setUpListeners.call(this),this.model.on("change",function(e,t){_.isEqual(_.keys(e.changed),["deleted"])&&this.render()},this)},_renderSubtitle:function(){var e=$('
');switch(this.model.get("collection_type")){case"list":return e.text(n("a list of datasets"));case"paired":return e.text(n("a pair of datasets"));case"list:paired":return e.text(n("a list of paired datasets"))}return e},_getFoldoutPanelOptions:function(){var e=s.prototype._getFoldoutPanelOptions.call(this);return _.extend(e,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCListItemView("+e+")"}});o.prototype.templates=function(){var e=_.extend({},s.prototype.templates.warnings,{error:i.wrapTemplate(["<% if( model.error ){ %>",'
',n("There was an error getting the data for this collection"),": <%- model.error %>","
","<% } %>"]),purged:i.wrapTemplate(["<% if( model.purged ){ %>",'
',n("This collection has been deleted and removed from disk"),"
","<% } %>"]),deleted:i.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
',n("This collection has been deleted"),"
","<% } %>"])}),t=i.wrapTemplate(['
','
','<%- collection.element_identifier || collection.name %>',"
",'
',"
"],"collection");return _.extend({},s.prototype.templates,{warnings:e,titleBar:t})}();var r=a.extend({className:a.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),a.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCEListItemView("+e+")"}});r.prototype.templates=function(){var e=i.wrapTemplate(['
','
','<%- element.element_identifier %>',"
",'
',"
"],"element");return _.extend({},a.prototype.templates,{titleBar:e})}();var l=t.DatasetListItemView.extend({className:t.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),t.DatasetListItemView.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetDCEListItemView("+e+")"}});l.prototype.templates=function(){var e=i.wrapTemplate(['
','','
','<%- element.element_identifier %>',"
","
"],"element");return _.extend({},t.DatasetListItemView.prototype.templates,{titleBar:e})}();var c=o.extend({className:o.prototype.className+" dataset-collection-element",_swapNewRender:function(e){o.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){var e=this.model?this.model+"":"(no model)";return"NestedDCDCEListItemView("+e+")"}});return{DCListItemView:o,DCEListItemView:r,DatasetDCEListItemView:l,NestedDCDCEListItemView:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(20),i(2),i(1)],s=function(e,t,i){var n={defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(e){return _.extend(e,e.object,{element_id:e.id}),delete e.object,e},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",Backbone.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}},s=Backbone.Model.extend(t.LoggableMixin).extend(n),a=Backbone.Collection.extend(t.LoggableMixin).extend({model:s,initialize:function(e,t){this.debug(this+"(DCECollection).initialize:",e,t),t=t||{}},toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),o=e.DatasetAssociation.extend(t.mixin(n,{defaults:_.extend({},e.DatasetAssociation.prototype.defaults,n.defaults),constructor:function(e,t){this.debug(" DatasetDCE.constructor:",e,t),n.constructor.call(this,e,t)},initialize:function(t,i){this.debug(this+"(DatasetDCE).initialize:",t,i),e.DatasetAssociation.prototype.initialize.call(this,t,i)},toString:function(){var e=this.get("element_identifier");return["DatasetDCE(",e,")"].join("")}})),r=a.extend({model:o,initialize:function(e,t){this.debug(this+"(DatasetDCECollection).initialize:",e,t),a.prototype.initialize.call(this,e,t)},toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),l=Backbone.Model.extend(t.LoggableMixin).extend(t.SearchableModelMixin).extend({defaults:{collection_type:null,deleted:!1},collectionClass:a,initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var e=this.get("elements")||[];return this.unset("elements",{silent:!0}),this.elements=new this.collectionClass(e),this.elements},toJSON:function(){var e=Backbone.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){return!0},hasDetails:function(){return this.debug("hasDetails:",this.elements.length),0!==this.elements.length},getVisibleContents:function(e){return this.elements},"delete":function(e){return this.get("deleted")?jQuery.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?jQuery.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name"],toString:function(){var e=[this.get("id"),this.get("name")||this.get("element_identifier")];return"DatasetCollection("+e.join(",")+")"}}),c=l.extend({collectionClass:r,initialize:function(e,t){this.debug(this+"(ListDatasetCollection).initialize:",e,t),l.prototype.initialize.call(this,e,t)},toString:function(){return["ListDatasetCollection(",this.get("name"),")"].join("")}}),d=c.extend({initialize:function(e,t){this.debug(this+"(PairDatasetCollection).initialize:",e,t),c.prototype.initialize.call(this,e,t)},toString:function(){return["PairDatasetCollection(",this.get("name"),")"].join("")}}),h=l.extend(t.mixin(n,{constructor:function(e,t){this.debug(" NestedDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedDCDCE(",e,")"].join("")}})),u=a.extend({model:h,initialize:function(e,t){this.debug(this+"(NestedDCDCECollection).initialize:",e,t),a.prototype.initialize.call(this,e,t)},toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),p=d.extend(t.mixin(n,{constructor:function(e,t){this.debug(" NestedPairDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedPairDCDCE(",e,")"].join("")}})),f=u.extend({model:p,initialize:function(e,t){this.debug(this+"(NestedPairDCDCECollection).initialize:",e,t),u.prototype.initialize.call(this,e,t)},toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),g=l.extend({collectionClass:f,initialize:function(e,t){this.debug(this+"(ListPairedDatasetCollection).initialize:",e,t),l.prototype.initialize.call(this,e,t)},toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}});return{ListDatasetCollection:c,PairDatasetCollection:d,ListPairedDatasetCollection:g}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(25),i(6),i(5),i(2),i(1)],s=function(e,t,i,n,s){var a=e.ModelListPanel,o=a.extend({className:a.prototype.className+" dataset-collection-panel",DatasetDCEViewClass:i.DatasetDCEListItemView,NestedDCDCEViewClass:i.NestedDCDCEListItemView,modelCollectionKey:"elements",initialize:function(e){a.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,this.panelStack=[],this.parentName=e.parentName,this.foldoutStyle=e.foldoutStyle||"foldout"},_filterCollection:function(){return this.model.getVisibleContents()},_getItemViewClass:function(e){switch(e.get("element_type")){case"hda":return this.DatasetDCEViewClass;case"dataset_collection":return this.NestedDCDCEViewClass}throw new TypeError("Unknown element type:",e.get("element_type"))},_getItemViewOptions:function(e){var t=a.prototype._getItemViewOptions.call(this,e);return _.extend(t,{linkTarget:this.linkTarget,hasUser:this.hasUser,foldoutStyle:this.foldoutStyle})},_setUpItemViewListeners:function(e){var t=this;return a.prototype._setUpItemViewListeners.call(t,e),e.on("expanded:drilldown",function(e,t){this._expandDrilldownPanel(t)},this),e.on("collapsed:drilldown",function(e,t){this._collapseDrilldownPanel(t)},this),this},_expandDrilldownPanel:function(e){this.panelStack.push(e),this.$("> .controls").add(this.$list()).hide(),e.parentName=this.model.get("name"),this.$el.append(e.render().$el)},_collapseDrilldownPanel:function(e){this.panelStack.pop(),this.render()},events:{"click .navigation .back":"close"},close:function(e){this.$el.remove(),this.trigger("close")},toString:function(){return"CollectionPanel("+(this.model?this.model.get("name"):"")+")"}});o.prototype.templates=function(){var e=n.wrapTemplate(['
','",'
','
<%- collection.name || collection.element_identifier %>
','
','<% if( collection.collection_type === "list" ){ %>',s("a list of datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',s("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',s("a list of paired datasets"),"<% } %>","
","
","
"],"collection");return _.extend(_.clone(a.prototype.templates),{controls:e})}();var r=o.extend({DatasetDCEViewClass:i.DatasetDCEListItemView,toString:function(){return"ListCollectionPanel("+(this.model?this.model.get("name"):"")+")"}}),l=r.extend({toString:function(){return"PairCollectionPanel("+(this.model?this.model.get("name"):"")+")"}}),c=o.extend({NestedDCDCEViewClass:i.NestedDCDCEListItemView.extend({foldoutPanelClass:l}),toString:function(){return"ListOfPairsCollectionPanel("+(this.model?this.model.get("name"):"")+")"}});return{CollectionPanel:o,ListCollectionPanel:r,PairCollectionPanel:l,ListOfPairsCollectionPanel:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(10),i(3),i(2),i(49),i(32),i(1),i(29)],s=function(e,t,i,n,s,a){function o(e){var t=e.toJSON(),i=d(t,{creationFn:function(t,i){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i)}});return i}var r=Backbone.View.extend(i.LoggableMixin).extend({tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){return this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})),this.selected&&this.$el.addClass("selected"),this},template:_.template(['',"<%= element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([a("Enter a new name for the element"),":\n(",a("Note that changing the name here will not rename the dataset"),")"].join(""),prompt(a("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),l=Backbone.View.extend(i.LoggableMixin).extend({elementViewClass:r,collectionClass:e.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;_.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=_.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){return"dataset"!==e.history_content_type?a("is not a dataset"):e.state!==t.OK?a(_.contains(t.NOT_READY_STATES,e.state)?"hasn't finished running yet":"has errored, is paused, or is not accessible"):e.deleted||e.purged?a("has been deleted or purged"):null},_mangleDuplicateNames:function(){var e=900,t=1,i={};this.workingElements.forEach(function(n){for(var s=n.name;i.hasOwnProperty(s);)if(s=n.name+" ("+t+")",t+=1,t>=e)throw new Error("Safety hit in while loop - thats impressive");n.name=s,i[n.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,n=jQuery("
"),s=i.$list();_.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);n.append(t.$el)}),i._renderClearSelected(),s.empty().append(n.children()),_.invoke(i.elementViews,"render"),s.height()>s.css("max-height")?s.css("border-width","1px 0px 1px 0px"):s.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:_.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=_.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=a("No valid elements for final list")+". ";return t+=''+a("Cancel")+" ",t+=a("or"),t+=' '+a("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:a("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=_.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this;if(content=e.message||a("An error occurred"),e.xhr){var i=e.xhr,n=e.message;0===i.readyState&&0===i.status?content+=": "+a("Galaxy could not be reached and may be updating.")+a(" Try again in a few minutes."):i.responseJSON?content+=":
"+JSON.stringify(i.responseJSON)+"
":content+=": "+n}t._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,t){t=t||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(t).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=$('
');i.size()?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=2,n=e.offset(),s=e.scrollTop(),a=t-n.top,o=n.top+e.outerHeight()-t;a>=0&&a=0&&oe&&e>a-o)return s}return $()},_dropElements:function(e){e.originalEvent&&(e=e.originalEvent),e.preventDefault(),e.dataTransfer.dropEffect="move";var t=this._getNearestElement(e.clientY);return t.size()?this.$dragging.insertBefore(t):this.$dragging.insertAfter(this.$(".collection-elements .collection-element").last()),this._syncOrderToDom(),!1},_syncOrderToDom:function(){var e=this,t=[];this.$(".collection-elements .collection-element").each(function(){var i=$(this).attr("data-element-id"),n=_.findWhere(e.workingElements,{id:i});n?t.push(n):console.error("missing element: ",i)}),this.workingElements=t,this._renderList()},_elementDragstart:function(e,t){t.select(!0),this.$dragging=this.$(".collection-elements .collection-element.selected")},_elementDragend:function(e,t){$(".element-drop-placeholder").remove(),this.$dragging=null},_changeName:function(e){this._validationWarning("name",!!this._getName()); -},_nameCheckForEnter:function(e){13!==e.keyCode||this.blocking||this._clickCreate()},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(e){var t=this._getName();t?this.blocking||this.createList(t):this._validationWarning("name")},templates:{main:_.template(['
','
',''].join("")),header:_.template(['",'
','','',"
"].join("")),middle:_.template(['",'
',"
"].join("")),footer:_.template(['
','
','','
',a("Name"),":
","
","
",'
','
','",'
','",'","
","
",'
','","
","
"].join("")),helpContent:_.template(["

",a(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"

","
    ","
  • ",a(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
  • ","
  • ",a(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
  • ","
  • ",a(["Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ",'them and you can then move those selected by dragging the ',"entire group. Deselect them by clicking them again or by clicking the ",'the "Clear selected" link.'].join("")),"
  • ","
  • ",a(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
  • ","
  • ",a(['Click the "Cancel" button to exit the interface.'].join("")),"
  • ","

","

",a(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"

"].join("")),invalidElements:_.template([a("The following selections could not be included due to problems:"),"
    <% _.each( problems, function( problem ){ %>","
  • <%= problem.element.name %>: <%= problem.text %>
  • ","<% }); %>
"].join("")),noElementsLeft:_.template(['
  • ',a("No elements left! "),a("Would you like to "),'',a("start over"),"?","
  • "].join("")),invalidInitial:_.template(['
    ','
    ','',"<% if( _.size( problems ) ){ %>",a("The following selections could not be included due to problems"),":","
      <% _.each( problems, function( problem ){ %>","
    • <%= problem.element.name %>: <%= problem.text %>
    • ","<% }); %>
    ","<% } else if( _.size( elements ) < 1 ){ %>",a("No datasets were selected"),".","<% } %>","
    ",a("At least one element is needed for the collection"),". ",a("You may need to "),'',a("cancel")," ",a("and reselect new elements"),".","
    ","
    ","
    ",'"].join(""))},toString:function(){return"ListCollectionCreator"}}),c=function(e,t,i){var s,o=jQuery.Deferred(),r=Galaxy.modal||new n.View;return t=_.defaults(t||{},{elements:e,oncancel:function(){r.hide(),o.reject("cancelled")},oncreate:function(e,t){r.hide(),o.resolve(t)}}),s=new i(t),r.show({title:t.title||a("Create a collection"),body:s.$el,width:"80%",height:"min-content",closing_events:!0}),s.render(),window._collectionCreator=s,o},d=function(e,t){return t=t||{},t.title=a("Create a collection from a list of datasets"),c(e,t,l)};return{DatasetCollectionElementView:r,ListCollectionCreator:l,collectionCreatorModal:c,listCollectionCreatorModal:d,createListCollection:o}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(13),i(3),i(4),i(2),i(1)],s=function(e,t,i,n,s){var a=e.ListItemView,o=a.extend({className:a.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log(this+".initialize:",e),a.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank",this._setUpListeners()},_setUpListeners:function(){a.prototype._setUpListeners.call(this),this.model.on("change",function(e,t){this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()?this.model.fetch():this.render()},this)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):jQuery.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){Backbone.View.prototype.remove.call(i),t&&t.call(i)})},render:function(e){return a.prototype.render.call(this,e)},_swapNewRender:function(e){return a.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===t.NOT_VIEWABLE||e===t.DISCARDED||!this.model.get("accessible"))return null;var n={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))n.disabled=!0,n.title=s("Cannot display datasets removed from disk");else if(e===t.UPLOAD)n.disabled=!0,n.title=s("This dataset must finish uploading before it can be viewed");else if(e===t.NEW)n.disabled=!0,n.title=s("This dataset is not yet viewable");else{n.title=s("View data"),n.href=this.model.urls.display;var a=this;n.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add_dataset(a.model.get("id")),e.preventDefault())}}return n.faIcon="fa-eye",i(n)},_renderDetails:function(){if(this.model.get("state")===t.NOT_VIEWABLE)return $(this.templates.noAccess(this.model.toJSON(),this));var e=a.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var e=this,t=$('
    '),i=e.model.toJSON();return _.each(e.templates.detailMessages,function(n){t.append($(n(i,e)))}),t},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case t.NOT_VIEWABLE:return[];case t.OK:case t.FAILED_METADATA:case t.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return i({title:s("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:_.isEmpty(this.model.get("meta_files"))?$(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var e=this.model.urls;return $(['"].join("\n"))},events:_.extend(_.clone(a.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetListItemView("+e+")"}});return o.prototype.templates=function(){var e=_.extend({},a.prototype.templates.warnings,{failed_metadata:n.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
    ',s("An error occurred setting the metadata for this dataset"),"
    ","<% } %>"]),error:n.wrapTemplate(["<% if( model.error ){ %>",'
    ',s("There was an error getting the data for this dataset"),": <%- model.error %>","
    ","<% } %>"]),purged:n.wrapTemplate(["<% if( model.purged ){ %>",'
    ',s("This dataset has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:n.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',s("This dataset has been deleted"),"
    ","<% } %>"])}),i=n.wrapTemplate(['
    ','
    ','
    ','
    ','
    ',"
    ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
    ','
    ','
    ',"<% if( dataset.peek ){ %>",'
    <%= dataset.peek %>
    ',"<% } %>","<% } %>","
    "],"dataset"),o=n.wrapTemplate(['
    ','
    ',s("You do not have permission to view this dataset"),"
    ","
    "],"dataset"),r={};r[t.OK]=r[t.FAILED_METADATA]=n.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
    ','<%- dataset.misc_blurb %>',"
    ","<% } %>","<% if( dataset.file_ext ){ %>",'
    ','",'<%- dataset.file_ext %>',"
    ","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
    ','",'',"<%- dataset.metadata_dbkey %>","","
    ","<% } %>","<% if( dataset.misc_info ){ %>",'
    ','<%- dataset.misc_info %>',"
    ","<% } %>"],"dataset"),r[t.NEW]=n.wrapTemplate(["
    ",s("This is a new dataset and not all of its data are available yet"),"
    "],"dataset"),r[t.NOT_VIEWABLE]=n.wrapTemplate(["
    ",s("You do not have permission to view this dataset"),"
    "],"dataset"),r[t.DISCARDED]=n.wrapTemplate(["
    ",s("The job creating this dataset was cancelled before completion"),"
    "],"dataset"),r[t.QUEUED]=n.wrapTemplate(["
    ",s("This job is waiting to run"),"
    "],"dataset"),r[t.RUNNING]=n.wrapTemplate(["
    ",s("This job is currently running"),"
    "],"dataset"),r[t.UPLOAD]=n.wrapTemplate(["
    ",s("This dataset is currently uploading"),"
    "],"dataset"),r[t.SETTING_METADATA]=n.wrapTemplate(["
    ",s("Metadata is being auto-detected"),"
    "],"dataset"),r[t.PAUSED]=n.wrapTemplate(["
    ",s('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
    "],"dataset"),r[t.ERROR]=n.wrapTemplate(["<% if( !dataset.purged ){ %>","
    <%- dataset.misc_blurb %>
    ","<% } %>",'',s("An error occurred with this dataset"),":",'
    <%- dataset.misc_info %>
    '],"dataset"),r[t.EMPTY]=n.wrapTemplate(["
    ",s("No data"),": <%- dataset.misc_blurb %>
    "],"dataset"),r.unknown=n.wrapTemplate(['
    Error: unknown dataset state: "<%- dataset.state %>"
    '],"dataset");var l={resubmitted:n.wrapTemplate(["<% if( model.resubmitted ){ %>",'
    ',s("The job creating this dataset has been resubmitted"),"
    ","<% } %>"])},c=n.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
    ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
    ","<% }); %>"],"apps");return _.extend({},a.prototype.templates,{warnings:e,details:i,noAccess:o,summaries:r,detailMessages:l,displayApplications:c})}(),{DatasetListItemView:o}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(6),i(11),i(1)],s=function(e,t,i){function n(e){return function(t,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",t=t||{},t.type="dataset_collection"),e.call(this,t,i)}}var s=t.HistoryContentMixin,a=e.ListDatasetCollection,o=e.PairDatasetCollection,r=e.ListPairedDatasetCollection,l=a.extend(s).extend({defaults:_.extend(_.clone(a.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(e,t){a.prototype.initialize.call(this,e,t),s.initialize.call(this,e,t)},save:n(a.prototype.save),toString:function(){return["HistoryListDatasetCollection(",this.get("name"),")"].join("")}}),c=o.extend(s).extend({defaults:_.extend(_.clone(o.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(e,t){o.prototype.initialize.call(this,e,t),s.initialize.call(this,e,t)},save:n(o.prototype.save),toString:function(){return["HistoryPairDatasetCollection(",this.get("name"),")"].join("")}}),d=r.extend(s).extend({defaults:_.extend(_.clone(r.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(e,t){r.prototype.initialize.call(this,e,t),s.initialize.call(this,e,t)},save:n(r.prototype.save),toString:function(){return["HistoryListPairedDatasetCollection(",this.get("name"),")"].join("")}});return{HistoryListDatasetCollection:l,HistoryPairDatasetCollection:c,HistoryListPairedDatasetCollection:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(3),i(2),i(1)],s=function(e,t,i){var n=function(e,t){return[e,t].join("-")},s={defaults:{history_id:null,history_content_type:null,hid:null,visible:!0},idAttribute:"type_id",constructor:function(e,t){e.type_id=n(e.history_content_type,e.id),this.debug("HistoryContentMixin.constructor:",e.type_id),Backbone.Model.apply(this,arguments)},_typeIdStr:function(){return n(this.get("history_content_type"),this.get("id"))},initialize:function(e,t){this.on("change:id",this._createTypeId)},_createTypeId:function(){this.set("type_id",this._typeIdStr())},isNew:function(){return!this.get("id")},hidden:function(){return!this.get("visible")},isVisible:function(e,t){var i=!0;return e||!this.get("deleted")&&!this.get("purged")||(i=!1),t||this.get("visible")||(i=!1),i},urlRoot:(window.Galaxy?Galaxy.options.root:"/")+"api/histories/",url:function(){var e=this.urlRoot+this.get("history_id")+"/contents/"+this.get("history_content_type")+"s/"+this.get("id");return e},hide:function(e){return this.get("visible")?this.save({visible:!1},e):jQuery.when()},unhide:function(e){return this.get("visible")?jQuery.when():this.save({visible:!0},e)},toString:function(){var e=this.get("id")||"";return this.get("name")&&(e=this.get("hid")+' :"'+this.get("name")+'",'+e),"HistoryContent("+e+")"}},a=Backbone.Model.extend(t.LoggableMixin).extend(s);return{typeIdStr:n,HistoryContentMixin:s,HistoryContent:a}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(11),i(22),i(10),i(2),i(1)],s=function(e,t,i,n,s){var a=Backbone.Collection.extend(n.LoggableMixin).extend({model:function(e,n){if("dataset"===e.history_content_type)return new t.HistoryDatasetAssociation(e,n);if("dataset_collection"===e.history_content_type){switch(e.collection_type){case"list":return new i.HistoryListDatasetCollection(e,n);case"paired":return new i.HistoryPairDatasetCollection(e,n);case"list:paired":return new i.HistoryListPairedDatasetCollection(e,n)}return{validationError:"Unknown collection_type: "+e.history_content_type}}return{validationError:"Unknown history_content_type: "+e.history_content_type}},initialize:function(e,t){t=t||{},this.historyId=t.historyId,this.model.prototype.idAttribute="type_id",this.on("all",function(){this.debug(this+".event:",arguments)})},urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},ids:function(){return this.map(function(e){return e.get("id")})},notReady:function(){return this.filter(function(e){return!e.inReadyState()})},running:function(){var e=[];return this.each(function(t){var i=!t.inReadyState();i&&e.push(t.get("id"))}),e},getByHid:function(e){return _.first(this.filter(function(t){return t.get("hid")===e}))},getVisible:function(e,t,i){i=i||[],this.debug("checking isVisible");var n=new a(this.filter(function(i){return i.isVisible(e,t)}));return _.each(i,function(e){_.isFunction(e)&&(n=new a(n.filter(e)))}),n},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},fetchAllDetails:function(e){e=e||{};var t={details:"all"};return e.data=e.data?_.extend(e.data,t):t,this.fetch(e)},ajaxQueue:function(e,t){var i=jQuery.Deferred(),n=this.length,s=[];if(!n)return i.resolve([]),i;var a=this.chain().reverse().map(function(o,r){return function(){var l=e.call(o,t);l.done(function(e){i.notify({curr:r,total:n,response:e,model:o})}),l.always(function(e){s.push(e),a.length?a.shift()():i.resolve(s)})}}).value();return a.shift()(),i},isCopyable:function(e){var t=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return _.isObject(e)&&e.id&&_.contains(t,e.model_class)},copy:function(e){var t,i,n;_.isString(e)?(t=e,n="hda",i="dataset"):(t=e.id,n={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[e.model_class]||"hda",i="hdca"===n?"dataset_collection":"dataset");var s=this,a=jQuery.post(this.url(),{content:t,source:n,type:i}).done(function(e){s.add([e])}).fail(function(e,o,r){s.trigger("error",s,a,{},"Error copying contents",{type:i,id:t,source:n})});return a},matches:function(e){return this.filter(function(t){return t.matches(e)})},set:function(t,i){_.each(t,function(t){t.type_id&&t.get&&t.get("type_id")||(t.type_id=e.typeIdStr(t.history_content_type,t.id))}),Backbone.Collection.prototype.set.call(this,t,i)},createHDCA:function(e,t,n,s){var a=this,o={list:i.HistoryListDatasetCollection,paired:i.HistoryPairDatasetCollection},r=new o[t]({history_id:this.historyId,name:n,element_identifiers:e});return r.save().done(function(e){a.add(r)}).fail(function(e,t,i){a.trigger("error",e,t,i)})},clone:function(){var e=Backbone.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},print:function(){var e=this;e.each(function(t){e.debug(t),t.elements&&e.debug(" elements:",t.elements)})},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});return{HistoryContents:a}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(2),i(1)],s=function(e,t){var i=Backbone.View.extend(e.LoggableMixin).extend({initialize:function(e){this.expanded=e.expanded||!1,this.log(" expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=$(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;$(i).queue("fx",[function(e){this.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){this.$el.fadeIn(t,e)},function(e){this.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",_.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=$(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?jQuery.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown({duration:e.fxSpeed,step:function(){e.trigger("expanding",e)},complete:function(){e.trigger("expanded",e)}})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp({duration:e.fxSpeed,step:function(){e.trigger("collapsing",e)},complete:function(){e.trigger("collapsed",e)}})}}),n=i.extend(e.mixin(e.SelectableViewMixin,e.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(t){i.prototype.initialize.call(this,t),e.SelectableViewMixin.initialize.call(this,t),e.DraggableViewMixin.initialize.call(this,t),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=i.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return i.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=$('
    '),i=e.model.toJSON();return _.each(e.templates.warnings,function(n){t.append($(n(i,e)))}),t},_renderTitleBar:function(){return $(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return $(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){var t=32,i=13;return!e||"keydown"!==e.type||e.keyCode!==t&&e.keyCode!==i?!0:(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){var e=this.model?this.model+"":"(no model)";return"ListItemView("+e+")"}}));n.prototype.templates=function(){var t=e.wrapTemplate(['
    ','
    ','
    ','',"
    ",'
    ','
    ','
    ',"
    "]),i={},n=e.wrapTemplate(['
    ','','
    ','<%- element.name %>',"
    ",'
    ',"
    "],"element"),s=e.wrapTemplate(['
    ']),a=e.wrapTemplate(['
    ']);return{el:t,warnings:i,titleBar:n,subtitle:s,details:a}}();var s=n.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,n.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return $();var e=n.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e),n=new t(_.extend(i,{model:e}));return n},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.foldout.on("close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});return s.prototype.templates=function(){var t=e.wrapTemplate(['
    ',"
    "],"collection");return _.extend({},n.prototype.templates,{details:t})}(),{ExpandableView:i,ListItemView:n,FoldoutListItemView:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[],s=function(){var e=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(e){this.options=e,$("body").off(),this.setElement($(this._template(e))),$(this.el_masthead).append($(this.el)),this.$background=$(this.el).find("#masthead-background");var t=this;$(window).on("beforeunload",function(){var e="";for(key in t.list)if(t.list[key].options.onunload){var i=t.list[key].options.onunload();i&&(e+=i+" ")}return""!=e?e:void 0})},events:{click:"_click",mousedown:function(e){e.preventDefault()}},append:function(e){return this._add(e,!0)},prepend:function(e){return this._add(e,!1)},highlight:function(e){var t=$(this.el).find("#"+e+"> li");t&&t.addClass("active")},_add:function(e,t){var i=$(this.el).find("#"+e.location);if(i){var n=$(e.el);n.addClass("masthead-item"),t?i.append(n):i.prepend(n),this.list.push(e)}return null},_click:function(e){var t=$(this.el).find(".popup");t&&t.hide();var i=$(e.target).closest(".masthead-item").find(".popup");$(e.target).hasClass("head")?(i.show(),this.$background.show()):this.$background.hide()},_template:function(e){var t=e.brand?"/ "+e.brand:"";return''}}),t=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:!1,onclick:function(){alert("clicked")},onunload:null,visible:!0},location:"iconbar",initialize:function(e){e&&(this.options=_.defaults(e,this.options)),this.setElement($(this._template(this.options)));var t=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",t.options.onclick),this.options.visible||this.hide()},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(e){$(this.el).find(".icon").removeClass(this.options.icon).addClass(e),this.options.icon=e},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(e){$(this.el).find(".number").text(e)},_template:function(e){var t='
    ';return e.with_number&&(t+='
    '),t+="
    "}}),i=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:!1,onunload:null,visible:!0,disabled:!1,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(e){e&&(this.options=_.defaults(e,this.options)),void 0!==this.options.content&&-1===this.options.content.indexOf("//")&&(this.options.content=galaxy_config.root+this.options.content),this.setElement($(this._template(this.options))),this.options.disabled&&($(this.el).find(".root").addClass("disabled"),this._attachPopover()),this.options.visible||this.hide()},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(e){var t={title:"Title",content:"",type:"url",target:"_parent",scratchbook:!1,divider:!1};e&&(t=_.defaults(e,t)),t.content&&-1===t.content.indexOf("//")&&(t.content=galaxy_config.root+t.content),this.$menu||($(this.el).find(".root").append(this._templateMenu()),$(this.el).find(".symbol").addClass("caret"),this.$menu=$(this.el).find(".popup"));var i=$(this._templateMenuItem(t));this.$menu.append(i);var n=this;i.on("click",function(t){return t.preventDefault(),"_blank"===n.options.target?!0:void Galaxy.frame.add(e)}),t.divider&&this.$menu.append($(this._templateDivider()))},_head:function(e){e.preventDefault(),this.options.disabled||this.$menu||Galaxy.frame.add(this.options)},_attachPopover:function(){var e=$(this.el).find(".head");e.popover({html:!0,content:'Please log in or register to use this feature.', -placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){e.popover("hide")},5e3)})},_templateMenuItem:function(e){return'
  • '+e.title+"
  • "},_templateMenu:function(){return''},_templateDivider:function(){return'
  • '},_template:function(e){var t='';return t}});return{GalaxyMasthead:e,GalaxyMastheadTab:i,GalaxyMastheadIcon:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))},,,,function(e,t,i){var n,s;n=[i(2),i(1)],s=function(e,t){var i=Backbone.View.extend(e.LoggableMixin).extend(e.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(e){e=e||{},this.tooltipConfig=e.tooltipConfig||{placement:"bottom"},this.listenTo(this.model,"change:annotation",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$el.find("[title]").tooltip(this.tooltipConfig),this.$annotation().make_text_editable({use_textarea:!0,on_finish:function(t){e.$annotation().text(t),e.model.save({annotation:t},{silent:!0}).fail(function(){e.$annotation().text(e.model.previous("annotation"))})}}),this},_template:function(){var e=this.model.get("annotation");return['",'
    ',_.escape(e),"
    "].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off(),this.stopListening(this.model),Backbone.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",this.model+"",")"].join("")}});return{AnnotationEditor:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(3),i(9),i(26),i(18),i(4),i(2),i(1)],s=function(e,t,i,n,s,a,o){var r=t.DatasetListItemView,l=r.extend({initialize:function(e){r.prototype.initialize.call(this,e),this.hasUser=e.hasUser,this.purgeAllowed=e.purgeAllowed||!1,this.tagsEditorShown=e.tagsEditorShown||!1,this.annotationEditorShown=e.annotationEditorShown||!1},_renderPrimaryActions:function(){var t=r.prototype._renderPrimaryActions.call(this);return this.model.get("state")===e.NOT_VIEWABLE?t:r.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(),this._renderDeleteButton()])},_renderEditButton:function(){if(this.model.get("state")===e.DISCARDED||!this.model.get("accessible"))return null;var t=this.model.get("purged"),i=this.model.get("deleted"),n={title:o("Edit attributes"),href:this.model.urls.edit,target:this.linkTarget,faIcon:"fa-pencil",classes:"edit-btn"};return i||t?(n.disabled=!0,t?n.title=o("Cannot edit attributes of datasets removed from disk"):i&&(n.title=o("Undelete dataset to edit attributes"))):_.contains([e.UPLOAD,e.NEW],this.model.get("state"))&&(n.disabled=!0,n.title=o("This dataset is not yet editable")),s(n)},_renderDeleteButton:function(){if(!this.model.get("accessible"))return null;var e=this,t=this.model.isDeletedOrPurged();return s({title:o(t?"Dataset is already deleted":"Delete"),disabled:t,faIcon:"fa-times",classes:"delete-btn",onclick:function(){e.$el.find(".icon-btn.delete-btn").trigger("mouseout"),e.model["delete"]()}})},_renderDetails:function(){var t=r.prototype._renderDetails.call(this),i=this.model.get("state");return!this.model.isDeletedOrPurged()&&_.contains([e.OK,e.FAILED_METADATA],i)&&(this._renderTags(t),this._renderAnnotation(t),this._makeDbkeyEditLink(t)),this._setUpBehaviors(t),t},_renderSecondaryActions:function(){var t=r.prototype._renderSecondaryActions.call(this);switch(this.model.get("state")){case e.UPLOAD:case e.NEW:case e.NOT_VIEWABLE:return t;case e.ERROR:return t.unshift(this._renderErrButton()),t.concat([this._renderRerunButton()]);case e.OK:case e.FAILED_METADATA:return t.concat([this._renderRerunButton(),this._renderVisualizationsButton()])}return t.concat([this._renderRerunButton()])},_renderErrButton:function(){return s({title:o("View or report this error"),href:this.model.urls.report_error,classes:"report-error-btn",target:this.linkTarget,faIcon:"fa-bug"})},_renderRerunButton:function(){return s({title:o("Run this job again"),href:this.model.urls.rerun,classes:"rerun-btn",target:this.linkTarget,faIcon:"fa-refresh"})},_renderVisualizationsButton:function(){var e=this.model.get("visualizations");if(this.model.isDeletedOrPurged()||!this.hasUser||!this.model.hasData()||_.isEmpty(e))return null;if(!_.isObject(e[0]))return this.warn("Visualizations have been switched off"),null;var t=$(this.templates.visualizations(e,this));return t.find('[target="galaxy_main"]').attr("target",this.linkTarget),this._addScratchBookFn(t.find(".visualization-link").addBack(".visualization-link")),t},_addScratchBookFn:function(e){e.click(function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Visualization",type:"url",content:$(this).attr("href")}),e.preventDefault(),e.stopPropagation())})},_renderTags:function(e){if(this.hasUser){var t=this;this.tagsEditor=new i.TagsEditor({model:this.model,el:e.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.tagsEditorShown=!0},onhide:function(){t.tagsEditorShown=!1},$activator:s({title:o("Edit dataset tags"),classes:"tag-btn",faIcon:"fa-tags"}).appendTo(e.find(".actions .right"))}),this.tagsEditorShown&&this.tagsEditor.toggle(!0)}},_renderAnnotation:function(e){if(this.hasUser){var t=this;this.annotationEditor=new n.AnnotationEditor({model:this.model,el:e.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.annotationEditorShown=!0},onhide:function(){t.annotationEditorShown=!1},$activator:s({title:o("Edit dataset annotation"),classes:"annotate-btn",faIcon:"fa-comment"}).appendTo(e.find(".actions .right"))}),this.annotationEditorShown&&this.annotationEditor.toggle(!0)}},_makeDbkeyEditLink:function(e){if("?"===this.model.get("metadata_dbkey")&&!this.model.isDeletedOrPurged()){var t=$('?').attr("href",this.model.urls.edit).attr("target",this.linkTarget);e.find(".dbkey .value").replaceWith(t)}},events:_.extend(_.clone(r.prototype.events),{"click .undelete-link":"_clickUndeleteLink","click .purge-link":"_clickPurgeLink","click .edit-btn":function(e){this.trigger("edit",this,e)},"click .delete-btn":function(e){this.trigger("delete",this,e)},"click .rerun-btn":function(e){this.trigger("rerun",this,e)},"click .report-err-btn":function(e){this.trigger("report-err",this,e)},"click .visualization-btn":function(e){this.trigger("visualize",this,e)},"click .dbkey a":function(e){this.trigger("edit",this,e)}}),_clickUndeleteLink:function(e){return this.model.undelete(),!1},_clickPurgeLink:function(e){return this.model.purge(),!1},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDAEditView("+e+")"}});return l.prototype.templates=function(){var e=_.extend({},r.prototype.templates.warnings,{failed_metadata:a.wrapTemplate(['<% if( dataset.state === "failed_metadata" ){ %>','","<% } %>"],"dataset"),deleted:a.wrapTemplate(["<% if( dataset.deleted && !dataset.purged ){ %>",'
    ',o("This dataset has been deleted"),'
    ',o("Undelete it"),"","<% if( view.purgeAllowed ){ %>",'
    ',o("Permanently remove it from disk"),"","<% } %>","
    ","<% } %>"],"dataset")}),t=a.wrapTemplate(["<% if( visualizations.length === 1 ){ %>",'">','',"","<% } else { %>",'","<% } %>"],"visualizations");return _.extend({},r.prototype.templates,{warnings:e,visualizations:t})}(),{DatasetListItemEdit:l}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(3),i(2),i(1)],s=function(e,t,i){var n=t.SearchableModelMixin,s=Backbone.Model.extend(t.LoggableMixin).extend(t.mixin(n,{defaults:{state:e.NEW,deleted:!1,purged:!1,name:"(unnamed dataset)",accessible:!0,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(t,i){this.debug(this+"(Dataset).initialize",t,i), +webpackJsonp([1],[function(e,t,i){var n=i(33).GalaxyApp,r=i(47).HistoryPanelEdit,s=i(24).History,o=i(14).GalaxyMasthead,a=i(35).GalaxyMenu;window.app=function(e,t){if(window.Galaxy||(window.Galaxy=new n(e,t)),!Galaxy.masthead||!Galaxy.menu){var i=_.extend(_.clone(Galaxy.config),{user:{requests:Galaxy.currUser.get("requests"),email:Galaxy.currUser.get("email"),valid:Galaxy.currUser.isAnonymous(),json:Galaxy.currUser.toJSON()}});Galaxy.masthead=new o(i),Galaxy.menu=new a({masthead:Galaxy.masthead,config:i}),console.debug(Galaxy.masthead),console.debug(Galaxy.menu)}return t=t||{},window.panel=new r({show_deleted:t.show_deleted,show_hidden:t.show_deleted,purgeAllowed:Galaxy.config.allow_user_dataset_purge,model:new s(t.history,t.contents)}),$(function(){panel.render().$el.appendTo((e||{}).panelLoc||"body")}),panel}},function(e,t,i){var n,r;n=[],r=function(e){e={};var t=function(i){return t.cacheNonLocalized&&!e.hasOwnProperty(i)&&(t.nonLocalized||(t.nonLocalized={}),t.nonLocalized[i]=navigator.language),e[i]||i};return t.cacheNonLocalized=!1,t}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(31),i(1)],r=function(e,t){function i(e,t){var i=Array.prototype.slice.call(arguments,0),n=i.pop();return i.unshift(n),_.defaults.apply(_,i)}function n(e,i){i=i||"model";var n=_.template(e.join(""));return function(e,r){var s={view:r||{},_l:t};return s[i]=e||{},n(s)}}var r={logger:null,_logNamespace:"?",log:function(){if(this.logger){var e=this.logger.log;return"object"==typeof this.logger.log&&(e=Function.prototype.bind.call(this.logger.log,this.logger)),e.apply(this.logger,arguments)}return void 0}};e(r);var s=Backbone.Model.extend({initialize:function(e){if(this._checkEnabledSessionStorage(),!e.id)throw new Error("SessionStorageModel requires an id in the initial attributes");this.id=e.id;var t=this.isNew()?{}:this._read(this);this.clear({silent:!0}),this.save(_.extend({},this.defaults,t,e),{silent:!0}),this.on("change",function(){this.save()})},_checkEnabledSessionStorage:function(){try{return sessionStorage.length}catch(e){return alert("Please enable cookies in your browser for this Galaxy site"),!1}},sync:function(e,t,i){i.silent||t.trigger("request",t,{},i);var n={};switch(e){case"create":n=this._create(t);break;case"read":n=this._read(t);break;case"update":n=this._update(t);break;case"delete":n=this._delete(t)}return void 0!==n||null!==n?i.success&&i.success():i.error&&i.error(),n},_create:function(e){try{var t=e.toJSON(),i=sessionStorage.setItem(e.id,JSON.stringify(t));return null===i?i:t}catch(n){if(!(n instanceof DOMException&&navigator.userAgent.indexOf("Safari")>-1))throw n}return null},_read:function(e){return JSON.parse(sessionStorage.getItem(e.id))},_update:function(e){return e._create(e)},_delete:function(e){return sessionStorage.removeItem(e.id)},isNew:function(){return!sessionStorage.hasOwnProperty(this.id)},_log:function(){return JSON.stringify(this.toJSON(),null," ")},toString:function(){return"SessionStorageModel("+this.id+")"}});!function(){s.prototype=_.omit(s.prototype,"url","urlRoot")}();var o={searchAttributes:[],searchAliases:{},searchAttribute:function(e,t){var i=this.get(e);return t&&void 0!==i&&null!==i?_.isArray(i)?this._searchArrayAttribute(i,t):-1!==i.toString().toLowerCase().indexOf(t.toLowerCase()):!1},_searchArrayAttribute:function(e,t){return t=t.toLowerCase(),_.any(e,function(e){return-1!==e.toString().toLowerCase().indexOf(t.toLowerCase())})},search:function(e){var t=this;return _.filter(this.searchAttributes,function(i){return t.searchAttribute(i,e)})},matches:function(e){var t="=",i=e.split(t);if(i.length>=2){var n=i[0];return n=this.searchAliases[n]||n,this.searchAttribute(n,i[1])}return!!this.search(e).length},matchesAll:function(e){var t=this;return e=e.match(/(".*"|\w*=".*"|\S*)/g).filter(function(e){return!!e}),_.all(e,function(e){return e=e.replace(/"/g,""),t.matches(e)})}},a={hiddenUntilActivated:function(e,t){if(t=t||{},this.HUAVOptions={$elementShown:this.$el,showFn:jQuery.prototype.toggle,showSpeed:"fast"},_.extend(this.HUAVOptions,t||{}),this.HUAVOptions.hasBeenShown=this.HUAVOptions.$elementShown.is(":visible"),this.hidden=this.isHidden(),e){var i=this;e.on("click",function(e){i.toggle(i.HUAVOptions.showSpeed)})}},isHidden:function(){return this.HUAVOptions.$elementShown.is(":hidden")},toggle:function(){return this.hidden?(this.HUAVOptions.hasBeenShown||_.isFunction(this.HUAVOptions.onshowFirstTime)&&(this.HUAVOptions.hasBeenShown=!0,this.HUAVOptions.onshowFirstTime.call(this)),_.isFunction(this.HUAVOptions.onshow)&&(this.HUAVOptions.onshow.call(this),this.trigger("hiddenUntilActivated:shown",this)),this.hidden=!1):(_.isFunction(this.HUAVOptions.onhide)&&(this.HUAVOptions.onhide.call(this),this.trigger("hiddenUntilActivated:hidden",this)),this.hidden=!0),this.HUAVOptions.showFn.apply(this.HUAVOptions.$elementShown,arguments)}},l={initialize:function(e){this.draggable=e.draggable||!1},$dragHandle:function(){return this.$(".title-bar")},toggleDraggable:function(){this.draggable?this.draggableOff():this.draggableOn()},draggableOn:function(){this.draggable=!0,this.dragStartHandler=_.bind(this._dragStartHandler,this),this.dragEndHandler=_.bind(this._dragEndHandler,this);var e=this.$dragHandle().attr("draggable",!0).get(0);e.addEventListener("dragstart",this.dragStartHandler,!1),e.addEventListener("dragend",this.dragEndHandler,!1)},draggableOff:function(){this.draggable=!1;var e=this.$dragHandle().attr("draggable",!1).get(0);e.removeEventListener("dragstart",this.dragStartHandler,!1),e.removeEventListener("dragend",this.dragEndHandler,!1)},_dragStartHandler:function(e){return e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text",JSON.stringify(this.model.toJSON())),this.trigger("draggable:dragstart",e,this),!1},_dragEndHandler:function(e){return this.trigger("draggable:dragend",e,this),!1}},c={initialize:function(e){this.selectable=e.selectable||!1,this.selected=e.selected||!1},$selector:function(){return this.$(".selector")},_renderSelected:function(){this.$selector().find("span").toggleClass("fa-check-square-o",this.selected).toggleClass("fa-square-o",!this.selected)},toggleSelector:function(){this.$selector().is(":visible")?this.hideSelector():this.showSelector()},showSelector:function(e){e=void 0!==e?e:this.fxSpeed,this.selectable=!0,this.trigger("selectable",!0,this),this._renderSelected(),this.$selector().show(e)},hideSelector:function(e){e=void 0!==e?e:this.fxSpeed,this.selectable=!1,this.trigger("selectable",!1,this),this.$selector().hide(e)},toggleSelect:function(e){this.selected?this.deselect(e):this.select(e)},select:function(e){return this.selected||(this.trigger("selected",this,e),this.selected=!0,this._renderSelected()),!1},deselect:function(e){return this.selected&&(this.trigger("de-selected",this,e),this.selected=!1,this._renderSelected()),!1}};return{LoggableMixin:r,SessionStorageModel:s,mixin:i,SearchableModelMixin:o,HiddenUntilActivatedViewMixin:a,DraggableViewMixin:l,SelectableViewMixin:c,wrapTemplate:n}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[],r=function(){var e={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};return e.READY_STATES=[e.OK,e.EMPTY,e.PAUSED,e.FAILED_METADATA,e.NOT_VIEWABLE,e.DISCARDED,e.ERROR],e.NOT_READY_STATES=[e.UPLOAD,e.QUEUED,e.RUNNING,e.SETTING_METADATA,e.NEW],e}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r,s;!function(i,o){r=[],n=o,s="function"==typeof n?n.apply(t,r):n,!(void 0!==s&&(e.exports=s))}(this,function(){var e=function(e){e=e||{},e.tooltipConfig=e.tooltipConfig||{placement:"bottom"},e.classes=["icon-btn"].concat(e.classes||[]),e.disabled&&e.classes.push("disabled");var t=['','',""].join(""),i=$(t).tooltip(e.tooltipConfig);return _.isFunction(e.onclick)&&i.click(e.onclick),i};return e})},function(e,t,i){var n,r;n=[i(13),i(9),i(2),i(1)],r=function(e,t,i,n){var r=e.FoldoutListItemView,s=e.ListItemView,o=r.extend({className:r.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(e){this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,r.prototype.initialize.call(this,e)},_setUpListeners:function(){r.prototype._setUpListeners.call(this),this.model.on("change",function(e,t){_.isEqual(_.keys(e.changed),["deleted"])&&this.render()},this)},_renderSubtitle:function(){var e=$('
    ');switch(this.model.get("collection_type")){case"list":return e.text(n("a list of datasets"));case"paired":return e.text(n("a pair of datasets"));case"list:paired":return e.text(n("a list of paired datasets"))}return e},_getFoldoutPanelOptions:function(){var e=r.prototype._getFoldoutPanelOptions.call(this);return _.extend(e,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCListItemView("+e+")"}});o.prototype.templates=function(){var e=_.extend({},r.prototype.templates.warnings,{error:i.wrapTemplate(["<% if( model.error ){ %>",'
    ',n("There was an error getting the data for this collection"),": <%- model.error %>","
    ","<% } %>"]),purged:i.wrapTemplate(["<% if( model.purged ){ %>",'
    ',n("This collection has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:i.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',n("This collection has been deleted"),"
    ","<% } %>"])}),t=i.wrapTemplate(['
    ','
    ','<%- collection.element_identifier || collection.name %>',"
    ",'
    ',"
    "],"collection");return _.extend({},r.prototype.templates,{warnings:e,titleBar:t})}();var a=s.extend({className:s.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DCEListItemView.initialize:",e),s.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCEListItemView("+e+")"}});a.prototype.templates=function(){var e=i.wrapTemplate(['
    ','
    ','<%- element.element_identifier %>',"
    ",'
    ',"
    "],"element");return _.extend({},s.prototype.templates,{titleBar:e})}();var l=t.DatasetListItemView.extend({className:t.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log("DatasetDCEListItemView.initialize:",e),t.DatasetListItemView.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetDCEListItemView("+e+")"}});l.prototype.templates=function(){var e=i.wrapTemplate(['
    ','','
    ','<%- element.element_identifier %>',"
    ","
    "],"element");return _.extend({},t.DatasetListItemView.prototype.templates,{titleBar:e})}();var c=o.extend({className:o.prototype.className+" dataset-collection-element",_swapNewRender:function(e){o.prototype._swapNewRender.call(this,e);var t=this.model.get("state")||"ok";return this.$el.addClass("state-"+t),this.$el},toString:function(){var e=this.model?this.model+"":"(no model)";return"NestedDCDCEListItemView("+e+")"}});return{DCListItemView:o,DCEListItemView:a,DatasetDCEListItemView:l,NestedDCDCEListItemView:c}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(20),i(2),i(1)],r=function(e,t,i){var n={defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(e){return _.extend(e,e.object,{element_id:e.id}),delete e.object,e},constructor:function(e,t){e=this._mergeObject(e),this.idAttribute="element_id",Backbone.Model.apply(this,arguments)},parse:function(e,t){var i=e;return i=this._mergeObject(i)}},r=Backbone.Model.extend(t.LoggableMixin).extend(n),s=Backbone.Collection.extend(t.LoggableMixin).extend({model:r,initialize:function(e,t){this.debug(this+"(DCECollection).initialize:",e,t),t=t||{}},toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),o=e.DatasetAssociation.extend(t.mixin(n,{defaults:_.extend({},e.DatasetAssociation.prototype.defaults,n.defaults),constructor:function(e,t){this.debug(" DatasetDCE.constructor:",e,t),n.constructor.call(this,e,t)},initialize:function(t,i){this.debug(this+"(DatasetDCE).initialize:",t,i),e.DatasetAssociation.prototype.initialize.call(this,t,i)},toString:function(){var e=this.get("element_identifier");return["DatasetDCE(",e,")"].join("")}})),a=s.extend({model:o,initialize:function(e,t){this.debug(this+"(DatasetDCECollection).initialize:",e,t),s.prototype.initialize.call(this,e,t)},toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),l=Backbone.Model.extend(t.LoggableMixin).extend(t.SearchableModelMixin).extend({defaults:{collection_type:null,deleted:!1},collectionClass:s,initialize:function(e,t){this.debug(this+"(DatasetCollection).initialize:",e,t,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var e=this.get("elements")||[];return this.unset("elements",{silent:!0}),this.elements=new this.collectionClass(e),this.elements},toJSON:function(){var e=Backbone.Model.prototype.toJSON.call(this);return this.elements&&(e.elements=this.elements.toJSON()),e},inReadyState:function(){return!0},hasDetails:function(){return this.debug("hasDetails:",this.elements.length),0!==this.elements.length},getVisibleContents:function(e){return this.elements},"delete":function(e){return this.get("deleted")?jQuery.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?jQuery.when():this.save({deleted:!1},e)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name"],toString:function(){var e=[this.get("id"),this.get("name")||this.get("element_identifier")];return"DatasetCollection("+e.join(",")+")"}}),c=l.extend({collectionClass:a,initialize:function(e,t){this.debug(this+"(ListDatasetCollection).initialize:",e,t),l.prototype.initialize.call(this,e,t)},toString:function(){return["ListDatasetCollection(",this.get("name"),")"].join("")}}),d=c.extend({initialize:function(e,t){this.debug(this+"(PairDatasetCollection).initialize:",e,t),c.prototype.initialize.call(this,e,t)},toString:function(){return["PairDatasetCollection(",this.get("name"),")"].join("")}}),u=l.extend(t.mixin(n,{constructor:function(e,t){this.debug(" NestedDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedDCDCE(",e,")"].join("")}})),h=s.extend({model:u,initialize:function(e,t){this.debug(this+"(NestedDCDCECollection).initialize:",e,t),s.prototype.initialize.call(this,e,t)},toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),p=d.extend(t.mixin(n,{constructor:function(e,t){this.debug(" NestedPairDCDCE.constructor:",e,t),n.constructor.call(this,e,t)},toString:function(){var e=this.object?""+this.object:this.get("element_identifier");return["NestedPairDCDCE(",e,")"].join("")}})),f=h.extend({model:p,initialize:function(e,t){this.debug(this+"(NestedPairDCDCECollection).initialize:",e,t),h.prototype.initialize.call(this,e,t)},toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),g=l.extend({collectionClass:f,initialize:function(e,t){this.debug(this+"(ListPairedDatasetCollection).initialize:",e,t),l.prototype.initialize.call(this,e,t)},toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}});return{ListDatasetCollection:c,PairDatasetCollection:d,ListPairedDatasetCollection:g}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(25),i(6),i(5),i(2),i(1)],r=function(e,t,i,n,r){var s=e.ModelListPanel,o=s.extend({className:s.prototype.className+" dataset-collection-panel",DatasetDCEViewClass:i.DatasetDCEListItemView,NestedDCDCEViewClass:i.NestedDCDCEListItemView,modelCollectionKey:"elements",initialize:function(e){s.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank",this.hasUser=e.hasUser,this.panelStack=[],this.parentName=e.parentName,this.foldoutStyle=e.foldoutStyle||"foldout"},_filterCollection:function(){return this.model.getVisibleContents()},_getItemViewClass:function(e){switch(e.get("element_type")){case"hda":return this.DatasetDCEViewClass;case"dataset_collection":return this.NestedDCDCEViewClass}throw new TypeError("Unknown element type:",e.get("element_type"))},_getItemViewOptions:function(e){var t=s.prototype._getItemViewOptions.call(this,e);return _.extend(t,{linkTarget:this.linkTarget,hasUser:this.hasUser,foldoutStyle:this.foldoutStyle})},_setUpItemViewListeners:function(e){var t=this;return s.prototype._setUpItemViewListeners.call(t,e),e.on("expanded:drilldown",function(e,t){this._expandDrilldownPanel(t)},this),e.on("collapsed:drilldown",function(e,t){this._collapseDrilldownPanel(t)},this),this},_expandDrilldownPanel:function(e){this.panelStack.push(e),this.$("> .controls").add(this.$list()).hide(),e.parentName=this.model.get("name"),this.$el.append(e.render().$el)},_collapseDrilldownPanel:function(e){this.panelStack.pop(),this.render()},events:{"click .navigation .back":"close"},close:function(e){this.$el.remove(),this.trigger("close")},toString:function(){return"CollectionPanel("+(this.model?this.model.get("name"):"")+")"}});o.prototype.templates=function(){var e=n.wrapTemplate(['
    ','",'
    ','
    <%- collection.name || collection.element_identifier %>
    ','
    ','<% if( collection.collection_type === "list" ){ %>',r("a list of datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',r("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',r("a list of paired datasets"),"<% } %>","
    ","
    ","
    "],"collection");return _.extend(_.clone(s.prototype.templates),{controls:e})}();var a=o.extend({DatasetDCEViewClass:i.DatasetDCEListItemView,toString:function(){return"ListCollectionPanel("+(this.model?this.model.get("name"):"")+")"}}),l=a.extend({toString:function(){return"PairCollectionPanel("+(this.model?this.model.get("name"):"")+")"}}),c=o.extend({NestedDCDCEViewClass:i.NestedDCDCEListItemView.extend({foldoutPanelClass:l}),toString:function(){return"ListOfPairsCollectionPanel("+(this.model?this.model.get("name"):"")+")"}});return{CollectionPanel:o,ListCollectionPanel:a,PairCollectionPanel:l,ListOfPairsCollectionPanel:c}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(10),i(3),i(2),i(49),i(32),i(1),i(29)],r=function(e,t,i,n,r,s){function o(e){var t=e.toJSON(),i=d(t,{creationFn:function(t,i){return t=t.map(function(e){return{id:e.id,name:e.name,src:"dataset"===e.history_content_type?"hda":"hdca"}}),e.createHDCA(t,"list",i)}});return i}var a=Backbone.View.extend(i.LoggableMixin).extend({tagName:"li",className:"collection-element",initialize:function(e){this.element=e.element||{},this.selected=e.selected||!1},render:function(){return this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})),this.selected&&this.$el.addClass("selected"),this},template:_.template(['',"<%= element.name %>","",'"].join("")),select:function(e){this.$el.toggleClass("selected",e),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var e=this,t=this.$el.parent().width();this.$el.animate({"margin-right":t},"fast",function(){e.trigger("discard",{source:e}),e.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(e){e.stopPropagation(),this.select(e)},_clickName:function(e){e.stopPropagation(),e.preventDefault();var t=([s("Enter a new name for the element"),":\n(",s("Note that changing the name here will not rename the dataset"),")"].join(""),prompt(s("Enter a new name for the element")+":",this.element.name));t&&(this.element.name=t,this.render())},_clickDiscard:function(e){e.stopPropagation(),this.discard()},_dragstart:function(e){e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(e){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"DatasetCollectionElementView()"}}),l=Backbone.View.extend(i.LoggableMixin).extend({elementViewClass:a,collectionClass:e.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},initialize:function(e){this.metric("ListCollectionCreator.initialize",e);var t=this;_.each(this.defaultAttributes,function(i,n){i=e[n]||i,t[n]=i}),t.initialElements=e.elements||[],this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(e){e.hasOwnProperty("id")||(e.id=_.uniqueId())}),this.workingElements},_validateElements:function(){var e=this;return e.invalidElements=[],this.workingElements=this.workingElements.filter(function(t){var i=e._isElementInvalid(t);return i&&e.invalidElements.push({element:t,text:i}),!i}),this.workingElements},_isElementInvalid:function(e){return"dataset"!==e.history_content_type?s("is not a dataset"):e.state!==t.OK?s(_.contains(t.NOT_READY_STATES,e.state)?"hasn't finished running yet":"has errored, is paused, or is not accessible"):e.deleted||e.purged?s("has been deleted or purged"):null},_mangleDuplicateNames:function(){var e=900,t=1,i={};this.workingElements.forEach(function(n){for(var r=n.name;i.hasOwnProperty(r);)if(r=n.name+" ("+t+")",t+=1,t>=e)throw new Error("Safety hit in while loop - thats impressive");n.name=r,i[n.name]=!0})},_sortElements:function(e){},render:function(e,t){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(e,t){var i=this,n=jQuery("
    "),r=i.$list();_.each(this.elementViews,function(e){e.destroy(),i.removeElementView(e)}),i.workingElements.forEach(function(e){var t=i._createElementView(e);n.append(t.$el)}),i._renderClearSelected(),r.empty().append(n.children()),_.invoke(i.elementViews,"render"),r.height()>r.css("max-height")?r.css("border-width","1px 0px 1px 0px"):r.css("border-width","0px")},_createElementView:function(e){var t=new this.elementViewClass({element:e,selected:_.has(this.selectedIds,e.id)});return this.elementViews.push(t),this._listenToElementView(t),t},_listenToElementView:function(e){var t=this;t.listenTo(e,{select:function(e){var i=e.source.element;e.selected?t.selectedIds[i.id]=!0:delete t.selectedIds[i.id],t.trigger("elements:select",e)},discard:function(e){t.trigger("elements:discard",e)}})},addElementView:function(e){},removeElementView:function(e){delete this.selectedIds[e.element.id],this._renderClearSelected(),this.elementViews=_.without(this.elementViews,e),this.stopListening(e)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(e){return e},createList:function(e){if(!this.workingElements.length){var t=s("No valid elements for final list")+". ";return t+=''+s("Cancel")+" ",t+=s("or"),t+=' '+s("start over")+".",void this._showAlert(t)}var i=this,n=this.workingElements.map(function(e){return i._elementToJSON(e)});return i.blocking=!0,i.creationFn(n,e).always(function(){i.blocking=!1}).fail(function(e,t,n){i.trigger("error",{xhr:e,status:t,message:s("An error occurred while creating this collection")})}).done(function(e,t,n){i.trigger("collection:created",e,t,n),i.metric("collection:created",e),"function"==typeof i.oncreate&&i.oncreate.call(this,e,t,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(e){this._renderClearSelected()}),this.on("elements:discard",function(e){var t=e.source.element;this.removeElementView(e.source),this.workingElements=_.without(this.workingElements,t),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(e){this.error(e);var t=this;if(content=e.message||s("An error occurred"),e.xhr){var i=e.xhr,n=e.message;0===i.readyState&&0===i.status?content+=": "+s("Galaxy could not be reached and may be updating.")+s(" Try again in a few minutes."):i.responseJSON?content+=":
    "+JSON.stringify(i.responseJSON)+"
    ":content+=": "+n}t._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(e){e.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){e.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(e){e.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(e,t){t=t||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(t).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(e){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(e){e.preventDefault();var t=this.$list();this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestElement(e.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=$('
    ');i.size()?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=2,n=e.offset(),r=e.scrollTop(),s=t-n.top,o=n.top+e.outerHeight()-t;s>=0&&s=0&&oe&&e>s-o)return r}return $()},_dropElements:function(e){e.originalEvent&&(e=e.originalEvent),e.preventDefault(),e.dataTransfer.dropEffect="move";var t=this._getNearestElement(e.clientY);return t.size()?this.$dragging.insertBefore(t):this.$dragging.insertAfter(this.$(".collection-elements .collection-element").last()),this._syncOrderToDom(),!1},_syncOrderToDom:function(){var e=this,t=[];this.$(".collection-elements .collection-element").each(function(){var i=$(this).attr("data-element-id"),n=_.findWhere(e.workingElements,{id:i});n?t.push(n):console.error("missing element: ",i)}),this.workingElements=t,this._renderList()},_elementDragstart:function(e,t){t.select(!0),this.$dragging=this.$(".collection-elements .collection-element.selected")},_elementDragend:function(e,t){$(".element-drop-placeholder").remove(),this.$dragging=null},_changeName:function(e){this._validationWarning("name",!!this._getName()); +},_nameCheckForEnter:function(e){13!==e.keyCode||this.blocking||this._clickCreate()},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(e){var t=this._getName();t?this.blocking||this.createList(t):this._validationWarning("name")},templates:{main:_.template(['
    ','
    ',''].join("")),header:_.template(['",'
    ','','',"
    "].join("")),middle:_.template(['",'
    ',"
    "].join("")),footer:_.template(['
    ','
    ','','
    ',s("Name"),":
    ","
    ","
    ",'
    ','
    ','",'
    ','",'","
    ","
    ",'
    ','","
    ","
    "].join("")),helpContent:_.template(["

    ",s(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"

    ","
      ","
    • ",s(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
    • ","
    • ",s(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
    • ","
    • ",s(["Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ",'them and you can then move those selected by dragging the ',"entire group. Deselect them by clicking them again or by clicking the ",'the "Clear selected" link.'].join("")),"
    • ","
    • ",s(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
    • ","
    • ",s(['Click the "Cancel" button to exit the interface.'].join("")),"
    • ","

    ","

    ",s(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"

    "].join("")),invalidElements:_.template([s("The following selections could not be included due to problems:"),"
      <% _.each( problems, function( problem ){ %>","
    • <%= problem.element.name %>: <%= problem.text %>
    • ","<% }); %>
    "].join("")),noElementsLeft:_.template(['
  • ',s("No elements left! "),s("Would you like to "),'',s("start over"),"?","
  • "].join("")),invalidInitial:_.template(['
    ','
    ','',"<% if( _.size( problems ) ){ %>",s("The following selections could not be included due to problems"),":","
      <% _.each( problems, function( problem ){ %>","
    • <%= problem.element.name %>: <%= problem.text %>
    • ","<% }); %>
    ","<% } else if( _.size( elements ) < 1 ){ %>",s("No datasets were selected"),".","<% } %>","
    ",s("At least one element is needed for the collection"),". ",s("You may need to "),'',s("cancel")," ",s("and reselect new elements"),".","
    ","
    ","
    ",'"].join(""))},toString:function(){return"ListCollectionCreator"}}),c=function(e,t,i){var r,o=jQuery.Deferred(),a=Galaxy.modal||new n.View;return t=_.defaults(t||{},{elements:e,oncancel:function(){a.hide(),o.reject("cancelled")},oncreate:function(e,t){a.hide(),o.resolve(t)}}),r=new i(t),a.show({title:t.title||s("Create a collection"),body:r.$el,width:"80%",height:"min-content",closing_events:!0}),r.render(),window._collectionCreator=r,o},d=function(e,t){return t=t||{},t.title=s("Create a collection from a list of datasets"),c(e,t,l)};return{DatasetCollectionElementView:a,ListCollectionCreator:l,collectionCreatorModal:c,listCollectionCreatorModal:d,createListCollection:o}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(13),i(3),i(4),i(2),i(1)],r=function(e,t,i,n,r){var s=e.ListItemView,o=s.extend({className:s.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(e){e.logger&&(this.logger=this.model.logger=e.logger),this.log(this+".initialize:",e),s.prototype.initialize.call(this,e),this.linkTarget=e.linkTarget||"_blank",this._setUpListeners()},_setUpListeners:function(){s.prototype._setUpListeners.call(this),this.model.on("change",function(e,t){this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()?this.model.fetch():this.render()},this)},_fetchModelDetails:function(){var e=this;return e.model.inReadyState()&&!e.model.hasDetails()?e.model.fetch({silent:!0}):jQuery.when()},remove:function(e,t){var i=this;e=e||this.fxSpeed,this.$el.fadeOut(e,function(){Backbone.View.prototype.remove.call(i),t&&t.call(i)})},render:function(e){return s.prototype.render.call(this,e)},_swapNewRender:function(e){return s.prototype._swapNewRender.call(this,e),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var e=this.model.get("state");if(e===t.NOT_VIEWABLE||e===t.DISCARDED||!this.model.get("accessible"))return null;var n={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))n.disabled=!0,n.title=r("Cannot display datasets removed from disk");else if(e===t.UPLOAD)n.disabled=!0,n.title=r("This dataset must finish uploading before it can be viewed");else if(e===t.NEW)n.disabled=!0,n.title=r("This dataset is not yet viewable");else{n.title=r("View data"),n.href=this.model.urls.display;var s=this;n.onclick=function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add_dataset(s.model.get("id")),e.preventDefault())}}return n.faIcon="fa-eye",i(n)},_renderDetails:function(){if(this.model.get("state")===t.NOT_VIEWABLE)return $(this.templates.noAccess(this.model.toJSON(),this));var e=s.prototype._renderDetails.call(this);return e.find(".actions .left").empty().append(this._renderSecondaryActions()),e.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),e.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(e),e},_renderSummary:function(){var e=this.model.toJSON(),t=this.templates.summaries[e.state];return(t=t||this.templates.summaries.unknown)(e,this)},_renderDetailMessages:function(){var e=this,t=$('
    '),i=e.model.toJSON();return _.each(e.templates.detailMessages,function(n){t.append($(n(i,e)))}),t},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case t.NOT_VIEWABLE:return[];case t.OK:case t.FAILED_METADATA:case t.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return i({title:r("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:_.isEmpty(this.model.get("meta_files"))?$(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var e=this.model.urls;return $(['"].join("\n"))},events:_.extend(_.clone(s.prototype.events),{"click .display-btn":function(e){this.trigger("display",this,e)},"click .params-btn":function(e){this.trigger("params",this,e)},"click .download-btn":function(e){this.trigger("download",this,e)}}),toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetListItemView("+e+")"}});return o.prototype.templates=function(){var e=_.extend({},s.prototype.templates.warnings,{failed_metadata:n.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
    ',r("An error occurred setting the metadata for this dataset"),"
    ","<% } %>"]),error:n.wrapTemplate(["<% if( model.error ){ %>",'
    ',r("There was an error getting the data for this dataset"),": <%- model.error %>","
    ","<% } %>"]),purged:n.wrapTemplate(["<% if( model.purged ){ %>",'
    ',r("This dataset has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:n.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',r("This dataset has been deleted"),"
    ","<% } %>"])}),i=n.wrapTemplate(['
    ','
    ','
    ','
    ','
    ',"
    ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
    ','
    ','
    ',"<% if( dataset.peek ){ %>",'
    <%= dataset.peek %>
    ',"<% } %>","<% } %>","
    "],"dataset"),o=n.wrapTemplate(['
    ','
    ',r("You do not have permission to view this dataset"),"
    ","
    "],"dataset"),a={};a[t.OK]=a[t.FAILED_METADATA]=n.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
    ','<%- dataset.misc_blurb %>',"
    ","<% } %>","<% if( dataset.file_ext ){ %>",'
    ','",'<%- dataset.file_ext %>',"
    ","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
    ','",'',"<%- dataset.metadata_dbkey %>","","
    ","<% } %>","<% if( dataset.misc_info ){ %>",'
    ','<%- dataset.misc_info %>',"
    ","<% } %>"],"dataset"),a[t.NEW]=n.wrapTemplate(["
    ",r("This is a new dataset and not all of its data are available yet"),"
    "],"dataset"),a[t.NOT_VIEWABLE]=n.wrapTemplate(["
    ",r("You do not have permission to view this dataset"),"
    "],"dataset"),a[t.DISCARDED]=n.wrapTemplate(["
    ",r("The job creating this dataset was cancelled before completion"),"
    "],"dataset"),a[t.QUEUED]=n.wrapTemplate(["
    ",r("This job is waiting to run"),"
    "],"dataset"),a[t.RUNNING]=n.wrapTemplate(["
    ",r("This job is currently running"),"
    "],"dataset"),a[t.UPLOAD]=n.wrapTemplate(["
    ",r("This dataset is currently uploading"),"
    "],"dataset"),a[t.SETTING_METADATA]=n.wrapTemplate(["
    ",r("Metadata is being auto-detected"),"
    "],"dataset"),a[t.PAUSED]=n.wrapTemplate(["
    ",r('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
    "],"dataset"),a[t.ERROR]=n.wrapTemplate(["<% if( !dataset.purged ){ %>","
    <%- dataset.misc_blurb %>
    ","<% } %>",'',r("An error occurred with this dataset"),":",'
    <%- dataset.misc_info %>
    '],"dataset"),a[t.EMPTY]=n.wrapTemplate(["
    ",r("No data"),": <%- dataset.misc_blurb %>
    "],"dataset"),a.unknown=n.wrapTemplate(['
    Error: unknown dataset state: "<%- dataset.state %>"
    '],"dataset");var l={resubmitted:n.wrapTemplate(["<% if( model.resubmitted ){ %>",'
    ',r("The job creating this dataset has been resubmitted"),"
    ","<% } %>"])},c=n.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
    ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
    ","<% }); %>"],"apps");return _.extend({},s.prototype.templates,{warnings:e,details:i,noAccess:o,summaries:a,detailMessages:l,displayApplications:c})}(),{DatasetListItemView:o}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(6),i(11),i(1)],r=function(e,t,i){function n(e){return function(t,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",t=t||{},t.type="dataset_collection"),e.call(this,t,i)}}var r=t.HistoryContentMixin,s=e.ListDatasetCollection,o=e.PairDatasetCollection,a=e.ListPairedDatasetCollection,l=s.extend(r).extend({defaults:_.extend(_.clone(s.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(e,t){s.prototype.initialize.call(this,e,t),r.initialize.call(this,e,t)},save:n(s.prototype.save),toString:function(){return["HistoryListDatasetCollection(",this.get("name"),")"].join("")}}),c=o.extend(r).extend({defaults:_.extend(_.clone(o.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(e,t){o.prototype.initialize.call(this,e,t),r.initialize.call(this,e,t)},save:n(o.prototype.save),toString:function(){return["HistoryPairDatasetCollection(",this.get("name"),")"].join("")}}),d=a.extend(r).extend({defaults:_.extend(_.clone(a.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(e,t){a.prototype.initialize.call(this,e,t),r.initialize.call(this,e,t)},save:n(a.prototype.save),toString:function(){return["HistoryListPairedDatasetCollection(",this.get("name"),")"].join("")}});return{HistoryListDatasetCollection:l,HistoryPairDatasetCollection:c,HistoryListPairedDatasetCollection:d}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(3),i(2),i(1)],r=function(e,t,i){var n=function(e,t){return[e,t].join("-")},r={defaults:{history_id:null,history_content_type:null,hid:null,visible:!0},idAttribute:"type_id",constructor:function(e,t){e.type_id=n(e.history_content_type,e.id),this.debug("HistoryContentMixin.constructor:",e.type_id),Backbone.Model.apply(this,arguments)},_typeIdStr:function(){return n(this.get("history_content_type"),this.get("id"))},initialize:function(e,t){this.on("change:id",this._createTypeId)},_createTypeId:function(){this.set("type_id",this._typeIdStr())},isNew:function(){return!this.get("id")},hidden:function(){return!this.get("visible")},isVisible:function(e,t){var i=!0;return e||!this.get("deleted")&&!this.get("purged")||(i=!1),t||this.get("visible")||(i=!1),i},urlRoot:(window.Galaxy?Galaxy.options.root:"/")+"api/histories/",url:function(){var e=this.urlRoot+this.get("history_id")+"/contents/"+this.get("history_content_type")+"s/"+this.get("id");return e},hide:function(e){return this.get("visible")?this.save({visible:!1},e):jQuery.when()},unhide:function(e){return this.get("visible")?jQuery.when():this.save({visible:!0},e)},toString:function(){var e=this.get("id")||"";return this.get("name")&&(e=this.get("hid")+' :"'+this.get("name")+'",'+e),"HistoryContent("+e+")"}},s=Backbone.Model.extend(t.LoggableMixin).extend(r);return{typeIdStr:n,HistoryContentMixin:r,HistoryContent:s}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(11),i(22),i(10),i(2),i(1)],r=function(e,t,i,n,r){var s=Backbone.Collection.extend(n.LoggableMixin).extend({model:function(e,n){if("dataset"===e.history_content_type)return new t.HistoryDatasetAssociation(e,n);if("dataset_collection"===e.history_content_type){switch(e.collection_type){case"list":return new i.HistoryListDatasetCollection(e,n);case"paired":return new i.HistoryPairDatasetCollection(e,n);case"list:paired":return new i.HistoryListPairedDatasetCollection(e,n)}return{validationError:"Unknown collection_type: "+e.history_content_type}}return{validationError:"Unknown history_content_type: "+e.history_content_type}},initialize:function(e,t){t=t||{},this.historyId=t.historyId,this.model.prototype.idAttribute="type_id",this.on("all",function(){this.debug(this+".event:",arguments)})},urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},ids:function(){return this.map(function(e){return e.get("id")})},notReady:function(){return this.filter(function(e){return!e.inReadyState()})},running:function(){var e=[];return this.each(function(t){var i=!t.inReadyState();i&&e.push(t.get("id"))}),e},getByHid:function(e){return _.first(this.filter(function(t){return t.get("hid")===e}))},getVisible:function(e,t,i){i=i||[],this.debug("checking isVisible");var n=new s(this.filter(function(i){return i.isVisible(e,t)}));return _.each(i,function(e){_.isFunction(e)&&(n=new s(n.filter(e)))}),n},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},fetchAllDetails:function(e){e=e||{};var t={details:"all"};return e.data=e.data?_.extend(e.data,t):t,this.fetch(e)},ajaxQueue:function(e,t){var i=jQuery.Deferred(),n=this.length,r=[];if(!n)return i.resolve([]),i;var s=this.chain().reverse().map(function(o,a){return function(){var l=e.call(o,t);l.done(function(e){i.notify({curr:a,total:n,response:e,model:o})}),l.always(function(e){r.push(e),s.length?s.shift()():i.resolve(r)})}}).value();return s.shift()(),i},isCopyable:function(e){var t=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return _.isObject(e)&&e.id&&_.contains(t,e.model_class)},copy:function(e){var t,i,n;_.isString(e)?(t=e,n="hda",i="dataset"):(t=e.id,n={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[e.model_class]||"hda",i="hdca"===n?"dataset_collection":"dataset");var r=this,s=jQuery.post(this.url(),{content:t,source:n,type:i}).done(function(e){r.add([e])}).fail(function(e,o,a){r.trigger("error",r,s,{},"Error copying contents",{type:i,id:t,source:n})});return s},matches:function(e){return this.filter(function(t){return t.matches(e)})},set:function(t,i){_.each(t,function(t){t.type_id&&t.get&&t.get("type_id")||(t.type_id=e.typeIdStr(t.history_content_type,t.id))}),Backbone.Collection.prototype.set.call(this,t,i)},createHDCA:function(e,t,n,r){var s=this,o={list:i.HistoryListDatasetCollection,paired:i.HistoryPairDatasetCollection},a=new o[t]({history_id:this.historyId,name:n,element_identifiers:e});return a.save().done(function(e){s.add(a)}).fail(function(e,t,i){s.trigger("error",e,t,i)})},clone:function(){var e=Backbone.Collection.prototype.clone.call(this);return e.historyId=this.historyId,e},print:function(){var e=this;e.each(function(t){e.debug(t),t.elements&&e.debug(" elements:",t.elements)})},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});return{HistoryContents:s}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(2),i(1)],r=function(e,t){var i=Backbone.View.extend(e.LoggableMixin).extend({initialize:function(e){this.expanded=e.expanded||!1,this.log(" expanded:",this.expanded),this.fxSpeed=void 0!==e.fxSpeed?e.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(e){var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){var e=$(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(e).replaceWith(this._renderDetails().show()),e},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;$(i).queue("fx",[function(e){this.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){this.$el.fadeIn(t,e)},function(e){this.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",_.isFunction(this.className)?this.className():this.className).append(e.children())},_setUpBehaviors:function(e){e=e||this.$el,e.find("[title]").tooltip({placement:"bottom"})},$details:function(e){return e=e||this.$el,e.find("> .details")},_renderDetails:function(){var e=$(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(e),e},toggleExpanded:function(e){return e=void 0===e?!this.expanded:e,e?this.expand():this.collapse(),this},expand:function(){var e=this;return e._fetchModelDetails().always(function(){e._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?jQuery.when():this.model.fetch()},_expand:function(){var e=this,t=e._renderDetails();e.$details().replaceWith(t),e.expanded=!0,e.$details().slideDown({duration:e.fxSpeed,step:function(){e.trigger("expanding",e)},complete:function(){e.trigger("expanded",e)}})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var e=this;e.expanded=!1,this.$details().slideUp({duration:e.fxSpeed,step:function(){e.trigger("collapsing",e)},complete:function(){e.trigger("collapsed",e)}})}}),n=i.extend(e.mixin(e.SelectableViewMixin,e.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(t){i.prototype.initialize.call(this,t),e.SelectableViewMixin.initialize.call(this,t),e.DraggableViewMixin.initialize.call(this,t),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(e){e?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var e=i.prototype._buildNewRender.call(this);return e.children(".warnings").replaceWith(this._renderWarnings()),e.children(".title-bar").replaceWith(this._renderTitleBar()),e.children(".primary-actions").append(this._renderPrimaryActions()),e.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),e},_swapNewRender:function(e){return i.prototype._swapNewRender.call(this,e),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var e=this,t=$('
    '),i=e.model.toJSON();return _.each(e.templates.warnings,function(n){t.append($(n(i,e)))}),t},_renderTitleBar:function(){return $(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return $(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(e){e.stopPropagation(),e.altKey?(this.toggleSelect(e),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(e){var t=32,i=13;return!e||"keydown"!==e.type||e.keyCode!==t&&e.keyCode!==i?!0:(this.toggleExpanded(),e.stopPropagation(),!1)},toString:function(){var e=this.model?this.model+"":"(no model)";return"ListItemView("+e+")"}}));n.prototype.templates=function(){var t=e.wrapTemplate(['
    ','
    ','
    ','',"
    ",'
    ','
    ','
    ',"
    "]),i={},n=e.wrapTemplate(['
    ','','
    ','<%- element.name %>',"
    ",'
    ',"
    "],"element"),r=e.wrapTemplate(['
    ']),s=e.wrapTemplate(['
    ']);return{el:t,warnings:i,titleBar:n,subtitle:r,details:s}}();var r=n.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(e){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=e.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=e.foldoutPanelClass||this.foldoutPanelClass,n.prototype.initialize.call(this,e),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return $();var e=n.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,e)},_createFoldoutPanel:function(){var e=this.model,t=this._getFoldoutPanelClass(e),i=this._getFoldoutPanelOptions(e),n=new t(_.extend(i,{model:e}));return n},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(e,t){return t=t||this.$("> .details"),this.foldout=e.render(0),e.$("> .controls").hide(),t.append(e.$el)},expand:function(){var e=this;return e._fetchModelDetails().always(function(){"foldout"===e.foldoutStyle?e._expand():"drilldown"===e.foldoutStyle&&e._expandByDrilldown()})},_expandByDrilldown:function(){var e=this;e.foldout.on("close",function(){e.trigger("collapsed:drilldown",e,e.foldout)}),e.trigger("expanded:drilldown",e,e.foldout)}});return r.prototype.templates=function(){var t=e.wrapTemplate(['
    ',"
    "],"collection");return _.extend({},n.prototype.templates,{details:t})}(),{ExpandableView:i,ListItemView:n,FoldoutListItemView:r}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[],r=function(){var e=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(e){this.options=e,$("body").off(),this.setElement($(this._template(e))),$(this.el_masthead).append($(this.el)),this.$background=$(this.el).find("#masthead-background");var t=this;$(window).on("beforeunload",function(){var e="";for(key in t.list)if(t.list[key].options.onunload){var i=t.list[key].options.onunload();i&&(e+=i+" ")}return""!=e?e:void 0})},events:{click:"_click",mousedown:function(e){e.preventDefault()}},append:function(e){return this._add(e,!0)},prepend:function(e){return this._add(e,!1)},highlight:function(e){var t=$(this.el).find("#"+e+"> li");t&&t.addClass("active")},_add:function(e,t){var i=$(this.el).find("#"+e.location);if(i){var n=$(e.el);n.addClass("masthead-item"),t?i.append(n):i.prepend(n),this.list.push(e)}return null},_click:function(e){var t=$(this.el).find(".popup");t&&t.hide();var i=$(e.target).closest(".masthead-item").find(".popup");$(e.target).hasClass("head")?(i.show(),this.$background.show()):this.$background.hide()},_template:function(e){var t=e.brand?"/ "+e.brand:"";return''}}),t=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:!1,onclick:function(){alert("clicked")},onunload:null,visible:!0},location:"iconbar",initialize:function(e){e&&(this.options=_.defaults(e,this.options)),this.setElement($(this._template(this.options)));var t=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",t.options.onclick),this.options.visible||this.hide()},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(e){$(this.el).find(".icon").removeClass(this.options.icon).addClass(e),this.options.icon=e},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(e){$(this.el).find(".number").text(e)},_template:function(e){var t='
    ';return e.with_number&&(t+='
    '),t+="
    "}}),i=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:!1,onunload:null,visible:!0,disabled:!1,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(e){e&&(this.options=_.defaults(e,this.options)),void 0!==this.options.content&&-1===this.options.content.indexOf("//")&&(this.options.content=galaxy_config.root+this.options.content),this.setElement($(this._template(this.options))),this.options.disabled&&($(this.el).find(".root").addClass("disabled"),this._attachPopover()),this.options.visible||this.hide()},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(e){var t={title:"Title",content:"",type:"url",target:"_parent",scratchbook:!1,divider:!1};e&&(t=_.defaults(e,t)),t.content&&-1===t.content.indexOf("//")&&(t.content=galaxy_config.root+t.content),this.$menu||($(this.el).find(".root").append(this._templateMenu()),$(this.el).find(".symbol").addClass("caret"),this.$menu=$(this.el).find(".popup"));var i=$(this._templateMenuItem(t));this.$menu.append(i);var n=this;i.on("click",function(t){return t.preventDefault(),"_blank"===n.options.target?!0:void Galaxy.frame.add(e)}),t.divider&&this.$menu.append($(this._templateDivider()))},_head:function(e){e.preventDefault(),this.options.disabled||this.$menu||Galaxy.frame.add(this.options)},_attachPopover:function(){var e=$(this.el).find(".head");e.popover({html:!0,content:'Please log in or register to use this feature.', +placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){e.popover("hide")},5e3)})},_templateMenuItem:function(e){return'
  • '+e.title+"
  • "},_templateMenu:function(){return''},_templateDivider:function(){return'
  • '},_template:function(e){var t='';return t}});return{GalaxyMasthead:e,GalaxyMastheadTab:i,GalaxyMastheadIcon:t}}.apply(t,n),!(void 0!==r&&(e.exports=r))},,,,function(e,t,i){var n,r;n=[i(2),i(1)],r=function(e,t){var i=Backbone.View.extend(e.LoggableMixin).extend(e.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(e){e=e||{},this.tooltipConfig=e.tooltipConfig||{placement:"bottom"},this.listenTo(this.model,"change:annotation",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$el.find("[title]").tooltip(this.tooltipConfig),this.$annotation().make_text_editable({use_textarea:!0,on_finish:function(t){e.$annotation().text(t),e.model.save({annotation:t},{silent:!0}).fail(function(){e.$annotation().text(e.model.previous("annotation"))})}}),this},_template:function(){var e=this.model.get("annotation");return['",'
    ',_.escape(e),"
    "].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off(),this.stopListening(this.model),Backbone.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",this.model+"",")"].join("")}});return{AnnotationEditor:i}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(3),i(9),i(26),i(18),i(4),i(2),i(1)],r=function(e,t,i,n,r,s,o){var a=t.DatasetListItemView,l=a.extend({initialize:function(e){a.prototype.initialize.call(this,e),this.hasUser=e.hasUser,this.purgeAllowed=e.purgeAllowed||!1,this.tagsEditorShown=e.tagsEditorShown||!1,this.annotationEditorShown=e.annotationEditorShown||!1},_renderPrimaryActions:function(){var t=a.prototype._renderPrimaryActions.call(this);return this.model.get("state")===e.NOT_VIEWABLE?t:a.prototype._renderPrimaryActions.call(this).concat([this._renderEditButton(),this._renderDeleteButton()])},_renderEditButton:function(){if(this.model.get("state")===e.DISCARDED||!this.model.get("accessible"))return null;var t=this.model.get("purged"),i=this.model.get("deleted"),n={title:o("Edit attributes"),href:this.model.urls.edit,target:this.linkTarget,faIcon:"fa-pencil",classes:"edit-btn"};return i||t?(n.disabled=!0,t?n.title=o("Cannot edit attributes of datasets removed from disk"):i&&(n.title=o("Undelete dataset to edit attributes"))):_.contains([e.UPLOAD,e.NEW],this.model.get("state"))&&(n.disabled=!0,n.title=o("This dataset is not yet editable")),r(n)},_renderDeleteButton:function(){if(!this.model.get("accessible"))return null;var e=this,t=this.model.isDeletedOrPurged();return r({title:o(t?"Dataset is already deleted":"Delete"),disabled:t,faIcon:"fa-times",classes:"delete-btn",onclick:function(){e.$el.find(".icon-btn.delete-btn").trigger("mouseout"),e.model["delete"]()}})},_renderDetails:function(){var t=a.prototype._renderDetails.call(this),i=this.model.get("state");return!this.model.isDeletedOrPurged()&&_.contains([e.OK,e.FAILED_METADATA],i)&&(this._renderTags(t),this._renderAnnotation(t),this._makeDbkeyEditLink(t)),this._setUpBehaviors(t),t},_renderSecondaryActions:function(){var t=a.prototype._renderSecondaryActions.call(this);switch(this.model.get("state")){case e.UPLOAD:case e.NEW:case e.NOT_VIEWABLE:return t;case e.ERROR:return t.unshift(this._renderErrButton()),t.concat([this._renderRerunButton()]);case e.OK:case e.FAILED_METADATA:return t.concat([this._renderRerunButton(),this._renderVisualizationsButton()])}return t.concat([this._renderRerunButton()])},_renderErrButton:function(){return r({title:o("View or report this error"),href:this.model.urls.report_error,classes:"report-error-btn",target:this.linkTarget,faIcon:"fa-bug"})},_renderRerunButton:function(){return r({title:o("Run this job again"),href:this.model.urls.rerun,classes:"rerun-btn",target:this.linkTarget,faIcon:"fa-refresh"})},_renderVisualizationsButton:function(){var e=this.model.get("visualizations");if(this.model.isDeletedOrPurged()||!this.hasUser||!this.model.hasData()||_.isEmpty(e))return null;if(!_.isObject(e[0]))return this.warn("Visualizations have been switched off"),null;var t=$(this.templates.visualizations(e,this));return t.find('[target="galaxy_main"]').attr("target",this.linkTarget),this._addScratchBookFn(t.find(".visualization-link").addBack(".visualization-link")),t},_addScratchBookFn:function(e){e.click(function(e){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.add({title:"Visualization",type:"url",content:$(this).attr("href")}),e.preventDefault(),e.stopPropagation())})},_renderTags:function(e){if(this.hasUser){var t=this;this.tagsEditor=new i.TagsEditor({model:this.model,el:e.find(".tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.tagsEditorShown=!0},onhide:function(){t.tagsEditorShown=!1},$activator:r({title:o("Edit dataset tags"),classes:"tag-btn",faIcon:"fa-tags"}).appendTo(e.find(".actions .right"))}),this.tagsEditorShown&&this.tagsEditor.toggle(!0)}},_renderAnnotation:function(e){if(this.hasUser){var t=this;this.annotationEditor=new n.AnnotationEditor({model:this.model,el:e.find(".annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){t.annotationEditorShown=!0},onhide:function(){t.annotationEditorShown=!1},$activator:r({title:o("Edit dataset annotation"),classes:"annotate-btn",faIcon:"fa-comment"}).appendTo(e.find(".actions .right"))}),this.annotationEditorShown&&this.annotationEditor.toggle(!0)}},_makeDbkeyEditLink:function(e){if("?"===this.model.get("metadata_dbkey")&&!this.model.isDeletedOrPurged()){var t=$('?').attr("href",this.model.urls.edit).attr("target",this.linkTarget);e.find(".dbkey .value").replaceWith(t)}},events:_.extend(_.clone(a.prototype.events),{"click .undelete-link":"_clickUndeleteLink","click .purge-link":"_clickPurgeLink","click .edit-btn":function(e){this.trigger("edit",this,e)},"click .delete-btn":function(e){this.trigger("delete",this,e)},"click .rerun-btn":function(e){this.trigger("rerun",this,e)},"click .report-err-btn":function(e){this.trigger("report-err",this,e)},"click .visualization-btn":function(e){this.trigger("visualize",this,e)},"click .dbkey a":function(e){this.trigger("edit",this,e)}}),_clickUndeleteLink:function(e){return this.model.undelete(),!1},_clickPurgeLink:function(e){return this.model.purge(),!1},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDAEditView("+e+")"}});return l.prototype.templates=function(){var e=_.extend({},a.prototype.templates.warnings,{failed_metadata:s.wrapTemplate(['<% if( dataset.state === "failed_metadata" ){ %>','","<% } %>"],"dataset"),deleted:s.wrapTemplate(["<% if( dataset.deleted && !dataset.purged ){ %>",'
    ',o("This dataset has been deleted"),'
    ',o("Undelete it"),"","<% if( view.purgeAllowed ){ %>",'
    ',o("Permanently remove it from disk"),"","<% } %>","
    ","<% } %>"],"dataset")}),t=s.wrapTemplate(["<% if( visualizations.length === 1 ){ %>",'">','',"","<% } else { %>",'","<% } %>"],"visualizations");return _.extend({},a.prototype.templates,{warnings:e,visualizations:t})}(),{DatasetListItemEdit:l}}.apply(t,n),!(void 0!==r&&(e.exports=r))},function(e,t,i){var n,r;n=[i(3),i(2),i(1)],r=function(e,t,i){var n=t.SearchableModelMixin,r=Backbone.Model.extend(t.LoggableMixin).extend(t.mixin(n,{defaults:{state:e.NEW,deleted:!1,purged:!1,name:"(unnamed dataset)",accessible:!0,data_type:"",file_ext:"",file_size:0,meta_files:[],misc_blurb:"",misc_info:"",tags:[]},initialize:function(t,i){this.debug(this+"(Dataset).initialize",t,i), //!! this state is not in trans.app.model.Dataset.states - set it here - -this.get("accessible")||this.set("state",e.NOT_VIEWABLE),this.urls=this._generateUrls(),this._setUpListeners()},_generateUrls:function(){var e=this.get("id");if(!e)return{};var t={purge:"datasets/"+e+"/purge_async",display:"datasets/"+e+"/display/?preview=True",edit:"datasets/"+e+"/edit",download:"datasets/"+e+"/display?to_ext="+this.get("file_ext"),report_error:"dataset/errors?id="+e,rerun:"tool_runner/rerun?id="+e,show_params:"datasets/"+e+"/show_params",visualization:"visualization",meta_download:"dataset/get_metadata_file?hda_id="+e+"&metadata_name="},i=window.galaxy_config&&galaxy_config.root?galaxy_config.root:"/";return _.each(t,function(e,n){t[n]=i+e}),this.urls=t,t},_setUpListeners:function(){this.on("change:state",function(e,t){this.log(this+" has changed state:",e,t),this.inReadyState()&&this.trigger("state:ready",e,t,this.previous("state"))}),this.on("change:id change:file_ext",function(e){this._generateUrls()})},toJSON:function(){var e=Backbone.Model.prototype.toJSON.call(this);return _.extend(e,{urls:this.urls})},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},inReadyState:function(){var t=_.contains(e.READY_STATES,this.get("state"));return this.isDeletedOrPurged()||t},hasDetails:function(){return _.has(this.attributes,"genome_build")},hasData:function(){return this.get("file_size")>0},fetch:function(e){var t=this;return Backbone.Model.prototype.fetch.call(this,e).always(function(){t._generateUrls()})},"delete":function(e){return this.get("deleted")?jQuery.when():this.save({deleted:!0},e)},undelete:function(e){return!this.get("deleted")||this.get("purged")?jQuery.when():this.save({deleted:!1},e)},purge:function(e){if(this.get("purged"))return jQuery.when();e=e||{},e.url=this.urls.purge;var t=this,n=jQuery.ajax(e);return n.done(function(e,i,n){t.set({deleted:!0,purged:!0})}),n.fail(function(n,s,a){var o=i("Unable to purge dataset"),r="Removal of datasets by users is not allowed in this Galaxy instance";n.responseJSON&&n.responseJSON.error?o=n.responseJSON.error:-1!==n.responseText.indexOf(r)&&(o=r),n.responseText=o,t.trigger("error",t,n,e,i(o),{error:o})}),n},searchAttributes:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],searchAliases:{title:"name",format:"file_ext",database:"genome_build",blurb:"misc_blurb",description:"misc_blurb",info:"misc_info",tag:"tags"},toString:function(){var e=this.get("id")||"";return this.get("name")&&(e='"'+this.get("name")+'",'+e),"Dataset("+e+")"}})),a=Backbone.Collection.extend(t.LoggableMixin).extend({model:s,urlRoot:(window.galaxy_config&&galaxy_config.root?galaxy_config.root:"/")+"api/datasets",url:function(){return this.urlRoot},ids:function(){return this.map(function(e){return e.get("id")})},notReady:function(){return this.filter(function(e){return!e.inReadyState()})},haveDetails:function(){return this.all(function(e){return e.hasDetails()})},ajaxQueue:function(e,t){var i=jQuery.Deferred(),n=this.length,s=[];if(!n)return i.resolve([]),i;var a=this.chain().reverse().map(function(o,r){return function(){var l=e.call(o,t);l.done(function(e){i.notify({curr:r,total:n,response:e,model:o})}),l.always(function(e){s.push(e),a.length?a.shift()():i.resolve(s)})}}).value();return a.shift()(),i},matches:function(e){return this.filter(function(t){return t.matches(e)})},toString:function(){return["DatasetAssociationCollection(",this.length,")"].join("")}});return{DatasetAssociation:s,DatasetAssociationCollection:a}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(9),i(2),i(1)],s=function(e,t,i){var n=e.DatasetListItemView,s=n.extend({className:n.prototype.className+" history-content",initialize:function(e,t){n.prototype.initialize.call(this,e,t)},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDAListItemView("+e+")"}});return s.prototype.templates=function(){var e=t.wrapTemplate(['
    ','','
    ','<%- dataset.hid %> ','<%- dataset.name %>',"
    ","
    "],"dataset"),s=_.extend({},n.prototype.templates.warnings,{hidden:t.wrapTemplate(["<% if( !dataset.visible ){ %>",'
    ',i("This dataset has been hidden"),"
    ","<% } %>"],"dataset")});return _.extend({},n.prototype.templates,{titleBar:e,warnings:s})}(),{HDAListItemView:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(20),i(11),i(2),i(1)],s=function(e,t,i,n){var s=e.DatasetAssociation,a=t.HistoryContentMixin,o=s.extend(i.mixin(a,{constructor:function(e,t){a.constructor.call(this,e,t)},defaults:_.extend({},s.prototype.defaults,a.defaults,{model_class:"HistoryDatasetAssociation"}),initialize:function(e,t){s.prototype.initialize.call(this,e,t),a.initialize.call(this,e,t)},toString:function(){var e=this.get("id")||"";return this.get("name")&&(e=this.get("hid")+' :"'+this.get("name")+'",'+e),"HDA("+e+")"}}));return{HistoryDatasetAssociation:o}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(3),i(5),i(7),i(2),i(1)],s=function(e,t,i,n,s){var a=t.DCListItemView,o=a.extend({className:a.prototype.className+" history-content",_setUpListeners:function(){a.prototype._setUpListeners.call(this),this.model.on("change",function(e,t){_.isEqual(_.keys(e.changed),["visible"])&&this.render()},this)},_getFoldoutPanelClass:function(){switch(this.model.get("collection_type")){case"list":return i.ListCollectionPanel;case"paired":return i.PairCollectionPanel;case"list:paired":return i.ListOfPairsCollectionPanel}throw new TypeError("Uknown collection_type: "+this.model.get("collection_type"))},_swapNewRender:function(t){a.prototype._swapNewRender.call(this,t);var i=this.model.get("state")||e.OK;return this.$el.addClass("state-"+i),this.$el},toString:function(){var e=this.model?this.model+"":"(no model)";return"HDCAListItemView("+e+")"}});return o.prototype.templates=function(){var e=_.extend({},a.prototype.templates.warnings,{hidden:n.wrapTemplate(["<% if( !collection.visible ){ %>",'
    ',s("This collection has been hidden"),"
    ","<% } %>"],"collection")}),t=n.wrapTemplate(['
    ','','
    ','<%- collection.hid %> ','<%- collection.name %>',"
    ",'
    ',"
    "],"collection");return _.extend({},a.prototype.templates,{warnings:e,titleBar:t})}(),{HDCAListItemView:o}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(12),i(2),i(1)],s=function(e,t,i){var n=Backbone.Model.extend(t.LoggableMixin).extend(t.mixin(t.SearchableModelMixin,{defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",diskSize:0,deleted:!1},urlRoot:galaxy_config.root+"api/histories",initialize:function(t,i,n){n=n||{},this.logger=n.logger||null,this.log(this+".initialize:",t,i,n),this.log("creating history contents:",i),this.contents=new e.HistoryContents(i||[],{historyId:this.get("id")}),this._setUpListeners(),this.updateTimeoutId=null},_setUpListeners:function(){this.on("error",function(e,t,i,n,s){this.errorHandler(e,t,i,n,s)}),this.contents&&this.listenTo(this.contents,"error",function(){this.trigger.apply(this,["error:contents"].concat(jQuery.makeArray(arguments)))}),this.on("change:id",function(e,t){this.contents&&(this.contents.historyId=t)},this)},errorHandler:function(e,t,i,n,s){this.clearUpdateTimeout()},ownedByCurrUser:function(){return Galaxy&&Galaxy.currUser?Galaxy.currUser.isAnonymous()||Galaxy.currUser.id!==this.get("user_id")?!1:!0:!1},contentsCount:function(){return _.reduce(_.values(this.get("state_details")),function(e,t){return e+t},0)},searchAttributes:["name","annotation","tags"],searchAliases:{title:"name",tag:"tags"},checkForUpdates:function(e){return this.contents.running().length?this.setUpdateTimeout():(this.trigger("ready"),_.isFunction(e)&&e.call(this)),this},setUpdateTimeout:function(e){e=e||n.UPDATE_DELAY;var t=this;return this.clearUpdateTimeout(),this.updateTimeoutId=setTimeout(function(){t.refresh()},e),this.updateTimeoutId},clearUpdateTimeout:function(){this.updateTimeoutId&&(clearTimeout(this.updateTimeoutId),this.updateTimeoutId=null)},refresh:function(e,t){e=e||[],t=t||{};var i=this;t.data=t.data||{},e.length&&(t.data.details=e.join(","));var n=this.contents.fetch(t);return n.done(function(e){i.checkForUpdates(function(){this.fetch()})}),n},_delete:function(e){return this.get("deleted")?jQuery.when():this.save({deleted:!0},e)},purge:function(e){return this.get("purged")?jQuery.when():this.save({deleted:!0,purged:!0},e)},undelete:function(e){return this.get("deleted")?this.save({deleted:!1},e):jQuery.when()},copy:function(e,t){if(e=void 0!==e?e:!0,!this.id)throw new Error("You must set the history ID before copying it.");var i={history_id:this.id};e&&(i.current=!0),t&&(i.name=t);var s=this,a=jQuery.post(this.urlRoot,i);return e?a.then(function(e){var t=new n(e);return t.setAsCurrent().done(function(){s.trigger("copied",s,e)})}):a.done(function(e){s.trigger("copied",s,e)})},setAsCurrent:function(){var e=this,t=jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+this.id);return t.done(function(){e.trigger("set-as-current",e)}),t},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}}));n.UPDATE_DELAY=4e3,n.getHistoryData=function(e,t){function i(t){return"current"===e?jQuery.getJSON(galaxy_config.root+"history/current_history_json"):jQuery.ajax(galaxy_config.root+"api/histories/"+e)}function n(e){return e&&e.empty}function s(e){if(n(e))return[];_.isFunction(a)&&(a=a(e)),_.isFunction(o)&&(o=o(e));var t={};return a.length&&(t.dataset_details=a.join(",")),o.length&&(t.dataset_collection_details=o.join(",")),jQuery.ajax(galaxy_config.root+"api/histories/"+e.id+"/contents",{data:t})}t=t||{};var a=t.detailIdsFn||[],o=t.hdcaDetailIds||[],r=jQuery.Deferred(),l=null,c=t.historyFn||i,d=t.contentsFn||s,h=c(e);h.done(function(e){l=e,r.notify({status:"history data retrieved",historyJSON:l})}),h.fail(function(e,t,i){r.reject(e,"loading the history")});var u=h.then(d);return u.then(function(e){r.notify({status:"contents data retrieved",historyJSON:l,contentsJSON:e}),r.resolve(l,e)}),u.fail(function(e,t,i){r.reject(e,"loading the contents",{history:l})}),r};var s=Backbone.Collection.extend(t.LoggableMixin).extend({model:n,urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/histories",initialize:function(e,t){t=t||{},this.log("HistoryCollection.initialize",arguments),this.includeDeleted=t.includeDeleted||!1,this.setUpListeners()},setUpListeners:function(){var e=this;this.on("change:deleted",function(t){this.debug("change:deleted",e.includeDeleted,t.get("deleted")),!e.includeDeleted&&t.get("deleted")&&e.remove(t)}),this.on("copied",function(e,t){this.unshift(new n(t,[]))})},create:function(e,t,i,s){var a=this,o=jQuery.getJSON(galaxy_config.root+"history/create_new_current");return o.done(function(e){var t=new n(e,[],i||{});a.unshift(t),a.trigger("new-current")})},toString:function(){return"HistoryCollection("+this.length+")"}});return{History:n,HistoryCollection:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(13),i(50),i(2),i(1),i(30)],s=function(e,t,i,n){var s=Backbone.View.extend(i.LoggableMixin).extend({viewClass:e.ListItemView,collectionClass:Backbone.Collection,tagName:"div",className:"list-panel",fxSpeed:"fast",emptyMsg:n("This list is empty"),noneFoundMsg:n("No matching items found"),searchPlaceholder:n("search"),initialize:function(e,i){e=e||{},e.logger&&(this.logger=e.logger),this.log(this+".initialize:",e),this.fxSpeed=_.has(e,"fxSpeed")?e.fxSpeed:this.fxSpeed,this.filters=[],this.searchFor=e.searchFor||"",this.indicator=new t(this.$el),this.selecting=void 0!==e.selecting?e.selecting:!0,this.selected=e.selected||[],this.lastSelected=null,this.dragItems=e.dragItems||!1,this.viewClass=e.viewClass||this.viewClass,this.views=[],this.collection=e.collection||new this.collectionClass([]),this.filters=e.filters||[],this.$scrollContainer=e.$scrollContainer||this.$scrollContainer,this.title=e.title||"",this.subtitle=e.subtitle||"",this._setUpListeners()},freeViews:function(){return _.each(this.views,function(e){e.off()}),this.views=[],this},_setUpListeners:function(){return this.off(),this.on("error",function(e,t,i,n,s){console.error(e,t,i,n,s)},this),this.on("loading",function(){this._showLoadingIndicator("loading...",40)},this),this.on("loading-done",function(){this._hideLoadingIndicator(40)},this),this.once("rendered",function(){this.trigger("rendered:initial",this)},this),this.logger&&this.on("all",function(e){this.log(this+"",arguments)},this),this._setUpCollectionListeners(),this._setUpViewListeners(),this},_setUpCollectionListeners:function(){return this.log(this+"._setUpCollectionListeners",this.collection),this.collection.off(),this.collection.on("error",function(e,t,i,n,s){this.trigger("error",e,t,i,n,s)},this),this.collection.on("reset",function(){this.renderItems()},this),this.collection.on("add",this.addItemView,this),this.collection.on("remove",this.removeItemView,this),this.logger&&this.collection.on("all",function(e){this.info(this+"(collection)",arguments)},this),this},_setUpViewListeners:function(){this.log(this+"._setUpViewListeners"),this.on("view:selected",function(e,t){if(t&&t.shiftKey&&this.lastSelected){var i=this.viewFromModelId(this.lastSelected);i&&this.selectRange(e,i)}else t&&t.altKey&&!this.selecting&&this.showSelectors();this.selected.push(e.model.id),this.lastSelected=e.model.id},this),this.on("view:de-selected",function(e,t){this.selected=_.without(this.selected,e.model.id)},this)},render:function(e){this.log(this+".render",e);var t=this._buildNewRender();return this._setUpBehaviors(t),this._queueNewRender(t,e),this},_buildNewRender:function(){this.debug(this+"(ListPanel)._buildNewRender");var e=$(this.templates.el({},this));return this._renderControls(e),this._renderTitle(e),this._renderSubtitle(e),this._renderSearch(e),this.renderItems(e),e},_renderControls:function(e){this.debug(this+"(ListPanel)._renderControls");var t=$(this.templates.controls({},this));return e.find(".controls").replaceWith(t),t},_renderTitle:function(e){},_renderSubtitle:function(e){},_queueNewRender:function(e,t){t=void 0===t?this.fxSpeed:t;var i=this;i.log("_queueNewRender:",e,t),$(i).queue("fx",[function(e){this.$el.fadeOut(t,e)},function(t){i._swapNewRender(e),t()},function(e){this.$el.fadeIn(t,e)},function(e){i.trigger("rendered",i),e()}])},_swapNewRender:function(e){return this.$el.empty().attr("class",this.className).append(e.children()),this.selecting&&this.showSelectors(0),this},_setUpBehaviors:function(e){return e=e||this.$el,e.find(".controls [title]").tooltip({placement:"bottom"}),this._renderMultiselectActionMenu(e),this},_renderMultiselectActionMenu:function(e){e=e||this.$el;var t=e.find(".list-action-menu"),i=this.multiselectActions();if(!i.length)return t.empty();var s=$(['
    ','",'","
    "].join("")),a=i.map(function(e){var t=['
  • ',e.html,"
  • "].join("");return $(t).click(function(t){return t.preventDefault(),e.func(t)})});return s.find("ul").append(a),t.replaceWith(s),s},multiselectActions:function(){return[]},$scrollContainer:function(){return this.$el.parent().parent()},$list:function(e){return(e||this.$el).find("> .list-items")},$messages:function(e){return(e||this.$el).find("> .controls .messages")},$emptyMessage:function(e){return(e||this.$el).find("> .empty-message")},renderItems:function(e){e=e||this.$el;var t=this;t.log(this+".renderItems",e);var i=t.$list(e);return t.views=t._filterCollection().map(function(e){return t._createItemView(e).render(0)}),i.empty(),t.views.length?(t._attachItems(e),t.$emptyMessage(e).hide()):t._renderEmptyMessage(e).show(),t.views},_filterCollection:function(){var e=this;return e.collection.filter(_.bind(e._filterItem,e))},_filterItem:function(e){var t=this;return _.every(t.filters.map(function(t){return t.call(e)}))&&(!t.searchFor||e.matchesAll(t.searchFor))},_createItemView:function(e){var t=this._getItemViewClass(e),i=_.extend(this._getItemViewOptions(e),{model:e}),n=new t(i);return this._setUpItemViewListeners(n),n},_getItemViewClass:function(e){return this.viewClass},_getItemViewOptions:function(e){return{fxSpeed:this.fxSpeed,expanded:!1,selectable:this.selecting,selected:_.contains(this.selected,e.id),draggable:this.dragItems}},_setUpItemViewListeners:function(e){var t=this;return e.on("all",function(){var e=Array.prototype.slice.call(arguments,0);e[0]="view:"+e[0],t.trigger.apply(t,e)}),e.on("draggable:dragstart",function(e,t){var i={},n=this.getSelectedModels();i=n.length?n.toJSON():[t.model.toJSON()],e.dataTransfer.setData("text",JSON.stringify(i))},this),t},_attachItems:function(e){return this.$list(e).append(this.views.map(function(e){return e.$el})),this},_renderEmptyMessage:function(e){this.debug("_renderEmptyMessage",e,this.searchFor);var t=this.searchFor?this.noneFoundMsg:this.emptyMsg;return this.$emptyMessage(e).text(t)},expandAll:function(){_.each(this.views,function(e){e.expand()})},collapseAll:function(){_.each(this.views,function(e){e.collapse()})},addItemView:function(e,t,i){this.log(this+".addItemView:",e);var n=this;if(!n._filterItem(e))return void 0;var s=n._createItemView(e);return $(s).queue("fx",[function(e){n.$emptyMessage().fadeOut(n.fxSpeed,e)},function(e){n._attachView(s),e()}]),s},_attachView:function(e){var t=this;t.views.push(e),t.$list().append(e.render(0).$el.hide()),t.trigger("view:attached",e),e.$el.slideDown(t.fxSpeed,function(){t.trigger("view:attached:rendered")})},removeItemView:function(e,t,i){this.log(this+".removeItemView:",e);var n=this,s=n.viewFromModel(e);return s?(n.views=_.without(n.views,s),n.trigger("view:removed",s),$({}).queue("fx",[function(e){s.$el.fadeOut(n.fxSpeed,e)},function(e){s.remove(),n.trigger("view:removed:rendered"),n.views.length?e():n._renderEmptyMessage().fadeIn(n.fxSpeed,e)}]),s):void 0},viewFromModelId:function(e){for(var t=0;ti?this.views.slice(i,n+1):this.views.slice(n,i+1)},_renderSearch:function(e){return e.find(".controls .search-input").searchInput({placeholder:this.searchPlaceholder,initialVal:this.searchFor,onfirstsearch:_.bind(this._firstSearch,this),onsearch:_.bind(this.searchItems,this),onclear:_.bind(this.clearSearch,this)}),e},_firstSearch:function(e){return this.log("onFirstSearch",e),this.searchItems(e)},searchItems:function(e){return this.searchFor=e,this.trigger("search:searching",e,this),this.renderItems(),this.$("> .controls .search-query").val(e),this},clearSearch:function(e){return this.searchFor="",this.trigger("search:clear",this),this.renderItems(),this.$("> .controls .search-query").val(""),this},showSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!0,this.$(".list-actions").slideDown(e),_.each(this.views,function(t){t.showSelector(e)})},hideSelectors:function(e){e=void 0!==e?e:this.fxSpeed,this.selecting=!1,this.$(".list-actions").slideUp(e),_.each(this.views,function(t){t.hideSelector(e)}),this.selected=[],this.lastSelected=null},toggleSelectors:function(){this.selecting?this.hideSelectors():this.showSelectors()},selectAll:function(e){_.each(this.views,function(t){t.select(e)})},deselectAll:function(e){this.lastSelected=null,_.each(this.views,function(t){t.deselect(e)})},selectRange:function(e,t){var i=this.viewRange(e,t);return _.each(i,function(e){e.select()}),i},getSelectedViews:function(){return _.filter(this.views,function(e){return e.selected})},getSelectedModels:function(){return new this.collection.constructor(_.map(this.getSelectedViews(),function(e){return e.model}))},_showLoadingIndicator:function(e,i,n){this.debug("_showLoadingIndicator",this.indicator,e,i,n),i=void 0!==i?i:this.fxSpeed,this.indicator||(this.indicator=new t(this.$el,this.$el.parent()),this.debug(" created",this.indicator)),this.$el.is(":visible")?(this.$el.fadeOut(i),this.indicator.show(e,i,n)):this.indicator.show(0,n)},_hideLoadingIndicator:function(e,t){this.debug("_hideLoadingIndicator",this.indicator,e,t),e=void 0!==e?e:this.fxSpeed,this.indicator&&this.indicator.hide(e,t)},scrollPosition:function(){return this.$scrollContainer().scrollTop()},scrollTo:function(e,t){return t=t||0,this.$scrollContainer().animate({scrollTop:e},t),this},scrollToTop:function(e){return this.scrollTo(0,e)},scrollToItem:function(e,t){if(!e)return this;var i=e.$el.position().top;return this.scrollTo(i,t)},scrollToId:function(e,t){return this.scrollToItem(this.viewFromModelId(e),t)},events:{"click .select-all":"selectAll","click .deselect-all":"deselectAll"},toString:function(){return"ListPanel("+this.collection+")"}});s.prototype.templates=function(){var e=i.wrapTemplate(["
    ",'
    ','
    ','
    ',"
    "]),t=i.wrapTemplate(['
    ','
    ','
    <%= view.title %>
    ',"
    ",'
    <%= view.subtitle %>
    ','
    ','
    ','",'
    ','
    ','",'","
    ",'
    ',"
    ","
    ","
    "]);return{el:e,controls:t}}();var a=s.extend({modelCollectionKey:"contents",initialize:function(e){s.prototype.initialize.call(this,e),this.selecting=void 0!==e.selecting?e.selecting:!1,this.setModel(this.model,e)},setModel:function(e,t){if(t=t||{},this.debug(this+".setModel:",e,t),this.freeModel(),this.freeViews(),e){var i=this.model?this.model.get("id"):null;this.model=e,this.logger&&(this.model.logger=this.logger),this._setUpModelListeners(),this.collection.off(),this.collection=this.model[this.modelCollectionKey]?this.model[this.modelCollectionKey]:t.collection||new this.collectionClass([]),this._setUpCollectionListeners(),i&&e.get("id")!==i&&this.trigger("new-model",this)}return this},freeModel:function(){return this.model&&this.stopListening(this.model),this},_setUpModelListeners:function(){return this.log(this+"._setUpModelListeners",this.model),this.model.on("error",function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("error"),this.trigger.apply(this,e)},this),this},_renderControls:function(e){this.debug(this+"(ListPanel)._renderControls");var t=this.model?this.model.toJSON():{},i=$(this.templates.controls(t,this));return e.find(".controls").replaceWith(i),i},toString:function(){return"ModelListPanel("+this.model+")"}});return a.prototype.templates=function(){var e=i.wrapTemplate(['
    ','
    ','
    <%= model.name %>
    ',"
    ",'
    <%= view.subtitle %>
    ','
    ','
    ','",'
    ','
    ','",'","
    ",'
    ',"
    ","
    ","
    "]);return _.extend(_.clone(s.prototype.templates),{controls:e})}(),{ListPanel:s,ModelListPanel:a}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(2),i(1)],s=function(e,t){var i=Backbone.View.extend(e.LoggableMixin).extend(e.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",initialize:function(e){this.listenTo(this.model,"change:tags",function(){this.render()}),this.hiddenUntilActivated(e.$activator,e)},render:function(){var e=this;return this.$el.html(this._template()),this.$input().select2({placeholder:"Add tags",width:"100%",tags:function(){return e._getTagsUsed()}}),this._setUpBehaviors(),this},_template:function(){return['",''].join("")},tagsToCSV:function(){var e=this.model.get("tags");return!_.isArray(e)||_.isEmpty(e)?"":e.map(function(e){return _.escape(e)}).sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){return Galaxy.currUser.get("tags_used")},_setUpBehaviors:function(){var e=this;this.$input().on("change",function(t){e.model.save({tags:t.val},{silent:!0}),t.added&&e._addNewTagToTagsUsed(t.added.text+"")})},_addNewTagToTagsUsed:function(e){var t=Galaxy.currUser.get("tags_used");_.contains(t,e)||(t.push(e),t.sort(),Galaxy.currUser.set("tags_used",t))},remove:function(){this.$input.off(),this.stopListening(this.model),Backbone.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",this.model+"",")"].join("")}});return{TagsEditor:i}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[],s=function(){var e=Backbone.View.extend({initialize:function(e,t){this.$button=e,this.$button.size()||(this.$button=$("
    ")),this.options=t||[];var i=this;this.$button.click(function(e){return $(".popmenu-wrapper").remove(),i._renderAndShow(e),!1})},_renderAndShow:function(e){this.render(),this.$el.appendTo("body").css(this._getShownPosition(e)).show(),this._setUpCloseBehavior()},render:function(){if(this.$el.addClass("popmenu-wrapper").hide().css({position:"absolute"}).html(this.template(this.$button.attr("id"),this.options)),this.options.length){var e=this;this.$el.find("li").each(function(t,i){var n=e.options[t];n.func&&$(this).children("a.popupmenu-option").click(function(t){n.func.call(e,t,n),t.preventDefault()})})}return this},template:function(e,t){return['"].join("")},_templateOptions:function(e){return e.length?_.map(e,function(e){if(e.divider)return'
  • ';if(e.header)return['
  • ',e.html,"
  • "].join("");var t=e.href||"javascript:void(0);",i=e.target?' target="'+e.target+'"':"",n=e.checked?'':"";return['
  • ",n,e.html,"
  • "].join("")}).join(""):"
  • (no options)
  • "},_getShownPosition:function(e){var t=this.$el.width(),i=e.pageX-t/2;return i=Math.min(i,$(document).scrollLeft()+$(window).width()-t-5),i=Math.max(i,$(document).scrollLeft()+5),{top:e.pageY,left:i}},_setUpCloseBehavior:function(){function e(e){if($(document).off("click.close_popup"),window.parent!==window)try{$(window.parent.document).off("click.close_popup")}catch(i){}else try{$("iframe#galaxy_main").contents().off("click.close_popup")}catch(i){}t.remove()}var t=this;if($("html").one("click.close_popup",e),window.parent!==window)try{$(window.parent.document).find("html").one("click.close_popup",e)}catch(i){}else try{$("iframe#galaxy_main").contents().one("click.close_popup",e)}catch(i){}},addItem:function(e,t){return t=t>=0?t:this.options.length,this.options.splice(t,0,e),this},removeItem:function(e){return e>=0&&this.options.splice(e,1),this},findIndexByHtml:function(e){for(var t=0;t"].join("")}function o(){return $(a()).focus(function(e){$(this).select()}).keyup(function(e){if(e.preventDefault(),e.stopPropagation(),$(this).val()||$(this).blur(),e.which===d&&i.escWillClear)n.call(this,e);else{var t=$(this).val();e.which===h||i.minSearchLen&&t.length>=i.minSearchLen?s.call(this,e,t):t.length||n.call(this,e)}}).on("change",function(e){s.call(this,e,$(this).val()); -}).val(i.initialVal)}function r(){return $([''].join("")).tooltip({placement:"bottom"}).click(function(e){n.call(this,e)})}function l(){return $([''].join("")).hide().tooltip({placement:"bottom"})}function c(){u.find(".search-loading").toggle(),u.find(".search-clear").toggle()}var d=27,h=13,u=$(e),p=!0,f={initialVal:"",name:"search",placeholder:"search",classes:"",onclear:function(){},onfirstsearch:null,onsearch:function(e){},minSearchLen:0,escWillClear:!0,oninit:function(){}};return"string"===jQuery.type(i)?("toggle-loading"===i&&c(),u):("object"===jQuery.type(i)&&(i=jQuery.extend(!0,{},f,i)),u.addClass("search-input").prepend([o(),r(),l()]))}var t=window._l||function(e){return e};jQuery.fn.extend({searchInput:function(t){return this.each(function(){return e(this,t)})}})})},function(e,t,i){var n,s;n=[],s=function(){function e(e,t){var i=void 0!==e.prototype?e.prototype:e;return void 0!==t&&(i._logNamespace=t),["debug","info","warn","error","metric"].forEach(function(e){i[e]=function(){return this.logger?this.logger.emit?this.logger.emit(e,this._logNamespace,arguments):this.logger[e]?this.logger[e].apply(this.logger,arguments):void 0:void 0}}),e}return e}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[],s=function(){function e(e,t){var i=/(-?[0-9\.]+)/g,n=e.toString().toLowerCase()||"",s=t.toString().toLowerCase()||"",a=String.fromCharCode(0),o=n.replace(i,a+"$1"+a).split(a),r=s.replace(i,a+"$1"+a).split(a),l=new Date(n).getTime(),c=l?new Date(s).getTime():null;if(c){if(c>l)return-1;if(l>c)return 1}for(var d,h,u=0,p=Math.max(o.length,r.length);p>u;u++){if(d=parseFloat(o[u])||o[u],h=parseFloat(r[u])||r[u],h>d)return-1;if(d>h)return 1}return 0}return e}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;i(15),n=[i(28),i(52),i(31),i(1)],s=function(e,t,i,n){function s(e,t){var i=this;return i._init(e||{},t||{})}return i(s,"GalaxyApp"),s.prototype.defaultOptions={patchExisting:!0,root:"/"},s.prototype._init=function(e,t){var i=this;return console.debug("bootstrapped:",t),_.extend(i,Backbone.Events),i._processOptions(e),i.debug("GalaxyApp.options: ",i.options),i._patchGalaxy(window.Galaxy),i._initLogger(e.loggerOptions||{}),i.debug("GalaxyApp.logger: ",i.logger),i._initLocale(),i.debug("GalaxyApp.localize: ",i.localize),i.config=e.config||t.config||{},i.debug("GalaxyApp.config: ",i.config),i._initUser(e.user||t.user||{}),i.debug("GalaxyApp.user: ",i.user),i._setUpListeners(),i.trigger("ready",i),i},s.prototype._processOptions=function(e){var t=this,i=t.defaultOptions;t.debug("_processOptions: ",e),t.options={};for(var n in i)i.hasOwnProperty(n)&&(t.options[n]=e.hasOwnProperty(n)?e[n]:i[n]);return t},s.prototype._patchGalaxy=function(e){var t=this;if(t.options.patchExisting&&e){t.debug("found existing Galaxy object:",e);for(var i in e)e.hasOwnProperty(i)&&(t.debug(" patching in "+i+" to Galaxy"),t[i]=e[i])}},s.prototype._initLogger=function(e){var i=this;return i.debug("_initLogger:",e),i.logger=new t.MetricsLogger(e),i},s.prototype._initLocale=function(e){var t=this;return t.debug("_initLocale:",e),t.localize=n,window._l=t.localize,t},s.prototype._initUser=function(t){var i=this;return i.debug("_initUser:",t),i.user=new e.User(t),i.currUser=i.user,i},s.prototype._setUpListeners=function(){var e=this;return e.lastAjax={},$(document).bind("ajaxSend",function(t,i,n){var s=n.data;try{s=JSON.parse(s)}catch(a){}e.lastAjax={url:location.href.slice(0,-1)+n.url,data:s}}),e._listenToGalaxyMain(),e},s.prototype._listenToGalaxyMain=function(){var e=this,t="iframe#galaxy_main",i=$(t);if(i=i.size()?i.get(0).contentWindow:void 0){var n=function(i){try{var n=$(t).get(0).contentWindow,s=n.location.pathname+n.location.search+n.location.hash;e.trigger("galaxy_main:load",{fullpath:s,pathname:n.location.pathname,search:n.location.search,hash:n.location.hash})}catch(a){e.debug("Error handling main frame load:",a)}};$(t).on("load",n)}else e.debug("No galaxy_main found")},s.prototype.toString=function(){var e=this.user.get("email")||"(anonymous)";return"GalaxyApp("+e+")"},{GalaxyApp:s}}.apply(t,n),!(void 0!==s&&(e.exports=s))},,function(e,t,i){var n,s;n=[i(14)],s=function(e){var t=Backbone.Model.extend({options:null,masthead:null,initialize:function(e){this.options=e.config,this.masthead=e.masthead,this.create()},create:function(){var t=new e.GalaxyMastheadTab({id:"analysis",title:"Analyze Data",content:"",title_attribute:"Analysis home view"});this.masthead.append(t);var i={id:"workflow",title:"Workflow",content:"workflow",title_attribute:"Chain tools into workflows"};this.options.user.valid||(i.disabled=!0);var n=new e.GalaxyMastheadTab(i);this.masthead.append(n);var s=new e.GalaxyMastheadTab({id:"shared",title:"Shared Data",content:"library/index",title_attribute:"Access published resources"});if(s.add({title:"Data Libraries",content:"library/index"}),s.add({title:"Data Libraries Beta",content:"library/list",divider:!0}),s.add({title:"Published Histories",content:"history/list_published"}),s.add({title:"Published Workflows",content:"workflow/list_published"}),s.add({title:"Published Visualizations",content:"visualization/list_published"}),s.add({title:"Published Pages",content:"page/list_published"}),this.masthead.append(s),this.options.user.requests){var a=new e.GalaxyMastheadTab({id:"lab",title:"Lab"});a.add({title:"Sequencing Requests",content:"requests/index"}),a.add({title:"Find Samples",content:"requests/find_samples_index"}),a.add({title:"Help",content:this.options.lims_doc_url}),this.masthead.append(a)}var o={id:"visualization",title:"Visualization",content:"visualization/list",title_attribute:"Visualize datasets"};this.options.user.valid||(o.disabled=!0);var r=new e.GalaxyMastheadTab(o);if(this.options.user.valid&&(r.add({title:"New Track Browser",content:"visualization/trackster",target:"_frame"}),r.add({title:"Saved Visualizations",content:"visualization/list",target:"_frame"})),this.masthead.append(r),this.options.enable_cloud_launch){var l=new e.GalaxyMastheadTab({id:"cloud",title:"Cloud",content:"cloudlaunch/index"});l.add({title:"New Cloud Cluster",content:"cloudlaunch/index"}),this.masthead.append(l)}if(this.options.is_admin_user){var c=new e.GalaxyMastheadTab({id:"admin",title:"Admin",content:"admin",extra_class:"admin-only",title_attribute:"Administer this Galaxy"});this.masthead.append(c)}var d=new e.GalaxyMastheadTab({id:"help",title:"Help",title_attribute:"Support, contact, and community hubs"});if(this.options.biostar_url&&(d.add({title:"Galaxy Biostar",content:this.options.biostar_url_redirect,target:"_blank"}),d.add({title:"Ask a question",content:"biostar/biostar_question_redirect",target:"_blank"})),d.add({title:"Support",content:this.options.support_url,target:"_blank"}),d.add({title:"Search",content:this.options.search_url,target:"_blank"}),d.add({title:"Mailing Lists",content:this.options.mailing_lists,target:"_blank"}),d.add({title:"Videos",content:this.options.screencasts_url,target:"_blank"}),d.add({title:"Wiki",content:this.options.wiki_url,target:"_blank"}),d.add({title:"How to Cite Galaxy",content:this.options.citation_url,target:"_blank"}),this.options.terms_url&&d.add({title:"Terms and Conditions",content:this.options.terms_url,target:"_blank"}),this.masthead.append(d),this.options.user.valid){var h=new e.GalaxyMastheadTab({id:"user",title:"User",extra_class:"loggedin-only",title_attribute:"Account preferences and saved data"});h.add({title:"Logged in as "+this.options.user.email}),h.add({title:"Preferences",content:"user?cntrller=user",target:"galaxy_main"}),h.add({title:"Custom Builds",content:"user/dbkeys",target:"galaxy_main"}),h.add({title:"Logout",content:"user/logout",target:"_top",divider:!0}),h.add({title:"Saved Histories",content:"history/list",target:"galaxy_main"}),h.add({title:"Saved Datasets",content:"dataset/list",target:"galaxy_main"}),h.add({title:"Saved Pages",content:"page/list",target:"_top"}),h.add({title:"API Keys",content:"user/api_keys?cntrller=user",target:"galaxy_main"}),this.options.use_remote_user&&h.add({title:"Public Name",content:"user/edit_username?cntrller=user",target:"galaxy_main"}),this.masthead.append(h)}else{var h=new e.GalaxyMastheadTab({id:"user",title:"User",extra_class:"loggedout-only",title_attribute:"Account registration or login"});h.add({title:"Login",content:"user/login",target:"galaxy_main"}),this.options.allow_user_creation&&h.add({title:"Register",content:"user/create",target:"galaxy_main"}),this.masthead.append(h)}this.options.active_view&&this.masthead.highlight(this.options.active_view)}});return{GalaxyMenu:t}}.apply(t,n),!(void 0!==s&&(e.exports=s))},,,,,,function(e,t,i){var n,s;n=[i(5),i(19),i(2),i(1)],s=function(e,t,i,n){var s=e.DCListItemView,a=s.extend({initialize:function(e){s.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCListItemEdit("+e+")"}}),o=e.DCEListItemView,r=o.extend({initialize:function(e){o.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DCEListItemEdit("+e+")"}}),l=t.DatasetListItemEdit.extend({initialize:function(e){t.DatasetListItemEdit.prototype.initialize.call(this,e)},toString:function(){var e=this.model?this.model+"":"(no model)";return"DatasetDCEListItemEdit("+e+")"}});l.prototype.templates=function(){return _.extend({},t.DatasetListItemEdit.prototype.templates,{titleBar:e.DatasetDCEListItemView.prototype.templates.titleBar})}();var c=e.NestedDCDCEListItemView.extend({toString:function(){var e=this.model?this.model+"":"(no model)";return"NestedDCDCEListItemEdit("+e+")"}});return{DCListItemEdit:a,DCEListItemEdit:r,DatasetDCEListItemEdit:l,NestedDCDCEListItemEdit:c}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(7),i(6),i(41),i(2),i(1)],s=function(e,t,i,n,s){var a=e.CollectionPanel,o=a.extend({DatasetDCEViewClass:i.DatasetDCEListItemEdit,NestedDCDCEViewClass:i.NestedDCDCEListItemEdit,initialize:function(e){a.prototype.initialize.call(this,e)},_setUpBehaviors:function(e){if(e=e||this.$el,a.prototype._setUpBehaviors.call(this,e),this.model&&Galaxy.currUser&&!Galaxy.currUser.isAnonymous()){var t=this,i="> .controls .name";e.find(i).attr("title",s("Click to rename collection")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(e){var n=t.model.get("name");e&&e!==n?(t.$el.find(i).text(e),t.model.save({name:e}).fail(function(){t.$el.find(i).text(t.model.previous("name"))})):t.$el.find(i).text(n)}})}},toString:function(){return"CollectionPanelEdit("+(this.model?this.model.get("name"):"")+")"}}),r=o.extend({DatasetDCEViewClass:i.DatasetDCEListItemEdit,toString:function(){return"ListCollectionPanelEdit("+(this.model?this.model.get("name"):"")+")"}}),l=r.extend({toString:function(){return"PairCollectionPanelEdit("+(this.model?this.model.get("name"):"")+")"}}),c=l.extend({_setUpBehaviors:function(e){a.prototype._setUpBehaviors.call(this,e)},toString:function(){return"NestedPairCollectionPanelEdit("+(this.model?this.model.get("name"):"")+")"}}),d=o.extend({NestedDCDCEViewClass:i.NestedDCDCEListItemEdit.extend({foldoutPanelClass:c}),toString:function(){return"ListOfPairsCollectionPanelEdit("+(this.model?this.model.get("name"):"")+")"}});return{CollectionPanelEdit:o,ListCollectionPanelEdit:r,PairCollectionPanelEdit:l,ListOfPairsCollectionPanelEdit:d}}.apply(t,n),!(void 0!==s&&(e.exports=s))},function(e,t,i){var n,s;n=[i(51),i(32),i(8),i(2),i(1),i(29)],s=function(e,t,i,n,s){function a(e){function t(){return i.length||(i=[new RegExp(this.filters[0]),new RegExp(this.filters[1])]),i}e=e||{},e.createPair=e.createPair||function(e){return this.debug("creating pair:",e.listA[e.indexA].name,e.listB[e.indexB].name),e=e||{},this._pair(e.listA.splice(e.indexA,1)[0],e.listB.splice(e.indexB,1)[0],{silent:!0})};var i=[];return e.preprocessMatch=e.preprocessMatch||function(e){var i=t.call(this);return _.extend(e,{matchTo:e.matchTo.name.replace(i[0],""),possible:e.possible.name.replace(i[1],"")})},function(t){this.debug("autopair _strategy ---------------------------"),t=t||{};var i,n=t.listA,s=t.listB,a=0,o={score:0,index:null},r=[];for(this.debug("starting list lens:",n.length,s.length),this.debug("bestMatch (starting):",JSON.stringify(o,null," "));a=d?(this.debug("creating pair"),r.push(e.createPair.call(this,{listA:n,indexA:a,listB:s,indexB:o.index})),this.debug("list lens now:",n.length,s.length)):a+=1,!n.length||!s.length)return r}return this.debug("paired:",JSON.stringify(r,null," ")),this.debug("autopair _strategy ---------------------------"),r}}function o(e){var t=e.toJSON();return c(t,{historyId:e.historyId})}var r=Backbone.View.extend(n.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(e){this.pair=e.pair||{}},template:_.template(['<%= pair.forward.name %>','','<%= pair.name %>',"",'<%= pair.reverse.name %>'].join("")),render:function(){return this.$el.attr("draggable",!0).data("pair",this.pair).html(this.template({pair:this.pair})).addClass("flex-column-container"),this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(e){e.currentTarget.style.opacity="0.4",e.originalEvent&&(e=e.originalEvent),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",JSON.stringify(this.pair)),this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(e){e.currentTarget.style.opacity="1.0",this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(e){this.$el.parent().trigger(e)},toString:function(){return"PairView("+this.pair.name+")"}}),l=Backbone.View.extend(n.LoggableMixin).extend({className:"list-of-pairs-collection-creator collection-creator flex-row-container",initialize:function(e){this.metric("PairedCollectionCreator.initialize",e),e=_.defaults(e,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:!0,strategy:"lcs",matchPercentage:.9,twoPassAutopairing:!0}),this.initialList=e.datasets,this.historyId=e.historyId,this.filters=this.commonFilters[e.filters]||this.commonFilters[this.DEFAULT_FILTERS],_.isArray(e.filters)&&(this.filters=e.filters),this.automaticallyPair=e.automaticallyPair,this.strategy=this.strategies[e.strategy]||this.strategies[this.DEFAULT_STRATEGY],_.isFunction(e.strategy)&&(this.strategy=e.strategy),this.matchPercentage=e.matchPercentage,this.twoPassAutopairing=e.twoPassAutopairing,this.removeExtensions=!0,this.oncancel=e.oncancel,this.oncreate=e.oncreate,this.autoscrollDist=e.autoscrollDist||24,this.unpairedPanelHidden=!1,this.pairedPanelHidden=!1,this.$dragging=null,this.blocking=!1,this._setUpBehaviors(),this._dataSetUp()},commonFilters:{illumina:["_1","_2"],Rs:["_R1","_R2"]},DEFAULT_FILTERS:"illumina",strategies:{simple:"autopairSimple",lcs:"autopairLCS",levenshtein:"autopairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[],this.unpaired=[],this.selectedIds=[],this._sortInitialList(),this._ensureIds(),this.unpaired=this.initialList.slice(0),this.automaticallyPair&&(this.autoPair(),this.once("rendered:initial",function(){this.trigger("autopair")}))},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(e){return e.sort(function(e,i){return t(e.name,i.name)}),e},_ensureIds:function(){return this.initialList.forEach(function(e){e.hasOwnProperty("id")||(e.id=_.uniqueId())}),this.initialList},_splitByFilters:function(){function e(e,t){return t.test(e.name)}var t=this.filters.map(function(e){return new RegExp(e)}),i=[[],[]];return this.unpaired.forEach(function(n){t.forEach(function(t,s){e(n,t)&&i[s].push(n)})}),i},_addToUnpaired:function(e){var i=function(n,s){if(n===s)return n;var a=Math.floor((s-n)/2)+n,o=t(e.name,this.unpaired[a].name);if(0>o)return i(n,a);if(o>0)return i(a+1,s);for(;this.unpaired[a]&&this.unpaired[a].name===e.name;)a++;return a}.bind(this);this.unpaired.splice(i(0,this.unpaired.length),0,e)},autoPair:function(e){var t=this._splitByFilters(),i=[];return this.twoPassAutopairing&&(i=this.autopairSimple({listA:t[0],listB:t[1]}),t=this._splitByFilters()),e=e||this.strategy,t=this._splitByFilters(),i=i.concat(this[e].call(this,{listA:t[0],listB:t[1]}))},autopairSimple:a({scoreThreshold:function(){return 1},match:function(e){return e=e||{},e.matchTo===e.possible?{index:e.index,score:1}:e.bestMatch}}),autopairLevenshtein:a({scoreThreshold:function(){return this.matchPercentage},match:function(t){t=t||{};var i=e(t.matchTo,t.possible),n=1-i/Math.max(t.matchTo.length,t.possible.length);return n>t.bestMatch.score?{index:t.index,score:n}:t.bestMatch}}),autopairLCS:a({scoreThreshold:function(){return this.matchPercentage},match:function(e){e=e||{};var t=this._naiveStartingAndEndingLCS(e.matchTo,e.possible).length,i=t/Math.max(e.matchTo.length,e.possible.length);return i>e.bestMatch.score?{index:e.index,score:i}:e.bestMatch}}),_naiveStartingAndEndingLCS:function(e,t){for(var i="",n="",s=0,a=0;s=0&&a>=0&&e[s]===t[a];)n=[e[s],n].join(""),s-=1,a-=1;return i+n},_pair:function(e,t,i){i=i||{};var n=this._createPair(e,t,i.name);return this.paired.push(n),this.unpaired=_.without(this.unpaired,e,t),i.silent||this.trigger("pair:new",n),n},_createPair:function(e,t,i){if(!e||!t||e===t)throw new Error("Bad pairing: "+[JSON.stringify(e),JSON.stringify(t)]);return i=i||this._guessNameForPair(e,t),{forward:e,name:i,reverse:t}},_guessNameForPair:function(e,t,i){i=void 0!==i?i:this.removeExtensions;var n=e.name,s=t.name,a=this._naiveStartingAndEndingLCS(n.replace(this.filters[0],""),s.replace(this.filters[1],""));if(i){var o=a.lastIndexOf(".");if(o>0){var r=a.slice(o,a.length);a=a.replace(r,""),n=n.replace(r,""),s=s.replace(r,"")}}return a||n+" & "+s},_unpair:function(e,t){if(t=t||{},!e)throw new Error("Bad pair: "+JSON.stringify(e));return this.paired=_.without(this.paired,e),this._addToUnpaired(e.forward),this._addToUnpaired(e.reverse),t.silent||this.trigger("pair:unpair",[e]),e},unpairAll:function(){for(var e=[];this.paired.length;)e.push(this._unpair(this.paired[0],{silent:!0}));this.trigger("pair:unpair",e)},_pairToJSON:function(e,t){return t=t||"hda",{collection_type:"paired",src:"new_collection",name:e.name,element_identifiers:[{name:"forward",id:e.forward.id,src:t},{name:"reverse",id:e.reverse.id,src:t}]}},createList:function(e){var t=this,i="/api/histories/"+this.historyId+"/contents/dataset_collections",n={type:"dataset_collection",collection_type:"list:paired",name:_.escape(e||t.$(".collection-name").val()),element_identifiers:t.paired.map(function(e){return t._pairToJSON(e)})};return t.blocking=!0,jQuery.ajax(i,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(n)}).always(function(){t.blocking=!1}).fail(function(e,i,n){t._ajaxErrHandler(e,i,n)}).done(function(e,i,n){t.trigger("collection:created",e,i,n),t.metric("collection:created",e),"function"==typeof t.oncreate&&t.oncreate.call(this,e,i,n)})},_ajaxErrHandler:function(e,t,i){this.error(e,t,i);var n=s("An error occurred while creating this collection");e&&(n+=0===e.readyState&&0===e.status?": "+s("Galaxy could not be reached and may be updating.")+s(" Try again in a few minutes."):e.responseJSON?"
    "+JSON.stringify(e.responseJSON)+"
    ":": "+i),creator._showAlert(n,"alert-danger")},render:function(e,t){return this.$el.empty().html(l.templates.main()),this._renderHeader(e),this._renderMiddle(e),this._renderFooter(e),this._addPluginComponents(),this.trigger("rendered",this),this},_renderHeader:function(e,t){var i=this.$(".header").empty().html(l.templates.header()).find(".help-content").prepend($(l.templates.helpContent()));return this._renderFilters(),i},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(e,t){var i=this.$(".middle").empty().html(l.templates.middle());return this.unpairedPanelHidden?this.$(".unpaired-columns").hide():this.pairedPanelHidden&&this.$(".paired-columns").hide(),this._renderUnpaired(),this._renderPaired(),i},_renderUnpaired:function(e,t){var i,n,a=this,o=[],r=this._splitByFilters();return this.$(".forward-column .title").text([r[0].length,s("unpaired forward")].join(" ")),this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-r[0].length)),this.$(".reverse-column .title").text([r[1].length,s("unpaired reverse")].join(" ")),this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-r[1].length)),this.$(".unpaired-columns .column-datasets").empty(),this.$(".autopair-link").toggle(0!==this.unpaired.length),0===this.unpaired.length?void this._renderUnpairedEmpty():(n=r[1].map(function(e,t){return void 0!==r[0][t]&&r[0][t]!==e&&o.push(a._renderPairButton()),a._renderUnpairedDataset(e)}),i=r[0].map(function(e){return a._renderUnpairedDataset(e)}),i.length||n.length?(this.$(".unpaired-columns .forward-column .column-datasets").append(i).add(this.$(".unpaired-columns .paired-column .column-datasets").append(o)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(n)),void this._adjUnpairedOnScrollbar()):void this._renderUnpairedNotShown())},_renderUnpairedDisplayStr:function(e){return["(",e," ",s("filtered out"),")"].join("")},_renderUnpairedDataset:function(e){return $("
  • ").attr("id","dataset-"+e.id).addClass("dataset unpaired").attr("draggable",!0).addClass(e.selected?"selected":"").append($("").addClass("dataset-name").text(e.name)).data("dataset",e)},_renderPairButton:function(){return $("
  • ").addClass("dataset unpaired").append($("").addClass("dataset-name").text(s("Pair these datasets")))},_renderUnpairedEmpty:function(){var e=$('
    ').text("("+s("no remaining unpaired datasets")+")");return this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(e),e},_renderUnpairedNotShown:function(){var e=$('
    ').text("("+s("no datasets were found matching the current filters")+")");return this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(e),e},_adjUnpairedOnScrollbar:function(){var e=this.$(".unpaired-columns").last(),t=this.$(".unpaired-columns .reverse-column .dataset").first();if(t.size()){var i=e.offset().left+e.outerWidth(),n=t.offset().left+t.outerWidth(),s=Math.floor(i)-Math.floor(n);this.$(".unpaired-columns .forward-column").css("margin-left",s>0?s:0)}},_renderPaired:function(e,t){if(this.$(".paired-column-title .title").text([this.paired.length,s("paired")].join(" ")),this.$(".unpair-all-link").toggle(0!==this.paired.length),0===this.paired.length)return void this._renderPairedEmpty();this.$(".remove-extensions-link").show(),this.$(".paired-columns .column-datasets").empty();var i=this;this.paired.forEach(function(e,t){var n=new r({pair:e});i.$(".paired-columns .column-datasets").append(n.render().$el).append(['"].join(""))})},_renderPairedEmpty:function(){var e=$('
    ').text("("+s("no paired datasets yet")+")");return this.$(".paired-columns .column-datasets").empty().prepend(e),e},_renderFooter:function(e,t){var i=this.$(".footer").empty().html(l.templates.footer());return this.$(".remove-extensions").prop("checked",this.removeExtensions),"function"==typeof this.oncancel&&this.$(".cancel-create.btn").show(),i},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link"),this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(e){function t(e,t){return['"].join("")}var i=$(_.template(['
    ','
    ',s("Choose from the following filters to change which unpaired reads are shown in the display"),":
    ",_.values(this.commonFilters).map(function(e){return t(e[0],e[1])}).join(""),"
    "].join(""))({}));return this.$(e).popover({container:".collection-creator",placement:"bottom",html:!0,content:i})},_validationWarning:function(e,t){var i="validation-warning";"name"===e&&(e=this.$(".collection-name").add(this.$(".collection-name-prompt")),this.$(".collection-name").focus().select()),t?(e=e||this.$("."+i),e.removeClass(i)):e.addClass(i)},_setUpBehaviors:function(){return this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("pair:new",function(){this._renderUnpaired(),this._renderPaired(),this.$(".paired-columns").scrollTop(8e6)}),this.on("pair:unpair",function(e){this._renderUnpaired(),this._renderPaired(),this.splitView()}),this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()],this.metric("filter-change",this.filters),this._renderFilters(),this._renderUnpaired()}),this.on("autopair",function(){this._renderUnpaired(),this._renderPaired();var e,t=null;this.paired.length?(t="alert-success",e=this.paired.length+" "+s("pairs created"),this.unpaired.length||(e+=": "+s("all datasets have been successfully paired"),this.hideUnpaired(),this.$(".collection-name").focus())):e=s("Could not automatically create any pairs from the given dataset names"),this._showAlert(e,t)}),this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(e){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(e){$(e.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(e){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(e){$(e.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(e){this.toggleExtensions()},"change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(e){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(e){this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(e){this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_showAlert:function(e,t){t=t||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(t).show().find(".alert-message").html(e)},_hideAlert:function(e){this.$(".main-help").show(),this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(e){this.$(".paired-columns").is(":visible")?this.hidePaired():this.splitView()},_clickShowOnlyPaired:function(e){this.$(".unpaired-columns").is(":visible")?this.hideUnpaired():this.splitView()},hideUnpaired:function(e,t){this.unpairedPanelHidden=!0,this.pairedPanelHidden=!1,this._renderMiddle(e,t)},hidePaired:function(e,t){this.unpairedPanelHidden=!1,this.pairedPanelHidden=!0,this._renderMiddle(e,t)},splitView:function(e,t){return this.unpairedPanelHidden=this.pairedPanelHidden=!1,this._renderMiddle(e,t),this},_clickUnpairAll:function(e){this.metric("unpairAll"),this.unpairAll()},_clickAutopair:function(e){var t=this.autoPair();this.metric("autopair",t.length,this.unpaired.length),this.trigger("autopair")},_clickFilterChoice:function(e){var t=$(e.currentTarget);this.$(".forward-unpaired-filter input").val(t.data("forward")),this.$(".reverse-unpaired-filter input").val(t.data("reverse")),this._hideChooseFilters(),this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide"),this.$(".popover").css("display","none")},_clearFilters:function(e){this.$(".forward-unpaired-filter input").val(""),this.$(".reverse-unpaired-filter input").val(""),this.trigger("filter-change")},_clickUnpairedDataset:function(e){return e.stopPropagation(),this.toggleSelectUnpaired($(e.currentTarget))},toggleSelectUnpaired:function(e,t){t=t||{};var i=e.data("dataset"),n=void 0!==t.force?t.force:!e.hasClass("selected");return e.size()&&void 0!==i?(n?(e.addClass("selected"),t.waitToPair||this.pairAllSelected()):e.removeClass("selected"),e):e},pairAllSelected:function(e){e=e||{};var t=this,i=[],n=[],s=[];return t.$(".unpaired-columns .forward-column .dataset.selected").each(function(){i.push($(this).data("dataset"))}),t.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){n.push($(this).data("dataset"))}),i.length=n.length=Math.min(i.length,n.length),i.forEach(function(e,i){try{s.push(t._pair(e,n[i],{silent:!0}))}catch(a){t.error(a)}}),s.length&&!e.silent&&this.trigger("pair:new",s),s},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(e){if(e.shiftKey){var t=this,i=$(e.target).addClass("selected"),n=function(e){t.$(e.target).filter(".dataset").addClass("selected")};i.parent().on("mousemove",n),$(document).one("mouseup",function(e){i.parent().off("mousemove",n),t.pairAllSelected()})}},_clickPairRow:function(e){var t=$(e.currentTarget).index(),i=$(".unpaired-columns .forward-column .dataset").eq(t).data("dataset"),n=$(".unpaired-columns .reverse-column .dataset").eq(t).data("dataset");this._pair(i,n)},_startPartitionDrag:function(e){function t(e){n.$(".flexible-partition-drag").css("color",""),$("body").css("cursor","").unbind("mousemove",i)}function i(e){var t=e.pageY-s;n.adjPartition(t)||$("body").trigger("mouseup"),n._adjUnpairedOnScrollbar(),s+=t}var n=this,s=e.pageY;$("body").css("cursor","ns-resize"),n.$(".flexible-partition-drag").css("color","black"),$("body").mousemove(i),$("body").one("mouseup",t)},adjPartition:function(e){var t=this.$(".unpaired-columns"),i=this.$(".paired-columns"),n=parseInt(t.css("height"),10),s=parseInt(i.css("height"),10); -n=Math.max(10,n+e),s-=e;var a=0>e;if(a){if(this.unpairedPanelHidden)return!1;if(10>=n)return this.hideUnpaired(),!1}else this.unpairedPanelHidden&&(t.show(),this.unpairedPanelHidden=!1);if(a)this.pairedPanelHidden&&(i.show(),this.pairedPanelHidden=!1);else{if(this.pairedPanelHidden)return!1;if(15>=s)return this.hidePaired(),!1}return t.css({height:n+"px",flex:"0 0 auto"}),!0},selectPair:function(e){e.stopPropagation(),$(e.currentTarget).toggleClass("selected")},clearSelectedPaired:function(e){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(e){e.stopPropagation();var t=$(e.currentTarget),i=t.parent().parent(),n=i.index(".dataset.paired"),s=this.paired[n],a=prompt("Enter a new name for the pair:",s.name);a&&(s.name=a,s.customizedName=!0,t.text(s.name))},_clickUnpair:function(e){var t=Math.floor($(e.currentTarget).index(".unpair-btn"));this._unpair(this.paired[t])},_dragoverPairedColumns:function(e){e.preventDefault();var t=this.$(".paired-columns .column-datasets");this._checkForAutoscroll(t,e.originalEvent.clientY);var i=this._getNearestPairedDatasetLi(e.originalEvent.clientY);$(".element-drop-placeholder").remove();var n=$('
    ');i.size()?i.before(n):t.append(n)},_checkForAutoscroll:function(e,t){var i=2,n=e.offset(),s=e.scrollTop(),a=t-n.top,o=n.top+e.outerHeight()-t;a>=0&&a=0&&oe&&e>a-o)return s}return $()},_dropPairedColumns:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move";var t=this._getNearestPairedDatasetLi(e.originalEvent.clientY);return t.size()?this.$dragging.insertBefore(t):this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last()),this._syncPairsToDom(),!1},_syncPairsToDom:function(){var e=[];this.$(".paired-columns .dataset.paired").each(function(){e.push($(this).data("pair"))}),this.paired=e,this._renderPaired()},_pairDragstart:function(e,t){t.$el.addClass("selected");var i=this.$(".paired-columns .dataset.selected");this.$dragging=i},_pairDragend:function(e,t){$(".element-drop-placeholder").remove(),this.$dragging=null},toggleExtensions:function(e){var t=this;t.removeExtensions=void 0!==e?e:!t.removeExtensions,_.each(t.paired,function(e){e.customizedName||(e.name=t._guessNameForPair(e.forward,e.reverse))}),t._renderPaired(),t._renderFooter()},_changeName:function(e){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(e){13!==e.keyCode||this.blocking||this._clickCreate()},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(e){var t=this._getName();t?this.blocking||this.createList():this._validationWarning("name")},_printList:function(e){var t=this;_.each(e,function(i){e===t.paired&&t._printPair(i)})},_printPair:function(e){this.debug(e.forward.name,e.reverse.name,": ->",e.name)},toString:function(){return"PairedCollectionCreator"}});l.templates=l.templates||{main:_.template(['
    ','
    ','