"))}})}(),function(){"use strict";window.databaseView=Backbone.View.extend({users:null,el:"#content",template:templateEngine.createTemplate("databaseView.ejs"),dropdownVisible:!1,currentDB:"",events:{"click #createDatabase":"createDatabase","click #submitCreateDatabase":"submitCreateDatabase","click .editDatabase":"editDatabase","click .icon":"editDatabase","click #selectDatabase":"updateDatabase","click #submitDeleteDatabase":"submitDeleteDatabase","click .contentRowInactive a":"changeDatabase","keyup #databaseSearchInput":"search","click #databaseSearchSubmit":"search","click #databaseToggle":"toggleSettingsDropdown","click .css-label":"checkBoxes","click #dbSortDesc":"sorting","click .tile":"switchDatabase"},sorting:function(){$("#dbSortDesc").is(":checked")?this.collection.setSortingDesc(!0):this.collection.setSortingDesc(!1),$("#databaseDropdown").is(":visible")?this.dropdownVisible=!0:this.dropdownVisible=!1,this.render()},initialize:function(){this.collection.fetch({async:!1})},checkBoxes:function(a){var b=a.currentTarget.id;$("#"+b).click()},render:function(){return this.currentDatabase(),this.collection.sort(),$(this.el).html(this.template.render({collection:this.collection,searchString:"",currentDB:this.currentDB})),this.dropdownVisible===!0&&($("#dbSortDesc").attr("checked",this.collection.sortOptions.desc),$("#databaseToggle").toggleClass("activated"),$("#databaseDropdown2").show()),arangoHelper.setCheckboxStatus("#databaseDropdown"),this.replaceSVGs(),this},toggleSettingsDropdown:function(){$("#dbSortDesc").attr("checked",this.collection.sortOptions.desc),$("#databaseToggle").toggleClass("activated"),$("#databaseDropdown2").slideToggle(200)},selectedDatabase:function(){return $("#selectDatabases").val()},handleError:function(a,b,c){return 409===a?void arangoHelper.arangoError("DB","Database "+c+" already exists."):400===a?void arangoHelper.arangoError("DB","Invalid Parameters"):403===a?void arangoHelper.arangoError("DB","Insufficent rights. Execute this from _system database"):void 0},validateDatabaseInfo:function(a,b,c){return""===b?(arangoHelper.arangoError("DB","You have to define an owner for the new database"),!1):""===a?(arangoHelper.arangoError("DB","You have to define a name for the new database"),!1):0===a.indexOf("_")?(arangoHelper.arangoError("DB ","Databasename should not start with _"),!1):a.match(/^[a-zA-Z][a-zA-Z0-9_\-]*$/)?!0:(arangoHelper.arangoError("DB","Databasename may only contain numbers, letters, _ and -"),!1)},createDatabase:function(a){a.preventDefault(),this.createAddDatabaseModal()},switchDatabase:function(a){if(!$(a.target).parent().hasClass("iconSet")){var b=$(a.currentTarget).find("h5").text();if(""!==b){var c=this.collection.createDatabaseURL(b);window.location.replace(c)}}},submitCreateDatabase:function(){var a,b=this,c=$("#newDatabaseName").val(),d=$("#newUser").val();if(a="true"===$("#useDefaultPassword").val()?"ARANGODB_DEFAULT_ROOT_PASSWORD":$("#newPassword").val(),this.validateDatabaseInfo(c,d,a)){var e={name:c,users:[{username:d,passwd:a,active:!0}]};this.collection.create(e,{wait:!0,error:function(a,d){b.handleError(d.status,d.statusText,c)},success:function(a){b.updateDatabases(),window.modalView.hide(),window.App.naviView.dbSelectionView.render($("#dbSelect"))}})}},submitDeleteDatabase:function(a){var b=this.collection.where({name:a});b[0].destroy({wait:!0,url:"/_api/database/"+a}),this.updateDatabases(),window.App.naviView.dbSelectionView.render($("#dbSelect")),window.modalView.hide()},currentDatabase:function(){this.currentDB=this.collection.getCurrentDatabase()},changeDatabase:function(a){var b=$(a.currentTarget).attr("id"),c=this.collection.createDatabaseURL(b);window.location.replace(c)},updateDatabases:function(){var a=this;this.collection.fetch({success:function(){a.render(),window.App.handleSelectDatabase()}})},editDatabase:function(a){var b=this.evaluateDatabaseName($(a.currentTarget).attr("id"),"_edit-database"),c=!0;b===this.currentDB&&(c=!1),this.createEditDatabaseModal(b,c)},search:function(){var a,b,c,d;a=$("#databaseSearchInput"),b=$("#databaseSearchInput").val(),d=this.collection.filter(function(a){return-1!==a.get("name").indexOf(b)}),$(this.el).html(this.template.render({collection:d,searchString:b,currentDB:this.currentDB})),this.replaceSVGs(),a=$("#databaseSearchInput"),c=a.val().length,a.focus(),a[0].setSelectionRange(c,c)},replaceSVGs:function(){$(".svgToReplace").each(function(){var a=$(this),b=a.attr("id"),c=a.attr("src");$.get(c,function(c){var d=$(c).find("svg");d.attr("id",b).attr("class","tile-icon-svg").removeAttr("xmlns:a"),a.replaceWith(d)},"xml")})},evaluateDatabaseName:function(a,b){var c=a.lastIndexOf(b);return a.substring(0,c)},createEditDatabaseModal:function(a,b){var c=[],d=[];d.push(window.modalView.createReadOnlyEntry("id_name","Name",a,"")),b?c.push(window.modalView.createDeleteButton("Delete",this.submitDeleteDatabase.bind(this,a))):c.push(window.modalView.createDisabledButton("Delete")),window.modalView.show("modalTable.ejs","Delete database",c,d)},createAddDatabaseModal:function(){var a=[],b=[];b.push(window.modalView.createTextEntry("newDatabaseName","Name","",!1,"Database Name",!0,[{rule:Joi.string().regex(/^[a-zA-Z]/),msg:"Database name must start with a letter."},{rule:Joi.string().regex(/^[a-zA-Z0-9\-_]*$/),msg:'Only Symbols "_" and "-" are allowed.'},{rule:Joi.string().required(),msg:"No database name given."}])),b.push(window.modalView.createTextEntry("newUser","Username",null!==this.users?this.users.whoAmI():"root","Please define the owner of this database. This will be the only user having initial access to this database if authentication is turned on. Please note that if you specify a username different to your account you will not be able to access the database with your account after having creating it. Specifying a username is mandatory even with authentication turned off. If there is a failure you will be informed.","Database Owner",!0,[{rule:Joi.string().required(),msg:"No username given."}])),b.push(window.modalView.createSelectEntry("useDefaultPassword","Use default password",!0,"Read the password from the environment variable ARANGODB_DEFAULT_ROOT_PASSWORD.",[{value:!1,label:"No"},{value:!0,label:"Yes"}])),b.push(window.modalView.createPasswordEntry("newPassword","Password","",!1,"",!1)),a.push(window.modalView.createSuccessButton("Create",this.submitCreateDatabase.bind(this))),window.modalView.show("modalTable.ejs","Create Database",a,b),$("#useDefaultPassword").change(function(){"true"===$("#useDefaultPassword").val()?$("#row_newPassword").hide():$("#row_newPassword").show()}),$("#row_newPassword").hide()}})}(),function(){"use strict";window.DBSelectionView=Backbone.View.extend({template:templateEngine.createTemplate("dbSelectionView.ejs"),events:{"click .dbSelectionLink":"changeDatabase"},initialize:function(a){this.current=a.current},changeDatabase:function(a){var b=$(a.currentTarget).closest(".dbSelectionLink.tab").attr("id"),c=this.collection.createDatabaseURL(b);window.location.replace(c)},render:function(a){return this.$el=a,this.$el.html(this.template.render({list:this.collection.getDatabasesForUser(),current:this.current.get("name")})),this.delegateEvents(),this.el}})}(),function(){"use strict";var a=function(a){var b=a.split("/");return"collection/"+encodeURIComponent(b[0])+"/"+encodeURIComponent(b[1])};window.DocumentView=Backbone.View.extend({el:"#content",colid:0,docid:0,customView:!1,template:templateEngine.createTemplate("documentView.ejs"),events:{"click #saveDocumentButton":"saveDocument","click #deleteDocumentButton":"deleteDocumentModal","click #confirmDeleteDocument":"deleteDocument","click #document-from":"navigateToDocument","click #document-to":"navigateToDocument","keydown #documentEditor .ace_editor":"keyPress","keyup .jsoneditor .search input":"checkSearchBox"},checkSearchBox:function(a){""===$(a.currentTarget).val()&&this.editor.expandAll()},keyPress:function(a){a.ctrlKey&&13===a.keyCode?(a.preventDefault(),this.saveDocument()):a.metaKey&&13===a.keyCode&&(a.preventDefault(),this.saveDocument())},editor:0,setType:function(a){var b,c;return"edge"===a?(b=this.collection.getEdge(this.colid,this.docid),c="Edge: "):"document"===a&&(b=this.collection.getDocument(this.colid,this.docid),c="Document: "),b===!0?(this.type=a,this.fillInfo(c),this.fillEditor(),!0):void 0},deleteDocumentModal:function(){var a=[],b=[];b.push(window.modalView.createReadOnlyEntry("doc-delete-button","Delete","Delete this "+this.type+"?",void 0,void 0,!1,/[<>&'"]/)),a.push(window.modalView.createDeleteButton("Delete",this.deleteDocument.bind(this))),window.modalView.show("modalTable.ejs","Delete Document",a,b)},deleteDocument:function(){var a;if("document"===this.type){if(a=this.collection.deleteDocument(this.colid,this.docid),a===!1)return void arangoHelper.arangoError("Document error:","Could not delete")}else if("edge"===this.type&&(a=this.collection.deleteEdge(this.colid,this.docid),a===!1))return void arangoHelper.arangoError("Edge error:","Could not delete");if(a===!0)if(this.customView)this.customDeleteFunction();else{var b="collection/"+encodeURIComponent(this.colid)+"/documents/1";window.modalView.hide(),window.App.navigate(b,{trigger:!0})}},navigateToDocument:function(a){var b=$(a.target).attr("documentLink");b&&window.App.navigate(b,{trigger:!0})},fillInfo:function(b){var c=this.collection.first(),d=c.get("_id"),e=c.get("_key"),f=c.get("_rev"),g=c.get("_from"),h=c.get("_to");if($("#document-type").text(b),$("#document-id").text(d),$("#document-key").text(e),$("#document-rev").text(f),g&&h){var i=a(g),j=a(h);$("#document-from").text(g),$("#document-from").attr("documentLink",i),$("#document-to").text(h),$("#document-to").attr("documentLink",j)}else $(".edge-info-container").hide()},fillEditor:function(){var a=this.removeReadonlyKeys(this.collection.first().attributes);this.editor.set(a),$(".ace_content").attr("font-size","11pt")},jsonContentChanged:function(){this.enableSaveButton()},render:function(){$(this.el).html(this.template.render({})),this.disableSaveButton(),this.breadcrumb();var a=this,b=document.getElementById("documentEditor"),c={change:function(){a.jsonContentChanged()},search:!0,mode:"tree",modes:["tree","code"],iconlib:"fontawesome4"};return this.editor=new JSONEditor(b,c),this},removeReadonlyKeys:function(a){return _.omit(a,["_key","_id","_from","_to","_rev"])},saveDocument:function(){var a,b;if(void 0===$("#saveDocumentButton").attr("disabled")){try{a=this.editor.get()}catch(c){return this.errorConfirmation(c),void this.disableSaveButton()}if(a=JSON.stringify(a),"document"===this.type){if(b=this.collection.saveDocument(this.colid,this.docid,a),b===!1)return void arangoHelper.arangoError("Document error:","Could not save")}else if("edge"===this.type&&(b=this.collection.saveEdge(this.colid,this.docid,a),b===!1))return void arangoHelper.arangoError("Edge error:","Could not save");b===!0&&(this.successConfirmation(),this.disableSaveButton())}},successConfirmation:function(){arangoHelper.arangoNotification("Document saved."),$("#documentEditor .tree").animate({backgroundColor:"#C6FFB0"},500),$("#documentEditor .tree").animate({backgroundColor:"#FFFFF"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#C6FFB0"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#FFFFF"},500)},errorConfirmation:function(a){arangoHelper.arangoError("Document editor: ",a),$("#documentEditor .tree").animate({backgroundColor:"#FFB0B0"},500),$("#documentEditor .tree").animate({backgroundColor:"#FFFFF"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#FFB0B0"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#FFFFF"},500)},enableSaveButton:function(){$("#saveDocumentButton").prop("disabled",!1),$("#saveDocumentButton").addClass("button-success"),$("#saveDocumentButton").removeClass("button-close")},disableSaveButton:function(){$("#saveDocumentButton").prop("disabled",!0),$("#saveDocumentButton").addClass("button-close"),$("#saveDocumentButton").removeClass("button-success")},breadcrumb:function(){var a=window.location.hash.split("/");$("#transparentHeader").append('
")}),arangoHelper.fixTooltips("deleteIndex","left")}}})}(),function(){"use strict";window.EditListEntryView=Backbone.View.extend({template:templateEngine.createTemplate("editListEntryView.ejs"),initialize:function(a){this.key=a.key,this.value=a.value,this.render()},events:{"click .deleteAttribute":"removeRow"},render:function(){$(this.el).html(this.template.render({key:this.key,value:JSON.stringify(this.value),isReadOnly:this.isReadOnly()}))},isReadOnly:function(){return 0===this.key.indexOf("_")},getKey:function(){return $(".key").val()},getValue:function(){var val=$(".val").val();try{val=JSON.parse(val)}catch(e){try{return eval("val = "+val),val}catch(e2){return $(".val").val()}}return val},removeRow:function(){this.remove()}})}(),function(){"use strict";window.FooterView=Backbone.View.extend({el:"#footerBar",system:{},isOffline:!0,isOfflineCounter:0,firstLogin:!0,events:{"click .footer-center p":"showShortcutModal"},initialize:function(){var a=this;window.setInterval(function(){a.getVersion()},15e3),a.getVersion()},template:templateEngine.createTemplate("footerView.ejs"),showServerStatus:function(a){a===!0?($(".serverStatusIndicator").addClass("isOnline"),$(".serverStatusIndicator").addClass("fa-check-circle-o"),$(".serverStatusIndicator").removeClass("fa-times-circle-o")):($(".serverStatusIndicator").removeClass("isOnline"),$(".serverStatusIndicator").removeClass("fa-check-circle-o"),$(".serverStatusIndicator").addClass("fa-times-circle-o"))},showShortcutModal:function(){window.arangoHelper.hotkeysFunctions.showHotkeysModal()},getVersion:function(){var a=this;$.ajax({type:"GET",cache:!1,url:"/_api/version",contentType:"application/json",processData:!1,async:!0,success:function(b){a.showServerStatus(!0),a.isOffline===!0&&(a.isOffline=!1,a.isOfflineCounter=0,a.firstLogin?a.firstLogin=!1:window.setTimeout(function(){a.showServerStatus(!0)},1e3),a.system.name=b.server,a.system.version=b.version,a.render())},error:function(b){a.isOffline=!0,a.isOfflineCounter++,a.isOfflineCounter>=1&&a.showServerStatus(!1)}}),a.system.hasOwnProperty("database")||$.ajax({type:"GET",cache:!1,url:"/_api/database/current",contentType:"application/json",processData:!1,async:!0,success:function(b){var c=b.result.name;a.system.database=c;var d=window.setInterval(function(){var b=$("#databaseNavi");b&&(window.clearTimeout(d),d=null,"_system"===c?($(".logs-menu").css("visibility","visible"),$(".logs-menu").css("display","inline"),$("#databaseNavi").css("display","inline")):($(".logs-menu").css("visibility","hidden"),$(".logs-menu").css("display","none")),a.render())},50)}})},renderVersion:function(){this.system.hasOwnProperty("database")&&this.system.hasOwnProperty("name")&&$(this.el).html(this.template.render({name:this.system.name,version:this.system.version,database:this.system.database}))},render:function(){return this.system.version||this.getVersion(),$(this.el).html(this.template.render({name:this.system.name,version:this.system.version})),this}})}(),function(){"use strict";window.FoxxActiveView=Backbone.View.extend({tagName:"div",className:"tile",template:templateEngine.createTemplate("foxxActiveView.ejs"),_show:!0,events:{click:"openAppDetailView"},openAppDetailView:function(){window.App.navigate("applications/"+encodeURIComponent(this.model.get("mount")),{trigger:!0})},toggle:function(a,b){switch(a){case"devel":this.model.isDevelopment()&&(this._show=b);break;case"production":this.model.isDevelopment()||this.model.isSystem()||(this._show=b);break;case"system":this.model.isSystem()&&(this._show=b)}this._show?$(this.el).show():$(this.el).hide()},render:function(){return $(this.el).html(this.template.render({model:this.model})),$(this.el)}})}(),function(){"use strict";var a=require("internal").errors,b=templateEngine.createTemplate("applicationListView.ejs"),c=function(a){this.collection=a.collection},d=function(b){if(b.error===!1)this.collection.fetch({async:!1}),window.modalView.hide(),this.reload();else{var c=b;switch(b.hasOwnProperty("responseJSON")&&(c=b.responseJSON),c.errorNum){case a.ERROR_APPLICATION_DOWNLOAD_FAILED.code:alert("Unable to download application from the given repository.");break;default:alert("Error: "+c.errorNum+". "+c.errorMessage)}}},e=function(){window.modalView.modalBindValidation({id:"new-app-mount",validateInput:function(){return[{rule:Joi.string().regex(/^(\/(APP[^\/]+|(?!APP)[a-zA-Z0-9_\-%]+))+$/i),msg:"May not contain /APP"},{rule:Joi.string().regex(/^(\/[a-zA-Z0-9_\-%]+)+$/),msg:"Can only contain [a-zA-Z0-9_-%]"},{rule:Joi.string().regex(/^\/([^_]|_open\/)/),msg:"Mountpoints with _ are reserved for internal use"},{rule:Joi.string().regex(/[^\/]$/),msg:"May not end with /"},{rule:Joi.string().regex(/^\//),msg:"Has to start with /"},{rule:Joi.string().required().min(2),msg:"Has to be non-empty"}]}})},f=function(){window.modalView.modalBindValidation({id:"repository",validateInput:function(){return[{rule:Joi.string().required().regex(/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+$/),msg:"No valid Github account and repository."}]}})},g=function(){window.modalView.modalBindValidation({id:"new-app-author",validateInput:function(){return[{rule:Joi.string().required().min(1),msg:"Has to be non empty."}]}}),window.modalView.modalBindValidation({id:"new-app-name",validateInput:function(){return[{rule:Joi.string().required().regex(/^[a-zA-Z\-_][a-zA-Z0-9\-_]*$/),msg:"Can only contain a to z, A to Z, 0-9, '-' and '_'."}]}}),window.modalView.modalBindValidation({id:"new-app-description",validateInput:function(){return[{rule:Joi.string().required().min(1),msg:"Has to be non empty."}]}}),window.modalView.modalBindValidation({id:"new-app-license",validateInput:function(){return[{rule:Joi.string().required().regex(/^[a-zA-Z0-9 \.,;\-]+$/),msg:"Has to be non empty."}]}}),window.modalView.modalTestAll()},h=function(a){window.modalView.clearValidators();var b=$("#modalButton1");switch(this._upgrade||e(),a){case"newApp":b.html("Generate"),b.prop("disabled",!1),g();break;case"appstore":b.html("Install"),b.prop("disabled",!0);break;case"github":f(),b.html("Install"),b.prop("disabled",!1);break;case"zip":b.html("Install"),b.prop("disabled",!1)}b.prop("disabled")||window.modalView.modalTestAll()||b.prop("disabled",!0)},i=function(a){var b=$(a.currentTarget).attr("href").substr(1);h.call(this,b)},j=function(a){if(h.call(this,"appstore"),window.modalView.modalTestAll()){var b,c;this._upgrade?(b=this.mount,c=$("#new-app-teardown").prop("checked")):b=window.arangoHelper.escapeHtml($("#new-app-mount").val());var e=$(a.currentTarget).attr("appId"),f=$(a.currentTarget).attr("appVersion");void 0!==c?this.collection.installFromStore({name:e,version:f},b,d.bind(this),c):this.collection.installFromStore({name:e,version:f},b,d.bind(this))}},k=function(a,b){if(void 0===b?b=this._uploadData:this._uploadData=b,b&&window.modalView.modalTestAll()){var c,e;this._upgrade?(c=this.mount,e=$("#new-app-teardown").prop("checked")):c=window.arangoHelper.escapeHtml($("#new-app-mount").val()),void 0!==e?this.collection.installFromZip(b.filename,c,d.bind(this),e):this.collection.installFromZip(b.filename,c,d.bind(this))}},l=function(){if(window.modalView.modalTestAll()){var a,b,c,e;this._upgrade?(c=this.mount,e=$("#new-app-teardown").prop("checked")):c=window.arangoHelper.escapeHtml($("#new-app-mount").val()),a=window.arangoHelper.escapeHtml($("#repository").val()),b=window.arangoHelper.escapeHtml($("#tag").val()),""===b&&(b="master");var f={url:window.arangoHelper.escapeHtml($("#repository").val()),version:window.arangoHelper.escapeHtml($("#tag").val())};try{Joi.assert(a,Joi.string().regex(/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+$/))}catch(g){return}void 0!==e?this.collection.installFromGithub(f,c,d.bind(this),e):this.collection.installFromGithub(f,c,d.bind(this))}},m=function(){if(window.modalView.modalTestAll()){var a,b;this._upgrade?(a=this.mount,b=$("#new-app-teardown").prop("checked")):a=window.arangoHelper.escapeHtml($("#new-app-mount").val());var c={name:window.arangoHelper.escapeHtml($("#new-app-name").val()),collectionNames:_.map($("#new-app-collections").select2("data"),function(a){return window.arangoHelper.escapeHtml(a.text)}),author:window.arangoHelper.escapeHtml($("#new-app-author").val()),license:window.arangoHelper.escapeHtml($("#new-app-license").val()),description:window.arangoHelper.escapeHtml($("#new-app-description").val())};void 0!==b?this.collection.generate(c,a,d.bind(this),b):this.collection.generate(c,a,d.bind(this))}},n=function(){var a=$(".modal-body .tab-pane.active").attr("id");switch(a){case"newApp":m.apply(this);break;case"github":l.apply(this);break;case"zip":k.apply(this)}},o=function(a,c){var d=[],e={"click #infoTab a":i.bind(a),"click .install-app":j.bind(a)};d.push(window.modalView.createSuccessButton("Generate",n.bind(a))),window.modalView.show("modalApplicationMount.ejs","Install Service",d,c,void 0,void 0,e),$("#new-app-collections").select2({tags:[],showSearchBox:!1,minimumResultsForSearch:-1,width:"336px"});var f=function(){var a=$("#modalButton1");a.prop("disabled")||window.modalView.modalTestAll()?a.prop("disabled",!1):a.prop("disabled",!0)};$(".select2-search-field input").focusout(function(){f(),window.setTimeout(function(){$(".select2-drop").is(":visible")&&($("#select2-search-field input").is(":focus")||($("#s2id_new-app-collections").select2("close"),f()))},80)}),$(".select2-search-field input").focusin(function(){if($(".select2-drop").is(":visible")){var a=$("#modalButton1");a.prop("disabled",!0)}}),$("#upload-foxx-zip").uploadFile({url:"/_api/upload?multipart=true",allowedTypes:"zip",multiple:!1,onSuccess:k.bind(a)}),$.get("foxxes/fishbowl",function(a){var c=$("#appstore-content");c.html(""),_.each(_.sortBy(a,"name"),function(a){c.append(b.render(a))})}).fail(function(){var a=$("#appstore-content");a.append("
Store is not available. ArangoDB is not able to connect to github.com
")})};c.prototype.install=function(a){this.reload=a,this._upgrade=!1,this._uploadData=void 0,delete this.mount,o(this,!1),window.modalView.clearValidators(),e(),g()},c.prototype.upgrade=function(a,b){this.reload=b,this._upgrade=!0,this._uploadData=void 0,this.mount=a,o(this,!0),window.modalView.clearValidators(),g()},window.FoxxInstallView=c}(),function(){"use strict";window.GraphManagementView=Backbone.View.extend({el:"#content",template:templateEngine.createTemplate("graphManagementView.ejs"),edgeDefintionTemplate:templateEngine.createTemplate("edgeDefinitionTable.ejs"),eCollList:[],removedECollList:[],dropdownVisible:!1,events:{"click #deleteGraph":"deleteGraph","click .icon_arangodb_settings2.editGraph":"editGraph","click #createGraph":"addNewGraph","keyup #graphManagementSearchInput":"search","click #graphManagementSearchSubmit":"search","click .tile-graph":"redirectToGraphViewer","click #graphManagementToggle":"toggleGraphDropdown","click .css-label":"checkBoxes","change #graphSortDesc":"sorting"},toggleTab:function(a){var b=a.currentTarget.id;b=b.replace("tab-",""),$("#tab-content-create-graph .tab-pane").removeClass("active"),$("#tab-content-create-graph #"+b).addClass("active"),"exampleGraphs"===b?$("#modal-dialog .modal-footer button").css("display","none"):$("#modal-dialog .modal-footer button").css("display","block")},redirectToGraphViewer:function(a){var b=$(a.currentTarget).attr("id");b=b.substr(0,b.length-5),window.location=window.location+"/"+encodeURIComponent(b)},loadGraphViewer:function(a){var b=this.collection.get(a).get("edgeDefinitions");if(b&&0!==b.length){var c={type:"gharial",graphName:a,baseUrl:require("internal").arango.databasePrefix("/")},d=$("#content").width()-75;$("#content").html("");var e=arangoHelper.calculateCenterDivHeight();this.ui=new GraphViewerUI($("#content")[0],c,d,e,{nodeShaper:{label:"_key",color:{type:"attribute",key:"_key"}}},!0),$(".contentDiv").height(e)}},handleResize:function(a){this.width&&this.width===a||(this.width=a,this.ui&&this.ui.changeWidth(a))},addNewGraph:function(a){a.preventDefault(),this.createEditGraphModal()},deleteGraph:function(){var a=this,b=$("#editGraphName")[0].value;if($("#dropGraphCollections").is(":checked")){var c=function(c){c?(a.collection.remove(a.collection.get(b)),a.updateGraphManagementView(),window.modalView.hide()):window.modalView.hide()};this.collection.dropAndDeleteGraph(b,c)}else this.collection.get(b).destroy({success:function(){a.updateGraphManagementView(),window.modalView.hide()},error:function(a,b){var c=JSON.parse(b.responseText),d=c.errorMessage;arangoHelper.arangoError(d),window.modalView.hide()}})},checkBoxes:function(a){var b=a.currentTarget.id;$("#"+b).click()},toggleGraphDropdown:function(){$("#graphSortDesc").attr("checked",this.collection.sortOptions.desc),$("#graphManagementToggle").toggleClass("activated"),$("#graphManagementDropdown2").slideToggle(200)},sorting:function(){$("#graphSortDesc").is(":checked")?this.collection.setSortingDesc(!0):this.collection.setSortingDesc(!1),$("#graphManagementDropdown").is(":visible")?this.dropdownVisible=!0:this.dropdownVisible=!1,this.render()},createExampleGraphs:function(a){var b=$(a.currentTarget).attr("graph-id"),c=this;$.ajax({type:"POST",url:"/_admin/aardvark/graph-examples/create/"+encodeURIComponent(b),success:function(){window.modalView.hide(),c.updateGraphManagementView(),arangoHelper.arangoNotification("Example Graphs","Graph: "+b+" created.")},error:function(a){if(window.modalView.hide(),console.log(a),a.responseText)try{var c=JSON.parse(a.responseText);arangoHelper.arangoError("Example Graphs",c.errorMessage)}catch(d){arangoHelper.arangoError("Example Graphs","Could not create example graph: "+b)}else arangoHelper.arangoError("Example Graphs","Could not create example graph: "+b)}})},render:function(){return this.collection.fetch({async:!1}),this.collection.sort(),$(this.el).html(this.template.render({graphs:this.collection,searchString:""})),this.dropdownVisible===!0&&($("#graphManagementDropdown2").show(),$("#graphSortDesc").attr("checked",this.collection.sortOptions.desc),$("#graphManagementToggle").toggleClass("activated"),$("#graphManagementDropdown").show()),this.events["click .tableRow"]=this.showHideDefinition.bind(this),this.events['change tr[id*="newEdgeDefinitions"]']=this.setFromAndTo.bind(this),this.events["click .graphViewer-icon-button"]=this.addRemoveDefinition.bind(this),this.events["click #graphTab a"]=this.toggleTab.bind(this),this.events["click .createExampleGraphs"]=this.createExampleGraphs.bind(this),arangoHelper.setCheckboxStatus("#graphManagementDropdown"),this},setFromAndTo:function(a){a.stopPropagation();var b,c=this.calculateEdgeDefinitionMap();if(a.added){if(-1===this.eCollList.indexOf(a.added.id)&&-1!==this.removedECollList.indexOf(a.added.id))return b=a.currentTarget.id.split("row_newEdgeDefinitions")[1],$('input[id*="newEdgeDefinitions'+b+'"]').select2("val",null),void $('input[id*="newEdgeDefinitions'+b+'"]').attr("placeholder","The collection "+a.added.id+" is already used.");this.removedECollList.push(a.added.id),this.eCollList.splice(this.eCollList.indexOf(a.added.id),1)}else this.eCollList.push(a.removed.id),this.removedECollList.splice(this.removedECollList.indexOf(a.removed.id),1);c[a.val]?(b=a.currentTarget.id.split("row_newEdgeDefinitions")[1],$("#s2id_fromCollections"+b).select2("val",c[a.val].from),$("#fromCollections"+b).attr("disabled",!0),$("#s2id_toCollections"+b).select2("val",c[a.val].to),$("#toCollections"+b).attr("disabled",!0)):(b=a.currentTarget.id.split("row_newEdgeDefinitions")[1],$("#s2id_fromCollections"+b).select2("val",null),$("#fromCollections"+b).attr("disabled",!1),$("#s2id_toCollections"+b).select2("val",null),$("#toCollections"+b).attr("disabled",!1))},editGraph:function(a){a.stopPropagation(),this.collection.fetch(),this.graphToEdit=this.evaluateGraphName($(a.currentTarget).attr("id"),"_settings");var b=this.collection.findWhere({_key:this.graphToEdit});this.createEditGraphModal(b)},saveEditedGraph:function(){var a,b,c,d,e,f=$("#editGraphName")[0].value,g=_.pluck($("#newVertexCollections").select2("data"),"text"),h=[],i={};if(e=$("[id^=s2id_newEdgeDefinitions]").toArray(),e.forEach(function(e){if(d=$(e).attr("id"),d=d.replace("s2id_newEdgeDefinitions",""),a=_.pluck($("#s2id_newEdgeDefinitions"+d).select2("data"),"text")[0],a&&""!==a&&(b=_.pluck($("#s2id_fromCollections"+d).select2("data"),"text"),c=_.pluck($("#s2id_toCollections"+d).select2("data"),"text"),0!==b.length&&0!==c.length)){var f={collection:a,from:b,to:c};h.push(f),i[a]=f}}),0===h.length)return void $("#s2id_newEdgeDefinitions0 .select2-choices").css("border-color","red");var j=this.collection.findWhere({_key:f}),k=j.get("edgeDefinitions"),l=j.get("orphanCollections"),m=[];l.forEach(function(a){-1===g.indexOf(a)&&j.deleteVertexCollection(a)}),g.forEach(function(a){-1===l.indexOf(a)&&j.addVertexCollection(a)});var n=[],o=[],p=[];k.forEach(function(a){var b=a.collection;m.push(b);var c=i[b];void 0===c?p.push(b):JSON.stringify(c)!==JSON.stringify(a)&&o.push(b)}),h.forEach(function(a){var b=a.collection;-1===m.indexOf(b)&&n.push(b)}),n.forEach(function(a){j.addEdgeDefinition(i[a])}),o.forEach(function(a){j.modifyEdgeDefinition(i[a])}),p.forEach(function(a){j.deleteEdgeDefinition(a)}),this.updateGraphManagementView(),window.modalView.hide()},evaluateGraphName:function(a,b){var c=a.lastIndexOf(b);return a.substring(0,c)},search:function(){var a,b,c,d;a=$("#graphManagementSearchInput"),b=$("#graphManagementSearchInput").val(),d=this.collection.filter(function(a){return-1!==a.get("_key").indexOf(b)}),$(this.el).html(this.template.render({graphs:d,searchString:b})),a=$("#graphManagementSearchInput"),c=a.val().length,a.focus(),a[0].setSelectionRange(c,c)},updateGraphManagementView:function(){var a=this;this.collection.fetch({success:function(){a.render()}})},createNewGraph:function(){var a,b,c,d,e,f=$("#createNewGraphName").val(),g=_.pluck($("#newVertexCollections").select2("data"),"text"),h=[],i=this;return f?this.collection.findWhere({_key:f})?(arangoHelper.arangoError("The graph '"+f+"' already exists."),0):(e=$("[id^=s2id_newEdgeDefinitions]").toArray(),e.forEach(function(e){d=$(e).attr("id"),d=d.replace("s2id_newEdgeDefinitions",""),a=_.pluck($("#s2id_newEdgeDefinitions"+d).select2("data"),"text")[0],a&&""!==a&&(b=_.pluck($("#s2id_fromCollections"+d).select2("data"),"text"),c=_.pluck($("#s2id_toCollections"+d).select2("data"),"text"),1!==b&&1!==c&&h.push({collection:a,from:b,to:c}))}),void this.collection.create({name:f,edgeDefinitions:h,orphanCollections:g},{success:function(){i.updateGraphManagementView(),window.modalView.hide()},error:function(a,b){var c=JSON.parse(b.responseText),d=c.errorMessage;d=d.replace("<",""),d=d.replace(">",""),arangoHelper.arangoError(d)}})):(arangoHelper.arangoError("A name for the graph has to be provided."),0)},createEditGraphModal:function(a){var b,c=[],d=[],e=[],f=this.options.collectionCollection.models,g=this,h="",i=[{collection:"",from:"",to:""}],j="",k=function(a,b){return a=a.toLowerCase(),b=b.toLowerCase(),b>a?-1:a>b?1:0};if(this.eCollList=[],this.removedECollList=[],f.forEach(function(a){a.get("isSystem")||("edge"===a.get("type")?g.eCollList.push(a.id):d.push(a.id))}),window.modalView.enableHotKeys=!1,this.counter=0,a?(b="Edit Graph",h=a.get("_key"),i=a.get("edgeDefinitions"),i&&0!==i.length||(i=[{collection:"",from:"",to:""}]),j=a.get("orphanCollections"),e.push(window.modalView.createReadOnlyEntry("editGraphName","Name",h,"The name to identify the graph. Has to be unique")),
-c.push(window.modalView.createDeleteButton("Delete",this.deleteGraph.bind(this))),c.push(window.modalView.createSuccessButton("Save",this.saveEditedGraph.bind(this)))):(b="Create Graph",e.push(window.modalView.createTextEntry("createNewGraphName","Name","","The name to identify the graph. Has to be unique.","graphName",!0)),c.push(window.modalView.createSuccessButton("Create",this.createNewGraph.bind(this)))),i.forEach(function(a){0===g.counter?(a.collection&&(g.removedECollList.push(a.collection),g.eCollList.splice(g.eCollList.indexOf(a.collection),1)),e.push(window.modalView.createSelect2Entry("newEdgeDefinitions"+g.counter,"Edge definitions",a.collection,"An edge definition defines a relation of the graph","Edge definitions",!0,!1,!0,1,g.eCollList.sort(k)))):e.push(window.modalView.createSelect2Entry("newEdgeDefinitions"+g.counter,"Edge definitions",a.collection,"An edge definition defines a relation of the graph","Edge definitions",!1,!0,!1,1,g.eCollList.sort(k))),e.push(window.modalView.createSelect2Entry("fromCollections"+g.counter,"fromCollections",a.from,"The collections that contain the start vertices of the relation.","fromCollections",!0,!1,!1,10,d.sort(k))),e.push(window.modalView.createSelect2Entry("toCollections"+g.counter,"toCollections",a.to,"The collections that contain the end vertices of the relation.","toCollections",!0,!1,!1,10,d.sort(k))),g.counter++}),e.push(window.modalView.createSelect2Entry("newVertexCollections","Vertex collections",j,"Collections that are part of a graph but not used in an edge definition","Vertex Collections",!1,!1,!1,10,d.sort(k))),window.modalView.show("modalGraphTable.ejs",b,c,e,void 0,void 0,this.events),a){$(".modal-body table").css("border-collapse","separate");var l;for($(".modal-body .spacer").remove(),l=0;l<=this.counter;l++)$("#row_fromCollections"+l).show(),$("#row_toCollections"+l).show(),$("#row_newEdgeDefinitions"+l).addClass("first"),$("#row_fromCollections"+l).addClass("middle"),$("#row_toCollections"+l).addClass("last"),$("#row_toCollections"+l).after('
"))}})}(),function(){"use strict";window.databaseView=Backbone.View.extend({users:null,el:"#content",template:templateEngine.createTemplate("databaseView.ejs"),dropdownVisible:!1,currentDB:"",events:{"click #createDatabase":"createDatabase","click #submitCreateDatabase":"submitCreateDatabase","click .editDatabase":"editDatabase","click .icon":"editDatabase","click #selectDatabase":"updateDatabase","click #submitDeleteDatabase":"submitDeleteDatabase","click .contentRowInactive a":"changeDatabase","keyup #databaseSearchInput":"search","click #databaseSearchSubmit":"search","click #databaseToggle":"toggleSettingsDropdown","click .css-label":"checkBoxes","click #dbSortDesc":"sorting","click .tile":"switchDatabase"},sorting:function(){$("#dbSortDesc").is(":checked")?this.collection.setSortingDesc(!0):this.collection.setSortingDesc(!1),$("#databaseDropdown").is(":visible")?this.dropdownVisible=!0:this.dropdownVisible=!1,this.render()},initialize:function(){this.collection.fetch({async:!1})},checkBoxes:function(a){var b=a.currentTarget.id;$("#"+b).click()},render:function(){return this.currentDatabase(),this.collection.sort(),$(this.el).html(this.template.render({collection:this.collection,searchString:"",currentDB:this.currentDB})),this.dropdownVisible===!0&&($("#dbSortDesc").attr("checked",this.collection.sortOptions.desc),$("#databaseToggle").toggleClass("activated"),$("#databaseDropdown2").show()),arangoHelper.setCheckboxStatus("#databaseDropdown"),this.replaceSVGs(),this},toggleSettingsDropdown:function(){$("#dbSortDesc").attr("checked",this.collection.sortOptions.desc),$("#databaseToggle").toggleClass("activated"),$("#databaseDropdown2").slideToggle(200)},selectedDatabase:function(){return $("#selectDatabases").val()},handleError:function(a,b,c){return 409===a?void arangoHelper.arangoError("DB","Database "+c+" already exists."):400===a?void arangoHelper.arangoError("DB","Invalid Parameters"):403===a?void arangoHelper.arangoError("DB","Insufficent rights. Execute this from _system database"):void 0},validateDatabaseInfo:function(a,b,c){return""===b?(arangoHelper.arangoError("DB","You have to define an owner for the new database"),!1):""===a?(arangoHelper.arangoError("DB","You have to define a name for the new database"),!1):0===a.indexOf("_")?(arangoHelper.arangoError("DB ","Databasename should not start with _"),!1):a.match(/^[a-zA-Z][a-zA-Z0-9_\-]*$/)?!0:(arangoHelper.arangoError("DB","Databasename may only contain numbers, letters, _ and -"),!1)},createDatabase:function(a){a.preventDefault(),this.createAddDatabaseModal()},switchDatabase:function(a){if(!$(a.target).parent().hasClass("iconSet")){var b=$(a.currentTarget).find("h5").text();if(""!==b){var c=this.collection.createDatabaseURL(b);window.location.replace(c)}}},submitCreateDatabase:function(){var a,b=this,c=$("#newDatabaseName").val(),d=$("#newUser").val();if(a="true"===$("#useDefaultPassword").val()?"ARANGODB_DEFAULT_ROOT_PASSWORD":$("#newPassword").val(),this.validateDatabaseInfo(c,d,a)){var e={name:c,users:[{username:d,passwd:a,active:!0}]};this.collection.create(e,{wait:!0,error:function(a,d){b.handleError(d.status,d.statusText,c)},success:function(a){b.updateDatabases(),window.modalView.hide(),window.App.naviView.dbSelectionView.render($("#dbSelect"))}})}},submitDeleteDatabase:function(a){var b=this.collection.where({name:a});b[0].destroy({wait:!0,url:"/_api/database/"+a}),this.updateDatabases(),window.App.naviView.dbSelectionView.render($("#dbSelect")),window.modalView.hide()},currentDatabase:function(){this.currentDB=this.collection.getCurrentDatabase()},changeDatabase:function(a){var b=$(a.currentTarget).attr("id"),c=this.collection.createDatabaseURL(b);window.location.replace(c)},updateDatabases:function(){var a=this;this.collection.fetch({success:function(){a.render(),window.App.handleSelectDatabase()}})},editDatabase:function(a){var b=this.evaluateDatabaseName($(a.currentTarget).attr("id"),"_edit-database"),c=!0;b===this.currentDB&&(c=!1),this.createEditDatabaseModal(b,c)},search:function(){var a,b,c,d;a=$("#databaseSearchInput"),b=$("#databaseSearchInput").val(),d=this.collection.filter(function(a){return-1!==a.get("name").indexOf(b)}),$(this.el).html(this.template.render({collection:d,searchString:b,currentDB:this.currentDB})),this.replaceSVGs(),a=$("#databaseSearchInput"),c=a.val().length,a.focus(),a[0].setSelectionRange(c,c)},replaceSVGs:function(){$(".svgToReplace").each(function(){var a=$(this),b=a.attr("id"),c=a.attr("src");$.get(c,function(c){var d=$(c).find("svg");d.attr("id",b).attr("class","tile-icon-svg").removeAttr("xmlns:a"),a.replaceWith(d)},"xml")})},evaluateDatabaseName:function(a,b){var c=a.lastIndexOf(b);return a.substring(0,c)},createEditDatabaseModal:function(a,b){var c=[],d=[];d.push(window.modalView.createReadOnlyEntry("id_name","Name",a,"")),b?c.push(window.modalView.createDeleteButton("Delete",this.submitDeleteDatabase.bind(this,a))):c.push(window.modalView.createDisabledButton("Delete")),window.modalView.show("modalTable.ejs","Delete database",c,d)},createAddDatabaseModal:function(){var a=[],b=[];b.push(window.modalView.createTextEntry("newDatabaseName","Name","",!1,"Database Name",!0,[{rule:Joi.string().regex(/^[a-zA-Z]/),msg:"Database name must start with a letter."},{rule:Joi.string().regex(/^[a-zA-Z0-9\-_]*$/),msg:'Only Symbols "_" and "-" are allowed.'},{rule:Joi.string().required(),msg:"No database name given."}])),b.push(window.modalView.createTextEntry("newUser","Username",null!==this.users?this.users.whoAmI():"root","Please define the owner of this database. This will be the only user having initial access to this database if authentication is turned on. Please note that if you specify a username different to your account you will not be able to access the database with your account after having creating it. Specifying a username is mandatory even with authentication turned off. If there is a failure you will be informed.","Database Owner",!0,[{rule:Joi.string().required(),msg:"No username given."}])),b.push(window.modalView.createSelectEntry("useDefaultPassword","Use default password",!0,"Read the password from the environment variable ARANGODB_DEFAULT_ROOT_PASSWORD.",[{value:!1,label:"No"},{value:!0,label:"Yes"}])),b.push(window.modalView.createPasswordEntry("newPassword","Password","",!1,"",!1)),a.push(window.modalView.createSuccessButton("Create",this.submitCreateDatabase.bind(this))),window.modalView.show("modalTable.ejs","Create Database",a,b),$("#useDefaultPassword").change(function(){"true"===$("#useDefaultPassword").val()?$("#row_newPassword").hide():$("#row_newPassword").show()}),$("#row_newPassword").hide()}})}(),function(){"use strict";window.DBSelectionView=Backbone.View.extend({template:templateEngine.createTemplate("dbSelectionView.ejs"),events:{"click .dbSelectionLink":"changeDatabase"},initialize:function(a){this.current=a.current},changeDatabase:function(a){var b=$(a.currentTarget).closest(".dbSelectionLink.tab").attr("id"),c=this.collection.createDatabaseURL(b);window.location.replace(c)},render:function(a){return this.$el=a,this.$el.html(this.template.render({list:this.collection.getDatabasesForUser(),current:this.current.get("name")})),this.delegateEvents(),this.el}})}(),function(){"use strict";var a=function(a){var b=a.split("/");return"collection/"+encodeURIComponent(b[0])+"/"+encodeURIComponent(b[1])};window.DocumentView=Backbone.View.extend({el:"#content",colid:0,docid:0,customView:!1,template:templateEngine.createTemplate("documentView.ejs"),events:{"click #saveDocumentButton":"saveDocument","click #deleteDocumentButton":"deleteDocumentModal","click #confirmDeleteDocument":"deleteDocument","click #document-from":"navigateToDocument","click #document-to":"navigateToDocument","keydown #documentEditor .ace_editor":"keyPress","keyup .jsoneditor .search input":"checkSearchBox"},checkSearchBox:function(a){""===$(a.currentTarget).val()&&this.editor.expandAll()},keyPress:function(a){a.ctrlKey&&13===a.keyCode?(a.preventDefault(),this.saveDocument()):a.metaKey&&13===a.keyCode&&(a.preventDefault(),this.saveDocument())},editor:0,setType:function(a){var b,c;return"edge"===a?(b=this.collection.getEdge(this.colid,this.docid),c="Edge: "):"document"===a&&(b=this.collection.getDocument(this.colid,this.docid),c="Document: "),b===!0?(this.type=a,this.fillInfo(c),this.fillEditor(),!0):void 0},deleteDocumentModal:function(){var a=[],b=[];b.push(window.modalView.createReadOnlyEntry("doc-delete-button","Delete","Delete this "+this.type+"?",void 0,void 0,!1,/[<>&'"]/)),a.push(window.modalView.createDeleteButton("Delete",this.deleteDocument.bind(this))),window.modalView.show("modalTable.ejs","Delete Document",a,b)},deleteDocument:function(){var a;if("document"===this.type){if(a=this.collection.deleteDocument(this.colid,this.docid),a===!1)return void arangoHelper.arangoError("Document error:","Could not delete")}else if("edge"===this.type&&(a=this.collection.deleteEdge(this.colid,this.docid),a===!1))return void arangoHelper.arangoError("Edge error:","Could not delete");if(a===!0)if(this.customView)this.customDeleteFunction();else{var b="collection/"+encodeURIComponent(this.colid)+"/documents/1";window.modalView.hide(),window.App.navigate(b,{trigger:!0})}},navigateToDocument:function(a){var b=$(a.target).attr("documentLink");b&&window.App.navigate(b,{trigger:!0})},fillInfo:function(b){var c=this.collection.first(),d=c.get("_id"),e=c.get("_key"),f=c.get("_rev"),g=c.get("_from"),h=c.get("_to");if($("#document-type").text(b),$("#document-id").text(d),$("#document-key").text(e),$("#document-rev").text(f),g&&h){var i=a(g),j=a(h);$("#document-from").text(g),$("#document-from").attr("documentLink",i),$("#document-to").text(h),$("#document-to").attr("documentLink",j)}else $(".edge-info-container").hide()},fillEditor:function(){var a=this.removeReadonlyKeys(this.collection.first().attributes);this.editor.set(a),$(".ace_content").attr("font-size","11pt")},jsonContentChanged:function(){this.enableSaveButton()},render:function(){$(this.el).html(this.template.render({})),this.disableSaveButton(),this.breadcrumb();var a=this,b=document.getElementById("documentEditor"),c={change:function(){a.jsonContentChanged()},search:!0,mode:"tree",modes:["tree","code"],iconlib:"fontawesome4"};return this.editor=new JSONEditor(b,c),this},removeReadonlyKeys:function(a){return _.omit(a,["_key","_id","_from","_to","_rev"])},saveDocument:function(){var a,b;if(void 0===$("#saveDocumentButton").attr("disabled")){try{a=this.editor.get()}catch(c){return this.errorConfirmation(c),void this.disableSaveButton()}if(a=JSON.stringify(a),"document"===this.type){if(b=this.collection.saveDocument(this.colid,this.docid,a),b===!1)return void arangoHelper.arangoError("Document error:","Could not save")}else if("edge"===this.type&&(b=this.collection.saveEdge(this.colid,this.docid,a),b===!1))return void arangoHelper.arangoError("Edge error:","Could not save");b===!0&&(this.successConfirmation(),this.disableSaveButton())}},successConfirmation:function(){arangoHelper.arangoNotification("Document saved."),$("#documentEditor .tree").animate({backgroundColor:"#C6FFB0"},500),$("#documentEditor .tree").animate({backgroundColor:"#FFFFF"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#C6FFB0"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#FFFFF"},500)},errorConfirmation:function(a){arangoHelper.arangoError("Document editor: ",a),$("#documentEditor .tree").animate({backgroundColor:"#FFB0B0"},500),$("#documentEditor .tree").animate({backgroundColor:"#FFFFF"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#FFB0B0"},500),$("#documentEditor .ace_content").animate({backgroundColor:"#FFFFF"},500)},enableSaveButton:function(){$("#saveDocumentButton").prop("disabled",!1),$("#saveDocumentButton").addClass("button-success"),$("#saveDocumentButton").removeClass("button-close")},disableSaveButton:function(){$("#saveDocumentButton").prop("disabled",!0),$("#saveDocumentButton").addClass("button-close"),$("#saveDocumentButton").removeClass("button-success")},breadcrumb:function(){var a=window.location.hash.split("/");$("#transparentHeader").append('
")}})}(),function(){"use strict";window.EditListEntryView=Backbone.View.extend({template:templateEngine.createTemplate("editListEntryView.ejs"),initialize:function(a){this.key=a.key,this.value=a.value,this.render()},events:{"click .deleteAttribute":"removeRow"},render:function(){$(this.el).html(this.template.render({key:this.key,value:JSON.stringify(this.value),isReadOnly:this.isReadOnly()}))},isReadOnly:function(){return 0===this.key.indexOf("_")},getKey:function(){return $(".key").val()},getValue:function(){var val=$(".val").val();try{val=JSON.parse(val)}catch(e){try{return eval("val = "+val),val}catch(e2){return $(".val").val()}}return val},removeRow:function(){this.remove()}})}(),function(){"use strict";window.FooterView=Backbone.View.extend({el:"#footerBar",system:{},isOffline:!0,isOfflineCounter:0,firstLogin:!0,events:{"click .footer-center p":"showShortcutModal"},initialize:function(){var a=this;window.setInterval(function(){a.getVersion()},15e3),a.getVersion()},template:templateEngine.createTemplate("footerView.ejs"),showServerStatus:function(a){a===!0?($(".serverStatusIndicator").addClass("isOnline"),$(".serverStatusIndicator").addClass("fa-check-circle-o"),$(".serverStatusIndicator").removeClass("fa-times-circle-o")):($(".serverStatusIndicator").removeClass("isOnline"),$(".serverStatusIndicator").removeClass("fa-check-circle-o"),$(".serverStatusIndicator").addClass("fa-times-circle-o"))},showShortcutModal:function(){window.arangoHelper.hotkeysFunctions.showHotkeysModal()},getVersion:function(){var a=this;$.ajax({type:"GET",cache:!1,url:"/_api/version",contentType:"application/json",processData:!1,async:!0,success:function(b){a.showServerStatus(!0),a.isOffline===!0&&(a.isOffline=!1,a.isOfflineCounter=0,a.firstLogin?a.firstLogin=!1:window.setTimeout(function(){a.showServerStatus(!0)},1e3),a.system.name=b.server,a.system.version=b.version,a.render())},error:function(b){a.isOffline=!0,a.isOfflineCounter++,a.isOfflineCounter>=1&&a.showServerStatus(!1)}}),a.system.hasOwnProperty("database")||$.ajax({type:"GET",cache:!1,url:"/_api/database/current",contentType:"application/json",processData:!1,async:!0,success:function(b){var c=b.result.name;a.system.database=c;var d=window.setInterval(function(){var b=$("#databaseNavi");b&&(window.clearTimeout(d),d=null,"_system"===c?($(".logs-menu").css("visibility","visible"),$(".logs-menu").css("display","inline"),$("#databaseNavi").css("display","inline")):($(".logs-menu").css("visibility","hidden"),$(".logs-menu").css("display","none")),a.render())},50)}})},renderVersion:function(){this.system.hasOwnProperty("database")&&this.system.hasOwnProperty("name")&&$(this.el).html(this.template.render({name:this.system.name,version:this.system.version,database:this.system.database}))},render:function(){return this.system.version||this.getVersion(),$(this.el).html(this.template.render({name:this.system.name,version:this.system.version})),this}})}(),function(){"use strict";window.FoxxActiveView=Backbone.View.extend({tagName:"div",className:"tile",template:templateEngine.createTemplate("foxxActiveView.ejs"),_show:!0,events:{click:"openAppDetailView"},openAppDetailView:function(){window.App.navigate("applications/"+encodeURIComponent(this.model.get("mount")),{trigger:!0})},toggle:function(a,b){switch(a){case"devel":this.model.isDevelopment()&&(this._show=b);break;case"production":this.model.isDevelopment()||this.model.isSystem()||(this._show=b);break;case"system":this.model.isSystem()&&(this._show=b)}this._show?$(this.el).show():$(this.el).hide()},render:function(){return $(this.el).html(this.template.render({model:this.model})),$(this.el)}})}(),function(){"use strict";var a=require("internal").errors,b=templateEngine.createTemplate("applicationListView.ejs"),c=function(a){this.collection=a.collection},d=function(b){if(b.error===!1)this.collection.fetch({async:!1}),window.modalView.hide(),this.reload();else{var c=b;switch(b.hasOwnProperty("responseJSON")&&(c=b.responseJSON),c.errorNum){case a.ERROR_APPLICATION_DOWNLOAD_FAILED.code:alert("Unable to download application from the given repository.");break;default:alert("Error: "+c.errorNum+". "+c.errorMessage)}}},e=function(){window.modalView.modalBindValidation({id:"new-app-mount",validateInput:function(){return[{rule:Joi.string().regex(/^(\/(APP[^\/]+|(?!APP)[a-zA-Z0-9_\-%]+))+$/i),msg:"May not contain /APP"},{rule:Joi.string().regex(/^(\/[a-zA-Z0-9_\-%]+)+$/),msg:"Can only contain [a-zA-Z0-9_-%]"},{rule:Joi.string().regex(/^\/([^_]|_open\/)/),msg:"Mountpoints with _ are reserved for internal use"},{rule:Joi.string().regex(/[^\/]$/),msg:"May not end with /"},{rule:Joi.string().regex(/^\//),msg:"Has to start with /"},{rule:Joi.string().required().min(2),msg:"Has to be non-empty"}]}})},f=function(){window.modalView.modalBindValidation({id:"repository",validateInput:function(){return[{rule:Joi.string().required().regex(/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+$/),msg:"No valid Github account and repository."}]}})},g=function(){window.modalView.modalBindValidation({id:"new-app-author",validateInput:function(){return[{rule:Joi.string().required().min(1),msg:"Has to be non empty."}]}}),window.modalView.modalBindValidation({id:"new-app-name",validateInput:function(){return[{rule:Joi.string().required().regex(/^[a-zA-Z\-_][a-zA-Z0-9\-_]*$/),msg:"Can only contain a to z, A to Z, 0-9, '-' and '_'."}]}}),window.modalView.modalBindValidation({id:"new-app-description",validateInput:function(){return[{rule:Joi.string().required().min(1),msg:"Has to be non empty."}]}}),window.modalView.modalBindValidation({id:"new-app-license",validateInput:function(){return[{rule:Joi.string().required().regex(/^[a-zA-Z0-9 \.,;\-]+$/),msg:"Has to be non empty."}]}}),window.modalView.modalTestAll()},h=function(a){window.modalView.clearValidators();var b=$("#modalButton1");switch(this._upgrade||e(),a){case"newApp":b.html("Generate"),b.prop("disabled",!1),g();break;case"appstore":b.html("Install"),b.prop("disabled",!0);break;case"github":f(),b.html("Install"),b.prop("disabled",!1);break;case"zip":b.html("Install"),b.prop("disabled",!1)}b.prop("disabled")||window.modalView.modalTestAll()||b.prop("disabled",!0)},i=function(a){var b=$(a.currentTarget).attr("href").substr(1);h.call(this,b)},j=function(a){if(h.call(this,"appstore"),window.modalView.modalTestAll()){var b,c;this._upgrade?(b=this.mount,c=$("#new-app-teardown").prop("checked")):b=window.arangoHelper.escapeHtml($("#new-app-mount").val());var e=$(a.currentTarget).attr("appId"),f=$(a.currentTarget).attr("appVersion");void 0!==c?this.collection.installFromStore({name:e,version:f},b,d.bind(this),c):this.collection.installFromStore({name:e,version:f},b,d.bind(this))}},k=function(a,b){if(void 0===b?b=this._uploadData:this._uploadData=b,b&&window.modalView.modalTestAll()){var c,e;this._upgrade?(c=this.mount,e=$("#new-app-teardown").prop("checked")):c=window.arangoHelper.escapeHtml($("#new-app-mount").val()),void 0!==e?this.collection.installFromZip(b.filename,c,d.bind(this),e):this.collection.installFromZip(b.filename,c,d.bind(this))}},l=function(){if(window.modalView.modalTestAll()){var a,b,c,e;this._upgrade?(c=this.mount,e=$("#new-app-teardown").prop("checked")):c=window.arangoHelper.escapeHtml($("#new-app-mount").val()),a=window.arangoHelper.escapeHtml($("#repository").val()),b=window.arangoHelper.escapeHtml($("#tag").val()),""===b&&(b="master");var f={url:window.arangoHelper.escapeHtml($("#repository").val()),version:window.arangoHelper.escapeHtml($("#tag").val())};try{Joi.assert(a,Joi.string().regex(/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+$/))}catch(g){return}void 0!==e?this.collection.installFromGithub(f,c,d.bind(this),e):this.collection.installFromGithub(f,c,d.bind(this))}},m=function(){if(window.modalView.modalTestAll()){var a,b;this._upgrade?(a=this.mount,b=$("#new-app-teardown").prop("checked")):a=window.arangoHelper.escapeHtml($("#new-app-mount").val());var c={name:window.arangoHelper.escapeHtml($("#new-app-name").val()),collectionNames:_.map($("#new-app-collections").select2("data"),function(a){return window.arangoHelper.escapeHtml(a.text)}),author:window.arangoHelper.escapeHtml($("#new-app-author").val()),license:window.arangoHelper.escapeHtml($("#new-app-license").val()),description:window.arangoHelper.escapeHtml($("#new-app-description").val())};void 0!==b?this.collection.generate(c,a,d.bind(this),b):this.collection.generate(c,a,d.bind(this))}},n=function(){var a=$(".modal-body .tab-pane.active").attr("id");switch(a){case"newApp":m.apply(this);break;case"github":l.apply(this);break;case"zip":k.apply(this)}},o=function(a,c){var d=[],e={"click #infoTab a":i.bind(a),"click .install-app":j.bind(a)};d.push(window.modalView.createSuccessButton("Generate",n.bind(a))),window.modalView.show("modalApplicationMount.ejs","Install Service",d,c,void 0,void 0,e),$("#new-app-collections").select2({tags:[],showSearchBox:!1,minimumResultsForSearch:-1,width:"336px"});var f=function(){var a=$("#modalButton1");a.prop("disabled")||window.modalView.modalTestAll()?a.prop("disabled",!1):a.prop("disabled",!0)};$(".select2-search-field input").focusout(function(){f(),window.setTimeout(function(){$(".select2-drop").is(":visible")&&($("#select2-search-field input").is(":focus")||($("#s2id_new-app-collections").select2("close"),f()))},80)}),$(".select2-search-field input").focusin(function(){if($(".select2-drop").is(":visible")){var a=$("#modalButton1");a.prop("disabled",!0)}}),$("#upload-foxx-zip").uploadFile({url:"/_api/upload?multipart=true",allowedTypes:"zip",multiple:!1,onSuccess:k.bind(a)}),$.get("foxxes/fishbowl",function(a){var c=$("#appstore-content");c.html(""),_.each(_.sortBy(a,"name"),function(a){c.append(b.render(a))})}).fail(function(){var a=$("#appstore-content");a.append("
Store is not available. ArangoDB is not able to connect to github.com
")})};c.prototype.install=function(a){this.reload=a,this._upgrade=!1,this._uploadData=void 0,delete this.mount,o(this,!1),window.modalView.clearValidators(),e(),g()},c.prototype.upgrade=function(a,b){this.reload=b,this._upgrade=!0,this._uploadData=void 0,this.mount=a,o(this,!0),window.modalView.clearValidators(),g()},window.FoxxInstallView=c}(),function(){"use strict";window.GraphManagementView=Backbone.View.extend({el:"#content",template:templateEngine.createTemplate("graphManagementView.ejs"),edgeDefintionTemplate:templateEngine.createTemplate("edgeDefinitionTable.ejs"),eCollList:[],removedECollList:[],dropdownVisible:!1,events:{"click #deleteGraph":"deleteGraph","click .icon_arangodb_settings2.editGraph":"editGraph","click #createGraph":"addNewGraph","keyup #graphManagementSearchInput":"search","click #graphManagementSearchSubmit":"search","click .tile-graph":"redirectToGraphViewer","click #graphManagementToggle":"toggleGraphDropdown","click .css-label":"checkBoxes","change #graphSortDesc":"sorting"},toggleTab:function(a){var b=a.currentTarget.id;b=b.replace("tab-",""),$("#tab-content-create-graph .tab-pane").removeClass("active"),$("#tab-content-create-graph #"+b).addClass("active"),"exampleGraphs"===b?$("#modal-dialog .modal-footer button").css("display","none"):$("#modal-dialog .modal-footer button").css("display","block")},redirectToGraphViewer:function(a){var b=$(a.currentTarget).attr("id");b=b.substr(0,b.length-5),window.location=window.location+"/"+encodeURIComponent(b)},loadGraphViewer:function(a){var b=this.collection.get(a).get("edgeDefinitions");if(b&&0!==b.length){var c={type:"gharial",graphName:a,baseUrl:require("internal").arango.databasePrefix("/")},d=$("#content").width()-75;$("#content").html("");var e=arangoHelper.calculateCenterDivHeight();this.ui=new GraphViewerUI($("#content")[0],c,d,e,{nodeShaper:{label:"_key",color:{type:"attribute",key:"_key"}}},!0),$(".contentDiv").height(e)}},handleResize:function(a){this.width&&this.width===a||(this.width=a,this.ui&&this.ui.changeWidth(a))},addNewGraph:function(a){a.preventDefault(),this.createEditGraphModal()},deleteGraph:function(){var a=this,b=$("#editGraphName")[0].value;if($("#dropGraphCollections").is(":checked")){var c=function(c){c?(a.collection.remove(a.collection.get(b)),a.updateGraphManagementView(),window.modalView.hide()):window.modalView.hide()};this.collection.dropAndDeleteGraph(b,c)}else this.collection.get(b).destroy({success:function(){a.updateGraphManagementView(),window.modalView.hide()},error:function(a,b){var c=JSON.parse(b.responseText),d=c.errorMessage;arangoHelper.arangoError(d),window.modalView.hide()}})},checkBoxes:function(a){var b=a.currentTarget.id;$("#"+b).click()},toggleGraphDropdown:function(){$("#graphSortDesc").attr("checked",this.collection.sortOptions.desc),$("#graphManagementToggle").toggleClass("activated"),$("#graphManagementDropdown2").slideToggle(200)},sorting:function(){$("#graphSortDesc").is(":checked")?this.collection.setSortingDesc(!0):this.collection.setSortingDesc(!1),$("#graphManagementDropdown").is(":visible")?this.dropdownVisible=!0:this.dropdownVisible=!1,this.render()},createExampleGraphs:function(a){var b=$(a.currentTarget).attr("graph-id"),c=this;$.ajax({type:"POST",url:"/_admin/aardvark/graph-examples/create/"+encodeURIComponent(b),success:function(){window.modalView.hide(),c.updateGraphManagementView(),arangoHelper.arangoNotification("Example Graphs","Graph: "+b+" created.")},error:function(a){if(window.modalView.hide(),console.log(a),a.responseText)try{var c=JSON.parse(a.responseText);arangoHelper.arangoError("Example Graphs",c.errorMessage)}catch(d){arangoHelper.arangoError("Example Graphs","Could not create example graph: "+b)}else arangoHelper.arangoError("Example Graphs","Could not create example graph: "+b)}})},render:function(){return this.collection.fetch({async:!1}),this.collection.sort(),$(this.el).html(this.template.render({graphs:this.collection,searchString:""})),this.dropdownVisible===!0&&($("#graphManagementDropdown2").show(),$("#graphSortDesc").attr("checked",this.collection.sortOptions.desc),$("#graphManagementToggle").toggleClass("activated"),$("#graphManagementDropdown").show()),this.events["click .tableRow"]=this.showHideDefinition.bind(this),this.events['change tr[id*="newEdgeDefinitions"]']=this.setFromAndTo.bind(this),this.events["click .graphViewer-icon-button"]=this.addRemoveDefinition.bind(this),this.events["click #graphTab a"]=this.toggleTab.bind(this),this.events["click .createExampleGraphs"]=this.createExampleGraphs.bind(this),arangoHelper.setCheckboxStatus("#graphManagementDropdown"),this},setFromAndTo:function(a){a.stopPropagation();var b,c=this.calculateEdgeDefinitionMap();if(a.added){if(-1===this.eCollList.indexOf(a.added.id)&&-1!==this.removedECollList.indexOf(a.added.id))return b=a.currentTarget.id.split("row_newEdgeDefinitions")[1],$('input[id*="newEdgeDefinitions'+b+'"]').select2("val",null),void $('input[id*="newEdgeDefinitions'+b+'"]').attr("placeholder","The collection "+a.added.id+" is already used.");this.removedECollList.push(a.added.id),this.eCollList.splice(this.eCollList.indexOf(a.added.id),1)}else this.eCollList.push(a.removed.id),this.removedECollList.splice(this.removedECollList.indexOf(a.removed.id),1);c[a.val]?(b=a.currentTarget.id.split("row_newEdgeDefinitions")[1],$("#s2id_fromCollections"+b).select2("val",c[a.val].from),$("#fromCollections"+b).attr("disabled",!0),$("#s2id_toCollections"+b).select2("val",c[a.val].to),$("#toCollections"+b).attr("disabled",!0)):(b=a.currentTarget.id.split("row_newEdgeDefinitions")[1],$("#s2id_fromCollections"+b).select2("val",null),$("#fromCollections"+b).attr("disabled",!1),$("#s2id_toCollections"+b).select2("val",null),$("#toCollections"+b).attr("disabled",!1))},editGraph:function(a){a.stopPropagation(),this.collection.fetch(),this.graphToEdit=this.evaluateGraphName($(a.currentTarget).attr("id"),"_settings");var b=this.collection.findWhere({_key:this.graphToEdit});this.createEditGraphModal(b)},saveEditedGraph:function(){var a,b,c,d,e,f=$("#editGraphName")[0].value,g=_.pluck($("#newVertexCollections").select2("data"),"text"),h=[],i={};if(e=$("[id^=s2id_newEdgeDefinitions]").toArray(),e.forEach(function(e){if(d=$(e).attr("id"),d=d.replace("s2id_newEdgeDefinitions",""),a=_.pluck($("#s2id_newEdgeDefinitions"+d).select2("data"),"text")[0],a&&""!==a&&(b=_.pluck($("#s2id_fromCollections"+d).select2("data"),"text"),c=_.pluck($("#s2id_toCollections"+d).select2("data"),"text"),0!==b.length&&0!==c.length)){var f={collection:a,from:b,to:c};h.push(f),i[a]=f}}),0===h.length)return void $("#s2id_newEdgeDefinitions0 .select2-choices").css("border-color","red");var j=this.collection.findWhere({_key:f}),k=j.get("edgeDefinitions"),l=j.get("orphanCollections"),m=[];l.forEach(function(a){-1===g.indexOf(a)&&j.deleteVertexCollection(a)}),g.forEach(function(a){-1===l.indexOf(a)&&j.addVertexCollection(a)});var n=[],o=[],p=[];k.forEach(function(a){var b=a.collection;m.push(b);var c=i[b];void 0===c?p.push(b):JSON.stringify(c)!==JSON.stringify(a)&&o.push(b)}),h.forEach(function(a){var b=a.collection;-1===m.indexOf(b)&&n.push(b)}),n.forEach(function(a){j.addEdgeDefinition(i[a])}),o.forEach(function(a){j.modifyEdgeDefinition(i[a])}),p.forEach(function(a){j.deleteEdgeDefinition(a)}),this.updateGraphManagementView(),window.modalView.hide()},evaluateGraphName:function(a,b){var c=a.lastIndexOf(b);return a.substring(0,c)},search:function(){var a,b,c,d;a=$("#graphManagementSearchInput"),b=$("#graphManagementSearchInput").val(),d=this.collection.filter(function(a){return-1!==a.get("_key").indexOf(b)}),$(this.el).html(this.template.render({graphs:d,searchString:b})),a=$("#graphManagementSearchInput"),c=a.val().length,a.focus(),a[0].setSelectionRange(c,c)},updateGraphManagementView:function(){
+var a=this;this.collection.fetch({success:function(){a.render()}})},createNewGraph:function(){var a,b,c,d,e,f=$("#createNewGraphName").val(),g=_.pluck($("#newVertexCollections").select2("data"),"text"),h=[],i=this;return f?this.collection.findWhere({_key:f})?(arangoHelper.arangoError("The graph '"+f+"' already exists."),0):(e=$("[id^=s2id_newEdgeDefinitions]").toArray(),e.forEach(function(e){d=$(e).attr("id"),d=d.replace("s2id_newEdgeDefinitions",""),a=_.pluck($("#s2id_newEdgeDefinitions"+d).select2("data"),"text")[0],a&&""!==a&&(b=_.pluck($("#s2id_fromCollections"+d).select2("data"),"text"),c=_.pluck($("#s2id_toCollections"+d).select2("data"),"text"),1!==b&&1!==c&&h.push({collection:a,from:b,to:c}))}),void this.collection.create({name:f,edgeDefinitions:h,orphanCollections:g},{success:function(){i.updateGraphManagementView(),window.modalView.hide()},error:function(a,b){var c=JSON.parse(b.responseText),d=c.errorMessage;d=d.replace("<",""),d=d.replace(">",""),arangoHelper.arangoError(d)}})):(arangoHelper.arangoError("A name for the graph has to be provided."),0)},createEditGraphModal:function(a){var b,c=[],d=[],e=[],f=this.options.collectionCollection.models,g=this,h="",i=[{collection:"",from:"",to:""}],j="",k=function(a,b){return a=a.toLowerCase(),b=b.toLowerCase(),b>a?-1:a>b?1:0};if(this.eCollList=[],this.removedECollList=[],f.forEach(function(a){a.get("isSystem")||("edge"===a.get("type")?g.eCollList.push(a.id):d.push(a.id))}),window.modalView.enableHotKeys=!1,this.counter=0,a?(b="Edit Graph",h=a.get("_key"),i=a.get("edgeDefinitions"),i&&0!==i.length||(i=[{collection:"",from:"",to:""}]),j=a.get("orphanCollections"),e.push(window.modalView.createReadOnlyEntry("editGraphName","Name",h,"The name to identify the graph. Has to be unique")),c.push(window.modalView.createDeleteButton("Delete",this.deleteGraph.bind(this))),c.push(window.modalView.createSuccessButton("Save",this.saveEditedGraph.bind(this)))):(b="Create Graph",e.push(window.modalView.createTextEntry("createNewGraphName","Name","","The name to identify the graph. Has to be unique.","graphName",!0)),c.push(window.modalView.createSuccessButton("Create",this.createNewGraph.bind(this)))),i.forEach(function(a){0===g.counter?(a.collection&&(g.removedECollList.push(a.collection),g.eCollList.splice(g.eCollList.indexOf(a.collection),1)),e.push(window.modalView.createSelect2Entry("newEdgeDefinitions"+g.counter,"Edge definitions",a.collection,"An edge definition defines a relation of the graph","Edge definitions",!0,!1,!0,1,g.eCollList.sort(k)))):e.push(window.modalView.createSelect2Entry("newEdgeDefinitions"+g.counter,"Edge definitions",a.collection,"An edge definition defines a relation of the graph","Edge definitions",!1,!0,!1,1,g.eCollList.sort(k))),e.push(window.modalView.createSelect2Entry("fromCollections"+g.counter,"fromCollections",a.from,"The collections that contain the start vertices of the relation.","fromCollections",!0,!1,!1,10,d.sort(k))),e.push(window.modalView.createSelect2Entry("toCollections"+g.counter,"toCollections",a.to,"The collections that contain the end vertices of the relation.","toCollections",!0,!1,!1,10,d.sort(k))),g.counter++}),e.push(window.modalView.createSelect2Entry("newVertexCollections","Vertex collections",j,"Collections that are part of a graph but not used in an edge definition","Vertex Collections",!1,!1,!1,10,d.sort(k))),window.modalView.show("modalGraphTable.ejs",b,c,e,void 0,void 0,this.events),a){$(".modal-body table").css("border-collapse","separate");var l;for($(".modal-body .spacer").remove(),l=0;l<=this.counter;l++)$("#row_fromCollections"+l).show(),$("#row_toCollections"+l).show(),$("#row_newEdgeDefinitions"+l).addClass("first"),$("#row_fromCollections"+l).addClass("middle"),$("#row_toCollections"+l).addClass("last"),$("#row_toCollections"+l).after('
',maxVisible:1,closeWith:["click"],type:d.get("type"),layout:"bottom",timeout:f,animation:{open:{height:"show"},close:{height:"hide"},easing:"swing",speed:200}}),"success"===d.get("type"))return void d.destroy()}$("#stat_hd_counter").text(this.collection.length),0===this.collection.length?($("#stat_hd").removeClass("fullNotification"),$("#notification_menu").hide()):$("#stat_hd").addClass("fullNotification"),$(".innerDropdownInnerUL").html(this.notificationItem.render({notifications:this.collection})),$(".notificationInfoIcon").tooltip({position:{my:"left top",at:"right+55 top-1"}})},render:function(){return $(this.el).html(this.template.render({notifications:this.collection})),this.renderNotifications(),this.delegateEvents(),this.el}})}(),function(){"use strict";window.ProgressView=Backbone.View.extend({template:templateEngine.createTemplate("progressBase.ejs"),el:"#progressPlaceholder",el2:"#progressPlaceholderIcon",toShow:!1,lastDelay:0,action:function(){},events:{"click .progress-action button":"performAction"},performAction:function(){this.action(),window.progressView.hide()},initialize:function(){},showWithDelay:function(a,b,c,d){var e=this;e.toShow=!0,e.lastDelay=a,setTimeout(function(){e.toShow===!0&&e.show(b,c,d)},e.lastDelay)},show:function(a,b,c){$(this.el).html(this.template.render({})),$(".progress-text").text(a),c?$(".progress-action").html('"):$(".progress-action").html(''),b?this.action=b:this.action=this.hide(),$(this.el).show()},hide:function(){var a=this;a.toShow=!1,$(this.el).hide(),this.action=function(){}}})}(),function(){"use strict";window.queryManagementView=Backbone.View.extend({el:"#content",id:"#queryManagementContent",templateActive:templateEngine.createTemplate("queryManagementViewActive.ejs"),templateSlow:templateEngine.createTemplate("queryManagementViewSlow.ejs"),table:templateEngine.createTemplate("arangoTable.ejs"),tabbar:templateEngine.createTemplate("arangoTabbar.ejs"),initialize:function(){this.activeCollection=new window.QueryManagementActive,this.slowCollection=new window.QueryManagementSlow,this.convertModelToJSON(!0)},events:{"click #arangoQueryManagementTabbar button":"switchTab","click #deleteSlowQueryHistory":"deleteSlowQueryHistoryModal","click #arangoQueryManagementTable .fa-minus-circle":"deleteRunningQueryModal"},tabbarElements:{id:"arangoQueryManagementTabbar",titles:[["Active","activequeries"],["Slow","slowqueries"]]},tableDescription:{id:"arangoQueryManagementTable",titles:["ID","Query String","Runtime","Started",""],rows:[],unescaped:[!1,!1,!1,!1,!0]},switchTab:function(a){"activequeries"===a.currentTarget.id?this.convertModelToJSON(!0):"slowqueries"===a.currentTarget.id&&this.convertModelToJSON(!1)},deleteRunningQueryModal:function(a){this.killQueryId=$(a.currentTarget).attr("data-id");var b=[],c=[];c.push(window.modalView.createReadOnlyEntry(void 0,"Running Query","Do you want to kill the running query?",void 0,void 0,!1,void 0)),b.push(window.modalView.createDeleteButton("Kill",this.killRunningQuery.bind(this))),window.modalView.show("modalTable.ejs","Kill Running Query",b,c),$(".modal-delete-confirmation strong").html("Really kill?")},killRunningQuery:function(){this.collection.killRunningQuery(this.killQueryId,this.killRunningQueryCallback.bind(this)),window.modalView.hide()},killRunningQueryCallback:function(){this.convertModelToJSON(!0),this.renderActive()},deleteSlowQueryHistoryModal:function(){var a=[],b=[];b.push(window.modalView.createReadOnlyEntry(void 0,"Slow Query Log","Do you want to delete the slow query log entries?",void 0,void 0,!1,void 0)),a.push(window.modalView.createDeleteButton("Delete",this.deleteSlowQueryHistory.bind(this))),window.modalView.show("modalTable.ejs","Delete Slow Query Log",a,b)},deleteSlowQueryHistory:function(){this.collection.deleteSlowQueryHistory(this.slowQueryCallback.bind(this)),window.modalView.hide()},slowQueryCallback:function(){this.convertModelToJSON(!1),this.renderSlow()},render:function(){this.convertModelToJSON(!0)},renderActive:function(){this.$el.html(this.templateActive.render({})),$(this.id).html(this.tabbar.render({content:this.tabbarElements})),$(this.id).append(this.table.render({content:this.tableDescription})),$("#activequeries").addClass("arango-active-tab")},renderSlow:function(){this.$el.html(this.templateSlow.render({})),$(this.id).html(this.tabbar.render({content:this.tabbarElements})),$(this.id).append(this.table.render({content:this.tableDescription})),$("#slowqueries").addClass("arango-active-tab")},convertModelToJSON:function(a){var b=this,c=[];a===!0?this.collection=this.activeCollection:this.collection=this.slowCollection,this.collection.fetch({success:function(){b.collection.each(function(b){var d="";a&&(d=''),c.push([b.get("id"),b.get("query"),b.get("runTime").toFixed(2)+" s",b.get("started"),d])});var d="No running queries.";a||(d="No slow queries."),0===c.length&&c.push([d,"","",""]),b.tableDescription.rows=c,a?b.renderActive():b.renderSlow()}})}})}(),function(){"use strict";window.queryView=Backbone.View.extend({el:"#content",id:"#customsDiv",warningTemplate:templateEngine.createTemplate("warningList.ejs"),tabArray:[],execPending:!1,initialize:function(){this.refreshAQL(),this.tableDescription.rows=this.customQueries},events:{"click #result-switch":"switchTab","click #query-switch":"switchTab","click #customs-switch":"switchTab","click #submitQueryButton":"submitQuery","click #explainQueryButton":"explainQuery","click #commentText":"commentText","click #uncommentText":"uncommentText","click #undoText":"undoText","click #redoText":"redoText","click #smallOutput":"smallOutput","click #bigOutput":"bigOutput","click #clearOutput":"clearOutput","click #clearInput":"clearInput","click #clearQueryButton":"clearInput","click #addAQL":"addAQL","mouseover #querySelect":function(){this.refreshAQL(!0)},"change #querySelect":"importSelected","keypress #aqlEditor":"aqlShortcuts","click #arangoQueryTable .table-cell0":"editCustomQuery","click #arangoQueryTable .table-cell1":"editCustomQuery","click #arangoQueryTable .table-cell2 a":"deleteAQL","click #confirmQueryImport":"importCustomQueries","click #confirmQueryExport":"exportCustomQueries","click #export-query":"exportCustomQueries","click #import-query":"openExportDialog","click #closeQueryModal":"closeExportDialog","click #downloadQueryResult":"downloadQueryResult"},openExportDialog:function(){$("#queryImportDialog").modal("show")},closeExportDialog:function(){$("#queryImportDialog").modal("hide")},createCustomQueryModal:function(){var a=[],b=[];b.push(window.modalView.createTextEntry("new-query-name","Name","",void 0,void 0,!1,[{rule:Joi.string().required(),msg:"No query name given."}])),a.push(window.modalView.createSuccessButton("Save",this.saveAQL.bind(this))),window.modalView.show("modalTable.ejs","Save Query",a,b,void 0,void 0,{"keyup #new-query-name":this.listenKey.bind(this)})},updateTable:function(){this.tableDescription.rows=this.customQueries,_.each(this.tableDescription.rows,function(a){a.thirdRow='',a.hasOwnProperty("parameter")&&delete a.parameter}),this.tableDescription.unescaped=[!1,!1,!0],this.$(this.id).html(this.table.render({content:this.tableDescription}))},editCustomQuery:function(a){var b=$(a.target).parent().children().first().text(),c=ace.edit("aqlEditor"),d=ace.edit("varsEditor");c.setValue(this.getCustomQueryValueByName(b)),d.setValue(JSON.stringify(this.getCustomQueryParameterByName(b))),this.deselect(d),this.deselect(c),$("#querySelect").val(b),this.switchTab("query-switch")},initTabArray:function(){var a=this;$(".arango-tab").children().each(function(){a.tabArray.push($(this).children().first().attr("id"))})},listenKey:function(a){13===a.keyCode&&this.saveAQL(a),this.checkSaveName()},checkSaveName:function(){var a=$("#new-query-name").val();if("Insert Query"===a)return void $("#new-query-name").val("");var b=this.customQueries.some(function(b){return b.name===a});b?($("#modalButton1").removeClass("button-success"),$("#modalButton1").addClass("button-warning"),$("#modalButton1").text("Update")):($("#modalButton1").removeClass("button-warning"),$("#modalButton1").addClass("button-success"),$("#modalButton1").text("Save"))},clearOutput:function(){var a=ace.edit("queryOutput");a.setValue("")},clearInput:function(){var a=ace.edit("aqlEditor"),b=ace.edit("varsEditor");this.setCachedQuery(a.getValue(),b.getValue()),a.setValue(""),b.setValue("")},smallOutput:function(){var a=ace.edit("queryOutput");a.getSession().foldAll()},bigOutput:function(){var a=ace.edit("queryOutput");a.getSession().unfold()},aqlShortcuts:function(a){a.ctrlKey&&13===a.keyCode?this.submitQuery():a.metaKey&&!a.ctrlKey&&13===a.keyCode&&this.submitQuery()},queries:[],customQueries:[],tableDescription:{id:"arangoQueryTable",titles:["Name","Content",""],rows:[]},template:templateEngine.createTemplate("queryView.ejs"),table:templateEngine.createTemplate("arangoTable.ejs"),render:function(){var a=this;this.$el.html(this.template.render({})),this.$(this.id).html(this.table.render({content:this.tableDescription}));var b=1e3,c=$("#querySize");c.empty(),[100,250,500,1e3,2500,5e3,1e4,"all"].forEach(function(a){c.append('")});var d=ace.edit("queryOutput");d.setReadOnly(!0),d.setHighlightActiveLine(!1),d.getSession().setMode("ace/mode/json"),d.setFontSize("13px"),d.setValue("");var e=ace.edit("aqlEditor");e.getSession().setMode("ace/mode/aql"),e.setFontSize("13px"),e.commands.addCommand({name:"togglecomment",bindKey:{win:"Ctrl-Shift-C",linux:"Ctrl-Shift-C",mac:"Command-Shift-C"},exec:function(a){a.toggleCommentLines()},multiSelectAction:"forEach"});var f=ace.edit("varsEditor");f.getSession().setMode("ace/mode/aql"),f.setFontSize("13px"),f.commands.addCommand({name:"togglecomment",bindKey:{win:"Ctrl-Shift-C",linux:"Ctrl-Shift-C",mac:"Command-Shift-C"},exec:function(a){a.toggleCommentLines()},multiSelectAction:"forEach"});var g=this.getCachedQuery();null!==g&&void 0!==g&&""!==g&&(e.setValue(g.query),""===g.parameter||void 0===g?f.setValue("{}"):f.setValue(g.parameter));var h=function(){var b=e.getSession(),c=e.getCursorPosition(),d=b.getTokenAt(c.row,c.column);d&&("comment"===d.type?$("#commentText i").removeClass("fa-comment").addClass("fa-comment-o").attr("data-original-title","Uncomment"):$("#commentText i").removeClass("fa-comment-o").addClass("fa-comment").attr("data-original-title","Comment"));var g=e.getValue(),h=f.getValue();1===g.length&&(g=""),1===h.length&&(h=""),a.setCachedQuery(g,h)};e.getSession().selection.on("changeCursor",function(){h()}),f.getSession().selection.on("changeCursor",function(){h()}),$("#queryOutput").resizable({handles:"s",ghost:!0,stop:function(){setTimeout(function(){var a=ace.edit("queryOutput");a.resize()},200)}}),arangoHelper.fixTooltips(".vars-editor-header i, .queryTooltips, .icon_arangodb","top"),$("#aqlEditor .ace_text-input").focus();var i=$(window).height()-295;return $("#aqlEditor").height(i-100-29),$("#varsEditor").height(100),$("#queryOutput").height(i),e.resize(),d.resize(),this.initTabArray(),this.renderSelectboxes(),this.deselect(f),this.deselect(d),this.deselect(e),$("#queryDiv").show(),$("#customsDiv").show(),this.initQueryImport(),this.switchTab("query-switch"),this},getCachedQuery:function(){if("undefined"!==Storage){var a=localStorage.getItem("cachedQuery");if(void 0!==a){var b=JSON.parse(a);return b}}},setCachedQuery:function(a,b){if("undefined"!==Storage){var c={query:a,parameter:b};localStorage.setItem("cachedQuery",JSON.stringify(c))}},initQueryImport:function(){var a=this;a.allowUpload=!1,$("#importQueries").change(function(b){a.files=b.target.files||b.dataTransfer.files,a.file=a.files[0],a.allowUpload=!0,$("#confirmQueryImport").removeClass("disabled")})},importCustomQueries:function(){var a=this;if(this.allowUpload===!0){var b=function(){this.collection.fetch({
+async:!1}),this.updateLocalQueries(),this.renderSelectboxes(),this.updateTable(),a.allowUpload=!1,$("#customs-switch").click()};a.collection.saveImportQueries(a.file,b.bind(this)),$("#confirmQueryImport").addClass("disabled"),$("#queryImportDialog").modal("hide")}},downloadQueryResult:function(){var a=ace.edit("aqlEditor"),b=a.getValue();""!==b||void 0!==b||null!==b?window.open("query/result/download/"+encodeURIComponent(btoa(JSON.stringify({query:b})))):arangoHelper.arangoError("Query error","could not query result.")},exportCustomQueries:function(){var a,b={},c=[];_.each(this.customQueries,function(a){c.push({name:a.name,value:a.value,parameter:a.parameter})}),b={extra:{queries:c}},$.ajax("whoAmI?_="+Date.now(),{async:!1}).done(function(b){a=b.user,(null===a||a===!1)&&(a="root")}),window.open("query/download/"+encodeURIComponent(a))},deselect:function(a){var b=a.getSelection(),c=b.lead.row,d=b.lead.column;b.setSelectionRange({start:{row:c,column:d},end:{row:c,column:d}}),a.focus()},addAQL:function(){this.refreshAQL(!0),this.createCustomQueryModal(),$("#new-query-name").val($("#querySelect").val()),setTimeout(function(){$("#new-query-name").focus()},500),this.checkSaveName()},getAQL:function(){var a,b=this;this.collection.fetch({async:!1});var c=localStorage.getItem("customQueries");if(c){var d=JSON.parse(c);_.each(d,function(a){b.collection.add({value:a.value,name:a.name})}),a=b.collection.saveCollectionQueries(),a===!0&&localStorage.removeItem("customQueries")}this.updateLocalQueries()},deleteAQL:function(a){var b=$(a.target).parent().parent().parent().children().first().text(),c=this.collection.findWhere({name:b});this.collection.remove(c),this.collection.saveCollectionQueries(),this.updateLocalQueries(),this.renderSelectboxes(),this.updateTable()},updateLocalQueries:function(){var a=this;this.customQueries=[],this.collection.each(function(b){a.customQueries.push({name:b.get("name"),value:b.get("value"),parameter:b.get("parameter")})})},saveAQL:function(a){a.stopPropagation(),this.refreshAQL();var b=ace.edit("aqlEditor"),c=ace.edit("varsEditor"),d=$("#new-query-name").val(),e=c.getValue();if(!$("#new-query-name").hasClass("invalid-input")&&""!==d.trim()){var f=b.getValue(),g=!1;if($.each(this.customQueries,function(a,b){return b.name===d?(b.value=f,void(g=!0)):void 0}),g===!0)this.collection.findWhere({name:d}).set("value",f);else{if((""===e||void 0===e)&&(e="{}"),"string"==typeof e)try{e=JSON.parse(e)}catch(h){console.log("could not parse bind parameter")}this.collection.add({name:d,parameter:e,value:f})}this.collection.saveCollectionQueries(),window.modalView.hide(),this.updateLocalQueries(),this.renderSelectboxes(),$("#querySelect").val(d)}},getSystemQueries:function(){var a=this;$.ajax({type:"GET",cache:!1,url:"js/arango/aqltemplates.json",contentType:"application/json",processData:!1,async:!1,success:function(b){a.queries=b},error:function(){arangoHelper.arangoNotification("Query","Error while loading system templates")}})},getCustomQueryValueByName:function(a){return this.collection.findWhere({name:a}).get("value")},getCustomQueryParameterByName:function(a){return this.collection.findWhere({name:a}).get("parameter")},refreshAQL:function(a){if(this.getAQL(),this.getSystemQueries(),this.updateLocalQueries(),a){var b=$("#querySelect").val();this.renderSelectboxes(),$("#querySelect").val(b)}},importSelected:function(a){var b=ace.edit("aqlEditor"),c=ace.edit("varsEditor");$.each(this.queries,function(d,e){$("#"+a.currentTarget.id).val()===e.name&&(b.setValue(e.value),e.hasOwnProperty("parameter")?((""===e.parameter||void 0===e.parameter)&&(e.parameter="{}"),"object"==typeof e.parameter?c.setValue(JSON.stringify(e.parameter)):c.setValue(e.parameter)):c.setValue("{}"))}),$.each(this.customQueries,function(d,e){$("#"+a.currentTarget.id).val()===e.name&&(b.setValue(e.value),e.hasOwnProperty("parameter")?((""===e.parameter||void 0===e.parameter)&&(e.parameter="{}"),c.setValue(e.parameter)):c.setValue("{}"))}),this.deselect(ace.edit("varsEditor")),this.deselect(ace.edit("aqlEditor"))},renderSelectboxes:function(){this.sortQueries();var a="";a="#querySelect",$(a).empty(),$(a).append(''),$(a).append('"),this.customQueries.length>0&&($(a).append('"))},undoText:function(){var a=ace.edit("aqlEditor");a.undo()},redoText:function(){var a=ace.edit("aqlEditor");a.redo()},commentText:function(){var a=ace.edit("aqlEditor");a.toggleCommentLines()},sortQueries:function(){this.queries=_.sortBy(this.queries,"name"),this.customQueries=_.sortBy(this.customQueries,"name")},readQueryData:function(){var a=ace.edit("aqlEditor"),b=ace.edit("varsEditor"),c=a.session.getTextRange(a.getSelectionRange()),d=$("#querySize"),e={query:c||a.getValue(),id:"currentFrontendQuery"};"all"!==d.val()&&(e.batchSize=parseInt(d.val(),10));var f=b.getValue();if(f.length>0)try{var g=JSON.parse(f);0!==Object.keys(g).length&&(e.bindVars=g)}catch(h){return arangoHelper.arangoError("Query error","Could not parse bind parameters."),!1}return JSON.stringify(e)},heatmapColors:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"],heatmap:function(a){return this.heatmapColors[Math.floor(10*a)]},followQueryPath:function(a,b){var c={},d=0;c[b[0].id]=a;var e,f,g,h;for(e=1;e0&&(b+="Warnings:\r\n\r\n",a.extra.warnings.forEach(function(a){b+="["+a.code+"], '"+a.message+"'\r\n"})),""!==b&&(b+="\r\nResult:\r\n\r\n"),d.setValue(b+JSON.stringify(a.result,void 0,2))},g=function(a){f(a),c.switchTab("result-switch"),window.progressView.hide();var e="Execution time: "+c.timer.getTimeAndReset()/1e3+" s";$(".queryExecutionTime").text(e),c.deselect(d),$("#downloadQueryResult").show(),"function"==typeof b&&b()},h=function(){$.ajax({type:"PUT",url:"/_api/job/"+encodeURIComponent(a),contentType:"application/json",processData:!1,success:function(a,b,d){201===d.status?g(a):204===d.status&&(c.checkQueryTimer=window.setTimeout(function(){h()},500))},error:function(a){try{var b=JSON.parse(a.responseText);b.errorMessage&&arangoHelper.arangoError("Query",b.errorMessage)}catch(c){arangoHelper.arangoError("Query","Something went wrong.")}window.progressView.hide()}})};h()},fillResult:function(a){var b=this,c=ace.edit("queryOutput");c.setValue("");var d=this.readQueryData();d&&$.ajax({type:"POST",url:"/_api/cursor",headers:{"x-arango-async":"store"},data:d,contentType:"application/json",processData:!1,success:function(c,d,e){e.getResponseHeader("x-arango-async-id")&&b.queryCallbackFunction(e.getResponseHeader("x-arango-async-id"),a)},error:function(d){b.switchTab("result-switch"),$("#downloadQueryResult").hide();try{var e=JSON.parse(d.responseText);c.setValue("["+e.errorNum+"] "+e.errorMessage)}catch(f){c.setValue("ERROR"),arangoHelper.arangoError("Query error","ERROR")}window.progressView.hide(),"function"==typeof a&&a()}})},submitQuery:function(){var a=ace.edit("queryOutput");this.fillResult(this.switchTab.bind(this,"result-switch")),a.resize();var b=ace.edit("aqlEditor");this.deselect(b),$("#downloadQueryResult").show()},explainQuery:function(){this.fillExplain()},switchTab:function(a){var b;b="string"==typeof a?a:a.target.id;var c=this,d=function(a){var d="#"+a.replace("-switch",""),e="#tabContent"+d.charAt(1).toUpperCase()+d.substr(2);a===b?($("#"+a).parent().addClass("active"),$(d).addClass("active"),$(e).show(),"query-switch"===b?$("#aqlEditor .ace_text-input").focus():"result-switch"===b&&c.execPending&&c.fillResult()):($("#"+a).parent().removeClass("active"),$(d).removeClass("active"),$(e).hide())};this.tabArray.forEach(d),this.updateTable()}})}(),function(){"use strict";window.shellView=Backbone.View.extend({resizing:!1,el:"#content",template:templateEngine.createTemplate("shellView.ejs"),render:function(){$(this.el).html(this.template.render({})),this.replShell(),$("#shell_workspace").trigger("resize",[150]),this.resize();var a=this;return $(window).resize(function(){a.resize()}),this.executeJs("start_pretty_print(); try { db._collections(); } catch (err) { } undefined;"),this},resize:function(){if(!this.resizing){this.resizing=!0;var a=$(window).height()-250;$("#shell_workspace").height(a),this.resizing=!1}},executeJs:function(a){var b=require("internal");try{var c=window.eval(a);void 0!==c&&(b.browserOutputBuffer="",b.printShell(c),jqconsole.Write("==> "+b.browserOutputBuffer+"\n","jssuccess")),b.browserOutputBuffer=""}catch(d){d instanceof b.ArangoError?d.hasOwnProperty("errorMessage")?jqconsole.Write(d.errorMessage+"\n","jserror"):jqconsole.Write(d.message+"\n","jserror"):jqconsole.Write(d.name+": "+d.message+"\n","jserror")}},replShellPromptHelper:function(a){try{new Function(a)}catch(b){return/[\[\{\(]$/.test(a)?1:0}return!1},replShellHandlerHelper:function(a){},replShell:function(){var a=this,b=require("internal"),c=require("@arangodb/arangosh"),d="Welcome to arangosh. Copyright (c) ArangoDB GmbH\n";window.jqconsole=$("#replShell").jqconsole(d,"JSH> ","...>"),this.executeJs(b.print(c.HELP)),jqconsole.RegisterShortcut("Z",function(){jqconsole.AbortPrompt(),e()}),jqconsole.RegisterShortcut("E",function(){jqconsole.MoveToEnd(),e()}),jqconsole.RegisterMatching("{","}","brace"),jqconsole.RegisterMatching("(",")","paren"),jqconsole.RegisterMatching("[","]","bracket");var e=function(b){"help"===b&&(b=help()),"exit"===b&&location.reload(),a.executeJs(b),jqconsole.Prompt(!0,e,a.replShellPromptHelper(b))};e()}})}(),function(){"use strict";window.StatisticBarView=Backbone.View.extend({el:"#statisticBar",events:{"change #arangoCollectionSelect":"navigateBySelect","click .tab":"navigateByTab"},template:templateEngine.createTemplate("statisticBarView.ejs"),initialize:function(){this.currentDB=this.options.currentDB},replaceSVG:function(a){var b=a.attr("id"),c=a.attr("class"),d=a.attr("src");$.get(d,function(d){var e=$(d).find("svg");void 0===b&&(e=e.attr("id",b)),void 0===c&&(e=e.attr("class",c+" replaced-svg")),e=e.removeAttr("xmlns:a"),a.replaceWith(e)},"xml")},render:function(){var a=this;return $(this.el).html(this.template.render({isSystem:this.currentDB.get("isSystem")})),$("img.svg").each(function(){a.replaceSVG($(this))}),this},navigateBySelect:function(){var a=$("#arangoCollectionSelect").find("option:selected").val();window.App.navigate(a,{trigger:!0})},navigateByTab:function(a){var b=a.target||a.srcElement,c=b.id;return"links"===c?($("#link_dropdown").slideToggle(200),void a.preventDefault()):"tools"===c?($("#tools_dropdown").slideToggle(200),void a.preventDefault()):(window.App.navigate(c,{trigger:!0}),void a.preventDefault())},handleSelectNavigation:function(){$("#arangoCollectionSelect").change(function(){var a=$(this).find("option:selected").val();window.App.navigate(a,{trigger:!0})})},selectMenuItem:function(a){$(".navlist li").removeClass("active"),a&&$("."+a).addClass("active")}})}(),function(){"use strict";window.TableView=Backbone.View.extend({template:templateEngine.createTemplate("tableView.ejs"),loading:templateEngine.createTemplate("loadingTableView.ejs"),initialize:function(){this.rowClickCallback=this.options.rowClick},events:{"click tbody tr":"rowClick","click .deleteButton":"removeClick"},rowClick:function(a){this.hasOwnProperty("rowClickCallback")&&this.rowClickCallback(a)},removeClick:function(a){this.hasOwnProperty("removeClickCallback")&&(this.removeClickCallback(a),a.stopPropagation())},setRowClick:function(a){this.rowClickCallback=a},setRemoveClick:function(a){this.removeClickCallback=a},render:function(){$(this.el).html(this.template.render({docs:this.collection}))},drawLoading:function(){$(this.el).html(this.loading.render({}))}})}(),function(){"use strict";window.testView=Backbone.View.extend({el:"#content",graph:{edges:[],nodes:[]},events:{},initialize:function(){console.log(void 0)},template:templateEngine.createTemplate("testView.ejs"),render:function(){return $(this.el).html(this.template.render({})),this.renderGraph(),this},renderGraph:function(){this.convertData(),console.log(this.graph),this.s=new sigma({graph:this.graph,container:"graph-container",verbose:!0,renderers:[{container:document.getElementById("graph-container"),type:"webgl"}]})},convertData:function(){var a=this;return _.each(this.dump,function(b){_.each(b.p,function(c){a.graph.nodes.push({id:c.verticesvalue.v._id,label:b.v._key,x:Math.random(),y:Math.random(),size:Math.random()}),a.graph.edges.push({id:b.e._id,source:b.e._from,target:b.e._to})})}),null},dump:[{v:{label:"7",_id:"circles/G",_rev:"1841663870851",_key:"G"},e:{theFalse:!1,theTruth:!0,label:"right_foo",_id:"edges/1841666099075",_rev:"1841666099075",_key:"1841666099075",_from:"circles/A",_to:"circles/G"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"7",_id:"circles/G",_rev:"1841663870851",_key:"G"}],edges:[{theFalse:!1,theTruth:!0,label:"right_foo",_id:"edges/1841666099075",_rev:"1841666099075",_key:"1841666099075",_from:"circles/A",_to:"circles/G"}]}},{v:{label:"8",_id:"circles/H",_rev:"1841664067459",_key:"H"},e:{theFalse:!1,theTruth:!0,label:"right_blob",_id:"edges/1841666295683",_rev:"1841666295683",_key:"1841666295683",_from:"circles/G",_to:"circles/H"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"7",_id:"circles/G",_rev:"1841663870851",_key:"G"},{label:"8",_id:"circles/H",_rev:"1841664067459",_key:"H"}],edges:[{theFalse:!1,theTruth:!0,label:"right_foo",_id:"edges/1841666099075",_rev:"1841666099075",_key:"1841666099075",_from:"circles/A",_to:"circles/G"},{theFalse:!1,theTruth:!0,label:"right_blob",_id:"edges/1841666295683",_rev:"1841666295683",_key:"1841666295683",_from:"circles/G",_to:"circles/H"}]}},{v:{label:"9",_id:"circles/I",_rev:"1841664264067",_key:"I"},e:{theFalse:!1,theTruth:!0,label:"right_blub",_id:"edges/1841666492291",_rev:"1841666492291",_key:"1841666492291",_from:"circles/H",_to:"circles/I"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"7",_id:"circles/G",_rev:"1841663870851",_key:"G"},{label:"8",_id:"circles/H",_rev:"1841664067459",_key:"H"},{label:"9",_id:"circles/I",_rev:"1841664264067",_key:"I"}],edges:[{theFalse:!1,theTruth:!0,label:"right_foo",_id:"edges/1841666099075",_rev:"1841666099075",_key:"1841666099075",_from:"circles/A",_to:"circles/G"},{theFalse:!1,theTruth:!0,label:"right_blob",_id:"edges/1841666295683",_rev:"1841666295683",_key:"1841666295683",_from:"circles/G",_to:"circles/H"},{theFalse:!1,theTruth:!0,label:"right_blub",_id:"edges/1841666492291",_rev:"1841666492291",_key:"1841666492291",_from:"circles/H",_to:"circles/I"}]}},{v:{label:"10",_id:"circles/J",_rev:"1841664460675",_key:"J"},e:{theFalse:!1,theTruth:!0,label:"right_zip",_id:"edges/1841666688899",_rev:"1841666688899",_key:"1841666688899",_from:"circles/G",_to:"circles/J"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"7",_id:"circles/G",_rev:"1841663870851",_key:"G"},{label:"10",_id:"circles/J",_rev:"1841664460675",_key:"J"}],edges:[{theFalse:!1,theTruth:!0,label:"right_foo",_id:"edges/1841666099075",_rev:"1841666099075",_key:"1841666099075",_from:"circles/A",_to:"circles/G"},{theFalse:!1,theTruth:!0,label:"right_zip",_id:"edges/1841666688899",_rev:"1841666688899",_key:"1841666688899",_from:"circles/G",_to:"circles/J"}]}},{v:{label:"11",_id:"circles/K",_rev:"1841664657283",_key:"K"},e:{theFalse:!1,theTruth:!0,label:"right_zup",_id:"edges/1841666885507",_rev:"1841666885507",_key:"1841666885507",_from:"circles/J",_to:"circles/K"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"7",_id:"circles/G",_rev:"1841663870851",_key:"G"},{label:"10",_id:"circles/J",_rev:"1841664460675",_key:"J"},{label:"11",_id:"circles/K",_rev:"1841664657283",_key:"K"}],edges:[{theFalse:!1,theTruth:!0,label:"right_foo",_id:"edges/1841666099075",_rev:"1841666099075",_key:"1841666099075",_from:"circles/A",_to:"circles/G"},{theFalse:!1,theTruth:!0,label:"right_zip",_id:"edges/1841666688899",_rev:"1841666688899",_key:"1841666688899",_from:"circles/G",_to:"circles/J"},{theFalse:!1,theTruth:!0,label:"right_zup",_id:"edges/1841666885507",_rev:"1841666885507",_key:"1841666885507",_from:"circles/J",_to:"circles/K"}]}},{v:{label:"2",_id:"circles/B",_rev:"1841662887811",_key:"B"},e:{theFalse:!1,theTruth:!0,label:"left_bar",_id:"edges/1841665116035",_rev:"1841665116035",_key:"1841665116035",_from:"circles/A",_to:"circles/B"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"2",_id:"circles/B",_rev:"1841662887811",_key:"B"}],edges:[{theFalse:!1,theTruth:!0,label:"left_bar",_id:"edges/1841665116035",_rev:"1841665116035",_key:"1841665116035",_from:"circles/A",_to:"circles/B"}]}},{v:{label:"5",_id:"circles/E",_rev:"1841663477635",_key:"E"},e:{theFalse:!1,theTruth:!0,label:"left_blub",_id:"edges/1841665705859",_rev:"1841665705859",_key:"1841665705859",_from:"circles/B",_to:"circles/E"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"2",_id:"circles/B",_rev:"1841662887811",_key:"B"},{label:"5",_id:"circles/E",_rev:"1841663477635",_key:"E"}],edges:[{theFalse:!1,theTruth:!0,label:"left_bar",_id:"edges/1841665116035",_rev:"1841665116035",_key:"1841665116035",_from:"circles/A",_to:"circles/B"},{theFalse:!1,theTruth:!0,label:"left_blub",_id:"edges/1841665705859",_rev:"1841665705859",_key:"1841665705859",_from:"circles/B",_to:"circles/E"}]}},{v:{label:"6",_id:"circles/F",_rev:"1841663674243",_key:"F"},e:{theFalse:!1,theTruth:!0,label:"left_schubi",_id:"edges/1841665902467",_rev:"1841665902467",_key:"1841665902467",_from:"circles/E",_to:"circles/F"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"2",_id:"circles/B",_rev:"1841662887811",_key:"B"},{label:"5",_id:"circles/E",_rev:"1841663477635",_key:"E"},{label:"6",_id:"circles/F",_rev:"1841663674243",_key:"F"}],edges:[{theFalse:!1,theTruth:!0,label:"left_bar",_id:"edges/1841665116035",_rev:"1841665116035",_key:"1841665116035",_from:"circles/A",_to:"circles/B"},{theFalse:!1,theTruth:!0,label:"left_blub",_id:"edges/1841665705859",_rev:"1841665705859",_key:"1841665705859",_from:"circles/B",_to:"circles/E"},{theFalse:!1,theTruth:!0,label:"left_schubi",_id:"edges/1841665902467",_rev:"1841665902467",_key:"1841665902467",_from:"circles/E",_to:"circles/F"}]}},{v:{label:"3",_id:"circles/C",_rev:"1841663084419",_key:"C"},e:{theFalse:!1,theTruth:!0,label:"left_blarg",_id:"edges/1841665312643",_rev:"1841665312643",_key:"1841665312643",_from:"circles/B",_to:"circles/C"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"2",_id:"circles/B",_rev:"1841662887811",_key:"B"},{label:"3",_id:"circles/C",_rev:"1841663084419",_key:"C"}],edges:[{theFalse:!1,theTruth:!0,label:"left_bar",_id:"edges/1841665116035",_rev:"1841665116035",_key:"1841665116035",_from:"circles/A",_to:"circles/B"},{theFalse:!1,theTruth:!0,label:"left_blarg",_id:"edges/1841665312643",_rev:"1841665312643",_key:"1841665312643",_from:"circles/B",_to:"circles/C"}]}},{v:{label:"4",_id:"circles/D",_rev:"1841663281027",_key:"D"},e:{theFalse:!1,theTruth:!0,label:"left_blorg",_id:"edges/1841665509251",_rev:"1841665509251",_key:"1841665509251",_from:"circles/C",_to:"circles/D"},p:{vertices:[{label:"1",_id:"circles/A",_rev:"1841662691203",_key:"A"},{label:"2",_id:"circles/B",_rev:"1841662887811",_key:"B"},{label:"3",_id:"circles/C",_rev:"1841663084419",_key:"C"},{label:"4",_id:"circles/D",_rev:"1841663281027",_key:"D"}],edges:[{theFalse:!1,theTruth:!0,label:"left_bar",_id:"edges/1841665116035",_rev:"1841665116035",_key:"1841665116035",_from:"circles/A",_to:"circles/B"},{theFalse:!1,theTruth:!0,label:"left_blarg",_id:"edges/1841665312643",_rev:"1841665312643",_key:"1841665312643",_from:"circles/B",_to:"circles/C"},{theFalse:!1,theTruth:!0,label:"left_blorg",_id:"edges/1841665509251",_rev:"1841665509251",_key:"1841665509251",_from:"circles/C",_to:"circles/D"}]}}]})}(),function(){"use strict";window.UserBarView=Backbone.View.extend({events:{"change #userBarSelect":"navigateBySelect","click .tab":"navigateByTab","mouseenter .dropdown":"showDropdown","mouseleave .dropdown":"hideDropdown","click #userLogout":"userLogout"},initialize:function(){this.userCollection=this.options.userCollection,this.userCollection.fetch({async:!1}),this.userCollection.bind("change:extra",this.render.bind(this))},template:templateEngine.createTemplate("userBarView.ejs"),navigateBySelect:function(){var a=$("#arangoCollectionSelect").find("option:selected").val();window.App.navigate(a,{trigger:!0})},navigateByTab:function(a){var b=a.target||a.srcElement;b=$(b).closest("a");var c=b.attr("id");return"user"===c?($("#user_dropdown").slideToggle(200),void a.preventDefault()):(window.App.navigate(c,{trigger:!0}),void a.preventDefault())},showDropdown:function(){$("#user_dropdown").fadeIn(1)},hideDropdown:function(){$("#user_dropdown").fadeOut(1)},render:function(){var a=this.userCollection.whoAmI(),b=null,c=null,d=!1,e=null;return a&&(e=this.userCollection.findWhere({user:a}),e.set({loggedIn:!0}),c=e.get("extra").name,b=e.get("extra").img,d=e.get("active")),b=b?"https://s.gravatar.com/avatar/"+b+"?s=24":"img/default_user.png",c||(c=""),this.$el=$("#userBar"),this.$el.html(this.template.render({img:b,name:c,username:a,active:d})),this.delegateEvents(),this.$el},userLogout:function(){this.userCollection.whoAmI(),this.userCollection.logout()}})}(),function(){"use strict";window.userManagementView=Backbone.View.extend({el:"#content",el2:"#userManagementThumbnailsIn",template:templateEngine.createTemplate("userManagementView.ejs"),events:{"click #createUser":"createUser","click #submitCreateUser":"submitCreateUser","click #userManagementThumbnailsIn .tile":"editUser","click #submitEditUser":"submitEditUser","click #userManagementToggle":"toggleView","keyup #userManagementSearchInput":"search","click #userManagementSearchSubmit":"search","click #callEditUserPassword":"editUserPassword","click #submitEditUserPassword":"submitEditUserPassword","click #submitEditCurrentUserProfile":"submitEditCurrentUserProfile","click .css-label":"checkBoxes","change #userSortDesc":"sorting"},dropdownVisible:!1,initialize:function(){this.collection.fetch({async:!1}),this.currentUser=this.collection.findWhere({user:this.collection.whoAmI()})},checkBoxes:function(a){var b=a.currentTarget.id;$("#"+b).click()},sorting:function(){$("#userSortDesc").is(":checked")?this.collection.setSortingDesc(!0):this.collection.setSortingDesc(!1),$("#userManagementDropdown").is(":visible")?this.dropdownVisible=!0:this.dropdownVisible=!1,this.render()},render:function(a){var b=!1;return $("#userManagementDropdown").is(":visible")&&(b=!0),this.collection.sort(),$(this.el).html(this.template.render({collection:this.collection,searchString:""})),b===!0&&($("#userManagementDropdown2").show(),$("#userSortDesc").attr("checked",this.collection.sortOptions.desc),$("#userManagementToggle").toggleClass("activated"),$("#userManagementDropdown").show()),a&&this.editCurrentUser(),arangoHelper.setCheckboxStatus("#userManagementDropdown"),this},search:function(){var a,b,c,d;a=$("#userManagementSearchInput"),b=$("#userManagementSearchInput").val(),d=this.collection.filter(function(a){return-1!==a.get("user").indexOf(b)}),$(this.el).html(this.template.render({collection:d,searchString:b})),a=$("#userManagementSearchInput"),c=a.val().length,a.focus(),a[0].setSelectionRange(c,c)},createUser:function(a){a.preventDefault(),this.createCreateUserModal()},submitCreateUser:function(){var a=this,b=$("#newUsername").val(),c=$("#newName").val(),d=$("#newPassword").val(),e=$("#newStatus").is(":checked");if(this.validateUserInfo(c,b,d,e)){var f={user:b,passwd:d,active:e,extra:{name:c}};this.collection.create(f,{wait:!0,error:function(a,b){},success:function(b){a.updateUserManagement(),window.modalView.hide()}})}},validateUserInfo:function(a,b,c,d){return""===b?(arangoHelper.arangoError("You have to define an username"),$("#newUsername").closest("th").css("backgroundColor","red"),!1):!0},updateUserManagement:function(){var a=this;this.collection.fetch({success:function(){a.render()}})},submitDeleteUser:function(a){var b=this.collection.findWhere({user:a});b.destroy({wait:!0}),window.modalView.hide(),this.updateUserManagement()},editUser:function(a){$(a.currentTarget).hasClass("tile")&&(a.currentTarget=$(a.currentTarget).find("img")),this.collection.fetch();var b=this.evaluateUserName($(a.currentTarget).attr("id"),"_edit-user");""===b&&(b=$(a.currentTarget).attr("id"));var c=this.collection.findWhere({user:b});c.get("loggedIn")?this.editCurrentUser():this.createEditUserModal(c.get("user"),c.get("extra").name,c.get("active"))},editCurrentUser:function(){this.createEditCurrentUserModal(this.currentUser.get("user"),this.currentUser.get("extra").name,this.currentUser.get("extra").img)},submitEditUser:function(a){var b=$("#editName").val(),c=$("#editStatus").is(":checked");if(!this.validateStatus(c))return void $("#editStatus").closest("th").css("backgroundColor","red");if(!this.validateName(b))return void $("#editName").closest("th").css("backgroundColor","red");var d=this.collection.findWhere({user:a});d.save({extra:{name:b},active:c},{type:"PATCH"}),window.modalView.hide(),this.updateUserManagement()},validateUsername:function(a){return""===a?(arangoHelper.arangoError("You have to define an username"),$("#newUsername").closest("th").css("backgroundColor","red"),!1):a.match(/^[a-zA-Z][a-zA-Z0-9_\-]*$/)?!0:(arangoHelper.arangoError("Wrong Username","Username may only contain numbers, letters, _ and -"),!1)},validatePassword:function(a){return!0},validateName:function(a){return""===a?!0:a.match(/^[a-zA-Z][a-zA-Z0-9_\-\ ]*$/)?!0:(arangoHelper.arangoError("Wrong Username","Username may only contain numbers, letters, _ and -"),!1)},validateStatus:function(a){return""===a?!1:!0},toggleView:function(){$("#userSortDesc").attr("checked",this.collection.sortOptions.desc),$("#userManagementToggle").toggleClass("activated"),$("#userManagementDropdown2").slideToggle(200)},setFilterValues:function(){},evaluateUserName:function(a,b){var c=a.lastIndexOf(b);return a.substring(0,c)},editUserPassword:function(){window.modalView.hide(),this.createEditUserPasswordModal()},submitEditUserPassword:function(){var a=$("#oldCurrentPassword").val(),b=$("#newCurrentPassword").val(),c=$("#confirmCurrentPassword").val();$("#oldCurrentPassword").val(""),$("#newCurrentPassword").val(""),$("#confirmCurrentPassword").val(""),$("#oldCurrentPassword").closest("th").css("backgroundColor","white"),$("#newCurrentPassword").closest("th").css("backgroundColor","white"),$("#confirmCurrentPassword").closest("th").css("backgroundColor","white");var d=!1;this.validateCurrentPassword(a)||($("#oldCurrentPassword").closest("th").css("backgroundColor","red"),d=!0),b!==c&&($("#confirmCurrentPassword").closest("th").css("backgroundColor","red"),d=!0),this.validatePassword(b)||($("#newCurrentPassword").closest("th").css("backgroundColor","red"),d=!0),d||(this.currentUser.setPassword(b),window.modalView.hide())},validateCurrentPassword:function(a){return this.currentUser.checkPassword(a)},submitEditCurrentUserProfile:function(){var a=$("#editCurrentName").val(),b=$("#editCurrentUserProfileImg").val();b=this.parseImgString(b),this.currentUser.setExtras(a,b),this.updateUserProfile(),window.modalView.hide()},updateUserProfile:function(){var a=this;this.collection.fetch({success:function(){a.render()}})},parseImgString:function(a){return-1===a.indexOf("@")?a:CryptoJS.MD5(a).toString()},createEditUserModal:function(a,b,c){var d,e;e=[{type:window.modalView.tables.READONLY,label:"Username",value:_.escape(a)},{type:window.modalView.tables.TEXT,label:"Name",value:b,id:"editName",placeholder:"Name"},{type:window.modalView.tables.CHECKBOX,label:"Active",value:"active",checked:c,id:"editStatus"}],d=[{title:"Delete",type:window.modalView.buttons.DELETE,callback:this.submitDeleteUser.bind(this,a)},{title:"Save",type:window.modalView.buttons.SUCCESS,callback:this.submitEditUser.bind(this,a)}],window.modalView.show("modalTable.ejs","Edit User",d,e)},createCreateUserModal:function(){var a=[],b=[];b.push(window.modalView.createTextEntry("newUsername","Username","",!1,"Username",!0,[{rule:Joi.string().regex(/^[a-zA-Z0-9\-_]*$/),msg:'Only symbols, "_" and "-" are allowed.'},{rule:Joi.string().required(),msg:"No username given."}])),b.push(window.modalView.createTextEntry("newName","Name","",!1,"Name",!1)),b.push(window.modalView.createPasswordEntry("newPassword","Password","",!1,"",!1)),b.push(window.modalView.createCheckboxEntry("newStatus","Active","active",!1,!0)),a.push(window.modalView.createSuccessButton("Create",this.submitCreateUser.bind(this))),window.modalView.show("modalTable.ejs","Create New User",a,b)},createEditCurrentUserModal:function(a,b,c){var d=[],e=[];e.push(window.modalView.createReadOnlyEntry("id_username","Username",a)),e.push(window.modalView.createTextEntry("editCurrentName","Name",b,!1,"Name",!1)),e.push(window.modalView.createTextEntry("editCurrentUserProfileImg","Gravatar account (Mail)",c,"Mailaddress or its md5 representation of your gravatar account. The address will be converted into a md5 string. Only the md5 string will be stored, not the mailaddress.","myAccount(at)gravatar.com")),d.push(window.modalView.createNotificationButton("Change Password",this.editUserPassword.bind(this))),d.push(window.modalView.createSuccessButton("Save",this.submitEditCurrentUserProfile.bind(this))),window.modalView.show("modalTable.ejs","Edit User Profile",d,e)},createEditUserPasswordModal:function(){var a=[],b=[];b.push(window.modalView.createPasswordEntry("oldCurrentPassword","Old Password","",!1,"old password",!1)),
+b.push(window.modalView.createPasswordEntry("newCurrentPassword","New Password","",!1,"new password",!1)),b.push(window.modalView.createPasswordEntry("confirmCurrentPassword","Confirm New Password","",!1,"confirm new password",!1)),a.push(window.modalView.createSuccessButton("Save",this.submitEditUserPassword.bind(this))),window.modalView.show("modalTable.ejs","Edit User Password",a,b)}})}(),function(){"use strict";window.workMonitorView=Backbone.View.extend({el:"#content",id:"#workMonitorContent",template:templateEngine.createTemplate("workMonitorView.ejs"),table:templateEngine.createTemplate("arangoTable.ejs"),initialize:function(){},events:{},tableDescription:{id:"workMonitorTable",titles:["Type","Database","Task ID","Started","Url","User","Description","Method"],rows:[],unescaped:[!1,!1,!1,!1,!1,!1,!1,!1]},render:function(){var a=this;this.$el.html(this.template.render({})),this.collection.fetch({success:function(){a.parseTableData(),$(a.id).append(a.table.render({content:a.tableDescription}))}})},parseTableData:function(){var a=this;this.collection.each(function(b){if("AQL query"===b.get("type")){var c=b.get("parent");if(c)try{a.tableDescription.rows.push([b.get("type"),"(p) "+c.database,"(p) "+c.taskId,"(p) "+c.startTime,"(p) "+c.url,"(p) "+c.user,b.get("description"),"(p) "+c.method])}catch(d){console.log("some parse error")}}else"thread"!==b.get("type")&&a.tableDescription.rows.push([b.get("type"),b.get("database"),b.get("taskId"),b.get("startTime"),b.get("url"),b.get("user"),b.get("description"),b.get("method")])})}})}(),function(){"use strict";window.Router=Backbone.Router.extend({routes:{"":"dashboard",dashboard:"dashboard",collections:"collections","new":"newCollection",login:"login","collection/:colid/documents/:pageid":"documents","collection/:colid/:docid":"document",shell:"shell",query:"query",queryManagement:"queryManagement",workMonitor:"workMonitor",databases:"databases",applications:"applications","applications/:mount":"applicationDetail",graph:"graphManagement","graph/:name":"showGraph",userManagement:"userManagement",userProfile:"userProfile",logs:"logs",test:"test"},initialize:function(){window.modalView=new window.ModalView,this.foxxList=new window.FoxxCollection,window.foxxInstallView=new window.FoxxInstallView({collection:this.foxxList}),window.progressView=new window.ProgressView;var a=this;this.userCollection=new window.ArangoUsers,this.initOnce=function(){this.initOnce=function(){},this.arangoDatabase=new window.ArangoDatabase,this.currentDB=new window.CurrentDatabase,this.currentDB.fetch({async:!1}),this.arangoCollectionsStore=new window.arangoCollections,this.arangoDocumentStore=new window.arangoDocument,arangoHelper.setDocumentStore(this.arangoDocumentStore),this.arangoCollectionsStore.fetch({async:!1}),this.footerView=new window.FooterView,this.notificationList=new window.NotificationCollection,this.naviView=new window.NavigationView({database:this.arangoDatabase,currentDB:this.currentDB,notificationCollection:a.notificationList,userCollection:this.userCollection}),this.queryCollection=new window.ArangoQueries,this.footerView.render(),this.naviView.render(),window.checkVersion()}.bind(this),$(window).resize(function(){a.handleResize()})},checkUser:function(){return null===this.userCollection.whoAmI()?(this.navigate("login",{trigger:!0}),!1):(this.initOnce(),!0)},logs:function(){if(this.checkUser()){if(!this.logsView){var a=new window.ArangoLogs({upto:!0,loglevel:4}),b=new window.ArangoLogs({loglevel:4}),c=new window.ArangoLogs({loglevel:3}),d=new window.ArangoLogs({loglevel:2}),e=new window.ArangoLogs({loglevel:1});this.logsView=new window.LogsView({logall:a,logdebug:b,loginfo:c,logwarning:d,logerror:e})}this.logsView.render(),this.naviView.selectMenuItem("tools-menu")}},applicationDetail:function(a){this.checkUser()&&(this.naviView.selectMenuItem("applications-menu"),0===this.foxxList.length&&this.foxxList.fetch({async:!1}),this.hasOwnProperty("applicationDetailView")||(this.applicationDetailView=new window.ApplicationDetailView({model:this.foxxList.get(decodeURIComponent(a))})),this.applicationDetailView.model=this.foxxList.get(decodeURIComponent(a)),this.applicationDetailView.render("swagger"))},login:function(){return null!==this.userCollection.whoAmI()?(this.navigate("",{trigger:!0}),!1):(this.loginView||(this.loginView=new window.loginView({collection:this.userCollection})),void this.loginView.render())},collections:function(){if(this.checkUser()){var a=this.naviView,b=this;this.collectionsView||(this.collectionsView=new window.CollectionsView({collection:this.arangoCollectionsStore})),this.arangoCollectionsStore.fetch({success:function(){b.collectionsView.render(),a.selectMenuItem("collections-menu")}})}},documents:function(a,b){this.checkUser()&&(this.documentsView||(this.documentsView=new window.DocumentsView({collection:new window.arangoDocuments,documentStore:this.arangoDocumentStore,collectionsStore:this.arangoCollectionsStore})),this.documentsView.setCollectionId(a,b),this.documentsView.render())},document:function(a,b){if(this.checkUser()){this.documentView||(this.documentView=new window.DocumentView({collection:this.arangoDocumentStore})),this.documentView.colid=a,this.documentView.docid=b,this.documentView.render();var c=arangoHelper.collectionApiType(a);this.documentView.setType(c)}},shell:function(){this.checkUser()&&(this.shellView||(this.shellView=new window.shellView),this.shellView.render(),this.naviView.selectMenuItem("tools-menu"))},query:function(){this.checkUser()&&(this.queryView||(this.queryView=new window.queryView({collection:this.queryCollection})),this.queryView.render(),this.naviView.selectMenuItem("query-menu"))},test:function(){this.checkUser()&&(this.testView||(this.testView=new window.testView({})),this.testView.render())},workMonitor:function(){this.checkUser()&&(this.workMonitorCollection||(this.workMonitorCollection=new window.WorkMonitorCollection),this.workMonitorView||(this.workMonitorView=new window.workMonitorView({collection:this.workMonitorCollection})),this.workMonitorView.render(),this.naviView.selectMenuItem("tools-menu"))},queryManagement:function(){this.checkUser()&&(this.queryManagementView||(this.queryManagementView=new window.queryManagementView({collection:void 0})),this.queryManagementView.render(),this.naviView.selectMenuItem("tools-menu"))},databases:function(){this.checkUser()&&(arangoHelper.databaseAllowed()===!0?(this.databaseView||(this.databaseView=new window.databaseView({users:this.userCollection,collection:this.arangoDatabase})),this.databaseView.render(),this.naviView.selectMenuItem("databases-menu")):(this.navigate("#",{trigger:!0}),this.naviView.selectMenuItem("dashboard-menu"),$("#databaseNavi").css("display","none"),$("#databaseNaviSelect").css("display","none")))},dashboard:function(){this.checkUser()&&(this.naviView.selectMenuItem("dashboard-menu"),void 0===this.dashboardView&&(this.dashboardView=new window.DashboardView({dygraphConfig:window.dygraphConfig,database:this.arangoDatabase})),this.dashboardView.render())},graphManagement:function(){this.checkUser()&&(this.graphManagementView||(this.graphManagementView=new window.GraphManagementView({collection:new window.GraphCollection,collectionCollection:this.arangoCollectionsStore})),this.graphManagementView.render(),this.naviView.selectMenuItem("graphviewer-menu"))},showGraph:function(a){this.checkUser()&&(this.graphManagementView||(this.graphManagementView=new window.GraphManagementView({collection:new window.GraphCollection,collectionCollection:this.arangoCollectionsStore})),this.graphManagementView.render(),this.graphManagementView.loadGraphViewer(a),this.naviView.selectMenuItem("graphviewer-menu"))},applications:function(){this.checkUser()&&(void 0===this.applicationsView&&(this.applicationsView=new window.ApplicationsView({collection:this.foxxList})),this.applicationsView.reload(),this.naviView.selectMenuItem("applications-menu"))},handleSelectDatabase:function(){this.checkUser()&&this.naviView.handleSelectDatabase()},handleResize:function(){this.dashboardView&&this.dashboardView.resize(),this.graphManagementView&&this.graphManagementView.handleResize($("#content").width()),this.queryView&&this.queryView.resize()},userManagement:function(){this.checkUser()&&(this.userManagementView||(this.userManagementView=new window.userManagementView({collection:this.userCollection})),this.userManagementView.render(),this.naviView.selectMenuItem("tools-menu"))},userProfile:function(){this.checkUser()&&(this.userManagementView||(this.userManagementView=new window.userManagementView({collection:this.userCollection})),this.userManagementView.render(!0),this.naviView.selectMenuItem("tools-menu"))}})}(),function(){"use strict";var a=function(){$.ajax({type:"POST",url:"/_admin/aardvark/disableVersionCheck"})},b=function(a){$.ajax({type:"GET",url:"/_admin/aardvark/shouldCheckVersion",success:function(b){b===!0&&a()}})},c=function(b,c){var d=[];d.push(window.modalView.createNotificationButton("Don't ask again",function(){a(),window.modalView.hide()})),d.push(window.modalView.createSuccessButton("Download Page",function(){window.open("https://www.arangodb.com/download","_blank"),window.modalView.hide()}));var e=[],f=window.modalView.createReadOnlyEntry.bind(window.modalView);e.push(f("current","Current",b.toString())),c.major&&e.push(f("major","Major",c.major.version)),c.minor&&e.push(f("minor","Minor",c.minor.version)),c.bugfix&&e.push(f("bugfix","Bugfix",c.bugfix.version)),window.modalView.show("modalTable.ejs","New Version Available",d,e)};window.checkVersion=function(){$.ajax({type:"GET",cache:!1,url:"/_api/version",contentType:"application/json",processData:!1,async:!0,success:function(a){var d=window.versionHelper.fromString(a.version);window.parseVersions=function(e){_.isEmpty(e)||/-devel$/.test(a.version)||b(c.bind(window,d,e))},$.ajax({type:"GET",async:!0,crossDomain:!0,timeout:3e3,dataType:"jsonp",url:"https://www.arangodb.com/repositories/versions.php?jsonp=parseVersions&version="+encodeURIComponent(d.toString())})}})}}(),function(){"use strict";window.hasOwnProperty("TEST_BUILD")||$(document).ready(function(){window.App=new window.Router,Backbone.history.start(),window.App.handleResize()})}();
\ No newline at end of file
diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js.gz b/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js.gz
index 3b55fea4c7..980086dad8 100644
Binary files a/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js.gz and b/js/apps/system/_admin/aardvark/APP/frontend/build/app.min.js.gz differ
diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.js b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.js
index 97f91a5bd0..486ac5cf9a 100644
--- a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.js
+++ b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes5.js
@@ -369,7 +369,7 @@ global.start_color_print = function start_color_print(color){require('internal')
global.stop_color_print = function stop_color_print(){require('internal').stopColorPrint();};if(global.EXPORTS_SLOW_BUFFER){Object.keys(global.EXPORTS_SLOW_BUFFER).forEach(function(key){exports[key] = global.EXPORTS_SLOW_BUFFER[key];});delete global.EXPORTS_SLOW_BUFFER;}if(global.APP_PATH){exports.appPath = global.APP_PATH;delete global.APP_PATH;}return exports;})()); /*jshint maxlen: 240 */ /*global require */ ////////////////////////////////////////////////////////////////////////////////
/// @brief auto-generated file generated from errors.dat
////////////////////////////////////////////////////////////////////////////////
-(function(){"use strict";var internal=require("internal");internal.errors = {"ERROR_NO_ERROR":{"code":0,"message":"no error"},"ERROR_FAILED":{"code":1,"message":"failed"},"ERROR_SYS_ERROR":{"code":2,"message":"system error"},"ERROR_OUT_OF_MEMORY":{"code":3,"message":"out of memory"},"ERROR_INTERNAL":{"code":4,"message":"internal error"},"ERROR_ILLEGAL_NUMBER":{"code":5,"message":"illegal number"},"ERROR_NUMERIC_OVERFLOW":{"code":6,"message":"numeric overflow"},"ERROR_ILLEGAL_OPTION":{"code":7,"message":"illegal option"},"ERROR_DEAD_PID":{"code":8,"message":"dead process identifier"},"ERROR_NOT_IMPLEMENTED":{"code":9,"message":"not implemented"},"ERROR_BAD_PARAMETER":{"code":10,"message":"bad parameter"},"ERROR_FORBIDDEN":{"code":11,"message":"forbidden"},"ERROR_OUT_OF_MEMORY_MMAP":{"code":12,"message":"out of memory in mmap"},"ERROR_CORRUPTED_CSV":{"code":13,"message":"csv is corrupt"},"ERROR_FILE_NOT_FOUND":{"code":14,"message":"file not found"},"ERROR_CANNOT_WRITE_FILE":{"code":15,"message":"cannot write file"},"ERROR_CANNOT_OVERWRITE_FILE":{"code":16,"message":"cannot overwrite file"},"ERROR_TYPE_ERROR":{"code":17,"message":"type error"},"ERROR_LOCK_TIMEOUT":{"code":18,"message":"lock timeout"},"ERROR_CANNOT_CREATE_DIRECTORY":{"code":19,"message":"cannot create directory"},"ERROR_CANNOT_CREATE_TEMP_FILE":{"code":20,"message":"cannot create temporary file"},"ERROR_REQUEST_CANCELED":{"code":21,"message":"canceled request"},"ERROR_DEBUG":{"code":22,"message":"intentional debug error"},"ERROR_AID_NOT_FOUND":{"code":23,"message":"internal error with attribute ID in shaper"},"ERROR_LEGEND_INCOMPLETE":{"code":24,"message":"internal error if a legend could not be created"},"ERROR_IP_ADDRESS_INVALID":{"code":25,"message":"IP address is invalid"},"ERROR_LEGEND_NOT_IN_WAL_FILE":{"code":26,"message":"internal error if a legend for a marker does not yet exist in the same WAL file"},"ERROR_FILE_EXISTS":{"code":27,"message":"file exists"},"ERROR_LOCKED":{"code":28,"message":"locked"},"ERROR_DEADLOCK":{"code":29,"message":"deadlock detected"},"ERROR_HTTP_BAD_PARAMETER":{"code":400,"message":"bad parameter"},"ERROR_HTTP_UNAUTHORIZED":{"code":401,"message":"unauthorized"},"ERROR_HTTP_FORBIDDEN":{"code":403,"message":"forbidden"},"ERROR_HTTP_NOT_FOUND":{"code":404,"message":"not found"},"ERROR_HTTP_METHOD_NOT_ALLOWED":{"code":405,"message":"method not supported"},"ERROR_HTTP_PRECONDITION_FAILED":{"code":412,"message":"precondition failed"},"ERROR_HTTP_SERVER_ERROR":{"code":500,"message":"internal server error"},"ERROR_HTTP_CORRUPTED_JSON":{"code":600,"message":"invalid JSON object"},"ERROR_HTTP_SUPERFLUOUS_SUFFICES":{"code":601,"message":"superfluous URL suffices"},"ERROR_ARANGO_ILLEGAL_STATE":{"code":1000,"message":"illegal state"},"ERROR_ARANGO_SHAPER_FAILED":{"code":1001,"message":"could not shape document"},"ERROR_ARANGO_DATAFILE_SEALED":{"code":1002,"message":"datafile sealed"},"ERROR_ARANGO_UNKNOWN_COLLECTION_TYPE":{"code":1003,"message":"unknown type"},"ERROR_ARANGO_READ_ONLY":{"code":1004,"message":"read only"},"ERROR_ARANGO_DUPLICATE_IDENTIFIER":{"code":1005,"message":"duplicate identifier"},"ERROR_ARANGO_DATAFILE_UNREADABLE":{"code":1006,"message":"datafile unreadable"},"ERROR_ARANGO_DATAFILE_EMPTY":{"code":1007,"message":"datafile empty"},"ERROR_ARANGO_RECOVERY":{"code":1008,"message":"logfile recovery error"},"ERROR_ARANGO_CORRUPTED_DATAFILE":{"code":1100,"message":"corrupted datafile"},"ERROR_ARANGO_ILLEGAL_PARAMETER_FILE":{"code":1101,"message":"illegal or unreadable parameter file"},"ERROR_ARANGO_CORRUPTED_COLLECTION":{"code":1102,"message":"corrupted collection"},"ERROR_ARANGO_MMAP_FAILED":{"code":1103,"message":"mmap failed"},"ERROR_ARANGO_FILESYSTEM_FULL":{"code":1104,"message":"filesystem full"},"ERROR_ARANGO_NO_JOURNAL":{"code":1105,"message":"no journal"},"ERROR_ARANGO_DATAFILE_ALREADY_EXISTS":{"code":1106,"message":"cannot create/rename datafile because it already exists"},"ERROR_ARANGO_DATADIR_LOCKED":{"code":1107,"message":"database directory is locked"},"ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS":{"code":1108,"message":"cannot create/rename collection because directory already exists"},"ERROR_ARANGO_MSYNC_FAILED":{"code":1109,"message":"msync failed"},"ERROR_ARANGO_DATADIR_UNLOCKABLE":{"code":1110,"message":"cannot lock database directory"},"ERROR_ARANGO_SYNC_TIMEOUT":{"code":1111,"message":"sync timeout"},"ERROR_ARANGO_CONFLICT":{"code":1200,"message":"conflict"},"ERROR_ARANGO_DATADIR_INVALID":{"code":1201,"message":"invalid database directory"},"ERROR_ARANGO_DOCUMENT_NOT_FOUND":{"code":1202,"message":"document not found"},"ERROR_ARANGO_COLLECTION_NOT_FOUND":{"code":1203,"message":"collection not found"},"ERROR_ARANGO_COLLECTION_PARAMETER_MISSING":{"code":1204,"message":"parameter 'collection' not found"},"ERROR_ARANGO_DOCUMENT_HANDLE_BAD":{"code":1205,"message":"illegal document handle"},"ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL":{"code":1206,"message":"maximal size of journal too small"},"ERROR_ARANGO_DUPLICATE_NAME":{"code":1207,"message":"duplicate name"},"ERROR_ARANGO_ILLEGAL_NAME":{"code":1208,"message":"illegal name"},"ERROR_ARANGO_NO_INDEX":{"code":1209,"message":"no suitable index known"},"ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED":{"code":1210,"message":"unique constraint violated"},"ERROR_ARANGO_INDEX_NOT_FOUND":{"code":1212,"message":"index not found"},"ERROR_ARANGO_CROSS_COLLECTION_REQUEST":{"code":1213,"message":"cross collection request not allowed"},"ERROR_ARANGO_INDEX_HANDLE_BAD":{"code":1214,"message":"illegal index handle"},"ERROR_ARANGO_CAP_CONSTRAINT_ALREADY_DEFINED":{"code":1215,"message":"cap constraint already defined"},"ERROR_ARANGO_DOCUMENT_TOO_LARGE":{"code":1216,"message":"document too large"},"ERROR_ARANGO_COLLECTION_NOT_UNLOADED":{"code":1217,"message":"collection must be unloaded"},"ERROR_ARANGO_COLLECTION_TYPE_INVALID":{"code":1218,"message":"collection type invalid"},"ERROR_ARANGO_VALIDATION_FAILED":{"code":1219,"message":"validator failed"},"ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED":{"code":1220,"message":"parsing attribute name definition failed"},"ERROR_ARANGO_DOCUMENT_KEY_BAD":{"code":1221,"message":"illegal document key"},"ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED":{"code":1222,"message":"unexpected document key"},"ERROR_ARANGO_DATADIR_NOT_WRITABLE":{"code":1224,"message":"server database directory not writable"},"ERROR_ARANGO_OUT_OF_KEYS":{"code":1225,"message":"out of keys"},"ERROR_ARANGO_DOCUMENT_KEY_MISSING":{"code":1226,"message":"missing document key"},"ERROR_ARANGO_DOCUMENT_TYPE_INVALID":{"code":1227,"message":"invalid document type"},"ERROR_ARANGO_DATABASE_NOT_FOUND":{"code":1228,"message":"database not found"},"ERROR_ARANGO_DATABASE_NAME_INVALID":{"code":1229,"message":"database name invalid"},"ERROR_ARANGO_USE_SYSTEM_DATABASE":{"code":1230,"message":"operation only allowed in system database"},"ERROR_ARANGO_ENDPOINT_NOT_FOUND":{"code":1231,"message":"endpoint not found"},"ERROR_ARANGO_INVALID_KEY_GENERATOR":{"code":1232,"message":"invalid key generator"},"ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE":{"code":1233,"message":"edge attribute missing"},"ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING":{"code":1234,"message":"index insertion warning - attribute missing in document"},"ERROR_ARANGO_INDEX_CREATION_FAILED":{"code":1235,"message":"index creation failed"},"ERROR_ARANGO_WRITE_THROTTLE_TIMEOUT":{"code":1236,"message":"write-throttling timeout"},"ERROR_ARANGO_COLLECTION_TYPE_MISMATCH":{"code":1237,"message":"collection type mismatch"},"ERROR_ARANGO_COLLECTION_NOT_LOADED":{"code":1238,"message":"collection not loaded"},"ERROR_ARANGO_DATAFILE_FULL":{"code":1300,"message":"datafile full"},"ERROR_ARANGO_EMPTY_DATADIR":{"code":1301,"message":"server database directory is empty"},"ERROR_REPLICATION_NO_RESPONSE":{"code":1400,"message":"no response"},"ERROR_REPLICATION_INVALID_RESPONSE":{"code":1401,"message":"invalid response"},"ERROR_REPLICATION_MASTER_ERROR":{"code":1402,"message":"master error"},"ERROR_REPLICATION_MASTER_INCOMPATIBLE":{"code":1403,"message":"master incompatible"},"ERROR_REPLICATION_MASTER_CHANGE":{"code":1404,"message":"master change"},"ERROR_REPLICATION_LOOP":{"code":1405,"message":"loop detected"},"ERROR_REPLICATION_UNEXPECTED_MARKER":{"code":1406,"message":"unexpected marker"},"ERROR_REPLICATION_INVALID_APPLIER_STATE":{"code":1407,"message":"invalid applier state"},"ERROR_REPLICATION_UNEXPECTED_TRANSACTION":{"code":1408,"message":"invalid transaction"},"ERROR_REPLICATION_INVALID_APPLIER_CONFIGURATION":{"code":1410,"message":"invalid replication applier configuration"},"ERROR_REPLICATION_RUNNING":{"code":1411,"message":"cannot perform operation while applier is running"},"ERROR_REPLICATION_APPLIER_STOPPED":{"code":1412,"message":"replication stopped"},"ERROR_REPLICATION_NO_START_TICK":{"code":1413,"message":"no start tick"},"ERROR_REPLICATION_START_TICK_NOT_PRESENT":{"code":1414,"message":"start tick not present"},"ERROR_CLUSTER_NO_AGENCY":{"code":1450,"message":"could not connect to agency"},"ERROR_CLUSTER_NO_COORDINATOR_HEADER":{"code":1451,"message":"missing coordinator header"},"ERROR_CLUSTER_COULD_NOT_LOCK_PLAN":{"code":1452,"message":"could not lock plan in agency"},"ERROR_CLUSTER_COLLECTION_ID_EXISTS":{"code":1453,"message":"collection ID already exists"},"ERROR_CLUSTER_COULD_NOT_CREATE_COLLECTION_IN_PLAN":{"code":1454,"message":"could not create collection in plan"},"ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION":{"code":1455,"message":"could not read version in current in agency"},"ERROR_CLUSTER_COULD_NOT_CREATE_COLLECTION":{"code":1456,"message":"could not create collection"},"ERROR_CLUSTER_TIMEOUT":{"code":1457,"message":"timeout in cluster operation"},"ERROR_CLUSTER_COULD_NOT_REMOVE_COLLECTION_IN_PLAN":{"code":1458,"message":"could not remove collection from plan"},"ERROR_CLUSTER_COULD_NOT_REMOVE_COLLECTION_IN_CURRENT":{"code":1459,"message":"could not remove collection from current"},"ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE_IN_PLAN":{"code":1460,"message":"could not create database in plan"},"ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE":{"code":1461,"message":"could not create database"},"ERROR_CLUSTER_COULD_NOT_REMOVE_DATABASE_IN_PLAN":{"code":1462,"message":"could not remove database from plan"},"ERROR_CLUSTER_COULD_NOT_REMOVE_DATABASE_IN_CURRENT":{"code":1463,"message":"could not remove database from current"},"ERROR_CLUSTER_SHARD_GONE":{"code":1464,"message":"no responsible shard found"},"ERROR_CLUSTER_CONNECTION_LOST":{"code":1465,"message":"cluster internal HTTP connection broken"},"ERROR_CLUSTER_MUST_NOT_SPECIFY_KEY":{"code":1466,"message":"must not specify _key for this collection"},"ERROR_CLUSTER_GOT_CONTRADICTING_ANSWERS":{"code":1467,"message":"got contradicting answers from different shards"},"ERROR_CLUSTER_NOT_ALL_SHARDING_ATTRIBUTES_GIVEN":{"code":1468,"message":"not all sharding attributes given"},"ERROR_CLUSTER_MUST_NOT_CHANGE_SHARDING_ATTRIBUTES":{"code":1469,"message":"must not change the value of a shard key attribute"},"ERROR_CLUSTER_UNSUPPORTED":{"code":1470,"message":"unsupported operation or parameter"},"ERROR_CLUSTER_ONLY_ON_COORDINATOR":{"code":1471,"message":"this operation is only valid on a coordinator in a cluster"},"ERROR_CLUSTER_READING_PLAN_AGENCY":{"code":1472,"message":"error reading Plan in agency"},"ERROR_CLUSTER_COULD_NOT_TRUNCATE_COLLECTION":{"code":1473,"message":"could not truncate collection"},"ERROR_CLUSTER_AQL_COMMUNICATION":{"code":1474,"message":"error in cluster internal communication for AQL"},"ERROR_ARANGO_DOCUMENT_NOT_FOUND_OR_SHARDING_ATTRIBUTES_CHANGED":{"code":1475,"message":"document not found or sharding attributes changed"},"ERROR_CLUSTER_COULD_NOT_DETERMINE_ID":{"code":1476,"message":"could not determine my ID from my local info"},"ERROR_QUERY_KILLED":{"code":1500,"message":"query killed"},"ERROR_QUERY_PARSE":{"code":1501,"message":"%s"},"ERROR_QUERY_EMPTY":{"code":1502,"message":"query is empty"},"ERROR_QUERY_SCRIPT":{"code":1503,"message":"runtime error '%s'"},"ERROR_QUERY_NUMBER_OUT_OF_RANGE":{"code":1504,"message":"number out of range"},"ERROR_QUERY_VARIABLE_NAME_INVALID":{"code":1510,"message":"variable name '%s' has an invalid format"},"ERROR_QUERY_VARIABLE_REDECLARED":{"code":1511,"message":"variable '%s' is assigned multiple times"},"ERROR_QUERY_VARIABLE_NAME_UNKNOWN":{"code":1512,"message":"unknown variable '%s'"},"ERROR_QUERY_COLLECTION_LOCK_FAILED":{"code":1521,"message":"unable to read-lock collection %s"},"ERROR_QUERY_TOO_MANY_COLLECTIONS":{"code":1522,"message":"too many collections"},"ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED":{"code":1530,"message":"document attribute '%s' is assigned multiple times"},"ERROR_QUERY_FUNCTION_NAME_UNKNOWN":{"code":1540,"message":"usage of unknown function '%s()'"},"ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH":{"code":1541,"message":"invalid number of arguments for function '%s()', expected number of arguments: minimum: %d, maximum: %d"},"ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH":{"code":1542,"message":"invalid argument type in call to function '%s()'"},"ERROR_QUERY_INVALID_REGEX":{"code":1543,"message":"invalid regex value"},"ERROR_QUERY_BIND_PARAMETERS_INVALID":{"code":1550,"message":"invalid structure of bind parameters"},"ERROR_QUERY_BIND_PARAMETER_MISSING":{"code":1551,"message":"no value specified for declared bind parameter '%s'"},"ERROR_QUERY_BIND_PARAMETER_UNDECLARED":{"code":1552,"message":"bind parameter '%s' was not declared in the query"},"ERROR_QUERY_BIND_PARAMETER_TYPE":{"code":1553,"message":"bind parameter '%s' has an invalid value or type"},"ERROR_QUERY_INVALID_LOGICAL_VALUE":{"code":1560,"message":"invalid logical value"},"ERROR_QUERY_INVALID_ARITHMETIC_VALUE":{"code":1561,"message":"invalid arithmetic value"},"ERROR_QUERY_DIVISION_BY_ZERO":{"code":1562,"message":"division by zero"},"ERROR_QUERY_ARRAY_EXPECTED":{"code":1563,"message":"array expected"},"ERROR_QUERY_FAIL_CALLED":{"code":1569,"message":"FAIL(%s) called"},"ERROR_QUERY_GEO_INDEX_MISSING":{"code":1570,"message":"no suitable geo index found for geo restriction on '%s'"},"ERROR_QUERY_FULLTEXT_INDEX_MISSING":{"code":1571,"message":"no suitable fulltext index found for fulltext query on '%s'"},"ERROR_QUERY_INVALID_DATE_VALUE":{"code":1572,"message":"invalid date value"},"ERROR_QUERY_MULTI_MODIFY":{"code":1573,"message":"multi-modify query"},"ERROR_QUERY_INVALID_AGGREGATE_EXPRESSION":{"code":1574,"message":"invalid aggregate expression"},"ERROR_QUERY_COMPILE_TIME_OPTIONS":{"code":1575,"message":"query options must be readable at query compile time"},"ERROR_QUERY_EXCEPTION_OPTIONS":{"code":1576,"message":"query options expected"},"ERROR_QUERY_COLLECTION_USED_IN_EXPRESSION":{"code":1577,"message":"collection '%s' used as expression operand"},"ERROR_QUERY_DISALLOWED_DYNAMIC_CALL":{"code":1578,"message":"disallowed dynamic call to '%s'"},"ERROR_QUERY_ACCESS_AFTER_MODIFICATION":{"code":1579,"message":"access after data-modification"},"ERROR_QUERY_FUNCTION_INVALID_NAME":{"code":1580,"message":"invalid user function name"},"ERROR_QUERY_FUNCTION_INVALID_CODE":{"code":1581,"message":"invalid user function code"},"ERROR_QUERY_FUNCTION_NOT_FOUND":{"code":1582,"message":"user function '%s()' not found"},"ERROR_QUERY_FUNCTION_RUNTIME_ERROR":{"code":1583,"message":"user function runtime error: %s"},"ERROR_QUERY_BAD_JSON_PLAN":{"code":1590,"message":"bad execution plan JSON"},"ERROR_QUERY_NOT_FOUND":{"code":1591,"message":"query ID not found"},"ERROR_QUERY_IN_USE":{"code":1592,"message":"query with this ID is in use"},"ERROR_CURSOR_NOT_FOUND":{"code":1600,"message":"cursor not found"},"ERROR_CURSOR_BUSY":{"code":1601,"message":"cursor is busy"},"ERROR_TRANSACTION_INTERNAL":{"code":1650,"message":"internal transaction error"},"ERROR_TRANSACTION_NESTED":{"code":1651,"message":"nested transactions detected"},"ERROR_TRANSACTION_UNREGISTERED_COLLECTION":{"code":1652,"message":"unregistered collection used in transaction"},"ERROR_TRANSACTION_DISALLOWED_OPERATION":{"code":1653,"message":"disallowed operation inside transaction"},"ERROR_TRANSACTION_ABORTED":{"code":1654,"message":"transaction aborted"},"ERROR_USER_INVALID_NAME":{"code":1700,"message":"invalid user name"},"ERROR_USER_INVALID_PASSWORD":{"code":1701,"message":"invalid password"},"ERROR_USER_DUPLICATE":{"code":1702,"message":"duplicate user"},"ERROR_USER_NOT_FOUND":{"code":1703,"message":"user not found"},"ERROR_USER_CHANGE_PASSWORD":{"code":1704,"message":"user must change his password"},"ERROR_APPLICATION_INVALID_NAME":{"code":1750,"message":"invalid application name"},"ERROR_APPLICATION_INVALID_MOUNT":{"code":1751,"message":"invalid mount"},"ERROR_APPLICATION_DOWNLOAD_FAILED":{"code":1752,"message":"application download failed"},"ERROR_APPLICATION_UPLOAD_FAILED":{"code":1753,"message":"application upload failed"},"ERROR_KEYVALUE_INVALID_KEY":{"code":1800,"message":"invalid key declaration"},"ERROR_KEYVALUE_KEY_EXISTS":{"code":1801,"message":"key already exists"},"ERROR_KEYVALUE_KEY_NOT_FOUND":{"code":1802,"message":"key not found"},"ERROR_KEYVALUE_KEY_NOT_UNIQUE":{"code":1803,"message":"key is not unique"},"ERROR_KEYVALUE_KEY_NOT_CHANGED":{"code":1804,"message":"key value not changed"},"ERROR_KEYVALUE_KEY_NOT_REMOVED":{"code":1805,"message":"key value not removed"},"ERROR_KEYVALUE_NO_VALUE":{"code":1806,"message":"missing value"},"ERROR_TASK_INVALID_ID":{"code":1850,"message":"invalid task id"},"ERROR_TASK_DUPLICATE_ID":{"code":1851,"message":"duplicate task id"},"ERROR_TASK_NOT_FOUND":{"code":1852,"message":"task not found"},"ERROR_GRAPH_INVALID_GRAPH":{"code":1901,"message":"invalid graph"},"ERROR_GRAPH_COULD_NOT_CREATE_GRAPH":{"code":1902,"message":"could not create graph"},"ERROR_GRAPH_INVALID_VERTEX":{"code":1903,"message":"invalid vertex"},"ERROR_GRAPH_COULD_NOT_CREATE_VERTEX":{"code":1904,"message":"could not create vertex"},"ERROR_GRAPH_COULD_NOT_CHANGE_VERTEX":{"code":1905,"message":"could not change vertex"},"ERROR_GRAPH_INVALID_EDGE":{"code":1906,"message":"invalid edge"},"ERROR_GRAPH_COULD_NOT_CREATE_EDGE":{"code":1907,"message":"could not create edge"},"ERROR_GRAPH_COULD_NOT_CHANGE_EDGE":{"code":1908,"message":"could not change edge"},"ERROR_GRAPH_TOO_MANY_ITERATIONS":{"code":1909,"message":"too many iterations - try increasing the value of 'maxIterations'"},"ERROR_GRAPH_INVALID_FILTER_RESULT":{"code":1910,"message":"invalid filter result"},"ERROR_GRAPH_COLLECTION_MULTI_USE":{"code":1920,"message":"multi use of edge collection in edge def"},"ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS":{"code":1921,"message":"edge collection already used in edge def"},"ERROR_GRAPH_CREATE_MISSING_NAME":{"code":1922,"message":"missing graph name"},"ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION":{"code":1923,"message":"malformed edge definition"},"ERROR_GRAPH_NOT_FOUND":{"code":1924,"message":"graph not found"},"ERROR_GRAPH_DUPLICATE":{"code":1925,"message":"graph already exists"},"ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST":{"code":1926,"message":"vertex collection does not exist or is not part of the graph"},"ERROR_GRAPH_WRONG_COLLECTION_TYPE_VERTEX":{"code":1927,"message":"not a vertex collection"},"ERROR_GRAPH_NOT_IN_ORPHAN_COLLECTION":{"code":1928,"message":"not in orphan collection"},"ERROR_GRAPH_COLLECTION_USED_IN_EDGE_DEF":{"code":1929,"message":"collection already used in edge def"},"ERROR_GRAPH_EDGE_COLLECTION_NOT_USED":{"code":1930,"message":"edge collection not used in graph"},"ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION":{"code":1931,"message":" is not an ArangoCollection"},"ERROR_GRAPH_NO_GRAPH_COLLECTION":{"code":1932,"message":"collection _graphs does not exist"},"ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT_STRING":{"code":1933,"message":"Invalid example type. Has to be String, Array or Object"},"ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT":{"code":1934,"message":"Invalid example type. Has to be Array or Object"},"ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS":{"code":1935,"message":"Invalid number of arguments. Expected: "},"ERROR_GRAPH_INVALID_PARAMETER":{"code":1936,"message":"Invalid parameter type."},"ERROR_GRAPH_INVALID_ID":{"code":1937,"message":"Invalid id"},"ERROR_GRAPH_COLLECTION_USED_IN_ORPHANS":{"code":1938,"message":"collection used in orphans"},"ERROR_GRAPH_EDGE_COL_DOES_NOT_EXIST":{"code":1939,"message":"edge collection does not exist or is not part of the graph"},"ERROR_GRAPH_EMPTY":{"code":1940,"message":"empty graph"},"ERROR_SESSION_UNKNOWN":{"code":1950,"message":"unknown session"},"ERROR_SESSION_EXPIRED":{"code":1951,"message":"session expired"},"SIMPLE_CLIENT_UNKNOWN_ERROR":{"code":2000,"message":"unknown client error"},"SIMPLE_CLIENT_COULD_NOT_CONNECT":{"code":2001,"message":"could not connect to server"},"SIMPLE_CLIENT_COULD_NOT_WRITE":{"code":2002,"message":"could not write to server"},"SIMPLE_CLIENT_COULD_NOT_READ":{"code":2003,"message":"could not read from server"},"ERROR_MALFORMED_MANIFEST_FILE":{"code":3000,"message":"malformed manifest file"},"ERROR_INVALID_APPLICATION_MANIFEST":{"code":3001,"message":"manifest file is invalid"},"ERROR_MANIFEST_FILE_ATTRIBUTE_MISSING":{"code":3002,"message":"missing manifest attribute"},"ERROR_CANNOT_EXTRACT_APPLICATION_ROOT":{"code":3003,"message":"unable to extract app root path"},"ERROR_INVALID_FOXX_OPTIONS":{"code":3004,"message":"invalid foxx options"},"ERROR_FAILED_TO_EXECUTE_SCRIPT":{"code":3005,"message":"failed to execute script"},"ERROR_SYNTAX_ERROR_IN_SCRIPT":{"code":3006,"message":"syntax error in script"},"ERROR_INVALID_MOUNTPOINT":{"code":3007,"message":"mountpoint is invalid"},"ERROR_NO_FOXX_FOUND":{"code":3008,"message":"No foxx found at this location"},"ERROR_APP_NOT_FOUND":{"code":3009,"message":"App not found"},"ERROR_APP_NEEDS_CONFIGURATION":{"code":3010,"message":"App not configured"},"ERROR_MODULE_NOT_FOUND":{"code":3100,"message":"cannot locate module"},"ERROR_MODULE_SYNTAX_ERROR":{"code":3101,"message":"syntax error in module"},"ERROR_MODULE_BAD_WRAPPER":{"code":3102,"message":"failed to wrap module"},"ERROR_MODULE_FAILURE":{"code":3103,"message":"failed to invoke module"},"ERROR_MODULE_UNKNOWN_FILE_TYPE":{"code":3110,"message":"unknown file type"},"ERROR_MODULE_PATH_MUST_BE_ABSOLUTE":{"code":3111,"message":"path must be absolute"},"ERROR_MODULE_CAN_NOT_ESCAPE":{"code":3112,"message":"cannot use '..' to escape top-level-directory"},"ERROR_MODULE_DRIVE_LETTER":{"code":3113,"message":"drive local path is not supported"},"ERROR_MODULE_BAD_MODULE_ORIGIN":{"code":3120,"message":"corrupted module origin"},"ERROR_MODULE_BAD_PACKAGE_ORIGIN":{"code":3121,"message":"corrupted package origin"},"ERROR_MODULE_DOCUMENT_IS_EMPTY":{"code":3125,"message":"no content"},"ERROR_MODULE_MAIN_NOT_READABLE":{"code":3130,"message":"cannot read main file"},"ERROR_MODULE_MAIN_NOT_JS":{"code":3131,"message":"main file is not of type 'js'"},"RESULT_ELEMENT_EXISTS":{"code":10000,"message":"element not inserted into structure, because it already exists"},"RESULT_ELEMENT_NOT_FOUND":{"code":10001,"message":"element not found in structure"},"ERROR_APP_ALREADY_EXISTS":{"code":20000,"message":"newest version of app already installed"},"ERROR_QUEUE_ALREADY_EXISTS":{"code":21000,"message":"named queue already exists"},"ERROR_DISPATCHER_IS_STOPPING":{"code":21001,"message":"dispatcher stopped"},"ERROR_QUEUE_UNKNOWN":{"code":21002,"message":"named queue does not exist"},"ERROR_QUEUE_FULL":{"code":21003,"message":"named queue is full"}};})(); /*jshint -W051:true */ /*global jqconsole, Symbol */ /*eslint-disable */global.DEFINE_MODULE('console',(function(){'use strict'; /*eslint-enable */ ////////////////////////////////////////////////////////////////////////////////
+(function(){"use strict";var internal=require("internal");internal.errors = {"ERROR_NO_ERROR":{"code":0,"message":"no error"},"ERROR_FAILED":{"code":1,"message":"failed"},"ERROR_SYS_ERROR":{"code":2,"message":"system error"},"ERROR_OUT_OF_MEMORY":{"code":3,"message":"out of memory"},"ERROR_INTERNAL":{"code":4,"message":"internal error"},"ERROR_ILLEGAL_NUMBER":{"code":5,"message":"illegal number"},"ERROR_NUMERIC_OVERFLOW":{"code":6,"message":"numeric overflow"},"ERROR_ILLEGAL_OPTION":{"code":7,"message":"illegal option"},"ERROR_DEAD_PID":{"code":8,"message":"dead process identifier"},"ERROR_NOT_IMPLEMENTED":{"code":9,"message":"not implemented"},"ERROR_BAD_PARAMETER":{"code":10,"message":"bad parameter"},"ERROR_FORBIDDEN":{"code":11,"message":"forbidden"},"ERROR_OUT_OF_MEMORY_MMAP":{"code":12,"message":"out of memory in mmap"},"ERROR_CORRUPTED_CSV":{"code":13,"message":"csv is corrupt"},"ERROR_FILE_NOT_FOUND":{"code":14,"message":"file not found"},"ERROR_CANNOT_WRITE_FILE":{"code":15,"message":"cannot write file"},"ERROR_CANNOT_OVERWRITE_FILE":{"code":16,"message":"cannot overwrite file"},"ERROR_TYPE_ERROR":{"code":17,"message":"type error"},"ERROR_LOCK_TIMEOUT":{"code":18,"message":"lock timeout"},"ERROR_CANNOT_CREATE_DIRECTORY":{"code":19,"message":"cannot create directory"},"ERROR_CANNOT_CREATE_TEMP_FILE":{"code":20,"message":"cannot create temporary file"},"ERROR_REQUEST_CANCELED":{"code":21,"message":"canceled request"},"ERROR_DEBUG":{"code":22,"message":"intentional debug error"},"ERROR_AID_NOT_FOUND":{"code":23,"message":"internal error with attribute ID in shaper"},"ERROR_LEGEND_INCOMPLETE":{"code":24,"message":"internal error if a legend could not be created"},"ERROR_IP_ADDRESS_INVALID":{"code":25,"message":"IP address is invalid"},"ERROR_LEGEND_NOT_IN_WAL_FILE":{"code":26,"message":"internal error if a legend for a marker does not yet exist in the same WAL file"},"ERROR_FILE_EXISTS":{"code":27,"message":"file exists"},"ERROR_LOCKED":{"code":28,"message":"locked"},"ERROR_DEADLOCK":{"code":29,"message":"deadlock detected"},"ERROR_HTTP_BAD_PARAMETER":{"code":400,"message":"bad parameter"},"ERROR_HTTP_UNAUTHORIZED":{"code":401,"message":"unauthorized"},"ERROR_HTTP_FORBIDDEN":{"code":403,"message":"forbidden"},"ERROR_HTTP_NOT_FOUND":{"code":404,"message":"not found"},"ERROR_HTTP_METHOD_NOT_ALLOWED":{"code":405,"message":"method not supported"},"ERROR_HTTP_PRECONDITION_FAILED":{"code":412,"message":"precondition failed"},"ERROR_HTTP_SERVER_ERROR":{"code":500,"message":"internal server error"},"ERROR_HTTP_CORRUPTED_JSON":{"code":600,"message":"invalid JSON object"},"ERROR_HTTP_SUPERFLUOUS_SUFFICES":{"code":601,"message":"superfluous URL suffices"},"ERROR_ARANGO_ILLEGAL_STATE":{"code":1000,"message":"illegal state"},"ERROR_ARANGO_SHAPER_FAILED":{"code":1001,"message":"could not shape document"},"ERROR_ARANGO_DATAFILE_SEALED":{"code":1002,"message":"datafile sealed"},"ERROR_ARANGO_UNKNOWN_COLLECTION_TYPE":{"code":1003,"message":"unknown type"},"ERROR_ARANGO_READ_ONLY":{"code":1004,"message":"read only"},"ERROR_ARANGO_DUPLICATE_IDENTIFIER":{"code":1005,"message":"duplicate identifier"},"ERROR_ARANGO_DATAFILE_UNREADABLE":{"code":1006,"message":"datafile unreadable"},"ERROR_ARANGO_DATAFILE_EMPTY":{"code":1007,"message":"datafile empty"},"ERROR_ARANGO_RECOVERY":{"code":1008,"message":"logfile recovery error"},"ERROR_ARANGO_CORRUPTED_DATAFILE":{"code":1100,"message":"corrupted datafile"},"ERROR_ARANGO_ILLEGAL_PARAMETER_FILE":{"code":1101,"message":"illegal or unreadable parameter file"},"ERROR_ARANGO_CORRUPTED_COLLECTION":{"code":1102,"message":"corrupted collection"},"ERROR_ARANGO_MMAP_FAILED":{"code":1103,"message":"mmap failed"},"ERROR_ARANGO_FILESYSTEM_FULL":{"code":1104,"message":"filesystem full"},"ERROR_ARANGO_NO_JOURNAL":{"code":1105,"message":"no journal"},"ERROR_ARANGO_DATAFILE_ALREADY_EXISTS":{"code":1106,"message":"cannot create/rename datafile because it already exists"},"ERROR_ARANGO_DATADIR_LOCKED":{"code":1107,"message":"database directory is locked"},"ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS":{"code":1108,"message":"cannot create/rename collection because directory already exists"},"ERROR_ARANGO_MSYNC_FAILED":{"code":1109,"message":"msync failed"},"ERROR_ARANGO_DATADIR_UNLOCKABLE":{"code":1110,"message":"cannot lock database directory"},"ERROR_ARANGO_SYNC_TIMEOUT":{"code":1111,"message":"sync timeout"},"ERROR_ARANGO_CONFLICT":{"code":1200,"message":"conflict"},"ERROR_ARANGO_DATADIR_INVALID":{"code":1201,"message":"invalid database directory"},"ERROR_ARANGO_DOCUMENT_NOT_FOUND":{"code":1202,"message":"document not found"},"ERROR_ARANGO_COLLECTION_NOT_FOUND":{"code":1203,"message":"collection not found"},"ERROR_ARANGO_COLLECTION_PARAMETER_MISSING":{"code":1204,"message":"parameter 'collection' not found"},"ERROR_ARANGO_DOCUMENT_HANDLE_BAD":{"code":1205,"message":"illegal document handle"},"ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL":{"code":1206,"message":"maximal size of journal too small"},"ERROR_ARANGO_DUPLICATE_NAME":{"code":1207,"message":"duplicate name"},"ERROR_ARANGO_ILLEGAL_NAME":{"code":1208,"message":"illegal name"},"ERROR_ARANGO_NO_INDEX":{"code":1209,"message":"no suitable index known"},"ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED":{"code":1210,"message":"unique constraint violated"},"ERROR_ARANGO_INDEX_NOT_FOUND":{"code":1212,"message":"index not found"},"ERROR_ARANGO_CROSS_COLLECTION_REQUEST":{"code":1213,"message":"cross collection request not allowed"},"ERROR_ARANGO_INDEX_HANDLE_BAD":{"code":1214,"message":"illegal index handle"},"ERROR_ARANGO_CAP_CONSTRAINT_ALREADY_DEFINED":{"code":1215,"message":"cap constraint already defined"},"ERROR_ARANGO_DOCUMENT_TOO_LARGE":{"code":1216,"message":"document too large"},"ERROR_ARANGO_COLLECTION_NOT_UNLOADED":{"code":1217,"message":"collection must be unloaded"},"ERROR_ARANGO_COLLECTION_TYPE_INVALID":{"code":1218,"message":"collection type invalid"},"ERROR_ARANGO_VALIDATION_FAILED":{"code":1219,"message":"validator failed"},"ERROR_ARANGO_ATTRIBUTE_PARSER_FAILED":{"code":1220,"message":"parsing attribute name definition failed"},"ERROR_ARANGO_DOCUMENT_KEY_BAD":{"code":1221,"message":"illegal document key"},"ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED":{"code":1222,"message":"unexpected document key"},"ERROR_ARANGO_DATADIR_NOT_WRITABLE":{"code":1224,"message":"server database directory not writable"},"ERROR_ARANGO_OUT_OF_KEYS":{"code":1225,"message":"out of keys"},"ERROR_ARANGO_DOCUMENT_KEY_MISSING":{"code":1226,"message":"missing document key"},"ERROR_ARANGO_DOCUMENT_TYPE_INVALID":{"code":1227,"message":"invalid document type"},"ERROR_ARANGO_DATABASE_NOT_FOUND":{"code":1228,"message":"database not found"},"ERROR_ARANGO_DATABASE_NAME_INVALID":{"code":1229,"message":"database name invalid"},"ERROR_ARANGO_USE_SYSTEM_DATABASE":{"code":1230,"message":"operation only allowed in system database"},"ERROR_ARANGO_ENDPOINT_NOT_FOUND":{"code":1231,"message":"endpoint not found"},"ERROR_ARANGO_INVALID_KEY_GENERATOR":{"code":1232,"message":"invalid key generator"},"ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE":{"code":1233,"message":"edge attribute missing"},"ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING":{"code":1234,"message":"index insertion warning - attribute missing in document"},"ERROR_ARANGO_INDEX_CREATION_FAILED":{"code":1235,"message":"index creation failed"},"ERROR_ARANGO_WRITE_THROTTLE_TIMEOUT":{"code":1236,"message":"write-throttling timeout"},"ERROR_ARANGO_COLLECTION_TYPE_MISMATCH":{"code":1237,"message":"collection type mismatch"},"ERROR_ARANGO_COLLECTION_NOT_LOADED":{"code":1238,"message":"collection not loaded"},"ERROR_ARANGO_DATAFILE_FULL":{"code":1300,"message":"datafile full"},"ERROR_ARANGO_EMPTY_DATADIR":{"code":1301,"message":"server database directory is empty"},"ERROR_REPLICATION_NO_RESPONSE":{"code":1400,"message":"no response"},"ERROR_REPLICATION_INVALID_RESPONSE":{"code":1401,"message":"invalid response"},"ERROR_REPLICATION_MASTER_ERROR":{"code":1402,"message":"master error"},"ERROR_REPLICATION_MASTER_INCOMPATIBLE":{"code":1403,"message":"master incompatible"},"ERROR_REPLICATION_MASTER_CHANGE":{"code":1404,"message":"master change"},"ERROR_REPLICATION_LOOP":{"code":1405,"message":"loop detected"},"ERROR_REPLICATION_UNEXPECTED_MARKER":{"code":1406,"message":"unexpected marker"},"ERROR_REPLICATION_INVALID_APPLIER_STATE":{"code":1407,"message":"invalid applier state"},"ERROR_REPLICATION_UNEXPECTED_TRANSACTION":{"code":1408,"message":"invalid transaction"},"ERROR_REPLICATION_INVALID_APPLIER_CONFIGURATION":{"code":1410,"message":"invalid replication applier configuration"},"ERROR_REPLICATION_RUNNING":{"code":1411,"message":"cannot perform operation while applier is running"},"ERROR_REPLICATION_APPLIER_STOPPED":{"code":1412,"message":"replication stopped"},"ERROR_REPLICATION_NO_START_TICK":{"code":1413,"message":"no start tick"},"ERROR_REPLICATION_START_TICK_NOT_PRESENT":{"code":1414,"message":"start tick not present"},"ERROR_CLUSTER_NO_AGENCY":{"code":1450,"message":"could not connect to agency"},"ERROR_CLUSTER_NO_COORDINATOR_HEADER":{"code":1451,"message":"missing coordinator header"},"ERROR_CLUSTER_COULD_NOT_LOCK_PLAN":{"code":1452,"message":"could not lock plan in agency"},"ERROR_CLUSTER_COLLECTION_ID_EXISTS":{"code":1453,"message":"collection ID already exists"},"ERROR_CLUSTER_COULD_NOT_CREATE_COLLECTION_IN_PLAN":{"code":1454,"message":"could not create collection in plan"},"ERROR_CLUSTER_COULD_NOT_READ_CURRENT_VERSION":{"code":1455,"message":"could not read version in current in agency"},"ERROR_CLUSTER_COULD_NOT_CREATE_COLLECTION":{"code":1456,"message":"could not create collection"},"ERROR_CLUSTER_TIMEOUT":{"code":1457,"message":"timeout in cluster operation"},"ERROR_CLUSTER_COULD_NOT_REMOVE_COLLECTION_IN_PLAN":{"code":1458,"message":"could not remove collection from plan"},"ERROR_CLUSTER_COULD_NOT_REMOVE_COLLECTION_IN_CURRENT":{"code":1459,"message":"could not remove collection from current"},"ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE_IN_PLAN":{"code":1460,"message":"could not create database in plan"},"ERROR_CLUSTER_COULD_NOT_CREATE_DATABASE":{"code":1461,"message":"could not create database"},"ERROR_CLUSTER_COULD_NOT_REMOVE_DATABASE_IN_PLAN":{"code":1462,"message":"could not remove database from plan"},"ERROR_CLUSTER_COULD_NOT_REMOVE_DATABASE_IN_CURRENT":{"code":1463,"message":"could not remove database from current"},"ERROR_CLUSTER_SHARD_GONE":{"code":1464,"message":"no responsible shard found"},"ERROR_CLUSTER_CONNECTION_LOST":{"code":1465,"message":"cluster internal HTTP connection broken"},"ERROR_CLUSTER_MUST_NOT_SPECIFY_KEY":{"code":1466,"message":"must not specify _key for this collection"},"ERROR_CLUSTER_GOT_CONTRADICTING_ANSWERS":{"code":1467,"message":"got contradicting answers from different shards"},"ERROR_CLUSTER_NOT_ALL_SHARDING_ATTRIBUTES_GIVEN":{"code":1468,"message":"not all sharding attributes given"},"ERROR_CLUSTER_MUST_NOT_CHANGE_SHARDING_ATTRIBUTES":{"code":1469,"message":"must not change the value of a shard key attribute"},"ERROR_CLUSTER_UNSUPPORTED":{"code":1470,"message":"unsupported operation or parameter"},"ERROR_CLUSTER_ONLY_ON_COORDINATOR":{"code":1471,"message":"this operation is only valid on a coordinator in a cluster"},"ERROR_CLUSTER_READING_PLAN_AGENCY":{"code":1472,"message":"error reading Plan in agency"},"ERROR_CLUSTER_COULD_NOT_TRUNCATE_COLLECTION":{"code":1473,"message":"could not truncate collection"},"ERROR_CLUSTER_AQL_COMMUNICATION":{"code":1474,"message":"error in cluster internal communication for AQL"},"ERROR_ARANGO_DOCUMENT_NOT_FOUND_OR_SHARDING_ATTRIBUTES_CHANGED":{"code":1475,"message":"document not found or sharding attributes changed"},"ERROR_CLUSTER_COULD_NOT_DETERMINE_ID":{"code":1476,"message":"could not determine my ID from my local info"},"ERROR_CLUSTER_ONLY_ON_DBSERVER":{"code":1477,"message":"this operation is only valid on a DBserver in a cluster"},"ERROR_QUERY_KILLED":{"code":1500,"message":"query killed"},"ERROR_QUERY_PARSE":{"code":1501,"message":"%s"},"ERROR_QUERY_EMPTY":{"code":1502,"message":"query is empty"},"ERROR_QUERY_SCRIPT":{"code":1503,"message":"runtime error '%s'"},"ERROR_QUERY_NUMBER_OUT_OF_RANGE":{"code":1504,"message":"number out of range"},"ERROR_QUERY_VARIABLE_NAME_INVALID":{"code":1510,"message":"variable name '%s' has an invalid format"},"ERROR_QUERY_VARIABLE_REDECLARED":{"code":1511,"message":"variable '%s' is assigned multiple times"},"ERROR_QUERY_VARIABLE_NAME_UNKNOWN":{"code":1512,"message":"unknown variable '%s'"},"ERROR_QUERY_COLLECTION_LOCK_FAILED":{"code":1521,"message":"unable to read-lock collection %s"},"ERROR_QUERY_TOO_MANY_COLLECTIONS":{"code":1522,"message":"too many collections"},"ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED":{"code":1530,"message":"document attribute '%s' is assigned multiple times"},"ERROR_QUERY_FUNCTION_NAME_UNKNOWN":{"code":1540,"message":"usage of unknown function '%s()'"},"ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH":{"code":1541,"message":"invalid number of arguments for function '%s()', expected number of arguments: minimum: %d, maximum: %d"},"ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH":{"code":1542,"message":"invalid argument type in call to function '%s()'"},"ERROR_QUERY_INVALID_REGEX":{"code":1543,"message":"invalid regex value"},"ERROR_QUERY_BIND_PARAMETERS_INVALID":{"code":1550,"message":"invalid structure of bind parameters"},"ERROR_QUERY_BIND_PARAMETER_MISSING":{"code":1551,"message":"no value specified for declared bind parameter '%s'"},"ERROR_QUERY_BIND_PARAMETER_UNDECLARED":{"code":1552,"message":"bind parameter '%s' was not declared in the query"},"ERROR_QUERY_BIND_PARAMETER_TYPE":{"code":1553,"message":"bind parameter '%s' has an invalid value or type"},"ERROR_QUERY_INVALID_LOGICAL_VALUE":{"code":1560,"message":"invalid logical value"},"ERROR_QUERY_INVALID_ARITHMETIC_VALUE":{"code":1561,"message":"invalid arithmetic value"},"ERROR_QUERY_DIVISION_BY_ZERO":{"code":1562,"message":"division by zero"},"ERROR_QUERY_ARRAY_EXPECTED":{"code":1563,"message":"array expected"},"ERROR_QUERY_FAIL_CALLED":{"code":1569,"message":"FAIL(%s) called"},"ERROR_QUERY_GEO_INDEX_MISSING":{"code":1570,"message":"no suitable geo index found for geo restriction on '%s'"},"ERROR_QUERY_FULLTEXT_INDEX_MISSING":{"code":1571,"message":"no suitable fulltext index found for fulltext query on '%s'"},"ERROR_QUERY_INVALID_DATE_VALUE":{"code":1572,"message":"invalid date value"},"ERROR_QUERY_MULTI_MODIFY":{"code":1573,"message":"multi-modify query"},"ERROR_QUERY_INVALID_AGGREGATE_EXPRESSION":{"code":1574,"message":"invalid aggregate expression"},"ERROR_QUERY_COMPILE_TIME_OPTIONS":{"code":1575,"message":"query options must be readable at query compile time"},"ERROR_QUERY_EXCEPTION_OPTIONS":{"code":1576,"message":"query options expected"},"ERROR_QUERY_COLLECTION_USED_IN_EXPRESSION":{"code":1577,"message":"collection '%s' used as expression operand"},"ERROR_QUERY_DISALLOWED_DYNAMIC_CALL":{"code":1578,"message":"disallowed dynamic call to '%s'"},"ERROR_QUERY_ACCESS_AFTER_MODIFICATION":{"code":1579,"message":"access after data-modification"},"ERROR_QUERY_FUNCTION_INVALID_NAME":{"code":1580,"message":"invalid user function name"},"ERROR_QUERY_FUNCTION_INVALID_CODE":{"code":1581,"message":"invalid user function code"},"ERROR_QUERY_FUNCTION_NOT_FOUND":{"code":1582,"message":"user function '%s()' not found"},"ERROR_QUERY_FUNCTION_RUNTIME_ERROR":{"code":1583,"message":"user function runtime error: %s"},"ERROR_QUERY_BAD_JSON_PLAN":{"code":1590,"message":"bad execution plan JSON"},"ERROR_QUERY_NOT_FOUND":{"code":1591,"message":"query ID not found"},"ERROR_QUERY_IN_USE":{"code":1592,"message":"query with this ID is in use"},"ERROR_CURSOR_NOT_FOUND":{"code":1600,"message":"cursor not found"},"ERROR_CURSOR_BUSY":{"code":1601,"message":"cursor is busy"},"ERROR_TRANSACTION_INTERNAL":{"code":1650,"message":"internal transaction error"},"ERROR_TRANSACTION_NESTED":{"code":1651,"message":"nested transactions detected"},"ERROR_TRANSACTION_UNREGISTERED_COLLECTION":{"code":1652,"message":"unregistered collection used in transaction"},"ERROR_TRANSACTION_DISALLOWED_OPERATION":{"code":1653,"message":"disallowed operation inside transaction"},"ERROR_TRANSACTION_ABORTED":{"code":1654,"message":"transaction aborted"},"ERROR_USER_INVALID_NAME":{"code":1700,"message":"invalid user name"},"ERROR_USER_INVALID_PASSWORD":{"code":1701,"message":"invalid password"},"ERROR_USER_DUPLICATE":{"code":1702,"message":"duplicate user"},"ERROR_USER_NOT_FOUND":{"code":1703,"message":"user not found"},"ERROR_USER_CHANGE_PASSWORD":{"code":1704,"message":"user must change his password"},"ERROR_APPLICATION_INVALID_NAME":{"code":1750,"message":"invalid application name"},"ERROR_APPLICATION_INVALID_MOUNT":{"code":1751,"message":"invalid mount"},"ERROR_APPLICATION_DOWNLOAD_FAILED":{"code":1752,"message":"application download failed"},"ERROR_APPLICATION_UPLOAD_FAILED":{"code":1753,"message":"application upload failed"},"ERROR_KEYVALUE_INVALID_KEY":{"code":1800,"message":"invalid key declaration"},"ERROR_KEYVALUE_KEY_EXISTS":{"code":1801,"message":"key already exists"},"ERROR_KEYVALUE_KEY_NOT_FOUND":{"code":1802,"message":"key not found"},"ERROR_KEYVALUE_KEY_NOT_UNIQUE":{"code":1803,"message":"key is not unique"},"ERROR_KEYVALUE_KEY_NOT_CHANGED":{"code":1804,"message":"key value not changed"},"ERROR_KEYVALUE_KEY_NOT_REMOVED":{"code":1805,"message":"key value not removed"},"ERROR_KEYVALUE_NO_VALUE":{"code":1806,"message":"missing value"},"ERROR_TASK_INVALID_ID":{"code":1850,"message":"invalid task id"},"ERROR_TASK_DUPLICATE_ID":{"code":1851,"message":"duplicate task id"},"ERROR_TASK_NOT_FOUND":{"code":1852,"message":"task not found"},"ERROR_GRAPH_INVALID_GRAPH":{"code":1901,"message":"invalid graph"},"ERROR_GRAPH_COULD_NOT_CREATE_GRAPH":{"code":1902,"message":"could not create graph"},"ERROR_GRAPH_INVALID_VERTEX":{"code":1903,"message":"invalid vertex"},"ERROR_GRAPH_COULD_NOT_CREATE_VERTEX":{"code":1904,"message":"could not create vertex"},"ERROR_GRAPH_COULD_NOT_CHANGE_VERTEX":{"code":1905,"message":"could not change vertex"},"ERROR_GRAPH_INVALID_EDGE":{"code":1906,"message":"invalid edge"},"ERROR_GRAPH_COULD_NOT_CREATE_EDGE":{"code":1907,"message":"could not create edge"},"ERROR_GRAPH_COULD_NOT_CHANGE_EDGE":{"code":1908,"message":"could not change edge"},"ERROR_GRAPH_TOO_MANY_ITERATIONS":{"code":1909,"message":"too many iterations - try increasing the value of 'maxIterations'"},"ERROR_GRAPH_INVALID_FILTER_RESULT":{"code":1910,"message":"invalid filter result"},"ERROR_GRAPH_COLLECTION_MULTI_USE":{"code":1920,"message":"multi use of edge collection in edge def"},"ERROR_GRAPH_COLLECTION_USE_IN_MULTI_GRAPHS":{"code":1921,"message":"edge collection already used in edge def"},"ERROR_GRAPH_CREATE_MISSING_NAME":{"code":1922,"message":"missing graph name"},"ERROR_GRAPH_CREATE_MALFORMED_EDGE_DEFINITION":{"code":1923,"message":"malformed edge definition"},"ERROR_GRAPH_NOT_FOUND":{"code":1924,"message":"graph not found"},"ERROR_GRAPH_DUPLICATE":{"code":1925,"message":"graph already exists"},"ERROR_GRAPH_VERTEX_COL_DOES_NOT_EXIST":{"code":1926,"message":"vertex collection does not exist or is not part of the graph"},"ERROR_GRAPH_WRONG_COLLECTION_TYPE_VERTEX":{"code":1927,"message":"not a vertex collection"},"ERROR_GRAPH_NOT_IN_ORPHAN_COLLECTION":{"code":1928,"message":"not in orphan collection"},"ERROR_GRAPH_COLLECTION_USED_IN_EDGE_DEF":{"code":1929,"message":"collection already used in edge def"},"ERROR_GRAPH_EDGE_COLLECTION_NOT_USED":{"code":1930,"message":"edge collection not used in graph"},"ERROR_GRAPH_NOT_AN_ARANGO_COLLECTION":{"code":1931,"message":" is not an ArangoCollection"},"ERROR_GRAPH_NO_GRAPH_COLLECTION":{"code":1932,"message":"collection _graphs does not exist"},"ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT_STRING":{"code":1933,"message":"Invalid example type. Has to be String, Array or Object"},"ERROR_GRAPH_INVALID_EXAMPLE_ARRAY_OBJECT":{"code":1934,"message":"Invalid example type. Has to be Array or Object"},"ERROR_GRAPH_INVALID_NUMBER_OF_ARGUMENTS":{"code":1935,"message":"Invalid number of arguments. Expected: "},"ERROR_GRAPH_INVALID_PARAMETER":{"code":1936,"message":"Invalid parameter type."},"ERROR_GRAPH_INVALID_ID":{"code":1937,"message":"Invalid id"},"ERROR_GRAPH_COLLECTION_USED_IN_ORPHANS":{"code":1938,"message":"collection used in orphans"},"ERROR_GRAPH_EDGE_COL_DOES_NOT_EXIST":{"code":1939,"message":"edge collection does not exist or is not part of the graph"},"ERROR_GRAPH_EMPTY":{"code":1940,"message":"empty graph"},"ERROR_SESSION_UNKNOWN":{"code":1950,"message":"unknown session"},"ERROR_SESSION_EXPIRED":{"code":1951,"message":"session expired"},"SIMPLE_CLIENT_UNKNOWN_ERROR":{"code":2000,"message":"unknown client error"},"SIMPLE_CLIENT_COULD_NOT_CONNECT":{"code":2001,"message":"could not connect to server"},"SIMPLE_CLIENT_COULD_NOT_WRITE":{"code":2002,"message":"could not write to server"},"SIMPLE_CLIENT_COULD_NOT_READ":{"code":2003,"message":"could not read from server"},"ERROR_MALFORMED_MANIFEST_FILE":{"code":3000,"message":"malformed manifest file"},"ERROR_INVALID_APPLICATION_MANIFEST":{"code":3001,"message":"manifest file is invalid"},"ERROR_MANIFEST_FILE_ATTRIBUTE_MISSING":{"code":3002,"message":"missing manifest attribute"},"ERROR_CANNOT_EXTRACT_APPLICATION_ROOT":{"code":3003,"message":"unable to extract app root path"},"ERROR_INVALID_FOXX_OPTIONS":{"code":3004,"message":"invalid foxx options"},"ERROR_FAILED_TO_EXECUTE_SCRIPT":{"code":3005,"message":"failed to execute script"},"ERROR_SYNTAX_ERROR_IN_SCRIPT":{"code":3006,"message":"syntax error in script"},"ERROR_INVALID_MOUNTPOINT":{"code":3007,"message":"mountpoint is invalid"},"ERROR_NO_FOXX_FOUND":{"code":3008,"message":"No foxx found at this location"},"ERROR_APP_NOT_FOUND":{"code":3009,"message":"App not found"},"ERROR_APP_NEEDS_CONFIGURATION":{"code":3010,"message":"App not configured"},"ERROR_MODULE_NOT_FOUND":{"code":3100,"message":"cannot locate module"},"ERROR_MODULE_SYNTAX_ERROR":{"code":3101,"message":"syntax error in module"},"ERROR_MODULE_BAD_WRAPPER":{"code":3102,"message":"failed to wrap module"},"ERROR_MODULE_FAILURE":{"code":3103,"message":"failed to invoke module"},"ERROR_MODULE_UNKNOWN_FILE_TYPE":{"code":3110,"message":"unknown file type"},"ERROR_MODULE_PATH_MUST_BE_ABSOLUTE":{"code":3111,"message":"path must be absolute"},"ERROR_MODULE_CAN_NOT_ESCAPE":{"code":3112,"message":"cannot use '..' to escape top-level-directory"},"ERROR_MODULE_DRIVE_LETTER":{"code":3113,"message":"drive local path is not supported"},"ERROR_MODULE_BAD_MODULE_ORIGIN":{"code":3120,"message":"corrupted module origin"},"ERROR_MODULE_BAD_PACKAGE_ORIGIN":{"code":3121,"message":"corrupted package origin"},"ERROR_MODULE_DOCUMENT_IS_EMPTY":{"code":3125,"message":"no content"},"ERROR_MODULE_MAIN_NOT_READABLE":{"code":3130,"message":"cannot read main file"},"ERROR_MODULE_MAIN_NOT_JS":{"code":3131,"message":"main file is not of type 'js'"},"RESULT_ELEMENT_EXISTS":{"code":10000,"message":"element not inserted into structure, because it already exists"},"RESULT_ELEMENT_NOT_FOUND":{"code":10001,"message":"element not found in structure"},"ERROR_APP_ALREADY_EXISTS":{"code":20000,"message":"newest version of app already installed"},"ERROR_QUEUE_ALREADY_EXISTS":{"code":21000,"message":"named queue already exists"},"ERROR_DISPATCHER_IS_STOPPING":{"code":21001,"message":"dispatcher stopped"},"ERROR_QUEUE_UNKNOWN":{"code":21002,"message":"named queue does not exist"},"ERROR_QUEUE_FULL":{"code":21003,"message":"named queue is full"}};})(); /*jshint -W051:true */ /*global jqconsole, Symbol */ /*eslint-disable */global.DEFINE_MODULE('console',(function(){'use strict'; /*eslint-enable */ ////////////////////////////////////////////////////////////////////////////////
/// @brief module "console"
///
/// @file
@@ -927,7 +927,7 @@ if(requestResult !== null && requestResult.error === true && requestResult.error
arangosh.checkRequestResult(requestResult);var name=requestResult.name;if(name !== undefined){this._registerCollection(name,new this._collectionConstructor(this,requestResult));return this[name];}return null;}; ////////////////////////////////////////////////////////////////////////////////
/// @brief creates a new collection
////////////////////////////////////////////////////////////////////////////////
-ArangoDatabase.prototype._create = function(name,properties,type){var body={"name":name,"type":ArangoCollection.TYPE_DOCUMENT};if(properties !== undefined){["waitForSync","journalSize","isSystem","isVolatile","doCompact","keyOptions","shardKeys","numberOfShards","distributeShardsLike","indexBuckets","id"].forEach(function(p){if(properties.hasOwnProperty(p)){body[p] = properties[p];}});}if(type !== undefined){body.type = type;}var requestResult=this._connection.POST(this._collectionurl(),JSON.stringify(body));arangosh.checkRequestResult(requestResult);var nname=requestResult.name;if(nname !== undefined){this._registerCollection(nname,new this._collectionConstructor(this,requestResult));return this[nname];}return undefined;}; ////////////////////////////////////////////////////////////////////////////////
+ArangoDatabase.prototype._create = function(name,properties,type){var body={"name":name,"type":ArangoCollection.TYPE_DOCUMENT};if(properties !== undefined){["waitForSync","journalSize","isSystem","isVolatile","doCompact","keyOptions","shardKeys","numberOfShards","distributeShardsLike","indexBuckets","id","replicationFactor","replicationQuorum"].forEach(function(p){if(properties.hasOwnProperty(p)){body[p] = properties[p];}});}if(type !== undefined){body.type = type;}var requestResult=this._connection.POST(this._collectionurl(),JSON.stringify(body));arangosh.checkRequestResult(requestResult);var nname=requestResult.name;if(nname !== undefined){this._registerCollection(nname,new this._collectionConstructor(this,requestResult));return this[nname];}return undefined;}; ////////////////////////////////////////////////////////////////////////////////
/// @brief creates a new document collection
////////////////////////////////////////////////////////////////////////////////
ArangoDatabase.prototype._createDocumentCollection = function(name,properties){return this._create(name,properties,ArangoCollection.TYPE_DOCUMENT);}; ////////////////////////////////////////////////////////////////////////////////
@@ -1494,19 +1494,20 @@ SimpleQueryFulltext.prototype.execute = function(batchSize){if(this._execution =
var index=0;var next="Type 'tutorial' again to get to the next chapter.";var lessons=[{title:"Welcome to the tutorial!",text:"This is a user-interactive tutorial on ArangoDB and the ArangoDB shell.\n" + "It will give you a first look into ArangoDB and how it works."},{title:"JavaScript Shell",text:"On this shell's prompt, you can issue arbitrary JavaScript commands.\n" + "So you are able to do things like...:\n\n" + " number = 123;\n" + " number = number * 10;"},{title:"Running Complex Instructions",text:"You can also run more complex instructions, such as for loops:\n\n" + " for (i = 0; i < 10; i++) { number = number + 1; }"},{title:"Printing Results",text:"As you can see, the result of the last command executed is printed automatically. " + "To explicitly print a value at any other time, there is the print function:\n\n" + " for (i = 0; i < 5; ++i) { print(\"I am a JavaScript shell\"); }"},{title:"Creating Collections",text:"ArangoDB is a document database. This means that we store data as documents " + "(which are similar to JavaScript objects) in so-called 'collections'. " + "Let's create a collection named 'places' now:\n\n" + " db._create('places');\n\n" + "Note: each collection is identified by a unique name. Trying to create a " + "collection that already exists will produce an error."},{title:"Displaying Collections",text:"Now you can take a look at the collection(s) you just created:\n\n" + " db._collections();\n\n" + "Please note that all collections will be returned, including ArangoDB's pre-defined " + "system collections."},{title:"Creating Documents",text:"Now we have a collection, but it is empty. So let's create some documents!\n\n" + " db.places.save({ _key : \"foo\", city : \"foo-city\" });\n" + " for (i = 0; i <= 10; i++) { db.places.save({ _key: \"example\" + i, zipcode: i }) };"},{title:"Displaying All Documents",text:"You want to take a look at your docs? No problem:\n\n" + " db.places.toArray();"},{title:"Counting Documents",text:"To see how many documents there are in a collection, use the 'count' method:\n\n" + " db.places.count();"},{title:"Retrieving Single Documents",text:"As you can see, each document has some meta attributes '_id', '_key' and '_rev'.\n" + "The '_key' attribute can be used to quickly retrieve a single document from " + "a collection:\n\n" + " db.places.document(\"foo\");\n" + " db.places.document(\"example5\");"},{title:"Retrieving Single Documents",text:"The '_id' attribute can also be used to retrieve documents using the 'db' object:\n\n" + " db._document(\"places/foo\");\n" + " db._document(\"places/example5\");"},{title:"Modifying Documents",text:"You can modify existing documents. Try to add a new attribute to a document and " + "verify whether it has been added:\n\n" + " db._update(\"places/foo\", { zipcode: 39535 });\n" + " db._document(\"places/foo\");"},{title:"Document Revisions",text:"Note that after updating the document, its '_rev' attribute changed automatically.\n" + "The '_rev' attribute contains a document revision number, and it can be used for " + "conditional modifications. Here's an example of how to avoid lost updates in case " + "multiple clients are accessing the documents in parallel:\n\n" + " doc = db._document(\"places/example1\");\n" + " db._update(\"places/example1\", { someValue: 23 });\n" + " db._update(doc, { someValue: 42 });\n\n" + "Note that the first update will succeed because it was unconditional. The second " + "update however is conditional because we're also passing the document's revision " + "id in the first parameter to _update. As the revision id we're passing to update " + "does not match the document's current revision anymore, the update is rejected."},{title:"Removing Documents",text:"Deleting single documents can be achieved by providing the document _id or _key:\n\n" + " db._remove(\"places/example7\");\n" + " db.places.remove(\"example8\");\n" + " db.places.count();"},{title:"Searching Documents",text:"Searching for documents with specific attributes can be done by using the " + "byExample method:\n\n" + " db._create(\"users\");\n" + " for (i = 0; i < 10; ++i) { " + "db.users.save({ name: \"username\" + i, active: (i % 3 == 0), age: 30 + i }); }\n" + " db.users.byExample({ active: false }).toArray();\n" + " db.users.byExample({ name: \"username3\", active: true }).toArray();\n"},{title:"Running AQL Queries",text:"ArangoDB also provides a query language for more complex matching:\n\n" + " db._query(\"FOR u IN users FILTER u.active == true && u.age >= 33 " + "RETURN { username: u.name, age: u.age }\").toArray();"},{title:"Using Databases",text:"By default, the ArangoShell connects to the default database. The default database " + "is named '_system'. To create another database, use the '_createDatabase' method of the " + "'db' object. To switch into an existing database, use '_useDatabase'. To get rid of a " + "database and all of its collections, use '_dropDatabase':\n\n" + " db._createDatabase(\"mydb\");\n" + " db._useDatabase(\"mydb\");\n" + " db._dropDatabase(\"mydb\");"}]; ////////////////////////////////////////////////////////////////////////////////
/// @brief print tutorial contents
////////////////////////////////////////////////////////////////////////////////
-exports._PRINT = function(context){var colors=require("internal").COLORS; /*jslint regexp: true */function process(text){return text.replace(/\n {2}(.+?)(?=\n)/g,"\n " + colors.COLOR_MAGENTA + "$1" + colors.COLOR_RESET);} /*jslint regexp: false */var headline=colors.COLOR_BOLD_BLUE + (index + 1) + ". " + lessons[index].title + colors.COLOR_RESET;context.output += "\n\n" + headline + "\n\n" + process(lessons[index].text + "\n") + "\n";++index;if(index >= lessons.length){context.output += "Congratulations! You finished the tutorial.\n";index = 0;}else {context.output += next + "\n";}};});module.define("@arangodb/aql/explainer",function(exports,module){ /*jshint strict: false, maxlen: 300 */var db=require("@arangodb").db,internal=require("internal"),systemColors=internal.COLORS,print=internal.print,colors={};if(typeof internal.printBrowser === "function"){print = internal.printBrowser;}var stringBuilder={output:"",appendLine:function appendLine(line){if(!line){this.output += "\n";}else {this.output += line + "\n";}},getOutput:function getOutput(){return this.output;},clearOutput:function clearOutput(){this.output = "";}}; /* set colors for output */function setColors(useSystemColors){'use strict';["COLOR_RESET","COLOR_CYAN","COLOR_BLUE","COLOR_GREEN","COLOR_MAGENTA","COLOR_YELLOW","COLOR_RED","COLOR_WHITE","COLOR_BOLD_CYAN","COLOR_BOLD_BLUE","COLOR_BOLD_GREEN","COLOR_BOLD_MAGENTA","COLOR_BOLD_YELLOW","COLOR_BOLD_RED","COLOR_BOLD_WHITE"].forEach(function(c){colors[c] = useSystemColors?systemColors[c]:"";});} /* colorizer and output helper functions */function attributeUncolored(v){'use strict';return "`" + v + "`";}function keyword(v){'use strict';return colors.COLOR_CYAN + v + colors.COLOR_RESET;}function annotation(v){'use strict';return colors.COLOR_BLUE + v + colors.COLOR_RESET;}function value(v){'use strict';if(typeof v === 'string' && v.length > 1024){return colors.COLOR_GREEN + v.substr(0,1024) + "..." + colors.COLOR_RESET;}return colors.COLOR_GREEN + v + colors.COLOR_RESET;}function variable(v){'use strict';if(v[0] === "#"){return colors.COLOR_MAGENTA + v + colors.COLOR_RESET;}return colors.COLOR_YELLOW + v + colors.COLOR_RESET;}function func(v){'use strict';return colors.COLOR_GREEN + v + colors.COLOR_RESET;}function collection(v){'use strict';return colors.COLOR_RED + v + colors.COLOR_RESET;}function attribute(v){'use strict';return "`" + colors.COLOR_YELLOW + v + colors.COLOR_RESET + "`";}function header(v){'use strict';return colors.COLOR_MAGENTA + v + colors.COLOR_RESET;}function section(v){'use strict';return colors.COLOR_BOLD_BLUE + v + colors.COLOR_RESET;}function pad(n){'use strict';if(n < 0){ // value seems invalid...
+exports._PRINT = function(context){var colors=require("internal").COLORS; /*jslint regexp: true */function process(text){return text.replace(/\n {2}(.+?)(?=\n)/g,"\n " + colors.COLOR_MAGENTA + "$1" + colors.COLOR_RESET);} /*jslint regexp: false */var headline=colors.COLOR_BOLD_BLUE + (index + 1) + ". " + lessons[index].title + colors.COLOR_RESET;context.output += "\n\n" + headline + "\n\n" + process(lessons[index].text + "\n") + "\n";++index;if(index >= lessons.length){context.output += "Congratulations! You finished the tutorial.\n";index = 0;}else {context.output += next + "\n";}};});module.define("@arangodb/aql/explainer",function(exports,module){ /*jshint strict: false, maxlen: 300 */var db=require("@arangodb").db,internal=require("internal"),systemColors=internal.COLORS,print=internal.print,colors={};if(typeof internal.printBrowser === "function"){print = internal.printBrowser;}var stringBuilder={output:"",appendLine:function appendLine(line){if(!line){this.output += "\n";}else {this.output += line + "\n";}},getOutput:function getOutput(){return this.output;},clearOutput:function clearOutput(){this.output = "";}}; /* set colors for output */function setColors(useSystemColors){'use strict';["COLOR_RESET","COLOR_CYAN","COLOR_BLUE","COLOR_GREEN","COLOR_MAGENTA","COLOR_YELLOW","COLOR_RED","COLOR_WHITE","COLOR_BOLD_CYAN","COLOR_BOLD_BLUE","COLOR_BOLD_GREEN","COLOR_BOLD_MAGENTA","COLOR_BOLD_YELLOW","COLOR_BOLD_RED","COLOR_BOLD_WHITE"].forEach(function(c){colors[c] = useSystemColors?systemColors[c]:"";});} /* colorizer and output helper functions */function bracketize(node,v){'use strict';if(node && node.subNodes && node.subNodes.length > 1){return "(" + v + ")";}return v;}function attributeUncolored(v){'use strict';return "`" + v + "`";}function keyword(v){'use strict';return colors.COLOR_CYAN + v + colors.COLOR_RESET;}function annotation(v){'use strict';return colors.COLOR_BLUE + v + colors.COLOR_RESET;}function value(v){'use strict';if(typeof v === 'string' && v.length > 1024){return colors.COLOR_GREEN + v.substr(0,1024) + "..." + colors.COLOR_RESET;}return colors.COLOR_GREEN + v + colors.COLOR_RESET;}function variable(v){'use strict';if(v[0] === "#"){return colors.COLOR_MAGENTA + v + colors.COLOR_RESET;}return colors.COLOR_YELLOW + v + colors.COLOR_RESET;}function func(v){'use strict';return colors.COLOR_GREEN + v + colors.COLOR_RESET;}function collection(v){'use strict';return colors.COLOR_RED + v + colors.COLOR_RESET;}function attribute(v){'use strict';return "`" + colors.COLOR_YELLOW + v + colors.COLOR_RESET + "`";}function header(v){'use strict';return colors.COLOR_MAGENTA + v + colors.COLOR_RESET;}function section(v){'use strict';return colors.COLOR_BOLD_BLUE + v + colors.COLOR_RESET;}function pad(n){'use strict';if(n < 0){ // value seems invalid...
n = 0;}return new Array(n).join(" ");}function wrap(str,width){'use strict';var re=".{1," + width + "}(\\s|$)|\\S+?(\\s|$)";return str.match(new RegExp(re,"g")).join("\n");} /* print functions */ /* print query string */function printQuery(query){'use strict'; // restrict max length of printed query to avoid endless printing for
// very long query strings
var maxLength=4096;if(query.length > maxLength){stringBuilder.appendLine(section("Query string (truncated):"));query = query.substr(0,maxLength / 2) + " ... " + query.substr(query.length - maxLength / 2);}else {stringBuilder.appendLine(section("Query string:"));}stringBuilder.appendLine(" " + value(wrap(query,100).replace(/\n+/g,"\n ",query)));stringBuilder.appendLine();} /* print write query modification flags */function printModificationFlags(flags){'use strict';if(flags === undefined){return;}stringBuilder.appendLine(section("Write query options:"));var keys=Object.keys(flags),maxLen="Option".length;keys.forEach(function(k){if(k.length > maxLen){maxLen = k.length;}});stringBuilder.appendLine(" " + header("Option") + pad(1 + maxLen - "Option".length) + " " + header("Value"));keys.forEach(function(k){stringBuilder.appendLine(" " + keyword(k) + pad(1 + maxLen - k.length) + " " + value(JSON.stringify(flags[k])));});stringBuilder.appendLine();} /* print optimizer rules */function printRules(rules){'use strict';stringBuilder.appendLine(section("Optimization rules applied:"));if(rules.length === 0){stringBuilder.appendLine(" " + value("none"));}else {var maxIdLen=String("Id").length;stringBuilder.appendLine(" " + pad(1 + maxIdLen - String("Id").length) + header("Id") + " " + header("RuleName"));for(var i=0;i < rules.length;++i) {stringBuilder.appendLine(" " + pad(1 + maxIdLen - String(i + 1).length) + variable(String(i + 1)) + " " + keyword(rules[i]));}}stringBuilder.appendLine();} /* print warnings */function printWarnings(warnings){'use strict';if(!Array.isArray(warnings) || warnings.length === 0){return;}stringBuilder.appendLine(section("Warnings:"));var maxIdLen=String("Code").length;stringBuilder.appendLine(" " + pad(1 + maxIdLen - String("Code").length) + header("Code") + " " + header("Message"));for(var i=0;i < warnings.length;++i) {stringBuilder.appendLine(" " + pad(1 + maxIdLen - String(warnings[i].code).length) + variable(warnings[i].code) + " " + keyword(warnings[i].message));}stringBuilder.appendLine();} /* print indexes used */function printIndexes(indexes){'use strict';stringBuilder.appendLine(section("Indexes used:"));if(indexes.length === 0){stringBuilder.appendLine(" " + value("none"));}else {var maxIdLen=String("By").length;var maxCollectionLen=String("Collection").length;var maxUniqueLen=String("Unique").length;var maxSparseLen=String("Sparse").length;var maxTypeLen=String("Type").length;var maxSelectivityLen=String("Selectivity").length;var maxFieldsLen=String("Fields").length;indexes.forEach(function(index){var l=String(index.node).length;if(l > maxIdLen){maxIdLen = l;}l = index.type.length;if(l > maxTypeLen){maxTypeLen = l;}l = index.fields.map(attributeUncolored).join(", ").length + "[ ]".length;if(l > maxFieldsLen){maxFieldsLen = l;}l = index.collection.length;if(l > maxCollectionLen){maxCollectionLen = l;}});var line=" " + pad(1 + maxIdLen - String("By").length) + header("By") + " " + header("Type") + pad(1 + maxTypeLen - "Type".length) + " " + header("Collection") + pad(1 + maxCollectionLen - "Collection".length) + " " + header("Unique") + pad(1 + maxUniqueLen - "Unique".length) + " " + header("Sparse") + pad(1 + maxSparseLen - "Sparse".length) + " " + header("Selectivity") + " " + header("Fields") + pad(1 + maxFieldsLen - "Fields".length) + " " + header("Ranges");stringBuilder.appendLine(line);for(var i=0;i < indexes.length;++i) {var uniqueness=indexes[i].unique?"true":"false";var sparsity=indexes[i].hasOwnProperty("sparse")?indexes[i].sparse?"true":"false":"n/a";var fields="[ " + indexes[i].fields.map(attribute).join(", ") + " ]";var fieldsLen=indexes[i].fields.map(attributeUncolored).join(", ").length + "[ ]".length;var ranges;if(indexes[i].hasOwnProperty("condition")){ranges = indexes[i].condition;}else {ranges = "[ " + indexes[i].ranges + " ]";}var selectivity=indexes[i].hasOwnProperty("selectivityEstimate")?(indexes[i].selectivityEstimate * 100).toFixed(2) + " %":"n/a";line = " " + pad(1 + maxIdLen - String(indexes[i].node).length) + variable(String(indexes[i].node)) + " " + keyword(indexes[i].type) + pad(1 + maxTypeLen - indexes[i].type.length) + " " + collection(indexes[i].collection) + pad(1 + maxCollectionLen - indexes[i].collection.length) + " " + value(uniqueness) + pad(1 + maxUniqueLen - uniqueness.length) + " " + value(sparsity) + pad(1 + maxSparseLen - sparsity.length) + " " + pad(1 + maxSelectivityLen - selectivity.length) + value(selectivity) + " " + fields + pad(1 + maxFieldsLen - fieldsLen) + " " + ranges;stringBuilder.appendLine(line);}}} /* print traversal info */function printTraversalDetails(traversals){'use strict';if(traversals.length === 0){return;}stringBuilder.appendLine();stringBuilder.appendLine(section("Traversals on graphs:"));var maxIdLen=String("Id").length;var maxMinMaxDepth=String("Depth").length;var maxVertexCollectionNameStrLen=String("Vertex collections").length;var maxEdgeCollectionNameStrLen=String("Edge collections").length;var maxConditionsLen=String("Filter conditions").length;traversals.forEach(function(node){var l=String(node.id).length;if(l > maxIdLen){maxIdLen = l;}if(node.minMaxDepthLen > maxMinMaxDepth){maxMinMaxDepth = node.minMaxDepthLen;}if(node.hasOwnProperty('ConditionStr')){if(node.ConditionStr.length > maxConditionsLen){maxConditionsLen = node.ConditionStr.length;}}if(node.hasOwnProperty('vertexCollectionNameStr')){if(node.vertexCollectionNameStrLen > maxVertexCollectionNameStrLen){maxVertexCollectionNameStrLen = node.vertexCollectionNameStrLen;}}if(node.hasOwnProperty('edgeCollectionNameStr')){if(node.edgeCollectionNameStrLen > maxEdgeCollectionNameStrLen){maxEdgeCollectionNameStrLen = node.edgeCollectionNameStrLen;}}});var line=" " + pad(1 + maxIdLen - String("Id").length) + header("Id") + " " + header("Depth") + pad(1 + maxMinMaxDepth - String("Depth").length) + " " + header("Vertex collections") + pad(1 + maxVertexCollectionNameStrLen - "Vertex collections".length) + " " + header("Edge collections") + pad(1 + maxEdgeCollectionNameStrLen - "Edge collections".length) + " " + header("Filter conditions");stringBuilder.appendLine(line);for(var i=0;i < traversals.length;++i) {line = " " + pad(1 + maxIdLen - String(traversals[i].id).length) + traversals[i].id + " ";line += traversals[i].minMaxDepth + pad(1 + maxMinMaxDepth - traversals[i].minMaxDepthLen) + " ";if(traversals[i].hasOwnProperty('vertexCollectionNameStr')){line += traversals[i].vertexCollectionNameStr + pad(1 + maxVertexCollectionNameStrLen - traversals[i].vertexCollectionNameStrLen) + " ";}else {line += pad(1 + maxVertexCollectionNameStrLen) + " ";}if(traversals[i].hasOwnProperty('edgeCollectionNameStr')){line += traversals[i].edgeCollectionNameStr + pad(1 + maxEdgeCollectionNameStrLen - traversals[i].edgeCollectionNameStrLen) + " ";}else {line += pad(1 + maxEdgeCollectionNameStrLen) + " ";}if(traversals[i].hasOwnProperty('ConditionStr')){line += traversals[i].ConditionStr;}stringBuilder.appendLine(line);}} /* analzye and print execution plan */function processQuery(query,explain){'use strict';var nodes={},parents={},rootNode=null,maxTypeLen=0,maxSiteLen=0,maxIdLen=String("Id").length,maxEstimateLen=String("Est.").length,plan=explain.plan,cluster=require("@arangodb/cluster");var recursiveWalk=function recursiveWalk(n,level){n.forEach(function(node){nodes[node.id] = node;if(level === 0 && node.dependencies.length === 0){rootNode = node.id;}if(node.type === "SubqueryNode"){recursiveWalk(node.subquery.nodes,level + 1);}node.dependencies.forEach(function(d){if(!parents.hasOwnProperty(d)){parents[d] = [];}parents[d].push(node.id);});if(String(node.id).length > maxIdLen){maxIdLen = String(node.id).length;}if(String(node.type).length > maxTypeLen){maxTypeLen = String(node.type).length;}if(String(node.site).length > maxSiteLen){maxSiteLen = String(node.site).length;}if(String(node.estimatedNrItems).length > maxEstimateLen){maxEstimateLen = String(node.estimatedNrItems).length;}});var count=n.length,site="COOR";while(count > 0) {--count;var node=n[count];node.site = site;if(node.type === "RemoteNode"){site = site === "COOR"?"DBS":"COOR";}}};recursiveWalk(plan.nodes,0);var references={},collectionVariables={},usedVariables={},indexes=[],traversalDetails=[],modificationFlags,isConst=true,currentNode=null;var variableName=function variableName(node){try{if(/^[0-9_]/.test(node.name)){return variable("#" + node.name);}}catch(x) {print(node);throw x;}if(collectionVariables.hasOwnProperty(node.id)){usedVariables[node.name] = collectionVariables[node.id];}return variable(node.name);};var addHint=function addHint(){}; // uncomment this to show "style" hints
// var addHint = function (dst, currentNode, msg) {
// dst.push({ code: "Hint", message: "Node #" + currentNode + ": " + msg });
// };
-var buildExpression=function buildExpression(_x){var _again=true;_function: while(_again) {var node=_x;i = ref = out = collectionName = collectionObject = isEdgeCollection = isSystem = undefined;_again = false;isConst = isConst && ["value","object","object element","array"].indexOf(node.type) !== -1;if(node.type !== "attribute access" && node.hasOwnProperty("subNodes")){for(var i=0;i < node.subNodes.length;++i) {if(node.subNodes[i].type === "reference" && collectionVariables.hasOwnProperty(node.subNodes[i].id)){addHint(explain.warnings,currentNode,"reference to collection document variable '" + node.subNodes[i].name + "' used in potentially non-working way");break;}}}switch(node.type){case "reference":if(references.hasOwnProperty(node.name)){var ref=references[node.name];delete references[node.name];if(Array.isArray(ref)){var out=buildExpression(ref[1]) + "[" + new Array(ref[0] + 1).join('*');if(ref[2].type !== "no-op"){out += " " + keyword("FILTER") + " " + buildExpression(ref[2]);}if(ref[3].type !== "no-op"){out += " " + keyword("LIMIT ") + " " + buildExpression(ref[3]);}if(ref[4].type !== "no-op"){out += " " + keyword("RETURN ") + " " + buildExpression(ref[4]);}out += "]";return out;}return buildExpression(ref) + "[*]";}return variableName(node);case "collection":addHint(explain.warnings,currentNode,"using all documents from collection '" + node.name + "' in expression");return collection(node.name) + " " + annotation("/* all collection documents */");case "value":return value(JSON.stringify(node.value));case "object":if(node.hasOwnProperty("subNodes")){if(node.subNodes.length > 20){ // print only the first 20 values from the objects
+var buildExpression=function buildExpression(_x){var _again=true;_function: while(_again) {var node=_x;binaryOperator = i = ref = out = collectionName = collectionObject = isEdgeCollection = isSystem = undefined;_again = false;var binaryOperator=function binaryOperator(node,name){var lhs=buildExpression(node.subNodes[0]);var rhs=buildExpression(node.subNodes[1]);if(node.subNodes.length === 3){ // array operator node... prepend "all" | "any" | "none" to node type
+name = node.subNodes[2].quantifier + " " + name;}if(node.sorted){return lhs + " " + name + " " + annotation("/* sorted */") + " " + rhs;}return lhs + " " + name + " " + rhs;};isConst = isConst && ["value","object","object element","array"].indexOf(node.type) !== -1;if(node.type !== "attribute access" && node.hasOwnProperty("subNodes")){for(var i=0;i < node.subNodes.length;++i) {if(node.subNodes[i].type === "reference" && collectionVariables.hasOwnProperty(node.subNodes[i].id)){addHint(explain.warnings,currentNode,"reference to collection document variable '" + node.subNodes[i].name + "' used in potentially non-working way");break;}}}switch(node.type){case "reference":if(references.hasOwnProperty(node.name)){var ref=references[node.name];delete references[node.name];if(Array.isArray(ref)){var out=buildExpression(ref[1]) + "[" + new Array(ref[0] + 1).join('*');if(ref[2].type !== "no-op"){out += " " + keyword("FILTER") + " " + buildExpression(ref[2]);}if(ref[3].type !== "no-op"){out += " " + keyword("LIMIT ") + " " + buildExpression(ref[3]);}if(ref[4].type !== "no-op"){out += " " + keyword("RETURN ") + " " + buildExpression(ref[4]);}out += "]";return out;}return buildExpression(ref) + "[*]";}return variableName(node);case "collection":addHint(explain.warnings,currentNode,"using all documents from collection '" + node.name + "' in expression");return collection(node.name) + " " + annotation("/* all collection documents */");case "value":return value(JSON.stringify(node.value));case "object":if(node.hasOwnProperty("subNodes")){if(node.subNodes.length > 20){ // print only the first 20 values from the objects
return "{ " + node.subNodes.slice(0,20).map(buildExpression).join(", ") + ", ... }";}return "{ " + node.subNodes.map(buildExpression).join(", ") + " }";}return "{ }";case "object element":return value(JSON.stringify(node.name)) + " : " + buildExpression(node.subNodes[0]);case "calculated object element":return "[ " + buildExpression(node.subNodes[0]) + " ] : " + buildExpression(node.subNodes[1]);case "array":if(node.hasOwnProperty("subNodes")){if(node.subNodes.length > 20){ // print only the first 20 values from the array
return "[ " + node.subNodes.slice(0,20).map(buildExpression).join(", ") + ", ... ]";}return "[ " + node.subNodes.map(buildExpression).join(", ") + " ]";}return "[ ]";case "unary not":return "! " + buildExpression(node.subNodes[0]);case "unary plus":return "+ " + buildExpression(node.subNodes[0]);case "unary minus":return "- " + buildExpression(node.subNodes[0]);case "array limit":return buildExpression(node.subNodes[0]) + ", " + buildExpression(node.subNodes[1]);case "attribute access":if(node.subNodes[0].type === "reference" && collectionVariables.hasOwnProperty(node.subNodes[0].id)){ // top-level attribute access
var collectionName=collectionVariables[node.subNodes[0].id],collectionObject=db._collection(collectionName);if(collectionObject !== null){var isEdgeCollection=collectionObject.type() === 3,isSystem=node.name[0] === '_';if(isSystem && ["_key","_id","_rev"].concat(isEdgeCollection?["_from","_to"]:[]).indexOf(node.name) === -1 || !isSystem && isEdgeCollection && ["from","to"].indexOf(node.name) !== -1){addHint(explain.warnings,currentNode,"reference to potentially non-existing attribute '" + node.name + "'");}}}return buildExpression(node.subNodes[0]) + "." + attribute(node.name);case "indexed access":return buildExpression(node.subNodes[0]) + "[" + buildExpression(node.subNodes[1]) + "]";case "range":return buildExpression(node.subNodes[0]) + " .. " + buildExpression(node.subNodes[1]) + " " + annotation("/* range */");case "expand":case "expansion":if(node.subNodes.length > 2){ // [FILTER ...]
references[node.subNodes[0].subNodes[0].name] = [node.levels,node.subNodes[0].subNodes[1],node.subNodes[2],node.subNodes[3],node.subNodes[4]];}else { // [*]
-references[node.subNodes[0].subNodes[0].name] = node.subNodes[0].subNodes[1];}_x = node.subNodes[1];_again = true;continue _function;case "user function call":return func(node.name) + "(" + (node.subNodes && node.subNodes[0].subNodes || []).map(buildExpression).join(", ") + ")" + " " + annotation("/* user-defined function */");case "function call":return func(node.name) + "(" + (node.subNodes && node.subNodes[0].subNodes || []).map(buildExpression).join(", ") + ")";case "plus":return buildExpression(node.subNodes[0]) + " + " + buildExpression(node.subNodes[1]);case "minus":return buildExpression(node.subNodes[0]) + " - " + buildExpression(node.subNodes[1]);case "times":return buildExpression(node.subNodes[0]) + " * " + buildExpression(node.subNodes[1]);case "division":return buildExpression(node.subNodes[0]) + " / " + buildExpression(node.subNodes[1]);case "modulus":return buildExpression(node.subNodes[0]) + " % " + buildExpression(node.subNodes[1]);case "compare not in":if(node.sorted){return buildExpression(node.subNodes[0]) + " not in " + annotation("/* sorted */") + " " + buildExpression(node.subNodes[1]);}return buildExpression(node.subNodes[0]) + " not in " + buildExpression(node.subNodes[1]);case "compare in":if(node.sorted){return buildExpression(node.subNodes[0]) + " in " + annotation("/* sorted */") + " " + buildExpression(node.subNodes[1]);}return buildExpression(node.subNodes[0]) + " in " + buildExpression(node.subNodes[1]);case "compare ==":return buildExpression(node.subNodes[0]) + " == " + buildExpression(node.subNodes[1]);case "compare !=":return buildExpression(node.subNodes[0]) + " != " + buildExpression(node.subNodes[1]);case "compare >":return buildExpression(node.subNodes[0]) + " > " + buildExpression(node.subNodes[1]);case "compare >=":return buildExpression(node.subNodes[0]) + " >= " + buildExpression(node.subNodes[1]);case "compare <":return buildExpression(node.subNodes[0]) + " < " + buildExpression(node.subNodes[1]);case "compare <=":return buildExpression(node.subNodes[0]) + " <= " + buildExpression(node.subNodes[1]);case "logical or":return buildExpression(node.subNodes[0]) + " || " + buildExpression(node.subNodes[1]);case "logical and":return buildExpression(node.subNodes[0]) + " && " + buildExpression(node.subNodes[1]);case "ternary":return buildExpression(node.subNodes[0]) + " ? " + buildExpression(node.subNodes[1]) + " : " + buildExpression(node.subNodes[2]);case "n-ary or":if(node.hasOwnProperty("subNodes")){return node.subNodes.map(function(sub){return buildExpression(sub);}).join(" || ");}return "";case "n-ary and":if(node.hasOwnProperty("subNodes")){return node.subNodes.map(function(sub){return buildExpression(sub);}).join(" && ");}return "";default:return "unhandled node type (" + node.type + ")";}}};var buildSimpleExpression=function buildSimpleExpression(simpleExpressions){var rc="";for(var indexNo in simpleExpressions) {if(simpleExpressions.hasOwnProperty(indexNo)){if(rc.length > 0){rc += " AND ";}for(var i=0;i < simpleExpressions[indexNo].length;i++) {var item=simpleExpressions[indexNo][i];rc += attribute("Path") + ".";if(item.isEdgeAccess){rc += attribute("edges");}else {rc += attribute("vertices");}rc += "[" + value(indexNo) + "] -> ";rc += buildExpression(item.varAccess);rc += " " + item.comparisonTypeStr + " ";rc += buildExpression(item.compareTo);}}}return rc;};var buildBound=function buildBound(attr,operators,bound){var boundValue=bound.isConstant?value(JSON.stringify(bound.bound)):buildExpression(bound.bound);return attribute(attr) + " " + operators[bound.include?1:0] + " " + boundValue;};var buildRanges=function buildRanges(ranges){var results=[];ranges.forEach(function(range){var attr=range.attr;if(range.lowConst.hasOwnProperty("bound") && range.highConst.hasOwnProperty("bound") && JSON.stringify(range.lowConst.bound) === JSON.stringify(range.highConst.bound)){range.equality = true;}if(range.equality){if(range.lowConst.hasOwnProperty("bound")){results.push(buildBound(attr,["==","=="],range.lowConst));}else if(range.hasOwnProperty("lows")){range.lows.forEach(function(bound){results.push(buildBound(attr,["==","=="],bound));});}}else {if(range.lowConst.hasOwnProperty("bound")){results.push(buildBound(attr,[">",">="],range.lowConst));}if(range.highConst.hasOwnProperty("bound")){results.push(buildBound(attr,["<","<="],range.highConst));}if(range.hasOwnProperty("lows")){range.lows.forEach(function(bound){results.push(buildBound(attr,[">",">="],bound));});}if(range.hasOwnProperty("highs")){range.highs.forEach(function(bound){results.push(buildBound(attr,["<","<="],bound));});}}});if(results.length > 1){return "(" + results.join(" && ") + ")";}return results[0];};var label=function label(node){switch(node.type){case "SingletonNode":return keyword("ROOT");case "NoResultsNode":return keyword("EMPTY") + " " + annotation("/* empty result set */");case "EnumerateCollectionNode":collectionVariables[node.outVariable.id] = node.collection;return keyword("FOR") + " " + variableName(node.outVariable) + " " + keyword("IN") + " " + collection(node.collection) + " " + annotation("/* full collection scan" + (node.random?", random order":"") + " */");case "EnumerateListNode":return keyword("FOR") + " " + variableName(node.outVariable) + " " + keyword("IN") + " " + variableName(node.inVariable) + " " + annotation("/* list iteration */");case "IndexNode":collectionVariables[node.outVariable.id] = node.collection;var types=[];node.indexes.forEach(function(idx,i){var what=(idx.reverse?"reverse ":"") + idx.type + " index scan";if(types.length === 0 || what !== types[types.length - 1]){types.push(what);}idx.collection = node.collection;idx.node = node.id;if(node.condition.type && node.condition.type === 'n-ary or'){idx.condition = buildExpression(node.condition.subNodes[i]);}else {idx.condition = "*"; // empty condition. this is likely an index used for sorting only
+references[node.subNodes[0].subNodes[0].name] = node.subNodes[0].subNodes[1];}_x = node.subNodes[1];_again = true;continue _function;case "user function call":return func(node.name) + "(" + (node.subNodes && node.subNodes[0].subNodes || []).map(buildExpression).join(", ") + ")" + " " + annotation("/* user-defined function */");case "function call":return func(node.name) + "(" + (node.subNodes && node.subNodes[0].subNodes || []).map(buildExpression).join(", ") + ")";case "plus":return "(" + binaryOperator(node,"+") + ")";case "minus":return "(" + binaryOperator(node,"-") + ")";case "times":return "(" + binaryOperator(node,"*") + ")";case "division":return "(" + binaryOperator(node,"/") + ")";case "modulus":return "(" + binaryOperator(node,"%") + ")";case "compare not in":case "array compare not in":return "(" + binaryOperator(node,"not in") + ")";case "compare in":case "array compare in":return "(" + binaryOperator(node,"in") + ")";case "compare ==":case "array compare ==":return "(" + binaryOperator(node,"==") + ")";case "compare !=":case "array compare !=":return "(" + binaryOperator(node,"!=") + ")";case "compare >":case "array compare >":return "(" + binaryOperator(node,">") + ")";case "compare >=":case "array compare >=":return "(" + binaryOperator(node,">=") + ")";case "compare <":case "array compare <":return "(" + binaryOperator(node,"<") + ")";case "compare <=":case "array compare <=":return "(" + binaryOperator(node,"<=") + ")";case "logical or":return "(" + binaryOperator(node,"||") + ")";case "logical and":return "(" + binaryOperator(node,"&&") + ")";case "ternary":return "(" + buildExpression(node.subNodes[0]) + " ? " + buildExpression(node.subNodes[1]) + " : " + buildExpression(node.subNodes[2]) + ")";case "n-ary or":if(node.hasOwnProperty("subNodes")){return bracketize(node,node.subNodes.map(function(sub){return buildExpression(sub);}).join(" || "));}return "";case "n-ary and":if(node.hasOwnProperty("subNodes")){return bracketize(node,node.subNodes.map(function(sub){return buildExpression(sub);}).join(" && "));}return "";default:return "unhandled node type (" + node.type + ")";}}};var buildSimpleExpression=function buildSimpleExpression(simpleExpressions){var rc="";for(var indexNo in simpleExpressions) {if(simpleExpressions.hasOwnProperty(indexNo)){if(rc.length > 0){rc += " AND ";}for(var i=0;i < simpleExpressions[indexNo].length;i++) {var item=simpleExpressions[indexNo][i];rc += attribute("Path") + ".";if(item.isEdgeAccess){rc += attribute("edges");}else {rc += attribute("vertices");}rc += "[" + value(indexNo) + "] -> ";rc += buildExpression(item.varAccess);rc += " " + item.comparisonTypeStr + " ";rc += buildExpression(item.compareTo);}}}return rc;};var buildBound=function buildBound(attr,operators,bound){var boundValue=bound.isConstant?value(JSON.stringify(bound.bound)):buildExpression(bound.bound);return attribute(attr) + " " + operators[bound.include?1:0] + " " + boundValue;};var buildRanges=function buildRanges(ranges){var results=[];ranges.forEach(function(range){var attr=range.attr;if(range.lowConst.hasOwnProperty("bound") && range.highConst.hasOwnProperty("bound") && JSON.stringify(range.lowConst.bound) === JSON.stringify(range.highConst.bound)){range.equality = true;}if(range.equality){if(range.lowConst.hasOwnProperty("bound")){results.push(buildBound(attr,["==","=="],range.lowConst));}else if(range.hasOwnProperty("lows")){range.lows.forEach(function(bound){results.push(buildBound(attr,["==","=="],bound));});}}else {if(range.lowConst.hasOwnProperty("bound")){results.push(buildBound(attr,[">",">="],range.lowConst));}if(range.highConst.hasOwnProperty("bound")){results.push(buildBound(attr,["<","<="],range.highConst));}if(range.hasOwnProperty("lows")){range.lows.forEach(function(bound){results.push(buildBound(attr,[">",">="],bound));});}if(range.hasOwnProperty("highs")){range.highs.forEach(function(bound){results.push(buildBound(attr,["<","<="],bound));});}}});if(results.length > 1){return "(" + results.join(" && ") + ")";}return results[0];};var label=function label(node){switch(node.type){case "SingletonNode":return keyword("ROOT");case "NoResultsNode":return keyword("EMPTY") + " " + annotation("/* empty result set */");case "EnumerateCollectionNode":collectionVariables[node.outVariable.id] = node.collection;return keyword("FOR") + " " + variableName(node.outVariable) + " " + keyword("IN") + " " + collection(node.collection) + " " + annotation("/* full collection scan" + (node.random?", random order":"") + " */");case "EnumerateListNode":return keyword("FOR") + " " + variableName(node.outVariable) + " " + keyword("IN") + " " + variableName(node.inVariable) + " " + annotation("/* list iteration */");case "IndexNode":collectionVariables[node.outVariable.id] = node.collection;var types=[];node.indexes.forEach(function(idx,i){var what=(node.reverse?"reverse ":"") + idx.type + " index scan";if(types.length === 0 || what !== types[types.length - 1]){types.push(what);}idx.collection = node.collection;idx.node = node.id;if(node.condition.type && node.condition.type === 'n-ary or'){idx.condition = buildExpression(node.condition.subNodes[i]);}else {idx.condition = "*"; // empty condition. this is likely an index used for sorting only
}indexes.push(idx);});return keyword("FOR") + " " + variableName(node.outVariable) + " " + keyword("IN") + " " + collection(node.collection) + " " + annotation("/* " + types.join(", ") + " */");case "IndexRangeNode":collectionVariables[node.outVariable.id] = node.collection;var index=node.index;index.ranges = node.ranges.map(buildRanges).join(" || ");index.collection = node.collection;index.node = node.id;indexes.push(index);return keyword("FOR") + " " + variableName(node.outVariable) + " " + keyword("IN") + " " + collection(node.collection) + " " + annotation("/* " + (node.reverse?"reverse ":"") + node.index.type + " index scan */");case "TraversalNode":node.minMaxDepth = node.minDepth + ".." + node.maxDepth;node.minMaxDepthLen = node.minMaxDepth.length;var rc=keyword("FOR ") + variableName(node.vertexOutVariable) + " " + annotation("/* vertex */");if(node.hasOwnProperty('edgeOutVariable')){rc += " , " + variableName(node.edgeOutVariable) + " " + annotation("/* edge */");}if(node.hasOwnProperty('pathOutVariable')){rc += " , " + variableName(node.pathOutVariable) + " " + annotation("/* paths */");}rc += " " + keyword("IN") + " " + value(node.minMaxDepth) + " " + annotation("/* min..maxPathDepth */") + " ";var translate=["ANY","INBOUND","OUTBOUND"];var defaultDirection=node.directions[0];rc += keyword(translate[defaultDirection]);if(node.hasOwnProperty("vertexId")){rc += " '" + value(node.vertexId) + "' ";}else {rc += " " + variableName(node.inVariable) + " ";}rc += annotation("/* startnode */") + " ";if(Array.isArray(node.graph)){rc += node.graph.map(function(g,index){var tmp="";if(node.directions[index] !== defaultDirection){tmp += keyword(translate[node.directions[index]]);tmp += " ";}return tmp + collection(g);}).join(", ");}else {rc += keyword("GRAPH") + " '" + value(node.graph) + "'";}traversalDetails.push(node);if(node.hasOwnProperty('simpleExpressions')){node.ConditionStr = buildSimpleExpression(node.simpleExpressions);}var e=[];if(node.hasOwnProperty('graphDefinition')){var v=[];node.graphDefinition.vertexCollectionNames.forEach(function(vcn){v.push(collection(vcn));});node.vertexCollectionNameStr = v.join(", ");node.vertexCollectionNameStrLen = node.graphDefinition.vertexCollectionNames.join(", ").length;node.graphDefinition.edgeCollectionNames.forEach(function(ecn){e.push(collection(ecn));});node.edgeCollectionNameStr = e.join(", ");node.edgeCollectionNameStrLen = node.graphDefinition.edgeCollectionNames.join(", ").length;}else {var edgeCols=node.graph || [];edgeCols.forEach(function(ecn){e.push(collection(ecn));});node.edgeCollectionNameStr = e.join(", ");node.edgeCollectionNameStrLen = edgeCols.join(", ").length;node.graph = "";}return rc;case "CalculationNode":return keyword("LET") + " " + variableName(node.outVariable) + " = " + buildExpression(node.expression) + " " + annotation("/* " + node.expressionType + " expression */");case "FilterNode":return keyword("FILTER") + " " + variableName(node.inVariable);case "AggregateNode": /* old-style COLLECT node */return keyword("COLLECT") + " " + node.aggregates.map(function(node){return variableName(node.outVariable) + " = " + variableName(node.inVariable);}).join(", ") + (node.count?" " + keyword("WITH COUNT"):"") + (node.outVariable?" " + keyword("INTO") + " " + variableName(node.outVariable):"") + (node.keepVariables?" " + keyword("KEEP") + " " + node.keepVariables.map(function(variable){return variableName(variable);}).join(", "):"") + " " + annotation("/* " + node.aggregationOptions.method + " */");case "CollectNode":var collect=keyword("COLLECT") + " " + node.groups.map(function(node){return variableName(node.outVariable) + " = " + variableName(node.inVariable);}).join(", ");if(node.hasOwnProperty("aggregates") && node.aggregates.length > 0){if(node.groups.length > 0){collect += " ";}collect += keyword("AGGREGATE") + " " + node.aggregates.map(function(node){return variableName(node.outVariable) + " = " + func(node.type) + "(" + variableName(node.inVariable) + ")";}).join(", ");}collect += (node.count?" " + keyword("WITH COUNT"):"") + (node.outVariable?" " + keyword("INTO") + " " + variableName(node.outVariable):"") + (node.keepVariables?" " + keyword("KEEP") + " " + node.keepVariables.map(function(variable){return variableName(variable);}).join(", "):"") + " " + annotation("/* " + node.collectOptions.method + "*/");return collect;case "SortNode":return keyword("SORT") + " " + node.elements.map(function(node){return variableName(node.inVariable) + " " + keyword(node.ascending?"ASC":"DESC");}).join(", ");case "LimitNode":return keyword("LIMIT") + " " + value(JSON.stringify(node.offset)) + ", " + value(JSON.stringify(node.limit));case "ReturnNode":return keyword("RETURN") + " " + variableName(node.inVariable);case "SubqueryNode":return keyword("LET") + " " + variableName(node.outVariable) + " = ... " + annotation("/* subquery */");case "InsertNode":modificationFlags = node.modificationFlags;return keyword("INSERT") + " " + variableName(node.inVariable) + " " + keyword("IN") + " " + collection(node.collection);case "UpdateNode":modificationFlags = node.modificationFlags;if(node.hasOwnProperty("inKeyVariable")){return keyword("UPDATE") + " " + variableName(node.inKeyVariable) + " " + keyword("WITH") + " " + variableName(node.inDocVariable) + " " + keyword("IN") + " " + collection(node.collection);}return keyword("UPDATE") + " " + variableName(node.inDocVariable) + " " + keyword("IN") + " " + collection(node.collection);case "ReplaceNode":modificationFlags = node.modificationFlags;if(node.hasOwnProperty("inKeyVariable")){return keyword("REPLACE") + " " + variableName(node.inKeyVariable) + " " + keyword("WITH") + " " + variableName(node.inDocVariable) + " " + keyword("IN") + " " + collection(node.collection);}return keyword("REPLACE") + " " + variableName(node.inDocVariable) + " " + keyword("IN") + " " + collection(node.collection);case "UpsertNode":modificationFlags = node.modificationFlags;return keyword("UPSERT") + " " + variableName(node.inDocVariable) + " " + keyword("INSERT") + " " + variableName(node.insertVariable) + " " + keyword(node.isReplace?"REPLACE":"UPDATE") + " " + variableName(node.updateVariable) + " " + keyword("IN") + " " + collection(node.collection);case "RemoveNode":modificationFlags = node.modificationFlags;return keyword("REMOVE") + " " + variableName(node.inVariable) + " " + keyword("IN") + " " + collection(node.collection);case "RemoteNode":return keyword("REMOTE");case "DistributeNode":return keyword("DISTRIBUTE");case "ScatterNode":return keyword("SCATTER");case "GatherNode":return keyword("GATHER");}return "unhandled node type (" + node.type + ")";};var level=0,subqueries=[];var indent=function indent(level,isRoot){return pad(1 + level + level) + (isRoot?"* ":"- ");};var preHandle=function preHandle(node){usedVariables = {};currentNode = node.id;isConst = true;if(node.type === "SubqueryNode"){subqueries.push(level);}};var postHandle=function postHandle(node){var isLeafNode=!parents.hasOwnProperty(node.id);if(["EnumerateCollectionNode","EnumerateListNode","IndexRangeNode","IndexNode","SubqueryNode"].indexOf(node.type) !== -1){level++;}else if(isLeafNode && subqueries.length > 0){level = subqueries.pop();}else if(node.type === "SingletonNode"){level++;}};var constNess=function constNess(){if(isConst){return " " + annotation("/* const assignment */");}return "";};var variablesUsed=function variablesUsed(){var used=[];for(var a in usedVariables) {if(usedVariables.hasOwnProperty(a)){used.push(variable(a) + " : " + collection(usedVariables[a]));}}if(used.length > 0){return " " + annotation("/* collections used:") + " " + used.join(", ") + " " + annotation("*/");}return "";};var printNode=function printNode(node){preHandle(node);var line=" " + pad(1 + maxIdLen - String(node.id).length) + variable(node.id) + " " + keyword(node.type) + pad(1 + maxTypeLen - String(node.type).length) + " ";if(cluster && cluster.isCluster && cluster.isCluster()){line += variable(node.site) + pad(1 + maxSiteLen - String(node.site).length) + " ";}line += pad(1 + maxEstimateLen - String(node.estimatedNrItems).length) + value(node.estimatedNrItems) + " " + indent(level,node.type === "SingletonNode") + label(node);if(node.type === "CalculationNode"){line += variablesUsed() + constNess();}stringBuilder.appendLine(line);postHandle(node);};printQuery(query);stringBuilder.appendLine(section("Execution plan:"));var line=" " + pad(1 + maxIdLen - String("Id").length) + header("Id") + " " + header("NodeType") + pad(1 + maxTypeLen - String("NodeType").length) + " ";if(cluster && cluster.isCluster && cluster.isCluster()){line += header("Site") + pad(1 + maxSiteLen - String("Site").length) + " ";}line += pad(1 + maxEstimateLen - String("Est.").length) + header("Est.") + " " + header("Comment");stringBuilder.appendLine(line);var walk=[rootNode];while(walk.length > 0) {var id=walk.pop();var node=nodes[id];printNode(node);if(parents.hasOwnProperty(id)){walk = walk.concat(parents[id]);}if(node.type === "SubqueryNode"){walk = walk.concat([node.subquery.nodes[0].id]);}}stringBuilder.appendLine();printIndexes(indexes);printTraversalDetails(traversalDetails);stringBuilder.appendLine();printRules(plan.rules);printModificationFlags(modificationFlags);printWarnings(explain.warnings);} /* the exposed function */function explain(data,options,shouldPrint){'use strict';if(typeof data === "string"){data = {query:data};}if(!(data instanceof Object)){throw "ArangoStatement needs initial data";}if(options === undefined){options = data.options;}options = options || {};setColors(options.colors === undefined?true:options.colors);var stmt=db._createStatement(data);var result=stmt.explain(options);stringBuilder.clearOutput();processQuery(data.query,result,true);if(shouldPrint === undefined || shouldPrint){print(stringBuilder.getOutput());}else {return stringBuilder.getOutput();}}exports.explain = explain;});module.define("@arangodb/aql/functions",function(exports,module){ /*jshint strict: false */ ////////////////////////////////////////////////////////////////////////////////
/// @brief AQL user functions management
///
@@ -2994,7 +2995,307 @@ this._index = index.id;}}}}if(this._index === null){var err=new ArangoError();er
SimpleQueryFulltext.prototype.clone = function(){var query;query = new SimpleQueryFulltext(this._collection,this._attribute,this._query,this._index);query._skip = this._skip;query._limit = this._limit;return query;}; ////////////////////////////////////////////////////////////////////////////////
/// @brief prints a fulltext query
////////////////////////////////////////////////////////////////////////////////
-SimpleQueryFulltext.prototype._PRINT = function(context){var text;text = "SimpleQueryFulltext(" + this._collection.name() + ", " + this._attribute + ", \"" + this._query + "\")";if(this._skip !== null && this._skip !== 0){text += ".skip(" + this._skip + ")";}if(this._limit !== null){text += ".limit(" + this._limit + ")";}context.output += text;};exports.GeneralArrayCursor = GeneralArrayCursor;exports.SimpleQueryAll = SimpleQueryAll;exports.SimpleQueryArray = SimpleQueryArray;exports.SimpleQueryByExample = SimpleQueryByExample;exports.SimpleQueryByCondition = SimpleQueryByCondition;exports.SimpleQueryRange = SimpleQueryRange;exports.SimpleQueryGeo = SimpleQueryGeo;exports.SimpleQueryNear = SimpleQueryNear;exports.SimpleQueryWithin = SimpleQueryWithin;exports.SimpleQueryWithinRectangle = SimpleQueryWithinRectangle;exports.SimpleQueryFulltext = SimpleQueryFulltext;}); /*jshint -W051:true */ /*global global:true, window, require */'use strict'; ////////////////////////////////////////////////////////////////////////////////
+SimpleQueryFulltext.prototype._PRINT = function(context){var text;text = "SimpleQueryFulltext(" + this._collection.name() + ", " + this._attribute + ", \"" + this._query + "\")";if(this._skip !== null && this._skip !== 0){text += ".skip(" + this._skip + ")";}if(this._limit !== null){text += ".limit(" + this._limit + ")";}context.output += text;};exports.GeneralArrayCursor = GeneralArrayCursor;exports.SimpleQueryAll = SimpleQueryAll;exports.SimpleQueryArray = SimpleQueryArray;exports.SimpleQueryByExample = SimpleQueryByExample;exports.SimpleQueryByCondition = SimpleQueryByCondition;exports.SimpleQueryRange = SimpleQueryRange;exports.SimpleQueryGeo = SimpleQueryGeo;exports.SimpleQueryNear = SimpleQueryNear;exports.SimpleQueryWithin = SimpleQueryWithin;exports.SimpleQueryWithinRectangle = SimpleQueryWithinRectangle;exports.SimpleQueryFulltext = SimpleQueryFulltext;});module.define("underscore",function(exports,module){ // Underscore.js 1.8.3
+// http://underscorejs.org
+// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+// Underscore may be freely distributed under the MIT license.
+(function(){ // Baseline setup
+// --------------
+// Establish the root object, `window` in the browser, or `exports` on the server.
+var root=this; // Save the previous value of the `_` variable.
+var previousUnderscore=root._; // Save bytes in the minified (but not gzipped) version:
+var ArrayProto=Array.prototype,ObjProto=Object.prototype,FuncProto=Function.prototype; // Create quick reference variables for speed access to core prototypes.
+var push=ArrayProto.push,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty; // All **ECMAScript 5** native function implementations that we hope to use
+// are declared here.
+var nativeIsArray=Array.isArray,nativeKeys=Object.keys,nativeBind=FuncProto.bind,nativeCreate=Object.create; // Naked function reference for surrogate-prototype-swapping.
+var Ctor=function Ctor(){}; // Create a safe reference to the Underscore object for use below.
+var _=function _(obj){if(obj instanceof _)return obj;if(!(this instanceof _))return new _(obj);this._wrapped = obj;}; // Export the Underscore object for **Node.js**, with
+// backwards-compatibility for the old `require()` API. If we're in
+// the browser, add `_` as a global object.
+if(typeof exports !== 'undefined'){if(typeof module !== 'undefined' && module.exports){exports = module.exports = _;}exports._ = _;}else {root._ = _;} // Current version.
+_.VERSION = '1.8.3'; // Internal function that returns an efficient (for current engines) version
+// of the passed-in callback, to be repeatedly applied in other Underscore
+// functions.
+var optimizeCb=function optimizeCb(func,context,argCount){if(context === void 0)return func;switch(argCount == null?3:argCount){case 1:return function(value){return func.call(context,value);};case 2:return function(value,other){return func.call(context,value,other);};case 3:return function(value,index,collection){return func.call(context,value,index,collection);};case 4:return function(accumulator,value,index,collection){return func.call(context,accumulator,value,index,collection);};}return function(){return func.apply(context,arguments);};}; // A mostly-internal function to generate callbacks that can be applied
+// to each element in a collection, returning the desired result — either
+// identity, an arbitrary callback, a property matcher, or a property accessor.
+var cb=function cb(value,context,argCount){if(value == null)return _.identity;if(_.isFunction(value))return optimizeCb(value,context,argCount);if(_.isObject(value))return _.matcher(value);return _.property(value);};_.iteratee = function(value,context){return cb(value,context,Infinity);}; // An internal function for creating assigner functions.
+var createAssigner=function createAssigner(keysFunc,undefinedOnly){return function(obj){var length=arguments.length;if(length < 2 || obj == null)return obj;for(var index=1;index < length;index++) {var source=arguments[index],keys=keysFunc(source),l=keys.length;for(var i=0;i < l;i++) {var key=keys[i];if(!undefinedOnly || obj[key] === void 0)obj[key] = source[key];}}return obj;};}; // An internal function for creating a new object that inherits from another.
+var baseCreate=function baseCreate(prototype){if(!_.isObject(prototype))return {};if(nativeCreate)return nativeCreate(prototype);Ctor.prototype = prototype;var result=new Ctor();Ctor.prototype = null;return result;};var property=function property(key){return function(obj){return obj == null?void 0:obj[key];};}; // Helper for collection methods to determine whether a collection
+// should be iterated as an array or as an object
+// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
+// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
+var MAX_ARRAY_INDEX=Math.pow(2,53) - 1;var getLength=property('length');var isArrayLike=function isArrayLike(collection){var length=getLength(collection);return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;}; // Collection Functions
+// --------------------
+// The cornerstone, an `each` implementation, aka `forEach`.
+// Handles raw objects in addition to array-likes. Treats all
+// sparse array-likes as if they were dense.
+_.each = _.forEach = function(obj,iteratee,context){iteratee = optimizeCb(iteratee,context);var i,length;if(isArrayLike(obj)){for(i = 0,length = obj.length;i < length;i++) {iteratee(obj[i],i,obj);}}else {var keys=_.keys(obj);for(i = 0,length = keys.length;i < length;i++) {iteratee(obj[keys[i]],keys[i],obj);}}return obj;}; // Return the results of applying the iteratee to each element.
+_.map = _.collect = function(obj,iteratee,context){iteratee = cb(iteratee,context);var keys=!isArrayLike(obj) && _.keys(obj),length=(keys || obj).length,results=Array(length);for(var index=0;index < length;index++) {var currentKey=keys?keys[index]:index;results[index] = iteratee(obj[currentKey],currentKey,obj);}return results;}; // Create a reducing function iterating left or right.
+function createReduce(dir){ // Optimized iterator function as using arguments.length
+// in the main function will deoptimize the, see #1991.
+function iterator(obj,iteratee,memo,keys,index,length){for(;index >= 0 && index < length;index += dir) {var currentKey=keys?keys[index]:index;memo = iteratee(memo,obj[currentKey],currentKey,obj);}return memo;}return function(obj,iteratee,memo,context){iteratee = optimizeCb(iteratee,context,4);var keys=!isArrayLike(obj) && _.keys(obj),length=(keys || obj).length,index=dir > 0?0:length - 1; // Determine the initial value if none is provided.
+if(arguments.length < 3){memo = obj[keys?keys[index]:index];index += dir;}return iterator(obj,iteratee,memo,keys,index,length);};} // **Reduce** builds up a single result from a list of values, aka `inject`,
+// or `foldl`.
+_.reduce = _.foldl = _.inject = createReduce(1); // The right-associative version of reduce, also known as `foldr`.
+_.reduceRight = _.foldr = createReduce(-1); // Return the first value which passes a truth test. Aliased as `detect`.
+_.find = _.detect = function(obj,predicate,context){var key;if(isArrayLike(obj)){key = _.findIndex(obj,predicate,context);}else {key = _.findKey(obj,predicate,context);}if(key !== void 0 && key !== -1)return obj[key];}; // Return all the elements that pass a truth test.
+// Aliased as `select`.
+_.filter = _.select = function(obj,predicate,context){var results=[];predicate = cb(predicate,context);_.each(obj,function(value,index,list){if(predicate(value,index,list))results.push(value);});return results;}; // Return all the elements for which a truth test fails.
+_.reject = function(obj,predicate,context){return _.filter(obj,_.negate(cb(predicate)),context);}; // Determine whether all of the elements match a truth test.
+// Aliased as `all`.
+_.every = _.all = function(obj,predicate,context){predicate = cb(predicate,context);var keys=!isArrayLike(obj) && _.keys(obj),length=(keys || obj).length;for(var index=0;index < length;index++) {var currentKey=keys?keys[index]:index;if(!predicate(obj[currentKey],currentKey,obj))return false;}return true;}; // Determine if at least one element in the object matches a truth test.
+// Aliased as `any`.
+_.some = _.any = function(obj,predicate,context){predicate = cb(predicate,context);var keys=!isArrayLike(obj) && _.keys(obj),length=(keys || obj).length;for(var index=0;index < length;index++) {var currentKey=keys?keys[index]:index;if(predicate(obj[currentKey],currentKey,obj))return true;}return false;}; // Determine if the array or object contains a given item (using `===`).
+// Aliased as `includes` and `include`.
+_.contains = _.includes = _.include = function(obj,item,fromIndex,guard){if(!isArrayLike(obj))obj = _.values(obj);if(typeof fromIndex != 'number' || guard)fromIndex = 0;return _.indexOf(obj,item,fromIndex) >= 0;}; // Invoke a method (with arguments) on every item in a collection.
+_.invoke = function(obj,method){var args=slice.call(arguments,2);var isFunc=_.isFunction(method);return _.map(obj,function(value){var func=isFunc?method:value[method];return func == null?func:func.apply(value,args);});}; // Convenience version of a common use case of `map`: fetching a property.
+_.pluck = function(obj,key){return _.map(obj,_.property(key));}; // Convenience version of a common use case of `filter`: selecting only objects
+// containing specific `key:value` pairs.
+_.where = function(obj,attrs){return _.filter(obj,_.matcher(attrs));}; // Convenience version of a common use case of `find`: getting the first object
+// containing specific `key:value` pairs.
+_.findWhere = function(obj,attrs){return _.find(obj,_.matcher(attrs));}; // Return the maximum element (or element-based computation).
+_.max = function(obj,iteratee,context){var result=-Infinity,lastComputed=-Infinity,value,computed;if(iteratee == null && obj != null){obj = isArrayLike(obj)?obj:_.values(obj);for(var i=0,length=obj.length;i < length;i++) {value = obj[i];if(value > result){result = value;}}}else {iteratee = cb(iteratee,context);_.each(obj,function(value,index,list){computed = iteratee(value,index,list);if(computed > lastComputed || computed === -Infinity && result === -Infinity){result = value;lastComputed = computed;}});}return result;}; // Return the minimum element (or element-based computation).
+_.min = function(obj,iteratee,context){var result=Infinity,lastComputed=Infinity,value,computed;if(iteratee == null && obj != null){obj = isArrayLike(obj)?obj:_.values(obj);for(var i=0,length=obj.length;i < length;i++) {value = obj[i];if(value < result){result = value;}}}else {iteratee = cb(iteratee,context);_.each(obj,function(value,index,list){computed = iteratee(value,index,list);if(computed < lastComputed || computed === Infinity && result === Infinity){result = value;lastComputed = computed;}});}return result;}; // Shuffle a collection, using the modern version of the
+// [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
+_.shuffle = function(obj){var set=isArrayLike(obj)?obj:_.values(obj);var length=set.length;var shuffled=Array(length);for(var index=0,rand;index < length;index++) {rand = _.random(0,index);if(rand !== index)shuffled[index] = shuffled[rand];shuffled[rand] = set[index];}return shuffled;}; // Sample **n** random values from a collection.
+// If **n** is not specified, returns a single random element.
+// The internal `guard` argument allows it to work with `map`.
+_.sample = function(obj,n,guard){if(n == null || guard){if(!isArrayLike(obj))obj = _.values(obj);return obj[_.random(obj.length - 1)];}return _.shuffle(obj).slice(0,Math.max(0,n));}; // Sort the object's values by a criterion produced by an iteratee.
+_.sortBy = function(obj,iteratee,context){iteratee = cb(iteratee,context);return _.pluck(_.map(obj,function(value,index,list){return {value:value,index:index,criteria:iteratee(value,index,list)};}).sort(function(left,right){var a=left.criteria;var b=right.criteria;if(a !== b){if(a > b || a === void 0)return 1;if(a < b || b === void 0)return -1;}return left.index - right.index;}),'value');}; // An internal function used for aggregate "group by" operations.
+var group=function group(behavior){return function(obj,iteratee,context){var result={};iteratee = cb(iteratee,context);_.each(obj,function(value,index){var key=iteratee(value,index,obj);behavior(result,value,key);});return result;};}; // Groups the object's values by a criterion. Pass either a string attribute
+// to group by, or a function that returns the criterion.
+_.groupBy = group(function(result,value,key){if(_.has(result,key))result[key].push(value);else result[key] = [value];}); // Indexes the object's values by a criterion, similar to `groupBy`, but for
+// when you know that your index values will be unique.
+_.indexBy = group(function(result,value,key){result[key] = value;}); // Counts instances of an object that group by a certain criterion. Pass
+// either a string attribute to count by, or a function that returns the
+// criterion.
+_.countBy = group(function(result,value,key){if(_.has(result,key))result[key]++;else result[key] = 1;}); // Safely create a real, live array from anything iterable.
+_.toArray = function(obj){if(!obj)return [];if(_.isArray(obj))return slice.call(obj);if(isArrayLike(obj))return _.map(obj,_.identity);return _.values(obj);}; // Return the number of elements in an object.
+_.size = function(obj){if(obj == null)return 0;return isArrayLike(obj)?obj.length:_.keys(obj).length;}; // Split a collection into two arrays: one whose elements all satisfy the given
+// predicate, and one whose elements all do not satisfy the predicate.
+_.partition = function(obj,predicate,context){predicate = cb(predicate,context);var pass=[],fail=[];_.each(obj,function(value,key,obj){(predicate(value,key,obj)?pass:fail).push(value);});return [pass,fail];}; // Array Functions
+// ---------------
+// Get the first element of an array. Passing **n** will return the first N
+// values in the array. Aliased as `head` and `take`. The **guard** check
+// allows it to work with `_.map`.
+_.first = _.head = _.take = function(array,n,guard){if(array == null)return void 0;if(n == null || guard)return array[0];return _.initial(array,array.length - n);}; // Returns everything but the last entry of the array. Especially useful on
+// the arguments object. Passing **n** will return all the values in
+// the array, excluding the last N.
+_.initial = function(array,n,guard){return slice.call(array,0,Math.max(0,array.length - (n == null || guard?1:n)));}; // Get the last element of an array. Passing **n** will return the last N
+// values in the array.
+_.last = function(array,n,guard){if(array == null)return void 0;if(n == null || guard)return array[array.length - 1];return _.rest(array,Math.max(0,array.length - n));}; // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
+// Especially useful on the arguments object. Passing an **n** will return
+// the rest N values in the array.
+_.rest = _.tail = _.drop = function(array,n,guard){return slice.call(array,n == null || guard?1:n);}; // Trim out all falsy values from an array.
+_.compact = function(array){return _.filter(array,_.identity);}; // Internal implementation of a recursive `flatten` function.
+var flatten=function flatten(input,shallow,strict,startIndex){var output=[],idx=0;for(var i=startIndex || 0,length=getLength(input);i < length;i++) {var value=input[i];if(isArrayLike(value) && (_.isArray(value) || _.isArguments(value))){ //flatten current level of array or arguments object
+if(!shallow)value = flatten(value,shallow,strict);var j=0,len=value.length;output.length += len;while(j < len) {output[idx++] = value[j++];}}else if(!strict){output[idx++] = value;}}return output;}; // Flatten out an array, either recursively (by default), or just one level.
+_.flatten = function(array,shallow){return flatten(array,shallow,false);}; // Return a version of the array that does not contain the specified value(s).
+_.without = function(array){return _.difference(array,slice.call(arguments,1));}; // Produce a duplicate-free version of the array. If the array has already
+// been sorted, you have the option of using a faster algorithm.
+// Aliased as `unique`.
+_.uniq = _.unique = function(array,isSorted,iteratee,context){if(!_.isBoolean(isSorted)){context = iteratee;iteratee = isSorted;isSorted = false;}if(iteratee != null)iteratee = cb(iteratee,context);var result=[];var seen=[];for(var i=0,length=getLength(array);i < length;i++) {var value=array[i],computed=iteratee?iteratee(value,i,array):value;if(isSorted){if(!i || seen !== computed)result.push(value);seen = computed;}else if(iteratee){if(!_.contains(seen,computed)){seen.push(computed);result.push(value);}}else if(!_.contains(result,value)){result.push(value);}}return result;}; // Produce an array that contains the union: each distinct element from all of
+// the passed-in arrays.
+_.union = function(){return _.uniq(flatten(arguments,true,true));}; // Produce an array that contains every item shared between all the
+// passed-in arrays.
+_.intersection = function(array){var result=[];var argsLength=arguments.length;for(var i=0,length=getLength(array);i < length;i++) {var item=array[i];if(_.contains(result,item))continue;for(var j=1;j < argsLength;j++) {if(!_.contains(arguments[j],item))break;}if(j === argsLength)result.push(item);}return result;}; // Take the difference between one array and a number of other arrays.
+// Only the elements present in just the first array will remain.
+_.difference = function(array){var rest=flatten(arguments,true,true,1);return _.filter(array,function(value){return !_.contains(rest,value);});}; // Zip together multiple lists into a single array -- elements that share
+// an index go together.
+_.zip = function(){return _.unzip(arguments);}; // Complement of _.zip. Unzip accepts an array of arrays and groups
+// each array's elements on shared indices
+_.unzip = function(array){var length=array && _.max(array,getLength).length || 0;var result=Array(length);for(var index=0;index < length;index++) {result[index] = _.pluck(array,index);}return result;}; // Converts lists into objects. Pass either a single array of `[key, value]`
+// pairs, or two parallel arrays of the same length -- one of keys, and one of
+// the corresponding values.
+_.object = function(list,values){var result={};for(var i=0,length=getLength(list);i < length;i++) {if(values){result[list[i]] = values[i];}else {result[list[i][0]] = list[i][1];}}return result;}; // Generator function to create the findIndex and findLastIndex functions
+function createPredicateIndexFinder(dir){return function(array,predicate,context){predicate = cb(predicate,context);var length=getLength(array);var index=dir > 0?0:length - 1;for(;index >= 0 && index < length;index += dir) {if(predicate(array[index],index,array))return index;}return -1;};} // Returns the first index on an array-like that passes a predicate test
+_.findIndex = createPredicateIndexFinder(1);_.findLastIndex = createPredicateIndexFinder(-1); // Use a comparator function to figure out the smallest index at which
+// an object should be inserted so as to maintain order. Uses binary search.
+_.sortedIndex = function(array,obj,iteratee,context){iteratee = cb(iteratee,context,1);var value=iteratee(obj);var low=0,high=getLength(array);while(low < high) {var mid=Math.floor((low + high) / 2);if(iteratee(array[mid]) < value)low = mid + 1;else high = mid;}return low;}; // Generator function to create the indexOf and lastIndexOf functions
+function createIndexFinder(dir,predicateFind,sortedIndex){return function(array,item,idx){var i=0,length=getLength(array);if(typeof idx == 'number'){if(dir > 0){i = idx >= 0?idx:Math.max(idx + length,i);}else {length = idx >= 0?Math.min(idx + 1,length):idx + length + 1;}}else if(sortedIndex && idx && length){idx = sortedIndex(array,item);return array[idx] === item?idx:-1;}if(item !== item){idx = predicateFind(slice.call(array,i,length),_.isNaN);return idx >= 0?idx + i:-1;}for(idx = dir > 0?i:length - 1;idx >= 0 && idx < length;idx += dir) {if(array[idx] === item)return idx;}return -1;};} // Return the position of the first occurrence of an item in an array,
+// or -1 if the item is not included in the array.
+// If the array is large and already in sort order, pass `true`
+// for **isSorted** to use binary search.
+_.indexOf = createIndexFinder(1,_.findIndex,_.sortedIndex);_.lastIndexOf = createIndexFinder(-1,_.findLastIndex); // Generate an integer Array containing an arithmetic progression. A port of
+// the native Python `range()` function. See
+// [the Python documentation](http://docs.python.org/library/functions.html#range).
+_.range = function(start,stop,step){if(stop == null){stop = start || 0;start = 0;}step = step || 1;var length=Math.max(Math.ceil((stop - start) / step),0);var range=Array(length);for(var idx=0;idx < length;idx++,start += step) {range[idx] = start;}return range;}; // Function (ahem) Functions
+// ------------------
+// Determines whether to execute a function as a constructor
+// or a normal function with the provided arguments
+var executeBound=function executeBound(sourceFunc,boundFunc,context,callingContext,args){if(!(callingContext instanceof boundFunc))return sourceFunc.apply(context,args);var self=baseCreate(sourceFunc.prototype);var result=sourceFunc.apply(self,args);if(_.isObject(result))return result;return self;}; // Create a function bound to a given object (assigning `this`, and arguments,
+// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
+// available.
+_.bind = function(func,context){if(nativeBind && func.bind === nativeBind)return nativeBind.apply(func,slice.call(arguments,1));if(!_.isFunction(func))throw new TypeError('Bind must be called on a function');var args=slice.call(arguments,2);var bound=function bound(){return executeBound(func,bound,context,this,args.concat(slice.call(arguments)));};return bound;}; // Partially apply a function by creating a version that has had some of its
+// arguments pre-filled, without changing its dynamic `this` context. _ acts
+// as a placeholder, allowing any combination of arguments to be pre-filled.
+_.partial = function(func){var boundArgs=slice.call(arguments,1);var bound=function bound(){var position=0,length=boundArgs.length;var args=Array(length);for(var i=0;i < length;i++) {args[i] = boundArgs[i] === _?arguments[position++]:boundArgs[i];}while(position < arguments.length) args.push(arguments[position++]);return executeBound(func,bound,this,this,args);};return bound;}; // Bind a number of an object's methods to that object. Remaining arguments
+// are the method names to be bound. Useful for ensuring that all callbacks
+// defined on an object belong to it.
+_.bindAll = function(obj){var i,length=arguments.length,key;if(length <= 1)throw new Error('bindAll must be passed function names');for(i = 1;i < length;i++) {key = arguments[i];obj[key] = _.bind(obj[key],obj);}return obj;}; // Memoize an expensive function by storing its results.
+_.memoize = function(func,hasher){var memoize=function memoize(key){var cache=memoize.cache;var address='' + (hasher?hasher.apply(this,arguments):key);if(!_.has(cache,address))cache[address] = func.apply(this,arguments);return cache[address];};memoize.cache = {};return memoize;}; // Delays a function for the given number of milliseconds, and then calls
+// it with the arguments supplied.
+_.delay = function(func,wait){var args=slice.call(arguments,2);return setTimeout(function(){return func.apply(null,args);},wait);}; // Defers a function, scheduling it to run after the current call stack has
+// cleared.
+_.defer = _.partial(_.delay,_,1); // Returns a function, that, when invoked, will only be triggered at most once
+// during a given window of time. Normally, the throttled function will run
+// as much as it can, without ever going more than once per `wait` duration;
+// but if you'd like to disable the execution on the leading edge, pass
+// `{leading: false}`. To disable execution on the trailing edge, ditto.
+_.throttle = function(func,wait,options){var context,args,result;var timeout=null;var previous=0;if(!options)options = {};var later=function later(){previous = options.leading === false?0:_.now();timeout = null;result = func.apply(context,args);if(!timeout)context = args = null;};return function(){var now=_.now();if(!previous && options.leading === false)previous = now;var remaining=wait - (now - previous);context = this;args = arguments;if(remaining <= 0 || remaining > wait){if(timeout){clearTimeout(timeout);timeout = null;}previous = now;result = func.apply(context,args);if(!timeout)context = args = null;}else if(!timeout && options.trailing !== false){timeout = setTimeout(later,remaining);}return result;};}; // Returns a function, that, as long as it continues to be invoked, will not
+// be triggered. The function will be called after it stops being called for
+// N milliseconds. If `immediate` is passed, trigger the function on the
+// leading edge, instead of the trailing.
+_.debounce = function(func,wait,immediate){var timeout,args,context,timestamp,result;var later=function later(){var last=_.now() - timestamp;if(last < wait && last >= 0){timeout = setTimeout(later,wait - last);}else {timeout = null;if(!immediate){result = func.apply(context,args);if(!timeout)context = args = null;}}};return function(){context = this;args = arguments;timestamp = _.now();var callNow=immediate && !timeout;if(!timeout)timeout = setTimeout(later,wait);if(callNow){result = func.apply(context,args);context = args = null;}return result;};}; // Returns the first function passed as an argument to the second,
+// allowing you to adjust arguments, run code before and after, and
+// conditionally execute the original function.
+_.wrap = function(func,wrapper){return _.partial(wrapper,func);}; // Returns a negated version of the passed-in predicate.
+_.negate = function(predicate){return function(){return !predicate.apply(this,arguments);};}; // Returns a function that is the composition of a list of functions, each
+// consuming the return value of the function that follows.
+_.compose = function(){var args=arguments;var start=args.length - 1;return function(){var i=start;var result=args[start].apply(this,arguments);while(i--) result = args[i].call(this,result);return result;};}; // Returns a function that will only be executed on and after the Nth call.
+_.after = function(times,func){return function(){if(--times < 1){return func.apply(this,arguments);}};}; // Returns a function that will only be executed up to (but not including) the Nth call.
+_.before = function(times,func){var memo;return function(){if(--times > 0){memo = func.apply(this,arguments);}if(times <= 1)func = null;return memo;};}; // Returns a function that will be executed at most one time, no matter how
+// often you call it. Useful for lazy initialization.
+_.once = _.partial(_.before,2); // Object Functions
+// ----------------
+// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
+var hasEnumBug=!({toString:null}).propertyIsEnumerable('toString');var nonEnumerableProps=['valueOf','isPrototypeOf','toString','propertyIsEnumerable','hasOwnProperty','toLocaleString'];function collectNonEnumProps(obj,keys){var nonEnumIdx=nonEnumerableProps.length;var constructor=obj.constructor;var proto=_.isFunction(constructor) && constructor.prototype || ObjProto; // Constructor is a special case.
+var prop='constructor';if(_.has(obj,prop) && !_.contains(keys,prop))keys.push(prop);while(nonEnumIdx--) {prop = nonEnumerableProps[nonEnumIdx];if(prop in obj && obj[prop] !== proto[prop] && !_.contains(keys,prop)){keys.push(prop);}}} // Retrieve the names of an object's own properties.
+// Delegates to **ECMAScript 5**'s native `Object.keys`
+_.keys = function(obj){if(!_.isObject(obj))return [];if(nativeKeys)return nativeKeys(obj);var keys=[];for(var key in obj) if(_.has(obj,key))keys.push(key); // Ahem, IE < 9.
+if(hasEnumBug)collectNonEnumProps(obj,keys);return keys;}; // Retrieve all the property names of an object.
+_.allKeys = function(obj){if(!_.isObject(obj))return [];var keys=[];for(var key in obj) keys.push(key); // Ahem, IE < 9.
+if(hasEnumBug)collectNonEnumProps(obj,keys);return keys;}; // Retrieve the values of an object's properties.
+_.values = function(obj){var keys=_.keys(obj);var length=keys.length;var values=Array(length);for(var i=0;i < length;i++) {values[i] = obj[keys[i]];}return values;}; // Returns the results of applying the iteratee to each element of the object
+// In contrast to _.map it returns an object
+_.mapObject = function(obj,iteratee,context){iteratee = cb(iteratee,context);var keys=_.keys(obj),length=keys.length,results={},currentKey;for(var index=0;index < length;index++) {currentKey = keys[index];results[currentKey] = iteratee(obj[currentKey],currentKey,obj);}return results;}; // Convert an object into a list of `[key, value]` pairs.
+_.pairs = function(obj){var keys=_.keys(obj);var length=keys.length;var pairs=Array(length);for(var i=0;i < length;i++) {pairs[i] = [keys[i],obj[keys[i]]];}return pairs;}; // Invert the keys and values of an object. The values must be serializable.
+_.invert = function(obj){var result={};var keys=_.keys(obj);for(var i=0,length=keys.length;i < length;i++) {result[obj[keys[i]]] = keys[i];}return result;}; // Return a sorted list of the function names available on the object.
+// Aliased as `methods`
+_.functions = _.methods = function(obj){var names=[];for(var key in obj) {if(_.isFunction(obj[key]))names.push(key);}return names.sort();}; // Extend a given object with all the properties in passed-in object(s).
+_.extend = createAssigner(_.allKeys); // Assigns a given object with all the own properties in the passed-in object(s)
+// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
+_.extendOwn = _.assign = createAssigner(_.keys); // Returns the first key on an object that passes a predicate test
+_.findKey = function(obj,predicate,context){predicate = cb(predicate,context);var keys=_.keys(obj),key;for(var i=0,length=keys.length;i < length;i++) {key = keys[i];if(predicate(obj[key],key,obj))return key;}}; // Return a copy of the object only containing the whitelisted properties.
+_.pick = function(object,oiteratee,context){var result={},obj=object,iteratee,keys;if(obj == null)return result;if(_.isFunction(oiteratee)){keys = _.allKeys(obj);iteratee = optimizeCb(oiteratee,context);}else {keys = flatten(arguments,false,false,1);iteratee = function(value,key,obj){return key in obj;};obj = Object(obj);}for(var i=0,length=keys.length;i < length;i++) {var key=keys[i];var value=obj[key];if(iteratee(value,key,obj))result[key] = value;}return result;}; // Return a copy of the object without the blacklisted properties.
+_.omit = function(obj,iteratee,context){if(_.isFunction(iteratee)){iteratee = _.negate(iteratee);}else {var keys=_.map(flatten(arguments,false,false,1),String);iteratee = function(value,key){return !_.contains(keys,key);};}return _.pick(obj,iteratee,context);}; // Fill in a given object with default properties.
+_.defaults = createAssigner(_.allKeys,true); // Creates an object that inherits from the given prototype object.
+// If additional properties are provided then they will be added to the
+// created object.
+_.create = function(prototype,props){var result=baseCreate(prototype);if(props)_.extendOwn(result,props);return result;}; // Create a (shallow-cloned) duplicate of an object.
+_.clone = function(obj){if(!_.isObject(obj))return obj;return _.isArray(obj)?obj.slice():_.extend({},obj);}; // Invokes interceptor with the obj, and then returns obj.
+// The primary purpose of this method is to "tap into" a method chain, in
+// order to perform operations on intermediate results within the chain.
+_.tap = function(obj,interceptor){interceptor(obj);return obj;}; // Returns whether an object has a given set of `key:value` pairs.
+_.isMatch = function(object,attrs){var keys=_.keys(attrs),length=keys.length;if(object == null)return !length;var obj=Object(object);for(var i=0;i < length;i++) {var key=keys[i];if(attrs[key] !== obj[key] || !(key in obj))return false;}return true;}; // Internal recursive comparison function for `isEqual`.
+var eq=function eq(a,b,aStack,bStack){ // Identical objects are equal. `0 === -0`, but they aren't identical.
+// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
+if(a === b)return a !== 0 || 1 / a === 1 / b; // A strict comparison is necessary because `null == undefined`.
+if(a == null || b == null)return a === b; // Unwrap any wrapped objects.
+if(a instanceof _)a = a._wrapped;if(b instanceof _)b = b._wrapped; // Compare `[[Class]]` names.
+var className=toString.call(a);if(className !== toString.call(b))return false;switch(className){ // Strings, numbers, regular expressions, dates, and booleans are compared by value.
+case '[object RegExp]': // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
+case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+// equivalent to `new String("5")`.
+return '' + a === '' + b;case '[object Number]': // `NaN`s are equivalent, but non-reflexive.
+// Object(NaN) is equivalent to NaN
+if(+a !== +a)return +b !== +b; // An `egal` comparison is performed for other numeric values.
+return +a === 0?1 / +a === 1 / b:+a === +b;case '[object Date]':case '[object Boolean]': // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+// millisecond representations. Note that invalid dates with millisecond representations
+// of `NaN` are not equivalent.
+return +a === +b;}var areArrays=className === '[object Array]';if(!areArrays){if(typeof a != 'object' || typeof b != 'object')return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s
+// from different frames are.
+var aCtor=a.constructor,bCtor=b.constructor;if(aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && _.isFunction(bCtor) && bCtor instanceof bCtor) && ('constructor' in a && 'constructor' in b)){return false;}} // Assume equality for cyclic structures. The algorithm for detecting cyclic
+// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+// Initializing stack of traversed objects.
+// It's done here since we only need them for objects and arrays comparison.
+aStack = aStack || [];bStack = bStack || [];var length=aStack.length;while(length--) { // Linear search. Performance is inversely proportional to the number of
+// unique nested structures.
+if(aStack[length] === a)return bStack[length] === b;} // Add the first object to the stack of traversed objects.
+aStack.push(a);bStack.push(b); // Recursively compare objects and arrays.
+if(areArrays){ // Compare array lengths to determine if a deep comparison is necessary.
+length = a.length;if(length !== b.length)return false; // Deep compare the contents, ignoring non-numeric properties.
+while(length--) {if(!eq(a[length],b[length],aStack,bStack))return false;}}else { // Deep compare objects.
+var keys=_.keys(a),key;length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
+if(_.keys(b).length !== length)return false;while(length--) { // Deep compare each member
+key = keys[length];if(!(_.has(b,key) && eq(a[key],b[key],aStack,bStack)))return false;}} // Remove the first object from the stack of traversed objects.
+aStack.pop();bStack.pop();return true;}; // Perform a deep comparison to check if two objects are equal.
+_.isEqual = function(a,b){return eq(a,b);}; // Is a given array, string, or object empty?
+// An "empty" object has no enumerable own-properties.
+_.isEmpty = function(obj){if(obj == null)return true;if(isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj)))return obj.length === 0;return _.keys(obj).length === 0;}; // Is a given value a DOM element?
+_.isElement = function(obj){return !!(obj && obj.nodeType === 1);}; // Is a given value an array?
+// Delegates to ECMA5's native Array.isArray
+_.isArray = nativeIsArray || function(obj){return toString.call(obj) === '[object Array]';}; // Is a given variable an object?
+_.isObject = function(obj){var type=typeof obj;return type === 'function' || type === 'object' && !!obj;}; // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
+_.each(['Arguments','Function','String','Number','Date','RegExp','Error'],function(name){_['is' + name] = function(obj){return toString.call(obj) === '[object ' + name + ']';};}); // Define a fallback version of the method in browsers (ahem, IE < 9), where
+// there isn't any inspectable "Arguments" type.
+if(!_.isArguments(arguments)){_.isArguments = function(obj){return _.has(obj,'callee');};} // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
+// IE 11 (#1621), and in Safari 8 (#1929).
+if(typeof /./ != 'function' && typeof Int8Array != 'object'){_.isFunction = function(obj){return typeof obj == 'function' || false;};} // Is a given object a finite number?
+_.isFinite = function(obj){return isFinite(obj) && !isNaN(parseFloat(obj));}; // Is the given value `NaN`? (NaN is the only number which does not equal itself).
+_.isNaN = function(obj){return _.isNumber(obj) && obj !== +obj;}; // Is a given value a boolean?
+_.isBoolean = function(obj){return obj === true || obj === false || toString.call(obj) === '[object Boolean]';}; // Is a given value equal to null?
+_.isNull = function(obj){return obj === null;}; // Is a given variable undefined?
+_.isUndefined = function(obj){return obj === void 0;}; // Shortcut function for checking if an object has a given property directly
+// on itself (in other words, not on a prototype).
+_.has = function(obj,key){return obj != null && hasOwnProperty.call(obj,key);}; // Utility Functions
+// -----------------
+// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
+// previous owner. Returns a reference to the Underscore object.
+_.noConflict = function(){root._ = previousUnderscore;return this;}; // Keep the identity function around for default iteratees.
+_.identity = function(value){return value;}; // Predicate-generating functions. Often useful outside of Underscore.
+_.constant = function(value){return function(){return value;};};_.noop = function(){};_.property = property; // Generates a function for a given object that returns a given property.
+_.propertyOf = function(obj){return obj == null?function(){}:function(key){return obj[key];};}; // Returns a predicate for checking whether an object has a given set of
+// `key:value` pairs.
+_.matcher = _.matches = function(attrs){attrs = _.extendOwn({},attrs);return function(obj){return _.isMatch(obj,attrs);};}; // Run a function **n** times.
+_.times = function(n,iteratee,context){var accum=Array(Math.max(0,n));iteratee = optimizeCb(iteratee,context,1);for(var i=0;i < n;i++) accum[i] = iteratee(i);return accum;}; // Return a random integer between min and max (inclusive).
+_.random = function(min,max){if(max == null){max = min;min = 0;}return min + Math.floor(Math.random() * (max - min + 1));}; // A (possibly faster) way to get the current timestamp as an integer.
+_.now = Date.now || function(){return new Date().getTime();}; // List of HTML entities for escaping.
+var escapeMap={'&':'&','<':'<','>':'>','"':'"',"'":''','`':'`'};var unescapeMap=_.invert(escapeMap); // Functions for escaping and unescaping strings to/from HTML interpolation.
+var createEscaper=function createEscaper(map){var escaper=function escaper(match){return map[match];}; // Regexes for identifying a key that needs to be escaped
+var source='(?:' + _.keys(map).join('|') + ')';var testRegexp=RegExp(source);var replaceRegexp=RegExp(source,'g');return function(string){string = string == null?'':'' + string;return testRegexp.test(string)?string.replace(replaceRegexp,escaper):string;};};_.escape = createEscaper(escapeMap);_.unescape = createEscaper(unescapeMap); // If the value of the named `property` is a function then invoke it with the
+// `object` as context; otherwise, return it.
+_.result = function(object,property,fallback){var value=object == null?void 0:object[property];if(value === void 0){value = fallback;}return _.isFunction(value)?value.call(object):value;}; // Generate a unique integer id (unique within the entire client session).
+// Useful for temporary DOM ids.
+var idCounter=0;_.uniqueId = function(prefix){var id=++idCounter + '';return prefix?prefix + id:id;}; // By default, Underscore uses ERB-style template delimiters, change the
+// following template settings to use alternative delimiters.
+_.templateSettings = {evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g}; // When customizing `templateSettings`, if you don't want to define an
+// interpolation, evaluation or escaping regex, we need one that is
+// guaranteed not to match.
+var noMatch=/(.)^/; // Certain characters need to be escaped so that they can be put into a
+// string literal.
+var escapes={"'":"'",'\\':'\\','\r':'r','\n':'n','\u2028':'u2028','\u2029':'u2029'};var escaper=/\\|'|\r|\n|\u2028|\u2029/g;var escapeChar=function escapeChar(match){return '\\' + escapes[match];}; // JavaScript micro-templating, similar to John Resig's implementation.
+// Underscore templating handles arbitrary delimiters, preserves whitespace,
+// and correctly escapes quotes within interpolated code.
+// NB: `oldSettings` only exists for backwards compatibility.
+_.template = function(text,settings,oldSettings){if(!settings && oldSettings)settings = oldSettings;settings = _.defaults({},settings,_.templateSettings); // Combine delimiters into one regular expression via alternation.
+var matcher=RegExp([(settings.escape || noMatch).source,(settings.interpolate || noMatch).source,(settings.evaluate || noMatch).source].join('|') + '|$','g'); // Compile the template source, escaping string literals appropriately.
+var index=0;var source="__p+='";text.replace(matcher,function(match,escape,interpolate,evaluate,offset){source += text.slice(index,offset).replace(escaper,escapeChar);index = offset + match.length;if(escape){source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";}else if(interpolate){source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";}else if(evaluate){source += "';\n" + evaluate + "\n__p+='";} // Adobe VMs need the match returned to produce the correct offest.
+return match;});source += "';\n"; // If a variable is not specified, place data values in local scope.
+if(!settings.variable)source = 'with(obj||{}){\n' + source + '}\n';source = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + source + 'return __p;\n';try{var render=new Function(settings.variable || 'obj','_',source);}catch(e) {e.source = source;throw e;}var template=function template(data){return render.call(this,data,_);}; // Provide the compiled source as a convenience for precompilation.
+var argument=settings.variable || 'obj';template.source = 'function(' + argument + '){\n' + source + '}';return template;}; // Add a "chain" function. Start chaining a wrapped Underscore object.
+_.chain = function(obj){var instance=_(obj);instance._chain = true;return instance;}; // OOP
+// ---------------
+// If Underscore is called as a function, it returns a wrapped object that
+// can be used OO-style. This wrapper holds altered versions of all the
+// underscore functions. Wrapped objects may be chained.
+// Helper function to continue chaining intermediate results.
+var result=function result(instance,obj){return instance._chain?_(obj).chain():obj;}; // Add your own custom functions to the Underscore object.
+_.mixin = function(obj){_.each(_.functions(obj),function(name){var func=_[name] = obj[name];_.prototype[name] = function(){var args=[this._wrapped];push.apply(args,arguments);return result(this,func.apply(_,args));};});}; // Add all of the Underscore functions to the wrapper object.
+_.mixin(_); // Add all mutator Array functions to the wrapper.
+_.each(['pop','push','reverse','shift','sort','splice','unshift'],function(name){var method=ArrayProto[name];_.prototype[name] = function(){var obj=this._wrapped;method.apply(obj,arguments);if((name === 'shift' || name === 'splice') && obj.length === 0)delete obj[0];return result(this,obj);};}); // Add all accessor Array functions to the wrapper.
+_.each(['concat','join','slice'],function(name){var method=ArrayProto[name];_.prototype[name] = function(){return result(this,method.apply(this._wrapped,arguments));};}); // Extracts the result from a wrapped and chained object.
+_.prototype.value = function(){return this._wrapped;}; // Provide unwrapping proxy for some methods used in engine operations
+// such as arithmetic and JSON stringification.
+_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;_.prototype.toString = function(){return '' + this._wrapped;}; // AMD registration happens at the end for compatibility with AMD loaders
+// that may not enforce next-turn semantics on modules. Even though general
+// practice for AMD registration is to be anonymous, underscore registers
+// as a named module because, like jQuery, it is a base library that is
+// popular enough to be bundled in a third party lib, but not be part of
+// an AMD load request. Those cases could generate an error when an
+// anonymous define() is called outside of a loader request.
+if(typeof define === 'function' && define.amd){define('underscore',[],function(){return _;});}}).call(this);}); /*jshint -W051:true */ /*global global:true, window, require */'use strict'; ////////////////////////////////////////////////////////////////////////////////
/// @brief ArangoShell client API
///
/// @file
diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes6.js b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes6.js
index e2aa22e454..52a0edfd23 100644
--- a/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes6.js
+++ b/js/apps/system/_admin/aardvark/APP/frontend/build/arangoes6.js
@@ -1964,6 +1964,7 @@ return exports;
"ERROR_CLUSTER_AQL_COMMUNICATION" : { "code" : 1474, "message" : "error in cluster internal communication for AQL" },
"ERROR_ARANGO_DOCUMENT_NOT_FOUND_OR_SHARDING_ATTRIBUTES_CHANGED" : { "code" : 1475, "message" : "document not found or sharding attributes changed" },
"ERROR_CLUSTER_COULD_NOT_DETERMINE_ID" : { "code" : 1476, "message" : "could not determine my ID from my local info" },
+ "ERROR_CLUSTER_ONLY_ON_DBSERVER" : { "code" : 1477, "message" : "this operation is only valid on a DBserver in a cluster" },
"ERROR_QUERY_KILLED" : { "code" : 1500, "message" : "query killed" },
"ERROR_QUERY_PARSE" : { "code" : 1501, "message" : "%s" },
"ERROR_QUERY_EMPTY" : { "code" : 1502, "message" : "query is empty" },
@@ -4747,7 +4748,8 @@ ArangoDatabase.prototype._create = function (name, properties, type) {
if (properties !== undefined) {
[ "waitForSync", "journalSize", "isSystem", "isVolatile",
"doCompact", "keyOptions", "shardKeys", "numberOfShards",
- "distributeShardsLike", "indexBuckets", "id" ].forEach(function(p) {
+ "distributeShardsLike", "indexBuckets", "id",
+ "replicationFactor", "replicationQuorum" ].forEach(function(p) {
if (properties.hasOwnProperty(p)) {
body[p] = properties[p];
}
@@ -7526,7 +7528,6 @@ if (typeof internal.printBrowser === "function") {
}
var stringBuilder = {
-
output: "",
appendLine: function(line) {
@@ -7562,6 +7563,14 @@ function setColors (useSystemColors) {
/* colorizer and output helper functions */
+function bracketize (node, v) {
+ 'use strict';
+ if (node && node.subNodes && node.subNodes.length > 1) {
+ return "(" + v + ")";
+ }
+ return v;
+}
+
function attributeUncolored (v) {
'use strict';
return "`" + v + "`";
@@ -7956,6 +7965,19 @@ function processQuery (query, explain) {
// };
var buildExpression = function (node) {
+ var binaryOperator = function (node, name) {
+ var lhs = buildExpression(node.subNodes[0]);
+ var rhs = buildExpression(node.subNodes[1]);
+ if (node.subNodes.length === 3) {
+ // array operator node... prepend "all" | "any" | "none" to node type
+ name = node.subNodes[2].quantifier + " " + name;
+ }
+ if (node.sorted) {
+ return lhs + " " + name + " " + annotation("/* sorted */") + " " + rhs;
+ }
+ return lhs + " " + name + " " + rhs;
+ };
+
isConst = isConst && ([ "value", "object", "object element", "array" ].indexOf(node.type) !== -1);
if (node.type !== "attribute access" &&
@@ -8064,51 +8086,53 @@ function processQuery (query, explain) {
case "function call":
return func(node.name) + "(" + ((node.subNodes && node.subNodes[0].subNodes) || [ ]).map(buildExpression).join(", ") + ")";
case "plus":
- return buildExpression(node.subNodes[0]) + " + " + buildExpression(node.subNodes[1]);
+ return "(" + binaryOperator(node, "+") + ")";
case "minus":
- return buildExpression(node.subNodes[0]) + " - " + buildExpression(node.subNodes[1]);
+ return "(" + binaryOperator(node, "-") + ")";
case "times":
- return buildExpression(node.subNodes[0]) + " * " + buildExpression(node.subNodes[1]);
+ return "(" + binaryOperator(node, "*") + ")";
case "division":
- return buildExpression(node.subNodes[0]) + " / " + buildExpression(node.subNodes[1]);
+ return "(" + binaryOperator(node, "/") + ")";
case "modulus":
- return buildExpression(node.subNodes[0]) + " % " + buildExpression(node.subNodes[1]);
+ return "(" + binaryOperator(node, "%") + ")";
case "compare not in":
- if (node.sorted) {
- return buildExpression(node.subNodes[0]) + " not in " + annotation("/* sorted */") + " " + buildExpression(node.subNodes[1]);
- }
- return buildExpression(node.subNodes[0]) + " not in " + buildExpression(node.subNodes[1]);
+ case "array compare not in":
+ return "(" + binaryOperator(node, "not in") + ")";
case "compare in":
- if (node.sorted) {
- return buildExpression(node.subNodes[0]) + " in " + annotation("/* sorted */") + " " + buildExpression(node.subNodes[1]);
- }
- return buildExpression(node.subNodes[0]) + " in " + buildExpression(node.subNodes[1]);
+ case "array compare in":
+ return "(" + binaryOperator(node, "in") + ")";
case "compare ==":
- return buildExpression(node.subNodes[0]) + " == " + buildExpression(node.subNodes[1]);
+ case "array compare ==":
+ return "(" + binaryOperator(node, "==") + ")";
case "compare !=":
- return buildExpression(node.subNodes[0]) + " != " + buildExpression(node.subNodes[1]);
+ case "array compare !=":
+ return "(" + binaryOperator(node, "!=") + ")";
case "compare >":
- return buildExpression(node.subNodes[0]) + " > " + buildExpression(node.subNodes[1]);
+ case "array compare >":
+ return "(" + binaryOperator(node, ">") + ")";
case "compare >=":
- return buildExpression(node.subNodes[0]) + " >= " + buildExpression(node.subNodes[1]);
+ case "array compare >=":
+ return "(" + binaryOperator(node, ">=") + ")";
case "compare <":
- return buildExpression(node.subNodes[0]) + " < " + buildExpression(node.subNodes[1]);
+ case "array compare <":
+ return "(" + binaryOperator(node, "<") + ")";
case "compare <=":
- return buildExpression(node.subNodes[0]) + " <= " + buildExpression(node.subNodes[1]);
+ case "array compare <=":
+ return "(" + binaryOperator(node, "<=") + ")";
case "logical or":
- return buildExpression(node.subNodes[0]) + " || " + buildExpression(node.subNodes[1]);
+ return "(" + binaryOperator(node, "||") + ")";
case "logical and":
- return buildExpression(node.subNodes[0]) + " && " + buildExpression(node.subNodes[1]);
+ return "(" + binaryOperator(node, "&&") + ")";
case "ternary":
- return buildExpression(node.subNodes[0]) + " ? " + buildExpression(node.subNodes[1]) + " : " + buildExpression(node.subNodes[2]);
+ return "(" + buildExpression(node.subNodes[0]) + " ? " + buildExpression(node.subNodes[1]) + " : " + buildExpression(node.subNodes[2]) + ")";
case "n-ary or":
if (node.hasOwnProperty("subNodes")) {
- return node.subNodes.map(function(sub) { return buildExpression(sub); }).join(" || ");
+ return bracketize(node, node.subNodes.map(function(sub) { return buildExpression(sub); }).join(" || "));
}
return "";
case "n-ary and":
if (node.hasOwnProperty("subNodes")) {
- return node.subNodes.map(function(sub) { return buildExpression(sub); }).join(" && ");
+ return bracketize(node, node.subNodes.map(function(sub) { return buildExpression(sub); }).join(" && "));
}
return "";
default:
@@ -8211,7 +8235,7 @@ function processQuery (query, explain) {
collectionVariables[node.outVariable.id] = node.collection;
var types = [ ];
node.indexes.forEach(function (idx, i) {
- var what = (idx.reverse ? "reverse " : "") + idx.type + " index scan";
+ var what = (node.reverse ? "reverse " : "") + idx.type + " index scan";
if (types.length === 0 || what !== types[types.length - 1]) {
types.push(what);
}
@@ -16508,6 +16532,1557 @@ exports.SimpleQueryFulltext = SimpleQueryFulltext;
});
+module.define("underscore", function(exports, module) {
+// Underscore.js 1.8.3
+// http://underscorejs.org
+// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+// Underscore may be freely distributed under the MIT license.
+
+(function() {
+
+ // Baseline setup
+ // --------------
+
+ // Establish the root object, `window` in the browser, or `exports` on the server.
+ var root = this;
+
+ // Save the previous value of the `_` variable.
+ var previousUnderscore = root._;
+
+ // Save bytes in the minified (but not gzipped) version:
+ var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
+
+ // Create quick reference variables for speed access to core prototypes.
+ var
+ push = ArrayProto.push,
+ slice = ArrayProto.slice,
+ toString = ObjProto.toString,
+ hasOwnProperty = ObjProto.hasOwnProperty;
+
+ // All **ECMAScript 5** native function implementations that we hope to use
+ // are declared here.
+ var
+ nativeIsArray = Array.isArray,
+ nativeKeys = Object.keys,
+ nativeBind = FuncProto.bind,
+ nativeCreate = Object.create;
+
+ // Naked function reference for surrogate-prototype-swapping.
+ var Ctor = function(){};
+
+ // Create a safe reference to the Underscore object for use below.
+ var _ = function(obj) {
+ if (obj instanceof _) return obj;
+ if (!(this instanceof _)) return new _(obj);
+ this._wrapped = obj;
+ };
+
+ // Export the Underscore object for **Node.js**, with
+ // backwards-compatibility for the old `require()` API. If we're in
+ // the browser, add `_` as a global object.
+ if (typeof exports !== 'undefined') {
+ if (typeof module !== 'undefined' && module.exports) {
+ exports = module.exports = _;
+ }
+ exports._ = _;
+ } else {
+ root._ = _;
+ }
+
+ // Current version.
+ _.VERSION = '1.8.3';
+
+ // Internal function that returns an efficient (for current engines) version
+ // of the passed-in callback, to be repeatedly applied in other Underscore
+ // functions.
+ var optimizeCb = function(func, context, argCount) {
+ if (context === void 0) return func;
+ switch (argCount == null ? 3 : argCount) {
+ case 1: return function(value) {
+ return func.call(context, value);
+ };
+ case 2: return function(value, other) {
+ return func.call(context, value, other);
+ };
+ case 3: return function(value, index, collection) {
+ return func.call(context, value, index, collection);
+ };
+ case 4: return function(accumulator, value, index, collection) {
+ return func.call(context, accumulator, value, index, collection);
+ };
+ }
+ return function() {
+ return func.apply(context, arguments);
+ };
+ };
+
+ // A mostly-internal function to generate callbacks that can be applied
+ // to each element in a collection, returning the desired result — either
+ // identity, an arbitrary callback, a property matcher, or a property accessor.
+ var cb = function(value, context, argCount) {
+ if (value == null) return _.identity;
+ if (_.isFunction(value)) return optimizeCb(value, context, argCount);
+ if (_.isObject(value)) return _.matcher(value);
+ return _.property(value);
+ };
+ _.iteratee = function(value, context) {
+ return cb(value, context, Infinity);
+ };
+
+ // An internal function for creating assigner functions.
+ var createAssigner = function(keysFunc, undefinedOnly) {
+ return function(obj) {
+ var length = arguments.length;
+ if (length < 2 || obj == null) return obj;
+ for (var index = 1; index < length; index++) {
+ var source = arguments[index],
+ keys = keysFunc(source),
+ l = keys.length;
+ for (var i = 0; i < l; i++) {
+ var key = keys[i];
+ if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
+ }
+ }
+ return obj;
+ };
+ };
+
+ // An internal function for creating a new object that inherits from another.
+ var baseCreate = function(prototype) {
+ if (!_.isObject(prototype)) return {};
+ if (nativeCreate) return nativeCreate(prototype);
+ Ctor.prototype = prototype;
+ var result = new Ctor;
+ Ctor.prototype = null;
+ return result;
+ };
+
+ var property = function(key) {
+ return function(obj) {
+ return obj == null ? void 0 : obj[key];
+ };
+ };
+
+ // Helper for collection methods to determine whether a collection
+ // should be iterated as an array or as an object
+ // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
+ // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
+ var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
+ var getLength = property('length');
+ var isArrayLike = function(collection) {
+ var length = getLength(collection);
+ return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
+ };
+
+ // Collection Functions
+ // --------------------
+
+ // The cornerstone, an `each` implementation, aka `forEach`.
+ // Handles raw objects in addition to array-likes. Treats all
+ // sparse array-likes as if they were dense.
+ _.each = _.forEach = function(obj, iteratee, context) {
+ iteratee = optimizeCb(iteratee, context);
+ var i, length;
+ if (isArrayLike(obj)) {
+ for (i = 0, length = obj.length; i < length; i++) {
+ iteratee(obj[i], i, obj);
+ }
+ } else {
+ var keys = _.keys(obj);
+ for (i = 0, length = keys.length; i < length; i++) {
+ iteratee(obj[keys[i]], keys[i], obj);
+ }
+ }
+ return obj;
+ };
+
+ // Return the results of applying the iteratee to each element.
+ _.map = _.collect = function(obj, iteratee, context) {
+ iteratee = cb(iteratee, context);
+ var keys = !isArrayLike(obj) && _.keys(obj),
+ length = (keys || obj).length,
+ results = Array(length);
+ for (var index = 0; index < length; index++) {
+ var currentKey = keys ? keys[index] : index;
+ results[index] = iteratee(obj[currentKey], currentKey, obj);
+ }
+ return results;
+ };
+
+ // Create a reducing function iterating left or right.
+ function createReduce(dir) {
+ // Optimized iterator function as using arguments.length
+ // in the main function will deoptimize the, see #1991.
+ function iterator(obj, iteratee, memo, keys, index, length) {
+ for (; index >= 0 && index < length; index += dir) {
+ var currentKey = keys ? keys[index] : index;
+ memo = iteratee(memo, obj[currentKey], currentKey, obj);
+ }
+ return memo;
+ }
+
+ return function(obj, iteratee, memo, context) {
+ iteratee = optimizeCb(iteratee, context, 4);
+ var keys = !isArrayLike(obj) && _.keys(obj),
+ length = (keys || obj).length,
+ index = dir > 0 ? 0 : length - 1;
+ // Determine the initial value if none is provided.
+ if (arguments.length < 3) {
+ memo = obj[keys ? keys[index] : index];
+ index += dir;
+ }
+ return iterator(obj, iteratee, memo, keys, index, length);
+ };
+ }
+
+ // **Reduce** builds up a single result from a list of values, aka `inject`,
+ // or `foldl`.
+ _.reduce = _.foldl = _.inject = createReduce(1);
+
+ // The right-associative version of reduce, also known as `foldr`.
+ _.reduceRight = _.foldr = createReduce(-1);
+
+ // Return the first value which passes a truth test. Aliased as `detect`.
+ _.find = _.detect = function(obj, predicate, context) {
+ var key;
+ if (isArrayLike(obj)) {
+ key = _.findIndex(obj, predicate, context);
+ } else {
+ key = _.findKey(obj, predicate, context);
+ }
+ if (key !== void 0 && key !== -1) return obj[key];
+ };
+
+ // Return all the elements that pass a truth test.
+ // Aliased as `select`.
+ _.filter = _.select = function(obj, predicate, context) {
+ var results = [];
+ predicate = cb(predicate, context);
+ _.each(obj, function(value, index, list) {
+ if (predicate(value, index, list)) results.push(value);
+ });
+ return results;
+ };
+
+ // Return all the elements for which a truth test fails.
+ _.reject = function(obj, predicate, context) {
+ return _.filter(obj, _.negate(cb(predicate)), context);
+ };
+
+ // Determine whether all of the elements match a truth test.
+ // Aliased as `all`.
+ _.every = _.all = function(obj, predicate, context) {
+ predicate = cb(predicate, context);
+ var keys = !isArrayLike(obj) && _.keys(obj),
+ length = (keys || obj).length;
+ for (var index = 0; index < length; index++) {
+ var currentKey = keys ? keys[index] : index;
+ if (!predicate(obj[currentKey], currentKey, obj)) return false;
+ }
+ return true;
+ };
+
+ // Determine if at least one element in the object matches a truth test.
+ // Aliased as `any`.
+ _.some = _.any = function(obj, predicate, context) {
+ predicate = cb(predicate, context);
+ var keys = !isArrayLike(obj) && _.keys(obj),
+ length = (keys || obj).length;
+ for (var index = 0; index < length; index++) {
+ var currentKey = keys ? keys[index] : index;
+ if (predicate(obj[currentKey], currentKey, obj)) return true;
+ }
+ return false;
+ };
+
+ // Determine if the array or object contains a given item (using `===`).
+ // Aliased as `includes` and `include`.
+ _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
+ if (!isArrayLike(obj)) obj = _.values(obj);
+ if (typeof fromIndex != 'number' || guard) fromIndex = 0;
+ return _.indexOf(obj, item, fromIndex) >= 0;
+ };
+
+ // Invoke a method (with arguments) on every item in a collection.
+ _.invoke = function(obj, method) {
+ var args = slice.call(arguments, 2);
+ var isFunc = _.isFunction(method);
+ return _.map(obj, function(value) {
+ var func = isFunc ? method : value[method];
+ return func == null ? func : func.apply(value, args);
+ });
+ };
+
+ // Convenience version of a common use case of `map`: fetching a property.
+ _.pluck = function(obj, key) {
+ return _.map(obj, _.property(key));
+ };
+
+ // Convenience version of a common use case of `filter`: selecting only objects
+ // containing specific `key:value` pairs.
+ _.where = function(obj, attrs) {
+ return _.filter(obj, _.matcher(attrs));
+ };
+
+ // Convenience version of a common use case of `find`: getting the first object
+ // containing specific `key:value` pairs.
+ _.findWhere = function(obj, attrs) {
+ return _.find(obj, _.matcher(attrs));
+ };
+
+ // Return the maximum element (or element-based computation).
+ _.max = function(obj, iteratee, context) {
+ var result = -Infinity, lastComputed = -Infinity,
+ value, computed;
+ if (iteratee == null && obj != null) {
+ obj = isArrayLike(obj) ? obj : _.values(obj);
+ for (var i = 0, length = obj.length; i < length; i++) {
+ value = obj[i];
+ if (value > result) {
+ result = value;
+ }
+ }
+ } else {
+ iteratee = cb(iteratee, context);
+ _.each(obj, function(value, index, list) {
+ computed = iteratee(value, index, list);
+ if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
+ result = value;
+ lastComputed = computed;
+ }
+ });
+ }
+ return result;
+ };
+
+ // Return the minimum element (or element-based computation).
+ _.min = function(obj, iteratee, context) {
+ var result = Infinity, lastComputed = Infinity,
+ value, computed;
+ if (iteratee == null && obj != null) {
+ obj = isArrayLike(obj) ? obj : _.values(obj);
+ for (var i = 0, length = obj.length; i < length; i++) {
+ value = obj[i];
+ if (value < result) {
+ result = value;
+ }
+ }
+ } else {
+ iteratee = cb(iteratee, context);
+ _.each(obj, function(value, index, list) {
+ computed = iteratee(value, index, list);
+ if (computed < lastComputed || computed === Infinity && result === Infinity) {
+ result = value;
+ lastComputed = computed;
+ }
+ });
+ }
+ return result;
+ };
+
+ // Shuffle a collection, using the modern version of the
+ // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
+ _.shuffle = function(obj) {
+ var set = isArrayLike(obj) ? obj : _.values(obj);
+ var length = set.length;
+ var shuffled = Array(length);
+ for (var index = 0, rand; index < length; index++) {
+ rand = _.random(0, index);
+ if (rand !== index) shuffled[index] = shuffled[rand];
+ shuffled[rand] = set[index];
+ }
+ return shuffled;
+ };
+
+ // Sample **n** random values from a collection.
+ // If **n** is not specified, returns a single random element.
+ // The internal `guard` argument allows it to work with `map`.
+ _.sample = function(obj, n, guard) {
+ if (n == null || guard) {
+ if (!isArrayLike(obj)) obj = _.values(obj);
+ return obj[_.random(obj.length - 1)];
+ }
+ return _.shuffle(obj).slice(0, Math.max(0, n));
+ };
+
+ // Sort the object's values by a criterion produced by an iteratee.
+ _.sortBy = function(obj, iteratee, context) {
+ iteratee = cb(iteratee, context);
+ return _.pluck(_.map(obj, function(value, index, list) {
+ return {
+ value: value,
+ index: index,
+ criteria: iteratee(value, index, list)
+ };
+ }).sort(function(left, right) {
+ var a = left.criteria;
+ var b = right.criteria;
+ if (a !== b) {
+ if (a > b || a === void 0) return 1;
+ if (a < b || b === void 0) return -1;
+ }
+ return left.index - right.index;
+ }), 'value');
+ };
+
+ // An internal function used for aggregate "group by" operations.
+ var group = function(behavior) {
+ return function(obj, iteratee, context) {
+ var result = {};
+ iteratee = cb(iteratee, context);
+ _.each(obj, function(value, index) {
+ var key = iteratee(value, index, obj);
+ behavior(result, value, key);
+ });
+ return result;
+ };
+ };
+
+ // Groups the object's values by a criterion. Pass either a string attribute
+ // to group by, or a function that returns the criterion.
+ _.groupBy = group(function(result, value, key) {
+ if (_.has(result, key)) result[key].push(value); else result[key] = [value];
+ });
+
+ // Indexes the object's values by a criterion, similar to `groupBy`, but for
+ // when you know that your index values will be unique.
+ _.indexBy = group(function(result, value, key) {
+ result[key] = value;
+ });
+
+ // Counts instances of an object that group by a certain criterion. Pass
+ // either a string attribute to count by, or a function that returns the
+ // criterion.
+ _.countBy = group(function(result, value, key) {
+ if (_.has(result, key)) result[key]++; else result[key] = 1;
+ });
+
+ // Safely create a real, live array from anything iterable.
+ _.toArray = function(obj) {
+ if (!obj) return [];
+ if (_.isArray(obj)) return slice.call(obj);
+ if (isArrayLike(obj)) return _.map(obj, _.identity);
+ return _.values(obj);
+ };
+
+ // Return the number of elements in an object.
+ _.size = function(obj) {
+ if (obj == null) return 0;
+ return isArrayLike(obj) ? obj.length : _.keys(obj).length;
+ };
+
+ // Split a collection into two arrays: one whose elements all satisfy the given
+ // predicate, and one whose elements all do not satisfy the predicate.
+ _.partition = function(obj, predicate, context) {
+ predicate = cb(predicate, context);
+ var pass = [], fail = [];
+ _.each(obj, function(value, key, obj) {
+ (predicate(value, key, obj) ? pass : fail).push(value);
+ });
+ return [pass, fail];
+ };
+
+ // Array Functions
+ // ---------------
+
+ // Get the first element of an array. Passing **n** will return the first N
+ // values in the array. Aliased as `head` and `take`. The **guard** check
+ // allows it to work with `_.map`.
+ _.first = _.head = _.take = function(array, n, guard) {
+ if (array == null) return void 0;
+ if (n == null || guard) return array[0];
+ return _.initial(array, array.length - n);
+ };
+
+ // Returns everything but the last entry of the array. Especially useful on
+ // the arguments object. Passing **n** will return all the values in
+ // the array, excluding the last N.
+ _.initial = function(array, n, guard) {
+ return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
+ };
+
+ // Get the last element of an array. Passing **n** will return the last N
+ // values in the array.
+ _.last = function(array, n, guard) {
+ if (array == null) return void 0;
+ if (n == null || guard) return array[array.length - 1];
+ return _.rest(array, Math.max(0, array.length - n));
+ };
+
+ // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
+ // Especially useful on the arguments object. Passing an **n** will return
+ // the rest N values in the array.
+ _.rest = _.tail = _.drop = function(array, n, guard) {
+ return slice.call(array, n == null || guard ? 1 : n);
+ };
+
+ // Trim out all falsy values from an array.
+ _.compact = function(array) {
+ return _.filter(array, _.identity);
+ };
+
+ // Internal implementation of a recursive `flatten` function.
+ var flatten = function(input, shallow, strict, startIndex) {
+ var output = [], idx = 0;
+ for (var i = startIndex || 0, length = getLength(input); i < length; i++) {
+ var value = input[i];
+ if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
+ //flatten current level of array or arguments object
+ if (!shallow) value = flatten(value, shallow, strict);
+ var j = 0, len = value.length;
+ output.length += len;
+ while (j < len) {
+ output[idx++] = value[j++];
+ }
+ } else if (!strict) {
+ output[idx++] = value;
+ }
+ }
+ return output;
+ };
+
+ // Flatten out an array, either recursively (by default), or just one level.
+ _.flatten = function(array, shallow) {
+ return flatten(array, shallow, false);
+ };
+
+ // Return a version of the array that does not contain the specified value(s).
+ _.without = function(array) {
+ return _.difference(array, slice.call(arguments, 1));
+ };
+
+ // Produce a duplicate-free version of the array. If the array has already
+ // been sorted, you have the option of using a faster algorithm.
+ // Aliased as `unique`.
+ _.uniq = _.unique = function(array, isSorted, iteratee, context) {
+ if (!_.isBoolean(isSorted)) {
+ context = iteratee;
+ iteratee = isSorted;
+ isSorted = false;
+ }
+ if (iteratee != null) iteratee = cb(iteratee, context);
+ var result = [];
+ var seen = [];
+ for (var i = 0, length = getLength(array); i < length; i++) {
+ var value = array[i],
+ computed = iteratee ? iteratee(value, i, array) : value;
+ if (isSorted) {
+ if (!i || seen !== computed) result.push(value);
+ seen = computed;
+ } else if (iteratee) {
+ if (!_.contains(seen, computed)) {
+ seen.push(computed);
+ result.push(value);
+ }
+ } else if (!_.contains(result, value)) {
+ result.push(value);
+ }
+ }
+ return result;
+ };
+
+ // Produce an array that contains the union: each distinct element from all of
+ // the passed-in arrays.
+ _.union = function() {
+ return _.uniq(flatten(arguments, true, true));
+ };
+
+ // Produce an array that contains every item shared between all the
+ // passed-in arrays.
+ _.intersection = function(array) {
+ var result = [];
+ var argsLength = arguments.length;
+ for (var i = 0, length = getLength(array); i < length; i++) {
+ var item = array[i];
+ if (_.contains(result, item)) continue;
+ for (var j = 1; j < argsLength; j++) {
+ if (!_.contains(arguments[j], item)) break;
+ }
+ if (j === argsLength) result.push(item);
+ }
+ return result;
+ };
+
+ // Take the difference between one array and a number of other arrays.
+ // Only the elements present in just the first array will remain.
+ _.difference = function(array) {
+ var rest = flatten(arguments, true, true, 1);
+ return _.filter(array, function(value){
+ return !_.contains(rest, value);
+ });
+ };
+
+ // Zip together multiple lists into a single array -- elements that share
+ // an index go together.
+ _.zip = function() {
+ return _.unzip(arguments);
+ };
+
+ // Complement of _.zip. Unzip accepts an array of arrays and groups
+ // each array's elements on shared indices
+ _.unzip = function(array) {
+ var length = array && _.max(array, getLength).length || 0;
+ var result = Array(length);
+
+ for (var index = 0; index < length; index++) {
+ result[index] = _.pluck(array, index);
+ }
+ return result;
+ };
+
+ // Converts lists into objects. Pass either a single array of `[key, value]`
+ // pairs, or two parallel arrays of the same length -- one of keys, and one of
+ // the corresponding values.
+ _.object = function(list, values) {
+ var result = {};
+ for (var i = 0, length = getLength(list); i < length; i++) {
+ if (values) {
+ result[list[i]] = values[i];
+ } else {
+ result[list[i][0]] = list[i][1];
+ }
+ }
+ return result;
+ };
+
+ // Generator function to create the findIndex and findLastIndex functions
+ function createPredicateIndexFinder(dir) {
+ return function(array, predicate, context) {
+ predicate = cb(predicate, context);
+ var length = getLength(array);
+ var index = dir > 0 ? 0 : length - 1;
+ for (; index >= 0 && index < length; index += dir) {
+ if (predicate(array[index], index, array)) return index;
+ }
+ return -1;
+ };
+ }
+
+ // Returns the first index on an array-like that passes a predicate test
+ _.findIndex = createPredicateIndexFinder(1);
+ _.findLastIndex = createPredicateIndexFinder(-1);
+
+ // Use a comparator function to figure out the smallest index at which
+ // an object should be inserted so as to maintain order. Uses binary search.
+ _.sortedIndex = function(array, obj, iteratee, context) {
+ iteratee = cb(iteratee, context, 1);
+ var value = iteratee(obj);
+ var low = 0, high = getLength(array);
+ while (low < high) {
+ var mid = Math.floor((low + high) / 2);
+ if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
+ }
+ return low;
+ };
+
+ // Generator function to create the indexOf and lastIndexOf functions
+ function createIndexFinder(dir, predicateFind, sortedIndex) {
+ return function(array, item, idx) {
+ var i = 0, length = getLength(array);
+ if (typeof idx == 'number') {
+ if (dir > 0) {
+ i = idx >= 0 ? idx : Math.max(idx + length, i);
+ } else {
+ length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
+ }
+ } else if (sortedIndex && idx && length) {
+ idx = sortedIndex(array, item);
+ return array[idx] === item ? idx : -1;
+ }
+ if (item !== item) {
+ idx = predicateFind(slice.call(array, i, length), _.isNaN);
+ return idx >= 0 ? idx + i : -1;
+ }
+ for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
+ if (array[idx] === item) return idx;
+ }
+ return -1;
+ };
+ }
+
+ // Return the position of the first occurrence of an item in an array,
+ // or -1 if the item is not included in the array.
+ // If the array is large and already in sort order, pass `true`
+ // for **isSorted** to use binary search.
+ _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
+ _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);
+
+ // Generate an integer Array containing an arithmetic progression. A port of
+ // the native Python `range()` function. See
+ // [the Python documentation](http://docs.python.org/library/functions.html#range).
+ _.range = function(start, stop, step) {
+ if (stop == null) {
+ stop = start || 0;
+ start = 0;
+ }
+ step = step || 1;
+
+ var length = Math.max(Math.ceil((stop - start) / step), 0);
+ var range = Array(length);
+
+ for (var idx = 0; idx < length; idx++, start += step) {
+ range[idx] = start;
+ }
+
+ return range;
+ };
+
+ // Function (ahem) Functions
+ // ------------------
+
+ // Determines whether to execute a function as a constructor
+ // or a normal function with the provided arguments
+ var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {
+ if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
+ var self = baseCreate(sourceFunc.prototype);
+ var result = sourceFunc.apply(self, args);
+ if (_.isObject(result)) return result;
+ return self;
+ };
+
+ // Create a function bound to a given object (assigning `this`, and arguments,
+ // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
+ // available.
+ _.bind = function(func, context) {
+ if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
+ if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
+ var args = slice.call(arguments, 2);
+ var bound = function() {
+ return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
+ };
+ return bound;
+ };
+
+ // Partially apply a function by creating a version that has had some of its
+ // arguments pre-filled, without changing its dynamic `this` context. _ acts
+ // as a placeholder, allowing any combination of arguments to be pre-filled.
+ _.partial = function(func) {
+ var boundArgs = slice.call(arguments, 1);
+ var bound = function() {
+ var position = 0, length = boundArgs.length;
+ var args = Array(length);
+ for (var i = 0; i < length; i++) {
+ args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];
+ }
+ while (position < arguments.length) args.push(arguments[position++]);
+ return executeBound(func, bound, this, this, args);
+ };
+ return bound;
+ };
+
+ // Bind a number of an object's methods to that object. Remaining arguments
+ // are the method names to be bound. Useful for ensuring that all callbacks
+ // defined on an object belong to it.
+ _.bindAll = function(obj) {
+ var i, length = arguments.length, key;
+ if (length <= 1) throw new Error('bindAll must be passed function names');
+ for (i = 1; i < length; i++) {
+ key = arguments[i];
+ obj[key] = _.bind(obj[key], obj);
+ }
+ return obj;
+ };
+
+ // Memoize an expensive function by storing its results.
+ _.memoize = function(func, hasher) {
+ var memoize = function(key) {
+ var cache = memoize.cache;
+ var address = '' + (hasher ? hasher.apply(this, arguments) : key);
+ if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
+ return cache[address];
+ };
+ memoize.cache = {};
+ return memoize;
+ };
+
+ // Delays a function for the given number of milliseconds, and then calls
+ // it with the arguments supplied.
+ _.delay = function(func, wait) {
+ var args = slice.call(arguments, 2);
+ return setTimeout(function(){
+ return func.apply(null, args);
+ }, wait);
+ };
+
+ // Defers a function, scheduling it to run after the current call stack has
+ // cleared.
+ _.defer = _.partial(_.delay, _, 1);
+
+ // Returns a function, that, when invoked, will only be triggered at most once
+ // during a given window of time. Normally, the throttled function will run
+ // as much as it can, without ever going more than once per `wait` duration;
+ // but if you'd like to disable the execution on the leading edge, pass
+ // `{leading: false}`. To disable execution on the trailing edge, ditto.
+ _.throttle = function(func, wait, options) {
+ var context, args, result;
+ var timeout = null;
+ var previous = 0;
+ if (!options) options = {};
+ var later = function() {
+ previous = options.leading === false ? 0 : _.now();
+ timeout = null;
+ result = func.apply(context, args);
+ if (!timeout) context = args = null;
+ };
+ return function() {
+ var now = _.now();
+ if (!previous && options.leading === false) previous = now;
+ var remaining = wait - (now - previous);
+ context = this;
+ args = arguments;
+ if (remaining <= 0 || remaining > wait) {
+ if (timeout) {
+ clearTimeout(timeout);
+ timeout = null;
+ }
+ previous = now;
+ result = func.apply(context, args);
+ if (!timeout) context = args = null;
+ } else if (!timeout && options.trailing !== false) {
+ timeout = setTimeout(later, remaining);
+ }
+ return result;
+ };
+ };
+
+ // Returns a function, that, as long as it continues to be invoked, will not
+ // be triggered. The function will be called after it stops being called for
+ // N milliseconds. If `immediate` is passed, trigger the function on the
+ // leading edge, instead of the trailing.
+ _.debounce = function(func, wait, immediate) {
+ var timeout, args, context, timestamp, result;
+
+ var later = function() {
+ var last = _.now() - timestamp;
+
+ if (last < wait && last >= 0) {
+ timeout = setTimeout(later, wait - last);
+ } else {
+ timeout = null;
+ if (!immediate) {
+ result = func.apply(context, args);
+ if (!timeout) context = args = null;
+ }
+ }
+ };
+
+ return function() {
+ context = this;
+ args = arguments;
+ timestamp = _.now();
+ var callNow = immediate && !timeout;
+ if (!timeout) timeout = setTimeout(later, wait);
+ if (callNow) {
+ result = func.apply(context, args);
+ context = args = null;
+ }
+
+ return result;
+ };
+ };
+
+ // Returns the first function passed as an argument to the second,
+ // allowing you to adjust arguments, run code before and after, and
+ // conditionally execute the original function.
+ _.wrap = function(func, wrapper) {
+ return _.partial(wrapper, func);
+ };
+
+ // Returns a negated version of the passed-in predicate.
+ _.negate = function(predicate) {
+ return function() {
+ return !predicate.apply(this, arguments);
+ };
+ };
+
+ // Returns a function that is the composition of a list of functions, each
+ // consuming the return value of the function that follows.
+ _.compose = function() {
+ var args = arguments;
+ var start = args.length - 1;
+ return function() {
+ var i = start;
+ var result = args[start].apply(this, arguments);
+ while (i--) result = args[i].call(this, result);
+ return result;
+ };
+ };
+
+ // Returns a function that will only be executed on and after the Nth call.
+ _.after = function(times, func) {
+ return function() {
+ if (--times < 1) {
+ return func.apply(this, arguments);
+ }
+ };
+ };
+
+ // Returns a function that will only be executed up to (but not including) the Nth call.
+ _.before = function(times, func) {
+ var memo;
+ return function() {
+ if (--times > 0) {
+ memo = func.apply(this, arguments);
+ }
+ if (times <= 1) func = null;
+ return memo;
+ };
+ };
+
+ // Returns a function that will be executed at most one time, no matter how
+ // often you call it. Useful for lazy initialization.
+ _.once = _.partial(_.before, 2);
+
+ // Object Functions
+ // ----------------
+
+ // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
+ var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
+ var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
+ 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
+
+ function collectNonEnumProps(obj, keys) {
+ var nonEnumIdx = nonEnumerableProps.length;
+ var constructor = obj.constructor;
+ var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;
+
+ // Constructor is a special case.
+ var prop = 'constructor';
+ if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
+
+ while (nonEnumIdx--) {
+ prop = nonEnumerableProps[nonEnumIdx];
+ if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
+ keys.push(prop);
+ }
+ }
+ }
+
+ // Retrieve the names of an object's own properties.
+ // Delegates to **ECMAScript 5**'s native `Object.keys`
+ _.keys = function(obj) {
+ if (!_.isObject(obj)) return [];
+ if (nativeKeys) return nativeKeys(obj);
+ var keys = [];
+ for (var key in obj) if (_.has(obj, key)) keys.push(key);
+ // Ahem, IE < 9.
+ if (hasEnumBug) collectNonEnumProps(obj, keys);
+ return keys;
+ };
+
+ // Retrieve all the property names of an object.
+ _.allKeys = function(obj) {
+ if (!_.isObject(obj)) return [];
+ var keys = [];
+ for (var key in obj) keys.push(key);
+ // Ahem, IE < 9.
+ if (hasEnumBug) collectNonEnumProps(obj, keys);
+ return keys;
+ };
+
+ // Retrieve the values of an object's properties.
+ _.values = function(obj) {
+ var keys = _.keys(obj);
+ var length = keys.length;
+ var values = Array(length);
+ for (var i = 0; i < length; i++) {
+ values[i] = obj[keys[i]];
+ }
+ return values;
+ };
+
+ // Returns the results of applying the iteratee to each element of the object
+ // In contrast to _.map it returns an object
+ _.mapObject = function(obj, iteratee, context) {
+ iteratee = cb(iteratee, context);
+ var keys = _.keys(obj),
+ length = keys.length,
+ results = {},
+ currentKey;
+ for (var index = 0; index < length; index++) {
+ currentKey = keys[index];
+ results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
+ }
+ return results;
+ };
+
+ // Convert an object into a list of `[key, value]` pairs.
+ _.pairs = function(obj) {
+ var keys = _.keys(obj);
+ var length = keys.length;
+ var pairs = Array(length);
+ for (var i = 0; i < length; i++) {
+ pairs[i] = [keys[i], obj[keys[i]]];
+ }
+ return pairs;
+ };
+
+ // Invert the keys and values of an object. The values must be serializable.
+ _.invert = function(obj) {
+ var result = {};
+ var keys = _.keys(obj);
+ for (var i = 0, length = keys.length; i < length; i++) {
+ result[obj[keys[i]]] = keys[i];
+ }
+ return result;
+ };
+
+ // Return a sorted list of the function names available on the object.
+ // Aliased as `methods`
+ _.functions = _.methods = function(obj) {
+ var names = [];
+ for (var key in obj) {
+ if (_.isFunction(obj[key])) names.push(key);
+ }
+ return names.sort();
+ };
+
+ // Extend a given object with all the properties in passed-in object(s).
+ _.extend = createAssigner(_.allKeys);
+
+ // Assigns a given object with all the own properties in the passed-in object(s)
+ // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
+ _.extendOwn = _.assign = createAssigner(_.keys);
+
+ // Returns the first key on an object that passes a predicate test
+ _.findKey = function(obj, predicate, context) {
+ predicate = cb(predicate, context);
+ var keys = _.keys(obj), key;
+ for (var i = 0, length = keys.length; i < length; i++) {
+ key = keys[i];
+ if (predicate(obj[key], key, obj)) return key;
+ }
+ };
+
+ // Return a copy of the object only containing the whitelisted properties.
+ _.pick = function(object, oiteratee, context) {
+ var result = {}, obj = object, iteratee, keys;
+ if (obj == null) return result;
+ if (_.isFunction(oiteratee)) {
+ keys = _.allKeys(obj);
+ iteratee = optimizeCb(oiteratee, context);
+ } else {
+ keys = flatten(arguments, false, false, 1);
+ iteratee = function(value, key, obj) { return key in obj; };
+ obj = Object(obj);
+ }
+ for (var i = 0, length = keys.length; i < length; i++) {
+ var key = keys[i];
+ var value = obj[key];
+ if (iteratee(value, key, obj)) result[key] = value;
+ }
+ return result;
+ };
+
+ // Return a copy of the object without the blacklisted properties.
+ _.omit = function(obj, iteratee, context) {
+ if (_.isFunction(iteratee)) {
+ iteratee = _.negate(iteratee);
+ } else {
+ var keys = _.map(flatten(arguments, false, false, 1), String);
+ iteratee = function(value, key) {
+ return !_.contains(keys, key);
+ };
+ }
+ return _.pick(obj, iteratee, context);
+ };
+
+ // Fill in a given object with default properties.
+ _.defaults = createAssigner(_.allKeys, true);
+
+ // Creates an object that inherits from the given prototype object.
+ // If additional properties are provided then they will be added to the
+ // created object.
+ _.create = function(prototype, props) {
+ var result = baseCreate(prototype);
+ if (props) _.extendOwn(result, props);
+ return result;
+ };
+
+ // Create a (shallow-cloned) duplicate of an object.
+ _.clone = function(obj) {
+ if (!_.isObject(obj)) return obj;
+ return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
+ };
+
+ // Invokes interceptor with the obj, and then returns obj.
+ // The primary purpose of this method is to "tap into" a method chain, in
+ // order to perform operations on intermediate results within the chain.
+ _.tap = function(obj, interceptor) {
+ interceptor(obj);
+ return obj;
+ };
+
+ // Returns whether an object has a given set of `key:value` pairs.
+ _.isMatch = function(object, attrs) {
+ var keys = _.keys(attrs), length = keys.length;
+ if (object == null) return !length;
+ var obj = Object(object);
+ for (var i = 0; i < length; i++) {
+ var key = keys[i];
+ if (attrs[key] !== obj[key] || !(key in obj)) return false;
+ }
+ return true;
+ };
+
+
+ // Internal recursive comparison function for `isEqual`.
+ var eq = function(a, b, aStack, bStack) {
+ // Identical objects are equal. `0 === -0`, but they aren't identical.
+ // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
+ if (a === b) return a !== 0 || 1 / a === 1 / b;
+ // A strict comparison is necessary because `null == undefined`.
+ if (a == null || b == null) return a === b;
+ // Unwrap any wrapped objects.
+ if (a instanceof _) a = a._wrapped;
+ if (b instanceof _) b = b._wrapped;
+ // Compare `[[Class]]` names.
+ var className = toString.call(a);
+ if (className !== toString.call(b)) return false;
+ switch (className) {
+ // Strings, numbers, regular expressions, dates, and booleans are compared by value.
+ case '[object RegExp]':
+ // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
+ case '[object String]':
+ // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+ // equivalent to `new String("5")`.
+ return '' + a === '' + b;
+ case '[object Number]':
+ // `NaN`s are equivalent, but non-reflexive.
+ // Object(NaN) is equivalent to NaN
+ if (+a !== +a) return +b !== +b;
+ // An `egal` comparison is performed for other numeric values.
+ return +a === 0 ? 1 / +a === 1 / b : +a === +b;
+ case '[object Date]':
+ case '[object Boolean]':
+ // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+ // millisecond representations. Note that invalid dates with millisecond representations
+ // of `NaN` are not equivalent.
+ return +a === +b;
+ }
+
+ var areArrays = className === '[object Array]';
+ if (!areArrays) {
+ if (typeof a != 'object' || typeof b != 'object') return false;
+
+ // Objects with different constructors are not equivalent, but `Object`s or `Array`s
+ // from different frames are.
+ var aCtor = a.constructor, bCtor = b.constructor;
+ if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
+ _.isFunction(bCtor) && bCtor instanceof bCtor)
+ && ('constructor' in a && 'constructor' in b)) {
+ return false;
+ }
+ }
+ // Assume equality for cyclic structures. The algorithm for detecting cyclic
+ // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+
+ // Initializing stack of traversed objects.
+ // It's done here since we only need them for objects and arrays comparison.
+ aStack = aStack || [];
+ bStack = bStack || [];
+ var length = aStack.length;
+ while (length--) {
+ // Linear search. Performance is inversely proportional to the number of
+ // unique nested structures.
+ if (aStack[length] === a) return bStack[length] === b;
+ }
+
+ // Add the first object to the stack of traversed objects.
+ aStack.push(a);
+ bStack.push(b);
+
+ // Recursively compare objects and arrays.
+ if (areArrays) {
+ // Compare array lengths to determine if a deep comparison is necessary.
+ length = a.length;
+ if (length !== b.length) return false;
+ // Deep compare the contents, ignoring non-numeric properties.
+ while (length--) {
+ if (!eq(a[length], b[length], aStack, bStack)) return false;
+ }
+ } else {
+ // Deep compare objects.
+ var keys = _.keys(a), key;
+ length = keys.length;
+ // Ensure that both objects contain the same number of properties before comparing deep equality.
+ if (_.keys(b).length !== length) return false;
+ while (length--) {
+ // Deep compare each member
+ key = keys[length];
+ if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
+ }
+ }
+ // Remove the first object from the stack of traversed objects.
+ aStack.pop();
+ bStack.pop();
+ return true;
+ };
+
+ // Perform a deep comparison to check if two objects are equal.
+ _.isEqual = function(a, b) {
+ return eq(a, b);
+ };
+
+ // Is a given array, string, or object empty?
+ // An "empty" object has no enumerable own-properties.
+ _.isEmpty = function(obj) {
+ if (obj == null) return true;
+ if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
+ return _.keys(obj).length === 0;
+ };
+
+ // Is a given value a DOM element?
+ _.isElement = function(obj) {
+ return !!(obj && obj.nodeType === 1);
+ };
+
+ // Is a given value an array?
+ // Delegates to ECMA5's native Array.isArray
+ _.isArray = nativeIsArray || function(obj) {
+ return toString.call(obj) === '[object Array]';
+ };
+
+ // Is a given variable an object?
+ _.isObject = function(obj) {
+ var type = typeof obj;
+ return type === 'function' || type === 'object' && !!obj;
+ };
+
+ // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
+ _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {
+ _['is' + name] = function(obj) {
+ return toString.call(obj) === '[object ' + name + ']';
+ };
+ });
+
+ // Define a fallback version of the method in browsers (ahem, IE < 9), where
+ // there isn't any inspectable "Arguments" type.
+ if (!_.isArguments(arguments)) {
+ _.isArguments = function(obj) {
+ return _.has(obj, 'callee');
+ };
+ }
+
+ // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
+ // IE 11 (#1621), and in Safari 8 (#1929).
+ if (typeof /./ != 'function' && typeof Int8Array != 'object') {
+ _.isFunction = function(obj) {
+ return typeof obj == 'function' || false;
+ };
+ }
+
+ // Is a given object a finite number?
+ _.isFinite = function(obj) {
+ return isFinite(obj) && !isNaN(parseFloat(obj));
+ };
+
+ // Is the given value `NaN`? (NaN is the only number which does not equal itself).
+ _.isNaN = function(obj) {
+ return _.isNumber(obj) && obj !== +obj;
+ };
+
+ // Is a given value a boolean?
+ _.isBoolean = function(obj) {
+ return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
+ };
+
+ // Is a given value equal to null?
+ _.isNull = function(obj) {
+ return obj === null;
+ };
+
+ // Is a given variable undefined?
+ _.isUndefined = function(obj) {
+ return obj === void 0;
+ };
+
+ // Shortcut function for checking if an object has a given property directly
+ // on itself (in other words, not on a prototype).
+ _.has = function(obj, key) {
+ return obj != null && hasOwnProperty.call(obj, key);
+ };
+
+ // Utility Functions
+ // -----------------
+
+ // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
+ // previous owner. Returns a reference to the Underscore object.
+ _.noConflict = function() {
+ root._ = previousUnderscore;
+ return this;
+ };
+
+ // Keep the identity function around for default iteratees.
+ _.identity = function(value) {
+ return value;
+ };
+
+ // Predicate-generating functions. Often useful outside of Underscore.
+ _.constant = function(value) {
+ return function() {
+ return value;
+ };
+ };
+
+ _.noop = function(){};
+
+ _.property = property;
+
+ // Generates a function for a given object that returns a given property.
+ _.propertyOf = function(obj) {
+ return obj == null ? function(){} : function(key) {
+ return obj[key];
+ };
+ };
+
+ // Returns a predicate for checking whether an object has a given set of
+ // `key:value` pairs.
+ _.matcher = _.matches = function(attrs) {
+ attrs = _.extendOwn({}, attrs);
+ return function(obj) {
+ return _.isMatch(obj, attrs);
+ };
+ };
+
+ // Run a function **n** times.
+ _.times = function(n, iteratee, context) {
+ var accum = Array(Math.max(0, n));
+ iteratee = optimizeCb(iteratee, context, 1);
+ for (var i = 0; i < n; i++) accum[i] = iteratee(i);
+ return accum;
+ };
+
+ // Return a random integer between min and max (inclusive).
+ _.random = function(min, max) {
+ if (max == null) {
+ max = min;
+ min = 0;
+ }
+ return min + Math.floor(Math.random() * (max - min + 1));
+ };
+
+ // A (possibly faster) way to get the current timestamp as an integer.
+ _.now = Date.now || function() {
+ return new Date().getTime();
+ };
+
+ // List of HTML entities for escaping.
+ var escapeMap = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": ''',
+ '`': '`'
+ };
+ var unescapeMap = _.invert(escapeMap);
+
+ // Functions for escaping and unescaping strings to/from HTML interpolation.
+ var createEscaper = function(map) {
+ var escaper = function(match) {
+ return map[match];
+ };
+ // Regexes for identifying a key that needs to be escaped
+ var source = '(?:' + _.keys(map).join('|') + ')';
+ var testRegexp = RegExp(source);
+ var replaceRegexp = RegExp(source, 'g');
+ return function(string) {
+ string = string == null ? '' : '' + string;
+ return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
+ };
+ };
+ _.escape = createEscaper(escapeMap);
+ _.unescape = createEscaper(unescapeMap);
+
+ // If the value of the named `property` is a function then invoke it with the
+ // `object` as context; otherwise, return it.
+ _.result = function(object, property, fallback) {
+ var value = object == null ? void 0 : object[property];
+ if (value === void 0) {
+ value = fallback;
+ }
+ return _.isFunction(value) ? value.call(object) : value;
+ };
+
+ // Generate a unique integer id (unique within the entire client session).
+ // Useful for temporary DOM ids.
+ var idCounter = 0;
+ _.uniqueId = function(prefix) {
+ var id = ++idCounter + '';
+ return prefix ? prefix + id : id;
+ };
+
+ // By default, Underscore uses ERB-style template delimiters, change the
+ // following template settings to use alternative delimiters.
+ _.templateSettings = {
+ evaluate : /<%([\s\S]+?)%>/g,
+ interpolate : /<%=([\s\S]+?)%>/g,
+ escape : /<%-([\s\S]+?)%>/g
+ };
+
+ // When customizing `templateSettings`, if you don't want to define an
+ // interpolation, evaluation or escaping regex, we need one that is
+ // guaranteed not to match.
+ var noMatch = /(.)^/;
+
+ // Certain characters need to be escaped so that they can be put into a
+ // string literal.
+ var escapes = {
+ "'": "'",
+ '\\': '\\',
+ '\r': 'r',
+ '\n': 'n',
+ '\u2028': 'u2028',
+ '\u2029': 'u2029'
+ };
+
+ var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
+
+ var escapeChar = function(match) {
+ return '\\' + escapes[match];
+ };
+
+ // JavaScript micro-templating, similar to John Resig's implementation.
+ // Underscore templating handles arbitrary delimiters, preserves whitespace,
+ // and correctly escapes quotes within interpolated code.
+ // NB: `oldSettings` only exists for backwards compatibility.
+ _.template = function(text, settings, oldSettings) {
+ if (!settings && oldSettings) settings = oldSettings;
+ settings = _.defaults({}, settings, _.templateSettings);
+
+ // Combine delimiters into one regular expression via alternation.
+ var matcher = RegExp([
+ (settings.escape || noMatch).source,
+ (settings.interpolate || noMatch).source,
+ (settings.evaluate || noMatch).source
+ ].join('|') + '|$', 'g');
+
+ // Compile the template source, escaping string literals appropriately.
+ var index = 0;
+ var source = "__p+='";
+ text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
+ source += text.slice(index, offset).replace(escaper, escapeChar);
+ index = offset + match.length;
+
+ if (escape) {
+ source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
+ } else if (interpolate) {
+ source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
+ } else if (evaluate) {
+ source += "';\n" + evaluate + "\n__p+='";
+ }
+
+ // Adobe VMs need the match returned to produce the correct offest.
+ return match;
+ });
+ source += "';\n";
+
+ // If a variable is not specified, place data values in local scope.
+ if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
+
+ source = "var __t,__p='',__j=Array.prototype.join," +
+ "print=function(){__p+=__j.call(arguments,'');};\n" +
+ source + 'return __p;\n';
+
+ try {
+ var render = new Function(settings.variable || 'obj', '_', source);
+ } catch (e) {
+ e.source = source;
+ throw e;
+ }
+
+ var template = function(data) {
+ return render.call(this, data, _);
+ };
+
+ // Provide the compiled source as a convenience for precompilation.
+ var argument = settings.variable || 'obj';
+ template.source = 'function(' + argument + '){\n' + source + '}';
+
+ return template;
+ };
+
+ // Add a "chain" function. Start chaining a wrapped Underscore object.
+ _.chain = function(obj) {
+ var instance = _(obj);
+ instance._chain = true;
+ return instance;
+ };
+
+ // OOP
+ // ---------------
+ // If Underscore is called as a function, it returns a wrapped object that
+ // can be used OO-style. This wrapper holds altered versions of all the
+ // underscore functions. Wrapped objects may be chained.
+
+ // Helper function to continue chaining intermediate results.
+ var result = function(instance, obj) {
+ return instance._chain ? _(obj).chain() : obj;
+ };
+
+ // Add your own custom functions to the Underscore object.
+ _.mixin = function(obj) {
+ _.each(_.functions(obj), function(name) {
+ var func = _[name] = obj[name];
+ _.prototype[name] = function() {
+ var args = [this._wrapped];
+ push.apply(args, arguments);
+ return result(this, func.apply(_, args));
+ };
+ });
+ };
+
+ // Add all of the Underscore functions to the wrapper object.
+ _.mixin(_);
+
+ // Add all mutator Array functions to the wrapper.
+ _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
+ var method = ArrayProto[name];
+ _.prototype[name] = function() {
+ var obj = this._wrapped;
+ method.apply(obj, arguments);
+ if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
+ return result(this, obj);
+ };
+ });
+
+ // Add all accessor Array functions to the wrapper.
+ _.each(['concat', 'join', 'slice'], function(name) {
+ var method = ArrayProto[name];
+ _.prototype[name] = function() {
+ return result(this, method.apply(this._wrapped, arguments));
+ };
+ });
+
+ // Extracts the result from a wrapped and chained object.
+ _.prototype.value = function() {
+ return this._wrapped;
+ };
+
+ // Provide unwrapping proxy for some methods used in engine operations
+ // such as arithmetic and JSON stringification.
+ _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
+
+ _.prototype.toString = function() {
+ return '' + this._wrapped;
+ };
+
+ // AMD registration happens at the end for compatibility with AMD loaders
+ // that may not enforce next-turn semantics on modules. Even though general
+ // practice for AMD registration is to be anonymous, underscore registers
+ // as a named module because, like jQuery, it is a base library that is
+ // popular enough to be bundled in a third party lib, but not be part of
+ // an AMD load request. Those cases could generate an error when an
+ // anonymous define() is called outside of a loader request.
+ if (typeof define === 'function' && define.amd) {
+ define('underscore', [], function() {
+ return _;
+ });
+ }
+}.call(this));
+});
+
/*jshint -W051:true */
/*global global:true, window, require */
'use strict';
diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/scripts.html.part b/js/apps/system/_admin/aardvark/APP/frontend/build/scripts.html.part
index 49b213a0a3..89973ca9b1 100644
--- a/js/apps/system/_admin/aardvark/APP/frontend/build/scripts.html.part
+++ b/js/apps/system/_admin/aardvark/APP/frontend/build/scripts.html.part
@@ -1,3 +1,3 @@
-
-
-
+
+
+
diff --git a/js/apps/system/_admin/aardvark/APP/frontend/build/standalone-min.html b/js/apps/system/_admin/aardvark/APP/frontend/build/standalone-min.html
index 689a39bc1f..399173d0f1 100644
--- a/js/apps/system/_admin/aardvark/APP/frontend/build/standalone-min.html
+++ b/js/apps/system/_admin/aardvark/APP/frontend/build/standalone-min.html
@@ -378,6 +378,21 @@
+
+
+
+